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
max-module-lines=1500
[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=
too-many-positional-arguments,
duplicate-code,
fixme,
invalid-name,
bad-continuation,
bad-whitespace,
consider-using-f-string,
too-few-public-methods,
too-many-locals,
......
......@@ -89,7 +89,7 @@ class RetryingCaucaseClient(CaucaseClient):
u'Got a network error, retrying at %s, %s: %r' % (
next_try.strftime(u'%Y-%m-%d %H:%M:%S +0000'),
exception.__class__.__name__,
unicode(exception),
unicode(exception), # pylint: disable=possibly-used-before-assignment
),
file=self._log_file,
)
......
......@@ -48,7 +48,7 @@ class NoReentryConnection(sqlite3.Connection):
def __enter__(self):
if self.__entered: # pragma: no cover
raise Exception('Subtransactions are not supported')
raise RuntimeError('Subtransactions are not supported')
self.__entered = True
return super(NoReentryConnection, self).__enter__()
......
......@@ -24,6 +24,7 @@ Caucase - Certificate Authority for Users, Certificate Authority for SErvices
Test suite
"""
# pylint: disable=too-many-lines, too-many-public-methods
# pylint: disable=unbalanced-tuple-unpacking
from __future__ import absolute_import
try:
from http.cookies import SimpleCookie
......@@ -160,7 +161,9 @@ else: # pragma: no cover
"""
For forward-compatibility wit 3.x unittest API.
"""
# pylint: disable=no-member
assertRegex = unittest.TestCase.assertRegexpMatches
# pylint: enable=no-member
class assertHTMLNoScriptAlert(
html_parser.HTMLParser,
......@@ -216,8 +219,7 @@ def canConnect(address): # pragma: no cover
if e.errno == errno.ECONNREFUSED:
return False
raise
else:
sock.close()
sock.close()
return True
def retry(callback, try_count=10, try_delay=0.1): # pragma: no cover
......@@ -831,7 +833,7 @@ class CaucaseTest(TestCase):
while True:
row = c.fetchone()
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']))
if crt.serial_number == serial:
new_crt = self._setCertificateRemainingLifeTime(
......
......@@ -779,7 +779,9 @@ def toUnicode(value, encoding='ascii'):
"""
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)
# pylint: enable=possibly-used-before-assignment
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