File python-311-compat.patch of Package python-ntfy

From: Matthias Bach <marix@marix.org>
Date: Sat, 7 Jan 2023 15:15:25 +0100
Subject: [PATCH] Fix compatibility with Python 3.11
References: https://github.com/dschep/ntfy/pull/271
Upstream: submitted

We had still been using the function inspect.getargspec() that had
already been deprecated in Python 3.0.

Switching to the equivalent inspect.getfullargspec() breaks
compabitility with Python 2. However, as Python 2 is long dead we don't
care about that.
---
 ntfy/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ntfy/__init__.py b/ntfy/__init__.py
index 0fa7a22..6ed0abb 100644
--- a/ntfy/__init__.py
+++ b/ntfy/__init__.py
@@ -3,7 +3,7 @@ from getpass import getuser
 from os import getcwd, path, name
 from socket import gethostname
 from importlib import import_module
-from inspect import getargspec
+from inspect import getfullargspec
 from .backends.default import DefaultNotifierError
 
 __version__ = '2.7.0'
@@ -65,7 +65,7 @@ def notify(message, title, config=None, **kwargs):
                 notifier = e.module
                 e = e.exception
 
-            args, _, _, defaults = getargspec(notifier.notify)
+            args, _, _, defaults, *_ = getfullargspec(notifier.notify)
             possible_args = set(args)
             required_args =  set(args) if defaults is None else set(args[:-len(defaults)])
             required_args -= set(['title', 'message', 'retcode'])
-- 
2.35.3

openSUSE Build Service is sponsored by