Skip to content

Commit

Permalink
src/sage/schemes/toric/variety.py: Fix pyright 'is possibly unbound'
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Oct 23, 2023
1 parent 07a2afd commit a532055
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/sage/schemes/toric/variety.py
Original file line number Diff line number Diff line change
Expand Up @@ -2250,20 +2250,21 @@ def Todd_class(self, deg=None):
1
"""
Td = QQ.one()
if self.dimension() >= 1:
dim = self.dimension()
if dim >= 1:
c1 = self.Chern_class(1)
Td += QQ.one() / 2 * c1
if self.dimension() >= 2:
c2 = self.Chern_class(2)
Td += QQ.one() / 12 * (c1**2 + c2)
if self.dimension() >= 3:
Td += QQ.one() / 24 * c1*c2
if self.dimension() >= 4:
c3 = self.Chern_class(3)
c4 = self.Chern_class(4)
Td += -QQ.one() / 720 * (c1**4 - 4*c1**2*c2 - 3*c2**2 - c1*c3 + c4)
if self.dimension() >= 5:
raise NotImplementedError('Todd class is currently only implemented up to degree 4')
if dim >= 2:
c2 = self.Chern_class(2)
Td += QQ.one() / 12 * (c1**2 + c2)
if dim >= 3:
Td += QQ.one() / 24 * c1*c2
if dim >= 4:
c3 = self.Chern_class(3)
c4 = self.Chern_class(4)
Td += -QQ.one() / 720 * (c1**4 - 4*c1**2*c2 - 3*c2**2 - c1*c3 + c4)
if dim >= 5:
raise NotImplementedError('Todd class is currently only implemented up to degree 4')
if deg is None:
return Td
else:
Expand Down

0 comments on commit a532055

Please sign in to comment.