absfuyu 4.1.1__tar.gz → 4.2.0__tar.gz

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.

Files changed (93) hide show
  1. {absfuyu-4.1.1 → absfuyu-4.2.0}/PKG-INFO +13 -18
  2. absfuyu-4.2.0/README.md +66 -0
  3. {absfuyu-4.1.1 → absfuyu-4.2.0}/pyproject.toml +4 -3
  4. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/__init__.py +1 -1
  5. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/cli/__init__.py +4 -2
  6. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/cli/do_group.py +14 -61
  7. absfuyu-4.2.0/src/absfuyu/cli/tool_group.py +136 -0
  8. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/core.py +3 -3
  9. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/extensions/__init__.py +1 -0
  10. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/pkg_data/__init__.py +2 -1
  11. absfuyu-4.2.0/src/absfuyu/pkg_data/passwordlib_lzma.pkl +0 -0
  12. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/tools/checksum.py +15 -4
  13. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/tools/converter.py +36 -7
  14. {absfuyu-4.1.1/src/absfuyu/extensions/dev → absfuyu-4.2.0/src/absfuyu/tools}/passwordlib.py +52 -50
  15. absfuyu-4.2.0/src/absfuyu/tools/shutdownizer.py +266 -0
  16. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/util/shorten_number.py +1 -1
  17. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_data_analysis.py +1 -1
  18. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_everything.py +12 -4
  19. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_passwordlib.py +4 -9
  20. absfuyu-4.1.1/README.md +0 -68
  21. absfuyu-4.1.1/src/absfuyu/extensions/dev/__init__.py +0 -244
  22. absfuyu-4.1.1/src/absfuyu/extensions/dev/password_hash.py +0 -80
  23. absfuyu-4.1.1/src/absfuyu/extensions/dev/project_starter.py +0 -60
  24. absfuyu-4.1.1/src/absfuyu/extensions/dev/shutdownizer.py +0 -156
  25. absfuyu-4.1.1/src/absfuyu/extensions/extra/__init__.py +0 -24
  26. {absfuyu-4.1.1 → absfuyu-4.2.0}/.gitignore +0 -0
  27. {absfuyu-4.1.1 → absfuyu-4.2.0}/LICENSE +0 -0
  28. {absfuyu-4.1.1 → absfuyu-4.2.0}/dev_requirements.txt +0 -0
  29. {absfuyu-4.1.1 → absfuyu-4.2.0}/docs/Makefile +0 -0
  30. {absfuyu-4.1.1 → absfuyu-4.2.0}/docs/conf.py +0 -0
  31. {absfuyu-4.1.1 → absfuyu-4.2.0}/docs/index.rst +0 -0
  32. {absfuyu-4.1.1 → absfuyu-4.2.0}/docs/info.md +0 -0
  33. {absfuyu-4.1.1 → absfuyu-4.2.0}/docs/make.bat +0 -0
  34. {absfuyu-4.1.1 → absfuyu-4.2.0}/docs/modules.rst +0 -0
  35. {absfuyu-4.1.1 → absfuyu-4.2.0}/images/repository-image-crop.png +0 -0
  36. {absfuyu-4.1.1 → absfuyu-4.2.0}/images/repository-image-white.png +0 -0
  37. {absfuyu-4.1.1 → absfuyu-4.2.0}/images/repository-image.png +0 -0
  38. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/__main__.py +0 -0
  39. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/cli/color.py +0 -0
  40. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/cli/config_group.py +0 -0
  41. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/cli/game_group.py +0 -0
  42. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/config/__init__.py +0 -0
  43. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/config/config.json +0 -0
  44. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/everything.py +0 -0
  45. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/extensions/beautiful.py +0 -0
  46. {absfuyu-4.1.1/src/absfuyu/extensions/extra → absfuyu-4.2.0/src/absfuyu/extensions}/data_analysis.py +0 -0
  47. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/fun/WGS.py +0 -0
  48. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/fun/__init__.py +0 -0
  49. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/fun/tarot.py +0 -0
  50. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/game/__init__.py +0 -0
  51. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/game/game_stat.py +0 -0
  52. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/game/sudoku.py +0 -0
  53. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/game/tictactoe.py +0 -0
  54. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/game/wordle.py +0 -0
  55. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/general/__init__.py +0 -0
  56. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/general/content.py +0 -0
  57. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/general/data_extension.py +0 -0
  58. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/general/generator.py +0 -0
  59. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/general/human.py +0 -0
  60. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/logger.py +0 -0
  61. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/pkg_data/chemistry.pkl +0 -0
  62. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/pkg_data/tarot.pkl +0 -0
  63. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/py.typed +0 -0
  64. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/sort.py +0 -0
  65. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/tools/__init__.py +0 -0
  66. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/tools/keygen.py +0 -0
  67. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/tools/obfuscator.py +0 -0
  68. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/tools/stats.py +0 -0
  69. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/tools/web.py +0 -0
  70. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/util/__init__.py +0 -0
  71. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/util/api.py +0 -0
  72. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/util/json_method.py +0 -0
  73. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/util/lunar.py +0 -0
  74. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/util/path.py +0 -0
  75. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/util/performance.py +0 -0
  76. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/util/pkl.py +0 -0
  77. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/util/zipped.py +0 -0
  78. {absfuyu-4.1.1 → absfuyu-4.2.0}/src/absfuyu/version.py +0 -0
  79. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/__init__.py +0 -0
  80. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/conftest.py +0 -0
  81. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_beautiful.py +0 -0
  82. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_config.py +0 -0
  83. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_data_extension.py +0 -0
  84. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_extensions.py +0 -0
  85. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_fun.py +0 -0
  86. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_game.py +0 -0
  87. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_generator.py +0 -0
  88. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_logger.py +0 -0
  89. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_pkg_data.py +0 -0
  90. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_tarot.py +0 -0
  91. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_tools.py +0 -0
  92. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_util.py +0 -0
  93. {absfuyu-4.1.1 → absfuyu-4.2.0}/tests/test_version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: absfuyu
3
- Version: 4.1.1
3
+ Version: 4.2.0
4
4
  Summary: A small collection of code
5
5
  Project-URL: Homepage, https://github.com/AbsoluteWinter/absfuyu-public
6
6
  Project-URL: Documentation, https://absolutewinter.github.io/absfuyu-docs/
@@ -42,30 +42,26 @@ Provides-Extra: extra
42
42
  Requires-Dist: numpy; extra == 'extra'
43
43
  Requires-Dist: pandas; extra == 'extra'
44
44
  Provides-Extra: full
45
- Requires-Dist: absfuyu-res; extra == 'full'
46
45
  Requires-Dist: numpy; extra == 'full'
47
46
  Requires-Dist: pandas; extra == 'full'
48
47
  Requires-Dist: rich; extra == 'full'
49
48
  Requires-Dist: tqdm; extra == 'full'
50
- Provides-Extra: res
51
- Requires-Dist: absfuyu-res; extra == 'res'
52
49
  Description-Content-Type: text/markdown
53
50
 
54
51
  <div align="center">
55
- <h1 align="center">
56
- <img src="https://github.com/AbsoluteWinter/AbsoluteWinter.github.io/blob/main/absfuyu/images/repository-image-crop.png?raw=true" alt="absfuyu"/>
57
- </h1>
58
- <p align="center">
59
- <a href="https://pypi.org/project/absfuyu/"><img src="https://img.shields.io/pypi/pyversions/absfuyu?style=flat-square&logo=python" alt="PyPI Supported Versions"/></a>
60
- <a href="https://pypi.org/project/absfuyu/"><img src="https://img.shields.io/pypi/dm/absfuyu?style=flat-square&color=blue" alt="PyPI Downloads"/></a>
61
- <a href="https://pypi.org/project/absfuyu/"><img src="https://img.shields.io/pypi/v/absfuyu?style=flat-square&logo=pypi" /></a>
62
- <a><img src="https://img.shields.io/pypi/l/absfuyu?style=flat-square&logo=github&color=blue"/></a>
63
- <a><img src="https://img.shields.io/badge/code%20style-black-black?style=flat-square"/></a>
64
- <a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=flat-square" alt="Ruff" style="max-width:100%;"></a>
65
- </p>
52
+ <h1 align="center">
53
+ <img src="https://github.com/AbsoluteWinter/AbsoluteWinter.github.io/blob/main/absfuyu/images/repository-image-crop.png?raw=true" alt="absfuyu"/>
54
+ </h1>
55
+ <p align="center">
56
+ <a href="https://pypi.org/project/absfuyu/"><img src="https://img.shields.io/pypi/pyversions/absfuyu?style=flat-square&logo=python" alt="PyPI Supported Versions"/></a>
57
+ <a href="https://pypi.org/project/absfuyu/"><img src="https://img.shields.io/pypi/dm/absfuyu?style=flat-square&color=blue" alt="PyPI Downloads"/></a>
58
+ <a href="https://pypi.org/project/absfuyu/"><img src="https://img.shields.io/pypi/v/absfuyu?style=flat-square&logo=pypi" /></a>
59
+ <a><img src="https://img.shields.io/pypi/l/absfuyu?style=flat-square&logo=github&color=blue"/></a>
60
+ <a><img src="https://img.shields.io/badge/code%20style-black-black?style=flat-square"/></a>
61
+ <a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=flat-square" alt="Ruff" style="max-width:100%;"></a>
62
+ </p>
66
63
  </div>
67
64
 
68
-
69
65
  ---
70
66
 
71
67
  ## **SUMMARY:**
@@ -75,7 +71,7 @@ Description-Content-Type: text/markdown
75
71
  ## **INSTALLATION:**
76
72
 
77
73
  ```bash
78
- $ pip install -U absfuyu
74
+ pip install -U absfuyu
79
75
  ```
80
76
 
81
77
  ## **USAGE:**
@@ -115,7 +111,6 @@ python -m pip install -e .[full,dev]
115
111
  hatch env show
116
112
  ```
117
113
 
118
-
119
114
  ## **LICENSE:**
120
115
 
121
116
  MIT License
@@ -0,0 +1,66 @@
1
+ <div align="center">
2
+ <h1 align="center">
3
+ <img src="https://github.com/AbsoluteWinter/AbsoluteWinter.github.io/blob/main/absfuyu/images/repository-image-crop.png?raw=true" alt="absfuyu"/>
4
+ </h1>
5
+ <p align="center">
6
+ <a href="https://pypi.org/project/absfuyu/"><img src="https://img.shields.io/pypi/pyversions/absfuyu?style=flat-square&logo=python" alt="PyPI Supported Versions"/></a>
7
+ <a href="https://pypi.org/project/absfuyu/"><img src="https://img.shields.io/pypi/dm/absfuyu?style=flat-square&color=blue" alt="PyPI Downloads"/></a>
8
+ <a href="https://pypi.org/project/absfuyu/"><img src="https://img.shields.io/pypi/v/absfuyu?style=flat-square&logo=pypi" /></a>
9
+ <a><img src="https://img.shields.io/pypi/l/absfuyu?style=flat-square&logo=github&color=blue"/></a>
10
+ <a><img src="https://img.shields.io/badge/code%20style-black-black?style=flat-square"/></a>
11
+ <a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=flat-square" alt="Ruff" style="max-width:100%;"></a>
12
+ </p>
13
+ </div>
14
+
15
+ ---
16
+
17
+ ## **SUMMARY:**
18
+
19
+ *TL;DR: A collection of code*
20
+
21
+ ## **INSTALLATION:**
22
+
23
+ ```bash
24
+ pip install -U absfuyu
25
+ ```
26
+
27
+ ## **USAGE:**
28
+
29
+ ```python
30
+ import absfuyu
31
+ help(absfuyu)
32
+ ```
33
+
34
+ ## **DOCUMENTATION:**
35
+
36
+ > [here](https://absolutewinter.github.io/absfuyu/)
37
+
38
+ ## **DEV SETUP**
39
+
40
+ 1. Create virtual environment
41
+
42
+ ```bash
43
+ python -m venv env
44
+ ```
45
+
46
+ Note: Might need to run this in powershell (windows)
47
+
48
+ ```powershell
49
+ Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
50
+ ```
51
+
52
+ 2. Install required packages
53
+
54
+ ```bash
55
+ python -m pip install -e .[full,dev]
56
+ ```
57
+
58
+ 3. Getting info of dev environment
59
+
60
+ ```bash
61
+ hatch env show
62
+ ```
63
+
64
+ ## **LICENSE:**
65
+
66
+ MIT License
@@ -59,8 +59,7 @@ Repository = "https://github.com/AbsoluteWinter/absfuyu-public"
59
59
  Issues = "https://github.com/AbsoluteWinter/absfuyu-public/issues"
60
60
 
61
61
  [project.optional-dependencies]
62
- res = ["absfuyu-res"]
63
- full = ["absfuyu-res", "numpy", "pandas", "rich", "tqdm"]
62
+ full = ["numpy", "pandas", "rich", "tqdm"]
64
63
  beautiful = ["rich"]
65
64
  extra = ["numpy", "pandas"]
66
65
  dev = ["hatch", "pytest"]
@@ -212,7 +211,6 @@ build = [
212
211
  9617320663a662e77726974656c696e65732863290a7072696e7428224c6963656e7365\
213
212
  207965617220757064617465642229').decode('utf-8'))\"
214
213
  """,
215
- # "python support_scripts/update_license_year.py", # Update license year
216
214
  "hatch clean", # Clean dist/ folder
217
215
  "hatch -v build", # Build package
218
216
  "hatch run docs:build", # Build docs
@@ -310,6 +308,9 @@ ignore = [
310
308
  ]
311
309
  "shorten_number.py" = ["B007"] # Loop control variable not used within loop body
312
310
 
311
+ [tool.ruff.lint.pydocstyle]
312
+ convention = "numpy"
313
+
313
314
  # MARK: TOOL: black
314
315
  [tool.black]
315
316
  line-length = 88
@@ -22,7 +22,7 @@ Using in cmd (`absfuyu[cli]` required):
22
22
  __title__ = "absfuyu"
23
23
  __author__ = "AbsoluteWinter"
24
24
  __license__ = "MIT License"
25
- __version__ = "4.1.1"
25
+ __version__ = "4.2.0"
26
26
  __all__ = [
27
27
  "core",
28
28
  "config",
@@ -3,8 +3,8 @@ ABSFUYU
3
3
  -------
4
4
  COMMAND LINE INTERFACE
5
5
 
6
- Version: 1.0.0
7
- Date updated: 14/04/2024 (dd/mm/yyyy)
6
+ Version: 1.1.0
7
+ Date updated: 09/02/2025 (dd/mm/yyyy)
8
8
  """
9
9
 
10
10
  __all__ = ["cli"]
@@ -19,6 +19,7 @@ from absfuyu.cli.color import COLOR
19
19
  from absfuyu.cli.config_group import config_group
20
20
  from absfuyu.cli.do_group import do_group
21
21
  from absfuyu.cli.game_group import game_group
22
+ from absfuyu.cli.tool_group import tool_group
22
23
 
23
24
  # Color stuff
24
25
  colorama.init(autoreset=True)
@@ -48,4 +49,5 @@ def cli() -> None:
48
49
  cli.add_command(config_group)
49
50
  cli.add_command(do_group)
50
51
  cli.add_command(game_group)
52
+ cli.add_command(tool_group)
51
53
  cli.add_command(version)
@@ -3,14 +3,13 @@ ABSFUYU CLI
3
3
  -----------
4
4
  Do
5
5
 
6
- Version: 1.3.1
7
- Date updated: 01/02/2025 (dd/mm/yyyy)
6
+ Version: 1.4.0
7
+ Date updated: 07/02/2025 (dd/mm/yyyy)
8
8
  """
9
9
 
10
10
  __all__ = ["do_group"]
11
11
 
12
12
  import subprocess
13
- from typing import Literal
14
13
 
15
14
  import click
16
15
 
@@ -18,7 +17,7 @@ from absfuyu import __title__
18
17
  from absfuyu.cli.color import COLOR
19
18
  from absfuyu.core import __package_feature__
20
19
  from absfuyu.general.human import Human2
21
- from absfuyu.tools.checksum import Checksum
20
+ from absfuyu.tools.shutdownizer import ShutDownizer
22
21
  from absfuyu.util.zipped import Zipper
23
22
  from absfuyu.version import PkgVersion
24
23
 
@@ -82,7 +81,11 @@ def fs(date: str, number_string: str) -> None:
82
81
  @click.command(name="info")
83
82
  @click.argument("date", type=str)
84
83
  def info(date: str) -> None:
85
- """Day info"""
84
+ """
85
+ Day info, format: yyyymmdd
86
+
87
+ Remake this
88
+ """
86
89
 
87
90
  instance = Human2(date)
88
91
  print(instance.info())
@@ -98,61 +101,11 @@ def unzip_files_in_dir(dir: str) -> None:
98
101
  print("Done")
99
102
 
100
103
 
101
- @click.command(name="checksum")
102
- @click.argument("file_path", type=str)
103
- @click.option(
104
- "--hashmode",
105
- "-m",
106
- "hash_mode",
107
- type=click.Choice(["md5", "sha1", "sha256", "sha512"]),
108
- default="sha256",
109
- show_default=True,
110
- help="Hash mode",
111
- )
112
- @click.option(
113
- "--save-result",
114
- "-s",
115
- "save_result",
116
- type=bool,
117
- default=False,
118
- is_flag=True,
119
- show_default=True,
120
- help="Save checksum result to file",
121
- )
122
- @click.option(
123
- "--recursive",
124
- "-r",
125
- "recursive_mode",
126
- type=bool,
127
- default=False,
128
- is_flag=True,
129
- show_default=True,
130
- help="Do checksum for every file in the folder (including child folder)",
131
- )
132
- @click.option(
133
- "--compare",
134
- "-c",
135
- "hash_to_compare",
136
- type=str,
137
- default=None,
138
- show_default=True,
139
- help="Hash to compare",
140
- )
141
- def file_checksum(
142
- file_path: str,
143
- hash_mode: str | Literal["md5", "sha1", "sha256", "sha512"],
144
- save_result: bool,
145
- recursive_mode: bool,
146
- hash_to_compare: str,
147
- ) -> None:
148
- """Checksum for file"""
149
- # print(hash_mode, save_result, recursive_mode)
150
- instance = Checksum(file_path, hash_mode=hash_mode, save_result_to_file=save_result)
151
- res = instance.checksum(recursive=recursive_mode)
152
- if hash_to_compare:
153
- print(res == hash_to_compare)
154
- else:
155
- print(res)
104
+ @click.command(name="shutdown")
105
+ def os_shutdown() -> None:
106
+ """Shutdown"""
107
+ engine = ShutDownizer()
108
+ engine.shutdown()
156
109
 
157
110
 
158
111
  @click.group(name="do")
@@ -167,4 +120,4 @@ do_group.add_command(advice)
167
120
  do_group.add_command(fs)
168
121
  do_group.add_command(info)
169
122
  do_group.add_command(unzip_files_in_dir)
170
- do_group.add_command(file_checksum)
123
+ do_group.add_command(os_shutdown)
@@ -0,0 +1,136 @@
1
+ """
2
+ ABSFUYU CLI
3
+ -----------
4
+ Tool
5
+
6
+ Version: 1.0.0
7
+ Date updated: 10/02/2025 (dd/mm/yyyy)
8
+ """
9
+
10
+ __all__ = ["tool_group"]
11
+
12
+ from typing import Literal
13
+
14
+ import click
15
+
16
+ from absfuyu.tools.checksum import Checksum
17
+ from absfuyu.tools.converter import Base64EncodeDecode, Text2Chemistry
18
+
19
+
20
+ @click.command(name="checksum")
21
+ @click.argument("file_path", type=str)
22
+ @click.option(
23
+ "--hashmode",
24
+ "-m",
25
+ "hash_mode",
26
+ type=click.Choice(["md5", "sha1", "sha256", "sha512"]),
27
+ default="sha256",
28
+ show_default=True,
29
+ help="Hash mode",
30
+ )
31
+ @click.option(
32
+ "--save-result",
33
+ "-s",
34
+ "save_result",
35
+ type=bool,
36
+ default=False,
37
+ is_flag=True,
38
+ show_default=True,
39
+ help="Save checksum result to file",
40
+ )
41
+ @click.option(
42
+ "--recursive",
43
+ "-r",
44
+ "recursive_mode",
45
+ type=bool,
46
+ default=False,
47
+ is_flag=True,
48
+ show_default=True,
49
+ help="Do checksum for every file in the folder (including child folder)",
50
+ )
51
+ @click.option(
52
+ "--compare",
53
+ "-c",
54
+ "hash_to_compare",
55
+ type=str,
56
+ default=None,
57
+ show_default=True,
58
+ help="Hash to compare",
59
+ )
60
+ def file_checksum(
61
+ file_path: str,
62
+ hash_mode: str | Literal["md5", "sha1", "sha256", "sha512"],
63
+ save_result: bool,
64
+ recursive_mode: bool,
65
+ hash_to_compare: str,
66
+ ) -> None:
67
+ """Checksum for file/directory"""
68
+ # print(hash_mode, save_result, recursive_mode)
69
+ instance = Checksum(file_path, hash_mode=hash_mode, save_result_to_file=save_result)
70
+ res = instance.checksum(recursive=recursive_mode)
71
+ if hash_to_compare:
72
+ print(res == hash_to_compare)
73
+ else:
74
+ print(res)
75
+
76
+
77
+ @click.command(name="t2c")
78
+ @click.argument("text", type=str)
79
+ def text2chem(text: str) -> None:
80
+ """Convert text into chemistry symbol"""
81
+ engine = Text2Chemistry()
82
+ out = engine.convert(text)
83
+ print(Text2Chemistry.beautify_result(out))
84
+
85
+
86
+ @click.command(name="e")
87
+ @click.argument("text", type=str)
88
+ def base64encode(text: str) -> None:
89
+ """Convert text to base64"""
90
+ print(Base64EncodeDecode.encode(text))
91
+
92
+
93
+ @click.command(name="d")
94
+ @click.argument("text", type=str)
95
+ def base64decode(text: str) -> None:
96
+ """Convert base64 to text"""
97
+ print(Base64EncodeDecode.decode(text))
98
+
99
+
100
+ @click.command(name="img")
101
+ @click.option(
102
+ "--data-tag",
103
+ "-d",
104
+ "data_tag",
105
+ type=bool,
106
+ default=False,
107
+ is_flag=True,
108
+ show_default=True,
109
+ help="Add data tag before base64 string",
110
+ )
111
+ @click.argument("img_path", type=str)
112
+ def base64convert_img(img_path: str, data_tag: bool) -> None:
113
+ """Convert img to base64"""
114
+ print(Base64EncodeDecode.encode_image(img_path, data_tag=data_tag))
115
+
116
+
117
+ @click.group(name="b64")
118
+ def base64_group():
119
+ """Base64 encode decode"""
120
+ pass
121
+
122
+
123
+ base64_group.add_command(base64encode)
124
+ base64_group.add_command(base64decode)
125
+ base64_group.add_command(base64convert_img)
126
+
127
+
128
+ @click.group(name="tool")
129
+ def tool_group() -> None:
130
+ """Tools"""
131
+ pass
132
+
133
+
134
+ tool_group.add_command(file_checksum)
135
+ tool_group.add_command(base64_group)
136
+ tool_group.add_command(text2chem)
@@ -3,8 +3,8 @@ Absfuyu: Core
3
3
  -------------
4
4
  Contain type hints and other stuffs
5
5
 
6
- Version: 2.3.1
7
- Date updated: 01/02/2025 (dd/mm/yyyy)
6
+ Version: 2.3.2
7
+ Date updated: 11/02/2025 (dd/mm/yyyy)
8
8
  """
9
9
 
10
10
  # Module Package
@@ -18,7 +18,7 @@ __all__ = [
18
18
  "DATA_PATH",
19
19
  ]
20
20
 
21
- __package_feature__ = ["beautiful", "extra", "res", "full", "dev"]
21
+ __package_feature__ = ["beautiful", "extra", "full", "dev"]
22
22
 
23
23
 
24
24
  # Library
@@ -1,6 +1,7 @@
1
1
  """
2
2
  Absfuyu: Extension
3
3
  ------------------
4
+ Features that require additional libraries
4
5
 
5
6
  Version: 1.0.1
6
7
  Date updated: 24/11/2023 (dd/mm/yyyy)
@@ -26,9 +26,9 @@ from absfuyu.logger import logger
26
26
  ###########################################################################
27
27
  _EXTERNAL_DATA = {
28
28
  "chemistry.json": "https://raw.githubusercontent.com/Bowserinator/Periodic-Table-JSON/master/PeriodicTableJSON.json",
29
- "countries.json": "https://github.com/dr5hn/countries-states-cities-database/blob/master/countries.json",
30
29
  "tarot.json": "https://raw.githubusercontent.com/dariusk/corpora/master/data/divination/tarot_interpretations.json",
31
30
  "word_list.json": "https://raw.githubusercontent.com/dwyl/english-words/master/words_dictionary.json",
31
+ # "countries.json": "https://raw.githubusercontent.com/dr5hn/countries-states-cities-database/refs/heads/master/json/countries.json",
32
32
  }
33
33
 
34
34
 
@@ -37,6 +37,7 @@ _EXTERNAL_DATA = {
37
37
  class DataList:
38
38
  CHEMISTRY = files("absfuyu.pkg_data").joinpath("chemistry.pkl")
39
39
  TAROT = files("absfuyu.pkg_data").joinpath("tarot.pkl")
40
+ PASSWORDLIB = files("absfuyu.pkg_data").joinpath("passwordlib_lzma.pkl")
40
41
 
41
42
 
42
43
  class PkgData:
@@ -3,8 +3,8 @@ Absufyu: Checksum
3
3
  -----------------
4
4
  Check MD5, SHA256, ...
5
5
 
6
- Version: 1.1.0
7
- Date updated: 01/02/2025 (dd/mm/yyyy)
6
+ Version: 1.1.1
7
+ Date updated: 05/02/2025 (dd/mm/yyyy)
8
8
  """
9
9
 
10
10
  # Module level
@@ -58,6 +58,17 @@ class Checksum:
58
58
  hash_mode: str | Literal["md5", "sha1", "sha256", "sha512"] = "sha256",
59
59
  save_result_to_file: bool = False,
60
60
  ) -> None:
61
+ """Checksum engine
62
+
63
+ Parameters
64
+ ----------
65
+ path : str | Path
66
+ Path to file/directory to perform checksum
67
+ hash_mode : str | Literal["md5", "sha1", "sha256", "sha512"], optional
68
+ Hash mode, by default "sha256"
69
+ save_result_to_file : bool, optional
70
+ Save checksum result(s) to file, by default False
71
+ """
61
72
  self.path = Path(path)
62
73
  self.hash_mode = hash_mode
63
74
  self.save_result_to_file = save_result_to_file
@@ -109,7 +120,7 @@ class Checksum:
109
120
  str
110
121
  Checksum hash
111
122
  """
112
- if self.path.absolute().is_dir():
123
+ if self.path.absolute().is_dir(): # Dir
113
124
  new_path = self.path.joinpath(self.checksum_result_file_name)
114
125
  # List of files
115
126
  if recursive:
@@ -125,7 +136,7 @@ class Checksum:
125
136
  name = x.relative_to(self.path)
126
137
  res.append(f"{self._checksum_operation(x)} | {name}")
127
138
  output = "\n".join(res)
128
- else:
139
+ else: # File
129
140
  new_path = self.path.with_name(self.checksum_result_file_name)
130
141
  output = self._checksum_operation(self.path)
131
142
 
@@ -3,8 +3,8 @@ Absufyu: Converter
3
3
  ------------------
4
4
  Convert stuff
5
5
 
6
- Version: 1.3.0
7
- Date updated: 01/02/2025 (dd/mm/yyyy)
6
+ Version: 1.4.0
7
+ Date updated: 10/02/2025 (dd/mm/yyyy)
8
8
 
9
9
  Feature:
10
10
  --------
@@ -26,6 +26,7 @@ import re
26
26
  import string
27
27
  from itertools import chain, combinations
28
28
  from pathlib import Path
29
+ from typing import Self
29
30
 
30
31
  from absfuyu.core import CLITextColor
31
32
  from absfuyu.logger import logger
@@ -58,7 +59,7 @@ class Base64EncodeDecode:
58
59
  img_path : Path | str
59
60
  Path to image
60
61
  data_tag : bool, optional
61
- Add data tag before base64 string, by default False
62
+ Add data tag before base64 string, by default ``False``
62
63
 
63
64
  Returns
64
65
  -------
@@ -76,8 +77,6 @@ class Base64EncodeDecode:
76
77
  class ChemistryElement:
77
78
  """Chemistry Element"""
78
79
 
79
- _VERSION = (1, 1, 0)
80
-
81
80
  def __init__(self, name: str, number: int, symbol: str, atomic_mass: float) -> None:
82
81
  """
83
82
  name: element name
@@ -111,7 +110,7 @@ class ChemistryElement:
111
110
  }
112
111
 
113
112
  @classmethod
114
- def from_dict(cls, data: dict[str, str | int | float]) -> "ChemistryElement":
113
+ def from_dict(cls, data: dict[str, str | int | float]) -> Self:
115
114
  """
116
115
  Convert from ``dict`` data
117
116
 
@@ -159,7 +158,7 @@ class Text2Chemistry:
159
158
  # logger.debug(available)
160
159
  return base.difference(available)
161
160
 
162
- def convert(self, text: str) -> list[list[ChemistryElement]]:
161
+ def convert(self, text: str) -> list[list[ChemistryElement]] | list:
163
162
  """
164
163
  Convert text to chemistry symbol
165
164
 
@@ -231,6 +230,36 @@ class Text2Chemistry:
231
230
 
232
231
  return output
233
232
 
233
+ @staticmethod
234
+ def beautify_result(
235
+ result: list[list[ChemistryElement]] | list,
236
+ ) -> str: # Added in version 4.2.0
237
+ """Beautify the result from ``Text2Chemistry.convert()``
238
+
239
+ Parameters
240
+ ----------
241
+ result : list[list[ChemistryElement]] | list
242
+ Convert ``Text2Chemistry.convert()`` result
243
+
244
+ Returns
245
+ -------
246
+ str
247
+ Beautified output
248
+ """
249
+ if len(result) == 0:
250
+ res = "No possible combination"
251
+ else:
252
+ msg = []
253
+ for i, solution in enumerate(result, start=1):
254
+ msg.append(f"Option {i:02}: {', '.join([x.symbol for x in solution])}")
255
+ for x in solution:
256
+ msg.append(
257
+ f"{x.symbol} ({x.number}. {x.name} - {round(x.atomic_mass, 2)})"
258
+ )
259
+ msg.append("---")
260
+ res = "\n".join(msg)
261
+ return res
262
+
234
263
 
235
264
  class Str2Pixel:
236
265
  """Convert str into pixel"""