summaryrefslogtreecommitdiffstats
path: root/contrib/python
diff options
context:
space:
mode:
authorYDBot <[email protected]>2026-06-01 15:15:16 +0000
committerYDBot <[email protected]>2026-06-01 15:15:16 +0000
commitc8a656730654bc6db15a4e7303dd2f679584c10f (patch)
tree2a003a266eddcdf710edfd806ee1cdc83b3cdc0d /contrib/python
parente4146fad8f78c20d1a091d440447a3c09d9277ad (diff)
parent3803b25c5c7c56dd827cea04fcbcabc5868fe741 (diff)
Merge pull request #42038 from ydb-platform/merge-rightlib-260601-0924
Diffstat (limited to 'contrib/python')
-rw-r--r--contrib/python/jaraco.functools/py3/.dist-info/METADATA11
-rw-r--r--contrib/python/jaraco.functools/py3/LICENSE2
-rw-r--r--contrib/python/jaraco.functools/py3/README.rst2
-rw-r--r--contrib/python/jaraco.functools/py3/jaraco/functools/__init__.py29
-rw-r--r--contrib/python/jaraco.functools/py3/jaraco/functools/__init__.pyi5
-rw-r--r--contrib/python/jaraco.functools/py3/ya.make2
6 files changed, 38 insertions, 13 deletions
diff --git a/contrib/python/jaraco.functools/py3/.dist-info/METADATA b/contrib/python/jaraco.functools/py3/.dist-info/METADATA
index f2150dd88be..b854ec7091c 100644
--- a/contrib/python/jaraco.functools/py3/.dist-info/METADATA
+++ b/contrib/python/jaraco.functools/py3/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.4
Name: jaraco.functools
-Version: 4.4.0
+Version: 4.5.0
Summary: Functools like those found in stdlib
Author-email: "Jason R. Coombs" <[email protected]>
License-Expression: MIT
@@ -9,7 +9,7 @@ Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
-Requires-Python: >=3.9
+Requires-Python: >=3.10
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: more_itertools
@@ -24,15 +24,14 @@ Requires-Dist: furo; extra == "doc"
Requires-Dist: sphinx-lint; extra == "doc"
Requires-Dist: jaraco.tidelift>=1.4; extra == "doc"
Provides-Extra: check
-Requires-Dist: pytest-checkdocs>=2.4; extra == "check"
+Requires-Dist: pytest-checkdocs>=2.14; extra == "check"
Requires-Dist: pytest-ruff>=0.2.1; sys_platform != "cygwin" and extra == "check"
Provides-Extra: cover
Requires-Dist: pytest-cov; extra == "cover"
Provides-Extra: enabler
Requires-Dist: pytest-enabler>=3.4; extra == "enabler"
Provides-Extra: type
-Requires-Dist: pytest-mypy>=1.0.1; extra == "type"
-Requires-Dist: mypy<1.19; platform_python_implementation == "PyPy" and extra == "type"
+Requires-Dist: pytest-mypy>=1.0.1; platform_python_implementation != "PyPy" and extra == "type"
Dynamic: license-file
.. image:: https://img.shields.io/pypi/v/jaraco.functools.svg
@@ -51,7 +50,7 @@ Dynamic: license-file
.. image:: https://readthedocs.org/projects/jaracofunctools/badge/?version=latest
:target: https://jaracofunctools.readthedocs.io/en/latest/?badge=latest
-.. image:: https://img.shields.io/badge/skeleton-2025-informational
+.. image:: https://img.shields.io/badge/skeleton-2026-informational
:target: https://blog.jaraco.com/skeleton
.. image:: https://tidelift.com/badges/package/pypi/jaraco.functools
diff --git a/contrib/python/jaraco.functools/py3/LICENSE b/contrib/python/jaraco.functools/py3/LICENSE
index f60bd572013..c891f411dc4 100644
--- a/contrib/python/jaraco.functools/py3/LICENSE
+++ b/contrib/python/jaraco.functools/py3/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2025 <copyright holders>
+Copyright (c) 2026 <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
diff --git a/contrib/python/jaraco.functools/py3/README.rst b/contrib/python/jaraco.functools/py3/README.rst
index 4986c6f9c7a..7a880297d48 100644
--- a/contrib/python/jaraco.functools/py3/README.rst
+++ b/contrib/python/jaraco.functools/py3/README.rst
@@ -14,7 +14,7 @@
.. image:: https://readthedocs.org/projects/jaracofunctools/badge/?version=latest
:target: https://jaracofunctools.readthedocs.io/en/latest/?badge=latest
-.. image:: https://img.shields.io/badge/skeleton-2025-informational
+.. image:: https://img.shields.io/badge/skeleton-2026-informational
:target: https://blog.jaraco.com/skeleton
.. image:: https://tidelift.com/badges/package/pypi/jaraco.functools
diff --git a/contrib/python/jaraco.functools/py3/jaraco/functools/__init__.py b/contrib/python/jaraco.functools/py3/jaraco/functools/__init__.py
index df32e2e924b..ba602d2290b 100644
--- a/contrib/python/jaraco.functools/py3/jaraco/functools/__init__.py
+++ b/contrib/python/jaraco.functools/py3/jaraco/functools/__init__.py
@@ -8,7 +8,8 @@ import operator
import time
import types
import warnings
-from typing import Callable, TypeVar
+from collections.abc import Callable
+from typing import TypeVar
import more_itertools
@@ -297,6 +298,8 @@ def passthrough(func: Callable[..., object]) -> Callable[[_T], _T]:
"""
Wrap the function to always return the first parameter.
+ Useful for wrapping functions called for their side effects.
+
>>> passthrough(print)('3')
3
'3'
@@ -580,6 +583,16 @@ def identity(x):
return x
+def _as_invocable(check):
+ return lambda: check
+
+
+@_as_invocable.register(collections.abc.Callable)
+def _(check):
+ return check
+
+
def bypass_when(check, *, _op=identity):
"""
Decorate a function to return its parameter when ``check``.
@@ -594,12 +607,24 @@ def bypass_when(check, *, _op=identity):
>>> bypassed[:] = [object()] # True
>>> double(2)
2
+
+ ``check`` may also be a callable returning the condition.
+
+ >>> enabled = False
+ >>> @bypass_when(lambda: enabled)
+ ... def double(x):
+ ... return x * 2
+ >>> double(2)
+ 4
+ >>> enabled = True
+ >>> double(2)
+ 2
"""
def decorate(func):
@functools.wraps(func)
def wrapper(param, /):
- return param if _op(check) else func(param)
+ return param if _op(_as_invocable(check)()) else func(param)
return wrapper
diff --git a/contrib/python/jaraco.functools/py3/jaraco/functools/__init__.pyi b/contrib/python/jaraco.functools/py3/jaraco/functools/__init__.pyi
index 6f834bf06d9..0462fe98862 100644
--- a/contrib/python/jaraco.functools/py3/jaraco/functools/__init__.pyi
+++ b/contrib/python/jaraco.functools/py3/jaraco/functools/__init__.pyi
@@ -3,13 +3,14 @@ from functools import partial
from operator import methodcaller
from typing import (
Any,
+ Concatenate,
Generic,
Protocol,
TypeVar,
overload,
)
-from typing_extensions import Concatenate, ParamSpec, TypeVarTuple, Unpack
+from typing_extensions import ParamSpec, TypeVarTuple, Unpack
_P = ParamSpec('_P')
_R = TypeVar('_R')
@@ -115,7 +116,7 @@ def except_(
) -> Callable[[Callable[_P, Any]], Callable[_P, Any]]: ...
def identity(x: _T) -> _T: ...
def bypass_when(
- check: _V, *, _op: Callable[[_V], Any] = ...
+ check: _V | Callable[[], _V], *, _op: Callable[[_V], Any] = ...
) -> Callable[[Callable[[_T], _R]], Callable[[_T], _T | _R]]: ...
def bypass_unless(
check: Any,
diff --git a/contrib/python/jaraco.functools/py3/ya.make b/contrib/python/jaraco.functools/py3/ya.make
index 777e095d45c..4e7eb4d4540 100644
--- a/contrib/python/jaraco.functools/py3/ya.make
+++ b/contrib/python/jaraco.functools/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(4.4.0)
+VERSION(4.5.0)
LICENSE(MIT)