absfuyu 5.0.0__py3-none-any.whl → 6.1.2__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 +5 -3
- absfuyu/__main__.py +3 -3
- absfuyu/cli/__init__.py +13 -2
- absfuyu/cli/audio_group.py +98 -0
- absfuyu/cli/color.py +30 -14
- absfuyu/cli/config_group.py +9 -2
- absfuyu/cli/do_group.py +23 -6
- absfuyu/cli/game_group.py +27 -2
- absfuyu/cli/tool_group.py +81 -11
- absfuyu/config/__init__.py +3 -3
- absfuyu/core/__init__.py +12 -8
- absfuyu/core/baseclass.py +929 -96
- absfuyu/core/baseclass2.py +44 -3
- absfuyu/core/decorator.py +70 -4
- absfuyu/core/docstring.py +64 -41
- absfuyu/core/dummy_cli.py +3 -3
- absfuyu/core/dummy_func.py +19 -6
- absfuyu/dxt/__init__.py +2 -2
- absfuyu/dxt/base_type.py +93 -0
- absfuyu/dxt/dictext.py +204 -16
- absfuyu/dxt/dxt_support.py +2 -2
- absfuyu/dxt/intext.py +151 -34
- absfuyu/dxt/listext.py +969 -127
- absfuyu/dxt/strext.py +77 -17
- absfuyu/extra/__init__.py +2 -2
- absfuyu/extra/audio/__init__.py +8 -0
- absfuyu/extra/audio/_util.py +57 -0
- absfuyu/extra/audio/convert.py +192 -0
- absfuyu/extra/audio/lossless.py +281 -0
- absfuyu/extra/beautiful.py +3 -2
- absfuyu/extra/da/__init__.py +72 -0
- absfuyu/extra/da/dadf.py +1600 -0
- absfuyu/extra/da/dadf_base.py +186 -0
- absfuyu/extra/da/df_func.py +181 -0
- absfuyu/extra/da/mplt.py +219 -0
- absfuyu/extra/ggapi/__init__.py +8 -0
- absfuyu/extra/ggapi/gdrive.py +223 -0
- absfuyu/extra/ggapi/glicense.py +148 -0
- absfuyu/extra/ggapi/glicense_df.py +186 -0
- absfuyu/extra/ggapi/gsheet.py +88 -0
- absfuyu/extra/img/__init__.py +30 -0
- absfuyu/extra/img/converter.py +402 -0
- absfuyu/extra/img/dup_check.py +291 -0
- absfuyu/extra/pdf.py +87 -0
- absfuyu/extra/rclone.py +253 -0
- absfuyu/extra/xml.py +90 -0
- absfuyu/fun/__init__.py +7 -20
- 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/schulte.py +78 -0
- absfuyu/game/sudoku.py +2 -2
- absfuyu/game/tictactoe.py +2 -3
- absfuyu/game/wordle.py +6 -4
- absfuyu/general/__init__.py +4 -4
- absfuyu/general/content.py +4 -4
- absfuyu/general/human.py +2 -2
- absfuyu/general/resrel.py +213 -0
- absfuyu/general/shape.py +3 -8
- absfuyu/general/tax.py +344 -0
- absfuyu/logger.py +806 -59
- absfuyu/numbers/__init__.py +13 -0
- absfuyu/numbers/number_to_word.py +321 -0
- absfuyu/numbers/shorten_number.py +303 -0
- absfuyu/numbers/time_duration.py +217 -0
- absfuyu/pkg_data/__init__.py +2 -2
- absfuyu/pkg_data/deprecated.py +2 -2
- absfuyu/pkg_data/logo.py +1462 -0
- absfuyu/sort.py +4 -4
- absfuyu/tools/__init__.py +28 -2
- absfuyu/tools/checksum.py +144 -9
- absfuyu/tools/converter.py +120 -34
- absfuyu/tools/generator.py +461 -0
- absfuyu/tools/inspector.py +752 -0
- absfuyu/tools/keygen.py +2 -2
- absfuyu/tools/obfuscator.py +47 -9
- absfuyu/tools/passwordlib.py +89 -25
- absfuyu/tools/shutdownizer.py +3 -8
- absfuyu/tools/sw.py +718 -0
- absfuyu/tools/web.py +10 -13
- absfuyu/typings.py +138 -0
- absfuyu/util/__init__.py +114 -6
- absfuyu/util/api.py +41 -18
- absfuyu/util/cli.py +119 -0
- absfuyu/util/gui.py +91 -0
- absfuyu/util/json_method.py +43 -14
- absfuyu/util/lunar.py +2 -2
- absfuyu/util/package.py +124 -0
- absfuyu/util/path.py +702 -82
- absfuyu/util/performance.py +122 -7
- absfuyu/util/shorten_number.py +244 -21
- absfuyu/util/text_table.py +481 -0
- absfuyu/util/zipped.py +8 -7
- absfuyu/version.py +79 -59
- {absfuyu-5.0.0.dist-info → absfuyu-6.1.2.dist-info}/METADATA +52 -11
- absfuyu-6.1.2.dist-info/RECORD +105 -0
- {absfuyu-5.0.0.dist-info → absfuyu-6.1.2.dist-info}/WHEEL +1 -1
- absfuyu/extra/data_analysis.py +0 -1078
- absfuyu/general/generator.py +0 -303
- absfuyu-5.0.0.dist-info/RECORD +0 -68
- {absfuyu-5.0.0.dist-info → absfuyu-6.1.2.dist-info}/entry_points.txt +0 -0
- {absfuyu-5.0.0.dist-info → absfuyu-6.1.2.dist-info}/licenses/LICENSE +0 -0
absfuyu/__init__.py
CHANGED
|
@@ -22,19 +22,21 @@ Using in cmd:
|
|
|
22
22
|
__title__ = "absfuyu"
|
|
23
23
|
__author__ = "AbsoluteWinter"
|
|
24
24
|
__license__ = "MIT License"
|
|
25
|
-
__version__ = "
|
|
25
|
+
__version__ = "6.1.2"
|
|
26
26
|
__all__ = [
|
|
27
27
|
"core",
|
|
28
28
|
"config",
|
|
29
29
|
"dxt",
|
|
30
30
|
"extra",
|
|
31
|
-
"logger",
|
|
32
31
|
"fun",
|
|
33
32
|
"game",
|
|
34
33
|
"general",
|
|
34
|
+
"numbers",
|
|
35
35
|
"pkg_data",
|
|
36
|
-
"sort",
|
|
37
36
|
"tools",
|
|
38
37
|
"util",
|
|
38
|
+
"logger",
|
|
39
|
+
"sort",
|
|
40
|
+
"typings",
|
|
39
41
|
"version",
|
|
40
42
|
]
|
absfuyu/__main__.py
CHANGED
|
@@ -3,15 +3,15 @@ ABSFUYU
|
|
|
3
3
|
-------
|
|
4
4
|
COMMAND LINE INTERFACE
|
|
5
5
|
|
|
6
|
-
Version:
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 6.1.1
|
|
7
|
+
Date updated: 30/12/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
# Library
|
|
11
11
|
# ---------------------------------------------------------------------------
|
|
12
12
|
try:
|
|
13
13
|
from absfuyu.cli import cli
|
|
14
|
-
except
|
|
14
|
+
except ImportError: # Check for `click`, `colorama`
|
|
15
15
|
from absfuyu.core.dummy_cli import cli
|
|
16
16
|
|
|
17
17
|
|
absfuyu/cli/__init__.py
CHANGED
|
@@ -3,8 +3,8 @@ ABSFUYU
|
|
|
3
3
|
-------
|
|
4
4
|
COMMAND LINE INTERFACE
|
|
5
5
|
|
|
6
|
-
Version: 1.1
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 6.1.1
|
|
7
|
+
Date updated: 30/12/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
__all__ = ["cli"]
|
|
@@ -15,6 +15,7 @@ import click
|
|
|
15
15
|
import colorama
|
|
16
16
|
|
|
17
17
|
from absfuyu import __title__, __version__
|
|
18
|
+
from absfuyu.cli.audio_group import audio_group
|
|
18
19
|
from absfuyu.cli.color import COLOR
|
|
19
20
|
from absfuyu.cli.config_group import config_group
|
|
20
21
|
from absfuyu.cli.do_group import do_group
|
|
@@ -25,6 +26,15 @@ from absfuyu.cli.tool_group import tool_group
|
|
|
25
26
|
colorama.init(autoreset=True)
|
|
26
27
|
|
|
27
28
|
|
|
29
|
+
def quick_info() -> str:
|
|
30
|
+
return (
|
|
31
|
+
f"- os/type: {platform.system().lower()}\n"
|
|
32
|
+
f"- os/kernel: {platform.version()}\n"
|
|
33
|
+
f"- os/arch: {platform.machine().lower()}\n"
|
|
34
|
+
f"- python version: {platform.python_version()}\n"
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
28
38
|
@click.command()
|
|
29
39
|
def version() -> None:
|
|
30
40
|
"""Show current version"""
|
|
@@ -50,4 +60,5 @@ cli.add_command(config_group)
|
|
|
50
60
|
cli.add_command(do_group)
|
|
51
61
|
cli.add_command(game_group)
|
|
52
62
|
cli.add_command(tool_group)
|
|
63
|
+
cli.add_command(audio_group)
|
|
53
64
|
cli.add_command(version)
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ABSFUYU CLI
|
|
3
|
+
-----------
|
|
4
|
+
Audio
|
|
5
|
+
|
|
6
|
+
Version: 6.1.1
|
|
7
|
+
Date updated: 30/12/2025 (dd/mm/yyyy)
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
# Module Package
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
12
|
+
__all__ = ["audio_group"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# Library
|
|
16
|
+
# ---------------------------------------------------------------------------
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
import click
|
|
20
|
+
|
|
21
|
+
from absfuyu.extra.audio.convert import DirectoryAudioConvertMixin
|
|
22
|
+
from absfuyu.extra.audio.lossless import DirectoryAudioLosslessCheckMixin
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# CLI
|
|
26
|
+
# ---------------------------------------------------------------------------
|
|
27
|
+
@click.command(name="c3")
|
|
28
|
+
@click.argument("dir_path", type=str)
|
|
29
|
+
@click.option(
|
|
30
|
+
"--recursive",
|
|
31
|
+
"-r",
|
|
32
|
+
"recursive_mode",
|
|
33
|
+
type=bool,
|
|
34
|
+
default=False,
|
|
35
|
+
is_flag=True,
|
|
36
|
+
show_default=True,
|
|
37
|
+
help="Scan for every file in the folder (including child folder)",
|
|
38
|
+
)
|
|
39
|
+
@click.option(
|
|
40
|
+
"--format",
|
|
41
|
+
"-f",
|
|
42
|
+
"from_format",
|
|
43
|
+
type=str,
|
|
44
|
+
default=".flac",
|
|
45
|
+
show_default=True,
|
|
46
|
+
help="From which audio format",
|
|
47
|
+
)
|
|
48
|
+
def convert_to_mp3(dir_path: str, from_format: str, recursive_mode: bool) -> None:
|
|
49
|
+
"""Convert to .mp3 file"""
|
|
50
|
+
|
|
51
|
+
engine = DirectoryAudioConvertMixin(Path(dir_path).resolve())
|
|
52
|
+
|
|
53
|
+
try:
|
|
54
|
+
engine.convert_to_mp3(from_format=from_format, recursive=recursive_mode)
|
|
55
|
+
except Exception:
|
|
56
|
+
engine.convert_to_mp3_single_thread(from_format=from_format, recursive=recursive_mode)
|
|
57
|
+
click.echo("Done")
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@click.command(name="lc")
|
|
61
|
+
@click.argument("dir_path", type=str)
|
|
62
|
+
@click.option(
|
|
63
|
+
"--recursive",
|
|
64
|
+
"-r",
|
|
65
|
+
"recursive_mode",
|
|
66
|
+
type=bool,
|
|
67
|
+
default=False,
|
|
68
|
+
is_flag=True,
|
|
69
|
+
show_default=True,
|
|
70
|
+
help="Scan for every file in the folder (including child folder)",
|
|
71
|
+
)
|
|
72
|
+
@click.option(
|
|
73
|
+
"--format",
|
|
74
|
+
"-f",
|
|
75
|
+
"format",
|
|
76
|
+
type=str,
|
|
77
|
+
default=".flac",
|
|
78
|
+
show_default=True,
|
|
79
|
+
help="Audio format",
|
|
80
|
+
)
|
|
81
|
+
def lossless_check(dir_path: str, format: str, recursive_mode: bool) -> None:
|
|
82
|
+
"""Check for lossless audio file"""
|
|
83
|
+
|
|
84
|
+
engine = DirectoryAudioLosslessCheckMixin(Path(dir_path).resolve())
|
|
85
|
+
try:
|
|
86
|
+
engine.lossless_check(from_format=format, recursive=recursive_mode)
|
|
87
|
+
except Exception:
|
|
88
|
+
engine.lossless_check_single_thread(from_format=format, recursive=recursive_mode)
|
|
89
|
+
click.echo("Done")
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@click.group(name="audio")
|
|
93
|
+
def audio_group() -> None:
|
|
94
|
+
"""Audio related"""
|
|
95
|
+
pass
|
|
96
|
+
|
|
97
|
+
audio_group.add_command(lossless_check)
|
|
98
|
+
audio_group.add_command(convert_to_mp3)
|
absfuyu/cli/color.py
CHANGED
|
@@ -3,8 +3,8 @@ ABSFUYU CLI
|
|
|
3
3
|
-----------
|
|
4
4
|
Color
|
|
5
5
|
|
|
6
|
-
Version: 1.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 6.1.1
|
|
7
|
+
Date updated: 30/12/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
# Module Package
|
|
@@ -14,18 +14,34 @@ __all__ = ["COLOR"]
|
|
|
14
14
|
|
|
15
15
|
# Library
|
|
16
16
|
# ---------------------------------------------------------------------------
|
|
17
|
-
|
|
17
|
+
try:
|
|
18
|
+
import colorama
|
|
19
|
+
except ImportError: # Check for `colorama`
|
|
20
|
+
colorama = None
|
|
18
21
|
|
|
19
22
|
# Color
|
|
20
23
|
# ---------------------------------------------------------------------------
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
if colorama is None:
|
|
25
|
+
COLOR = {
|
|
26
|
+
"green": "",
|
|
27
|
+
"GREEN": "",
|
|
28
|
+
"blue": "",
|
|
29
|
+
"BLUE": "",
|
|
30
|
+
"red": "",
|
|
31
|
+
"RED": "",
|
|
32
|
+
"yellow": "",
|
|
33
|
+
"YELLOW": "",
|
|
34
|
+
"reset": "",
|
|
35
|
+
}
|
|
36
|
+
else:
|
|
37
|
+
COLOR = {
|
|
38
|
+
"green": colorama.Fore.LIGHTGREEN_EX,
|
|
39
|
+
"GREEN": colorama.Fore.GREEN,
|
|
40
|
+
"blue": colorama.Fore.LIGHTCYAN_EX,
|
|
41
|
+
"BLUE": colorama.Fore.CYAN,
|
|
42
|
+
"red": colorama.Fore.LIGHTRED_EX,
|
|
43
|
+
"RED": colorama.Fore.RED,
|
|
44
|
+
"yellow": colorama.Fore.LIGHTYELLOW_EX,
|
|
45
|
+
"YELLOW": colorama.Fore.YELLOW,
|
|
46
|
+
"reset": colorama.Fore.RESET,
|
|
47
|
+
}
|
absfuyu/cli/config_group.py
CHANGED
|
@@ -3,18 +3,25 @@ ABSFUYU CLI
|
|
|
3
3
|
-----------
|
|
4
4
|
Config
|
|
5
5
|
|
|
6
|
-
Version: 1.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 6.1.1
|
|
7
|
+
Date updated: 30/12/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
|
+
# Module Package
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
10
12
|
__all__ = ["config_group"]
|
|
11
13
|
|
|
14
|
+
|
|
15
|
+
# Library
|
|
16
|
+
# ---------------------------------------------------------------------------
|
|
12
17
|
import click
|
|
13
18
|
|
|
14
19
|
from absfuyu.cli.color import COLOR
|
|
15
20
|
from absfuyu.config import ABSFUYU_CONFIG
|
|
16
21
|
|
|
17
22
|
|
|
23
|
+
# CLI
|
|
24
|
+
# ---------------------------------------------------------------------------
|
|
18
25
|
@click.command()
|
|
19
26
|
@click.option(
|
|
20
27
|
"--setting",
|
absfuyu/cli/do_group.py
CHANGED
|
@@ -3,12 +3,17 @@ ABSFUYU CLI
|
|
|
3
3
|
-----------
|
|
4
4
|
Do
|
|
5
5
|
|
|
6
|
-
Version: 1.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 6.1.1
|
|
7
|
+
Date updated: 30/12/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
|
+
# Module Package
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
10
12
|
__all__ = ["do_group"]
|
|
11
13
|
|
|
14
|
+
|
|
15
|
+
# Library
|
|
16
|
+
# ---------------------------------------------------------------------------
|
|
12
17
|
import subprocess
|
|
13
18
|
|
|
14
19
|
import click
|
|
@@ -17,10 +22,12 @@ from absfuyu import __title__
|
|
|
17
22
|
from absfuyu.cli.color import COLOR
|
|
18
23
|
from absfuyu.core import __package_feature__
|
|
19
24
|
from absfuyu.tools.shutdownizer import ShutDownizer
|
|
20
|
-
from absfuyu.util.
|
|
25
|
+
from absfuyu.util.path import Directory
|
|
21
26
|
from absfuyu.version import PkgVersion
|
|
22
27
|
|
|
23
28
|
|
|
29
|
+
# CLI
|
|
30
|
+
# ---------------------------------------------------------------------------
|
|
24
31
|
@click.command()
|
|
25
32
|
@click.option(
|
|
26
33
|
"--force_update/--no-force-update",
|
|
@@ -64,9 +71,9 @@ def install(pkg: str) -> None:
|
|
|
64
71
|
def unzip_files_in_dir(dir: str) -> None:
|
|
65
72
|
"""Unzip every files in directory"""
|
|
66
73
|
|
|
67
|
-
engine =
|
|
68
|
-
engine.
|
|
69
|
-
|
|
74
|
+
engine = Directory(dir)
|
|
75
|
+
engine.decompress()
|
|
76
|
+
click.echo(f"{COLOR['green']}Done!")
|
|
70
77
|
|
|
71
78
|
|
|
72
79
|
@click.command(name="shutdown")
|
|
@@ -76,6 +83,15 @@ def os_shutdown() -> None:
|
|
|
76
83
|
engine.shutdown()
|
|
77
84
|
|
|
78
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
|
+
|
|
79
95
|
@click.group(name="do")
|
|
80
96
|
def do_group() -> None:
|
|
81
97
|
"""Perform functionalities"""
|
|
@@ -86,3 +102,4 @@ do_group.add_command(update)
|
|
|
86
102
|
do_group.add_command(install)
|
|
87
103
|
do_group.add_command(unzip_files_in_dir)
|
|
88
104
|
do_group.add_command(os_shutdown)
|
|
105
|
+
do_group.add_command(organize_directory)
|
absfuyu/cli/game_group.py
CHANGED
|
@@ -3,20 +3,28 @@ ABSFUYU CLI
|
|
|
3
3
|
-----------
|
|
4
4
|
Game
|
|
5
5
|
|
|
6
|
-
Version: 1.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 6.1.1
|
|
7
|
+
Date updated: 30/12/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
|
+
# Module Package
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
10
12
|
__all__ = ["game_group"]
|
|
11
13
|
|
|
14
|
+
|
|
15
|
+
# Library
|
|
16
|
+
# ---------------------------------------------------------------------------
|
|
12
17
|
import click
|
|
13
18
|
|
|
14
19
|
from absfuyu.game import game_escapeLoop, game_RockPaperScissors
|
|
20
|
+
from absfuyu.game.schulte import SchulteTable
|
|
15
21
|
from absfuyu.game.sudoku import Sudoku
|
|
16
22
|
from absfuyu.game.tictactoe import GameMode, TicTacToe
|
|
17
23
|
from absfuyu.game.wordle import Wordle
|
|
18
24
|
|
|
19
25
|
|
|
26
|
+
# CLI
|
|
27
|
+
# ---------------------------------------------------------------------------
|
|
20
28
|
@click.command
|
|
21
29
|
@click.option(
|
|
22
30
|
"--hard",
|
|
@@ -96,6 +104,22 @@ def tictactoe(size: int, game_mode: str, bot_time: float) -> None:
|
|
|
96
104
|
instance.play(game_mode, bot_time=bot_time)
|
|
97
105
|
|
|
98
106
|
|
|
107
|
+
@click.command(name="schulte")
|
|
108
|
+
@click.option(
|
|
109
|
+
"--size",
|
|
110
|
+
"-s",
|
|
111
|
+
"size",
|
|
112
|
+
type=int,
|
|
113
|
+
default=5,
|
|
114
|
+
show_default=True,
|
|
115
|
+
help="Size of the table",
|
|
116
|
+
)
|
|
117
|
+
def schulte_table(size: int) -> None:
|
|
118
|
+
"""Schulte table"""
|
|
119
|
+
engine = SchulteTable(size=size)
|
|
120
|
+
engine.make_table()
|
|
121
|
+
|
|
122
|
+
|
|
99
123
|
@click.group(name="game")
|
|
100
124
|
def game_group() -> None:
|
|
101
125
|
"""Play game"""
|
|
@@ -107,3 +131,4 @@ game_group.add_command(escape_loop)
|
|
|
107
131
|
game_group.add_command(wordle_solver)
|
|
108
132
|
game_group.add_command(sudoku_solver)
|
|
109
133
|
game_group.add_command(tictactoe)
|
|
134
|
+
game_group.add_command(schulte_table)
|
absfuyu/cli/tool_group.py
CHANGED
|
@@ -3,12 +3,18 @@ ABSFUYU CLI
|
|
|
3
3
|
-----------
|
|
4
4
|
Tool
|
|
5
5
|
|
|
6
|
-
Version: 1.
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 6.1.1
|
|
7
|
+
Date updated: 30/12/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
|
+
# Module Package
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
10
12
|
__all__ = ["tool_group"]
|
|
11
13
|
|
|
14
|
+
|
|
15
|
+
# Library
|
|
16
|
+
# ---------------------------------------------------------------------------
|
|
17
|
+
from pathlib import Path
|
|
12
18
|
from typing import Literal
|
|
13
19
|
|
|
14
20
|
import click
|
|
@@ -17,7 +23,9 @@ from absfuyu.tools.checksum import Checksum
|
|
|
17
23
|
from absfuyu.tools.converter import Base64EncodeDecode, Text2Chemistry
|
|
18
24
|
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
# CLI
|
|
27
|
+
# ---------------------------------------------------------------------------
|
|
28
|
+
@click.command(name="cs")
|
|
21
29
|
@click.argument("file_path", type=str)
|
|
22
30
|
@click.option(
|
|
23
31
|
"--hashmode",
|
|
@@ -65,13 +73,73 @@ def file_checksum(
|
|
|
65
73
|
hash_to_compare: str | None,
|
|
66
74
|
) -> None:
|
|
67
75
|
"""Checksum for file/directory"""
|
|
68
|
-
# print(hash_mode, save_result, recursive_mode)
|
|
69
76
|
instance = Checksum(file_path, hash_mode=hash_mode, save_result_to_file=save_result)
|
|
70
77
|
res = instance.checksum(recursive=recursive_mode)
|
|
71
78
|
if hash_to_compare is None:
|
|
72
|
-
|
|
79
|
+
click.echo(res)
|
|
73
80
|
else:
|
|
74
|
-
|
|
81
|
+
click.echo(res == hash_to_compare)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@click.command(name="cimg")
|
|
85
|
+
@click.argument("dir_path", type=str)
|
|
86
|
+
@click.argument("to_format", type=str)
|
|
87
|
+
def convert_img(dir_path: str, to_format: str) -> None:
|
|
88
|
+
"""Convert image in directory"""
|
|
89
|
+
from absfuyu.extra.img.converter import ImgConverter
|
|
90
|
+
|
|
91
|
+
engine = ImgConverter(Path(dir_path).resolve())
|
|
92
|
+
engine.img_convert(to_format)
|
|
93
|
+
click.echo("Done")
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@click.command(name="rdimg")
|
|
97
|
+
@click.argument("dir_path", type=str)
|
|
98
|
+
@click.option(
|
|
99
|
+
"--dryrun",
|
|
100
|
+
"-d",
|
|
101
|
+
"dry_run",
|
|
102
|
+
type=bool,
|
|
103
|
+
default=False,
|
|
104
|
+
is_flag=True,
|
|
105
|
+
show_default=True,
|
|
106
|
+
help="Simulate deleting only",
|
|
107
|
+
)
|
|
108
|
+
@click.option(
|
|
109
|
+
"--recursive",
|
|
110
|
+
"-r",
|
|
111
|
+
"recursive_mode",
|
|
112
|
+
type=bool,
|
|
113
|
+
default=False,
|
|
114
|
+
is_flag=True,
|
|
115
|
+
show_default=True,
|
|
116
|
+
help="Scan for every file in the folder (including child folder)",
|
|
117
|
+
)
|
|
118
|
+
@click.option(
|
|
119
|
+
"--threshold",
|
|
120
|
+
"-t",
|
|
121
|
+
"threshold",
|
|
122
|
+
type=int,
|
|
123
|
+
default=5,
|
|
124
|
+
show_default=True,
|
|
125
|
+
help="Threshold: 0 for exact image, 5 to 10 for light edit",
|
|
126
|
+
)
|
|
127
|
+
@click.option(
|
|
128
|
+
"--keepmode",
|
|
129
|
+
"-k",
|
|
130
|
+
"keep_mode",
|
|
131
|
+
type=click.Choice(["first", "last", "best"]),
|
|
132
|
+
default="best",
|
|
133
|
+
show_default=True,
|
|
134
|
+
help="Keep mode",
|
|
135
|
+
)
|
|
136
|
+
def remove_dup_img(dir_path: str, threshold: bool, recursive_mode: bool, keep_mode: str, dry_run: bool) -> None:
|
|
137
|
+
"""Remove duplicate images in directory"""
|
|
138
|
+
from absfuyu.extra.img.dup_check import DirectoryRemoveDuplicateImageMixin as DRDI
|
|
139
|
+
|
|
140
|
+
engine = DRDI(Path(dir_path).resolve())
|
|
141
|
+
engine.remove_duplicate_images(threshold=threshold, recursive=recursive_mode, keep_mode=keep_mode, dry_run=dry_run)
|
|
142
|
+
click.echo("Done")
|
|
75
143
|
|
|
76
144
|
|
|
77
145
|
@click.command(name="t2c")
|
|
@@ -80,21 +148,21 @@ def text2chem(text: str) -> None:
|
|
|
80
148
|
"""Convert text into chemistry symbol"""
|
|
81
149
|
engine = Text2Chemistry()
|
|
82
150
|
out = engine.convert(text)
|
|
83
|
-
|
|
151
|
+
click.echo(Text2Chemistry.beautify_result(out))
|
|
84
152
|
|
|
85
153
|
|
|
86
154
|
@click.command(name="e")
|
|
87
155
|
@click.argument("text", type=str)
|
|
88
156
|
def base64encode(text: str) -> None:
|
|
89
157
|
"""Convert text to base64"""
|
|
90
|
-
|
|
158
|
+
click.echo(Base64EncodeDecode.encode(text))
|
|
91
159
|
|
|
92
160
|
|
|
93
161
|
@click.command(name="d")
|
|
94
162
|
@click.argument("text", type=str)
|
|
95
163
|
def base64decode(text: str) -> None:
|
|
96
164
|
"""Convert base64 to text"""
|
|
97
|
-
|
|
165
|
+
click.echo(Base64EncodeDecode.decode(text))
|
|
98
166
|
|
|
99
167
|
|
|
100
168
|
@click.command(name="img")
|
|
@@ -111,11 +179,11 @@ def base64decode(text: str) -> None:
|
|
|
111
179
|
@click.argument("img_path", type=str)
|
|
112
180
|
def base64convert_img(img_path: str, data_tag: bool) -> None:
|
|
113
181
|
"""Convert img to base64"""
|
|
114
|
-
|
|
182
|
+
click.echo(Base64EncodeDecode.encode_image(img_path, data_tag=data_tag))
|
|
115
183
|
|
|
116
184
|
|
|
117
185
|
@click.group(name="b64")
|
|
118
|
-
def base64_group():
|
|
186
|
+
def base64_group() -> None:
|
|
119
187
|
"""Base64 encode decode"""
|
|
120
188
|
pass
|
|
121
189
|
|
|
@@ -132,5 +200,7 @@ def tool_group() -> None:
|
|
|
132
200
|
|
|
133
201
|
|
|
134
202
|
tool_group.add_command(file_checksum)
|
|
203
|
+
tool_group.add_command(convert_img)
|
|
204
|
+
tool_group.add_command(remove_dup_img)
|
|
135
205
|
tool_group.add_command(base64_group)
|
|
136
206
|
tool_group.add_command(text2chem)
|
absfuyu/config/__init__.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Absfuyu: Configuration
|
|
3
3
|
----------------------
|
|
4
|
-
Package configuration module
|
|
4
|
+
Package configuration module - internal use
|
|
5
5
|
|
|
6
|
-
Version:
|
|
7
|
-
Date updated: 12/
|
|
6
|
+
Version: 6.1.1
|
|
7
|
+
Date updated: 30/12/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
# Module level
|
absfuyu/core/__init__.py
CHANGED
|
@@ -3,8 +3,8 @@ Absfuyu: Core
|
|
|
3
3
|
-------------
|
|
4
4
|
Bases for other features
|
|
5
5
|
|
|
6
|
-
Version:
|
|
7
|
-
Date updated:
|
|
6
|
+
Version: 6.1.1
|
|
7
|
+
Date updated: 30/12/2025 (dd/mm/yyyy)
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
# Module Package
|
|
@@ -15,7 +15,7 @@ __all__ = [
|
|
|
15
15
|
# path
|
|
16
16
|
# "CORE_PATH",
|
|
17
17
|
# class
|
|
18
|
-
"
|
|
18
|
+
"GetClassMembersMixin",
|
|
19
19
|
"BaseClass",
|
|
20
20
|
# wrapper
|
|
21
21
|
"tqdm",
|
|
@@ -27,11 +27,15 @@ __all__ = [
|
|
|
27
27
|
]
|
|
28
28
|
|
|
29
29
|
__package_feature__ = [
|
|
30
|
-
"beautiful", # BeautifulOutput
|
|
31
|
-
"docs", # For (package) hatch's env use only
|
|
32
|
-
"extra", # DataFrame
|
|
33
30
|
"full", # All package
|
|
34
|
-
"
|
|
31
|
+
"docs", # For (package) hatch's env use only
|
|
32
|
+
"extra", # Extra features
|
|
33
|
+
"beautiful", # BeautifulOutput
|
|
34
|
+
"dadf", # DataFrame
|
|
35
|
+
"pdf", # PDF
|
|
36
|
+
"pic", # picture related
|
|
37
|
+
"xml", # XML
|
|
38
|
+
"ggapi", # Google
|
|
35
39
|
]
|
|
36
40
|
|
|
37
41
|
|
|
@@ -40,7 +44,7 @@ __package_feature__ = [
|
|
|
40
44
|
# from importlib.resources import files
|
|
41
45
|
|
|
42
46
|
# Most used features are imported to core
|
|
43
|
-
from absfuyu.core.baseclass import BaseClass, CLITextColor,
|
|
47
|
+
from absfuyu.core.baseclass import BaseClass, CLITextColor, GetClassMembersMixin
|
|
44
48
|
from absfuyu.core.docstring import deprecated, versionadded, versionchanged
|
|
45
49
|
from absfuyu.core.dummy_func import tqdm, unidecode
|
|
46
50
|
|