xloft 0.1.15__py3-none-any.whl → 0.10.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xloft/__init__.py +35 -10
- xloft/converters/__init__.py +22 -0
- xloft/converters/human_size.py +42 -0
- xloft/converters/roman.py +119 -0
- xloft/errors.py +43 -24
- xloft/itis.py +63 -0
- xloft/types/__init__.py +20 -0
- xloft/types/alias_dict.py +359 -0
- xloft/{namedtuple.py → types/named_tuple.py} +240 -252
- xloft-0.10.10.dist-info/METADATA +281 -0
- xloft-0.10.10.dist-info/RECORD +14 -0
- {xloft-0.1.15.dist-info → xloft-0.10.10.dist-info}/WHEEL +1 -1
- {xloft-0.1.15.dist-info → xloft-0.10.10.dist-info}/licenses/LICENSE +21 -21
- xloft-0.1.15.dist-info/METADATA +0 -150
- xloft-0.1.15.dist-info/RECORD +0 -8
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xloft
|
|
3
|
+
Version: 0.10.10
|
|
4
|
+
Summary: (XLOFT) X-Library of tools
|
|
5
|
+
Project-URL: Homepage, https://kebasyaty.github.io/xloft/
|
|
6
|
+
Project-URL: Repository, https://github.com/kebasyaty/xloft
|
|
7
|
+
Project-URL: Source, https://github.com/kebasyaty/xloft
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/kebasyaty/xloft/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/kebasyaty/xloft/blob/v0/CHANGELOG.md
|
|
10
|
+
Author-email: kebasyaty <kebasyaty@gmail.com>
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: aliasdict,collection,namedtuple,tools,xloft
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
18
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
19
|
+
Classifier: Operating System :: POSIX
|
|
20
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
|
22
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
26
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
28
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
29
|
+
Classifier: Topic :: Utilities
|
|
30
|
+
Classifier: Typing :: Typed
|
|
31
|
+
Requires-Python: <4.0,>=3.12
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
<div align="center">
|
|
35
|
+
<p align="center">
|
|
36
|
+
<a href="https://github.com/kebasyaty/xloft">
|
|
37
|
+
<img
|
|
38
|
+
height="80"
|
|
39
|
+
alt="Logo"
|
|
40
|
+
src="https://raw.githubusercontent.com/kebasyaty/xloft/main/assets/logo.png">
|
|
41
|
+
</a>
|
|
42
|
+
</p>
|
|
43
|
+
<p>
|
|
44
|
+
<h1>XLOFT</h1>
|
|
45
|
+
<h3>(XLOFT) X-Library of tools.</h3>
|
|
46
|
+
<p align="center">
|
|
47
|
+
<a href="https://github.com/kebasyaty/xloft/actions/workflows/test.yml" alt="Build Status"><img src="https://github.com/kebasyaty/xloft/actions/workflows/test.yml/badge.svg" alt="Build Status"></a>
|
|
48
|
+
<a href="https://kebasyaty.github.io/xloft/" alt="Docs"><img src="https://img.shields.io/badge/docs-available-brightgreen.svg" alt="Docs"></a>
|
|
49
|
+
<a href="https://pypi.python.org/pypi/xloft/" alt="PyPI pyversions"><img src="https://img.shields.io/pypi/pyversions/xloft.svg" alt="PyPI pyversions"></a>
|
|
50
|
+
<a href="https://pypi.python.org/pypi/xloft/" alt="PyPI status"><img src="https://img.shields.io/pypi/status/xloft.svg" alt="PyPI status"></a>
|
|
51
|
+
<a href="https://pypi.python.org/pypi/xloft/" alt="PyPI version fury.io"><img src="https://badge.fury.io/py/xloft.svg" alt="PyPI version fury.io"></a>
|
|
52
|
+
<br>
|
|
53
|
+
<a href="https://pyrefly.org/" alt="Types: Pyrefly"><img src="https://img.shields.io/badge/types-Pyrefly-FFB74D.svg" alt="Types: Pyrefly"></a>
|
|
54
|
+
<a href="https://docs.astral.sh/ruff/" alt="Code style: Ruff"><img src="https://img.shields.io/badge/code%20style-Ruff-FDD835.svg" alt="Code style: Ruff"></a>
|
|
55
|
+
<a href="https://pypi.org/project/xloft"><img src="https://img.shields.io/pypi/format/xloft" alt="Format"></a>
|
|
56
|
+
<a href="https://pepy.tech/projects/xloft"><img src="https://static.pepy.tech/badge/xloft" alt="PyPI Downloads"></a>
|
|
57
|
+
<a href="https://github.com/kebasyaty/xloft/blob/main/LICENSE" alt="GitHub license"><img src="https://img.shields.io/github/license/kebasyaty/xloft" alt="GitHub license"></a>
|
|
58
|
+
</p>
|
|
59
|
+
<p align="center">
|
|
60
|
+
The collection is represented by three modules of `NamedTuple`, `AliasDict`, `Converters`, `ItIs`.
|
|
61
|
+
<br>
|
|
62
|
+
In the future, new tools can be added.
|
|
63
|
+
</p>
|
|
64
|
+
</p>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
##
|
|
68
|
+
|
|
69
|
+
<br>
|
|
70
|
+
|
|
71
|
+
[](https://kebasyaty.github.io/xloft/ "Documentation")
|
|
72
|
+
|
|
73
|
+
[](https://github.com/kebasyaty/xloft/blob/v0/REQUIREMENTS.md "Requirements")
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
|
|
77
|
+
```shell
|
|
78
|
+
uv add xloft
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Usage
|
|
82
|
+
|
|
83
|
+
[](https://kebasyaty.github.io/xloft/latest/pages/usage/ "Examples")
|
|
84
|
+
|
|
85
|
+
- **NamedTuple**
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
"""This class imitates the behavior of the `named tuple`."""
|
|
89
|
+
|
|
90
|
+
from xloft import NamedTuple
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
nt = NamedTuple(x=10, y="Hello", _id="507c7f79bcf86cd7994f6c0e")
|
|
94
|
+
# or
|
|
95
|
+
d = {"x": 10, "y": "Hello", "_id": "507c7f79bcf86cd7994f6c0e"}
|
|
96
|
+
nt = NamedTuple(**d)
|
|
97
|
+
|
|
98
|
+
nt.x # => 10
|
|
99
|
+
nt.y # => Hello
|
|
100
|
+
nt._id # => 507c7f79bcf86cd7994f6c0e
|
|
101
|
+
nt.z # => raise: KeyError
|
|
102
|
+
|
|
103
|
+
nt["x"] # => 10
|
|
104
|
+
nt["y"] # => Hello
|
|
105
|
+
nt["_id"] # => 507c7f79bcf86cd7994f6c0e
|
|
106
|
+
nt["z"] # => KeyError
|
|
107
|
+
|
|
108
|
+
nt.get("x") # => 10
|
|
109
|
+
nt.get("y") # => Hello
|
|
110
|
+
nt.get("_id") # => 507c7f79bcf86cd7994f6c0e
|
|
111
|
+
nt.get("z") # => None
|
|
112
|
+
|
|
113
|
+
len(nt) # => 3
|
|
114
|
+
list(nt.keys()) # => ["x", "y", "_id"]
|
|
115
|
+
list(nt.values()) # => [10, "Hello", "507c7f79bcf86cd7994f6c0e"]
|
|
116
|
+
|
|
117
|
+
nt.has_key("x") # => True
|
|
118
|
+
nt.has_key("y") # => True
|
|
119
|
+
nt.hsa_key("_id") # => True
|
|
120
|
+
nt.has_key("z") # => False
|
|
121
|
+
|
|
122
|
+
nt.has_value(10) # => True
|
|
123
|
+
nt.has_value("Hello") # => True
|
|
124
|
+
nt.has_value("507c7f79bcf86cd7994f6c0e") # => True
|
|
125
|
+
nt.has_value([1, 2, 3]) # => False
|
|
126
|
+
|
|
127
|
+
d = nt.to_dict()
|
|
128
|
+
d["x"] # => 10
|
|
129
|
+
d.get("y") # => Hello
|
|
130
|
+
d.get("z") # => None
|
|
131
|
+
|
|
132
|
+
for key, val in nt.items():
|
|
133
|
+
print(f"Key: {key}, Value: {val}")
|
|
134
|
+
|
|
135
|
+
nt.update("x", 20)
|
|
136
|
+
nt.update("y", "Hi")
|
|
137
|
+
nt.update("_id", "new_id")
|
|
138
|
+
nt.x # => 20
|
|
139
|
+
nt.y # => Hi
|
|
140
|
+
nt._id # => new_id
|
|
141
|
+
nt.update("z", [1, 2, 3]) # => raise: KeyError
|
|
142
|
+
|
|
143
|
+
nt["x"] # => raise: KeyError
|
|
144
|
+
nt["y"] # => raise: KeyError
|
|
145
|
+
nt["_id"] # => raise: KeyError
|
|
146
|
+
nt["z"] # => raise: KeyError
|
|
147
|
+
nt["x"] = 20 # => TypeError
|
|
148
|
+
nt["y"] = "Hi" # => TypeError
|
|
149
|
+
nt["_id"] = "new_id" # => TypeError
|
|
150
|
+
nt["z"] = [1, 2, 3] # => TypeError
|
|
151
|
+
|
|
152
|
+
nt.x = 20 # => raise: AttributeDoesNotSetValueError
|
|
153
|
+
nt.y = "Hi" # => raise: AttributeDoesNotSetValueError
|
|
154
|
+
nt._id = "new_id" # => raise: AttributeDoesNotSetValueError
|
|
155
|
+
nt.z = [1, 2, 3] # => raise: AttributeDoesNotSetValueError
|
|
156
|
+
|
|
157
|
+
del nt.x # => raise: AttributeCannotBeDeleteError
|
|
158
|
+
del nt.y # => raise: AttributeCannotBeDeleteError
|
|
159
|
+
del nt._id # => raise: AttributeCannotBeDeleteError
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
- **AliasDict**
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
"""Pseudo dictionary with supports aliases for keys."""
|
|
166
|
+
|
|
167
|
+
from xloft import AliasDict
|
|
168
|
+
|
|
169
|
+
d = AliasDict()
|
|
170
|
+
# or
|
|
171
|
+
data = [
|
|
172
|
+
({"English", "en"}, "lemmatize_en_all"),
|
|
173
|
+
({"Russian", "ru"}, "lemmatize_ru_all"),
|
|
174
|
+
({"German", "de"}, "lemmatize_de_all"),
|
|
175
|
+
({"five", 5}, "Five it's me!"),
|
|
176
|
+
]
|
|
177
|
+
d = AliasDict(data)
|
|
178
|
+
|
|
179
|
+
len(d) # => 4
|
|
180
|
+
#
|
|
181
|
+
d["English"] # => "lemmatize_en_all"
|
|
182
|
+
d["en"] # => "lemmatize_en_all"
|
|
183
|
+
d["EN"] # => KeyError
|
|
184
|
+
#
|
|
185
|
+
d.get("English") # => "lemmatize_en_all"
|
|
186
|
+
d.get("en") # => "lemmatize_en_all"
|
|
187
|
+
d.get("EN") # => None
|
|
188
|
+
#
|
|
189
|
+
d.add({"Turkish", "tr"}, "libstemmer_tr")
|
|
190
|
+
d.get("Turkish") # => "libstemmer_tr"
|
|
191
|
+
d.get("tr") # => "libstemmer_tr"
|
|
192
|
+
#
|
|
193
|
+
d.update(5, "Hello world!")
|
|
194
|
+
d.get("five") # => "Hello world!"
|
|
195
|
+
d.get(5) # => "Hello world!"
|
|
196
|
+
#
|
|
197
|
+
d.add_alias(5, "five stars") # or -> d.add_alias("five", "five stars")
|
|
198
|
+
d.get("five stars") # => "Hello world!"
|
|
199
|
+
#
|
|
200
|
+
d.delete_alias("five stars")
|
|
201
|
+
d.get("five stars") # => None
|
|
202
|
+
#
|
|
203
|
+
d.delete(5)
|
|
204
|
+
d.get("five") # => None
|
|
205
|
+
d.get(5) # => None
|
|
206
|
+
#
|
|
207
|
+
d.has_key("English") # => True
|
|
208
|
+
d.has_key("en") # => True
|
|
209
|
+
d.has_key("EN") # => False
|
|
210
|
+
#
|
|
211
|
+
d.has_value("lemmatize_en_all") # True
|
|
212
|
+
d.has_value(6) # False
|
|
213
|
+
#
|
|
214
|
+
# items() -> `Generator[tuple[list[str | int | float], Any]]`
|
|
215
|
+
for aliases, value in d.items():
|
|
216
|
+
print(f"Aliases of key: {aliases}, Value: {value}")
|
|
217
|
+
#
|
|
218
|
+
list(d.keys()) # => ["English", "en", "Russian", "ru", "German", "de", "Turkish", "tr"]
|
|
219
|
+
#
|
|
220
|
+
list(d.values()) # => ["lemmatize_en_all", "lemmatize_ru_all", "lemmatize_de_all", "libstemmer_tr"]
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
- **Converters**
|
|
224
|
+
|
|
225
|
+
```python
|
|
226
|
+
"""Convert the number of bytes into a human-readable format."""
|
|
227
|
+
|
|
228
|
+
from xloft import to_human_size, int_to_roman, roman_to_int
|
|
229
|
+
# from xloft.converters import to_human_size, int_to_roman, roman_to_int
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
to_human_size(200) # => 200 bytes
|
|
233
|
+
to_human_size(1048576) # => 1 MB
|
|
234
|
+
to_human_size(1048575) # => 1023.999 KB
|
|
235
|
+
#
|
|
236
|
+
int_to_roman(1994) # => MCMXCIV
|
|
237
|
+
roman_to_int("MCMXCIV") # => 1994
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
- **ItIs**
|
|
241
|
+
|
|
242
|
+
```python
|
|
243
|
+
"""Check if a string is a number."""
|
|
244
|
+
|
|
245
|
+
from xloft import is_number, is_palindrome
|
|
246
|
+
# from xloft.itis import is_number, is_palindrome
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
is_number("") # => False
|
|
250
|
+
is_number(" ") # => False
|
|
251
|
+
is_number("1230.") # => False
|
|
252
|
+
is_number("0x5") # => False
|
|
253
|
+
is_number("0o5") # => False
|
|
254
|
+
is_number("-5.0") # => True
|
|
255
|
+
is_number("+5.0") # => True
|
|
256
|
+
is_number("5.0") # => True
|
|
257
|
+
is_number(".5") # => True
|
|
258
|
+
is_number("5.") # => True
|
|
259
|
+
is_number("3.4E+38") # => True
|
|
260
|
+
is_number("3.4E-38") # => True
|
|
261
|
+
is_number("1.7E+308") # => True
|
|
262
|
+
is_number("1.7E-308") # => True
|
|
263
|
+
is_number("-1.7976931348623157e+308") # => True
|
|
264
|
+
is_number("1.7976931348623157e+308") # => True
|
|
265
|
+
is_number("72028601076372765770200707816364342373431783018070841859646251155447849538676") # => True
|
|
266
|
+
is_number("-72028601076372765770200707816364342373431783018070841859646251155447849538676") # => True
|
|
267
|
+
#
|
|
268
|
+
is_palindrome("racecar") # True
|
|
269
|
+
is_palindrome("Go hang a salami, I'm a lasagna hog") # True
|
|
270
|
+
is_palindrome("22022022") # True
|
|
271
|
+
is_palindrome("Gene") # False
|
|
272
|
+
is_palindrome("123") # False
|
|
273
|
+
is_palindrome(123) # TypeError
|
|
274
|
+
is_palindrome("") # ValueError
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
<br>
|
|
278
|
+
|
|
279
|
+
[](https://github.com/kebasyaty/xloft/blob/v0/CHANGELOG.md "Changelog")
|
|
280
|
+
|
|
281
|
+
[](https://github.com/kebasyaty/xloft/blob/main/LICENSE "MIT")
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
xloft/__init__.py,sha256=vqVIpiatMS5jmCNQO1j69-B93yKGvi9809eLqdlIcSs,1033
|
|
2
|
+
xloft/errors.py,sha256=ef7mNwE3L1NjrLAraD6gDOuV7WfHyGtNBIbs18hmaxI,1377
|
|
3
|
+
xloft/itis.py,sha256=J0ucQCXSAVQxCa7D_3Iy26zymQVD-e-FMrUWTUcPdNY,1421
|
|
4
|
+
xloft/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
xloft/converters/__init__.py,sha256=qm0oLeKRqmmeOMrP1ppU2pxyT4eAAo-uB8bSiTcQmmg,610
|
|
6
|
+
xloft/converters/human_size.py,sha256=JwBEovNJzdt5JcLInA_ftZFBC_ZJUjnA_2RoSU2wFNc,1210
|
|
7
|
+
xloft/converters/roman.py,sha256=fdrJuOXiiIIjtFjHuxyc2HJhFNjmJpthcF2o5sPyNwM,2393
|
|
8
|
+
xloft/types/__init__.py,sha256=haOzryhXBq6poprsNw664lk0IThfCdxMr2WCfTlwROI,480
|
|
9
|
+
xloft/types/alias_dict.py,sha256=SJ_KnB-wlqjYVfk8d5sOeZuGOopiykra18Cq30xVUcQ,11740
|
|
10
|
+
xloft/types/named_tuple.py,sha256=sPD0TMyMrrvfhwZZ2x-H35VV3u5gaSo_SZdsbHf5wWc,6463
|
|
11
|
+
xloft-0.10.10.dist-info/METADATA,sha256=EivUBNpZv5_avIbUfWLaa5je-UGLTxwWMQgq5RpCUkE,9506
|
|
12
|
+
xloft-0.10.10.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
13
|
+
xloft-0.10.10.dist-info/licenses/LICENSE,sha256=mS0Wz0yGNB63gEcWEnuIb_lldDYV0sjRaO-o_GL6CWE,1074
|
|
14
|
+
xloft-0.10.10.dist-info/RECORD,,
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Gennady Kostyunin
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Gennady Kostyunin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
xloft-0.1.15.dist-info/METADATA
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: xloft
|
|
3
|
-
Version: 0.1.15
|
|
4
|
-
Summary: (XLOFT) X-Library of tools
|
|
5
|
-
Project-URL: Homepage, https://github.com/kebasyaty/xloft
|
|
6
|
-
Project-URL: Repository, https://github.com/kebasyaty/xloft
|
|
7
|
-
Project-URL: Source, https://github.com/kebasyaty/xloft
|
|
8
|
-
Project-URL: Bug Tracker, https://github.com/kebasyaty/xloft/issues
|
|
9
|
-
Project-URL: Changelog, https://github.com/kebasyaty/xloft/blob/v0/CHANGELOG.md
|
|
10
|
-
Author-email: kebasyaty <kebasyaty@gmail.com>
|
|
11
|
-
License-Expression: MIT
|
|
12
|
-
License-File: LICENSE
|
|
13
|
-
Keywords: collection,namedtuple,tools,xloft
|
|
14
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
15
|
-
Classifier: Intended Audience :: Developers
|
|
16
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
-
Classifier: Operating System :: MacOS :: MacOS X
|
|
18
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
19
|
-
Classifier: Operating System :: POSIX
|
|
20
|
-
Classifier: Programming Language :: Python :: 3
|
|
21
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
25
|
-
Classifier: Topic :: Utilities
|
|
26
|
-
Classifier: Typing :: Typed
|
|
27
|
-
Requires-Python: <4.0,>=3.12
|
|
28
|
-
Description-Content-Type: text/markdown
|
|
29
|
-
|
|
30
|
-
<div align="center">
|
|
31
|
-
<p align="center">
|
|
32
|
-
<a href="https://github.com/kebasyaty/xloft">
|
|
33
|
-
<img
|
|
34
|
-
height="90"
|
|
35
|
-
alt="Logo"
|
|
36
|
-
src="https://raw.githubusercontent.com/kebasyaty/xloft/main/assets/logo.svg">
|
|
37
|
-
</a>
|
|
38
|
-
</p>
|
|
39
|
-
<p>
|
|
40
|
-
<h1>XLOFT</h1>
|
|
41
|
-
<h3>(XLOFT) X-Library of tools.</h3>
|
|
42
|
-
<p align="center">
|
|
43
|
-
<a href="https://github.com/kebasyaty/xloft/actions/workflows/test.yml" alt="Build Status"><img src="https://github.com/kebasyaty/xloft/actions/workflows/test.yml/badge.svg" alt="Build Status"></a>
|
|
44
|
-
<a href="https://kebasyaty.github.io/xloft/" alt="Docs"><img src="https://img.shields.io/badge/docs-available-brightgreen.svg" alt="Docs"></a>
|
|
45
|
-
<a href="https://pypi.python.org/pypi/xloft/" alt="PyPI pyversions"><img src="https://img.shields.io/pypi/pyversions/xloft.svg" alt="PyPI pyversions"></a>
|
|
46
|
-
<a href="https://pypi.python.org/pypi/xloft/" alt="PyPI status"><img src="https://img.shields.io/pypi/status/xloft.svg" alt="PyPI status"></a>
|
|
47
|
-
<a href="https://pypi.python.org/pypi/xloft/" alt="PyPI version fury.io"><img src="https://badge.fury.io/py/xloft.svg" alt="PyPI version fury.io"></a>
|
|
48
|
-
<br>
|
|
49
|
-
<a href="https://github.com/kebasyaty/xloft/issues"><img src="https://img.shields.io/github/issues/kebasyaty/xloft.svg" alt="GitHub issues"></a>
|
|
50
|
-
<a href="https://pepy.tech/projects/xloft"><img src="https://static.pepy.tech/badge/xloft" alt="PyPI Downloads"></a>
|
|
51
|
-
<a href="https://github.com/kebasyaty/xloft/blob/main/LICENSE" alt="GitHub license"><img src="https://img.shields.io/github/license/kebasyaty/xloft" alt="GitHub license"></a>
|
|
52
|
-
<a href="https://docs.astral.sh/ruff/" alt="Code style: Ruff"><img src="https://img.shields.io/badge/code%20style-Ruff-FDD835.svg" alt="Code style: Ruff"></a>
|
|
53
|
-
<a href="https://github.com/kebasyaty/xloft" alt="PyPI implementation"><img src="https://img.shields.io/pypi/implementation/xloft" alt="PyPI implementation"></a>
|
|
54
|
-
<a href="https://github.com/kebasyaty/xloft" alt="GitHub repository"><img src="https://img.shields.io/badge/--ecebeb?logo=github&logoColor=000000" alt="GitHub repository"></a>
|
|
55
|
-
<br>
|
|
56
|
-
<a href="https://pypi.org/project/xloft"><img src="https://img.shields.io/pypi/format/xloft" alt="Format"></a>
|
|
57
|
-
<a href="https://github.com/kebasyaty/xloft"><img src="https://img.shields.io/github/languages/top/kebasyaty/xloft" alt="Top"></a>
|
|
58
|
-
<a href="https://github.com/kebasyaty/xloft"><img src="https://img.shields.io/github/repo-size/kebasyaty/xloft" alt="Size"></a>
|
|
59
|
-
<a href="https://github.com/kebasyaty/xloft"><img src="https://img.shields.io/github/last-commit/kebasyaty/xloft/main" alt="Last commit"></a>
|
|
60
|
-
<a href="https://github.com/kebasyaty/xloft/releases/" alt="GitHub release"><img src="https://img.shields.io/github/release/kebasyaty/xloft" alt="GitHub release"></a>
|
|
61
|
-
</p>
|
|
62
|
-
<p align="center">
|
|
63
|
-
Currently, the collection is represented by one element `NamedTuple`.
|
|
64
|
-
</p>
|
|
65
|
-
</p>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
##
|
|
69
|
-
|
|
70
|
-
## Documentation
|
|
71
|
-
|
|
72
|
-
Online browsable documentation is available at [https://kebasyaty.github.io/xloft/](https://kebasyaty.github.io/xloft/ "Documentation").
|
|
73
|
-
|
|
74
|
-
## Requirements
|
|
75
|
-
|
|
76
|
-
[View the list of requirements.](https://github.com/kebasyaty/xloft/blob/main/REQUIREMENTS.md "View the list of requirements.")
|
|
77
|
-
|
|
78
|
-
## Installation
|
|
79
|
-
|
|
80
|
-
```shell
|
|
81
|
-
uv add xloft
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Usage
|
|
85
|
-
|
|
86
|
-
```python
|
|
87
|
-
from xloft import NamedTuple
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
nt = NamedTuple(x=10, y="Hello")
|
|
91
|
-
# or
|
|
92
|
-
d = {"x": 10, "y": "Hello"}
|
|
93
|
-
nt = NamedTuple(**d)
|
|
94
|
-
|
|
95
|
-
nt.x # => 10
|
|
96
|
-
nt.y # => "Hello"
|
|
97
|
-
nt.z # => raise: KeyError
|
|
98
|
-
|
|
99
|
-
len(nt) # => 2
|
|
100
|
-
nt.keys() # => ["x", "y"]
|
|
101
|
-
nt.values() # => [10, "Hello"]
|
|
102
|
-
|
|
103
|
-
nt.has_key("x") # => True
|
|
104
|
-
nt.has_key("y") # => True
|
|
105
|
-
nt.has_key("z") # => False
|
|
106
|
-
|
|
107
|
-
nt.has_value(10) # => True
|
|
108
|
-
nt.has_value("Hello") # => True
|
|
109
|
-
nt.has_value([1, 2, 3]) # => False
|
|
110
|
-
|
|
111
|
-
nt.get("x") # => 10
|
|
112
|
-
nt.get("y") # => "Hello"
|
|
113
|
-
nt.get("z") # => None
|
|
114
|
-
|
|
115
|
-
d = nt.to_dict()
|
|
116
|
-
d["x"] # => 10
|
|
117
|
-
d.get("y") # => "Hello"
|
|
118
|
-
d.get("z") # => None
|
|
119
|
-
|
|
120
|
-
for key, val in nt.items():
|
|
121
|
-
print(f"Key: {key}, Value: {val}")
|
|
122
|
-
|
|
123
|
-
nt.update("x", 20)
|
|
124
|
-
nt.update("y", "Hi")
|
|
125
|
-
nt.x # => 20
|
|
126
|
-
nt.y # => "Hi"
|
|
127
|
-
nt.update("z", [1, 2, 3]) # => raise: KeyError
|
|
128
|
-
|
|
129
|
-
nt["x"] # => raise: KeyError
|
|
130
|
-
nt["y"] # => raise: KeyError
|
|
131
|
-
nt["z"] # => raise: KeyError
|
|
132
|
-
nt["x"] = 20 # => TypeError
|
|
133
|
-
nt["y"] = "Hi" # => TypeError
|
|
134
|
-
nt["z"] = [1, 2, 3] # => TypeError
|
|
135
|
-
|
|
136
|
-
nt.x = 20 # => raise: AttributeDoesNotSetValue
|
|
137
|
-
nt.y = "Hi" # => raise: AttributeDoesNotSetValue
|
|
138
|
-
nt.z = [1, 2, 3] # => raise: AttributeDoesNotSetValue
|
|
139
|
-
|
|
140
|
-
del nt.x # => raise: AttributeCannotBeDelete
|
|
141
|
-
del nt.y # => raise: AttributeCannotBeDelete
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Changelog
|
|
145
|
-
|
|
146
|
-
[View the change history.](https://github.com/kebasyaty/xloft/blob/main/CHANGELOG.md "Changelog")
|
|
147
|
-
|
|
148
|
-
## License
|
|
149
|
-
|
|
150
|
-
This project is licensed under the [MIT](https://github.com/kebasyaty/xloft/blob/main/LICENSE "MIT").
|
xloft-0.1.15.dist-info/RECORD
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
xloft/__init__.py,sha256=YtzkovVqW8hLxBXxM0U7K_qqfU8XBJ1pzX6tAgTUNFw,215
|
|
2
|
-
xloft/errors.py,sha256=GYXvi2l01VUDQSs6skiOfQsKLF6tFuUhJMqNkL7BJNI,857
|
|
3
|
-
xloft/namedtuple.py,sha256=JfbEisEa00m8zLtc8TMljCZmU-a9PdoAvshE6j0jSpQ,6711
|
|
4
|
-
xloft/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
xloft-0.1.15.dist-info/METADATA,sha256=MLp8eZdlYKpEo6b-sFnob7Xt02xlzcb5VFkoRvzY-qs,6037
|
|
6
|
-
xloft-0.1.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
-
xloft-0.1.15.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
|
|
8
|
-
xloft-0.1.15.dist-info/RECORD,,
|