function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def view_or_basicauth(view, request, test_func, realm = "", *args, **kwargs):
"""
This is a helper function used by both 'logged_in_or_basicauth' and
'has_perm_or_basicauth' that does the nitty of determining if they
are already logged in or if they have provided proper http-authorization
and r... | schubergphilis/twitterwall | [
3,
1,
3,
3,
1371292479
] |
def logged_in_or_basicauth(realm = ""):
"""
A simple decorator that requires a user to be logged in. If they are not
logged in the request is examined for a 'authorization' header. | schubergphilis/twitterwall | [
3,
1,
3,
3,
1371292479
] |
def your_view:
... | schubergphilis/twitterwall | [
3,
1,
3,
3,
1371292479
] |
def view_decorator(func):
def wrapper(request, *args, **kwargs):
return view_or_basicauth(func, request,
lambda u: u.is_authenticated(),
realm, *args, **kwargs)
return wrapper | schubergphilis/twitterwall | [
3,
1,
3,
3,
1371292479
] |
def has_perm_or_basicauth(perm, realm = ""):
"""
This is similar to the above decorator 'logged_in_or_basicauth'
except that it requires the logged in user to have a specific
permission. | schubergphilis/twitterwall | [
3,
1,
3,
3,
1371292479
] |
def your_view:
... | schubergphilis/twitterwall | [
3,
1,
3,
3,
1371292479
] |
def view_decorator(func):
def wrapper(request, *args, **kwargs):
return view_or_basicauth(func, request,
lambda u: u.has_perm(perm),
realm, *args, **kwargs)
return wrapper | schubergphilis/twitterwall | [
3,
1,
3,
3,
1371292479
] |
def _get_label_map(label_map):
"""Gets the label map dict."""
if isinstance(label_map, list):
label_map_dict = {}
for i, label in enumerate(label_map):
# 0 is resevered for background.
label_map_dict[i + 1] = label
label_map = label_map_dict
label_map = label_util.get_label_map(label_map)
... | tensorflow/examples | [
6911,
7012,
6911,
106,
1531779116
] |
def __init__(self,
tfrecord_file_patten,
size,
label_map,
annotations_json_file=None):
"""Initialize DataLoader for object detector.
Args:
tfrecord_file_patten: Glob for tfrecord files. e.g. "/tmp/coco*.tfrecord".
size: The size of the dat... | tensorflow/examples | [
6911,
7012,
6911,
106,
1531779116
] |
def from_pascal_voc(
cls,
images_dir: str,
annotations_dir: str,
label_map: Union[List[str], Dict[int, str], str],
annotation_filenames: Optional[Collection[str]] = None,
ignore_difficult_instances: bool = False,
num_shards: int = 100,
max_num_images: Optional[int] = None... | tensorflow/examples | [
6911,
7012,
6911,
106,
1531779116
] |
def from_csv(
cls,
filename: str,
images_dir: Optional[str] = None,
delimiter: str = ',',
quotechar: str = '"',
num_shards: int = 10,
max_num_images: Optional[int] = None,
cache_dir: Optional[str] = None,
cache_prefix_filename: Optional[str] = None | tensorflow/examples | [
6911,
7012,
6911,
106,
1531779116
] |
def from_cache(cls, cache_prefix):
"""Loads the data from cache.
Args:
cache_prefix: The cache prefix including the cache directory and the cache
prefix filename, e.g: '/tmp/cache/train'.
Returns:
ObjectDetectorDataLoader object.
"""
# Gets TFRecord files.
tfrecord_file_pat... | tensorflow/examples | [
6911,
7012,
6911,
106,
1531779116
] |
def __init__(self, api, settings):
self.api = api
self.settings = settings | cloudControl/cctrl | [
22,
15,
22,
3,
1327055471
] |
def create(self, args):
"""
Create a new user.
"""
if not self.settings.user_registration_enabled:
print messages['RegisterDisabled'].format(self.settings.user_registration_url)
return
self.api.set_token(None)
if args.name and args.email and a... | cloudControl/cctrl | [
22,
15,
22,
3,
1327055471
] |
def delete(self, args):
"""
Delete your user account.
"""
users = self.api.read_users()
if not args.force_delete:
question = raw_input('Do you really want to delete your user? ' +
'Type "Yes" without the quotes to delete: ')
... | cloudControl/cctrl | [
22,
15,
22,
3,
1327055471
] |
def listKeys(self, args):
"""
List your public keys.
"""
users = self.api.read_users()
if args.id:
key = self.api.read_user_key(users[0]['username'], args.id)
print_key(key)
else:
keys = self.api.read_user_keys(users[0]['username'])... | cloudControl/cctrl | [
22,
15,
22,
3,
1327055471
] |
def logout(self, args):
"""
Logout a user by deleting the token.json file.
"""
self.api.set_token(None) | cloudControl/cctrl | [
22,
15,
22,
3,
1327055471
] |
def setup(self, args):
user_config = get_user_config(self.settings)
ssh_key_path = self._get_setup_ssh_key_path(user_config, args)
if not is_key_valid(ssh_key_path):
# If given key path is not default and does not exist
# we raise an error
if ssh_key_path != g... | cloudControl/cctrl | [
22,
15,
22,
3,
1327055471
] |
def config(ctx):
aim_ctx = context.AimContext(store=api.get_store(expire_on_commit=True))
ctx.obj['manager'] = aim_cfg.ConfigManager(aim_ctx, '') | noironetworks/aci-integration-module | [
9,
13,
9,
19,
1456526919
] |
def update(ctx, host):
"""Current database version."""
host = host or ''
ctx.obj['manager'].to_db(ctx.obj['conf'], host=host) | noironetworks/aci-integration-module | [
9,
13,
9,
19,
1456526919
] |
def test_sample_names_spaces(self):
runs = find_runs_in_directory(path.join(path_to_module, "sample-names-with-spaces"))
self.assertEqual(1, len(runs))
samples = runs[0].sample_list
self.assertEqual(3, len(samples))
for sample in samples:
self.assertEqual(sample.get_i... | phac-nml/irida-miseq-uploader | [
3,
1,
3,
3,
1453404960
] |
def test_completed_upload(self):
runs = find_runs_in_directory(path.join(path_to_module, "completed"))
self.assertEqual(0, len(runs)) | phac-nml/irida-miseq-uploader | [
3,
1,
3,
3,
1453404960
] |
def raw_page(self):
return self | googleapis/python-aiplatform | [
306,
205,
306,
52,
1600875819
] |
def raw_page(self):
return self | googleapis/python-aiplatform | [
306,
205,
306,
52,
1600875819
] |
def raw_page(self):
return self | googleapis/python-aiplatform | [
306,
205,
306,
52,
1600875819
] |
def raw_page(self):
return self | googleapis/python-aiplatform | [
306,
205,
306,
52,
1600875819
] |
def __init__(self, *args, **kwargs):
super(CommandTestCase, self).__init__(*args, **kwargs)
self.client = None
self.cluster_info = None
self.class_id1 = None | orientechnologies/pyorient | [
117,
36,
117,
15,
1419963921
] |
def test_boolean(self):
rec = self.client.command('create vertex v content {"abcdef":false,'
'"qwerty":TRUE}')
assert rec[0].abcdef is not True, "abcdef expected False: '%s'" % rec[
0].abcdef
assert rec[0].qwerty is True, "qwerty expected True: '%s'"... | orientechnologies/pyorient | [
117,
36,
117,
15,
1419963921
] |
def test_record_create_embedded_list(self):
# this should succeed with no exception
self.client.record_create(self.class_id1, {'@my_v_class': {'a': ['bar', 'bar']}}) | orientechnologies/pyorient | [
117,
36,
117,
15,
1419963921
] |
def test_new_orient_dict(self):
rec = self.client.command('create vertex v content {"a":false,'
'"q":TRUE}')
assert rec[0].a is False
assert rec[0].q is True
import re
# this can differ from orientDB versions, so i use a regular expression
... | orientechnologies/pyorient | [
117,
36,
117,
15,
1419963921
] |
def test_nested_objects_1(self):
res = self.client.command(
'create vertex v content {"b":[[1]],"a":{},"d":[12],"c":["x"]}'
)
print(res[0]) | orientechnologies/pyorient | [
117,
36,
117,
15,
1419963921
] |
def test_nested_objects_3(self):
res = self.client.command(
'create vertex v content {"b":[[1,{"abc":2}]]}'
)
print(res[0])
assert res[0].oRecordData['b'][0][0] == 1
assert res[0].oRecordData['b'][0][1]['abc'] == 2 | orientechnologies/pyorient | [
117,
36,
117,
15,
1419963921
] |
def test_nested_objects_5(self):
res = self.client.command(
'create vertex v content '
'{"b":[[1,{"dx":[1,2]},"abc"]],"a":{},"d":[12],"c":["x"],"s":111}'
)
assert res[0].oRecordData['b'][0][0] == 1
assert res[0].oRecordData['b'][0][1]['dx'][0] == 1
assert ... | orientechnologies/pyorient | [
117,
36,
117,
15,
1419963921
] |
def test_nested_objects_7(self):
res = self.client.command(
'create vertex v content '
'{"b":[{"xx":{"xxx":[1,2,"abc"]}}]}'
)
assert isinstance(res[0].oRecordData['b'], list)
assert isinstance(res[0].oRecordData['b'][0], dict)
assert isinstance(res[0].oRec... | orientechnologies/pyorient | [
117,
36,
117,
15,
1419963921
] |
def test_nested_objects_9(self):
res = self.client.command(
'create vertex v content '
'{"a":[[1,2],[3,4],[5,6],null]}'
)
assert isinstance(res[0].oRecordData['a'], list)
assert isinstance(res[0].oRecordData['a'][0], list)
assert isinstance(res[0].oRecordD... | orientechnologies/pyorient | [
117,
36,
117,
15,
1419963921
] |
def test_nested_objects_11(self):
res = self.client.command(
'create vertex v content '
'{"embedded_map":{"one":{"three":4}}}'
)
assert isinstance(res[0].oRecordData['embedded_map'], dict)
assert isinstance(res[0].oRecordData['embedded_map']['one'], dict)
... | orientechnologies/pyorient | [
117,
36,
117,
15,
1419963921
] |
def test_nested_objects_13(self):
res = self.client.command(
'create vertex v content '
'{"a":1,"b":{},"c":3}'
)
assert res[0].oRecordData['a'] == 1
assert isinstance(res[0].oRecordData['b'], dict)
assert len(res[0].oRecordData['b']) == 0
assert r... | orientechnologies/pyorient | [
117,
36,
117,
15,
1419963921
] |
def test_db_list(self):
self.client.connect("root", "root")
databases = self.client.db_list()
assert databases.oRecordData['databases']['GratefulDeadConcerts'] | orientechnologies/pyorient | [
117,
36,
117,
15,
1419963921
] |
def __init__(self, session_factory):
self.session_factory = session_factory | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def resolve(resource_type):
if not isinstance(resource_type, type):
raise ValueError(resource_type)
else:
m = resource_type
return m | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def __init__(self, manager):
self.manager = manager
self.query = self.resource_query_factory(self.manager.session_factory) | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def get_resources(self, query):
return self.query.filter(self.manager) | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def augment(self, resources):
return resources | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def __init__(self, manager):
self.manager = manager | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def get_resources(self, _):
log.warning('The Azure Resource Graph source '
'should not be used in production scenarios at this time.')
session = self.manager.get_session()
client = session.client('azure.mgmt.resourcegraph.ResourceGraphClient')
# empty scope will ret... | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def augment(self, resources):
return resources | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def filter(self, resource_manager, **params):
"""Query a set of resources."""
m = self.resolve(resource_manager.resource_type) # type: ChildTypeInfo
parents = resource_manager.get_parent_manager()
# Have to query separately for each parent's children.
results = []
for ... | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def __repr__(cls):
return "<Type info service:%s client: %s>" % (
cls.service,
cls.client) | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def extra_args(cls, resource_manager):
return {} | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def extra_args(cls, parent_resource):
return {} | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def __new__(cls, name, parents, attrs):
if 'filter_registry' not in attrs:
attrs['filter_registry'] = FilterRegistry(
'%s.filters' % name.lower())
if 'action_registry' not in attrs:
attrs['action_registry'] = ActionRegistry(
'%s.actions' % name.low... | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def __init__(self, data, options):
super(QueryResourceManager, self).__init__(data, options)
self.source = self.get_source(self.source_type)
self._session = None | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def get_permissions(self):
return () | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def get_session(self):
if self._session is None:
self._session = local_session(self.session_factory)
return self._session | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def get_cache_key(self, query):
return {'source_type': self.source_type, 'query': query} | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def get_model(cls):
return ResourceQuery.resolve(cls.resource_type) | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def source_type(self):
return self.data.get('source', 'describe-azure') | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def check_resource_limit(self, selection_count, population_count):
"""Check if policy's execution affects more resources then its limit.
"""
p = self.ctx.policy
max_resource_limits = MaxResourceLimit(p, selection_count, population_count)
return max_resource_limits.check_resource_... | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def register_actions_and_filters(registry, resource_class):
resource_class.action_registry.register('notify', Notify)
if 'logic-app' not in resource_class.action_registry:
resource_class.action_registry.register('logic-app', LogicAppAction) | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def source_type(self):
source = self.data.get('source', self.child_source)
if source == 'describe':
source = self.child_source
return source | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def get_session(self):
if self._session is None:
session = super(ChildResourceManager, self).get_session()
if self.resource_type.resource != constants.RESOURCE_ACTIVE_DIRECTORY:
session = session.get_session_for_resource(self.resource_type.resource)
self._sess... | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def register_child_specific(registry, resource_class):
if not issubclass(resource_class, ChildResourceManager):
return
# If Child Resource doesn't annotate parent, there is no way to filter based on
# parent properties.
if resource_class.resource_type.annotate_parent:
... | kapilt/cloud-custodian | [
2,
2,
2,
8,
1461493242
] |
def __init__(self, request, domains, *args, **kwargs):
super(DcDomainForm, self).__init__(request, None, *args, **kwargs)
self.fields['name'].choices = domains.values_list('name', 'name') | erigones/esdc-ce | [
106,
27,
106,
56,
1478554493
] |
def __init__(self, request, domain, *args, **kwargs):
super(AdminDomainForm, self).__init__(request, domain, *args, **kwargs)
self.fields['owner'].choices = get_owners(request).values_list('username', 'username')
if not request.user.is_staff:
self.fields['dc_bound'].widget.attrs['di... | erigones/esdc-ce | [
106,
27,
106,
56,
1478554493
] |
def _final_data(self, data=None):
data = super(AdminDomainForm, self)._final_data(data=data)
if self.action == 'create': # Add dc parameter when doing POST (required by api.db.utils.get_virt_object)
data['dc'] = self._request.dc.name
return data | erigones/esdc-ce | [
106,
27,
106,
56,
1478554493
] |
def __init__(self, request, data, _all=False, **kwargs):
super(DnsRecordFilterForm, self).__init__(data, **kwargs)
domains = Domain.objects.order_by('name')
user, dc = request.user, request.dc
if request.GET.get('deleted', False):
domains = domains.exclude(access=Domain.INTE... | erigones/esdc-ce | [
106,
27,
106,
56,
1478554493
] |
def __init__(self, request, domain, record, *args, **kwargs):
self.domain = domain
super(DnsRecordForm, self).__init__(request, record, *args, **kwargs) | erigones/esdc-ce | [
106,
27,
106,
56,
1478554493
] |
def api_call_args(self, domain_name):
if self.action == 'create':
return domain_name,
else:
return domain_name, self.cleaned_data['id'] | erigones/esdc-ce | [
106,
27,
106,
56,
1478554493
] |
def __init__(self, request, domain, record, *args, **kwargs):
self.domain = domain
super(MultiDnsRecordForm, self).__init__(request, record, *args, **kwargs) | erigones/esdc-ce | [
106,
27,
106,
56,
1478554493
] |
def __init__(self, task_id, msg, obj=None):
super(DetailLog, self).__init__()
self.task_id = task_id
self.msg = msg
self.obj = obj
self.dc_id = None # Do not change this, unless you know what you are doing (the "vm_zoneid_changed" case) | erigones/esdc-ce | [
106,
27,
106,
56,
1478554493
] |
def get_detail(self):
return '\n'.join('%s: %s' % (getLevelName(level), message) for level, message in self) | erigones/esdc-ce | [
106,
27,
106,
56,
1478554493
] |
def save(self, status):
"""Save task log entry if result is not None"""
if hasattr(status, '__iter__'):
status = [i for i in status if i is not None] # remove None from result
if status:
success = all(status)
else:
success = None
... | erigones/esdc-ce | [
106,
27,
106,
56,
1478554493
] |
def wrap(fun):
@wraps(fun, assigned=available_attrs(fun))
def inner(task_id, sender, **kwargs):
logger.info('Primary task %s issued a secondary mgmt monitoring task %s', sender, task_id)
status = None
# Every monitoring task should collect logs
# NOTE: How... | erigones/esdc-ce | [
106,
27,
106,
56,
1478554493
] |
def rsync_get_file(uri_from, uri_to, user, host, port, key):
cmd = [
'rsync',
'-e',
'ssh -i {} -p {} {}'.format(key, port, ' '.join(SSH_OPTIONS)),
'{}@{}:{}'.format(user, host, uri_from),
uri_to,
]
_call(cmd) | galaxyproject/pulsar | [
36,
43,
36,
69,
1403216408
] |
def scp_get_file(uri_from, uri_to, user, host, port, key):
cmd = [
'scp',
'-P', str(port),
'-i', key
] + SSH_OPTIONS + [
'{}@{}:{}'.format(user, host, uri_from),
uri_to,
]
_call(cmd) | galaxyproject/pulsar | [
36,
43,
36,
69,
1403216408
] |
def _ensure_dir(uri_to, key, port, user, host):
directory = os.path.dirname(uri_to)
cmd = [
'ssh',
'-i', key,
'-p', str(port),
] + SSH_OPTIONS + [
'{}@{}'.format(user, host),
'mkdir', '-p', directory,
]
_call(cmd) | galaxyproject/pulsar | [
36,
43,
36,
69,
1403216408
] |
def setUpClass(cls):
ds = mldb.create_dataset({'id' : 'ds', 'type' : 'sparse.mutable'})
ds.record_row('row0', [['x', 'A', 0]])
ds.record_row('row1', [['x', 'B', 0]])
ds.commit() | mldbai/mldb | [
639,
98,
639,
28,
1449592456
] |
def test_int(self):
n = mldb.get('/v1/query', q="select x from (select 17 as x)", format='atom').json()
self.assertEqual(17, n) | mldbai/mldb | [
639,
98,
639,
28,
1449592456
] |
def test_string(self):
n = mldb.get('/v1/query', q="select x from (select 'blah' as x)", format='atom').json()
self.assertEqual('blah', n) | mldbai/mldb | [
639,
98,
639,
28,
1449592456
] |
def test_error_columns(self):
msg = "Query with atom format returned multiple columns"
with self.assertRaisesRegex(ResponseException, msg):
n = mldb.get('/v1/query', q="select x,y from (select false as x, 1 as y)", format='atom').json() | mldbai/mldb | [
639,
98,
639,
28,
1449592456
] |
def test_multiple_rows_limit(self):
n = mldb.get('/v1/query', q="select x from ds limit 1", format='atom').json()
self.assertEqual('B', n) | mldbai/mldb | [
639,
98,
639,
28,
1449592456
] |
def test_error_no_column(self):
msg = "Query with atom format returned no column"
with self.assertRaisesRegex(ResponseException, msg):
n = mldb.get('/v1/query', q="select COLUMN EXPR (WHERE columnName() IN ('Z')) from (select 17 as x)", format='atom').json() | mldbai/mldb | [
639,
98,
639,
28,
1449592456
] |
def test_java() -> None:
sources = {
"src/org/pantsbuild/test/Hello.java": dedent(
"""\
package org.pantsbuild.test;
public class Hello {{
public static void main(String[] args) {{
System.out.println("Hello, World!");
}... | pantsbuild/pants | [
2553,
518,
2553,
833,
1355765944
] |
def main(args: Array[String]): Unit = {{
println("Hello, World!") | pantsbuild/pants | [
2553,
518,
2553,
833,
1355765944
] |
def __init__(self, output_dir=None, **kwargs):
self.output_dir = output_dir | tensorflow/examples | [
6911,
7012,
6911,
106,
1531779116
] |
def benchmark_with_function_custom_loops_300_epochs_2_gpus(self):
kwargs = utils.get_cifar10_kwargs()
kwargs.update({'epochs': 300, 'data_format': 'channels_first',
'bottleneck': False, 'compression': 1., 'num_gpu': 2,
'batch_size': 128})
self._run_and_report_benchmark... | tensorflow/examples | [
6911,
7012,
6911,
106,
1531779116
] |
def _run_and_report_benchmark(self, top_1_min=.944, top_1_max=.949, **kwargs):
"""Run the benchmark and report metrics.report.
Args:
top_1_min: Min value for top_1 accuracy. Default range is SOTA.
top_1_max: Max value for top_1 accuracy.
**kwargs: All args passed to the test.
"""
sta... | tensorflow/examples | [
6911,
7012,
6911,
106,
1531779116
] |
def create_project(location, with_ui=False, template=None):
"""
Create a ZeroVM application project by writing a default `zapp.yaml` in the
specified directory `location`.
:param location:
Directory location to place project files.
:param with_ui:
Defaults to `False`. If `True`,... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def _generate_job_desc(zapp):
"""
Generate the boot/system.map file contents from the zapp config file.
:param zapp:
`dict` of the contents of a ``zapp.yaml`` file.
:returns:
`dict` of the job description
"""
job = []
# TODO(mg): we should eventually reuse zvsh._nvram_escap... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def _prepare_job(tar, zapp, zapp_swift_url):
"""
:param tar:
The application .zapp file, as a :class:`tarfile.TarFile` object.
:param dict zapp:
Parsed contents of the application `zapp.yaml` specification, as a
`dict`.
:param str zapp_swift_url:
Path of the .zapp in Swif... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def _add_file_to_tar(root, path, tar, arcname=None):
"""
:param root:
Root working directory.
:param path:
File path.
:param tar:
Open :class:`tarfile.TarFile` object to add the ``files`` to.
"""
# TODO(larsbutler): document ``arcname``
LOG.info('adding %s' % path)
... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def _post_job(url, token, data, http_conn=None, response_dict=None,
content_type='application/json', content_length=None,
response_body_buffer=None):
# Modelled after swiftclient.client.post_account.
headers = {'X-Auth-Token': token,
'X-Zerovm-Execute': '1.0',
... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def authenticate(self):
"""
Authenticate with the provided credentials and cache the storage URL
and auth token as `self.url` and `self.token`, respectively.
"""
self.url, self.token = self.get_auth() | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def post_zapp(self, data, response_dict=None, content_length=None,
response_body_buffer=None):
return self._retry(None, _post_job, data,
response_dict=response_dict,
content_type='application/x-gzip',
content_leng... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def _deploy_zapp(conn, target, zapp_path, auth_opts, force=False):
"""Upload all of the necessary files for a zapp.
Returns the name an uploaded index file, or the target if no
index.html file was uploaded.
:param bool force:
Force deployment, even if the target container is not empty. This me... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def _prepare_auth(version, args, conn):
"""
:param str version:
Auth version: "0.0", "1.0", or "2.0". "0.0" indicates "no auth".
:param args:
:class:`argparse.Namespace` instance, with attributes representing the
various authentication parameters
:param conn:
:class:`Zero... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def deploy_project(args):
conn = _get_zerocloud_conn(args)
conn.authenticate()
ui_auth_version = conn.auth_version
# We can now reset the auth for the web UI, if needed
if args.no_ui_auth:
ui_auth_version = '0.0'
auth = _prepare_auth(ui_auth_version, args, conn)
auth_opts = jinja2.... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def _get_exec_table_data(headers):
"""Extract a stats table from execution HTTP response headers.
Stats include things like node name, execution time, number of
reads/writes, bytes read/written, etc.
:param dict headers:
`dict` of response headers from a job execution request. It must
... | zerovm/zerovm-cli | [
6,
7,
6,
10,
1384778504
] |
def __init__(self, **kwargs):
super(H2OXGBoostEstimator, self).__init__()
self._parms = {}
names_list = {"model_id", "training_frame", "validation_frame", "nfolds", "keep_cross_validation_models",
"keep_cross_validation_predictions", "keep_cross_validation_fold_assignment",... | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def training_frame(self):
"""
Id of the training data frame.
Type: ``H2OFrame``.
"""
return self._parms.get("training_frame") | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.