|
93 | 93 |
|
94 | 94 | from . import __version__ |
95 | 95 |
|
96 | | -try: |
97 | | - baseint = (int, long) |
98 | | -except NameError: # Python 3 |
99 | | - baseint = int |
100 | | - |
101 | 96 |
|
102 | 97 | class SteadyDBError(Exception): |
103 | 98 | """General SteadyDB error.""" |
@@ -173,10 +168,10 @@ def __init__( |
173 | 168 | except AttributeError: |
174 | 169 | self._threadsafety = None |
175 | 170 | if not callable(self._creator): |
176 | | - raise TypeError("%r is not a connection provider." % (creator,)) |
| 171 | + raise TypeError(f"{creator!r} is not a connection provider.") |
177 | 172 | if maxusage is None: |
178 | 173 | maxusage = 0 |
179 | | - if not isinstance(maxusage, baseint): |
| 174 | + if not isinstance(maxusage, int): |
180 | 175 | raise TypeError("'maxusage' must be an integer value.") |
181 | 176 | self._maxusage = maxusage |
182 | 177 | self._setsession_sql = setsession |
@@ -531,7 +526,7 @@ def __init__(self, con, *args, **kwargs): |
531 | 526 | try: |
532 | 527 | self._cursor = con._cursor(*args, **kwargs) |
533 | 528 | except AttributeError: |
534 | | - raise TypeError("%r is not a SteadyDBConnection." % (con,)) |
| 529 | + raise TypeError(f"{con!r} is not a SteadyDBConnection.") |
535 | 530 | self._closed = False |
536 | 531 |
|
537 | 532 | def __enter__(self): |
@@ -688,10 +683,8 @@ def __getattr__(self, name): |
688 | 683 | if name.startswith(('execute', 'call')): |
689 | 684 | # make execution methods "tough" |
690 | 685 | return self._get_tough_method(name) |
691 | | - else: |
692 | | - return getattr(self._cursor, name) |
693 | | - else: |
694 | | - raise InvalidCursor |
| 686 | + return getattr(self._cursor, name) |
| 687 | + raise InvalidCursor |
695 | 688 |
|
696 | 689 | def __del__(self): |
697 | 690 | """Delete the steady cursor.""" |
|
0 commit comments