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 | lint | def lint(session: nox.Session) -> None:
"""
Run the linter.
"""
session.install("pre-commit")
session.run(
"pre-commit", "run", "--all-files", "--show-diff-on-failure", *session.posargs
) | python | noxfile.py | 17 | 24 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
2 | pylint | def pylint(session: nox.Session) -> None:
"""
Run PyLint.
"""
# This needs to be installed into the package environment, and is slower
# than a pre-commit check
session.install(".", "pylint")
session.run("pylint", "my_cool_package", *session.posargs) | python | noxfile.py | 28 | 35 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
3 | tests | def tests(session: nox.Session) -> None:
"""
Run the unit and regular tests.
"""
session.install(".[test]")
session.run("pytest", *session.posargs) | python | noxfile.py | 39 | 44 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
4 | docs | def docs(session: nox.Session) -> None:
"""
Build the docs. Pass "--serve" to serve. Pass "-b linkcheck" to check links.
"""
parser = argparse.ArgumentParser()
parser.add_argument("--serve", action="store_true", help="Serve after building")
parser.add_argument(
"-b", dest="builder", def... | python | noxfile.py | 48 | 86 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
5 | build_api_docs | def build_api_docs(session: nox.Session) -> None:
"""
Build (regenerate) API docs.
"""
session.install("sphinx")
session.chdir("docs")
session.run(
"sphinx-apidoc",
"-o",
"api/",
"--module-first",
"--no-toc",
"--force",
"../src/my_cool_pac... | python | noxfile.py | 90 | 105 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
6 | build | def build(session: nox.Session) -> None:
"""
Build an SDist and wheel.
"""
build_path = DIR.joinpath("build")
if build_path.exists():
shutil.rmtree(build_path)
session.install("build")
session.run("python", "-m", "build") | python | noxfile.py | 109 | 119 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
7 | random | def random(
cls,
num_particles: int,
num_dimensions: int,
mass_mean: float,
mass_width: float,
x_width: float,
p_width: float,
rng: None | np.random.Generator = None,
) -> System:
"""
Generate a system of gravitating particles randomly.... | python | src/my_cool_package/orbitty.py | 51 | 86 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
8 | __init__ | def __init__(self, m: npt.ArrayLike, x: npt.ArrayLike, p: npt.ArrayLike):
"""
Initialize a system of gravitating particles with explicit values.
Args:
m (npt.ArrayLike): Ordered collection of masses (1-dimensional).
x (npt.ArrayLike): Collection of positions in the same ... | python | src/my_cool_package/orbitty.py | 88 | 133 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
9 | __init__ | def __init__(
self,
t: float,
x: np.ndarray[tuple[int, int], FloatingPoint],
p: np.ndarray[tuple[int, int], FloatingPoint],
):
self.t, self.x, self.p = t, x, p | python | src/my_cool_package/orbitty.py | 140 | 146 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
10 | __repr__ | def __repr__(self) -> str:
return f"<Step t={self.t} x={self.x.tolist()} p={self.p.tolist()}>" | python | src/my_cool_package/orbitty.py | 148 | 149 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
11 | __repr__ | def __repr__(self) -> str:
return f"<System of {self.num_particles} particles in {self.num_dimensions} dimensions>" | python | src/my_cool_package/orbitty.py | 151 | 152 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
12 | num_particles | def num_particles(self) -> int:
"""
The number of particles in the System.
"""
return self.x.shape[0] | python | src/my_cool_package/orbitty.py | 155 | 160 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
13 | num_dimensions | def num_dimensions(self) -> int:
"""
The number of dimensions in each position and momentum.
"""
return self.x.shape[1] # type: ignore[no-any-return] | python | src/my_cool_package/orbitty.py | 163 | 168 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
14 | forces | def forces(self) -> np.ndarray[tuple[int, int], FloatingPoint]:
"""
The total force, as a vector on each particle, due to gravitational
attraction to all other particles in the System.
This array has the same shape as ``x`` and ``p``.
"""
# indexes to pick out (particle... | python | src/my_cool_package/orbitty.py | 171 | 199 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
15 | step | def step(self, dt: float = 0.1) -> None:
"""
Simulate the System for one time-step.
Args:
dt (float): Time interval to simulate. The smaller this value is,
the more precise the simulation will be.
Uses a kick-drift-kick method to control numerical error. Con... | python | src/my_cool_package/orbitty.py | 201 | 223 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
16 | steps | def steps(self, n: int, dt: float = 0.01) -> None:
"""
Simulate the System for ``n`` time-steps.
Args:
n (int): Number of time-steps.
dt (float): Time interval to simulate. The smaller this value is,
the more precise the simulation will be.
This ... | python | src/my_cool_package/orbitty.py | 225 | 238 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
17 | t_history | def t_history(self) -> np.ndarray[tuple[int], FloatingPoint]:
"""
Get the history of time-steps as an array.
The 1 axis is
* time-steps
"""
return np.array([step.t for step in self.history]) | python | src/my_cool_package/orbitty.py | 241 | 250 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
18 | x_history | def x_history(self) -> np.ndarray[tuple[int, int, int], FloatingPoint]:
"""
Get the history of x positions as an array.
The 3 axes are
* time-steps
* particles
* dimensions
"""
x = np.empty((len(self.history), self.num_particles, 2))
for i, step... | python | src/my_cool_package/orbitty.py | 253 | 268 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
19 | p_history | def p_history(self) -> np.ndarray[tuple[int, int, int], FloatingPoint]:
"""
Get the history of p momenta as an array.
The 3 axes are
* time-steps
* particles
* dimensions
"""
p = np.empty((len(self.history), self.num_particles, 2))
for i, step i... | python | src/my_cool_package/orbitty.py | 271 | 286 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
20 | plot | def plot(
self,
figsize: tuple[int, int] = (5, 5),
method: Literal["to_jshtml", "to_html5_video"] = "to_jshtml",
num_frames: int = 100,
frame_ms: int = 50,
) -> Any:
"""
Present the time-evolution of the System as a Matplotlib animation.
Be sure to ca... | python | src/my_cool_package/orbitty.py | 288 | 345 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
21 | update | def update(i: int) -> list[Any]:
for j, line in enumerate(lines):
line.set_xdata(x[:i, j, 0])
line.set_ydata(x[:i, j, 1])
dots.set_offsets(x[i, :, :])
return [*lines, dots] | python | src/my_cool_package/orbitty.py | 332 | 337 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
22 | to_radians | def to_radians(θ: float) -> float:
"""
Convert θ from degrees into radians.
This is a scale transformation in which θ = 360° is returned as 2π.
"""
return θ * math.pi / 180 | python | src/my_cool_package/oldtrig.py | 6 | 13 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
23 | sine | def sine(θ: float) -> float:
"""
In a triangle with one right angle and another angle θ, the sine is the
length of the side opposite to θ divided by the length of the hypotenuse.
The word "sine" comes from
1. the Latin "sinus" ("bosom"),
2. a translation of Arabic "جَيْب" ("bosom"),
3. a m... | python | src/my_cool_package/oldtrig.py | 16 | 29 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
24 | cosine | def cosine(θ: float) -> float:
"""
In a triangle with one right angle and another angle θ, the sine is the
length of the side adjacent to θ divided by the length of the hypotenuse.
The word "cosine" comes from
1. the Latin "complementi sinus" (1620, Edmund Gunter's Canon Triangulorum)
and is ... | python | src/my_cool_package/oldtrig.py | 32 | 45 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
25 | versine | def versine(θ: float) -> float:
"""
Versed sine (as in "versus" or "against"), equal to 1 - cosine(θ).
Called "उत्क्रम-ज्या" in the Surya Siddhanta (5th century CE).
It was popular before computers because it is always non-negative, making
it easier to apply tables of logarithms.
"""
retu... | python | src/my_cool_package/oldtrig.py | 48 | 58 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
26 | coversine | def coversine(θ: float) -> float:
"""
Complement of the versed sine, equal to 1 + sine(θ).
"""
return 1 - math.sin(to_radians(θ)) | python | src/my_cool_package/oldtrig.py | 64 | 69 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
27 | vercosine | def vercosine(θ: float) -> float:
"""
Versed complement-sine, equal to 1 + cosine(θ).
"""
return 1 + math.cos(to_radians(θ)) | python | src/my_cool_package/oldtrig.py | 72 | 77 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
28 | covercosine | def covercosine(θ: float) -> float:
"""
Complement to the versed complement-sine, equal to 1 + sine(θ).
"""
return 1 + math.sin(to_radians(θ)) | python | src/my_cool_package/oldtrig.py | 80 | 85 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
29 | haversine | def haversine(θ: float) -> float:
"""
Half of the versed sine, equal to (1 - cosine(θ)) / 2.
"""
return (1 - math.cos(to_radians(θ))) / 2 | python | src/my_cool_package/oldtrig.py | 88 | 93 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
30 | hacoversine | def hacoversine(θ: float) -> float:
"""
Half of the complement of the versed sine, equal to (1 - sine(θ)) / 2.
"""
return (1 - math.sin(to_radians(θ))) / 2 | python | src/my_cool_package/oldtrig.py | 96 | 101 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
31 | havercosine | def havercosine(θ: float) -> float:
"""
Half of the versed complement-sine, equal to (1 + cosine(θ)) / 2.
"""
return (1 + math.cos(to_radians(θ))) / 2 | python | src/my_cool_package/oldtrig.py | 104 | 109 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
32 | hacovercosine | def hacovercosine(θ: float) -> float:
"""
Half of the complement to the versed complement-sine, equal to (1 + sine(θ)) / 2.
Sheesh!
"""
return (1 + math.sin(to_radians(θ))) / 2 | python | src/my_cool_package/oldtrig.py | 112 | 119 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
33 | exsecant | def exsecant(θ: float) -> float:
"""
External secant, equal to 1/cosine(θ) - 1.
Introduced in 1855 by American civil engineer Charles Haslett, used to design
circular sections of the Ohio and Mississippi railroad.
"Experience has shown, that versed sines and external secants as frequently
ente... | python | src/my_cool_package/oldtrig.py | 125 | 142 | {
"name": "jpivarski-talks/my-cool-package",
"url": "https://github.com/jpivarski-talks/my-cool-package.git",
"license": "BSD-3-Clause",
"stars": 2,
"forks": 1
} |
34 | __init__ | def __init__(
self,
name: str,
verbose: bool = False,
log_level: int = logging.INFO,
) -> None:
self.name = name
self.verbose = verbose
self.logger = logging.getLogger(name)
handler = logging.FileHandler(f"{name}.log")
handler.setFormatter(log... | python | tools/cloud-tool.py | 49 | 65 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
35 | print | def print(
self,
*args: Any,
sep: str = " ",
end: str = "\n",
file=None,
) -> None:
self.logger.info(sep.join(map(str, args)))
if self.verbose:
print(*args, sep=sep, end=end, file=file) | python | tools/cloud-tool.py | 67 | 76 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
36 | __init__ | def __init__(
self,
config: GKEConfig,
verbose: bool = False,
log_level: int = logging.INFO,
) -> None:
self.config = config
self.logger = Logger(__name__.lower(), verbose, log_level)
self.logger.print(f"Initialized {__name__} CLI")
self.logger.print(... | python | tools/cloud-tool.py | 87 | 99 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
37 | update_components | def update_components() -> None:
subprocess.run(["gcloud", "--quiet", "components", "update"]) | python | tools/cloud-tool.py | 102 | 103 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
38 | install_components | def install_components() -> None:
for component in ["gke-gcloud-auth-plugin", "kubectl"]:
subprocess.run(["gcloud", "--quiet", "components", "install", component]) | python | tools/cloud-tool.py | 106 | 108 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
39 | create_cluster | def create_cluster(self) -> None:
subprocess.run(
[
"gcloud",
"container",
"clusters",
"create",
self.config.cluster_name,
"--num-nodes",
str(self.config.num_nodes),
"--mac... | python | tools/cloud-tool.py | 110 | 129 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
40 | get_cluster_credentials | def get_cluster_credentials(self) -> None:
subprocess.run(
[
"gcloud",
"container",
"clusters",
"get-credentials",
self.config.cluster_name,
]
) | python | tools/cloud-tool.py | 131 | 140 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
41 | delete_cluster | def delete_cluster(self) -> None:
subprocess.run(
["gcloud", "container", "clusters", "delete", self.config.cluster_name]
) | python | tools/cloud-tool.py | 142 | 145 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
42 | __init__ | def __init__(
self,
config: GCEConfig,
verbose: bool = False,
log_level: int = logging.INFO,
) -> None:
self.config = config
self.logger = Logger(__name__.lower(), verbose, log_level)
self.logger.print(f"Initialized {__name__} CLI")
self.logger.print(... | python | tools/cloud-tool.py | 149 | 161 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
43 | update_components | def update_components() -> None:
subprocess.run(["gcloud", "--quiet", "components", "update"]) | python | tools/cloud-tool.py | 164 | 165 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
44 | create_vm | def create_vm(self) -> int:
"""Create the VM.
- The first command creates a VM similar to the one
the user can get from the GCP marketplace.
- There is apparently no way to "interact" with the
GCP marketplace directly.
- The VMI explicitly asks to install GPU dri... | python | tools/cloud-tool.py | 167 | 243 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
45 | run | def run(self) -> int:
"""Run the VM.
:return:
"""
cmd = [
"gcloud",
"compute",
"ssh",
self.config.instance_name,
"--command",
"sudo apt update; "
"sudo apt install -y python3-pip; "
"pip3 ins... | python | tools/cloud-tool.py | 245 | 266 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
46 | delete_vm | def delete_vm(self) -> int:
"""Delete the VM.
:return:
"""
p = subprocess.run(
[
"gcloud",
"compute",
"instances",
"delete",
self.config.instance_name,
"--quiet",
]
... | python | tools/cloud-tool.py | 268 | 283 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
47 | __init__ | def __init__(self) -> None:
self._items: List[SequenceItem] = []
self._uuid_messages = dict() | python | tools/tracelog-tool.py | 29 | 31 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
48 | _parse | def _parse(self, line: str) -> None:
line = line.strip()
index = line.find("TRACELOG(")
if index < 0:
return
line = line[index:]
items = line.split()
if len(items) != 10:
return
# ['TRACELOG(1)', '<-', '185542.522061', 'fd1e0e9f4d3f3520', '... | python | tools/tracelog-tool.py | 33 | 64 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
49 | add | def add(self, item: SequenceItem):
self._items.append(item) | python | tools/tracelog-tool.py | 66 | 67 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
50 | output_plantuml | def output_plantuml(self) -> None:
lines = []
for item in self._items:
line = f"{item.src} --> {item.dst}: {item.info}"
lines.append((item.ts, line))
print("@startuml")
header = """
!theme crt-amber
skinparam responseMessageBelowArrow true
box "User Process"
parti... | python | tools/tracelog-tool.py | 69 | 101 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
51 | output_mermaid | def output_mermaid(self) -> None:
lines = []
for item in self._items:
line = f"{item.src} ->> {item.dst}: {item.info}"
lines.append((item.ts, line))
header = """
sequenceDiagram
participant MainThread as User
participant MsgRouterThr as router
participant ChkStopThr as c... | python | tools/tracelog-tool.py | 103 | 129 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
52 | load | def load(self, fname: str) -> None:
with open(fname) as f:
for line in f.readlines():
self._parse(line) | python | tools/tracelog-tool.py | 131 | 134 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
53 | loaddir | def loaddir(self, dname: str) -> None:
flist = []
for p in pathlib.Path(dname).iterdir():
if not p.is_file():
continue
flist.append(p)
for f in flist:
self.load(f) | python | tools/tracelog-tool.py | 136 | 144 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
54 | main | def main():
argparser = argparse.ArgumentParser()
argparser.add_argument("--logdir", default="wandb/latest-run/logs/")
argparser.add_argument("--format", default="mermaid")
args = argparser.parse_args()
parser = TracelogParser()
parser.loaddir(args.logdir)
if args.format == "plantuml":
... | python | tools/tracelog-tool.py | 147 | 161 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
55 | get_available_protobuf_versions | def get_available_protobuf_versions() -> List[str]:
"""Get a list of available protobuf versions."""
try:
output = subprocess.check_output(
["pip", "index", "versions", "protobuf"],
).decode("utf-8")
versions = list({o for o in output.split() if o[0].isnumeric()})
ver... | python | tools/check-protobuf-version-compatibility.py | 11 | 21 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
56 | parse_protobuf_requirements | def parse_protobuf_requirements() -> List[Tuple[str, str]]:
"""Parse protobuf requirements from a requirements.txt file."""
path_requirements = pathlib.Path(__file__).parent.parent / "requirements.txt"
with open(path_requirements) as f:
requirements = f.readlines()
system_python_version = f"{sy... | python | tools/check-protobuf-version-compatibility.py | 24 | 91 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
57 | get_matching_versions | def get_matching_versions(
available_protobuf_vs: List[str], protobuf_reqs: List[Tuple[str, str]]
) -> List[str]:
matching_vs = []
for v in available_protobuf_vs:
if all(
eval(f"parse_version({v!r}) {rq[0]} parse_version({rq[1]!r})")
for rq in protobuf_reqs
):
... | python | tools/check-protobuf-version-compatibility.py | 94 | 105 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
58 | attempt_install_protobuf_version | def attempt_install_protobuf_version(version: str) -> bool:
try:
subprocess.check_call(["pip", "install", f"protobuf=={version}"])
subprocess.check_call(["python", "-c", "import wandb"])
return True
except subprocess.CalledProcessError:
return False | python | tools/check-protobuf-version-compatibility.py | 108 | 114 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
59 | run_in_env | def run_in_env(command, python_version=None):
"""Run a command in a pyenv environment."""
if python_version:
command = f'eval "$(pyenv init -)"; (pyenv shell {python_version}; {command})'
return subprocess.check_output(command, shell=True).decode("utf-8") | python | tools/setup_dev_environment.py | 32 | 36 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
60 | installed_versions | def installed_versions(python_version):
"""List of installed package/versions."""
list_cmd = "pip list --format=freeze --disable-pip-version-check"
return run_in_env(list_cmd, python_version=python_version).split() | python | tools/setup_dev_environment.py | 39 | 42 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
61 | pin_version | def pin_version(package_name, package_version, python_version=None):
versioned_package = f"{package_name}=={package_version}"
if versioned_package in installed_versions(python_version):
return
print(f"Installing {versioned_package}", end=" ")
if python_version:
print(f"for Python {python... | python | tools/setup_dev_environment.py | 45 | 54 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
62 | main | def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"-p",
"--python-versions",
nargs="+",
help="Python versions to use with pyenv.",
)
args = parser.parse_args()
python_versions = args.python_versions
if python_versions is None:
python_ve... | python | tools/setup_dev_environment.py | 57 | 168 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
63 | parse_args | def parse_args():
"""Parse command line arguments."""
parser = argparse.ArgumentParser()
parser.add_argument(
"--push",
action="store_true",
help="Push image after creation. This requires that you enter a tag that includes a registry via --tag",
)
parser.add_argument("--tag",... | python | tools/build_launch_agent.py | 36 | 45 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
64 | main | def main():
"""Build the launch agent image."""
args = parse_args()
build_context = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
dockerfile_path = os.path.join(build_context, "Dockerfile")
dockerignore_path = os.path.join(build_context, ".dockerignore")
with open(dockerfile_path, ... | python | tools/build_launch_agent.py | 48 | 69 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
65 | version_problem | def version_problem(current_version):
print(f"Unhandled version string: {current_version}")
sys.exit(1) | python | tools/bumpversion-tool.py | 16 | 18 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
66 | bump_release_to_dev | def bump_release_to_dev(current_version):
# Assume this is a released version
parts = current_version.split(".")
if len(parts) != 3:
version_problem(current_version)
major, minor, patch = parts
patch_num = 0
try:
patch_num = int(patch)
except ValueError:
version_prob... | python | tools/bumpversion-tool.py | 21 | 39 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
67 | bump_release_from_dev | def bump_release_from_dev(current_version):
# Assume this is a dev version
parts = current_version.split(".")
if len(parts) != 4:
version_problem(current_version)
major, minor, patch, _ = parts
new_version = f"{major}.{minor}.{patch}"
bump_args = []
if args.debug:
bump_args ... | python | tools/bumpversion-tool.py | 42 | 54 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
68 | main | def main():
config = configparser.ConfigParser()
config.read("setup.cfg")
current_version = config["bumpversion"]["current_version"]
if args.to_dev:
bump_release_to_dev(current_version)
elif args.from_dev:
bump_release_from_dev(current_version)
else:
parser.print_help() | python | tools/bumpversion-tool.py | 57 | 67 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
69 | poll | def poll(args, pipeline_id=None, workflow_ids=None):
print(f"Waiting for pipeline to complete (Branch: {args.branch})...")
while True:
num = 0
done = 0
if pipeline_id:
url = f"https://circleci.com/api/v2/pipeline/{pipeline_id}/workflow"
r = requests.get(url, auth=... | python | tools/circleci-tool.py | 74 | 99 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
70 | trigger | def trigger(args):
url = "https://circleci.com/api/v2/project/gh/wandb/wandb/pipeline"
payload = {
"branch": args.branch,
}
manual: bool = any(
[args.platform, args.toxenv, args.test_file, args.test_name, args.test_repeat]
)
if manual:
parameters = {"manual": True}
... | python | tools/circleci-tool.py | 102 | 162 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
71 | trigger_nightly | def trigger_nightly(args):
url = "https://circleci.com/api/v2/project/gh/wandb/wandb/pipeline"
default_shards = set(NIGHTLY_SHARDS)
shards = {
f"nightly_execute_{shard.replace('-', '_')}": False for shard in default_shards
}
requested_shards = set(args.shards.split(",")) if args.shards els... | python | tools/circleci-tool.py | 165 | 210 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
72 | get_ci_builds | def get_ci_builds(args, completed=True):
bname = args.branch
# TODO: extend pagination if not done
url = "https://circleci.com/api/v1.1/project/gh/wandb/wandb?shallow=true&limit=100"
if completed:
url = url + "&filter=completed"
# print("SEND", url)
r = requests.get(url, auth=(args.api_t... | python | tools/circleci-tool.py | 213 | 242 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
73 | grab | def grab(args, vhash, bnum):
# curl -H "Circle-Token: $CIRCLECI_TOKEN" https://circleci.com/api/v1.1/project/github/wandb/wandb/61238/artifacts
# curl -L -o out.dat -H "Circle-Token: $CIRCLECI_TOKEN" https://61238-86031674-gh.circle-artifacts.com/0/cover-results/.coverage
cachedir = ".circle_cache"
cfb... | python | tools/circleci-tool.py | 245 | 278 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
74 | status | def status(args):
# TODO: check for current git hash only
got = get_ci_builds(args, completed=False)
if not got:
print("ERROR: couldn't find job, maybe we should poll?")
sys.exit(1)
work_ids = [workid for _, _, _, workid in got]
poll(args, workflow_ids=[work_ids[0]]) | python | tools/circleci-tool.py | 281 | 288 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
75 | download | def download(args):
print(f"Checking for circle artifacts (Branch: {args.branch})...")
got = get_ci_builds(args)
assert got
for v, n, _, _ in got:
grab(args, v, n) | python | tools/circleci-tool.py | 291 | 296 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
76 | process_args | def process_args():
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(
dest="action", title="action", description="Action to perform"
)
parser.add_argument("--api_token", help=argparse.SUPPRESS)
parser.add_argument("--branch", help="git branch (autodetected)")
parser... | python | tools/circleci-tool.py | 299 | 348 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
77 | process_environment | def process_environment(args):
api_token = os.environ.get(CIRCLECI_API_TOKEN)
assert api_token, f"Set environment variable: {CIRCLECI_API_TOKEN}"
args.api_token = api_token | python | tools/circleci-tool.py | 351 | 354 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
78 | process_workspace | def process_workspace(args):
branch = args.branch
if not branch:
code, branch = subprocess.getstatusoutput("git branch --show-current")
assert code == 0, "failed git command"
args.branch = branch | python | tools/circleci-tool.py | 357 | 362 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
79 | main | def main():
parser, args = process_args()
process_environment(args)
process_workspace(args)
if args.action == "trigger":
for i in range(args.loop or 1):
if args.loop:
print(f"Loop: {i + 1} of {args.loop}")
trigger(args)
elif args.action == "trigger-ni... | python | tools/circleci-tool.py | 365 | 383 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
80 | chunk | def chunk(n: int, iterable) -> Iterator[List[Dict]]:
done = False
while not done:
data = []
try:
for _ in range(n):
data.append(next(iterable))
except StopIteration:
if data:
yield data
# done = True
break
... | python | tools/wandb_export_history.py | 28 | 40 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
81 | wandb_export_history | def wandb_export_history(
*,
run,
api=None,
db_file=None,
db_table=None,
db_replace: bool = None,
history_exclude_prefix=None,
read_page_size=None,
write_page_size=None,
) -> int:
api = api or wandb.Api()
db_file = db_file or DB_FILE
db_table = db_table or "history"
h... | python | tools/wandb_export_history.py | 43 | 77 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
82 | main | def main() -> None:
parser = argparse.ArgumentParser(
description="Export W&B run history", allow_abbrev=False
)
parser.add_argument("--run", required=True)
parser.add_argument("--db_file", default=DB_FILE)
parser.add_argument("--db_table")
parser.add_argument("--history_exclude_prefix")... | python | tools/wandb_export_history.py | 80 | 103 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
83 | find_list_of_key_locations_and_dicts | def find_list_of_key_locations_and_dicts(data, search_key: str, root=None):
"""Search for a dict with key search_key and value containing search_v.
Returns:
# location - list of indexes representing where to find the key
# containing_dict - the dictionary where the search_key was found
Lis... | python | tools/coverage-tool.py | 19 | 51 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
84 | find_parallelism_defaults | def find_parallelism_defaults(loc_dict_tuple):
_, containing_dict = loc_dict_tuple
parallelism = containing_dict.get("parallelism")
if not isinstance(parallelism, dict):
return False
default = parallelism.get("default")
return isinstance(default, int) and default > 1 | python | tools/coverage-tool.py | 54 | 60 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
85 | matrix_expand | def matrix_expand(loc_dict_tuple_list):
ret = []
loc_dict_tuple_list = list(loc_dict_tuple_list)
for location, containing_dict in loc_dict_tuple_list:
matrix = containing_dict.get("matrix")
if matrix:
# assume any block referencing a matrix is using all parameters
# c... | python | tools/coverage-tool.py | 63 | 89 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
86 | create_parallelism_defaults_dict | def create_parallelism_defaults_dict(par_defaults_list):
ret = {}
for location, containing_dict in par_defaults_list:
assert len(location) == 3
jobs, job_name, parameters = location
assert jobs == "jobs"
assert parameters == "parameters"
default = containing_dict["paralle... | python | tools/coverage-tool.py | 92 | 101 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
87 | parallelism_expand | def parallelism_expand(cov_list, par_dict):
ret = []
for location, containing_dict in cov_list:
parallelism = containing_dict.get("parallelism")
if parallelism:
count = parallelism
else:
# see if we can find counts in defaults
# look up by last element... | python | tools/coverage-tool.py | 104 | 121 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
88 | coverage_tasks | def coverage_tasks(args: argparse.Namespace):
ci_fname = args.circleci_yaml
with open(ci_fname) as file:
data = yaml.safe_load(file)
parallelism = find_list_of_key_locations_and_dicts(data, "parallelism")
parallelism_defaults = filter(find_parallelism_defaults, parallelism)
tox... | python | tools/coverage-tool.py | 124 | 143 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
89 | coverage_config_check | def coverage_config_check(jobs_count, args):
ci_fname = args.codecov_yaml
with open(ci_fname) as file:
data = yaml.safe_load(file)
num_builds_tuple_list = find_list_of_key_locations_and_dicts(
data, "after_n_builds"
)
for _, data in num_builds_tuple_list:
... | python | tools/coverage-tool.py | 146 | 158 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
90 | coverage_coveragerc_check | def coverage_coveragerc_check(toxenv_list, args):
py = "py"
cononical = "wandb/"
cov_fname = args.coveragerc
cf = configparser.ConfigParser()
cf.read(cov_fname)
paths = cf.get("paths", "canonicalsrc")
paths = paths.split()
toxenv_list = list(set(toxenv_list))
toxenv_list.sort()
... | python | tools/coverage-tool.py | 161 | 196 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
91 | process_args | def process_args():
parser = argparse.ArgumentParser()
parser.add_argument("--circleci-yaml", default=".circleci/config.yml")
parser.add_argument("--codecov-yaml", default=".codecov.yml")
parser.add_argument("--coveragerc", default=".coveragerc")
subparsers = parser.add_subparsers(
dest="ac... | python | tools/coverage-tool.py | 199 | 212 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
92 | main | def main():
parser, args = process_args()
if args.action == "jobs":
tasks = coverage_tasks(args)
max_key_len = max(len(t) for t, _ in tasks)
for k, v in tasks:
print(f"{k:{max_key_len}} {v}")
elif args.action == "check":
tasks = coverage_tasks(args)
# let... | python | tools/coverage-tool.py | 215 | 232 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
93 | write_csv | def write_csv(record: str, fields: List[Any]):
record_arg = f"output_{record}s"
fname = os.path.join(args.output_dir, getattr(args, record_arg))
print("Writing:", fname)
with open(fname, "w") as fp:
writer = csv.DictWriter(fp, fieldnames=[record, "key"], lineterminator="\n")
writer.write... | python | tools/telemetry-tool.py | 37 | 48 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
94 | main | def main():
telemetry_records = list(tpb.TelemetryRecord.DESCRIPTOR.fields)
write_csv(record="telemetry_record_type", fields=telemetry_records)
import_records = list(tpb.Imports.DESCRIPTOR.fields)
write_csv(record="import", fields=import_records)
feature_records = list(tpb.Feature.DESCRIPTOR.field... | python | tools/telemetry-tool.py | 51 | 71 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
95 | get_paths | def get_paths() -> List[Path]:
paths: List[Path] = []
if not args.files:
exclude_dirs = {"vendor", "__pycache__"}
root_dir = pathlib.Path(__file__).resolve().parent.parent / "wandb"
for base, subdirs, files in os.walk(root_dir):
# Don't walk into excluded subdirectories
... | python | tools/generate-tool.py | 43 | 56 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
96 | generate_file | def generate_file(generate_path: Path, output_path: Path) -> None:
status, output = subprocess.getstatusoutput(f"python {generate_path}")
assert status == 0, f"Error: {output}"
with open(output_path, "w") as f:
f.write("# DO NOT EDIT -- GENERATED BY: `generate-tool.py --generate`")
f.write(o... | python | tools/generate-tool.py | 59 | 64 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
97 | generate_files | def generate_files(paths: List[Path]) -> None:
for p in paths:
output_path = p.parent / str(p).replace(GENERATE_SUFFIX, GENERATED_SUFFIX)
print(f"INFO: Generating {output_path}...")
generate_file(p, output_path) | python | tools/generate-tool.py | 67 | 71 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
98 | format_file | def format_file(filename: Path) -> None:
status, output = subprocess.getstatusoutput(f"black {filename}")
assert status == 0, f"Error: {output}" | python | tools/generate-tool.py | 74 | 76 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
99 | format_files | def format_files(paths: List[Path]) -> None:
for p in paths:
output_path = p.parent / str(p).replace(GENERATE_SUFFIX, GENERATED_SUFFIX)
print(f"INFO: Formatting {output_path}...")
format_file(output_path) | python | tools/generate-tool.py | 79 | 83 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
100 | temp_fname | def temp_fname() -> Iterator[Path]:
try:
f = tempfile.NamedTemporaryFile(delete=False)
tmp_name = f.name
f.close()
yield pathlib.Path(tmp_name)
finally:
os.unlink(tmp_name) | python | tools/generate-tool.py | 87 | 94 | {
"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.