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 117
117
from . import __version__
118
118
from .steady_pg import SteadyPgConnection
119
119
120
+ # constants for "reset" parameter
121
+ RESET_ALWAYS_ROLLBACK = 1
122
+ RESET_COMPLETELY = 2
123
+
120
124
121
125
class PooledPgError (Exception ):
122
126
"""General PooledPg error."""
@@ -214,10 +218,10 @@ def connection(self):
214
218
def cache (self , con ):
215
219
"""Put a connection back into the pool cache."""
216
220
try :
217
- if self ._reset == 2 :
221
+ if self ._reset == RESET_COMPLETELY :
218
222
con .reset () # reset the connection completely
219
223
else :
220
- if self ._reset or con ._transaction :
224
+ if self ._reset == RESET_ALWAYS_ROLLBACK or con ._transaction :
221
225
try :
222
226
con .rollback () # rollback a possible transaction
223
227
except Exception :
Original file line number Diff line number Diff line change @@ -66,18 +66,18 @@ line-length = 79
66
66
target-version = " py37"
67
67
68
68
[tool .ruff .mccabe ]
69
- max-complexity = 31
69
+ max-complexity = 32
70
70
71
71
[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
76
75
77
76
[tool .ruff .per-file-ignores ]
78
77
"docs/*" = [
79
- " INP001" # allow stand-alone scripts
78
+ " INP001" , # allow stand-alone scripts
80
79
]
81
80
"tests/*" = [
82
- " S101" # allow assert statements
81
+ " PLR2004" , # allow magic values
82
+ " S101" , # allow assert statements
83
83
]
You can’t perform that action at this time.
0 commit comments