Skip to content

Commit ff67b44

Browse files
author
Release Manager
committed
gh-36517: `sage.misc.lazy_attribute`: Add typestub file for pyright <!-- ^^^^^ 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 #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> Split out from #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 #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. - [ ] The description explains in detail what this PR is about. - [ ] 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 - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36517 Reported by: Matthias Köppe Reviewer(s): Tobias Diez
2 parents 41625b8 + 5d31354 commit ff67b44

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/sage/misc/lazy_attribute.pyi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This type-stub file helps pyright understand the decorator @lazy_attribute.
2+
3+
# Adapted from https://github.com/python/typeshed/blob/b9640005eb586afdbe0a57bac2b88a7a12465069/stdlib/builtins.pyi#L1237-L1254
4+
class lazy_attribute:
5+
def __init__(
6+
self,
7+
f: Callable[[Any], Any] | None = ...
8+
) -> None: ...
9+
def __get__(self, a: Any, cls: type) -> Any: ...

0 commit comments

Comments
 (0)