Skip to content

Fix static typing errors #26

@candleindark

Description

@candleindark

Currently, running static type checking via hatch run types:check 2>&1 produces the following output.

`hatch run types:check 2>&1` output
src/pydantic2linkml/tools.py:15: error: Skipping analyzing "linkml_runtime.linkml_model": module is installed, but missing library stubs or py.typed marker  [import-untyped]
src/pydantic2linkml/tools.py:16: error: Skipping analyzing "linkml_runtime.utils.formatutils": module is installed, but missing library stubs or py.typed marker  [import-untyped]
src/pydantic2linkml/tools.py:156: error: Dict entry 0 has incompatible type "str": "Callable[[AfterValidatorFunctionSchema | BeforeValidatorFunctionSchema | WrapValidatorFunctionSchema | PlainValidatorFunctionSchema], Mapping[str, Any]]"; expected "str": "Callable[[Mapping[str, Any]], Mapping[str, Any]]"  [dict-item]
src/pydantic2linkml/tools.py:157: error: Dict entry 1 has incompatible type "str": "Callable[[AfterValidatorFunctionSchema | BeforeValidatorFunctionSchema | WrapValidatorFunctionSchema | PlainValidatorFunctionSchema], Mapping[str, Any]]"; expected "str": "Callable[[Mapping[str, Any]], Mapping[str, Any]]"  [dict-item]
src/pydantic2linkml/tools.py:158: error: Dict entry 2 has incompatible type "str": "Callable[[AfterValidatorFunctionSchema | BeforeValidatorFunctionSchema | WrapValidatorFunctionSchema | PlainValidatorFunctionSchema], Mapping[str, Any]]"; expected "str": "Callable[[Mapping[str, Any]], Mapping[str, Any]]"  [dict-item]
src/pydantic2linkml/tools.py:159: error: Dict entry 3 has incompatible type "str": "Callable[[AfterValidatorFunctionSchema | BeforeValidatorFunctionSchema | WrapValidatorFunctionSchema | PlainValidatorFunctionSchema], Mapping[str, Any]]"; expected "str": "Callable[[Mapping[str, Any]], Mapping[str, Any]]"  [dict-item]
src/pydantic2linkml/tools.py:308: error: Argument 1 to "append" of "list" has incompatible type "T | V"; expected "T"  [arg-type]
src/pydantic2linkml/tools.py:309: error: Incompatible return value type (got "defaultdict[K, list[T]]", expected "defaultdict[K, list[V]]")  [return-value]
src/pydantic2linkml/gen_linkml.py:14: error: Skipping analyzing "linkml_runtime.linkml_model": module is installed, but missing library stubs or py.typed marker  [import-untyped]
src/pydantic2linkml/gen_linkml.py:21: error: Skipping analyzing "linkml_runtime.linkml_model.meta": module is installed, but missing library stubs or py.typed marker  [import-untyped]
src/pydantic2linkml/gen_linkml.py:22: error: Skipping analyzing "linkml_runtime.utils.schema_builder": module is installed, but missing library stubs or py.typed marker  [import-untyped]
src/pydantic2linkml/gen_linkml.py:62: error: Module has no attribute "all_literal_values"  [attr-defined]
src/pydantic2linkml/gen_linkml.py:121: error: Key expression in dictionary comprehension has incompatible type "type[Enum] | type[BaseModel]"; expected type "type[BaseModel]"  [misc]
src/pydantic2linkml/gen_linkml.py:121: error: Argument 1 to "get_locally_defined_fields" has incompatible type "type[Enum] | type[BaseModel]"; expected "type[BaseModel]"  [arg-type]
src/pydantic2linkml/gen_linkml.py:158: error: Item "ModelMetaclass" of "type[Enum] | type[BaseModel]" has no attribute "__iter__" (not iterable)  [union-attr]
src/pydantic2linkml/gen_linkml.py:965: error: TypedDict "PlainValidatorFunctionSchema" has no key "schema"  [typeddict-item]
src/pydantic2linkml/cli/__init__.py:6: error: Skipping analyzing "linkml_runtime.dumpers": module is installed, but missing library stubs or py.typed marker  [import-untyped]
src/pydantic2linkml/cli/__init__.py:6: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
tests/test_tools.py:10: error: Skipping analyzing "linkml_runtime.linkml_model": module is installed, but missing library stubs or py.typed marker  [import-untyped]
tests/test_tools.py:83: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:84: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:85: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:137: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:138: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:155: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:156: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:159: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:160: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:173: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:174: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:177: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:178: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:241: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:242: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:243: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:247: error: Incompatible types in assignment (expression has type "str | None", base class "A" defined the type as "str")  [assignment]
tests/test_tools.py:247: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:250: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:251: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tools.py:252: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:10: error: Skipping analyzing "linkml_runtime.linkml_model": module is installed, but missing library stubs or py.typed marker  [import-untyped]
tests/test_gen_linkml.py:11: error: Skipping analyzing "linkml_runtime.linkml_model.meta": module is installed, but missing library stubs or py.typed marker  [import-untyped]
tests/test_gen_linkml.py:174: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:194: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:202: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:214: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:233: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:256: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:295: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:334: error: Name "ptrn" is not defined  [name-defined]
tests/test_gen_linkml.py:338: error: Name "ptrn" is not defined  [name-defined]
tests/test_gen_linkml.py:357: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:403: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:453: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:515: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:600: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:628: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:663: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:685: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:810: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:850: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:866: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:869: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:872: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:892: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:905: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:917: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:918: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:921: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:922: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:925: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:926: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:929: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:939: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:962: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:965: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:996: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_gen_linkml.py:1040: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_cli.py:4: error: Skipping analyzing "linkml_runtime.linkml_model": module is installed, but missing library stubs or py.typed marker  [import-untyped]
Found 24 errors in 6 files (checked 14 source files)

Resolve as many of those errors as possible. If an error is not possible to resolve, consider the modifying configuration for mypy with justification clearly specified. In resolving these errors, consider resolving errors of the the same type in the same commits.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions