Skip to content

Work on mypy

I propose to work on mypy errors:

 make mypy
/home/ycolera/.pixi/bin/pixi run --frozen -q --no-progress -e dev mypy src/ tests/ scripts/
tests/test_perceiver_upstream.py:6: error: Skipping analyzing "perceiver.model.core": module is installed, but missing library stubs or py.typed marker  [import-untyped]
tests/test_perceiver_upstream.py:7: error: Skipping analyzing "perceiver.model.vision.image_classifier.backend": module is installed, but missing library stubs or py.typed marker  [import-untyped]
src/releo_mvp/models/positional_encoding.py:6: error: Skipping analyzing "einops": module is installed, but missing library stubs or py.typed marker  [import-untyped]
src/releo_mvp/data/tokens.py:9: error: Skipping analyzing "einops": module is installed, but missing library stubs or py.typed marker  [import-untyped]
scripts/generate_aois.py:19: error: Skipping analyzing "geopandas": module is installed, but missing library stubs or py.typed marker  [import-untyped]
scripts/generate_aois.py:23: error: Skipping analyzing "rasterio": module is installed, but missing library stubs or py.typed marker  [import-untyped]
scripts/generate_aois.py:24: error: Skipping analyzing "affine": module is installed, but missing library stubs or py.typed marker  [import-untyped]
scripts/generate_aois.py:210: error: Incompatible return value type (got "Path", expected "str")  [return-value]
scripts/generate_aois.py:218: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[float64]]", variable has type "Polygon")  [assignment]
scripts/generate_aois.py:219: error: Value of type "Polygon" is not indexable  [index]
scripts/generate_aois.py:220: error: Value of type "Polygon" is not indexable  [index]
scripts/generate_aois.py:253: error: Bracketed expression "[...]" is not valid as a type  [valid-type]
scripts/generate_aois.py:604: error: "dict[Any, Any]" has no attribute "aoi_file"  [attr-defined]
scripts/generate_aois.py:604: error: "dict[Any, Any]" has no attribute "force"  [attr-defined]
scripts/generate_aois.py:607: error: "dict[Any, Any]" has no attribute "aoi_file"  [attr-defined]
scripts/generate_aois.py:615: error: "dict[Any, Any]" has no attribute "select_tiles"  [attr-defined]
scripts/generate_aois.py:617: error: "dict[Any, Any]" has no attribute "select_tiles"  [attr-defined]
scripts/generate_aois.py:628: error: Need type annotation for "df" (hint: "df: dict[<type>, <type>] = ...")  [var-annotated]
scripts/generate_aois.py:639: error: Incompatible types in assignment (expression has type "DataFrame", variable has type "dict[Any, Any]")  [assignment]
scripts/generate_aois.py:640: error: "dict[Any, Any]" has no attribute "geometry"  [attr-defined]
scripts/generate_aois.py:642: error: "dict[Any, Any]" has no attribute "aoi_file"  [attr-defined]
scripts/generate_aois.py:651: error: "dict[Any, Any]" has no attribute "aoi_file"  [attr-defined]
scripts/generate_aois.py:671: error: "dict[Any, Any]" has no attribute "limit_stats"  [attr-defined]
scripts/generate_aois.py:672: error: "dict[Any, Any]" has no attribute "limit_stats"  [attr-defined]
scripts/generate_aois.py:680: error: "dict[Any, Any]" has no attribute "aoi_file"  [attr-defined]
scripts/generate_aois.py:682: error: "dict[Any, Any]" has no attribute "seed"  [attr-defined]
scripts/generate_aois.py:683: error: "dict[Any, Any]" has no attribute "seed"  [attr-defined]
scripts/generate_aois.py:684: error: "dict[Any, Any]" has no attribute "seed"  [attr-defined]
scripts/generate_aois.py:690: error: "dict[Any, Any]" has no attribute "min_strata_size"  [attr-defined]
scripts/generate_aois.py:693: error: "dict[Any, Any]" has no attribute "aoi_file"  [attr-defined]
scripts/generate_aois.py:704: error: "dict[Any, Any]" has no attribute "max_nb_samples_per_strata"  [attr-defined]
scripts/generate_aois.py:704: error: "dict[Any, Any]" has no attribute "min_nb_samples_per_strata"  [attr-defined]
scripts/generate_aois.py:714: error: "dict[Any, Any]" has no attribute "max_nb_samples_per_strata"  [attr-defined]
scripts/generate_aois.py:721: error: "dict[Any, Any]" has no attribute "output"  [attr-defined]
src/releo_mvp/data/sample_utils.py:298: error: Incompatible default for argument "tokenizer" (default has type "Callable[[Sample, TokenizationConfig], dict[SequenceElementContent, slice[Any, Any, Any]]]", argument has type "Callable[[[Sample, VarArg(Any), KwArg(Any)]], dict[SequenceElementContent, slice[Any, Any, Any]]]")  [assignment]
src/releo_mvp/data/sample_utils.py:301: error: Argument 1 has incompatible type "Sample"; expected "[Sample, VarArg(Any), KwArg(Any)]"  [arg-type]
src/releo_mvp/data/sample_utils.py:311: error: Argument 1 to "__delitem__" of "dict" has incompatible type "Enum"; expected "SensorTag | AuxDataTag"  [arg-type]
src/releo_mvp/data/dataset_utils.py:96: error: Skipping analyzing "einops": module is installed, but missing library stubs or py.typed marker  [import-untyped]
src/releo_mvp/data/dataset_utils.py:96: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
tests/test_datasets.py:151: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/test_tokens.py:95: error: Argument 1 to "__delitem__" of "dict" has incompatible type "Enum"; expected "SensorTag | AuxDataTag"  [arg-type]
tests/test_perceiver_mvp.py:14: error: Skipping analyzing "perceiver.model.core": module is installed, but missing library stubs or py.typed marker  [import-untyped]
Found 40 errors in 8 files (checked 31 source files)
Edited by cyouri-csgroup