Commit 7cfcbccc authored by Vincent Pelletier's avatar Vincent Pelletier

all: Make pylint happy

As of pylint 3.3.1 on CPython 3.12.
The only remaining warning is that the cgi module is deprecated, and will
disappear in python 3.13 . Fun.
parent 609921a3
...@@ -7,12 +7,15 @@ max-nested-blocks=6 ...@@ -7,12 +7,15 @@ max-nested-blocks=6
max-module-lines=1500 max-module-lines=1500
[MESSAGES CONTROL] [MESSAGES CONTROL]
# Note about too-many-positional-arguments: I would like to enable it, but it
# triggers on callable definition unless using the "*" argument synatx to
# actively forbid positional calls. Except this would break compatibility with
# older python versions, so it is a no-go.
disable= disable=
too-many-positional-arguments,
duplicate-code, duplicate-code,
fixme, fixme,
invalid-name, invalid-name,
bad-continuation,
bad-whitespace,
consider-using-f-string, consider-using-f-string,
too-few-public-methods, too-few-public-methods,
too-many-locals, too-many-locals,
......
...@@ -89,7 +89,7 @@ class RetryingCaucaseClient(CaucaseClient): ...@@ -89,7 +89,7 @@ class RetryingCaucaseClient(CaucaseClient):
u'Got a network error, retrying at %s, %s: %r' % ( u'Got a network error, retrying at %s, %s: %r' % (
next_try.strftime(u'%Y-%m-%d %H:%M:%S +0000'), next_try.strftime(u'%Y-%m-%d %H:%M:%S +0000'),
exception.__class__.__name__, exception.__class__.__name__,
unicode(exception), unicode(exception), # pylint: disable=possibly-used-before-assignment
), ),
file=self._log_file, file=self._log_file,
) )
......
...@@ -48,7 +48,7 @@ class NoReentryConnection(sqlite3.Connection): ...@@ -48,7 +48,7 @@ class NoReentryConnection(sqlite3.Connection):
def __enter__(self): def __enter__(self):
if self.__entered: # pragma: no cover if self.__entered: # pragma: no cover
raise Exception('Subtransactions are not supported') raise RuntimeError('Subtransactions are not supported')
self.__entered = True self.__entered = True
return super(NoReentryConnection, self).__enter__() return super(NoReentryConnection, self).__enter__()
......
...@@ -24,6 +24,7 @@ Caucase - Certificate Authority for Users, Certificate Authority for SErvices ...@@ -24,6 +24,7 @@ Caucase - Certificate Authority for Users, Certificate Authority for SErvices
Test suite Test suite
""" """
# pylint: disable=too-many-lines, too-many-public-methods # pylint: disable=too-many-lines, too-many-public-methods
# pylint: disable=unbalanced-tuple-unpacking
from __future__ import absolute_import from __future__ import absolute_import
try: try:
from http.cookies import SimpleCookie from http.cookies import SimpleCookie
...@@ -160,7 +161,9 @@ else: # pragma: no cover ...@@ -160,7 +161,9 @@ else: # pragma: no cover
""" """
For forward-compatibility wit 3.x unittest API. For forward-compatibility wit 3.x unittest API.
""" """
# pylint: disable=no-member
assertRegex = unittest.TestCase.assertRegexpMatches assertRegex = unittest.TestCase.assertRegexpMatches
# pylint: enable=no-member
class assertHTMLNoScriptAlert( class assertHTMLNoScriptAlert(
html_parser.HTMLParser, html_parser.HTMLParser,
...@@ -216,7 +219,6 @@ def canConnect(address): # pragma: no cover ...@@ -216,7 +219,6 @@ def canConnect(address): # pragma: no cover
if e.errno == errno.ECONNREFUSED: if e.errno == errno.ECONNREFUSED:
return False return False
raise raise
else:
sock.close() sock.close()
return True return True
...@@ -831,7 +833,7 @@ class CaucaseTest(TestCase): ...@@ -831,7 +833,7 @@ class CaucaseTest(TestCase):
while True: while True:
row = c.fetchone() row = c.fetchone()
if row is None: # pragma: no cover if row is None: # pragma: no cover
raise Exception('CA with serial %r not found' % (serial, )) raise ValueError('CA with serial %r not found' % (serial, ))
crt = utils.load_ca_certificate(utils.toBytes(row['crt'])) crt = utils.load_ca_certificate(utils.toBytes(row['crt']))
if crt.serial_number == serial: if crt.serial_number == serial:
new_crt = self._setCertificateRemainingLifeTime( new_crt = self._setCertificateRemainingLifeTime(
......
...@@ -779,7 +779,9 @@ def toUnicode(value, encoding='ascii'): ...@@ -779,7 +779,9 @@ def toUnicode(value, encoding='ascii'):
""" """
Convert value to unicode object, if it is not already. Convert value to unicode object, if it is not already.
""" """
# pylint: disable=possibly-used-before-assignment
return value if isinstance(value, unicode) else value.decode(encoding) return value if isinstance(value, unicode) else value.decode(encoding)
# pylint: enable=possibly-used-before-assignment
def toBytes(value, encoding='ascii'): def toBytes(value, encoding='ascii'):
""" """
......
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