Skip to content

Commit

Permalink
sagemathgh-36517: sage.misc.lazy_attribute: Add typestub file for p…
Browse files Browse the repository at this point in the history
…yright

    
<!-- ^^^^^
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 -->

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.
- [ ] 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
- 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#36517
Reported by: Matthias Köppe
Reviewer(s): Tobias Diez
  • Loading branch information
Release Manager committed Nov 2, 2023
2 parents 6536299 + 5d31354 commit 0de7167
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/sage/misc/lazy_attribute.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This type-stub file helps pyright understand the decorator @lazy_attribute.

# Adapted from https://github.com/python/typeshed/blob/b9640005eb586afdbe0a57bac2b88a7a12465069/stdlib/builtins.pyi#L1237-L1254
class lazy_attribute:
def __init__(
self,
f: Callable[[Any], Any] | None = ...
) -> None: ...
def __get__(self, a: Any, cls: type) -> Any: ...

0 comments on commit 0de7167

Please sign in to comment.