lib64
/
python3.6
/
Go to Home Directory
+
Upload
Create File
root@0UT1S:~$
Execute
By Order of Mr.0UT1S
[DIR] ..
N/A
[DIR] __pycache__
N/A
[DIR] asyncio
N/A
[DIR] collections
N/A
[DIR] concurrent
N/A
[DIR] config-3.6m-x86_64-linux-gnu
N/A
[DIR] ctypes
N/A
[DIR] curses
N/A
[DIR] dbm
N/A
[DIR] distutils
N/A
[DIR] email
N/A
[DIR] encodings
N/A
[DIR] ensurepip
N/A
[DIR] html
N/A
[DIR] http
N/A
[DIR] importlib
N/A
[DIR] json
N/A
[DIR] lib-dynload
N/A
[DIR] lib2to3
N/A
[DIR] logging
N/A
[DIR] multiprocessing
N/A
[DIR] pydoc_data
N/A
[DIR] site-packages
N/A
[DIR] sqlite3
N/A
[DIR] test
N/A
[DIR] unittest
N/A
[DIR] urllib
N/A
[DIR] venv
N/A
[DIR] wsgiref
N/A
[DIR] xml
N/A
[DIR] xmlrpc
N/A
__future__.py
4.73 KB
Rename
Delete
__phello__.foo.py
64 bytes
Rename
Delete
_bootlocale.py
1.27 KB
Rename
Delete
_collections_abc.py
25.77 KB
Rename
Delete
_compat_pickle.py
8.54 KB
Rename
Delete
_compression.py
5.21 KB
Rename
Delete
_dummy_thread.py
5.00 KB
Rename
Delete
_markupbase.py
14.26 KB
Rename
Delete
_osx_support.py
18.69 KB
Rename
Delete
_pydecimal.py
224.83 KB
Rename
Delete
_pyio.py
86.03 KB
Rename
Delete
_sitebuiltins.py
3.04 KB
Rename
Delete
_strptime.py
24.17 KB
Rename
Delete
_sysconfigdata_dm_linux_x86_64-linux-gnu.py
29.48 KB
Rename
Delete
_sysconfigdata_m_linux_x86_64-linux-gnu.py
29.66 KB
Rename
Delete
_threading_local.py
7.04 KB
Rename
Delete
_weakrefset.py
5.57 KB
Rename
Delete
abc.py
8.52 KB
Rename
Delete
aifc.py
31.69 KB
Rename
Delete
antigravity.py
477 bytes
Rename
Delete
argparse.py
88.25 KB
Rename
Delete
ast.py
11.88 KB
Rename
Delete
asynchat.py
11.06 KB
Rename
Delete
asyncore.py
19.69 KB
Rename
Delete
base64.py
19.91 KB
Rename
Delete
bdb.py
23.00 KB
Rename
Delete
binhex.py
13.63 KB
Rename
Delete
bisect.py
2.53 KB
Rename
Delete
bz2.py
12.19 KB
Rename
Delete
cProfile.py
5.25 KB
Rename
Delete
calendar.py
22.67 KB
Rename
Delete
cgi.py
36.35 KB
Rename
Delete
cgitb.py
11.74 KB
Rename
Delete
chunk.py
5.30 KB
Rename
Delete
cmd.py
14.51 KB
Rename
Delete
code.py
10.37 KB
Rename
Delete
codecs.py
35.43 KB
Rename
Delete
codeop.py
5.85 KB
Rename
Delete
colorsys.py
3.97 KB
Rename
Delete
compileall.py
11.84 KB
Rename
Delete
configparser.py
52.34 KB
Rename
Delete
contextlib.py
12.85 KB
Rename
Delete
copy.py
8.61 KB
Rename
Delete
copyreg.py
6.84 KB
Rename
Delete
crypt.py
1.82 KB
Rename
Delete
csv.py
15.80 KB
Rename
Delete
datetime.py
80.11 KB
Rename
Delete
decimal.py
320 bytes
Rename
Delete
difflib.py
82.40 KB
Rename
Delete
dis.py
17.71 KB
Rename
Delete
doctest.py
101.94 KB
Rename
Delete
dummy_threading.py
2.75 KB
Rename
Delete
enum.py
32.82 KB
Rename
Delete
filecmp.py
9.60 KB
Rename
Delete
fileinput.py
14.13 KB
Rename
Delete
fnmatch.py
3.09 KB
Rename
Delete
formatter.py
14.79 KB
Rename
Delete
fractions.py
23.08 KB
Rename
Delete
ftplib.py
34.78 KB
Rename
Delete
functools.py
30.61 KB
Rename
Delete
genericpath.py
4.64 KB
Rename
Delete
getopt.py
7.31 KB
Rename
Delete
getpass.py
5.85 KB
Rename
Delete
gettext.py
21.03 KB
Rename
Delete
glob.py
5.51 KB
Rename
Delete
gzip.py
19.86 KB
Rename
Delete
hashlib.py
8.59 KB
Rename
Delete
heapq.py
22.39 KB
Rename
Delete
hmac.py
6.23 KB
Rename
Delete
imaplib.py
52.05 KB
Rename
Delete
imghdr.py
3.71 KB
Rename
Delete
imp.py
10.42 KB
Rename
Delete
inspect.py
114.22 KB
Rename
Delete
io.py
3.43 KB
Rename
Delete
ipaddress.py
75.99 KB
Rename
Delete
keyword.py
2.17 KB
Rename
Delete
linecache.py
5.19 KB
Rename
Delete
locale.py
75.49 KB
Rename
Delete
lzma.py
12.68 KB
Rename
Delete
macpath.py
5.83 KB
Rename
Delete
macurl2path.py
2.67 KB
Rename
Delete
mailbox.py
76.78 KB
Rename
Delete
mailcap.py
8.85 KB
Rename
Delete
mimetypes.py
20.55 KB
Rename
Delete
modulefinder.py
22.49 KB
Rename
Delete
netrc.py
5.55 KB
Rename
Delete
nntplib.py
42.07 KB
Rename
Delete
ntpath.py
22.55 KB
Rename
Delete
nturl2path.py
2.39 KB
Rename
Delete
numbers.py
10.00 KB
Rename
Delete
opcode.py
5.69 KB
Rename
Delete
operator.py
10.61 KB
Rename
Delete
optparse.py
58.96 KB
Rename
Delete
os.py
36.65 KB
Rename
Delete
pathlib.py
47.83 KB
Rename
Delete
pdb.py
59.88 KB
Rename
Delete
pickle.py
54.39 KB
Rename
Delete
pickletools.py
89.62 KB
Rename
Delete
pipes.py
8.71 KB
Rename
Delete
pkgutil.py
20.82 KB
Rename
Delete
platform.py
46.11 KB
Rename
Delete
plistlib.py
31.53 KB
Rename
Delete
poplib.py
14.61 KB
Rename
Delete
posixpath.py
15.40 KB
Rename
Delete
pprint.py
20.37 KB
Rename
Delete
profile.py
21.51 KB
Rename
Delete
pstats.py
25.94 KB
Rename
Delete
pty.py
4.65 KB
Rename
Delete
py_compile.py
7.01 KB
Rename
Delete
pyclbr.py
13.24 KB
Rename
Delete
pydoc.py
101.08 KB
Rename
Delete
queue.py
8.57 KB
Rename
Delete
quopri.py
7.09 KB
Rename
Delete
random.py
26.80 KB
Rename
Delete
re.py
15.19 KB
Rename
Delete
reprlib.py
5.21 KB
Rename
Delete
rlcompleter.py
6.93 KB
Rename
Delete
runpy.py
11.68 KB
Rename
Delete
sched.py
6.36 KB
Rename
Delete
secrets.py
1.99 KB
Rename
Delete
selectors.py
18.98 KB
Rename
Delete
shelve.py
8.32 KB
Rename
Delete
shlex.py
12.65 KB
Rename
Delete
shutil.py
39.87 KB
Rename
Delete
signal.py
2.07 KB
Rename
Delete
site.py
20.77 KB
Rename
Delete
smtpd.py
33.91 KB
Rename
Delete
smtplib.py
43.18 KB
Rename
Delete
sndhdr.py
6.92 KB
Rename
Delete
socket.py
26.80 KB
Rename
Delete
socketserver.py
26.38 KB
Rename
Delete
sre_compile.py
18.88 KB
Rename
Delete
sre_constants.py
6.66 KB
Rename
Delete
sre_parse.py
35.68 KB
Rename
Delete
ssl.py
43.47 KB
Rename
Delete
stat.py
4.92 KB
Rename
Delete
statistics.py
20.19 KB
Rename
Delete
string.py
11.52 KB
Rename
Delete
stringprep.py
12.61 KB
Rename
Delete
struct.py
257 bytes
Rename
Delete
subprocess.py
60.88 KB
Rename
Delete
sunau.py
17.67 KB
Rename
Delete
symbol.py
2.07 KB
Rename
Delete
symtable.py
7.11 KB
Rename
Delete
sysconfig.py
24.29 KB
Rename
Delete
tabnanny.py
11.14 KB
Rename
Delete
tarfile.py
104.88 KB
Rename
Delete
telnetlib.py
22.59 KB
Rename
Delete
tempfile.py
27.41 KB
Rename
Delete
textwrap.py
19.10 KB
Rename
Delete
this.py
1003 bytes
Rename
Delete
threading.py
48.96 KB
Rename
Delete
timeit.py
13.03 KB
Rename
Delete
token.py
3.00 KB
Rename
Delete
tokenize.py
28.80 KB
Rename
Delete
trace.py
28.06 KB
Rename
Delete
traceback.py
22.91 KB
Rename
Delete
tracemalloc.py
16.27 KB
Rename
Delete
tty.py
879 bytes
Rename
Delete
types.py
8.66 KB
Rename
Delete
typing.py
78.39 KB
Rename
Delete
uu.py
6.60 KB
Rename
Delete
uuid.py
23.46 KB
Rename
Delete
warnings.py
18.05 KB
Rename
Delete
wave.py
17.29 KB
Rename
Delete
weakref.py
19.99 KB
Rename
Delete
webbrowser.py
21.26 KB
Rename
Delete
xdrlib.py
5.77 KB
Rename
Delete
zipapp.py
6.99 KB
Rename
Delete
zipfile.py
78.05 KB
Rename
Delete
"""Utilities to support packages.""" from collections import namedtuple from functools import singledispatch as simplegeneric import importlib import importlib.util import importlib.machinery import os import os.path import sys from types import ModuleType import warnings __all__ = [ 'get_importer', 'iter_importers', 'get_loader', 'find_loader', 'walk_packages', 'iter_modules', 'get_data', 'ImpImporter', 'ImpLoader', 'read_code', 'extend_path', 'ModuleInfo', ] ModuleInfo = namedtuple('ModuleInfo', 'module_finder name ispkg') ModuleInfo.__doc__ = 'A namedtuple with minimal info about a module.' def _get_spec(finder, name): """Return the finder-specific module spec.""" # Works with legacy finders. try: find_spec = finder.find_spec except AttributeError: loader = finder.find_module(name) if loader is None: return None return importlib.util.spec_from_loader(name, loader) else: return find_spec(name) def read_code(stream): # This helper is needed in order for the PEP 302 emulation to # correctly handle compiled files import marshal magic = stream.read(4) if magic != importlib.util.MAGIC_NUMBER: return None stream.read(8) # Skip timestamp and size return marshal.load(stream) def walk_packages(path=None, prefix='', onerror=None): """Yields ModuleInfo for all modules recursively on path, or, if path is None, all accessible modules. 'path' should be either None or a list of paths to look for modules in. 'prefix' is a string to output on the front of every module name on output. Note that this function must import all *packages* (NOT all modules!) on the given path, in order to access the __path__ attribute to find submodules. 'onerror' is a function which gets called with one argument (the name of the package which was being imported) if any exception occurs while trying to import a package. If no onerror function is supplied, ImportErrors are caught and ignored, while all other exceptions are propagated, terminating the search. Examples: # list all modules python can access walk_packages() # list all submodules of ctypes walk_packages(ctypes.__path__, ctypes.__name__+'.') """ def seen(p, m={}): if p in m: return True m[p] = True for info in iter_modules(path, prefix): yield info if info.ispkg: try: __import__(info.name) except ImportError: if onerror is not None: onerror(info.name) except Exception: if onerror is not None: onerror(info.name) else: raise else: path = getattr(sys.modules[info.name], '__path__', None) or [] # don't traverse path items we've seen before path = [p for p in path if not seen(p)] yield from walk_packages(path, info.name+'.', onerror) def iter_modules(path=None, prefix=''): """Yields ModuleInfo for all submodules on path, or, if path is None, all top-level modules on sys.path. 'path' should be either None or a list of paths to look for modules in. 'prefix' is a string to output on the front of every module name on output. """ if path is None: importers = iter_importers() else: importers = map(get_importer, path) yielded = {} for i in importers: for name, ispkg in iter_importer_modules(i, prefix): if name not in yielded: yielded[name] = 1 yield ModuleInfo(i, name, ispkg) @simplegeneric def iter_importer_modules(importer, prefix=''): if not hasattr(importer, 'iter_modules'): return [] return importer.iter_modules(prefix) # Implement a file walker for the normal importlib path hook def _iter_file_finder_modules(importer, prefix=''): if importer.path is None or not os.path.isdir(importer.path): return yielded = {} import inspect try: filenames = os.listdir(importer.path) except OSError: # ignore unreadable directories like import does filenames = [] filenames.sort() # handle packages before same-named modules for fn in filenames: modname = inspect.getmodulename(fn) if modname=='__init__' or modname in yielded: continue path = os.path.join(importer.path, fn) ispkg = False if not modname and os.path.isdir(path) and '.' not in fn: modname = fn try: dircontents = os.listdir(path) except OSError: # ignore unreadable directories like import does dircontents = [] for fn in dircontents: subname = inspect.getmodulename(fn) if subname=='__init__': ispkg = True break else: continue # not a package if modname and '.' not in modname: yielded[modname] = 1 yield prefix + modname, ispkg iter_importer_modules.register( importlib.machinery.FileFinder, _iter_file_finder_modules) def _import_imp(): global imp with warnings.catch_warnings(): warnings.simplefilter('ignore', DeprecationWarning) imp = importlib.import_module('imp') class ImpImporter: """PEP 302 Finder that wraps Python's "classic" import algorithm ImpImporter(dirname) produces a PEP 302 finder that searches that directory. ImpImporter(None) produces a PEP 302 finder that searches the current sys.path, plus any modules that are frozen or built-in. Note that ImpImporter does not currently support being used by placement on sys.meta_path. """ def __init__(self, path=None): global imp warnings.warn("This emulation is deprecated, use 'importlib' instead", DeprecationWarning) _import_imp() self.path = path def find_module(self, fullname, path=None): # Note: we ignore 'path' argument since it is only used via meta_path subname = fullname.split(".")[-1] if subname != fullname and self.path is None: return None if self.path is None: path = None else: path = [os.path.realpath(self.path)] try: file, filename, etc = imp.find_module(subname, path) except ImportError: return None return ImpLoader(fullname, file, filename, etc) def iter_modules(self, prefix=''): if self.path is None or not os.path.isdir(self.path): return yielded = {} import inspect try: filenames = os.listdir(self.path) except OSError: # ignore unreadable directories like import does filenames = [] filenames.sort() # handle packages before same-named modules for fn in filenames: modname = inspect.getmodulename(fn) if modname=='__init__' or modname in yielded: continue path = os.path.join(self.path, fn) ispkg = False if not modname and os.path.isdir(path) and '.' not in fn: modname = fn try: dircontents = os.listdir(path) except OSError: # ignore unreadable directories like import does dircontents = [] for fn in dircontents: subname = inspect.getmodulename(fn) if subname=='__init__': ispkg = True break else: continue # not a package if modname and '.' not in modname: yielded[modname] = 1 yield prefix + modname, ispkg class ImpLoader: """PEP 302 Loader that wraps Python's "classic" import algorithm """ code = source = None def __init__(self, fullname, file, filename, etc): warnings.warn("This emulation is deprecated, use 'importlib' instead", DeprecationWarning) _import_imp() self.file = file self.filename = filename self.fullname = fullname self.etc = etc def load_module(self, fullname): self._reopen() try: mod = imp.load_module(fullname, self.file, self.filename, self.etc) finally: if self.file: self.file.close() # Note: we don't set __loader__ because we want the module to look # normal; i.e. this is just a wrapper for standard import machinery return mod def get_data(self, pathname): with open(pathname, "rb") as file: return file.read() def _reopen(self): if self.file and self.file.closed: mod_type = self.etc[2] if mod_type==imp.PY_SOURCE: self.file = open(self.filename, 'r') elif mod_type in (imp.PY_COMPILED, imp.C_EXTENSION): self.file = open(self.filename, 'rb') def _fix_name(self, fullname): if fullname is None: fullname = self.fullname elif fullname != self.fullname: raise ImportError("Loader for module %s cannot handle " "module %s" % (self.fullname, fullname)) return fullname def is_package(self, fullname): fullname = self._fix_name(fullname) return self.etc[2]==imp.PKG_DIRECTORY def get_code(self, fullname=None): fullname = self._fix_name(fullname) if self.code is None: mod_type = self.etc[2] if mod_type==imp.PY_SOURCE: source = self.get_source(fullname) self.code = compile(source, self.filename, 'exec') elif mod_type==imp.PY_COMPILED: self._reopen() try: self.code = read_code(self.file) finally: self.file.close() elif mod_type==imp.PKG_DIRECTORY: self.code = self._get_delegate().get_code() return self.code def get_source(self, fullname=None): fullname = self._fix_name(fullname) if self.source is None: mod_type = self.etc[2] if mod_type==imp.PY_SOURCE: self._reopen() try: self.source = self.file.read() finally: self.file.close() elif mod_type==imp.PY_COMPILED: if os.path.exists(self.filename[:-1]): with open(self.filename[:-1], 'r') as f: self.source = f.read() elif mod_type==imp.PKG_DIRECTORY: self.source = self._get_delegate().get_source() return self.source def _get_delegate(self): finder = ImpImporter(self.filename) spec = _get_spec(finder, '__init__') return spec.loader def get_filename(self, fullname=None): fullname = self._fix_name(fullname) mod_type = self.etc[2] if mod_type==imp.PKG_DIRECTORY: return self._get_delegate().get_filename() elif mod_type in (imp.PY_SOURCE, imp.PY_COMPILED, imp.C_EXTENSION): return self.filename return None try: import zipimport from zipimport import zipimporter def iter_zipimport_modules(importer, prefix=''): dirlist = sorted(zipimport._zip_directory_cache[importer.archive]) _prefix = importer.prefix plen = len(_prefix) yielded = {} import inspect for fn in dirlist: if not fn.startswith(_prefix): continue fn = fn[plen:].split(os.sep) if len(fn)==2 and fn[1].startswith('__init__.py'): if fn[0] not in yielded: yielded[fn[0]] = 1 yield prefix + fn[0], True if len(fn)!=1: continue modname = inspect.getmodulename(fn[0]) if modname=='__init__': continue if modname and '.' not in modname and modname not in yielded: yielded[modname] = 1 yield prefix + modname, False iter_importer_modules.register(zipimporter, iter_zipimport_modules) except ImportError: pass def get_importer(path_item): """Retrieve a finder for the given path item The returned finder is cached in sys.path_importer_cache if it was newly created by a path hook. The cache (or part of it) can be cleared manually if a rescan of sys.path_hooks is necessary. """ try: importer = sys.path_importer_cache[path_item] except KeyError: for path_hook in sys.path_hooks: try: importer = path_hook(path_item) sys.path_importer_cache.setdefault(path_item, importer) break except ImportError: pass else: importer = None return importer def iter_importers(fullname=""): """Yield finders for the given module name If fullname contains a '.', the finders will be for the package containing fullname, otherwise they will be all registered top level finders (i.e. those on both sys.meta_path and sys.path_hooks). If the named module is in a package, that package is imported as a side effect of invoking this function. If no module name is specified, all top level finders are produced. """ if fullname.startswith('.'): msg = "Relative module name {!r} not supported".format(fullname) raise ImportError(msg) if '.' in fullname: # Get the containing package's __path__ pkg_name = fullname.rpartition(".")[0] pkg = importlib.import_module(pkg_name) path = getattr(pkg, '__path__', None) if path is None: return else: yield from sys.meta_path path = sys.path for item in path: yield get_importer(item) def get_loader(module_or_name): """Get a "loader" object for module_or_name Returns None if the module cannot be found or imported. If the named module is not already imported, its containing package (if any) is imported, in order to establish the package __path__. """ if module_or_name in sys.modules: module_or_name = sys.modules[module_or_name] if module_or_name is None: return None if isinstance(module_or_name, ModuleType): module = module_or_name loader = getattr(module, '__loader__', None) if loader is not None: return loader if getattr(module, '__spec__', None) is None: return None fullname = module.__name__ else: fullname = module_or_name return find_loader(fullname) def find_loader(fullname): """Find a "loader" object for fullname This is a backwards compatibility wrapper around importlib.util.find_spec that converts most failures to ImportError and only returns the loader rather than the full spec """ if fullname.startswith('.'): msg = "Relative module name {!r} not supported".format(fullname) raise ImportError(msg) try: spec = importlib.util.find_spec(fullname) except (ImportError, AttributeError, TypeError, ValueError) as ex: # This hack fixes an impedance mismatch between pkgutil and # importlib, where the latter raises other errors for cases where # pkgutil previously raised ImportError msg = "Error while finding loader for {!r} ({}: {})" raise ImportError(msg.format(fullname, type(ex), ex)) from ex return spec.loader if spec is not None else None def extend_path(path, name): """Extend a package's path. Intended use is to place the following code in a package's __init__.py: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) This will add to the package's __path__ all subdirectories of directories on sys.path named after the package. This is useful if one wants to distribute different parts of a single logical package as multiple directories. It also looks for *.pkg files beginning where * matches the name argument. This feature is similar to *.pth files (see site.py), except that it doesn't special-case lines starting with 'import'. A *.pkg file is trusted at face value: apart from checking for duplicates, all entries found in a *.pkg file are added to the path, regardless of whether they are exist the filesystem. (This is a feature.) If the input path is not a list (as is the case for frozen packages) it is returned unchanged. The input path is not modified; an extended copy is returned. Items are only appended to the copy at the end. It is assumed that sys.path is a sequence. Items of sys.path that are not (unicode or 8-bit) strings referring to existing directories are ignored. Unicode items of sys.path that cause errors when used as filenames may cause this function to raise an exception (in line with os.path.isdir() behavior). """ if not isinstance(path, list): # This could happen e.g. when this is called from inside a # frozen package. Return the path unchanged in that case. return path sname_pkg = name + ".pkg" path = path[:] # Start with a copy of the existing path parent_package, _, final_name = name.rpartition('.') if parent_package: try: search_path = sys.modules[parent_package].__path__ except (KeyError, AttributeError): # We can't do anything: find_loader() returns None when # passed a dotted name. return path else: search_path = sys.path for dir in search_path: if not isinstance(dir, str): continue finder = get_importer(dir) if finder is not None: portions = [] if hasattr(finder, 'find_spec'): spec = finder.find_spec(final_name) if spec is not None: portions = spec.submodule_search_locations or [] # Is this finder PEP 420 compliant? elif hasattr(finder, 'find_loader'): _, portions = finder.find_loader(final_name) for portion in portions: # XXX This may still add duplicate entries to path on # case-insensitive filesystems if portion not in path: path.append(portion) # XXX Is this the right thing for subpackages like zope.app? # It looks for a file named "zope.app.pkg" pkgfile = os.path.join(dir, sname_pkg) if os.path.isfile(pkgfile): try: f = open(pkgfile) except OSError as msg: sys.stderr.write("Can't open %s: %s\n" % (pkgfile, msg)) else: with f: for line in f: line = line.rstrip('\n') if not line or line.startswith('#'): continue path.append(line) # Don't check for existence! return path def get_data(package, resource): """Get a resource from a package. This is a wrapper round the PEP 302 loader get_data API. The package argument should be the name of a package, in standard module format (foo.bar). The resource argument should be in the form of a relative filename, using '/' as the path separator. The parent directory name '..' is not allowed, and nor is a rooted name (starting with a '/'). The function returns a binary string, which is the contents of the specified resource. For packages located in the filesystem, which have already been imported, this is the rough equivalent of d = os.path.dirname(sys.modules[package].__file__) data = open(os.path.join(d, resource), 'rb').read() If the package cannot be located or loaded, or it uses a PEP 302 loader which does not support get_data(), then None is returned. """ spec = importlib.util.find_spec(package) if spec is None: return None loader = spec.loader if loader is None or not hasattr(loader, 'get_data'): return None # XXX needs test mod = (sys.modules.get(package) or importlib._bootstrap._load(spec)) if mod is None or not hasattr(mod, '__file__'): return None # Modify the resource name to be compatible with the loader.get_data # signature - an os.path format "filename" starting with the dirname of # the package's __file__ parts = resource.split('/') parts.insert(0, os.path.dirname(mod.__file__)) resource_name = os.path.join(*parts) return loader.get_data(resource_name)
Save