-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: parsers.pyi #40508
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
Merged
Merged
TYP: parsers.pyi #40508
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
bc296ce
TYP: parsers.pyi
jbrockmendel e127ce0
Any->Hashable
jbrockmendel 11dc57d
Merge branch 'master' into typ-libs-6
jbrockmendel 542d803
Merge branch 'master' into typ-libs-6
jbrockmendel 601dd5f
Merge branch 'master' into typ-libs-6
jbrockmendel b8a9fa6
Merge branch 'master' into typ-libs-6
jbrockmendel 429cb86
mypy fixup
jbrockmendel 3f31021
Merge branch 'master' into typ-libs-6
jbrockmendel 270ea85
Merge branch 'master' into typ-libs-6
jbrockmendel 82acddc
mypy fixup
jbrockmendel 7700fa9
Merge branch 'master' into typ-libs-6
jbrockmendel d60e885
Merge branch 'master' into typ-libs-6
jbrockmendel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,77 @@ | ||||||
from typing import ( | ||||||
Any, | ||||||
Literal, | ||||||
) | ||||||
|
||||||
import numpy as np | ||||||
|
||||||
from pandas._typing import ( | ||||||
ArrayLike, | ||||||
Dtype, | ||||||
) | ||||||
|
||||||
STR_NA_VALUES: set[str] | ||||||
|
||||||
|
||||||
def sanitize_objects( | ||||||
values: np.ndarray, # ndarray[object] | ||||||
na_values: set, | ||||||
convert_empty: bool = ..., | ||||||
) -> int: ... | ||||||
|
||||||
|
||||||
class TextReader: | ||||||
unnamed_cols: set[str] | ||||||
table_width: int # int64_t | ||||||
leading_cols: int # int64_t | ||||||
header: list[list[int]] # non-negative integers | ||||||
|
||||||
def __init__( | ||||||
self, | ||||||
source, | ||||||
delimiter: bytes | str = ..., # single-character only | ||||||
header=0, | ||||||
header_start=0, | ||||||
header_end=0, | ||||||
index_col=..., | ||||||
names=..., | ||||||
tokenize_chunksize: int = ..., # int64_t | ||||||
delim_whitespace: bool = ..., | ||||||
converters=..., | ||||||
skipinitialspace: bool = ..., | ||||||
escapechar: bytes | str | None = ..., # single-character only | ||||||
doublequote: bool = ..., | ||||||
quotechar: str | bytes | None = ..., # at most 1 character | ||||||
quoting: int = ..., | ||||||
lineterminator: bytes | str | None = ..., # at most 1 character | ||||||
comment=..., | ||||||
decimal: bytes | str = ..., # single-character only | ||||||
thousands: bytes | str | None = ..., # single-character only | ||||||
dtype: Dtype | dict[Any, Dtype] = ..., | ||||||
usecols=..., | ||||||
error_bad_lines: bool = ..., | ||||||
warn_bad_lines: bool = ..., | ||||||
na_filter: bool = ..., | ||||||
na_values=..., | ||||||
na_fvalues=..., | ||||||
keep_default_na: bool = ..., | ||||||
true_values=..., | ||||||
false_values=..., | ||||||
allow_leading_cols: bool = ..., | ||||||
low_memory: bool = ..., | ||||||
skiprows=..., | ||||||
skipfooter: int = ..., # int64_t | ||||||
verbose: bool = ..., | ||||||
mangle_dupe_cols: bool = ..., | ||||||
float_precision: Literal["round_trip", "legacy", "high"] | None = ..., | ||||||
skip_blank_lines: bool = ..., | ||||||
encoding_errors: bytes | str = ... | ||||||
): ... | ||||||
|
||||||
def set_error_bad_lines(self, status: int) -> None: ... | ||||||
def set_noconvert(self, i: int) -> None: ... | ||||||
def remove_noconvert(self, i: int) -> None: ... | ||||||
|
||||||
def close(self) -> None: ... | ||||||
|
||||||
def read(self, rows: int | None = None) -> dict[int, ArrayLike]: ... | ||||||
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.
Suggested change
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
we want to avoid using Any, maybe could use Hashable. (which is effectively Any for a dictionary key)
this fails with
error: Dict entry 0 has incompatible type "List[<nothing>]": "int"; expected "Hashable": "int" [dict-item]
but this passes mypy checks
although granted you can't create a dict with an unhashable key