13
13
except ImportError as exc :
14
14
_frozen_importlib_external = _bootstrap_external
15
15
import abc
16
+ import warnings
16
17
17
18
18
19
def _register (abstract_cls , * classes ):
@@ -34,6 +35,8 @@ class Finder(metaclass=abc.ABCMeta):
34
35
reimplementations of the import system. Otherwise, finder
35
36
implementations should derive from the more specific MetaPathFinder
36
37
or PathEntryFinder ABCs.
38
+
39
+ Deprecated since Python 3.3
37
40
"""
38
41
39
42
@abc .abstractmethod
@@ -57,11 +60,16 @@ def find_module(self, fullname, path):
57
60
If no module is found, return None. The fullname is a str and
58
61
the path is a list of strings or None.
59
62
60
- This method is deprecated in favor of finder.find_spec(). If find_spec()
61
- exists then backwards-compatible functionality is provided for this
62
- method.
63
+ This method is deprecated since Python 3.4 in favor of
64
+ finder.find_spec(). If find_spec() exists then backwards-compatible
65
+ functionality is provided for this method.
63
66
64
67
"""
68
+ warnings .warn ("MetaPathFinder.find_module() is deprecated since Python "
69
+ "3.4 in favor of MetaPathFinder.find_spec()"
70
+ "(available since 3.4)" ,
71
+ DeprecationWarning ,
72
+ stacklevel = 2 )
65
73
if not hasattr (self , 'find_spec' ):
66
74
return None
67
75
found = self .find_spec (fullname , path )
@@ -94,10 +102,15 @@ def find_loader(self, fullname):
94
102
The portion will be discarded if another path entry finder
95
103
locates the module as a normal module or package.
96
104
97
- This method is deprecated in favor of finder.find_spec(). If find_spec()
98
- is provided than backwards-compatible functionality is provided.
99
-
105
+ This method is deprecated since Python 3.4 in favor of
106
+ finder.find_spec(). If find_spec() is provided than backwards-compatible
107
+ functionality is provided.
100
108
"""
109
+ warnings .warn ("PathEntryFinder.find_loader() is deprecated since Python "
110
+ "3.4 in favor of PathEntryFinder.find_spec() "
111
+ "(available since 3.4)" ,
112
+ DeprecationWarning ,
113
+ stacklevel = 2 )
101
114
if not hasattr (self , 'find_spec' ):
102
115
return None , []
103
116
found = self .find_spec (fullname )
0 commit comments