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
3,001
scheme
def scheme(self) -> str: return self._scheme
python
wandb/sdk/wandb_artifacts.py
1,334
1,335
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,002
init_boto
def init_boto(self) -> "boto3.resources.base.ServiceResource": if self._s3 is not None: return self._s3 boto: "boto3" = util.get_module( "boto3", required="s3:// references requires the boto3 library, run pip install wandb[aws]", lazy=False, ) ...
python
wandb/sdk/wandb_artifacts.py
1,337
1,351
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,003
_parse_uri
def _parse_uri(self, uri: str) -> Tuple[str, str, Optional[str]]: url = urlparse(uri) query = dict(parse_qsl(url.query)) bucket = url.netloc key = url.path[1:] # strip leading slash version = query.get("versionId") return bucket, key, version
python
wandb/sdk/wandb_artifacts.py
1,353
1,361
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,004
versioning_enabled
def versioning_enabled(self, bucket: str) -> bool: self.init_boto() assert self._s3 is not None # mypy: unwraps optionality if self._versioning_enabled is not None: return self._versioning_enabled res = self._s3.BucketVersioning(bucket) self._versioning_enabled = res...
python
wandb/sdk/wandb_artifacts.py
1,363
1,370
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,005
load_path
def load_path( self, manifest_entry: ArtifactManifestEntry, local: bool = False, ) -> Union[URIStr, FilePathStr]: if not local: assert manifest_entry.ref is not None return manifest_entry.ref assert manifest_entry.ref is not None path, hit, c...
python
wandb/sdk/wandb_artifacts.py
1,372
1,433
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,006
store_path
def store_path( self, artifact: ArtifactInterface, path: Union[URIStr, FilePathStr], name: Optional[str] = None, checksum: bool = True, max_objects: Optional[int] = None, ) -> Sequence[ArtifactManifestEntry]: self.init_boto() assert self._s3 is not Non...
python
wandb/sdk/wandb_artifacts.py
1,435
1,510
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,007
_size_from_obj
def _size_from_obj(self, obj: "boto3.s3.Object") -> int: # ObjectSummary has size, Object has content_length size: int if hasattr(obj, "size"): size = obj.size else: size = obj.content_length return size
python
wandb/sdk/wandb_artifacts.py
1,512
1,519
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,008
_entry_from_obj
def _entry_from_obj( self, obj: "boto3.s3.Object", path: str, name: Optional[str] = None, prefix: str = "", multi: bool = False, ) -> ArtifactManifestEntry: """Create an ArtifactManifestEntry from an S3 object. Arguments: obj: The S3 objec...
python
wandb/sdk/wandb_artifacts.py
1,521
1,568
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,009
_etag_from_obj
def _etag_from_obj(obj: "boto3.s3.Object") -> ETag: etag: ETag etag = obj.e_tag[1:-1] # escape leading and trailing quote return etag
python
wandb/sdk/wandb_artifacts.py
1,571
1,574
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,010
_extra_from_obj
def _extra_from_obj(obj: "boto3.s3.Object") -> Dict[str, str]: extra = { "etag": obj.e_tag[1:-1], # escape leading and trailing quote } # ObjectSummary will never have version_id if hasattr(obj, "version_id") and obj.version_id != "null": extra["versionID"] = obj...
python
wandb/sdk/wandb_artifacts.py
1,577
1,584
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,011
_content_addressed_path
def _content_addressed_path(md5: str) -> FilePathStr: # TODO: is this the structure we want? not at all human # readable, but that's probably OK. don't want people # poking around in the bucket return FilePathStr( "wandb/%s" % base64.b64encode(md5.encode("ascii")).decode("asc...
python
wandb/sdk/wandb_artifacts.py
1,587
1,593
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,012
__init__
def __init__(self, scheme: Optional[str] = None) -> None: self._scheme = scheme or "gs" self._client = None self._versioning_enabled = None self._cache = get_artifacts_cache()
python
wandb/sdk/wandb_artifacts.py
1,600
1,604
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,013
versioning_enabled
def versioning_enabled(self, bucket_path: str) -> bool: if self._versioning_enabled is not None: return self._versioning_enabled self.init_gcs() assert self._client is not None # mypy: unwraps optionality bucket = self._client.bucket(bucket_path) bucket.reload() ...
python
wandb/sdk/wandb_artifacts.py
1,606
1,614
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,014
scheme
def scheme(self) -> str: return self._scheme
python
wandb/sdk/wandb_artifacts.py
1,617
1,618
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,015
init_gcs
def init_gcs(self) -> "gcs_module.client.Client": if self._client is not None: return self._client storage = util.get_module( "google.cloud.storage", required="gs:// references requires the google-cloud-storage library, run pip install wandb[gcp]", ) s...
python
wandb/sdk/wandb_artifacts.py
1,620
1,628
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,016
_parse_uri
def _parse_uri(self, uri: str) -> Tuple[str, str, Optional[str]]: url = urlparse(uri) bucket = url.netloc key = url.path[1:] version = url.fragment if url.fragment else None return bucket, key, version
python
wandb/sdk/wandb_artifacts.py
1,630
1,635
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,017
load_path
def load_path( self, manifest_entry: ArtifactManifestEntry, local: bool = False, ) -> Union[URIStr, FilePathStr]: if not local: assert manifest_entry.ref is not None return manifest_entry.ref path, hit, cache_open = self._cache.check_md5_obj_path( ...
python
wandb/sdk/wandb_artifacts.py
1,637
1,682
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,018
store_path
def store_path( self, artifact: ArtifactInterface, path: Union[URIStr, FilePathStr], name: Optional[str] = None, checksum: bool = True, max_objects: Optional[int] = None, ) -> Sequence[ArtifactManifestEntry]: self.init_gcs() assert self._client is not ...
python
wandb/sdk/wandb_artifacts.py
1,684
1,740
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,019
_entry_from_obj
def _entry_from_obj( self, obj: "gcs_module.blob.Blob", path: str, name: Optional[str] = None, prefix: str = "", multi: bool = False, ) -> ArtifactManifestEntry: """Create an ArtifactManifestEntry from a GCS object. Arguments: obj: The GCS...
python
wandb/sdk/wandb_artifacts.py
1,742
1,789
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,020
_extra_from_obj
def _extra_from_obj(obj: "gcs_module.blob.Blob") -> Dict[str, str]: return { "etag": obj.etag, "versionID": obj.generation, }
python
wandb/sdk/wandb_artifacts.py
1,792
1,796
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,021
_content_addressed_path
def _content_addressed_path(md5: str) -> FilePathStr: # TODO: is this the structure we want? not at all human # readable, but that's probably OK. don't want people # poking around in the bucket return FilePathStr( "wandb/%s" % base64.b64encode(md5.encode("ascii")).decode("asc...
python
wandb/sdk/wandb_artifacts.py
1,799
1,805
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,022
__init__
def __init__(self, session: requests.Session, scheme: Optional[str] = None) -> None: self._scheme = scheme or "http" self._cache = get_artifacts_cache() self._session = session
python
wandb/sdk/wandb_artifacts.py
1,809
1,812
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,023
scheme
def scheme(self) -> str: return self._scheme
python
wandb/sdk/wandb_artifacts.py
1,815
1,816
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,024
load_path
def load_path( self, manifest_entry: ArtifactManifestEntry, local: bool = False, ) -> Union[URIStr, FilePathStr]: if not local: assert manifest_entry.ref is not None return manifest_entry.ref assert manifest_entry.ref is not None path, hit, c...
python
wandb/sdk/wandb_artifacts.py
1,818
1,852
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,025
store_path
def store_path( self, artifact: ArtifactInterface, path: Union[URIStr, FilePathStr], name: Optional[str] = None, checksum: bool = True, max_objects: Optional[int] = None, ) -> Sequence[ArtifactManifestEntry]: name = LogicalFilePathStr(name or os.path.basename(...
python
wandb/sdk/wandb_artifacts.py
1,854
1,875
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,026
_entry_from_headers
def _entry_from_headers( self, headers: requests.structures.CaseInsensitiveDict ) -> Tuple[Optional[ETag], Optional[int], Dict[str, str]]: response_headers = {k.lower(): v for k, v in headers.items()} size = None if response_headers.get("content-length", None): size = int...
python
wandb/sdk/wandb_artifacts.py
1,877
1,891
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,027
__init__
def __init__(self) -> None: self._scheme = "wandb-artifact" self._cache = get_artifacts_cache() self._client = None
python
wandb/sdk/wandb_artifacts.py
1,899
1,902
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,028
scheme
def scheme(self) -> str: """Scheme this handler applies to.""" return self._scheme
python
wandb/sdk/wandb_artifacts.py
1,905
1,907
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,029
client
def client(self) -> PublicApi: if self._client is None: self._client = PublicApi() return self._client
python
wandb/sdk/wandb_artifacts.py
1,910
1,913
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,030
load_path
def load_path( self, manifest_entry: ArtifactManifestEntry, local: bool = False, ) -> Union[URIStr, FilePathStr]: """Load the file in the specified artifact given its corresponding entry. Download the referenced artifact; create and return a new symlink to the caller. ...
python
wandb/sdk/wandb_artifacts.py
1,915
1,947
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,031
store_path
def store_path( self, artifact: ArtifactInterface, path: Union[URIStr, FilePathStr], name: Optional[str] = None, checksum: bool = True, max_objects: Optional[int] = None, ) -> Sequence[ArtifactManifestEntry]: """Store the file or directory at the given path in...
python
wandb/sdk/wandb_artifacts.py
1,949
2,002
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,032
__init__
def __init__(self) -> None: self._scheme = "wandb-client-artifact" self._cache = get_artifacts_cache()
python
wandb/sdk/wandb_artifacts.py
2,010
2,012
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,033
scheme
def scheme(self) -> str: """Scheme this handler applies to.""" return self._scheme
python
wandb/sdk/wandb_artifacts.py
2,015
2,017
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,034
load_path
def load_path( self, manifest_entry: ArtifactManifestEntry, local: bool = False, ) -> Union[URIStr, FilePathStr]: raise NotImplementedError( "Should not be loading a path for an artifact entry with unresolved client id." )
python
wandb/sdk/wandb_artifacts.py
2,019
2,026
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,035
store_path
def store_path( self, artifact: ArtifactInterface, path: Union[URIStr, FilePathStr], name: Optional[str] = None, checksum: bool = True, max_objects: Optional[int] = None, ) -> Sequence[ArtifactManifestEntry]: """Store the file or directory at the given path wi...
python
wandb/sdk/wandb_artifacts.py
2,028
2,063
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,036
_set_logger
def _set_logger(log_object: logging.Logger) -> None: """Configure module logger.""" global logger logger = log_object
python
wandb/sdk/wandb_init.py
56
59
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,037
_huggingface_version
def _huggingface_version() -> Optional[str]: if "transformers" in sys.modules: trans = wandb.util.get_module("transformers") if hasattr(trans, "__version__"): return str(trans.__version__) return None
python
wandb/sdk/wandb_init.py
62
67
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,038
_maybe_mp_process
def _maybe_mp_process(backend: Backend) -> bool: parent_process = getattr( backend._multiprocessing, "parent_process", None ) # New in version 3.8. if parent_process: return parent_process() is not None process = backend._multiprocessing.current_process() if process.name == "MainPro...
python
wandb/sdk/wandb_init.py
70
81
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,039
_handle_launch_config
def _handle_launch_config(settings: "Settings") -> Dict[str, Any]: launch_run_config: Dict[str, Any] = {} if not settings.launch: return launch_run_config if os.environ.get("WANDB_CONFIG") is not None: try: launch_run_config = json.loads(os.environ.get("WANDB_CONFIG", "{}")) ...
python
wandb/sdk/wandb_init.py
84
97
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,040
__init__
def __init__(self) -> None: self.kwargs = None self.settings: Optional[Settings] = None self.sweep_config: Dict[str, Any] = {} self.launch_config: Dict[str, Any] = {} self.config: Dict[str, Any] = {} self.run: Optional[Run] = None self.backend: Optional[Backend] =...
python
wandb/sdk/wandb_init.py
103
120
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,041
_setup_printer
def _setup_printer(self, settings: Settings) -> None: if self.printer: return self.printer = get_printer(settings._jupyter)
python
wandb/sdk/wandb_init.py
122
125
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,042
setup
def setup(self, kwargs: Any) -> None: # noqa: C901 """Complete setup for `wandb.init()`. This includes parsing all arguments, applying them with settings and enabling logging. """ self.kwargs = kwargs # if the user ran, for example, `wandb.login(`) before `wandb.init()`, ...
python
wandb/sdk/wandb_init.py
127
327
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,043
teardown
def teardown(self) -> None: # TODO: currently this is only called on failed wandb.init attempts # normally this happens on the run object assert logger logger.info("tearing down wandb.init") for hook in self._teardown_hooks: hook.call()
python
wandb/sdk/wandb_init.py
329
335
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,044
_split_artifacts_from_config
def _split_artifacts_from_config( self, config_source: dict, config_target: dict ) -> None: for k, v in config_source.items(): if _is_artifact_representation(v): self.init_artifact_config[k] = v else: config_target.setdefault(k, v)
python
wandb/sdk/wandb_init.py
337
344
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,045
_enable_logging
def _enable_logging(self, log_fname: str, run_id: Optional[str] = None) -> None: """Enable logging to the global debug log. This adds a run_id to the log, in case of multiple processes on the same machine. Currently, there is no way to disable logging after it's enabled. """ han...
python
wandb/sdk/wandb_init.py
346
384
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,046
filter
def filter(self, record: logging.LogRecord) -> bool: record.run_id = run_id return True
python
wandb/sdk/wandb_init.py
356
358
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,047
_safe_symlink
def _safe_symlink( self, base: str, target: str, name: str, delete: bool = False ) -> None: # TODO(jhr): do this with relpaths, but i cant figure it out on no sleep if not hasattr(os, "symlink"): return pid = os.getpid() tmp_name = os.path.join(base, "%s.%d" % (n...
python
wandb/sdk/wandb_init.py
386
406
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,048
_pause_backend
def _pause_backend(self) -> None: if self.backend is None: return None # Attempt to save the code on every execution if self.notebook.save_ipynb(): # type: ignore assert self.run is not None res = self.run.log_code(root=None) logger.info("saved c...
python
wandb/sdk/wandb_init.py
408
419
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,049
_resume_backend
def _resume_backend(self) -> None: if self.backend is not None and self.backend.interface is not None: logger.info("resuming backend") # type: ignore self.backend.interface.publish_resume()
python
wandb/sdk/wandb_init.py
421
424
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,050
_jupyter_teardown
def _jupyter_teardown(self) -> None: """Teardown hooks and display saving, called with wandb.finish.""" assert self.notebook ipython = self.notebook.shell self.notebook.save_history() if self.notebook.save_ipynb(): assert self.run is not None res = self.ru...
python
wandb/sdk/wandb_init.py
426
444
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,051
_jupyter_setup
def _jupyter_setup(self, settings: Settings) -> None: """Add hooks, and session history saving.""" self.notebook = wandb.jupyter.Notebook(settings) ipython = self.notebook.shell # Monkey patch ipython publish to capture displayed outputs if not hasattr(ipython.display_pub, "_ori...
python
wandb/sdk/wandb_init.py
446
470
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,052
publish
def publish(data, metadata=None, **kwargs) -> None: # type: ignore ipython.display_pub._orig_publish(data, metadata=metadata, **kwargs) assert self.notebook is not None self.notebook.save_display( ipython.execution_count, {"data": data, "metadata": metadata} ...
python
wandb/sdk/wandb_init.py
463
468
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,053
_log_setup
def _log_setup(self, settings: Settings) -> None: """Set up logging from settings.""" filesystem.mkdir_exists_ok(os.path.dirname(settings.log_user)) filesystem.mkdir_exists_ok(os.path.dirname(settings.log_internal)) filesystem.mkdir_exists_ok(os.path.dirname(settings.sync_file)) ...
python
wandb/sdk/wandb_init.py
472
508
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,054
_make_run_disabled
def _make_run_disabled(self) -> RunDisabled: drun = RunDisabled() drun.config = wandb.wandb_sdk.wandb_config.Config() drun.config.update(self.sweep_config) drun.config.update(self.config) drun.summary = SummaryDisabled() drun.log = lambda data, *_, **__: drun.summary.upda...
python
wandb/sdk/wandb_init.py
510
536
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,055
_on_progress_init
def _on_progress_init(self, handle: MailboxProgress) -> None: assert self.printer line = "Waiting for wandb.init()...\r" percent_done = handle.percent_done self.printer.progress_update(line, percent_done=percent_done)
python
wandb/sdk/wandb_init.py
538
542
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,056
init
def init(self) -> Union[Run, RunDisabled, None]: # noqa: C901 if logger is None: raise RuntimeError("Logger not initialized") logger.info("calling init triggers") trigger.call("on_init", **self.kwargs) # type: ignore assert self.settings is not None assert self._wl...
python
wandb/sdk/wandb_init.py
544
825
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,057
getcaller
def getcaller() -> None: if not logger: return None src, line, func, stack = logger.findCaller(stack_info=True) print("Problem at:", src, line, func)
python
wandb/sdk/wandb_init.py
828
832
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,058
_attach
def _attach( attach_id: Optional[str] = None, run_id: Optional[str] = None, *, run: Optional["Run"] = None, ) -> Union[Run, RunDisabled, None]: """Attach to a run currently executing in another process/thread. Arguments: attach_id: (str, optional) The id of the run or an attach identifi...
python
wandb/sdk/wandb_init.py
835
910
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,059
init
def init( job_type: Optional[str] = None, dir: Union[str, pathlib.Path, None] = None, config: Union[Dict, str, None] = None, project: Optional[str] = None, entity: Optional[str] = None, reinit: Optional[bool] = None, tags: Optional[Sequence] = None, group: Optional[str] = None, name:...
python
wandb/sdk/wandb_init.py
913
1,184
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,060
parse_config
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_from_config_file(params, must_exist=True) params = _to_dict(params) if include: ...
python
wandb/sdk/wandb_helper.py
9
19
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,061
_to_dict
def _to_dict(params): if isinstance(params, dict): return params # Handle some cases where params is not a dictionary # by trying to convert it into a dictionary meta = inspect.getmodule(params) if meta: is_tf_flags_module = ( isinstance(params, types.ModuleType) ...
python
wandb/sdk/wandb_helper.py
22
54
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,062
get_args
def get_args(obj: Any) -> Optional[Any]: return obj.__args__ if hasattr(obj, "__args__") else None
python
wandb/sdk/wandb_settings.py
55
56
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,063
get_origin
def get_origin(obj: Any) -> Optional[Any]: return obj.__origin__ if hasattr(obj, "__origin__") else None
python
wandb/sdk/wandb_settings.py
58
59
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,064
get_type_hints
def get_type_hints(obj: Any) -> Dict[str, Any]: return dict(obj.__annotations__) if hasattr(obj, "__annotations__") else dict()
python
wandb/sdk/wandb_settings.py
61
62
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,065
_get_wandb_dir
def _get_wandb_dir(root_dir: str) -> str: """Get the full path to the wandb directory. The setting exposed to users as `dir=` or `WANDB_DIR` is the `root_dir`. We add the `__stage_dir__` to it to get the full `wandb_dir` """ # We use the hidden version if it already exists, otherwise non-hidden. ...
python
wandb/sdk/wandb_settings.py
65
85
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,066
_str_as_bool
def _str_as_bool(val: Union[str, bool]) -> bool: """Parse a string as a bool.""" if isinstance(val, bool): return val try: ret_val = bool(strtobool(str(val))) return ret_val except (AttributeError, ValueError): pass # todo: remove this and only raise error once we ar...
python
wandb/sdk/wandb_settings.py
89
104
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,067
_str_as_dict
def _str_as_dict(val: Union[str, Dict[str, Any]]) -> Dict[str, Any]: """Parse a string as a dict.""" if isinstance(val, dict): return val try: return dict(json.loads(val)) except (AttributeError, ValueError): pass # todo: remove this and only raise error once we are confiden...
python
wandb/sdk/wandb_settings.py
107
121
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,068
_str_as_tuple
def _str_as_tuple(val: Union[str, Sequence[str]]) -> Tuple[str, ...]: """Parse a (potentially comma-separated) string as a tuple.""" if isinstance(val, str): return tuple(val.split(",")) return tuple(val)
python
wandb/sdk/wandb_settings.py
124
128
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,069
_redact_dict
def _redact_dict( d: Dict[str, Any], unsafe_keys: Union[Set[str], FrozenSet[str]] = frozenset({"api_key"}), redact_str: str = "***REDACTED***", ) -> Dict[str, Any]: """Redact a dict of unsafe values specified by their key.""" if not d or unsafe_keys.isdisjoint(d): return d safe_dict = d....
python
wandb/sdk/wandb_settings.py
131
141
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,070
_get_program
def _get_program() -> Optional[str]: program = os.getenv(wandb.env.PROGRAM) if program is not None: return program try: import __main__ if __main__.__spec__ is None: return __main__.__file__ # likely run as `python -m ...` return f"-m {__main__.__spec__.n...
python
wandb/sdk/wandb_settings.py
144
156
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,071
_get_program_relpath_from_gitrepo
def _get_program_relpath_from_gitrepo( program: str, _logger: Optional[_EarlyLogger] = None ) -> Optional[str]: repo = GitRepo() root = repo.root if not root: root = os.getcwd() full_path_to_program = os.path.join( root, os.path.relpath(os.getcwd(), root), program ) if os.pat...
python
wandb/sdk/wandb_settings.py
159
179
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,072
__init__
def __init__( # pylint: disable=unused-argument self, name: str, value: Optional[Any] = None, preprocessor: Union[Callable, Sequence[Callable], None] = None, # validators allow programming by contract validator: Union[Callable, Sequence[Callable], None] = None, #...
python
wandb/sdk/wandb_settings.py
241
272
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,073
value
def value(self) -> Any: """Apply the runtime modifier(s) (if any) and return the value.""" _value = self._value if (_value is not None or self._auto_hook) and self._hook is not None: _hook = [self._hook] if callable(self._hook) else self._hook for h in _hook: ...
python
wandb/sdk/wandb_settings.py
275
282
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,074
is_policy
def is_policy(self) -> bool: return self._is_policy
python
wandb/sdk/wandb_settings.py
285
286
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,075
source
def source(self) -> int: return self._source
python
wandb/sdk/wandb_settings.py
289
290
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,076
_preprocess
def _preprocess(self, value: Any) -> Any: if value is not None and self._preprocessor is not None: _preprocessor = ( [self._preprocessor] if callable(self._preprocessor) else self._preprocessor ) for p in _preprocessor: ...
python
wandb/sdk/wandb_settings.py
292
310
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,077
_validate
def _validate(self, value: Any) -> Any: self.__failed_validation = False # todo: this is a temporary measure if value is not None and self._validator is not None: _validator = ( [self._validator] if callable(self._validator) else self._validator ) for...
python
wandb/sdk/wandb_settings.py
312
334
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,078
update
def update(self, value: Any, source: int = Source.OVERRIDE) -> None: """Update the value of the property.""" if self.__frozen: raise TypeError("Property object is frozen") # - always update value if source == Source.OVERRIDE # - if not previously overridden: # - upd...
python
wandb/sdk/wandb_settings.py
336
359
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,079
__setattr__
def __setattr__(self, key: str, value: Any) -> None: if "_Property__frozen" in self.__dict__ and self.__frozen: raise TypeError(f"Property object {self.name} is frozen") if key == "value": raise AttributeError("Use update() to update property value") self.__dict__[key] = ...
python
wandb/sdk/wandb_settings.py
361
366
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,080
__str__
def __str__(self) -> str: return f"{self.value!r}" if isinstance(self.value, str) else f"{self.value}"
python
wandb/sdk/wandb_settings.py
368
369
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,081
__repr__
def __repr__(self) -> str: return ( f"<Property {self.name}: value={self.value} " f"_value={self._value} source={self._source} is_policy={self._is_policy}>" ) # return f"<Property {self.name}: value={self.value}>" # return self.__dict__.__repr__()
python
wandb/sdk/wandb_settings.py
371
377
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,082
_default_props
def _default_props(self) -> Dict[str, Dict[str, Any]]: """Initialize instance attributes (individual settings) as Property objects. Helper method that is used in `__init__` together with the class attributes. Note that key names must be the same as the class attribute names. """ ...
python
wandb/sdk/wandb_settings.py
526
784
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,083
_validator_factory
def _validator_factory(hint: Any) -> Callable[[Any], bool]: """Return a factory for type validators. Given a type hint for a setting into a function that type checks the argument. """ origin, args = get_origin(hint), get_args(hint) def helper(x: Any) -> bool: if ori...
python
wandb/sdk/wandb_settings.py
788
807
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,084
helper
def helper(x: Any) -> bool: if origin is None: return isinstance(x, hint) elif origin is Union: return isinstance(x, args) if args is not None else True else: return ( isinstance(x, origin) and all(isinstance(y, args...
python
wandb/sdk/wandb_settings.py
795
805
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,085
_validate_mode
def _validate_mode(value: str) -> bool: choices: Set[str] = {"dryrun", "run", "offline", "online", "disabled"} if value not in choices: raise UsageError(f"Settings field `mode`: {value!r} not in {choices}") return True
python
wandb/sdk/wandb_settings.py
810
814
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,086
_validate_project
def _validate_project(value: Optional[str]) -> bool: invalid_chars_list = list("/\\#?%:") if value is not None: if len(value) > 128: raise UsageError( f"Invalid project name {value!r}: exceeded 128 characters" ) invalid_chars = ...
python
wandb/sdk/wandb_settings.py
817
831
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,087
_validate_start_method
def _validate_start_method(value: str) -> bool: available_methods = ["thread"] if hasattr(multiprocessing, "get_all_start_methods"): available_methods += multiprocessing.get_all_start_methods() if value not in available_methods: raise UsageError( f"Setting...
python
wandb/sdk/wandb_settings.py
834
842
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,088
_validate_console
def _validate_console(value: str) -> bool: # choices = {"auto", "redirect", "off", "file", "iowrap", "notebook"} choices: Set[str] = { "auto", "redirect", "off", "wrap", # internal console states "wrap_emu", "wrap_raw", ...
python
wandb/sdk/wandb_settings.py
845
860
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,089
_validate_problem
def _validate_problem(value: str) -> bool: choices: Set[str] = {"fatal", "warn", "silent"} if value not in choices: raise UsageError(f"Settings field `problem`: {value!r} not in {choices}") return True
python
wandb/sdk/wandb_settings.py
863
867
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,090
_validate_anonymous
def _validate_anonymous(value: str) -> bool: choices: Set[str] = {"allow", "must", "never", "false", "true"} if value not in choices: raise UsageError(f"Settings field `anonymous`: {value!r} not in {choices}") return True
python
wandb/sdk/wandb_settings.py
870
874
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,091
_validate_run_id
def _validate_run_id(value: str) -> bool: # if len(value) > len(value.strip()): # raise UsageError("Run ID cannot start or end with whitespace") return bool(value.strip())
python
wandb/sdk/wandb_settings.py
877
880
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,092
_validate_api_key
def _validate_api_key(value: str) -> bool: if len(value) > len(value.strip()): raise UsageError("API key cannot start or end with whitespace") # todo: move this check to the post-init validation step # if value.startswith("local") and not self.is_local: # raise UsageErro...
python
wandb/sdk/wandb_settings.py
883
894
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,093
_validate_base_url
def _validate_base_url(value: Optional[str]) -> bool: """Validate the base url of the wandb server. param value: URL to validate Based on the Django URLValidator, but with a few additional checks. Copyright (c) Django Software Foundation and individual contributors. All rights...
python
wandb/sdk/wandb_settings.py
897
996
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,094
_validate__service_wait
def _validate__service_wait(value: float) -> bool: if value <= 0: raise UsageError("_service_wait must be a positive number") return True
python
wandb/sdk/wandb_settings.py
999
1,002
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,095
_validate__stats_sample_rate_seconds
def _validate__stats_sample_rate_seconds(value: float) -> bool: if value < 0.1: raise UsageError("_stats_sample_rate_seconds must be >= 0.1") return True
python
wandb/sdk/wandb_settings.py
1,005
1,008
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,096
_validate__stats_samples_to_average
def _validate__stats_samples_to_average(value: int) -> bool: if value < 1 or value > 30: raise UsageError("_stats_samples_to_average must be between 1 and 30") return True
python
wandb/sdk/wandb_settings.py
1,011
1,014
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,097
_validate__async_upload_concurrency_limit
def _validate__async_upload_concurrency_limit(value: int) -> bool: if value <= 0: raise UsageError("_async_upload_concurrency_limit must be positive") try: import resource # not always available on Windows file_limit = resource.getrlimit(resource.RLIMIT_NOFILE)[0] ...
python
wandb/sdk/wandb_settings.py
1,017
1,043
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,098
_path_convert
def _path_convert(*args: str) -> str: """Join path and apply os.path.expanduser to it.""" return os.path.expanduser(os.path.join(*args))
python
wandb/sdk/wandb_settings.py
1,047
1,049
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,099
_convert_console
def _convert_console(self) -> SettingsConsole: convert_dict: Dict[str, SettingsConsole] = dict( off=SettingsConsole.OFF, wrap=SettingsConsole.WRAP, wrap_raw=SettingsConsole.WRAP_RAW, wrap_emu=SettingsConsole.WRAP_EMU, redirect=SettingsConsole.REDIRECT,...
python
wandb/sdk/wandb_settings.py
1,051
1,071
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,100
_get_url_query_string
def _get_url_query_string(self) -> str: # TODO(settings) use `wandb_setting` (if self.anonymous != "true":) if Api().settings().get("anonymous") != "true": return "" api_key = apikey.api_key(settings=self) return f"?{urlencode({'apiKey': api_key})}"
python
wandb/sdk/wandb_settings.py
1,073
1,080
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }