-
Notifications
You must be signed in to change notification settings - Fork 618
/
settings_static.py
83 lines (70 loc) 路 2.43 KB
/
settings_static.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
"""
static settings.
"""
from typing import Any, Dict, Iterable, Optional, Sequence, Tuple, Union
SettingsDict = Dict[str, Union[str, float, Tuple, None]]
class SettingsStatic:
# TODO(jhr): figure out how to share type defs with sdk/wandb_settings.py
_offline: Optional[bool]
_disable_stats: Optional[bool]
_disable_meta: Optional[bool]
_start_time: float
_start_datetime: str
_stats_pid: int
_stats_sample_rate_seconds: float
_stats_samples_to_average: int
_stats_join_assets: bool
files_dir: str
program_relpath: Optional[str]
log_internal: str
_internal_check_process: bool
is_local: Optional[bool]
_colab: Optional[bool]
_jupyter: Optional[bool]
notebook_name: Optional[str]
_jupyter_path: Optional[str]
_jupyter_name: Optional[str]
_jupyter_root: Optional[str]
_require_service: Optional[str]
_live_policy_rate_limit: Optional[int]
resume: Optional[str]
program: Optional[str]
silent: Optional[bool]
email: Optional[str]
git_commit: Optional[str]
git_remote: Optional[str]
git_remote_url: Optional[str]
git_root: Optional[str]
docker: Optional[str]
_cuda: Optional[str]
_args: Optional[Sequence[str]]
_os: Optional[str]
_python: Optional[str]
disable_git: Optional[bool]
_save_requirements: Optional[bool]
save_code: Optional[bool]
disable_code: Optional[bool]
anonymous: Optional[str]
host: Optional[str]
username: Optional[str]
_executable: str
# TODO(jhr): clean this up, it is only in SettingsStatic and not in Settings
_log_level: int
def __init__(self, d: "SettingsDict") -> None:
object.__setattr__(self, "__dict__", d)
def __setattr__(self, name: str, value: object) -> None:
raise AttributeError("Error: SettingsStatic is a readonly object")
def __setitem__(self, key: str, val: object) -> None:
raise AttributeError("Error: SettingsStatic is a readonly object")
def keys(self) -> "Iterable[str]":
return self.__dict__.keys()
def items(self) -> "Iterable[Any]":
return self.__dict__.items()
def __getitem__(self, key: str) -> "Any":
return self.__dict__[key]
def __str__(self) -> str:
return str(self.__dict__)
def __contains__(self, key: str) -> bool:
return key in self.__dict__
def get(self, key: str, default: Any = None) -> Any:
return self.__dict__.get(key, default)