Commit 40a89260 authored by Vincent Pelletier's avatar Vincent Pelletier

all: Make pylint happier.

parent 6c612e22
[MASTER] [MASTER]
ignore=_version.py ignore=_version.py
[DESIGN]
max-args=12
max-nested-blocks=6
max-module-lines=1500
[MESSAGES CONTROL] [MESSAGES CONTROL]
disable=C0103,C0330,R0903,R0914,R0912,R0915,R0902 disable=C0103,C0330,R0903,R0914,R0912,R0915,R0902
# C0103 "Invalid name "%s" (should match %s)" # C0103 "Invalid name "%s" (should match %s)"
......
...@@ -20,6 +20,7 @@ Caucase - Certificate Authority for Users, Certificate Authority for SErvices ...@@ -20,6 +20,7 @@ Caucase - Certificate Authority for Users, Certificate Authority for SErvices
Test suite Test suite
""" """
# pylint: disable=too-many-lines
from __future__ import absolute_import from __future__ import absolute_import
from Cookie import SimpleCookie from Cookie import SimpleCookie
import datetime import datetime
...@@ -148,8 +149,13 @@ class FakeStreamRequest(object): ...@@ -148,8 +149,13 @@ class FakeStreamRequest(object):
""" """
return self._rfile if 'r' in mode else self._wfile return self._rfile if 'r' in mode else self._wfile
# pylint: disable=unused-argument
def sendall(self, data, flags=None): # pragma: no cover def sendall(self, data, flags=None): # pragma: no cover
"""
Redirect sendall.
"""
self._wfile.write(data) self._wfile.write(data)
# pylint: enable=unused-argument
class NoCloseFileProxy(object): class NoCloseFileProxy(object):
""" """
...@@ -1329,6 +1335,9 @@ class CaucaseTest(unittest.TestCase): ...@@ -1329,6 +1335,9 @@ class CaucaseTest(unittest.TestCase):
)) ))
server_key_file.write(ca_crt_pem) server_key_file.write(ca_crt_pem)
def readServerKey(): def readServerKey():
"""
Read server key from file.
"""
with open(self._server_key, 'rb') as server_key_file: with open(self._server_key, 'rb') as server_key_file:
return server_key_file.read() return server_key_file.read()
reference_server_key = readServerKey() reference_server_key = readServerKey()
...@@ -2570,7 +2579,7 @@ class CaucaseTest(unittest.TestCase): ...@@ -2570,7 +2579,7 @@ class CaucaseTest(unittest.TestCase):
netloc = '[::1]' netloc = '[::1]'
port = urlparse.urlparse(self._caucase_url).port port = urlparse.urlparse(self._caucase_url).port
if port: if port:
netloc += ':%s' % port netloc += ':%s' % port
self._server_netloc = netloc self._server_netloc = netloc
self._caucase_url = 'http://' + netloc self._caucase_url = 'http://' + netloc
self._startServer() self._startServer()
...@@ -2602,10 +2611,12 @@ class CaucaseTest(unittest.TestCase): ...@@ -2602,10 +2611,12 @@ class CaucaseTest(unittest.TestCase):
self.assertEqual(os.stat(self._server_db).st_mode & 0o777, 0o600) self.assertEqual(os.stat(self._server_db).st_mode & 0o777, 0o600)
self.assertEqual(os.stat(self._server_key).st_mode & 0o777, 0o600) self.assertEqual(os.stat(self._server_key).st_mode & 0o777, 0o600)
# pylint: disable=no-member
if getattr(CaucaseTest, 'assertItemsEqual', None) is None: if getattr(CaucaseTest, 'assertItemsEqual', None) is None:
# Because python3 decided it should be named differently, and 2to3 cannot # Because python3 decided it should be named differently, and 2to3 cannot
# pick it up, and this code must remain python2-compatible... Yay ! # pick it up, and this code must remain python2-compatible... Yay !
CaucaseTest.assertItemsEqual = CaucaseTest.assertCountEqual CaucaseTest.assertItemsEqual = CaucaseTest.assertCountEqual
# pylint: enable=no-member
if __name__ == '__main__': # pragma: no cover if __name__ == '__main__': # pragma: no cover
unittest.main() unittest.main()
...@@ -34,10 +34,12 @@ import jwt ...@@ -34,10 +34,12 @@ import jwt
from . import utils from . import utils
from . import exceptions from . import exceptions
# pylint: disable=import-error
if sys.version_info >= (3, ): # pragma: no cover if sys.version_info >= (3, ): # pragma: no cover
from html import escape from html import escape
else: # pragma: no cover else: # pragma: no cover
from cgi import escape from cgi import escape
# pylint: enable=import-error
__all__ = ('Application', 'CORSTokenManager') __all__ = ('Application', 'CORSTokenManager')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment