request-vm-on-golem 0.1.55__py3-none-any.whl → 0.1.56__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.
- {request_vm_on_golem-0.1.55.dist-info → request_vm_on_golem-0.1.56.dist-info}/METADATA +1 -1
- {request_vm_on_golem-0.1.55.dist-info → request_vm_on_golem-0.1.56.dist-info}/RECORD +5 -4
- requestor/settings.py +49 -0
- {request_vm_on_golem-0.1.55.dist-info → request_vm_on_golem-0.1.56.dist-info}/WHEEL +0 -0
- {request_vm_on_golem-0.1.55.dist-info → request_vm_on_golem-0.1.56.dist-info}/entry_points.txt +0 -0
@@ -18,11 +18,12 @@ requestor/services/database_service.py,sha256=GlSrzzzd7PSYQJNup00sxkB-B2PMr1__04
|
|
18
18
|
requestor/services/provider_service.py,sha256=XMZtdkrpEKiGg0iFW3v_cf3zu7BZcYp1wjaphxo2SCU,16250
|
19
19
|
requestor/services/ssh_service.py,sha256=tcOCtk2SlB9Uuv-P2ghR22e7BJ9kigQh5b4zSGdPFns,4280
|
20
20
|
requestor/services/vm_service.py,sha256=e05OgMZwz3NcCiIwmz4EnB6joMK6S3G_RT3VajD92lw,9438
|
21
|
+
requestor/settings.py,sha256=OzBVwtnCRn8qg_ByEJDGpQowz4zkdA81uIWU4_OsPjQ,1183
|
21
22
|
requestor/ssh/__init__.py,sha256=hNgSqJ5s1_AwwxVRyFjUqh_LTBpI4Hmzq0F-f_wXN9g,119
|
22
23
|
requestor/ssh/manager.py,sha256=3jQtbbK7CVC2yD1zCO88jGXh2fBcuv3CzWEqDLuaQVk,9758
|
23
24
|
requestor/utils/logging.py,sha256=lgAswzYvO9M0EOET0cFZvuAsGI4lInh_wln_6bI-fJk,4281
|
24
25
|
requestor/utils/spinner.py,sha256=X0jfPfs5ricglTS4_XmacrM2Z1DDHR7zGk2KqYZDpXg,2541
|
25
|
-
request_vm_on_golem-0.1.
|
26
|
-
request_vm_on_golem-0.1.
|
27
|
-
request_vm_on_golem-0.1.
|
28
|
-
request_vm_on_golem-0.1.
|
26
|
+
request_vm_on_golem-0.1.56.dist-info/METADATA,sha256=pTeRTJd-v6xEdUIJTdS44hdl3_atkEB9MaKg7LJ5FIw,15780
|
27
|
+
request_vm_on_golem-0.1.56.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
28
|
+
request_vm_on_golem-0.1.56.dist-info/entry_points.txt,sha256=Z-skRNpJ8aZcIl_En9mEm1ygkp9FKy0bzQoL3zO52-0,44
|
29
|
+
request_vm_on_golem-0.1.56.dist-info/RECORD,,
|
requestor/settings.py
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
import json
|
2
|
+
from pathlib import Path
|
3
|
+
from typing import Literal, TypedDict
|
4
|
+
|
5
|
+
from .config import config
|
6
|
+
|
7
|
+
|
8
|
+
class _Prefs(TypedDict, total=False):
|
9
|
+
price_display: Literal["fiat", "native"]
|
10
|
+
|
11
|
+
|
12
|
+
_PREFS_FILE = config.base_dir / "settings.json"
|
13
|
+
|
14
|
+
|
15
|
+
def _read_prefs() -> _Prefs:
|
16
|
+
try:
|
17
|
+
if _PREFS_FILE.exists():
|
18
|
+
data = json.loads(_PREFS_FILE.read_text())
|
19
|
+
if isinstance(data, dict):
|
20
|
+
return data # type: ignore[return-value]
|
21
|
+
except Exception:
|
22
|
+
pass
|
23
|
+
return {}
|
24
|
+
|
25
|
+
|
26
|
+
def _write_prefs(p: _Prefs) -> None:
|
27
|
+
try:
|
28
|
+
_PREFS_FILE.parent.mkdir(parents=True, exist_ok=True)
|
29
|
+
tmp = Path(str(_PREFS_FILE) + ".tmp")
|
30
|
+
tmp.write_text(json.dumps(p, indent=2))
|
31
|
+
tmp.replace(_PREFS_FILE)
|
32
|
+
except Exception:
|
33
|
+
# Best-effort persistence; ignore write errors
|
34
|
+
pass
|
35
|
+
|
36
|
+
|
37
|
+
def get_price_display() -> Literal["fiat", "native"]:
|
38
|
+
prefs = _read_prefs()
|
39
|
+
mode = prefs.get("price_display")
|
40
|
+
if mode in ("fiat", "native"):
|
41
|
+
return mode
|
42
|
+
return "fiat"
|
43
|
+
|
44
|
+
|
45
|
+
def set_price_display(mode: Literal["fiat", "native"]) -> None:
|
46
|
+
prefs = _read_prefs()
|
47
|
+
prefs["price_display"] = mode
|
48
|
+
_write_prefs(prefs)
|
49
|
+
|
File without changes
|
{request_vm_on_golem-0.1.55.dist-info → request_vm_on_golem-0.1.56.dist-info}/entry_points.txt
RENAMED
File without changes
|