summaryrefslogtreecommitdiff
path: root/oauthlib/common.py
diff options
context:
space:
mode:
authorHugo <hugovk@users.noreply.github.com>2019-08-14 23:44:51 +0300
committerHugo <hugovk@users.noreply.github.com>2019-08-15 12:24:33 +0300
commit2cec2adf8f54c9eda2a2674f565584aea709ef8a (patch)
tree5d965388d9b02f6b82cba84a53dd55ff979e45e2 /oauthlib/common.py
parent3718a0e048e64994c2ee3819c5e5ed218a05f115 (diff)
downloadoauthlib-2cec2adf8f54c9eda2a2674f565584aea709ef8a.tar.gz
Upgrade Python syntax with pyupgrade
Diffstat (limited to 'oauthlib/common.py')
-rw-r--r--oauthlib/common.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/oauthlib/common.py b/oauthlib/common.py
index 1462e75..52a3567 100644
--- a/oauthlib/common.py
+++ b/oauthlib/common.py
@@ -300,7 +300,7 @@ def to_unicode(data, encoding='UTF-8'):
# We support 2.6 which lacks dict comprehensions
if hasattr(data, 'items'):
data = data.items()
- return dict(((to_unicode(k, encoding), to_unicode(v, encoding)) for k, v in data))
+ return {to_unicode(k, encoding): to_unicode(v, encoding) for k, v in data}
return data
@@ -312,7 +312,7 @@ class CaseInsensitiveDict(dict):
proxy = {}
def __init__(self, data):
- self.proxy = dict((k.lower(), k) for k in data)
+ self.proxy = {k.lower(): k for k in data}
for k in data:
self[k] = data[k]
@@ -321,27 +321,27 @@ class CaseInsensitiveDict(dict):
def __delitem__(self, k):
key = self.proxy[k.lower()]
- super(CaseInsensitiveDict, self).__delitem__(key)
+ super().__delitem__(key)
del self.proxy[k.lower()]
def __getitem__(self, k):
key = self.proxy[k.lower()]
- return super(CaseInsensitiveDict, self).__getitem__(key)
+ return super().__getitem__(key)
def get(self, k, default=None):
return self[k] if k in self else default
def __setitem__(self, k, v):
- super(CaseInsensitiveDict, self).__setitem__(k, v)
+ super().__setitem__(k, v)
self.proxy[k.lower()] = k
def update(self, *args, **kwargs):
- super(CaseInsensitiveDict, self).update(*args, **kwargs)
+ super().update(*args, **kwargs)
for k in dict(*args, **kwargs):
self.proxy[k.lower()] = k
-class Request(object):
+class Request:
"""A malleable representation of a signable HTTP request.
@@ -421,7 +421,7 @@ class Request(object):
body = SANITIZE_PATTERN.sub('\1<SANITIZED>', str(body))
if 'Authorization' in headers:
headers['Authorization'] = '<SANITIZED>'
- return '<oauthlib.Request url="%s", http_method="%s", headers="%s", body="%s">' % (
+ return '<oauthlib.Request url="{}", http_method="{}", headers="{}", body="{}">'.format(
self.uri, self.http_method, headers, body)
@property