Unnecessary update when value is None

When value is None, it is not necessary to invoke update and run other methods and conditions to make the code complicated there.
This commit is contained in:
Jacty 2020-05-11 11:18:25 +08:00 committed by GitHub
parent 794ab19660
commit b5684909d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -83,7 +83,8 @@ class BaseSettings(MutableMapping):
def __init__(self, values=None, priority='project'):
self.frozen = False
self.attributes = {}
self.update(values, priority)
if values is not None:
self.update(values, priority)
def __getitem__(self, opt_name):
if opt_name not in self: