PKLiȅ^ modutil.py"""Help for working with modules.""" __version__ = "1.0.0" import importlib def lazy_import(importer_name, to_import): """Return the importing module and a callable for lazy importing. The module named by importer_name represents the module performing the import to help facilitate resolving relative imports. to_import is an iterable of the modules to be potentially imported (absolute or relative). The `as` form of importing is also supported, e.g. `pkg.mod as spam`. This function returns a tuple of two items. The first is the importer module for easy reference within itself. The second item is a callable to be set to `__getattr__`. """ module = importlib.import_module(importer_name) import_mapping = {} for name in to_import: importing, _, binding = name.partition(' as ') if not binding: _, _, binding = importing.rpartition('.') import_mapping[binding] = importing def __getattr__(name): if name not in import_mapping: message = f'module {importer_name!r} has no attribute {name!r}' raise AttributeError(message) importing = import_mapping[name] # imortlib.import_module() implicitly sets submodules on this module as # appropriate for direct imports. imported = importlib.import_module(importing, module.__spec__.parent) setattr(module, name, imported) return imported return module, __getattr__ PKUwL modutil-1.0.0.dist-info/LICENSEBSD 3-Clause License Copyright (c) 2018, Brett Cannon All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PK!HNOmodutil-1.0.0.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,zd&Y)r$[)T&UrPK!H?b|8 modutil-1.0.0.dist-info/METADATAUM6W -@[E&(QX""UZG);CJCƏoޛ7?a r;:uJsm3W؏}/ݔ{uʴpT4L=nS%Xeji5ۥGU܉:rx`蹸^*Cyf2Z+9*~%rME_;52& @~ [rtأ7Zz ->COXFyo`;=t)l`76 M h~'#>?n}v|}q䋳}c(M;\L&YLgp0S9Z~ օ"! 3B)4 HֲG´g Jg87PMP^4,@bN9cUE:C⠋,kt[8ZHeM ʓdP8굇G<3WyZ|`#5'с$T!M$ x 2*FpQNL6''o$#8*ʀ5ъ;|XG Ԕ|\}_,76r Eإ`Z/0k3(6CR? -cyihDA{iR׆qR["X zbǜӢ,쟕qٟ%"m|SJywIa45(t$qy9{dG}.y*3CqKF騺~ezw,~#bQ K(j I^Nw,Q /"^X_+?VrV^sjNWa b*/ȘacYe#9^x!PK!Himodutil-1.0.0.dist-info/RECORDu̹r@oY R@.3B ɂ>d(׿ϧn/ wA0AS 0udjѶ/j< \HABY~/yMFd|r!e\A6~AfsYf@C؋ߵ cs]u]ӭT5gXeB^nC ¾Hj+a:׆|ղB/J&6l3UxDڌ],ۮPKLiȅ^ modutil.pyPKUwL 'modutil-1.0.0.dist-info/LICENSEPK!HNOL modutil-1.0.0.dist-info/WHEELPK!H?b|8  modutil-1.0.0.dist-info/METADATAPK!Himodutil-1.0.0.dist-info/RECORDPKj