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
1diff --git a/piston3/authentication.py b/piston3/authentication.py
2index 474d6b6..a5ee0da 100644
3--- a/piston3/authentication.py
4+++ b/piston3/authentication.py
5@@ -88,7 +88,7 @@ class HttpBasicAuthentication(object):
6 return resp
7
8 def __repr__(self):
9- return u"<HTTPBasic: realm=%s>" % self.realm
10+ return "<HTTPBasic: realm=%s>" % self.realm
11
12
13 class HttpBasicSimple(HttpBasicAuthentication):
14@@ -104,8 +104,7 @@ class HttpBasicSimple(HttpBasicAuthentication):
15
16
17 def load_data_store():
18- """Load data store for OAuth Consumers, Tokens, Nonces and Resources
19- """
20+ """Load data store for OAuth Consumers, Tokens, Nonces and Resources"""
21 path = getattr(settings, "OAUTH_DATA_STORE", "piston3.store.DataStore")
22
23 # stolen from django.contrib.auth.load_backend
24diff --git a/piston3/doc.py b/piston3/doc.py
25index ba8d412..8efc9c4 100644
26--- a/piston3/doc.py
27+++ b/piston3/doc.py
28@@ -151,7 +151,7 @@ class HandlerDocumentation(object):
29 def _convert(template, params=[]):
30 """URI template converter"""
31 paths = template % dict([p, "{%s}" % p] for p in params)
32- return u"%s%s" % (get_script_prefix(), paths)
33+ return "%s%s" % (get_script_prefix(), paths)
34
35 try:
36 resource_uri = self.handler.resource_uri()
37@@ -187,7 +187,7 @@ class HandlerDocumentation(object):
38 resource_uri_template = property(get_resource_uri_template)
39
40 def __repr__(self):
41- return u'<Documentation for "%s">' % self.name
42+ return '<Documentation for "%s">' % self.name
43
44
45 def documentation_view(request):
46diff --git a/piston3/emitters.py b/piston3/emitters.py
47index 375bef3..d0fa1b6 100644
48--- a/piston3/emitters.py
49+++ b/piston3/emitters.py
50@@ -105,7 +105,7 @@ class Emitter(object):
51
52 if thing in self.stack:
53 raise RuntimeError(
54- u"Circular reference detected while emitting " "response"
55+ "Circular reference detected while emitting " "response"
56 )
57
58 self.stack.append(thing)
59diff --git a/piston3/managers.py b/piston3/managers.py
60index cd36ed5..f90ed45 100644
61--- a/piston3/managers.py
62+++ b/piston3/managers.py
63@@ -6,8 +6,7 @@ SECRET_SIZE = 32
64
65
66 class KeyManager(models.Manager):
67- """Add support for random key/secret generation
68- """
69+ """Add support for random key/secret generation"""
70
71 def generate_random_codes(self):
72 key = User.objects.make_random_password(length=KEY_SIZE)
73diff --git a/piston3/models.py b/piston3/models.py
74index 688fb8b..a845cdd 100644
75--- a/piston3/models.py
76+++ b/piston3/models.py
77@@ -51,7 +51,7 @@ class Nonce(models.Model):
78 key = models.CharField(max_length=255)
79
80 def __unicode__(self):
81- return u"Nonce %s for %s" % (self.key, self.consumer_key)
82+ return "Nonce %s for %s" % (self.key, self.consumer_key)
83
84 class Meta:
85 # This is mostly useful to speed up Nonces lookups, as the table can
86@@ -78,7 +78,7 @@ class Consumer(models.Model):
87 objects = ConsumerManager()
88
89 def __unicode__(self):
90- return u"Consumer %s with key %s" % (self.name, self.key)
91+ return "Consumer %s with key %s" % (self.name, self.key)
92
93 def generate_random_codes(self):
94 """
95@@ -105,7 +105,7 @@ class Consumer(models.Model):
96 class Token(models.Model):
97 REQUEST = 1
98 ACCESS = 2
99- TOKEN_TYPES = ((REQUEST, u"Request"), (ACCESS, u"Access"))
100+ TOKEN_TYPES = ((REQUEST, "Request"), (ACCESS, "Access"))
101
102 key = models.CharField(max_length=KEY_SIZE)
103 secret = models.CharField(max_length=SECRET_SIZE)
104@@ -129,7 +129,7 @@ class Token(models.Model):
105 objects = TokenManager()
106
107 def __unicode__(self):
108- return u"%s Token %s for %s" % (
109+ return "%s Token %s for %s" % (
110 self.get_token_type_display(),
111 self.key,
112 self.consumer,
113diff --git a/piston3/oauth.py b/piston3/oauth.py
114index 568cb76..eadc71b 100644
115--- a/piston3/oauth.py
116+++ b/piston3/oauth.py
117@@ -147,7 +147,7 @@ class OAuthToken(object):
118
119 @staticmethod
120 def from_string(s):
121- """ Returns a token from something like:
122+ """Returns a token from something like:
123 oauth_token_secret=xxx&oauth_token=xxx
124 """
125 params = parse_qs(s, keep_blank_values=False)
126diff --git a/piston3/utils.py b/piston3/utils.py
127index 0d22132..f9f45e1 100644
128--- a/piston3/utils.py
129+++ b/piston3/utils.py
130@@ -24,7 +24,7 @@ def get_version():
131
132
133 def format_error(error):
134- return u"Piston/%s (Django %s) crash report:\n\n%s" % (
135+ return "Piston/%s (Django %s) crash report:\n\n%s" % (
136 get_version(),
137 django_version(),
138 error,
139diff --git a/piston3/validate_jsonp.py b/piston3/validate_jsonp.py
140index 4dbc8dc..81be259 100644
141--- a/piston3/validate_jsonp.py
142+++ b/piston3/validate_jsonp.py
143@@ -132,7 +132,7 @@ def is_valid_javascript_identifier(identifier, escape=r"\u", ucd_cat=category):
144 return False
145 add_char(segment[4:])
146
147- identifier = u"".join(new)
148+ identifier = "".join(new)
149
150 if is_reserved_js_word(identifier):
151 return False
152@@ -155,11 +155,11 @@ def is_valid_javascript_identifier(identifier, escape=r"\u", ucd_cat=category):
153 def is_valid_jsonp_callback_value(value):
154 """Return whether the given ``value`` can be used as a JSON-P callback."""
155
156- for identifier in value.split(u"."):
157+ for identifier in value.split("."):
158 while "[" in identifier:
159 if not has_valid_array_index(identifier):
160 return False
161- identifier = replace_array_index(u"", identifier)
162+ identifier = replace_array_index("", identifier)
163 if not is_valid_javascript_identifier(identifier):
164 return False
165
166diff --git a/tests/test_project/apps/testapp/tests.py b/tests/test_project/apps/testapp/tests.py
167index d183439..0fc94af 100644
168--- a/tests/test_project/apps/testapp/tests.py
169+++ b/tests/test_project/apps/testapp/tests.py
170@@ -82,8 +82,7 @@ class OAuthTests(MainTests):
171 self.consumer.delete()
172
173 def test_handshake(self):
174- """Test the OAuth handshake procedure
175- """
176+ """Test the OAuth handshake procedure"""
177 oaconsumer = oauth.OAuthConsumer(self.consumer.key, self.consumer.secret)
178
179 # Get a request key...
180@@ -219,7 +218,8 @@ class MultiXMLTests(MainTests):
181 )
182 result_xml = ElementTree.fromstring(result.content)
183 self.assertCountEqual(
184- [elem.tag for elem in result_xml], ["test1", "test2", "resource_uri"],
185+ [elem.tag for elem in result_xml],
186+ ["test1", "test2", "resource_uri"],
187 )
188
189
190diff --git a/tests/tests.py b/tests/tests.py
191index f2ff15f..c25072a 100644
192--- a/tests/tests.py
193+++ b/tests/tests.py
194@@ -49,7 +49,7 @@ class ConsumerTest(TestCase):
195 return False
196
197 def test_create_pending(self):
198- """ Ensure creating a pending Consumer sends proper emails """
199+ """Ensure creating a pending Consumer sends proper emails"""
200 # Verify if the emails can be sent
201 if not self._pre_test_email():
202 return
203@@ -65,7 +65,7 @@ class ConsumerTest(TestCase):
204 self.assertEqual(mail.outbox[0].subject, expected)
205
206 def test_delete_consumer(self):
207- """ Ensure deleting a Consumer sends a cancel email """
208+ """Ensure deleting a Consumer sends a cancel email"""
209
210 # Clear out the outbox before we test for the cancel email.
211 mail.outbox = []

Subscribers

People subscribed via source and target branches