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

Docopt #38

Merged
merged 29 commits into from
Jan 7, 2019
Merged

Docopt #38

merged 29 commits into from
Jan 7, 2019

Conversation

jtatusko
Copy link
Contributor

@jtatusko jtatusko commented Jan 4, 2019

No description provided.

@jtatusko
Copy link
Contributor Author

jtatusko commented Jan 4, 2019

still need to do:

  • adept.app options for other scripts
  • docopt for other scripts
  • update readme
  • --use-defaults or --override-defaults flag


def lookup_env_class(self, env_id):
engine = self.lookup_engine(env_id)
return self.plugin_class_by_engine_id[engine]
return self._plugin_class_by_engine_id[engine]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

_module_class_by_engine_id

@@ -34,15 +34,15 @@ def __init__(self, env_plugin_class, args):
self._gpu_preprocessor = dummy_env.gpu_preprocessor

@classmethod
def from_args(cls, args, registry=EnvPluginRegistry()):
def from_args(cls, args, registry=EnvModuleRegistry()):
"""
Mimic the AdeptEnvPlugin.from_args API to simplify interface.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

EnvModule

"""
Mimic the AdeptEnvPlugin.from_args API to simplify interface.

:param args: Arguments object
:param registry: Optionally provide to avoid recreating.
:return: EnvMetaData
"""
plugin_class = registry.lookup_env_class(args.env_id)
plugin_class = registry.lookup_env_class(args.env)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

module_class

@@ -63,38 +66,62 @@ class Engines(IntEnum):
]


class EnvPluginRegistry:
class EnvModuleRegistry:
"""
Keeps track of supported environment plugins.
"""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

modules

self.engine_ids_by_env_id_set = {}
self.plugin_class_by_engine_id = {}
self._engine_ids_by_env_id_set = {}
self._plugin_class_by_engine_id = {}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

module_class

@jtatusko jtatusko merged commit e7a3243 into master Jan 7, 2019
@jtatusko jtatusko deleted the docopt branch January 7, 2019 20:04
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

Successfully merging this pull request may close these issues.

1 participant