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

Metaclass factory to replace Registrar and registry access classes #40

Open
cczhu opened this issue Jan 28, 2020 · 2 comments
Open

Metaclass factory to replace Registrar and registry access classes #40

cczhu opened this issue Jan 28, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request refactoring Reworking code structure without (major) API changes

Comments

@cczhu
Copy link
Contributor

cczhu commented Jan 28, 2020

We currently use Registrar metaclasses to register different analysis classes in CountMatch. There are multiple metaclasses, but all share nearly identical codebases, so it would be ideal to be able to write something like

DV_REGISTRY = {}
"""Dict for storing derived value processor class definitions."""

DVRegistrar = RegistrarFactory(DV_REGISTRY, "DV_REGISTRY", "_dv_type")

in place of the current DVRegistrar definition.

Ditto for DerivedVals:

DerivedVals = RegistryAccess(DV_REGISTRY)

Tests should remain the same, since the functionality is identical. Thus, very little effort wasted when writing tests currently.

@cczhu cczhu added enhancement New feature or request refactoring Reworking code structure without (major) API changes labels Jan 28, 2020
@cczhu cczhu self-assigned this Jan 28, 2020
@cczhu cczhu changed the title Metaclass factory to replace Registrar metaclasses Metaclass factory to replace Registrar metaclasses Jan 28, 2020
@cczhu cczhu changed the title Metaclass factory to replace Registrar metaclasses Metaclass factory to replace Registrar and registry access classes Jan 28, 2020
@cczhu
Copy link
Contributor Author

cczhu commented Feb 2, 2020

Also, in the tests, move Registrar class tests into the same class as launcher tests.

@cczhu
Copy link
Contributor Author

cczhu commented Feb 3, 2020

Also, the neighbour module needs a metaclass registrar and a functional wrapper for initializing nearest neighbour calculator instances.

Once you've built this registrar, change the relevant test fixtures and preprocessing functions in test_matcher.py as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactoring Reworking code structure without (major) API changes
Projects
None yet
Development

No branches or pull requests

1 participant