Skip to content

fix: correct get_metadata return annotations - #2424

Open
Gagandeep-2003 wants to merge 1 commit into
unionai-oss:mainfrom
Gagandeep-2003:bugfix/1750
Open

fix: correct get_metadata return annotations#2424
Gagandeep-2003 wants to merge 1 commit into
unionai-oss:mainfrom
Gagandeep-2003:bugfix/1750

Conversation

@Gagandeep-2003

Copy link
Copy Markdown

Summary

  • Correct the return annotations of DataFrameModel.get_metadata() and DataFrameSchema.get_metadata() from dict | None to dict[Any, Any].
  • Add static typing regression coverage using Pandera’s existing no-plugin mypy test setup.

Both methods always return dictionaries, so callers should not need to handle an impossible None value. This change only corrects the public type annotations and does not alter runtime behavior.

Closes #1750

Tests

    • .venv/bin/python -m mypy tests/mypy/pandas_modules/pandera_metadata.py --config-file tests/mypy/config/no_plugin.ini
  • .venv/bin/python -m pytest tests/mypy/test_pandas_static_type_checking.py -q
  • .venv/bin/python -m pytest tests/pandas/test_schemas.py::test_get_schema_metadata tests/pandas/test_model.py::test_pandas_fields_metadata -q
  • .venv/bin/python -m pytest tests/pandas/test_model.py tests/pandas/test_schemas.py -q
  • prek run --files pandera/api/dataframe/container.py pandera/api/dataframe/model.py tests/mypy/pandas_modules/pandera_metadata.py tests/mypy/test_pandas_static_type_checking.py

Signed-off-by: Gagandeep-2003 <gagandeeppctebca21a@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DataFrameModel.get_metadata should not be typed Optional

1 participant