absfuyu 2.8.1__py3-none-any.whl → 3.1.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 +13 -10
- absfuyu/__main__.py +55 -38
- absfuyu/config/config.json +3 -3
- absfuyu/core.py +39 -25
- absfuyu/everything.py +4 -5
- absfuyu/extensions/__init__.py +3 -2
- absfuyu/extensions/dev/__init__.py +162 -19
- absfuyu/extensions/dev/password_hash.py +11 -10
- absfuyu/extensions/dev/passwordlib.py +256 -0
- absfuyu/extensions/dev/pkglib.py +53 -57
- absfuyu/extensions/dev/project_starter.py +58 -0
- absfuyu/extensions/dev/shutdownizer.py +8 -0
- absfuyu/extensions/extra/data_analysis.py +687 -119
- absfuyu/fun/__init__.py +88 -118
- absfuyu/fun/tarot.py +32 -34
- absfuyu/game/tictactoe2.py +90 -78
- absfuyu/{collections → general}/__init__.py +14 -12
- absfuyu/{collections → general}/content.py +105 -87
- absfuyu/{collections → general}/data_extension.py +652 -172
- absfuyu/{collections → general}/generator.py +65 -4
- absfuyu/{collections → general}/human.py +28 -3
- absfuyu/pkg_data/__init__.py +14 -36
- absfuyu/pkg_data/chemistry.pkl +0 -0
- absfuyu/pkg_data/tarot.pkl +0 -0
- absfuyu/tools/converter.py +58 -31
- absfuyu/tools/obfuscator.py +4 -4
- absfuyu/tools/stats.py +4 -4
- absfuyu/tools/web.py +2 -2
- absfuyu/util/lunar.py +144 -123
- absfuyu/util/path.py +22 -3
- absfuyu/util/performance.py +101 -14
- absfuyu/version.py +93 -84
- {absfuyu-2.8.1.dist-info → absfuyu-3.1.0.dist-info}/METADATA +63 -33
- absfuyu-3.1.0.dist-info/RECORD +55 -0
- {absfuyu-2.8.1.dist-info → absfuyu-3.1.0.dist-info}/WHEEL +1 -1
- absfuyu-3.1.0.dist-info/entry_points.txt +2 -0
- absfuyu/pkg_data/chemistry.json +0 -6268
- absfuyu/pkg_data/tarot.json +0 -2593
- absfuyu-2.8.1.dist-info/RECORD +0 -52
- absfuyu-2.8.1.dist-info/entry_points.txt +0 -2
- {absfuyu-2.8.1.dist-info → absfuyu-3.1.0.dist-info}/LICENSE +0 -0
- {absfuyu-2.8.1.dist-info → absfuyu-3.1.0.dist-info}/top_level.txt +0 -0
|
@@ -3,14 +3,15 @@ Absfuyu: Generator
|
|
|
3
3
|
------------------
|
|
4
4
|
This generate stuff (Not python's ``generator``)
|
|
5
5
|
|
|
6
|
-
Version: 1.0
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 1.1.0
|
|
7
|
+
Date updated: 06/03/2024 (dd/mm/yyyy)
|
|
8
8
|
|
|
9
9
|
Features:
|
|
10
10
|
---------
|
|
11
11
|
- Generate random string
|
|
12
12
|
- Generate key
|
|
13
13
|
- Generate check digit
|
|
14
|
+
- Generate combinations of list in range
|
|
14
15
|
"""
|
|
15
16
|
|
|
16
17
|
|
|
@@ -24,10 +25,21 @@ __all__ = [
|
|
|
24
25
|
|
|
25
26
|
# Library
|
|
26
27
|
###########################################################################
|
|
28
|
+
from itertools import chain, combinations
|
|
27
29
|
from random import choice
|
|
28
30
|
import string
|
|
31
|
+
# from string import (
|
|
32
|
+
# ascii_letters as _ascii_letters,
|
|
33
|
+
# ascii_uppercase as _ascii_uppercase,
|
|
34
|
+
# ascii_lowercase as _ascii_lowercase,
|
|
35
|
+
# digits as _digits,
|
|
36
|
+
# printable as _printable,
|
|
37
|
+
# punctuation as _punctuation,
|
|
38
|
+
# )
|
|
39
|
+
from typing import List
|
|
29
40
|
|
|
30
41
|
from absfuyu.logger import logger
|
|
42
|
+
from absfuyu.util import set_max, set_min_max
|
|
31
43
|
|
|
32
44
|
|
|
33
45
|
# Class
|
|
@@ -45,10 +57,19 @@ class Charset:
|
|
|
45
57
|
SPECIAL = string.punctuation
|
|
46
58
|
ALL = string.printable
|
|
47
59
|
PRODUCT_KEY = "BCDFGHJKMNPQRTVWXY2346789" # Charset that various key makers use
|
|
60
|
+
# DEFAULT = _ascii_letters + _digits
|
|
61
|
+
# ALPHABET = _ascii_letters
|
|
62
|
+
# FULL = _ascii_letters + _digits + _punctuation
|
|
63
|
+
# UPPERCASE = _ascii_uppercase
|
|
64
|
+
# LOWERCASE = _ascii_lowercase
|
|
65
|
+
# DIGIT = _digits
|
|
66
|
+
# SPECIAL = _punctuation
|
|
67
|
+
# ALL = _printable
|
|
48
68
|
|
|
49
69
|
def __str__(self) -> str:
|
|
50
70
|
charset = [x for x in __class__.__dict__.keys() if not x.startswith("__")]
|
|
51
|
-
return f"List of
|
|
71
|
+
return f"List of Character set: {charset}"
|
|
72
|
+
|
|
52
73
|
def __repr__(self) -> str:
|
|
53
74
|
return self.__str__()
|
|
54
75
|
|
|
@@ -258,8 +279,48 @@ class Generator:
|
|
|
258
279
|
logger.debug(f"Output: {out}")
|
|
259
280
|
return out
|
|
260
281
|
|
|
282
|
+
@staticmethod
|
|
283
|
+
def combinations_range(sequence: list, *, min_len: int = 1, max_len: int = 0) -> List[tuple]:
|
|
284
|
+
"""
|
|
285
|
+
Generate all combinations of a ``sequence`` from ``min_len`` to ``max_len``
|
|
286
|
+
|
|
287
|
+
Parameters
|
|
288
|
+
----------
|
|
289
|
+
sequence : list
|
|
290
|
+
A sequence that need to generate combination
|
|
291
|
+
|
|
292
|
+
min_len : int
|
|
293
|
+
Minimum ``r`` of ``combinations``
|
|
294
|
+
(Default: ``1``)
|
|
295
|
+
|
|
296
|
+
max_len : int
|
|
297
|
+
Maximum ``r`` of ``combinations``
|
|
298
|
+
(Default: ``0`` - len of ``sequence``)
|
|
299
|
+
|
|
300
|
+
Returns
|
|
301
|
+
-------
|
|
302
|
+
list[tuple]
|
|
303
|
+
A list of all combinations from range(``min_len``, ``max_len``) of ``sequence``
|
|
304
|
+
"""
|
|
305
|
+
# Restrain
|
|
306
|
+
if max_len < 1:
|
|
307
|
+
max_len = len(sequence)
|
|
308
|
+
max_len = set_max(max_len, max_value=len(sequence))
|
|
309
|
+
min_len = set_min_max(min_len, min_value=1, max_value=max_len)
|
|
310
|
+
logger.debug(f"Combination range: [{min_len}, {max_len}]")
|
|
311
|
+
|
|
312
|
+
# Return
|
|
313
|
+
return list(
|
|
314
|
+
chain.from_iterable(
|
|
315
|
+
[
|
|
316
|
+
list(combinations(sequence, i))
|
|
317
|
+
for i in range(min_len, max_len + 1)
|
|
318
|
+
]
|
|
319
|
+
)
|
|
320
|
+
)
|
|
321
|
+
|
|
261
322
|
|
|
262
323
|
# Run
|
|
263
324
|
###########################################################################
|
|
264
325
|
if __name__ == "__main__":
|
|
265
|
-
logger.setLevel(10) # DEBUG
|
|
326
|
+
logger.setLevel(10) # DEBUG
|
|
@@ -3,8 +3,8 @@ Absfuyu: Human
|
|
|
3
3
|
--------------
|
|
4
4
|
Human related stuff
|
|
5
5
|
|
|
6
|
-
Version: 1.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 1.3.0
|
|
7
|
+
Date updated: 08/12/2023 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
|
|
@@ -22,12 +22,37 @@ from typing import Optional, Union
|
|
|
22
22
|
|
|
23
23
|
from dateutil.relativedelta import relativedelta
|
|
24
24
|
|
|
25
|
-
from absfuyu.
|
|
25
|
+
from absfuyu.general.data_extension import IntNumber
|
|
26
26
|
from absfuyu.fun import zodiac_sign
|
|
27
27
|
# from absfuyu.util import set_min_max
|
|
28
28
|
from absfuyu.version import Version
|
|
29
29
|
|
|
30
30
|
|
|
31
|
+
# Sub-Class
|
|
32
|
+
###########################################################################
|
|
33
|
+
class _FloatBase:
|
|
34
|
+
"""To show some unit"""
|
|
35
|
+
|
|
36
|
+
def __init__(self, value: float) -> None:
|
|
37
|
+
self.value = value
|
|
38
|
+
|
|
39
|
+
def __str__(self) -> str:
|
|
40
|
+
return self.value.__str__()
|
|
41
|
+
|
|
42
|
+
def to_float(self) -> float:
|
|
43
|
+
return float(self.value)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class _Height(_FloatBase):
|
|
47
|
+
def __repr__(self) -> str:
|
|
48
|
+
return f"{self.value:.2f} cm"
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class _Weight(_FloatBase):
|
|
52
|
+
def __repr__(self) -> str:
|
|
53
|
+
return f"{self.value:.2f} kg"
|
|
54
|
+
|
|
55
|
+
|
|
31
56
|
# Class
|
|
32
57
|
###########################################################################
|
|
33
58
|
class BloodType:
|
absfuyu/pkg_data/__init__.py
CHANGED
|
@@ -3,8 +3,8 @@ Absfuyu: Package data
|
|
|
3
3
|
---------------------
|
|
4
4
|
Load package data
|
|
5
5
|
|
|
6
|
-
Version: 2.2.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 2.2.2
|
|
7
|
+
Date updated: 30/11/2023 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
|
|
@@ -22,42 +22,20 @@ from importlib.resources import read_binary
|
|
|
22
22
|
from pathlib import Path
|
|
23
23
|
from typing import List, Union
|
|
24
24
|
import zlib
|
|
25
|
+
import sys
|
|
26
|
+
|
|
27
|
+
if sys.version_info.minor >= 10:
|
|
28
|
+
from importlib.resources import files
|
|
29
|
+
else:
|
|
30
|
+
try:
|
|
31
|
+
from importlib_resources import files
|
|
32
|
+
except:
|
|
33
|
+
raise ImportError("Please install importlib-resources")
|
|
25
34
|
|
|
26
35
|
from absfuyu.core import DATA_PATH
|
|
27
36
|
from absfuyu.logger import logger
|
|
28
37
|
|
|
29
38
|
|
|
30
|
-
# Legacy - depreciated
|
|
31
|
-
###########################################################################
|
|
32
|
-
def __data_validate(data_name: str) -> bool:
|
|
33
|
-
"""Validate if data exist"""
|
|
34
|
-
DATA_LIST = [
|
|
35
|
-
"dummy", "punishment_windows",
|
|
36
|
-
]
|
|
37
|
-
if data_name not in DATA_LIST:
|
|
38
|
-
return False
|
|
39
|
-
else:
|
|
40
|
-
return True
|
|
41
|
-
|
|
42
|
-
def __load_data_string(data_name: str):
|
|
43
|
-
"""Load data and convert into string"""
|
|
44
|
-
data = read_binary("absfuyu.pkg_data", f"{data_name}.dat")
|
|
45
|
-
decompressed_data = zlib.decompress(data).decode()
|
|
46
|
-
return decompressed_data
|
|
47
|
-
|
|
48
|
-
def __data_string_to_list(data_string: str):
|
|
49
|
-
"""Convert data to list"""
|
|
50
|
-
data = literal_eval(data_string)
|
|
51
|
-
return data
|
|
52
|
-
|
|
53
|
-
def loadData(data_name: str):
|
|
54
|
-
"""Load data"""
|
|
55
|
-
if __data_validate(data_name):
|
|
56
|
-
return __data_string_to_list(__load_data_string(data_name))
|
|
57
|
-
else:
|
|
58
|
-
return None
|
|
59
|
-
|
|
60
|
-
|
|
61
39
|
# External Data
|
|
62
40
|
###########################################################################
|
|
63
41
|
_EXTERNAL_DATA = {
|
|
@@ -70,9 +48,9 @@ _EXTERNAL_DATA = {
|
|
|
70
48
|
|
|
71
49
|
# Class
|
|
72
50
|
###########################################################################
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
51
|
+
class DataList:
|
|
52
|
+
CHEMISTRY = files("absfuyu.pkg_data").joinpath("chemistry.pkl")
|
|
53
|
+
TAROT = files("absfuyu.pkg_data").joinpath("tarot.pkl")
|
|
76
54
|
|
|
77
55
|
|
|
78
56
|
class PkgData:
|
|
Binary file
|
|
Binary file
|
absfuyu/tools/converter.py
CHANGED
|
@@ -3,42 +3,58 @@ Absufyu: Converter
|
|
|
3
3
|
------------------
|
|
4
4
|
Convert stuff
|
|
5
5
|
|
|
6
|
-
Version: 1.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 1.2.1
|
|
7
|
+
Date updated: 30/11/2023 (dd/mm/yyyy)
|
|
8
8
|
|
|
9
9
|
Feature:
|
|
10
10
|
--------
|
|
11
11
|
- Text2Chemistry
|
|
12
12
|
- Str2Pixel
|
|
13
|
+
- Base64EncodeDecode
|
|
13
14
|
"""
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
# Module level
|
|
17
18
|
###########################################################################
|
|
18
19
|
__all__ = [
|
|
19
|
-
"Text2Chemistry", "Str2Pixel"
|
|
20
|
+
"Text2Chemistry", "Str2Pixel", "Base64EncodeDecode"
|
|
20
21
|
]
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
# Library
|
|
24
25
|
###########################################################################
|
|
26
|
+
import base64
|
|
25
27
|
from itertools import combinations, chain
|
|
26
28
|
import math
|
|
27
29
|
import re
|
|
28
30
|
import string
|
|
29
|
-
from typing import List, Union
|
|
31
|
+
from typing import Dict, List, Union
|
|
30
32
|
|
|
31
|
-
from absfuyu.core import
|
|
33
|
+
from absfuyu.core import CLITextColor
|
|
32
34
|
from absfuyu.logger import logger
|
|
33
|
-
from absfuyu.pkg_data import
|
|
35
|
+
from absfuyu.pkg_data import DataList
|
|
34
36
|
from absfuyu.util import set_min
|
|
35
|
-
from absfuyu.util.
|
|
37
|
+
from absfuyu.util.pkl import Pickler
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
# Class
|
|
39
41
|
###########################################################################
|
|
42
|
+
class Base64EncodeDecode:
|
|
43
|
+
"""
|
|
44
|
+
Encode and decode base64
|
|
45
|
+
"""
|
|
46
|
+
@staticmethod
|
|
47
|
+
def encode(data: str) -> str:
|
|
48
|
+
return base64.b64encode(data.encode()).decode()
|
|
49
|
+
|
|
50
|
+
@staticmethod
|
|
51
|
+
def decode(data: str) -> str:
|
|
52
|
+
return base64.b64decode(data).decode()
|
|
53
|
+
|
|
54
|
+
|
|
40
55
|
class ChemistryElement:
|
|
41
56
|
"""Chemistry Element"""
|
|
57
|
+
_VERSION = (1, 1, 0)
|
|
42
58
|
def __init__(
|
|
43
59
|
self,
|
|
44
60
|
name: str,
|
|
@@ -61,39 +77,50 @@ class ChemistryElement:
|
|
|
61
77
|
def __repr__(self) -> str:
|
|
62
78
|
# return self.symbol
|
|
63
79
|
return f"{self.__class__.__name__}({self.symbol})"
|
|
80
|
+
|
|
81
|
+
def to_dict(self) -> Dict[str, Union[str, int, float]]:
|
|
82
|
+
"""
|
|
83
|
+
Output content to dict
|
|
84
|
+
|
|
85
|
+
:rtype: dict[str, str | int | float]
|
|
86
|
+
"""
|
|
87
|
+
return {
|
|
88
|
+
"name": self.name,
|
|
89
|
+
"number": self.number,
|
|
90
|
+
"symbol": self.symbol,
|
|
91
|
+
"atomic_mass": self.atomic_mass
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@classmethod
|
|
95
|
+
def from_dict(cls, data: Dict[str, Union[str, int, float]]) -> "ChemistryElement":
|
|
96
|
+
"""
|
|
97
|
+
Convert from ``dict`` data
|
|
98
|
+
|
|
99
|
+
:param data: Dict data
|
|
100
|
+
:type data: dict[str, str | int | float]
|
|
101
|
+
:rtype: ChemistryElement
|
|
102
|
+
"""
|
|
103
|
+
return cls(
|
|
104
|
+
name=data["name"],
|
|
105
|
+
number=int(data["number"]),
|
|
106
|
+
symbol=data["symbol"],
|
|
107
|
+
atomic_mass=float(data["atomic_mass"])
|
|
108
|
+
)
|
|
64
109
|
|
|
65
110
|
class Text2Chemistry:
|
|
66
111
|
def __init__(self) -> None:
|
|
67
|
-
self.
|
|
68
|
-
_EXTERNAL_DATA.get("chemistry.json"),
|
|
69
|
-
encoding="utf-8"
|
|
70
|
-
)
|
|
71
|
-
self.data_location = DATA_PATH.joinpath("chemistry.json")
|
|
112
|
+
self.data_location = DataList.CHEMISTRY
|
|
72
113
|
def __str__(self) -> str:
|
|
73
114
|
return f"{self.__class__.__name__}()"
|
|
74
115
|
def __repr__(self) -> str:
|
|
75
116
|
return self.__str__()
|
|
76
117
|
|
|
77
|
-
def _load_chemistry_data(self
|
|
118
|
+
def _load_chemistry_data(self) -> List[ChemistryElement]:
|
|
78
119
|
"""
|
|
79
|
-
Load chemistry
|
|
80
|
-
|
|
81
|
-
update: Refresh the cache (Default: ``False``)
|
|
120
|
+
Load chemistry pickle data
|
|
82
121
|
"""
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
json_cache=self.data_location
|
|
86
|
-
)
|
|
87
|
-
elements = json_data["elements"]
|
|
88
|
-
logger.debug(f"{len(elements)} elements loaded")
|
|
89
|
-
return [
|
|
90
|
-
ChemistryElement(
|
|
91
|
-
name=element["name"],
|
|
92
|
-
number=int(element["number"]),
|
|
93
|
-
symbol=element["symbol"],
|
|
94
|
-
atomic_mass=float(element["atomic_mass"])
|
|
95
|
-
) for element in elements
|
|
96
|
-
]
|
|
122
|
+
data: List[dict] = Pickler.load(self.data_location)
|
|
123
|
+
return [ChemistryElement.from_dict(x) for x in data]
|
|
97
124
|
|
|
98
125
|
@property
|
|
99
126
|
def unvailable_characters(self):
|
|
@@ -261,4 +288,4 @@ class Str2Pixel:
|
|
|
261
288
|
# Run
|
|
262
289
|
###########################################################################
|
|
263
290
|
if __name__ == "__main__":
|
|
264
|
-
logger.setLevel(10)
|
|
291
|
+
logger.setLevel(10)
|
absfuyu/tools/obfuscator.py
CHANGED
|
@@ -3,8 +3,8 @@ Absfuyu: Obfuscator
|
|
|
3
3
|
-------------------
|
|
4
4
|
Obfuscate code
|
|
5
5
|
|
|
6
|
-
Version: 2.0.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 2.0.1
|
|
7
|
+
Date updated: 26/11/2023 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
|
|
@@ -23,8 +23,8 @@ import random
|
|
|
23
23
|
import zlib
|
|
24
24
|
|
|
25
25
|
from absfuyu.logger import logger
|
|
26
|
-
from absfuyu.
|
|
27
|
-
from absfuyu.
|
|
26
|
+
from absfuyu.general.generator import Generator as gen, Charset
|
|
27
|
+
from absfuyu.general.data_extension import Text
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
# Class
|
absfuyu/tools/stats.py
CHANGED
|
@@ -3,8 +3,8 @@ Absfuyu: Stats
|
|
|
3
3
|
--------------
|
|
4
4
|
List's stats
|
|
5
5
|
|
|
6
|
-
Version: 2.0.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 2.0.3
|
|
7
|
+
Date updated: 26/11/2023 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
|
|
@@ -20,7 +20,7 @@ __all__ = [
|
|
|
20
20
|
import math
|
|
21
21
|
from typing import List, Union
|
|
22
22
|
|
|
23
|
-
from absfuyu.
|
|
23
|
+
from absfuyu.general.data_extension import ListExt
|
|
24
24
|
from absfuyu.logger import logger
|
|
25
25
|
|
|
26
26
|
|
|
@@ -92,7 +92,7 @@ class ListStats(List[Union[int, float]]):
|
|
|
92
92
|
[1]
|
|
93
93
|
"""
|
|
94
94
|
lst = self
|
|
95
|
-
frequency =
|
|
95
|
+
frequency = ListExt(lst).freq()
|
|
96
96
|
|
|
97
97
|
max_val = max(frequency.values())
|
|
98
98
|
keys = []
|
absfuyu/tools/web.py
CHANGED
|
@@ -45,7 +45,7 @@ def soup_link(link: str) -> BeautifulSoup:
|
|
|
45
45
|
def gen_random_commit_msg() -> str:
|
|
46
46
|
"""
|
|
47
47
|
Generate random commit message
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
:returns: Random commit message
|
|
50
50
|
:rtype: str
|
|
51
51
|
"""
|
|
@@ -58,4 +58,4 @@ def gen_random_commit_msg() -> str:
|
|
|
58
58
|
###########################################################################
|
|
59
59
|
if __name__ == "__main__":
|
|
60
60
|
logger.setLevel(10)
|
|
61
|
-
gen_random_commit_msg()
|
|
61
|
+
gen_random_commit_msg()
|