Merge ~bjornt/django-piston3:reformat into django-piston3:master

Proposed by Björn Tillenius
Status: Merged
Approved by: Alberto Donato
Approved revision: 5cf3b205ff001510f46a857954afb97c60685cfe
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~bjornt/django-piston3:reformat
Merge into: django-piston3:master
Diff against target: 211 lines (+20/-22)
10 files modified
piston3/authentication.py (+2/-3)
piston3/doc.py (+2/-2)
piston3/emitters.py (+1/-1)
piston3/managers.py (+1/-2)
piston3/models.py (+4/-4)
piston3/oauth.py (+1/-1)
piston3/utils.py (+1/-1)
piston3/validate_jsonp.py (+3/-3)
tests/test_project/apps/testapp/tests.py (+3/-3)
tests/tests.py (+2/-2)
Reviewer Review Type Date Requested Status
Alberto Donato (community) Approve
MAAS Lander Approve
Review via email: mp+421169@code.launchpad.net

Commit message

Reformat due to new black version.

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b reformat lp:~bjornt/django-piston3/+git/django-piston3 into -b master lp:~maas-committers/django-piston3

STATUS: SUCCESS
COMMIT: 5cf3b205ff001510f46a857954afb97c60685cfe

review: Approve
Revision history for this message
Alberto Donato (ack) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/piston3/authentication.py b/piston3/authentication.py
index 474d6b6..a5ee0da 100644
--- a/piston3/authentication.py
+++ b/piston3/authentication.py
@@ -88,7 +88,7 @@ class HttpBasicAuthentication(object):
88 return resp88 return resp
8989
90 def __repr__(self):90 def __repr__(self):
91 return u"<HTTPBasic: realm=%s>" % self.realm91 return "<HTTPBasic: realm=%s>" % self.realm
9292
9393
94class HttpBasicSimple(HttpBasicAuthentication):94class HttpBasicSimple(HttpBasicAuthentication):
@@ -104,8 +104,7 @@ class HttpBasicSimple(HttpBasicAuthentication):
104104
105105
106def load_data_store():106def load_data_store():
107 """Load data store for OAuth Consumers, Tokens, Nonces and Resources107 """Load data store for OAuth Consumers, Tokens, Nonces and Resources"""
108 """
109 path = getattr(settings, "OAUTH_DATA_STORE", "piston3.store.DataStore")108 path = getattr(settings, "OAUTH_DATA_STORE", "piston3.store.DataStore")
110109
111 # stolen from django.contrib.auth.load_backend110 # stolen from django.contrib.auth.load_backend
diff --git a/piston3/doc.py b/piston3/doc.py
index ba8d412..8efc9c4 100644
--- a/piston3/doc.py
+++ b/piston3/doc.py
@@ -151,7 +151,7 @@ class HandlerDocumentation(object):
151 def _convert(template, params=[]):151 def _convert(template, params=[]):
152 """URI template converter"""152 """URI template converter"""
153 paths = template % dict([p, "{%s}" % p] for p in params)153 paths = template % dict([p, "{%s}" % p] for p in params)
154 return u"%s%s" % (get_script_prefix(), paths)154 return "%s%s" % (get_script_prefix(), paths)
155155
156 try:156 try:
157 resource_uri = self.handler.resource_uri()157 resource_uri = self.handler.resource_uri()
@@ -187,7 +187,7 @@ class HandlerDocumentation(object):
187 resource_uri_template = property(get_resource_uri_template)187 resource_uri_template = property(get_resource_uri_template)
188188
189 def __repr__(self):189 def __repr__(self):
190 return u'<Documentation for "%s">' % self.name190 return '<Documentation for "%s">' % self.name
191191
192192
193def documentation_view(request):193def documentation_view(request):
diff --git a/piston3/emitters.py b/piston3/emitters.py
index 375bef3..d0fa1b6 100644
--- a/piston3/emitters.py
+++ b/piston3/emitters.py
@@ -105,7 +105,7 @@ class Emitter(object):
105105
106 if thing in self.stack:106 if thing in self.stack:
107 raise RuntimeError(107 raise RuntimeError(
108 u"Circular reference detected while emitting " "response"108 "Circular reference detected while emitting " "response"
109 )109 )
110110
111 self.stack.append(thing)111 self.stack.append(thing)
diff --git a/piston3/managers.py b/piston3/managers.py
index cd36ed5..f90ed45 100644
--- a/piston3/managers.py
+++ b/piston3/managers.py
@@ -6,8 +6,7 @@ SECRET_SIZE = 32
66
77
8class KeyManager(models.Manager):8class KeyManager(models.Manager):
9 """Add support for random key/secret generation9 """Add support for random key/secret generation"""
10 """
1110
12 def generate_random_codes(self):11 def generate_random_codes(self):
13 key = User.objects.make_random_password(length=KEY_SIZE)12 key = User.objects.make_random_password(length=KEY_SIZE)
diff --git a/piston3/models.py b/piston3/models.py
index 688fb8b..a845cdd 100644
--- a/piston3/models.py
+++ b/piston3/models.py
@@ -51,7 +51,7 @@ class Nonce(models.Model):
51 key = models.CharField(max_length=255)51 key = models.CharField(max_length=255)
5252
53 def __unicode__(self):53 def __unicode__(self):
54 return u"Nonce %s for %s" % (self.key, self.consumer_key)54 return "Nonce %s for %s" % (self.key, self.consumer_key)
5555
56 class Meta:56 class Meta:
57 # This is mostly useful to speed up Nonces lookups, as the table can57 # This is mostly useful to speed up Nonces lookups, as the table can
@@ -78,7 +78,7 @@ class Consumer(models.Model):
78 objects = ConsumerManager()78 objects = ConsumerManager()
7979
80 def __unicode__(self):80 def __unicode__(self):
81 return u"Consumer %s with key %s" % (self.name, self.key)81 return "Consumer %s with key %s" % (self.name, self.key)
8282
83 def generate_random_codes(self):83 def generate_random_codes(self):
84 """84 """
@@ -105,7 +105,7 @@ class Consumer(models.Model):
105class Token(models.Model):105class Token(models.Model):
106 REQUEST = 1106 REQUEST = 1
107 ACCESS = 2107 ACCESS = 2
108 TOKEN_TYPES = ((REQUEST, u"Request"), (ACCESS, u"Access"))108 TOKEN_TYPES = ((REQUEST, "Request"), (ACCESS, "Access"))
109109
110 key = models.CharField(max_length=KEY_SIZE)110 key = models.CharField(max_length=KEY_SIZE)
111 secret = models.CharField(max_length=SECRET_SIZE)111 secret = models.CharField(max_length=SECRET_SIZE)
@@ -129,7 +129,7 @@ class Token(models.Model):
129 objects = TokenManager()129 objects = TokenManager()
130130
131 def __unicode__(self):131 def __unicode__(self):
132 return u"%s Token %s for %s" % (132 return "%s Token %s for %s" % (
133 self.get_token_type_display(),133 self.get_token_type_display(),
134 self.key,134 self.key,
135 self.consumer,135 self.consumer,
diff --git a/piston3/oauth.py b/piston3/oauth.py
index 568cb76..eadc71b 100644
--- a/piston3/oauth.py
+++ b/piston3/oauth.py
@@ -147,7 +147,7 @@ class OAuthToken(object):
147147
148 @staticmethod148 @staticmethod
149 def from_string(s):149 def from_string(s):
150 """ Returns a token from something like:150 """Returns a token from something like:
151 oauth_token_secret=xxx&oauth_token=xxx151 oauth_token_secret=xxx&oauth_token=xxx
152 """152 """
153 params = parse_qs(s, keep_blank_values=False)153 params = parse_qs(s, keep_blank_values=False)
diff --git a/piston3/utils.py b/piston3/utils.py
index 0d22132..f9f45e1 100644
--- a/piston3/utils.py
+++ b/piston3/utils.py
@@ -24,7 +24,7 @@ def get_version():
2424
2525
26def format_error(error):26def format_error(error):
27 return u"Piston/%s (Django %s) crash report:\n\n%s" % (27 return "Piston/%s (Django %s) crash report:\n\n%s" % (
28 get_version(),28 get_version(),
29 django_version(),29 django_version(),
30 error,30 error,
diff --git a/piston3/validate_jsonp.py b/piston3/validate_jsonp.py
index 4dbc8dc..81be259 100644
--- a/piston3/validate_jsonp.py
+++ b/piston3/validate_jsonp.py
@@ -132,7 +132,7 @@ def is_valid_javascript_identifier(identifier, escape=r"\u", ucd_cat=category):
132 return False132 return False
133 add_char(segment[4:])133 add_char(segment[4:])
134134
135 identifier = u"".join(new)135 identifier = "".join(new)
136136
137 if is_reserved_js_word(identifier):137 if is_reserved_js_word(identifier):
138 return False138 return False
@@ -155,11 +155,11 @@ def is_valid_javascript_identifier(identifier, escape=r"\u", ucd_cat=category):
155def is_valid_jsonp_callback_value(value):155def is_valid_jsonp_callback_value(value):
156 """Return whether the given ``value`` can be used as a JSON-P callback."""156 """Return whether the given ``value`` can be used as a JSON-P callback."""
157157
158 for identifier in value.split(u"."):158 for identifier in value.split("."):
159 while "[" in identifier:159 while "[" in identifier:
160 if not has_valid_array_index(identifier):160 if not has_valid_array_index(identifier):
161 return False161 return False
162 identifier = replace_array_index(u"", identifier)162 identifier = replace_array_index("", identifier)
163 if not is_valid_javascript_identifier(identifier):163 if not is_valid_javascript_identifier(identifier):
164 return False164 return False
165165
diff --git a/tests/test_project/apps/testapp/tests.py b/tests/test_project/apps/testapp/tests.py
index d183439..0fc94af 100644
--- a/tests/test_project/apps/testapp/tests.py
+++ b/tests/test_project/apps/testapp/tests.py
@@ -82,8 +82,7 @@ class OAuthTests(MainTests):
82 self.consumer.delete()82 self.consumer.delete()
8383
84 def test_handshake(self):84 def test_handshake(self):
85 """Test the OAuth handshake procedure85 """Test the OAuth handshake procedure"""
86 """
87 oaconsumer = oauth.OAuthConsumer(self.consumer.key, self.consumer.secret)86 oaconsumer = oauth.OAuthConsumer(self.consumer.key, self.consumer.secret)
8887
89 # Get a request key...88 # Get a request key...
@@ -219,7 +218,8 @@ class MultiXMLTests(MainTests):
219 )218 )
220 result_xml = ElementTree.fromstring(result.content)219 result_xml = ElementTree.fromstring(result.content)
221 self.assertCountEqual(220 self.assertCountEqual(
222 [elem.tag for elem in result_xml], ["test1", "test2", "resource_uri"],221 [elem.tag for elem in result_xml],
222 ["test1", "test2", "resource_uri"],
223 )223 )
224224
225225
diff --git a/tests/tests.py b/tests/tests.py
index f2ff15f..c25072a 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -49,7 +49,7 @@ class ConsumerTest(TestCase):
49 return False49 return False
5050
51 def test_create_pending(self):51 def test_create_pending(self):
52 """ Ensure creating a pending Consumer sends proper emails """52 """Ensure creating a pending Consumer sends proper emails"""
53 # Verify if the emails can be sent53 # Verify if the emails can be sent
54 if not self._pre_test_email():54 if not self._pre_test_email():
55 return55 return
@@ -65,7 +65,7 @@ class ConsumerTest(TestCase):
65 self.assertEqual(mail.outbox[0].subject, expected)65 self.assertEqual(mail.outbox[0].subject, expected)
6666
67 def test_delete_consumer(self):67 def test_delete_consumer(self):
68 """ Ensure deleting a Consumer sends a cancel email """68 """Ensure deleting a Consumer sends a cancel email"""
6969
70 # Clear out the outbox before we test for the cancel email.70 # Clear out the outbox before we test for the cancel email.
71 mail.outbox = []71 mail.outbox = []

Subscribers

People subscribed via source and target branches