Skip to content
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

Closed
wants to merge 7 commits into from

Commits on Aug 26, 2020

  1. 馃悜 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.
    coiax committed Aug 26, 2020
    Configuration menu
    Copy the full SHA
    1cdd1d9 View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2020

  1. Configuration menu
    Copy the full SHA
    69076c5 View commit details
    Browse the repository at this point in the history
  2. 馃悜 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.
    coiax committed Oct 2, 2020
    Configuration menu
    Copy the full SHA
    5091835 View commit details
    Browse the repository at this point in the history

Commits on Oct 7, 2020

  1. Configuration menu
    Copy the full SHA
    f4e46d9 View commit details
    Browse the repository at this point in the history
  2. 馃拃 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.
    coiax committed Oct 7, 2020
    Configuration menu
    Copy the full SHA
    0239209 View commit details
    Browse the repository at this point in the history
  3. 馃寜 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.
    coiax committed Oct 7, 2020
    Configuration menu
    Copy the full SHA
    fb53a7e View commit details
    Browse the repository at this point in the history
  4. 馃毃 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.
    coiax committed Oct 7, 2020
    Configuration menu
    Copy the full SHA
    899bdfa View commit details
    Browse the repository at this point in the history