Skip to content

Commit 188a243

Browse files
committed
Avoid abstractmethods on non-ABCMeta instances.
1 parent 2bb3852 commit 188a243

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

postgresql/driver/pq3.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from traceback import format_exception
1111
from itertools import repeat, chain, count
1212
from functools import partial
13-
from abc import abstractmethod
1413
from codecs import lookup as lookup_codecs
1514

1615
from operator import itemgetter
@@ -631,12 +630,12 @@ class Output(object):
631630

632631
_complete_message = None
633632

634-
@abstractmethod
635633
def _init(self):
636634
"""
637635
Bind a cursor based on the configured parameters.
638636
"""
639637
# The local initialization for the specific cursor.
638+
raise NotImplementedError
640639

641640
def __init__(self, cursor_id, wref = weakref.ref, ID = ID):
642641
self.cursor_id = cursor_id
@@ -990,17 +989,17 @@ def __init__(self, statement, parameters, cursor_id):
990989
self.database = statement.database
991990
Output.__init__(self, cursor_id or ID(self))
992991

993-
@abstractmethod
994992
def _bind(self):
995993
"""
996994
Generate the commands needed to bind the cursor.
997995
"""
996+
raise NotImplementedError
998997

999-
@abstractmethod
1000998
def _fetch(self):
1001999
"""
10021000
Generate the commands needed to bind the cursor.
10031001
"""
1002+
raise NotImplementedError
10041003

10051004
def _init(self):
10061005
self._command = self._fetch()
@@ -2768,7 +2767,6 @@ def __repr__(self):
27682767
keywords = os.linesep + ' ' + keywords if keywords else ''
27692768
)
27702769

2771-
@abstractmethod
27722770
def socket_factory_sequence(self):
27732771
"""
27742772
Generate a list of callables that will be used to attempt to make the
@@ -2778,6 +2776,7 @@ def socket_factory_sequence(self):
27782776
27792777
The callables in the sequence must take a timeout parameter.
27802778
"""
2779+
raise NotImplementedError
27812780

27822781
def __init__(self,
27832782
connect_timeout : int = None,
@@ -2843,23 +2842,12 @@ def __init__(self,
28432842
for k, v in tnkw.items()
28442843
])
28452844
self._password = (self.password or '').encode(se)
2846-
self._socket_secure = {
2847-
'keyfile' : self.sslkeyfile,
2848-
'certfile' : self.sslcrtfile,
2849-
'ca_certs' : self.sslrootcrtfile,
2850-
}
28512845
# class Connector
28522846

28532847
class SocketConnector(Connector):
28542848
"""
28552849
Abstract connector for using `socket` and `ssl`.
28562850
"""
2857-
@abstractmethod
2858-
def socket_factory_sequence(self):
2859-
"""
2860-
Return a sequence of `SocketFactory`s for a connection to use to connect
2861-
to the target host.
2862-
"""
28632851

28642852
def create_socket_factory(self, **params):
28652853
return SocketFactory(**params)

0 commit comments

Comments
 (0)