Draft
Conversation
- Add mypy override to ignore missing linkml_runtime type stubs - Cast strip_function_schema for UNNEEDED_WRAPPING_SCHEMA_TYPE_TO_STRIP_FUNC dict - Add @overload signatures for bucketize() to fix return type - Add type: ignore for pydantic internal attr access (all_literal_values) - Properly type model_lst and enum_lst in LinkmlGenerator.__init__ - Add type: ignore for PlainValidatorFunctionSchema missing 'schema' key - Add type: ignore for intentional incompatible override in test - Replace walrus operator usage in parametrize with explicit values Co-authored-by: candleindark <12135617+candleindark@users.noreply.github.com>
Co-authored-by: candleindark <12135617+candleindark@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix static typing errors in tools.py
Fix all mypy static typing errors
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hatch run types:checkreported 24 errors across 6 files. This resolves all of them.pyproject.toml[[tool.mypy.overrides]]to ignore missinglinkml_runtime.*stubs (no py.typed marker upstream)src/pydantic2linkml/tools.pystrip_function_schemato matchCallable[[CoreSchema], CoreSchema]dict value type (contravariance mismatch withAnyFunctionSchemaparameter)@overloadsignatures tobucketize()so return type correctly reflects whethervalue_funcis provided:src/pydantic2linkml/gen_linkml.pyto_sorted_lsthelper with explicitly typedmodel_lst: list[type[BaseModel]]andenum_lst: list[type[Enum]]— fixes 3 downstream errors (dict-key,arg-type,union-attr)type: ignore[attr-defined]for_typing_extra.all_literal_values(renamed toliteral_valuesin Pydantic 2.10)type: ignore[typeddict-item]forschema["schema"]access guarded bymode != "plain"(mypy can't narrow union of TypedDicts via string comparison)Tests
type: ignore[assignment]on intentional incompatible override intest_tools.py:=in@pytest.mark.parametrizetuples with explicit literals (mypy doesn't track assignment expressions in decorator args)Original prompt
This section details on the original issue you should resolve
<issue_title>Fix static typing errors</issue_title>
<issue_description>Currently, running static type checking via
hatch run types:check 2>&1produces the following output.`hatch run types:check 2>&1` output