Skip to content

cleanup some mypy types #5072

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
merged 1 commit into from
Mar 10, 2021
Merged

Conversation

chriselion
Copy link
Contributor

Proposed change(s)

Small mypy cleanup (IMHO)

@chriselion chriselion requested a review from ervteng March 10, 2021 17:05
@@ -253,9 +253,7 @@ def create_torch_policy(
return policy

def create_coma_optimizer(self) -> TorchCOMAOptimizer:
return TorchCOMAOptimizer( # type: ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These made me sad :(

@@ -58,7 +58,7 @@ def __init__(
PPOSettings, self.trainer_settings.hyperparameters
)
self.seed = seed
self.policy: Policy = None # type: ignore
self.policy: TorchPolicy = None # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this still throws a mypy error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The # type: ignore is to handle it being assigned None - otherwise you'd have to use Optional[TorchPolicy] and check that it was non-None everywhere you used it.

@chriselion chriselion merged commit b6e70ce into develop-coma2-trainer Mar 10, 2021
@delete-merged-branch delete-merged-branch bot deleted the develop-coma2-trainer-mypy branch March 10, 2021 18:40
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants