Compare commits
10 Commits
5a95d57aff
...
bd34d4dffa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd34d4dffa | ||
|
|
9ec5f04230 | ||
|
|
66230340db | ||
|
|
0410ba8e47 | ||
|
|
2258920298 | ||
|
|
fd4d127f20 | ||
|
|
93744021aa | ||
|
|
9022abe5fb | ||
|
|
aeeb2f53da | ||
|
|
d90823e39c |
60
backport-fix-assigning-string-value-to-Set.patch
Normal file
60
backport-fix-assigning-string-value-to-Set.patch
Normal 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
|
||||||
|
|
||||||
@ -1,52 +1,71 @@
|
|||||||
Name: python-traitlets
|
Name: python-traitlets
|
||||||
Version: 4.3.2
|
Version: 5.14.1
|
||||||
Release: 11
|
Release: 2
|
||||||
Summary: A lightweight Traits like module.
|
Summary: A lightweight Traits like module.
|
||||||
|
|
||||||
License: BSD-3-Clause
|
License: BSD-3-Clause
|
||||||
URL: https://github.com/ipython/traitlets
|
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
|
BuildArch: noarch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
A framework that lets Python classes have attributes with type checking, dynamically calculated default values,
|
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.
|
Summary: A lightweight Traits like module.
|
||||||
BuildRequires: python%{python3_pkgversion}-devel python%{python3_pkgversion}-pytest
|
BuildRequires: python3-devel
|
||||||
BuildRequires: python%{python3_pkgversion}-decorator python%{python3_pkgversion}-six
|
BuildRequires: python3-setuptools
|
||||||
BuildRequires: python%{python3_pkgversion}-ipython_genutils python%{python3_pkgversion}-six
|
BuildRequires: python3-pip
|
||||||
Requires: python%{python3_pkgversion}-decorator python%{python3_pkgversion}-ipython_genutils python%{python3_pkgversion}-six
|
BuildRequires: python3-wheel
|
||||||
%python_provide python%{python3_pkgversion}-traitlets
|
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,
|
A framework that lets Python classes have attributes with type checking, dynamically calculated default values,
|
||||||
and ‘on change’ callbacks.
|
and callbacks.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n traitlets-%{version} -p1
|
%autosetup -n traitlets-%{version} -p1
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%py3_build
|
%pyproject_build
|
||||||
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%py3_install
|
%pyproject_install
|
||||||
|
|
||||||
|
|
||||||
%check
|
%check
|
||||||
py.test-%{python3_version} -v traitlets/tests/
|
py.test-3 -v traitlets/tests/
|
||||||
|
|
||||||
|
|
||||||
%files -n python%{python3_pkgversion}-traitlets
|
|
||||||
%doc README.md COPYING.md
|
|
||||||
%{python3_sitelib}/*
|
|
||||||
|
|
||||||
|
%files -n python3-traitlets
|
||||||
|
%license LICENSE
|
||||||
|
%doc README.md
|
||||||
|
%{python3_sitelib}/traitlets/
|
||||||
|
%{python3_sitelib}/traitlets*.dist-info/
|
||||||
|
|
||||||
%changelog
|
%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
|
* Mon May 9 2022 yaoxin <yaoxin30@h-partners.com> - 4.3.2-11
|
||||||
- License compliance rectification
|
- License compliance rectification
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
BIN
traitlets-5.14.1.tar.gz
Normal file
BIN
traitlets-5.14.1.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user