From a1dc9b19dec00fb838f4c9a696b6d6a4f1c29894 Mon Sep 17 00:00:00 2001 From: Adam Jakubowski Date: Tue, 1 Feb 2022 14:53:33 +0100 Subject: [PATCH 1/3] installation problems when classifier are a tuple (they should be a list) --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index bf63710..e0fef44 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ def get_version(): test_suite="embedly.tests", zip_safe=True, use_2to3=True, - classifiers=( + classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Natural Language :: English', @@ -54,5 +54,5 @@ def get_version(): 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', - ) + ] ) From ed4bd179ebde02b3256a330ffd2ed6e4ab98c39f Mon Sep 17 00:00:00 2001 From: Adam Jakubowski Date: Tue, 1 Feb 2022 16:17:36 +0100 Subject: [PATCH 2/3] I believe this will kind-of move it to python3? --- embedly/client.py | 2 +- embedly/models.py | 5 ++--- embedly/py3_utils.py | 28 ---------------------------- embedly/tests.py | 12 ++---------- 4 files changed, 5 insertions(+), 42 deletions(-) delete mode 100644 embedly/py3_utils.py diff --git a/embedly/client.py b/embedly/client.py index cfda2df..d8cd099 100644 --- a/embedly/client.py +++ b/embedly/client.py @@ -8,7 +8,7 @@ import re import httplib2 import json -from urllib import quote, urlencode +from urllib.parse import quote, urlencode from .models import Url diff --git a/embedly/models.py b/embedly/models.py index f97591c..d9e488c 100644 --- a/embedly/models.py +++ b/embedly/models.py @@ -1,9 +1,8 @@ from __future__ import absolute_import, unicode_literals -from .py3_utils import python_2_unicode_compatible, IterableUserDict +from collections import UserDict -@python_2_unicode_compatible -class Url(IterableUserDict, object): +class Url(UserDict, object): """ A dictionary with two additional attributes for the method and url. UserDict provides a dictionary interface along with the regular diff --git a/embedly/py3_utils.py b/embedly/py3_utils.py deleted file mode 100644 index 089ce8e..0000000 --- a/embedly/py3_utils.py +++ /dev/null @@ -1,28 +0,0 @@ -import sys - -# 2to3 doesn't handle the UserDict relocation -# put the import logic here for cleaner usage -try: - from collections import UserDict as IterableUserDict -except ImportError: # Python 2 - from UserDict import IterableUserDict - - -def python_2_unicode_compatible(klass): - """ - A decorator that defines __unicode__ and __str__ methods under Python 2. - Under Python 3 it does nothing. - - From django.utils.encoding.py in 1.4.2+, minus the dependency on Six. - - To support Python 2 and 3 with a single code base, define a __str__ method - returning text and apply this decorator to the class. - """ - if sys.version_info[0] == 2: - if '__str__' not in klass.__dict__: - raise ValueError("@python_2_unicode_compatible cannot be applied " - "to %s because it doesn't define __str__()." % - klass.__name__) - klass.__unicode__ = klass.__str__ - klass.__str__ = lambda self: self.__unicode__().encode('utf-8') - return klass diff --git a/embedly/tests.py b/embedly/tests.py index 90ac6d9..c65e2e1 100644 --- a/embedly/tests.py +++ b/embedly/tests.py @@ -2,16 +2,8 @@ import re import sys import json - -try: # pragma: no cover - import unittest2 as unittest # Python 2.6 # pragma: no cover -except ImportError: # pragma: no cover - import unittest # pragma: no cover - -try: # pragma: no cover - from unittest import mock # pragma: no cover -except ImportError: # Python < 3.3 # pragma: no cover - import mock # pragma: no cover +import unittest +from unittest import mock # pragma: no cover from embedly.client import Embedly from embedly.models import Url From 7b466a297a541b8d3c3e575ebf0e5db7e7625dce Mon Sep 17 00:00:00 2001 From: Adam Jakubowski Date: Tue, 1 Feb 2022 16:18:16 +0100 Subject: [PATCH 3/3] No more 2to3 nonsense --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index e0fef44..562860c 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,6 @@ def get_version(): tests_require=tests_require, test_suite="embedly.tests", zip_safe=True, - use_2to3=True, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers',