39 lines
1.5 KiB
Diff
39 lines
1.5 KiB
Diff
From dc0ad61ece0a44123dbc34fe83b30a2c418caf8e Mon Sep 17 00:00:00 2001
|
|
From: Luke Granger-Brown <jj@lukegb.com>
|
|
Date: Sun, 19 Nov 2023 20:30:32 +0000
|
|
Subject: [PATCH 1/3] Swap from inspect.getargspec to inspect.signature for
|
|
Python 3.11+.
|
|
|
|
---
|
|
ntfy/__init__.py | 8 ++++----
|
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/ntfy/__init__.py b/ntfy/__init__.py
|
|
index 13cb716..8449410 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 signature, Parameter
|
|
from .backends.default import DefaultNotifierError
|
|
|
|
__version__ = '2.7.1'
|
|
@@ -65,9 +65,9 @@ def notify(message, title, config=None, **kwargs):
|
|
notifier = e.module
|
|
e = e.exception
|
|
|
|
- args, _, _, defaults = getargspec(notifier.notify)
|
|
- possible_args = set(args)
|
|
- required_args = set(args) if defaults is None else set(args[:-len(defaults)])
|
|
+ signature = signature(notifier.notify)
|
|
+ possible_args = {arg.name for arg in signature.parameters.values()}
|
|
+ required_args = {arg.name for arg in signature.parameters.values() if arg.default == Parameter.empty}
|
|
required_args -= set(['title', 'message', 'retcode'])
|
|
unknown_args = set(backend_config) - possible_args
|
|
missing_args = required_args - set(backend_config)
|
|
--
|
|
2.42.0
|
|
|