wrapt 2.5.0rc1__tar.gz → 2.5.1.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {wrapt-2.5.0rc1/src/wrapt.egg-info → wrapt-2.5.1.dev1}/PKG-INFO +1 -1
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt/__init__.py +1 -1
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt/decorators.py +11 -3
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt/proxies.py +3 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt/weakrefs.py +8 -3
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1/src/wrapt.egg-info}/PKG-INFO +1 -1
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_adapter.py +101 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_lazy_object_proxy.py +19 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_weak_function_proxy.py +43 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/LICENSE +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/MANIFEST.in +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/README.md +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/RELEASE.rst +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/pyproject.toml +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/setup.cfg +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/setup.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt/__wrapt__.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt/_wrappers.c +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt/arguments.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt/caching.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt/doc.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt/exceptions.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt/importer.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt/patches.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt/signature.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt/synchronization.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt/wrappers.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt-stubs/__init__.pyi +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt.egg-info/SOURCES.txt +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt.egg-info/dependency_links.txt +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt.egg-info/not-zip-safe +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt.egg-info/requires.txt +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/src/wrapt.egg-info/top_level.txt +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/conftest.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/compat.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/module1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/module2.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_adapter_annotations.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_adapter_kwonly.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_annotations.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_attribute_wrapper.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_auto_object_proxy.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_callable_binding_no_args.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_callable_object_proxy.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_class.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_class_mro_entries.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_copy.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_decorator_state.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_decorators.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_deferred_patching.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_descriptor_get_class_access.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_descriptors.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_enabled_bool_error.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_entry_points.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_find_wrapper.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_formatargspec.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_function.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_function_wrapper.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_inheritance.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_inner_classmethod.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_inner_staticmethod.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_inplace_operators.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_instancemethod.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_lru_cache.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_memoize.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_missing_sentinel.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_monkey_patching.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_nested_function.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_object_proxy.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_object_proxy_hook.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_object_proxy_self_dict.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_object_proxy_type_checks.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_outer_classmethod.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_outer_staticmethod.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_pickle.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_post_import_hooks.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_proxy_doc_descriptor.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_proxy_new_arguments.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_proxy_operands.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_pyerr_clear_propagation.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_resolve_path.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_runtime_type_hints.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_scoped_function_wrapper.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_synchronized_async.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_synchronized_lock.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_synchronized_markers.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_transient_function_wrapper.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_type_module_attribute.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_uninitialized_wrapper.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_unwrap_object.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_update_attributes.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_with_doc.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_with_signature.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/core/test_wrapper_chain.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_auto_object_proxy_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_auto_object_proxy_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_decorator_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_decorator_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t2.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t2.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t3.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t3.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t4.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t4.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t5.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t5.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t6.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t6.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t7.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t7.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t8.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_cls_t8.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_fn_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_fn_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_fn_t2.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_fn_t2.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_fn_t3.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_fn_t3.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_fn_t4.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_fn_t4.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_fn_t5.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_fn_t5.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_fn_t6.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_fn_t6.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_fn_t7.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_function_wrapper_fn_t7.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_object_proxy_arithmetic_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_object_proxy_arithmetic_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_object_proxy_container_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_object_proxy_container_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_object_proxy_context_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_object_proxy_context_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_partial_callable_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_partial_callable_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_patch_function_wrapper_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_patch_function_wrapper_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_patching_primitives_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_patching_primitives_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_post_import_hooks_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_post_import_hooks_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_proxy_new_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_proxy_new_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_synchronized_lock_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_synchronized_lock_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_transient_function_wrapper_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_transient_function_wrapper_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_weak_function_proxy_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_weak_function_proxy_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_with_doc_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_with_doc_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t1.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t1.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t2.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t2.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t3.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t3.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t4.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t4.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t5.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t5.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t6.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t6.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t7.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t7.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t8.out +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/mypy/mypy_wrap_function_wrapper_t8.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/stress/runner.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/stress/stress_function_wrapper_call.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/stress/stress_init_reinit.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/stress/stress_inplace_ops.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/stress/stress_read_during_mutate.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tests/stress/stress_set_wrapped.py +0 -0
- {wrapt-2.5.0rc1 → wrapt-2.5.1.dev1}/tox.ini +0 -0
|
@@ -177,10 +177,18 @@ def decorator(wrapper=None, /, *, enabled=None, adapter=None, proxy=FunctionWrap
|
|
|
177
177
|
# time when we need it down below.
|
|
178
178
|
|
|
179
179
|
def _build(wrapped, wrapper, enabled=None, adapter=None):
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
# Where the adapter is a factory, call it to obtain the actual
|
|
181
|
+
# adapter before testing whether an adapter was supplied at
|
|
182
|
+
# all. The factory check is done first and by type, rather
|
|
183
|
+
# than relying on the truth value of the adapter, as a factory
|
|
184
|
+
# instance may evaluate as false if it defines `__bool__()` or
|
|
185
|
+
# `__len__()`. A factory which returns `None` or some other
|
|
186
|
+
# false value is treated as there being no adapter.
|
|
187
|
+
|
|
188
|
+
if isinstance(adapter, AdapterFactory):
|
|
189
|
+
adapter = adapter(wrapped)
|
|
183
190
|
|
|
191
|
+
if adapter:
|
|
184
192
|
if not callable(adapter):
|
|
185
193
|
ns = {}
|
|
186
194
|
|
|
@@ -276,6 +276,9 @@ class LazyObjectProxy(AutoObjectProxy):
|
|
|
276
276
|
):
|
|
277
277
|
namespace["__length_hint__"] = __wrapper_length_hint__
|
|
278
278
|
|
|
279
|
+
if "__fspath__" in interface_attrs and "__fspath__" not in class_attrs:
|
|
280
|
+
namespace["__fspath__"] = __wrapper_fspath__
|
|
281
|
+
|
|
279
282
|
# Note that not providing compatibility with generator-based coroutines
|
|
280
283
|
# (PEP 342) here as they are removed in Python 3.11+ and were deprecated
|
|
281
284
|
# in 3.8.
|
|
@@ -32,6 +32,9 @@ def _weak_function_proxy_callback(ref, proxy, callback):
|
|
|
32
32
|
# This could raise an exception. We let it propagate back and let
|
|
33
33
|
# the weakref.proxy() deal with it, at which point it generally
|
|
34
34
|
# prints out a short error message direct to stderr and keeps going.
|
|
35
|
+
# Note that the callback can never actually be None here, as the
|
|
36
|
+
# partial which invokes this function is only created when a
|
|
37
|
+
# callback was supplied, but check anyway as a safeguard.
|
|
35
38
|
|
|
36
39
|
if callback is not None:
|
|
37
40
|
callback(proxy)
|
|
@@ -65,9 +68,11 @@ class WeakFunctionProxy(BaseObjectProxy):
|
|
|
65
68
|
# then call it. Note that we avoid using a nested function for
|
|
66
69
|
# the callback here so as not to cause any odd reference cycles.
|
|
67
70
|
|
|
68
|
-
_callback =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
_callback = None
|
|
72
|
+
if callback is not None:
|
|
73
|
+
_callback = functools.partial(
|
|
74
|
+
_weak_function_proxy_callback, proxy=self, callback=callback
|
|
75
|
+
)
|
|
71
76
|
|
|
72
77
|
self._self_expired = False
|
|
73
78
|
self._self_owner = None
|
|
@@ -226,6 +226,107 @@ class TestDynamicAdapter(unittest.TestCase):
|
|
|
226
226
|
|
|
227
227
|
self.assertEqual(argspec.args, ["arg0", "arg1", "arg2"])
|
|
228
228
|
|
|
229
|
+
def test_adapter_factory_evaluates_false(self):
|
|
230
|
+
# An adapter factory must be recognised by its type and not by
|
|
231
|
+
# its truth value, so a factory which evaluates as false because
|
|
232
|
+
# it defines __bool__() or __len__() must still be called.
|
|
233
|
+
|
|
234
|
+
calls = []
|
|
235
|
+
|
|
236
|
+
class FalseFactory(wrapt.AdapterFactory):
|
|
237
|
+
def __bool__(self):
|
|
238
|
+
return False
|
|
239
|
+
|
|
240
|
+
def __call__(self, wrapped):
|
|
241
|
+
calls.append(wrapped)
|
|
242
|
+
argspec = inspect.getfullargspec(wrapped)
|
|
243
|
+
argspec.args.insert(0, "arg0")
|
|
244
|
+
return argspec
|
|
245
|
+
|
|
246
|
+
class EmptyFactory(wrapt.AdapterFactory):
|
|
247
|
+
def __len__(self):
|
|
248
|
+
return 0
|
|
249
|
+
|
|
250
|
+
__call__ = FalseFactory.__call__
|
|
251
|
+
|
|
252
|
+
for factory_type in (FalseFactory, EmptyFactory):
|
|
253
|
+
with self.subTest(factory=factory_type.__name__):
|
|
254
|
+
calls.clear()
|
|
255
|
+
|
|
256
|
+
factory = factory_type()
|
|
257
|
+
|
|
258
|
+
self.assertFalse(factory)
|
|
259
|
+
|
|
260
|
+
@wrapt.decorator(adapter=factory)
|
|
261
|
+
def _wrapper(wrapped, instance, args, kwargs):
|
|
262
|
+
return wrapped(*args, **kwargs)
|
|
263
|
+
|
|
264
|
+
def _function(arg1):
|
|
265
|
+
return arg1
|
|
266
|
+
|
|
267
|
+
_decorated = _wrapper(_function)
|
|
268
|
+
|
|
269
|
+
self.assertEqual(calls, [_function])
|
|
270
|
+
|
|
271
|
+
self.assertEqual(str(inspect.signature(_decorated)), "(arg0, arg1)")
|
|
272
|
+
self.assertEqual(
|
|
273
|
+
inspect.getfullargspec(_decorated).args, ["arg0", "arg1"]
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
self.assertEqual(_decorated(1), 1)
|
|
277
|
+
|
|
278
|
+
def test_adapter_factory_returns_none(self):
|
|
279
|
+
# A factory which returns None, or any other false value, means
|
|
280
|
+
# that no adapter is to be used for that function.
|
|
281
|
+
|
|
282
|
+
for result in (None, ""):
|
|
283
|
+
with self.subTest(result=result):
|
|
284
|
+
calls = []
|
|
285
|
+
|
|
286
|
+
def factory(wrapped):
|
|
287
|
+
calls.append(wrapped)
|
|
288
|
+
return result
|
|
289
|
+
|
|
290
|
+
@wrapt.decorator(adapter=wrapt.adapter_factory(factory))
|
|
291
|
+
def _wrapper(wrapped, instance, args, kwargs):
|
|
292
|
+
return wrapped(*args, **kwargs)
|
|
293
|
+
|
|
294
|
+
def _function(arg1):
|
|
295
|
+
return arg1
|
|
296
|
+
|
|
297
|
+
_decorated = _wrapper(_function)
|
|
298
|
+
|
|
299
|
+
self.assertEqual(calls, [_function])
|
|
300
|
+
|
|
301
|
+
self.assertEqual(
|
|
302
|
+
inspect.signature(_decorated), inspect.signature(_function)
|
|
303
|
+
)
|
|
304
|
+
self.assertEqual(inspect.getfullargspec(_decorated).args, ["arg1"])
|
|
305
|
+
|
|
306
|
+
self.assertEqual(_decorated(1), 1)
|
|
307
|
+
|
|
308
|
+
def test_adapter_evaluates_false(self):
|
|
309
|
+
# Passing a false value directly as the adapter means there is no
|
|
310
|
+
# adapter, so the original signature is retained.
|
|
311
|
+
|
|
312
|
+
for adapter in (None, False, ""):
|
|
313
|
+
with self.subTest(adapter=adapter):
|
|
314
|
+
|
|
315
|
+
@wrapt.decorator(adapter=adapter)
|
|
316
|
+
def _wrapper(wrapped, instance, args, kwargs):
|
|
317
|
+
return wrapped(*args, **kwargs)
|
|
318
|
+
|
|
319
|
+
def _function(arg1):
|
|
320
|
+
return arg1
|
|
321
|
+
|
|
322
|
+
_decorated = _wrapper(_function)
|
|
323
|
+
|
|
324
|
+
self.assertEqual(
|
|
325
|
+
inspect.signature(_decorated), inspect.signature(_function)
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
self.assertEqual(_decorated(1), 1)
|
|
329
|
+
|
|
229
330
|
|
|
230
331
|
if __name__ == "__main__":
|
|
231
332
|
unittest.main()
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import os
|
|
1
2
|
import sys
|
|
2
3
|
import unittest
|
|
4
|
+
from pathlib import Path
|
|
3
5
|
|
|
4
6
|
import wrapt
|
|
5
7
|
|
|
@@ -148,3 +150,20 @@ class TestLazyObjectProxy(unittest.TestCase):
|
|
|
148
150
|
self.assertIn(char, "0123456789")
|
|
149
151
|
|
|
150
152
|
self.assertEqual("".join(digits2), "0123456789")
|
|
153
|
+
|
|
154
|
+
def test_pathlike_interface_is_lazy(self):
|
|
155
|
+
for interface in (os.PathLike, Path):
|
|
156
|
+
with self.subTest(interface=interface):
|
|
157
|
+
status = {"created": 0}
|
|
158
|
+
|
|
159
|
+
def factory():
|
|
160
|
+
status["created"] += 1
|
|
161
|
+
return Path("example.txt")
|
|
162
|
+
|
|
163
|
+
proxy = wrapt.LazyObjectProxy(factory, interface=interface)
|
|
164
|
+
self.assertEqual(status["created"], 0)
|
|
165
|
+
self.assertTrue(hasattr(type(proxy), "__fspath__"))
|
|
166
|
+
self.assertEqual(os.fspath(proxy), "example.txt")
|
|
167
|
+
self.assertEqual(status["created"], 1)
|
|
168
|
+
self.assertEqual(os.fspath(proxy), "example.txt")
|
|
169
|
+
self.assertEqual(status["created"], 1)
|
|
@@ -144,6 +144,49 @@ class TestWeakFunctionProxy(unittest.TestCase):
|
|
|
144
144
|
self.assertEqual(len(result), 1)
|
|
145
145
|
self.assertEqual(id(proxy), result[0])
|
|
146
146
|
|
|
147
|
+
def test_falsey_callback_receives_proxy(self):
|
|
148
|
+
# A list subclass is used so that the callback is a callable which
|
|
149
|
+
# evaluates as false while it is empty.
|
|
150
|
+
|
|
151
|
+
class Callback(list):
|
|
152
|
+
def __call__(self, proxy):
|
|
153
|
+
self.append(id(proxy))
|
|
154
|
+
|
|
155
|
+
def function():
|
|
156
|
+
return 42
|
|
157
|
+
|
|
158
|
+
callback = Callback()
|
|
159
|
+
proxy = wrapt.WeakFunctionProxy(function, callback)
|
|
160
|
+
self.assertEqual(proxy(), 42)
|
|
161
|
+
del function
|
|
162
|
+
gc.collect()
|
|
163
|
+
self.assertEqual(callback, [id(proxy)])
|
|
164
|
+
|
|
165
|
+
@unittest.skipIf(
|
|
166
|
+
sys.version_info[:2] == (3, 13) and sysconfig.get_config_var("Py_GIL_DISABLED"),
|
|
167
|
+
"Free-threaded CPython 3.13 immortalizes classes after a thread starts",
|
|
168
|
+
)
|
|
169
|
+
def test_falsey_callback_runs_once_when_method_and_instance_expire(self):
|
|
170
|
+
# A list subclass is used so that the callback is a callable which
|
|
171
|
+
# evaluates as false while it is empty.
|
|
172
|
+
|
|
173
|
+
class Callback(list):
|
|
174
|
+
def __call__(self, proxy):
|
|
175
|
+
self.append(id(proxy))
|
|
176
|
+
|
|
177
|
+
class Class:
|
|
178
|
+
def method(self):
|
|
179
|
+
return 42
|
|
180
|
+
|
|
181
|
+
callback = Callback()
|
|
182
|
+
instance = Class()
|
|
183
|
+
proxy = wrapt.WeakFunctionProxy(instance.method, callback)
|
|
184
|
+
self.assertEqual(proxy(), 42)
|
|
185
|
+
del instance
|
|
186
|
+
del Class
|
|
187
|
+
gc.collect()
|
|
188
|
+
self.assertEqual(callback, [id(proxy)])
|
|
189
|
+
|
|
147
190
|
def test_instancemethod_delete_instance(self):
|
|
148
191
|
class Class:
|
|
149
192
|
def function(self, a, b):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|