From 9d29d06c1eb6fde9233c0fe87cc5f09a2f8d02f6 Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Thu, 4 Apr 2024 06:24:00 +0000 Subject: [PATCH] Remove last remaining pylint comments (#194) --- src/persistent/mapping.py | 2 +- src/persistent/persistence.py | 10 ---------- src/persistent/picklecache.py | 5 ----- src/persistent/ring.py | 7 ++----- src/persistent/tests/test__compat.py | 2 +- src/persistent/tests/test_docs.py | 3 --- src/persistent/tests/test_list.py | 2 -- src/persistent/tests/test_mapping.py | 2 -- src/persistent/tests/test_persistence.py | 7 ------- src/persistent/tests/test_picklecache.py | 3 --- src/persistent/tests/test_ring.py | 2 -- src/persistent/tests/test_timestamp.py | 2 -- src/persistent/timestamp.py | 4 +--- 13 files changed, 5 insertions(+), 46 deletions(-) diff --git a/src/persistent/mapping.py b/src/persistent/mapping.py index 221358f..0c1b346 100644 --- a/src/persistent/mapping.py +++ b/src/persistent/mapping.py @@ -141,7 +141,7 @@ def popitem(self): # ``data`` when we have ``_container`` instead @default - def data(self): # pylint:disable=method-hidden + def data(self): # We don't want to cause a write on read, so we're careful not to # do anything that would cause us to become marked as changed, however, # if we're modified, then the saved record will have data, not diff --git a/src/persistent/persistence.py b/src/persistent/persistence.py index 3d72574..3f84a99 100644 --- a/src/persistent/persistence.py +++ b/src/persistent/persistence.py @@ -29,14 +29,6 @@ 'PersistentPy', ] -# We use implementation details of PickleCachePy -# pylint:disable=protected-access -# we have lots of not-quite-correct continuation indentation. -# TODO: Fix that in a whitespace-only commit. -# pylint:disable=bad-continuation -# There are a few places we need to work with exact types. -# pylint:disable=unidiomatic-typecheck - _INITIAL_SERIAL = _ZERO @@ -346,7 +338,6 @@ def __getstate__(self): if idict is not None: # TODO: Convert to a dictionary comprehension, avoid the # intermediate list. - # pylint:disable=consider-using-dict-comprehension d = dict([x for x in idict.items() if not x[0].startswith('_p_') and not x[0].startswith('_v_')]) @@ -588,7 +579,6 @@ def _p_is_in_cache(self, jar=None): return None def __repr__(self): - # pylint:disable=broad-except p_repr_str = '' p_repr = getattr(type(self), '_p_repr', None) if p_repr is not None: diff --git a/src/persistent/picklecache.py b/src/persistent/picklecache.py index 3172836..325af8d 100644 --- a/src/persistent/picklecache.py +++ b/src/persistent/picklecache.py @@ -34,11 +34,6 @@ 'PickleCachePy', ] -# We're tightly coupled to the PersistentPy implementation and access -# its internals. -# pylint:disable=protected-access - - _OGA = object.__getattribute__ _OSA = object.__setattr__ diff --git a/src/persistent/ring.py b/src/persistent/ring.py index 904c809..1fee7d6 100644 --- a/src/persistent/ring.py +++ b/src/persistent/ring.py @@ -12,9 +12,6 @@ # ############################################################################## -# pylint:disable=inherit-non-class,no-self-argument,redefined-builtin,c-extension-no-member -# pylint:disable=protected-access - from zope.interface import Interface from zope.interface import implementer @@ -32,7 +29,7 @@ class IRing(Interface): implementations by explaining assumptions and performance requirements. """ - def __len__(): # pylint:disable=no-method-argument + def __len__(): """Return the number of persistent objects stored in the ring. Should be constant time. @@ -74,7 +71,7 @@ def move_to_head(object): allowed. """ - def __iter__(): # pylint:disable=no-method-argument + def __iter__(): """Iterate over each persistent object in the ring, in the order of least recently used to most recently used. diff --git a/src/persistent/tests/test__compat.py b/src/persistent/tests/test__compat.py index e6bf109..10e379d 100644 --- a/src/persistent/tests/test__compat.py +++ b/src/persistent/tests/test__compat.py @@ -23,7 +23,7 @@ class TestCOptimizationsFuncs(unittest.TestCase): - # pylint:disable=protected-access + def setUp(self): self.env_val = os.environ.get('PURE_PYTHON', self) self.orig_pypy = compat.PYPY diff --git a/src/persistent/tests/test_docs.py b/src/persistent/tests/test_docs.py index 1b52a51..0d68703 100644 --- a/src/persistent/tests/test_docs.py +++ b/src/persistent/tests/test_docs.py @@ -16,9 +16,6 @@ """ -# disable: accessing protected members, too many methods -# pylint: disable=W0212,R0904 - import doctest import os.path import unittest diff --git a/src/persistent/tests/test_list.py b/src/persistent/tests/test_list.py index ed84ac8..2cc32ff 100644 --- a/src/persistent/tests/test_list.py +++ b/src/persistent/tests/test_list.py @@ -24,8 +24,6 @@ l1 = [0] l2 = [0, 1] -# pylint:disable=protected-access - class OtherList: def __init__(self, initlist): diff --git a/src/persistent/tests/test_mapping.py b/src/persistent/tests/test_mapping.py index 36a6983..d96b9ac 100644 --- a/src/persistent/tests/test_mapping.py +++ b/src/persistent/tests/test_mapping.py @@ -17,8 +17,6 @@ from persistent.tests.utils import copy_test -# pylint:disable=blacklisted-name, protected-access - class Test_default(unittest.TestCase): def _getTargetClass(self): diff --git a/src/persistent/tests/test_persistence.py b/src/persistent/tests/test_persistence.py index 0887b5e..8d91266 100644 --- a/src/persistent/tests/test_persistence.py +++ b/src/persistent/tests/test_persistence.py @@ -21,13 +21,6 @@ from persistent.tests.utils import skipIfNoCExtension -# pylint:disable=R0904,W0212,E1101 -# pylint:disable=attribute-defined-outside-init,too-many-lines -# pylint:disable=blacklisted-name,useless-object-inheritance -# Hundreds of unused jar and OID vars make this useless -# pylint:disable=unused-variable - - class _Persistent_Base: def _getTargetClass(self): diff --git a/src/persistent/tests/test_picklecache.py b/src/persistent/tests/test_picklecache.py index c3a860a..a2ce7a7 100644 --- a/src/persistent/tests/test_picklecache.py +++ b/src/persistent/tests/test_picklecache.py @@ -19,9 +19,6 @@ from persistent.tests.utils import skipIfNoCExtension -# pylint:disable=protected-access,too-many-lines,too-many-public-methods -# pylint:disable=attribute-defined-outside-init,redefined-outer-name - _marker = object() diff --git a/src/persistent/tests/test_ring.py b/src/persistent/tests/test_ring.py index 81005eb..a18b109 100644 --- a/src/persistent/tests/test_ring.py +++ b/src/persistent/tests/test_ring.py @@ -16,8 +16,6 @@ from .. import ring -# pylint:disable=protected-access - class DummyPersistent: _p_oid = None _Persistent__ring = None diff --git a/src/persistent/tests/test_timestamp.py b/src/persistent/tests/test_timestamp.py index 8ab5083..1413c22 100644 --- a/src/persistent/tests/test_timestamp.py +++ b/src/persistent/tests/test_timestamp.py @@ -211,7 +211,6 @@ class Instant: def __init__(self): from persistent import timestamp as MUT self.MUT = MUT - # pylint:disable=protected-access self.orig_maxint = MUT._MAXINT self.is_32_bit_hash = self.orig_maxint == self.MAX_32_BITS @@ -231,7 +230,6 @@ def __init__(self): @contextmanager def _use_hash(self, maxint, c_long): - # pylint:disable=protected-access try: self.MUT._MAXINT = maxint self.MUT.c_long = c_long diff --git a/src/persistent/timestamp.py b/src/persistent/timestamp.py index 5266b43..faa9a97 100644 --- a/src/persistent/timestamp.py +++ b/src/persistent/timestamp.py @@ -105,8 +105,7 @@ def __init__(self, *args): raise TypeError('Raw must be 8 octets') self._raw = raw elif len(args) == 6: - self._raw = _makeRaw( - *args) # pylint:disable=no-value-for-parameter + self._raw = _makeRaw(*args) # Note that we don't preserve the incoming arguments in # self._elements, we derive them from the raw value. This is # because the incoming seconds value could have more precision than @@ -162,7 +161,6 @@ def laterThan(self, other): """ if not isinstance(other, self.__class__): raise ValueError() - # pylint:disable=protected-access if self._raw > other._raw: return self a, b = struct.unpack('>II', other._raw)