File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 117117from . import __version__
118118from .steady_pg import SteadyPgConnection
119119
120+ # constants for "reset" parameter
121+ RESET_ALWAYS_ROLLBACK = 1
122+ RESET_COMPLETELY = 2
123+
120124
121125class PooledPgError (Exception ):
122126 """General PooledPg error."""
@@ -214,10 +218,10 @@ def connection(self):
214218 def cache (self , con ):
215219 """Put a connection back into the pool cache."""
216220 try :
217- if self ._reset == 2 :
221+ if self ._reset == RESET_COMPLETELY :
218222 con .reset () # reset the connection completely
219223 else :
220- if self ._reset or con ._transaction :
224+ if self ._reset == RESET_ALWAYS_ROLLBACK or con ._transaction :
221225 try :
222226 con .rollback () # rollback a possible transaction
223227 except Exception :
Original file line number Diff line number Diff line change @@ -66,18 +66,18 @@ line-length = 79
6666target-version = " py37"
6767
6868[tool .ruff .mccabe ]
69- max-complexity = 31
69+ max-complexity = 32
7070
7171[tool .ruff .pylint ]
72- allow-magic-value-types = [" int" , " str" ]
73- max-args = 12
74- max-branches = 41
75- max-statements = 95
72+ max-args = 15
73+ max-branches = 50
74+ max-statements = 100
7675
7776[tool .ruff .per-file-ignores ]
7877"docs/*" = [
79- " INP001" # allow stand-alone scripts
78+ " INP001" , # allow stand-alone scripts
8079]
8180"tests/*" = [
82- " S101" # allow assert statements
81+ " PLR2004" , # allow magic values
82+ " S101" , # allow assert statements
8383]
You can’t perform that action at this time.
0 commit comments