xloft 0.6.2__py3-none-any.whl → 0.6.4__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 +4 -4
- xloft/converter/__init__.py +22 -0
- xloft/{human.py → converter/human_size.py} +8 -5
- {xloft-0.6.2.dist-info → xloft-0.6.4.dist-info}/METADATA +3 -3
- xloft-0.6.4.dist-info/RECORD +11 -0
- xloft-0.6.2.dist-info/RECORD +0 -10
- /xloft/{it_is.py → itis.py} +0 -0
- {xloft-0.6.2.dist-info → xloft-0.6.4.dist-info}/WHEEL +0 -0
- {xloft-0.6.2.dist-info → xloft-0.6.4.dist-info}/licenses/LICENSE +0 -0
xloft/__init__.py
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Modules exported by this package:
|
|
4
4
|
|
|
5
5
|
- `namedtuple`- Class imitates the behavior of the _named tuple_.
|
|
6
|
-
- `
|
|
7
|
-
- `
|
|
6
|
+
- `converter` - A collection of instruments for converting data to format is convenient for humans.
|
|
7
|
+
- `itis` - Tools for determining something.
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
from __future__ import annotations
|
|
@@ -15,6 +15,6 @@ __all__ = (
|
|
|
15
15
|
"NamedTuple",
|
|
16
16
|
)
|
|
17
17
|
|
|
18
|
-
from xloft.
|
|
19
|
-
from xloft.
|
|
18
|
+
from xloft.converter.human_size import to_human_size
|
|
19
|
+
from xloft.itis import is_number
|
|
20
20
|
from xloft.namedtuple import NamedTuple
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""A collection of instruments for converting data.
|
|
2
|
+
|
|
3
|
+
The module contains the following functions:
|
|
4
|
+
|
|
5
|
+
- `to_human_size(n_bytes)` - Returns a humanized string: 200 bytes | 1 KB | 1.5 MB etc.
|
|
6
|
+
- `get_cache_human_size` - Gets a copy of variable _cache_human_size.
|
|
7
|
+
- `clean_cache_human_size` - Resets of variable _cache_human_size.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
__all__ = (
|
|
13
|
+
"to_human_size",
|
|
14
|
+
"get_cache_human_size",
|
|
15
|
+
"clean_cache_human_size",
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
from xloft.converter.human_size import (
|
|
19
|
+
clean_cache_human_size,
|
|
20
|
+
get_cache_human_size,
|
|
21
|
+
to_human_size,
|
|
22
|
+
)
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Converts the number of bytes into a human-readable format.
|
|
2
2
|
|
|
3
3
|
The module contains the following functions:
|
|
4
4
|
|
|
5
|
-
- `to_human_size(
|
|
5
|
+
- `to_human_size(n_bytes)` - Returns a humanized string: 200 bytes | 1 KB | 1.5 MB etc.
|
|
6
|
+
- `get_cache_human_size` - Gets a copy of variable _cache_human_size.
|
|
7
|
+
- `clean_cache_human_size` - Resets of variable _cache_human_size.
|
|
6
8
|
"""
|
|
7
9
|
|
|
8
10
|
from __future__ import annotations
|
|
@@ -10,6 +12,7 @@ from __future__ import annotations
|
|
|
10
12
|
__all__ = (
|
|
11
13
|
"to_human_size",
|
|
12
14
|
"get_cache_human_size",
|
|
15
|
+
"clean_cache_human_size",
|
|
13
16
|
)
|
|
14
17
|
|
|
15
18
|
import math
|
|
@@ -19,7 +22,7 @@ _cache_human_size: dict[int, str] = {}
|
|
|
19
22
|
|
|
20
23
|
|
|
21
24
|
def get_cache_human_size() -> dict[int, str]:
|
|
22
|
-
"""
|
|
25
|
+
"""Gets a copy of variable _cach_human_size.
|
|
23
26
|
|
|
24
27
|
Hint: To tests.
|
|
25
28
|
"""
|
|
@@ -27,13 +30,13 @@ def get_cache_human_size() -> dict[int, str]:
|
|
|
27
30
|
|
|
28
31
|
|
|
29
32
|
def clean_cache_human_size() -> None:
|
|
30
|
-
"""
|
|
33
|
+
"""Resets of variable _cach_human_size."""
|
|
31
34
|
global _cache_human_size # noqa: PLW0603
|
|
32
35
|
_cache_human_size = {}
|
|
33
36
|
|
|
34
37
|
|
|
35
38
|
def to_human_size(n_bytes: int) -> str:
|
|
36
|
-
"""
|
|
39
|
+
"""Converts the number of bytes into a human-readable format.
|
|
37
40
|
|
|
38
41
|
Examples:
|
|
39
42
|
>>> from xloft import to_human_size
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xloft
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.4
|
|
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`, `
|
|
64
|
+
The collection is represented by three modules of `NamedTuple`, `Converter`, `ItIs`.
|
|
65
65
|
<br>
|
|
66
66
|
In the future, new tools can be added.
|
|
67
67
|
</p>
|
|
@@ -165,7 +165,7 @@ del nt.y # => raise: AttributeCannotBeDelete
|
|
|
165
165
|
del nt._id # => raise: AttributeCannotBeDelete
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
-
- **
|
|
168
|
+
- **Converter**
|
|
169
169
|
|
|
170
170
|
```python
|
|
171
171
|
from xloft import to_human_size
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
xloft/__init__.py,sha256=edoLxSQjmYOqkA_m7IKUavUPnZdTBz8J0YvgqAzFqqI,535
|
|
2
|
+
xloft/errors.py,sha256=hZcmF0QVVdvE5oM1jsXymRk_pPGgDSnUDM9wx9zJAYQ,895
|
|
3
|
+
xloft/itis.py,sha256=Uac1du1Z_rUf3e8uThLWcSYU0F27zThBDW6UMUEHz88,480
|
|
4
|
+
xloft/namedtuple.py,sha256=egEULlfATXM8gMhAMjQSHocwTudqqzXDGTYGZVSUGZs,5725
|
|
5
|
+
xloft/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
xloft/converter/__init__.py,sha256=iTZaq2zKj7NEFpKQ-v-xJAxcT0MdzEODTJkjzUgUrQo,597
|
|
7
|
+
xloft/converter/human_size.py,sha256=vslG12Fln86zuCfXmDlmeijA2mCoLW3R2299PJ0wbxE,1957
|
|
8
|
+
xloft-0.6.4.dist-info/METADATA,sha256=eOmsrmGoPSmjGmPK5KUX7KHt3qcLrUap02v2Gbn_fUw,7509
|
|
9
|
+
xloft-0.6.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
10
|
+
xloft-0.6.4.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
|
|
11
|
+
xloft-0.6.4.dist-info/RECORD,,
|
xloft-0.6.2.dist-info/RECORD
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
xloft/__init__.py,sha256=owfU9Z6DZAKLdm-6mCV3alaUKdXTcPErg-sexMGvcFc,518
|
|
2
|
-
xloft/errors.py,sha256=hZcmF0QVVdvE5oM1jsXymRk_pPGgDSnUDM9wx9zJAYQ,895
|
|
3
|
-
xloft/human.py,sha256=WQbVOKpOvzGot-c7f3xitbS05JUIQmj3dreGtRV6GA0,1792
|
|
4
|
-
xloft/it_is.py,sha256=Uac1du1Z_rUf3e8uThLWcSYU0F27zThBDW6UMUEHz88,480
|
|
5
|
-
xloft/namedtuple.py,sha256=egEULlfATXM8gMhAMjQSHocwTudqqzXDGTYGZVSUGZs,5725
|
|
6
|
-
xloft/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
xloft-0.6.2.dist-info/METADATA,sha256=-sYtMS0tbSWPLTHN5i4cC8O2aD0rUbP_lQYSYBLOz3A,7501
|
|
8
|
-
xloft-0.6.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
9
|
-
xloft-0.6.2.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
|
|
10
|
-
xloft-0.6.2.dist-info/RECORD,,
|
/xloft/{it_is.py → itis.py}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|