-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: sas, stata, style #36990
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
TYP: sas, stata, style #36990
Conversation
pandas/io/sas/sas7bdat.py
Outdated
@@ -63,11 +64,21 @@ def _convert_datetimes(sas_datetimes: pd.Series, unit: str) -> pd.Series: | |||
|
|||
|
|||
class _subheader_pointer: | |||
pass | |||
def __init__(self, offset, length, compression, ptype): |
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.
can you defin the types? (alt you can define attributes on the class)
pandas/io/sas/sas7bdat.py
Outdated
@@ -63,11 +64,21 @@ def _convert_datetimes(sas_datetimes: pd.Series, unit: str) -> pd.Series: | |||
|
|||
|
|||
class _subheader_pointer: |
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.
while why are at it, shouldn't these follow pep?
else: | ||
buf = path_or_buf | ||
|
||
self._path_or_buf: IO[Any] = buf |
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.
define as a class attribute?
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.
some requests i think are worth doing here
# mypy doesnt like dynamically-defined class | ||
# error: Variable "cls" is not valid as a type [valid-type] | ||
# error: Invalid base class "cls" [misc] | ||
class MyStyler(cls): # type:ignore[valid-type,misc] |
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.
does this resolve if using an appropriate constructor like: https://docs.python.org/3.7/library/types.html (or the old type constructor)
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 didnt know that types.new_class
was a thing. id rather keep the more-idiomatic usage even if mypy doesnt like it
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.
ok
pass | ||
|
||
class _Column: | ||
col_id: int |
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.
could be a dataclass to avoid this repetition
fair, merge on green-ish |
followups appreciated here |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff