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

Refactor dynamic country package imports to instead directly reference country packages #1999

Open
anth-volk opened this issue Nov 21, 2024 · 0 comments

Comments

@anth-volk
Copy link
Collaborator

As proposed by @ldorner, we should refactor akin to the below:

import policyengine_uk
import policyengine_us
...

class PolicyEngineCountry:
    COUNTRY_MODULES = {
         'uk': policyengine_uk,
         'us': policyengine_us,
         ...
     }

    def __init__(self, country_package_name: str, country_id: str):
        self.country_package_name = country_package_name
        self.country_id = country_id
        self.country_package = self.COUNTRY_MODULES[country_package_name]
        ...
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

No branches or pull requests

1 participant