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

Add __contains__ to Dynaconf #502

Merged
merged 3 commits into from Feb 18, 2021
Merged

Add __contains__ to Dynaconf #502

merged 3 commits into from Feb 18, 2021

Conversation

Mdslino
Copy link
Contributor

@Mdslino Mdslino commented Jan 13, 2021

No description provided.

@codecov
Copy link

codecov bot commented Jan 13, 2021

Codecov Report

Merging #502 (92542df) into master (c2d8b71) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #502   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           17        17           
  Lines          849       851    +2     
=========================================
+ Hits           849       851    +2     
Impacted Files Coverage Δ
dynaconf/contrib/flask_dynaconf.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2d8b71...92542df. Read the comment docs.

dynaconf/base.py Outdated
@@ -105,6 +105,9 @@ def __init__(self, **kwargs):
self._kwargs = kwargs
super(LazySettings, self).__init__()

def __contains__(self, item):
return hasattr(self, item)
Copy link
Member

Choose a reason for hiding this comment

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

dynaconf stores data in 2 places.

  1. self._store which is a dictionary
  2. as instance attributes

I am not sure if simply calling hasattr will use __getattr__ which already makes the lookup in both places.

Also we might need to add some unit tests and a functional test in /example/ folder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, i get it. I'll test this scenario and write some tests to validate this.

@Mdslino Mdslino marked this pull request as ready for review February 17, 2021 17:16
@rochacbruno rochacbruno merged commit ce23ff5 into dynaconf:master Feb 18, 2021
rochacbruno added a commit that referenced this pull request Mar 1, 2021
Shortlog of commits since last release:

    Bruno Rocha (11):
          Release version 3.1.2
          Fix #445 casting on dottet get. (#446)
          Fix docs regarding --django argument on cli (#477)
          Fix #521 - FlaskDynaconf should raise KeyError for non existing keys (#522)
          Case insensitive envvar traversal (#524)
          Allow load_file to accept pathlib.Path (#525)
          Allow Title case lookup and validation. (#526)
          Fix #482 - formatter case insensitive (#527)
          Fix #449 - Django lazy templating Fix #449 (#528)
          Added a test to reproduce #492 (not able to reproduce) (#530)
          Fix #511 allow user to specify loaders argument to execute_loaders (#531)

    FrankBattaglia (1):
          Specify flask extension initializers by entry point object reference (#456)

    Ilito Torquato (3):
          fix merging hyperlink to fix  #454 (#458)
          Changed enabled_core_loaders elements to be upper case to fix #455 (#457)
          Fix doc secrets from vault #403 (#459)

    Marcelo Lino (1):
          Add __contains__ to Dynaconf (#502)

    Michal Odnous (1):
          Fix: Environment variables filtering #470 (#474)

    dependabot-preview[bot] (5):
          Bump mkdocs-material from 6.0.2 to 6.1.0 (#453)
          Bump mkdocs-git-revision-date-localized-plugin from 0.5.2 to 0.7.3 (#463)
          Bump mkdocs-material from 6.1.0 to 6.1.5 (#473)
          Bump mkdocs-versioning from 0.2.1 to 0.3.1 (#475)
          Bump mkdocs-material from 6.1.5 to 6.1.6 (#476)

    mirrorrim (1):
          Fix reading secret from Vault kv v2 (#483) (#487)
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.

None yet

2 participants