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 |
|---|---|---|---|---|---|---|---|
7,901 | _reject | def _reject(self, reason):
# type: (Exception) -> None
assert not self.is_resolved
self._values = None
self.promise._reject_callback(reason, False) | python | wandb/vendor/promise-2.3.0/wandb_promise/promise_list.py | 147 | 151 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,902 | __init__ | def __init__(self, trampoline_enabled=True):
self.is_tick_used = False
self.late_queue = deque() # type: ignore
self.normal_queue = deque() # type: ignore
self.have_drained_queues = False
self.trampoline_enabled = trampoline_enabled | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 11 | 16 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,903 | enable_trampoline | def enable_trampoline(self):
self.trampoline_enabled = True | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 18 | 19 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,904 | disable_trampoline | def disable_trampoline(self):
self.trampoline_enabled = False | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 21 | 22 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,905 | have_items_queued | def have_items_queued(self):
return self.is_tick_used or self.have_drained_queues | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 24 | 25 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,906 | _async_invoke_later | def _async_invoke_later(self, fn, scheduler):
self.late_queue.append(fn)
self.queue_tick(scheduler) | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 27 | 29 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,907 | _async_invoke | def _async_invoke(self, fn, scheduler):
# type: (Callable, Any) -> None
self.normal_queue.append(fn)
self.queue_tick(scheduler) | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 31 | 34 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,908 | _async_settle_promise | def _async_settle_promise(self, promise):
# type: (Promise) -> None
self.normal_queue.append(promise)
self.queue_tick(promise.scheduler) | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 36 | 39 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,909 | invoke_later | def invoke_later(self, fn):
if self.trampoline_enabled:
self._async_invoke_later(fn, scheduler)
else:
scheduler.call_later(0.1, fn) | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 41 | 45 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,910 | invoke | def invoke(self, fn, scheduler):
# type: (Callable, Any) -> None
if self.trampoline_enabled:
self._async_invoke(fn, scheduler)
else:
scheduler.call(fn) | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 47 | 52 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,911 | settle_promises | def settle_promises(self, promise):
# type: (Promise) -> None
if self.trampoline_enabled:
self._async_settle_promise(promise)
else:
promise.scheduler.call(promise._settle_promises) | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 54 | 59 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,912 | throw_later | def throw_later(self, reason, scheduler):
# type: (Exception, Any) -> None
def fn():
# type: () -> None
raise reason
scheduler.call(fn) | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 61 | 67 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,913 | fn | def fn():
# type: () -> None
raise reason | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 63 | 65 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,914 | drain_queue | def drain_queue(self, queue):
# type: (deque) -> None
from .promise import Promise
while queue:
fn = queue.popleft()
if isinstance(fn, Promise):
fn._settle_promises()
continue
fn() | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 71 | 80 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,915 | drain_queue_until_resolved | def drain_queue_until_resolved(self, promise):
# type: (Promise) -> None
from .promise import Promise
queue = self.normal_queue
while queue:
if not promise.is_pending:
return
fn = queue.popleft()
if isinstance(fn, Promise):
... | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 82 | 98 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,916 | wait | def wait(self, promise, timeout=None):
# type: (Promise, Optional[float]) -> None
if not promise.is_pending:
# We return if the promise is already
# fulfilled or rejected
return
target = promise._target()
if self.trampoline_enabled:
if se... | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 100 | 117 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,917 | drain_queues | def drain_queues(self):
# type: () -> None
assert self.is_tick_used
self.drain_queue(self.normal_queue)
self.reset()
self.have_drained_queues = True
self.drain_queue(self.late_queue) | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 119 | 125 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,918 | queue_tick | def queue_tick(self, scheduler):
# type: (Any) -> None
if not self.is_tick_used:
self.is_tick_used = True
scheduler.call(self.drain_queues) | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 127 | 131 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,919 | reset | def reset(self):
# type: () -> None
self.is_tick_used = False | python | wandb/vendor/promise-2.3.0/wandb_promise/async_.py | 133 | 135 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,920 | get_chunks | def get_chunks(iterable_obj, chunk_size=1):
# type: (List[Loader], int) -> Iterator
chunk_size = max(1, chunk_size)
return (
iterable_obj[i : i + chunk_size]
for i in range(0, len(iterable_obj), chunk_size)
) | python | wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py | 25 | 31 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,921 | __init__ | def __init__(
self,
batch_load_fn=None, # type: Callable
batch=None, # type: Optional[Any]
max_batch_size=None, # type: Optional[int]
cache=None, # type: Optional[Any]
get_cache_key=None, # type: Optional[Any]
cache_map=None, # type: Optional[Any]
sc... | python | wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py | 43 | 78 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,922 | load | def load(self, key=None):
# type: (Hashable) -> Promise
"""
Loads a key, returning a `Promise` for the value represented by that key.
"""
if key is None:
raise TypeError(
(
"The loader.load() function must be called with a value,"
... | python | wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py | 80 | 109 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,923 | do_resolve_reject | def do_resolve_reject(self, key, resolve, reject):
# type: (Hashable, Callable, Callable) -> None
# Enqueue this Promise to be dispatched.
self._queue.append(Loader(key=key, resolve=resolve, reject=reject))
# Determine if a dispatch of this queue should be scheduled.
# A single d... | python | wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py | 111 | 124 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,924 | load_many | def load_many(self, keys):
# type: (Iterable[Hashable]) -> Promise
"""
Loads multiple keys, promising an array of values
>>> a, b = await my_loader.load_many([ 'a', 'b' ])
This is equivalent to the more verbose:
>>> a, b = await Promise.all([
>>> my_loader.l... | python | wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py | 126 | 148 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,925 | clear | def clear(self, key):
# type: (Hashable) -> DataLoader
"""
Clears the value at `key` from the cache, if it exists. Returns itself for
method chaining.
"""
cache_key = self.get_cache_key(key)
self._promise_cache.pop(cache_key, None)
return self | python | wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py | 150 | 158 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,926 | clear_all | def clear_all(self):
# type: () -> DataLoader
"""
Clears the entire cache. To be used when some event results in unknown
invalidations across this particular `DataLoader`. Returns itself for
method chaining.
"""
self._promise_cache.clear()
return self | python | wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py | 160 | 168 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,927 | prime | def prime(self, key, value):
# type: (Hashable, Any) -> DataLoader
"""
Adds the provied key and value to the cache. If the key already exists, no
change is made. Returns itself for method chaining.
"""
cache_key = self.get_cache_key(key)
# Only add the key if it ... | python | wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py | 170 | 189 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,928 | enqueue_post_promise_job | def enqueue_post_promise_job(fn, scheduler):
# type: (Callable, Any) -> None
global cache
if not hasattr(cache, 'resolved_promise'):
cache.resolved_promise = Promise.resolve(None)
if not scheduler:
scheduler = get_default_scheduler()
def on_promise_resolve(v):
# type: (Any) ... | python | wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py | 217 | 229 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,929 | on_promise_resolve | def on_promise_resolve(v):
# type: (Any) -> None
async_instance.invoke(fn, scheduler) | python | wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py | 225 | 227 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,930 | dispatch_queue | def dispatch_queue(loader):
# type: (DataLoader) -> None
"""
Given the current state of a Loader instance, perform a batch load
from its current queue.
"""
# Take the current loader queue, replacing it with an empty queue.
queue = loader._queue
loader._queue = []
# If a maxBatchSize... | python | wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py | 232 | 251 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,931 | dispatch_queue_batch | def dispatch_queue_batch(loader, queue):
# type: (DataLoader, List[Loader]) -> None
# Collect all keys to be loaded in this dispatch
keys = [l.key for l in queue]
# Call the provided batch_load_fn for this loader with the loader queue's keys.
try:
batch_promise = loader.batch_load_fn(keys)
... | python | wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py | 254 | 315 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,932 | batch_promise_resolved | def batch_promise_resolved(values):
# type: (Sized) -> None
# Assert the expected resolution from batchLoadFn.
if not isinstance(values, Iterable):
raise TypeError(
(
"DataLoader must be constructed with a function which accepts "
... | python | wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py | 281 | 311 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,933 | failed_dispatch | def failed_dispatch(loader, queue, error):
# type: (DataLoader, Iterable[Loader], Exception) -> None
"""
Do not cache individual loads if the entire batch dispatch fails,
but still reject each request so they do not hang.
"""
for l in queue:
loader.clear(l.key)
l.reject(error) | python | wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py | 318 | 326 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,934 | iterate_promise | def iterate_promise(promise):
# type: (Promise) -> Iterator
if not promise.is_fulfilled:
yield from promise.future # type: ignore
assert promise.is_fulfilled
return promise.get() | python | wandb/vendor/promise-2.3.0/wandb_promise/iterate_promise.py | 7 | 12 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,935 | get_version | def get_version(version=None):
"Returns a PEP 440-compliant version number from VERSION."
version = get_complete_version(version)
# Now build the two parts of the version number:
# main = X.Y[.Z]
# sub = .devN - for pre-alpha releases
# | {a|b|rc}N - for alpha, beta, and rc releases
ma... | python | wandb/vendor/promise-2.3.0/wandb_promise/pyutils/version.py | 8 | 30 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,936 | get_main_version | def get_main_version(version=None):
"Returns main version (X.Y[.Z]) from VERSION."
version = get_complete_version(version)
parts = 2 if version[2] == 0 else 3
return ".".join(str(x) for x in version[:parts]) | python | wandb/vendor/promise-2.3.0/wandb_promise/pyutils/version.py | 33 | 37 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,937 | get_complete_version | def get_complete_version(version=None):
"""Returns a tuple of the promise version. If version argument is non-empty,
then checks for correctness of the tuple provided.
"""
if version is None:
from promise import VERSION
return VERSION
else:
assert len(version) == 5
a... | python | wandb/vendor/promise-2.3.0/wandb_promise/pyutils/version.py | 40 | 52 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,938 | get_docs_version | def get_docs_version(version=None):
version = get_complete_version(version)
if version[3] != "final":
return "dev"
else:
return "%d.%d" % version[:2] | python | wandb/vendor/promise-2.3.0/wandb_promise/pyutils/version.py | 55 | 60 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,939 | get_git_changeset | def get_git_changeset():
"""Returns a numeric identifier of the latest git changeset.
The result is the UTC timestamp of the changeset in YYYYMMDDHHMMSS format.
This value isn't guaranteed to be unique, but collisions are very unlikely,
so it's sufficient for generating the development version numbers.
... | python | wandb/vendor/promise-2.3.0/wandb_promise/pyutils/version.py | 63 | 83 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,940 | call | def call(self, fn):
thread = Thread(target=fn)
thread.start() | python | wandb/vendor/promise-2.3.0/wandb_promise/schedulers/thread.py | 5 | 7 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,941 | wait | def wait(self, promise, timeout=None):
e = Event()
def on_resolve_or_reject(_):
e.set()
promise._then(on_resolve_or_reject, on_resolve_or_reject)
waited = e.wait(timeout)
if not waited:
raise Exception("Timeout") | python | wandb/vendor/promise-2.3.0/wandb_promise/schedulers/thread.py | 9 | 18 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,942 | on_resolve_or_reject | def on_resolve_or_reject(_):
e.set() | python | wandb/vendor/promise-2.3.0/wandb_promise/schedulers/thread.py | 12 | 13 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,943 | call | def call(self, fn):
# type: (Callable) -> None
try:
fn()
except:
pass | python | wandb/vendor/promise-2.3.0/wandb_promise/schedulers/immediate.py | 9 | 14 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,944 | wait | def wait(self, promise, timeout=None):
# type: (Promise, Optional[float]) -> None
e = Event()
def on_resolve_or_reject(_):
# type: (Any) -> None
e.set()
promise._then(on_resolve_or_reject, on_resolve_or_reject)
waited = e.wait(timeout)
if not wai... | python | wandb/vendor/promise-2.3.0/wandb_promise/schedulers/immediate.py | 16 | 27 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,945 | on_resolve_or_reject | def on_resolve_or_reject(_):
# type: (Any) -> None
e.set() | python | wandb/vendor/promise-2.3.0/wandb_promise/schedulers/immediate.py | 20 | 22 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,946 | call | def call(self, fn):
# print fn
gevent.spawn(fn) | python | wandb/vendor/promise-2.3.0/wandb_promise/schedulers/gevent.py | 8 | 10 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,947 | wait | def wait(self, promise, timeout=None):
e = Event()
def on_resolve_or_reject(_):
e.set()
promise._then(on_resolve_or_reject, on_resolve_or_reject)
waited = e.wait(timeout)
if not waited:
raise Exception("Timeout") | python | wandb/vendor/promise-2.3.0/wandb_promise/schedulers/gevent.py | 12 | 21 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,948 | on_resolve_or_reject | def on_resolve_or_reject(_):
e.set() | python | wandb/vendor/promise-2.3.0/wandb_promise/schedulers/gevent.py | 15 | 16 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,949 | __init__ | def __init__(self, loop=None):
self.loop = loop or get_event_loop() | python | wandb/vendor/promise-2.3.0/wandb_promise/schedulers/asyncio.py | 7 | 8 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,950 | call | def call(self, fn):
self.loop.call_soon(fn) | python | wandb/vendor/promise-2.3.0/wandb_promise/schedulers/asyncio.py | 10 | 11 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,951 | wait | def wait(self, promise, timeout=None):
e = Event()
def on_resolve_or_reject(_):
e.set()
promise._then(on_resolve_or_reject, on_resolve_or_reject)
# We can't use the timeout in Asyncio event
e.wait() | python | wandb/vendor/promise-2.3.0/wandb_promise/schedulers/asyncio.py | 13 | 22 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,952 | on_resolve_or_reject | def on_resolve_or_reject(_):
e.set() | python | wandb/vendor/promise-2.3.0/wandb_promise/schedulers/asyncio.py | 16 | 17 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,953 | _noop_if_disabled | def _noop_if_disabled(func: Callable) -> Callable:
@functools.wraps(func)
def wrapper(self: Type["Sentry"], *args: Any, **kwargs: Any) -> Any:
if self._disabled:
return None
return func(self, *args, **kwargs)
return wrapper | python | wandb/analytics/sentry.py | 35 | 42 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,954 | wrapper | def wrapper(self: Type["Sentry"], *args: Any, **kwargs: Any) -> Any:
if self._disabled:
return None
return func(self, *args, **kwargs) | python | wandb/analytics/sentry.py | 37 | 40 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,955 | __init__ | def __init__(self) -> None:
self._disabled = not wandb.env.error_reporting_enabled()
self._sent_messages: set = set()
self.dsn = os.environ.get(wandb.env.SENTRY_DSN, SENTRY_DEFAULT_DSN)
self.hub: Optional["sentry_sdk.hub.Hub"] = None
# ensure we always end the Sentry session
... | python | wandb/analytics/sentry.py | 48 | 57 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,956 | environment | def environment(self) -> str:
"""Return the environment we're running in."""
# check if we're in a git repo
is_git = pathlib.Path(__file__).parent.parent.parent.joinpath(".git").exists()
# these match the environments for gorilla
return "development" if is_git else "production" | python | wandb/analytics/sentry.py | 60 | 66 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,957 | setup | def setup(self) -> None:
"""Setup Sentry SDK.
We use lower-level APIs (i.e., not sentry_sdk.init) here
to avoid the possibility of interfering with the user's
own Sentry SDK setup.
"""
client = sentry_sdk.Client(
dsn=self.dsn,
default_integrations... | python | wandb/analytics/sentry.py | 69 | 82 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,958 | message | def message(self, message: str, repeat: bool = True) -> None:
"""Send a message to Sentry."""
if not repeat and message in self._sent_messages:
return
self._sent_messages.add(message)
self.hub.capture_message(message) # type: ignore | python | wandb/analytics/sentry.py | 85 | 90 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,959 | exception | def exception(
self,
exc: Union[
str,
BaseException,
Tuple[
Optional[Type[BaseException]],
Optional[BaseException],
Optional[TracebackType],
],
None,
],
handled: bool = False,
... | python | wandb/analytics/sentry.py | 93 | 134 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,960 | reraise | def reraise(self, exc: Any) -> None:
"""Re-raise an exception after logging it to Sentry.
Use this for top-level exceptions when you want the user to see the traceback.
Must be called from within an exception handler.
"""
self.exception(exc)
# this will messily add this... | python | wandb/analytics/sentry.py | 136 | 146 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,961 | start_session | def start_session(self) -> None:
"""Start a new session."""
assert self.hub is not None
# get the current client and scope
_, scope = self.hub._stack[-1]
session = scope._session
# if there's no session, start one
if session is None:
self.hub.start_se... | python | wandb/analytics/sentry.py | 149 | 158 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,962 | end_session | def end_session(self) -> None:
"""End the current session."""
assert self.hub is not None
# get the current client and scope
client, scope = self.hub._stack[-1]
session = scope._session
if session is not None and client is not None:
self.hub.end_session()
... | python | wandb/analytics/sentry.py | 161 | 170 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,963 | mark_session | def mark_session(self, status: Optional["SessionStatus"] = None) -> None:
"""Mark the current session with a status."""
assert self.hub is not None
_, scope = self.hub._stack[-1]
session = scope._session
if session is not None:
session.update(status=status) | python | wandb/analytics/sentry.py | 173 | 180 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,964 | configure_scope | def configure_scope(
self,
settings: Optional[
Union[
"wandb.sdk.wandb_settings.Settings",
"wandb.sdk.internal.settings_static.SettingsStatic",
]
] = None,
process_context: Optional[str] = None,
) -> None:
"""Configure t... | python | wandb/analytics/sentry.py | 183 | 262 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
7,965 | copy_if_modified | def copy_if_modified(src, dest):
try:
dest_stat = os.stat(dest)
except FileNotFoundError:
do_copy = True
else:
src_stat = os.stat(src)
do_copy = (
src_stat.st_mtime != dest_stat.st_mtime
or src_stat.st_size != dest_stat.st_size
)
if do_cop... | python | PC/layout/main.py | 63 | 79 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,966 | get_lib_layout | def get_lib_layout(ns):
def _c(f):
if f in EXCLUDE_FROM_LIB:
return False
if f.is_dir():
if f in TEST_DIRS_ONLY:
return ns.include_tests
if f in TCLTK_DIRS_ONLY:
return ns.include_tcltk
if f in IDLE_DIRS_ONLY:
... | python | PC/layout/main.py | 82 | 101 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,967 | _c | def _c(f):
if f in EXCLUDE_FROM_LIB:
return False
if f.is_dir():
if f in TEST_DIRS_ONLY:
return ns.include_tests
if f in TCLTK_DIRS_ONLY:
return ns.include_tcltk
if f in IDLE_DIRS_ONLY:
return ns.include_idle... | python | PC/layout/main.py | 83 | 98 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,968 | get_tcltk_lib | def get_tcltk_lib(ns):
if not ns.include_tcltk:
return
tcl_lib = os.getenv("TCL_LIBRARY")
if not tcl_lib or not os.path.isdir(tcl_lib):
try:
with open(ns.build / "TCL_LIBRARY.env", "r", encoding="utf-8-sig") as f:
tcl_lib = f.read().strip()
except FileNot... | python | PC/layout/main.py | 104 | 120 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,969 | get_layout | def get_layout(ns):
def in_build(f, dest="", new_name=None):
n, _, x = f.rpartition(".")
n = new_name or n
src = ns.build / f
if ns.debug and src not in REQUIRED_DLLS:
if not "_d." in src.name:
src = src.parent / (src.stem + "_d" + src.suffix)
... | python | PC/layout/main.py | 123 | 296 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,970 | in_build | def in_build(f, dest="", new_name=None):
n, _, x = f.rpartition(".")
n = new_name or n
src = ns.build / f
if ns.debug and src not in REQUIRED_DLLS:
if not "_d." in src.name:
src = src.parent / (src.stem + "_d" + src.suffix)
if "_d." not in f:
... | python | PC/layout/main.py | 124 | 142 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,971 | _c | def _c(d):
if d.is_dir():
return d in TOOLS_DIRS
return d in TOOLS_FILES | python | PC/layout/main.py | 246 | 249 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,972 | _compile_one_py | def _compile_one_py(src, dest, name, optimize, checked=True):
import py_compile
if dest is not None:
dest = str(dest)
mode = (
py_compile.PycInvalidationMode.CHECKED_HASH
if checked
else py_compile.PycInvalidationMode.UNCHECKED_HASH
)
try:
return Path(
... | python | PC/layout/main.py | 299 | 324 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,973 | _py_temp_compile | def _py_temp_compile(src, name, ns, dest_dir=None, checked=True):
if not ns.precompile or src not in PY_FILES or src.parent in DATA_DIRS:
return None
dest = (dest_dir or ns.temp) / (src.stem + ".pyc")
return _compile_one_py(src, dest, name, optimize=2, checked=checked) | python | PC/layout/main.py | 328 | 332 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,974 | _write_to_zip | def _write_to_zip(zf, dest, src, ns, checked=True):
pyc = _py_temp_compile(src, dest, ns, checked=checked)
if pyc:
try:
zf.write(str(pyc), dest.with_suffix(".pyc"))
finally:
try:
pyc.unlink()
except:
log_exception("Failed to del... | python | PC/layout/main.py | 335 | 347 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,975 | generate_source_files | def generate_source_files(ns):
if ns.zip_lib:
zip_name = PYTHON_ZIP_NAME
zip_path = ns.temp / zip_name
if zip_path.is_file():
zip_path.unlink()
elif zip_path.is_dir():
log_error(
"Cannot create zip file because a directory exists by the same na... | python | PC/layout/main.py | 350 | 387 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,976 | _create_zip_file | def _create_zip_file(ns):
if not ns.zip:
return None
if ns.zip.is_file():
try:
ns.zip.unlink()
except OSError:
log_exception("Unable to remove {}", ns.zip)
sys.exit(8)
elif ns.zip.is_dir():
log_error("Cannot create ZIP file because {} is a... | python | PC/layout/main.py | 390 | 405 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,977 | copy_files | def copy_files(files, ns):
if ns.copy:
ns.copy.mkdir(parents=True, exist_ok=True)
try:
total = len(files)
except TypeError:
total = None
count = 0
zip_file = _create_zip_file(ns)
try:
need_compile = []
in_catalog = []
for dest, src in files:
... | python | PC/layout/main.py | 408 | 498 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,978 | main | def main():
parser = argparse.ArgumentParser()
parser.add_argument("-v", help="Increase verbosity", action="count")
parser.add_argument(
"-s",
"--source",
metavar="dir",
help="The directory containing the repository root",
type=Path,
default=None,
)
pa... | python | PC/layout/main.py | 501 | 683 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,979 | public | def public(f):
__all__.append(f.__name__)
return f | python | PC/layout/support/catalog.py | 12 | 14 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,980 | can_sign | def can_sign(file):
return file.is_file() and file.stat().st_size | python | PC/layout/support/catalog.py | 34 | 35 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,981 | write_catalog | def write_catalog(target, files):
with target.open("w", encoding="utf-8") as cat:
cat.write(CATALOG_TEMPLATE.format(target=target))
cat.writelines("<HASH>{}={}\n".format(n, f) for n, f in files if can_sign(f)) | python | PC/layout/support/catalog.py | 39 | 42 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,982 | public | def public(f):
__all__.append(f.__name__)
return f | python | PC/layout/support/options.py | 12 | 14 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,983 | get_argparse_options | def get_argparse_options():
for opt, info in OPTIONS.items():
help = "When specified, includes {}".format(info["help"])
if info.get("not-in-all"):
help = "{}. Not affected by --include-all".format(help)
yield "--include-{}".format(opt), help
for opt, info in PRESETS.items()... | python | PC/layout/support/options.py | 102 | 112 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,984 | ns_get | def ns_get(ns, key, default=False):
return getattr(ns, key.replace("-", "_"), default) | python | PC/layout/support/options.py | 115 | 116 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,985 | ns_set | def ns_set(ns, key, value=True):
k1 = key.replace("-", "_")
k2 = "include_{}".format(k1)
if hasattr(ns, k2):
setattr(ns, k2, value)
elif hasattr(ns, k1):
setattr(ns, k1, value)
else:
raise AttributeError("no argument named '{}'".format(k1)) | python | PC/layout/support/options.py | 119 | 127 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,986 | update_presets | def update_presets(ns):
for preset, info in PRESETS.items():
if ns_get(ns, "preset-{}".format(preset)):
for opt in info["options"]:
ns_set(ns, opt)
if ns.include_all:
for opt in OPTIONS:
if OPTIONS[opt].get("not-in-all"):
continue
... | python | PC/layout/support/options.py | 131 | 141 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,987 | public | def public(f):
__all__.append(f.__name__)
return f | python | PC/layout/support/logging.py | 17 | 19 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,988 | configure_logger | def configure_logger(ns):
global LOG
if LOG:
return
LOG = logging.getLogger("make_layout")
LOG.level = logging.DEBUG
if ns.v:
s_level = max(logging.ERROR - ns.v * 10, logging.DEBUG)
f_level = max(logging.WARNING - ns.v * 10, logging.DEBUG)
else:
s_level = loggin... | python | PC/layout/support/logging.py | 23 | 49 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,989 | __init__ | def __init__(self, fmt, *args, **kwargs):
self.fmt = fmt
self.args = args
self.kwargs = kwargs | python | PC/layout/support/logging.py | 53 | 56 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,990 | __str__ | def __str__(self):
return self.fmt.format(*self.args, **self.kwargs) | python | PC/layout/support/logging.py | 58 | 59 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,991 | log_debug | def log_debug(msg, *args, **kwargs):
return LOG.debug(BraceMessage(msg, *args, **kwargs)) | python | PC/layout/support/logging.py | 63 | 64 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,992 | log_info | def log_info(msg, *args, **kwargs):
return LOG.info(BraceMessage(msg, *args, **kwargs)) | python | PC/layout/support/logging.py | 68 | 69 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,993 | log_warning | def log_warning(msg, *args, **kwargs):
return LOG.warning(BraceMessage(msg, *args, **kwargs)) | python | PC/layout/support/logging.py | 73 | 74 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,994 | log_error | def log_error(msg, *args, **kwargs):
global HAS_ERROR
HAS_ERROR = True
return LOG.error(BraceMessage(msg, *args, **kwargs)) | python | PC/layout/support/logging.py | 78 | 81 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,995 | log_exception | def log_exception(msg, *args, **kwargs):
global HAS_ERROR
HAS_ERROR = True
return LOG.exception(BraceMessage(msg, *args, **kwargs)) | python | PC/layout/support/logging.py | 85 | 88 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,996 | error_was_logged | def error_was_logged():
return HAS_ERROR | python | PC/layout/support/logging.py | 92 | 93 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,997 | _unpack_hexversion | def _unpack_hexversion():
try:
hexversion = int(os.getenv("PYTHON_HEXVERSION"), 16)
except (TypeError, ValueError):
hexversion = sys.hexversion
return struct.pack(">i", hexversion) | python | PC/layout/support/constants.py | 13 | 18 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,998 | _get_suffix | def _get_suffix(field4):
name = {0xA0: "a", 0xB0: "b", 0xC0: "rc"}.get(field4 & 0xF0, "")
if name:
serial = field4 & 0x0F
return f"{name}{serial}"
return "" | python | PC/layout/support/constants.py | 21 | 26 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
7,999 | get_packagefamilyname | def get_packagefamilyname(name, publisher_id):
class PACKAGE_ID(ctypes.Structure):
_fields_ = [
("reserved", ctypes.c_uint32),
("processorArchitecture", ctypes.c_uint32),
("version", ctypes.c_uint64),
("name", ctypes.c_wchar_p),
("publisher", ctype... | python | PC/layout/support/appxmanifest.py | 195 | 216 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,000 | _fixup_sccd | def _fixup_sccd(ns, sccd, new_hash=None):
if not new_hash:
return sccd
NS = dict(s="http://schemas.microsoft.com/appx/2016/sccd")
with open(sccd, "rb") as f:
xml = ET.parse(f)
pfn = get_packagefamilyname(APPX_DATA["Name"], APPX_DATA["Publisher"])
ae = xml.find("s:AuthorizedEntitie... | python | PC/layout/support/appxmanifest.py | 219 | 244 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.