Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
adding stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
hlafaille committed May 23, 2023
1 parent c18ec24 commit 125fc6c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from distutils.core import setup
from Cython.Build import cythonize

# todo add "embedsignature.format" directive, set it to python when new Cython release comes out
setup(
name='tenforce',
ext_modules=cythonize(["tenforce/enforcer.pyx"])
ext_modules=cythonize(["tenforce/enforcer.pyx"]),
package_data={
"tenforce": ["py.typed", "enforcer.pyi"]
}
)
5 changes: 3 additions & 2 deletions tenforce/enforcer.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def check(obj: object, auto_cast: bool = False) -> None:
def check(obj: object, auto_cast: bool) -> None:
"""
Checks the class variables of an object & enforces its type hints
:param obj: Instance of a class
:param auto_cast: Optional, automatically cast things like
:return: None
"""
"""
...
2 changes: 1 addition & 1 deletion tenforce/enforcer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ cpdef ParsedMember _parse_member(str class_name, str member_name, type annotatio
return parsed_member


cpdef check(object obj: object, bint auto_cast: bool = False):
cpdef check(object obj, bint auto_cast = False):
"""
Checks the class variables of an object & enforces its type hints
:param obj: Instance of a class
Expand Down

0 comments on commit 125fc6c

Please sign in to comment.