absfuyu 5.0.1__py3-none-any.whl → 5.2.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 +1 -1
- absfuyu/__main__.py +3 -3
- absfuyu/cli/__init__.py +2 -2
- absfuyu/cli/color.py +30 -14
- absfuyu/cli/config_group.py +9 -2
- absfuyu/cli/do_group.py +13 -6
- absfuyu/cli/game_group.py +9 -2
- absfuyu/cli/tool_group.py +15 -9
- absfuyu/config/__init__.py +2 -2
- absfuyu/core/__init__.py +2 -2
- absfuyu/core/baseclass.py +448 -79
- absfuyu/core/baseclass2.py +2 -2
- absfuyu/core/decorator.py +70 -4
- absfuyu/core/docstring.py +43 -25
- absfuyu/core/dummy_cli.py +2 -2
- absfuyu/core/dummy_func.py +15 -4
- absfuyu/dxt/__init__.py +2 -2
- absfuyu/dxt/dictext.py +5 -2
- absfuyu/dxt/dxt_support.py +2 -2
- absfuyu/dxt/intext.py +34 -3
- absfuyu/dxt/listext.py +300 -113
- absfuyu/dxt/strext.py +75 -15
- absfuyu/extra/__init__.py +2 -2
- absfuyu/extra/beautiful.py +2 -2
- absfuyu/extra/da/__init__.py +36 -0
- absfuyu/extra/da/dadf.py +1177 -0
- absfuyu/extra/da/dadf_base.py +186 -0
- absfuyu/extra/da/df_func.py +97 -0
- absfuyu/extra/da/mplt.py +219 -0
- absfuyu/extra/data_analysis.py +10 -1067
- absfuyu/fun/__init__.py +2 -2
- absfuyu/fun/tarot.py +2 -2
- absfuyu/game/__init__.py +2 -2
- absfuyu/game/game_stat.py +2 -2
- absfuyu/game/sudoku.py +2 -2
- absfuyu/game/tictactoe.py +2 -3
- absfuyu/game/wordle.py +2 -2
- absfuyu/general/__init__.py +2 -2
- absfuyu/general/content.py +2 -2
- absfuyu/general/human.py +2 -2
- absfuyu/general/shape.py +2 -2
- absfuyu/logger.py +2 -2
- absfuyu/pkg_data/__init__.py +2 -2
- absfuyu/pkg_data/deprecated.py +2 -2
- absfuyu/sort.py +2 -2
- absfuyu/tools/__init__.py +28 -2
- absfuyu/tools/checksum.py +27 -7
- absfuyu/tools/converter.py +120 -34
- absfuyu/tools/generator.py +251 -110
- absfuyu/tools/inspector.py +463 -0
- absfuyu/tools/keygen.py +2 -2
- absfuyu/tools/obfuscator.py +45 -7
- absfuyu/tools/passwordlib.py +88 -24
- absfuyu/tools/shutdownizer.py +2 -2
- absfuyu/tools/web.py +2 -2
- absfuyu/typings.py +136 -0
- absfuyu/util/__init__.py +18 -4
- absfuyu/util/api.py +36 -16
- absfuyu/util/json_method.py +43 -14
- absfuyu/util/lunar.py +2 -2
- absfuyu/util/path.py +190 -82
- absfuyu/util/performance.py +122 -7
- absfuyu/util/shorten_number.py +40 -10
- absfuyu/util/text_table.py +306 -0
- absfuyu/util/zipped.py +8 -7
- absfuyu/version.py +2 -2
- {absfuyu-5.0.1.dist-info → absfuyu-5.2.0.dist-info}/METADATA +9 -2
- absfuyu-5.2.0.dist-info/RECORD +76 -0
- absfuyu-5.0.1.dist-info/RECORD +0 -68
- {absfuyu-5.0.1.dist-info → absfuyu-5.2.0.dist-info}/WHEEL +0 -0
- {absfuyu-5.0.1.dist-info → absfuyu-5.2.0.dist-info}/entry_points.txt +0 -0
- {absfuyu-5.0.1.dist-info → absfuyu-5.2.0.dist-info}/licenses/LICENSE +0 -0
absfuyu/dxt/strext.py
CHANGED
|
@@ -3,8 +3,8 @@ Absfuyu: Data Extension
|
|
|
3
3
|
-----------------------
|
|
4
4
|
str extension
|
|
5
5
|
|
|
6
|
-
Version: 5.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 5.2.0
|
|
7
|
+
Date updated: 13/03/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
# Module Package
|
|
@@ -15,14 +15,72 @@ __all__ = ["Text", "TextAnalyzeDictFormat"]
|
|
|
15
15
|
# Library
|
|
16
16
|
# ---------------------------------------------------------------------------
|
|
17
17
|
import random
|
|
18
|
+
from string import ascii_letters as _ascii_letters
|
|
18
19
|
from typing import NotRequired, Self, TypedDict
|
|
19
20
|
|
|
20
21
|
from absfuyu.core import ShowAllMethodsMixin, deprecated, versionadded, versionchanged
|
|
21
|
-
from absfuyu.logger import logger
|
|
22
|
-
from absfuyu.tools.generator import Charset, Generator
|
|
23
22
|
from absfuyu.util import set_min_max
|
|
24
23
|
|
|
25
24
|
|
|
25
|
+
# Support function
|
|
26
|
+
# ---------------------------------------------------------------------------
|
|
27
|
+
def _generate_string(
|
|
28
|
+
charset: str | None = None,
|
|
29
|
+
size: int = 8,
|
|
30
|
+
times: int = 1,
|
|
31
|
+
unique: bool = True,
|
|
32
|
+
) -> list[str]:
|
|
33
|
+
"""
|
|
34
|
+
Generate a list of random string from character set
|
|
35
|
+
(Random string generator)
|
|
36
|
+
|
|
37
|
+
This is a lesser version of
|
|
38
|
+
``absfuyu.tools.generator.Generator.generate_string()``
|
|
39
|
+
|
|
40
|
+
Parameters
|
|
41
|
+
----------
|
|
42
|
+
charset : str, optional
|
|
43
|
+
Custom character set, by default ``None``
|
|
44
|
+
([a-zA-Z] - string.ascii_letters)
|
|
45
|
+
|
|
46
|
+
size : int, optional
|
|
47
|
+
Length of each string in list, by default ``8``
|
|
48
|
+
|
|
49
|
+
times : int, optional
|
|
50
|
+
How many random string generated, by default ``1``
|
|
51
|
+
|
|
52
|
+
unique : bool, optional
|
|
53
|
+
Each generated text is unique, by default ``True``
|
|
54
|
+
|
|
55
|
+
Returns
|
|
56
|
+
-------
|
|
57
|
+
list[str]
|
|
58
|
+
List of random string generated
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
charset = _ascii_letters or charset
|
|
62
|
+
|
|
63
|
+
try:
|
|
64
|
+
char_lst = list(charset) # type: ignore[arg-type]
|
|
65
|
+
except Exception:
|
|
66
|
+
char_lst = charset # type: ignore[assignment]
|
|
67
|
+
|
|
68
|
+
unique_string = []
|
|
69
|
+
count = 0
|
|
70
|
+
|
|
71
|
+
while count < times:
|
|
72
|
+
gen_string = "".join(random.choice(char_lst) for _ in range(size))
|
|
73
|
+
if not unique:
|
|
74
|
+
unique_string.append(gen_string)
|
|
75
|
+
count += 1
|
|
76
|
+
else:
|
|
77
|
+
if gen_string not in unique_string:
|
|
78
|
+
unique_string.append(gen_string)
|
|
79
|
+
count += 1
|
|
80
|
+
|
|
81
|
+
return unique_string
|
|
82
|
+
|
|
83
|
+
|
|
26
84
|
# Class
|
|
27
85
|
# ---------------------------------------------------------------------------
|
|
28
86
|
class TextAnalyzeDictFormat(TypedDict):
|
|
@@ -61,6 +119,9 @@ class TextAnalyzeDictFormat(TypedDict):
|
|
|
61
119
|
class Text(ShowAllMethodsMixin, str):
|
|
62
120
|
"""
|
|
63
121
|
``str`` extension
|
|
122
|
+
|
|
123
|
+
>>> # For a list of new methods
|
|
124
|
+
>>> Text.show_all_methods()
|
|
64
125
|
"""
|
|
65
126
|
|
|
66
127
|
def divide(self, string_split_size: int = 60) -> list[str]:
|
|
@@ -154,9 +215,7 @@ class Text(ShowAllMethodsMixin, str):
|
|
|
154
215
|
splt_len = len(temp)
|
|
155
216
|
|
|
156
217
|
if custom_var_name is None:
|
|
157
|
-
splt_name =
|
|
158
|
-
charset=Charset.ALPHABET, size=split_var_len, times=splt_len + 1
|
|
159
|
-
)
|
|
218
|
+
splt_name = _generate_string(size=split_var_len, times=splt_len + 1)
|
|
160
219
|
for i in range(splt_len):
|
|
161
220
|
output.append(f"{splt_name[i]}='{temp[i]}'")
|
|
162
221
|
else:
|
|
@@ -361,14 +420,15 @@ class Text(ShowAllMethodsMixin, str):
|
|
|
361
420
|
probability = int(set_min_max(probability))
|
|
362
421
|
text = self.lower()
|
|
363
422
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
temp.append(x)
|
|
369
|
-
logger.debug(temp)
|
|
370
|
-
return self.__class__("".join(temp))
|
|
423
|
+
random_caps = (
|
|
424
|
+
x.upper() if random.randint(1, 100) <= probability else x for x in text
|
|
425
|
+
)
|
|
426
|
+
return self.__class__("".join(random_caps))
|
|
371
427
|
|
|
428
|
+
@deprecated(
|
|
429
|
+
"5.2.0",
|
|
430
|
+
reason="str already has swapcase() method, will be removed in version 5.3.0",
|
|
431
|
+
)
|
|
372
432
|
@versionchanged("5.0.0", reason="Use ``str.swapcase()``")
|
|
373
433
|
def reverse_capslock(self) -> Self:
|
|
374
434
|
"""
|
|
@@ -406,7 +466,7 @@ class Text(ShowAllMethodsMixin, str):
|
|
|
406
466
|
"""
|
|
407
467
|
return list(self)
|
|
408
468
|
|
|
409
|
-
@deprecated("5.0.0", reason="Unused")
|
|
469
|
+
@deprecated("5.0.0", reason="Unused, will be removed in version 5.3.0")
|
|
410
470
|
def to_listext(self) -> None:
|
|
411
471
|
"""Deprecated, will be removed soon"""
|
|
412
472
|
raise NotImplementedError("Deprecated, will be removed soon")
|
absfuyu/extra/__init__.py
CHANGED
absfuyu/extra/beautiful.py
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Absfuyu: Data Analysis
|
|
3
|
+
----------------------
|
|
4
|
+
Data Analyst
|
|
5
|
+
|
|
6
|
+
Version: 5.2.0
|
|
7
|
+
Date updated: 10/03/2025 (dd/mm/yyyy)
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
# Module level
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
12
|
+
__all__ = ["MatplotlibFormatString", "DADF"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# Library
|
|
16
|
+
# ---------------------------------------------------------------------------
|
|
17
|
+
DA_MODE = False
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
import numpy as np
|
|
21
|
+
import pandas as pd
|
|
22
|
+
except ImportError:
|
|
23
|
+
from subprocess import run
|
|
24
|
+
|
|
25
|
+
from absfuyu.config import ABSFUYU_CONFIG
|
|
26
|
+
|
|
27
|
+
if ABSFUYU_CONFIG._get_setting("auto-install-extra").value:
|
|
28
|
+
cmd = "python -m pip install -U absfuyu[full]".split()
|
|
29
|
+
run(cmd)
|
|
30
|
+
else:
|
|
31
|
+
raise SystemExit("This feature is in absfuyu[full] package") # noqa: B904
|
|
32
|
+
else:
|
|
33
|
+
DA_MODE = True
|
|
34
|
+
|
|
35
|
+
from absfuyu.extra.da.dadf import DADF
|
|
36
|
+
from absfuyu.extra.da.mplt import MatplotlibFormatString
|