hungerlib 2.3.4.dev0__tar.gz → 2.3.6.dev0__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.
Files changed (30) hide show
  1. {hungerlib-2.3.4.dev0/src/hungerlib.egg-info → hungerlib-2.3.6.dev0}/PKG-INFO +1 -1
  2. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/pyproject.toml +1 -1
  3. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/__init__.py +1 -1
  4. hungerlib-2.3.6.dev0/src/hungerlib/addons/colormap.py +77 -0
  5. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/logger.py +11 -6
  6. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0/src/hungerlib.egg-info}/PKG-INFO +1 -1
  7. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib.egg-info/SOURCES.txt +0 -2
  8. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib.egg-info/top_level.txt +0 -1
  9. hungerlib-2.3.4.dev0/src/examples/Config.py +0 -24
  10. hungerlib-2.3.4.dev0/src/hungerlib/addons/colormap.py +0 -44
  11. hungerlib-2.3.4.dev0/src/hungerlib/config.py +0 -30
  12. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/LICENSE +0 -0
  13. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/README.md +0 -0
  14. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/setup.cfg +0 -0
  15. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/addons/generic.py +0 -0
  16. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/addons/minecraft.py +0 -0
  17. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/api/__init__.py +0 -0
  18. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/api/backups.py +0 -0
  19. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/api/command.py +0 -0
  20. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/api/databases.py +0 -0
  21. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/api/filemanager.py +0 -0
  22. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/api/schedule.py +0 -0
  23. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/api/startup.py +0 -0
  24. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/mchelpers.py +0 -0
  25. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/panel.py +0 -0
  26. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/scheduler.py +0 -0
  27. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/servers/generic.py +0 -0
  28. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib/servers/minecraft.py +0 -0
  29. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib.egg-info/dependency_links.txt +0 -0
  30. {hungerlib-2.3.4.dev0 → hungerlib-2.3.6.dev0}/src/hungerlib.egg-info/requires.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hungerlib
3
- Version: 2.3.4.dev0
3
+ Version: 2.3.6.dev0
4
4
  Summary: Powerful automation library for Pterodactyl.
5
5
  Author: iFamished
6
6
  License: MIT
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "hungerlib"
10
- version = "2.3.4-dev"
10
+ version = "2.3.6-dev"
11
11
  description = "Powerful automation library for Pterodactyl."
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.10"
@@ -40,7 +40,7 @@ _EXPORTS = {
40
40
  "waitForOffline": ("addons.generic", "waitForOffline"),
41
41
  "checkLag": ("addons.minecraft", "checkLag"),
42
42
  "MC_COLOR_MAP": ("addons.colormap", "MC_COLOR_MAP"),
43
- "ASCI_COLOR_MAP": ("addons.colormap", "ASCI_COLOR_MAP"),
43
+ "ASCII_COLOR_MAP": ("addons.colormap", "ASCII_COLOR_MAP"),
44
44
 
45
45
  # api endpoints
46
46
  "ScheduleAPI": ("api.schedule", "ScheduleAPI"),
@@ -0,0 +1,77 @@
1
+ # Environment-based color translation and mapping
2
+ from dataclasses import dataclass, field
3
+
4
+
5
+ @dataclass(frozen=True)
6
+ class ColorMap:
7
+ black: str
8
+ dark_blue: str
9
+ dark_green: str
10
+ dark_aqua: str
11
+ dark_red: str
12
+ dark_purple: str
13
+ gold: str
14
+ gray: str
15
+ dark_gray: str
16
+ blue: str
17
+ green: str
18
+ aqua: str
19
+ red: str
20
+ light_purple: str
21
+ yellow: str
22
+ white: str
23
+ reset: str
24
+ bold: str
25
+ italic: str
26
+
27
+ def as_dict(self):
28
+ """Convert dataclass to dict with <tags> as keys."""
29
+ return {
30
+ f"<{field}>": getattr(self, field)
31
+ for field in self.__dataclass_fields__
32
+ }
33
+
34
+
35
+ MC_COLOR_MAP = ColorMap(
36
+ black="§0",
37
+ dark_blue="§1",
38
+ dark_green="§2",
39
+ dark_aqua="§3",
40
+ dark_red="§4",
41
+ dark_purple="§5",
42
+ gold="§6",
43
+ gray="§7",
44
+ dark_gray="§8",
45
+ blue="§9",
46
+ green="§a",
47
+ aqua="§b",
48
+ red="§c",
49
+ light_purple="§d",
50
+ yellow="§e",
51
+ white="§f",
52
+ reset="§r",
53
+ bold="§l",
54
+ italic="§o"
55
+ )
56
+
57
+ ASCII_COLOR_MAP = ColorMap(
58
+ black="\033[30m",
59
+ dark_blue="\033[34m",
60
+ dark_green="\033[32m",
61
+ dark_aqua="\033[36m",
62
+ dark_red="\033[31m",
63
+ dark_purple="\033[35m",
64
+ gold="\033[33m",
65
+ gray="\033[37m",
66
+ dark_gray="\033[90m",
67
+ blue="\033[94m",
68
+ green="\033[92m",
69
+ aqua="\033[96m",
70
+ red="\033[91m",
71
+ light_purple="\033[95m",
72
+ yellow="\033[93m",
73
+ white="\033[97m",
74
+ reset="\033[0m",
75
+ bold="\033[1m",
76
+ italic="\033[3m"
77
+ )
@@ -8,6 +8,7 @@ time.tzset()
8
8
  import logging
9
9
  from pathlib import Path
10
10
  from datetime import datetime
11
+ from hungerlib.addons.colormap import ASCII_COLOR_MAP, MC_COLOR_MAP
11
12
 
12
13
 
13
14
  class HungerLogger:
@@ -23,8 +24,8 @@ class HungerLogger:
23
24
 
24
25
  # color mapping
25
26
  file_color_map=None,
26
- origin_color_map=ASCI_COLOR_MAP,
27
- destination_color_map=ASCI_COLOR_MAP,
27
+ origin_color_map=ASCII_COLOR_MAP.as_dict(),
28
+ destination_color_map=ASCII_COLOR_MAP.as_dict(),
28
29
  mc_color_map=MC_COLOR_MAP,
29
30
 
30
31
  # prefixes
@@ -36,7 +37,7 @@ class HungerLogger:
36
37
  self.name = name
37
38
  self.server = server
38
39
  self.log_path = Path(f'{log_path}')
39
- self.log_destionation_method = log_destination_method
40
+ self.log_destination_method = log_destination_method
40
41
 
41
42
  self.console_backspaces = '\b' * console_backspaces
42
43
 
@@ -45,6 +46,10 @@ class HungerLogger:
45
46
  self.destination_color_map = destination_color_map
46
47
  self.mc_color_map = mc_color_map
47
48
 
49
+ self.info_prefix = info_prefix
50
+ self.warn_prefix = warn_prefix
51
+ self.error_prefix = error_prefix
52
+
48
53
  self.prefixes = {
49
54
  "INFO": self.info_prefix,
50
55
  "WARN": self.warn_prefix,
@@ -52,12 +57,12 @@ class HungerLogger:
52
57
  }
53
58
 
54
59
  self.log_path.mkdir(parents=True, exist_ok=True)
55
- self.logger = logging.getLogger(loggerName)
60
+ self.logger = logging.getLogger(name)
56
61
  self.logger.setLevel(logging.DEBUG)
57
62
  self._initializeLogger()
58
63
 
59
64
  def _initializeLogger(self):
60
- logFile = self.logDir / f"{self.loggerName}_{datetime.now().strftime('%Y-%m-%d')}.log"
65
+ logFile = self.log_path / f"{self.name}_{datetime.now().strftime('%Y-%m-%d')}.log"
61
66
 
62
67
  if not self.logger.handlers:
63
68
  handler = logging.FileHandler(str(logFile))
@@ -97,7 +102,7 @@ class HungerLogger:
97
102
 
98
103
 
99
104
  def _log(self, level, msg, destination, origin, logs):
100
- prefix = self.prefixes[level] + f"[{self.loggerName}] "
105
+ prefix = self.prefixes[level] + f"[{self.name}] "
101
106
  full = prefix + msg
102
107
 
103
108
  if destination:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hungerlib
3
- Version: 2.3.4.dev0
3
+ Version: 2.3.6.dev0
4
4
  Summary: Powerful automation library for Pterodactyl.
5
5
  Author: iFamished
6
6
  License: MIT
@@ -1,9 +1,7 @@
1
1
  LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
- src/examples/Config.py
5
4
  src/hungerlib/__init__.py
6
- src/hungerlib/config.py
7
5
  src/hungerlib/logger.py
8
6
  src/hungerlib/mchelpers.py
9
7
  src/hungerlib/panel.py
@@ -1,24 +0,0 @@
1
- from hungerlib import Config, Panel
2
- from pathlib import Path
3
- from hungerlib.addons.colormap import ASCI_COLOR_MAP, MC_COLOR_MAP
4
-
5
- ExampleConfig = Config(
6
-
7
- # Color maps
8
- file_color_map=None,
9
- origin_color_map=ASCI_COLOR_MAP.copy(),
10
- destination_color_map=ASCI_COLOR_MAP.copy(),
11
- mc_color_map=MC_COLOR_MAP.copy(),
12
-
13
-
14
- # --- Prefixes ---
15
- info_prefix='<white>[INFO]: ',
16
- warn_prefix='<yellow>[WARN]: ',
17
- error_prefix='<red>[ERROR]: ',
18
- console_backspaces=8,
19
-
20
- # --- Logging ---
21
- log_path=Path("/home/container/logs"),
22
- log_destination_method='rcon',
23
-
24
- )
@@ -1,44 +0,0 @@
1
- # Environment-based color translation and mapping
2
-
3
- MC_COLOR_MAP = {
4
- "<black>": "§0",
5
- "<dark_blue>": "§1",
6
- "<dark_green>": "§2",
7
- "<dark_aqua>": "§3",
8
- "<dark_red>": "§4",
9
- "<dark_purple>": "§5",
10
- "<gold>": "§6",
11
- "<gray>": "§7",
12
- "<dark_gray>": "§8",
13
- "<blue>": "§9",
14
- "<green>": "§a",
15
- "<aqua>": "§b",
16
- "<red>": "§c",
17
- "<light_purple>": "§d",
18
- "<yellow>": "§e",
19
- "<white>": "§f",
20
- "<reset>": "§r",
21
- "<bold>": "§l",
22
- "<italic>": "§o"
23
- }
24
- ASCI_COLOR_MAP = {
25
- "<black>": "\033[30m",
26
- "<dark_blue>": "\033[34m",
27
- "<dark_green>": "\033[32m",
28
- "<dark_aqua>": "\033[36m",
29
- "<dark_red>": "\033[31m",
30
- "<dark_purple>": "\033[35m",
31
- "<gold>": "\033[33m",
32
- "<gray>": "\033[37m",
33
- "<dark_gray>": "\033[90m",
34
- "<blue>": "\033[94m",
35
- "<green>": "\033[92m",
36
- "<aqua>": "\033[96m",
37
- "<red>": "\033[91m",
38
- "<light_purple>": "\033[95m",
39
- "<yellow>": "\033[93m",
40
- "<white>": "\033[97m",
41
- "<reset>": "\033[0m",
42
- "<bold>": "\033[1m",
43
- "<italic>": "\033[3m"
44
- }
@@ -1,30 +0,0 @@
1
- # =====================================
2
- # CORE CONFIG SYSTEM
3
- # =====================================
4
- # The variables in this file can be used to control many things in Hungerlib's functions.
5
- # It helps keep track of constants and serves as an easy-to-use configuration system.
6
-
7
- from dataclasses import dataclass, field
8
- from pathlib import Path
9
- from hungerlib.addons.colormap import *
10
-
11
- @dataclass
12
- class Config:
13
-
14
- # Color maps
15
- file_color_map: dict | None = None
16
- origin_color_map: dict = field(default_factory=lambda: ASCI_COLOR_MAP.copy())
17
- destination_color_map: dict = field(default_factory=lambda: ASCI_COLOR_MAP.copy())
18
- mc_color_map: dict = field(default_factory=lambda: MC_COLOR_MAP.copy())
19
-
20
- # Prefixes
21
- info_prefix: str = '<white>[INFO]: '
22
- warn_prefix: str = '<yellow>[WARN]: '
23
- error_prefix: str = '<red>[ERROR]: '
24
- console_backspaces: int = 8
25
-
26
- # Logging
27
- log_path: Path = Path("/home/container/logs")
28
- log_destination_method: str = 'rcon'
29
-
30
- _internal_config = Config()
File without changes
File without changes
File without changes