Skip to content

Commit 9b66889

Browse files
committed
Run a recent version of yapf against everything
1 parent 3a15a91 commit 9b66889

File tree

3 files changed

+24
-53
lines changed

3 files changed

+24
-53
lines changed

docs/conf.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@
2828

2929
# Add any Sphinx extension module names here, as strings. They can be extensions
3030
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
31-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest',
32-
'sphinx.ext.intersphinx', 'sphinx.ext.coverage']
31+
extensions = [
32+
'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx',
33+
'sphinx.ext.coverage'
34+
]
3335

3436
# Add any paths that contain templates here, relative to this directory.
3537
templates_path = ['_templates']
@@ -90,7 +92,6 @@
9092
# A list of ignored prefixes for module index sorting.
9193
#modindex_common_prefix = []
9294

93-
9495
# -- Options for HTML output ---------------------------------------------
9596

9697
# The theme to use for HTML and HTML Help pages. See the documentation for
@@ -170,7 +171,6 @@
170171
# Output file base name for HTML help builder.
171172
htmlhelp_basename = 'geoip2doc'
172173

173-
174174
# -- Options for LaTeX output --------------------------------------------
175175

176176
latex_elements = {
@@ -187,8 +187,8 @@
187187
# Grouping the document tree into LaTeX files. List of tuples
188188
# (source start file, target name, title, author, documentclass [howto/manual]).
189189
latex_documents = [
190-
('index', 'geoip2.tex', 'geoip2 Documentation',
191-
'Gregory Oschwald', 'manual'),
190+
('index', 'geoip2.tex', 'geoip2 Documentation', 'Gregory Oschwald',
191+
'manual'),
192192
]
193193

194194
# The name of an image file (relative to this directory) to place at the top of
@@ -211,29 +211,24 @@
211211
# If false, no module index is generated.
212212
#latex_domain_indices = True
213213

214-
215214
# -- Options for manual page output --------------------------------------
216215

217216
# One entry per manual page. List of tuples
218217
# (source start file, name, description, authors, manual section).
219-
man_pages = [
220-
('index', 'geoip2', 'geoip2 Documentation',
221-
['Gregory Oschwald'], 1)
222-
]
218+
man_pages = [('index', 'geoip2', 'geoip2 Documentation', ['Gregory Oschwald'],
219+
1)]
223220

224221
# If true, show URL addresses after external links.
225222
#man_show_urls = False
226223

227-
228224
# -- Options for Texinfo output ------------------------------------------
229225

230226
# Grouping the document tree into Texinfo files. List of tuples
231227
# (source start file, target name, title, author,
232228
# dir menu entry, description, category)
233229
texinfo_documents = [
234-
('index', 'geoip2', 'geoip2 Documentation',
235-
'Gregory Oschwald', 'geoip2', 'One line description of project.',
236-
'Miscellaneous'),
230+
('index', 'geoip2', 'geoip2 Documentation', 'Gregory Oschwald', 'geoip2',
231+
'One line description of project.', 'Miscellaneous'),
237232
]
238233

239234
# Documents to append as an appendix to all manuals.
@@ -245,6 +240,5 @@
245240
# How to display URL addresses: 'footnote', 'no', or 'inline'.
246241
#texinfo_show_urls = 'footnote'
247242

248-
249243
# Example configuration for intersphinx: refer to the Python standard library.
250244
intersphinx_mapping = {'http://docs.python.org/': None}

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@
4747
'Programming Language :: Python',
4848
'Topic :: Internet :: Proxy Servers',
4949
'Topic :: Internet',
50-
], )
50+
],
51+
)

tests/webservice_test.py

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ def test_country_ok(self, mock):
6767
self.base_uri + 'country/1.2.3.4',
6868
json=self.country,
6969
status_code=200,
70-
headers={
71-
'Content-Type': self._content_type('country')
72-
})
70+
headers={'Content-Type': self._content_type('country')})
7371
country = self.client.country('1.2.3.4')
7472
self.assertEqual(
7573
type(country), geoip2.models.Country,
@@ -101,9 +99,7 @@ def test_me(self, mock):
10199
self.base_uri + 'country/me',
102100
json=self.country,
103101
status_code=200,
104-
headers={
105-
'Content-Type': self._content_type('country')
106-
})
102+
headers={'Content-Type': self._content_type('country')})
107103
implicit_me = self.client.country()
108104
self.assertEqual(
109105
type(implicit_me), geoip2.models.Country,
@@ -118,9 +114,7 @@ def test_200_error(self, mock):
118114
mock.get(
119115
self.base_uri + 'country/1.1.1.1',
120116
status_code=200,
121-
headers={
122-
'Content-Type': self._content_type('country')
123-
})
117+
headers={'Content-Type': self._content_type('country')})
124118
with self.assertRaisesRegex(GeoIP2Error,
125119
'could not decode the response as JSON'):
126120
self.client.country('1.1.1.1')
@@ -137,9 +131,7 @@ def test_no_body_error(self, mock):
137131
self.base_uri + 'country/' + '1.2.3.7',
138132
text='',
139133
status_code=400,
140-
headers={
141-
'Content-Type': self._content_type('country')
142-
})
134+
headers={'Content-Type': self._content_type('country')})
143135
with self.assertRaisesRegex(
144136
HTTPError, 'Received a 400 error for .* with no body'):
145137
self.client.country('1.2.3.7')
@@ -150,9 +142,7 @@ def test_weird_body_error(self, mock):
150142
self.base_uri + 'country/' + '1.2.3.8',
151143
text='{"wierd": 42}',
152144
status_code=400,
153-
headers={
154-
'Content-Type': self._content_type('country')
155-
})
145+
headers={'Content-Type': self._content_type('country')})
156146
with self.assertRaisesRegex(HTTPError,
157147
'Response contains JSON but it does not '
158148
'specify code or error keys'):
@@ -164,9 +154,7 @@ def test_bad_body_error(self, mock):
164154
self.base_uri + 'country/' + '1.2.3.9',
165155
text='bad body',
166156
status_code=400,
167-
headers={
168-
'Content-Type': self._content_type('country')
169-
})
157+
headers={'Content-Type': self._content_type('country')})
170158
with self.assertRaisesRegex(
171159
HTTPError, 'it did not include the expected JSON body'):
172160
self.client.country('1.2.3.9')
@@ -183,9 +171,7 @@ def test_300_error(self, mock):
183171
mock.get(
184172
self.base_uri + 'country/' + '1.2.3.11',
185173
status_code=300,
186-
headers={
187-
'Content-Type': self._content_type('country')
188-
})
174+
headers={'Content-Type': self._content_type('country')})
189175
with self.assertRaisesRegex(HTTPError,
190176
'Received a very surprising HTTP status '
191177
'\(300\) for'):
@@ -248,9 +234,7 @@ def _test_error(self, mock, status, error_code, error_class):
248234
self.base_uri + 'country/1.2.3.18',
249235
json=body,
250236
status_code=status,
251-
headers={
252-
'Content-Type': self._content_type('country')
253-
})
237+
headers={'Content-Type': self._content_type('country')})
254238
with self.assertRaisesRegex(error_class, msg):
255239
self.client.country('1.2.3.18')
256240

@@ -263,9 +247,7 @@ def test_unknown_error(self, mock):
263247
self.base_uri + 'country/' + ip,
264248
json=body,
265249
status_code=400,
266-
headers={
267-
'Content-Type': self._content_type('country')
268-
})
250+
headers={'Content-Type': self._content_type('country')})
269251
with self.assertRaisesRegex(InvalidRequestError, msg):
270252
self.client.country(ip)
271253

@@ -275,9 +257,7 @@ def test_request(self, mock):
275257
self.base_uri + 'country/' + '1.2.3.4',
276258
json=self.country,
277259
status_code=200,
278-
headers={
279-
'Content-Type': self._content_type('country')
280-
})
260+
headers={'Content-Type': self._content_type('country')})
281261
self.client.country('1.2.3.4')
282262
request = mock.request_history[-1]
283263

@@ -296,9 +276,7 @@ def test_city_ok(self, mock):
296276
self.base_uri + 'city/' + '1.2.3.4',
297277
json=self.country,
298278
status_code=200,
299-
headers={
300-
'Content-Type': self._content_type('city')
301-
})
279+
headers={'Content-Type': self._content_type('city')})
302280
city = self.client.city('1.2.3.4')
303281
self.assertEqual(
304282
type(city), geoip2.models.City, 'return value of client.city')
@@ -309,9 +287,7 @@ def test_insights_ok(self, mock):
309287
self.base_uri + 'insights/1.2.3.4',
310288
json=self.country,
311289
status_code=200,
312-
headers={
313-
'Content-Type': self._content_type('country')
314-
})
290+
headers={'Content-Type': self._content_type('country')})
315291
insights = self.client.insights('1.2.3.4')
316292
self.assertEqual(
317293
type(insights), geoip2.models.Insights,

0 commit comments

Comments
 (0)