-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Enforce ruff/flake8-pyi rules (PYI) #10359
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
Changes from all commits
cd84e5b
433f52f
2a0f233
51b7594
321a8f9
8cd0e1a
4bc134a
75a2110
ec70982
382bde2
0fea8f4
775655e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,7 +214,7 @@ def copy( | |
|
||
# FYI in some cases we don't allow `None`, which this doesn't take account of. | ||
# FYI the `str` is for a size string, e.g. "16MB", supported by dask. | ||
T_ChunkDim: TypeAlias = str | int | Literal["auto"] | None | tuple[int, ...] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the intent was to have int, tuple of int or "auto" — not any string. I hope I'm not wrong. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check comment above :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was so busy scavenging the reference documentation for a hint that I didn't see the comment 😕 Reverted and added |
||
T_ChunkDim: TypeAlias = str | int | Literal["auto"] | None | tuple[int, ...] # noqa: PYI051 | ||
T_ChunkDimFreq: TypeAlias = Union["TimeResampler", T_ChunkDim] | ||
T_ChunksFreq: TypeAlias = T_ChunkDim | Mapping[Any, T_ChunkDimFreq] | ||
# We allow the tuple form of this (though arguably we could transition to named dims only) | ||
|
@@ -329,7 +329,7 @@ def mode(self) -> str: | |
# for _get_filepath_or_buffer | ||
... | ||
|
||
def seek(self, __offset: int, __whence: int = ...) -> int: | ||
def seek(self, offset: int, whence: int = ..., /) -> int: | ||
# with one argument: gzip.GzipFile, bz2.BZ2File | ||
# with two arguments: zip.ZipFile, read_sas | ||
... | ||
|
@@ -345,7 +345,7 @@ def tell(self) -> int: | |
|
||
@runtime_checkable | ||
class ReadBuffer(BaseBuffer, Protocol[AnyStr_co]): | ||
def read(self, __n: int = ...) -> AnyStr_co: | ||
def read(self, n: int = ..., /) -> AnyStr_co: | ||
# for BytesIOWrapper, gzip.GzipFile, bz2.BZ2File | ||
... | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -39,7 +39,6 @@ class Default(Enum): | |||
_default = Default.token | ||||
|
||||
# https://stackoverflow.com/questions/74633074/how-to-type-hint-a-generic-numpy-array | ||||
_T = TypeVar("_T") | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we keep this (private) type even though it is not used? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we stopped using it, unless the link in the line above is relevant? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I may be mistaken, but https://stackoverflow.com/questions/74633074/how-to-type-hint-a-generic-numpy-array does not seem relevant to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's defined locally elsewhere: xarray/xarray/computation/rolling.py Line 35 in d589df1
It looks like the more global definition in |
||||
_T_co = TypeVar("_T_co", covariant=True) | ||||
|
||||
_dtype = np.dtype | ||||
|
@@ -79,7 +78,7 @@ def dtype(self) -> _DType_co: ... | |||
_NormalizedChunks = tuple[tuple[int, ...], ...] | ||||
# FYI in some cases we don't allow `None`, which this doesn't take account of. | ||||
# # FYI the `str` is for a size string, e.g. "16MB", supported by dask. | ||||
T_ChunkDim: TypeAlias = str | int | Literal["auto"] | None | tuple[int, ...] | ||||
T_ChunkDim: TypeAlias = str | int | Literal["auto"] | None | tuple[int, ...] # noqa: PYI051 | ||||
# We allow the tuple form of this (though arguably we could transition to named dims only) | ||||
T_Chunks: TypeAlias = T_ChunkDim | Mapping[Any, T_ChunkDim] | ||||
|
||||
|
Uh oh!
There was an error while loading. Please reload this page.