Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange non-type-error #70

Open
dfilan opened this issue Jan 17, 2023 · 3 comments
Open

Strange non-type-error #70

dfilan opened this issue Jan 17, 2023 · 3 comments

Comments

@dfilan
Copy link
Collaborator

dfilan commented Jan 17, 2023

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?

@Rocamonde
Copy link
Member

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?

@dfilan
Copy link
Collaborator Author

dfilan commented Jan 20, 2023

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.

@dfilan
Copy link
Collaborator Author

dfilan commented Jan 20, 2023

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.

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

No branches or pull requests

2 participants