absfuyu 4.2.0__py3-none-any.whl → 5.0.1__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 (72) hide show
  1. absfuyu/__init__.py +4 -4
  2. absfuyu/__main__.py +13 -1
  3. absfuyu/cli/__init__.py +2 -2
  4. absfuyu/cli/color.py +9 -2
  5. absfuyu/cli/config_group.py +2 -2
  6. absfuyu/cli/do_group.py +2 -37
  7. absfuyu/cli/game_group.py +2 -2
  8. absfuyu/cli/tool_group.py +7 -7
  9. absfuyu/config/__init__.py +17 -34
  10. absfuyu/core/__init__.py +49 -0
  11. absfuyu/core/baseclass.py +299 -0
  12. absfuyu/core/baseclass2.py +165 -0
  13. absfuyu/core/decorator.py +67 -0
  14. absfuyu/core/docstring.py +166 -0
  15. absfuyu/core/dummy_cli.py +67 -0
  16. absfuyu/core/dummy_func.py +49 -0
  17. absfuyu/dxt/__init__.py +42 -0
  18. absfuyu/dxt/dictext.py +201 -0
  19. absfuyu/dxt/dxt_support.py +79 -0
  20. absfuyu/dxt/intext.py +586 -0
  21. absfuyu/dxt/listext.py +508 -0
  22. absfuyu/dxt/strext.py +530 -0
  23. absfuyu/extra/__init__.py +12 -0
  24. absfuyu/extra/beautiful.py +252 -0
  25. absfuyu/{extensions → extra}/data_analysis.py +51 -82
  26. absfuyu/fun/__init__.py +110 -135
  27. absfuyu/fun/tarot.py +11 -19
  28. absfuyu/game/__init__.py +8 -2
  29. absfuyu/game/game_stat.py +8 -2
  30. absfuyu/game/sudoku.py +9 -3
  31. absfuyu/game/tictactoe.py +14 -7
  32. absfuyu/game/wordle.py +16 -10
  33. absfuyu/general/__init__.py +8 -81
  34. absfuyu/general/content.py +24 -38
  35. absfuyu/general/human.py +108 -228
  36. absfuyu/general/shape.py +1334 -0
  37. absfuyu/logger.py +10 -15
  38. absfuyu/pkg_data/__init__.py +137 -100
  39. absfuyu/pkg_data/deprecated.py +133 -0
  40. absfuyu/sort.py +6 -130
  41. absfuyu/tools/__init__.py +2 -2
  42. absfuyu/tools/checksum.py +33 -22
  43. absfuyu/tools/converter.py +51 -48
  44. absfuyu/{general → tools}/generator.py +17 -42
  45. absfuyu/tools/keygen.py +25 -30
  46. absfuyu/tools/obfuscator.py +246 -112
  47. absfuyu/tools/passwordlib.py +100 -30
  48. absfuyu/tools/shutdownizer.py +68 -47
  49. absfuyu/tools/web.py +4 -11
  50. absfuyu/util/__init__.py +17 -17
  51. absfuyu/util/api.py +10 -15
  52. absfuyu/util/json_method.py +7 -24
  53. absfuyu/util/lunar.py +5 -11
  54. absfuyu/util/path.py +22 -27
  55. absfuyu/util/performance.py +43 -67
  56. absfuyu/util/shorten_number.py +65 -14
  57. absfuyu/util/zipped.py +11 -17
  58. absfuyu/version.py +59 -42
  59. {absfuyu-4.2.0.dist-info → absfuyu-5.0.1.dist-info}/METADATA +41 -14
  60. absfuyu-5.0.1.dist-info/RECORD +68 -0
  61. absfuyu/core.py +0 -57
  62. absfuyu/everything.py +0 -32
  63. absfuyu/extensions/__init__.py +0 -12
  64. absfuyu/extensions/beautiful.py +0 -188
  65. absfuyu/fun/WGS.py +0 -134
  66. absfuyu/general/data_extension.py +0 -1796
  67. absfuyu/tools/stats.py +0 -226
  68. absfuyu/util/pkl.py +0 -67
  69. absfuyu-4.2.0.dist-info/RECORD +0 -59
  70. {absfuyu-4.2.0.dist-info → absfuyu-5.0.1.dist-info}/WHEEL +0 -0
  71. {absfuyu-4.2.0.dist-info → absfuyu-5.0.1.dist-info}/entry_points.txt +0 -0
  72. {absfuyu-4.2.0.dist-info → absfuyu-5.0.1.dist-info}/licenses/LICENSE +0 -0
@@ -3,94 +3,21 @@ Absfuyu: General
3
3
  ----------------
4
4
  Collection of useful classes
5
5
 
6
- Version: 1.1.4
7
- Date updated: 15/03/2024 (dd/mm/yyyy)
6
+ Version: 5.0.0
7
+ Date updated: 22/02/2025 (dd/mm/yyyy)
8
8
 
9
9
  Features:
10
10
  ---------
11
11
  - content
12
- - data_extension
13
12
  - generator
14
13
  - human
15
14
  """
16
15
 
17
- # Libary
18
- ###########################################################################
19
- from typing import Any, Dict, Optional
20
-
21
- from absfuyu.general import content, data_extension, generator, human
22
-
23
-
24
- # Class
25
- ###########################################################################
26
- class Dummy:
27
- """
28
- Dummy class that has nothing
29
-
30
- Update attribute through dict
31
- """
32
-
33
- def __init__(self, data: Optional[Dict[Any, Any]] = None) -> None:
34
- try:
35
- self.__dict__.update(data) # type: ignore
36
- except Exception:
37
- pass
38
-
39
- def __str__(self) -> str:
40
- class_name = self.__class__.__name__
41
- return f"{class_name}({self.__dict__})"
42
-
43
- def __repr__(self) -> str:
44
- return self.__str__()
45
-
46
- def dir_(self):
47
- """List ``property``"""
48
- return [x for x in self.__dir__() if not x.startswith("_")]
49
-
50
- def update(self, data: Dict[Any, Any]) -> None:
51
- """
52
- Update with dict data
16
+ # Module level
17
+ # ---------------------------------------------------------------------------
18
+ __all__ = ["content", "shape", "human"]
53
19
 
54
- :param data: Dict data
55
- :type data: dict
56
- """
57
- self.__dict__.update(data)
58
20
 
59
-
60
- class ClassBase:
61
- """Class base for other class"""
62
-
63
- def __init__(self) -> None:
64
- pass
65
-
66
- def __str__(self) -> str:
67
- return f"{self.__class__.__name__}({self._get_key_and_val_for_print()})"
68
-
69
- def __repr__(self) -> str:
70
- return self.__str__()
71
-
72
- def _get_key_and_val_for_print(self, sep: str = ", ") -> str:
73
- """
74
- returns `self.__dict__` without `{}` symbol
75
-
76
- Example:
77
- Convert `"a": "b"` to `a=b`
78
- """
79
- keys = self.__dict__.keys()
80
- temp = filter(lambda x: not x.startswith("_"), keys)
81
- # out = [f"{x}={self.__dict__[x]}" for x in temp]
82
- out = [f"{x}={self.__dict__.get(x)}" for x in temp]
83
- return sep.join(out)
84
-
85
- # def _get_new_available_method(self) -> List[str]:
86
- # """
87
- # Return all new available methods in this particular class
88
- # """
89
- # available = set(dir(self.__class__)).difference(set(dir(self.__class__.__base__)))
90
- # return sorted(list(available))
91
-
92
-
93
- # Run
94
- ###########################################################################
95
- if __name__ == "__main__":
96
- pass
21
+ # Libary
22
+ # ---------------------------------------------------------------------------
23
+ from absfuyu.general import content, human, shape
@@ -3,37 +3,38 @@ Absfuyu: Content
3
3
  ----------------
4
4
  Handle .txt file
5
5
 
6
- Version: 1.2.6
7
- Date updated: 05/04/2024 (dd/mm/yyyy)
6
+ Version: 5.0.0
7
+ Date updated: 25/02/2025 (dd/mm/yyyy)
8
8
 
9
9
  Usage:
10
10
  ------
11
11
  >>> from absfuyu.general.content import ContentLoader
12
12
  """
13
13
 
14
+ # TODO: rewrite this
15
+
14
16
  # Module level
15
- ###########################################################################
17
+ # ---------------------------------------------------------------------------
16
18
  __all__ = ["ContentLoader", "Content", "LoadedContent"]
17
19
 
18
20
 
19
21
  # Library
20
- ###########################################################################
22
+ # ---------------------------------------------------------------------------
21
23
  import json
22
24
  import random
23
25
  import re
24
26
  from collections import Counter
25
27
  from itertools import chain
26
28
  from pathlib import Path
27
- from typing import List, Optional
28
-
29
- from unidecode import unidecode
29
+ from typing import Self
30
30
 
31
+ from absfuyu.core import BaseClass, ShowAllMethodsMixin, unidecode
31
32
  from absfuyu.logger import logger
32
33
 
33
34
 
34
35
  # Class
35
- ###########################################################################
36
- class Content:
36
+ # ---------------------------------------------------------------------------
37
+ class Content(BaseClass):
37
38
  """
38
39
  Contain data
39
40
 
@@ -50,10 +51,7 @@ class Content:
50
51
  # return f"{self.data} | {self.tag}"
51
52
  return str(self.data)
52
53
 
53
- def __repr__(self) -> str:
54
- return self.__str__()
55
-
56
- def unidecoded(self) -> "Content":
54
+ def unidecoded(self) -> Self:
57
55
  """
58
56
  Convert data through ``unidecode`` package
59
57
 
@@ -97,7 +95,7 @@ class Content:
97
95
 
98
96
  def handle_address(
99
97
  self, address_separator: str = ",", *, first_item_not_address: bool = True
100
- ) -> "Content":
98
+ ) -> Self:
101
99
  """
102
100
  Handle ``self.data`` as address and then update the address into ``self.tag``
103
101
 
@@ -142,7 +140,7 @@ class Content:
142
140
  return self.__class__([self.data, self.tag])
143
141
 
144
142
 
145
- class LoadedContent(List[Content]):
143
+ class LoadedContent(list[Content], ShowAllMethodsMixin):
146
144
  """
147
145
  Contain list of ``Content``
148
146
  """
@@ -154,7 +152,7 @@ class LoadedContent(List[Content]):
154
152
  def __repr__(self) -> str:
155
153
  return self.__str__()
156
154
 
157
- def apply(self, func) -> "LoadedContent":
155
+ def apply(self, func) -> Self:
158
156
  """
159
157
  Apply function to each entry
160
158
 
@@ -165,7 +163,7 @@ class LoadedContent(List[Content]):
165
163
  return self.__class__(func(x.data) for x in self)
166
164
 
167
165
  @classmethod
168
- def load_from_json(cls, file: Path) -> "LoadedContent":
166
+ def load_from_json(cls, file: Path) -> Self:
169
167
  """
170
168
  Use this method to load data from ``.json`` file from ``to_json()`` method
171
169
 
@@ -202,7 +200,7 @@ class LoadedContent(List[Content]):
202
200
  logger.debug(temp)
203
201
  return Counter(temp)
204
202
 
205
- def filter(self, tag: str) -> "LoadedContent":
203
+ def filter(self, tag: str) -> Self:
206
204
  """
207
205
  Filter out entry with ``tag``
208
206
 
@@ -223,7 +221,7 @@ class LoadedContent(List[Content]):
223
221
  )
224
222
  return self.__class__([x for x in self if tag in x.tag])
225
223
 
226
- def find(self, keyword: str) -> "LoadedContent":
224
+ def find(self, keyword: str) -> Self:
227
225
  """
228
226
  Return all entries that include ``keyword``
229
227
 
@@ -240,7 +238,7 @@ class LoadedContent(List[Content]):
240
238
  logger.debug("No result")
241
239
  return temp
242
240
 
243
- def short_form(self, separator: str = ",") -> List[str]:
241
+ def short_form(self, separator: str = ",") -> list[str]:
244
242
  """
245
243
  Shows only first item when separated by ``separator`` of ``Content.data``
246
244
 
@@ -256,7 +254,7 @@ class LoadedContent(List[Content]):
256
254
  """
257
255
  return [x.short_form(separator) for x in self]
258
256
 
259
- def pick_one(self, tag: Optional[str] = None) -> Content:
257
+ def pick_one(self, tag: str | None = None) -> Content:
260
258
  """
261
259
  Pick a random entry
262
260
 
@@ -279,7 +277,7 @@ class LoadedContent(List[Content]):
279
277
 
280
278
  def handle_address(
281
279
  self, address_separator: str = ",", *, first_item_not_address: bool = True
282
- ) -> "LoadedContent":
280
+ ) -> Self:
283
281
  """
284
282
  Execute ``Content.handle_address()`` on every ``self.data`` of ``Content``
285
283
 
@@ -362,7 +360,7 @@ class LoadedContent(List[Content]):
362
360
  return "\n".join(out)
363
361
 
364
362
 
365
- class ContentLoader:
363
+ class ContentLoader(BaseClass):
366
364
  """
367
365
  This load data from ``.txt`` file
368
366
 
@@ -372,9 +370,9 @@ class ContentLoader:
372
370
 
373
371
  def __init__(
374
372
  self,
375
- file_path: Path,
373
+ file_path: Path | str,
376
374
  characteristic_detect: bool = True,
377
- tag_dictionary: Optional[dict] = None,
375
+ tag_dictionary: dict | None = None,
378
376
  *,
379
377
  comment_symbol: str = "#",
380
378
  split_symbol: str = "|",
@@ -437,12 +435,6 @@ class ContentLoader:
437
435
  self.split_symbol: str = split_symbol
438
436
  self.tag_separate_symbol: str = tag_separate_symbol
439
437
 
440
- def __str__(self) -> str:
441
- return f"{self.__class__.__name__}({self.__dict__})"
442
-
443
- def __repr__(self) -> str:
444
- return self.__str__()
445
-
446
438
  def content_format(self) -> str:
447
439
  """
448
440
  Shows current content format
@@ -462,7 +454,7 @@ class ContentLoader:
462
454
  out = (
463
455
  f"{self.comment_symbol} This line will be ignored\n"
464
456
  f"<content> {self.split_symbol} "
465
- f"<tag1>{self.tag_separate_symbol} <tag2>"
457
+ f"<tag1>{self.tag_separate_symbol} <tag2>, ..., <tag n>"
466
458
  )
467
459
  return out
468
460
 
@@ -557,9 +549,3 @@ class ContentLoader:
557
549
  Loaded content
558
550
  """
559
551
  return LoadedContent(map(Content, self.load()))
560
-
561
-
562
- # Run
563
- ###########################################################################
564
- if __name__ == "__main__":
565
- logger.setLevel(10)