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.

Files changed (42) hide show
  1. absfuyu/__init__.py +13 -10
  2. absfuyu/__main__.py +55 -38
  3. absfuyu/config/config.json +3 -3
  4. absfuyu/core.py +39 -25
  5. absfuyu/everything.py +4 -5
  6. absfuyu/extensions/__init__.py +3 -2
  7. absfuyu/extensions/dev/__init__.py +162 -19
  8. absfuyu/extensions/dev/password_hash.py +11 -10
  9. absfuyu/extensions/dev/passwordlib.py +256 -0
  10. absfuyu/extensions/dev/pkglib.py +53 -57
  11. absfuyu/extensions/dev/project_starter.py +58 -0
  12. absfuyu/extensions/dev/shutdownizer.py +8 -0
  13. absfuyu/extensions/extra/data_analysis.py +687 -119
  14. absfuyu/fun/__init__.py +88 -118
  15. absfuyu/fun/tarot.py +32 -34
  16. absfuyu/game/tictactoe2.py +90 -78
  17. absfuyu/{collections → general}/__init__.py +14 -12
  18. absfuyu/{collections → general}/content.py +105 -87
  19. absfuyu/{collections → general}/data_extension.py +652 -172
  20. absfuyu/{collections → general}/generator.py +65 -4
  21. absfuyu/{collections → general}/human.py +28 -3
  22. absfuyu/pkg_data/__init__.py +14 -36
  23. absfuyu/pkg_data/chemistry.pkl +0 -0
  24. absfuyu/pkg_data/tarot.pkl +0 -0
  25. absfuyu/tools/converter.py +58 -31
  26. absfuyu/tools/obfuscator.py +4 -4
  27. absfuyu/tools/stats.py +4 -4
  28. absfuyu/tools/web.py +2 -2
  29. absfuyu/util/lunar.py +144 -123
  30. absfuyu/util/path.py +22 -3
  31. absfuyu/util/performance.py +101 -14
  32. absfuyu/version.py +93 -84
  33. {absfuyu-2.8.1.dist-info → absfuyu-3.1.0.dist-info}/METADATA +63 -33
  34. absfuyu-3.1.0.dist-info/RECORD +55 -0
  35. {absfuyu-2.8.1.dist-info → absfuyu-3.1.0.dist-info}/WHEEL +1 -1
  36. absfuyu-3.1.0.dist-info/entry_points.txt +2 -0
  37. absfuyu/pkg_data/chemistry.json +0 -6268
  38. absfuyu/pkg_data/tarot.json +0 -2593
  39. absfuyu-2.8.1.dist-info/RECORD +0 -52
  40. absfuyu-2.8.1.dist-info/entry_points.txt +0 -2
  41. {absfuyu-2.8.1.dist-info → absfuyu-3.1.0.dist-info}/LICENSE +0 -0
  42. {absfuyu-2.8.1.dist-info → absfuyu-3.1.0.dist-info}/top_level.txt +0 -0
absfuyu/__init__.py CHANGED
@@ -12,7 +12,8 @@ USAGE
12
12
  -----
13
13
 
14
14
  Normal import:
15
- ``import absfuyu``
15
+ >>> import absfuyu
16
+ >>> help(absfuyu)
16
17
 
17
18
  Using in cmd (`absfuyu[cli]` required):
18
19
  ``$ fuyu --help``
@@ -25,17 +26,19 @@ __title__ = "absfuyu"
25
26
  __author__ = "AbsoluteWinter"
26
27
  __license__ = "MIT License"
27
28
  __all__ = [
28
- # default
29
- "util",
30
- # extra
31
- "sort", "fun",
32
- # "pkg_data",
33
- "game", "tools", "extensions",
34
- # config
29
+ "core",
35
30
  "config",
36
- # Other
31
+ "everything",
32
+ "extensions",
33
+ "logger",
34
+ "fun",
35
+ "game",
36
+ "general",
37
+ "pkg_data",
38
+ "sort",
39
+ "tools",
40
+ "util",
37
41
  "version",
38
- # "everything",
39
42
  ]
40
43
 
41
44
 
absfuyu/__main__.py CHANGED
@@ -1,12 +1,10 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
1
  """
4
2
  ABSFUYU
5
3
  ---
6
4
  COMMAND LINE INTERFACE
7
5
 
8
- Version: 2.0.0
9
- Date updated: 22/11/2023 (dd/mm/yyyy)
6
+ Version: 2.0.1
7
+ Date updated: 25/11/2023 (dd/mm/yyyy)
10
8
  """
11
9
 
12
10
 
@@ -22,6 +20,7 @@ try:
22
20
  except ImportError:
23
21
  # Auto install absfuyu[cli]
24
22
  from absfuyu.config import ABSFUYU_CONFIG
23
+
25
24
  if ABSFUYU_CONFIG._get_setting("auto-install-extra").value:
26
25
  __cmd: str = "python -m pip install -U absfuyu[cli]".split()
27
26
  subprocess.run(__cmd)
@@ -42,7 +41,7 @@ if CLI_MODE:
42
41
  colorama.init(autoreset=True)
43
42
  __COLOR = __core.Color
44
43
  else:
45
- __COLOR = {"green":"", "blue":"", "red":"", "yellow":"", "reset":""}
44
+ __COLOR = {"green": "", "blue": "", "red": "", "yellow": "", "reset": ""}
46
45
 
47
46
 
48
47
  # Main group
@@ -51,17 +50,21 @@ if CLI_MODE:
51
50
  def welcome():
52
51
  """Welcome message"""
53
52
  import os as __os
53
+
54
54
  try:
55
55
  user = __os.getlogin()
56
56
  except:
57
57
  import getpass
58
+
58
59
  user = getpass.getuser()
59
60
  welcome_msg = f"{__COLOR['green']}Welcome {__COLOR['red']}{user} {__COLOR['green']}to {__COLOR['blue']}absfuyu's cli"
60
- click.echo(f"""
61
+ click.echo(
62
+ f"""
61
63
  {__COLOR['reset']}{'='*(len(welcome_msg)-20)}
62
64
  {welcome_msg}
63
65
  {__COLOR['reset']}{'='*(len(welcome_msg)-20)}
64
- """)
66
+ """
67
+ )
65
68
  ABSFUYU_CONFIG.welcome()
66
69
 
67
70
 
@@ -74,9 +77,11 @@ def greet(name):
74
77
 
75
78
  @click.command()
76
79
  @click.option(
77
- "--setting", "-s",
80
+ "--setting",
81
+ "-s",
78
82
  type=click.Choice(["luckgod", "install-extra"]),
79
- help="Toggle on/off selected setting")
83
+ help="Toggle on/off selected setting",
84
+ )
80
85
  def toggle(setting: str):
81
86
  """Toggle on/off setting"""
82
87
 
@@ -84,7 +89,7 @@ def toggle(setting: str):
84
89
  trans = {
85
90
  "luckgod": "luckgod-mode",
86
91
  "install-extra": "auto-install-extra",
87
- } # trans[setting]
92
+ } # trans[setting]
88
93
 
89
94
  if setting is None:
90
95
  click.echo(f"{__COLOR['red']}Invalid setting")
@@ -101,18 +106,21 @@ def version():
101
106
  click.echo(f"{__COLOR['green']}absfuyu: {__v.__version__}")
102
107
 
103
108
 
104
-
105
109
  # Do group
106
110
  ###########################################################################
107
111
  @click.command()
108
112
  @click.option(
109
- "--force_update/--no-force-update", "-F/-f", "force_update",
110
- type=bool, default=True,
113
+ "--force_update/--no-force-update",
114
+ "-F/-f",
115
+ "force_update",
116
+ type=bool,
117
+ default=True,
111
118
  show_default=True,
112
- help="Update the package")
119
+ help="Update the package",
120
+ )
113
121
  def update(force_update: bool):
114
122
  """Update the package to latest version"""
115
- click.echo(__COLOR['green'])
123
+ click.echo(__COLOR["green"])
116
124
  __v._AbsfuyuPackage.check_for_update(force_update=force_update)
117
125
 
118
126
 
@@ -125,26 +133,32 @@ def reset():
125
133
 
126
134
  @click.command()
127
135
  @click.option(
128
- "--game-name", "-g",
129
- type=click.Choice(
130
- ["random", "esc", "rps", "ttt"],
131
- case_sensitive=False
132
- ),
133
- default="random", show_default=True,
134
- help="Play game")
136
+ "--game-name",
137
+ "-g",
138
+ type=click.Choice(["random", "esc", "rps", "ttt"], case_sensitive=False),
139
+ default="random",
140
+ show_default=True,
141
+ help="Play game",
142
+ )
135
143
  @click.option(
136
- "--size", "-s",
137
- type=int, default=3,
144
+ "--size",
145
+ "-s",
146
+ type=int,
147
+ default=3,
138
148
  show_default=True,
139
- help="Change game's size (if any)")
149
+ help="Change game's size (if any)",
150
+ )
140
151
  @click.option(
141
- "--mode", "-m",
142
- type=str, default=None,
143
- help="Change game's gamemode (if any)")
152
+ "--mode", "-m", type=str, default=None, help="Change game's gamemode (if any)"
153
+ )
144
154
  @click.option(
145
- "--board-style", "-b", "board_style",
146
- type=str, default="1",
147
- help="Change game's board style (if any)")
155
+ "--board-style",
156
+ "-b",
157
+ "board_style",
158
+ type=str,
159
+ default="1",
160
+ help="Change game's board style (if any)",
161
+ )
148
162
  def game(game_name: str, size: int, mode: str, board_style):
149
163
  """
150
164
  Play game
@@ -155,8 +169,9 @@ def game(game_name: str, size: int, mode: str, board_style):
155
169
  - ttt: Tic Tac Toe
156
170
  """
157
171
  from absfuyu.game import game_escapeLoop, game_RockPaperScissors
172
+
158
173
  if game_name.startswith("random"):
159
- if __randc([0,1]) == 0:
174
+ if __randc([0, 1]) == 0:
160
175
  game_escapeLoop()
161
176
  else:
162
177
  game_RockPaperScissors()
@@ -167,6 +182,7 @@ def game(game_name: str, size: int, mode: str, board_style):
167
182
  game_RockPaperScissors(hard_mode=mode)
168
183
  elif game_name.startswith("ttt"):
169
184
  from absfuyu.game.tictactoe import game_tictactoe
185
+
170
186
  if board_style == "None":
171
187
  board_style = None
172
188
  elif board_style == "1":
@@ -193,15 +209,14 @@ def install(pkg: str):
193
209
  click.echo(f"{__COLOR['green']}absfuyu[{pkg}] installed")
194
210
  else:
195
211
  click.echo(f"{__COLOR['green']}absfuyu[{pkg}] installed")
196
-
212
+
197
213
 
198
214
  @click.command()
199
215
  def advice():
200
216
  """Give some recommendation when bored"""
201
217
  from .fun import im_bored
202
- click.echo(f"{__COLOR['green']}{im_bored()}")
203
-
204
218
 
219
+ click.echo(f"{__COLOR['green']}{im_bored()}")
205
220
 
206
221
 
207
222
  @click.group(name="do")
@@ -209,6 +224,7 @@ def do_group():
209
224
  """Perform functionalities"""
210
225
  pass
211
226
 
227
+
212
228
  do_group.add_command(reset)
213
229
  do_group.add_command(update)
214
230
  do_group.add_command(game)
@@ -216,19 +232,20 @@ do_group.add_command(install)
216
232
  do_group.add_command(advice)
217
233
 
218
234
 
219
-
220
235
  # Main group init
221
236
  ###########################################################################
222
237
  @click.group()
223
238
  def main():
224
239
  """
225
240
  absfuyu's command line interface
226
-
241
+
227
242
  Usage:
228
243
  python -m absfuyu --help
229
244
  fuyu --help
230
245
  """
231
246
  pass
247
+
248
+
232
249
  main.add_command(welcome)
233
250
  main.add_command(greet)
234
251
  main.add_command(toggle)
@@ -240,4 +257,4 @@ main.add_command(do_group)
240
257
  ###########################################################################
241
258
  if __name__ == "__main__":
242
259
  if CLI_MODE:
243
- main()
260
+ main()
@@ -22,9 +22,9 @@
22
22
  }
23
23
  },
24
24
  "version": {
25
- "major": 2,
26
- "minor": 8,
27
- "patch": 1,
25
+ "major": 3,
26
+ "minor": 1,
27
+ "patch": 0,
28
28
  "release_level": "final",
29
29
  "serial": 0
30
30
  }
absfuyu/core.py CHANGED
@@ -3,8 +3,8 @@ Absfuyu: Core
3
3
  -------------
4
4
  Contain type hints and other stuffs
5
5
 
6
- Version: 2.1.5
7
- Date updated: 24/11/2023 (dd/mm/yyyy)
6
+ Version: 2.1.9
7
+ Date updated: 27/11/2023 (dd/mm/yyyy)
8
8
  """
9
9
 
10
10
 
@@ -12,27 +12,24 @@ Date updated: 24/11/2023 (dd/mm/yyyy)
12
12
  ###########################################################################
13
13
  __all__ = [
14
14
  # module
15
- "ModulePackage", "ModuleList",
15
+ "ModulePackage",
16
+ "ModuleList",
16
17
  # color
17
18
  "Color",
18
19
  "CLITextColor",
19
20
  # path
20
- "CORE_PATH", "CONFIG_PATH", "DATA_PATH"
21
+ "CORE_PATH",
22
+ "CONFIG_PATH",
23
+ "DATA_PATH",
21
24
  ]
22
25
 
23
- ModulePackage = [
24
- "all",
25
- "cli",
26
- "beautiful", "extra",
27
- "full",
28
- "dev"
29
- ]
26
+ ModulePackage = ["all", "cli", "beautiful", "extra", "res", "full", "dev"]
30
27
  ModuleList = [
31
- "collections",
32
28
  "config",
33
29
  "extensions",
34
30
  "fun",
35
31
  "game",
32
+ "general",
36
33
  "pkg_data",
37
34
  "sort",
38
35
  "tools",
@@ -44,6 +41,16 @@ ModuleList = [
44
41
  # Library
45
42
  ###########################################################################
46
43
  from pathlib import Path
44
+ # import sys
45
+
46
+ # if sys.version_info.minor >= 10:
47
+ # from importlib.resources import files
48
+ # else:
49
+ # try:
50
+ # from importlib_resources import files
51
+ # except:
52
+ # raise ImportError("Please install importlib-resources")
53
+
47
54
 
48
55
  try:
49
56
  import colorama as __colorama
@@ -64,40 +71,47 @@ if __colorama is not None:
64
71
  "RED": __colorama.Fore.RED,
65
72
  "yellow": __colorama.Fore.LIGHTYELLOW_EX,
66
73
  "YELLOW": __colorama.Fore.YELLOW,
67
- "reset": __colorama.Fore.RESET
74
+ "reset": __colorama.Fore.RESET,
68
75
  }
69
76
  else:
70
77
  Color = {
71
78
  "green": "",
72
79
  "GREEN": "",
73
80
  "blue": "",
74
- "BLUE":"",
81
+ "BLUE": "",
75
82
  "red": "",
76
83
  "RED": "",
77
84
  "yellow": "",
78
85
  "YELLOW": "",
79
- "reset": ""
86
+ "reset": "",
80
87
  }
81
88
 
82
89
 
83
90
  class CLITextColor:
84
91
  """Color code for text in terminal"""
85
- WHITE = "\x1b[37m"
86
- BLACK = "\x1b[30m"
87
- BLUE = "\x1b[34m"
88
- GRAY = "\x1b[90m"
89
- GREEN = "\x1b[32m"
90
- RED = "\x1b[91m"
91
- DARK_RED = "\x1b[31m"
92
- MAGENTA = "\x1b[35m"
93
- YELLOW = "\x1b[33m"
94
- RESET = "\x1b[39m"
92
+
93
+ WHITE = "\x1b[37m"
94
+ BLACK = "\x1b[30m"
95
+ BLUE = "\x1b[34m"
96
+ GRAY = "\x1b[90m"
97
+ GREEN = "\x1b[32m"
98
+ RED = "\x1b[91m"
99
+ DARK_RED = "\x1b[31m"
100
+ MAGENTA = "\x1b[35m"
101
+ YELLOW = "\x1b[33m"
102
+ RESET = "\x1b[39m"
95
103
 
96
104
 
97
105
  # Path
98
106
  ###########################################################################
99
107
  # CORE_PATH = Path(os.path.abspath(os.path.dirname(__file__)))
100
108
  CORE_PATH = Path(__file__).parent.absolute()
109
+ # CORE_PATH = files("absfuyu")
101
110
  CONFIG_PATH = CORE_PATH.joinpath("config", "config.json")
102
111
  DATA_PATH = CORE_PATH.joinpath("pkg_data")
103
112
 
113
+
114
+ # Run
115
+ ###########################################################################
116
+ if __name__ == "__main__":
117
+ print(CORE_PATH)
absfuyu/everything.py CHANGED
@@ -1,11 +1,10 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Absfuyu: Everything
4
3
  -------------------
5
4
  Everything has to offer in this package
6
5
 
7
- Version: 2.0.0
8
- Date updated: 24/11/2023 (mm/dd/yyyy)
6
+ Version: 2.0.1
7
+ Date updated: 26/11/2023 (mm/dd/yyyy)
9
8
 
10
9
  Usage:
11
10
  ------
@@ -23,7 +22,7 @@ from absfuyu.logger import *
23
22
  from absfuyu.sort import *
24
23
  from absfuyu.version import *
25
24
 
26
- from absfuyu.collections import *
25
+ from absfuyu.general import *
27
26
  from absfuyu.extensions import *
28
27
  from absfuyu.game import *
29
28
  from absfuyu.tools import *
@@ -32,4 +31,4 @@ from absfuyu.util import *
32
31
 
33
32
  # Is loaded
34
33
  ###########################################################################
35
- __IS_EVERYTHING = True
34
+ __IS_EVERYTHING = True
@@ -6,5 +6,6 @@ Version: 1.0.1
6
6
  Date updated: 24/11/2023 (dd/mm/yyyy)
7
7
  """
8
8
 
9
- def isloaded():
10
- return True
9
+
10
+ def is_loaded():
11
+ return True
@@ -11,16 +11,18 @@ Date updated: 23/11/2023 (dd/mm/yyyy)
11
11
  # Module level
12
12
  ###########################################################################
13
13
  __all__ = [
14
- "password_check", "fib",
14
+ "password_check",
15
+ "fib",
15
16
  ]
16
17
 
17
18
 
18
19
  # Library
19
20
  ###########################################################################
20
- import re
21
- import os as __os
21
+ import base64
22
+ from collections import deque
22
23
  from functools import lru_cache
23
-
24
+ import re
25
+ from typing import Dict, TypedDict, Final, List, NamedTuple
24
26
 
25
27
 
26
28
  # PASSWORD CHECKER
@@ -49,24 +51,27 @@ def password_check(password: str) -> bool:
49
51
  lowercase_error = re.search(r"[a-z]", password) is None
50
52
 
51
53
  # searching for symbols
52
- symbols = re.compile(r"[ !#$%&'()*+,-./[\\\]^_`{|}~"+r'"]')
54
+ symbols = re.compile(r"[ !#$%&'()*+,-./[\\\]^_`{|}~" + r'"]')
53
55
  symbol_error = symbols.search(password) is None
54
56
 
55
57
  detail = {
56
- 'password_ok': not any([ # overall result
57
- length_error, digit_error,
58
- uppercase_error, lowercase_error,
59
- symbol_error
60
- ]),
61
- 'length_error': length_error,
62
- 'digit_error': digit_error,
63
- 'uppercase_error': uppercase_error,
64
- 'lowercase_error': lowercase_error,
65
- 'symbol_error': symbol_error,
58
+ "password_ok": not any(
59
+ [ # overall result
60
+ length_error,
61
+ digit_error,
62
+ uppercase_error,
63
+ lowercase_error,
64
+ symbol_error,
65
+ ]
66
+ ),
67
+ "length_error": length_error,
68
+ "digit_error": digit_error,
69
+ "uppercase_error": uppercase_error,
70
+ "lowercase_error": lowercase_error,
71
+ "symbol_error": symbol_error,
66
72
  }
67
73
 
68
- return detail['password_ok']
69
-
74
+ return detail["password_ok"]
70
75
 
71
76
 
72
77
  # FIBONACCI WITH CACHE
@@ -76,13 +81,13 @@ def fib(n: int) -> int:
76
81
  # max recursion is 484
77
82
  if n < 2:
78
83
  return n
79
- return fib(n-1) + fib(n-2)
80
-
84
+ return fib(n - 1) + fib(n - 2)
81
85
 
82
86
 
83
87
  # https://stackoverflow.com/questions/563022/whats-python-good-practice-for-importing-and-offering-optional-features
84
88
  def optional_import(module: str, name: str = None, package: str = None):
85
89
  import importlib
90
+
86
91
  try:
87
92
  module = importlib.import_module(module)
88
93
  return module if name is None else getattr(module, name)
@@ -96,3 +101,141 @@ def optional_import(module: str, name: str = None, package: str = None):
96
101
  raise ValueError(msg) from import_error
97
102
 
98
103
  return _failed_import
104
+
105
+
106
+ def load_toml_file(toml_file: str):
107
+ """
108
+ Load ``.toml`` file
109
+
110
+ :param toml_file: Path to ``.toml`` file
111
+ """
112
+ from sys import version_info as _python_version
113
+
114
+ if _python_version.minor < 11:
115
+ try:
116
+ import tomli as tomllib
117
+ except ImportError:
118
+ raise ImportError("Please install tomli python package")
119
+ except:
120
+ raise SystemExit
121
+ else:
122
+ import tomllib
123
+
124
+ with open(toml_file, "rb") as file:
125
+ toml_data = tomllib.load(file)
126
+ return toml_data
127
+
128
+
129
+ def get_sitemap(url: str):
130
+ import re
131
+ import requests
132
+
133
+ class Url(NamedTuple):
134
+ base: str
135
+ extra: str
136
+
137
+ def __str__(self) -> str:
138
+ return f"{self.base}{self.extra}"
139
+
140
+ def __repr__(self) -> str:
141
+ return f"{self.__class__.__name__}({self.base}{self.extra})"
142
+
143
+ # robots.txt
144
+ # sitemap.xml
145
+ if not url.endswith("/"):
146
+ url += "/"
147
+ pattern = re.compile(
148
+ r"([(http(s)?):\/\/(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b)([-a-zA-Z0-9@:%_\+.~#?&//=]*)",
149
+ re.IGNORECASE,
150
+ )
151
+ try:
152
+ url += "sitemap.xml"
153
+ res = requests.get(url).text
154
+ except:
155
+ # W.I.P
156
+ url += "robots.txt"
157
+ res = requests.get(url).text
158
+ regex = re.findall(pattern, res)
159
+ return list(map(Url._make, regex))
160
+
161
+
162
+ from absfuyu.general import ClassBase
163
+
164
+ class SimpleStrEncrypt(ClassBase):
165
+ """
166
+ Simple Encryption
167
+
168
+ Logic:
169
+ - Base64
170
+ - Shift characters
171
+ """
172
+
173
+ def __init__(self, times_to_base64_encode: int = 10, shift: int = 13) -> None:
174
+ """
175
+ :param times_to_base64_encode: How many time to base64 encode
176
+ :type times_to_base64_encode: int
177
+ :param shift: Shift characters to the right for how many position
178
+ :type shift: int
179
+ """
180
+ self.times_to_base64_encode = times_to_base64_encode
181
+ self.shift = shift
182
+
183
+ # Support
184
+ def _convert_table(self, text: str, shift: int) -> Dict[str, str]:
185
+ data = text
186
+
187
+ data = deque(sorted(list(set(data))))
188
+ translate = data.copy()
189
+ translate.rotate(shift)
190
+ convert_table = dict(zip(data, translate))
191
+
192
+ return convert_table
193
+
194
+ @staticmethod
195
+ def _use_convert_table(text: str, convert_table: Dict[str, str]) -> str:
196
+ """Use convert table"""
197
+ data = list(text)
198
+ for i, x in enumerate(data):
199
+ data[i] = convert_table[x]
200
+ return "".join(data)
201
+
202
+ @staticmethod
203
+ def _b64encode(text: str) -> str:
204
+ return base64.b64encode(text.encode()).decode()
205
+
206
+ @staticmethod
207
+ def _b64decode(text: str) -> str:
208
+ return base64.b64decode(text).decode()
209
+
210
+ # Main
211
+ def encode(self, text: str) -> str:
212
+ # Base64
213
+ data = text
214
+ for _ in range(self.times_to_base64_encode):
215
+ data = self._b64encode(data)
216
+
217
+ # Shift
218
+ convert_table = self._convert_table(data, self.shift)
219
+ return self._use_convert_table(data, convert_table)
220
+
221
+ def decode(self, text: str) -> str:
222
+ # Shift back
223
+ data = text
224
+ convert_table = self._convert_table(data, -self.shift)
225
+ data = self._use_convert_table(data, convert_table)
226
+
227
+ # Base64
228
+ for _ in range(self.times_to_base64_encode):
229
+ data = self._b64decode(data)
230
+
231
+ return data
232
+
233
+
234
+
235
+
236
+ # testing
237
+ CON_VAR: Final[List[str]] = ["a", "b"] # Declare as final
238
+
239
+
240
+ if __name__ == "__main__":
241
+ print(get_sitemap("https://kingdomality.com/"))