Files
RustPython/Lib/zipfile/_path/_functools.py
T
youknowdot db7519f01c Align filesystem archives and bytecode compilation with Python 3.15 (#9191)
Refresh the connected pathlib, glob, zipfile, tempfile, py_compile and compileall closure from CPython 3.15.0 while preserving existing RustPython test guards.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-18 22:38:49 +09:00

21 lines
575 B
Python
Vendored

import collections
import functools
# from jaraco.functools 4.0.2
def save_method_args(method):
"""
Wrap a method such that when it is called, the args and kwargs are
saved on the method.
"""
args_and_kwargs = collections.namedtuple('args_and_kwargs', 'args kwargs') # noqa: PYI024
@functools.wraps(method)
def wrapper(self, /, *args, **kwargs):
attr_name = '_saved_' + method.__name__
attr = args_and_kwargs(args, kwargs)
setattr(self, attr_name, attr)
return method(self, *args, **kwargs)
return wrapper