-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved the type stubs in the _libs directory to help with type checking #43744
Conversation
@@ -0,0 +1,3 @@ | |||
|
|||
cache_readonly = property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will need many ignore statements, since there are quite a few places where a typed cache_readonly
will reveal existing type issues (until now, mypy couldn't find cache_readonly
).
I think you will also need to add annotations for AxisProperty
as that is important elsewhere. It would be great to have partial type-stubs.
VALID_CLOSED: FrozenSet[str] | ||
|
||
def intervals_to_interval_bounds( | ||
intervals: np.ndarray, valdiate_closed: bool = ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
valdiate_closed -> validate_closed
@property | ||
def rule_code(self) -> str: ... | ||
def freqstr(self) -> str: ... | ||
# Next one is problematic due to circular imports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do it inside a if TYPE_CHECKING
block
@@ -0,0 +1,8 @@ | |||
class C_NAType: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any benefit/reason to include the C class.
@@ -13,6 +13,7 @@ iNaT: int | |||
nat_strings: set[str] | |||
|
|||
def is_null_datetimelike(val: object, inat_is_null: bool = ...) -> bool: ... | |||
def checknull_with_nat(val: object) -> bool: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to expose this to python code.
This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this. |
@erictraut If you don't have time for this PR, I wouldn't mind forking your branch, rebasing it, and making adjustments to get it merged (after #43828 is merged). Out of curiosity: Did pyright generate the type annotations in this PR or are they from Microsoft's pandas type stubs? |
@twoertwein, thanks for offering. Yeah, I'd appreciate it if you'd take over this PR. Addressing its issues involved more complexity than I anticipated. These type annotations are based on Microsoft's pandas type stubs plus some additional hand-written signatures. They weren't auto-generated by pyright. |
pls rebase |
I think this PR could be closed (but please don't delete the fork). I cherry-pick parts of this PR into more manageable portions. |
closing as per @twoertwein comment #43744 (comment) |
This doesn't change any code, so it should have no impact on runtime behavior.