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 |
|---|---|---|---|---|---|---|---|
1,301 | _resolve_authconfig_credstore | def _resolve_authconfig_credstore(
self, registry: Optional[str], credstore_name: str
) -> Optional[Dict[str, Any]]:
if not registry or registry == INDEX_NAME:
# The ecosystem is a little schizophrenic with recker.io VS
# docker.io - in that case, it seems the full URL is necessary.
registry = INDEX_URL
log.debug(f"Looking for auth entry for {repr(registry)}")
store = self._get_store_instance(credstore_name)
try:
data = store.get(registry)
res = {
"ServerAddress": registry,
}
if data["Username"] == TOKEN_USERNAME:
res["IdentityToken"] = data["Secret"]
else:
res.update({"Username": data["Username"], "Password": data["Secret"]})
return res
except (dockerpycreds.CredentialsNotFound, ValueError):
log.debug("No entry found")
return None
except dockerpycreds.StoreError as e:
raise DockerError(f"Credentials store error: {repr(e)}") | python | wandb/docker/auth.py | 309 | 332 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,302 | _get_store_instance | def _get_store_instance(self, name: str) -> "dockerpycreds.Store":
if name not in self._stores:
self._stores[name] = dockerpycreds.Store(
name, environment=self._credstore_env
)
return self._stores[name] | python | wandb/docker/auth.py | 334 | 339 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,303 | get_credential_store | def get_credential_store(self, registry: Optional[str]) -> Optional[str]:
if not registry or registry == INDEX_NAME:
registry = INDEX_URL
return self.cred_helpers.get(registry) or self.creds_store | python | wandb/docker/auth.py | 341 | 345 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,304 | get_all_credentials | def get_all_credentials(self) -> Dict[str, Dict[str, Any]]:
auth_data = self.auths.copy()
if self.creds_store:
# Retrieve all credentials from the default store
store = self._get_store_instance(self.creds_store)
for k in store.list().keys():
auth_data[k] = self._resolve_authconfig_credstore(k, self.creds_store) # type: ignore
# credHelpers entries take priority over all others
for reg, store_name in self.cred_helpers.items():
auth_data[reg] = self._resolve_authconfig_credstore(reg, store_name) # type: ignore
return auth_data | python | wandb/docker/auth.py | 347 | 359 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,305 | add_auth | def add_auth(self, reg: str, data: Dict[str, Any]) -> None:
self["auths"][reg] = data | python | wandb/docker/auth.py | 361 | 362 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,306 | resolve_authconfig | def resolve_authconfig(
authconfig: Dict,
registry: Optional[str] = None,
credstore_env: Optional[Mapping] = None,
) -> Optional[Dict[str, Any]]:
if not isinstance(authconfig, AuthConfig):
authconfig = AuthConfig(authconfig, credstore_env)
return authconfig.resolve_authconfig(registry) | python | wandb/docker/auth.py | 365 | 372 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,307 | convert_to_hostname | def convert_to_hostname(url: str) -> str:
return url.replace("http://", "").replace("https://", "").split("/", 1)[0] | python | wandb/docker/auth.py | 375 | 376 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,308 | decode_auth | def decode_auth(auth: Union[str, bytes]) -> Tuple[str, str]:
if isinstance(auth, str):
auth = auth.encode("ascii")
s = base64.b64decode(auth)
login, pwd = s.split(b":", 1)
return login.decode("utf8"), pwd.decode("utf8") | python | wandb/docker/auth.py | 379 | 384 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,309 | parse_auth | def parse_auth(
entries: Dict, raise_on_error: bool = False
) -> Dict[str, Dict[str, Any]]:
"""Parse authentication entries.
Arguments:
entries: Dict of authentication entries.
raise_on_error: If set to true, an invalid format will raise
InvalidConfigFileError
Returns:
Authentication registry.
"""
return AuthConfig.parse_auth(entries, raise_on_error) | python | wandb/docker/auth.py | 387 | 399 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,310 | load_config | def load_config(
config_path: Optional[str] = None,
config_dict: Optional[Dict[str, Any]] = None,
credstore_env: Optional[Mapping] = None,
) -> AuthConfig:
return AuthConfig.load_config(config_path, config_dict, credstore_env) | python | wandb/docker/auth.py | 402 | 407 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,311 | _load_legacy_config | def _load_legacy_config(
config_file: str,
) -> Dict[str, Dict[str, Union[str, Dict[str, str]]]]:
log.debug("Attempting to parse legacy auth file format")
try:
data = []
with open(config_file) as f:
for line in f.readlines():
data.append(line.strip().split(" = ")[1])
if len(data) < 2:
# Not enough data
raise InvalidConfigFileError("Invalid or empty configuration file!")
username, password = decode_auth(data[0])
return {
"auths": {
INDEX_NAME: {
"username": username,
"password": password,
"email": data[1],
"serveraddress": INDEX_URL,
}
}
}
except Exception as e:
log.debug(e)
pass
log.debug("All parsing attempts failed - returning empty config")
return {} | python | wandb/docker/auth.py | 410 | 439 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,312 | __init__ | def __init__(
self,
command_launched: List[str],
return_code: int,
stdout: Optional[bytes] = None,
stderr: Optional[bytes] = None,
) -> None:
command_launched_str = " ".join(command_launched)
error_msg = (
f"The docker command executed was `{command_launched_str}`.\n"
f"It returned with code {return_code}\n"
)
if stdout is not None:
error_msg += f"The content of stdout is '{stdout.decode()}'\n"
else:
error_msg += (
"The content of stdout can be found above the "
"stacktrace (it wasn't captured).\n"
)
if stderr is not None:
error_msg += f"The content of stderr is '{stderr.decode()}'\n"
else:
error_msg += (
"The content of stderr can be found above the "
"stacktrace (it wasn't captured)."
)
super().__init__(error_msg) | python | wandb/docker/__init__.py | 17 | 43 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,313 | shell | def shell(cmd: List[str]) -> Optional[str]:
"""Simple wrapper for calling docker,.
returning None on error and the output on success
"""
try:
return (
subprocess.check_output(["docker"] + cmd, stderr=subprocess.STDOUT)
.decode("utf8")
.strip()
)
except subprocess.CalledProcessError as e:
print(e)
return None | python | wandb/docker/__init__.py | 53 | 66 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,314 | is_buildx_installed | def is_buildx_installed() -> bool:
"""Return `True` if docker buildx is installed and working."""
global _buildx_installed
if _buildx_installed is not None:
return _buildx_installed # type: ignore
if not find_executable("docker"):
_buildx_installed = False
else:
help_output = shell(["buildx", "--help"])
_buildx_installed = help_output is not None and "buildx" in help_output
return _buildx_installed | python | wandb/docker/__init__.py | 72 | 82 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,315 | build | def build(tags: List[str], file: str, context_path: str) -> str:
command = ["buildx", "build"] if is_buildx_installed() else ["build"]
build_tags = []
for tag in tags:
build_tags += ["-t", tag]
args = ["docker"] + command + build_tags + ["-f", file, context_path]
stdout = run_command_live_output(
args,
)
return stdout | python | wandb/docker/__init__.py | 85 | 94 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,316 | run_command_live_output | def run_command_live_output(args: List[Any]) -> str:
with subprocess.Popen(
args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
bufsize=1,
) as process:
stdout = ""
while True:
chunk = os.read(process.stdout.fileno(), 4096) # type: ignore
if not chunk:
break
index = chunk.find(b"\r")
if index != -1:
print(chunk.decode(), end="")
else:
stdout += chunk.decode()
print(chunk.decode(), end="\r")
print(stdout)
return_code = process.wait()
if return_code != 0:
raise DockerError(args, return_code, stdout.encode())
return stdout | python | wandb/docker/__init__.py | 97 | 123 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,317 | run | def run(
args: List[Any],
capture_stdout: bool = True,
capture_stderr: bool = True,
input: Optional[bytes] = None,
return_stderr: bool = False,
env: Optional[Dict[str, str]] = None,
) -> Union[str, Tuple[str, str]]:
args = [str(x) for x in args]
subprocess_env = dict(os.environ)
subprocess_env.update(env or {})
if args[1] == "buildx":
subprocess_env["DOCKER_CLI_EXPERIMENTAL"] = "enabled"
stdout_dest: Optional[int] = subprocess.PIPE if capture_stdout else None
stderr_dest: Optional[int] = subprocess.PIPE if capture_stderr else None
completed_process = subprocess.run(
args, input=input, stdout=stdout_dest, stderr=stderr_dest, env=subprocess_env
)
if completed_process.returncode != 0:
raise DockerError(
args,
completed_process.returncode,
completed_process.stdout,
completed_process.stderr,
)
if return_stderr:
return (
_post_process_stream(completed_process.stdout),
_post_process_stream(completed_process.stderr),
)
else:
return _post_process_stream(completed_process.stdout) | python | wandb/docker/__init__.py | 126 | 159 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,318 | _post_process_stream | def _post_process_stream(stream: Optional[bytes]) -> str:
if stream is None:
return ""
decoded_stream = stream.decode()
if len(decoded_stream) != 0 and decoded_stream[-1] == "\n":
decoded_stream = decoded_stream[:-1]
return decoded_stream | python | wandb/docker/__init__.py | 162 | 168 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,319 | default_image | def default_image(gpu: bool = False) -> str:
tag = "all"
if not gpu:
tag += "-cpu"
return "wandb/deepo:%s" % tag | python | wandb/docker/__init__.py | 171 | 175 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,320 | parse_repository_tag | def parse_repository_tag(repo_name: str) -> Tuple[str, Optional[str]]:
parts = repo_name.rsplit("@", 1)
if len(parts) == 2:
return parts[0], parts[1]
parts = repo_name.rsplit(":", 1)
if len(parts) == 2 and "/" not in parts[1]:
return parts[0], parts[1]
return repo_name, None | python | wandb/docker/__init__.py | 178 | 185 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,321 | parse | def parse(image_name: str) -> Tuple[str, str, str]:
repository, tag = parse_repository_tag(image_name)
registry, repo_name = auth.resolve_repository_name(repository)
if registry == "docker.io":
registry = "index.docker.io"
return registry, repo_name, (tag or "latest") | python | wandb/docker/__init__.py | 188 | 193 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,322 | auth_token | def auth_token(registry: str, repo: str) -> Dict[str, str]:
"""Make a request to the root of a v2 docker registry to get the auth url.
Always returns a dictionary, if there's no token key we couldn't authenticate
"""
# TODO: Cache tokens?
auth_info = auth_config.resolve_authconfig(registry)
if auth_info:
normalized = {k.lower(): v for k, v in auth_info.items()}
normalized_auth_info = (
normalized.get("username"),
normalized.get("password"),
)
else:
normalized_auth_info = None
response = requests.get(f"https://{registry}/v2/", timeout=3)
if response.headers.get("www-authenticate"):
try:
info: Dict = www_authenticate.parse(response.headers["www-authenticate"])
except ValueError:
info = {}
else:
log.error(
"Received {} when attempting to authenticate with {}".format(
response, registry
)
)
info = {}
if info.get("bearer"):
res = requests.get(
info["bearer"]["realm"]
+ "?service={}&scope=repository:{}:pull".format(
info["bearer"]["service"], repo
),
auth=normalized_auth_info, # type: ignore
timeout=3,
)
res.raise_for_status()
result_json: Dict[str, str] = res.json()
return result_json
return {} | python | wandb/docker/__init__.py | 196 | 236 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,323 | image_id_from_registry | def image_id_from_registry(image_name: str) -> Optional[str]:
"""Get the docker id from a public or private registry."""
registry, repository, tag = parse(image_name)
res = None
try:
token = auth_token(registry, repository).get("token")
# dockerhub is crazy
if registry == "index.docker.io":
registry = "registry-1.docker.io"
res = requests.head(
f"https://{registry}/v2/{repository}/manifests/{tag}",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/vnd.docker.distribution.manifest.v2+json",
},
timeout=5,
)
res.raise_for_status()
except requests.RequestException:
log.error(f"Received {res} when attempting to get digest for {image_name}")
return None
return "@".join([registry + "/" + repository, res.headers["Docker-Content-Digest"]]) | python | wandb/docker/__init__.py | 239 | 260 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,324 | image_id | def image_id(image_name: str) -> Optional[str]:
"""Retreve the image id from the local docker daemon or remote registry."""
if "@sha256:" in image_name:
return image_name
else:
digests = shell(["inspect", image_name, "--format", "{{json .RepoDigests}}"])
try:
if digests is None:
raise ValueError
im_id: str = json.loads(digests)[0]
return im_id
except (ValueError, IndexError):
return image_id_from_registry(image_name) | python | wandb/docker/__init__.py | 263 | 275 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,325 | get_image_uid | def get_image_uid(image_name: str) -> int:
"""Retrieve the image default uid through brute force."""
image_uid = shell(["run", image_name, "id", "-u"])
return int(image_uid) if image_uid else -1 | python | wandb/docker/__init__.py | 278 | 281 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,326 | push | def push(image: str, tag: str) -> Optional[str]:
"""Push an image to a remote registry."""
return shell(["push", f"{image}:{tag}"]) | python | wandb/docker/__init__.py | 284 | 286 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,327 | login | def login(username: str, password: str, registry: str) -> Optional[str]:
"""Login to a registry."""
return shell(["login", "--username", username, "--password", password, registry]) | python | wandb/docker/__init__.py | 289 | 291 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,328 | tag | def tag(image_name: str, tag: str) -> Optional[str]:
"""Tag an image."""
return shell(["tag", image_name, tag]) | python | wandb/docker/__init__.py | 294 | 296 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,329 | _casefold | def _casefold(value: str) -> str:
try:
return value.casefold()
except AttributeError:
return value.lower() | python | wandb/docker/www_authenticate.py | 15 | 19 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,330 | __getitem__ | def __getitem__(self, key: str) -> Any:
return super().__getitem__(_casefold(key)) | python | wandb/docker/www_authenticate.py | 23 | 24 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,331 | __setitem__ | def __setitem__(self, key: str, value: Any) -> None:
super().__setitem__(_casefold(key), value) | python | wandb/docker/www_authenticate.py | 26 | 27 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,332 | __contains__ | def __contains__(self, key: object) -> bool:
return super().__contains__(_casefold(key)) # type: ignore | python | wandb/docker/www_authenticate.py | 29 | 30 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,333 | get | def get(self, key: str, default: Optional[Any] = None) -> Any:
return super().get(_casefold(key), default) | python | wandb/docker/www_authenticate.py | 32 | 33 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,334 | pop | def pop(self, key: str, default: Optional[Any] = None) -> Any:
return super().pop(_casefold(key), default) | python | wandb/docker/www_authenticate.py | 35 | 36 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,335 | _group_pairs | def _group_pairs(tokens: list) -> None:
i = 0
while i < len(tokens) - 2:
if (
tokens[i][0] == "token"
and tokens[i + 1][0] == "equals"
and tokens[i + 2][0] == "token"
):
tokens[i : i + 3] = [("pair", (tokens[i][1], tokens[i + 2][1]))]
i += 1 | python | wandb/docker/www_authenticate.py | 39 | 48 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,336 | _group_challenges | def _group_challenges(tokens: list) -> list:
challenges = []
while tokens:
j = 1
if len(tokens) == 1:
pass
elif tokens[1][0] == "comma":
pass
elif tokens[1][0] == "token":
j = 2
else:
while j < len(tokens) and tokens[j][0] == "pair":
j += 2
j -= 1
challenges.append((tokens[0][1], tokens[1:j]))
tokens[: j + 1] = []
return challenges | python | wandb/docker/www_authenticate.py | 51 | 67 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,337 | parse | def parse(value: str) -> CaseFoldedOrderedDict:
tokens = []
while value:
for token_name, pattern in _tokens:
match = pattern.match(value)
if match:
value = value[match.end() :]
if token_name:
tokens.append((token_name, match.group(1)))
break
else:
raise ValueError("Failed to parse value")
_group_pairs(tokens)
challenges = CaseFoldedOrderedDict()
for name, tokens in _group_challenges(tokens): # noqa: B020
args, kwargs = [], {}
for token_name, value in tokens:
if token_name == "token":
args.append(value)
elif token_name == "pair":
kwargs[value[0]] = value[1]
challenges[name] = (args and args[0]) or kwargs or None
return challenges | python | wandb/docker/www_authenticate.py | 70 | 94 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,338 | __init__ | def __init__(self, *args, **kwargs):
self._api_args = args
self._api_kwargs = kwargs
self._api = None | python | wandb/apis/internal.py | 9 | 12 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,339 | __getstate__ | def __getstate__(self):
"""Use for serializing.
self._api is not serializable, so it's dropped
"""
state = self.__dict__.copy()
del state["_api"]
return state | python | wandb/apis/internal.py | 14 | 21 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,340 | __setstate__ | def __setstate__(self, state):
"""Used for deserializing.
Don't need to set self._api because it's constructed when needed.
"""
self.__dict__.update(state)
self._api = None | python | wandb/apis/internal.py | 23 | 29 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,341 | api | def api(self):
# This is a property in order to delay construction of Internal API
# for as long as possible. If constructed in constructor, then the
# whole InternalAPI is started when simply importing wandb.
if self._api is None:
self._api = InternalApi(*self._api_args, **self._api_kwargs)
return self._api | python | wandb/apis/internal.py | 32 | 38 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,342 | api_key | def api_key(self):
return self.api.api_key | python | wandb/apis/internal.py | 41 | 42 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,343 | api_url | def api_url(self):
return self.api.api_url | python | wandb/apis/internal.py | 45 | 46 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,344 | app_url | def app_url(self):
return self.api.app_url | python | wandb/apis/internal.py | 49 | 50 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,345 | default_entity | def default_entity(self):
return self.api.default_entity | python | wandb/apis/internal.py | 53 | 54 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,346 | git | def git(self):
return self.api.git | python | wandb/apis/internal.py | 57 | 58 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,347 | file_current | def file_current(self, *args):
return self.api.file_current(*args) | python | wandb/apis/internal.py | 60 | 61 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,348 | download_file | def download_file(self, *args, **kwargs):
return self.api.download_file(*args, **kwargs) | python | wandb/apis/internal.py | 63 | 64 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,349 | download_write_file | def download_write_file(self, *args, **kwargs):
return self.api.download_write_file(*args, **kwargs) | python | wandb/apis/internal.py | 66 | 67 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,350 | set_current_run_id | def set_current_run_id(self, run_id):
return self.api.set_current_run_id(run_id) | python | wandb/apis/internal.py | 69 | 70 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,351 | viewer | def viewer(self):
return self.api.viewer() | python | wandb/apis/internal.py | 72 | 73 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,352 | max_cli_version | def max_cli_version(self):
return self.api.max_cli_version() | python | wandb/apis/internal.py | 75 | 76 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,353 | viewer_server_info | def viewer_server_info(self):
return self.api.viewer_server_info() | python | wandb/apis/internal.py | 78 | 79 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,354 | list_projects | def list_projects(self, entity=None):
return self.api.list_projects(entity=entity) | python | wandb/apis/internal.py | 81 | 82 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,355 | format_project | def format_project(self, project):
return self.api.format_project(project) | python | wandb/apis/internal.py | 84 | 85 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,356 | upsert_project | def upsert_project(self, project, id=None, description=None, entity=None):
return self.api.upsert_project(
project, id=id, description=description, entity=entity
) | python | wandb/apis/internal.py | 87 | 90 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,357 | settings | def settings(self, *args, **kwargs):
return self.api.settings(*args, **kwargs) | python | wandb/apis/internal.py | 92 | 93 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,358 | clear_setting | def clear_setting(self, *args, **kwargs):
return self.api.clear_setting(*args, **kwargs) | python | wandb/apis/internal.py | 95 | 96 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,359 | set_setting | def set_setting(self, *args, **kwargs):
return self.api.set_setting(*args, **kwargs) | python | wandb/apis/internal.py | 98 | 99 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,360 | parse_slug | def parse_slug(self, *args, **kwargs):
return self.api.parse_slug(*args, **kwargs) | python | wandb/apis/internal.py | 101 | 102 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,361 | download_url | def download_url(self, *args, **kwargs):
return self.api.download_url(*args, **kwargs) | python | wandb/apis/internal.py | 104 | 105 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,362 | download_urls | def download_urls(self, *args, **kwargs):
return self.api.download_urls(*args, **kwargs) | python | wandb/apis/internal.py | 107 | 108 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,363 | create_anonymous_api_key | def create_anonymous_api_key(self):
return self.api.create_anonymous_api_key() | python | wandb/apis/internal.py | 110 | 111 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,364 | push | def push(self, *args, **kwargs):
return self.api.push(*args, **kwargs) | python | wandb/apis/internal.py | 113 | 114 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,365 | sweep | def sweep(self, *args, **kwargs):
return self.api.sweep(*args, **kwargs) | python | wandb/apis/internal.py | 116 | 117 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,366 | upsert_sweep | def upsert_sweep(self, *args, **kwargs):
return self.api.upsert_sweep(*args, **kwargs) | python | wandb/apis/internal.py | 119 | 120 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,367 | set_sweep_state | def set_sweep_state(self, *args, **kwargs):
return self.api.set_sweep_state(*args, **kwargs) | python | wandb/apis/internal.py | 122 | 123 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,368 | get_sweep_state | def get_sweep_state(self, *args, **kwargs):
return self.api.get_sweep_state(*args, **kwargs) | python | wandb/apis/internal.py | 125 | 126 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,369 | stop_sweep | def stop_sweep(self, *args, **kwargs):
return self.api.stop_sweep(*args, **kwargs) | python | wandb/apis/internal.py | 128 | 129 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,370 | cancel_sweep | def cancel_sweep(self, *args, **kwargs):
return self.api.cancel_sweep(*args, **kwargs) | python | wandb/apis/internal.py | 131 | 132 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,371 | pause_sweep | def pause_sweep(self, *args, **kwargs):
return self.api.pause_sweep(*args, **kwargs) | python | wandb/apis/internal.py | 134 | 135 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,372 | resume_sweep | def resume_sweep(self, *args, **kwargs):
return self.api.resume_sweep(*args, **kwargs) | python | wandb/apis/internal.py | 137 | 138 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,373 | register_agent | def register_agent(self, *args, **kwargs):
return self.api.register_agent(*args, **kwargs) | python | wandb/apis/internal.py | 140 | 141 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,374 | agent_heartbeat | def agent_heartbeat(self, *args, **kwargs):
return self.api.agent_heartbeat(*args, **kwargs) | python | wandb/apis/internal.py | 143 | 144 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,375 | use_artifact | def use_artifact(self, *args, **kwargs):
return self.api.use_artifact(*args, **kwargs) | python | wandb/apis/internal.py | 146 | 147 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,376 | create_artifact | def create_artifact(self, *args, **kwargs):
return self.api.create_artifact(*args, **kwargs) | python | wandb/apis/internal.py | 149 | 150 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,377 | run_config | def run_config(self, *args, **kwargs):
return self.api.run_config(*args, **kwargs) | python | wandb/apis/internal.py | 152 | 153 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,378 | upload_file_retry | def upload_file_retry(self, *args, **kwargs):
return self.api.upload_file_retry(*args, **kwargs) | python | wandb/apis/internal.py | 155 | 156 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,379 | upload_file_retry_async | async def upload_file_retry_async(self, *args, **kwargs):
return await self.api.upload_file_retry_async(*args, **kwargs) | python | wandb/apis/internal.py | 158 | 159 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,380 | get_run_info | def get_run_info(self, *args, **kwargs):
return self.api.get_run_info(*args, **kwargs) | python | wandb/apis/internal.py | 161 | 162 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,381 | get_run_state | def get_run_state(self, *args, **kwargs):
return self.api.get_run_state(*args, **kwargs) | python | wandb/apis/internal.py | 164 | 165 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,382 | entity_is_team | def entity_is_team(self, *args, **kwargs):
return self.api.entity_is_team(*args, **kwargs) | python | wandb/apis/internal.py | 167 | 168 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,383 | get_project_run_queues | def get_project_run_queues(self, *args, **kwargs):
return self.api.get_project_run_queues(*args, **kwargs) | python | wandb/apis/internal.py | 170 | 171 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,384 | push_to_run_queue | def push_to_run_queue(self, *args, **kwargs):
return self.api.push_to_run_queue(*args, **kwargs) | python | wandb/apis/internal.py | 173 | 174 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,385 | pop_from_run_queue | def pop_from_run_queue(self, *args, **kwargs):
return self.api.pop_from_run_queue(*args, **kwargs) | python | wandb/apis/internal.py | 176 | 177 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,386 | ack_run_queue_item | def ack_run_queue_item(self, *args, **kwargs):
return self.api.ack_run_queue_item(*args, **kwargs) | python | wandb/apis/internal.py | 179 | 180 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,387 | create_launch_agent | def create_launch_agent(self, *args, **kwargs):
return self.api.create_launch_agent(*args, **kwargs) | python | wandb/apis/internal.py | 182 | 183 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,388 | update_launch_agent_status | def update_launch_agent_status(self, *args, **kwargs):
return self.api.update_launch_agent_status(*args, **kwargs) | python | wandb/apis/internal.py | 185 | 186 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,389 | launch_agent_introspection | def launch_agent_introspection(self, *args, **kwargs):
return self.api.launch_agent_introspection(*args, **kwargs) | python | wandb/apis/internal.py | 188 | 189 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,390 | fail_run_queue_item_introspection | def fail_run_queue_item_introspection(self, *args, **kwargs):
return self.api.fail_run_queue_item_introspection(*args, **kwargs) | python | wandb/apis/internal.py | 191 | 192 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,391 | fail_run_queue_item | def fail_run_queue_item(self, *args, **kwargs):
return self.api.fail_run_queue_item(*args, **kwargs) | python | wandb/apis/internal.py | 194 | 195 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,392 | get_launch_agent | def get_launch_agent(self, *args, **kwargs):
return self.api.get_launch_agent(*args, **kwargs) | python | wandb/apis/internal.py | 197 | 198 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,393 | __init__ | def __init__(self, client: Client):
self._server_info = None
self._client = client | python | wandb/apis/public.py | 236 | 238 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,394 | app_url | def app_url(self):
return util.app_url(self._client.transport.url.replace("/graphql", "")) + "/" | python | wandb/apis/public.py | 241 | 242 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,395 | execute | def execute(self, *args, **kwargs):
try:
return self._client.execute(*args, **kwargs)
except requests.exceptions.ReadTimeout:
if "timeout" not in kwargs:
timeout = self._client.transport.default_timeout
wandb.termwarn(
f"A graphql request initiated by the public wandb API timed out (timeout={timeout} sec). "
f"Create a new API with an integer timeout larger than {timeout}, e.g., `api = wandb.Api(timeout={timeout + 10})` "
f"to increase the graphql timeout."
)
raise | python | wandb/apis/public.py | 249 | 260 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,396 | server_info | def server_info(self):
if self._server_info is None:
self._server_info = self.execute(self.INFO_QUERY).get("serverInfo")
return self._server_info | python | wandb/apis/public.py | 263 | 266 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,397 | version_supported | def version_supported(self, min_version):
from pkg_resources import parse_version
return parse_version(min_version) <= parse_version(
self.server_info["cliVersionInfo"]["max_cli_version"]
) | python | wandb/apis/public.py | 268 | 273 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,398 | __init__ | def __init__(
self,
overrides=None,
timeout: Optional[int] = None,
api_key: Optional[str] = None,
) -> None:
self.settings = InternalApi().settings()
_overrides = overrides or {}
self._api_key = api_key
if self.api_key is None:
wandb.login(host=_overrides.get("base_url"))
self.settings.update(_overrides)
if "username" in _overrides and "entity" not in _overrides:
wandb.termwarn(
'Passing "username" to Api is deprecated. please use "entity" instead.'
)
self.settings["entity"] = _overrides["username"]
self.settings["base_url"] = self.settings["base_url"].rstrip("/")
self._viewer = None
self._projects = {}
self._runs = {}
self._sweeps = {}
self._reports = {}
self._default_entity = None
self._timeout = timeout if timeout is not None else self._HTTP_TIMEOUT
self._base_client = Client(
transport=GraphQLSession(
headers={"User-Agent": self.user_agent, "Use-Admin-Privileges": "true"},
use_json=True,
# this timeout won't apply when the DNS lookup fails. in that case, it will be 60s
# https://bugs.python.org/issue22889
timeout=self._timeout,
auth=("api", self.api_key),
url="%s/graphql" % self.settings["base_url"],
)
)
self._client = RetryingClient(self._base_client) | python | wandb/apis/public.py | 400 | 437 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,399 | create_run | def create_run(self, **kwargs):
"""Create a new run."""
if kwargs.get("entity") is None:
kwargs["entity"] = self.default_entity
return Run.create(self, **kwargs) | python | wandb/apis/public.py | 439 | 443 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,400 | create_report | def create_report(
self,
project: str,
entity: str = "",
title: Optional[str] = "Untitled Report",
description: Optional[str] = "",
width: Optional[str] = "readable",
blocks: Optional["wandb.apis.reports.util.Block"] = None,
) -> "wandb.apis.reports.Report":
if entity == "":
entity = self.default_entity or ""
if blocks is None:
blocks = []
return wandb.apis.reports.Report(
project, entity, title, description, width, blocks
).save() | python | wandb/apis/public.py | 445 | 460 | {
"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.