From c53035eaeb98d9f07978f249308599d722cae28c Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Tue, 2 Apr 2019 02:53:21 +0000 Subject: Remove deprecated constructors --- pandora/client.py | 15 --------------- pandora/util.py | 35 ----------------------------------- tests/test_pandora/test_util.py | 22 ---------------------- 3 files changed, 72 deletions(-) delete mode 100644 pandora/util.py delete mode 100644 tests/test_pandora/test_util.py diff --git a/pandora/client.py b/pandora/client.py index df09144..658fb0d 100644 --- a/pandora/client.py +++ b/pandora/client.py @@ -14,7 +14,6 @@ For simplicity use a client builder from pandora.clientbuilder to create an instance of a client. """ from . import errors -from .util import deprecated class BaseAPIClient(object): @@ -40,20 +39,6 @@ class BaseAPIClient(object): self.username = None self.password = None - @classmethod - @deprecated("1.3", "2.0", - "Replaced by clientbuilder.SettingsDictBuilder") - def from_settings_dict(cls, settings): # pragma: no cover - from .clientbuilder import SettingsDictBuilder - return SettingsDictBuilder(settings).build() - - @classmethod - @deprecated("1.3", "2.0", - "Replaced by clientbuilder.PydoraConfigFileBuilder") - def from_config_file(cls, path, authenticate=True): # pragma: no cover - from .clientbuilder import PydoraConfigFileBuilder - return PydoraConfigFileBuilder(path, authenticate).build() - def _partner_login(self): partner = self.transport("auth.partnerLogin", username=self.partner_user, diff --git a/pandora/util.py b/pandora/util.py deleted file mode 100644 index e0fc7fd..0000000 --- a/pandora/util.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -Utility Functions - -Functions that don't have a home anywhere else. -""" - -import warnings -from functools import wraps - - -def warn_deprecated(in_version, remove_version, what, message): - """Warn that something is deprecated - """ - msg = ("{} is deprecated as of version {}" - " and will be removed in version {}. {}") - - warnings.warn( - msg.format(what, in_version, remove_version, message), - DeprecationWarning) - - -def deprecated(in_version, remove_version, message): - """Deprecated function decorator - - Decorator to warn that a function is deprecated and what version it will be - removed in. - """ - def wrapper(wrapped): - @wraps(wrapped) - def inner_wrapper(self, *args, **kwargs): - warn_deprecated( - in_version, remove_version, wrapped.__name__, message) - return wrapped(self, *args, **kwargs) - return inner_wrapper - return wrapper diff --git a/tests/test_pandora/test_util.py b/tests/test_pandora/test_util.py deleted file mode 100644 index d8c3876..0000000 --- a/tests/test_pandora/test_util.py +++ /dev/null @@ -1,22 +0,0 @@ -import warnings -from unittest import TestCase -from unittest.mock import patch - -from pandora import util - - -class TestDeprecatedWarning(TestCase): - - def test_warning(self): - class Bar(object): - - @util.deprecated("1.0", "2.0", "Don't use this") - def foo(self): - pass - - with patch.object(warnings, "warn") as wmod: - Bar().foo() - - wmod.assert_called_with( - ("foo is deprecated as of version 1.0 and will be removed in " - "version 2.0. Don't use this"), DeprecationWarning) -- cgit v1.2.3