Commit b875143b authored by Jason R. Coombs's avatar Jason R. Coombs

Add some docstrings

--HG--
branch : feature/issue-229
parent 6a5145a0
...@@ -13,10 +13,17 @@ class VendorImporter: ...@@ -13,10 +13,17 @@ class VendorImporter:
@property @property
def search_path(self): def search_path(self):
"""
Search first the vendor package then as a natural package.
"""
yield self.vendor_pkg + '.' yield self.vendor_pkg + '.'
yield '' yield ''
def find_module(self, fullname, path=None): def find_module(self, fullname, path=None):
"""
Return self when fullname starts with root_name and the
target module is one vendored through this importer.
"""
root, base, target = fullname.partition(self.root_name + '.') root, base, target = fullname.partition(self.root_name + '.')
if root: if root:
return return
...@@ -25,6 +32,9 @@ class VendorImporter: ...@@ -25,6 +32,9 @@ class VendorImporter:
return self return self
def load_module(self, fullname): def load_module(self, fullname):
"""
Iterate over the search path to locate and load fullname.
"""
root, base, target = fullname.partition(self.root_name + '.') root, base, target = fullname.partition(self.root_name + '.')
for prefix in self.search_path: for prefix in self.search_path:
try: try:
...@@ -45,6 +55,9 @@ class VendorImporter: ...@@ -45,6 +55,9 @@ class VendorImporter:
) )
def install(self): def install(self):
"""
Install this importer into sys.meta_path if not already present.
"""
if self not in sys.meta_path: if self not in sys.meta_path:
sys.meta_path.append(self) sys.meta_path.append(self)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment