Skip to content

add type annotations to io\formats\html.py #27355

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 3 commits into from
Jul 12, 2019

Conversation

simonjayhawkins
Copy link
Member

No description provided.

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Jul 12, 2019
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job on these. Optional comment but otherwise lgtm

esc = OrderedDict([("&", r"&amp;"), ("<", r"&lt;"), (">", r"&gt;")])
esc = OrderedDict(
[("&", r"&amp;"), ("<", r"&lt;"), (">", r"&gt;")]
) # type: Union[OrderedDict[str, str], Dict]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think also OK to just make this an ordereddict all of the time; simplifies annotation and code

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was getting pandas\io\formats\html.py:145: error: Incompatible types in assignment (expression has type "Dict[<nothing>, <nothing>]", variable has type "OrderedDict[str, str]")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I so meant you could change the dict on line 145 to be an OrderedDict to match the signature here. I think OK to refactor code if it simplifies annotations and keeps same functionality, as there probably helps readability too

Though this is obviously fine as is too!

@WillAyd WillAyd added this to the 0.25.0 milestone Jul 12, 2019
@jreback jreback merged commit baba98c into pandas-dev:master Jul 12, 2019
@jreback
Copy link
Contributor

jreback commented Jul 12, 2019

thanks @simonjayhawkins really nice!

@simonjayhawkins simonjayhawkins deleted the typing-to-html branch July 12, 2019 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants