Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions neo4j/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ def _consume(cls, data):
config[key] = value
return cls(config)

def __update(self, data):
def __update(self, data, warn=True):
data_dict = dict(iter_items(data))

def set_attr(k, v):
if k in self.keys():
if k in self._deprecated_options():
if warn and k in self._deprecated_options():
deprecation_warn("The '{}' config key is "
"deprecated".format(k))
setattr(self, k, v)
Expand All @@ -164,10 +164,11 @@ def set_attr(k, v):
if k0 in data_dict:
raise ValueError("Cannot specify both '{}' and '{}' in "
"config".format(k0, k))
deprecation_warn(
"The '{}' config key is deprecated, please use "
"'{}' instead".format(k, k0)
)
if warn:
deprecation_warn(
"The '{}' config key is deprecated, please use "
"'{}' instead".format(k, k0)
)
set_attr(k0, v)
else:
raise AttributeError(k)
Expand All @@ -189,10 +190,7 @@ def set_attr(k, v):
def __init__(self, *args, **kwargs):
for arg in args:
if isinstance(arg, Config):
with warnings.catch_warnings():
warnings.filterwarnings("ignore",
category=DeprecationWarning)
self.__update(arg)
self.__update(arg, warn=False)
else:
self.__update(arg)
self.__update(kwargs)
Expand Down