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

use metameta class for registry #6

Closed
mikofski opened this issue Apr 27, 2016 · 1 comment
Closed

use metameta class for registry #6

mikofski opened this issue Apr 27, 2016 · 1 comment
Assignees
Milestone

Comments

@mikofski
Copy link
Member

define _meta_names as class attribute, then use metaclass __new__ method to add them to attributes.

Meta names can also be used by data_readers to propagate data attributes, especially if all data sources parameters (and parameter files) have same structure.

@mikofski mikofski self-assigned this Apr 27, 2016
@mikofski mikofski modified the milestones: v0.2, v0.3 Apr 27, 2016
@mikofski mikofski removed this from the v0.3 milestone Jul 19, 2016
@mikofski mikofski added this to the v0.3 milestone Sep 22, 2016
@mikofski
Copy link
Member Author

  • This seems like a good idea since for every single registry, the attributes are the same as the meta_names, and that's the only thing that happens in the constructor.
  • However using meta class unless necessary seems overkill here, unless making new registry is something that developers will do often, say when making custom layers (plugins/middleware)
  • meta names is required by layers, so
    • declare registry meta in init, then collect them into meta names in superclass somehow
    • declare registry meta as class attr, then collect them into meta names in meta class (*)
    • declare meta names and then use meta class to make attributes

(*) this seems best, because user is actually stating attributes rather than having them magically created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant