Skip to content

Add --namespace-packages to mypy for mlagents #3075

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 18 commits into from
Dec 12, 2019

Conversation

chriselion
Copy link
Contributor

Follow up from #3049

  • Adds --namespace-packages to the mypy settings for ml-agents
  • Fixes related errors

@@ -57,6 +57,7 @@ def __init__(self, seed, brain, trainer_parameters):
self.brain = brain
self.use_recurrent = trainer_parameters["use_recurrent"]
self.memory_dict: Dict[str, np.ndarray] = {}
self.reward_signals: Dict[str, "RewardSignal"] = {}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used the string form here, because importing RewardSignal was leading to circular imports.

@@ -1,6 +1,6 @@
from typing import NamedTuple, Any, Dict, Optional
from typing import NamedTuple, Any, Dict
Copy link
Contributor Author

Choose a reason for hiding this comment

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

from mlagents.trainers.brain import AllBrainInfo, BrainParameters
from mlagents.trainers.policy import Policy
from mlagents.trainers.action_info import ActionInfo


class EnvironmentStep(NamedTuple):
previous_all_brain_info: Optional[AllBrainInfo]
previous_all_brain_info: AllBrainInfo
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good to me

@@ -67,13 +67,14 @@ def __init__(
self.check_param_keys()

if multi_gpu and len(get_devices()) > 1:
self.policy = MultiGpuPPOPolicy(
self.ppo_policy = MultiGpuPPOPolicy(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ervteng This is what we talked about offline

@chriselion chriselion requested review from ervteng and vincentpierre and removed request for ervteng December 11, 2019 23:28
@chriselion chriselion changed the base branch from develop-mypy-coverage to master December 11, 2019 23:51
from mlagents.trainers.brain import AllBrainInfo, BrainParameters
from mlagents.trainers.policy import Policy
from mlagents.trainers.action_info import ActionInfo


class EnvironmentStep(NamedTuple):
previous_all_brain_info: Optional[AllBrainInfo]
previous_all_brain_info: AllBrainInfo
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good to me

@chriselion chriselion changed the title Add --namespace-packages to mypy (mlagents only) Add --namespace-packages to mypy for mlagents Dec 12, 2019
@chriselion chriselion merged commit aa69e77 into master Dec 12, 2019
@delete-merged-branch delete-merged-branch bot deleted the develop-mypy-coverage-mla branch December 12, 2019 01:09
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2021
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