Skip to content

Commit dff2b2d

Browse files
author
Release Manager
committed
sagemathgh-36516: `sage.schemes.toric`: Remove pyright 'is possibly unbound' warnings <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> Just a single commit split out from sagemath#36443 to facilitate review. <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes sagemath#12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#36516 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee
2 parents f79dc7a + a532055 commit dff2b2d

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/sage/schemes/toric/variety.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2258,20 +2258,21 @@ def Todd_class(self, deg=None):
22582258
1
22592259
"""
22602260
Td = QQ.one()
2261-
if self.dimension() >= 1:
2261+
dim = self.dimension()
2262+
if dim >= 1:
22622263
c1 = self.Chern_class(1)
22632264
Td += QQ.one() / 2 * c1
2264-
if self.dimension() >= 2:
2265-
c2 = self.Chern_class(2)
2266-
Td += QQ.one() / 12 * (c1**2 + c2)
2267-
if self.dimension() >= 3:
2268-
Td += QQ.one() / 24 * c1*c2
2269-
if self.dimension() >= 4:
2270-
c3 = self.Chern_class(3)
2271-
c4 = self.Chern_class(4)
2272-
Td += -QQ.one() / 720 * (c1**4 - 4*c1**2*c2 - 3*c2**2 - c1*c3 + c4)
2273-
if self.dimension() >= 5:
2274-
raise NotImplementedError('Todd class is currently only implemented up to degree 4')
2265+
if dim >= 2:
2266+
c2 = self.Chern_class(2)
2267+
Td += QQ.one() / 12 * (c1**2 + c2)
2268+
if dim >= 3:
2269+
Td += QQ.one() / 24 * c1*c2
2270+
if dim >= 4:
2271+
c3 = self.Chern_class(3)
2272+
c4 = self.Chern_class(4)
2273+
Td += -QQ.one() / 720 * (c1**4 - 4*c1**2*c2 - 3*c2**2 - c1*c3 + c4)
2274+
if dim >= 5:
2275+
raise NotImplementedError('Todd class is currently only implemented up to degree 4')
22752276
if deg is None:
22762277
return Td
22772278
else:

0 commit comments

Comments
 (0)