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/fun/__init__.py
CHANGED
absfuyu/fun/tarot.py
CHANGED
absfuyu/game/__init__.py
CHANGED
absfuyu/game/game_stat.py
CHANGED
absfuyu/game/sudoku.py
CHANGED
absfuyu/game/tictactoe.py
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
Game: Tic Tac Toe
|
|
3
3
|
-----------------
|
|
4
4
|
|
|
5
|
-
Version: 5.
|
|
6
|
-
Date updated:
|
|
5
|
+
Version: 5.2.0
|
|
6
|
+
Date updated: 15/03/2025 (dd/mm/yyyy)
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
# Module level
|
|
11
10
|
# ---------------------------------------------------------------------------
|
|
12
11
|
__all__ = ["TicTacToe", "GameMode"]
|
absfuyu/game/wordle.py
CHANGED
absfuyu/general/__init__.py
CHANGED
absfuyu/general/content.py
CHANGED
absfuyu/general/human.py
CHANGED
absfuyu/general/shape.py
CHANGED
absfuyu/logger.py
CHANGED
absfuyu/pkg_data/__init__.py
CHANGED
absfuyu/pkg_data/deprecated.py
CHANGED
absfuyu/sort.py
CHANGED
absfuyu/tools/__init__.py
CHANGED
|
@@ -3,6 +3,32 @@ Absfuyu: Tools
|
|
|
3
3
|
--------------
|
|
4
4
|
Some useful tools
|
|
5
5
|
|
|
6
|
-
Version: 5.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 5.2.0
|
|
7
|
+
Date updated: 16/03/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
|
+
|
|
10
|
+
# Module Package
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
12
|
+
__all__ = [
|
|
13
|
+
# # Main
|
|
14
|
+
"Checksum",
|
|
15
|
+
"Base64ED",
|
|
16
|
+
"T2C",
|
|
17
|
+
# "Charset",
|
|
18
|
+
# "Generator",
|
|
19
|
+
"Inspector",
|
|
20
|
+
"inspect_all",
|
|
21
|
+
# "Obfuscator",
|
|
22
|
+
# "StrShifter",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# Library
|
|
27
|
+
# ---------------------------------------------------------------------------
|
|
28
|
+
from absfuyu.tools.checksum import Checksum
|
|
29
|
+
from absfuyu.tools.converter import Base64EncodeDecode as Base64ED
|
|
30
|
+
from absfuyu.tools.converter import Text2Chemistry as T2C
|
|
31
|
+
from absfuyu.tools.inspector import Inspector, inspect_all
|
|
32
|
+
|
|
33
|
+
# from absfuyu.tools.generator import Charset, Generator # circular import bug
|
|
34
|
+
# from absfuyu.tools.obfuscator import Obfuscator, StrShifter # circular import bug
|
absfuyu/tools/checksum.py
CHANGED
|
@@ -3,8 +3,8 @@ Absufyu: Checksum
|
|
|
3
3
|
-----------------
|
|
4
4
|
Check MD5, SHA256, ...
|
|
5
5
|
|
|
6
|
-
Version: 5.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 5.2.0
|
|
7
|
+
Date updated: 11/03/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
# Module level
|
|
@@ -19,7 +19,9 @@ from enum import StrEnum
|
|
|
19
19
|
from pathlib import Path
|
|
20
20
|
from typing import Literal
|
|
21
21
|
|
|
22
|
-
from absfuyu.core import BaseClass
|
|
22
|
+
from absfuyu.core.baseclass import BaseClass
|
|
23
|
+
from absfuyu.core.docstring import deprecated, versionadded, versionchanged
|
|
24
|
+
from absfuyu.core.dummy_func import tqdm
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
# Function
|
|
@@ -65,6 +67,21 @@ class ChecksumMode(StrEnum):
|
|
|
65
67
|
@versionchanged("4.1.1", reason="Checksum for entire folder is possible")
|
|
66
68
|
@versionadded("4.1.0")
|
|
67
69
|
class Checksum(BaseClass):
|
|
70
|
+
"""
|
|
71
|
+
Checksum engine
|
|
72
|
+
|
|
73
|
+
Parameters
|
|
74
|
+
----------
|
|
75
|
+
path : str | Path
|
|
76
|
+
Path to file/directory to perform checksum
|
|
77
|
+
|
|
78
|
+
hash_mode : ChecksumMode | Literal["md5", "sha1", "sha256", "sha512"], optional
|
|
79
|
+
Hash mode, by default ``"sha256"``
|
|
80
|
+
|
|
81
|
+
save_result_to_file : bool, optional
|
|
82
|
+
Save checksum result(s) to file, by default ``False``
|
|
83
|
+
"""
|
|
84
|
+
|
|
68
85
|
def __init__(
|
|
69
86
|
self,
|
|
70
87
|
path: str | Path,
|
|
@@ -73,7 +90,8 @@ class Checksum(BaseClass):
|
|
|
73
90
|
) = ChecksumMode.SHA256,
|
|
74
91
|
save_result_to_file: bool = False,
|
|
75
92
|
) -> None:
|
|
76
|
-
"""
|
|
93
|
+
"""
|
|
94
|
+
Checksum engine
|
|
77
95
|
|
|
78
96
|
Parameters
|
|
79
97
|
----------
|
|
@@ -84,7 +102,7 @@ class Checksum(BaseClass):
|
|
|
84
102
|
Hash mode, by default ``"sha256"``
|
|
85
103
|
|
|
86
104
|
save_result_to_file : bool, optional
|
|
87
|
-
Save checksum result(s) to file, by default False
|
|
105
|
+
Save checksum result(s) to file, by default ``False``
|
|
88
106
|
"""
|
|
89
107
|
self.path = Path(path)
|
|
90
108
|
self.hash_mode = hash_mode
|
|
@@ -125,12 +143,14 @@ class Checksum(BaseClass):
|
|
|
125
143
|
return hash_engine.hexdigest() # type: ignore
|
|
126
144
|
|
|
127
145
|
def checksum(self, recursive: bool = True) -> str:
|
|
128
|
-
"""
|
|
146
|
+
"""
|
|
147
|
+
Perform checksum
|
|
129
148
|
|
|
130
149
|
Parameters
|
|
131
150
|
----------
|
|
132
151
|
recursive : bool, optional
|
|
133
|
-
Do checksum for every file in the folder (including child folder),
|
|
152
|
+
Do checksum for every file in the folder (including child folder),
|
|
153
|
+
by default ``True``
|
|
134
154
|
|
|
135
155
|
Returns
|
|
136
156
|
-------
|
absfuyu/tools/converter.py
CHANGED
|
@@ -3,8 +3,8 @@ Absufyu: Converter
|
|
|
3
3
|
------------------
|
|
4
4
|
Convert stuff
|
|
5
5
|
|
|
6
|
-
Version: 5.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 5.2.0
|
|
7
|
+
Date updated: 15/03/2025 (dd/mm/yyyy)
|
|
8
8
|
|
|
9
9
|
Feature:
|
|
10
10
|
--------
|
|
@@ -16,9 +16,11 @@ Feature:
|
|
|
16
16
|
# Module level
|
|
17
17
|
# ---------------------------------------------------------------------------
|
|
18
18
|
__all__ = [
|
|
19
|
+
"Base64EncodeDecode",
|
|
19
20
|
"Text2Chemistry",
|
|
20
21
|
"Str2Pixel",
|
|
21
|
-
|
|
22
|
+
# Support
|
|
23
|
+
"ChemistryElement",
|
|
22
24
|
]
|
|
23
25
|
|
|
24
26
|
|
|
@@ -32,10 +34,11 @@ from itertools import chain, combinations
|
|
|
32
34
|
from pathlib import Path
|
|
33
35
|
from typing import Self
|
|
34
36
|
|
|
35
|
-
from absfuyu.core import BaseClass, CLITextColor
|
|
37
|
+
from absfuyu.core.baseclass import BaseClass, CLITextColor
|
|
38
|
+
from absfuyu.core.docstring import versionadded
|
|
36
39
|
from absfuyu.logger import logger
|
|
37
40
|
from absfuyu.pkg_data import DataList, DataLoader
|
|
38
|
-
from absfuyu.util import
|
|
41
|
+
from absfuyu.util.text_table import OneColumnTableMaker
|
|
39
42
|
|
|
40
43
|
|
|
41
44
|
# Class
|
|
@@ -84,14 +87,43 @@ class Base64EncodeDecode(BaseClass):
|
|
|
84
87
|
|
|
85
88
|
|
|
86
89
|
class ChemistryElement(BaseClass):
|
|
87
|
-
"""
|
|
90
|
+
"""
|
|
91
|
+
Chemistry Element
|
|
92
|
+
|
|
93
|
+
Parameters
|
|
94
|
+
----------
|
|
95
|
+
name : str
|
|
96
|
+
Element name
|
|
97
|
+
|
|
98
|
+
number : int
|
|
99
|
+
Order in periodic table
|
|
100
|
+
|
|
101
|
+
symbol : str
|
|
102
|
+
Short symbol of element
|
|
103
|
+
|
|
104
|
+
atomic_mass : float
|
|
105
|
+
Atomic mass of element
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
__slots__ = ("name", "number", "symbol", "atomic_mass")
|
|
88
109
|
|
|
89
110
|
def __init__(self, name: str, number: int, symbol: str, atomic_mass: float) -> None:
|
|
90
111
|
"""
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
112
|
+
Chemistry Element
|
|
113
|
+
|
|
114
|
+
Parameters
|
|
115
|
+
----------
|
|
116
|
+
name : str
|
|
117
|
+
Element name
|
|
118
|
+
|
|
119
|
+
number : int
|
|
120
|
+
Order in periodic table
|
|
121
|
+
|
|
122
|
+
symbol : str
|
|
123
|
+
Short symbol of element
|
|
124
|
+
|
|
125
|
+
atomic_mass : float
|
|
126
|
+
Atomic mass of element
|
|
95
127
|
"""
|
|
96
128
|
self.name = name
|
|
97
129
|
self.number = number
|
|
@@ -105,23 +137,28 @@ class ChemistryElement(BaseClass):
|
|
|
105
137
|
"""
|
|
106
138
|
Output content to dict
|
|
107
139
|
|
|
108
|
-
|
|
140
|
+
Returns
|
|
141
|
+
-------
|
|
142
|
+
dict[str, str | int | float]
|
|
143
|
+
Dict version of element
|
|
109
144
|
"""
|
|
110
|
-
return {
|
|
111
|
-
|
|
112
|
-
"number": self.number,
|
|
113
|
-
"symbol": self.symbol,
|
|
114
|
-
"atomic_mass": self.atomic_mass,
|
|
115
|
-
}
|
|
145
|
+
# return {"name": self.name, "number": self.number, "symbol": self.symbol, "atomic_mass": self.atomic_mass}
|
|
146
|
+
return {x: getattr(self, x) for x in self.__slots__}
|
|
116
147
|
|
|
117
148
|
@classmethod
|
|
118
149
|
def from_dict(cls, data: dict[str, str | int | float]) -> Self:
|
|
119
150
|
"""
|
|
120
151
|
Convert from ``dict`` data
|
|
121
152
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
:
|
|
153
|
+
Parameters
|
|
154
|
+
----------
|
|
155
|
+
data : dict[str, str | int | float]
|
|
156
|
+
Dict data
|
|
157
|
+
|
|
158
|
+
Returns
|
|
159
|
+
-------
|
|
160
|
+
Self
|
|
161
|
+
ChemistryElement
|
|
125
162
|
"""
|
|
126
163
|
return cls(
|
|
127
164
|
name=data["name"], # type: ignore
|
|
@@ -132,6 +169,10 @@ class ChemistryElement(BaseClass):
|
|
|
132
169
|
|
|
133
170
|
|
|
134
171
|
class Text2Chemistry(BaseClass):
|
|
172
|
+
"""
|
|
173
|
+
Convert text into chemistry symbols.
|
|
174
|
+
"""
|
|
175
|
+
|
|
135
176
|
def __init__(self) -> None:
|
|
136
177
|
self.data_location = DataList.CHEMISTRY
|
|
137
178
|
|
|
@@ -150,7 +191,10 @@ class Text2Chemistry(BaseClass):
|
|
|
150
191
|
"""
|
|
151
192
|
Characters that can not be converted (unvailable chemistry symbol)
|
|
152
193
|
|
|
153
|
-
|
|
194
|
+
Returns
|
|
195
|
+
-------
|
|
196
|
+
set[str]
|
|
197
|
+
Set of unvailable characters
|
|
154
198
|
"""
|
|
155
199
|
base = set(string.ascii_lowercase)
|
|
156
200
|
available = set(
|
|
@@ -164,10 +208,20 @@ class Text2Chemistry(BaseClass):
|
|
|
164
208
|
"""
|
|
165
209
|
Convert text to chemistry symbol
|
|
166
210
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
211
|
+
Parameters
|
|
212
|
+
----------
|
|
213
|
+
text : str
|
|
214
|
+
Desired text
|
|
215
|
+
|
|
216
|
+
Returns
|
|
217
|
+
-------
|
|
218
|
+
list[list[ChemistryElement]] | list
|
|
219
|
+
Converted text (empty list when failed to convert)
|
|
220
|
+
|
|
221
|
+
Raises
|
|
222
|
+
------
|
|
223
|
+
ValueError
|
|
224
|
+
When text contains digit, whitespaces, ...
|
|
171
225
|
"""
|
|
172
226
|
# Check if `text` is a word (without digits)
|
|
173
227
|
is_word_pattern = r"^[a-zA-Z]+$"
|
|
@@ -253,21 +307,50 @@ class Text2Chemistry(BaseClass):
|
|
|
253
307
|
if len(result) == 0:
|
|
254
308
|
res = "No possible combination"
|
|
255
309
|
else:
|
|
256
|
-
|
|
310
|
+
header = ["Text to Chemistry"]
|
|
311
|
+
body = []
|
|
312
|
+
max_table_len = len(header[0])
|
|
313
|
+
|
|
257
314
|
for i, solution in enumerate(result, start=1):
|
|
315
|
+
msg = []
|
|
258
316
|
max_word_len = max([len(x.name) for x in solution])
|
|
259
317
|
msg.append(f"Option {i:02}: {', '.join([x.symbol for x in solution])}")
|
|
260
318
|
for x in solution:
|
|
261
319
|
msg.append(
|
|
262
|
-
f"{x.symbol.ljust(2)}
|
|
320
|
+
f"{x.symbol.ljust(2)} "
|
|
321
|
+
f"({x.number:02}. {x.name.ljust(max_word_len)}"
|
|
322
|
+
f" - {round(x.atomic_mass, 2)})"
|
|
263
323
|
)
|
|
264
|
-
|
|
265
|
-
|
|
324
|
+
body.append(msg)
|
|
325
|
+
|
|
326
|
+
max_table_len = max(
|
|
327
|
+
max([max([len(x) for x in opt]) for opt in body]), max_table_len
|
|
328
|
+
)
|
|
329
|
+
table = OneColumnTableMaker(ncols=max_table_len + 4, style="normal")
|
|
330
|
+
table.add_paragraph(header)
|
|
331
|
+
for x in body:
|
|
332
|
+
table.add_paragraph(x)
|
|
333
|
+
|
|
334
|
+
res = table.make_table()
|
|
266
335
|
return res
|
|
267
336
|
|
|
268
337
|
|
|
269
338
|
class Str2Pixel(BaseClass):
|
|
270
|
-
"""
|
|
339
|
+
"""
|
|
340
|
+
Convert str into pixel
|
|
341
|
+
|
|
342
|
+
Parameters
|
|
343
|
+
----------
|
|
344
|
+
str_data : str
|
|
345
|
+
| Pixel string data (Format: ``<number_of_pixel><color_code>``)
|
|
346
|
+
| Example: ``50w20b`` = 50 white pixels and 20 black pixels
|
|
347
|
+
|
|
348
|
+
pixel_size : int, optional
|
|
349
|
+
Pixel size, by default ``2``
|
|
350
|
+
|
|
351
|
+
pixel_symbol_overwrite : str | None, optional
|
|
352
|
+
Overwrite pixel symbol, by default ``None``
|
|
353
|
+
"""
|
|
271
354
|
|
|
272
355
|
PIXEL = "\u2588"
|
|
273
356
|
|
|
@@ -279,11 +362,13 @@ class Str2Pixel(BaseClass):
|
|
|
279
362
|
pixel_symbol_overwrite: str | None = None,
|
|
280
363
|
) -> None:
|
|
281
364
|
"""
|
|
365
|
+
Convert str into pixel
|
|
366
|
+
|
|
282
367
|
Parameters
|
|
283
368
|
----------
|
|
284
369
|
str_data : str
|
|
285
|
-
Pixel string data (Format: ``<number_of_pixel><color_code>``)
|
|
286
|
-
Example: 50w20b = 50 white pixels and 20 black pixels
|
|
370
|
+
| Pixel string data (Format: ``<number_of_pixel><color_code>``)
|
|
371
|
+
| Example: ``50w20b`` = 50 white pixels and 20 black pixels
|
|
287
372
|
|
|
288
373
|
pixel_size : int, optional
|
|
289
374
|
Pixel size, by default ``2``
|
|
@@ -293,7 +378,7 @@ class Str2Pixel(BaseClass):
|
|
|
293
378
|
"""
|
|
294
379
|
self.data = str_data
|
|
295
380
|
if pixel_symbol_overwrite is None:
|
|
296
|
-
self.pixel = self.PIXEL * int(
|
|
381
|
+
self.pixel = self.PIXEL * int(max(pixel_size, 1))
|
|
297
382
|
else:
|
|
298
383
|
self.pixel = pixel_symbol_overwrite
|
|
299
384
|
|
|
@@ -307,7 +392,8 @@ class Str2Pixel(BaseClass):
|
|
|
307
392
|
return [x for y in zip(num, char) for x in y]
|
|
308
393
|
|
|
309
394
|
def convert(self, line_break: bool = True) -> str:
|
|
310
|
-
"""
|
|
395
|
+
"""
|
|
396
|
+
Convert data into pixel
|
|
311
397
|
|
|
312
398
|
Parameters
|
|
313
399
|
----------
|