Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
bd34d4dffa
!16 [sync] PR-15: bugfix:Fix assigning string value to Set
From: @openeuler-sync-bot 
Reviewed-by: @shinwell_hu 
Signed-off-by: @shinwell_hu
2024-05-12 06:54:17 +00:00
dongjiao
9ec5f04230 bugfix:Fix assigning string value to Set
(cherry picked from commit 34a2b39b314e57789eece67a21f5280ac83216ee)
2024-05-11 17:40:48 +08:00
openeuler-ci-bot
66230340db
!13 Upgrade package with version 5.14.1
From: @desert-sailor 
Reviewed-by: @yangzhao_kl 
Signed-off-by: @yangzhao_kl
2024-03-01 10:07:32 +00:00
desert-sailor
0410ba8e47 Upgrade package with version 5.14.1 2024-03-01 16:23:21 +08:00
openeuler-ci-bot
2258920298
!12 Update to 5.9.0
From: @starlet-dx 
Reviewed-by: @cherry530 
Signed-off-by: @cherry530
2023-04-25 07:05:17 +00:00
starlet-dx
fd4d127f20 Update to 5.9.0 2023-04-25 13:49:23 +08:00
openeuler-ci-bot
93744021aa
!9 Update package
From: @liqiuyu123 
Reviewed-by: @yangzhao_kl 
Signed-off-by: @yangzhao_kl
2022-08-05 05:43:17 +00:00
liqiuyu123
9022abe5fb update package 2022-08-04 14:19:04 +08:00
openeuler-ci-bot
aeeb2f53da
!8 Update python-traitlets to v5.1.1
From: @penelope_y 
Reviewed-by: @myeuler 
Signed-off-by: @myeuler
2022-06-02 09:39:36 +00:00
penelope
d90823e39c update to 5.1.1 2022-06-01 16:25:36 +08:00
4 changed files with 102 additions and 23 deletions

View File

@ -0,0 +1,60 @@
From 5cf34f6c42b6e39aa1e53394443efca3d7329e3b Mon Sep 17 00:00:00 2001
From: azjps <azhu@tower-research.com>
Date: Fri, 19 Apr 2024 23:07:41 +1200
Subject: [PATCH] Fix assigning string value to Set (#903)
url:https://github.com/ipython/traitlets/pull/903/commits/4143e7eb0c3e474fe3cb031666b4620cf1e0d832
---
tests/test_traitlets.py | 18 ++++++++++++++++++
traitlets/traitlets.py | 7 +------
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/tests/test_traitlets.py b/tests/test_traitlets.py
index dfcf3f0..f9f623b 100644
--- a/tests/test_traitlets.py
+++ b/tests/test_traitlets.py
@@ -1658,6 +1658,24 @@ class TestList(TraitTestBase):
return value
+class SetTrait(HasTraits):
+ value = Set(Unicode())
+
+
+class TestSet(TraitTestBase):
+ obj = SetTrait()
+
+ _default_value: t.Set[str] = set()
+ _good_values = [{"a", "b"}, "ab"]
+ _bad_values = [1]
+
+ def coerce(self, value):
+ if isinstance(value, str):
+ # compatibility handling: convert string to set containing string
+ value = {value}
+ return value
+
+
class Foo:
pass
diff --git a/traitlets/traitlets.py b/traitlets/traitlets.py
index 1d1675a..ecd0d7c 100644
--- a/traitlets/traitlets.py
+++ b/traitlets/traitlets.py
@@ -3698,12 +3698,7 @@ class Set(Container[t.Set[t.Any]]):
def set(self, obj: t.Any, value: t.Any) -> None:
if isinstance(value, str):
- return super().set(
- obj,
- set(
- value,
- ),
- )
+ return super().set(obj, {value})
else:
return super().set(obj, value)
--
2.27.0

View File

@ -1,52 +1,71 @@
Name: python-traitlets
Version: 4.3.2
Release: 11
Version: 5.14.1
Release: 2
Summary: A lightweight Traits like module.
License: BSD-3-Clause
URL: https://github.com/ipython/traitlets
Source0: https://github.com/ipython/traitlets/archive/%{version}.tar.gz#/traitlets-%{version}.tar.gz
Source0: https://files.pythonhosted.org/packages/source/t/traitlets/traitlets-%{version}.tar.gz
Patch0: backport-fix-assigning-string-value-to-Set.patch
BuildArch: noarch
%description
A framework that lets Python classes have attributes with type checking, dynamically calculated default values,
and on change callbacks.
and callbacks.
%package -n python%{python3_pkgversion}-traitlets
%package -n python3-traitlets
Summary: A lightweight Traits like module.
BuildRequires: python%{python3_pkgversion}-devel python%{python3_pkgversion}-pytest
BuildRequires: python%{python3_pkgversion}-decorator python%{python3_pkgversion}-six
BuildRequires: python%{python3_pkgversion}-ipython_genutils python%{python3_pkgversion}-six
Requires: python%{python3_pkgversion}-decorator python%{python3_pkgversion}-ipython_genutils python%{python3_pkgversion}-six
%python_provide python%{python3_pkgversion}-traitlets
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
BuildRequires: python3-wheel
BuildRequires: python3-hatchling
BuildRequires: python3-pytest
%python_provide python3-traitlets
%description -n python%{python3_pkgversion}-traitlets
%description -n python3-traitlets
A framework that lets Python classes have attributes with type checking, dynamically calculated default values,
and on change callbacks.
and callbacks.
%prep
%autosetup -n traitlets-%{version} -p1
%build
%py3_build
%pyproject_build
%install
%py3_install
%pyproject_install
%check
py.test-%{python3_version} -v traitlets/tests/
%files -n python%{python3_pkgversion}-traitlets
%doc README.md COPYING.md
%{python3_sitelib}/*
py.test-3 -v traitlets/tests/
%files -n python3-traitlets
%license LICENSE
%doc README.md
%{python3_sitelib}/traitlets/
%{python3_sitelib}/traitlets*.dist-info/
%changelog
* Sat May 11 2024 dongjiao <dongjiao@kylinos.cn> - 5.14.1-2
- bugfix:Fix assigning string value to Set
* Fri Mar 1 2024 Dongxing Wang <dongxing.wang_a@thundersoft.com> - 5.14.1-1
- Upgrade package with version 5.14.1
Add option to load traitlets values from environement.
Cleanup after remove Python 2 support.
Add more project URLs, trove classifiers.
Added type hints to HasTraits.observe() and friends.
* Tue Apr 25 2023 yaoxin <yao_xin001@hoperun.com> - 5.9.0-1
- Update to 5.9.0
* Thu Aug 04 2022 liqiuyu <liqiuyu@kylinos.cn> - 5.3.0-1
- Update to 5.3.0
* Wed Jun 01 2022 yangping <yangping69@h-partners.com> - 5.1.1-1
- Update to v5.1.1
* Mon May 9 2022 yaoxin <yaoxin30@h-partners.com> - 4.3.2-11
- License compliance rectification

Binary file not shown.

BIN
traitlets-5.14.1.tar.gz Normal file

Binary file not shown.