repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
wandb
wandb/wandb_run.py
.py
"""Compatibility wandb_run module. Please use `wandb.Run` instead. """ from wandb.sdk.wandb_run import Run __all__ = ["Run"]
9
128
wandb
wandb/jupyter.py
.py
from __future__ import annotations import json import logging import os import re import shutil import sys import traceback import urllib.parse import urllib.request from base64 import b64encode from typing import Any import IPython import IPython.display from IPython.core.magic import Magics, line_cell_magic, magics...
512
16,417
wandb
wandb/_pydantic/utils.py
.py
"""Internal utilities for working with Pydantic types and data.""" from __future__ import annotations from functools import lru_cache from typing import TYPE_CHECKING, Any import pydantic_core if TYPE_CHECKING: from pydantic import BaseModel @lru_cache def gql_typename(cls: type[BaseModel]) -> str: """Get...
50
1,584
wandb
wandb/_pydantic/field_types.py
.py
"""Reusable field types and annotations for pydantic fields.""" from __future__ import annotations from typing import Annotated, TypeAlias, TypeVar from pydantic import Field, StrictStr T = TypeVar("T") Typename: TypeAlias = Annotated[T, Field(alias="__typename")] """Annotates GraphQL `__typename` fields.""" GQL...
17
437
wandb
wandb/_pydantic/__init__.py
.py
"""Internal utilities for working with pydantic.""" __all__ = [ "CompatBaseModel", "JsonableModel", "GQLBase", "GQLInput", "GQLResult", "Connection", "ConnectionWithTotal", "Edge", "FilterDict", "PageInfo", "OrderValidator", "PaginatorVars", "Typename", "GQLId", ...
58
1,109
wandb
wandb/_pydantic/pagination.py
.py
"""Utilities for client-side handling of "relay-style" GraphQL pagination. For formal specs and definitions, see https://relay.dev/graphql/connections.htm. """ from __future__ import annotations import re from collections.abc import Collection, Iterator from dataclasses import dataclass from typing import Annotated,...
150
5,222
wandb
wandb/_pydantic/base.py
.py
"""Base classes and other customizations for generated pydantic types.""" from __future__ import annotations from abc import ABC from collections.abc import Callable from typing import TYPE_CHECKING, Any, ClassVar, Literal, overload from pydantic import BaseModel, ConfigDict from pydantic.alias_generators import to_...
147
5,542
wandb
wandb/sandbox/_sandbox.py
.py
from __future__ import annotations from collections.abc import Callable, Mapping, Sequence from typing import TYPE_CHECKING, Any, ParamSpec, TypeVar from cwsandbox import RemoteFunction, SandboxDefaults from cwsandbox import Sandbox as _BaseSandbox from cwsandbox import Session as _BaseSession from wandb.errors impo...
142
4,332
wandb
wandb/sandbox/__init__.py
.py
from __future__ import annotations try: import cwsandbox except ImportError as exc: raise ImportError( "cwsandbox is not installed. Please install it with: pip install wandb[sandbox]" ) from exc from cwsandbox import * # noqa: F403 from cwsandbox import __all__ as cwsandbox_all # wandb specific ...
23
572
wandb
wandb/sandbox/_auth.py
.py
from __future__ import annotations from collections.abc import Generator from contextlib import contextmanager from contextvars import ContextVar import cwsandbox from cwsandbox import AuthHeaders, CWSandboxAuthenticationError, set_auth_mode import wandb from wandb.errors import UsageError from wandb.sdk import wand...
94
3,046
wandb
wandb/sandbox/_secret.py
.py
from __future__ import annotations from dataclasses import dataclass from cwsandbox import Secret as _BaseSecret WANDB_SECRET_STORE = "wandb-team-secrets" @dataclass(frozen=True, kw_only=True) class Secret(_BaseSecret): """W&B sandbox secret with a default team secret store.""" store: str = WANDB_SECRET_S...
15
325
wandb
wandb/automations/scopes.py
.py
"""Scopes in which a W&B Automation can be triggered.""" from __future__ import annotations from typing import Annotated, Literal from pydantic import BeforeValidator, Discriminator, Field from wandb._pydantic import GQLBase from ._generated import ( ArtifactPortfolioScopeFields, ArtifactSequenceScopeField...
122
3,417
wandb
wandb/automations/_compat.py
.py
from __future__ import annotations from collections.abc import Collection from typing import TYPE_CHECKING, Final from wandb._strutils import nameof from ._generated import ( EntityScopeFields, GenericWebhookActionFields, NoOpActionFields, NotificationActionFields, QueueJobActionFields, ) from .a...
134
4,241
wandb
wandb/automations/_run_state_filters.py
.py
from __future__ import annotations from collections.abc import Iterable from typing import TYPE_CHECKING, Annotated, Any from pydantic import BeforeValidator, field_validator from wandb._filters import BaseOp, FilterExpr from wandb._iterutils import always_list from wandb._pydantic import GQLBase from wandb.automati...
82
2,981
wandb
wandb/automations/_validators.py
.py
from __future__ import annotations from enum import Enum from typing import Annotated, Any, TypeVar from pydantic import BeforeValidator, Json, PlainSerializer from wandb._filters import And, MongoLikeFilter, Or, simplify_expr from wandb._pydantic import to_json T = TypeVar("T") def ensure_json(v: Any) -> Any: ...
170
5,499
wandb
wandb/automations/__init__.py
.py
from .actions import ActionType, DoNothing, SendNotification, SendWebhook from .automations import Automation, NewAutomation from .events import ( ArtifactEvent, EventType, MetricChangeFilter, MetricThresholdFilter, MetricZScoreFilter, OnAddArtifactAlias, OnAddArtifactTag, OnAddCollectio...
73
1,763
wandb
wandb/automations/integrations.py
.py
from __future__ import annotations from typing import Annotated from pydantic import Field, TypeAdapter from ._generated import SlackIntegrationFields, WebhookIntegrationFields class SlackIntegration(SlackIntegrationFields): team_name: str """Slack workspace (not W&B team) where this integration will post ...
40
959
wandb
wandb/automations/automations.py
.py
from __future__ import annotations from datetime import datetime from typing import Annotated from pydantic import Field from wandb._pydantic import GQLId, GQLInput from ._generated import TriggerFields from .actions import InputAction, SavedAction from .events import InputEvent, SavedEvent from .scopes import Auto...
86
2,649
wandb
wandb/automations/_inputs.py
.py
from __future__ import annotations from collections.abc import Collection from typing import Annotated, Any, Final, Protocol, TypedDict from pydantic import Field from typing_extensions import Self, Unpack from wandb._filters import MongoLikeFilter from wandb._pydantic import GQLId, GQLInput, computed_field, model_v...
276
9,878
wandb
wandb/automations/events.py
.py
"""Events that trigger W&B Automations.""" from __future__ import annotations from typing import TYPE_CHECKING, Annotated, Any, Literal, get_args from pydantic import AfterValidator, BeforeValidator, Discriminator, Field from wandb._filters import And, FilterableField, MongoLikeFilter from wandb._pydantic import GQ...
496
15,639
wandb
wandb/automations/_run_metric_filters.py
.py
from __future__ import annotations from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Annotated, Any, Final, Literal, TypeAlias, overload from pydantic import ( Field, PositiveFloat, PositiveInt, StrictFloat, StrictInt, field_validator, ) from typing_extensions import overri...
513
19,405
wandb
wandb/automations/actions.py
.py
"""Actions that are triggered by W&B Automations.""" from __future__ import annotations from typing import Annotated, Any, Literal, get_args from pydantic import BeforeValidator, Field from typing_extensions import Self, TypeVar from wandb._pydantic import GQLBase, GQLId, default_if_none from wandb._strutils import...
232
8,030
wandb
wandb/automations/_generated/operations.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/automations/ __all__ = [ "CREATE_AUTOMATION_GQL", "CREATE_GENERIC_WEBHOOK_INTEGRATION_GQL", "DELETE_AUTOMATION_GQL", "GET_AUTOMATIONS_LEGACY_GQL", "GET_ENTITY_AUTOMATIONS_GQL", "GET_ENTITY_AUTOMATIONS_LEGACY_GQL", "GET_ORG_AUTOM...
813
13,509
wandb
wandb/automations/_generated/input_types.py
.py
# Generated by ariadne-codegen # Source: core/api/graphql/schemas/schema-latest.graphql from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLId, GQLInput from .enums import ( AlertSeverity, EventTriggeringConditionType, TriggeredActionType, TriggerScopeType, )...
112
3,853
wandb
wandb/automations/_generated/update_automation.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/automations/ from __future__ import annotations from wandb._pydantic import GQLResult from .fragments import TriggerFields class UpdateAutomation(GQLResult): result: UpdateAutomationResult | None class UpdateAutomationResult(GQLResult): trigg...
21
419
wandb
wandb/automations/_generated/create_generic_webhook_integration.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/automations/ from __future__ import annotations from typing import Literal from pydantic import Field from wandb._pydantic import GQLResult, Typename from .fragments import WebhookIntegrationFields class CreateGenericWebhookIntegration(GQLResult): ...
34
890
wandb
wandb/automations/_generated/get_org_automations.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/automations/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLResult from .fragments import PageInfoFields, TriggerFields class GetOrgAutomations(GQLResult): scope: GetOrgAutomationsScope | None class ...
34
814
wandb
wandb/automations/_generated/fragments.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/automations/ from __future__ import annotations from datetime import datetime from typing import Literal from pydantic import Field from wandb._pydantic import GQLId, GQLResult, Typename from .enums import AlertSeverity, EventTriggeringConditionType ...
167
4,854
wandb
wandb/automations/_generated/__init__.py
.py
# Generated by ariadne-codegen __all__ = [ "CREATE_AUTOMATION_GQL", "CREATE_GENERIC_WEBHOOK_INTEGRATION_GQL", "DELETE_AUTOMATION_GQL", "GET_AUTOMATIONS_LEGACY_GQL", "GET_ENTITY_AUTOMATIONS_GQL", "GET_ENTITY_AUTOMATIONS_LEGACY_GQL", "GET_ORG_AUTOMATIONS_GQL", "INTEGRATIONS_BY_ENTITY_GQL"...
103
3,069
wandb
wandb/automations/_generated/get_automations_legacy.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/automations/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLResult from .fragments import PageInfoFields, ProjectTriggersFields class GetAutomationsLegacy(GQLResult): scope: GetAutomationsLegacyScope |...
34
877
wandb
wandb/automations/_generated/enums.py
.py
# Generated by ariadne-codegen # Source: core/api/graphql/schemas/schema-latest.graphql from __future__ import annotations from enum import Enum class AlertSeverity(str, Enum): ERROR = "ERROR" INFO = "INFO" WARN = "WARN" class EventTriggeringConditionType(str, Enum): ADD_ARTIFACT_ALIAS = "ADD_ARTI...
44
1,219
wandb
wandb/automations/_generated/delete_automation.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/automations/ from __future__ import annotations from wandb._pydantic import GQLResult class DeleteAutomation(GQLResult): result: DeleteAutomationResult class DeleteAutomationResult(GQLResult): success: bool DeleteAutomation.model_rebuild()
18
319
wandb
wandb/automations/_generated/integrations_by_entity.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/automations/ from __future__ import annotations from typing import Annotated, Literal from pydantic import Field from wandb._pydantic import GQLResult, Typename from .fragments import PageInfoFields, SlackIntegrationFields, WebhookIntegrationFields c...
48
1,363
wandb
wandb/automations/_generated/create_automation.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/automations/ from __future__ import annotations from wandb._pydantic import GQLResult from .fragments import TriggerFields class CreateAutomation(GQLResult): result: CreateAutomationResult | None class CreateAutomationResult(GQLResult): trigg...
21
419
wandb
wandb/automations/_generated/get_entity_automations.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/automations/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLResult from .fragments import PageInfoFields, TriggerFields class GetEntityAutomations(GQLResult): scope: GetEntityAutomationsScope | None ...
34
847
wandb
wandb/automations/_generated/get_entity_automations_legacy.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/automations/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLResult from .fragments import PageInfoFields, ProjectTriggersFields class GetEntityAutomationsLegacy(GQLResult): scope: GetEntityAutomationsL...
34
943
wandb
wandb/_filters/filterutils.py
.py
"""Helpers for parsing and transforming MongoDB expressions. If a function is defined here, it's an internal helper that we deliberately don't expose as instnace methods on filter types for now. """ from __future__ import annotations from collections.abc import Iterator from functools import singledispatch from typi...
97
3,064
wandb
wandb/_filters/__init__.py
.py
from .expressions import FIELD_REGEX, FilterableField, FilterExpr, MongoLikeFilter from .filterutils import simplify_expr from .operators import ( All, And, BaseOp, Contains, Eq, Exists, Gt, Gte, In, Lt, Lte, Ne, Nor, Not, NotIn, Op, Or, Regex, ...
51
666
wandb
wandb/_filters/operators.py
.py
"""Types that represent operators in MongoDB filter expressions.""" from __future__ import annotations from abc import ABC from collections.abc import Iterable from typing import TYPE_CHECKING, Any, TypeAlias, TypeVar, final, get_args from pydantic import ConfigDict, Field, StrictBool, StrictFloat, StrictInt, Strict...
309
8,517
wandb
wandb/_filters/expressions.py
.py
"""Pydantic-compatible representations of MongoDB expressions.""" from __future__ import annotations import re from collections.abc import Iterable from typing import Any, TypeAlias from pydantic import ConfigDict, model_serializer from typing_extensions import Self from wandb._pydantic import CompatBaseModel, mode...
193
6,356
wandb
wandb/docker/__init__.py
.py
from __future__ import annotations import json import logging import os import shutil import subprocess from typing import Any from wandb.docker import names from wandb.errors import Error class DockerError(Error): """Raised when attempting to execute a docker command.""" def __init__( self, ...
289
8,529
wandb
wandb/docker/names.py
.py
from __future__ import annotations class InvalidRepositoryError(Exception): """The given string is not a valid repository name.""" def resolve_repository_name(repo_name: str) -> tuple[str, str]: if "://" in repo_name: raise InvalidRepositoryError( f"Repository name cannot contain a schem...
41
1,311
wandb
wandb/sdk/wandb_helper.py
.py
import inspect import types from wandb.errors import UsageError from .lib import config_util def parse_config(params, exclude=None, include=None): if exclude and include: raise UsageError("Expected at most only one of exclude or include") if isinstance(params, str): params = config_util.dict...
55
1,824
wandb
wandb/sdk/wandb_sweep.py
.py
from __future__ import annotations import urllib.parse from collections.abc import Callable from typing import TYPE_CHECKING import wandb from wandb import env from . import wandb_login if TYPE_CHECKING: from wandb.wandb_controller import _WandbController def _get_sweep_url(api, sweep_id): """Return sweep...
125
3,993
wandb
wandb/sdk/wandb_settings.py
.py
from __future__ import annotations import json import logging import os import pathlib import platform import re import shutil import socket import sys import traceback from collections.abc import Callable, Sequence from datetime import datetime from typing import Any, Literal from urllib.parse import quote, unquote ...
2,334
77,834
wandb
wandb/sdk/wandb_alerts.py
.py
# from enum import Enum """ Call run.alert() to generate an email or Slack notification programmatically. """ class AlertLevel(Enum): INFO = "INFO" WARN = "WARN" ERROR = "ERROR"
13
193
wandb
wandb/sdk/__init__.py
.py
"""W&B SDK module.""" __all__ = ( "Config", "Settings", "Summary", "Artifact", "AlertLevel", "init", "setup", "_attach", "_sync", "login", "require", "finish", "teardown", "_watch", "_unwatch", "sweep", "controller", "helper", ) from . import wan...
37
783
wandb
wandb/sdk/wandb_watch.py
.py
"""watch.""" from __future__ import annotations import logging from collections.abc import Sequence from typing import TYPE_CHECKING try: from typing import Literal except ImportError: from typing import Literal # type: ignore import wandb from .lib import telemetry if TYPE_CHECKING: import torch # ...
148
4,762
wandb
wandb/sdk/wandb_require.py
.py
"""Feature Flags Module. This module implements a feature flag system for the wandb library to require experimental features and notify the user when features have been deprecated. Example: import wandb wandb.require("wandb-service@beta") wandb.require("incremental-artifacts@beta") """ from __future__ im...
89
2,722
wandb
wandb/sdk/wandb_summary.py
.py
import abc import typing as t from .interface.summary_record import SummaryItem, SummaryRecord class SummaryDict(metaclass=abc.ABCMeta): """dict-like wrapper for the nested dictionaries in a SummarySubDict. Triggers self._root._callback on property changes. """ @abc.abstractmethod def _as_dict(...
143
4,369
wandb
wandb/sdk/wandb_setup.py
.py
"""Global W&B library state. This module manages global state, which for wandb includes: - Settings configured through `wandb.setup()` - The list of active runs - A subprocess ("the internal service") that asynchronously uploads metrics This module is fork-aware: in a forked process such as that spawned by the `mult...
595
20,368
wandb
wandb/sdk/wandb_login.py
.py
"""Log in to Weights & Biases. This authenticates your machine to log data to your account. """ from __future__ import annotations import click import wandb from wandb import env from wandb.apis.public.service_api import ServiceApi from wandb.errors import AuthenticationError, term from wandb.sdk import wandb_setup...
372
11,423
wandb
wandb/sdk/wandb_run.py
.py
from __future__ import annotations import contextlib import functools import glob import json import logging import numbers import os import pathlib import re import sys import threading import time import traceback from collections.abc import Callable, Mapping, Sequence from dataclasses import dataclass, field from d...
4,244
152,133
wandb
wandb/sdk/wandb_metric.py
.py
"""metric.""" from __future__ import annotations import logging from collections.abc import Callable, Sequence from wandb.proto import wandb_internal_pb2 as pb logger = logging.getLogger("wandb") class Metric: """Metric object.""" _callback: Callable[[pb.MetricRecord], None] | None _name: str _st...
115
3,320
wandb
wandb/sdk/wandb_config.py
.py
"""config.""" from __future__ import annotations import logging import wandb from wandb.util import ( _is_artifact_representation, check_dict_contains_nested_artifact, json_friendly_val, ) from . import wandb_helper from .lib import config_util logger = logging.getLogger("wandb") # TODO(jhr): conside...
328
10,707
wandb
wandb/sdk/wandb_init.py
.py
"""Defines wandb.init() and associated classes and methods. `wandb.init()` indicates the beginning of a new run. In an ML training pipeline, you could add `wandb.init()` to the beginning of your training script as well as your evaluation script, and each step would be tracked as a run in W&B. For more on using `wandb...
1,558
60,248
wandb
wandb/sdk/mailbox/response_handle.py
.py
from __future__ import annotations import asyncio import logging import math from collections.abc import Awaitable, Callable from typing_extensions import override from wandb.proto import wandb_server_pb2 as spb from wandb.sdk.lib import asyncio_manager from .mailbox_handle import HandleAbandonedError, MailboxHandl...
134
3,972
wandb
wandb/sdk/mailbox/__init__.py
.py
"""A message protocol for the internal service process. The core of W&B is implemented by a side process that asynchronously uploads data. The client process (such as this Python code) sends requests to the service, and for some requests, the service eventually sends a response. The client can send multiple requests ...
24
856
wandb
wandb/sdk/mailbox/mailbox_handle.py
.py
from __future__ import annotations import abc from collections.abc import Callable from typing import Generic from typing_extensions import TypeVar, override from wandb.sdk.lib import asyncio_manager _T = TypeVar("_T") _S = TypeVar("_S") class HandleAbandonedError(Exception): """The handle has no response and...
129
4,054
wandb
wandb/sdk/mailbox/wait_with_progress.py
.py
from __future__ import annotations import time from collections.abc import Callable, Coroutine from typing import Any, TypeVar, cast from wandb.sdk.lib import asyncio_compat from .mailbox_handle import MailboxHandle _T = TypeVar("_T") def wait_with_progress( handle: MailboxHandle[_T], *, timeout: floa...
102
3,117
wandb
wandb/sdk/mailbox/mailbox.py
.py
from __future__ import annotations import logging import secrets import string import threading from collections.abc import Awaitable, Callable from wandb.proto import wandb_internal_pb2 as pb from wandb.proto import wandb_server_pb2 as spb from wandb.sdk.lib import asyncio_manager from .mailbox_handle import Mailbo...
161
5,242
wandb
wandb/sdk/verify/verify.py
.py
"""Utilities for wandb verify.""" from __future__ import annotations import contextlib import getpass import io import os import time from collections.abc import Callable from functools import partial from http import HTTPStatus from pathlib import Path from typing import Any import click import requests import wan...
554
18,372
wandb
wandb/sdk/internal/tb_watcher.py
.py
"""tensorboard watcher.""" from __future__ import annotations import glob import logging import os import queue import socket import sys import threading import time from typing import TYPE_CHECKING, Any import wandb from wandb import util from wandb.plot import CustomChart from wandb.sdk.lib import filesystem from...
521
18,540
wandb
wandb/sdk/internal/progress.py
.py
"""progress.""" from __future__ import annotations import os from typing import IO, TYPE_CHECKING from wandb.errors import CommError if TYPE_CHECKING: from typing import Protocol class ProgressFn(Protocol): def __call__(self, new_bytes: int, total_bytes: int) -> None: pass class Progr...
78
2,296
wandb
wandb/sdk/internal/incremental_table_util.py
.py
from __future__ import annotations import time from typing import TYPE_CHECKING if TYPE_CHECKING: from wandb import Table from wandb.sdk.artifacts.artifact import Artifact from ..wandb_run import Run as LocalRun ART_TYPE = "wandb-run-incremental-table" def _get_artifact_name(run: LocalRun, key: str) -...
54
1,490
wandb
wandb/sdk/internal/internal_api.py
.py
from __future__ import annotations import base64 import datetime import functools import http.client import json import logging import os import re import socket import sys import tempfile from collections.abc import Callable, Iterable, Mapping, MutableMapping, Sequence from copy import deepcopy from pathlib import Pa...
3,819
133,198
wandb
wandb/sdk/internal/profiler.py
.py
"""Integration with pytorch profiler.""" import os import wandb from wandb.errors import Error, UsageError from wandb.sdk.lib import telemetry PYTORCH_MODULE = "torch" PYTORCH_PROFILER_MODULE = "torch.profiler" def torch_trace_handler(): """Create a trace handler for traces generated by the profiler. Pro...
80
2,391
wandb
wandb/sdk/internal/run.py
.py
# """InternalRun - Internal-only run object. Semi-stubbed run for internal process use. """ from typing_extensions import override from wandb.sdk import wandb_run class InternalRun(wandb_run.Run): def __init__(self, run_obj, settings, datatypes_cb): super().__init__(settings=settings) self._ru...
28
624
wandb
wandb/sdk/internal/sender_config.py
.py
from __future__ import annotations import json from collections.abc import Sequence from typing import Any, NewType from wandb.proto import wandb_internal_pb2 from wandb.sdk.lib import proto_util, telemetry BackendConfigDict = NewType("BackendConfigDict", dict[str, Any]) """Run config dictionary in the format used b...
207
7,171
wandb
wandb/sdk/internal/sender.py
.py
"""sender.""" from __future__ import annotations import contextlib import glob import gzip import json import logging import os import queue import threading import time import traceback from collections import defaultdict from collections.abc import Generator from datetime import datetime from queue import Queue fro...
1,646
63,604
wandb
wandb/sdk/internal/datastore.py
.py
"""leveldb log datastore. Format is described at: https://github.com/google/leveldb/blob/master/doc/log_format.md block := record* trailer? record := checksum: uint32 // crc32c of type and data[] ; little-endian length: uint16 // little-endian type: uint8 // One of FULL, FIRST, MIDDLE, LA...
284
9,469
wandb
wandb/sdk/internal/job_builder.py
.py
"""job builder.""" from __future__ import annotations import json import logging import os import re import sys from collections.abc import Callable from typing import TYPE_CHECKING, Any, Literal, TypedDict import wandb from wandb.sdk.artifacts._internal_artifact import InternalArtifact from wandb.sdk.artifacts.arti...
642
23,218
wandb
wandb/sdk/internal/file_stream.py
.py
from __future__ import annotations import functools import itertools import json import logging import os import queue import random import sys import threading import time from collections.abc import Callable from types import TracebackType from typing import TYPE_CHECKING, Any, NamedTuple if TYPE_CHECKING: from...
678
25,529
wandb
wandb/sdk/internal/settings_static.py
.py
from __future__ import annotations from collections.abc import Iterable from typing import Any from wandb.sdk.wandb_settings import Settings class SettingsStatic(Settings): """A readonly object that wraps a protobuf Settings message. Implements the mapping protocol, so you can access settings as attrib...
42
1,202
wandb
wandb/sdk/internal/handler.py
.py
"""Handle Manager.""" from __future__ import annotations import json import logging import math import numbers import time from collections import defaultdict from collections.abc import Callable, Sequence from queue import Queue from threading import Event from typing import TYPE_CHECKING, Any, cast from wandb.erro...
808
29,824
wandb
wandb/sdk/internal/file_pusher.py
.py
from __future__ import annotations import concurrent.futures import logging import os import queue import tempfile import threading import time from typing import TYPE_CHECKING import wandb import wandb.util from wandb.filesync import stats, step_checksum, step_upload from wandb.sdk.lib.paths import LogicalPath if T...
180
6,024
wandb
wandb/sdk/internal/_generated/operations.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/utils/ __all__ = ["SERVER_FEATURES_QUERY_GQL"] SERVER_FEATURES_QUERY_GQL = """ query ServerFeaturesQuery { serverInfo { features { name isEnabled } } } """
16
245
wandb
wandb/sdk/internal/_generated/server_features_query.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/utils/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLResult class ServerFeaturesQuery(GQLResult): server_info: ServerFeaturesQueryServerInfo | None = Field(alias="serverInfo") class ServerFeaturesQue...
26
614
wandb
wandb/sdk/artifacts/_gqlutils.py
.py
from __future__ import annotations from contextlib import suppress from dataclasses import dataclass from functools import lru_cache from typing import TYPE_CHECKING from wandb._iterutils import one from wandb.proto.wandb_internal_pb2 import ServerFeature from wandb.sdk.internal._generated import SERVER_FEATURES_QUER...
193
7,910
wandb
wandb/sdk/artifacts/artifact_download_logger.py
.py
"""Artifact download logger.""" from __future__ import annotations import multiprocessing.dummy import time from collections.abc import Callable from wandb.errors.term import termlog class ArtifactDownloadLogger: def __init__( self, nfiles: int, clock_for_testing: Callable[[], float] = ...
46
1,546
wandb
wandb/sdk/artifacts/staging.py
.py
"""Manages artifact file staging. Artifact files are copied to the staging area as soon as they are added to an artifact in order to avoid file changes corrupting the artifact. Once the upload is complete, the file should be moved to the artifact cache. """ from __future__ import annotations import os from wandb im...
28
890
wandb
wandb/sdk/artifacts/exceptions.py
.py
"""Artifact exceptions.""" from __future__ import annotations from typing import TYPE_CHECKING, TypeVar from wandb import errors from wandb._strutils import nameof if TYPE_CHECKING: from wandb.sdk.artifacts.artifact import Artifact ArtifactT = TypeVar("ArtifactT", bound=Artifact) class ArtifactStatusErro...
73
2,323
wandb
wandb/sdk/artifacts/artifact.py
.py
"""Artifact class.""" from __future__ import annotations import atexit import contextlib import json import logging import multiprocessing.dummy import os import re import shutil import stat import tempfile import time from collections import deque from collections.abc import Generator, Sequence from concurrent.futur...
2,752
106,358
wandb
wandb/sdk/artifacts/artifact_state.py
.py
"""Artifact state.""" from __future__ import annotations from enum import Enum class ArtifactState(Enum): PENDING = "PENDING" COMMITTED = "COMMITTED" DELETED = "DELETED" GARBAGE_COLLECTED = "GARBAGE_COLLECTED" PENDING_DELETION = "PENDING_DELETION"
14
272
wandb
wandb/sdk/artifacts/storage_policy.py
.py
"""Storage policy.""" from __future__ import annotations import concurrent.futures from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Any from wandb.sdk.internal.internal_api import Api as InternalApi from wandb.sdk.lib.paths import FilePathStr, URIStr if TYPE_CHECKING: from wandb.filesync.st...
90
2,546
wandb
wandb/sdk/artifacts/_validators.py
.py
"""Internal validation utilities that are specific to artifacts.""" from __future__ import annotations import json import os import re from collections.abc import Callable from dataclasses import dataclass, field, replace from functools import singledispatch, wraps from pathlib import PureWindowsPath from typing impo...
373
12,993
wandb
wandb/sdk/artifacts/storage_handler.py
.py
"""Storage handler.""" from __future__ import annotations from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Final from wandb.sdk.lib.paths import FilePathStr, URIStr if TYPE_CHECKING: from urllib.parse import ParseResult from wandb.sdk.artifacts.artifact import Artifact from wandb.s...
69
2,045
wandb
wandb/sdk/artifacts/artifact_instance_cache.py
.py
"""Recent Artifact storage. Artifacts are registered in the cache to ensure they won't be immediately garbage collected and can be retrieved by their ID. """ from __future__ import annotations from typing import TYPE_CHECKING from wandb.sdk.lib.capped_dict import CappedDict if TYPE_CHECKING: from wandb.sdk.art...
19
602
wandb
wandb/sdk/artifacts/_factories.py
.py
from __future__ import annotations from typing import TYPE_CHECKING from ._models.storage import StoragePolicyConfig from .storage_policies import WandbStoragePolicy if TYPE_CHECKING: from .storage_policy import StoragePolicy def make_storage_policy(region: str | None = None) -> StoragePolicy: """Returns t...
15
461
wandb
wandb/sdk/artifacts/artifact_manifest_entry.py
.py
"""Artifact manifest entry.""" # Keep older-style type annotations in this legacy model. # ruff: noqa: UP006, UP007, UP035, UP045 from __future__ import annotations import concurrent.futures import hashlib import logging import os from contextlib import suppress from os.path import getsize from typing import TYPE_CH...
265
9,613
wandb
wandb/sdk/artifacts/storage_layout.py
.py
"""Storage layout.""" from __future__ import annotations from enum import Enum class StorageLayout(str, Enum): V1 = "V1" V2 = "V2" @classmethod def from_env(cls) -> StorageLayout: from wandb.env import get_use_v1_artifacts return cls.V1 if get_use_v1_artifacts() else cls.V2
17
313
wandb
wandb/sdk/artifacts/artifact_manifest.py
.py
"""Artifact manifest.""" from __future__ import annotations from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Annotated, Any, Dict # noqa: UP035 from pydantic import Field from wandb.sdk.lib.hashutil import HexMD5 from ._models.base_model import ArtifactsBase from ._validators import validate_...
81
2,806
wandb
wandb/sdk/artifacts/artifact_ttl.py
.py
"""Artifact TTL.""" from __future__ import annotations from enum import Enum class ArtifactTTL(Enum): INHERIT = 0
10
122
wandb
wandb/sdk/artifacts/_internal_artifact.py
.py
from __future__ import annotations import re from base64 import urlsafe_b64encode from typing import Any, Final from zlib import crc32 from wandb.sdk.artifacts.artifact import Artifact PLACEHOLDER: Final[str] = "PLACEHOLDER" def sanitize_artifact_name(name: str) -> str: """Sanitize the string to satisfy constr...
55
1,923
wandb
wandb/sdk/artifacts/artifact_file_cache.py
.py
"""Artifact cache.""" from __future__ import annotations import contextlib import errno import hashlib import os import shutil import subprocess import sys from collections.abc import Generator from contextlib import AbstractContextManager from functools import lru_cache from pathlib import Path from tempfile import ...
258
10,033
wandb
wandb/sdk/artifacts/artifact_saver.py
.py
"""Artifact saver.""" from __future__ import annotations import concurrent.futures import json import os import tempfile from collections.abc import Awaitable, Sequence from typing import TYPE_CHECKING import wandb import wandb.filesync.step_prepare from wandb import util from wandb.sdk.artifacts.artifact_manifest i...
276
9,623
wandb
wandb/sdk/artifacts/_models/storage.py
.py
from __future__ import annotations from pydantic import ConfigDict, StrictStr from pydantic.alias_generators import to_camel from typing_extensions import Self from wandb.sdk.artifacts.storage_layout import StorageLayout from .base_model import ArtifactsBase class StoragePolicyConfig(ArtifactsBase): model_conf...
31
883
wandb
wandb/sdk/artifacts/_models/manifest.py
.py
from typing import Any, Literal, final from pydantic import field_validator from pydantic.alias_generators import to_camel from wandb.sdk.artifacts.artifact_manifest_entry import ArtifactManifestEntry from .base_model import ArtifactsBase from .storage import StoragePolicyConfig @final class ArtifactManifestV1Data...
30
990
wandb
wandb/sdk/artifacts/_models/artifact_collection.py
.py
from __future__ import annotations from typing import TYPE_CHECKING, Any from pydantic import Field, field_validator from typing_extensions import Self from wandb._pydantic import GQLId from .base_model import ArtifactsBase if TYPE_CHECKING: from wandb.sdk.artifacts._generated import ArtifactCollectionFragment...
127
4,475
wandb
wandb/sdk/artifacts/_models/__init__.py
.py
"""Pydantic model classes and related helpers for artifacts code. Excludes GraphQL-generated classes. """ __all__ = [ "ArtifactsBase", "RegistryData", "ArtifactCollectionData", ] from .artifact_collection import ArtifactCollectionData from .base_model import ArtifactsBase from .registry import RegistryDat...
14
322