1.1 --- a/importer.py Wed Feb 08 16:20:27 2017 +0100
1.2 +++ b/importer.py Wed Feb 08 17:24:31 2017 +0100
1.3 @@ -35,7 +35,7 @@
1.4
1.5 special_attributes = ("__args__", "__file__", "__fn__", "__name__", "__parent__")
1.6
1.7 - def __init__(self, path, cache=None, verbose=False):
1.8 + def __init__(self, path, cache=None, verbose=False, warnings=None):
1.9
1.10 """
1.11 Initialise the importer with the given search 'path' - a list of
1.12 @@ -46,11 +46,15 @@
1.13
1.14 The optional 'verbose' parameter causes output concerning the activities
1.15 of the object to be produced if set to a true value (not the default).
1.16 +
1.17 + The optional 'warnings' parameter may indicate classes of warnings to be
1.18 + produced.
1.19 """
1.20
1.21 self.path = path
1.22 self.cache = cache
1.23 self.verbose = verbose
1.24 + self.warnings = warnings
1.25
1.26 # Module importing queue, required modules, removed modules and active
1.27 # modules in the final program.
1.28 @@ -116,6 +120,12 @@
1.29
1.30 self.make_cache()
1.31
1.32 + def give_warning(self, name):
1.33 +
1.34 + "Return whether the indicated warning 'name' should be given."
1.35 +
1.36 + return self.warnings and (name in self.warnings or "all" in self.warnings)
1.37 +
1.38 def make_cache(self):
1.39
1.40 "Make a cache directory if it does not already exist."