wandb 0.18.7__py3-none-any.whl → 0.19.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- package_readme.md +8 -0
- wandb/__init__.py +5 -7
- wandb/__init__.pyi +51 -30
- wandb/analytics/sentry.py +4 -10
- wandb/apis/importers/internals/internal.py +6 -6
- wandb/apis/importers/internals/protocols.py +11 -7
- wandb/apis/public/jobs.py +1 -7
- wandb/apis/public/reports.py +6 -17
- wandb/apis/public/runs.py +12 -10
- wandb/bin/gpu_stats +0 -0
- wandb/cli/cli.py +9 -45
- wandb/env.py +3 -5
- wandb/errors/links.py +1 -1
- wandb/errors/term.py +1 -6
- wandb/filesync/dir_watcher.py +3 -3
- wandb/filesync/step_upload.py +2 -5
- wandb/integration/fastai/__init__.py +1 -6
- wandb/integration/gym/__init__.py +1 -7
- wandb/integration/keras/callbacks/metrics_logger.py +1 -8
- wandb/integration/keras/callbacks/model_checkpoint.py +1 -8
- wandb/integration/keras/keras.py +3 -5
- wandb/integration/lightgbm/__init__.py +1 -1
- wandb/integration/sb3/sb3.py +1 -7
- wandb/integration/sklearn/utils.py +1 -1
- wandb/integration/tensorboard/log.py +1 -2
- wandb/integration/torch/wandb_torch.py +1 -1
- wandb/integration/ultralytics/bbox_utils.py +9 -2
- wandb/jupyter.py +4 -4
- wandb/proto/v3/wandb_internal_pb2.py +31 -31
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_internal_pb2.py +31 -31
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v5/wandb_internal_pb2.py +31 -31
- wandb/proto/v5/wandb_settings_pb2.py +2 -2
- wandb/proto/wandb_deprecated.py +1 -11
- wandb/proto/wandb_generate_deprecated.py +3 -7
- wandb/sdk/artifacts/artifact.py +2 -10
- wandb/sdk/artifacts/artifact_file_cache.py +2 -5
- wandb/sdk/artifacts/artifact_saver.py +2 -6
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +2 -4
- wandb/sdk/artifacts/storage_handlers/local_file_handler.py +2 -4
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +2 -4
- wandb/sdk/backend/backend.py +1 -1
- wandb/sdk/data_types/histogram.py +1 -3
- wandb/sdk/data_types/object_3d.py +2 -6
- wandb/sdk/data_types/table.py +1 -1
- wandb/sdk/data_types/utils.py +1 -2
- wandb/sdk/data_types/video.py +15 -4
- wandb/sdk/integration_utils/auto_logging.py +1 -8
- wandb/sdk/interface/interface.py +12 -5
- wandb/sdk/interface/interface_shared.py +9 -0
- wandb/sdk/internal/file_stream.py +1 -4
- wandb/sdk/internal/flow_control.py +1 -1
- wandb/sdk/internal/handler.py +7 -2
- wandb/sdk/internal/internal.py +3 -3
- wandb/sdk/internal/internal_api.py +3 -10
- wandb/sdk/internal/job_builder.py +20 -12
- wandb/sdk/internal/progress.py +1 -5
- wandb/sdk/internal/sender.py +9 -13
- wandb/sdk/internal/settings_static.py +4 -10
- wandb/sdk/internal/system/assets/cpu.py +2 -2
- wandb/sdk/internal/system/assets/disk.py +3 -3
- wandb/sdk/internal/system/assets/gpu.py +7 -7
- wandb/sdk/internal/system/assets/gpu_amd.py +1 -7
- wandb/sdk/internal/system/assets/interfaces.py +11 -13
- wandb/sdk/internal/system/assets/ipu.py +1 -1
- wandb/sdk/internal/system/assets/memory.py +2 -2
- wandb/sdk/internal/system/assets/open_metrics.py +2 -8
- wandb/sdk/internal/system/assets/trainium.py +3 -9
- wandb/sdk/internal/system/system_info.py +14 -13
- wandb/sdk/internal/system/system_monitor.py +5 -12
- wandb/sdk/internal/tb_watcher.py +1 -1
- wandb/sdk/internal/writer.py +1 -1
- wandb/sdk/launch/agent/run_queue_item_file_saver.py +1 -7
- wandb/sdk/launch/create_job.py +2 -3
- wandb/sdk/launch/runner/abstract.py +1 -6
- wandb/sdk/launch/runner/kubernetes_monitor.py +2 -4
- wandb/sdk/lib/apikey.py +2 -6
- wandb/sdk/lib/fsm.py +12 -6
- wandb/sdk/lib/ipython.py +1 -6
- wandb/sdk/lib/module.py +0 -3
- wandb/sdk/lib/progress.py +2 -3
- wandb/sdk/lib/run_moment.py +1 -7
- wandb/sdk/lib/server.py +10 -24
- wandb/sdk/service/server.py +1 -1
- wandb/sdk/service/service.py +5 -5
- wandb/sdk/wandb_init.py +215 -166
- wandb/sdk/wandb_login.py +17 -27
- wandb/sdk/wandb_run.py +90 -116
- wandb/sdk/wandb_settings.py +978 -1778
- wandb/sdk/wandb_setup.py +86 -89
- wandb/sdk/wandb_watch.py +1 -1
- wandb/sync/sync.py +1 -2
- wandb/util.py +6 -39
- wandb/wandb_controller.py +10 -12
- {wandb-0.18.7.dist-info → wandb-0.19.0.dist-info}/METADATA +13 -3
- {wandb-0.18.7.dist-info → wandb-0.19.0.dist-info}/RECORD +100 -105
- wandb/integration/magic.py +0 -556
- wandb/magic.py +0 -3
- wandb/sdk/lib/_settings_toposort_generate.py +0 -159
- wandb/sdk/lib/_settings_toposort_generated.py +0 -251
- wandb/sdk/lib/reporting.py +0 -99
- {wandb-0.18.7.dist-info → wandb-0.19.0.dist-info}/WHEEL +0 -0
- {wandb-0.18.7.dist-info → wandb-0.19.0.dist-info}/entry_points.txt +0 -0
- {wandb-0.18.7.dist-info → wandb-0.19.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,159 +0,0 @@
|
|
1
|
-
import inspect
|
2
|
-
import sys
|
3
|
-
from typing import Dict, List, Set, Tuple
|
4
|
-
|
5
|
-
from wandb.errors import UsageError
|
6
|
-
from wandb.sdk.wandb_settings import Settings
|
7
|
-
|
8
|
-
if sys.version_info >= (3, 8):
|
9
|
-
from typing import get_type_hints
|
10
|
-
else:
|
11
|
-
from typing_extensions import get_type_hints
|
12
|
-
|
13
|
-
|
14
|
-
template = """
|
15
|
-
__all__ = ("SETTINGS_TOPOLOGICALLY_SORTED", "_Setting")
|
16
|
-
|
17
|
-
import sys
|
18
|
-
from typing import Tuple
|
19
|
-
|
20
|
-
if sys.version_info >= (3, 8):
|
21
|
-
from typing import Final, Literal
|
22
|
-
else:
|
23
|
-
from typing_extensions import Final, Literal
|
24
|
-
|
25
|
-
|
26
|
-
_Setting = Literal[
|
27
|
-
$settings_literal_list
|
28
|
-
]
|
29
|
-
|
30
|
-
SETTINGS_TOPOLOGICALLY_SORTED: Final[Tuple[_Setting, ...]] = (
|
31
|
-
$settings_topologically_sorted
|
32
|
-
)
|
33
|
-
"""
|
34
|
-
|
35
|
-
|
36
|
-
class Graph:
|
37
|
-
# A simple class representing an unweighted directed graph
|
38
|
-
# that uses an adjacency list representation.
|
39
|
-
# We use to ensure that we don't have cyclic dependencies in the settings
|
40
|
-
# and that modifications to the settings are applied in the correct order.
|
41
|
-
def __init__(self) -> None:
|
42
|
-
self.adj_list: Dict[str, Set[str]] = {}
|
43
|
-
|
44
|
-
def add_node(self, node: str) -> None:
|
45
|
-
if node not in self.adj_list:
|
46
|
-
self.adj_list[node] = set()
|
47
|
-
|
48
|
-
def add_edge(self, node1: str, node2: str) -> None:
|
49
|
-
self.adj_list[node1].add(node2)
|
50
|
-
|
51
|
-
def get_neighbors(self, node: str) -> Set[str]:
|
52
|
-
return self.adj_list[node]
|
53
|
-
|
54
|
-
# return a list of nodes sorted in topological order
|
55
|
-
def topological_sort_dfs(self) -> List[str]:
|
56
|
-
sorted_copy = {k: sorted(v) for k, v in self.adj_list.items()}
|
57
|
-
|
58
|
-
sorted_nodes: List[str] = []
|
59
|
-
visited_nodes: Set[str] = set()
|
60
|
-
current_nodes: Set[str] = set()
|
61
|
-
|
62
|
-
def visit(n: str) -> None:
|
63
|
-
if n in visited_nodes:
|
64
|
-
return None
|
65
|
-
if n in current_nodes:
|
66
|
-
raise UsageError("Cyclic dependency detected in wandb.Settings")
|
67
|
-
|
68
|
-
current_nodes.add(n)
|
69
|
-
for neighbor in sorted_copy[n]:
|
70
|
-
visit(neighbor)
|
71
|
-
|
72
|
-
current_nodes.remove(n)
|
73
|
-
visited_nodes.add(n)
|
74
|
-
sorted_nodes.append(n)
|
75
|
-
|
76
|
-
return None
|
77
|
-
|
78
|
-
for node in self.adj_list:
|
79
|
-
if node not in visited_nodes:
|
80
|
-
visit(node)
|
81
|
-
|
82
|
-
return sorted_nodes
|
83
|
-
|
84
|
-
|
85
|
-
def _get_modification_order(
|
86
|
-
settings: Settings,
|
87
|
-
) -> Tuple[Tuple[str, ...], Tuple[str, ...]]:
|
88
|
-
"""Return the order in which settings should be modified, based on dependencies."""
|
89
|
-
dependency_graph = Graph()
|
90
|
-
|
91
|
-
props = tuple(get_type_hints(Settings).keys())
|
92
|
-
|
93
|
-
# discover prop dependencies from validator methods and runtime hooks
|
94
|
-
|
95
|
-
prefix = "_validate_"
|
96
|
-
symbols = set(dir(settings))
|
97
|
-
validator_methods = tuple(sorted(m for m in symbols if m.startswith(prefix)))
|
98
|
-
|
99
|
-
# extract dependencies from validator methods
|
100
|
-
for m in validator_methods:
|
101
|
-
setting = m.split(prefix)[1]
|
102
|
-
dependency_graph.add_node(setting)
|
103
|
-
# if the method is not static, inspect its code to find the attributes it depends on
|
104
|
-
if (
|
105
|
-
not isinstance(Settings.__dict__[m], staticmethod)
|
106
|
-
and not isinstance(Settings.__dict__[m], classmethod)
|
107
|
-
and Settings.__dict__[m].__code__.co_argcount > 0
|
108
|
-
):
|
109
|
-
unbound_closure_vars = inspect.getclosurevars(Settings.__dict__[m]).unbound
|
110
|
-
dependencies = (v for v in unbound_closure_vars if v in props)
|
111
|
-
for d in dependencies:
|
112
|
-
dependency_graph.add_node(d)
|
113
|
-
dependency_graph.add_edge(setting, d)
|
114
|
-
|
115
|
-
# extract dependencies from props' runtime hooks
|
116
|
-
default_props = settings._default_props()
|
117
|
-
for prop, spec in default_props.items():
|
118
|
-
if "hook" not in spec:
|
119
|
-
continue
|
120
|
-
|
121
|
-
dependency_graph.add_node(prop)
|
122
|
-
|
123
|
-
hook = spec["hook"]
|
124
|
-
if callable(hook):
|
125
|
-
hook = [hook]
|
126
|
-
|
127
|
-
for h in hook:
|
128
|
-
unbound_closure_vars = inspect.getclosurevars(h).unbound
|
129
|
-
dependencies = (v for v in unbound_closure_vars if v in props)
|
130
|
-
for d in dependencies:
|
131
|
-
dependency_graph.add_node(d)
|
132
|
-
dependency_graph.add_edge(prop, d)
|
133
|
-
|
134
|
-
modification_order = dependency_graph.topological_sort_dfs()
|
135
|
-
return props, tuple(modification_order)
|
136
|
-
|
137
|
-
|
138
|
-
def generate(settings: Settings) -> None:
|
139
|
-
_settings_literal_list, _settings_topologically_sorted = _get_modification_order(
|
140
|
-
settings
|
141
|
-
)
|
142
|
-
settings_literal_list = ", ".join(f'"{s}"' for s in _settings_literal_list)
|
143
|
-
settings_topologically_sorted = ", ".join(
|
144
|
-
f'"{s}"' for s in _settings_topologically_sorted
|
145
|
-
)
|
146
|
-
|
147
|
-
print(
|
148
|
-
template.replace(
|
149
|
-
"$settings_literal_list",
|
150
|
-
settings_literal_list,
|
151
|
-
).replace(
|
152
|
-
"$settings_topologically_sorted",
|
153
|
-
settings_topologically_sorted,
|
154
|
-
)
|
155
|
-
)
|
156
|
-
|
157
|
-
|
158
|
-
if __name__ == "__main__":
|
159
|
-
generate(Settings())
|
@@ -1,251 +0,0 @@
|
|
1
|
-
# DO NOT EDIT -- GENERATED BY: `generate-tool.py --generate`
|
2
|
-
__all__ = ("SETTINGS_TOPOLOGICALLY_SORTED", "_Setting")
|
3
|
-
|
4
|
-
import sys
|
5
|
-
from typing import Tuple
|
6
|
-
|
7
|
-
if sys.version_info >= (3, 8):
|
8
|
-
from typing import Final, Literal
|
9
|
-
else:
|
10
|
-
from typing_extensions import Final, Literal
|
11
|
-
|
12
|
-
|
13
|
-
_Setting = Literal[
|
14
|
-
"_args",
|
15
|
-
"_aws_lambda",
|
16
|
-
"_cli_only_mode",
|
17
|
-
"_code_path_local",
|
18
|
-
"_colab",
|
19
|
-
"_cuda",
|
20
|
-
"_disable_meta",
|
21
|
-
"_disable_service",
|
22
|
-
"_disable_setproctitle",
|
23
|
-
"_disable_stats",
|
24
|
-
"_disable_update_check",
|
25
|
-
"_disable_viewer",
|
26
|
-
"_disable_machine_info",
|
27
|
-
"_executable",
|
28
|
-
"_extra_http_headers",
|
29
|
-
"_file_stream_max_bytes",
|
30
|
-
"_file_stream_transmit_interval",
|
31
|
-
"_file_stream_retry_max",
|
32
|
-
"_file_stream_retry_wait_min_seconds",
|
33
|
-
"_file_stream_retry_wait_max_seconds",
|
34
|
-
"_file_stream_timeout_seconds",
|
35
|
-
"_file_transfer_retry_max",
|
36
|
-
"_file_transfer_retry_wait_min_seconds",
|
37
|
-
"_file_transfer_retry_wait_max_seconds",
|
38
|
-
"_file_transfer_timeout_seconds",
|
39
|
-
"_flow_control_custom",
|
40
|
-
"_flow_control_disabled",
|
41
|
-
"_graphql_retry_max",
|
42
|
-
"_graphql_retry_wait_min_seconds",
|
43
|
-
"_graphql_retry_wait_max_seconds",
|
44
|
-
"_graphql_timeout_seconds",
|
45
|
-
"_internal_check_process",
|
46
|
-
"_internal_queue_timeout",
|
47
|
-
"_ipython",
|
48
|
-
"_jupyter",
|
49
|
-
"_jupyter_name",
|
50
|
-
"_jupyter_path",
|
51
|
-
"_jupyter_root",
|
52
|
-
"_kaggle",
|
53
|
-
"_live_policy_rate_limit",
|
54
|
-
"_live_policy_wait_time",
|
55
|
-
"_log_level",
|
56
|
-
"_network_buffer",
|
57
|
-
"_noop",
|
58
|
-
"_notebook",
|
59
|
-
"_offline",
|
60
|
-
"_sync",
|
61
|
-
"_os",
|
62
|
-
"_platform",
|
63
|
-
"_proxies",
|
64
|
-
"_python",
|
65
|
-
"_runqueue_item_id",
|
66
|
-
"_require_legacy_service",
|
67
|
-
"_save_requirements",
|
68
|
-
"_service_transport",
|
69
|
-
"_service_wait",
|
70
|
-
"_shared",
|
71
|
-
"_start_datetime",
|
72
|
-
"_start_time",
|
73
|
-
"_stats_pid",
|
74
|
-
"_stats_sampling_interval",
|
75
|
-
"_stats_sample_rate_seconds",
|
76
|
-
"_stats_samples_to_average",
|
77
|
-
"_stats_join_assets",
|
78
|
-
"_stats_neuron_monitor_config_path",
|
79
|
-
"_stats_open_metrics_endpoints",
|
80
|
-
"_stats_open_metrics_filters",
|
81
|
-
"_stats_disk_paths",
|
82
|
-
"_stats_buffer_size",
|
83
|
-
"_tmp_code_dir",
|
84
|
-
"_tracelog",
|
85
|
-
"_unsaved_keys",
|
86
|
-
"_windows",
|
87
|
-
"allow_offline_artifacts",
|
88
|
-
"allow_val_change",
|
89
|
-
"anonymous",
|
90
|
-
"api_key",
|
91
|
-
"azure_account_url_to_access_key",
|
92
|
-
"base_url",
|
93
|
-
"code_dir",
|
94
|
-
"colab_url",
|
95
|
-
"config_paths",
|
96
|
-
"console",
|
97
|
-
"console_multipart",
|
98
|
-
"credentials_file",
|
99
|
-
"deployment",
|
100
|
-
"disable_code",
|
101
|
-
"disable_git",
|
102
|
-
"disable_hints",
|
103
|
-
"disable_job_creation",
|
104
|
-
"disabled",
|
105
|
-
"docker",
|
106
|
-
"email",
|
107
|
-
"entity",
|
108
|
-
"files_dir",
|
109
|
-
"force",
|
110
|
-
"fork_from",
|
111
|
-
"resume_from",
|
112
|
-
"git_commit",
|
113
|
-
"git_remote",
|
114
|
-
"git_remote_url",
|
115
|
-
"git_root",
|
116
|
-
"heartbeat_seconds",
|
117
|
-
"host",
|
118
|
-
"http_proxy",
|
119
|
-
"https_proxy",
|
120
|
-
"identity_token_file",
|
121
|
-
"ignore_globs",
|
122
|
-
"init_timeout",
|
123
|
-
"is_local",
|
124
|
-
"job_name",
|
125
|
-
"job_source",
|
126
|
-
"label_disable",
|
127
|
-
"launch",
|
128
|
-
"launch_config_path",
|
129
|
-
"log_dir",
|
130
|
-
"log_internal",
|
131
|
-
"log_symlink_internal",
|
132
|
-
"log_symlink_user",
|
133
|
-
"log_user",
|
134
|
-
"login_timeout",
|
135
|
-
"mode",
|
136
|
-
"notebook_name",
|
137
|
-
"program",
|
138
|
-
"program_abspath",
|
139
|
-
"program_relpath",
|
140
|
-
"project",
|
141
|
-
"project_url",
|
142
|
-
"quiet",
|
143
|
-
"reinit",
|
144
|
-
"relogin",
|
145
|
-
"resume",
|
146
|
-
"resume_fname",
|
147
|
-
"resumed",
|
148
|
-
"root_dir",
|
149
|
-
"run_group",
|
150
|
-
"run_id",
|
151
|
-
"run_job_type",
|
152
|
-
"run_mode",
|
153
|
-
"run_name",
|
154
|
-
"run_notes",
|
155
|
-
"run_tags",
|
156
|
-
"run_url",
|
157
|
-
"sagemaker_disable",
|
158
|
-
"save_code",
|
159
|
-
"settings_system",
|
160
|
-
"settings_workspace",
|
161
|
-
"show_colors",
|
162
|
-
"show_emoji",
|
163
|
-
"show_errors",
|
164
|
-
"show_info",
|
165
|
-
"show_warnings",
|
166
|
-
"silent",
|
167
|
-
"start_method",
|
168
|
-
"strict",
|
169
|
-
"summary_errors",
|
170
|
-
"summary_timeout",
|
171
|
-
"summary_warnings",
|
172
|
-
"sweep_id",
|
173
|
-
"sweep_param_path",
|
174
|
-
"sweep_url",
|
175
|
-
"symlink",
|
176
|
-
"sync_dir",
|
177
|
-
"sync_file",
|
178
|
-
"sync_symlink_latest",
|
179
|
-
"table_raise_on_max_row_limit_exceeded",
|
180
|
-
"timespec",
|
181
|
-
"tmp_dir",
|
182
|
-
"username",
|
183
|
-
"wandb_dir",
|
184
|
-
]
|
185
|
-
|
186
|
-
SETTINGS_TOPOLOGICALLY_SORTED: Final[Tuple[_Setting, ...]] = (
|
187
|
-
"_service_wait",
|
188
|
-
"_stats_sample_rate_seconds",
|
189
|
-
"_stats_samples_to_average",
|
190
|
-
"_stats_sampling_interval",
|
191
|
-
"anonymous",
|
192
|
-
"api_key",
|
193
|
-
"base_url",
|
194
|
-
"console",
|
195
|
-
"job_source",
|
196
|
-
"mode",
|
197
|
-
"project",
|
198
|
-
"run_id",
|
199
|
-
"start_method",
|
200
|
-
"_aws_lambda",
|
201
|
-
"program",
|
202
|
-
"_code_path_local",
|
203
|
-
"_colab",
|
204
|
-
"_disable_machine_info",
|
205
|
-
"_disable_meta",
|
206
|
-
"_disable_stats",
|
207
|
-
"_network_buffer",
|
208
|
-
"_flow_control_disabled",
|
209
|
-
"_flow_control_custom",
|
210
|
-
"_ipython",
|
211
|
-
"_jupyter",
|
212
|
-
"_kaggle",
|
213
|
-
"_noop",
|
214
|
-
"_notebook",
|
215
|
-
"disabled",
|
216
|
-
"_offline",
|
217
|
-
"_shared",
|
218
|
-
"_stats_neuron_monitor_config_path",
|
219
|
-
"run_mode",
|
220
|
-
"_start_datetime",
|
221
|
-
"timespec",
|
222
|
-
"root_dir",
|
223
|
-
"wandb_dir",
|
224
|
-
"tmp_dir",
|
225
|
-
"_tmp_code_dir",
|
226
|
-
"_windows",
|
227
|
-
"colab_url",
|
228
|
-
"is_local",
|
229
|
-
"deployment",
|
230
|
-
"disable_code",
|
231
|
-
"disable_git",
|
232
|
-
"disable_job_creation",
|
233
|
-
"files_dir",
|
234
|
-
"_proxies",
|
235
|
-
"http_proxy",
|
236
|
-
"https_proxy",
|
237
|
-
"log_dir",
|
238
|
-
"log_internal",
|
239
|
-
"log_symlink_internal",
|
240
|
-
"log_symlink_user",
|
241
|
-
"log_user",
|
242
|
-
"project_url",
|
243
|
-
"resume_fname",
|
244
|
-
"run_url",
|
245
|
-
"settings_system",
|
246
|
-
"settings_workspace",
|
247
|
-
"sweep_url",
|
248
|
-
"sync_dir",
|
249
|
-
"sync_file",
|
250
|
-
"sync_symlink_latest",
|
251
|
-
)
|
wandb/sdk/lib/reporting.py
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
"""reporting."""
|
2
|
-
|
3
|
-
import logging
|
4
|
-
|
5
|
-
logger = logging.getLogger("wandb")
|
6
|
-
|
7
|
-
|
8
|
-
class _Reporter:
|
9
|
-
def __init__(self, settings):
|
10
|
-
self._settings = settings
|
11
|
-
self._errors = []
|
12
|
-
self._warnings = []
|
13
|
-
self._num_errors = 0
|
14
|
-
self._num_warnings = 0
|
15
|
-
self._context = dict()
|
16
|
-
|
17
|
-
def error(self, __s, *args):
|
18
|
-
pass
|
19
|
-
|
20
|
-
def warning(self, __s, *args):
|
21
|
-
show = self._settings.show_warnings
|
22
|
-
summary = self._settings.summary_warnings
|
23
|
-
if show is not None or summary is not None:
|
24
|
-
s = __s % args
|
25
|
-
self._num_warnings += 1
|
26
|
-
if show is not None:
|
27
|
-
if self._num_warnings <= show or show == 0:
|
28
|
-
print("[WARNING]", s)
|
29
|
-
if self._num_warnings == show:
|
30
|
-
print("not showing any more warnings")
|
31
|
-
if summary is not None:
|
32
|
-
if self._num_warnings <= summary or summary == 0:
|
33
|
-
self._warnings.append(s)
|
34
|
-
|
35
|
-
def info(self, __s, *args):
|
36
|
-
if self._settings.show_info:
|
37
|
-
print(("[INFO]" + __s) % args)
|
38
|
-
|
39
|
-
def internal(self, __s, *args):
|
40
|
-
pass
|
41
|
-
|
42
|
-
def problem(self, bool, __s=None, *args):
|
43
|
-
pass
|
44
|
-
|
45
|
-
def set_context(self, __d=None, **kwargs):
|
46
|
-
if __d:
|
47
|
-
self._context.update(__d)
|
48
|
-
self._context.update(**kwargs)
|
49
|
-
|
50
|
-
def clear_context(self, keys=None):
|
51
|
-
if keys is None:
|
52
|
-
self._context = dict()
|
53
|
-
return
|
54
|
-
for k in keys:
|
55
|
-
self._context.pop(k, None)
|
56
|
-
|
57
|
-
@property
|
58
|
-
def warning_count(self):
|
59
|
-
return self._num_warnings
|
60
|
-
|
61
|
-
@property
|
62
|
-
def error_count(self):
|
63
|
-
return self._num_errors
|
64
|
-
|
65
|
-
@property
|
66
|
-
def warning_lines(self):
|
67
|
-
return self._warnings
|
68
|
-
|
69
|
-
@property
|
70
|
-
def error_lines(self):
|
71
|
-
return self._errors
|
72
|
-
|
73
|
-
|
74
|
-
class Reporter:
|
75
|
-
_instance = None
|
76
|
-
|
77
|
-
def __init__(self, settings=None):
|
78
|
-
if Reporter._instance is not None:
|
79
|
-
return
|
80
|
-
if settings is None:
|
81
|
-
logging.error("internal issue: reporter not setup")
|
82
|
-
|
83
|
-
Reporter._instance = _Reporter(settings)
|
84
|
-
|
85
|
-
def __getattr__(self, name):
|
86
|
-
return getattr(self._instance, name)
|
87
|
-
|
88
|
-
|
89
|
-
def setup_reporter(settings):
|
90
|
-
# fixme: why?
|
91
|
-
# if not settings.is_frozen():
|
92
|
-
# logging.error("internal issue: settings not frozen")
|
93
|
-
r = Reporter(settings=settings)
|
94
|
-
return r
|
95
|
-
|
96
|
-
|
97
|
-
def get_reporter():
|
98
|
-
r = Reporter()
|
99
|
-
return r
|
File without changes
|
File without changes
|
File without changes
|