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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃悜 Add seperate typing hints for humanize #150
Commits on Aug 26, 2020
-
馃悜 Add seperate typing hints for humanize
Adds a collection of `.pyi` files that describe the expected type signatures of the publicly available `humanize` functions. A `MANIFEST.in` file has been added to include the new `.pyi` files and the `py.typed` file to indicate to mypy that this package supports typing. mypy has been added to the pre-commit configuration to check the stubs. Some of the signatures are slightly optimistic, since depending on error conditions, different types are returned.
Configuration menu - View commit details
-
Copy full SHA for 1cdd1d9 - Browse repository at this point
Copy the full SHA 1cdd1d9View commit details
Commits on Oct 2, 2020
-
Configuration menu - View commit details
-
Copy full SHA for 69076c5 - Browse repository at this point
Copy the full SHA 69076c5View commit details -
馃悜 Remove stubs, add typing to functions
It is better to include typing hints directly in the functions that they're describing; which allows mypy to actually check the functions, both in their execution, and that they are actually returning the appropriate values. The major change here is that previously a number of the functions, if they encountered a conversion error, would return the value unchanged. However, that would require just declaring the return type as Any, which although correct, isn't particularly useful. So instead, any failed, unconvertable, inconsistent values will just have `str` called on them, and the output will returned. The function will always return a string, although sometimes it won't be in the format you expect. In addition, some internal variables inside the function have been rearranged and moved around, to avoid changing the type of an already defined variable.
Configuration menu - View commit details
-
Copy full SHA for 5091835 - Browse repository at this point
Copy the full SHA 5091835View commit details
Commits on Oct 7, 2020
-
Configuration menu - View commit details
-
Copy full SHA for f4e46d9 - Browse repository at this point
Copy the full SHA f4e46d9View commit details -
馃拃 Remove non-required MANIFEST.in file
Originally only included this file to include the `.pyi` files in the package, but it turns out it was redundant, and we don't have `.pyi` files anymore.
Configuration menu - View commit details
-
Copy full SHA for 0239209 - Browse repository at this point
Copy the full SHA 0239209View commit details -
馃寜 Use typing_extensions for Literal typing
Instead of using `typing.Literal`, which was only added in Python 3.7, make the type annotations strings, preventing their execution in the interpreter, and use `typing_extensions` to provide Literal.
Configuration menu - View commit details
-
Copy full SHA for fb53a7e - Browse repository at this point
Copy the full SHA fb53a7eView commit details -
馃毃 Fix test failures through change in API
In order to make the typing accurate, the failure case was changed in multiple functions from "return the object unchanged", to "return the string representation of the object". As such, a number of tests all needed to be updated.
Configuration menu - View commit details
-
Copy full SHA for 899bdfa - Browse repository at this point
Copy the full SHA 899bdfaView commit details