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

ENHANCE: Make Config a singleton #215

Merged
merged 8 commits into from
Nov 19, 2019

Conversation

zacbrannelly
Copy link
Collaborator

@zacbrannelly zacbrannelly commented Oct 30, 2019

Example:

from surround import has_config

@has_config
def some_function(config=None):
    config.read_from_dict({"override": False})

@has_config(name="local_config")
def some_other_function(local_config=None):
    assert(local_config["override"]) == False)

Also can be used like this if preferred:

config = Config.instance()

Can also be used to override:

@has_config(filename="override.yaml")
def some_function(config=None):
    ...

templates/new/web_main.py.txt Outdated Show resolved Hide resolved
@zacbrannelly zacbrannelly force-pushed the enhance/config-singleton branch from b47c928 to 8085ad3 Compare November 15, 2019 00:25
@ucokzeko
Copy link
Member

@zacbrannelly Can you rebase this please? Thanks

@zacbrannelly zacbrannelly force-pushed the enhance/config-singleton branch from f6c87f0 to f6acb14 Compare November 19, 2019 03:06
@ucokzeko
Copy link
Member

Just a recap from discussion with @zacbrannelly
We will be trying to add an option to load other config files as an optional parameter of @has_config

Copy link
Member

@ucokzeko ucokzeko left a comment

Choose a reason for hiding this comment

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

LGTM
Good work @zacbrannelly!

@ucokzeko ucokzeko merged commit bc6f87b into a2i2:master Nov 19, 2019
@zacbrannelly zacbrannelly deleted the enhance/config-singleton branch November 19, 2019 22:33
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.

3 participants