main
md 50 lines 2.49 KB
Rendered Raw
1 # localization.py DOX
2
3 ## Purpose
4
5 - Own the `localization.py` helper module.
6 - This module loads and resolves localized UI/application text.
7 - Keep this file-level DOX profile synchronized with `localization.py` because this directory is intentionally flat.
8
9 ## Ownership
10
11 - `localization.py` owns the runtime implementation.
12 - `localization.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.
13 - Classes:
14 - `Localization` (no explicit base class)
15 - `get(cls, *args, **kwargs)`
16 - `get_timezone(self) -> str`
17 - `get_tzinfo(self)`
18 - `get_offset_minutes(self) -> int`
19 - `apply_process_timezone(self) -> None`
20 - `now(self) -> datetime`
21 - `now_iso(self, sep: str=..., timespec: str=...) -> str`
22 - `localize_naive_datetime(self, dt: datetime) -> datetime`
23
24 ## Runtime Contracts
25
26 - Helper modules own reusable framework APIs and must preserve public callers unless all callers, tests, and docs are updated together.
27 - Update this file whenever public functions, classes, persistence behavior, path/security assumptions, side effects, or cross-module contracts change.
28 - Observed side-effect areas: filesystem writes, settings/state persistence.
29 - Imported dependency areas include: `datetime`, `helpers.dotenv`, `helpers.print_style`, `os`, `pytz`, `time`.
30
31 ## Key Concepts
32
33 - Important called helpers/classes observed in the source: `get_dotenv_value`, `pytz.timezone`, `datetime.now`, `now_in_tz.utcoffset`, `self.now.isoformat`, `self.get_tzinfo`, `cls`, `self.set_timezone`, `self._compute_offset_minutes`, `self.apply_process_timezone`, `tzinfo.localize`, `PrintStyle.debug`, `save_dotenv_value`, `localtime_str.strip.replace`, `local_datetime_obj.astimezone`, `utc_dt.astimezone`, `local_datetime_obj.isoformat`, `dt.astimezone`, `local_dt.isoformat`, `time.tzset`.
34 - Keep request/response, tool, or helper semantics documented here at the same time as source changes.
35
36 ## Work Guidance
37
38 - Preserve public helper APIs used by core code and plugins unless every caller is updated.
39 - Keep path, auth, secret, persistence, network, and subprocess behavior explicit and bounded.
40 - Prefer adding cohesive helper functions here only when behavior is reused across modules.
41
42 ## Verification
43
44 - Run targeted tests for changed helper behavior; run security regressions for auth, filesystem, WebSocket, tunnel, upload, or secret-handling helpers.
45 - Related tests observed by source search:
46 - `tests/test_timezone_regressions.py`
47
48 ## Child DOX Index
49
50 No child DOX files.