File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -132,8 +132,10 @@ jobs:
132132 pre-commit run --hook-stage manual ruff-format --all-files --show-diff-on-failure
133133 env :
134134 RUFF_OUTPUT_FORMAT : github
135- # - name: Run mypy
136- # run: mypy pyesef
135+ - name : Run mypy
136+ run : |
137+ source .venv/bin/activate
138+ pre-commit run --hook-stage manual mypy --all-files --show-diff-on-failure
137139
138140 pytest :
139141 name : Run test suite
Original file line number Diff line number Diff line change @@ -20,3 +20,13 @@ repos:
2020 - id : no-commit-to-branch
2121 args :
2222 - --branch=main
23+ - repo : local
24+ hooks :
25+ - id : mypy
26+ name : mypy
27+ entry : >
28+ ./script/run-in-env.sh mypy --config-file pyproject.toml
29+ language : script
30+ types : [python]
31+ require_serial : true
32+ files : ^pygleif/.+\.py$
Original file line number Diff line number Diff line change @@ -127,11 +127,11 @@ class Links(BaseSchema):
127127class Relationships (BaseSchema ):
128128 """Represent a relationships ."""
129129
130- managing_lou : Links = None
131- lei_issuer : Links = None
132- field_modifications : Links = None
133- direct_parent : Links = None
134- ultimate_parent : Links = None
130+ managing_lou : Links | None = None
131+ lei_issuer : Links | None = None
132+ field_modifications : Links | None = None
133+ direct_parent : Links | None = None
134+ ultimate_parent : Links | None = None
135135
136136
137137class Data (BaseSchema ):
Original file line number Diff line number Diff line change @@ -29,15 +29,15 @@ class PyGleifBase(ABC):
2929 search_string : str
3030
3131 @property
32- def json_response (self ) -> list [ Any ] | dict [Any , Any ]:
32+ def json_response (self ) -> dict [Any , Any ]:
3333 """Return JSON response."""
3434 full_url = f"{ self .BASE_URL } { self .search_string } "
3535 try :
3636 with request .urlopen (
3737 full_url ,
3838 timeout = self .TIMEOUT_SECOND ,
3939 ) as fdesc :
40- return cast (dict [Any , Any ] | list [ Any ] , json .loads (fdesc .read ()))
40+ return cast (dict [Any , Any ], json .loads (fdesc .read ()))
4141 except error .HTTPError as e :
4242 if e .code == HttpErrorCodes .NOT_FOUND :
4343 raise PyGLEIFApiError (f"Resource { full_url } not found" )
Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ version = {file = "pygleif/VERSION"}
4949[tool .setuptools .packages .find ]
5050exclude = [" tests" , " tests*" ]
5151
52+ [tool .setuptools .package-data ]
53+ "pygleif" = [" py.typed" ]
54+
5255[tool .pytest .ini_options ]
5356testpaths = [
5457 " tests" ,
@@ -120,3 +123,8 @@ known-first-party = [
120123 " pygleif" ,
121124 " tests" ,
122125]
126+
127+ [tool .mypy ]
128+ python_version = " 3.11"
129+ strict = true
130+ plugins = " pydantic.mypy"
You can’t perform that action at this time.
0 commit comments