hungerlib 4.3__tar.gz → 4.4__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.
- {hungerlib-4.3/src/hungerlib.egg-info → hungerlib-4.4}/PKG-INFO +1 -1
- {hungerlib-4.3 → hungerlib-4.4}/pyproject.toml +1 -1
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/__init__.py +6 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/configloader.py +3 -2
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/utils/__init__.py +4 -1
- hungerlib-4.4/src/hungerlib/utils/maps/__init__.py +11 -0
- hungerlib-4.4/src/hungerlib/utils/maps/timemaps.py +48 -0
- {hungerlib-4.3 → hungerlib-4.4/src/hungerlib.egg-info}/PKG-INFO +1 -1
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib.egg-info/SOURCES.txt +4 -2
- {hungerlib-4.3 → hungerlib-4.4}/LICENSE +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/README.md +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/setup.cfg +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/api/__init__.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/api/backups.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/api/command.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/api/databases.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/api/filemanager.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/api/schedule.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/api/startup.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/bridgeclient.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/datamap.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/messagerouter.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/panel.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/servers/__init__.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/servers/generic.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/servers/minecraft.py +0 -0
- {hungerlib-4.3/src/hungerlib/utils → hungerlib-4.4/src/hungerlib/utils/maps}/colormaps.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/utils/time.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib/utils/utils.py +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib.egg-info/dependency_links.txt +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib.egg-info/requires.txt +0 -0
- {hungerlib-4.3 → hungerlib-4.4}/src/hungerlib.egg-info/top_level.txt +0 -0
|
@@ -28,6 +28,8 @@ from .utils import (
|
|
|
28
28
|
Snapshot,
|
|
29
29
|
clearTerminal,
|
|
30
30
|
validateAll,
|
|
31
|
+
TimeMap,
|
|
32
|
+
TIME_MAP,
|
|
31
33
|
)
|
|
32
34
|
|
|
33
35
|
# namespaces
|
|
@@ -36,6 +38,8 @@ utils = SimpleNamespace(
|
|
|
36
38
|
ASCII_COLOR_MAP = ASCII_COLOR_MAP,
|
|
37
39
|
MC_COLOR_MAP = MC_COLOR_MAP,
|
|
38
40
|
STRIP_COLOR_MAP = STRIP_COLOR_MAP,
|
|
41
|
+
TimeMap = TimeMap,
|
|
42
|
+
TIME_MAP = TIME_MAP,
|
|
39
43
|
snapSchedule = snapSchedule,
|
|
40
44
|
runCountdownEvents = runCountdownEvents,
|
|
41
45
|
waitForOnline = waitForOnline,
|
|
@@ -88,6 +92,8 @@ __all__ = [
|
|
|
88
92
|
'ASCII_COLOR_MAP',
|
|
89
93
|
'MC_COLOR_MAP',
|
|
90
94
|
'STRIP_COLOR_MAP',
|
|
95
|
+
'TimeMap',
|
|
96
|
+
'TIME_MAP',
|
|
91
97
|
'snapSchedule',
|
|
92
98
|
'runCountdownEvents',
|
|
93
99
|
'waitForOnline',
|
|
@@ -78,8 +78,9 @@ def loadConfig(schema, runtime_path: str | None = None):
|
|
|
78
78
|
raw = load_yaml(abs_runtime)
|
|
79
79
|
values = {}
|
|
80
80
|
|
|
81
|
-
# 5. Load fallback class
|
|
82
|
-
|
|
81
|
+
# 5. Load fallback class from the same module
|
|
82
|
+
module = importlib.import_module(schema.__module__)
|
|
83
|
+
fallbacks = getattr(module, 'fallbacks', None)
|
|
83
84
|
|
|
84
85
|
# 6. Map YAML → dataclass fields
|
|
85
86
|
mode = getattr(schema, "__mode__", None)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
from .colormaps import ColorMap, ASCII_COLOR_MAP, MC_COLOR_MAP, STRIP_COLOR_MAP
|
|
1
|
+
from .maps.colormaps import ColorMap, ASCII_COLOR_MAP, MC_COLOR_MAP, STRIP_COLOR_MAP
|
|
2
|
+
from .maps.timemaps import TimeMap, TIME_MAP
|
|
2
3
|
from .time import (
|
|
3
4
|
snapSchedule,
|
|
4
5
|
runCountdownEvents,
|
|
@@ -14,6 +15,8 @@ __all__ = [
|
|
|
14
15
|
'ASCII_COLOR_MAP',
|
|
15
16
|
'MC_COLOR_MAP',
|
|
16
17
|
'STRIP_COLOR_MAP',
|
|
18
|
+
'TimeMap',
|
|
19
|
+
'TIME_MAP',
|
|
17
20
|
'snapSchedule',
|
|
18
21
|
'runCountdownEvents',
|
|
19
22
|
'waitForOnline',
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from zoneinfo import ZoneInfo
|
|
3
|
+
from datamap import datamap, datamap_api
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@datamap(syntax=datamap_api.percents, mode='dynamic')
|
|
7
|
+
class TimeMap:
|
|
8
|
+
# default timezone
|
|
9
|
+
_default_tz = ZoneInfo('UTC')
|
|
10
|
+
|
|
11
|
+
# dynamic fields
|
|
12
|
+
hh: str = None
|
|
13
|
+
mm: str = None
|
|
14
|
+
ss: str = None
|
|
15
|
+
ms: str = None
|
|
16
|
+
|
|
17
|
+
YYYY: str = None
|
|
18
|
+
MM: str = None
|
|
19
|
+
DD: str = None
|
|
20
|
+
weekday: str = None
|
|
21
|
+
|
|
22
|
+
def __new__(cls, tz: str | None = None):
|
|
23
|
+
if tz is None:
|
|
24
|
+
obj = super().__new__(cls)
|
|
25
|
+
obj.TZ = cls._default_tz
|
|
26
|
+
return obj
|
|
27
|
+
|
|
28
|
+
obj = super().__new__(cls)
|
|
29
|
+
obj.TZ = ZoneInfo(tz)
|
|
30
|
+
return obj
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def providers(self):
|
|
34
|
+
return {
|
|
35
|
+
'hh': lambda: f'{datetime.now(self.TZ).hour:02d}',
|
|
36
|
+
'mm': lambda: f'{datetime.now(self.TZ).minute:02d}',
|
|
37
|
+
'ss': lambda: f'{datetime.now(self.TZ).second:02d}',
|
|
38
|
+
'ms': lambda: f'{int(datetime.now(self.TZ).microsecond / 1000):03d}',
|
|
39
|
+
|
|
40
|
+
'YYYY': lambda: str(datetime.now(self.TZ).year),
|
|
41
|
+
'MM': lambda: f'{datetime.now(self.TZ).month:02d}',
|
|
42
|
+
'DD': lambda: f'{datetime.now(self.TZ).day:02d}',
|
|
43
|
+
|
|
44
|
+
'weekday': lambda: datetime.now(self.TZ).strftime('%A'),
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# proxy map
|
|
48
|
+
TIME_MAP = TimeMap
|
|
@@ -23,6 +23,8 @@ src/hungerlib/servers/__init__.py
|
|
|
23
23
|
src/hungerlib/servers/generic.py
|
|
24
24
|
src/hungerlib/servers/minecraft.py
|
|
25
25
|
src/hungerlib/utils/__init__.py
|
|
26
|
-
src/hungerlib/utils/colormaps.py
|
|
27
26
|
src/hungerlib/utils/time.py
|
|
28
|
-
src/hungerlib/utils/utils.py
|
|
27
|
+
src/hungerlib/utils/utils.py
|
|
28
|
+
src/hungerlib/utils/maps/__init__.py
|
|
29
|
+
src/hungerlib/utils/maps/colormaps.py
|
|
30
|
+
src/hungerlib/utils/maps/timemaps.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|