id int64 1 6.07M | name stringlengths 1 295 | code stringlengths 12 426k | language stringclasses 1
value | source_file stringlengths 5 202 | start_line int64 1 158k | end_line int64 1 158k | repo dict |
|---|---|---|---|---|---|---|---|
601 | set_context | def set_context(self, key, value):
with self._lock:
self.ctx[key] = value | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 71 | 73 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
602 | Session | def Session(self):
return self | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 75 | 76 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
603 | RequestException | def RequestException(self):
return requests.RequestException | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 79 | 80 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
604 | HTTPError | def HTTPError(self):
return requests.HTTPError | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 83 | 84 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
605 | models | def models(self):
return self.mock | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 87 | 88 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
606 | headers | def headers(self):
return {} | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 91 | 92 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
607 | __version__ | def __version__(self):
return requests.__version__ | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 95 | 96 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
608 | utils | def utils(self):
return requests.utils | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 99 | 100 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
609 | exceptions | def exceptions(self):
return requests.exceptions | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 103 | 104 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
610 | packages | def packages(self):
return requests.packages | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 107 | 108 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
611 | adapters | def adapters(self):
return requests.adapters | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 111 | 112 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
612 | mount | def mount(self, *args):
pass | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 114 | 115 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
613 | _clean_kwargs | def _clean_kwargs(self, kwargs):
if "auth" in kwargs:
del kwargs["auth"]
if "timeout" in kwargs:
del kwargs["timeout"]
if "cookies" in kwargs:
del kwargs["cookies"]
if "params" in kwargs:
del kwargs["params"]
if "stream" in kwargs:
... | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 117 | 143 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
614 | _store_request | def _store_request(self, url, body):
parts = url.split("?")
key = parts[0].split("/")[-1]
if len(parts) > 1:
# To make assertions easier, we remove the run from storage requests
key = key + "?" + parts[1].split("&run=")[0]
with self._lock:
# Azure test... | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 145 | 156 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
615 | _inject | def _inject(self, method, url, kwargs):
pre_request = dict(method=method, url=url, kwargs=kwargs)
inject = InjectRequestsParse(self.ctx).find(pre_request=pre_request)
if inject:
if inject.requests_error:
if inject.requests_error is True:
raise requ... | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 158 | 165 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
616 | post | def post(self, url, **kwargs):
self._inject("post", url, kwargs)
self._store_request(url, kwargs.get("json"))
return ResponseMock(self.client.post(url, **self._clean_kwargs(kwargs))) | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 167 | 170 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
617 | put | def put(self, url, **kwargs):
self._inject("put", url, kwargs)
self._store_request(url, kwargs.get("json"))
return ResponseMock(self.client.put(url, **self._clean_kwargs(kwargs))) | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 172 | 175 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
618 | get | def get(self, url, **kwargs):
self._inject("get", url, kwargs)
self._store_request(url, kwargs.get("json"))
return ResponseMock(self.client.get(url, **self._clean_kwargs(kwargs))) | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 177 | 180 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
619 | request | def request(self, method, url, **kwargs):
if method.lower() == "get":
return self.get(url, **kwargs)
elif method.lower() == "post":
return self.post(url, **kwargs)
elif method.lower() == "put":
return self.put(url, **kwargs)
else:
message =... | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 182 | 191 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
620 | __repr__ | def __repr__(self):
return "<W&B Mocked Request class>" | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 193 | 194 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
621 | __init__ | def __init__(self, path_suffix=None, count=None, query_str=None):
self._path_suffix = path_suffix
self._count = count
self._query_str = query_str | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 198 | 201 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
622 | _as_dict | def _as_dict(self):
r = {}
if self._path_suffix:
r["path_suffix"] = self._path_suffix
if self._count:
r["count"] = self._count
if self._query_str:
r["query_str"] = self._query_str
return r | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 203 | 211 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
623 | __init__ | def __init__(self, response=None, http_status=None, requests_error=None):
self.response = response
self.http_status = http_status
self.requests_error = requests_error | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 215 | 218 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
624 | __str__ | def __str__(self):
return f"Action({vars(self)})" | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 220 | 221 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
625 | __init__ | def __init__(self, ctx):
self._ctx = ctx | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 225 | 226 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
626 | find | def find(self, request=None, pre_request=None):
inject = self._ctx.get("inject")
if not inject:
return
request_path = ""
if request:
request_path = request.path
if pre_request:
url = pre_request["url"]
parsed = urllib.parse.urlpars... | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 228 | 281 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
627 | __init__ | def __init__(self, ctx):
self._ctx = ctx
self.Match = InjectRequestsMatch | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 287 | 289 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
628 | add | def add(self, match, response=None, http_status=None, requests_error=None):
ctx_inject = self._ctx.setdefault("inject", {})
ctx_rules = ctx_inject.setdefault("rules", [])
rule = {}
rule["match"] = match._as_dict()
if response:
rule["response"] = response
if ht... | python | tests/pytest_tests/unit_tests_old/utils/mock_requests.py | 291 | 302 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
629 | internal_result_q | def internal_result_q():
return Queue() | python | tests/pytest_tests/system_tests/conftest.py | 66 | 67 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
630 | internal_sender_q | def internal_sender_q():
return Queue() | python | tests/pytest_tests/system_tests/conftest.py | 71 | 72 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
631 | internal_writer_q | def internal_writer_q():
return Queue() | python | tests/pytest_tests/system_tests/conftest.py | 76 | 77 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
632 | internal_record_q | def internal_record_q():
return Queue() | python | tests/pytest_tests/system_tests/conftest.py | 81 | 82 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
633 | internal_process | def internal_process():
return MockProcess() | python | tests/pytest_tests/system_tests/conftest.py | 86 | 87 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
634 | __init__ | def __init__(self):
self._alive = True | python | tests/pytest_tests/system_tests/conftest.py | 91 | 92 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
635 | is_alive | def is_alive(self):
return self._alive | python | tests/pytest_tests/system_tests/conftest.py | 94 | 95 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
636 | _internal_mailbox | def _internal_mailbox():
return Mailbox() | python | tests/pytest_tests/system_tests/conftest.py | 99 | 100 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
637 | _internal_sender | def _internal_sender(
internal_record_q, internal_result_q, internal_process, _internal_mailbox
):
return InterfaceQueue(
record_q=internal_record_q,
result_q=internal_result_q,
process=internal_process,
mailbox=_internal_mailbox,
) | python | tests/pytest_tests/system_tests/conftest.py | 104 | 112 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
638 | _internal_context_keeper | def _internal_context_keeper():
context_keeper = context.ContextKeeper()
yield context_keeper | python | tests/pytest_tests/system_tests/conftest.py | 116 | 118 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
639 | internal_sm | def internal_sm(
runner,
internal_sender_q,
internal_result_q,
_internal_sender,
_internal_context_keeper,
):
def helper(settings):
with runner.isolated_filesystem():
sm = SendManager(
settings=SettingsStatic(settings.make_static()),
record_q=i... | python | tests/pytest_tests/system_tests/conftest.py | 122 | 140 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
640 | helper | def helper(settings):
with runner.isolated_filesystem():
sm = SendManager(
settings=SettingsStatic(settings.make_static()),
record_q=internal_sender_q,
result_q=internal_result_q,
interface=_internal_sender,
context_keep... | python | tests/pytest_tests/system_tests/conftest.py | 129 | 138 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
641 | stopped_event | def stopped_event():
stopped = threading.Event()
yield stopped | python | tests/pytest_tests/system_tests/conftest.py | 144 | 146 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
642 | internal_hm | def internal_hm(
runner,
internal_record_q,
internal_result_q,
internal_writer_q,
_internal_sender,
stopped_event,
_internal_context_keeper,
):
def helper(settings):
with runner.isolated_filesystem():
hm = HandleManager(
settings=SettingsStatic(setting... | python | tests/pytest_tests/system_tests/conftest.py | 150 | 172 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
643 | helper | def helper(settings):
with runner.isolated_filesystem():
hm = HandleManager(
settings=SettingsStatic(settings.make_static()),
record_q=internal_record_q,
result_q=internal_result_q,
stopped=stopped_event,
writer_q=intern... | python | tests/pytest_tests/system_tests/conftest.py | 159 | 170 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
644 | internal_wm | def internal_wm(
runner,
internal_writer_q,
internal_result_q,
internal_sender_q,
_internal_sender,
stopped_event,
_internal_context_keeper,
):
def helper(settings):
with runner.isolated_filesystem():
wandb_file = settings.sync_file
# this is hacky, but w... | python | tests/pytest_tests/system_tests/conftest.py | 176 | 204 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
645 | helper | def helper(settings):
with runner.isolated_filesystem():
wandb_file = settings.sync_file
# this is hacky, but we dont have a clean rundir always
# so lets at least make sure we can write to this dir
run_dir = Path(wandb_file).parent
os.makedirs(run_di... | python | tests/pytest_tests/system_tests/conftest.py | 185 | 202 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
646 | internal_get_record | def internal_get_record():
def _get_record(input_q, timeout=None):
try:
i = input_q.get(timeout=timeout)
except Empty:
return None
return i
return _get_record | python | tests/pytest_tests/system_tests/conftest.py | 208 | 216 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
647 | _get_record | def _get_record(input_q, timeout=None):
try:
i = input_q.get(timeout=timeout)
except Empty:
return None
return i | python | tests/pytest_tests/system_tests/conftest.py | 209 | 214 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
648 | start_send_thread | def start_send_thread(
internal_sender_q, internal_get_record, stopped_event, internal_process
):
def start_send(send_manager):
def target():
try:
while True:
payload = internal_get_record(
input_q=internal_sender_q, timeout=0.1
... | python | tests/pytest_tests/system_tests/conftest.py | 220 | 245 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
649 | start_send | def start_send(send_manager):
def target():
try:
while True:
payload = internal_get_record(
input_q=internal_sender_q, timeout=0.1
)
if payload:
send_manager.send(payload)
... | python | tests/pytest_tests/system_tests/conftest.py | 223 | 242 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
650 | target | def target():
try:
while True:
payload = internal_get_record(
input_q=internal_sender_q, timeout=0.1
)
if payload:
send_manager.send(payload)
elif stopped_event.is_... | python | tests/pytest_tests/system_tests/conftest.py | 224 | 236 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
651 | start_write_thread | def start_write_thread(
internal_writer_q, internal_get_record, stopped_event, internal_process
):
def start_write(write_manager):
def target():
try:
while True:
payload = internal_get_record(
input_q=internal_writer_q, timeout=0.1
... | python | tests/pytest_tests/system_tests/conftest.py | 249 | 274 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
652 | start_write | def start_write(write_manager):
def target():
try:
while True:
payload = internal_get_record(
input_q=internal_writer_q, timeout=0.1
)
if payload:
write_manager.write(payload)
... | python | tests/pytest_tests/system_tests/conftest.py | 252 | 271 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
653 | target | def target():
try:
while True:
payload = internal_get_record(
input_q=internal_writer_q, timeout=0.1
)
if payload:
write_manager.write(payload)
elif stopped_event.i... | python | tests/pytest_tests/system_tests/conftest.py | 253 | 265 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
654 | start_handle_thread | def start_handle_thread(internal_record_q, internal_get_record, stopped_event):
def start_handle(handle_manager):
def target():
while True:
payload = internal_get_record(input_q=internal_record_q, timeout=0.1)
if payload:
handle_manager.handle(... | python | tests/pytest_tests/system_tests/conftest.py | 278 | 295 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
655 | start_handle | def start_handle(handle_manager):
def target():
while True:
payload = internal_get_record(input_q=internal_record_q, timeout=0.1)
if payload:
handle_manager.handle(payload)
elif stopped_event.is_set():
break
... | python | tests/pytest_tests/system_tests/conftest.py | 279 | 292 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
656 | target | def target():
while True:
payload = internal_get_record(input_q=internal_record_q, timeout=0.1)
if payload:
handle_manager.handle(payload)
elif stopped_event.is_set():
break | python | tests/pytest_tests/system_tests/conftest.py | 280 | 286 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
657 | _start_backend | def _start_backend(
internal_hm,
internal_sm,
internal_wm,
_internal_sender,
start_handle_thread,
start_write_thread,
start_send_thread,
):
def start_backend_func(run=None, initial_run=True, initial_start=True):
ihm = internal_hm(run.settings)
iwm = internal_wm(run.settin... | python | tests/pytest_tests/system_tests/conftest.py | 299 | 321 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
658 | start_backend_func | def start_backend_func(run=None, initial_run=True, initial_start=True):
ihm = internal_hm(run.settings)
iwm = internal_wm(run.settings)
ism = internal_sm(run.settings)
ht = start_handle_thread(ihm)
wt = start_write_thread(iwm)
st = start_send_thread(ism)
if initia... | python | tests/pytest_tests/system_tests/conftest.py | 308 | 319 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
659 | _stop_backend | def _stop_backend(
_internal_sender,
# collect_responses,
):
def stop_backend_func(threads=None):
threads = threads or ()
handle = _internal_sender.deliver_exit(0)
record = handle.wait(timeout=30)
assert record
server_info_handle = _internal_sender.deliver_request_se... | python | tests/pytest_tests/system_tests/conftest.py | 325 | 344 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
660 | stop_backend_func | def stop_backend_func(threads=None):
threads = threads or ()
handle = _internal_sender.deliver_exit(0)
record = handle.wait(timeout=30)
assert record
server_info_handle = _internal_sender.deliver_request_server_info()
result = server_info_handle.wait(timeout=30)
... | python | tests/pytest_tests/system_tests/conftest.py | 329 | 342 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
661 | backend_interface | def backend_interface(_start_backend, _stop_backend, _internal_sender):
@contextmanager
def backend_context(run, initial_run=True, initial_start=True):
threads = _start_backend(
run=run,
initial_run=initial_run,
initial_start=initial_start,
)
try:
... | python | tests/pytest_tests/system_tests/conftest.py | 348 | 361 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
662 | backend_context | def backend_context(run, initial_run=True, initial_start=True):
threads = _start_backend(
run=run,
initial_run=initial_run,
initial_start=initial_start,
)
try:
yield _internal_sender
finally:
_stop_backend(threads=threads) | python | tests/pytest_tests/system_tests/conftest.py | 350 | 359 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
663 | publish_util | def publish_util(backend_interface):
def publish_util_helper(
run,
metrics=None,
history=None,
artifacts=None,
files=None,
begin_cb=None,
end_cb=None,
initial_start=False,
):
metrics = metrics or []
history = history or []
a... | python | tests/pytest_tests/system_tests/conftest.py | 365 | 395 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
664 | publish_util_helper | def publish_util_helper(
run,
metrics=None,
history=None,
artifacts=None,
files=None,
begin_cb=None,
end_cb=None,
initial_start=False,
):
metrics = metrics or []
history = history or []
artifacts = artifacts or []
files ... | python | tests/pytest_tests/system_tests/conftest.py | 366 | 393 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
665 | pytest_addoption | def pytest_addoption(parser):
# note: we default to "function" scope to ensure the environment is
# set up properly when running the tests in parallel with pytest-xdist.
parser.addoption(
"--user-scope",
default="function", # or "function" or "session" or "module"
help='cli to set s... | python | tests/pytest_tests/system_tests/conftest.py | 403 | 434 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
666 | random_string | def random_string(length: int = 12) -> str:
"""Generate a random string of a given length.
:param length: Length of the string to generate.
:return: Random string.
"""
return "".join(
secrets.choice(string.ascii_lowercase + string.digits) for _ in range(length)
) | python | tests/pytest_tests/system_tests/conftest.py | 437 | 445 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
667 | determine_scope | def determine_scope(fixture_name, config):
return config.getoption("--user-scope") | python | tests/pytest_tests/system_tests/conftest.py | 448 | 449 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
668 | base_url | def base_url(request):
return request.config.getoption("--base-url") | python | tests/pytest_tests/system_tests/conftest.py | 453 | 454 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
669 | wandb_server_tag | def wandb_server_tag(request):
return request.config.getoption("--wandb-server-tag") | python | tests/pytest_tests/system_tests/conftest.py | 458 | 459 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
670 | wandb_server_pull | def wandb_server_pull(request):
if request.config.getoption("--wandb-server-pull"):
return "always"
return "missing" | python | tests/pytest_tests/system_tests/conftest.py | 463 | 466 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
671 | wandb_debug | def wandb_debug(request):
return request.config.getoption("--wandb-debug", default=False) | python | tests/pytest_tests/system_tests/conftest.py | 470 | 471 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
672 | check_server_health | def check_server_health(
base_url: str, endpoint: str, num_retries: int = 1, sleep_time: int = 1
) -> bool:
"""Check if wandb server is healthy.
:param base_url:
:param num_retries:
:param sleep_time:
:return:
"""
for _ in range(num_retries):
try:
response = requests... | python | tests/pytest_tests/system_tests/conftest.py | 474 | 492 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
673 | check_mysql_health | def check_mysql_health(num_retries: int = 1, sleep_time: int = 1):
for _ in range(num_retries):
try:
exit_code = subprocess.call(
[
"docker",
"exec",
"-t",
"wandb-local",
"/bin/bas... | python | tests/pytest_tests/system_tests/conftest.py | 495 | 514 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
674 | check_server_up | def check_server_up(
base_url: str,
wandb_server_tag: str = "master",
wandb_server_pull: Literal["missing", "always"] = "missing",
) -> bool:
"""Check if wandb server is up and running.
If not on the CI and the server is not running, then start it first.
:param base_url:
:param wandb_serve... | python | tests/pytest_tests/system_tests/conftest.py | 517 | 576 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
675 | fixture_fn | def fixture_fn(base_url, wandb_server_tag, wandb_server_pull):
def fixture_util(
cmd: Union[UserFixtureCommand, AddAdminAndEnsureNoDefaultUser]
) -> bool:
endpoint = urllib.parse.urljoin(
base_url.replace(LOCAL_BASE_PORT, cmd.port),
cmd.endpoint,
)
if isi... | python | tests/pytest_tests/system_tests/conftest.py | 600 | 638 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
676 | fixture_util | def fixture_util(
cmd: Union[UserFixtureCommand, AddAdminAndEnsureNoDefaultUser]
) -> bool:
endpoint = urllib.parse.urljoin(
base_url.replace(LOCAL_BASE_PORT, cmd.port),
cmd.endpoint,
)
if isinstance(cmd, UserFixtureCommand):
data = {"command": cm... | python | tests/pytest_tests/system_tests/conftest.py | 601 | 629 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
677 | user | def user(worker_id: str, fixture_fn, base_url, wandb_debug) -> str:
username = f"user-{worker_id}-{random_string()}"
command = UserFixtureCommand(command="up", username=username)
fixture_fn(command)
command = UserFixtureCommand(
command="password", username=username, password=username
)
... | python | tests/pytest_tests/system_tests/conftest.py | 642 | 664 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
678 | debug | def debug(wandb_debug, fixture_fn, base_url):
if wandb_debug:
admin_username = f"admin-{random_string()}"
# disable default user and create an admin account that can be used to log in to the app
# and inspect the test runs.
command = UserFixtureCommand(command="down", username="local... | python | tests/pytest_tests/system_tests/conftest.py | 668 | 712 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
679 | relay_server | def relay_server(base_url):
"""Create a new relay server."""
@contextmanager
def relay_server_context(inject: Optional[List[InjectedResponse]] = None):
_relay_server = RelayServer(base_url=base_url, inject=inject)
try:
_relay_server.start()
print(f"Relay server start... | python | tests/pytest_tests/system_tests/conftest.py | 716 | 734 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
680 | relay_server_context | def relay_server_context(inject: Optional[List[InjectedResponse]] = None):
_relay_server = RelayServer(base_url=base_url, inject=inject)
try:
_relay_server.start()
print(f"Relay server started at {_relay_server.relay_url}")
with unittest.mock.patch.dict(
... | python | tests/pytest_tests/system_tests/conftest.py | 720 | 732 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
681 | wandb_init | def wandb_init(user, test_settings, request):
# mirror wandb.sdk.wandb_init.init args, overriding name and entity defaults
def init(
job_type: Optional[str] = None,
dir: Optional[str] = None,
config: Union[Dict, str, None] = None,
project: Optional[str] = None,
entity: Op... | python | tests/pytest_tests/system_tests/conftest.py | 738 | 785 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
682 | init | def init(
job_type: Optional[str] = None,
dir: Optional[str] = None,
config: Union[Dict, str, None] = None,
project: Optional[str] = None,
entity: Optional[str] = None,
reinit: bool = None,
tags: Optional[Sequence] = None,
group: Optional[str] = None,
... | python | tests/pytest_tests/system_tests/conftest.py | 740 | 780 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
683 | server_context | def server_context(base_url):
class ServerContext:
def __init__(self) -> None:
self.api = wandb.Api(overrides={"base_url": base_url})
def get_run(self, run: "wandb.sdk.wandb_run.Run") -> "wandb.apis.public.Run":
return self.api.run(run.path)
yield ServerContext() | python | tests/pytest_tests/system_tests/conftest.py | 789 | 797 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
684 | __init__ | def __init__(self) -> None:
self.api = wandb.Api(overrides={"base_url": base_url}) | python | tests/pytest_tests/system_tests/conftest.py | 791 | 792 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
685 | get_run | def get_run(self, run: "wandb.sdk.wandb_run.Run") -> "wandb.apis.public.Run":
return self.api.run(run.path) | python | tests/pytest_tests/system_tests/conftest.py | 794 | 795 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
686 | inject_file_stream_response | def inject_file_stream_response(base_url, user):
def helper(
run,
body: Union[str, Exception] = "{}",
status: int = 200,
application_pattern: str = "1",
) -> InjectedResponse:
if status > 299:
message = body if isinstance(body, str) else "::".join(body.args)
... | python | tests/pytest_tests/system_tests/conftest.py | 802 | 825 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
687 | helper | def helper(
run,
body: Union[str, Exception] = "{}",
status: int = 200,
application_pattern: str = "1",
) -> InjectedResponse:
if status > 299:
message = body if isinstance(body, str) else "::".join(body.args)
body = DeliberateHTTPError(status_code=sta... | python | tests/pytest_tests/system_tests/conftest.py | 803 | 823 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
688 | _make_run | def _make_run(
tags: Optional[Dict[str, Any]] = None,
params: Optional[Dict[str, float]] = None,
metrics: Optional[Iterable[Dict[str, float]]] = None,
make_artifact_fns: Optional[Iterable[Callable[[], Path]]] = None,
batch_size: Optional[int] = None,
):
client = MlflowClient()
with mlflow.st... | python | tests/pytest_tests/system_tests/test_importers/conftest.py | 33 | 56 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
689 | batched | def batched(n, iterable):
i = iter(iterable)
batch = list(islice(i, n))
while batch:
yield batch
batch = list(islice(i, n)) | python | tests/pytest_tests/system_tests/test_importers/conftest.py | 65 | 70 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
690 | batch_metrics | def batch_metrics(metrics, bs: int) -> Iterable[List[Metric]]:
step = 0
for i, batch in enumerate(batched(bs, metrics)):
batched_metrics = []
for step, metric in enumerate(batch, start=i * bs):
for k, v in metric.items():
batched_metrics.append(
Me... | python | tests/pytest_tests/system_tests/test_importers/conftest.py | 73 | 82 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
691 | make_tags | def make_tags():
return st.dictionaries(
st.text(
min_size=1,
max_size=20,
alphabet="abcdefghijklmnopqrstuvwxyz1234567890_- ",
),
st.text(max_size=20),
max_size=10,
).example() | python | tests/pytest_tests/system_tests/test_importers/conftest.py | 85 | 94 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
692 | make_params | def make_params():
return {
"param_int": st.integers().example(),
"param_float": st.floats().example(),
"param_str": st.text(max_size=20).example(),
"param_bool": st.booleans().example(),
"param_list": st.lists(st.integers()).example(),
"param_dict": st.dictionaries(
... | python | tests/pytest_tests/system_tests/test_importers/conftest.py | 97 | 110 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
693 | make_metrics | def make_metrics(n_steps):
for _ in range(n_steps):
yield {
"metric_int": st.integers(min_value=0, max_value=100).example(),
"metric_float": st.floats(min_value=0, max_value=100).example(),
} | python | tests/pytest_tests/system_tests/test_importers/conftest.py | 113 | 118 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
694 | make_artifact_fns | def make_artifact_fns(temp_path: Path) -> Iterable[Callable[[], Path]]:
def artifact_fn():
fname = str(uuid.uuid4())
file_path = f"{temp_path}/{fname}.txt"
with open(file_path, "w") as f:
f.write(f"text from {file_path}")
return file_path
for _ in range(N_ARTIFACTS_P... | python | tests/pytest_tests/system_tests/test_importers/conftest.py | 121 | 130 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
695 | artifact_fn | def artifact_fn():
fname = str(uuid.uuid4())
file_path = f"{temp_path}/{fname}.txt"
with open(file_path, "w") as f:
f.write(f"text from {file_path}")
return file_path | python | tests/pytest_tests/system_tests/test_importers/conftest.py | 122 | 127 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
696 | make_run | def make_run(n_steps, mlflow_batch_size):
with tempfile.TemporaryDirectory() as temp_path:
_make_run(
tags=make_tags(),
params=make_params(),
metrics=make_metrics(n_steps),
make_artifact_fns=make_artifact_fns(temp_path),
batch_size=mlflow_batch_siz... | python | tests/pytest_tests/system_tests/test_importers/conftest.py | 133 | 141 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
697 | make_exp | def make_exp(n_runs, n_steps, mlflow_batch_size):
name = "Experiment " + str(uuid.uuid4())
mlflow.set_experiment(name)
# Can't use ProcessPoolExecutor -- it seems to always fail in tests!
for _ in range(n_runs):
make_run(n_steps, mlflow_batch_size) | python | tests/pytest_tests/system_tests/test_importers/conftest.py | 144 | 150 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
698 | log_to_mlflow | def log_to_mlflow(
mlflow_tracking_uri: str,
n_exps: int = 2,
n_runs_per_exp: int = 3,
n_steps: int = 1000,
mlflow_batch_size: int = 50,
):
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=NonInteractiveExampleWarning)
mlflow.set_tracking_uri(mlflow_trac... | python | tests/pytest_tests/system_tests/test_importers/conftest.py | 153 | 166 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
699 | check_mlflow_server_health | def check_mlflow_server_health(
base_url: str, endpoint: str, num_retries: int = 1, sleep_time: int = 1
):
for _ in range(num_retries):
try:
response = requests.get(urllib.parse.urljoin(base_url, endpoint))
if response.status_code == 200:
return True
t... | python | tests/pytest_tests/system_tests/test_importers/conftest.py | 169 | 180 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
700 | kill_child_processes | def kill_child_processes(parent_pid, sig=signal.SIGTERM):
try:
parent = psutil.Process(parent_pid)
except psutil.NoSuchProcess:
return
children = parent.children(recursive=True)
for process in children:
process.send_signal(sig) | python | tests/pytest_tests/system_tests/test_importers/conftest.py | 183 | 190 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.