xloft 0.5.2__py3-none-any.whl → 0.6.0__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.
Potentially problematic release.
This version of xloft might be problematic. Click here for more details.
- xloft/__init__.py +2 -0
- xloft/constants.py +14 -0
- xloft/it_is.py +21 -0
- {xloft-0.5.2.dist-info → xloft-0.6.0.dist-info}/METADATA +25 -8
- xloft-0.6.0.dist-info/RECORD +11 -0
- xloft-0.5.2.dist-info/RECORD +0 -9
- {xloft-0.5.2.dist-info → xloft-0.6.0.dist-info}/WHEEL +0 -0
- {xloft-0.5.2.dist-info → xloft-0.6.0.dist-info}/licenses/LICENSE +0 -0
xloft/__init__.py
CHANGED
xloft/constants.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Constant variables.
|
|
2
|
+
|
|
3
|
+
The module contains the following variables:
|
|
4
|
+
|
|
5
|
+
- `DB_ROOT` - Path to root directory of database. `By default = "ScrubyDB"` (*in root of project*).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
__all__ = ("REGEX_IS_NUMBER",)
|
|
11
|
+
|
|
12
|
+
import re
|
|
13
|
+
|
|
14
|
+
REGEX_IS_NUMBER = re.compile(r"^[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$")
|
xloft/it_is.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Tools for determining something."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = ("is_number",)
|
|
6
|
+
|
|
7
|
+
from xloft.constants import REGEX_IS_NUMBER
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def is_number(value: str) -> bool:
|
|
11
|
+
"""Check if a string is a number.
|
|
12
|
+
|
|
13
|
+
Only decimal numbers.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
value: Some kind of string.
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
True, if the string is a number.
|
|
20
|
+
"""
|
|
21
|
+
return REGEX_IS_NUMBER.match(value) is not None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xloft
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: (XLOFT) X-Library of tools
|
|
5
5
|
Project-URL: Homepage, https://github.com/kebasyaty/xloft
|
|
6
6
|
Project-URL: Repository, https://github.com/kebasyaty/xloft
|
|
@@ -61,7 +61,7 @@ Description-Content-Type: text/markdown
|
|
|
61
61
|
<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>
|
|
62
62
|
</p>
|
|
63
63
|
<p align="center">
|
|
64
|
-
The collection is represented by three modules of `NamedTuple`, `Human`.
|
|
64
|
+
The collection is represented by three modules of `NamedTuple`, `Human`, `ItIs`.
|
|
65
65
|
<br>
|
|
66
66
|
In the future, new tools can be added.
|
|
67
67
|
</p>
|
|
@@ -171,14 +171,31 @@ del nt._id # => raise: AttributeCannotBeDelete
|
|
|
171
171
|
from xloft import to_human_size
|
|
172
172
|
|
|
173
173
|
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
to_human_size(200) # => 200 bytes
|
|
175
|
+
to_human_size(1048576) # => 1 MB
|
|
176
|
+
to_human_size(1048575) # => 1023.999 KB
|
|
177
|
+
```
|
|
176
178
|
|
|
177
|
-
|
|
178
|
-
print(s) # => 1 MB
|
|
179
|
+
- **ItIs**
|
|
179
180
|
|
|
180
|
-
|
|
181
|
-
|
|
181
|
+
```python
|
|
182
|
+
from xloft import is_number
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
is_number("-1230.0123") # => True
|
|
186
|
+
is_number("+1230.0123") # => True
|
|
187
|
+
is_number("1230.0123") # => True
|
|
188
|
+
is_number("1230.0") # => True
|
|
189
|
+
is_number("1230") # => True
|
|
190
|
+
is_number("1.23e-5") # => True
|
|
191
|
+
is_number("1.23e-05") # => True
|
|
192
|
+
is_number(".5") # => True
|
|
193
|
+
|
|
194
|
+
is_number("") # => False
|
|
195
|
+
is_number(" ") # => False
|
|
196
|
+
is_number("1230.") # => False
|
|
197
|
+
is_number("0x5") # => False
|
|
198
|
+
is_number("0o5") # => False
|
|
182
199
|
```
|
|
183
200
|
|
|
184
201
|
## Changelog
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
xloft/__init__.py,sha256=X8EHVMXbfyOtAGzLgWsHGDesG9K8T9vQY218M4qAVDo,472
|
|
2
|
+
xloft/constants.py,sha256=13t-t6EA5PVwLwaaHkb09sAZZUxaI3--Klzkk04Zwlo,335
|
|
3
|
+
xloft/errors.py,sha256=hZcmF0QVVdvE5oM1jsXymRk_pPGgDSnUDM9wx9zJAYQ,895
|
|
4
|
+
xloft/human.py,sha256=WQbVOKpOvzGot-c7f3xitbS05JUIQmj3dreGtRV6GA0,1792
|
|
5
|
+
xloft/it_is.py,sha256=ZPdnQjOPCXw5_QXrpJWV56OT9AEA__762srO-5qSBOU,431
|
|
6
|
+
xloft/namedtuple.py,sha256=EygsHfND0P7pw9r7Amzqi0gXsMkhpAdQVEYKDAu3rr0,5725
|
|
7
|
+
xloft/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
xloft-0.6.0.dist-info/METADATA,sha256=i-ZfVMUJYzIvTDjJF6rdbCWsDodXbpkW1mwUrPps1iQ,7502
|
|
9
|
+
xloft-0.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
10
|
+
xloft-0.6.0.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
|
|
11
|
+
xloft-0.6.0.dist-info/RECORD,,
|
xloft-0.5.2.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
xloft/__init__.py,sha256=mf6z2-Tnl-CdYMa8mrI5MlTl48G0GQoYNNj2PMp8SsQ,419
|
|
2
|
-
xloft/errors.py,sha256=hZcmF0QVVdvE5oM1jsXymRk_pPGgDSnUDM9wx9zJAYQ,895
|
|
3
|
-
xloft/human.py,sha256=WQbVOKpOvzGot-c7f3xitbS05JUIQmj3dreGtRV6GA0,1792
|
|
4
|
-
xloft/namedtuple.py,sha256=EygsHfND0P7pw9r7Amzqi0gXsMkhpAdQVEYKDAu3rr0,5725
|
|
5
|
-
xloft/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
xloft-0.5.2.dist-info/METADATA,sha256=D5Pyg8nY1XPXiMBYMBjIWPtlZB3T-6IRKDGmeC-9PL8,7079
|
|
7
|
-
xloft-0.5.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8
|
-
xloft-0.5.2.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
|
|
9
|
-
xloft-0.5.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|