absfuyu 3.1.1__py3-none-any.whl → 3.3.3__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 +3 -10
- absfuyu/__main__.py +5 -250
- absfuyu/cli/__init__.py +51 -0
- absfuyu/cli/color.py +24 -0
- absfuyu/cli/config_group.py +56 -0
- absfuyu/cli/do_group.py +76 -0
- absfuyu/cli/game_group.py +109 -0
- absfuyu/config/__init__.py +117 -100
- absfuyu/config/config.json +0 -7
- absfuyu/core.py +5 -66
- absfuyu/everything.py +7 -9
- absfuyu/extensions/beautiful.py +30 -23
- absfuyu/extensions/dev/__init__.py +11 -8
- absfuyu/extensions/dev/password_hash.py +4 -2
- absfuyu/extensions/dev/passwordlib.py +7 -5
- absfuyu/extensions/dev/project_starter.py +4 -2
- absfuyu/extensions/dev/shutdownizer.py +148 -0
- absfuyu/extensions/extra/__init__.py +1 -2
- absfuyu/extensions/extra/data_analysis.py +182 -107
- absfuyu/fun/WGS.py +50 -26
- absfuyu/fun/__init__.py +6 -7
- absfuyu/fun/tarot.py +1 -1
- absfuyu/game/__init__.py +75 -81
- absfuyu/game/game_stat.py +36 -0
- absfuyu/game/sudoku.py +41 -48
- absfuyu/game/tictactoe.py +303 -548
- absfuyu/game/wordle.py +56 -47
- absfuyu/general/__init__.py +17 -7
- absfuyu/general/content.py +16 -15
- absfuyu/general/data_extension.py +282 -90
- absfuyu/general/generator.py +67 -67
- absfuyu/general/human.py +74 -78
- absfuyu/logger.py +94 -68
- absfuyu/pkg_data/__init__.py +29 -25
- absfuyu/py.typed +0 -0
- absfuyu/sort.py +61 -47
- absfuyu/tools/__init__.py +0 -1
- absfuyu/tools/converter.py +80 -62
- absfuyu/tools/keygen.py +62 -67
- absfuyu/tools/obfuscator.py +57 -53
- absfuyu/tools/stats.py +24 -24
- absfuyu/tools/web.py +10 -9
- absfuyu/util/__init__.py +71 -33
- absfuyu/util/api.py +53 -43
- absfuyu/util/json_method.py +25 -27
- absfuyu/util/lunar.py +20 -24
- absfuyu/util/path.py +362 -241
- absfuyu/util/performance.py +217 -135
- absfuyu/util/pkl.py +8 -8
- absfuyu/util/zipped.py +17 -19
- absfuyu/version.py +160 -147
- absfuyu-3.3.3.dist-info/METADATA +124 -0
- absfuyu-3.3.3.dist-info/RECORD +59 -0
- {absfuyu-3.1.1.dist-info → absfuyu-3.3.3.dist-info}/WHEEL +1 -2
- {absfuyu-3.1.1.dist-info → absfuyu-3.3.3.dist-info}/entry_points.txt +1 -0
- {absfuyu-3.1.1.dist-info → absfuyu-3.3.3.dist-info/licenses}/LICENSE +1 -1
- absfuyu/extensions/dev/pkglib.py +0 -98
- absfuyu/game/tictactoe2.py +0 -318
- absfuyu-3.1.1.dist-info/METADATA +0 -215
- absfuyu-3.1.1.dist-info/RECORD +0 -55
- absfuyu-3.1.1.dist-info/top_level.txt +0 -1
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
# type: ignore
|
|
2
|
+
# flake8: noqa
|
|
3
|
+
|
|
1
4
|
"""
|
|
2
5
|
Absfuyu: Development
|
|
3
|
-
|
|
4
|
-
Some stuffs that are not ready to use yet
|
|
6
|
+
--------------------
|
|
7
|
+
Some stuffs that are not ready to use yet.
|
|
8
|
+
Use at your own risk, everything is subject to change
|
|
5
9
|
|
|
6
10
|
Version: 2.0.0
|
|
7
11
|
Date updated: 23/11/2023 (dd/mm/yyyy)
|
|
8
12
|
"""
|
|
9
13
|
|
|
10
|
-
|
|
11
14
|
# Module level
|
|
12
15
|
###########################################################################
|
|
13
16
|
__all__ = [
|
|
@@ -19,10 +22,10 @@ __all__ = [
|
|
|
19
22
|
# Library
|
|
20
23
|
###########################################################################
|
|
21
24
|
import base64
|
|
25
|
+
import re
|
|
22
26
|
from collections import deque
|
|
23
27
|
from functools import lru_cache
|
|
24
|
-
import
|
|
25
|
-
from typing import Dict, TypedDict, Final, List, NamedTuple
|
|
28
|
+
from typing import Dict, Final, List, NamedTuple
|
|
26
29
|
|
|
27
30
|
|
|
28
31
|
# PASSWORD CHECKER
|
|
@@ -113,7 +116,7 @@ def load_toml_file(toml_file: str):
|
|
|
113
116
|
|
|
114
117
|
if _python_version.minor < 11:
|
|
115
118
|
try:
|
|
116
|
-
import tomli as tomllib
|
|
119
|
+
import tomli as tomllib # type: ignore
|
|
117
120
|
except ImportError:
|
|
118
121
|
raise ImportError("Please install tomli python package")
|
|
119
122
|
except:
|
|
@@ -128,6 +131,7 @@ def load_toml_file(toml_file: str):
|
|
|
128
131
|
|
|
129
132
|
def get_sitemap(url: str):
|
|
130
133
|
import re
|
|
134
|
+
|
|
131
135
|
import requests
|
|
132
136
|
|
|
133
137
|
class Url(NamedTuple):
|
|
@@ -161,6 +165,7 @@ def get_sitemap(url: str):
|
|
|
161
165
|
|
|
162
166
|
from absfuyu.general import ClassBase
|
|
163
167
|
|
|
168
|
+
|
|
164
169
|
class SimpleStrEncrypt(ClassBase):
|
|
165
170
|
"""
|
|
166
171
|
Simple Encryption
|
|
@@ -231,8 +236,6 @@ class SimpleStrEncrypt(ClassBase):
|
|
|
231
236
|
return data
|
|
232
237
|
|
|
233
238
|
|
|
234
|
-
|
|
235
|
-
|
|
236
239
|
# testing
|
|
237
240
|
CON_VAR: Final[List[str]] = ["a", "b"] # Declare as final
|
|
238
241
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
# type: ignore
|
|
2
|
+
# flake8: noqa
|
|
3
|
+
|
|
1
4
|
# Library
|
|
2
5
|
##############################################################
|
|
3
6
|
import hashlib as __hash
|
|
4
7
|
import os as __os
|
|
5
8
|
from typing import Dict as __Dict
|
|
9
|
+
from typing import NewType as __NewType
|
|
6
10
|
from typing import TypeVar as __TypeVar
|
|
7
11
|
from typing import Union as __Union
|
|
8
|
-
from typing import NewType as __NewType
|
|
9
|
-
|
|
10
12
|
|
|
11
13
|
# Define type
|
|
12
14
|
##############################################################
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# type: ignore
|
|
2
|
+
# flake8: noqa
|
|
3
|
+
|
|
1
4
|
"""
|
|
2
5
|
Absfuyu: Passwordlib
|
|
3
6
|
--------------------
|
|
@@ -7,7 +10,6 @@ Version: 1.0.0dev1
|
|
|
7
10
|
Date updated: 30/11/2023 (dd/mm/yyyy)
|
|
8
11
|
"""
|
|
9
12
|
|
|
10
|
-
|
|
11
13
|
# Library
|
|
12
14
|
###########################################################################
|
|
13
15
|
# from collections import namedtuple
|
|
@@ -15,13 +17,13 @@ import hashlib
|
|
|
15
17
|
import os
|
|
16
18
|
import random
|
|
17
19
|
import re
|
|
18
|
-
from typing import List,
|
|
20
|
+
from typing import List, Optional
|
|
19
21
|
|
|
20
22
|
from absfuyu_res import DATA
|
|
21
23
|
|
|
22
|
-
from absfuyu.logger import logger
|
|
23
24
|
from absfuyu.general.data_extension import DictExt, Text
|
|
24
|
-
from absfuyu.general.generator import
|
|
25
|
+
from absfuyu.general.generator import Charset, Generator
|
|
26
|
+
from absfuyu.logger import logger
|
|
25
27
|
from absfuyu.util import set_min
|
|
26
28
|
from absfuyu.util.pkl import Pickler
|
|
27
29
|
|
|
@@ -237,7 +239,7 @@ class Password:
|
|
|
237
239
|
if first_letter_cap:
|
|
238
240
|
value = value.title()
|
|
239
241
|
if include_number:
|
|
240
|
-
value += str(random.choice(range(
|
|
242
|
+
value += str(random.choice(range(10)))
|
|
241
243
|
return value
|
|
242
244
|
|
|
243
245
|
if not block_divider:
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# type: ignore
|
|
2
|
+
# flake8: noqa
|
|
3
|
+
|
|
1
4
|
"""
|
|
2
5
|
Absfuyu: Project starter
|
|
3
6
|
------------------------
|
|
@@ -6,7 +9,6 @@ Version: 1.0.0dev1
|
|
|
6
9
|
Date updated: 01/12/2023 (dd/mm/yyyy)
|
|
7
10
|
"""
|
|
8
11
|
|
|
9
|
-
|
|
10
12
|
# Module level
|
|
11
13
|
###########################################################################
|
|
12
14
|
__all__ = ["get_parser"]
|
|
@@ -14,7 +16,7 @@ __all__ = ["get_parser"]
|
|
|
14
16
|
|
|
15
17
|
# Library
|
|
16
18
|
###########################################################################
|
|
17
|
-
from argparse import
|
|
19
|
+
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
|
|
18
20
|
from typing import Optional
|
|
19
21
|
|
|
20
22
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# type: ignore
|
|
2
|
+
# flake8: noqa
|
|
3
|
+
|
|
1
4
|
"""
|
|
2
5
|
Absfuyu: Shutdownizer
|
|
3
6
|
---------------------
|
|
@@ -6,3 +9,148 @@ This shutdowns
|
|
|
6
9
|
Version: 1.0.0dev
|
|
7
10
|
Date updated: 27/11/2023 (dd/mm/yyyy)
|
|
8
11
|
"""
|
|
12
|
+
|
|
13
|
+
# Module level
|
|
14
|
+
###########################################################################
|
|
15
|
+
__all__ = ["ShutDownizer"]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# Library
|
|
19
|
+
###########################################################################
|
|
20
|
+
import datetime
|
|
21
|
+
import os
|
|
22
|
+
import random
|
|
23
|
+
import subprocess
|
|
24
|
+
import sys
|
|
25
|
+
from pathlib import Path
|
|
26
|
+
|
|
27
|
+
from absfuyu.logger import LogLevel, logger
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# Class
|
|
31
|
+
###########################################################################
|
|
32
|
+
class Dummy:
|
|
33
|
+
def __init__(self) -> None:
|
|
34
|
+
pass
|
|
35
|
+
|
|
36
|
+
def __str__(self) -> str:
|
|
37
|
+
return f"{self.__class__.__name__}()"
|
|
38
|
+
|
|
39
|
+
def __repr__(self) -> str:
|
|
40
|
+
return self.__str__()
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class ShutDownizer(Dummy):
|
|
44
|
+
"""
|
|
45
|
+
ShutDownizer
|
|
46
|
+
|
|
47
|
+
Shutdown tool because why not
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
def __init__(self) -> None:
|
|
51
|
+
"""doc_string"""
|
|
52
|
+
self.os: str = sys.platform
|
|
53
|
+
logger.debug(f"Current OS: {self.os}")
|
|
54
|
+
|
|
55
|
+
if self.os in ["win32", "cygwin"]: # Windows
|
|
56
|
+
self.engine = ShutDownizerWin()
|
|
57
|
+
elif self.os == "darwin": # MacOS
|
|
58
|
+
self.engine = ShutDownizerMac()
|
|
59
|
+
elif self.os == "linux": # Linux
|
|
60
|
+
self.engine = ShutDownizerLinux()
|
|
61
|
+
else: # Other (probably linux)
|
|
62
|
+
self.engine = ShutDownizerLinux()
|
|
63
|
+
|
|
64
|
+
def __str__(self) -> str:
|
|
65
|
+
return f"{self.__class__.__name__}({self.os})"
|
|
66
|
+
|
|
67
|
+
def shutdown(self):
|
|
68
|
+
"""Shutdown"""
|
|
69
|
+
self.engine.shutdown()
|
|
70
|
+
|
|
71
|
+
def restart(self):
|
|
72
|
+
"""Restart"""
|
|
73
|
+
self.engine.restart()
|
|
74
|
+
|
|
75
|
+
def cancel(self):
|
|
76
|
+
"""Cancel"""
|
|
77
|
+
self.engine.cancel()
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class ShutDownizerEngine(Dummy):
|
|
81
|
+
"""
|
|
82
|
+
Abstract class for different type of OS
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
def __init__(self) -> None:
|
|
86
|
+
self.shutdown_cmd = ""
|
|
87
|
+
self.restart_cmd = ""
|
|
88
|
+
self.cancel_cmd = ""
|
|
89
|
+
|
|
90
|
+
def _excute_cmd(self, cmd) -> None:
|
|
91
|
+
"""Execute the cmd"""
|
|
92
|
+
try:
|
|
93
|
+
if isinstance(cmd, str):
|
|
94
|
+
subprocess.run(cmd.split())
|
|
95
|
+
elif isinstance(cmd, list):
|
|
96
|
+
subprocess.run(cmd)
|
|
97
|
+
else:
|
|
98
|
+
logger.error(f'"{cmd}" failed to run')
|
|
99
|
+
except:
|
|
100
|
+
logger.error(f'"{cmd}" failed to run')
|
|
101
|
+
|
|
102
|
+
def shutdown(self):
|
|
103
|
+
"""Shutdown"""
|
|
104
|
+
try:
|
|
105
|
+
self._excute_cmd(self.shutdown_cmd)
|
|
106
|
+
except:
|
|
107
|
+
pass
|
|
108
|
+
|
|
109
|
+
def restart(self):
|
|
110
|
+
"""Restart"""
|
|
111
|
+
self._excute_cmd(self.restart_cmd)
|
|
112
|
+
|
|
113
|
+
def cancel(self):
|
|
114
|
+
"""Cancel shutdown/restart"""
|
|
115
|
+
self._excute_cmd(self.cancel_cmd)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class ShutDownizerWin(ShutDownizerEngine):
|
|
119
|
+
"""ShutDownizer - Windows"""
|
|
120
|
+
|
|
121
|
+
def __init__(self) -> None:
|
|
122
|
+
self.shutdown_cmd = "shutdown -f -s -t 0"
|
|
123
|
+
self.cancel_cmd = "shutdown -a"
|
|
124
|
+
|
|
125
|
+
def _punish(self):
|
|
126
|
+
"""Create a `batch` script that shut down computer when boot up"""
|
|
127
|
+
try:
|
|
128
|
+
startup_folder_win = Path(os.getenv("appdata")).joinpath(
|
|
129
|
+
"Microsoft", "Windows", "Start Menu", "Programs", "Startup"
|
|
130
|
+
)
|
|
131
|
+
with open(startup_folder_win.joinpath("system.bat"), "w") as f:
|
|
132
|
+
f.write(self.shutdown_cmd)
|
|
133
|
+
except:
|
|
134
|
+
logger.error("Cannot write file to startup folder")
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class ShutDownizerMac(ShutDownizerEngine):
|
|
138
|
+
"""ShutDownizer - MacOS"""
|
|
139
|
+
|
|
140
|
+
def __init__(self) -> None:
|
|
141
|
+
self.shutdown_cmd = ["osascript", "-e", 'tell app "System Events" to shut down']
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
class ShutDownizerLinux(ShutDownizerEngine):
|
|
145
|
+
"""ShutDownizer - Linux"""
|
|
146
|
+
|
|
147
|
+
def __init__(self) -> None:
|
|
148
|
+
self.shutdown_cmd = "shutdown -h now"
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
# Run
|
|
152
|
+
###########################################################################
|
|
153
|
+
if __name__ == "__main__":
|
|
154
|
+
logger.setLevel(LogLevel.DEBUG)
|
|
155
|
+
test = ShutDownizer()
|
|
156
|
+
print(ShutDownizerLinux().shutdown())
|
|
@@ -18,8 +18,7 @@ Date updated: 24/11/2023 (dd/mm/yyyy)
|
|
|
18
18
|
# Function
|
|
19
19
|
###########################################################################
|
|
20
20
|
|
|
21
|
-
|
|
22
21
|
# Run
|
|
23
22
|
###########################################################################
|
|
24
23
|
if __name__ == "__main__":
|
|
25
|
-
pass
|
|
24
|
+
pass
|