From 079d7fd6994bc6751bef4797a027b9e6daf966f4 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Mon, 9 Aug 2021 09:55:56 +0100 Subject: try fix for Protocol buy in 3.10 --- git/objects/util.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'git/objects/util.py') diff --git a/git/objects/util.py b/git/objects/util.py index 16d4c0ac..9f98db56 100644 --- a/git/objects/util.py +++ b/git/objects/util.py @@ -22,10 +22,10 @@ import calendar from datetime import datetime, timedelta, tzinfo # typing ------------------------------------------------------------ -from typing import (Any, Callable, Deque, Iterator, NamedTuple, overload, Sequence, +from typing import (Any, Callable, Deque, Iterator, Generic, NamedTuple, overload, Sequence, TYPE_CHECKING, Tuple, Type, TypeVar, Union, cast) -from git.types import Has_id_attribute, Literal, Protocol, runtime_checkable +from git.types import Has_id_attribute, Literal if TYPE_CHECKING: from io import BytesIO, StringIO @@ -35,6 +35,12 @@ if TYPE_CHECKING: from .tree import Tree, TraversedTreeTup from subprocess import Popen from .submodule.base import Submodule + from git.types import Protocol, runtime_checkable +else: + Protocol = Generic + + def runtime_checkable(f): + return f class TraverseNT(NamedTuple): -- cgit v1.2.1 From 1349ddc19f5a7f6aa56b0bc53d2f2c002128d360 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Mon, 9 Aug 2021 09:58:16 +0100 Subject: try fix for Protocol buy in 3.10 2 --- git/objects/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/objects/util.py') diff --git a/git/objects/util.py b/git/objects/util.py index 9f98db56..d227f346 100644 --- a/git/objects/util.py +++ b/git/objects/util.py @@ -37,7 +37,7 @@ if TYPE_CHECKING: from .submodule.base import Submodule from git.types import Protocol, runtime_checkable else: - Protocol = Generic + Protocol = Generic[Any] def runtime_checkable(f): return f -- cgit v1.2.1 From 2f42966cd1ec287d1c2011224940131dbda2383d Mon Sep 17 00:00:00 2001 From: Yobmod Date: Mon, 9 Aug 2021 10:08:42 +0100 Subject: try fix for Protocol buy in 3.10 3 --- git/objects/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'git/objects/util.py') diff --git a/git/objects/util.py b/git/objects/util.py index d227f346..4b830e0e 100644 --- a/git/objects/util.py +++ b/git/objects/util.py @@ -25,7 +25,7 @@ from datetime import datetime, timedelta, tzinfo from typing import (Any, Callable, Deque, Iterator, Generic, NamedTuple, overload, Sequence, TYPE_CHECKING, Tuple, Type, TypeVar, Union, cast) -from git.types import Has_id_attribute, Literal +from git.types import Has_id_attribute, Literal, _T if TYPE_CHECKING: from io import BytesIO, StringIO @@ -37,7 +37,7 @@ if TYPE_CHECKING: from .submodule.base import Submodule from git.types import Protocol, runtime_checkable else: - Protocol = Generic[Any] + Protocol = Generic[_T] def runtime_checkable(f): return f -- cgit v1.2.1 From c35ab1dd61e91bd55d939302d1f02e1c58985826 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Mon, 9 Aug 2021 17:14:31 +0100 Subject: upgrade sphinx for 3.10 compat --- git/objects/util.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'git/objects/util.py') diff --git a/git/objects/util.py b/git/objects/util.py index 4b830e0e..187318fe 100644 --- a/git/objects/util.py +++ b/git/objects/util.py @@ -5,7 +5,7 @@ # the BSD License: http://www.opensource.org/licenses/bsd-license.php """Module for general utility functions""" -from abc import abstractmethod +from abc import ABC, abstractmethod import warnings from git.util import ( IterableList, @@ -22,10 +22,10 @@ import calendar from datetime import datetime, timedelta, tzinfo # typing ------------------------------------------------------------ -from typing import (Any, Callable, Deque, Iterator, Generic, NamedTuple, overload, Sequence, +from typing import (Any, Callable, Deque, Iterator, Generic, NamedTuple, overload, Sequence, # NOQA: F401 TYPE_CHECKING, Tuple, Type, TypeVar, Union, cast) -from git.types import Has_id_attribute, Literal, _T +from git.types import Has_id_attribute, Literal, _T # NOQA: F401 if TYPE_CHECKING: from io import BytesIO, StringIO @@ -37,7 +37,8 @@ if TYPE_CHECKING: from .submodule.base import Submodule from git.types import Protocol, runtime_checkable else: - Protocol = Generic[_T] + # Protocol = Generic[_T] # NNeeded for typing bug #572? + Protocol = ABC def runtime_checkable(f): return f -- cgit v1.2.1