From 3718a0e048e64994c2ee3819c5e5ed218a05f115 Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 14 Aug 2019 23:35:36 +0300 Subject: Drop support for legacy Python 2.7 --- oauthlib/oauth2/rfc6749/utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'oauthlib/oauth2/rfc6749/utils.py') diff --git a/oauthlib/oauth2/rfc6749/utils.py b/oauthlib/oauth2/rfc6749/utils.py index f67019d..7516c9e 100644 --- a/oauthlib/oauth2/rfc6749/utils.py +++ b/oauthlib/oauth2/rfc6749/utils.py @@ -10,7 +10,7 @@ from __future__ import absolute_import, unicode_literals import datetime import os -from oauthlib.common import unicode_type, urldecode +from oauthlib.common import urldecode try: from urllib import quote @@ -24,10 +24,10 @@ except ImportError: def list_to_scope(scope): """Convert a list of scopes to a space separated string.""" - if isinstance(scope, unicode_type) or scope is None: + if isinstance(scope, str) or scope is None: return scope elif isinstance(scope, (set, tuple, list)): - return " ".join([unicode_type(s) for s in scope]) + return " ".join([str(s) for s in scope]) else: raise ValueError("Invalid scope (%s), must be string, tuple, set, or list." % scope) @@ -35,7 +35,7 @@ def list_to_scope(scope): def scope_to_list(scope): """Convert a space separated string to a list of scopes.""" if isinstance(scope, (tuple, list, set)): - return [unicode_type(s) for s in scope] + return [str(s) for s in scope] elif scope is None: return None else: @@ -74,7 +74,7 @@ def escape(u): TODO: verify whether this can in fact be used for OAuth 2 """ - if not isinstance(u, unicode_type): + if not isinstance(u, str): raise ValueError('Only unicode objects are escapable.') return quote(u.encode('utf-8'), safe=b'~') @@ -84,7 +84,7 @@ def generate_age(issue_time): td = datetime.datetime.now() - issue_time age = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10 ** 6) / 10 ** 6 - return unicode_type(age) + return str(age) def is_secure_transport(uri): -- cgit v1.2.1 From b41d4801dec588d82e6633869ac541e207598297 Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 15 Aug 2019 00:01:16 +0300 Subject: Drop support for legacy Python 2.7 --- oauthlib/oauth2/rfc6749/utils.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'oauthlib/oauth2/rfc6749/utils.py') diff --git a/oauthlib/oauth2/rfc6749/utils.py b/oauthlib/oauth2/rfc6749/utils.py index 7516c9e..efbf8aa 100644 --- a/oauthlib/oauth2/rfc6749/utils.py +++ b/oauthlib/oauth2/rfc6749/utils.py @@ -11,15 +11,8 @@ import datetime import os from oauthlib.common import urldecode - -try: - from urllib import quote -except ImportError: - from urllib.parse import quote -try: - from urlparse import urlparse -except ImportError: - from urllib.parse import urlparse +from urllib.parse import quote +from urllib.parse import urlparse def list_to_scope(scope): -- cgit v1.2.1 From 25dee45f9991bf009bcc5eebd5987046a4bf7779 Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 15 Aug 2019 12:31:29 +0300 Subject: The future is now --- oauthlib/oauth2/rfc6749/utils.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'oauthlib/oauth2/rfc6749/utils.py') diff --git a/oauthlib/oauth2/rfc6749/utils.py b/oauthlib/oauth2/rfc6749/utils.py index efbf8aa..3117d4b 100644 --- a/oauthlib/oauth2/rfc6749/utils.py +++ b/oauthlib/oauth2/rfc6749/utils.py @@ -5,8 +5,6 @@ oauthlib.utils This module contains utility methods used by various parts of the OAuth 2 spec. """ -from __future__ import absolute_import, unicode_literals - import datetime import os -- cgit v1.2.1