summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-05-14 16:35:21 +0200
committerMichał Górny <mgorny@gentoo.org>2022-05-14 22:01:36 +0200
commit06ff6a9f5b674e2467de74200639fe6dde7f7c74 (patch)
tree565b3c36ce2f734d3c6808f2dfbdfd01d3434df1 /dev-python/botocore/files
parentdev-lang/mercury-extras: version bump (diff)
downloadgentoo-06ff6a9f5b674e2467de74200639fe6dde7f7c74.tar.gz
gentoo-06ff6a9f5b674e2467de74200639fe6dde7f7c74.tar.bz2
gentoo-06ff6a9f5b674e2467de74200639fe6dde7f7c74.zip
dev-python/botocore: Enable py3.11
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/botocore/files')
-rw-r--r--dev-python/botocore/files/botocore-1.26.0-py311.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/dev-python/botocore/files/botocore-1.26.0-py311.patch b/dev-python/botocore/files/botocore-1.26.0-py311.patch
new file mode 100644
index 000000000000..8caa8765c008
--- /dev/null
+++ b/dev-python/botocore/files/botocore-1.26.0-py311.patch
@@ -0,0 +1,54 @@
+From 46a3d92e29a03f547d85861bb6e21281b6a42e60 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sat, 14 May 2022 19:38:23 +0200
+Subject: [PATCH] Replace deprecated inspect.formatargspec() with
+ inspect.signature()
+
+Originally submitted by Hugo van Kemenade as #2507. Modified by me
+to remove the first positional parameter like the old code did.
+---
+ botocore/docs/method.py | 21 +++++++++++++--------
+ 1 file changed, 13 insertions(+), 8 deletions(-)
+
+diff --git a/botocore/docs/method.py b/botocore/docs/method.py
+index 0f7c60f6c..44c97d6e4 100644
+--- a/botocore/docs/method.py
++++ b/botocore/docs/method.py
+@@ -11,6 +11,7 @@
+ # ANY KIND, either express or implied. See the License for the specific
+ # language governing permissions and limitations under the License.
+ import inspect
++import types
+
+ from botocore.docs.example import (
+ RequestExampleDocumenter,
+@@ -101,14 +102,18 @@ def document_custom_signature(
+ :param exclude: The names of the parameters to exclude from
+ documentation.
+ """
+- argspec = inspect.getfullargspec(method)
+- signature_params = inspect.formatargspec(
+- args=argspec.args[1:],
+- varargs=argspec.varargs,
+- varkw=argspec.varkw,
+- defaults=argspec.defaults,
+- )
+- signature_params = signature_params.lstrip('(')
++ signature = inspect.signature(method)
++ # "raw" class methods are FunctionType and they include "self" param
++ # object methods are MethodType and they skip the "self" param
++ if isinstance(method, types.FunctionType):
++ self_param = next(iter(signature.parameters))
++ self_kind = signature.parameters[self_param].kind
++ # safety check that we got the right parameter
++ assert self_kind == inspect.Parameter.POSITIONAL_OR_KEYWORD
++ new_params = signature.parameters.copy()
++ del new_params[self_param]
++ signature = signature.replace(parameters=new_params.values())
++ signature_params = str(signature).lstrip('(')
+ signature_params = signature_params.rstrip(')')
+ section.style.start_sphinx_py_method(name, signature_params)
+
+--
+2.35.1
+