Skip to content

Commit

Permalink
DEP: lib: Removed deprecated methods and parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Wagner committed Jul 5, 2017
1 parent ce1697b commit 6ccaf3b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 23 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ development
### Core
- Changing the value of an existing field to `None` deletes the field.
- `Message.update` now behaves like `dict.update`. The old behavior is implemented in `Message.change`
- deprecated `http_ssl_proxy` has been dropped, use `https_proxy` instead
- Deprecated `http_ssl_proxy` has been dropped, use `https_proxy` instead
- Deprecated `http_timeout` has been dropped, use `http_timeout_sec` instead
- Deprecated parameters force and ignore of `Message.add` have been removed
- Deprecated method `Message.contains` has been removed

### Development
- We are now testing with and without optional libraries/lowest recommended versions and most current versions of required libraries
Expand Down
8 changes: 0 additions & 8 deletions intelmq/lib/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,14 +543,6 @@ def set_request_parameters(self):
self.http_timeout_max_tries = getattr(self.parameters, 'http_timeout_max_tries', 1)
# Be sure this is always at least 1
self.http_timeout_max_tries = self.http_timeout_max_tries if self.http_timeout_max_tries >= 1 else 1
# Handle deprecated parameter http_timeout
if hasattr(self.parameters, 'http_timeout'):
if not self.http_timeout_sec:
self.logger.warning("Found deprecated parameter 'http_timeout', please use 'http_timeout_sec'.")
self.http_timeout_sec = self.parameters.http_timeout
elif self.http_timeout_sec != self.parameters.http_timeout:
self.logger.warning("parameter 'http_timeout_sec' will overwrite deprecated parameter 'http_timeout'.")
# otherwise they are equal -> ignore

self.http_header['User-agent'] = self.parameters.http_user_agent

Expand Down
14 changes: 0 additions & 14 deletions intelmq/lib/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ def add(self, key: str, value: str, sanitize: bool=True, force: bool=False,
value: A valid value as defined in the harmonization
sanitize: Sanitation of harmonization type will be called before validation
(default: True)
force: Deprecated, use overwrite (default: False)
overwrite: Overwrite an existing value if it already exists (default: False)
ignore: List or tuple of values to ignore, deprecated (default: ())
raise_failure: If a intelmq.lib.exceptions.InvalidValue should be raised for
invalid values (default: True). If false, the return parameter will be
False in case of invalid values.
Expand All @@ -173,9 +171,6 @@ def add(self, key: str, value: str, sanitize: bool=True, force: bool=False,
raise_failure is True.
"""
overwrite = force or overwrite
if force:
warnings.warn('The force-argument is deprecated by overwrite and will be removed in'
'1.0.', DeprecationWarning)
if not overwrite and key in self:
raise exceptions.KeyExists(key)

Expand All @@ -187,10 +182,6 @@ def add(self, key: str, value: str, sanitize: bool=True, force: bool=False,
if not self.__is_valid_key(key):
raise exceptions.InvalidKey(key)

if ignore:
warnings.warn('The ignore-argument will be removed in 1.0.',
DeprecationWarning)

try:
if value in ignore:
return
Expand Down Expand Up @@ -228,11 +219,6 @@ def change(self, key: str, value: str, sanitize: bool=True):
raise exceptions.KeyNotExists(key)
return self.add(key, value, overwrite=True, sanitize=sanitize)

def contains(self, key: str):
warnings.warn('The contains-method will be removed in 1.0.',
DeprecationWarning)
return key in self

def finditems(self, keyword: str):
for key, value in super(Message, self).items():
if key.startswith(keyword):
Expand Down

0 comments on commit 6ccaf3b

Please sign in to comment.