-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TYPING: add type hints to pandas\io\formats\printing.py #27579
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
TYPING: add type hints to pandas\io\formats\printing.py #27579
Conversation
pandas/io/formats/printing.py
Outdated
|
||
from pandas._config import get_option | ||
|
||
from pandas.core.dtypes.inference import is_sequence | ||
|
||
|
||
def adjoin(space, *lists, **kwargs): | ||
def adjoin(space: int, *lists: str, **kwargs) -> str: |
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 mean all the lists are strings?
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.
nice catch. should be List[str]. will update.
pandas/io/formats/printing.py
Outdated
sep = str(sep) | ||
return sep.join([x.decode("utf-8") if isinstance(x, str) else x for x in lines]) | ||
def _join_unicode(lines: Iterable[str], sep: str = "") -> str: | ||
return sep.join(lines) |
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.
Likely no longer needed?
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.
only used in two places. inline and remove?
lgtm. @WillAyd |
if hasattr(obj, "dtype") and include_dtype: | ||
attrs.append(("dtype", "'{}'".format(obj.dtype))) | ||
# error: "Sequence[Any]" has no attribute "dtype" |
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.
Hmm this type of introspection is going to be interesting with annotations. Something to think about moving forward
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.
see python/mypy#1424
Thanks @simonjayhawkins ! |
No description provided.