python-enforce-typing icon indicating copy to clipboard operation
python-enforce-typing copied to clipboard

An easy to use decorator to enforce static typing for function and dataclasses.

Results 8 python-enforce-typing issues
Sort by recently updated
recently updated
newest added

Right now, using `Literal[x]` where `x` is not a type raises an error: ```python @enforce_types @dataclass class Foo: foo: Literal[True] Foo(foo=True) # => TypeError: isinstance() arg 2 must be a...

Hi, I found your project when I was about to write the same thing. Thank you for sharing! I cleaned it up a bit, to make the decorator implementation more...

Hi All, Can we add a coerce=True boolean flag to the enforce_typing decorator, so that if coercable types are found, we dont fail? For example assume the variable x is...

running a simple example out of the box fails: ```python from typing import List from enforce_typing import enforce_types @enforce_types def test(abc: List = []): return abc test([]) ``` ``` ---------------------------------------------------------------------------...

As far as I can tell, class object types as described by [PEP 484: The type of class objects](https://www.python.org/dev/peps/pep-0484/#id33) are not supported. Would it be possible to support them?

Your README gives the impression that you support collection types like `Dict[str, Tuple[int, int]]`. That's arguably a bit misleading, since only the outermost type is enforced. E.g., the following works...

Hello, would it be possible to add git tags when a new version is released?

In Python 3.7, type enforcing creates an error with the example code below. Given that this is valid Python, I would expect that this runs (even if the inner `str`...