seals
seals copied to clipboard
Strange non-type-error
In base_envs.py
, the class TabularModelPOMDP
has a method obs_dtype
that returns the data type of observation vectors - specifically, it returns self.observation_matrix.dtype
. However, it is typed as returning an int. When I run code checks without first having first activated the virtual environment, mypy reports a type error. However, when I first activate the virtual environment, mypy doesn't complain at all. At first glance, this would certainly appear to be a type error, but maybe it isn't for some reason?
You are correct, this appears to be an error, and it is concerning that mypy doesn't catch this in a consistent way. I'll look into this. Could you provide some more context for this difference in behavior?
My 'default' mypy version before activating a virtual environment is 0.971, and that gives the error src/seals/base_envs.py:412: error: Incompatible return value type (got "dtype[Any]", expected "int")
. When I build the virtual environment by running ./ci/build_venv.sh
, activate it, and run pip install -e .[dev]
, mypy now has version 0.991, and when I run it on src/seals/base_envs.py
I just get Success: no issues found in 1 source file
. Whether or not the virtual environment is activated, the python version is 3.8.13.
LMK if there's other context that would be useful.
That said, if I update mypy to 0.991 outside the virtual environment and run it on src/seals/base_envs.py
I get the same error, so it must be something other than the mypy version.