Add files via upload
This commit is contained in:
1 parent
d3e8504706
commit
502309ad24
25 files changed
+4097
-3006
No files matched your search
+26
-17
@@ -1,17 +1,26 @@
|
||||
# config/__init__.py
|
||||
import json, os
|
||||
from pathlib import Path
|
||||
|
||||
_CONFIG_PATH = Path(__file__).parent / "api_keys.json"
|
||||
|
||||
def get_config() -> dict:
|
||||
with open(_CONFIG_PATH, "r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
|
||||
def get_os() -> str:
|
||||
"""Returns: 'windows' | 'mac' | 'linux'"""
|
||||
return get_config().get("os_system", "windows").lower()
|
||||
|
||||
def is_windows() -> bool: return get_os() == "windows"
|
||||
def is_mac() -> bool: return get_os() == "mac"
|
||||
def is_linux() -> bool: return get_os() == "linux"
|
||||
# config/__init__.py
|
||||
import json
|
||||
import platform
|
||||
from pathlib import Path
|
||||
|
||||
_CONFIG_PATH = Path(__file__).parent / "api_keys.json"
|
||||
|
||||
def get_config() -> dict:
|
||||
try:
|
||||
with open(_CONFIG_PATH, "r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
except Exception:
|
||||
return {}
|
||||
|
||||
def get_os() -> str:
|
||||
"""Returns 'windows' | 'mac' | 'linux' — detected at runtime, not from config."""
|
||||
s = platform.system().lower()
|
||||
if s == "darwin":
|
||||
return "mac"
|
||||
if s == "windows":
|
||||
return "windows"
|
||||
return "linux"
|
||||
|
||||
def is_windows() -> bool: return get_os() == "windows"
|
||||
def is_mac() -> bool: return get_os() == "mac"
|
||||
def is_linux() -> bool: return get_os() == "linux"
|
||||
Reference in new issue
Block a user