absfuyu 4.1.1__py3-none-any.whl → 5.0.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 absfuyu might be problematic. Click here for more details.
- absfuyu/__init__.py +4 -4
- absfuyu/__main__.py +13 -1
- absfuyu/cli/__init__.py +4 -2
- absfuyu/cli/color.py +7 -0
- absfuyu/cli/do_group.py +9 -91
- absfuyu/cli/tool_group.py +136 -0
- absfuyu/config/__init__.py +17 -34
- absfuyu/core/__init__.py +49 -0
- absfuyu/core/baseclass.py +299 -0
- absfuyu/core/baseclass2.py +165 -0
- absfuyu/core/decorator.py +67 -0
- absfuyu/core/docstring.py +163 -0
- absfuyu/core/dummy_cli.py +67 -0
- absfuyu/core/dummy_func.py +47 -0
- absfuyu/dxt/__init__.py +42 -0
- absfuyu/dxt/dictext.py +201 -0
- absfuyu/dxt/dxt_support.py +79 -0
- absfuyu/dxt/intext.py +586 -0
- absfuyu/dxt/listext.py +508 -0
- absfuyu/dxt/strext.py +530 -0
- absfuyu/{extensions → extra}/__init__.py +3 -2
- absfuyu/extra/beautiful.py +251 -0
- absfuyu/{extensions/extra → extra}/data_analysis.py +51 -82
- absfuyu/fun/__init__.py +110 -135
- absfuyu/fun/tarot.py +9 -17
- absfuyu/game/__init__.py +6 -0
- absfuyu/game/game_stat.py +6 -0
- absfuyu/game/sudoku.py +7 -1
- absfuyu/game/tictactoe.py +12 -5
- absfuyu/game/wordle.py +14 -8
- absfuyu/general/__init__.py +6 -79
- absfuyu/general/content.py +22 -36
- absfuyu/general/generator.py +17 -42
- absfuyu/general/human.py +108 -228
- absfuyu/general/shape.py +1334 -0
- absfuyu/logger.py +8 -13
- absfuyu/pkg_data/__init__.py +137 -99
- absfuyu/pkg_data/deprecated.py +133 -0
- absfuyu/pkg_data/passwordlib_lzma.pkl +0 -0
- absfuyu/sort.py +6 -130
- absfuyu/tools/__init__.py +2 -2
- absfuyu/tools/checksum.py +44 -22
- absfuyu/tools/converter.py +82 -50
- absfuyu/tools/keygen.py +25 -30
- absfuyu/tools/obfuscator.py +246 -112
- absfuyu/tools/passwordlib.py +330 -0
- absfuyu/tools/shutdownizer.py +287 -0
- absfuyu/tools/web.py +2 -9
- absfuyu/util/__init__.py +15 -15
- absfuyu/util/api.py +10 -15
- absfuyu/util/json_method.py +7 -24
- absfuyu/util/lunar.py +3 -9
- absfuyu/util/path.py +22 -27
- absfuyu/util/performance.py +43 -67
- absfuyu/util/shorten_number.py +65 -14
- absfuyu/util/zipped.py +9 -15
- absfuyu-5.0.0.dist-info/METADATA +143 -0
- absfuyu-5.0.0.dist-info/RECORD +68 -0
- absfuyu/core.py +0 -57
- absfuyu/everything.py +0 -32
- absfuyu/extensions/beautiful.py +0 -188
- absfuyu/extensions/dev/__init__.py +0 -244
- absfuyu/extensions/dev/password_hash.py +0 -80
- absfuyu/extensions/dev/passwordlib.py +0 -258
- absfuyu/extensions/dev/project_starter.py +0 -60
- absfuyu/extensions/dev/shutdownizer.py +0 -156
- absfuyu/extensions/extra/__init__.py +0 -24
- absfuyu/fun/WGS.py +0 -134
- absfuyu/general/data_extension.py +0 -1796
- absfuyu/tools/stats.py +0 -226
- absfuyu/util/pkl.py +0 -67
- absfuyu-4.1.1.dist-info/METADATA +0 -121
- absfuyu-4.1.1.dist-info/RECORD +0 -61
- {absfuyu-4.1.1.dist-info → absfuyu-5.0.0.dist-info}/WHEEL +0 -0
- {absfuyu-4.1.1.dist-info → absfuyu-5.0.0.dist-info}/entry_points.txt +0 -0
- {absfuyu-4.1.1.dist-info → absfuyu-5.0.0.dist-info}/licenses/LICENSE +0 -0
absfuyu/util/shorten_number.py
CHANGED
|
@@ -1,31 +1,47 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Absfuyu: Shorten number
|
|
3
|
-
|
|
3
|
+
-----------------------
|
|
4
4
|
Short number base on suffixes
|
|
5
5
|
|
|
6
|
-
Version:
|
|
7
|
-
|
|
6
|
+
Version: 5.0.0
|
|
7
|
+
Date updated: 18/02/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
# Module level
|
|
11
|
-
|
|
12
|
-
__all__ = [
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
12
|
+
__all__ = [
|
|
13
|
+
"UnitSuffixFactory",
|
|
14
|
+
"CommonUnitSuffixesFactory",
|
|
15
|
+
"Decimal",
|
|
16
|
+
"shorten_number",
|
|
17
|
+
]
|
|
13
18
|
|
|
14
19
|
|
|
15
20
|
# Library
|
|
16
|
-
|
|
21
|
+
# ---------------------------------------------------------------------------
|
|
22
|
+
from collections.abc import Callable
|
|
17
23
|
from dataclasses import dataclass, field
|
|
18
|
-
from
|
|
24
|
+
from functools import wraps
|
|
25
|
+
from typing import Annotated, NamedTuple, ParamSpec, Self, TypeVar
|
|
26
|
+
|
|
27
|
+
from absfuyu.core import versionadded
|
|
28
|
+
|
|
29
|
+
# Type
|
|
30
|
+
# ---------------------------------------------------------------------------
|
|
31
|
+
P = ParamSpec("P") # Parameter type
|
|
32
|
+
N = TypeVar("N", int, float) # Number type
|
|
19
33
|
|
|
20
34
|
|
|
21
35
|
# Class
|
|
22
|
-
|
|
36
|
+
# ---------------------------------------------------------------------------
|
|
37
|
+
@versionadded("4.1.0")
|
|
23
38
|
class UnitSuffixFactory(NamedTuple):
|
|
24
39
|
base: int
|
|
25
40
|
short_name: list[str]
|
|
26
41
|
full_name: list[str]
|
|
27
42
|
|
|
28
43
|
|
|
44
|
+
@versionadded("4.1.0")
|
|
29
45
|
class CommonUnitSuffixesFactory:
|
|
30
46
|
NUMBER = UnitSuffixFactory(
|
|
31
47
|
1000,
|
|
@@ -135,6 +151,7 @@ class CommonUnitSuffixesFactory:
|
|
|
135
151
|
|
|
136
152
|
|
|
137
153
|
@dataclass
|
|
154
|
+
@versionadded("4.1.0")
|
|
138
155
|
class Decimal:
|
|
139
156
|
"""
|
|
140
157
|
Shorten large number
|
|
@@ -160,7 +177,7 @@ class Decimal:
|
|
|
160
177
|
self.value, self.suffix = self._convert_decimal()
|
|
161
178
|
|
|
162
179
|
def __str__(self) -> str:
|
|
163
|
-
return self.to_text()
|
|
180
|
+
return self.to_text().strip()
|
|
164
181
|
|
|
165
182
|
@classmethod
|
|
166
183
|
def number(cls, value: int | float, suffix_full_name: bool = False) -> Self:
|
|
@@ -186,7 +203,7 @@ class Decimal:
|
|
|
186
203
|
return f"{value:.2e}"
|
|
187
204
|
|
|
188
205
|
def _get_factory(self) -> None:
|
|
189
|
-
if self.factory:
|
|
206
|
+
if self.factory is not None:
|
|
190
207
|
self.base = self.factory.base
|
|
191
208
|
self.suffixes = (
|
|
192
209
|
self.factory.full_name
|
|
@@ -222,7 +239,41 @@ class Decimal:
|
|
|
222
239
|
return f"{formatted_value}{separator}{self.suffix}"
|
|
223
240
|
|
|
224
241
|
|
|
225
|
-
#
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
242
|
+
# Decorator
|
|
243
|
+
# ---------------------------------------------------------------------------
|
|
244
|
+
@versionadded("5.0.0")
|
|
245
|
+
def shorten_number(f: Callable[P, N]) -> Callable[P, Decimal]:
|
|
246
|
+
"""
|
|
247
|
+
Shorten the number value by name
|
|
248
|
+
|
|
249
|
+
Parameters
|
|
250
|
+
----------
|
|
251
|
+
f : Callable[P, N]
|
|
252
|
+
Function that return ``int`` or ``float``
|
|
253
|
+
|
|
254
|
+
Returns
|
|
255
|
+
-------
|
|
256
|
+
Callable[P, Decimal]
|
|
257
|
+
Function that return ``Decimal``
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
Usage
|
|
261
|
+
-----
|
|
262
|
+
Use this as a decorator (``@shorten_number``)
|
|
263
|
+
|
|
264
|
+
Example:
|
|
265
|
+
--------
|
|
266
|
+
>>> import random
|
|
267
|
+
>>> @shorten_number
|
|
268
|
+
>>> def big_num() -> int:
|
|
269
|
+
... random.randint(100000000, 10000000000)
|
|
270
|
+
>>> big_num()
|
|
271
|
+
4.20 B
|
|
272
|
+
"""
|
|
273
|
+
|
|
274
|
+
@wraps(f)
|
|
275
|
+
def wrapper(*args: P.args, **kwargs: P.kwargs) -> Decimal:
|
|
276
|
+
value = Decimal.number(f(*args, **kwargs))
|
|
277
|
+
return value
|
|
278
|
+
|
|
279
|
+
return wrapper
|
absfuyu/util/zipped.py
CHANGED
|
@@ -8,21 +8,24 @@ Date updated: 07/01/2025 (dd/mm/yyyy)
|
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
# Module level
|
|
11
|
-
|
|
12
|
-
__all__ = [
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
12
|
+
__all__ = [
|
|
13
|
+
"Zipper",
|
|
14
|
+
]
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
# Library
|
|
16
|
-
|
|
18
|
+
# ---------------------------------------------------------------------------
|
|
17
19
|
import shutil
|
|
18
20
|
import zipfile
|
|
19
21
|
from pathlib import Path
|
|
20
22
|
|
|
23
|
+
from absfuyu.core import BaseClass, versionadded
|
|
21
24
|
from absfuyu.logger import logger
|
|
22
25
|
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
class Zipper:
|
|
27
|
+
# ---------------------------------------------------------------------------
|
|
28
|
+
class Zipper(BaseClass):
|
|
26
29
|
"""Zip file or folder"""
|
|
27
30
|
|
|
28
31
|
def __init__(self, path_to_zip: str | Path, name: str | None = None) -> None:
|
|
@@ -40,9 +43,6 @@ class Zipper:
|
|
|
40
43
|
def __str__(self) -> str:
|
|
41
44
|
return f"{self.__class__.__name__}({self.name})"
|
|
42
45
|
|
|
43
|
-
def __repr__(self) -> str:
|
|
44
|
-
return self.__str__()
|
|
45
|
-
|
|
46
46
|
def zip_stuff(self, delete_after_zip: bool = False) -> None:
|
|
47
47
|
"""
|
|
48
48
|
Zip file/folder
|
|
@@ -74,7 +74,7 @@ class Zipper:
|
|
|
74
74
|
except OSError as e:
|
|
75
75
|
logger.error(f"Error: {e.filename} - {e.strerror}.")
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
@versionadded("4.0.0")
|
|
78
78
|
def unzip(self):
|
|
79
79
|
"""
|
|
80
80
|
Unzip every archive files in directory
|
|
@@ -88,9 +88,3 @@ class Zipper:
|
|
|
88
88
|
shutil.unpack_archive(temp, temp.parent.joinpath(temp.stem))
|
|
89
89
|
else:
|
|
90
90
|
shutil.unpack_archive(x, x.parent.joinpath(x.stem))
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
# Run
|
|
94
|
-
###########################################################################
|
|
95
|
-
if __name__ == "__main__":
|
|
96
|
-
logger.setLevel(10)
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: absfuyu
|
|
3
|
+
Version: 5.0.0
|
|
4
|
+
Summary: A small collection of code
|
|
5
|
+
Project-URL: Homepage, https://github.com/AbsoluteWinter/absfuyu-public
|
|
6
|
+
Project-URL: Documentation, https://absolutewinter.github.io/absfuyu-docs/
|
|
7
|
+
Project-URL: Repository, https://github.com/AbsoluteWinter/absfuyu-public
|
|
8
|
+
Project-URL: Issues, https://github.com/AbsoluteWinter/absfuyu-public/issues
|
|
9
|
+
Author: somewhatcold (AbsoluteWinter)
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: utilities
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Natural Language :: English
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
+
Classifier: Topic :: Utilities
|
|
27
|
+
Requires-Python: <4,>=3.11
|
|
28
|
+
Requires-Dist: bs4
|
|
29
|
+
Requires-Dist: click>=8.0.0
|
|
30
|
+
Requires-Dist: colorama
|
|
31
|
+
Requires-Dist: requests
|
|
32
|
+
Provides-Extra: beautiful
|
|
33
|
+
Requires-Dist: rich; extra == 'beautiful'
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: hatch; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
37
|
+
Provides-Extra: docs
|
|
38
|
+
Requires-Dist: numpy; extra == 'docs'
|
|
39
|
+
Requires-Dist: pandas; extra == 'docs'
|
|
40
|
+
Requires-Dist: rich; extra == 'docs'
|
|
41
|
+
Provides-Extra: extra
|
|
42
|
+
Requires-Dist: numpy; extra == 'extra'
|
|
43
|
+
Requires-Dist: pandas; extra == 'extra'
|
|
44
|
+
Provides-Extra: full
|
|
45
|
+
Requires-Dist: numpy; extra == 'full'
|
|
46
|
+
Requires-Dist: pandas; extra == 'full'
|
|
47
|
+
Requires-Dist: rich; extra == 'full'
|
|
48
|
+
Requires-Dist: tqdm; extra == 'full'
|
|
49
|
+
Requires-Dist: unidecode; extra == 'full'
|
|
50
|
+
Description-Content-Type: text/markdown
|
|
51
|
+
|
|
52
|
+
<div align="center">
|
|
53
|
+
<h1 align="center">
|
|
54
|
+
<img src="https://github.com/AbsoluteWinter/AbsoluteWinter.github.io/blob/main/absfuyu/images/repository-image-crop.png?raw=true" alt="absfuyu"/>
|
|
55
|
+
</h1>
|
|
56
|
+
<p align="center">
|
|
57
|
+
<a href="https://pypi.org/project/absfuyu/"><img src="https://img.shields.io/pypi/pyversions/absfuyu?style=flat-square&logo=python" alt="PyPI Supported Versions"/></a>
|
|
58
|
+
<a href="https://pypi.org/project/absfuyu/"><img src="https://img.shields.io/pypi/dm/absfuyu?style=flat-square&color=blue" alt="PyPI Downloads"/></a>
|
|
59
|
+
<a href="https://pypi.org/project/absfuyu/"><img src="https://img.shields.io/pypi/v/absfuyu?style=flat-square&logo=pypi" /></a>
|
|
60
|
+
<a><img src="https://img.shields.io/pypi/l/absfuyu?style=flat-square&logo=github&color=blue"/></a>
|
|
61
|
+
<a><img src="https://img.shields.io/badge/code%20style-black-black?style=flat-square"/></a>
|
|
62
|
+
<a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=flat-square" alt="Ruff" style="max-width:100%;"></a>
|
|
63
|
+
</p>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## **SUMMARY:**
|
|
69
|
+
|
|
70
|
+
This project is a collection of code primarily developed as a personal hobby. It aims to provide practical experience and enhance my coding skills while exploring potential future applications.
|
|
71
|
+
|
|
72
|
+
## **INSTALLATION:**
|
|
73
|
+
|
|
74
|
+
To install the package, run the following command:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install -U absfuyu
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## **USAGE:**
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
import absfuyu
|
|
84
|
+
help(absfuyu)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Notable features
|
|
88
|
+
|
|
89
|
+
**absfuyu.core**: Provides foundational components for additional functionalities.
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
# Decorators that adds info to __doc__
|
|
93
|
+
from absfuyu.core.docstring import versionadded, versionchanged, deprecated
|
|
94
|
+
|
|
95
|
+
# Class mixins for enhanced functionality
|
|
96
|
+
from absfuyu.core.baseclass import AutoREPRMixin, ShowAllMethodsMixin
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**absfuyu.dxt**: Extension for `list`, `str`, `dict`, `int`.
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from absfuyu.dxt import DictExt, IntExt, ListExt, Text
|
|
103
|
+
for x in [DictExt, IntExt, ListExt, Text]:
|
|
104
|
+
x.show_all_methods(print_result=1)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
There are many additional features available to explore.
|
|
108
|
+
|
|
109
|
+
## **DOCUMENTATION:**
|
|
110
|
+
|
|
111
|
+
For more detailed information about the project, please refer to the documentation available at the following link:
|
|
112
|
+
|
|
113
|
+
> [Project Documentation](https://absolutewinter.github.io/absfuyu/)
|
|
114
|
+
|
|
115
|
+
## **DEVELOPMENT SETUP**
|
|
116
|
+
|
|
117
|
+
1. Create a Virtual Environment
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
python -m venv env
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Note: You may need to execute this command in PowerShell on Windows:
|
|
124
|
+
|
|
125
|
+
```powershell
|
|
126
|
+
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
2. Install Required Packages
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
python -m pip install -e .[full,dev]
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
3. Acquire Information About the Development Environment Configuration
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
hatch env show
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## **LICENSE:**
|
|
142
|
+
|
|
143
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
absfuyu/__init__.py,sha256=0fFKIm3iQEyqB0IdZIIqBe5bF7CCRl7ZD4mxwa_GxF0,600
|
|
2
|
+
absfuyu/__main__.py,sha256=vUKjwcjMvynbeygRLuXWMKR2vR7CndZ496xx2Qzb6xk,603
|
|
3
|
+
absfuyu/logger.py,sha256=VP9-sXtGVyDkHUyRSaGUfCrl_wn8wOnmtCLcUNec-yg,13043
|
|
4
|
+
absfuyu/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
absfuyu/sort.py,sha256=WjH0asrvl02TMlAhG77X-wGcGHIIQd-jWU_Xv9Xv-qc,3250
|
|
6
|
+
absfuyu/version.py,sha256=KMaeXNl93L4VU2RnTySoFv23IDyTvHfy84nyatFcKaE,14128
|
|
7
|
+
absfuyu/cli/__init__.py,sha256=mYX6lVAat9UOI9qR-ZDFw_4WOLVA9r-jTtW8d2fBEKM,1181
|
|
8
|
+
absfuyu/cli/color.py,sha256=Cvpqwc5mb4-71OplswgfxmJ8D9jf9gkjM7l3qV902X0,774
|
|
9
|
+
absfuyu/cli/config_group.py,sha256=FsyYm2apSyAA2PAD12CpHAizenRds_QlLf8j0AlLuVo,1230
|
|
10
|
+
absfuyu/cli/do_group.py,sha256=QBOL3Z6E70-_kPOivaH160lmFyOL2Zl70Qjda_fV0Fc,2131
|
|
11
|
+
absfuyu/cli/game_group.py,sha256=ySpL2hm4VCplhNY0s22kBGI5eFCdJj9fm1T58yftU74,2348
|
|
12
|
+
absfuyu/cli/tool_group.py,sha256=ZruYcBLCjP2G0CgyE19WsRJ2kn2H1fKEZ0pa0KF6tyI,3164
|
|
13
|
+
absfuyu/config/__init__.py,sha256=yWN-TguDXcWJg5EiCGRnKLsTZQfIYvKVHhzASNp2S0s,8238
|
|
14
|
+
absfuyu/config/config.json,sha256=-ZQnmDuLq0aAFfsrQbSNR3tq5k9Eu9IVUQgYD9htIQM,646
|
|
15
|
+
absfuyu/core/__init__.py,sha256=oZpRrxIU66dN4UYO61TM72oE0Ijs_3wajdYCg12SJlw,1186
|
|
16
|
+
absfuyu/core/baseclass.py,sha256=t5oyfwBw5Mm5wLp2o_JnTNx0v9njEb_OeRlzOTbc5KM,10204
|
|
17
|
+
absfuyu/core/baseclass2.py,sha256=5meEqRk0pPoDlhA0_qti_-p-fHvxT6XqwitHLpFVl_Q,5366
|
|
18
|
+
absfuyu/core/decorator.py,sha256=MpmgAb1gsXgRDEyMJLvSxUWEG0WC4aTFYJAEwjdauAI,1901
|
|
19
|
+
absfuyu/core/docstring.py,sha256=2TmPXXtJKszfBPPHXDMPjrTCpVFwxmS8J5XhWb4myNc,5228
|
|
20
|
+
absfuyu/core/dummy_cli.py,sha256=_-Gsmg2beO7fTSP-3nSGwqVmiVKpzTICIuHfGetQbw8,1884
|
|
21
|
+
absfuyu/core/dummy_func.py,sha256=AS7kgMWeXZoYF94gocyydAfkyOM7W2v1F9wNQ40ta-Q,1097
|
|
22
|
+
absfuyu/dxt/__init__.py,sha256=IHTjk-GdeKp5s9mhH87WUrHVb9gY34WUzrjQEw0q9II,986
|
|
23
|
+
absfuyu/dxt/dictext.py,sha256=_q45v98x2sB38QBROg-Fbd6Aw63HO5hPIEJENI39d-E,5998
|
|
24
|
+
absfuyu/dxt/dxt_support.py,sha256=dWMbFYiRUhX9QHxChYo_YzwCywylUi1R5h28y13Wn4I,2109
|
|
25
|
+
absfuyu/dxt/intext.py,sha256=wMmjt24c-0Kk3gJx1ln0ULNdrxmgeDh3zUOUTD6cQBo,16716
|
|
26
|
+
absfuyu/dxt/listext.py,sha256=lqWVQ1uBZ3zm0d1S0oVz0qjTagbucZjQ3htcFzc24tg,13964
|
|
27
|
+
absfuyu/dxt/strext.py,sha256=UDS818z4Rv92gCgdlfz_ibr3vsip6Sgxp-yfI8JyPho,14628
|
|
28
|
+
absfuyu/extra/__init__.py,sha256=lyJwiRHvCL3qNYKK9mbjNrzIHGDPERyfwl8_V6g4PEE,182
|
|
29
|
+
absfuyu/extra/beautiful.py,sha256=llxgAYco5-bg6VC1kMwA7VyCSJgu4LdCHBG0pM1PWs8,8072
|
|
30
|
+
absfuyu/extra/data_analysis.py,sha256=0zfjWm3t1nyp0n0rsPKzWmcR0ZvF7BpQsjn9niGqhps,32005
|
|
31
|
+
absfuyu/fun/__init__.py,sha256=tDSDIDHrJPQ_hWV7ASpbAUCIQ6B1t1IPq4ahrZQqfWk,5435
|
|
32
|
+
absfuyu/fun/tarot.py,sha256=E9NKwhebU4EGOcbQkt4Ni7o6ZIYq8-h7_Fz3jk0Arpw,2401
|
|
33
|
+
absfuyu/game/__init__.py,sha256=tkNxTbdkPtAhGEdqXFQARHYApEhcD68CeDF_oHMzVeA,4691
|
|
34
|
+
absfuyu/game/game_stat.py,sha256=mOs6UOvNUmr-vNOomNJK0lY9o9m9Rs0b9GEMGeXaAdE,1236
|
|
35
|
+
absfuyu/game/sudoku.py,sha256=ascN8ey7SimldXT8ae3AWv4bxlfwT4X14JdmxY2o808,10405
|
|
36
|
+
absfuyu/game/tictactoe.py,sha256=_JLeIhxHEIDLRJay7i1kagxx8kCDhZNgTrXt7Rl0ntc,9960
|
|
37
|
+
absfuyu/game/wordle.py,sha256=izvV_lOZwPnslDdQ73PnwD5t5ECKVWGhpZvHAZH-2EY,101576
|
|
38
|
+
absfuyu/general/__init__.py,sha256=EITlDmPAp6lcAWR9Bq707j4FZ9jAD9PblftOK1XvGDA,480
|
|
39
|
+
absfuyu/general/content.py,sha256=wGzYufji8PmHy6ygGFclf_u6DZudnYaeHtR9d2of_1E,17122
|
|
40
|
+
absfuyu/general/generator.py,sha256=C54TJ3DZ5TXFYRI7_jLdtjTMcWxACX4Jmlo27Zh90Ew,8996
|
|
41
|
+
absfuyu/general/human.py,sha256=o1TswjgN8zRfCmkEgchS1HVq036twBB64u1Dt4KLI1I,8099
|
|
42
|
+
absfuyu/general/shape.py,sha256=dAYSihPnanax4jMPSvZMIzMbo9puvxIqdQxuSlDLl4I,38619
|
|
43
|
+
absfuyu/pkg_data/__init__.py,sha256=Jn8fHDsPCd8w4YoOo3EpoExxda5BRAjHQJRdYwwTYeA,5510
|
|
44
|
+
absfuyu/pkg_data/chemistry.pkl,sha256=kYWNa_PVffoDnzT8b9Jvimmf_GZshPe1D-SnEKERsLo,4655
|
|
45
|
+
absfuyu/pkg_data/deprecated.py,sha256=L1ju3m_P8DbqQ1l18XgneVixorWiLJ5HeKh_K3wovXM,4349
|
|
46
|
+
absfuyu/pkg_data/passwordlib_lzma.pkl,sha256=rT5lJT8t42BATU5Cp2qFwbnZkbx-QlUgodSvR0wFY6I,891877
|
|
47
|
+
absfuyu/pkg_data/tarot.pkl,sha256=ssXTCC_BQgslO5F-3a9HivbxFQ6BioIe2E1frPVi2m0,56195
|
|
48
|
+
absfuyu/tools/__init__.py,sha256=g6-2banBKxGfAbsVTd-OZhLujixXApsQmx2RlAB_aGE,118
|
|
49
|
+
absfuyu/tools/checksum.py,sha256=1WLC9GGmjehxhhV-BgdxJbA45QhN850u_znOgwoYDP0,5156
|
|
50
|
+
absfuyu/tools/converter.py,sha256=tdDQpdzbB9RdcZIlcV6LzldDkVEiwCFzRoWCfJVCpn4,11615
|
|
51
|
+
absfuyu/tools/keygen.py,sha256=JxhUiiaUHaGqVicXY46JjVrH3ke2QlnsRJqgIvlxUsg,7115
|
|
52
|
+
absfuyu/tools/obfuscator.py,sha256=vy_nIyQeDci6vHFbHL907Ha6RUZm9axsSZw_nKyyYBc,12687
|
|
53
|
+
absfuyu/tools/passwordlib.py,sha256=jEmKW63fTyGOtBPPVi44fMtcNu1W7m2Qkox-GHxTxH4,9632
|
|
54
|
+
absfuyu/tools/shutdownizer.py,sha256=z5z5ofdAtOBat1m7lz95FwXZI0fMarl2mChBMwUMi4I,8549
|
|
55
|
+
absfuyu/tools/web.py,sha256=rVF-60IT8J_RVxMPzz5bhgBq3i1WmwbR5ouzQ_CZwhQ,1240
|
|
56
|
+
absfuyu/util/__init__.py,sha256=3Ylck5HBHAhFd_B_v6Bh3C1qyI1M0Kk9sK9nNIBLHqU,3831
|
|
57
|
+
absfuyu/util/api.py,sha256=xXwffnpq1qxBIag_MOriKe3ueaCdsaq-WFRIH-8yFqI,4288
|
|
58
|
+
absfuyu/util/json_method.py,sha256=a4xVabcw18HBLJthkmf5KNUcQya45-A8AFEpcGIDx3Q,2197
|
|
59
|
+
absfuyu/util/lunar.py,sha256=8dxXdGU7V_5L9fOeq36oKDzs_DcLnIiFwIpHa1O22yc,13630
|
|
60
|
+
absfuyu/util/path.py,sha256=0hRzobegpblgCIluy9wXFNCwlDoovz_ccVCwaVqvgo8,16434
|
|
61
|
+
absfuyu/util/performance.py,sha256=aN_0WGJfupqh8FdgsEU4llkDpUNAlojlWXtlRGMFmJE,8585
|
|
62
|
+
absfuyu/util/shorten_number.py,sha256=7-uH4zwy594pVnqqGe75IoS7vqEXx3DIA9nRl8hrQpw,7788
|
|
63
|
+
absfuyu/util/zipped.py,sha256=fXLVt4hnIgN2hwhvbwxzYQC1r--RX2Hgb429r767WDI,2979
|
|
64
|
+
absfuyu-5.0.0.dist-info/METADATA,sha256=J29q7jABMmx_LkCQVw9aL9BYsGk3QdTBsA4W0WyeF2s,4839
|
|
65
|
+
absfuyu-5.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
66
|
+
absfuyu-5.0.0.dist-info/entry_points.txt,sha256=bW5CgJRTTWJ2Pywojo07sf-YucRPcnHzMmETh5avbX0,79
|
|
67
|
+
absfuyu-5.0.0.dist-info/licenses/LICENSE,sha256=pFCHBSNSzdXwYG1AHpq7VcofI1NMQ1Fc77RzZ4Ln2O4,1097
|
|
68
|
+
absfuyu-5.0.0.dist-info/RECORD,,
|
absfuyu/core.py
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Absfuyu: Core
|
|
3
|
-
-------------
|
|
4
|
-
Contain type hints and other stuffs
|
|
5
|
-
|
|
6
|
-
Version: 2.3.1
|
|
7
|
-
Date updated: 01/02/2025 (dd/mm/yyyy)
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
# Module Package
|
|
11
|
-
###########################################################################
|
|
12
|
-
__all__ = [
|
|
13
|
-
# color
|
|
14
|
-
"CLITextColor",
|
|
15
|
-
# path
|
|
16
|
-
"CORE_PATH",
|
|
17
|
-
"CONFIG_PATH",
|
|
18
|
-
"DATA_PATH",
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
__package_feature__ = ["beautiful", "extra", "res", "full", "dev"]
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
# Library
|
|
25
|
-
###########################################################################
|
|
26
|
-
from importlib import import_module
|
|
27
|
-
from importlib.resources import files
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class CLITextColor:
|
|
31
|
-
"""Color code for text in terminal"""
|
|
32
|
-
|
|
33
|
-
WHITE = "\x1b[37m"
|
|
34
|
-
BLACK = "\x1b[30m"
|
|
35
|
-
BLUE = "\x1b[34m"
|
|
36
|
-
GRAY = "\x1b[90m"
|
|
37
|
-
GREEN = "\x1b[32m"
|
|
38
|
-
RED = "\x1b[91m"
|
|
39
|
-
DARK_RED = "\x1b[31m"
|
|
40
|
-
MAGENTA = "\x1b[35m"
|
|
41
|
-
YELLOW = "\x1b[33m"
|
|
42
|
-
RESET = "\x1b[39m"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
# CORE_PATH = Path(__file__).parent.absolute()
|
|
46
|
-
CORE_PATH = files("absfuyu")
|
|
47
|
-
CONFIG_PATH = CORE_PATH.joinpath("config", "config.json")
|
|
48
|
-
DATA_PATH = CORE_PATH.joinpath("pkg_data")
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
# tqdm wrapper
|
|
52
|
-
try:
|
|
53
|
-
tqdm = import_module("tqdm").tqdm
|
|
54
|
-
except ModuleNotFoundError:
|
|
55
|
-
|
|
56
|
-
def tqdm(iterable, **kwargs):
|
|
57
|
-
return iterable
|
absfuyu/everything.py
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# flake8: noqa
|
|
2
|
-
"""
|
|
3
|
-
Absfuyu: Everything
|
|
4
|
-
-------------------
|
|
5
|
-
Everything has to offer in this package
|
|
6
|
-
|
|
7
|
-
Version: 2.0.1
|
|
8
|
-
Date updated: 26/11/2023 (mm/dd/yyyy)
|
|
9
|
-
|
|
10
|
-
Usage:
|
|
11
|
-
------
|
|
12
|
-
>>> from absfuyu import everything as ab
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
# Library
|
|
16
|
-
###########################################################################
|
|
17
|
-
from absfuyu.config import *
|
|
18
|
-
from absfuyu.core import *
|
|
19
|
-
from absfuyu.extensions import *
|
|
20
|
-
from absfuyu.fun import *
|
|
21
|
-
from absfuyu.game import *
|
|
22
|
-
from absfuyu.general import *
|
|
23
|
-
from absfuyu.logger import *
|
|
24
|
-
from absfuyu.pkg_data import *
|
|
25
|
-
from absfuyu.sort import *
|
|
26
|
-
from absfuyu.tools import *
|
|
27
|
-
from absfuyu.util import *
|
|
28
|
-
from absfuyu.version import *
|
|
29
|
-
|
|
30
|
-
# Is loaded
|
|
31
|
-
###########################################################################
|
|
32
|
-
__IS_EVERYTHING = True
|
absfuyu/extensions/beautiful.py
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
# type: ignore
|
|
2
|
-
"""
|
|
3
|
-
Absfuyu: Beautiful
|
|
4
|
-
------------------
|
|
5
|
-
A decorator that makes output more beautiful
|
|
6
|
-
|
|
7
|
-
Version: 1.0.2
|
|
8
|
-
Date updated: 24/11/2023 (dd/mm/yyyy)
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
# Module level
|
|
12
|
-
###########################################################################
|
|
13
|
-
__all__ = [
|
|
14
|
-
"beautiful_output",
|
|
15
|
-
"print",
|
|
16
|
-
"demo",
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
# Library
|
|
21
|
-
###########################################################################
|
|
22
|
-
from functools import wraps as __wraps
|
|
23
|
-
from time import perf_counter as __perf
|
|
24
|
-
from typing import Optional as __Optional
|
|
25
|
-
|
|
26
|
-
BEAUTIFUL_MODE = False
|
|
27
|
-
try:
|
|
28
|
-
# from rich import print
|
|
29
|
-
from rich.align import Align as __Align
|
|
30
|
-
from rich.console import Console as __Console
|
|
31
|
-
from rich.console import Group as __Group
|
|
32
|
-
from rich.panel import Panel as __Panel
|
|
33
|
-
from rich.table import Table as __Table
|
|
34
|
-
from rich.text import Text as __Text
|
|
35
|
-
except ImportError:
|
|
36
|
-
from absfuyu.config import ABSFUYU_CONFIG
|
|
37
|
-
|
|
38
|
-
if ABSFUYU_CONFIG._get_setting("auto-install-extra").value:
|
|
39
|
-
__cmd: str = "python -m pip install -U absfuyu[beautiful]".split()
|
|
40
|
-
from subprocess import run as __run
|
|
41
|
-
|
|
42
|
-
__run(__cmd)
|
|
43
|
-
else:
|
|
44
|
-
raise SystemExit("This feature is in absfuyu[beautiful] package") # noqa: B904
|
|
45
|
-
else:
|
|
46
|
-
BEAUTIFUL_MODE = True
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
# Function
|
|
50
|
-
###########################################################################
|
|
51
|
-
def beautiful_output(
|
|
52
|
-
layout_option: int = 2,
|
|
53
|
-
header_visible: __Optional[bool] = True,
|
|
54
|
-
footer_visible: __Optional[bool] = False,
|
|
55
|
-
):
|
|
56
|
-
"""
|
|
57
|
-
Beautify function output
|
|
58
|
-
|
|
59
|
-
Parameters
|
|
60
|
-
----------
|
|
61
|
-
header_visible : True | False | None
|
|
62
|
-
Show header
|
|
63
|
-
|
|
64
|
-
footer_visible : True | False | None
|
|
65
|
-
Show footer
|
|
66
|
-
"""
|
|
67
|
-
|
|
68
|
-
if not BEAUTIFUL_MODE:
|
|
69
|
-
raise SystemExit("This feature is in absfuyu[beautiful] package")
|
|
70
|
-
|
|
71
|
-
def decorator(func):
|
|
72
|
-
@__wraps(func)
|
|
73
|
-
def wrapper(*args, **kwargs):
|
|
74
|
-
# Measure performance
|
|
75
|
-
start_time = __perf()
|
|
76
|
-
f = func(*args, **kwargs)
|
|
77
|
-
finished_time = __perf()
|
|
78
|
-
elapsed = f"Time elapsed: {finished_time - start_time:,.6f} s"
|
|
79
|
-
|
|
80
|
-
# Make header
|
|
81
|
-
header_table = __Table.grid(expand=True)
|
|
82
|
-
header_table.add_row(
|
|
83
|
-
__Panel(
|
|
84
|
-
__Align(f"[b]Function: {func.__name__}", align="center"),
|
|
85
|
-
style="white on blue",
|
|
86
|
-
),
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
# Make footer
|
|
90
|
-
footer_table = __Table.grid(expand=True)
|
|
91
|
-
footer_table.add_row(
|
|
92
|
-
__Panel(
|
|
93
|
-
__Align("[b]END PROGRAM", align="center"),
|
|
94
|
-
style="white on blue",
|
|
95
|
-
),
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
# Make output table
|
|
99
|
-
out_table = __Table.grid(expand=True)
|
|
100
|
-
out_table.add_column(ratio=2) # result
|
|
101
|
-
out_table.add_column() # performance
|
|
102
|
-
r_txt = __Text(
|
|
103
|
-
str(f),
|
|
104
|
-
overflow="fold",
|
|
105
|
-
no_wrap=False,
|
|
106
|
-
tab_size=2,
|
|
107
|
-
)
|
|
108
|
-
result_panel = __Panel(
|
|
109
|
-
__Align(r_txt, align="center"),
|
|
110
|
-
title="[bold]Result[/]",
|
|
111
|
-
border_style="green",
|
|
112
|
-
highlight=True,
|
|
113
|
-
)
|
|
114
|
-
performance_panel = __Panel(
|
|
115
|
-
__Align(elapsed, align="center"),
|
|
116
|
-
title="[bold]Performance[/]",
|
|
117
|
-
border_style="red",
|
|
118
|
-
highlight=True,
|
|
119
|
-
height=result_panel.height,
|
|
120
|
-
)
|
|
121
|
-
out_table.add_row(
|
|
122
|
-
result_panel,
|
|
123
|
-
performance_panel,
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
# Make a blue line for no reason
|
|
127
|
-
line = __Table.grid(expand=True)
|
|
128
|
-
line.add_row(__Text(style="white on blue"))
|
|
129
|
-
|
|
130
|
-
# Make layout
|
|
131
|
-
header = {
|
|
132
|
-
True: header_table,
|
|
133
|
-
False: line,
|
|
134
|
-
None: __Text(),
|
|
135
|
-
} # header[header_visible]
|
|
136
|
-
footer = {
|
|
137
|
-
True: footer_table,
|
|
138
|
-
False: line,
|
|
139
|
-
None: __Text(),
|
|
140
|
-
} # footer[footer_visible]
|
|
141
|
-
layout = {
|
|
142
|
-
1: __Group(header[header_visible], out_table, footer[footer_visible]),
|
|
143
|
-
2: __Group(
|
|
144
|
-
header[header_visible],
|
|
145
|
-
result_panel,
|
|
146
|
-
performance_panel,
|
|
147
|
-
footer[footer_visible],
|
|
148
|
-
),
|
|
149
|
-
3: __Group(result_panel),
|
|
150
|
-
}
|
|
151
|
-
if layout_option in layout:
|
|
152
|
-
return layout[layout_option]
|
|
153
|
-
else:
|
|
154
|
-
return layout[2]
|
|
155
|
-
# return layout[3]
|
|
156
|
-
|
|
157
|
-
return wrapper
|
|
158
|
-
|
|
159
|
-
return decorator
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
# rich's console.print wrapper
|
|
163
|
-
if BEAUTIFUL_MODE:
|
|
164
|
-
print = __Console().print
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
# demo
|
|
168
|
-
@beautiful_output()
|
|
169
|
-
def __demo_decorator(x: any = None):
|
|
170
|
-
code = """\
|
|
171
|
-
# demo
|
|
172
|
-
from absfuyu.extensions import beautiful as bu
|
|
173
|
-
@bu.beautiful_output()
|
|
174
|
-
def testcode():
|
|
175
|
-
test = [x for x in range(100)]
|
|
176
|
-
return test
|
|
177
|
-
bu.print(testcode())"""
|
|
178
|
-
if x is None:
|
|
179
|
-
x = code
|
|
180
|
-
return x
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
def demo(x: any = None):
|
|
184
|
-
print(__demo_decorator(x))
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
if __name__ == "__main__":
|
|
188
|
-
demo()
|