Flake8 changes
Adding comments for all ignores and extensions. Adding extensions from OpenStack Hacking. Fixing few breakages of those added extensions. Change-Id: Idacee2ca555411e33b65817fb9245d130cf36574
This commit is contained in:
1
AUTHORS
1
AUTHORS
@@ -1,4 +1,5 @@
|
||||
Chris Sibbitt <csibbitt@redhat.com>
|
||||
Erno Kuvaja <jokke@usr.fi>
|
||||
Jaromír Wysoglad <jwysogla@redhat.com>
|
||||
Leif Madsen <leif@leifmadsen.com>
|
||||
Leif Madsen <lmadsen@redhat.com>
|
||||
|
@@ -47,14 +47,14 @@ class PrometheusAPIClientError(Exception):
|
||||
return f'[{decoded.status}]'
|
||||
|
||||
|
||||
class PrometheusMetric:
|
||||
class PrometheusMetric(object):
|
||||
def __init__(self, input):
|
||||
self.timestamp = input['value'][0]
|
||||
self.labels = input['metric']
|
||||
self.value = input['value'][1]
|
||||
|
||||
|
||||
class PrometheusAPIClient:
|
||||
class PrometheusAPIClient(object):
|
||||
def __init__(self, host):
|
||||
self._host = host
|
||||
self._session = requests.Session()
|
||||
|
@@ -16,7 +16,6 @@ from unittest import mock
|
||||
|
||||
from keystoneauth1.exceptions.auth_plugins import MissingAuthPlugin
|
||||
from keystoneauth1 import session
|
||||
|
||||
import testtools
|
||||
|
||||
from observabilityclient.v1 import rbac
|
||||
@@ -44,7 +43,7 @@ class RbacTest(testtools.TestCase):
|
||||
with mock.patch.object(session.Session, 'get_project_id',
|
||||
side_effect=MissingAuthPlugin()):
|
||||
r = rbac.Rbac("client", session.Session(), False)
|
||||
self.assertEqual(r.project_id, None)
|
||||
self.assertIsNone(r.project_id)
|
||||
|
||||
def test_enrich_query(self):
|
||||
test_cases = [
|
||||
|
@@ -40,7 +40,7 @@ class GetConfigFileTest(testtools.TestCase):
|
||||
with mock.patch.object(os.path, 'exists', return_value=False) as m:
|
||||
ret = metric_utils.get_config_file()
|
||||
m.call_args_list == expected
|
||||
self.assertEqual(ret, None)
|
||||
self.assertIsNone(ret)
|
||||
|
||||
|
||||
class GetPrometheusClientTest(testtools.TestCase):
|
||||
|
@@ -23,7 +23,7 @@ class ObservabilityRbacError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class Rbac():
|
||||
class Rbac(object):
|
||||
def __init__(self, client, session, disable_rbac=False):
|
||||
self.client = client
|
||||
self.session = session
|
||||
|
31
tox.ini
31
tox.ini
@@ -37,9 +37,34 @@ commands = observabilityclient {posargs:observabilityclient/tests}
|
||||
|
||||
[flake8]
|
||||
show-source = True
|
||||
ignore = D100,D101,D102,D103,D104,D105,D106,D107,A002,A003,W504,W503
|
||||
exclude=.git,.tox,dist,doc,*egg,build
|
||||
enable-extensions=G
|
||||
# A002 argument "input" is shadowing a python builtin
|
||||
# A003 class attribute "list" is shadowing a python builtin
|
||||
# D100 Missing docstring in public module
|
||||
# D101 Missing docstring in public class
|
||||
# D102 Missing docstring in public method
|
||||
# D103 Missing docstring in public function
|
||||
# D104 Missing docstring in public package
|
||||
# D105 Missing docstring in magic method
|
||||
# D106 Missing docstring in public nested class
|
||||
# D107 Missing docstring in __init__
|
||||
# W503 line break before binary operator
|
||||
# W504 line break after binary operator
|
||||
ignore = A002,A003,D100,D101,D102,D103,D104,D105,D106,D107,W503,W504
|
||||
exclude=.venv,.git,.tox,dist,doc,*egg,build
|
||||
# [H101] Include your name with TODOs as in # TODO(yourname).
|
||||
# [H104] Empty files should not contain license or comments
|
||||
# [H106] Do not put vim configuration in source files.
|
||||
# [H201] Do not write except:, use except Exception: at the very least.
|
||||
# [H202] Testing for Exception being raised
|
||||
# [H203] Use assertIs(Not)None to check for None.
|
||||
# [H204] Use assert(Not)Equal to check for equality.
|
||||
# [H205] Use assert(Greater|Less)(Equal) for comparison.
|
||||
# [H23] Py3 compat
|
||||
# [H301] Do not import more than one module per line (*)
|
||||
# [H303] Do not use wildcard * import (*)
|
||||
# [H304] Do not make relative imports
|
||||
# [H306] Alphabetically order your imports by the full module path.
|
||||
enable-extensions=G,H101,H104,H106,H201,H202,H203,H204,H205,H23,H301,H303,H304,H306
|
||||
application-import-names = observabilityclient
|
||||
|
||||
[pytest]
|
||||
|
Reference in New Issue
Block a user