Skip to content

Commit 68b096a

Browse files
committed
chore: apply flake8 linting
Signed-off-by: Adrien Barreau <adrien.barreau@ovhcloud.com>
1 parent fab8863 commit 68b096a

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

.flake8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[pycodestyle]
2+
max_line_length = 120
3+
4+
[flake8]
5+
max-line-length = 120
6+
ignore = W503

docs/conf.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
# All configuration values have a default; values that are commented out
1313
# serve to show the default.
1414

15-
import os
16-
import sys
17-
1815
# If extensions (or modules to document with autodoc) are in another directory,
1916
# add these directories to sys.path here. If the directory is relative to the
2017
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -188,11 +185,11 @@
188185

189186
latex_elements = {
190187
# The paper size ('letterpaper' or 'a4paper').
191-
#'papersize': 'letterpaper',
188+
# 'papersize': 'letterpaper',
192189
# The font size ('10pt', '11pt' or '12pt').
193-
#'pointsize': '10pt',
190+
# 'pointsize': '10pt',
194191
# Additional stuff for the LaTeX preamble.
195-
#'preamble': '',
192+
# 'preamble': '',
196193
}
197194

198195
# Grouping the document tree into LaTeX files. List of tuples

ovh/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2727
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828

29+
# flake8: noqa
2930
from .client import Client
3031
from .consumer_key import API_READ_ONLY, API_READ_WRITE, API_READ_WRITE_SAFE, ConsumerKeyRequest
3132
from .exceptions import (

ovh/client.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,15 @@
3838
import json
3939
import keyword
4040
import time
41-
import urllib
4241

4342
try:
4443
from urllib import urlencode
4544
except ImportError: # pragma: no cover
4645
# Python 3
4746
from urllib.parse import urlencode
4847

49-
from requests import Session, request
48+
from requests import Session
5049
from requests.exceptions import RequestException
51-
from requests.packages import urllib3
5250

5351
from .config import config
5452
from .consumer_key import ConsumerKeyRequest
@@ -189,7 +187,7 @@ def __init__(
189187
# Override default timeout
190188
self._timeout = timeout
191189

192-
## high level API
190+
# high level API
193191

194192
@property
195193
def time_delta(self):
@@ -230,7 +228,7 @@ def new_consumer_key_request(self):
230228
'consumerKey': 'TnpZAd5pYNqxk4RhlPiSRfJ4WrkmII2i',
231229
'validationUrl': 'https://eu.api.ovh.com/auth/?credentialToken=now2OOAVO4Wp6t7bemyN9DMWIobhGjFNZSHmixtVJM4S7mzjkN2L5VBfG96Iy1i0'
232230
}
233-
"""
231+
""" # noqa:E501
234232
return ConsumerKeyRequest(self)
235233

236234
def request_consumerkey(self, access_rules, redirect_url=None):
@@ -294,7 +292,7 @@ def request_consumerkey(self, access_rules, redirect_url=None):
294292
self._consumer_key = res["consumerKey"]
295293
return res
296294

297-
## API shortcuts
295+
# API shortcuts
298296

299297
def _canonicalize_kwargs(self, kwargs):
300298
"""
@@ -413,7 +411,7 @@ def delete(self, _target, _need_auth=True, **kwargs):
413411

414412
return self.call("DELETE", _target, None, _need_auth)
415413

416-
## low level helpers
414+
# low level helpers
417415

418416
def call(self, method, path, data=None, need_auth=True):
419417
"""

ovh/consumer_key.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def request(self, redirect_url=None):
7474
'consumerKey': 'TnpZAd5pYNqxk4RhlPiSRfJ4WrkmII2i',
7575
'validationUrl': 'https://eu.api.ovh.com/auth/?credentialToken=now2OOAVO4Wp6t7bemyN9DMWIobhGjFNZSHmixtVJM4S7mzjkN2L5VBfG96Iy1i0'
7676
}
77-
"""
77+
""" # noqa: E501
7878
return self._client.request_consumerkey(self._access_rules, redirect_url)
7979

8080
def add_rule(self, method, path):

tests/test_client.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
NetworkError,
4747
NotCredential,
4848
NotGrantedCall,
49-
ReadOnlyError,
5049
ResourceConflictError,
5150
ResourceExpiredError,
5251
ResourceNotFoundError,
@@ -84,7 +83,7 @@ def setUp(self):
8483
def tearDown(self):
8584
self.time_patch.stop()
8685

87-
## test helpers
86+
# test helpers
8887

8988
def test_init(self):
9089
# nominal
@@ -168,7 +167,7 @@ def test_new_consumer_key_request(self):
168167
ck = api.new_consumer_key_request()
169168
self.assertEqual(ck._client, api)
170169

171-
## test wrappers
170+
# test wrappers
172171

173172
def test__canonicalize_kwargs(self):
174173
api = Client(ENDPOINT, APPLICATION_KEY, APPLICATION_SECRET, CONSUMER_KEY)
@@ -209,7 +208,7 @@ def test_get(self, m_call):
209208
self.assertEqual(m_call.return_value, api.get(FAKE_URL, _from="start", to="end"))
210209
try:
211210
m_call.assert_called_once_with("GET", FAKE_URL + "?to=end&from=start", None, True)
212-
except:
211+
except Exception:
213212
m_call.assert_called_once_with("GET", FAKE_URL + "?from=start&to=end", None, True)
214213

215214
@mock.patch.object(Client, "call")
@@ -243,7 +242,7 @@ def test_delete(self, m_call):
243242
self.assertEqual(m_call.return_value, api.delete(FAKE_URL, _from="start", to="end"))
244243
try:
245244
m_call.assert_called_once_with("DELETE", FAKE_URL + "?to=end&from=start", None, True)
246-
except:
245+
except Exception:
247246
m_call.assert_called_once_with("DELETE", FAKE_URL + "?from=start&to=end", None, True)
248247

249248
@mock.patch.object(Client, "call")
@@ -284,7 +283,7 @@ def test_put_no_body(self, m_call):
284283
self.assertEqual(m_call.return_value, api.put(FAKE_URL))
285284
m_call.assert_called_once_with("PUT", FAKE_URL, None, True)
286285

287-
## test core function
286+
# test core function
288287

289288
@mock.patch("ovh.client.Session.request")
290289
def test_call_no_sign(self, m_req):
@@ -366,7 +365,6 @@ def test_call_no_sign(self, m_req):
366365
@mock.patch("ovh.client.Session.request")
367366
def test_call_query_id(self, m_req):
368367
m_res = m_req.return_value
369-
m_json = m_res.json.return_value
370368
m_res.headers = {"X-OVH-QUERYID": "FR.test1"}
371369

372370
api = Client(ENDPOINT, APPLICATION_KEY, APPLICATION_SECRET)

0 commit comments

Comments
 (0)