From e3613541c38469e6a1b1172aff96748da7bfde24 Mon Sep 17 00:00:00 2001 From: Dulmandakh Date: Sat, 6 Jul 2024 10:27:51 +0800 Subject: [PATCH 1/4] bump mypy to 1.10 --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index fdec66d0..f172b5fe 100644 --- a/tox.ini +++ b/tox.ini @@ -22,7 +22,7 @@ commands = [testenv:mypy] basepython = python3.10 deps = - mypy>=0.950,<1 + mypy>=1.10,<2 commands = mypy graphene From f2ac42d9e15ab9bc36f30dcf6c4bcd94354ea580 Mon Sep 17 00:00:00 2001 From: Dulmandakh Date: Sat, 6 Jul 2024 10:32:26 +0800 Subject: [PATCH 2/4] fix mypy error --- graphene/utils/deprecated.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphene/utils/deprecated.py b/graphene/utils/deprecated.py index 42c358fb..9a8b14af 100644 --- a/graphene/utils/deprecated.py +++ b/graphene/utils/deprecated.py @@ -27,9 +27,9 @@ def deprecated(reason): def decorator(func1): if inspect.isclass(func1): - fmt1 = f"Call to deprecated class {func1.__name__} ({reason})." + fmt1 = f"Call to deprecated class {func1.__name__} ({reason!r})." else: - fmt1 = f"Call to deprecated function {func1.__name__} ({reason})." + fmt1 = f"Call to deprecated function {func1.__name__} ({reason!r})." @functools.wraps(func1) def new_func1(*args, **kwargs): From c23ff112202b8d5b4019d8513b6ac4fb5a0755fd Mon Sep 17 00:00:00 2001 From: Dulmandakh Date: Sat, 6 Jul 2024 10:45:40 +0800 Subject: [PATCH 3/4] decode --- graphene/utils/deprecated.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphene/utils/deprecated.py b/graphene/utils/deprecated.py index 9a8b14af..c51bd684 100644 --- a/graphene/utils/deprecated.py +++ b/graphene/utils/deprecated.py @@ -27,9 +27,9 @@ def deprecated(reason): def decorator(func1): if inspect.isclass(func1): - fmt1 = f"Call to deprecated class {func1.__name__} ({reason!r})." + fmt1 = f"Call to deprecated class {func1.__name__} ({reason.decode()})." else: - fmt1 = f"Call to deprecated function {func1.__name__} ({reason!r})." + fmt1 = f"Call to deprecated function {func1.__name__} ({reason.decode()})." @functools.wraps(func1) def new_func1(*args, **kwargs): From 0cc7bb7748f9e0b9d53f1f1d051315bc3801db46 Mon Sep 17 00:00:00 2001 From: Dulmandakh Date: Sat, 6 Jul 2024 10:49:31 +0800 Subject: [PATCH 4/4] fix mypy error --- graphene/utils/deprecated.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/graphene/utils/deprecated.py b/graphene/utils/deprecated.py index c51bd684..242a0c65 100644 --- a/graphene/utils/deprecated.py +++ b/graphene/utils/deprecated.py @@ -24,12 +24,13 @@ def deprecated(reason): # @deprecated("please, use another function") # def old_function(x, y): # pass + reason = reason.decode() if isinstance(reason, bytes) else reason def decorator(func1): if inspect.isclass(func1): - fmt1 = f"Call to deprecated class {func1.__name__} ({reason.decode()})." + fmt1 = f"Call to deprecated class {func1.__name__} ({reason})." else: - fmt1 = f"Call to deprecated function {func1.__name__} ({reason.decode()})." + fmt1 = f"Call to deprecated function {func1.__name__} ({reason})." @functools.wraps(func1) def new_func1(*args, **kwargs):