forked from pool/python-typing-inspect
- update to 0.8.0:
* Python 3.9 support * support PEO 591 * Require newer typing extension * Python 3.10 support * Add support for UnionType in get_args - drop typing_inspect-pr69-py39-GenericAlias.patch (upstream) OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-typing-inspect?expand=0&rev=5
This commit is contained in:
parent
b53468ef28
commit
acf13f99dc
@ -1,3 +1,14 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Jan 7 16:17:47 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
- update to 0.8.0:
|
||||||
|
* Python 3.9 support
|
||||||
|
* support PEO 591
|
||||||
|
* Require newer typing extension
|
||||||
|
* Python 3.10 support
|
||||||
|
* Add support for UnionType in get_args
|
||||||
|
- drop typing_inspect-pr69-py39-GenericAlias.patch (upstream)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Mar 21 13:52:12 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
Sun Mar 21 13:52:12 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-typing-inspect
|
# spec file for package python-typing-inspect
|
||||||
#
|
#
|
||||||
# Copyright (c) 2021 SUSE LLC
|
# Copyright (c) 2023 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -18,15 +18,13 @@
|
|||||||
|
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||||
Name: python-typing-inspect
|
Name: python-typing-inspect
|
||||||
Version: 0.6.0
|
Version: 0.8.0
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Python runtime inspection utilities for typing
|
Summary: Python runtime inspection utilities for typing
|
||||||
License: MIT
|
License: MIT
|
||||||
Group: Development/Languages/Python
|
Group: Development/Languages/Python
|
||||||
URL: https://github.com/ilevkivskyi/typing_inspect
|
URL: https://github.com/ilevkivskyi/typing_inspect
|
||||||
Source: https://files.pythonhosted.org/packages/source/t/typing_inspect/typing_inspect-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/t/typing_inspect/typing_inspect-%{version}.tar.gz
|
||||||
# PATCH-FIX-UPSTREAM typing_inspect-pr69-py39-GenericAlias.patch -- backport of gh#ilevkivskyi/typing_inspect#69
|
|
||||||
Patch0: typing_inspect-pr69-py39-GenericAlias.patch
|
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:8f1b1dd25908dbfd81d3bebc218011531e7ab614ba6e5bf7826d887c834afab7
|
|
||||||
size 12229
|
|
3
typing_inspect-0.8.0.tar.gz
Normal file
3
typing_inspect-0.8.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:8b1ff0c400943b6145df8119c41c244ca8207f1f10c9c057aeed1560e4806e3d
|
||||||
|
size 13550
|
@ -1,88 +0,0 @@
|
|||||||
diff --git a/typing_inspect.py b/typing_inspect.py
|
|
||||||
index 2444027..896f1a9 100644
|
|
||||||
--- a/typing_inspect.py
|
|
||||||
+++ b/typing_inspect.py
|
|
||||||
@@ -23,6 +23,11 @@ if NEW_TYPING:
|
|
||||||
Generic, Callable, Union, TypeVar, ClassVar, Tuple, _GenericAlias, ForwardRef
|
|
||||||
)
|
|
||||||
from typing_extensions import Literal
|
|
||||||
+ if sys.version_info[:3] >= (3, 9, 0):
|
|
||||||
+ from typing import _SpecialGenericAlias
|
|
||||||
+ typingGenericAlias = (_GenericAlias, _SpecialGenericAlias)
|
|
||||||
+ else:
|
|
||||||
+ typingGenericAlias = (_GenericAlias, )
|
|
||||||
else:
|
|
||||||
from typing import (
|
|
||||||
Callable, CallableMeta, Union, Tuple, TupleMeta, TypeVar, GenericMeta, _ForwardRef
|
|
||||||
@@ -74,7 +79,7 @@ def is_generic_type(tp):
|
|
||||||
"""
|
|
||||||
if NEW_TYPING:
|
|
||||||
return (isinstance(tp, type) and issubclass(tp, Generic) or
|
|
||||||
- isinstance(tp, _GenericAlias) and
|
|
||||||
+ isinstance(tp, typingGenericAlias) and
|
|
||||||
tp.__origin__ not in (Union, tuple, ClassVar, collections.abc.Callable))
|
|
||||||
return (isinstance(tp, GenericMeta) and not
|
|
||||||
isinstance(tp, (CallableMeta, TupleMeta)))
|
|
||||||
@@ -100,7 +105,7 @@ def is_callable_type(tp):
|
|
||||||
get_origin(tp) is collections.abc.Callable # Callable prior to Python 3.7
|
|
||||||
"""
|
|
||||||
if NEW_TYPING:
|
|
||||||
- return (tp is Callable or isinstance(tp, _GenericAlias) and
|
|
||||||
+ return (tp is Callable or isinstance(tp, typingGenericAlias) and
|
|
||||||
tp.__origin__ is collections.abc.Callable or
|
|
||||||
isinstance(tp, type) and issubclass(tp, Generic) and
|
|
||||||
issubclass(tp, collections.abc.Callable))
|
|
||||||
@@ -126,7 +131,7 @@ def is_tuple_type(tp):
|
|
||||||
get_origin(tp) is tuple # Tuple prior to Python 3.7
|
|
||||||
"""
|
|
||||||
if NEW_TYPING:
|
|
||||||
- return (tp is Tuple or isinstance(tp, _GenericAlias) and
|
|
||||||
+ return (tp is Tuple or isinstance(tp, typingGenericAlias) and
|
|
||||||
tp.__origin__ is tuple or
|
|
||||||
isinstance(tp, type) and issubclass(tp, Generic) and
|
|
||||||
issubclass(tp, tuple))
|
|
||||||
@@ -164,14 +169,14 @@ def is_union_type(tp):
|
|
||||||
"""
|
|
||||||
if NEW_TYPING:
|
|
||||||
return (tp is Union or
|
|
||||||
- isinstance(tp, _GenericAlias) and tp.__origin__ is Union)
|
|
||||||
+ isinstance(tp, typingGenericAlias) and tp.__origin__ is Union)
|
|
||||||
return type(tp) is _Union
|
|
||||||
|
|
||||||
|
|
||||||
def is_literal_type(tp):
|
|
||||||
if NEW_TYPING:
|
|
||||||
return (tp is Literal or
|
|
||||||
- isinstance(tp, _GenericAlias) and tp.__origin__ is Literal)
|
|
||||||
+ isinstance(tp, typingGenericAlias) and tp.__origin__ is Literal)
|
|
||||||
return WITH_LITERAL and type(tp) is _Literal
|
|
||||||
|
|
||||||
|
|
||||||
@@ -196,7 +201,7 @@ def is_classvar(tp):
|
|
||||||
"""
|
|
||||||
if NEW_TYPING:
|
|
||||||
return (tp is ClassVar or
|
|
||||||
- isinstance(tp, _GenericAlias) and tp.__origin__ is ClassVar)
|
|
||||||
+ isinstance(tp, typingGenericAlias) and tp.__origin__ is ClassVar)
|
|
||||||
elif WITH_CLASSVAR:
|
|
||||||
return type(tp) is _ClassVar
|
|
||||||
else:
|
|
||||||
@@ -262,7 +267,7 @@ def get_origin(tp):
|
|
||||||
get_origin(List[Tuple[T, T]][int]) == list # List prior to Python 3.7
|
|
||||||
"""
|
|
||||||
if NEW_TYPING:
|
|
||||||
- if isinstance(tp, _GenericAlias):
|
|
||||||
+ if isinstance(tp, typingGenericAlias):
|
|
||||||
return tp.__origin__ if tp.__origin__ is not ClassVar else None
|
|
||||||
if tp is Generic:
|
|
||||||
return Generic
|
|
||||||
@@ -327,7 +332,7 @@ def get_parameters(tp):
|
|
||||||
else:
|
|
||||||
return ()
|
|
||||||
elif NEW_TYPING:
|
|
||||||
- if (isinstance(tp, _GenericAlias) or
|
|
||||||
+ if (isinstance(tp, typingGenericAlias) or
|
|
||||||
isinstance(tp, type) and issubclass(tp, Generic) and
|
|
||||||
tp is not Generic):
|
|
||||||
return tp.__parameters__
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user