From 84a75fc6fff3e883e809a0431454da6e11177158 Mon Sep 17 00:00:00 2001 From: Jason Madden Date: Fri, 11 Oct 2024 07:39:46 -0500 Subject: [PATCH] lint --- .pylintrc | 5 +++-- src/relstorage/adapters/batch.py | 3 +-- src/relstorage/adapters/mysql/drivers/__init__.py | 3 +-- src/relstorage/adapters/oracle/adapter.py | 1 + src/relstorage/adapters/oracle/batch.py | 2 +- src/relstorage/cache/tests/test_mvcc.py | 3 +-- src/relstorage/storage/__init__.py | 3 +-- src/relstorage/storage/tpc/vote.py | 1 + src/relstorage/tests/__init__.py | 3 +-- 9 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.pylintrc b/.pylintrc index 2b86ebb9..bbc214dc 100644 --- a/.pylintrc +++ b/.pylintrc @@ -75,7 +75,7 @@ init-hook = # comments at the end of the line does the same thing (though Py3 supports # mixing) - +# too-many-positional-arguments: we inherit most of these and can't do anything about them. # invalid-name, ; We get lots of these, especially in scripts. should fix many of them # protected-access, ; We have many cases of this; legit ones need to be examinid and commented, then this removed # no-self-use, ; common in superclasses with extension points @@ -146,7 +146,8 @@ disable=wrong-import-position, missing-param-doc, differing-param-doc, differing-type-doc, - compare-to-zero + compare-to-zero, + too-many-positional-arguments enable=consider-using-augmented-assign diff --git a/src/relstorage/adapters/batch.py b/src/relstorage/adapters/batch.py index c66231fc..0521bc47 100644 --- a/src/relstorage/adapters/batch.py +++ b/src/relstorage/adapters/batch.py @@ -197,8 +197,7 @@ def select_from(self, columns, table, suffix='', timeout=None, **kw): timeout, kw ): - for row in cursor.fetchall(): - yield row + yield from cursor.fetchall() def update_set_static(self, update_set, timeout=None, batch_done_callback=lambda total_count: None, diff --git a/src/relstorage/adapters/mysql/drivers/__init__.py b/src/relstorage/adapters/mysql/drivers/__init__.py index c0d5f160..3beea79c 100644 --- a/src/relstorage/adapters/mysql/drivers/__init__.py +++ b/src/relstorage/adapters/mysql/drivers/__init__.py @@ -135,8 +135,7 @@ def __iter__(self): sleep = self.sleep batch = fetch() while batch: - for row in batch: - yield row + yield from batch if sleep is not None: sleep() # pylint:disable=not-callable batch = fetch() diff --git a/src/relstorage/adapters/oracle/adapter.py b/src/relstorage/adapters/oracle/adapter.py index 5a6fc267..e56a8ef1 100644 --- a/src/relstorage/adapters/oracle/adapter.py +++ b/src/relstorage/adapters/oracle/adapter.py @@ -86,6 +86,7 @@ def _create(self): twophase = self._twophase options = self.options dsn = self._dsn + inputsizes = None batcher_factory = lambda cursor, row_limit=None: OracleRowBatcher( cursor, inputsizes, row_limit diff --git a/src/relstorage/adapters/oracle/batch.py b/src/relstorage/adapters/oracle/batch.py index de07a757..9c72e087 100644 --- a/src/relstorage/adapters/oracle/batch.py +++ b/src/relstorage/adapters/oracle/batch.py @@ -49,7 +49,7 @@ def replace_var(match): new_name = '%s_%d' % (name, rownum) # pylint:disable=used-before-assignment if name in self.inputsizes: stmt_inputsizes[new_name] = self.inputsizes[name] - params[new_name] = row[name] + params[new_name] = row[name] # pylint:disable=possibly-used-before-assignment return ':%s' % new_name items = sorted(self.inserts.items()) diff --git a/src/relstorage/cache/tests/test_mvcc.py b/src/relstorage/cache/tests/test_mvcc.py index 22ebbcc2..1059a882 100644 --- a/src/relstorage/cache/tests/test_mvcc.py +++ b/src/relstorage/cache/tests/test_mvcc.py @@ -459,8 +459,7 @@ class MockRowBatcher(RowBatcher): def select_from(self, *args, **kwargs): # pylint:disable=signature-differs try: - for x in RowBatcher.select_from(self, *args, **kwargs): - yield x + yield from RowBatcher.select_from(self, *args, **kwargs) except AggregateOperationTimeoutError as ex: MockRowBatcher.ex = ex raise diff --git a/src/relstorage/storage/__init__.py b/src/relstorage/storage/__init__.py index 3c10e5f0..06502ec4 100644 --- a/src/relstorage/storage/__init__.py +++ b/src/relstorage/storage/__init__.py @@ -594,8 +594,7 @@ def __record_iternext_gen(self, start_oid_int): # at least so it seems. So here we make sure to have the cursor open. getattr(self._load_connection, 'cursor') with self._load_connection.server_side_cursor() as ss_cursor: - for record in self._adapter.dbiter.iter_current_records(ss_cursor, start_oid_int): - yield record + yield from self._adapter.dbiter.iter_current_records(ss_cursor, start_oid_int) def record_iternext(self, next=None): # pylint:disable=redefined-builtin """ diff --git a/src/relstorage/storage/tpc/vote.py b/src/relstorage/storage/tpc/vote.py index 59bacefe..820f2722 100644 --- a/src/relstorage/storage/tpc/vote.py +++ b/src/relstorage/storage/tpc/vote.py @@ -534,6 +534,7 @@ def tpc_finish(self, storage, transaction, f=None, _time=time.time): raise StorageTransactionError( "tpc_finish called with wrong transaction") try: + locks_released = 0 finish_entry = _time() # Handle the finishing. We cannot/must not fail now. # TODO: Move most of this into the Finish class/module. diff --git a/src/relstorage/tests/__init__.py b/src/relstorage/tests/__init__.py index 1f7c8997..caaae397 100644 --- a/src/relstorage/tests/__init__.py +++ b/src/relstorage/tests/__init__.py @@ -276,8 +276,7 @@ def close(self): self.closed = True def __iter__(self): - for row in self.results: - yield row + yield from self.results class MockOptions(Options): cache_module_name = '' # disable