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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve mypy typing performance #387

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 39 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ include = [
]

[dependencies]
# required since `Py_Ellipsis` fails on windows, see https://github.com/PyO3/pyo3/pull/2911
pyo3 = { git = "https://github.com/PyO3/pyo3", branch = "release-0.18.1" }
#pyo3 = "0.18.0"
pyo3 = "0.18.1"
regex = "1.6.0"
strum = { version = "0.24.1", features = ["derive"] }
strum_macros = "0.24.3"
Expand Down Expand Up @@ -67,6 +65,4 @@ strip = true
[build-dependencies]
version_check = "0.9.4"
# used where logic has to be version/distribution specific, e.g. pypy
# FIXME change when `pyo3` above is updated
pyo3-build-config = { git = "https://github.com/PyO3/pyo3", branch = "release-0.18.1" }
#pyo3 = "0.18.0"
pyo3-build-config = "0.18.1"
10 changes: 5 additions & 5 deletions generate_self_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ def type_dict_schema(typed_dict) -> dict[str, Any]: # noqa: C901
if matched:
required = True

if 'CoreSchema' == fr_arg or re.search('[^a-zA-Z]CoreSchema', fr_arg):
if fr_arg == 'CoreSchema':
if 'CoreSchemaBase' == fr_arg or re.search('[^a-zA-Z]CoreSchemaBase', fr_arg):
if fr_arg == 'CoreSchemaBase':
schema = schema_ref_validator
elif fr_arg == 'List[CoreSchema]':
elif fr_arg == 'List[CoreSchemaBase]':
schema = {'type': 'list', 'items_schema': schema_ref_validator}
elif fr_arg == 'Dict[str, CoreSchema]':
elif fr_arg == 'Dict[str, CoreSchemaBase]':
schema = {'type': 'dict', 'keys_schema': {'type': 'str'}, 'values_schema': schema_ref_validator}
elif fr_arg == 'Dict[str, Union[str, CoreSchema]]':
elif fr_arg == 'Dict[str, Union[str, CoreSchemaBase]]':
schema = {
'type': 'dict',
'keys_schema': {'type': 'str'},
Expand Down
Loading