-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix mypy issues in tests and examples #1077
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
Merged
MischaPanch
merged 123 commits into
thu-ml:master
from
dantp-ai:refactoring/mypy-issues-test-and-examples
Apr 3, 2024
Merged
Changes from all commits
Commits
Show all changes
123 commits
Select commit
Hold shift + click to select a range
b17c6dc
Remove mutable logger_factory used by examples
dantp-ai 933b27a
Fix mypy issues
dantp-ai 7947f53
Add type annotations to funcs signatures
dantp-ai 1163494
Rename variable to resolve type conflict
dantp-ai aa0f131
Provide right input type to buffer methods
dantp-ai 7c91575
Index sample from buffer according to cheatsheet recommendations
dantp-ai 76fe01e
Type index to make mypy happy
dantp-ai 33df04c
Make mypy happy and check for mask attribute before asserting tests
dantp-ai ba5d74e
Make mypy happy and specify union of types
dantp-ai 8d03ea4
Make mypy happy and type ndarray
dantp-ai 13ae7a8
Use recommended outer buffer indexing
dantp-ai f282d81
Access buffer attrs with __getattr__
dantp-ai 2805967
Ignore mypy issue as it explicitly tests for invalid type
dantp-ai eaa4503
Make mypy happy & use explicit var typing and ignore
dantp-ai cb765b4
Ignore type on explicit error
dantp-ai 1aacd10
Remove redundant assert
dantp-ai a6a210e
Merge branch 'master' into refactoring/mypy-issues-test-and-examples
dantp-ai ef9581b
Add typing to func args
dantp-ai 0356d8d
Add type annotations to funcs
dantp-ai c48d50f
Fix mypy issues
dantp-ai ebacf99
Use DataclassPPrintMixin to print collector stats
dantp-ai b6accd4
Add type annotations to func
dantp-ai 41a9d03
Merge branch 'master' into refactoring/mypy-issues-test-and-examples
dantp-ai 52bb1e3
Add type annotations to funcs
dantp-ai 14b769f
Fix policy annotation
dantp-ai 59f9bb1
Add type annotations func
dantp-ai ba6df44
Type policy var to resolve mypy confusion
dantp-ai ebd140f
Fix mypy issues
dantp-ai bce45a7
Check env.spec for none before accessing attrs
dantp-ai 1dcd319
Add type annotation using space info
dantp-ai 48af507
Add type annotations to NoopResetEnv's methods and helper funcs
dantp-ai 2ec7c67
Use only integers with Generator
dantp-ai e1a85fa
Use DataclassPPrintMixin to print collect stats
dantp-ai 8d9e168
Respect mypy typing for vars/args
dantp-ai 6f31ac1
Fix many mypy issues
dantp-ai 21e3805
Rename var to resolve ambiguity for mypy
dantp-ai 010395d
Fix mypy issues (see below)
dantp-ai ed70e82
Add type annotations to DummyDataset and FiniteEnv
dantp-ai 678c1c3
Fix mypy issues
dantp-ai 70e6dc1
Fix some mypy issues
dantp-ai 2db9b20
Fix many mypy issues related to:
dantp-ai b4d9450
Fix mypy issues:
dantp-ai 62b884d
ignore mypy check
dantp-ai 2b4ffa7
Fix mypy issues:
dantp-ai 2fb1d95
Add missing type annotations
dantp-ai 0398ef7
Fix some mypy issues:
dantp-ai f47b4ad
Merge branch 'master' into refactoring/mypy-issues-test-and-examples
dantp-ai cc04d08
Add missing type annotations to funcs
dantp-ai d265b2f
Fix mypy issues
dantp-ai 48af7a5
Pass correct typed param env_fns to SubprocVectorEnv
dantp-ai 4330e33
Fix more mypy issues:
dantp-ai 91a3ee2
Bugfix: Tuple item assignment
dantp-ai a481e2f
Make mypy happy and use [] instea of . notation
dantp-ai 5a68a9a
Merge branch 'master' into refactoring/mypy-issues-test-and-examples
dantp-ai c6aa77b
Typing: extend index type
MischaPanch 0de06a4
Typing in tests: added asserts and cast to remove some mypy errors
MischaPanch 0596f04
Revert output type to tuple[InfoStats, BasePolicy]
dantp-ai 3031c8f
For mypy: Store obs/obs_next in new var and assert type
dantp-ai 5451119
For mypy: store intermediate vars & assert type
dantp-ai a797811
Use pprint_asdict() instead
dantp-ai b09b581
Check for none
dantp-ai 989633e
Merge branch 'master' into refactoring/mypy-issues-test-and-examples
dantp-ai 41748f1
Use pprint_asdict to print CollectStats
dantp-ai 12d5e68
Ignore type as mypy doesn't know that it should be wrong here
dantp-ai 2fdab27
Ignore type annotation for step() because env can generate non-scalar…
dantp-ai bda6b10
Make mypy understand what type weight is
dantp-ai c4f6c2d
Make mypy happy and use proper type for adding constant to batch
dantp-ai 2d6f5f1
Use setattr/getattr because mypy doesn't know
dantp-ai f5084ca
Remove unused var
dantp-ai 2e8f3c3
Use SpaceInfo to determne types action/obs space
dantp-ai 176ecc0
Revert "Use SpaceInfo to determne types action/obs space"
dantp-ai 444b464
Cover case when state is dict
dantp-ai 01aad1a
Set integer default value for batch_size
dantp-ai 06ae70c
Add typing to env methods and use Gym API >v0.26 (with terminated, tr…
dantp-ai aba1d8c
Treat case when cpu_count() is None
dantp-ai 92e19be
Fix mypy issues:
dantp-ai 5ae29df
Ignore mypy typing on lines that use old Gym API:
dantp-ai 65c4aa1
Make mypy happy and add type to var
dantp-ai 34d94bc
Use space_info to type env spaces
dantp-ai 216ba7c
Use assert instead of cast to check for obs_space/action_space:
dantp-ai 524f0af
Assert action space
dantp-ai fe08d6e
Use assert as mypy doesn't know that FetchReach env has compute_rewar…
dantp-ai 7a5071c
Check for none before comparing mean_rewards to reward_threshold
dantp-ai c8e5448
Assert action space before accessing attributes specific to that space
dantp-ai f71ad85
Refactor way DQN API is used:
dantp-ai 56608da
Fix FiniteVectorEnv.reset() to satisfy superclass type annotations
dantp-ai 10352d4
Fix mypy issues for AtariWrappers
dantp-ai c21586a
Make mypy happy and use typing for obs_space_dtype
dantp-ai 75bb1f0
Assert env.action_space = MultiDiscrete:
dantp-ai a0d1427
Extend IndexType to explicitly have list[int]:
dantp-ai 66d92af
Use SpaceInfo to type env obs/action space:
dantp-ai d0c8745
Use SpaceInfo to type env obs/action space:
dantp-ai d4b5d23
Assert action space before accessing space-specific attrs
dantp-ai 2255f6e
Add type hints to obs/action spaces:
dantp-ai 8c5fa77
Add type hints to action/obs spaces:
dantp-ai 069a2e6
Minor reformat comments
dantp-ai d01420c
Merge branch 'master' into refactoring/mypy-issues-test-and-examples
dantp-ai feb0ee1
Merge branch 'thuml-master' into refactoring/mypy-issues-test-and-exa…
MischaPanch dab400f
Post-resolving conflicts in tests and examples
MischaPanch aaa56ea
Pyproject: added stubs, included tests and examples in type-check
MischaPanch 32951b2
Extended pre-commit type check [skip ci]
MischaPanch 6235a37
Typo in test
MischaPanch 4a867bd
Remove type in IndexType for batch
dantp-ai 528eb10
Use assert hasattr instead of getattr
dantp-ai d10b8b2
Remove iter since Batch already implements __iter__
dantp-ai 5ed5d50
Use Literal instead of asserting members of list
dantp-ai 7a18c4d
Use stop_fn for running this example
dantp-ai 4fb294d
Use ValueError to inform user about what type of env is supported.
dantp-ai 2ace3ef
Use more specific type hint for policy to get access to policy-specif…
dantp-ai 6e50389
Refactor type annotation make_vizdoom_env
dantp-ai 1ac275b
Use kw-args for better readability
dantp-ai 322b6aa
Use os.path.join
dantp-ai 0e2babb
Remove if and assert hasattr beforehand
dantp-ai 71a4006
Return non-empty dict when reset
dantp-ai 10669a6
Refactor ActorFactoryAtariDQN hidden_size semantics and output_dim of…
dantp-ai 5567ce0
Refactor type annotations of scale_obs:
dantp-ai 1c79d19
Simplify checks of obs_shape for atari envs
dantp-ai 2b6722f
Use kw for input arguments to QRDQN
dantp-ai e8ba5ad
Made NetBase generic (explanation below), removed **kwargs from forward
MischaPanch e4d7d2f
SamplingConfig: support for batch_size=None
MischaPanch c1a4b40
Changelog [skip ci]
MischaPanch 38b6b11
Merge branch 'thuml-master' into refactoring/mypy-issues-test-and-exa…
MischaPanch 4c34a45
Changelog [skip ci]
MischaPanch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.