diff options
Diffstat (limited to 'Lib/imp.py')
-rw-r--r-- | Lib/imp.py | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -58,24 +58,23 @@ def new_module(name): def get_magic(): """**DEPRECATED** - Return the magic number for .pyc or .pyo files. + Return the magic number for .pyc files. """ return util.MAGIC_NUMBER def get_tag(): - """Return the magic tag for .pyc or .pyo files.""" + """Return the magic tag for .pyc files.""" return sys.implementation.cache_tag def cache_from_source(path, debug_override=None): """**DEPRECATED** - Given the path to a .py file, return the path to its .pyc/.pyo file. + Given the path to a .py file, return the path to its .pyc file. The .py file does not need to exist; this simply returns the path to the - .pyc/.pyo file calculated as if the .py file were imported. The extension - will be .pyc unless sys.flags.optimize is non-zero, then it will be .pyo. + .pyc file calculated as if the .py file were imported. If debug_override is not None, then it must be a boolean and is used in place of sys.flags.optimize. @@ -83,16 +82,18 @@ def cache_from_source(path, debug_override=None): If sys.implementation.cache_tag is None then NotImplementedError is raised. """ - return util.cache_from_source(path, debug_override) + with warnings.catch_warnings(): + warnings.simplefilter('ignore') + return util.cache_from_source(path, debug_override) def source_from_cache(path): """**DEPRECATED** - Given the path to a .pyc./.pyo file, return the path to its .py file. + Given the path to a .pyc. file, return the path to its .py file. - The .pyc/.pyo file does not need to exist; this simply returns the path to - the .py file calculated to correspond to the .pyc/.pyo file. If path does + The .pyc file does not need to exist; this simply returns the path to + the .py file calculated to correspond to the .pyc file. If path does not conform to PEP 3147 format, ValueError will be raised. If sys.implementation.cache_tag is None then NotImplementedError is raised. |