wrapt:用于装饰器,包装器和猴子修补的Python模块

时间:2021-05-11 21:58:41
【文件属性】:
文件名称:wrapt:用于装饰器,包装器和猴子修补的Python模块
文件大小:161KB
文件格式:ZIP
更新时间:2021-05-11 21:58:41
Python 包裹 wrapt模块的目的是为Python提供一个透明的对象代理,可以用作构造函数包装器和装饰器函数的基础。 包装模块非常注重正确性。 因此,它超越了诸如functools.wraps()类的现有机制,以确保装饰器保留自省性,签名,类型检查能力等。可以使用此模块构造的装饰器在比典型装饰器更多的场景下工作,并提供更多可预测性和一致的行为。 为了确保开销尽可能小,C扩展模块用于性能至关重要的组件。 如果目标系统没有编译器来允许C扩展的编译,还可以提供对纯Python实现的自动回退。 文献资料 有关wrapt模块的更多信息,请参见: 快速开始 要实现装饰器,您需要首先定义一个包装函数。 每次调用装饰函数时都会调用此函数。 包装函数需要采用四个位置参数: wrapped -包装的函数,而包装的函数又需要调用包装的函数。 instance调用包装函数时绑定到的对象。 args调用修饰函数
【文件预览】:
wrapt-develop
----MANIFEST.in(35B)
----README.rst(5KB)
----tddium.yml(116B)
----src()
--------wrapt()
----blog()
--------03-implementing-a-factory-for-creating-decorators.md(14KB)
--------14-automatic-patching-of-python-applications.md(15KB)
--------05-decorators-which-accept-arguments.md(14KB)
--------10-performance-overhead-when-applying-decorators-to-methods.md(11KB)
--------08-the-synchronized-decorator-as-context-manager.md(9KB)
--------02-the-interaction-between-decorators-and-descriptors.md(12KB)
--------01-how-you-implemented-your-python-decorator-is-wrong.md(15KB)
--------04-implementing-a-universal-decorator.md(24KB)
--------11-safely-applying-monkey-patches-in-python.md(11KB)
--------13-ordering-issues-when-monkey-patching-in-python.md(11KB)
--------09-performance-overhead-of-using-decorators.md(9KB)
--------README.md(2KB)
--------07-the-missing-synchronized-decorator.md(18KB)
--------12-using-wrapt-to-support-testing-of-software.md(16KB)
--------06-maintaining-decorator-state-using-a-class.md(13KB)
----.travis.yml(896B)
----tox.ini(427B)
----LICENSE(1KB)
----setup.py(3KB)
----Makefile(217B)
----docs()
--------issues.rst(3KB)
--------_templates()
--------benchmarks.py(1KB)
--------benchmarks.sh(2KB)
--------quick-start.rst(4KB)
--------testing.rst(1KB)
--------conf.py(8KB)
--------changes.rst(26KB)
--------index.rst(2KB)
--------examples.rst(20KB)
--------Makefile(7KB)
--------benchmarks.rst(9KB)
--------decorators.rst(26KB)
--------wrappers.rst(17KB)
--------_static()
----appveyor.yml(674B)
----tests()
--------test_memoize.py(2KB)
--------compat.py(638B)
--------test_instancemethod.py(14KB)
--------test_inner_classmethod.py(10KB)
--------test_function_wrapper.py(17KB)
--------test_copy.py(1KB)
--------test_object_proxy.py(45KB)
--------test_arguments.py(883B)
--------test_pickle.py(793B)
--------test_callable_object_proxy.py(2KB)
--------test_weak_function_proxy.py(4KB)
--------test_adapter.py(7KB)
--------test_monkey_patching.py(14KB)
--------test_outer_classmethod.py(6KB)
--------requirements.txt(4B)
--------test_outer_staticmethod.py(6KB)
--------test_decorators.py(3KB)
--------test_post_import_hooks.py(2KB)
--------test_synchronized_lock.py(8KB)
--------test_function.py(3KB)
--------conftest.py(938B)
--------test_inner_staticmethod.py(8KB)
--------test_update_attributes.py(5KB)
--------test_attribute_wrapper.py(600B)
--------test_class_py37.py(3KB)
--------test_nested_function.py(3KB)
--------test_class.py(2KB)
--------test_adapter_py33.py(2KB)
----.gitignore(443B)
----.coveragerc(469B)

网友评论