@@ -19,7 +19,8 @@ class Loader(metaclass=abc.ABCMeta):
1919
2020 @abc .abstractmethod
2121 def load_module (self , fullname ):
22- """Abstract method which when implemented should load a module."""
22+ """Abstract method which when implemented should load a module.
23+ The fullname is a str."""
2324 raise NotImplementedError
2425
2526
@@ -29,7 +30,10 @@ class Finder(metaclass=abc.ABCMeta):
2930
3031 @abc .abstractmethod
3132 def find_module (self , fullname , path = None ):
32- """Abstract method which when implemented should find a module."""
33+ """Abstract method which when implemented should find a module.
34+ The fullname is a str and the optional path is a str or None.
35+ Returns a Loader object.
36+ """
3337 raise NotImplementedError
3438
3539Finder .register (machinery .BuiltinImporter )
@@ -49,7 +53,7 @@ class ResourceLoader(Loader):
4953 @abc .abstractmethod
5054 def get_data (self , path ):
5155 """Abstract method which when implemented should return the bytes for
52- the specified path."""
56+ the specified path. The path must be a str. """
5357 raise NotImplementedError
5458
5559
@@ -65,19 +69,19 @@ class InspectLoader(Loader):
6569 @abc .abstractmethod
6670 def is_package (self , fullname ):
6771 """Abstract method which when implemented should return whether the
68- module is a package."""
72+ module is a package. The fullname is a str. Returns a bool. """
6973 raise NotImplementedError
7074
7175 @abc .abstractmethod
7276 def get_code (self , fullname ):
7377 """Abstract method which when implemented should return the code object
74- for the module"""
78+ for the module. The fullname is a str. Returns a types.CodeType. """
7579 raise NotImplementedError
7680
7781 @abc .abstractmethod
7882 def get_source (self , fullname ):
7983 """Abstract method which should return the source code for the
80- module."""
84+ module. The fullname is a str. Returns a str. """
8185 raise NotImplementedError
8286
8387InspectLoader .register (machinery .BuiltinImporter )
@@ -118,12 +122,14 @@ class SourceLoader(_bootstrap.SourceLoader, ResourceLoader, ExecutionLoader):
118122 """
119123
120124 def path_mtime (self , path ):
121- """Return the modification time for the path."""
125+ """Return the (int) modification time for the path (str) ."""
122126 raise NotImplementedError
123127
124128 def set_data (self , path , data ):
125129 """Write the bytes to the path (if possible).
126130
131+ Accepts a str path and data as bytes.
132+
127133 Any needed intermediary directories are to be created. If for some
128134 reason the file cannot be written because of permissions, fail
129135 silently.
@@ -171,8 +177,8 @@ def is_package(self, fullname):
171177
172178 @abc .abstractmethod
173179 def source_path (self , fullname ):
174- """Abstract method which when implemented should return the path to the
175- source code for the module."""
180+ """Abstract method. Accepts a str module name and returns the path to
181+ the source code for the module."""
176182 raise NotImplementedError
177183
178184 def get_filename (self , fullname ):
@@ -280,19 +286,19 @@ def get_code(self, fullname):
280286
281287 @abc .abstractmethod
282288 def source_mtime (self , fullname ):
283- """Abstract method which when implemented should return the
289+ """Abstract method. Accepts a str filename and returns an int
284290 modification time for the source of the module."""
285291 raise NotImplementedError
286292
287293 @abc .abstractmethod
288294 def bytecode_path (self , fullname ):
289- """Abstract method which when implemented should return the path to the
290- bytecode for the module."""
295+ """Abstract method. Accepts a str filename and returns the str pathname
296+ to the bytecode for the module."""
291297 raise NotImplementedError
292298
293299 @abc .abstractmethod
294300 def write_bytecode (self , fullname , bytecode ):
295- """Abstract method which when implemented should attempt to write the
296- bytecode for the module, returning a boolean representing whether the
297- bytecode was written or not."""
301+ """Abstract method. Accepts a str filename and bytes object
302+ representing the bytecode for the module. Returns a boolean
303+ representing whether the bytecode was written or not."""
298304 raise NotImplementedError
0 commit comments