url-normalize icon indicating copy to clipboard operation
url-normalize copied to clipboard

Add type hints

Open scop opened this issue 3 years ago • 1 comments

This adds type hints to the entire tree. I'm not familiar with poetry, so not quite sure I got the dependencies right: with 3.6+, typing is in stdlib so no need to add a separate dependency; and I added mypy dev dep for 3.6+ only to follow what's being done with bandit, flake8, pylint and tox.

I did not feel like adding a separate config file for mypy config and it doesn't support pyproject.toml yet, so to check, invoke

mypy --config-file tox.ini url_normalize tests

I didn't find a place in the tree where the tool invocations would be specified, so there was no place I could add the above to.

Includes unrelated deconstruct_url docstring typo fix which I'm too lazy to submit separately.

scop avatar Dec 24 '20 12:12 scop

I should also note that a bunch of the hints are actually inaccurate on Python 2 with regards to bytes/str/unicode. I guess it would be possible to improve on that in case someone is interested in it, but I didn't feel like doing more towards that besides making mypy pass and them syntactically valid 2.x.

scop avatar Dec 24 '20 13:12 scop