Skip to main content

Create and recursively fill a temporary directory

Project description

(xmod.py, 71-148)

Extend the system module at name with any Python object.

The original module is replaced in sys.modules by a proxy class which delegates attributes, first to the extension, and then to the original module.

xmod can also be used as a decorator, both with and without parameters.

ARGUMENTS
extension

The object whose methods and properties extend the namespace. This includes magic methods like __call__ and __getitem__.

name

The name of this symbol in sys.modules. If this is None then xmod will use extension.__module__.

This only needs to be be set if extension is _not_ a function or class defined in the module that’s being extended.

If the name argument is given, it should almost certainly be __name__.

full

If False, just add extension as a callable. If True, extend the module with all members of extension. If None, add the extension if it’s a callable, otherwise extend the module with all members of extension.

omit

A list of methods _not_ to delegate from the proxy to the extension. If omit is None, it defaults to xmod.OMIT, which seems to work well.

(automatically generated by doks on 2020-07-25T11:50:46.314943)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xmod-1.1.0.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

xmod-1.1.0-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page