absfuyu 5.2.0__py3-none-any.whl → 5.4.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 +2 -2
- absfuyu/cli/__init__.py +2 -2
- absfuyu/cli/color.py +2 -2
- absfuyu/cli/config_group.py +2 -2
- absfuyu/cli/do_group.py +12 -2
- absfuyu/cli/game_group.py +2 -2
- absfuyu/cli/tool_group.py +2 -2
- absfuyu/config/__init__.py +2 -2
- absfuyu/core/__init__.py +2 -2
- absfuyu/core/baseclass.py +32 -2
- absfuyu/core/baseclass2.py +2 -2
- absfuyu/core/decorator.py +2 -2
- absfuyu/core/docstring.py +2 -2
- absfuyu/core/dummy_cli.py +2 -2
- absfuyu/core/dummy_func.py +2 -2
- absfuyu/dxt/__init__.py +2 -2
- absfuyu/dxt/dictext.py +15 -6
- absfuyu/dxt/dxt_support.py +2 -2
- absfuyu/dxt/intext.py +51 -33
- absfuyu/dxt/listext.py +138 -10
- absfuyu/dxt/strext.py +2 -2
- absfuyu/extra/__init__.py +2 -2
- absfuyu/extra/beautiful.py +2 -2
- absfuyu/extra/da/__init__.py +2 -2
- absfuyu/extra/da/dadf.py +57 -41
- absfuyu/extra/da/dadf_base.py +2 -2
- absfuyu/extra/da/df_func.py +2 -2
- absfuyu/extra/da/mplt.py +2 -2
- absfuyu/extra/data_analysis.py +2 -2
- absfuyu/fun/__init__.py +7 -2
- absfuyu/fun/rubik.py +442 -0
- 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 -2
- 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 +4 -4
- absfuyu/tools/checksum.py +2 -2
- absfuyu/tools/converter.py +2 -2
- absfuyu/tools/generator.py +2 -2
- absfuyu/tools/inspector.py +41 -6
- absfuyu/tools/keygen.py +2 -2
- absfuyu/tools/obfuscator.py +2 -2
- absfuyu/tools/passwordlib.py +2 -2
- absfuyu/tools/shutdownizer.py +2 -2
- absfuyu/tools/web.py +2 -2
- absfuyu/typings.py +7 -2
- absfuyu/util/__init__.py +57 -3
- absfuyu/util/api.py +2 -2
- absfuyu/util/json_method.py +2 -2
- absfuyu/util/lunar.py +2 -2
- absfuyu/util/path.py +158 -4
- absfuyu/util/performance.py +2 -2
- absfuyu/util/shorten_number.py +2 -2
- absfuyu/util/text_table.py +220 -64
- absfuyu/util/zipped.py +2 -2
- absfuyu/version.py +2 -2
- {absfuyu-5.2.0.dist-info → absfuyu-5.4.0.dist-info}/METADATA +1 -1
- absfuyu-5.4.0.dist-info/RECORD +77 -0
- absfuyu-5.2.0.dist-info/RECORD +0 -76
- {absfuyu-5.2.0.dist-info → absfuyu-5.4.0.dist-info}/WHEEL +0 -0
- {absfuyu-5.2.0.dist-info → absfuyu-5.4.0.dist-info}/entry_points.txt +0 -0
- {absfuyu-5.2.0.dist-info → absfuyu-5.4.0.dist-info}/licenses/LICENSE +0 -0
absfuyu/__init__.py
CHANGED
absfuyu/__main__.py
CHANGED
absfuyu/cli/__init__.py
CHANGED
absfuyu/cli/color.py
CHANGED
absfuyu/cli/config_group.py
CHANGED
absfuyu/cli/do_group.py
CHANGED
|
@@ -3,8 +3,8 @@ ABSFUYU CLI
|
|
|
3
3
|
-----------
|
|
4
4
|
Do
|
|
5
5
|
|
|
6
|
-
Version: 5.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 5.4.0
|
|
7
|
+
Date updated: 21/03/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
# Module Package
|
|
@@ -83,6 +83,15 @@ def os_shutdown() -> None:
|
|
|
83
83
|
engine.shutdown()
|
|
84
84
|
|
|
85
85
|
|
|
86
|
+
@click.command(name="organize")
|
|
87
|
+
@click.argument("dir", type=str)
|
|
88
|
+
def organize_directory(dir: str) -> None:
|
|
89
|
+
"""Organize a directory"""
|
|
90
|
+
engine = Directory(dir)
|
|
91
|
+
engine.organize()
|
|
92
|
+
click.echo(f"{COLOR['green']}Done!")
|
|
93
|
+
|
|
94
|
+
|
|
86
95
|
@click.group(name="do")
|
|
87
96
|
def do_group() -> None:
|
|
88
97
|
"""Perform functionalities"""
|
|
@@ -93,3 +102,4 @@ do_group.add_command(update)
|
|
|
93
102
|
do_group.add_command(install)
|
|
94
103
|
do_group.add_command(unzip_files_in_dir)
|
|
95
104
|
do_group.add_command(os_shutdown)
|
|
105
|
+
do_group.add_command(organize_directory)
|
absfuyu/cli/game_group.py
CHANGED
absfuyu/cli/tool_group.py
CHANGED
absfuyu/config/__init__.py
CHANGED
absfuyu/core/__init__.py
CHANGED
absfuyu/core/baseclass.py
CHANGED
|
@@ -3,8 +3,8 @@ Absfuyu: Core
|
|
|
3
3
|
-------------
|
|
4
4
|
Bases for other features
|
|
5
5
|
|
|
6
|
-
Version: 5.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 5.4.0
|
|
7
|
+
Date updated: 21/03/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
# Module Package
|
|
@@ -162,6 +162,36 @@ class MethodNPropertyList(NamedTuple):
|
|
|
162
162
|
|
|
163
163
|
return self.__class__(new_methods_list, [], [], self.properties)
|
|
164
164
|
|
|
165
|
+
def sort(self, reverse: bool = False) -> Self:
|
|
166
|
+
"""
|
|
167
|
+
Sorts every element in each method list.
|
|
168
|
+
|
|
169
|
+
Parameters
|
|
170
|
+
----------
|
|
171
|
+
reverse : bool, optional
|
|
172
|
+
Descending order, by default ``False``
|
|
173
|
+
|
|
174
|
+
Returns
|
|
175
|
+
-------
|
|
176
|
+
Self
|
|
177
|
+
Sorted.
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
Example:
|
|
181
|
+
--------
|
|
182
|
+
>>> test = MethodNPropertyList(["b", "a"], ["d", "c"], ["f", "e"], ["h", "g"])
|
|
183
|
+
>>> test.sort()
|
|
184
|
+
MethodNPropertyList(methods=['a', 'b'], classmethods=['c', 'd'], staticmethods=['e', 'f'], properties=['g', 'h'])
|
|
185
|
+
|
|
186
|
+
>>> test.pack().sort()
|
|
187
|
+
MethodNPropertyList(methods=['a', 'b', 'c <classmethod>', 'd <classmethod>', 'e <staticmethod>', 'f <staticmethod>'], properties=['g', 'h'])
|
|
188
|
+
"""
|
|
189
|
+
sorted_vals = [
|
|
190
|
+
sorted(getattr(self, field), reverse=reverse) for field in self._fields
|
|
191
|
+
]
|
|
192
|
+
# return self._make(sorted_vals)
|
|
193
|
+
return self.__class__(*sorted_vals)
|
|
194
|
+
|
|
165
195
|
|
|
166
196
|
# @versionadded("5.1.0")
|
|
167
197
|
class MethodNPropertyResult(dict[str, MethodNPropertyList]):
|
absfuyu/core/baseclass2.py
CHANGED
absfuyu/core/decorator.py
CHANGED
absfuyu/core/docstring.py
CHANGED
absfuyu/core/dummy_cli.py
CHANGED
absfuyu/core/dummy_func.py
CHANGED
absfuyu/dxt/__init__.py
CHANGED
absfuyu/dxt/dictext.py
CHANGED
|
@@ -3,8 +3,8 @@ Absfuyu: Data Extension
|
|
|
3
3
|
-----------------------
|
|
4
4
|
dict extension
|
|
5
5
|
|
|
6
|
-
Version: 5.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 5.4.0
|
|
7
|
+
Date updated: 21/03/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
# Module Package
|
|
@@ -16,10 +16,19 @@ __all__ = ["DictExt", "DictAnalyzeResult"]
|
|
|
16
16
|
# ---------------------------------------------------------------------------
|
|
17
17
|
import operator
|
|
18
18
|
from collections.abc import Callable
|
|
19
|
-
from typing import Any, NamedTuple, Self
|
|
19
|
+
from typing import Any, NamedTuple, Self, TypeVar
|
|
20
20
|
|
|
21
21
|
from absfuyu.core import ShowAllMethodsMixin, versionadded, versionchanged
|
|
22
22
|
|
|
23
|
+
# from absfuyu.typings import KT as _KT
|
|
24
|
+
# from absfuyu.typings import VT as _VT
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# Type
|
|
28
|
+
# ---------------------------------------------------------------------------
|
|
29
|
+
KT = TypeVar("KT")
|
|
30
|
+
VT = TypeVar("VT")
|
|
31
|
+
|
|
23
32
|
|
|
24
33
|
# Class
|
|
25
34
|
# ---------------------------------------------------------------------------
|
|
@@ -34,7 +43,7 @@ class DictAnalyzeResult(NamedTuple):
|
|
|
34
43
|
min_list: list
|
|
35
44
|
|
|
36
45
|
|
|
37
|
-
class DictExt(ShowAllMethodsMixin, dict):
|
|
46
|
+
class DictExt(ShowAllMethodsMixin, dict[KT, VT]):
|
|
38
47
|
"""
|
|
39
48
|
``dict`` extension
|
|
40
49
|
|
|
@@ -106,7 +115,7 @@ class DictExt(ShowAllMethodsMixin, dict):
|
|
|
106
115
|
# return self.__class__(zip(self.values(), self.keys()))
|
|
107
116
|
return self.__class__({v: k for k, v in self.items()})
|
|
108
117
|
|
|
109
|
-
def apply(self, func: Callable, apply_to_value: bool = True) -> Self:
|
|
118
|
+
def apply(self, func: Callable[[Any], Any], apply_to_value: bool = True) -> Self:
|
|
110
119
|
"""
|
|
111
120
|
Apply function to ``DictExt.keys()`` or ``DictExt.values()``
|
|
112
121
|
|
|
@@ -141,7 +150,7 @@ class DictExt(ShowAllMethodsMixin, dict):
|
|
|
141
150
|
@versionadded("3.4.0")
|
|
142
151
|
def aggregate(
|
|
143
152
|
self,
|
|
144
|
-
other_dict: dict,
|
|
153
|
+
other_dict: dict[KT, VT],
|
|
145
154
|
default_value: Any = 0,
|
|
146
155
|
operator_func: Callable[[Any, Any], Any] = operator.add, # operator add
|
|
147
156
|
) -> Self:
|
absfuyu/dxt/dxt_support.py
CHANGED
absfuyu/dxt/intext.py
CHANGED
|
@@ -3,8 +3,8 @@ Absfuyu: Data Extension
|
|
|
3
3
|
-----------------------
|
|
4
4
|
int extension
|
|
5
5
|
|
|
6
|
-
Version: 5.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 5.4.0
|
|
7
|
+
Date updated: 21/03/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
# Module Package
|
|
@@ -16,9 +16,10 @@ __all__ = ["IntExt", "Pow"]
|
|
|
16
16
|
# ---------------------------------------------------------------------------
|
|
17
17
|
import math
|
|
18
18
|
from collections import Counter
|
|
19
|
-
from typing import Any, Self
|
|
19
|
+
from typing import Any, Literal, Self, overload
|
|
20
20
|
|
|
21
|
-
from absfuyu.core import ShowAllMethodsMixin
|
|
21
|
+
from absfuyu.core.baseclass import ShowAllMethodsMixin
|
|
22
|
+
from absfuyu.core.docstring import deprecated, versionadded, versionchanged
|
|
22
23
|
from absfuyu.dxt.dxt_support import DictBoolTrue
|
|
23
24
|
|
|
24
25
|
|
|
@@ -32,20 +33,23 @@ class Pow:
|
|
|
32
33
|
self.power_by = power_by
|
|
33
34
|
|
|
34
35
|
def __str__(self) -> str:
|
|
36
|
+
return self.__repr__()
|
|
37
|
+
|
|
38
|
+
def __repr__(self) -> str:
|
|
35
39
|
if self.power_by == 1:
|
|
36
40
|
return str(self.number)
|
|
37
41
|
else:
|
|
38
42
|
return f"{self.number}^{self.power_by}"
|
|
39
43
|
# return f"{self.__class__.__name__}({self.number}, {self.power_by})"
|
|
40
44
|
|
|
41
|
-
def __repr__(self) -> str:
|
|
42
|
-
return self.__str__()
|
|
43
|
-
|
|
44
45
|
def to_list(self) -> list[int]:
|
|
45
46
|
"""
|
|
46
47
|
Convert into list
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
Returns
|
|
50
|
+
-------
|
|
51
|
+
list[int | float]
|
|
52
|
+
list
|
|
49
53
|
"""
|
|
50
54
|
return [self.number] * self.power_by # type: ignore
|
|
51
55
|
|
|
@@ -53,7 +57,10 @@ class Pow:
|
|
|
53
57
|
"""
|
|
54
58
|
Calculate the ``self.number`` to the power of ``self.power_by``
|
|
55
59
|
|
|
56
|
-
|
|
60
|
+
Returns
|
|
61
|
+
-------
|
|
62
|
+
float
|
|
63
|
+
Result
|
|
57
64
|
"""
|
|
58
65
|
# return self.number**self.power_by
|
|
59
66
|
return math.pow(self.number, self.power_by)
|
|
@@ -67,7 +74,8 @@ class IntExt(ShowAllMethodsMixin, int):
|
|
|
67
74
|
>>> IntExt.show_all_methods()
|
|
68
75
|
"""
|
|
69
76
|
|
|
70
|
-
# convert
|
|
77
|
+
# convert
|
|
78
|
+
@deprecated("5.4.0", reason="Use format(...) instead")
|
|
71
79
|
def to_binary(self) -> str:
|
|
72
80
|
"""
|
|
73
81
|
Convert to binary number
|
|
@@ -80,7 +88,7 @@ class IntExt(ShowAllMethodsMixin, int):
|
|
|
80
88
|
|
|
81
89
|
Example:
|
|
82
90
|
--------
|
|
83
|
-
>>> test =
|
|
91
|
+
>>> test = IntExt(10)
|
|
84
92
|
>>> test.to_binary()
|
|
85
93
|
'1010'
|
|
86
94
|
"""
|
|
@@ -98,7 +106,7 @@ class IntExt(ShowAllMethodsMixin, int):
|
|
|
98
106
|
|
|
99
107
|
Example:
|
|
100
108
|
--------
|
|
101
|
-
>>> test =
|
|
109
|
+
>>> test = IntExt(10)
|
|
102
110
|
>>> test.to_celcius_degree()
|
|
103
111
|
-12.222222222222221
|
|
104
112
|
"""
|
|
@@ -117,7 +125,7 @@ class IntExt(ShowAllMethodsMixin, int):
|
|
|
117
125
|
|
|
118
126
|
Example:
|
|
119
127
|
--------
|
|
120
|
-
>>> test =
|
|
128
|
+
>>> test = IntExt(10)
|
|
121
129
|
>>> test.to_fahrenheit_degree()
|
|
122
130
|
50.0
|
|
123
131
|
"""
|
|
@@ -130,13 +138,13 @@ class IntExt(ShowAllMethodsMixin, int):
|
|
|
130
138
|
|
|
131
139
|
Returns
|
|
132
140
|
-------
|
|
133
|
-
|
|
134
|
-
Reversed number
|
|
141
|
+
Self
|
|
142
|
+
Reversed number.
|
|
135
143
|
|
|
136
144
|
|
|
137
145
|
Example:
|
|
138
146
|
--------
|
|
139
|
-
>>> test =
|
|
147
|
+
>>> test = IntExt(102)
|
|
140
148
|
>>> test.reverse()
|
|
141
149
|
201
|
|
142
150
|
"""
|
|
@@ -384,13 +392,13 @@ class IntExt(ShowAllMethodsMixin, int):
|
|
|
384
392
|
|
|
385
393
|
Returns
|
|
386
394
|
-------
|
|
387
|
-
|
|
388
|
-
Least common multiple
|
|
395
|
+
Self
|
|
396
|
+
Least common multiple.
|
|
389
397
|
|
|
390
398
|
|
|
391
399
|
Example:
|
|
392
400
|
--------
|
|
393
|
-
>>> test =
|
|
401
|
+
>>> test = IntExt(102)
|
|
394
402
|
>>> test.lcm(5)
|
|
395
403
|
510
|
|
396
404
|
"""
|
|
@@ -408,13 +416,13 @@ class IntExt(ShowAllMethodsMixin, int):
|
|
|
408
416
|
|
|
409
417
|
Returns
|
|
410
418
|
-------
|
|
411
|
-
|
|
412
|
-
Greatest common divisor
|
|
419
|
+
Self
|
|
420
|
+
Greatest common divisor.
|
|
413
421
|
|
|
414
422
|
|
|
415
423
|
Example:
|
|
416
424
|
--------
|
|
417
|
-
>>> test =
|
|
425
|
+
>>> test = IntExt(1024)
|
|
418
426
|
>>> test.gcd(8)
|
|
419
427
|
8
|
|
420
428
|
"""
|
|
@@ -433,28 +441,31 @@ class IntExt(ShowAllMethodsMixin, int):
|
|
|
433
441
|
|
|
434
442
|
Returns
|
|
435
443
|
-------
|
|
436
|
-
|
|
437
|
-
|
|
444
|
+
Self
|
|
445
|
+
IntExt
|
|
438
446
|
|
|
439
447
|
|
|
440
448
|
Example:
|
|
441
449
|
--------
|
|
442
|
-
>>> test =
|
|
450
|
+
>>> test = IntExt(119)
|
|
443
451
|
>>> test.add_to_one_digit()
|
|
444
452
|
2
|
|
445
453
|
|
|
446
|
-
>>> test =
|
|
454
|
+
>>> test = IntExt(119)
|
|
447
455
|
>>> test.add_to_one_digit(master_number=True)
|
|
448
456
|
11
|
|
449
457
|
"""
|
|
458
|
+
|
|
450
459
|
number = int(self)
|
|
451
|
-
if number < 0:
|
|
460
|
+
if number < 0: # Convert positive
|
|
452
461
|
number *= -1
|
|
462
|
+
|
|
453
463
|
while len(str(number)) != 1:
|
|
454
464
|
number = sum(map(int, str(number)))
|
|
455
465
|
if master_number:
|
|
456
466
|
if number == 22 or number == 11:
|
|
457
467
|
break # Master number
|
|
468
|
+
|
|
458
469
|
return self.__class__(number)
|
|
459
470
|
|
|
460
471
|
@versionchanged("5.0.0", reason="Removed ``short_form`` parameter")
|
|
@@ -470,7 +481,7 @@ class IntExt(ShowAllMethodsMixin, int):
|
|
|
470
481
|
|
|
471
482
|
Example:
|
|
472
483
|
--------
|
|
473
|
-
>>> test =
|
|
484
|
+
>>> test = IntExt(1024)
|
|
474
485
|
>>> test.divisible_list()
|
|
475
486
|
[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]
|
|
476
487
|
"""
|
|
@@ -481,6 +492,12 @@ class IntExt(ShowAllMethodsMixin, int):
|
|
|
481
492
|
|
|
482
493
|
return divi_list
|
|
483
494
|
|
|
495
|
+
@overload
|
|
496
|
+
def prime_factor(self) -> list[Pow]: ...
|
|
497
|
+
|
|
498
|
+
@overload
|
|
499
|
+
def prime_factor(self, short_form: Literal[False] = ...) -> list[int]: ...
|
|
500
|
+
|
|
484
501
|
def prime_factor(self, short_form: bool = True) -> list[int] | list[Pow]:
|
|
485
502
|
"""
|
|
486
503
|
Prime factor
|
|
@@ -503,14 +520,15 @@ class IntExt(ShowAllMethodsMixin, int):
|
|
|
503
520
|
|
|
504
521
|
Example:
|
|
505
522
|
--------
|
|
506
|
-
>>> test =
|
|
523
|
+
>>> test = IntExt(1024)
|
|
507
524
|
>>> test.prime_factor()
|
|
508
525
|
[2^10]
|
|
509
526
|
|
|
510
|
-
>>> test =
|
|
527
|
+
>>> test = IntExt(1024)
|
|
511
528
|
>>> test.prime_factor(short_form=False)
|
|
512
529
|
[2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
|
|
513
530
|
"""
|
|
531
|
+
|
|
514
532
|
# Generate list
|
|
515
533
|
factors = []
|
|
516
534
|
divisor = 2
|
|
@@ -533,7 +551,7 @@ class IntExt(ShowAllMethodsMixin, int):
|
|
|
533
551
|
# analyze
|
|
534
552
|
def analyze(self, short_form: bool = True) -> dict[str, dict[str, Any]]:
|
|
535
553
|
"""
|
|
536
|
-
Analyze the number with almost all ``
|
|
554
|
+
Analyze the number with almost all ``IntExt`` method
|
|
537
555
|
|
|
538
556
|
Parameters
|
|
539
557
|
----------
|
|
@@ -549,7 +567,7 @@ class IntExt(ShowAllMethodsMixin, int):
|
|
|
549
567
|
|
|
550
568
|
Example:
|
|
551
569
|
--------
|
|
552
|
-
>>> test =
|
|
570
|
+
>>> test = IntExt(1024)
|
|
553
571
|
>>> test.analyze()
|
|
554
572
|
{
|
|
555
573
|
'summary': {'number': 1024, 'length': 4, 'even': True, 'prime factor': [2^10], 'divisible': [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]},
|
|
@@ -562,7 +580,7 @@ class IntExt(ShowAllMethodsMixin, int):
|
|
|
562
580
|
"number": self,
|
|
563
581
|
"length": len(str(self)),
|
|
564
582
|
"even": self.is_even(),
|
|
565
|
-
"prime factor": self.prime_factor(short_form=short_form),
|
|
583
|
+
"prime factor": self.prime_factor(short_form=short_form), # type: ignore[call-overload]
|
|
566
584
|
"divisible": self.divisible_list(),
|
|
567
585
|
},
|
|
568
586
|
"convert": {
|