Skip to content

Commit

Permalink
Updates for newer pylint version.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Dec 11, 2023
1 parent 88acc25 commit 5709702
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 27 deletions.
21 changes: 12 additions & 9 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ load-plugins=pylint.extensions.bad_builtin,
pylint.extensions.code_style,
pylint.extensions.dict_init_mutate,
pylint.extensions.dunder,
pylint.extensions.emptystring,
pylint.extensions.comparetozero,
pylint.extensions.comparison_placement,
pylint.extensions.confusing_elif,
pylint.extensions.for_any_all,
Expand Down Expand Up @@ -118,9 +116,12 @@ init-hook =
# Into ``if (foo := get_foo()):``
# But there are a *lot* of those. Trust people to do the right, most
# readable, thing
# unnecessary-lambda-assignment: We use this pattern a fair amount
# redefined-variable-type: Fairly common
# compare-to-zero: Often makes things less readable; an explicit == 0 can be better than 'not foo'
#
# XXX: unclear on the docstring warnings, missing-type-doc, missing-param-doc,
# differing-param-doc, differing-type-doc (are the last two replacements for the first two?)
#
# They should be addressed, in general they are a good thing, but sometimes they are
# unnecessary.
disable=wrong-import-position,
wrong-import-order,
missing-docstring,
Expand All @@ -140,9 +141,12 @@ disable=wrong-import-position,
unnecessary-lambda-assignment,
redefined-variable-type,
cyclic-import,
compare-to-zero,
missing-param-doc,
use-dict-literal,
missing-type-doc,
missing-param-doc,
differing-param-doc,
differing-type-doc,
compare-to-zero

enable=consider-using-augmented-assign

Expand Down Expand Up @@ -186,6 +190,7 @@ generated-members=REQUEST,acl_users,aq_parent,providedBy
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
#ignored-modules=gevent._corecffi,gevent.os,os,greenlet,threading,gevent.libev.corecffi,gevent.socket,gevent.core,gevent.testing.support
ignored-modules=psycopg2.errors

[DESIGN]
max-attributes=12
Expand All @@ -202,8 +207,6 @@ extension-pkg-allow-list = relstorage.cache._objectindex,relstorage.cache.cache,
# This does not seem to work, hence the init-hook
property-classes=zope.cachedescriptors.property.Lazy,zope.cachedescriptors.property.Cached



[CLASSES]
# List of interface methods to ignore, separated by a comma. This is used for
# instance to not check methods defines in Zope's Interface base class.
Expand Down
10 changes: 5 additions & 5 deletions src/relstorage/adapters/connmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,11 @@ def open_and_call(self, callback):
self.rollback_and_close(conn, cursor)
conn, cursor = None, None
raise
else:
self.close(None, cursor)
cursor = None
self.commit(conn)
return res

self.close(None, cursor)
cursor = None
self.commit(conn)
return res
finally:
self.close(conn, cursor)

Expand Down
2 changes: 1 addition & 1 deletion src/relstorage/adapters/oracle/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _do_inserts(self):
# pylint:disable=too-many-locals
def replace_var(match):
name = match.group(1)
new_name = '%s_%d' % (name, rownum) # pylint:disable=undefined-loop-variable
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]
Expand Down
20 changes: 10 additions & 10 deletions src/relstorage/adapters/packundo.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ def _find_pack_tid(self):
@metricmethod
def pack(self, pack_tid, packed_func=None):
"""Pack. Requires the information provided by pre_pack."""
# pylint:disable=too-many-locals
# pylint:disable=too-many-locals,too-complex
# Read committed mode is sufficient.
store_connection = StoreConnection(self.connmanager)
try: # pylint:disable=too-many-nested-blocks
Expand Down Expand Up @@ -1055,9 +1055,9 @@ def pack(self, pack_tid, packed_func=None):
store_connection.rollback_quietly()
raise

else:
logger.info("pack: finished successfully")
store_connection.commit()

logger.info("pack: finished successfully")
store_connection.commit()
finally:
store_connection.drop()

Expand Down Expand Up @@ -1454,9 +1454,9 @@ def pre_pack(self, pack_tid, get_references):
logger.exception("pre_pack: failed")
store_connection.rollback_quietly()
raise
else:
store_connection.commit()
logger.info("pre_pack: finished successfully")

store_connection.commit()
logger.info("pre_pack: finished successfully")
finally:
load_connection.drop()
store_connection.drop()
Expand Down Expand Up @@ -1679,9 +1679,9 @@ def maybe_commit_and_report(force=False):
store_connection.rollback_quietly()
raise

else:
logger.info("pack: finished successfully")
store_connection.commit()

logger.info("pack: finished successfully")
store_connection.commit()
finally:
store_connection.drop()

Expand Down
4 changes: 2 additions & 2 deletions src/relstorage/blobhelper/cached.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,8 @@ def remove_blob_at_path(file_path, lock_retries=0):
ZODB.blob.remove_committed(file_path)
except OSError:
return 0 # probably open on windows
else:
return fsize

return fsize
finally:
lock.close()

Expand Down

0 comments on commit 5709702

Please sign in to comment.