body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
4b5f6e94f37a4691367eb08ce125ede0439657ff7497c8145b3d840919424085 | def get_sequence_class(random_batches, balanced_sampling):
'\n Returns the appropriate BatchSequence sub-class given a set of parameters.\n\n Note: balanced_sampling cannot be True with random_batches=False\n\n Args:\n random_batches: (bool) The BatchSequence should sample random\n ... | Returns the appropriate BatchSequence sub-class given a set of parameters.
Note: balanced_sampling cannot be True with random_batches=False
Args:
random_batches: (bool) The BatchSequence should sample random
batches across the SleepStudyDataset
balanced_sampling: (bool) The... | utime/sequences/utils.py | get_sequence_class | learning310/U-Time | 138 | python | def get_sequence_class(random_batches, balanced_sampling):
'\n Returns the appropriate BatchSequence sub-class given a set of parameters.\n\n Note: balanced_sampling cannot be True with random_batches=False\n\n Args:\n random_batches: (bool) The BatchSequence should sample random\n ... | def get_sequence_class(random_batches, balanced_sampling):
'\n Returns the appropriate BatchSequence sub-class given a set of parameters.\n\n Note: balanced_sampling cannot be True with random_batches=False\n\n Args:\n random_batches: (bool) The BatchSequence should sample random\n ... |
c1ffdebcd9684caeecbfbec8a1761c842b694b182c669f3902cf7b4874690278 | def get_batch_sequence(dataset_queue, batch_size=16, random_batches=True, balanced_sampling=True, n_classes=None, margin=0, augmenters=None, scaler=None, batch_wise_scaling=False, no_log=False, **kwargs):
'\n Return a utime.sequences BatchSequence object made from a dataset queue.\n A BatchSequence object is ... | Return a utime.sequences BatchSequence object made from a dataset queue.
A BatchSequence object is used to extract batches of data from all or
individual SleepStudy objects represented by this SleepStudyDataset.
All args pass to the BatchSequence object.
Please refer to its documentation.
Returns:
A BatchSequence... | utime/sequences/utils.py | get_batch_sequence | learning310/U-Time | 138 | python | def get_batch_sequence(dataset_queue, batch_size=16, random_batches=True, balanced_sampling=True, n_classes=None, margin=0, augmenters=None, scaler=None, batch_wise_scaling=False, no_log=False, **kwargs):
'\n Return a utime.sequences BatchSequence object made from a dataset queue.\n A BatchSequence object is ... | def get_batch_sequence(dataset_queue, batch_size=16, random_batches=True, balanced_sampling=True, n_classes=None, margin=0, augmenters=None, scaler=None, batch_wise_scaling=False, no_log=False, **kwargs):
'\n Return a utime.sequences BatchSequence object made from a dataset queue.\n A BatchSequence object is ... |
0c353a9d87e0b447d8a869bba7209499e7456af8600f307b0756031e81d612b4 | def makedirs_touch(path):
'Creates the file and all parent directories in the supplied path'
basedir = os.path.dirname(path)
if (not os.path.exists(basedir)):
os.makedirs(basedir)
with open(path, 'a'):
os.utime(path, None) | Creates the file and all parent directories in the supplied path | pyjournal/utils.py | makedirs_touch | Lee-Sutton/pyjournal | 0 | python | def makedirs_touch(path):
basedir = os.path.dirname(path)
if (not os.path.exists(basedir)):
os.makedirs(basedir)
with open(path, 'a'):
os.utime(path, None) | def makedirs_touch(path):
basedir = os.path.dirname(path)
if (not os.path.exists(basedir)):
os.makedirs(basedir)
with open(path, 'a'):
os.utime(path, None)<|docstring|>Creates the file and all parent directories in the supplied path<|endoftext|> |
a1682e809a0ba0d4a74baa235b2d35f7f7ca56fb84443f5fa0bdaebfbf8f092b | def __init__(self, handler, thread_group=None, timeout=None):
'Initializes a new Watcher instance.\n\n :param handler: a `callable` object to be invoked for each observed\n K8s event with the event body as a single argument.\n Calling `handler` should never raise... | Initializes a new Watcher instance.
:param handler: a `callable` object to be invoked for each observed
K8s event with the event body as a single argument.
Calling `handler` should never raise any exceptions
other than `eventlet.greenlet.GreenletExit` caused by
... | kuryr_kubernetes/watcher.py | __init__ | BoringWenn/kuryr-kubernetes | 0 | python | def __init__(self, handler, thread_group=None, timeout=None):
'Initializes a new Watcher instance.\n\n :param handler: a `callable` object to be invoked for each observed\n K8s event with the event body as a single argument.\n Calling `handler` should never raise... | def __init__(self, handler, thread_group=None, timeout=None):
'Initializes a new Watcher instance.\n\n :param handler: a `callable` object to be invoked for each observed\n K8s event with the event body as a single argument.\n Calling `handler` should never raise... |
6b389fb3ec34e6c434a9e5212f2cfc551e4593d4f08fd4c25964adea602738ce | def add(self, path):
'Adds ths K8s resource to the Watcher.\n\n Adding a resource to a running `Watcher` also ensures that the event\n processing loop for that resource is running. This method could block\n for `Watcher`s operating in synchronous mode.\n\n :param path: K8s resource URL p... | Adds ths K8s resource to the Watcher.
Adding a resource to a running `Watcher` also ensures that the event
processing loop for that resource is running. This method could block
for `Watcher`s operating in synchronous mode.
:param path: K8s resource URL path | kuryr_kubernetes/watcher.py | add | BoringWenn/kuryr-kubernetes | 0 | python | def add(self, path):
'Adds ths K8s resource to the Watcher.\n\n Adding a resource to a running `Watcher` also ensures that the event\n processing loop for that resource is running. This method could block\n for `Watcher`s operating in synchronous mode.\n\n :param path: K8s resource URL p... | def add(self, path):
'Adds ths K8s resource to the Watcher.\n\n Adding a resource to a running `Watcher` also ensures that the event\n processing loop for that resource is running. This method could block\n for `Watcher`s operating in synchronous mode.\n\n :param path: K8s resource URL p... |
8b6af6574f3dd876c1488faddd6e7628d3ad8a4260ce7875d408f394e34a9402 | def remove(self, path):
'Removes the K8s resource from the Watcher.\n\n Also requests the corresponding event processing loop to stop if it\n is running.\n\n :param path: K8s resource URL path\n '
self._resources.discard(path)
if (path in self._watching):
self._stop_watch... | Removes the K8s resource from the Watcher.
Also requests the corresponding event processing loop to stop if it
is running.
:param path: K8s resource URL path | kuryr_kubernetes/watcher.py | remove | BoringWenn/kuryr-kubernetes | 0 | python | def remove(self, path):
'Removes the K8s resource from the Watcher.\n\n Also requests the corresponding event processing loop to stop if it\n is running.\n\n :param path: K8s resource URL path\n '
self._resources.discard(path)
if (path in self._watching):
self._stop_watch... | def remove(self, path):
'Removes the K8s resource from the Watcher.\n\n Also requests the corresponding event processing loop to stop if it\n is running.\n\n :param path: K8s resource URL path\n '
self._resources.discard(path)
if (path in self._watching):
self._stop_watch... |
d6b38122bab161bd2926cc067a9607e352107ad12a57e0e0f562de8038d9ad8b | def start(self):
'Starts the Watcher.\n\n Also ensures that the event processing loops are running. This method\n could block for `Watcher`s operating in synchronous mode.\n '
self._running = True
for path in (self._resources - set(self._watching)):
self._start_watch(path) | Starts the Watcher.
Also ensures that the event processing loops are running. This method
could block for `Watcher`s operating in synchronous mode. | kuryr_kubernetes/watcher.py | start | BoringWenn/kuryr-kubernetes | 0 | python | def start(self):
'Starts the Watcher.\n\n Also ensures that the event processing loops are running. This method\n could block for `Watcher`s operating in synchronous mode.\n '
self._running = True
for path in (self._resources - set(self._watching)):
self._start_watch(path) | def start(self):
'Starts the Watcher.\n\n Also ensures that the event processing loops are running. This method\n could block for `Watcher`s operating in synchronous mode.\n '
self._running = True
for path in (self._resources - set(self._watching)):
self._start_watch(path)<|docs... |
1d35b613eece6b6138378cce3e390b81095c6481a5cfe0702329f12ae5a153d6 | def stop(self):
'Stops the Watcher.\n\n Also requests all running event processing loops to stop.\n '
self._running = False
for path in list(self._watching):
self._stop_watch(path) | Stops the Watcher.
Also requests all running event processing loops to stop. | kuryr_kubernetes/watcher.py | stop | BoringWenn/kuryr-kubernetes | 0 | python | def stop(self):
'Stops the Watcher.\n\n Also requests all running event processing loops to stop.\n '
self._running = False
for path in list(self._watching):
self._stop_watch(path) | def stop(self):
'Stops the Watcher.\n\n Also requests all running event processing loops to stop.\n '
self._running = False
for path in list(self._watching):
self._stop_watch(path)<|docstring|>Stops the Watcher.
Also requests all running event processing loops to stop.<|endoftext|> |
18347931f6f758da5e586c02b09a81724a1611d86676fcdf1e38da069a717340 | def version() -> str:
'Returns the version number of this library.'
return VERSION | Returns the version number of this library. | redpandas/__init__.py | version | RedVoxInc/redpandas | 1 | python | def version() -> str:
return VERSION | def version() -> str:
return VERSION<|docstring|>Returns the version number of this library.<|endoftext|> |
dc55a383917dd4bd2fcc22b3c3d8c869db14863970454ea88f78344a12103ccf | def print_version() -> None:
'Prints the version number of this library'
print(version()) | Prints the version number of this library | redpandas/__init__.py | print_version | RedVoxInc/redpandas | 1 | python | def print_version() -> None:
print(version()) | def print_version() -> None:
print(version())<|docstring|>Prints the version number of this library<|endoftext|> |
7aa0edb6861393b0ffc4301d80126fbd4a222df6f8d6cb7b45d0ee5366bacd3e | def get_data_files():
' Get all data files for the package\n '
data_files = [('etc/jupyter/jupyter_server_config.d', ['etc/jupyter/jupyter_server_config.d/voila-gridstack.json']), ('etc/jupyter/jupyter_notebook_config.d', ['etc/jupyter/jupyter_notebook_config.d/voila-gridstack.json']), ('etc/jupyter/nbconfig... | Get all data files for the package | setup.py | get_data_files | JohanMabille/voila-gridstack | 0 | python | def get_data_files():
' \n '
data_files = [('etc/jupyter/jupyter_server_config.d', ['etc/jupyter/jupyter_server_config.d/voila-gridstack.json']), ('etc/jupyter/jupyter_notebook_config.d', ['etc/jupyter/jupyter_notebook_config.d/voila-gridstack.json']), ('etc/jupyter/nbconfig/notebook.d', ['etc/jupyter/nbconf... | def get_data_files():
' \n '
data_files = [('etc/jupyter/jupyter_server_config.d', ['etc/jupyter/jupyter_server_config.d/voila-gridstack.json']), ('etc/jupyter/jupyter_notebook_config.d', ['etc/jupyter/jupyter_notebook_config.d/voila-gridstack.json']), ('etc/jupyter/nbconfig/notebook.d', ['etc/jupyter/nbconf... |
e22b12ea4d06fc92775ab2863de86329138e1fb5237ab31fd48139b57418afa3 | def __call__(self, src):
'Augmenter body'
if (random.random() < self.p):
src = (255 - src)
return src | Augmenter body | cnocr/data_utils/aug.py | __call__ | breezedeus/cnocr | 1,562 | python | def __call__(self, src):
if (random.random() < self.p):
src = (255 - src)
return src | def __call__(self, src):
if (random.random() < self.p):
src = (255 - src)
return src<|docstring|>Augmenter body<|endoftext|> |
2f5617429f66a6d0657515f7369c5eaec22f1b62f4ab0860e36a8057abd50b3e | def __call__(self, img: torch.Tensor):
'\n\n :param img: [C, H, W]\n :return:\n '
if (random.random() >= self.p):
return img
pad_len = random.randint(1, self.max_pad_len)
pad_shape = list(img.shape)
pad_shape[(- 1)] = pad_len
padding = torch.zeros(pad_shape, dtype=im... | :param img: [C, H, W]
:return: | cnocr/data_utils/aug.py | __call__ | breezedeus/cnocr | 1,562 | python | def __call__(self, img: torch.Tensor):
'\n\n :param img: [C, H, W]\n :return:\n '
if (random.random() >= self.p):
return img
pad_len = random.randint(1, self.max_pad_len)
pad_shape = list(img.shape)
pad_shape[(- 1)] = pad_len
padding = torch.zeros(pad_shape, dtype=im... | def __call__(self, img: torch.Tensor):
'\n\n :param img: [C, H, W]\n :return:\n '
if (random.random() >= self.p):
return img
pad_len = random.randint(1, self.max_pad_len)
pad_shape = list(img.shape)
pad_shape[(- 1)] = pad_len
padding = torch.zeros(pad_shape, dtype=im... |
3169287f5d289f9a248008c5e01a59194831ad14b9923a6a57b5e297177b4915 | def pickle_write(content, name, append=1):
'function to open file, pickle dump, then close'
f = (open(name, 'ab') if append else open(name, 'wb'))
pickle.dump(content, f)
f.close() | function to open file, pickle dump, then close | forge/blade/systems/visualizer/visualizer.py | pickle_write | LYX0429/neural-mmo | 4 | python | def pickle_write(content, name, append=1):
f = (open(name, 'ab') if append else open(name, 'wb'))
pickle.dump(content, f)
f.close() | def pickle_write(content, name, append=1):
f = (open(name, 'ab') if append else open(name, 'wb'))
pickle.dump(content, f)
f.close()<|docstring|>function to open file, pickle dump, then close<|endoftext|> |
b3ae758ef71ca8697b076523e0697ca09ae3d99c981329ffb79e709b91d3e116 | def pickle_read(name):
'function to open file, pickle load, then close'
f = open(name, 'rb')
ret = pickle.load(f)
f.close()
return ret | function to open file, pickle load, then close | forge/blade/systems/visualizer/visualizer.py | pickle_read | LYX0429/neural-mmo | 4 | python | def pickle_read(name):
f = open(name, 'rb')
ret = pickle.load(f)
f.close()
return ret | def pickle_read(name):
f = open(name, 'rb')
ret = pickle.load(f)
f.close()
return ret<|docstring|>function to open file, pickle load, then close<|endoftext|> |
5da824118f17a11ac7ee7c1380b874bbef059adfcd8f9cc477f1c7b546840486 | def __init__(self, config):
"Visualizes a stream of data with threaded refreshing. To\n add items, initialize using 'keys' kwarg or add to packet in\n stream()\n Args:\n keys : List of object names (str) to be displayed on market\n history_len : How far back to plot... | Visualizes a stream of data with threaded refreshing. To
add items, initialize using 'keys' kwarg or add to packet in
stream()
Args:
keys : List of object names (str) to be displayed on market
history_len : How far back to plot data
scales : Scales for visualization
title : Title of gr... | forge/blade/systems/visualizer/visualizer.py | __init__ | LYX0429/neural-mmo | 4 | python | def __init__(self, config):
"Visualizes a stream of data with threaded refreshing. To\n add items, initialize using 'keys' kwarg or add to packet in\n stream()\n Args:\n keys : List of object names (str) to be displayed on market\n history_len : How far back to plot... | def __init__(self, config):
"Visualizes a stream of data with threaded refreshing. To\n add items, initialize using 'keys' kwarg or add to packet in\n stream()\n Args:\n keys : List of object names (str) to be displayed on market\n history_len : How far back to plot... |
3fe6425e54903ad561c9bca1575fb36e60a3898ff325193a696d1e2e26071434 | def stream(self):
'Wrapper function for source.stream to enable\n adding new items mid-stream. Overwrite graph\n with new figure if packet has different keys.\n Args:\n packet: dictionary of singleton lists'
self.dataSource = dict(self.data.copy())
if self.log:
pickle... | Wrapper function for source.stream to enable
adding new items mid-stream. Overwrite graph
with new figure if packet has different keys.
Args:
packet: dictionary of singleton lists | forge/blade/systems/visualizer/visualizer.py | stream | LYX0429/neural-mmo | 4 | python | def stream(self):
'Wrapper function for source.stream to enable\n adding new items mid-stream. Overwrite graph\n with new figure if packet has different keys.\n Args:\n packet: dictionary of singleton lists'
self.dataSource = dict(self.data.copy())
if self.log:
pickle... | def stream(self):
'Wrapper function for source.stream to enable\n adding new items mid-stream. Overwrite graph\n with new figure if packet has different keys.\n Args:\n packet: dictionary of singleton lists'
self.dataSource = dict(self.data.copy())
if self.log:
pickle... |
94b205e0d9afeb91e0dbd1f4e993b7749613f711877c2e0d10a54a5478c36436 | def __init__(self, middleman, config):
' Runs an asynchronous Bokeh data streaming server.\n \n Args:\n market : The market to visualize\n args : Additional arguments\n kwargs : Additional keyword arguments\n '
self.analytics = Analytics(config)
self.middle... | Runs an asynchronous Bokeh data streaming server.
Args:
market : The market to visualize
args : Additional arguments
kwargs : Additional keyword arguments | forge/blade/systems/visualizer/visualizer.py | __init__ | LYX0429/neural-mmo | 4 | python | def __init__(self, middleman, config):
' Runs an asynchronous Bokeh data streaming server.\n \n Args:\n market : The market to visualize\n args : Additional arguments\n kwargs : Additional keyword arguments\n '
self.analytics = Analytics(config)
self.middle... | def __init__(self, middleman, config):
' Runs an asynchronous Bokeh data streaming server.\n \n Args:\n market : The market to visualize\n args : Additional arguments\n kwargs : Additional keyword arguments\n '
self.analytics = Analytics(config)
self.middle... |
df44bd0b694e189a156cbfbf6a11c3b376c12329bb44883ead94ea24e820c93d | def init(self, doc):
'Initialize document and threaded update loop\n Args:\n doc: A Bokeh document\n '
self.analytics.init(doc)
self.doc = doc
self.thread = Thread(target=self.update, args=[])
self.thread.start()
self.started = True | Initialize document and threaded update loop
Args:
doc: A Bokeh document | forge/blade/systems/visualizer/visualizer.py | init | LYX0429/neural-mmo | 4 | python | def init(self, doc):
'Initialize document and threaded update loop\n Args:\n doc: A Bokeh document\n '
self.analytics.init(doc)
self.doc = doc
self.thread = Thread(target=self.update, args=[])
self.thread.start()
self.started = True | def init(self, doc):
'Initialize document and threaded update loop\n Args:\n doc: A Bokeh document\n '
self.analytics.init(doc)
self.doc = doc
self.thread = Thread(target=self.update, args=[])
self.thread.start()
self.started = True<|docstring|>Initialize document and thr... |
fe5c4e2b8fae682bd4eff60b4f659134cf9e1f54c669f2da8e07a69646b30418 | def update(self):
'Blocking update call to be run in a separate thread\n Ingests packets from a remote market and streams to Bokeh client'
self.n = 0
while True:
time.sleep(0.05)
if (self.thread is None):
continue
if ray.get(self.middleman.getShutdown.remote()):
... | Blocking update call to be run in a separate thread
Ingests packets from a remote market and streams to Bokeh client | forge/blade/systems/visualizer/visualizer.py | update | LYX0429/neural-mmo | 4 | python | def update(self):
'Blocking update call to be run in a separate thread\n Ingests packets from a remote market and streams to Bokeh client'
self.n = 0
while True:
time.sleep(0.05)
if (self.thread is None):
continue
if ray.get(self.middleman.getShutdown.remote()):
... | def update(self):
'Blocking update call to be run in a separate thread\n Ingests packets from a remote market and streams to Bokeh client'
self.n = 0
while True:
time.sleep(0.05)
if (self.thread is None):
continue
if ray.get(self.middleman.getShutdown.remote()):
... |
de616b19a371cc4a7549999e79b5cfab563724a9d7facb38f706eb30505e3c02 | @gen.coroutine
def stream(self):
'Stream current data buffer to Bokeh client'
self.analytics.stream() | Stream current data buffer to Bokeh client | forge/blade/systems/visualizer/visualizer.py | stream | LYX0429/neural-mmo | 4 | python | @gen.coroutine
def stream(self):
self.analytics.stream() | @gen.coroutine
def stream(self):
self.analytics.stream()<|docstring|>Stream current data buffer to Bokeh client<|endoftext|> |
67e7680ef5d74a0c0647cb59f373b944ae6c611cdea402c9b02e79d01a18e042 | def __init__(self):
'Remote data buffer for two processes to dump and recv data.\n Interacts with Market and BokehServer.\n This is probably not safe'
self.data = None
self.shutdown = 0 | Remote data buffer for two processes to dump and recv data.
Interacts with Market and BokehServer.
This is probably not safe | forge/blade/systems/visualizer/visualizer.py | __init__ | LYX0429/neural-mmo | 4 | python | def __init__(self):
'Remote data buffer for two processes to dump and recv data.\n Interacts with Market and BokehServer.\n This is probably not safe'
self.data = None
self.shutdown = 0 | def __init__(self):
'Remote data buffer for two processes to dump and recv data.\n Interacts with Market and BokehServer.\n This is probably not safe'
self.data = None
self.shutdown = 0<|docstring|>Remote data buffer for two processes to dump and recv data.
Interacts with Market and BokehServe... |
95a5ed26cfb8d487d457e2f41808eb1c8bb1157d1cc2c4caf00f47096ee942f4 | def getData(self):
'Get data from buffer\n Returns:\n data: From buffer\n '
data = self.data
self.data = None
return data | Get data from buffer
Returns:
data: From buffer | forge/blade/systems/visualizer/visualizer.py | getData | LYX0429/neural-mmo | 4 | python | def getData(self):
'Get data from buffer\n Returns:\n data: From buffer\n '
data = self.data
self.data = None
return data | def getData(self):
'Get data from buffer\n Returns:\n data: From buffer\n '
data = self.data
self.data = None
return data<|docstring|>Get data from buffer
Returns:
data: From buffer<|endoftext|> |
039ec34e5615f601b42a38047baff9831439f7982584785eb5faf228208981e0 | def setData(self, data):
'Set buffer data\n Args:\n data: To set buffer\n '
self.data = data.copy() | Set buffer data
Args:
data: To set buffer | forge/blade/systems/visualizer/visualizer.py | setData | LYX0429/neural-mmo | 4 | python | def setData(self, data):
'Set buffer data\n Args:\n data: To set buffer\n '
self.data = data.copy() | def setData(self, data):
'Set buffer data\n Args:\n data: To set buffer\n '
self.data = data.copy()<|docstring|>Set buffer data
Args:
data: To set buffer<|endoftext|> |
da64a3ae64f2074c3a3f341385fce968d3832a05a4045c727c1ac6e68b0a9eda | def switch_scale(attr, old, new):
"Callback for RadioButtonGroup to switch tick scale\n and refresh document\n Args:\n attr: variable to be changed, in this case 'active'\n old: old index of active button\n new: new index of active button\n ... | Callback for RadioButtonGroup to switch tick scale
and refresh document
Args:
attr: variable to be changed, in this case 'active'
old: old index of active button
new: new index of active button | forge/blade/systems/visualizer/visualizer.py | switch_scale | LYX0429/neural-mmo | 4 | python | def switch_scale(attr, old, new):
"Callback for RadioButtonGroup to switch tick scale\n and refresh document\n Args:\n attr: variable to be changed, in this case 'active'\n old: old index of active button\n new: new index of active button\n ... | def switch_scale(attr, old, new):
"Callback for RadioButtonGroup to switch tick scale\n and refresh document\n Args:\n attr: variable to be changed, in this case 'active'\n old: old index of active button\n new: new index of active button\n ... |
3206ea63ff836ad9d6f43a93f1b2c9db592c61050dde1bddbd269c06582f85ff | def learn(self):
'\n Performs numIters iterations with numEps episodes of self-play in each\n iteration. After every iteration, it retrains neural network with\n examples in trainExamples (which has a maximium length of maxlenofQueue).\n It then pits the new neural network against the ol... | Performs numIters iterations with numEps episodes of self-play in each
iteration. After every iteration, it retrains neural network with
examples in trainExamples (which has a maximium length of maxlenofQueue).
It then pits the new neural network against the old one and accepts it
only if it wins >= updateThreshold fra... | Coach.py | learn | danielvarga/alpha-zero-general | 0 | python | def learn(self):
'\n Performs numIters iterations with numEps episodes of self-play in each\n iteration. After every iteration, it retrains neural network with\n examples in trainExamples (which has a maximium length of maxlenofQueue).\n It then pits the new neural network against the ol... | def learn(self):
'\n Performs numIters iterations with numEps episodes of self-play in each\n iteration. After every iteration, it retrains neural network with\n examples in trainExamples (which has a maximium length of maxlenofQueue).\n It then pits the new neural network against the ol... |
f486fcc4a5e645644d38881afe05b66e1e0070987156154806b39456baa1b027 | def check_key():
'\n check TINY_KEY\n 代码中查找;文件中查找,没有的话,click装饰器会去环境变量中查找,再没有的话,提示用户手动输入\n :return:bool False:不需要用户输入;True:用户输入key\n '
_tiny_key = settings.TINY_KEY
if (not _tiny_key):
_tiny_key = os.environ.get('TINY_KEY')
if (_tiny_key is None):
if os.path.exists(set... | check TINY_KEY
代码中查找;文件中查找,没有的话,click装饰器会去环境变量中查找,再没有的话,提示用户手动输入
:return:bool False:不需要用户输入;True:用户输入key | scripts/yst.py | check_key | imoyao/PyTinyImg | 0 | python | def check_key():
'\n check TINY_KEY\n 代码中查找;文件中查找,没有的话,click装饰器会去环境变量中查找,再没有的话,提示用户手动输入\n :return:bool False:不需要用户输入;True:用户输入key\n '
_tiny_key = settings.TINY_KEY
if (not _tiny_key):
_tiny_key = os.environ.get('TINY_KEY')
if (_tiny_key is None):
if os.path.exists(set... | def check_key():
'\n check TINY_KEY\n 代码中查找;文件中查找,没有的话,click装饰器会去环境变量中查找,再没有的话,提示用户手动输入\n :return:bool False:不需要用户输入;True:用户输入key\n '
_tiny_key = settings.TINY_KEY
if (not _tiny_key):
_tiny_key = os.environ.get('TINY_KEY')
if (_tiny_key is None):
if os.path.exists(set... |
9dbc367204717250f5d56db0a83e32171244c2e6080530c3681086a27638ddd8 | def show_version(ctx, param, value):
'\n show the version\n :param ctx:\n :param param: del this will get: Warning: Invoked legacy parameter callback……\n :param value:\n :return:\n '
if ((not value) or ctx.resilient_parsing):
return
click.echo(settings.VERSION)
ctx.exit() | show the version
:param ctx:
:param param: del this will get: Warning: Invoked legacy parameter callback……
:param value:
:return: | scripts/yst.py | show_version | imoyao/PyTinyImg | 0 | python | def show_version(ctx, param, value):
'\n show the version\n :param ctx:\n :param param: del this will get: Warning: Invoked legacy parameter callback……\n :param value:\n :return:\n '
if ((not value) or ctx.resilient_parsing):
return
click.echo(settings.VERSION)
ctx.exit() | def show_version(ctx, param, value):
'\n show the version\n :param ctx:\n :param param: del this will get: Warning: Invoked legacy parameter callback……\n :param value:\n :return:\n '
if ((not value) or ctx.resilient_parsing):
return
click.echo(settings.VERSION)
ctx.exit()<|docs... |
1b37d03b4259bd0e0b1e16cf622f595d512f39ff13e32b1edeea8b918e70eb54 | def run(self):
"\n Build image inside current environment using imagebuilder;\n It's expected this may run within (privileged) docker container.\n\n Returns:\n BuildResult\n "
builder = self.workflow.builder
image = builder.image.to_str()
allow_repo_dir_in_dockerig... | Build image inside current environment using imagebuilder;
It's expected this may run within (privileged) docker container.
Returns:
BuildResult | atomic_reactor/plugins/build_imagebuilder.py | run | mkosiarc/atomic-reactor | 0 | python | def run(self):
"\n Build image inside current environment using imagebuilder;\n It's expected this may run within (privileged) docker container.\n\n Returns:\n BuildResult\n "
builder = self.workflow.builder
image = builder.image.to_str()
allow_repo_dir_in_dockerig... | def run(self):
"\n Build image inside current environment using imagebuilder;\n It's expected this may run within (privileged) docker container.\n\n Returns:\n BuildResult\n "
builder = self.workflow.builder
image = builder.image.to_str()
allow_repo_dir_in_dockerig... |
209d0076ee22914df44c4066529312cbc8f40f42efea78f6024dff8016f629c2 | def evaluate_central(self, dataset, state):
'\n Evaluates a model in central server mode.\n \n Arguments:\n dataset: tf Dataset, contains all the test set examples as a single \n tf Dataset.\n state: tff state, the federated training state of the model. ... | Evaluates a model in central server mode.
Arguments:
dataset: tf Dataset, contains all the test set examples as a single
tf Dataset.
state: tff state, the federated training state of the model.
Contains model weights
Returns:
accuracy of model in state on dataset provided | experiments.py | evaluate_central | r-o-s-h-a-n/semisupervisedFL | 5 | python | def evaluate_central(self, dataset, state):
'\n Evaluates a model in central server mode.\n \n Arguments:\n dataset: tf Dataset, contains all the test set examples as a single \n tf Dataset.\n state: tff state, the federated training state of the model. ... | def evaluate_central(self, dataset, state):
'\n Evaluates a model in central server mode.\n \n Arguments:\n dataset: tf Dataset, contains all the test set examples as a single \n tf Dataset.\n state: tff state, the federated training state of the model. ... |
2e64f03580629c31460288fd78b859c85d9009e2a40ca36f029d05a2e9ba30b8 | def evaluate_saved_model(self, dataset, model_fp=None):
'\n Evaluates trained model in central server mode.\n \n Arguments:\n dataset: tf Dataset, contains all the test set examples as a single \n tf Dataset.\n model_fp: str, if model filepath is provide... | Evaluates trained model in central server mode.
Arguments:
dataset: tf Dataset, contains all the test set examples as a single
tf Dataset.
model_fp: str, if model filepath is provided, it will load
the model from file and evaluate on that. Otherwise, will
evaluate the mod... | experiments.py | evaluate_saved_model | r-o-s-h-a-n/semisupervisedFL | 5 | python | def evaluate_saved_model(self, dataset, model_fp=None):
'\n Evaluates trained model in central server mode.\n \n Arguments:\n dataset: tf Dataset, contains all the test set examples as a single \n tf Dataset.\n model_fp: str, if model filepath is provide... | def evaluate_saved_model(self, dataset, model_fp=None):
'\n Evaluates trained model in central server mode.\n \n Arguments:\n dataset: tf Dataset, contains all the test set examples as a single \n tf Dataset.\n model_fp: str, if model filepath is provide... |
1adf3830ab39b2637c0808c950583f1eee3db8a8d0ffe8c6c9f085086e4b65f3 | def path(repo_ctx, additional_search_paths=[]):
'Return the value of the PATH environment variable that would be used by\n the which() command.'
search_paths = additional_search_paths
if (repo_ctx.os.name == 'mac os x'):
search_paths = (search_paths + ['/usr/local/bin'])
search_paths = (searc... | Return the value of the PATH environment variable that would be used by
the which() command. | third_party/drake_rules/execute.bzl | path | mingkaic/cortenn | 2 | python | def path(repo_ctx, additional_search_paths=[]):
'Return the value of the PATH environment variable that would be used by\n the which() command.'
search_paths = additional_search_paths
if (repo_ctx.os.name == 'mac os x'):
search_paths = (search_paths + ['/usr/local/bin'])
search_paths = (searc... | def path(repo_ctx, additional_search_paths=[]):
'Return the value of the PATH environment variable that would be used by\n the which() command.'
search_paths = additional_search_paths
if (repo_ctx.os.name == 'mac os x'):
search_paths = (search_paths + ['/usr/local/bin'])
search_paths = (searc... |
6ea742387c29d746f0494e040bd419bb0c1aa187bda3594ddafc0baa3aeb9c72 | def which(repo_ctx, program, additional_search_paths=[]):
"Return the path of the given program or None if there is no such program\n in the PATH as defined by the path() function above. The value of the\n user's PATH environment variable is ignored.\n "
exec_result = repo_ctx.execute(['which', program... | Return the path of the given program or None if there is no such program
in the PATH as defined by the path() function above. The value of the
user's PATH environment variable is ignored. | third_party/drake_rules/execute.bzl | which | mingkaic/cortenn | 2 | python | def which(repo_ctx, program, additional_search_paths=[]):
"Return the path of the given program or None if there is no such program\n in the PATH as defined by the path() function above. The value of the\n user's PATH environment variable is ignored.\n "
exec_result = repo_ctx.execute(['which', program... | def which(repo_ctx, program, additional_search_paths=[]):
"Return the path of the given program or None if there is no such program\n in the PATH as defined by the path() function above. The value of the\n user's PATH environment variable is ignored.\n "
exec_result = repo_ctx.execute(['which', program... |
d736d8f9cdb8f0ea856cf4537bf39dfb9a2caa5487eac9100fcbe23bbacca53f | def execute_and_return(repo_ctx, command, additional_search_paths=[]):
'Runs the `command` (list) and returns a status value. The return value\n is a struct with a field `error` that will be None on success or else a\n detailed message on command failure.\n '
if ('/' in command[0]):
program = ... | Runs the `command` (list) and returns a status value. The return value
is a struct with a field `error` that will be None on success or else a
detailed message on command failure. | third_party/drake_rules/execute.bzl | execute_and_return | mingkaic/cortenn | 2 | python | def execute_and_return(repo_ctx, command, additional_search_paths=[]):
'Runs the `command` (list) and returns a status value. The return value\n is a struct with a field `error` that will be None on success or else a\n detailed message on command failure.\n '
if ('/' in command[0]):
program = ... | def execute_and_return(repo_ctx, command, additional_search_paths=[]):
'Runs the `command` (list) and returns a status value. The return value\n is a struct with a field `error` that will be None on success or else a\n detailed message on command failure.\n '
if ('/' in command[0]):
program = ... |
6d665fc09b5f16a4d214dd58529713686644f5c41bb581681cfd6312222319ef | def execute_or_fail(repo_ctx, command):
'Runs the `command` (list) and immediately fails on any error.\n Returns a struct with the stdout value.'
result = execute_and_return(repo_ctx, command)
if result.error:
fail('Unable to complete setup for @{} repository: {}'.format(repo_ctx.name, result.err... | Runs the `command` (list) and immediately fails on any error.
Returns a struct with the stdout value. | third_party/drake_rules/execute.bzl | execute_or_fail | mingkaic/cortenn | 2 | python | def execute_or_fail(repo_ctx, command):
'Runs the `command` (list) and immediately fails on any error.\n Returns a struct with the stdout value.'
result = execute_and_return(repo_ctx, command)
if result.error:
fail('Unable to complete setup for @{} repository: {}'.format(repo_ctx.name, result.err... | def execute_or_fail(repo_ctx, command):
'Runs the `command` (list) and immediately fails on any error.\n Returns a struct with the stdout value.'
result = execute_and_return(repo_ctx, command)
if result.error:
fail('Unable to complete setup for @{} repository: {}'.format(repo_ctx.name, result.err... |
a38bde9f8ff6ce410a1cab6536fd72935bbc359b80f5b3373b12640dfe9bccf8 | def update_create_computations_fn_kwargs(arg_names: Iterable[Text], kwargs: Dict[(Text, Any)], eval_config: Optional[config_pb2.EvalConfig]=None, schema: Optional[schema_pb2.Schema]=None, model_names: Optional[List[Text]]=None, output_names: Optional[List[Text]]=None, sub_keys: Optional[List[Optional[SubKey]]]=None, ag... | Updates create_computations_fn kwargs based on arg spec.
Each metric's create_computations_fn is invoked with a variable set of
parameters, depending on the argument names of the callable. If an argument
name matches one of the reserved names, this function will update the kwargs
with the appropriate value for that ar... | tensorflow_model_analysis/metrics/metric_types.py | update_create_computations_fn_kwargs | jaymessina3/model-analysis | 1,118 | python | def update_create_computations_fn_kwargs(arg_names: Iterable[Text], kwargs: Dict[(Text, Any)], eval_config: Optional[config_pb2.EvalConfig]=None, schema: Optional[schema_pb2.Schema]=None, model_names: Optional[List[Text]]=None, output_names: Optional[List[Text]]=None, sub_keys: Optional[List[Optional[SubKey]]]=None, ag... | def update_create_computations_fn_kwargs(arg_names: Iterable[Text], kwargs: Dict[(Text, Any)], eval_config: Optional[config_pb2.EvalConfig]=None, schema: Optional[schema_pb2.Schema]=None, model_names: Optional[List[Text]]=None, output_names: Optional[List[Text]]=None, sub_keys: Optional[List[Optional[SubKey]]]=None, ag... |
eaa3daacb2c2c7c815c84dcd89e37b39b8ec91969e6a16fd77cb0ae4559a8be5 | def register_metric(cls: Type[Metric]):
'Registers metric under the list of standard TFMA metrics.'
_METRIC_OBJECTS[cls.__name__] = cls | Registers metric under the list of standard TFMA metrics. | tensorflow_model_analysis/metrics/metric_types.py | register_metric | jaymessina3/model-analysis | 1,118 | python | def register_metric(cls: Type[Metric]):
_METRIC_OBJECTS[cls.__name__] = cls | def register_metric(cls: Type[Metric]):
_METRIC_OBJECTS[cls.__name__] = cls<|docstring|>Registers metric under the list of standard TFMA metrics.<|endoftext|> |
44e1fb5f2d205326e13c4b11a040c47b1bf93bac5a75cb1b740a33a9927e6a25 | def registered_metrics() -> Dict[(Text, Type[Metric])]:
'Returns standard TFMA metrics.'
return copy.copy(_METRIC_OBJECTS) | Returns standard TFMA metrics. | tensorflow_model_analysis/metrics/metric_types.py | registered_metrics | jaymessina3/model-analysis | 1,118 | python | def registered_metrics() -> Dict[(Text, Type[Metric])]:
return copy.copy(_METRIC_OBJECTS) | def registered_metrics() -> Dict[(Text, Type[Metric])]:
return copy.copy(_METRIC_OBJECTS)<|docstring|>Returns standard TFMA metrics.<|endoftext|> |
f3fc400545294cce03840e2a33ccc81935f03e7a0b315dd00a484ae1d93a3ea1 | def InputPreprocessor(include_default_inputs: bool=False) -> StandardMetricInputsPreprocessor:
'Returns preprocessor for including raw inputs in StandardMetricInputs.\n\n Args:\n include_default_inputs: True to include default inputs (labels, predictions,\n example weights) in addition to the inputs.\n '
... | Returns preprocessor for including raw inputs in StandardMetricInputs.
Args:
include_default_inputs: True to include default inputs (labels, predictions,
example weights) in addition to the inputs. | tensorflow_model_analysis/metrics/metric_types.py | InputPreprocessor | jaymessina3/model-analysis | 1,118 | python | def InputPreprocessor(include_default_inputs: bool=False) -> StandardMetricInputsPreprocessor:
'Returns preprocessor for including raw inputs in StandardMetricInputs.\n\n Args:\n include_default_inputs: True to include default inputs (labels, predictions,\n example weights) in addition to the inputs.\n '
... | def InputPreprocessor(include_default_inputs: bool=False) -> StandardMetricInputsPreprocessor:
'Returns preprocessor for including raw inputs in StandardMetricInputs.\n\n Args:\n include_default_inputs: True to include default inputs (labels, predictions,\n example weights) in addition to the inputs.\n '
... |
a6cb1d437f74dd32c25978156304c78f95467d4732938b54a4490936171682cb | def FeaturePreprocessor(feature_keys: Iterable[Text], include_default_inputs: bool=True, model_names: Optional[Iterable[Text]]=None, output_names: Optional[Iterable[Text]]=None) -> StandardMetricInputsPreprocessor:
'Returns preprocessor for including features in StandardMetricInputs.\n\n Args:\n feature_keys: L... | Returns preprocessor for including features in StandardMetricInputs.
Args:
feature_keys: List of feature keys. An empty list means all.
include_default_inputs: True to include default inputs (labels, predictions,
example weights) in addition to the features.
model_names: Optional model names. Only used if in... | tensorflow_model_analysis/metrics/metric_types.py | FeaturePreprocessor | jaymessina3/model-analysis | 1,118 | python | def FeaturePreprocessor(feature_keys: Iterable[Text], include_default_inputs: bool=True, model_names: Optional[Iterable[Text]]=None, output_names: Optional[Iterable[Text]]=None) -> StandardMetricInputsPreprocessor:
'Returns preprocessor for including features in StandardMetricInputs.\n\n Args:\n feature_keys: L... | def FeaturePreprocessor(feature_keys: Iterable[Text], include_default_inputs: bool=True, model_names: Optional[Iterable[Text]]=None, output_names: Optional[Iterable[Text]]=None) -> StandardMetricInputsPreprocessor:
'Returns preprocessor for including features in StandardMetricInputs.\n\n Args:\n feature_keys: L... |
8ea9172cdde1db243aa56eee208fad14dc347a105fa702e7fd99f349bf573e2b | def TransformedFeaturePreprocessor(feature_keys: Iterable[Text], include_default_inputs: bool=True, model_names: Optional[Iterable[Text]]=None, output_names: Optional[Iterable[Text]]=None) -> StandardMetricInputsPreprocessor:
'Returns preprocessor for incl transformed features in StandardMetricInputs.\n\n Args:\n ... | Returns preprocessor for incl transformed features in StandardMetricInputs.
Args:
feature_keys: List of feature keys. An empty list means all.
include_default_inputs: True to include default inputs (labels, predictions,
example weights) in addition to the transformed features.
model_names: Optional model nam... | tensorflow_model_analysis/metrics/metric_types.py | TransformedFeaturePreprocessor | jaymessina3/model-analysis | 1,118 | python | def TransformedFeaturePreprocessor(feature_keys: Iterable[Text], include_default_inputs: bool=True, model_names: Optional[Iterable[Text]]=None, output_names: Optional[Iterable[Text]]=None) -> StandardMetricInputsPreprocessor:
'Returns preprocessor for incl transformed features in StandardMetricInputs.\n\n Args:\n ... | def TransformedFeaturePreprocessor(feature_keys: Iterable[Text], include_default_inputs: bool=True, model_names: Optional[Iterable[Text]]=None, output_names: Optional[Iterable[Text]]=None) -> StandardMetricInputsPreprocessor:
'Returns preprocessor for incl transformed features in StandardMetricInputs.\n\n Args:\n ... |
7331daddbe73a78576fb2e5b6a0241f0b60c500bae14b763cd26ad06834e18af | def AttributionPreprocessor(feature_keys: Iterable[Text], include_default_inputs: bool=True, model_names: Optional[Iterable[Text]]=None, output_names: Optional[Iterable[Text]]=None) -> StandardMetricInputsPreprocessor:
'Returns preprocessor for including attributions in StandardMetricInputs.\n\n Args:\n feature... | Returns preprocessor for including attributions in StandardMetricInputs.
Args:
feature_keys: List of feature keys under attributions to keep. An empty list
means all.
include_default_inputs: True to include default inputs (labels, predictions,
example weights) in addition to the transformed features.
mod... | tensorflow_model_analysis/metrics/metric_types.py | AttributionPreprocessor | jaymessina3/model-analysis | 1,118 | python | def AttributionPreprocessor(feature_keys: Iterable[Text], include_default_inputs: bool=True, model_names: Optional[Iterable[Text]]=None, output_names: Optional[Iterable[Text]]=None) -> StandardMetricInputsPreprocessor:
'Returns preprocessor for including attributions in StandardMetricInputs.\n\n Args:\n feature... | def AttributionPreprocessor(feature_keys: Iterable[Text], include_default_inputs: bool=True, model_names: Optional[Iterable[Text]]=None, output_names: Optional[Iterable[Text]]=None) -> StandardMetricInputsPreprocessor:
'Returns preprocessor for including attributions in StandardMetricInputs.\n\n Args:\n feature... |
d63f498c2abc21b7404a79406efb109cf2d70c972defe59255e577571e924c7a | def StandardMetricInputsPreprocessorList(preprocessors: List[StandardMetricInputsPreprocessor]) -> StandardMetricInputsPreprocessor:
'Returns preprocessor combining multiple standard preprocessors together.\n\n Args:\n preprocessors: List of StandardMetricInputsPreprocessors. Must be of type\n StandardMetr... | Returns preprocessor combining multiple standard preprocessors together.
Args:
preprocessors: List of StandardMetricInputsPreprocessors. Must be of type
StandardMetricInputsPreprocessor (subclasses not supported). | tensorflow_model_analysis/metrics/metric_types.py | StandardMetricInputsPreprocessorList | jaymessina3/model-analysis | 1,118 | python | def StandardMetricInputsPreprocessorList(preprocessors: List[StandardMetricInputsPreprocessor]) -> StandardMetricInputsPreprocessor:
'Returns preprocessor combining multiple standard preprocessors together.\n\n Args:\n preprocessors: List of StandardMetricInputsPreprocessors. Must be of type\n StandardMetr... | def StandardMetricInputsPreprocessorList(preprocessors: List[StandardMetricInputsPreprocessor]) -> StandardMetricInputsPreprocessor:
'Returns preprocessor combining multiple standard preprocessors together.\n\n Args:\n preprocessors: List of StandardMetricInputsPreprocessors. Must be of type\n StandardMetr... |
514a527692f2bf309951ff686199b64f93e7c2d63181e7ab572500a833919191 | def to_proto(self) -> metrics_for_slice_pb2.SubKey:
'Converts key to proto.'
sub_key = metrics_for_slice_pb2.SubKey()
if (self.class_id is not None):
sub_key.class_id.value = self.class_id
if (self.k is not None):
sub_key.k.value = self.k
if (self.top_k is not None):
sub_key.... | Converts key to proto. | tensorflow_model_analysis/metrics/metric_types.py | to_proto | jaymessina3/model-analysis | 1,118 | python | def to_proto(self) -> metrics_for_slice_pb2.SubKey:
sub_key = metrics_for_slice_pb2.SubKey()
if (self.class_id is not None):
sub_key.class_id.value = self.class_id
if (self.k is not None):
sub_key.k.value = self.k
if (self.top_k is not None):
sub_key.top_k.value = self.top_k... | def to_proto(self) -> metrics_for_slice_pb2.SubKey:
sub_key = metrics_for_slice_pb2.SubKey()
if (self.class_id is not None):
sub_key.class_id.value = self.class_id
if (self.k is not None):
sub_key.k.value = self.k
if (self.top_k is not None):
sub_key.top_k.value = self.top_k... |
74d50e385d8297cb0d78addf3bc1f596fb56ec5b0fd7d5d9efae28c5971602eb | @staticmethod
def from_proto(pb: metrics_for_slice_pb2.SubKey) -> Optional['SubKey']:
'Creates class from proto.'
class_id = None
if pb.HasField('class_id'):
class_id = pb.class_id.value
k = None
if pb.HasField('k'):
k = pb.k.value
top_k = None
if pb.HasField('top_k'):
... | Creates class from proto. | tensorflow_model_analysis/metrics/metric_types.py | from_proto | jaymessina3/model-analysis | 1,118 | python | @staticmethod
def from_proto(pb: metrics_for_slice_pb2.SubKey) -> Optional['SubKey']:
class_id = None
if pb.HasField('class_id'):
class_id = pb.class_id.value
k = None
if pb.HasField('k'):
k = pb.k.value
top_k = None
if pb.HasField('top_k'):
top_k = pb.top_k.value
... | @staticmethod
def from_proto(pb: metrics_for_slice_pb2.SubKey) -> Optional['SubKey']:
class_id = None
if pb.HasField('class_id'):
class_id = pb.class_id.value
k = None
if pb.HasField('k'):
k = pb.k.value
top_k = None
if pb.HasField('top_k'):
top_k = pb.top_k.value
... |
00b71c635498c322efa4038250ed794109da7ddced1f365426dffb8c65f5c1ee | def to_proto(self) -> metrics_for_slice_pb2.AggregationType:
'Converts key to proto.'
aggregration_type = metrics_for_slice_pb2.AggregationType()
if (self.micro_average is not None):
aggregration_type.micro_average = True
if (self.macro_average is not None):
aggregration_type.macro_avera... | Converts key to proto. | tensorflow_model_analysis/metrics/metric_types.py | to_proto | jaymessina3/model-analysis | 1,118 | python | def to_proto(self) -> metrics_for_slice_pb2.AggregationType:
aggregration_type = metrics_for_slice_pb2.AggregationType()
if (self.micro_average is not None):
aggregration_type.micro_average = True
if (self.macro_average is not None):
aggregration_type.macro_average = True
if (self.w... | def to_proto(self) -> metrics_for_slice_pb2.AggregationType:
aggregration_type = metrics_for_slice_pb2.AggregationType()
if (self.micro_average is not None):
aggregration_type.micro_average = True
if (self.macro_average is not None):
aggregration_type.macro_average = True
if (self.w... |
77a0779851d982b214c022cb2da60c2a1ce52a701f4d45d8c62cfc662b06ce15 | @staticmethod
def from_proto(pb: metrics_for_slice_pb2.AggregationType) -> Optional['AggregationType']:
'Creates class from proto.'
if (pb.micro_average or pb.macro_average or pb.weighted_macro_average):
return AggregationType(micro_average=(pb.micro_average or None), macro_average=(pb.macro_average or ... | Creates class from proto. | tensorflow_model_analysis/metrics/metric_types.py | from_proto | jaymessina3/model-analysis | 1,118 | python | @staticmethod
def from_proto(pb: metrics_for_slice_pb2.AggregationType) -> Optional['AggregationType']:
if (pb.micro_average or pb.macro_average or pb.weighted_macro_average):
return AggregationType(micro_average=(pb.micro_average or None), macro_average=(pb.macro_average or None), weighted_macro_avera... | @staticmethod
def from_proto(pb: metrics_for_slice_pb2.AggregationType) -> Optional['AggregationType']:
if (pb.micro_average or pb.macro_average or pb.weighted_macro_average):
return AggregationType(micro_average=(pb.micro_average or None), macro_average=(pb.macro_average or None), weighted_macro_avera... |
2dfead7cd95ebc69d270b37b7cb98a278f3e59b08789e2fa320fe859df678ed0 | def to_proto(self) -> metrics_for_slice_pb2.MetricKey:
'Converts key to proto.'
metric_key = metrics_for_slice_pb2.MetricKey()
if self.name:
metric_key.name = self.name
if self.model_name:
metric_key.model_name = self.model_name
if self.output_name:
metric_key.output_name = s... | Converts key to proto. | tensorflow_model_analysis/metrics/metric_types.py | to_proto | jaymessina3/model-analysis | 1,118 | python | def to_proto(self) -> metrics_for_slice_pb2.MetricKey:
metric_key = metrics_for_slice_pb2.MetricKey()
if self.name:
metric_key.name = self.name
if self.model_name:
metric_key.model_name = self.model_name
if self.output_name:
metric_key.output_name = self.output_name
if s... | def to_proto(self) -> metrics_for_slice_pb2.MetricKey:
metric_key = metrics_for_slice_pb2.MetricKey()
if self.name:
metric_key.name = self.name
if self.model_name:
metric_key.model_name = self.model_name
if self.output_name:
metric_key.output_name = self.output_name
if s... |
f92d649cab5127b2ff39af04132f8def5c16c2a3045bf69d19c8e41340708504 | @staticmethod
def from_proto(pb: metrics_for_slice_pb2.MetricKey) -> 'MetricKey':
'Configures class from proto.'
return MetricKey(name=pb.name, model_name=pb.model_name, output_name=pb.output_name, sub_key=SubKey.from_proto(pb.sub_key), aggregation_type=AggregationType.from_proto(pb.aggregation_type), is_diff=p... | Configures class from proto. | tensorflow_model_analysis/metrics/metric_types.py | from_proto | jaymessina3/model-analysis | 1,118 | python | @staticmethod
def from_proto(pb: metrics_for_slice_pb2.MetricKey) -> 'MetricKey':
return MetricKey(name=pb.name, model_name=pb.model_name, output_name=pb.output_name, sub_key=SubKey.from_proto(pb.sub_key), aggregation_type=AggregationType.from_proto(pb.aggregation_type), is_diff=pb.is_diff) | @staticmethod
def from_proto(pb: metrics_for_slice_pb2.MetricKey) -> 'MetricKey':
return MetricKey(name=pb.name, model_name=pb.model_name, output_name=pb.output_name, sub_key=SubKey.from_proto(pb.sub_key), aggregation_type=AggregationType.from_proto(pb.aggregation_type), is_diff=pb.is_diff)<|docstring|>Configu... |
797bee3df2d00ab5d0d9533e9e3a3d9635b98af89b97b3b3fb0bc1e54fd1ff54 | def to_proto(self) -> metrics_for_slice_pb2.PlotKey:
'Converts key to proto.'
plot_key = metrics_for_slice_pb2.PlotKey()
if self.name:
raise ValueError('plot values must be combined into a single proto andstored under a plot key without a name')
if self.model_name:
plot_key.model_name = ... | Converts key to proto. | tensorflow_model_analysis/metrics/metric_types.py | to_proto | jaymessina3/model-analysis | 1,118 | python | def to_proto(self) -> metrics_for_slice_pb2.PlotKey:
plot_key = metrics_for_slice_pb2.PlotKey()
if self.name:
raise ValueError('plot values must be combined into a single proto andstored under a plot key without a name')
if self.model_name:
plot_key.model_name = self.model_name
if s... | def to_proto(self) -> metrics_for_slice_pb2.PlotKey:
plot_key = metrics_for_slice_pb2.PlotKey()
if self.name:
raise ValueError('plot values must be combined into a single proto andstored under a plot key without a name')
if self.model_name:
plot_key.model_name = self.model_name
if s... |
00930b216965987f280e99b98fb2fc1440fdd72591ac38046b8c4277aff31648 | @staticmethod
def from_proto(pb: metrics_for_slice_pb2.PlotKey) -> 'PlotKey':
'Configures class from proto.'
return PlotKey(name='', model_name=pb.model_name, output_name=pb.output_name, sub_key=SubKey.from_proto(pb.sub_key)) | Configures class from proto. | tensorflow_model_analysis/metrics/metric_types.py | from_proto | jaymessina3/model-analysis | 1,118 | python | @staticmethod
def from_proto(pb: metrics_for_slice_pb2.PlotKey) -> 'PlotKey':
return PlotKey(name=, model_name=pb.model_name, output_name=pb.output_name, sub_key=SubKey.from_proto(pb.sub_key)) | @staticmethod
def from_proto(pb: metrics_for_slice_pb2.PlotKey) -> 'PlotKey':
return PlotKey(name=, model_name=pb.model_name, output_name=pb.output_name, sub_key=SubKey.from_proto(pb.sub_key))<|docstring|>Configures class from proto.<|endoftext|> |
587c450fee07fbd9047cea05974369513ff54139ebcb06c08fee2910137a77d6 | def to_proto(self) -> metrics_for_slice_pb2.AttributionsKey:
'Converts key to proto.'
attribution_key = metrics_for_slice_pb2.AttributionsKey()
if self.name:
attribution_key.name = self.name
if self.model_name:
attribution_key.model_name = self.model_name
if self.output_name:
... | Converts key to proto. | tensorflow_model_analysis/metrics/metric_types.py | to_proto | jaymessina3/model-analysis | 1,118 | python | def to_proto(self) -> metrics_for_slice_pb2.AttributionsKey:
attribution_key = metrics_for_slice_pb2.AttributionsKey()
if self.name:
attribution_key.name = self.name
if self.model_name:
attribution_key.model_name = self.model_name
if self.output_name:
attribution_key.output_... | def to_proto(self) -> metrics_for_slice_pb2.AttributionsKey:
attribution_key = metrics_for_slice_pb2.AttributionsKey()
if self.name:
attribution_key.name = self.name
if self.model_name:
attribution_key.model_name = self.model_name
if self.output_name:
attribution_key.output_... |
2be0303e5079ec8a2d9252e4b8e7508afa165ec4828ae1e07ba9a729a582b884 | @staticmethod
def from_proto(pb: metrics_for_slice_pb2.AttributionsKey) -> 'AttributionsKey':
'Configures class from proto.'
return AttributionsKey(name=pb.name, model_name=pb.model_name, output_name=pb.output_name, sub_key=SubKey.from_proto(pb.sub_key)) | Configures class from proto. | tensorflow_model_analysis/metrics/metric_types.py | from_proto | jaymessina3/model-analysis | 1,118 | python | @staticmethod
def from_proto(pb: metrics_for_slice_pb2.AttributionsKey) -> 'AttributionsKey':
return AttributionsKey(name=pb.name, model_name=pb.model_name, output_name=pb.output_name, sub_key=SubKey.from_proto(pb.sub_key)) | @staticmethod
def from_proto(pb: metrics_for_slice_pb2.AttributionsKey) -> 'AttributionsKey':
return AttributionsKey(name=pb.name, model_name=pb.model_name, output_name=pb.output_name, sub_key=SubKey.from_proto(pb.sub_key))<|docstring|>Configures class from proto.<|endoftext|> |
3be57738be6b4dab359f8895a292bdb3231ae1e63779a7ccb4eed0f51385fea3 | def __init__(self, create_computations_fn: Callable[(..., MetricComputations)], **kwargs):
'Initializes metric.\n\n Args:\n create_computations_fn: Function to create the metrics computations (e.g.\n mean_label, etc). This function should take the args passed to __init__\n as as input along wi... | Initializes metric.
Args:
create_computations_fn: Function to create the metrics computations (e.g.
mean_label, etc). This function should take the args passed to __init__
as as input along with any of eval_config, schema, model_names,
output_names, sub_keys, aggregation_type, or query_key (where needed)... | tensorflow_model_analysis/metrics/metric_types.py | __init__ | jaymessina3/model-analysis | 1,118 | python | def __init__(self, create_computations_fn: Callable[(..., MetricComputations)], **kwargs):
'Initializes metric.\n\n Args:\n create_computations_fn: Function to create the metrics computations (e.g.\n mean_label, etc). This function should take the args passed to __init__\n as as input along wi... | def __init__(self, create_computations_fn: Callable[(..., MetricComputations)], **kwargs):
'Initializes metric.\n\n Args:\n create_computations_fn: Function to create the metrics computations (e.g.\n mean_label, etc). This function should take the args passed to __init__\n as as input along wi... |
89477ac96d00ee4ef1253e18fc551418a7585d8378e85143a8d6a861904b85be | def get_config(self) -> Dict[(Text, Any)]:
'Returns serializable config.'
return self.kwargs | Returns serializable config. | tensorflow_model_analysis/metrics/metric_types.py | get_config | jaymessina3/model-analysis | 1,118 | python | def get_config(self) -> Dict[(Text, Any)]:
return self.kwargs | def get_config(self) -> Dict[(Text, Any)]:
return self.kwargs<|docstring|>Returns serializable config.<|endoftext|> |
02443b5486556b92195d41fd0fcbdb51cce11ec52548a6d69688efa3960dff7a | @property
def compute_confidence_interval(self) -> bool:
'Whether to compute confidence intervals for this metric.\n\n Note that this may not completely remove the computational overhead\n involved in computing a given metric. This is only respected by the\n jackknife confidence interval method.\n\n Ret... | Whether to compute confidence intervals for this metric.
Note that this may not completely remove the computational overhead
involved in computing a given metric. This is only respected by the
jackknife confidence interval method.
Returns:
Whether to compute confidence intervals for this metric. | tensorflow_model_analysis/metrics/metric_types.py | compute_confidence_interval | jaymessina3/model-analysis | 1,118 | python | @property
def compute_confidence_interval(self) -> bool:
'Whether to compute confidence intervals for this metric.\n\n Note that this may not completely remove the computational overhead\n involved in computing a given metric. This is only respected by the\n jackknife confidence interval method.\n\n Ret... | @property
def compute_confidence_interval(self) -> bool:
'Whether to compute confidence intervals for this metric.\n\n Note that this may not completely remove the computational overhead\n involved in computing a given metric. This is only respected by the\n jackknife confidence interval method.\n\n Ret... |
f515fe8ea035a71f862c5626bd5f5f94ff84086e9230b37e441ef4fdb3b3b863 | def computations(self, eval_config: Optional[config_pb2.EvalConfig]=None, schema: Optional[schema_pb2.Schema]=None, model_names: Optional[List[Text]]=None, output_names: Optional[List[Text]]=None, sub_keys: Optional[List[Optional[SubKey]]]=None, aggregation_type: Optional[AggregationType]=None, class_weights: Optional[... | Creates computations associated with metric. | tensorflow_model_analysis/metrics/metric_types.py | computations | jaymessina3/model-analysis | 1,118 | python | def computations(self, eval_config: Optional[config_pb2.EvalConfig]=None, schema: Optional[schema_pb2.Schema]=None, model_names: Optional[List[Text]]=None, output_names: Optional[List[Text]]=None, sub_keys: Optional[List[Optional[SubKey]]]=None, aggregation_type: Optional[AggregationType]=None, class_weights: Optional[... | def computations(self, eval_config: Optional[config_pb2.EvalConfig]=None, schema: Optional[schema_pb2.Schema]=None, model_names: Optional[List[Text]]=None, output_names: Optional[List[Text]]=None, sub_keys: Optional[List[Optional[SubKey]]]=None, aggregation_type: Optional[AggregationType]=None, class_weights: Optional[... |
8221e00d24c4f375c6b820d368d07d1ad38b6a2455dc881490824ea337f3875f | @property
def label(self) -> Optional[types.TensorValueMaybeMultiLevelDict]:
'Same as labels (DEPRECATED - use labels).'
return self.get_labels() | Same as labels (DEPRECATED - use labels). | tensorflow_model_analysis/metrics/metric_types.py | label | jaymessina3/model-analysis | 1,118 | python | @property
def label(self) -> Optional[types.TensorValueMaybeMultiLevelDict]:
return self.get_labels() | @property
def label(self) -> Optional[types.TensorValueMaybeMultiLevelDict]:
return self.get_labels()<|docstring|>Same as labels (DEPRECATED - use labels).<|endoftext|> |
bb196a80ee1edffe967210bd3c8441460590700cfdc8b390e0749a394f5cfa81 | @property
def prediction(self) -> Optional[types.TensorValueMaybeMultiLevelDict]:
'Same as predictions (DEPRECATED - use predictions).'
return self.get_predictions() | Same as predictions (DEPRECATED - use predictions). | tensorflow_model_analysis/metrics/metric_types.py | prediction | jaymessina3/model-analysis | 1,118 | python | @property
def prediction(self) -> Optional[types.TensorValueMaybeMultiLevelDict]:
return self.get_predictions() | @property
def prediction(self) -> Optional[types.TensorValueMaybeMultiLevelDict]:
return self.get_predictions()<|docstring|>Same as predictions (DEPRECATED - use predictions).<|endoftext|> |
6516503272130855decee728e087e3ca7349db4763b131dfdfea65938f43c178 | @property
def example_weight(self) -> Optional[types.TensorValueMaybeMultiLevelDict]:
'Same as example_weights (DEPRECATED - use example_weights).'
return self.get_example_weights() | Same as example_weights (DEPRECATED - use example_weights). | tensorflow_model_analysis/metrics/metric_types.py | example_weight | jaymessina3/model-analysis | 1,118 | python | @property
def example_weight(self) -> Optional[types.TensorValueMaybeMultiLevelDict]:
return self.get_example_weights() | @property
def example_weight(self) -> Optional[types.TensorValueMaybeMultiLevelDict]:
return self.get_example_weights()<|docstring|>Same as example_weights (DEPRECATED - use example_weights).<|endoftext|> |
f494c4a30394e33d29eeb2f10bec8603f9c40cea37b3a57dd3b39506ea5afbd4 | def __init__(self, include_filter: Optional[Union[(Iterable[Text], Dict[(Text, Any)])]]=None, include_default_inputs: bool=True, model_names: Optional[Iterable[Text]]=None, output_names: Optional[Iterable[Text]]=None):
"Initializes preprocessor.\n\n Args:\n include_filter: Optional list or map of extracts k... | Initializes preprocessor.
Args:
include_filter: Optional list or map of extracts keys to include in
output. If a map of keys is passed then the keys and sub-keys that exist
in the map will be included in the output. An empty dict behaves as a
wildcard matching all keys or the value itself. Since matching... | tensorflow_model_analysis/metrics/metric_types.py | __init__ | jaymessina3/model-analysis | 1,118 | python | def __init__(self, include_filter: Optional[Union[(Iterable[Text], Dict[(Text, Any)])]]=None, include_default_inputs: bool=True, model_names: Optional[Iterable[Text]]=None, output_names: Optional[Iterable[Text]]=None):
"Initializes preprocessor.\n\n Args:\n include_filter: Optional list or map of extracts k... | def __init__(self, include_filter: Optional[Union[(Iterable[Text], Dict[(Text, Any)])]]=None, include_default_inputs: bool=True, model_names: Optional[Iterable[Text]]=None, output_names: Optional[Iterable[Text]]=None):
"Initializes preprocessor.\n\n Args:\n include_filter: Optional list or map of extracts k... |
de36835b3d7d43ebc133b90f0cc6c1ac4e8d743ea5552c8e7fdef2ebe531bdd9 | def includeme(config):
" Set up standard configurator registrations. Use via:\n\n .. code-block:: python\n\n config = Configurator()\n config.include('pyramid_keystone')\n\n "
def register():
registry = config.registry
settings = parse_settings(registry.settings)
regi... | Set up standard configurator registrations. Use via:
.. code-block:: python
config = Configurator()
config.include('pyramid_keystone') | pyramid_keystone/__init__.py | includeme | bertjwregeer/pyramid_keystone | 0 | python | def includeme(config):
" Set up standard configurator registrations. Use via:\n\n .. code-block:: python\n\n config = Configurator()\n config.include('pyramid_keystone')\n\n "
def register():
registry = config.registry
settings = parse_settings(registry.settings)
regi... | def includeme(config):
" Set up standard configurator registrations. Use via:\n\n .. code-block:: python\n\n config = Configurator()\n config.include('pyramid_keystone')\n\n "
def register():
registry = config.registry
settings = parse_settings(registry.settings)
regi... |
6cc8678acce51ac876a05416a991db7c1ec5f6e301fcb5d3ced8d0dc16e4cf0d | def set_as_anonymous(self):
'Removes all IPs from the whitelist.'
self.testbed.setup_env(USER_EMAIL='', overwrite=True)
auth.ip_whitelist_key(auth.bots_ip_whitelist()).delete()
auth_testing.reset_local_state()
auth_testing.mock_get_current_identity(self, auth.Anonymous) | Removes all IPs from the whitelist. | appengine/swarming/test_env_handlers.py | set_as_anonymous | Swift1313/luci-py | 0 | python | def set_as_anonymous(self):
self.testbed.setup_env(USER_EMAIL=, overwrite=True)
auth.ip_whitelist_key(auth.bots_ip_whitelist()).delete()
auth_testing.reset_local_state()
auth_testing.mock_get_current_identity(self, auth.Anonymous) | def set_as_anonymous(self):
self.testbed.setup_env(USER_EMAIL=, overwrite=True)
auth.ip_whitelist_key(auth.bots_ip_whitelist()).delete()
auth_testing.reset_local_state()
auth_testing.mock_get_current_identity(self, auth.Anonymous)<|docstring|>Removes all IPs from the whitelist.<|endoftext|> |
d1ba39cf8aedab7bed91a8783755dfc5e437aab2892201a363a4133710fd8926 | def get_xsrf_token(self):
'Gets the generic XSRF token for web clients.'
resp = self.auth_app.post('/auth/api/v1/accounts/self/xsrf_token', headers={'X-XSRF-Token-Request': '1'}).json
return resp['xsrf_token'].encode('ascii') | Gets the generic XSRF token for web clients. | appengine/swarming/test_env_handlers.py | get_xsrf_token | Swift1313/luci-py | 0 | python | def get_xsrf_token(self):
resp = self.auth_app.post('/auth/api/v1/accounts/self/xsrf_token', headers={'X-XSRF-Token-Request': '1'}).json
return resp['xsrf_token'].encode('ascii') | def get_xsrf_token(self):
resp = self.auth_app.post('/auth/api/v1/accounts/self/xsrf_token', headers={'X-XSRF-Token-Request': '1'}).json
return resp['xsrf_token'].encode('ascii')<|docstring|>Gets the generic XSRF token for web clients.<|endoftext|> |
be73f0f1e427f226044fc5b76c7fddec0ab3aa710a28baa6baccc00d4b290b36 | def post_json(self, url, params, **kwargs):
'Does an HTTP POST with a JSON API and return JSON response.'
return self.app.post_json(url, params=params, **kwargs).json | Does an HTTP POST with a JSON API and return JSON response. | appengine/swarming/test_env_handlers.py | post_json | Swift1313/luci-py | 0 | python | def post_json(self, url, params, **kwargs):
return self.app.post_json(url, params=params, **kwargs).json | def post_json(self, url, params, **kwargs):
return self.app.post_json(url, params=params, **kwargs).json<|docstring|>Does an HTTP POST with a JSON API and return JSON response.<|endoftext|> |
feab837273acd36ceabe23b8ce66c7a69bc56c78f782fdcb1f1bd4b6c0ddd108 | def mock_task_service_accounts(self, exc=None):
'Mocks support for task-associated service accounts.'
self.mock(service_accounts, 'has_token_server', (lambda : True))
calls = []
def mocked(service_account, validity_duration):
calls.append((service_account, validity_duration))
if exc:
... | Mocks support for task-associated service accounts. | appengine/swarming/test_env_handlers.py | mock_task_service_accounts | Swift1313/luci-py | 0 | python | def mock_task_service_accounts(self, exc=None):
self.mock(service_accounts, 'has_token_server', (lambda : True))
calls = []
def mocked(service_account, validity_duration):
calls.append((service_account, validity_duration))
if exc:
raise exc
return ('token-grant-%s-%... | def mock_task_service_accounts(self, exc=None):
self.mock(service_accounts, 'has_token_server', (lambda : True))
calls = []
def mocked(service_account, validity_duration):
calls.append((service_account, validity_duration))
if exc:
raise exc
return ('token-grant-%s-%... |
9b389ea304a455d15f9194e0c2e97cbf37f5dadff55108bddba8970bcf87002c | def mock_default_pool_acl(self, service_accounts):
"Mocks ACLs of 'default' pool to allow usage of given service accounts."
assert isinstance(service_accounts, (list, tuple)), service_accounts
def mocked_fetch_pools_config():
default_isolate = pools_config.IsolateServer(server='https://pool.config.... | Mocks ACLs of 'default' pool to allow usage of given service accounts. | appengine/swarming/test_env_handlers.py | mock_default_pool_acl | Swift1313/luci-py | 0 | python | def mock_default_pool_acl(self, service_accounts):
assert isinstance(service_accounts, (list, tuple)), service_accounts
def mocked_fetch_pools_config():
default_isolate = pools_config.IsolateServer(server='https://pool.config.isolate.example.com', namespace='default-gzip')
default_cipd = p... | def mock_default_pool_acl(self, service_accounts):
assert isinstance(service_accounts, (list, tuple)), service_accounts
def mocked_fetch_pools_config():
default_isolate = pools_config.IsolateServer(server='https://pool.config.isolate.example.com', namespace='default-gzip')
default_cipd = p... |
a2364978af606f16ca4c2291a35558bee615a885dabaafe13ce650011060828e | def do_handshake(self, bot='bot1'):
'Performs bot handshake, returns data to be sent to bot handlers.\n\n Also populates self.bot_version.\n '
params = {'dimensions': {'id': [bot], 'os': ['Amiga'], 'pool': ['default']}, 'state': {'running_time': 1234.0, 'sleep_streak': 0, 'started_ts': 1410990411.111}, 'v... | Performs bot handshake, returns data to be sent to bot handlers.
Also populates self.bot_version. | appengine/swarming/test_env_handlers.py | do_handshake | Swift1313/luci-py | 0 | python | def do_handshake(self, bot='bot1'):
'Performs bot handshake, returns data to be sent to bot handlers.\n\n Also populates self.bot_version.\n '
params = {'dimensions': {'id': [bot], 'os': ['Amiga'], 'pool': ['default']}, 'state': {'running_time': 1234.0, 'sleep_streak': 0, 'started_ts': 1410990411.111}, 'v... | def do_handshake(self, bot='bot1'):
'Performs bot handshake, returns data to be sent to bot handlers.\n\n Also populates self.bot_version.\n '
params = {'dimensions': {'id': [bot], 'os': ['Amiga'], 'pool': ['default']}, 'state': {'running_time': 1234.0, 'sleep_streak': 0, 'started_ts': 1410990411.111}, 'v... |
ac1143581c217770268a8c3dcc4b023abdd4384c24a8b46d5df911ff064172ff | def bot_poll(self, bot='bot1', params=None):
'Simulates a bot that polls for task.'
if (not params):
params = self.do_handshake(bot)
return self.post_json('/swarming/api/v1/bot/poll', params) | Simulates a bot that polls for task. | appengine/swarming/test_env_handlers.py | bot_poll | Swift1313/luci-py | 0 | python | def bot_poll(self, bot='bot1', params=None):
if (not params):
params = self.do_handshake(bot)
return self.post_json('/swarming/api/v1/bot/poll', params) | def bot_poll(self, bot='bot1', params=None):
if (not params):
params = self.do_handshake(bot)
return self.post_json('/swarming/api/v1/bot/poll', params)<|docstring|>Simulates a bot that polls for task.<|endoftext|> |
8a1ea0af904cb90d2c3212758e12d10799e27e8eb52a245a70849779184255cf | @staticmethod
def create_props(**kwargs):
'Returns a serialized swarming_rpcs.TaskProperties.'
out = {u'cipd_input': {u'client_package': {u'package_name': u'infra/tools/cipd/${platform}', u'version': u'git_revision:deadbeef'}, u'packages': [{u'package_name': u'rm', u'path': u'bin', u'version': u'git_revision:de... | Returns a serialized swarming_rpcs.TaskProperties. | appengine/swarming/test_env_handlers.py | create_props | Swift1313/luci-py | 0 | python | @staticmethod
def create_props(**kwargs):
out = {u'cipd_input': {u'client_package': {u'package_name': u'infra/tools/cipd/${platform}', u'version': u'git_revision:deadbeef'}, u'packages': [{u'package_name': u'rm', u'path': u'bin', u'version': u'git_revision:deadbeef'}], u'server': u'https://pool.config.cipd.exa... | @staticmethod
def create_props(**kwargs):
out = {u'cipd_input': {u'client_package': {u'package_name': u'infra/tools/cipd/${platform}', u'version': u'git_revision:deadbeef'}, u'packages': [{u'package_name': u'rm', u'path': u'bin', u'version': u'git_revision:deadbeef'}], u'server': u'https://pool.config.cipd.exa... |
845bcfe0ea0a835a8636154b7d0964373bb2e7b59bc0cab91541feaa21954193 | def create_new_request(self, **kwargs):
'Returns an initialized swarming_rpcs.TaskNewRequest.\n\n Useful to use a swarming_rpcs.TaskSlice.\n '
out = {'expiration_secs': ((24 * 60) * 60), 'name': 'job1', 'priority': 20, 'tags': [u'a:tag'], 'user': 'joe@localhost'}
out.update(((unicode(k), v) for (k, v)... | Returns an initialized swarming_rpcs.TaskNewRequest.
Useful to use a swarming_rpcs.TaskSlice. | appengine/swarming/test_env_handlers.py | create_new_request | Swift1313/luci-py | 0 | python | def create_new_request(self, **kwargs):
'Returns an initialized swarming_rpcs.TaskNewRequest.\n\n Useful to use a swarming_rpcs.TaskSlice.\n '
out = {'expiration_secs': ((24 * 60) * 60), 'name': 'job1', 'priority': 20, 'tags': [u'a:tag'], 'user': 'joe@localhost'}
out.update(((unicode(k), v) for (k, v)... | def create_new_request(self, **kwargs):
'Returns an initialized swarming_rpcs.TaskNewRequest.\n\n Useful to use a swarming_rpcs.TaskSlice.\n '
out = {'expiration_secs': ((24 * 60) * 60), 'name': 'job1', 'priority': 20, 'tags': [u'a:tag'], 'user': 'joe@localhost'}
out.update(((unicode(k), v) for (k, v)... |
3e8971f4cce12994ea539c676f605e5b1884943c11626ddf2d49db7c4da8ef6d | def client_create_task(self, **kwargs):
'Creates a minimal task request via the Cloud Endpoints API.'
request = self.create_new_request(**kwargs)
response = self.endpoint_call(handlers_endpoints.SwarmingTasksService, 'new', request)
return (response, response['task_id']) | Creates a minimal task request via the Cloud Endpoints API. | appengine/swarming/test_env_handlers.py | client_create_task | Swift1313/luci-py | 0 | python | def client_create_task(self, **kwargs):
request = self.create_new_request(**kwargs)
response = self.endpoint_call(handlers_endpoints.SwarmingTasksService, 'new', request)
return (response, response['task_id']) | def client_create_task(self, **kwargs):
request = self.create_new_request(**kwargs)
response = self.endpoint_call(handlers_endpoints.SwarmingTasksService, 'new', request)
return (response, response['task_id'])<|docstring|>Creates a minimal task request via the Cloud Endpoints API.<|endoftext|> |
b01c8beaf703735a18731178e97cae2df91cd56838e5444442a7bcb0eafb2e4b | def client_create_task_isolated(self, properties=None, **kwargs):
'Creates a TaskRequest using an isolated tree via the Cloud Endpoints API.\n '
properties = (properties or {}).copy()
properties['inputs_ref'] = {'isolated': '0123456789012345678901234567890123456789', 'isolatedserver': 'http://localhost:1... | Creates a TaskRequest using an isolated tree via the Cloud Endpoints API. | appengine/swarming/test_env_handlers.py | client_create_task_isolated | Swift1313/luci-py | 0 | python | def client_create_task_isolated(self, properties=None, **kwargs):
'\n '
properties = (properties or {}).copy()
properties['inputs_ref'] = {'isolated': '0123456789012345678901234567890123456789', 'isolatedserver': 'http://localhost:1', 'namespace': 'default-gzip'}
return self.client_create_task(proper... | def client_create_task_isolated(self, properties=None, **kwargs):
'\n '
properties = (properties or {}).copy()
properties['inputs_ref'] = {'isolated': '0123456789012345678901234567890123456789', 'isolatedserver': 'http://localhost:1', 'namespace': 'default-gzip'}
return self.client_create_task(proper... |
12baeee666a55e4dc5ddb3f7446aab6c9766d6f1b76912e2e31f098a13f2d8d1 | def client_create_task_raw(self, properties=None, **kwargs):
'Creates a raw command TaskRequest via the Cloud Endpoints API.'
properties = (properties or {}).copy()
properties['command'] = ['python', 'run_test.py']
return self.client_create_task(properties=self.create_props(**properties), **kwargs) | Creates a raw command TaskRequest via the Cloud Endpoints API. | appengine/swarming/test_env_handlers.py | client_create_task_raw | Swift1313/luci-py | 0 | python | def client_create_task_raw(self, properties=None, **kwargs):
properties = (properties or {}).copy()
properties['command'] = ['python', 'run_test.py']
return self.client_create_task(properties=self.create_props(**properties), **kwargs) | def client_create_task_raw(self, properties=None, **kwargs):
properties = (properties or {}).copy()
properties['command'] = ['python', 'run_test.py']
return self.client_create_task(properties=self.create_props(**properties), **kwargs)<|docstring|>Creates a raw command TaskRequest via the Cloud Endpoint... |
bee7dc3a39f8c517591b3c2137f87f66a10d9cd3f891ab582db8f35792414103 | @staticmethod
def gen_props(**kwargs):
'Returns a serialized swarming_rpcs.TaskProperties.\n\n To be used for expectations.\n '
out = {u'cipd_input': {u'client_package': {u'package_name': u'infra/tools/cipd/${platform}', u'version': u'git_revision:deadbeef'}, u'packages': [{u'package_name': u'rm', u'path'... | Returns a serialized swarming_rpcs.TaskProperties.
To be used for expectations. | appengine/swarming/test_env_handlers.py | gen_props | Swift1313/luci-py | 0 | python | @staticmethod
def gen_props(**kwargs):
'Returns a serialized swarming_rpcs.TaskProperties.\n\n To be used for expectations.\n '
out = {u'cipd_input': {u'client_package': {u'package_name': u'infra/tools/cipd/${platform}', u'version': u'git_revision:deadbeef'}, u'packages': [{u'package_name': u'rm', u'path'... | @staticmethod
def gen_props(**kwargs):
'Returns a serialized swarming_rpcs.TaskProperties.\n\n To be used for expectations.\n '
out = {u'cipd_input': {u'client_package': {u'package_name': u'infra/tools/cipd/${platform}', u'version': u'git_revision:deadbeef'}, u'packages': [{u'package_name': u'rm', u'path'... |
98ab125383422ecb75692173c2c52b9152fc0a3a2853966a25dc584fdb43dfc4 | @staticmethod
def gen_request(**kwargs):
'Returns a serialized swarming_rpcs.TaskRequest.\n\n To be used for expectations.\n '
out = {u'authenticated': u'user:example@example.com', u'expiration_secs': u'86400', u'name': u'job1', u'priority': u'20', u'service_account': u'none', u'tags': [u'a:tag', u'os:Ami... | Returns a serialized swarming_rpcs.TaskRequest.
To be used for expectations. | appengine/swarming/test_env_handlers.py | gen_request | Swift1313/luci-py | 0 | python | @staticmethod
def gen_request(**kwargs):
'Returns a serialized swarming_rpcs.TaskRequest.\n\n To be used for expectations.\n '
out = {u'authenticated': u'user:example@example.com', u'expiration_secs': u'86400', u'name': u'job1', u'priority': u'20', u'service_account': u'none', u'tags': [u'a:tag', u'os:Ami... | @staticmethod
def gen_request(**kwargs):
'Returns a serialized swarming_rpcs.TaskRequest.\n\n To be used for expectations.\n '
out = {u'authenticated': u'user:example@example.com', u'expiration_secs': u'86400', u'name': u'job1', u'priority': u'20', u'service_account': u'none', u'tags': [u'a:tag', u'os:Ami... |
6284d9569b412f90f781559dee3b8bff1b137f8f9080936da63e9b6542754572 | @staticmethod
def gen_perf_stats(**kwargs):
'Returns a serialized swarming_rpcs.PerformanceStats.\n\n To be used for expectations.\n '
out = {u'bot_overhead': 0.1, u'isolated_download': {u'duration': 1.0, u'initial_number_items': u'10', u'initial_size': u'100000', u'items_cold': [20], u'items_hot': [30, 4... | Returns a serialized swarming_rpcs.PerformanceStats.
To be used for expectations. | appengine/swarming/test_env_handlers.py | gen_perf_stats | Swift1313/luci-py | 0 | python | @staticmethod
def gen_perf_stats(**kwargs):
'Returns a serialized swarming_rpcs.PerformanceStats.\n\n To be used for expectations.\n '
out = {u'bot_overhead': 0.1, u'isolated_download': {u'duration': 1.0, u'initial_number_items': u'10', u'initial_size': u'100000', u'items_cold': [20], u'items_hot': [30, 4... | @staticmethod
def gen_perf_stats(**kwargs):
'Returns a serialized swarming_rpcs.PerformanceStats.\n\n To be used for expectations.\n '
out = {u'bot_overhead': 0.1, u'isolated_download': {u'duration': 1.0, u'initial_number_items': u'10', u'initial_size': u'100000', u'items_cold': [20], u'items_hot': [30, 4... |
3bcce5cd48a3ded3e2bd178ab166badf3c23ce676e6adec791763ffffbacd351 | def gen_result_summary(self, **kwargs):
'Returns a serialized swarming_rpcs.TaskResult initialized from a\n TaskResultSummary.\n\n To be used for expectations.\n '
out = {u'bot_dimensions': [{u'key': u'id', u'value': [u'bot1']}, {u'key': u'os', u'value': [u'Amiga']}, {u'key': u'pool', u'value': [u'defa... | Returns a serialized swarming_rpcs.TaskResult initialized from a
TaskResultSummary.
To be used for expectations. | appengine/swarming/test_env_handlers.py | gen_result_summary | Swift1313/luci-py | 0 | python | def gen_result_summary(self, **kwargs):
'Returns a serialized swarming_rpcs.TaskResult initialized from a\n TaskResultSummary.\n\n To be used for expectations.\n '
out = {u'bot_dimensions': [{u'key': u'id', u'value': [u'bot1']}, {u'key': u'os', u'value': [u'Amiga']}, {u'key': u'pool', u'value': [u'defa... | def gen_result_summary(self, **kwargs):
'Returns a serialized swarming_rpcs.TaskResult initialized from a\n TaskResultSummary.\n\n To be used for expectations.\n '
out = {u'bot_dimensions': [{u'key': u'id', u'value': [u'bot1']}, {u'key': u'os', u'value': [u'Amiga']}, {u'key': u'pool', u'value': [u'defa... |
1b1a1658855a475756b10a1c0f8ff0798e6fb021237584c3f130230d4a36eb7c | def gen_run_result(self, **kwargs):
'Returns a serialized swarming_rpcs.TaskResult initialized from a\n TaskRunResult.\n\n To be used for expectations.\n '
out = {u'bot_dimensions': [{u'key': u'id', u'value': [u'bot1']}, {u'key': u'os', u'value': [u'Amiga']}, {u'key': u'pool', u'value': [u'default']}],... | Returns a serialized swarming_rpcs.TaskResult initialized from a
TaskRunResult.
To be used for expectations. | appengine/swarming/test_env_handlers.py | gen_run_result | Swift1313/luci-py | 0 | python | def gen_run_result(self, **kwargs):
'Returns a serialized swarming_rpcs.TaskResult initialized from a\n TaskRunResult.\n\n To be used for expectations.\n '
out = {u'bot_dimensions': [{u'key': u'id', u'value': [u'bot1']}, {u'key': u'os', u'value': [u'Amiga']}, {u'key': u'pool', u'value': [u'default']}],... | def gen_run_result(self, **kwargs):
'Returns a serialized swarming_rpcs.TaskResult initialized from a\n TaskRunResult.\n\n To be used for expectations.\n '
out = {u'bot_dimensions': [{u'key': u'id', u'value': [u'bot1']}, {u'key': u'os', u'value': [u'Amiga']}, {u'key': u'pool', u'value': [u'default']}],... |
971e3637f3cdb7d57bc039d3d17555b3f14ef52935d98d73f9edd8911db4254d | def image(self, windowName, imgNumpyArray, **kwargs):
' Takes numpy array and plots it into visdom '
opts = {'caption': windowName, 'title': windowName}
for key in kwargs:
opts[key] = kwargs[key]
self.viz.image(imgNumpyArray, opts) | Takes numpy array and plots it into visdom | visualizer.py | image | smerzbach/pysmtb | 1 | python | def image(self, windowName, imgNumpyArray, **kwargs):
' '
opts = {'caption': windowName, 'title': windowName}
for key in kwargs:
opts[key] = kwargs[key]
self.viz.image(imgNumpyArray, opts) | def image(self, windowName, imgNumpyArray, **kwargs):
' '
opts = {'caption': windowName, 'title': windowName}
for key in kwargs:
opts[key] = kwargs[key]
self.viz.image(imgNumpyArray, opts)<|docstring|>Takes numpy array and plots it into visdom<|endoftext|> |
fa43f3dbe40c8d86831b5193cbc46322f85ee5e3cc4f29ca521890a7a68db4bc | def __init__(self):
'\n Initialize your data structure here.\n '
self.data = set() | Initialize your data structure here. | 0380_Insert_Delete_GetRandom_O(1).py | __init__ | coldmanck/leetcode-python | 4 | python | def __init__(self):
'\n \n '
self.data = set() | def __init__(self):
'\n \n '
self.data = set()<|docstring|>Initialize your data structure here.<|endoftext|> |
9c179052aa5e07d4314d1413d6f94d028ff95cf5ae20e6809b021f324d6c317d | def insert(self, val: int) -> bool:
'\n Inserts a value to the set. Returns true if the set did not already contain the specified element.\n '
if (val in self.data):
return False
self.data.add(val)
return True | Inserts a value to the set. Returns true if the set did not already contain the specified element. | 0380_Insert_Delete_GetRandom_O(1).py | insert | coldmanck/leetcode-python | 4 | python | def insert(self, val: int) -> bool:
'\n \n '
if (val in self.data):
return False
self.data.add(val)
return True | def insert(self, val: int) -> bool:
'\n \n '
if (val in self.data):
return False
self.data.add(val)
return True<|docstring|>Inserts a value to the set. Returns true if the set did not already contain the specified element.<|endoftext|> |
ed498a29655162578a4f2320b2b7ddf73dc256fcad1305f77bf7d7eacee1535b | def remove(self, val: int) -> bool:
'\n Removes a value from the set. Returns true if the set contained the specified element.\n '
if (not (val in self.data)):
return False
self.data.remove(val)
return True | Removes a value from the set. Returns true if the set contained the specified element. | 0380_Insert_Delete_GetRandom_O(1).py | remove | coldmanck/leetcode-python | 4 | python | def remove(self, val: int) -> bool:
'\n \n '
if (not (val in self.data)):
return False
self.data.remove(val)
return True | def remove(self, val: int) -> bool:
'\n \n '
if (not (val in self.data)):
return False
self.data.remove(val)
return True<|docstring|>Removes a value from the set. Returns true if the set contained the specified element.<|endoftext|> |
9367b360de65b68eb9f03eb05d297bea02b0c750850cfb1c5747c47343b07520 | def getRandom(self) -> int:
'\n Get a random element from the set.\n '
if (len(self.data) > 0):
return random.sample(self.data, 1)[0] | Get a random element from the set. | 0380_Insert_Delete_GetRandom_O(1).py | getRandom | coldmanck/leetcode-python | 4 | python | def getRandom(self) -> int:
'\n \n '
if (len(self.data) > 0):
return random.sample(self.data, 1)[0] | def getRandom(self) -> int:
'\n \n '
if (len(self.data) > 0):
return random.sample(self.data, 1)[0]<|docstring|>Get a random element from the set.<|endoftext|> |
7eaca8ce2f16d2f3cbd831a88281e754ec6fb11ed8171a9d4c7b3ec99b212eaf | def interact_with_user(device, user_source, source_type, username, my_username, interaction_strategy: InteractionStrategy, on_action) -> (bool, bool):
'\n :return: (whether some photos was liked, whether @username was followed during the interaction,\n whether stories were watched, whether was commented)\n ... | :return: (whether some photos was liked, whether @username was followed during the interaction,
whether stories were watched, whether was commented) | insomniac/actions_impl.py | interact_with_user | davebaird/Insomniac | 0 | python | def interact_with_user(device, user_source, source_type, username, my_username, interaction_strategy: InteractionStrategy, on_action) -> (bool, bool):
'\n :return: (whether some photos was liked, whether @username was followed during the interaction,\n whether stories were watched, whether was commented)\n ... | def interact_with_user(device, user_source, source_type, username, my_username, interaction_strategy: InteractionStrategy, on_action) -> (bool, bool):
'\n :return: (whether some photos was liked, whether @username was followed during the interaction,\n whether stories were watched, whether was commented)\n ... |
b71bb699fa03229b0fd3094a73fcb30053e52f1767b70e5f0b4302472915a622 | def do_unfollow(device, my_username, username, storage, check_if_is_follower, username_view, follow_status_button_view, on_action):
'\n :return: whether unfollow was successful\n '
need_to_go_back_to_list = True
unfollow_from_list_chance = randint(1, 100)
if ((follow_status_button_view is not None... | :return: whether unfollow was successful | insomniac/actions_impl.py | do_unfollow | davebaird/Insomniac | 0 | python | def do_unfollow(device, my_username, username, storage, check_if_is_follower, username_view, follow_status_button_view, on_action):
'\n \n '
need_to_go_back_to_list = True
unfollow_from_list_chance = randint(1, 100)
if ((follow_status_button_view is not None) and (not check_if_is_follower) and (un... | def do_unfollow(device, my_username, username, storage, check_if_is_follower, username_view, follow_status_button_view, on_action):
'\n \n '
need_to_go_back_to_list = True
unfollow_from_list_chance = randint(1, 100)
if ((follow_status_button_view is not None) and (not check_if_is_follower) and (un... |
b4ae759cb3b3b202b96f100bbc290d9e86ecb14fc6a961dd87eb3106f70bdd5e | def ineichen(apparent_zenith, airmass_absolute, linke_turbidity, altitude=0, dni_extra=1364.0, perez_enhancement=False):
'\n Determine clear sky GHI, DNI, and DHI from Ineichen/Perez model.\n\n Implements the Ineichen and Perez clear sky model for global\n horizontal irradiance (GHI), direct normal irradia... | Determine clear sky GHI, DNI, and DHI from Ineichen/Perez model.
Implements the Ineichen and Perez clear sky model for global
horizontal irradiance (GHI), direct normal irradiance (DNI), and
calculates the clear-sky diffuse horizontal (DHI) component as the
difference between GHI and DNI*cos(zenith) as presented in [1... | pvlib/clearsky.py | ineichen | Antoine-0/pvlib-python | 695 | python | def ineichen(apparent_zenith, airmass_absolute, linke_turbidity, altitude=0, dni_extra=1364.0, perez_enhancement=False):
'\n Determine clear sky GHI, DNI, and DHI from Ineichen/Perez model.\n\n Implements the Ineichen and Perez clear sky model for global\n horizontal irradiance (GHI), direct normal irradia... | def ineichen(apparent_zenith, airmass_absolute, linke_turbidity, altitude=0, dni_extra=1364.0, perez_enhancement=False):
'\n Determine clear sky GHI, DNI, and DHI from Ineichen/Perez model.\n\n Implements the Ineichen and Perez clear sky model for global\n horizontal irradiance (GHI), direct normal irradia... |
f47894dcc8a3fcdf34fa5a46e698c401b1f1ad0bcd86e532f3e8360c6a07ff06 | def lookup_linke_turbidity(time, latitude, longitude, filepath=None, interp_turbidity=True):
'\n Look up the Linke Turibidity from the ``LinkeTurbidities.h5``\n data file supplied with pvlib.\n\n Parameters\n ----------\n time : pandas.DatetimeIndex\n\n latitude : float or int\n\n longitude : f... | Look up the Linke Turibidity from the ``LinkeTurbidities.h5``
data file supplied with pvlib.
Parameters
----------
time : pandas.DatetimeIndex
latitude : float or int
longitude : float or int
filepath : None or string, default None
The path to the ``.h5`` file.
interp_turbidity : bool, default True
If ``Tr... | pvlib/clearsky.py | lookup_linke_turbidity | Antoine-0/pvlib-python | 695 | python | def lookup_linke_turbidity(time, latitude, longitude, filepath=None, interp_turbidity=True):
'\n Look up the Linke Turibidity from the ``LinkeTurbidities.h5``\n data file supplied with pvlib.\n\n Parameters\n ----------\n time : pandas.DatetimeIndex\n\n latitude : float or int\n\n longitude : f... | def lookup_linke_turbidity(time, latitude, longitude, filepath=None, interp_turbidity=True):
'\n Look up the Linke Turibidity from the ``LinkeTurbidities.h5``\n data file supplied with pvlib.\n\n Parameters\n ----------\n time : pandas.DatetimeIndex\n\n latitude : float or int\n\n longitude : f... |
ff346fb4c9c3a9691629e4c2ed0d78b763fc0582973b268c0c1fe1f46979a939 | def _is_leap_year(year):
'Determine if a year is leap year.\n\n Parameters\n ----------\n year : numeric\n\n Returns\n -------\n isleap : array of bools\n '
isleap = ((np.mod(year, 4) == 0) & ((np.mod(year, 100) != 0) | (np.mod(year, 400) == 0)))
return isleap | Determine if a year is leap year.
Parameters
----------
year : numeric
Returns
-------
isleap : array of bools | pvlib/clearsky.py | _is_leap_year | Antoine-0/pvlib-python | 695 | python | def _is_leap_year(year):
'Determine if a year is leap year.\n\n Parameters\n ----------\n year : numeric\n\n Returns\n -------\n isleap : array of bools\n '
isleap = ((np.mod(year, 4) == 0) & ((np.mod(year, 100) != 0) | (np.mod(year, 400) == 0)))
return isleap | def _is_leap_year(year):
'Determine if a year is leap year.\n\n Parameters\n ----------\n year : numeric\n\n Returns\n -------\n isleap : array of bools\n '
isleap = ((np.mod(year, 4) == 0) & ((np.mod(year, 100) != 0) | (np.mod(year, 400) == 0)))
return isleap<|docstring|>Determine if a... |
705597f2634249965d1f729570e0e3b192efb36a0871f7a77aed41927136886d | def _interpolate_turbidity(lts, time):
'\n Interpolated monthly Linke turbidity onto daily values.\n\n Parameters\n ----------\n lts : np.array\n Monthly Linke turbidity values.\n time : pd.DatetimeIndex\n Times to be interpolated onto.\n\n Returns\n -------\n linke_turbidity :... | Interpolated monthly Linke turbidity onto daily values.
Parameters
----------
lts : np.array
Monthly Linke turbidity values.
time : pd.DatetimeIndex
Times to be interpolated onto.
Returns
-------
linke_turbidity : pd.Series
The interpolated turbidity. | pvlib/clearsky.py | _interpolate_turbidity | Antoine-0/pvlib-python | 695 | python | def _interpolate_turbidity(lts, time):
'\n Interpolated monthly Linke turbidity onto daily values.\n\n Parameters\n ----------\n lts : np.array\n Monthly Linke turbidity values.\n time : pd.DatetimeIndex\n Times to be interpolated onto.\n\n Returns\n -------\n linke_turbidity :... | def _interpolate_turbidity(lts, time):
'\n Interpolated monthly Linke turbidity onto daily values.\n\n Parameters\n ----------\n lts : np.array\n Monthly Linke turbidity values.\n time : pd.DatetimeIndex\n Times to be interpolated onto.\n\n Returns\n -------\n linke_turbidity :... |
4fcda9501b89799343d63565babdd7e91bec2778c1760221477f313a45838df3 | def _calendar_month_middles(year):
'List of middle day of each month, used by Linke turbidity lookup'
mdays = np.array(calendar.mdays[1:])
ydays = 365
if calendar.isleap(year):
mdays[1] = (mdays[1] + 1)
ydays = 366
middles = np.concatenate([[((- calendar.mdays[(- 1)]) / 2.0)], (np.cu... | List of middle day of each month, used by Linke turbidity lookup | pvlib/clearsky.py | _calendar_month_middles | Antoine-0/pvlib-python | 695 | python | def _calendar_month_middles(year):
mdays = np.array(calendar.mdays[1:])
ydays = 365
if calendar.isleap(year):
mdays[1] = (mdays[1] + 1)
ydays = 366
middles = np.concatenate([[((- calendar.mdays[(- 1)]) / 2.0)], (np.cumsum(mdays) - (np.array(mdays) / 2.0)), [(ydays + (calendar.mdays[... | def _calendar_month_middles(year):
mdays = np.array(calendar.mdays[1:])
ydays = 365
if calendar.isleap(year):
mdays[1] = (mdays[1] + 1)
ydays = 366
middles = np.concatenate([[((- calendar.mdays[(- 1)]) / 2.0)], (np.cumsum(mdays) - (np.array(mdays) / 2.0)), [(ydays + (calendar.mdays[... |
f9768d351408a1da6805b9a2f858880459c5e8d215b388c7f5f16f8f4df20b33 | def _degrees_to_index(degrees, coordinate):
"Transform input degrees to an output index integer. The Linke\n turbidity lookup tables have three dimensions, latitude, longitude, and\n month. Specify a degree value and either 'latitude' or 'longitude' to get\n the appropriate index number for the first two o... | Transform input degrees to an output index integer. The Linke
turbidity lookup tables have three dimensions, latitude, longitude, and
month. Specify a degree value and either 'latitude' or 'longitude' to get
the appropriate index number for the first two of these index numbers.
Parameters
----------
degrees : float or... | pvlib/clearsky.py | _degrees_to_index | Antoine-0/pvlib-python | 695 | python | def _degrees_to_index(degrees, coordinate):
"Transform input degrees to an output index integer. The Linke\n turbidity lookup tables have three dimensions, latitude, longitude, and\n month. Specify a degree value and either 'latitude' or 'longitude' to get\n the appropriate index number for the first two o... | def _degrees_to_index(degrees, coordinate):
"Transform input degrees to an output index integer. The Linke\n turbidity lookup tables have three dimensions, latitude, longitude, and\n month. Specify a degree value and either 'latitude' or 'longitude' to get\n the appropriate index number for the first two o... |
5f22c1a8b094e14d55ba2d4bc872419bc0c8f9e937ce2ac9ed444bfe92c5acf1 | def haurwitz(apparent_zenith):
'\n Determine clear sky GHI using the Haurwitz model.\n\n Implements the Haurwitz clear sky model for global horizontal\n irradiance (GHI) as presented in [1, 2]. A report on clear\n sky models found the Haurwitz model to have the best performance\n in terms of average ... | Determine clear sky GHI using the Haurwitz model.
Implements the Haurwitz clear sky model for global horizontal
irradiance (GHI) as presented in [1, 2]. A report on clear
sky models found the Haurwitz model to have the best performance
in terms of average monthly error among models which require only
zenith angle [3].... | pvlib/clearsky.py | haurwitz | Antoine-0/pvlib-python | 695 | python | def haurwitz(apparent_zenith):
'\n Determine clear sky GHI using the Haurwitz model.\n\n Implements the Haurwitz clear sky model for global horizontal\n irradiance (GHI) as presented in [1, 2]. A report on clear\n sky models found the Haurwitz model to have the best performance\n in terms of average ... | def haurwitz(apparent_zenith):
'\n Determine clear sky GHI using the Haurwitz model.\n\n Implements the Haurwitz clear sky model for global horizontal\n irradiance (GHI) as presented in [1, 2]. A report on clear\n sky models found the Haurwitz model to have the best performance\n in terms of average ... |
cfa06ec53980286c741bfd8950b55192bd97df60ace15612654bdbb0a5ed3cf5 | def simplified_solis(apparent_elevation, aod700=0.1, precipitable_water=1.0, pressure=101325.0, dni_extra=1364.0):
'\n Calculate the clear sky GHI, DNI, and DHI according to the\n simplified Solis model.\n\n Reference [1]_ describes the accuracy of the model as being 15, 20,\n and 18 W/m^2 for the beam,... | Calculate the clear sky GHI, DNI, and DHI according to the
simplified Solis model.
Reference [1]_ describes the accuracy of the model as being 15, 20,
and 18 W/m^2 for the beam, global, and diffuse components. Reference
[2]_ provides comparisons with other clear sky models.
Parameters
----------
apparent_elevation : ... | pvlib/clearsky.py | simplified_solis | Antoine-0/pvlib-python | 695 | python | def simplified_solis(apparent_elevation, aod700=0.1, precipitable_water=1.0, pressure=101325.0, dni_extra=1364.0):
'\n Calculate the clear sky GHI, DNI, and DHI according to the\n simplified Solis model.\n\n Reference [1]_ describes the accuracy of the model as being 15, 20,\n and 18 W/m^2 for the beam,... | def simplified_solis(apparent_elevation, aod700=0.1, precipitable_water=1.0, pressure=101325.0, dni_extra=1364.0):
'\n Calculate the clear sky GHI, DNI, and DHI according to the\n simplified Solis model.\n\n Reference [1]_ describes the accuracy of the model as being 15, 20,\n and 18 W/m^2 for the beam,... |
fb97298b16fe0faa5fd31302097ee1d8ef9f74b4aa5b5a25c71fc00c865b2f48 | def _calc_i0p(i0, w, aod700, p):
'Calculate the "enhanced extraterrestrial irradiance".'
p0 = 101325.0
io0 = (1.08 * (w ** 0.0051))
i01 = (0.97 * (w ** 0.032))
i02 = (0.12 * (w ** 0.56))
i0p = (i0 * ((((i02 * (aod700 ** 2)) + (i01 * aod700)) + io0) + (0.071 * np.log((p / p0)))))
return i0p | Calculate the "enhanced extraterrestrial irradiance". | pvlib/clearsky.py | _calc_i0p | Antoine-0/pvlib-python | 695 | python | def _calc_i0p(i0, w, aod700, p):
p0 = 101325.0
io0 = (1.08 * (w ** 0.0051))
i01 = (0.97 * (w ** 0.032))
i02 = (0.12 * (w ** 0.56))
i0p = (i0 * ((((i02 * (aod700 ** 2)) + (i01 * aod700)) + io0) + (0.071 * np.log((p / p0)))))
return i0p | def _calc_i0p(i0, w, aod700, p):
p0 = 101325.0
io0 = (1.08 * (w ** 0.0051))
i01 = (0.97 * (w ** 0.032))
i02 = (0.12 * (w ** 0.56))
i0p = (i0 * ((((i02 * (aod700 ** 2)) + (i01 * aod700)) + io0) + (0.071 * np.log((p / p0)))))
return i0p<|docstring|>Calculate the "enhanced extraterrestrial irr... |
749607145f0742a24dcc2f8418f7d5e12d18b05eb87880d294c6dd42cf50dadc | def _calc_taub(w, aod700, p):
'Calculate the taub coefficient'
p0 = 101325.0
tb1 = ((1.82 + (0.056 * np.log(w))) + (0.0071 * (np.log(w) ** 2)))
tb0 = ((0.33 + (0.045 * np.log(w))) + (0.0096 * (np.log(w) ** 2)))
tbp = ((0.0089 * w) + 0.13)
taub = (((tb1 * aod700) + tb0) + (tbp * np.log((p / p0)))... | Calculate the taub coefficient | pvlib/clearsky.py | _calc_taub | Antoine-0/pvlib-python | 695 | python | def _calc_taub(w, aod700, p):
p0 = 101325.0
tb1 = ((1.82 + (0.056 * np.log(w))) + (0.0071 * (np.log(w) ** 2)))
tb0 = ((0.33 + (0.045 * np.log(w))) + (0.0096 * (np.log(w) ** 2)))
tbp = ((0.0089 * w) + 0.13)
taub = (((tb1 * aod700) + tb0) + (tbp * np.log((p / p0))))
return taub | def _calc_taub(w, aod700, p):
p0 = 101325.0
tb1 = ((1.82 + (0.056 * np.log(w))) + (0.0071 * (np.log(w) ** 2)))
tb0 = ((0.33 + (0.045 * np.log(w))) + (0.0096 * (np.log(w) ** 2)))
tbp = ((0.0089 * w) + 0.13)
taub = (((tb1 * aod700) + tb0) + (tbp * np.log((p / p0))))
return taub<|docstring|>Ca... |
de82d5f189d3579ee91be6efef88f510e9639504003180a65ed7873966297925 | def _calc_b(w, aod700):
'Calculate the b coefficient.'
b1 = (((0.00925 * (aod700 ** 2)) + (0.0148 * aod700)) - 0.0172)
b0 = ((((- 0.7565) * (aod700 ** 2)) + (0.5057 * aod700)) + 0.4557)
b = ((b1 * np.log(w)) + b0)
return b | Calculate the b coefficient. | pvlib/clearsky.py | _calc_b | Antoine-0/pvlib-python | 695 | python | def _calc_b(w, aod700):
b1 = (((0.00925 * (aod700 ** 2)) + (0.0148 * aod700)) - 0.0172)
b0 = ((((- 0.7565) * (aod700 ** 2)) + (0.5057 * aod700)) + 0.4557)
b = ((b1 * np.log(w)) + b0)
return b | def _calc_b(w, aod700):
b1 = (((0.00925 * (aod700 ** 2)) + (0.0148 * aod700)) - 0.0172)
b0 = ((((- 0.7565) * (aod700 ** 2)) + (0.5057 * aod700)) + 0.4557)
b = ((b1 * np.log(w)) + b0)
return b<|docstring|>Calculate the b coefficient.<|endoftext|> |
7325d6b7ba8de0236dc1c6a2439168160ee1aac94bab1ac9c4b1d0e5baa31dfc | def _calc_taug(w, aod700, p):
'Calculate the taug coefficient'
p0 = 101325.0
tg1 = ((1.24 + (0.047 * np.log(w))) + (0.0061 * (np.log(w) ** 2)))
tg0 = ((0.27 + (0.043 * np.log(w))) + (0.009 * (np.log(w) ** 2)))
tgp = ((0.0079 * w) + 0.1)
taug = (((tg1 * aod700) + tg0) + (tgp * np.log((p / p0))))
... | Calculate the taug coefficient | pvlib/clearsky.py | _calc_taug | Antoine-0/pvlib-python | 695 | python | def _calc_taug(w, aod700, p):
p0 = 101325.0
tg1 = ((1.24 + (0.047 * np.log(w))) + (0.0061 * (np.log(w) ** 2)))
tg0 = ((0.27 + (0.043 * np.log(w))) + (0.009 * (np.log(w) ** 2)))
tgp = ((0.0079 * w) + 0.1)
taug = (((tg1 * aod700) + tg0) + (tgp * np.log((p / p0))))
return taug | def _calc_taug(w, aod700, p):
p0 = 101325.0
tg1 = ((1.24 + (0.047 * np.log(w))) + (0.0061 * (np.log(w) ** 2)))
tg0 = ((0.27 + (0.043 * np.log(w))) + (0.009 * (np.log(w) ** 2)))
tgp = ((0.0079 * w) + 0.1)
taug = (((tg1 * aod700) + tg0) + (tgp * np.log((p / p0))))
return taug<|docstring|>Calc... |
1aba7ae695f0658b0f47b8829a50d1e15301c9dbdb00277aff9d92ca9538468f | def _calc_g(w, aod700):
'Calculate the g coefficient.'
g = (((((- 0.0147) * np.log(w)) - (0.3079 * (aod700 ** 2))) + (0.2846 * aod700)) + 0.3798)
return g | Calculate the g coefficient. | pvlib/clearsky.py | _calc_g | Antoine-0/pvlib-python | 695 | python | def _calc_g(w, aod700):
g = (((((- 0.0147) * np.log(w)) - (0.3079 * (aod700 ** 2))) + (0.2846 * aod700)) + 0.3798)
return g | def _calc_g(w, aod700):
g = (((((- 0.0147) * np.log(w)) - (0.3079 * (aod700 ** 2))) + (0.2846 * aod700)) + 0.3798)
return g<|docstring|>Calculate the g coefficient.<|endoftext|> |
94a13d10d2a732c22f6ca5f42feab0fe273f81291d1523787f7805a02fe84e30 | def _calc_taud(w, aod700, p):
'Calculate the taud coefficient.'
if (np.isscalar(w) and np.isscalar(aod700)):
w = np.array([w])
aod700 = np.array([aod700])
elif np.isscalar(w):
w = np.full_like(aod700, w)
elif np.isscalar(aod700):
aod700 = np.full_like(w, aod700)
aod70... | Calculate the taud coefficient. | pvlib/clearsky.py | _calc_taud | Antoine-0/pvlib-python | 695 | python | def _calc_taud(w, aod700, p):
if (np.isscalar(w) and np.isscalar(aod700)):
w = np.array([w])
aod700 = np.array([aod700])
elif np.isscalar(w):
w = np.full_like(aod700, w)
elif np.isscalar(aod700):
aod700 = np.full_like(w, aod700)
aod700_lt_0p05 = np.full_like(aod700, ... | def _calc_taud(w, aod700, p):
if (np.isscalar(w) and np.isscalar(aod700)):
w = np.array([w])
aod700 = np.array([aod700])
elif np.isscalar(w):
w = np.full_like(aod700, w)
elif np.isscalar(aod700):
aod700 = np.full_like(w, aod700)
aod700_lt_0p05 = np.full_like(aod700, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.