function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def dict_merge(a, b):
c = a.copy()
c.update(b)
return c | NationalLibraryOfNorway/NB-N-gram | [
18,
5,
18,
1,
1433156314
] |
def swapcase(args):
""" Swaps the case of the first letter of the argument """ | NationalLibraryOfNorway/NB-N-gram | [
18,
5,
18,
1,
1433156314
] |
def tokenize(term):
""" Very simple tokenizer: based on whitespace but not including paranthesis """
return re.findall('[^\s\(]+|\([^)]*\)', term) | NationalLibraryOfNorway/NB-N-gram | [
18,
5,
18,
1,
1433156314
] |
def merge_result(self):
""" Returns a merged object (similar to UNION SELECT) """ | NationalLibraryOfNorway/NB-N-gram | [
18,
5,
18,
1,
1433156314
] |
def get_relfreq(total,total_freq):
"""Calculates the relative frequency for each item, returns complete dictionary """
relfreq_dict = []
for attribute, value in total.iteritems():
if int(attribute) >= 1810:
rel_freq = float(value) / total_freq[attribute] * 100
relfreq_dict.a... | NationalLibraryOfNorway/NB-N-gram | [
18,
5,
18,
1,
1433156314
] |
def return_single_results(sql,args,lang,label,corpus):
""" Returns the results for single items """ | NationalLibraryOfNorway/NB-N-gram | [
18,
5,
18,
1,
1433156314
] |
def get_query_params(request):
""" Returns a dictionary of query parameters """ | NationalLibraryOfNorway/NB-N-gram | [
18,
5,
18,
1,
1433156314
] |
def index():
return render_template('header-footer.html') | NationalLibraryOfNorway/NB-N-gram | [
18,
5,
18,
1,
1433156314
] |
def query():
entries = []
# get query paramaters
qParams = get_query_params(request)
# fills in default_parameters for those not set
sParams = dict_merge(default_params, qParams)
# does some clean-up and returns terms as list
sParams['terms'] = return_terms(sParams['terms'])
# gets total... | NationalLibraryOfNorway/NB-N-gram | [
18,
5,
18,
1,
1433156314
] |
def export_to_json_file(entries):
""" Exports result as JSON file """
with open('static/dump.json', 'wb') as outfile:
json.dump(entries, outfile, indent=4, separators=(', ', ': ')) | NationalLibraryOfNorway/NB-N-gram | [
18,
5,
18,
1,
1433156314
] |
def message( self ):
self._completeIfNotSet( self._message )
return self._NoneIfNotSet( self._message ) | sagarsane/abetterportfolio | [
6,
3,
6,
8,
1345948005
] |
def object( self ):
self._completeIfNotSet( self._object )
return self._NoneIfNotSet( self._object ) | sagarsane/abetterportfolio | [
6,
3,
6,
8,
1345948005
] |
def sha( self ):
self._completeIfNotSet( self._sha )
return self._NoneIfNotSet( self._sha ) | sagarsane/abetterportfolio | [
6,
3,
6,
8,
1345948005
] |
def tag( self ):
self._completeIfNotSet( self._tag )
return self._NoneIfNotSet( self._tag ) | sagarsane/abetterportfolio | [
6,
3,
6,
8,
1345948005
] |
def tagger( self ):
self._completeIfNotSet( self._tagger )
return self._NoneIfNotSet( self._tagger ) | sagarsane/abetterportfolio | [
6,
3,
6,
8,
1345948005
] |
def url( self ):
self._completeIfNotSet( self._url )
return self._NoneIfNotSet( self._url ) | sagarsane/abetterportfolio | [
6,
3,
6,
8,
1345948005
] |
def fetch(observable):
base_url_api = "https://www.threatcrowd.org/searchApi/v2"
if isinstance(observable, Hostname):
url = base_url_api + "/domain/report/"
params = {"domain": observable.value}
try:
res = requests.get(url, params)
if... | yeti-platform/yeti | [
1360,
268,
1360,
132,
1450025666
] |
def add_header(r):
"""
Add headers to both force latest IE rendering engine or Chrome Frame,
and also to cache the rendered page for 10 minutes.
"""
r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
r.headers["Pragma"] = "no-cache"
r.headers["Expires"] = "0"
r.headers['C... | dpnishant/appmon | [
1412,
284,
1412,
36,
1461924973
] |
def serve_json():
index = request.args.get('id')
if request.args.get('reportdb'):
db_name = request.args.get('reportdb')
else:
db_name = request.args.get('app')
response = db.read_from_database(db_name, index)
#response = open('static/data.json').read()
return response | dpnishant/appmon | [
1412,
284,
1412,
36,
1461924973
] |
def monitor_page():
app_name = request.args.get('app')
return render_template('monitor.html', app_name=app_name) | dpnishant/appmon | [
1412,
284,
1412,
36,
1461924973
] |
def landing_page():
global APP_LIST, DB_MAP
app_dumps_dir = os.path.join('.','app_dumps')
for root, dirs, files in os.walk(app_dumps_dir):
path = root.split(os.sep)
for file in files:
file_path = os.path.join(root, file)
if file_path.endswith('.db'):
... | dpnishant/appmon | [
1412,
284,
1412,
36,
1461924973
] |
def merge_scripts(path):
global merged_script_path
script_source = ''
for root, dirs, files in os.walk(path):
path = root.split('/')
for file in files:
script_path = os.path.join(root, file)
if script_path.endswith('.js'):
source = ''
w... | dpnishant/appmon | [
1412,
284,
1412,
36,
1461924973
] |
def writeBinFile(fname, data):
with codecs.open(fname, "a", "utf-8") as f:
f.write(data + '\r\n\r\n') | dpnishant/appmon | [
1412,
284,
1412,
36,
1461924973
] |
def on_detached():
print((colored('[WARNING] "%s" has terminated!' % (app_name), 'red'))) | dpnishant/appmon | [
1412,
284,
1412,
36,
1461924973
] |
def generate_injection():
injection_source = ''
if os.path.isfile(script_path):
with codecs.open(script_path, 'r', 'utf-8') as f:
injection_source = f.read()
elif os.path.isdir(script_path):
with codecs.open(merge_scripts(script_path), 'r', 'utf-8') as f:
injection_so... | dpnishant/appmon | [
1412,
284,
1412,
36,
1461924973
] |
def getBundleID(device, app_name, platform):
try:
session = device.attach(app_name)
session.on('detached', on_detached)
script = session.create_script("""'use strict'; | dpnishant/appmon | [
1412,
284,
1412,
36,
1461924973
] |
def init_session():
try:
session = None
if platform == 'ios' or platform == 'android':
try:
device = frida.get_usb_device(3) # added timeout to wait for 3 seconds
except Exception as e:
print((colored(str(e), "red")))
traceback.... | dpnishant/appmon | [
1412,
284,
1412,
36,
1461924973
] |
def test_bit_extraction() -> None:
share = ShareTensor(rank=0, parties_info=[], ring_size=2**32)
data = np.array([[21, 32], [-54, 89]], dtype=np.int32)
share.child = data
exp_res1 = np.array([[False, False], [True, False]], dtype=np.bool_)
res = share.bit_extraction(31).child
assert (res == exp... | OpenMined/PySyft | [
8617,
1908,
8617,
143,
1500410476
] |
def test_with_files(self):
zapp = {'ui': ['x']}
tar = mock.Mock(getnames=lambda: ['x', 'y'])
matches = zpm._find_ui_uploads(zapp, tar)
assert sorted(matches) == ['x'] | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def test__prepare_job():
# Test for `zpmlib.zpm._prepare_job`.
# Contents of `boot/system.map`, which is expected to be in the
# `myapp.zapp` archive.
myapp_json = [
{'exec': {'args': 'myapp.py', 'path': 'file://python2.7:python'},
'devices': [{'name': 'python2.7'}, {'name': 'stdout'}]... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def setup_method(self, _method):
self.tempdir = tempfile.mkdtemp()
self.subdir = os.path.join(self.tempdir, 'foo', 'bar')
os.makedirs(self.subdir) | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def test_zapp_yaml_not_exists(self):
try:
with mock.patch('os.getcwd') as cwd:
cwd.return_value = self.subdir
with pytest.raises(RuntimeError):
zpm.find_project_root()
finally:
shutil.rmtree(self.tempdir) | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def setup_method(self, _method):
self.v1_args = mock.Mock()
self.v1_args.auth_version = '1.0'
self.v1_args.auth = 'http://example.com/auth/v1.0'
self.v1_args.user = 'tenant1:user1'
self.v1_args.key = 'secret'
self.v2_args = mock.Mock()
self.v2_args.auth_version =... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def test_v1_fail(self):
self.v1_args.user = None
with pytest.raises(zpmlib.ZPMException):
zpm._get_zerocloud_conn(self.v1_args) | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def test_v2_fail(self):
self.v2_args.os_tenant_name = None
with pytest.raises(zpmlib.ZPMException):
zpm._get_zerocloud_conn(self.v2_args) | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def setup_class(cls):
cls.zapp_yaml_contents = """\ | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def teardown_class(cls):
shutil.rmtree(cls.temp_dir) | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def test__generate_uploads(self):
uploads = zpm._generate_uploads(self.conn, self.target,
self.zapp_path, self.auth_opts)
uploads = list(uploads)
foojs_tmpl = jinja2.Template(self.foojstmpl_contents.decode())
foojs = foojs_tmpl.render(auth_opts=se... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def test__deploy_zapp_with_index_html(self):
with mock.patch('zpmlib.zpm._generate_uploads') as gu:
gu.return_value = iter([('cont/dir/index.html', 'data',
'text/html')])
index = zpm._deploy_zapp(self.conn, 'cont', None, None)
assert index... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def test__deploy_zapp_container_not_empty(self):
self.conn.get_container.return_value = (
{}, # response headers
# The actual files list response from Swift is a list of
# dictionaries. For these tests, we don't actually check the
# content; just length of the fi... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def test__deploy_zapp_container_doesnt_exist(self):
self.conn.get_container.side_effect = (
swiftclient.exceptions.ClientException(None)
)
with mock.patch('zpmlib.zpm._generate_uploads') as gu:
gu.return_value = iter([('target/dir/foo.py', 'data', None)])
zpm... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def post_job(self, job, response_dict=None,
response_body_buffer=None):
response_dict['status'] = 200
response_dict['reason'] = 'OK'
response_dict['headers'] = {
'x-nexe-system': 'node-1',
'x-nexe-cdr-line':... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def test__prepare_auth_v0():
# Test for :func:`zpmlib.zpm._prepare_auth`, with version 0.0
version = '0.0'
args = None
conn = mock.Mock()
conn.url = 'http://example.com'
expected = {
'version': '0.0',
'swiftUrl': 'http://example.com',
}
assert zpm._prepare_auth(version, ... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def test__prepare_auth_v2():
# Test for :func:`zpmlib.zpm._prepare_auth`, with version 2.0
version = '2.0'
args = mock.Mock()
args.os_auth_url = 'http://example.com:5000/v2.0'
args.os_username = 'user1'
args.os_tenant_name = 'tenant1'
args.os_password = 'secret'
conn = None
expected... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def setup_method(self, _method):
self.args = mock.Mock()
self.args.auth = None
self.args.user = None
self.args.key = None
self.args.os_auth_url = None
self.args.os_username = None
self.args.os_password = None
self.args.os_tenant_name = None | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def test_args_v2(self):
args = self.args
args.os_auth_url = 'authurl'
args.os_username = 'username'
args.os_password = 'password'
args.os_tenant_name = 'tenant'
args.auth = 'auth'
assert zpm._guess_auth_version(args) == '2.0' | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def test_env_v1(self):
env = dict(
ST_AUTH='auth',
ST_USER='user',
ST_KEY='key',
OS_AUTH_URL='',
OS_USERNAME='username',
OS_PASSWORD='',
OS_TENANT_NAME='',
)
with mock.patch.dict('os.environ', env):
a... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def test_env_default(self):
env = dict(
ST_AUTH='auth',
ST_USER='user',
ST_KEY='key',
OS_AUTH_URL='authurl',
OS_USERNAME='username',
OS_PASSWORD='password',
OS_TENANT_NAME='tenant',
)
with mock.patch.dict('os.env... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def test__get_exec_table_data_1_row(self):
headers = {
'content-length': '20',
'content-type': 'text/html',
'date': 'Tue, 26 Aug 2014 09:27:08 GMT',
'etag': 'af0983cb8fef30642bae9ba0010e7a77',
'x-chain-total-time': '3.920',
'x-nexe-cdr-line... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def test_resize_and_fuse_features(self):
batch, height, width, channels = 2, 11, 11, 6
smaller_height, smaller_width, smaller_channels = 6, 6, 3
larger_height1, larger_width1 = 21, 21 # Stride 2 conv.
larger_height2, larger_width2 = 22, 22 # Stride 2 conv.
larger_height3, larger_width3 = 23, 23 #... | google-research/deeplab2 | [
878,
146,
878,
24,
1620859177
] |
def defaults(self):
self.name = "Toggle visibility of value/reference (of selected modules)"
self.category = "A descriptive category name"
self.description = "This plugin toggles the visibility of any selected module values/references" | mmccoo/kicad_mmccoo | [
100,
27,
100,
5,
1485771968
] |
def __init__(
self,
env,
policy,
max_num_epoch_paths_saved=None,
render=False,
render_kwargs=None, | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def get_epoch_paths(self):
return self._epoch_paths | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def get_diagnostics(self):
path_lens = [len(path['actions']) for path in self._epoch_paths]
stats = OrderedDict([
('num steps total', self._num_steps_total),
('num paths total', self._num_paths_total),
])
stats.update(create_stats_ordered_dict(
"path l... | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def collect_new_steps(
self,
max_path_length,
num_steps,
discard_incomplete_paths, | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def collect_one_step(
self,
max_path_length,
discard_incomplete_paths, | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def _start_new_rollout(self):
self._current_path_builder = PathBuilder()
self._obs = self._env.reset() | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def __init__(
self,
env,
policy,
max_num_epoch_paths_saved=None,
render=False,
render_kwargs=None,
observation_key='observation',
desired_goal_key='desired_goal', | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def get_epoch_paths(self):
return self._epoch_paths | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def get_diagnostics(self):
path_lens = [len(path['actions']) for path in self._epoch_paths]
stats = OrderedDict([
('num steps total', self._num_steps_total),
('num paths total', self._num_paths_total),
])
stats.update(create_stats_ordered_dict(
"path l... | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def start_collection(self):
self._start_new_rollout() | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def collect_new_steps(
self,
max_path_length,
num_steps,
discard_incomplete_paths, | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def collect_one_step(
self,
max_path_length,
discard_incomplete_paths, | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def _start_new_rollout(self):
self._current_path_builder = PathBuilder()
self._obs = self._env.reset() | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def __init__(
self,
env,
policy,
max_num_epoch_paths_saved=None,
render=False,
render_kwargs=None,
observation_key='observation', | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def get_epoch_paths(self):
return self._epoch_paths | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def get_diagnostics(self):
path_lens = [len(path['actions']) for path in self._epoch_paths]
stats = OrderedDict([
('num steps total', self._num_steps_total),
('num paths total', self._num_paths_total),
])
stats.update(create_stats_ordered_dict(
"path l... | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def start_collection(self):
self._start_new_rollout() | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def collect_new_steps(
self,
max_path_length,
num_steps,
discard_incomplete_paths, | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def collect_one_step(
self,
max_path_length,
discard_incomplete_paths, | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def _start_new_rollout(self):
self._current_path_builder = PathBuilder()
self._obs = self._env.reset() | google-research/DBAP-algorithm | [
3,
2,
3,
1,
1628553461
] |
def _check_if_unsupported_args_are_present(args: Mapping[str, Any],
supported_args: Collection[str],
job_type: str) -> None:
supported_args = set(supported_args)
unsupported_args = set(args.keys()) - supported_args
if unsupporte... | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def _apply_args_to_job_group(job_group: job_blocks.JobGroup,
args: Mapping[str, Any]) -> None:
"""Recursively overrides job group properties."""
if args:
_check_if_unsupported_args_are_present(args, job_group.jobs.keys(),
'xm.JobGroup')
... | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def is_active(self) -> bool:
"""Returns whether the unit is not in terminal state.
It may be actively running or queued. The unit may produce more results.
If the unit is stopped by a user it will be neither active, completed
nor failed.
"""
raise NotImplementedError | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def is_completed(self) -> bool:
"""Returns whether the unit has completed without failures.
This is a terminal state. The unit has produced all the intended results.
But it still may be restarted by an explicit request.
"""
raise NotImplementedError | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def is_failed(self) -> bool:
"""Returns whether the unit has failed.
This is a terminal state. Experiment unit will enter this state on any
fatal failure, such as process exiting with non-zero code, cloud rejecting
to schedule/queue the job or exceptions in JobGenerator. The unit will stay
in this ... | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def message(self) -> str:
"""An optional human-readable message providing context for the status.
This may take the form of explaining why the work unit is in this state,
or any potentially transient errors the work unit may be experiencing.
"""
raise NotImplementedError | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def _work_unit_arguments(
job: job_blocks.JobType,
args: Optional[Mapping[str, Any]], | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def deduce_args_for_job(job: job_blocks.Job) -> Dict[str, Any]:
args = {
'args': job.args.to_dict(kwargs_only=True),
'env_vars': job.env_vars
}
return {key: value for key, value in args.items() if value} | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def __init__(self, experiment: 'Experiment',
create_task: Callable[[Awaitable[Any]], futures.Future],
args: Optional[Mapping[str,
Any]], role: ExperimentUnitRole) -> None:
"""Initializes an `ExperimentUnit` instance.
Args:
experiment: An... | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def experiment_id(self) -> int:
"""Returns a unique ID assigned to the experiment."""
return self.experiment.experiment_id | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def launch_job(job: job_blocks.Job) -> Awaitable[None]:
return self._launch_job_group(
job_blocks.JobGroup(**{job.name: job}),
_work_unit_arguments(job, self._args)) | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def launch_job_generator(
job_generator: job_blocks.JobGeneratorType) -> Awaitable[None]:
if (not inspect.iscoroutinefunction(job_generator) and
not inspect.iscoroutinefunction(job_generator.__call__)):
raise ValueError(
'Job generator must be an async function. Signature nee... | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def stop(self) -> None:
"""Initiate the process to stop the unit from running.
This method will synchronously make a request for the unit to stop.
However, the method does not actually wait for the unit to be in a
terminal state.
Use self.wait_until_complete() after self.stop() to guarantee the un... | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def experiment_unit_name(self) -> str:
raise NotImplementedError | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def context(self) -> metadata_context.MetadataContext:
"""Returns metadata context for a unit."""
return metadata_context.MetadataContext(
creator=getpass.getuser(),
annotations=metadata_context.ContextAnnotations()) | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def work_unit_id(self) -> int:
raise NotImplementedError | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def __init__(self,
job: job_blocks.JobType,
*,
importance: Importance = Importance.NORMAL,
termination_delay_secs: int) -> None:
self.role = AuxiliaryUnitRole(
importance=importance,
termination_delay_secs=termination_delay_secs,
)
... | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def experiment_id(self) -> int:
"""Returns a unique ID assigned to the experiment."""
raise NotImplementedError | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def _wait_for_tasks(self):
while not self._running_tasks.empty():
self._running_tasks.get_nowait().result() | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def package(
cls, packageables: Sequence[job_blocks.Packageable] = () | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def package_async(
cls,
packageable: job_blocks.Packageable) -> Awaitable[job_blocks.Executable]:
"""Queues executable spec to be packaged into executable.
If gathering all packageables for a single `package()` call is inconvenient,
one may request packaging with `package_async` and later trigg... | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def add(self,
job: AuxiliaryUnitJob,
args: Optional[Mapping[str, Any]] = ...) -> Awaitable[ExperimentUnit]:
... | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def add(self,
job: job_blocks.JobType,
args: Optional[Mapping[str, Any]] = ...,
role: WorkUnitRole = ...) -> Awaitable[WorkUnit]:
... | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def add(self, job: job_blocks.JobType, args: Optional[Mapping[str, Any]],
role: ExperimentUnitRole) -> Awaitable[ExperimentUnit]:
... | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def add(
self,
job: job_blocks.JobType,
args: Optional[Mapping[str, Any]] = ...,
*, # parameters after “*” are keyword-only parameters
role: ExperimentUnitRole | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def add(self, job, args=None, role=WorkUnitRole()):
# pyformat: disable
"""Adds a Job / JobGroup to the experiment.
A new Experiment Unit is created to run the job.
Args:
job: A Job or JobGroup to add.
args: Keyword arguments to be passed to the job. For Job and JobGroup args
are r... | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def _create_experiment_unit(
self, args: Optional[Mapping[str, Any]],
role: ExperimentUnitRole) -> Awaitable[ExperimentUnit]:
"""Creates a new experiment unit.
Synchronously starts the experiment unit creation, ensuring that IDs would
be assigned in invocation order. The operation itself may ru... | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def work_unit_count(self) -> int:
"""Returns how many work units the experiment has."""
raise NotImplementedError | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
def work_units(self) -> Mapping[int, WorkUnit]:
"""Returns a mapping from work_unit_id to an instance of the work unit."""
raise NotImplementedError | deepmind/xmanager | [
669,
33,
669,
13,
1619456631
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.