!38 Fix minor stub issues

From: @cao-fei8 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
This commit is contained in:
openeuler-ci-bot 2023-01-17 07:31:19 +00:00 committed by Gitee
commit 622176c7cb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 65 additions and 1 deletions

View File

@ -0,0 +1,60 @@
From b9f35eb2f25fa835ce61af067c20029216a0aeeb Mon Sep 17 00:00:00 2001
From: Hynek Schlawack <hs@ox.cx>
Date: Tue, 20 Dec 2022 15:10:12 +0100
Subject: [PATCH] Fix minor stub issues (#1072)
---
src/attr/__init__.pyi | 8 ++++----
src/attr/converters.pyi | 2 +-
src/attr/setters.pyi | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/attr/__init__.pyi b/src/attr/__init__.pyi
index baa5b2a..42a2ee2 100644
--- a/src/attr/__init__.pyi
+++ b/src/attr/__init__.pyi
@@ -48,17 +48,17 @@ _T = TypeVar("_T")
_C = TypeVar("_C", bound=type)
_EqOrderType = Union[bool, Callable[[Any], Any]]
-_ValidatorType = Callable[[Any, Attribute[_T], _T], Any]
+_ValidatorType = Callable[[Any, "Attribute[_T]", _T], Any]
_ConverterType = Callable[[Any], Any]
-_FilterType = Callable[[Attribute[_T], _T], bool]
+_FilterType = Callable[["Attribute[_T]", _T], bool]
_ReprType = Callable[[Any], str]
_ReprArgType = Union[bool, _ReprType]
-_OnSetAttrType = Callable[[Any, Attribute[Any], Any], Any]
+_OnSetAttrType = Callable[[Any, "Attribute[Any]", Any], Any]
_OnSetAttrArgType = Union[
_OnSetAttrType, List[_OnSetAttrType], setters._NoOpType
]
_FieldTransformer = Callable[
- [type, List[Attribute[Any]]], List[Attribute[Any]]
+ [type, List["Attribute[Any]"]], List["Attribute[Any]"]
]
# FIXME: in reality, if multiple validators are passed they must be in a list
# or tuple, but those are invariant and so would prevent subtypes of
diff --git a/src/attr/converters.pyi b/src/attr/converters.pyi
index 0f58088..5abb49f 100644
--- a/src/attr/converters.pyi
+++ b/src/attr/converters.pyi
@@ -1,4 +1,4 @@
-from typing import Callable, Optional, TypeVar, overload
+from typing import Callable, TypeVar, overload
from . import _ConverterType
diff --git a/src/attr/setters.pyi b/src/attr/setters.pyi
index 3f5603c..72f7ce4 100644
--- a/src/attr/setters.pyi
+++ b/src/attr/setters.pyi
@@ -1,4 +1,4 @@
-from typing import Any, NewType, NoReturn, TypeVar, cast
+from typing import Any, NewType, NoReturn, TypeVar
from . import Attribute, _OnSetAttrType
--
2.33.0

View File

@ -9,7 +9,7 @@ object protocols. \
Name: python-attrs
Summary: Python attributes without boilerplate
Version: 22.1.0
Release: 4
Release: 5
License: MIT
URL: http://www.attrs.org/
Source0: https://github.com/hynek/attrs/archive/%{version}/attrs-%{version}.tar.gz
@ -17,6 +17,7 @@ Source0: https://github.com/hynek/attrs/archive/%{version}/attrs-%{versio
Patch0: 0001-Update-.gitignore.patch
Patch1: 0001-Fix-typo.patch
Patch2: 0001-Fix-type-docstring.patch
Patch3: 0001-Fix-minor-stub-issues-1072.patch
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-devel
@ -61,6 +62,9 @@ PYTHONPATH=$RPM_BUILD_ROOT/%{python3_sitelib} py.test-3 -v
%doc AUTHORS.rst README.rst
%changelog
* Fri Jan 13 2023 caofei <caofei@xfusion.com> - 22.1.0-5
- Fix minor stub issues
* Fri Jan 13 2023 caofei <caofei@xfusion.com> - 22.1.0-4
- Fix type docstring