code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def getSets(self, **kwargs):
'''
A way to get different sets from a query.
All parameters are optional, but you should probably use some (so that you get results)
:param str query: The thing you're searching for.
:param str theme: The theme of the set.
:param str subthem... | def function[getSets, parameter[self]]:
constant[
A way to get different sets from a query.
All parameters are optional, but you should probably use some (so that you get results)
:param str query: The thing you're searching for.
:param str theme: The theme of the set.
:... | keyword[def] identifier[getSets] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[params] ={
literal[string] : identifier[self] . identifier[apiKey] ,
literal[string] : identifier[self] . identifier[userHash] ,
literal[string] : identifier... | def getSets(self, **kwargs):
"""
A way to get different sets from a query.
All parameters are optional, but you should probably use some (so that you get results)
:param str query: The thing you're searching for.
:param str theme: The theme of the set.
:param str subtheme: T... |
def stats_set_value(self, key, value=1):
"""Set the specified key/value in the per-message measurements
.. versionadded:: 3.13.0
.. note:: If this method is called when there is not a message being
processed, a message will be logged at the ``warning`` level to
indicate... | def function[stats_set_value, parameter[self, key, value]]:
constant[Set the specified key/value in the per-message measurements
.. versionadded:: 3.13.0
.. note:: If this method is called when there is not a message being
processed, a message will be logged at the ``warning`` leve... | keyword[def] identifier[stats_set_value] ( identifier[self] , identifier[key] , identifier[value] = literal[int] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_measurement] :
keyword[if] keyword[not] identifier[self] . identifier[IGNORE_OOB_STATS] :
... | def stats_set_value(self, key, value=1):
"""Set the specified key/value in the per-message measurements
.. versionadded:: 3.13.0
.. note:: If this method is called when there is not a message being
processed, a message will be logged at the ``warning`` level to
indicate the... |
def makeStickyEdataFile(Economy,ignore_periods,description='',filename=None,save_data=False,calc_micro_stats=True,meas_err_base=None):
'''
Makes descriptive statistics and macroeconomic data file. Behaves slightly
differently for heterogeneous agents vs representative agent models.
Parameters
-----... | def function[makeStickyEdataFile, parameter[Economy, ignore_periods, description, filename, save_data, calc_micro_stats, meas_err_base]]:
constant[
Makes descriptive statistics and macroeconomic data file. Behaves slightly
differently for heterogeneous agents vs representative agent models.
Paramet... | keyword[def] identifier[makeStickyEdataFile] ( identifier[Economy] , identifier[ignore_periods] , identifier[description] = literal[string] , identifier[filename] = keyword[None] , identifier[save_data] = keyword[False] , identifier[calc_micro_stats] = keyword[True] , identifier[meas_err_base] = keyword[None] ):
... | def makeStickyEdataFile(Economy, ignore_periods, description='', filename=None, save_data=False, calc_micro_stats=True, meas_err_base=None):
"""
Makes descriptive statistics and macroeconomic data file. Behaves slightly
differently for heterogeneous agents vs representative agent models.
Parameters
... |
def stop(self):
"""
Stops the backend process.
"""
if self._process is None:
return
if self._shared:
BackendManager.SHARE_COUNT -= 1
if BackendManager.SHARE_COUNT:
return
comm('stopping backend process')
# close ... | def function[stop, parameter[self]]:
constant[
Stops the backend process.
]
if compare[name[self]._process is constant[None]] begin[:]
return[None]
if name[self]._shared begin[:]
<ast.AugAssign object at 0x7da18f09fa90>
if name[BackendManager].SHAR... | keyword[def] identifier[stop] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_process] keyword[is] keyword[None] :
keyword[return]
keyword[if] identifier[self] . identifier[_shared] :
identifier[BackendManager] . identifier[SH... | def stop(self):
"""
Stops the backend process.
"""
if self._process is None:
return # depends on [control=['if'], data=[]]
if self._shared:
BackendManager.SHARE_COUNT -= 1
if BackendManager.SHARE_COUNT:
return # depends on [control=['if'], data=[]] # de... |
def runpf_consumer_loop(
in_queue_url,
workdir,
lc_altexts=('',),
wait_time_seconds=5,
shutdown_check_timer_seconds=60.0,
sqs_client=None,
s3_client=None
):
"""This runs period-finding in a loop until interrupted.
Consumes work task items from an input qu... | def function[runpf_consumer_loop, parameter[in_queue_url, workdir, lc_altexts, wait_time_seconds, shutdown_check_timer_seconds, sqs_client, s3_client]]:
constant[This runs period-finding in a loop until interrupted.
Consumes work task items from an input queue set up by `runpf_producer_loop`
above.
... | keyword[def] identifier[runpf_consumer_loop] (
identifier[in_queue_url] ,
identifier[workdir] ,
identifier[lc_altexts] =( literal[string] ,),
identifier[wait_time_seconds] = literal[int] ,
identifier[shutdown_check_timer_seconds] = literal[int] ,
identifier[sqs_client] = keyword[None] ,
identifier[s3_client] =... | def runpf_consumer_loop(in_queue_url, workdir, lc_altexts=('',), wait_time_seconds=5, shutdown_check_timer_seconds=60.0, sqs_client=None, s3_client=None):
"""This runs period-finding in a loop until interrupted.
Consumes work task items from an input queue set up by `runpf_producer_loop`
above.
Parame... |
def update(self, n=1):
"""Increment current value."""
with self._lock:
self._pbar.update(n)
self.refresh() | def function[update, parameter[self, n]]:
constant[Increment current value.]
with name[self]._lock begin[:]
call[name[self]._pbar.update, parameter[name[n]]]
call[name[self].refresh, parameter[]] | keyword[def] identifier[update] ( identifier[self] , identifier[n] = literal[int] ):
literal[string]
keyword[with] identifier[self] . identifier[_lock] :
identifier[self] . identifier[_pbar] . identifier[update] ( identifier[n] )
identifier[self] . identifier[refresh] () | def update(self, n=1):
"""Increment current value."""
with self._lock:
self._pbar.update(n)
self.refresh() # depends on [control=['with'], data=[]] |
def get_all(cls):
''' Gets all available instances of this model from the database '''
redis = cls.get_redis()
return list(map(
lambda id: cls.get(id),
map(
debyte_string,
redis.smembers(cls.members_key())
)
)) | def function[get_all, parameter[cls]]:
constant[ Gets all available instances of this model from the database ]
variable[redis] assign[=] call[name[cls].get_redis, parameter[]]
return[call[name[list], parameter[call[name[map], parameter[<ast.Lambda object at 0x7da18dc9bf70>, call[name[map], paramete... | keyword[def] identifier[get_all] ( identifier[cls] ):
literal[string]
identifier[redis] = identifier[cls] . identifier[get_redis] ()
keyword[return] identifier[list] ( identifier[map] (
keyword[lambda] identifier[id] : identifier[cls] . identifier[get] ( identifier[id] ),
... | def get_all(cls):
""" Gets all available instances of this model from the database """
redis = cls.get_redis()
return list(map(lambda id: cls.get(id), map(debyte_string, redis.smembers(cls.members_key())))) |
def _step99(self, in_row, tmp_row, out_row):
"""
Validates all mandatory fields are in the output row and are filled.
:param dict in_row: The input row.
:param dict tmp_row: Not used.
:param dict out_row: The output row.
"""
park_info = ''
for field in se... | def function[_step99, parameter[self, in_row, tmp_row, out_row]]:
constant[
Validates all mandatory fields are in the output row and are filled.
:param dict in_row: The input row.
:param dict tmp_row: Not used.
:param dict out_row: The output row.
]
variable[park... | keyword[def] identifier[_step99] ( identifier[self] , identifier[in_row] , identifier[tmp_row] , identifier[out_row] ):
literal[string]
identifier[park_info] = literal[string]
keyword[for] identifier[field] keyword[in] identifier[self] . identifier[_mandatory_fields] :
key... | def _step99(self, in_row, tmp_row, out_row):
"""
Validates all mandatory fields are in the output row and are filled.
:param dict in_row: The input row.
:param dict tmp_row: Not used.
:param dict out_row: The output row.
"""
park_info = ''
for field in self._mandator... |
def _check_job_status(self, job, desc, status_key_name):
"""Check to see if the job completed successfully and, if not, construct and
raise a ValueError.
Args:
job (str): The name of the job to check.
desc (dict[str, str]): The result of ``describe_training_job()``.
... | def function[_check_job_status, parameter[self, job, desc, status_key_name]]:
constant[Check to see if the job completed successfully and, if not, construct and
raise a ValueError.
Args:
job (str): The name of the job to check.
desc (dict[str, str]): The result of ``desc... | keyword[def] identifier[_check_job_status] ( identifier[self] , identifier[job] , identifier[desc] , identifier[status_key_name] ):
literal[string]
identifier[status] = identifier[desc] [ identifier[status_key_name] ]
identifier[status] = identifier[_STATUS_CODE_TABLE] . identifie... | def _check_job_status(self, job, desc, status_key_name):
"""Check to see if the job completed successfully and, if not, construct and
raise a ValueError.
Args:
job (str): The name of the job to check.
desc (dict[str, str]): The result of ``describe_training_job()``.
... |
def get_parent_folder(self):
""" Get the parent folder from attribute self.parent or
getting it from the cloud
:return: Parent Folder
:rtype: mailbox.Folder or None
"""
if self.root:
return None
if self.parent:
return self.parent
... | def function[get_parent_folder, parameter[self]]:
constant[ Get the parent folder from attribute self.parent or
getting it from the cloud
:return: Parent Folder
:rtype: mailbox.Folder or None
]
if name[self].root begin[:]
return[constant[None]]
if name[se... | keyword[def] identifier[get_parent_folder] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[root] :
keyword[return] keyword[None]
keyword[if] identifier[self] . identifier[parent] :
keyword[return] identifier[self] . identifier[... | def get_parent_folder(self):
""" Get the parent folder from attribute self.parent or
getting it from the cloud
:return: Parent Folder
:rtype: mailbox.Folder or None
"""
if self.root:
return None # depends on [control=['if'], data=[]]
if self.parent:
return s... |
def map_sid2sub(self, sid, sub):
"""
Store the connection between a Session ID and a subject ID.
:param sid: Session ID
:param sub: subject ID
"""
self.set('sid2sub', sid, sub)
self.set('sub2sid', sub, sid) | def function[map_sid2sub, parameter[self, sid, sub]]:
constant[
Store the connection between a Session ID and a subject ID.
:param sid: Session ID
:param sub: subject ID
]
call[name[self].set, parameter[constant[sid2sub], name[sid], name[sub]]]
call[name[self].se... | keyword[def] identifier[map_sid2sub] ( identifier[self] , identifier[sid] , identifier[sub] ):
literal[string]
identifier[self] . identifier[set] ( literal[string] , identifier[sid] , identifier[sub] )
identifier[self] . identifier[set] ( literal[string] , identifier[sub] , identifier[sid]... | def map_sid2sub(self, sid, sub):
"""
Store the connection between a Session ID and a subject ID.
:param sid: Session ID
:param sub: subject ID
"""
self.set('sid2sub', sid, sub)
self.set('sub2sid', sub, sid) |
def distance_to_contact(D, alpha=1):
"""Compute contact matrix from input distance matrix. Distance values of
zeroes are given the largest contact count otherwise inferred non-zero
distance values.
"""
if callable(alpha):
distance_function = alpha
else:
try:
a = np.f... | def function[distance_to_contact, parameter[D, alpha]]:
constant[Compute contact matrix from input distance matrix. Distance values of
zeroes are given the largest contact count otherwise inferred non-zero
distance values.
]
if call[name[callable], parameter[name[alpha]]] begin[:]
... | keyword[def] identifier[distance_to_contact] ( identifier[D] , identifier[alpha] = literal[int] ):
literal[string]
keyword[if] identifier[callable] ( identifier[alpha] ):
identifier[distance_function] = identifier[alpha]
keyword[else] :
keyword[try] :
identifier[a] = ... | def distance_to_contact(D, alpha=1):
"""Compute contact matrix from input distance matrix. Distance values of
zeroes are given the largest contact count otherwise inferred non-zero
distance values.
"""
if callable(alpha):
distance_function = alpha # depends on [control=['if'], data=[]]
... |
def drawQuad(self, img=None, quad=None, thickness=30):
'''
Draw the quad into given img
'''
if img is None:
img = self.img
if quad is None:
quad = self.quad
q = np.int32(quad)
c = int(img.max())
cv2.line(img, tuple(q[0]),... | def function[drawQuad, parameter[self, img, quad, thickness]]:
constant[
Draw the quad into given img
]
if compare[name[img] is constant[None]] begin[:]
variable[img] assign[=] name[self].img
if compare[name[quad] is constant[None]] begin[:]
varia... | keyword[def] identifier[drawQuad] ( identifier[self] , identifier[img] = keyword[None] , identifier[quad] = keyword[None] , identifier[thickness] = literal[int] ):
literal[string]
keyword[if] identifier[img] keyword[is] keyword[None] :
identifier[img] = identifier[self] . identif... | def drawQuad(self, img=None, quad=None, thickness=30):
"""
Draw the quad into given img
"""
if img is None:
img = self.img # depends on [control=['if'], data=['img']]
if quad is None:
quad = self.quad # depends on [control=['if'], data=['quad']]
q = np.int32(quad)
... |
def _ScheduleGenericHunt(hunt_obj):
"""Adds foreman rules for a generic hunt."""
# TODO: Migrate foreman conditions to use relation expiration
# durations instead of absolute timestamps.
foreman_condition = foreman_rules.ForemanCondition(
creation_time=rdfvalue.RDFDatetime.Now(),
expiration_time=hun... | def function[_ScheduleGenericHunt, parameter[hunt_obj]]:
constant[Adds foreman rules for a generic hunt.]
variable[foreman_condition] assign[=] call[name[foreman_rules].ForemanCondition, parameter[]]
call[name[foreman_condition].Validate, parameter[]]
call[name[data_store].REL_DB.WriteFo... | keyword[def] identifier[_ScheduleGenericHunt] ( identifier[hunt_obj] ):
literal[string]
identifier[foreman_condition] = identifier[foreman_rules] . identifier[ForemanCondition] (
identifier[creation_time] = identifier[rdfvalue] . identifier[RDFDatetime] . identifier[Now] (),
identifier[expiration_t... | def _ScheduleGenericHunt(hunt_obj):
"""Adds foreman rules for a generic hunt."""
# TODO: Migrate foreman conditions to use relation expiration
# durations instead of absolute timestamps.
foreman_condition = foreman_rules.ForemanCondition(creation_time=rdfvalue.RDFDatetime.Now(), expiration_time=hunt_obj... |
def _populate(self):
"""
**Purpose**: Populate the ResourceManager class with the validated
resource description
"""
if self._validated:
self._prof.prof('populating rmgr', uid=self._uid)
self._logger.debug('Populating resource manager ... | def function[_populate, parameter[self]]:
constant[
**Purpose**: Populate the ResourceManager class with the validated
resource description
]
if name[self]._validated begin[:]
call[name[self]._prof.prof, parameter[constant[populating rmgr]]]
... | keyword[def] identifier[_populate] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_validated] :
identifier[self] . identifier[_prof] . identifier[prof] ( literal[string] , identifier[uid] = identifier[self] . identifier[_uid] )
identifie... | def _populate(self):
"""
**Purpose**: Populate the ResourceManager class with the validated
resource description
"""
if self._validated:
self._prof.prof('populating rmgr', uid=self._uid)
self._logger.debug('Populating resource manager object')
s... |
def decode(model_path_prefix: Union[str, Path],
input_paths: Sequence[Path],
label_set: Set[str],
*,
feature_type: str = "fbank", #TODO Make this None and infer feature_type from dimension of NN input layer.
batch_size: int = 64,
feat_dir: Optional[Path]... | def function[decode, parameter[model_path_prefix, input_paths, label_set]]:
constant[Use an existing tensorflow model that exists on disk to decode
WAV files.
Args:
model_path_prefix: The path to the saved tensorflow model.
This is the full prefix to the ".ckpt" file.... | keyword[def] identifier[decode] ( identifier[model_path_prefix] : identifier[Union] [ identifier[str] , identifier[Path] ],
identifier[input_paths] : identifier[Sequence] [ identifier[Path] ],
identifier[label_set] : identifier[Set] [ identifier[str] ],
*,
identifier[feature_type] : identifier[str] = literal[strin... | def decode(model_path_prefix: Union[str, Path], input_paths: Sequence[Path], label_set: Set[str], *, feature_type: str='fbank', batch_size: int=64, feat_dir: Optional[Path]=None, batch_x_name: str='batch_x:0', batch_x_lens_name: str='batch_x_lens:0', output_name: str='hyp_dense_decoded:0') -> List[List[str]]: #TODO Ma... |
def get_primary_key(self, table):
"""Retrieve the column which is the primary key for a table."""
for column in self.get_schema(table):
if len(column) > 3 and 'pri' in column[3].lower():
return column[0] | def function[get_primary_key, parameter[self, table]]:
constant[Retrieve the column which is the primary key for a table.]
for taget[name[column]] in starred[call[name[self].get_schema, parameter[name[table]]]] begin[:]
if <ast.BoolOp object at 0x7da1b0bd23e0> begin[:]
return... | keyword[def] identifier[get_primary_key] ( identifier[self] , identifier[table] ):
literal[string]
keyword[for] identifier[column] keyword[in] identifier[self] . identifier[get_schema] ( identifier[table] ):
keyword[if] identifier[len] ( identifier[column] )> literal[int] keyword[... | def get_primary_key(self, table):
"""Retrieve the column which is the primary key for a table."""
for column in self.get_schema(table):
if len(column) > 3 and 'pri' in column[3].lower():
return column[0] # depends on [control=['if'], data=[]] # depends on [control=['for'], data=['column']] |
def group(ctx, project, group): # pylint:disable=redefined-outer-name
"""Commands for experiment groups."""
ctx.obj = ctx.obj or {}
ctx.obj['project'] = project
ctx.obj['group'] = group | def function[group, parameter[ctx, project, group]]:
constant[Commands for experiment groups.]
name[ctx].obj assign[=] <ast.BoolOp object at 0x7da1aff1e4d0>
call[name[ctx].obj][constant[project]] assign[=] name[project]
call[name[ctx].obj][constant[group]] assign[=] name[group] | keyword[def] identifier[group] ( identifier[ctx] , identifier[project] , identifier[group] ):
literal[string]
identifier[ctx] . identifier[obj] = identifier[ctx] . identifier[obj] keyword[or] {}
identifier[ctx] . identifier[obj] [ literal[string] ]= identifier[project]
identifier[ctx] . identif... | def group(ctx, project, group): # pylint:disable=redefined-outer-name
'Commands for experiment groups.'
ctx.obj = ctx.obj or {}
ctx.obj['project'] = project
ctx.obj['group'] = group |
def del_all_svc_comments(self, service):
"""Delete all service comments
Format of the line that triggers function call::
DEL_ALL_SVC_COMMENTS;<host_name>;<service_description>
:param service: service to edit
:type service: alignak.objects.service.Service
:return: None
... | def function[del_all_svc_comments, parameter[self, service]]:
constant[Delete all service comments
Format of the line that triggers function call::
DEL_ALL_SVC_COMMENTS;<host_name>;<service_description>
:param service: service to edit
:type service: alignak.objects.service.Serv... | keyword[def] identifier[del_all_svc_comments] ( identifier[self] , identifier[service] ):
literal[string]
identifier[comments] = identifier[list] ( identifier[service] . identifier[comments] . identifier[keys] ())
keyword[for] identifier[uuid] keyword[in] identifier[comments] :
... | def del_all_svc_comments(self, service):
"""Delete all service comments
Format of the line that triggers function call::
DEL_ALL_SVC_COMMENTS;<host_name>;<service_description>
:param service: service to edit
:type service: alignak.objects.service.Service
:return: None
... |
def declare_selfvars(self):
"""
A block to declare self variables
"""
self._dictErr = {
'inputDirFail' : {
'action' : 'trying to check on the input directory, ',
'error' : 'directory not found. This is a *required* input',
... | def function[declare_selfvars, parameter[self]]:
constant[
A block to declare self variables
]
name[self]._dictErr assign[=] dictionary[[<ast.Constant object at 0x7da2054a4d90>, <ast.Constant object at 0x7da2054a61a0>, <ast.Constant object at 0x7da2054a5ea0>, <ast.Constant object at 0x7d... | keyword[def] identifier[declare_selfvars] ( identifier[self] ):
literal[string]
identifier[self] . identifier[_dictErr] ={
literal[string] :{
literal[string] : literal[string] ,
literal[string] : literal[string] ,
literal[string] : literal[int] },
litera... | def declare_selfvars(self):
"""
A block to declare self variables
"""
self._dictErr = {'inputDirFail': {'action': 'trying to check on the input directory, ', 'error': 'directory not found. This is a *required* input', 'exitCode': 1}, 'inputReadCallback': {'action': 'checking on the status of the... |
def get_audits():
"""Get OS hardening security limits audits.
:returns: dictionary of audits
"""
audits = []
settings = utils.get_settings('os')
# Ensure that the /etc/security/limits.d directory is only writable
# by the root user, but others can execute and read.
audits.append(Direc... | def function[get_audits, parameter[]]:
constant[Get OS hardening security limits audits.
:returns: dictionary of audits
]
variable[audits] assign[=] list[[]]
variable[settings] assign[=] call[name[utils].get_settings, parameter[constant[os]]]
call[name[audits].append, parameter... | keyword[def] identifier[get_audits] ():
literal[string]
identifier[audits] =[]
identifier[settings] = identifier[utils] . identifier[get_settings] ( literal[string] )
identifier[audits] . identifier[append] ( identifier[DirectoryPermissionAudit] ( literal[string] ,
identifier[user... | def get_audits():
"""Get OS hardening security limits audits.
:returns: dictionary of audits
"""
audits = []
settings = utils.get_settings('os')
# Ensure that the /etc/security/limits.d directory is only writable
# by the root user, but others can execute and read.
audits.append(Direct... |
def columns(self, **kw):
"""Creates a results set of column names in specified tables by
executing the ODBC SQLColumns function. Each row fetched has the
following columns.
:param table: the table tname
:param catalog: the catalog name
:param schema: the schmea name
... | def function[columns, parameter[self]]:
constant[Creates a results set of column names in specified tables by
executing the ODBC SQLColumns function. Each row fetched has the
following columns.
:param table: the table tname
:param catalog: the catalog name
:param schema:... | keyword[def] identifier[columns] ( identifier[self] ,** identifier[kw] ):
literal[string]
identifier[fut] = identifier[self] . identifier[_run_operation] ( identifier[self] . identifier[_impl] . identifier[columns] ,** identifier[kw] )
keyword[return] identifier[fut] | def columns(self, **kw):
"""Creates a results set of column names in specified tables by
executing the ODBC SQLColumns function. Each row fetched has the
following columns.
:param table: the table tname
:param catalog: the catalog name
:param schema: the schmea name
... |
def get_description(self, description_type='Abstract'):
"""Get DataCite description."""
if 'descriptions' in self.xml:
if isinstance(self.xml['descriptions']['description'], list):
for description in self.xml['descriptions']['description']:
if description_... | def function[get_description, parameter[self, description_type]]:
constant[Get DataCite description.]
if compare[constant[descriptions] in name[self].xml] begin[:]
if call[name[isinstance], parameter[call[call[name[self].xml][constant[descriptions]]][constant[description]], name[list]]] ... | keyword[def] identifier[get_description] ( identifier[self] , identifier[description_type] = literal[string] ):
literal[string]
keyword[if] literal[string] keyword[in] identifier[self] . identifier[xml] :
keyword[if] identifier[isinstance] ( identifier[self] . identifier[xml] [ lit... | def get_description(self, description_type='Abstract'):
"""Get DataCite description."""
if 'descriptions' in self.xml:
if isinstance(self.xml['descriptions']['description'], list):
for description in self.xml['descriptions']['description']:
if description_type in description:... |
def tornado_combiner(configs, use_gevent=False, start=True, monkey_patch=None,
Container=None, Server=None, threadpool=None): # pragma: no cover
"""Combine servers in one tornado event loop process
:param configs: [
{
'app': Microservice Application or another wsgi app... | def function[tornado_combiner, parameter[configs, use_gevent, start, monkey_patch, Container, Server, threadpool]]:
constant[Combine servers in one tornado event loop process
:param configs: [
{
'app': Microservice Application or another wsgi application, required
'port': in... | keyword[def] identifier[tornado_combiner] ( identifier[configs] , identifier[use_gevent] = keyword[False] , identifier[start] = keyword[True] , identifier[monkey_patch] = keyword[None] ,
identifier[Container] = keyword[None] , identifier[Server] = keyword[None] , identifier[threadpool] = keyword[None] ):
litera... | def tornado_combiner(configs, use_gevent=False, start=True, monkey_patch=None, Container=None, Server=None, threadpool=None): # pragma: no cover
'Combine servers in one tornado event loop process\n\n :param configs: [\n {\n \'app\': Microservice Application or another wsgi application, require... |
def check_cache(self, *args):
"""Call linecache.checkcache() safely protecting our cached values.
"""
# First call the orignal checkcache as intended
linecache._checkcache_ori(*args)
# Then, update back the cache with our data, so that tracebacks related
# to our compiled... | def function[check_cache, parameter[self]]:
constant[Call linecache.checkcache() safely protecting our cached values.
]
call[name[linecache]._checkcache_ori, parameter[<ast.Starred object at 0x7da18ede5870>]]
call[name[linecache].cache.update, parameter[name[linecache]._ipython_cache]] | keyword[def] identifier[check_cache] ( identifier[self] ,* identifier[args] ):
literal[string]
identifier[linecache] . identifier[_checkcache_ori] (* identifier[args] )
identifier[linecache] . identifier[cache] . identifier[update] ( identifier[linecache] . ident... | def check_cache(self, *args):
"""Call linecache.checkcache() safely protecting our cached values.
"""
# First call the orignal checkcache as intended
linecache._checkcache_ori(*args)
# Then, update back the cache with our data, so that tracebacks related
# to our compiled codes can be produc... |
def get_edgestore_handle(
client: arango.client.ArangoClient,
username=None,
password=None,
edgestore_db_name: str = edgestore_db_name,
edgestore_edges_name: str = edgestore_edges_name,
edgestore_nodes_name: str = edgestore_nodes_name,
edgestore_pipeline_name: str = edgestore_pipeline_name,
... | def function[get_edgestore_handle, parameter[client, username, password, edgestore_db_name, edgestore_edges_name, edgestore_nodes_name, edgestore_pipeline_name, edgestore_pipeline_stats_name, edgestore_pipeline_errors_name]]:
constant[Get Edgestore arangodb database handle
Args:
client (arango.clie... | keyword[def] identifier[get_edgestore_handle] (
identifier[client] : identifier[arango] . identifier[client] . identifier[ArangoClient] ,
identifier[username] = keyword[None] ,
identifier[password] = keyword[None] ,
identifier[edgestore_db_name] : identifier[str] = identifier[edgestore_db_name] ,
identifier[edge... | def get_edgestore_handle(client: arango.client.ArangoClient, username=None, password=None, edgestore_db_name: str=edgestore_db_name, edgestore_edges_name: str=edgestore_edges_name, edgestore_nodes_name: str=edgestore_nodes_name, edgestore_pipeline_name: str=edgestore_pipeline_name, edgestore_pipeline_stats_name: str=ed... |
def data(self, data, part=False, dataset=''):
"""Parse data and update links.
Parameters
----------
data
Data to parse.
part : `bool`, optional
True if data is partial (default: `False`).
dataset : `str`, optional
Dataset key prefix (d... | def function[data, parameter[self, data, part, dataset]]:
constant[Parse data and update links.
Parameters
----------
data
Data to parse.
part : `bool`, optional
True if data is partial (default: `False`).
dataset : `str`, optional
Dat... | keyword[def] identifier[data] ( identifier[self] , identifier[data] , identifier[part] = keyword[False] , identifier[dataset] = literal[string] ):
literal[string]
identifier[links] = identifier[self] . identifier[parser] ( identifier[self] . identifier[scanner] ( identifier[data] , identifier[part]... | def data(self, data, part=False, dataset=''):
"""Parse data and update links.
Parameters
----------
data
Data to parse.
part : `bool`, optional
True if data is partial (default: `False`).
dataset : `str`, optional
Dataset key prefix (defau... |
def _joinedQnames(self, _list):
"""util for returning a string joinin names of entities *used only in info command*"""
try:
s = "; ".join([p.qname for p in _list])
except:
s = "; ".join([p for p in _list])
return s | def function[_joinedQnames, parameter[self, _list]]:
constant[util for returning a string joinin names of entities *used only in info command*]
<ast.Try object at 0x7da1b10139a0>
return[name[s]] | keyword[def] identifier[_joinedQnames] ( identifier[self] , identifier[_list] ):
literal[string]
keyword[try] :
identifier[s] = literal[string] . identifier[join] ([ identifier[p] . identifier[qname] keyword[for] identifier[p] keyword[in] identifier[_list] ])
keyword[excep... | def _joinedQnames(self, _list):
"""util for returning a string joinin names of entities *used only in info command*"""
try:
s = '; '.join([p.qname for p in _list]) # depends on [control=['try'], data=[]]
except:
s = '; '.join([p for p in _list]) # depends on [control=['except'], data=[]]
... |
def report(self, msg, do_reset=False, file=sys.stdout):
"""Print to stdout msg followed by the runtime.
When true, do_reset will result in a reset of start time.
"""
print >> file, "%s (%s s)" % (msg, time.time() - self.start)
if do_reset:
self.start = time.time() | def function[report, parameter[self, msg, do_reset, file]]:
constant[Print to stdout msg followed by the runtime.
When true, do_reset will result in a reset of start time.
]
tuple[[<ast.BinOp object at 0x7da207f996f0>, <ast.BinOp object at 0x7da207f99e10>]]
if name[do_reset] be... | keyword[def] identifier[report] ( identifier[self] , identifier[msg] , identifier[do_reset] = keyword[False] , identifier[file] = identifier[sys] . identifier[stdout] ):
literal[string]
identifier[print] >> identifier[file] , literal[string] %( identifier[msg] , identifier[time] . identifier[time] ... | def report(self, msg, do_reset=False, file=sys.stdout):
"""Print to stdout msg followed by the runtime.
When true, do_reset will result in a reset of start time.
"""
(print >> file, '%s (%s s)' % (msg, time.time() - self.start))
if do_reset:
self.start = time.time() # depends on [... |
def list_team_repos(team_name, profile="github", ignore_cache=False):
'''
Gets the repo details for a given team as a dict from repo_name to repo details.
Note that repo names are always in lower case.
team_name
The name of the team from which to list repos.
profile
The name of the... | def function[list_team_repos, parameter[team_name, profile, ignore_cache]]:
constant[
Gets the repo details for a given team as a dict from repo_name to repo details.
Note that repo names are always in lower case.
team_name
The name of the team from which to list repos.
profile
... | keyword[def] identifier[list_team_repos] ( identifier[team_name] , identifier[profile] = literal[string] , identifier[ignore_cache] = keyword[False] ):
literal[string]
identifier[cached_team] = identifier[get_team] ( identifier[team_name] , identifier[profile] = identifier[profile] )
keyword[if] keyw... | def list_team_repos(team_name, profile='github', ignore_cache=False):
"""
Gets the repo details for a given team as a dict from repo_name to repo details.
Note that repo names are always in lower case.
team_name
The name of the team from which to list repos.
profile
The name of the... |
def job(self, name):
"""
Method for searching specific job by it's name.
:param name: name of the job to search.
:return: found job or None.
:rtype: yagocd.resources.job.JobInstance
"""
for job in self.jobs():
if job.data.name == name:
... | def function[job, parameter[self, name]]:
constant[
Method for searching specific job by it's name.
:param name: name of the job to search.
:return: found job or None.
:rtype: yagocd.resources.job.JobInstance
]
for taget[name[job]] in starred[call[name[self].jobs... | keyword[def] identifier[job] ( identifier[self] , identifier[name] ):
literal[string]
keyword[for] identifier[job] keyword[in] identifier[self] . identifier[jobs] ():
keyword[if] identifier[job] . identifier[data] . identifier[name] == identifier[name] :
keyword[re... | def job(self, name):
"""
Method for searching specific job by it's name.
:param name: name of the job to search.
:return: found job or None.
:rtype: yagocd.resources.job.JobInstance
"""
for job in self.jobs():
if job.data.name == name:
return job # d... |
def read(self, path):
"""Read EPW weather data from path.
Args:
path (str): path to read weather data from
"""
with open(path, "r") as f:
for line in f:
line = line.strip()
match_obj_name = re.search(r"^([A-Z][A-Z/ \d]+),", line)
... | def function[read, parameter[self, path]]:
constant[Read EPW weather data from path.
Args:
path (str): path to read weather data from
]
with call[name[open], parameter[name[path], constant[r]]] begin[:]
for taget[name[line]] in starred[name[f]] begin[:]
... | keyword[def] identifier[read] ( identifier[self] , identifier[path] ):
literal[string]
keyword[with] identifier[open] ( identifier[path] , literal[string] ) keyword[as] identifier[f] :
keyword[for] identifier[line] keyword[in] identifier[f] :
identifier[line] = id... | def read(self, path):
"""Read EPW weather data from path.
Args:
path (str): path to read weather data from
"""
with open(path, 'r') as f:
for line in f:
line = line.strip()
match_obj_name = re.search('^([A-Z][A-Z/ \\d]+),', line)
if match... |
def train_fn(data_dir=None, output_dir=None,
model_class=gin.REQUIRED, dataset=gin.REQUIRED,
input_names=None, target_names=None,
train_steps=1000, eval_steps=1, eval_frequency=100):
"""Train the given model on the given dataset.
Args:
data_dir: Directory where the data i... | def function[train_fn, parameter[data_dir, output_dir, model_class, dataset, input_names, target_names, train_steps, eval_steps, eval_frequency]]:
constant[Train the given model on the given dataset.
Args:
data_dir: Directory where the data is located.
output_dir: Directory where to put the logs and ... | keyword[def] identifier[train_fn] ( identifier[data_dir] = keyword[None] , identifier[output_dir] = keyword[None] ,
identifier[model_class] = identifier[gin] . identifier[REQUIRED] , identifier[dataset] = identifier[gin] . identifier[REQUIRED] ,
identifier[input_names] = keyword[None] , identifier[target_names] = k... | def train_fn(data_dir=None, output_dir=None, model_class=gin.REQUIRED, dataset=gin.REQUIRED, input_names=None, target_names=None, train_steps=1000, eval_steps=1, eval_frequency=100):
"""Train the given model on the given dataset.
Args:
data_dir: Directory where the data is located.
output_dir: Directory ... |
def as_set(self, preserve_casing=False):
"""Return the set as real python set type. When calling this, all
the items are converted to lowercase and the ordering is lost.
:param preserve_casing: if set to `True` the items in the set returned
will have the origina... | def function[as_set, parameter[self, preserve_casing]]:
constant[Return the set as real python set type. When calling this, all
the items are converted to lowercase and the ordering is lost.
:param preserve_casing: if set to `True` the items in the set returned
... | keyword[def] identifier[as_set] ( identifier[self] , identifier[preserve_casing] = keyword[False] ):
literal[string]
keyword[if] identifier[preserve_casing] :
keyword[return] identifier[set] ( identifier[self] . identifier[_headers] )
keyword[return] identifier[set] ( ident... | def as_set(self, preserve_casing=False):
"""Return the set as real python set type. When calling this, all
the items are converted to lowercase and the ordering is lost.
:param preserve_casing: if set to `True` the items in the set returned
will have the original ca... |
def _bcrypt_encrypt(certificate_or_public_key, data, rsa_oaep_padding=False):
"""
Encrypts a value using an RSA public key via CNG
:param certificate_or_public_key:
A Certificate or PublicKey instance to encrypt with
:param data:
A byte string of the data to encrypt
:param rsa_oae... | def function[_bcrypt_encrypt, parameter[certificate_or_public_key, data, rsa_oaep_padding]]:
constant[
Encrypts a value using an RSA public key via CNG
:param certificate_or_public_key:
A Certificate or PublicKey instance to encrypt with
:param data:
A byte string of the data to en... | keyword[def] identifier[_bcrypt_encrypt] ( identifier[certificate_or_public_key] , identifier[data] , identifier[rsa_oaep_padding] = keyword[False] ):
literal[string]
identifier[flags] = identifier[BcryptConst] . identifier[BCRYPT_PAD_PKCS1]
keyword[if] identifier[rsa_oaep_padding] keyword[is] ke... | def _bcrypt_encrypt(certificate_or_public_key, data, rsa_oaep_padding=False):
"""
Encrypts a value using an RSA public key via CNG
:param certificate_or_public_key:
A Certificate or PublicKey instance to encrypt with
:param data:
A byte string of the data to encrypt
:param rsa_oae... |
def _build_lv_grid_dict(network):
"""Creates dict of LV grids
LV grid ids are used as keys, LV grid references as values.
Parameters
----------
network: :class:`~.grid.network.Network`
The eDisGo container object
Returns
-------
:obj:`dict`
Format: {:obj:`int`: :class:... | def function[_build_lv_grid_dict, parameter[network]]:
constant[Creates dict of LV grids
LV grid ids are used as keys, LV grid references as values.
Parameters
----------
network: :class:`~.grid.network.Network`
The eDisGo container object
Returns
-------
:obj:`dict`
... | keyword[def] identifier[_build_lv_grid_dict] ( identifier[network] ):
literal[string]
identifier[lv_grid_dict] ={}
keyword[for] identifier[lv_grid] keyword[in] identifier[network] . identifier[mv_grid] . identifier[lv_grids] :
identifier[lv_grid_dict] [ identifier[lv_grid] . identifier[id... | def _build_lv_grid_dict(network):
"""Creates dict of LV grids
LV grid ids are used as keys, LV grid references as values.
Parameters
----------
network: :class:`~.grid.network.Network`
The eDisGo container object
Returns
-------
:obj:`dict`
Format: {:obj:`int`: :class:... |
def apply_rf_classifier(classifier,
varfeaturesdir,
outpickle,
maxobjects=None):
'''This applys an RF classifier trained using `train_rf_classifier`
to varfeatures pickles in `varfeaturesdir`.
Parameters
----------
classifier ... | def function[apply_rf_classifier, parameter[classifier, varfeaturesdir, outpickle, maxobjects]]:
constant[This applys an RF classifier trained using `train_rf_classifier`
to varfeatures pickles in `varfeaturesdir`.
Parameters
----------
classifier : dict or str
This is the output dict ... | keyword[def] identifier[apply_rf_classifier] ( identifier[classifier] ,
identifier[varfeaturesdir] ,
identifier[outpickle] ,
identifier[maxobjects] = keyword[None] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[classifier] , identifier[str] ) keyword[and] identifier[os] . identifi... | def apply_rf_classifier(classifier, varfeaturesdir, outpickle, maxobjects=None):
"""This applys an RF classifier trained using `train_rf_classifier`
to varfeatures pickles in `varfeaturesdir`.
Parameters
----------
classifier : dict or str
This is the output dict or pickle created by `get_... |
def _chk_qualifier(self, qualifiers, flds, lnum):
"""Check that qualifiers are expected values."""
# http://geneontology.org/page/go-annotation-conventions#qual
for qual in qualifiers:
if qual not in AnnoReaderBase.exp_qualifiers:
errname = 'UNEXPECTED QUALIFIER({QUAL... | def function[_chk_qualifier, parameter[self, qualifiers, flds, lnum]]:
constant[Check that qualifiers are expected values.]
for taget[name[qual]] in starred[name[qualifiers]] begin[:]
if compare[name[qual] <ast.NotIn object at 0x7da2590d7190> name[AnnoReaderBase].exp_qualifiers] begin[:]... | keyword[def] identifier[_chk_qualifier] ( identifier[self] , identifier[qualifiers] , identifier[flds] , identifier[lnum] ):
literal[string]
keyword[for] identifier[qual] keyword[in] identifier[qualifiers] :
keyword[if] identifier[qual] keyword[not] keyword[in] identifi... | def _chk_qualifier(self, qualifiers, flds, lnum):
"""Check that qualifiers are expected values."""
# http://geneontology.org/page/go-annotation-conventions#qual
for qual in qualifiers:
if qual not in AnnoReaderBase.exp_qualifiers:
errname = 'UNEXPECTED QUALIFIER({QUAL})'.format(QUAL=qual... |
def add_t(self, text):
"""
Return a newly added ``<w:t>`` element containing *text*.
"""
t = self._add_t(text=text)
if len(text.strip()) < len(text):
t.set(qn('xml:space'), 'preserve')
return t | def function[add_t, parameter[self, text]]:
constant[
Return a newly added ``<w:t>`` element containing *text*.
]
variable[t] assign[=] call[name[self]._add_t, parameter[]]
if compare[call[name[len], parameter[call[name[text].strip, parameter[]]]] less[<] call[name[len], paramete... | keyword[def] identifier[add_t] ( identifier[self] , identifier[text] ):
literal[string]
identifier[t] = identifier[self] . identifier[_add_t] ( identifier[text] = identifier[text] )
keyword[if] identifier[len] ( identifier[text] . identifier[strip] ())< identifier[len] ( identifier[text] ... | def add_t(self, text):
"""
Return a newly added ``<w:t>`` element containing *text*.
"""
t = self._add_t(text=text)
if len(text.strip()) < len(text):
t.set(qn('xml:space'), 'preserve') # depends on [control=['if'], data=[]]
return t |
def l2_norm(x, filters=None, epsilon=1e-6, name=None, reuse=None):
"""Layer normalization with l2 norm."""
if filters is None:
filters = shape_list(x)[-1]
with tf.variable_scope(name, default_name="l2_norm", values=[x], reuse=reuse):
scale = tf.get_variable(
"l2_norm_scale", [filters], initializer... | def function[l2_norm, parameter[x, filters, epsilon, name, reuse]]:
constant[Layer normalization with l2 norm.]
if compare[name[filters] is constant[None]] begin[:]
variable[filters] assign[=] call[call[name[shape_list], parameter[name[x]]]][<ast.UnaryOp object at 0x7da18dc04a60>]
... | keyword[def] identifier[l2_norm] ( identifier[x] , identifier[filters] = keyword[None] , identifier[epsilon] = literal[int] , identifier[name] = keyword[None] , identifier[reuse] = keyword[None] ):
literal[string]
keyword[if] identifier[filters] keyword[is] keyword[None] :
identifier[filters] = identif... | def l2_norm(x, filters=None, epsilon=1e-06, name=None, reuse=None):
"""Layer normalization with l2 norm."""
if filters is None:
filters = shape_list(x)[-1] # depends on [control=['if'], data=['filters']]
with tf.variable_scope(name, default_name='l2_norm', values=[x], reuse=reuse):
scale = ... |
def _subtract(start, stop, intervals):
"""
Subtract intervals from a spanning interval.
"""
remainder_start = start
sub_stop = None
for sub_start, sub_stop in _collapse(intervals):
if remainder_start < sub_start:
yield _Interval(remainder_start, sub_start)
remain... | def function[_subtract, parameter[start, stop, intervals]]:
constant[
Subtract intervals from a spanning interval.
]
variable[remainder_start] assign[=] name[start]
variable[sub_stop] assign[=] constant[None]
for taget[tuple[[<ast.Name object at 0x7da1b08e7970>, <ast.Name ob... | keyword[def] identifier[_subtract] ( identifier[start] , identifier[stop] , identifier[intervals] ):
literal[string]
identifier[remainder_start] = identifier[start]
identifier[sub_stop] = keyword[None]
keyword[for] identifier[sub_start] , identifier[sub_stop] keyword[in] identifier[_collapse... | def _subtract(start, stop, intervals):
"""
Subtract intervals from a spanning interval.
"""
remainder_start = start
sub_stop = None
for (sub_start, sub_stop) in _collapse(intervals):
if remainder_start < sub_start:
yield _Interval(remainder_start, sub_start) # depends o... |
def encrypt_and_hash(self, plaintext: bytes) -> bytes:
"""
Sets ciphertext = EncryptWithAd(h, plaintext), calls MixHash(ciphertext), and returns ciphertext. Note that if
k is empty, the EncryptWithAd() call will set ciphertext equal to plaintext.
:param plaintext: bytes sequence
... | def function[encrypt_and_hash, parameter[self, plaintext]]:
constant[
Sets ciphertext = EncryptWithAd(h, plaintext), calls MixHash(ciphertext), and returns ciphertext. Note that if
k is empty, the EncryptWithAd() call will set ciphertext equal to plaintext.
:param plaintext: bytes seque... | keyword[def] identifier[encrypt_and_hash] ( identifier[self] , identifier[plaintext] : identifier[bytes] )-> identifier[bytes] :
literal[string]
identifier[ciphertext] = identifier[self] . identifier[cipher_state] . identifier[encrypt_with_ad] ( identifier[self] . identifier[h] , identifier[plain... | def encrypt_and_hash(self, plaintext: bytes) -> bytes:
"""
Sets ciphertext = EncryptWithAd(h, plaintext), calls MixHash(ciphertext), and returns ciphertext. Note that if
k is empty, the EncryptWithAd() call will set ciphertext equal to plaintext.
:param plaintext: bytes sequence
:re... |
def adjoint(self):
"""Adjoint operator represented by the adjoint matrix.
Returns
-------
adjoint : `MatrixOperator`
"""
return MatrixOperator(self.matrix.conj().T,
domain=self.range, range=self.domain,
axis=sel... | def function[adjoint, parameter[self]]:
constant[Adjoint operator represented by the adjoint matrix.
Returns
-------
adjoint : `MatrixOperator`
]
return[call[name[MatrixOperator], parameter[call[name[self].matrix.conj, parameter[]].T]]] | keyword[def] identifier[adjoint] ( identifier[self] ):
literal[string]
keyword[return] identifier[MatrixOperator] ( identifier[self] . identifier[matrix] . identifier[conj] (). identifier[T] ,
identifier[domain] = identifier[self] . identifier[range] , identifier[range] = identifier[self]... | def adjoint(self):
"""Adjoint operator represented by the adjoint matrix.
Returns
-------
adjoint : `MatrixOperator`
"""
return MatrixOperator(self.matrix.conj().T, domain=self.range, range=self.domain, axis=self.axis) |
def send(self, packet_buffer):
"""
send a buffer as a packet to the network interface
:param packet_buffer: buffer to send (length shouldn't exceed MAX_INT)
"""
if self._handle is None:
raise self.DeviceIsNotOpen()
buffer_length = len(packet_buffer)
bu... | def function[send, parameter[self, packet_buffer]]:
constant[
send a buffer as a packet to the network interface
:param packet_buffer: buffer to send (length shouldn't exceed MAX_INT)
]
if compare[name[self]._handle is constant[None]] begin[:]
<ast.Raise object at 0x7da1b... | keyword[def] identifier[send] ( identifier[self] , identifier[packet_buffer] ):
literal[string]
keyword[if] identifier[self] . identifier[_handle] keyword[is] keyword[None] :
keyword[raise] identifier[self] . identifier[DeviceIsNotOpen] ()
identifier[buffer_length] = ident... | def send(self, packet_buffer):
"""
send a buffer as a packet to the network interface
:param packet_buffer: buffer to send (length shouldn't exceed MAX_INT)
"""
if self._handle is None:
raise self.DeviceIsNotOpen() # depends on [control=['if'], data=[]]
buffer_length = len(p... |
def _regularize(x, y, ties):
"""Regularize the values, make them ordered and remove duplicates.
If the ``ties`` parameter is explicitly set to 'ordered' then order
is already assumed. Otherwise, the removal process will happen.
Parameters
----------
x : array-like, shape=(n_samples,)
Th... | def function[_regularize, parameter[x, y, ties]]:
constant[Regularize the values, make them ordered and remove duplicates.
If the ``ties`` parameter is explicitly set to 'ordered' then order
is already assumed. Otherwise, the removal process will happen.
Parameters
----------
x : array-like... | keyword[def] identifier[_regularize] ( identifier[x] , identifier[y] , identifier[ties] ):
literal[string]
identifier[x] , identifier[y] =[
identifier[column_or_1d] ( identifier[check_array] ( identifier[arr] , identifier[ensure_2d] = keyword[False] ,
identifier[force_all_finite] = keyword[False]... | def _regularize(x, y, ties):
"""Regularize the values, make them ordered and remove duplicates.
If the ``ties`` parameter is explicitly set to 'ordered' then order
is already assumed. Otherwise, the removal process will happen.
Parameters
----------
x : array-like, shape=(n_samples,)
Th... |
def deserialize_header(stream):
# type: (IO) -> MessageHeader
"""Deserializes the header from a source stream
:param stream: Source data stream
:type stream: io.BytesIO
:returns: Deserialized MessageHeader object
:rtype: :class:`aws_encryption_sdk.structures.MessageHeader` and bytes
:raises... | def function[deserialize_header, parameter[stream]]:
constant[Deserializes the header from a source stream
:param stream: Source data stream
:type stream: io.BytesIO
:returns: Deserialized MessageHeader object
:rtype: :class:`aws_encryption_sdk.structures.MessageHeader` and bytes
:raises No... | keyword[def] identifier[deserialize_header] ( identifier[stream] ):
literal[string]
identifier[_LOGGER] . identifier[debug] ( literal[string] )
identifier[tee] = identifier[io] . identifier[BytesIO] ()
identifier[tee_stream] = identifier[TeeStream] ( identifier[stream] , identifier[tee] )
i... | def deserialize_header(stream):
# type: (IO) -> MessageHeader
'Deserializes the header from a source stream\n\n :param stream: Source data stream\n :type stream: io.BytesIO\n :returns: Deserialized MessageHeader object\n :rtype: :class:`aws_encryption_sdk.structures.MessageHeader` and bytes\n :ra... |
def cli_progress(addr, offset, size):
"""Prints a progress report suitable for use on the command line."""
width = 25
done = offset * width // size
print("\r0x{:08x} {:7d} [{}{}] {:3d}% "
.format(addr, size, '=' * done, ' ' * (width - done),
offset * 100 // size), end="")
... | def function[cli_progress, parameter[addr, offset, size]]:
constant[Prints a progress report suitable for use on the command line.]
variable[width] assign[=] constant[25]
variable[done] assign[=] binary_operation[binary_operation[name[offset] * name[width]] <ast.FloorDiv object at 0x7da2590d6bc0... | keyword[def] identifier[cli_progress] ( identifier[addr] , identifier[offset] , identifier[size] ):
literal[string]
identifier[width] = literal[int]
identifier[done] = identifier[offset] * identifier[width] // identifier[size]
identifier[print] ( literal[string]
. identifier[format] ( iden... | def cli_progress(addr, offset, size):
"""Prints a progress report suitable for use on the command line."""
width = 25
done = offset * width // size
print('\r0x{:08x} {:7d} [{}{}] {:3d}% '.format(addr, size, '=' * done, ' ' * (width - done), offset * 100 // size), end='')
try:
sys.stdout.flus... |
def _sslobj(sock):
"""Returns the underlying PySLLSocket object with which the C extension
functions interface.
"""
pass
if isinstance(sock._sslobj, _ssl._SSLSocket):
return sock._sslobj
else:
return sock._sslobj._sslobj | def function[_sslobj, parameter[sock]]:
constant[Returns the underlying PySLLSocket object with which the C extension
functions interface.
]
pass
if call[name[isinstance], parameter[name[sock]._sslobj, name[_ssl]._SSLSocket]] begin[:]
return[name[sock]._sslobj] | keyword[def] identifier[_sslobj] ( identifier[sock] ):
literal[string]
keyword[pass]
keyword[if] identifier[isinstance] ( identifier[sock] . identifier[_sslobj] , identifier[_ssl] . identifier[_SSLSocket] ):
keyword[return] identifier[sock] . identifier[_sslobj]
keyword[else] :
... | def _sslobj(sock):
"""Returns the underlying PySLLSocket object with which the C extension
functions interface.
"""
pass
if isinstance(sock._sslobj, _ssl._SSLSocket):
return sock._sslobj # depends on [control=['if'], data=[]]
else:
return sock._sslobj._sslobj |
def __update_count(self):
""" Update internal counters """
self._ntypes = self.count_types()
self._nvars = self.count_vars()
self._nfuns = self.count_funs() | def function[__update_count, parameter[self]]:
constant[ Update internal counters ]
name[self]._ntypes assign[=] call[name[self].count_types, parameter[]]
name[self]._nvars assign[=] call[name[self].count_vars, parameter[]]
name[self]._nfuns assign[=] call[name[self].count_funs, paramete... | keyword[def] identifier[__update_count] ( identifier[self] ):
literal[string]
identifier[self] . identifier[_ntypes] = identifier[self] . identifier[count_types] ()
identifier[self] . identifier[_nvars] = identifier[self] . identifier[count_vars] ()
identifier[self] . identifier[_... | def __update_count(self):
""" Update internal counters """
self._ntypes = self.count_types()
self._nvars = self.count_vars()
self._nfuns = self.count_funs() |
def send_url(amount, redirect_url, url, api):
'''
return payment gateway url to redirect user
to it for payment.
'''
values = {'api': api, 'amount': amount, 'redirect': redirect_url}
send_request = requests.post(SEND_URL_FINAL, data=values)
id_get = send_request.text
print(id_get)
if... | def function[send_url, parameter[amount, redirect_url, url, api]]:
constant[
return payment gateway url to redirect user
to it for payment.
]
variable[values] assign[=] dictionary[[<ast.Constant object at 0x7da18dc07a90>, <ast.Constant object at 0x7da18dc04e20>, <ast.Constant object at 0x7da... | keyword[def] identifier[send_url] ( identifier[amount] , identifier[redirect_url] , identifier[url] , identifier[api] ):
literal[string]
identifier[values] ={ literal[string] : identifier[api] , literal[string] : identifier[amount] , literal[string] : identifier[redirect_url] }
identifier[send_request... | def send_url(amount, redirect_url, url, api):
"""
return payment gateway url to redirect user
to it for payment.
"""
values = {'api': api, 'amount': amount, 'redirect': redirect_url}
send_request = requests.post(SEND_URL_FINAL, data=values)
id_get = send_request.text
print(id_get)
if... |
def find(self, *strings, **kwargs):
"""
Search the entire editor for lines that match the string.
.. code-block:: Python
string = '''word one
word two
three'''
ed = Editor(string)
ed.find('word') # [(0, "word one"), (1, "word... | def function[find, parameter[self]]:
constant[
Search the entire editor for lines that match the string.
.. code-block:: Python
string = '''word one
word two
three'''
ed = Editor(string)
ed.find('word') # [(0, "word one"), (1... | keyword[def] identifier[find] ( identifier[self] ,* identifier[strings] ,** identifier[kwargs] ):
literal[string]
identifier[start] = identifier[kwargs] . identifier[pop] ( literal[string] , literal[int] )
identifier[stop] = identifier[kwargs] . identifier[pop] ( literal[string] , keyword[... | def find(self, *strings, **kwargs):
"""
Search the entire editor for lines that match the string.
.. code-block:: Python
string = '''word one
word two
three'''
ed = Editor(string)
ed.find('word') # [(0, "word one"), (1, "word two... |
def _is_charge_balanced(struct):
"""
checks if the structure object is charge balanced
"""
if sum([s.specie.oxi_state for s in struct.sites]) == 0.0:
return True
else:
return False | def function[_is_charge_balanced, parameter[struct]]:
constant[
checks if the structure object is charge balanced
]
if compare[call[name[sum], parameter[<ast.ListComp object at 0x7da1b1c92440>]] equal[==] constant[0.0]] begin[:]
return[constant[True]] | keyword[def] identifier[_is_charge_balanced] ( identifier[struct] ):
literal[string]
keyword[if] identifier[sum] ([ identifier[s] . identifier[specie] . identifier[oxi_state] keyword[for] identifier[s] keyword[in] identifier[struct] . identifier[sites] ])== literal[int] :
keyword[... | def _is_charge_balanced(struct):
"""
checks if the structure object is charge balanced
"""
if sum([s.specie.oxi_state for s in struct.sites]) == 0.0:
return True # depends on [control=['if'], data=[]]
else:
return False |
def get_debug_info():
"""Return a list of lines with backend info.
"""
from . import __version__
d = OrderedDict()
d['Version'] = '%s' % __version__
for key, val in PyVisaLibrary.get_session_classes().items():
key_name = '%s %s' % (key[0].name.upper(), key[1]... | def function[get_debug_info, parameter[]]:
constant[Return a list of lines with backend info.
]
from relative_module[None] import module[__version__]
variable[d] assign[=] call[name[OrderedDict], parameter[]]
call[name[d]][constant[Version]] assign[=] binary_operation[constant[%s] <a... | keyword[def] identifier[get_debug_info] ():
literal[string]
keyword[from] . keyword[import] identifier[__version__]
identifier[d] = identifier[OrderedDict] ()
identifier[d] [ literal[string] ]= literal[string] % identifier[__version__]
keyword[for] identifier[key] , ... | def get_debug_info():
"""Return a list of lines with backend info.
"""
from . import __version__
d = OrderedDict()
d['Version'] = '%s' % __version__
for (key, val) in PyVisaLibrary.get_session_classes().items():
key_name = '%s %s' % (key[0].name.upper(), key[1])
try:
... |
def area(poly):
"""Calculation of zone area"""
poly_xy = []
num = len(poly)
for i in range(num):
poly[i] = poly[i][0:2] + (0,)
poly_xy.append(poly[i])
return surface.area(poly) | def function[area, parameter[poly]]:
constant[Calculation of zone area]
variable[poly_xy] assign[=] list[[]]
variable[num] assign[=] call[name[len], parameter[name[poly]]]
for taget[name[i]] in starred[call[name[range], parameter[name[num]]]] begin[:]
call[name[poly]][nam... | keyword[def] identifier[area] ( identifier[poly] ):
literal[string]
identifier[poly_xy] =[]
identifier[num] = identifier[len] ( identifier[poly] )
keyword[for] identifier[i] keyword[in] identifier[range] ( identifier[num] ):
identifier[poly] [ identifier[i] ]= identifier[poly] [ ident... | def area(poly):
"""Calculation of zone area"""
poly_xy = []
num = len(poly)
for i in range(num):
poly[i] = poly[i][0:2] + (0,)
poly_xy.append(poly[i]) # depends on [control=['for'], data=['i']]
return surface.area(poly) |
def get_parent_dir(name):
"""Get the parent directory of a filename."""
parent_dir = os.path.dirname(os.path.dirname(name))
if parent_dir:
return parent_dir
return os.path.abspath('.') | def function[get_parent_dir, parameter[name]]:
constant[Get the parent directory of a filename.]
variable[parent_dir] assign[=] call[name[os].path.dirname, parameter[call[name[os].path.dirname, parameter[name[name]]]]]
if name[parent_dir] begin[:]
return[name[parent_dir]]
return[call... | keyword[def] identifier[get_parent_dir] ( identifier[name] ):
literal[string]
identifier[parent_dir] = identifier[os] . identifier[path] . identifier[dirname] ( identifier[os] . identifier[path] . identifier[dirname] ( identifier[name] ))
keyword[if] identifier[parent_dir] :
keyword[return] ... | def get_parent_dir(name):
"""Get the parent directory of a filename."""
parent_dir = os.path.dirname(os.path.dirname(name))
if parent_dir:
return parent_dir # depends on [control=['if'], data=[]]
return os.path.abspath('.') |
def global_optimum(self):
"""Return a globally optimal solution to this problem.
This function returns a globally optimal solution (i.e., a
solution that lives on the Pareto front). Since there are many
solutions that are Pareto-optimal, this function randomly
chooses ... | def function[global_optimum, parameter[self]]:
constant[Return a globally optimal solution to this problem.
This function returns a globally optimal solution (i.e., a
solution that lives on the Pareto front). Since there are many
solutions that are Pareto-optimal, this function... | keyword[def] identifier[global_optimum] ( identifier[self] ):
literal[string]
identifier[x] =[ identifier[random] . identifier[uniform] ( literal[int] , literal[int] ) keyword[for] identifier[_] keyword[in] identifier[range] ( identifier[self] . identifier[objectives] - literal[int] )]
... | def global_optimum(self):
"""Return a globally optimal solution to this problem.
This function returns a globally optimal solution (i.e., a
solution that lives on the Pareto front). Since there are many
solutions that are Pareto-optimal, this function randomly
chooses one ... |
def count(self, val):
"""Return the number of occurrences of *val* in the list."""
# pylint: disable=arguments-differ
_maxes = self._maxes
if not _maxes:
return 0
pos_left = bisect_left(_maxes, val)
if pos_left == len(_maxes):
return 0
... | def function[count, parameter[self, val]]:
constant[Return the number of occurrences of *val* in the list.]
variable[_maxes] assign[=] name[self]._maxes
if <ast.UnaryOp object at 0x7da18bc704f0> begin[:]
return[constant[0]]
variable[pos_left] assign[=] call[name[bisect_left], par... | keyword[def] identifier[count] ( identifier[self] , identifier[val] ):
literal[string]
identifier[_maxes] = identifier[self] . identifier[_maxes]
keyword[if] keyword[not] identifier[_maxes] :
keyword[return] literal[int]
identifier[pos_left] = identifi... | def count(self, val):
"""Return the number of occurrences of *val* in the list."""
# pylint: disable=arguments-differ
_maxes = self._maxes
if not _maxes:
return 0 # depends on [control=['if'], data=[]]
pos_left = bisect_left(_maxes, val)
if pos_left == len(_maxes):
return 0 # d... |
def get_match_history(self, account_id=None, **kwargs):
"""Returns a dictionary containing a list of the most recent Dota matches
:param account_id: (int, optional)
:param hero_id: (int, optional)
:param game_mode: (int, optional) see ``ref/modes.json``
:param skill: (int, optio... | def function[get_match_history, parameter[self, account_id]]:
constant[Returns a dictionary containing a list of the most recent Dota matches
:param account_id: (int, optional)
:param hero_id: (int, optional)
:param game_mode: (int, optional) see ``ref/modes.json``
:param skill:... | keyword[def] identifier[get_match_history] ( identifier[self] , identifier[account_id] = keyword[None] ,** identifier[kwargs] ):
literal[string]
keyword[if] literal[string] keyword[not] keyword[in] identifier[kwargs] :
identifier[kwargs] [ literal[string] ]= identifier[account_id] ... | def get_match_history(self, account_id=None, **kwargs):
"""Returns a dictionary containing a list of the most recent Dota matches
:param account_id: (int, optional)
:param hero_id: (int, optional)
:param game_mode: (int, optional) see ``ref/modes.json``
:param skill: (int, optional)... |
def create_checkout(self, **params):
"""https://developers.coinbase.com/api/v2#create-checkout"""
for required in ['amount', 'currency', 'name']:
if required not in params:
raise ValueError("Missing required parameter: %s" % required)
response = self._post('v2', 'chec... | def function[create_checkout, parameter[self]]:
constant[https://developers.coinbase.com/api/v2#create-checkout]
for taget[name[required]] in starred[list[[<ast.Constant object at 0x7da2047ea1d0>, <ast.Constant object at 0x7da2047e9a20>, <ast.Constant object at 0x7da2047e8550>]]] begin[:]
... | keyword[def] identifier[create_checkout] ( identifier[self] ,** identifier[params] ):
literal[string]
keyword[for] identifier[required] keyword[in] [ literal[string] , literal[string] , literal[string] ]:
keyword[if] identifier[required] keyword[not] keyword[in] identifier[params... | def create_checkout(self, **params):
"""https://developers.coinbase.com/api/v2#create-checkout"""
for required in ['amount', 'currency', 'name']:
if required not in params:
raise ValueError('Missing required parameter: %s' % required) # depends on [control=['if'], data=['required']] # depe... |
def enable_external_loaders(obj):
"""Enable external service loaders like `VAULT_` and `REDIS_`
looks forenv variables like `REDIS_ENABLED_FOR_DYNACONF`
"""
for name, loader in ct.EXTERNAL_LOADERS.items():
enabled = getattr(
obj, "{}_ENABLED_FOR_DYNACONF".format(name.upper()), False
... | def function[enable_external_loaders, parameter[obj]]:
constant[Enable external service loaders like `VAULT_` and `REDIS_`
looks forenv variables like `REDIS_ENABLED_FOR_DYNACONF`
]
for taget[tuple[[<ast.Name object at 0x7da1b180dba0>, <ast.Name object at 0x7da1b180cd90>]]] in starred[call[name[... | keyword[def] identifier[enable_external_loaders] ( identifier[obj] ):
literal[string]
keyword[for] identifier[name] , identifier[loader] keyword[in] identifier[ct] . identifier[EXTERNAL_LOADERS] . identifier[items] ():
identifier[enabled] = identifier[getattr] (
identifier[obj] , liter... | def enable_external_loaders(obj):
"""Enable external service loaders like `VAULT_` and `REDIS_`
looks forenv variables like `REDIS_ENABLED_FOR_DYNACONF`
"""
for (name, loader) in ct.EXTERNAL_LOADERS.items():
enabled = getattr(obj, '{}_ENABLED_FOR_DYNACONF'.format(name.upper()), False)
if... |
def fix_fasta(fasta):
"""
remove pesky characters from fasta file header
"""
for seq in parse_fasta(fasta):
seq[0] = remove_char(seq[0])
if len(seq[1]) > 0:
yield seq | def function[fix_fasta, parameter[fasta]]:
constant[
remove pesky characters from fasta file header
]
for taget[name[seq]] in starred[call[name[parse_fasta], parameter[name[fasta]]]] begin[:]
call[name[seq]][constant[0]] assign[=] call[name[remove_char], parameter[call[name[seq]]... | keyword[def] identifier[fix_fasta] ( identifier[fasta] ):
literal[string]
keyword[for] identifier[seq] keyword[in] identifier[parse_fasta] ( identifier[fasta] ):
identifier[seq] [ literal[int] ]= identifier[remove_char] ( identifier[seq] [ literal[int] ])
keyword[if] identifier[len] (... | def fix_fasta(fasta):
"""
remove pesky characters from fasta file header
"""
for seq in parse_fasta(fasta):
seq[0] = remove_char(seq[0])
if len(seq[1]) > 0:
yield seq # depends on [control=['if'], data=[]] # depends on [control=['for'], data=['seq']] |
def str_to_time(self):
"""
Formats a XCCDF dateTime string to a datetime object.
:returns: datetime object.
:rtype: datetime.datetime
"""
return datetime(*list(map(int, re.split(r'-|:|T', self.time)))) | def function[str_to_time, parameter[self]]:
constant[
Formats a XCCDF dateTime string to a datetime object.
:returns: datetime object.
:rtype: datetime.datetime
]
return[call[name[datetime], parameter[<ast.Starred object at 0x7da1b0aa6860>]]] | keyword[def] identifier[str_to_time] ( identifier[self] ):
literal[string]
keyword[return] identifier[datetime] (* identifier[list] ( identifier[map] ( identifier[int] , identifier[re] . identifier[split] ( literal[string] , identifier[self] . identifier[time] )))) | def str_to_time(self):
"""
Formats a XCCDF dateTime string to a datetime object.
:returns: datetime object.
:rtype: datetime.datetime
"""
return datetime(*list(map(int, re.split('-|:|T', self.time)))) |
def bundles_list(self, io_handler, name=None):
"""
Lists the bundles in the framework and their state. Possibility to
filter on the bundle name.
"""
# Head of the table
headers = ("ID", "Name", "State", "Version")
# Get the bundles
bundles = self._context... | def function[bundles_list, parameter[self, io_handler, name]]:
constant[
Lists the bundles in the framework and their state. Possibility to
filter on the bundle name.
]
variable[headers] assign[=] tuple[[<ast.Constant object at 0x7da20c6e4190>, <ast.Constant object at 0x7da20c6e6... | keyword[def] identifier[bundles_list] ( identifier[self] , identifier[io_handler] , identifier[name] = keyword[None] ):
literal[string]
identifier[headers] =( literal[string] , literal[string] , literal[string] , literal[string] )
identifier[bundles] = identifier[self] .... | def bundles_list(self, io_handler, name=None):
"""
Lists the bundles in the framework and their state. Possibility to
filter on the bundle name.
"""
# Head of the table
headers = ('ID', 'Name', 'State', 'Version')
# Get the bundles
bundles = self._context.get_bundles()
# ... |
def Laliberte_density_w(T):
r'''Calculate the density of water using the form proposed by [1]_.
No parameters are needed, just a temperature. Units are Kelvin and kg/m^3h.
.. math::
\rho_w = \frac{\left\{\left([(-2.8054253\times 10^{-10}\cdot t +
1.0556302\times 10^{-7})t - 4.6170461\times ... | def function[Laliberte_density_w, parameter[T]]:
constant[Calculate the density of water using the form proposed by [1]_.
No parameters are needed, just a temperature. Units are Kelvin and kg/m^3h.
.. math::
\rho_w = \frac{\left\{\left([(-2.8054253\times 10^{-10}\cdot t +
1.0556302\time... | keyword[def] identifier[Laliberte_density_w] ( identifier[T] ):
literal[string]
identifier[t] = identifier[T] - literal[int]
identifier[rho_w] =(((((- literal[int] * identifier[t] + literal[int] )* identifier[t] - literal[int] )* identifier[t] - literal[int] )* identifier[t] + literal[int] )* identif... | def Laliberte_density_w(T):
"""Calculate the density of water using the form proposed by [1]_.
No parameters are needed, just a temperature. Units are Kelvin and kg/m^3h.
.. math::
\\rho_w = \\frac{\\left\\{\\left([(-2.8054253\\times 10^{-10}\\cdot t +
1.0556302\\times 10^{-7})t - 4.6170461... |
def make_withitem(queue, stack):
"""
Make an ast.withitem node.
"""
context_expr = make_expr(stack)
# This is a POP_TOP for just "with <expr>:".
# This is a STORE_NAME(name) for "with <expr> as <name>:".
as_instr = queue.popleft()
if isinstance(as_instr, (instrs.STORE_FAST,
... | def function[make_withitem, parameter[queue, stack]]:
constant[
Make an ast.withitem node.
]
variable[context_expr] assign[=] call[name[make_expr], parameter[name[stack]]]
variable[as_instr] assign[=] call[name[queue].popleft, parameter[]]
if call[name[isinstance], parameter[name... | keyword[def] identifier[make_withitem] ( identifier[queue] , identifier[stack] ):
literal[string]
identifier[context_expr] = identifier[make_expr] ( identifier[stack] )
identifier[as_instr] = identifier[queue] . identifier[popleft] ()
keyword[if] identifier[isinstance] ( identifier[as_... | def make_withitem(queue, stack):
"""
Make an ast.withitem node.
"""
context_expr = make_expr(stack)
# This is a POP_TOP for just "with <expr>:".
# This is a STORE_NAME(name) for "with <expr> as <name>:".
as_instr = queue.popleft()
if isinstance(as_instr, (instrs.STORE_FAST, instrs.STORE_... |
def V_vertical_torispherical_concave(D, f, k, h):
r'''Calculates volume of a vertical tank with a concave torispherical bottom,
according to [1]_. No provision for the top of the tank is made here.
.. math::
V = \frac{\pi D^2 h}{4} - v_1(h=a_1+a_2) + v_1(h=a_1 + a_2 -h),\; 0 \le h < a_2
.. mat... | def function[V_vertical_torispherical_concave, parameter[D, f, k, h]]:
constant[Calculates volume of a vertical tank with a concave torispherical bottom,
according to [1]_. No provision for the top of the tank is made here.
.. math::
V = \frac{\pi D^2 h}{4} - v_1(h=a_1+a_2) + v_1(h=a_1 + a_2 -h... | keyword[def] identifier[V_vertical_torispherical_concave] ( identifier[D] , identifier[f] , identifier[k] , identifier[h] ):
literal[string]
identifier[alpha] = identifier[asin] (( literal[int] - literal[int] * identifier[k] )/( literal[int] *( identifier[f] - identifier[k] )))
identifier[a1] = identi... | def V_vertical_torispherical_concave(D, f, k, h):
"""Calculates volume of a vertical tank with a concave torispherical bottom,
according to [1]_. No provision for the top of the tank is made here.
.. math::
V = \\frac{\\pi D^2 h}{4} - v_1(h=a_1+a_2) + v_1(h=a_1 + a_2 -h),\\; 0 \\le h < a_2
.. ... |
def contains(bank, key):
'''
Checks if the specified bank contains the specified key.
'''
if key is None:
return True # any key could be a branch and a leaf at the same time in Consul
else:
try:
c_key = '{0}/{1}'.format(bank, key)
_, value = api.kv.get(c_key)... | def function[contains, parameter[bank, key]]:
constant[
Checks if the specified bank contains the specified key.
]
if compare[name[key] is constant[None]] begin[:]
return[constant[True]] | keyword[def] identifier[contains] ( identifier[bank] , identifier[key] ):
literal[string]
keyword[if] identifier[key] keyword[is] keyword[None] :
keyword[return] keyword[True]
keyword[else] :
keyword[try] :
identifier[c_key] = literal[string] . identifier[format] ( ... | def contains(bank, key):
"""
Checks if the specified bank contains the specified key.
"""
if key is None:
return True # any key could be a branch and a leaf at the same time in Consul # depends on [control=['if'], data=[]]
else:
try:
c_key = '{0}/{1}'.format(bank, key)
... |
def create(cls, name, engines, include_core_files=False,
include_slapcat_output=False, comment=None):
"""
Create an sginfo task.
:param str name: name of task
:param engines: list of engines to apply the sginfo task
:type engines: list(Engine)
:pa... | def function[create, parameter[cls, name, engines, include_core_files, include_slapcat_output, comment]]:
constant[
Create an sginfo task.
:param str name: name of task
:param engines: list of engines to apply the sginfo task
:type engines: list(Engine)
:param b... | keyword[def] identifier[create] ( identifier[cls] , identifier[name] , identifier[engines] , identifier[include_core_files] = keyword[False] ,
identifier[include_slapcat_output] = keyword[False] , identifier[comment] = keyword[None] ):
literal[string]
identifier[json] ={
literal[string] :... | def create(cls, name, engines, include_core_files=False, include_slapcat_output=False, comment=None):
"""
Create an sginfo task.
:param str name: name of task
:param engines: list of engines to apply the sginfo task
:type engines: list(Engine)
:param bool include_co... |
def _apply_scope(self, scope, builder):
"""
Apply a single scope on the given builder instance.
:param scope: The scope to apply
:type scope: callable or Scope
:param builder: The builder to apply the scope to
:type builder: Builder
"""
if callable(scope... | def function[_apply_scope, parameter[self, scope, builder]]:
constant[
Apply a single scope on the given builder instance.
:param scope: The scope to apply
:type scope: callable or Scope
:param builder: The builder to apply the scope to
:type builder: Builder
]
... | keyword[def] identifier[_apply_scope] ( identifier[self] , identifier[scope] , identifier[builder] ):
literal[string]
keyword[if] identifier[callable] ( identifier[scope] ):
identifier[scope] ( identifier[builder] )
keyword[elif] identifier[isinstance] ( identifier[scope] , ... | def _apply_scope(self, scope, builder):
"""
Apply a single scope on the given builder instance.
:param scope: The scope to apply
:type scope: callable or Scope
:param builder: The builder to apply the scope to
:type builder: Builder
"""
if callable(scope):
... |
def error_map_source(self, kwargs_source, x_grid, y_grid, cov_param):
"""
variance of the linear source reconstruction in the source plane coordinates,
computed by the diagonal elements of the covariance matrix of the source reconstruction as a sum of the errors
of the basis set.
... | def function[error_map_source, parameter[self, kwargs_source, x_grid, y_grid, cov_param]]:
constant[
variance of the linear source reconstruction in the source plane coordinates,
computed by the diagonal elements of the covariance matrix of the source reconstruction as a sum of the errors
... | keyword[def] identifier[error_map_source] ( identifier[self] , identifier[kwargs_source] , identifier[x_grid] , identifier[y_grid] , identifier[cov_param] ):
literal[string]
identifier[error_map] = identifier[np] . identifier[zeros_like] ( identifier[x_grid] )
identifier[basis_functions] ... | def error_map_source(self, kwargs_source, x_grid, y_grid, cov_param):
"""
variance of the linear source reconstruction in the source plane coordinates,
computed by the diagonal elements of the covariance matrix of the source reconstruction as a sum of the errors
of the basis set.
:p... |
def expressionToAST(ex):
"""Take an expression tree made out of expressions.ExpressionNode,
and convert to an AST tree.
This is necessary as ExpressionNode overrides many methods to act
like a number.
"""
return ASTNode(ex.astType, ex.astKind, ex.value,
[expressionToAST(c) fo... | def function[expressionToAST, parameter[ex]]:
constant[Take an expression tree made out of expressions.ExpressionNode,
and convert to an AST tree.
This is necessary as ExpressionNode overrides many methods to act
like a number.
]
return[call[name[ASTNode], parameter[name[ex].astType, name[e... | keyword[def] identifier[expressionToAST] ( identifier[ex] ):
literal[string]
keyword[return] identifier[ASTNode] ( identifier[ex] . identifier[astType] , identifier[ex] . identifier[astKind] , identifier[ex] . identifier[value] ,
[ identifier[expressionToAST] ( identifier[c] ) keyword[for] identifier... | def expressionToAST(ex):
"""Take an expression tree made out of expressions.ExpressionNode,
and convert to an AST tree.
This is necessary as ExpressionNode overrides many methods to act
like a number.
"""
return ASTNode(ex.astType, ex.astKind, ex.value, [expressionToAST(c) for c in ex.children]... |
def GET_AUTH(self, courseid, taskid): # pylint: disable=arguments-differ
""" GET request """
course, task = self.get_course_and_check_rights(courseid, taskid)
return self.page(course, task) | def function[GET_AUTH, parameter[self, courseid, taskid]]:
constant[ GET request ]
<ast.Tuple object at 0x7da20c6a8730> assign[=] call[name[self].get_course_and_check_rights, parameter[name[courseid], name[taskid]]]
return[call[name[self].page, parameter[name[course], name[task]]]] | keyword[def] identifier[GET_AUTH] ( identifier[self] , identifier[courseid] , identifier[taskid] ):
literal[string]
identifier[course] , identifier[task] = identifier[self] . identifier[get_course_and_check_rights] ( identifier[courseid] , identifier[taskid] )
keyword[return] identifier[s... | def GET_AUTH(self, courseid, taskid): # pylint: disable=arguments-differ
' GET request '
(course, task) = self.get_course_and_check_rights(courseid, taskid)
return self.page(course, task) |
def _parse_acl(acl, user, group):
'''
Parse a single ACL rule
'''
comps = acl.split(':')
vals = {}
# What type of rule is this?
vals['type'] = 'acl'
if comps[0] == 'default':
vals['type'] = 'default'
comps.pop(0)
# If a user is not specified, use the owner of the fi... | def function[_parse_acl, parameter[acl, user, group]]:
constant[
Parse a single ACL rule
]
variable[comps] assign[=] call[name[acl].split, parameter[constant[:]]]
variable[vals] assign[=] dictionary[[], []]
call[name[vals]][constant[type]] assign[=] constant[acl]
if compa... | keyword[def] identifier[_parse_acl] ( identifier[acl] , identifier[user] , identifier[group] ):
literal[string]
identifier[comps] = identifier[acl] . identifier[split] ( literal[string] )
identifier[vals] ={}
identifier[vals] [ literal[string] ]= literal[string]
keyword[if] identifie... | def _parse_acl(acl, user, group):
"""
Parse a single ACL rule
"""
comps = acl.split(':')
vals = {}
# What type of rule is this?
vals['type'] = 'acl'
if comps[0] == 'default':
vals['type'] = 'default'
comps.pop(0) # depends on [control=['if'], data=[]]
# If a user is ... |
def getFile(self, file_xml_uri):
""" This will execute cmd to fetch file data from FMServer """
find = re.match('/fmi/xml/cnt/([\w\d.-]+)\.([\w]+)?-*', file_xml_uri)
file_name = find.group(1)
file_extension = find.group(2)
file_binary = self._doRequest(is_file=True, file_xml_uri=file_xml_uri)
return (file_... | def function[getFile, parameter[self, file_xml_uri]]:
constant[ This will execute cmd to fetch file data from FMServer ]
variable[find] assign[=] call[name[re].match, parameter[constant[/fmi/xml/cnt/([\w\d.-]+)\.([\w]+)?-*], name[file_xml_uri]]]
variable[file_name] assign[=] call[name[find].grou... | keyword[def] identifier[getFile] ( identifier[self] , identifier[file_xml_uri] ):
literal[string]
identifier[find] = identifier[re] . identifier[match] ( literal[string] , identifier[file_xml_uri] )
identifier[file_name] = identifier[find] . identifier[group] ( literal[int] )
identifier[file_extension] ... | def getFile(self, file_xml_uri):
""" This will execute cmd to fetch file data from FMServer """
find = re.match('/fmi/xml/cnt/([\\w\\d.-]+)\\.([\\w]+)?-*', file_xml_uri)
file_name = find.group(1)
file_extension = find.group(2)
file_binary = self._doRequest(is_file=True, file_xml_uri=file_xml_uri)
... |
def swapColors(self):
"""
Swaps the current :py:class:`Color` with the secondary :py:class:`Color`.
:rtype: Nothing.
"""
rgba = self.color.get_0_255()
self.color = self.secondColor
self.secondColor = Color(rgba, '0-255') | def function[swapColors, parameter[self]]:
constant[
Swaps the current :py:class:`Color` with the secondary :py:class:`Color`.
:rtype: Nothing.
]
variable[rgba] assign[=] call[name[self].color.get_0_255, parameter[]]
name[self].color assign[=] name[self].secondColor
name[self].s... | keyword[def] identifier[swapColors] ( identifier[self] ):
literal[string]
identifier[rgba] = identifier[self] . identifier[color] . identifier[get_0_255] ()
identifier[self] . identifier[color] = identifier[self] . identifier[secondColor]
identifier[self] . identifier[secondColor] = identifier[Color] ( ... | def swapColors(self):
"""
Swaps the current :py:class:`Color` with the secondary :py:class:`Color`.
:rtype: Nothing.
"""
rgba = self.color.get_0_255()
self.color = self.secondColor
self.secondColor = Color(rgba, '0-255') |
def extract_native_client_tarball(dir):
r'''
Download a native_client.tar.xz file from TaskCluster and extract it to dir.
'''
assert_valid_dir(dir)
target_tarball = os.path.join(dir, 'native_client.tar.xz')
if os.path.isfile(target_tarball) and os.stat(target_tarball).st_size == 0:
retu... | def function[extract_native_client_tarball, parameter[dir]]:
constant[
Download a native_client.tar.xz file from TaskCluster and extract it to dir.
]
call[name[assert_valid_dir], parameter[name[dir]]]
variable[target_tarball] assign[=] call[name[os].path.join, parameter[name[dir], consta... | keyword[def] identifier[extract_native_client_tarball] ( identifier[dir] ):
literal[string]
identifier[assert_valid_dir] ( identifier[dir] )
identifier[target_tarball] = identifier[os] . identifier[path] . identifier[join] ( identifier[dir] , literal[string] )
keyword[if] identifier[os] . ident... | def extract_native_client_tarball(dir):
"""
Download a native_client.tar.xz file from TaskCluster and extract it to dir.
"""
assert_valid_dir(dir)
target_tarball = os.path.join(dir, 'native_client.tar.xz')
if os.path.isfile(target_tarball) and os.stat(target_tarball).st_size == 0:
return... |
def _matrix_add_column(matrix, column, default=0):
"""Given a matrix as a list of lists, add a column to the right, filling in
with a default value if necessary.
"""
height_difference = len(column) - len(matrix)
# The width of the matrix is the length of its longest row.
width = max(len(row) fo... | def function[_matrix_add_column, parameter[matrix, column, default]]:
constant[Given a matrix as a list of lists, add a column to the right, filling in
with a default value if necessary.
]
variable[height_difference] assign[=] binary_operation[call[name[len], parameter[name[column]]] - call[name... | keyword[def] identifier[_matrix_add_column] ( identifier[matrix] , identifier[column] , identifier[default] = literal[int] ):
literal[string]
identifier[height_difference] = identifier[len] ( identifier[column] )- identifier[len] ( identifier[matrix] )
identifier[width] = identifier[max] ( ident... | def _matrix_add_column(matrix, column, default=0):
"""Given a matrix as a list of lists, add a column to the right, filling in
with a default value if necessary.
"""
height_difference = len(column) - len(matrix)
# The width of the matrix is the length of its longest row.
width = max((len(row) fo... |
def diff(xi, yi, order=1) -> np.ndarray:
"""Take the numerical derivative of a 1D array.
Output is mapped onto the original coordinates using linear interpolation.
Expects monotonic xi values.
Parameters
----------
xi : 1D array-like
Coordinates.
yi : 1D array-like
Values.... | def function[diff, parameter[xi, yi, order]]:
constant[Take the numerical derivative of a 1D array.
Output is mapped onto the original coordinates using linear interpolation.
Expects monotonic xi values.
Parameters
----------
xi : 1D array-like
Coordinates.
yi : 1D array-like
... | keyword[def] identifier[diff] ( identifier[xi] , identifier[yi] , identifier[order] = literal[int] )-> identifier[np] . identifier[ndarray] :
literal[string]
identifier[yi] = identifier[np] . identifier[array] ( identifier[yi] ). identifier[copy] ()
identifier[flip] = keyword[False]
keyword[if] ... | def diff(xi, yi, order=1) -> np.ndarray:
"""Take the numerical derivative of a 1D array.
Output is mapped onto the original coordinates using linear interpolation.
Expects monotonic xi values.
Parameters
----------
xi : 1D array-like
Coordinates.
yi : 1D array-like
Values.... |
def describe_consumer_groups(self, group_ids, group_coordinator_id=None):
"""Describe a set of consumer groups.
Any errors are immediately raised.
:param group_ids: A list of consumer group IDs. These are typically the
group names as strings.
:param group_coordinator_id: Th... | def function[describe_consumer_groups, parameter[self, group_ids, group_coordinator_id]]:
constant[Describe a set of consumer groups.
Any errors are immediately raised.
:param group_ids: A list of consumer group IDs. These are typically the
group names as strings.
:param gr... | keyword[def] identifier[describe_consumer_groups] ( identifier[self] , identifier[group_ids] , identifier[group_coordinator_id] = keyword[None] ):
literal[string]
identifier[group_descriptions] =[]
identifier[version] = identifier[self] . identifier[_matching_api_version] ( identifier[Desc... | def describe_consumer_groups(self, group_ids, group_coordinator_id=None):
"""Describe a set of consumer groups.
Any errors are immediately raised.
:param group_ids: A list of consumer group IDs. These are typically the
group names as strings.
:param group_coordinator_id: The no... |
def interactive_rewrite_schema(r, df, doc=None):
"""Rebuild the schema for a resource based on a dataframe and re-write the doc,
but only if running the notebook interactively, not while building"""
if 'metatab_doc' in caller_locals():
return False
if doc is None:
doc = open_source_pac... | def function[interactive_rewrite_schema, parameter[r, df, doc]]:
constant[Rebuild the schema for a resource based on a dataframe and re-write the doc,
but only if running the notebook interactively, not while building]
if compare[constant[metatab_doc] in call[name[caller_locals], parameter[]]] begin... | keyword[def] identifier[interactive_rewrite_schema] ( identifier[r] , identifier[df] , identifier[doc] = keyword[None] ):
literal[string]
keyword[if] literal[string] keyword[in] identifier[caller_locals] ():
keyword[return] keyword[False]
keyword[if] identifier[doc] keyword[is] keyw... | def interactive_rewrite_schema(r, df, doc=None):
"""Rebuild the schema for a resource based on a dataframe and re-write the doc,
but only if running the notebook interactively, not while building"""
if 'metatab_doc' in caller_locals():
return False # depends on [control=['if'], data=[]]
if doc ... |
def qteRunMacro(self, macroName: str, widgetObj: QtGui.QWidget=None,
keysequence: QtmacsKeysequence=None):
"""
Queue a previously registered macro for execution once the
event loop is idle.
The reason for queuing macros in the first place, instead of
running ... | def function[qteRunMacro, parameter[self, macroName, widgetObj, keysequence]]:
constant[
Queue a previously registered macro for execution once the
event loop is idle.
The reason for queuing macros in the first place, instead of
running them straight away, is to ensure that the ... | keyword[def] identifier[qteRunMacro] ( identifier[self] , identifier[macroName] : identifier[str] , identifier[widgetObj] : identifier[QtGui] . identifier[QWidget] = keyword[None] ,
identifier[keysequence] : identifier[QtmacsKeysequence] = keyword[None] ):
literal[string]
identif... | def qteRunMacro(self, macroName: str, widgetObj: QtGui.QWidget=None, keysequence: QtmacsKeysequence=None):
"""
Queue a previously registered macro for execution once the
event loop is idle.
The reason for queuing macros in the first place, instead of
running them straight away, is t... |
def sparkify(series):
u"""Converts <series> to a sparkline string.
Example:
>>> sparkify([ 0.5, 1.2, 3.5, 7.3, 8.0, 12.5, 13.2, 15.0, 14.2, 11.8, 6.1,
... 1.9 ])
u'▁▁▂▄▅▇▇██▆▄▂'
>>> sparkify([1, 1, -2, 3, -5, 8, -13])
u'▆▆▅▆▄█▁'
Raises ValueError if input data cannot be converted ... | def function[sparkify, parameter[series]]:
constant[Converts <series> to a sparkline string.
Example:
>>> sparkify([ 0.5, 1.2, 3.5, 7.3, 8.0, 12.5, 13.2, 15.0, 14.2, 11.8, 6.1,
... 1.9 ])
u'▁▁▂▄▅▇▇██▆▄▂'
>>> sparkify([1, 1, -2, 3, -5, 8, -13])
u'▆▆▅▆▄█▁'
Raises ValueError if i... | keyword[def] identifier[sparkify] ( identifier[series] ):
literal[string]
identifier[series] =[ identifier[float] ( identifier[i] ) keyword[for] identifier[i] keyword[in] identifier[series] ]
identifier[minimum] = identifier[min] ( identifier[series] )
identifier[maximum] = identifier[max] ( i... | def sparkify(series):
u"""Converts <series> to a sparkline string.
Example:
>>> sparkify([ 0.5, 1.2, 3.5, 7.3, 8.0, 12.5, 13.2, 15.0, 14.2, 11.8, 6.1,
... 1.9 ])
u'▁▁▂▄▅▇▇██▆▄▂'
>>> sparkify([1, 1, -2, 3, -5, 8, -13])
u'▆▆▅▆▄█▁'
Raises ValueError if input data cannot be converted ... |
def _to_bytes(self, data):
"""
Normalize a text data to bytes (type `bytes`) so that the go bindings can
handle it easily.
"""
# TODO: On Python 3, move this `if` line to the `except` branch
# as the common case will indeed no longer be bytes.
if not isinstance(da... | def function[_to_bytes, parameter[self, data]]:
constant[
Normalize a text data to bytes (type `bytes`) so that the go bindings can
handle it easily.
]
if <ast.UnaryOp object at 0x7da18bcc8220> begin[:]
<ast.Try object at 0x7da18bccbc10>
return[name[data]] | keyword[def] identifier[_to_bytes] ( identifier[self] , identifier[data] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[data] , identifier[bytes] ):
keyword[try] :
keyword[return] identifier[data] . identifier[encod... | def _to_bytes(self, data):
"""
Normalize a text data to bytes (type `bytes`) so that the go bindings can
handle it easily.
"""
# TODO: On Python 3, move this `if` line to the `except` branch
# as the common case will indeed no longer be bytes.
if not isinstance(data, bytes):
... |
def pfLon(jd, lat, lon):
""" Returns the ecliptic longitude of Pars Fortuna.
It considers diurnal or nocturnal conditions.
"""
sun = swe.sweObjectLon(const.SUN, jd)
moon = swe.sweObjectLon(const.MOON, jd)
asc = swe.sweHousesLon(jd, lat, lon,
const.HOUSES_DEFAULT)[... | def function[pfLon, parameter[jd, lat, lon]]:
constant[ Returns the ecliptic longitude of Pars Fortuna.
It considers diurnal or nocturnal conditions.
]
variable[sun] assign[=] call[name[swe].sweObjectLon, parameter[name[const].SUN, name[jd]]]
variable[moon] assign[=] call[name[swe].... | keyword[def] identifier[pfLon] ( identifier[jd] , identifier[lat] , identifier[lon] ):
literal[string]
identifier[sun] = identifier[swe] . identifier[sweObjectLon] ( identifier[const] . identifier[SUN] , identifier[jd] )
identifier[moon] = identifier[swe] . identifier[sweObjectLon] ( identifier[const]... | def pfLon(jd, lat, lon):
""" Returns the ecliptic longitude of Pars Fortuna.
It considers diurnal or nocturnal conditions.
"""
sun = swe.sweObjectLon(const.SUN, jd)
moon = swe.sweObjectLon(const.MOON, jd)
asc = swe.sweHousesLon(jd, lat, lon, const.HOUSES_DEFAULT)[1][0]
if isDiurnal(jd, ... |
def write_lines(label, lines):
'''write a list of lines with a header for a section.
Parameters
==========
lines: one or more lines to write, with header appended
'''
result = []
continued = False
for line in lines:
if continued:
result.append(line)
... | def function[write_lines, parameter[label, lines]]:
constant[write a list of lines with a header for a section.
Parameters
==========
lines: one or more lines to write, with header appended
]
variable[result] assign[=] list[[]]
variable[continued] assign[=] constan... | keyword[def] identifier[write_lines] ( identifier[label] , identifier[lines] ):
literal[string]
identifier[result] =[]
identifier[continued] = keyword[False]
keyword[for] identifier[line] keyword[in] identifier[lines] :
keyword[if] identifier[continued] :
identifier[res... | def write_lines(label, lines):
"""write a list of lines with a header for a section.
Parameters
==========
lines: one or more lines to write, with header appended
"""
result = []
continued = False
for line in lines:
if continued:
result.append(line) # ... |
def _read_metadata(self, f, endianness):
"""
Read the metadata for a DAQmx raw segment. This is the raw
DAQmx-specific portion of the raw data index.
"""
self.data_type = types.tds_data_types[0xFFFFFFFF]
self.dimension = types.Uint32.read(f, endianness)
# In TDMS... | def function[_read_metadata, parameter[self, f, endianness]]:
constant[
Read the metadata for a DAQmx raw segment. This is the raw
DAQmx-specific portion of the raw data index.
]
name[self].data_type assign[=] call[name[types].tds_data_types][constant[4294967295]]
name[s... | keyword[def] identifier[_read_metadata] ( identifier[self] , identifier[f] , identifier[endianness] ):
literal[string]
identifier[self] . identifier[data_type] = identifier[types] . identifier[tds_data_types] [ literal[int] ]
identifier[self] . identifier[dimension] = identifier[types] . i... | def _read_metadata(self, f, endianness):
"""
Read the metadata for a DAQmx raw segment. This is the raw
DAQmx-specific portion of the raw data index.
"""
self.data_type = types.tds_data_types[4294967295]
self.dimension = types.Uint32.read(f, endianness)
# In TDMS format version ... |
def getCert(username, password,
certHost=_SERVER,
certfile=None,
certQuery=_PROXY):
"""Access the cadc certificate server."""
if certfile is None:
certfile = tempfile.NamedTemporaryFile()
# Add the username and password.
# If we knew the realm, we could use ... | def function[getCert, parameter[username, password, certHost, certfile, certQuery]]:
constant[Access the cadc certificate server.]
if compare[name[certfile] is constant[None]] begin[:]
variable[certfile] assign[=] call[name[tempfile].NamedTemporaryFile, parameter[]]
variable[pass... | keyword[def] identifier[getCert] ( identifier[username] , identifier[password] ,
identifier[certHost] = identifier[_SERVER] ,
identifier[certfile] = keyword[None] ,
identifier[certQuery] = identifier[_PROXY] ):
literal[string]
keyword[if] identifier[certfile] keyword[is] keyword[None] :
ide... | def getCert(username, password, certHost=_SERVER, certfile=None, certQuery=_PROXY):
"""Access the cadc certificate server."""
if certfile is None:
certfile = tempfile.NamedTemporaryFile() # depends on [control=['if'], data=['certfile']]
# Add the username and password.
# If we knew the realm, w... |
def doc_paragraph(s, indent=0):
'''Takes in a string without wrapping corresponding to a paragraph,
and returns a version of that string wrapped to be at most 80
characters in length on each line.
If indent is given, ensures each line is indented to that number
of spaces.
'''
ret... | def function[doc_paragraph, parameter[s, indent]]:
constant[Takes in a string without wrapping corresponding to a paragraph,
and returns a version of that string wrapped to be at most 80
characters in length on each line.
If indent is given, ensures each line is indented to that number
... | keyword[def] identifier[doc_paragraph] ( identifier[s] , identifier[indent] = literal[int] ):
literal[string]
keyword[return] literal[string] . identifier[join] ([ literal[string] * identifier[indent] + identifier[l] keyword[for] identifier[l] keyword[in] identifier[wrap] ( identifier[s] , identifier[... | def doc_paragraph(s, indent=0):
"""Takes in a string without wrapping corresponding to a paragraph,
and returns a version of that string wrapped to be at most 80
characters in length on each line.
If indent is given, ensures each line is indented to that number
of spaces.
"""
ret... |
def remove_team(name, profile="github"):
'''
Remove a github team.
name
The name of the team to be removed.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.remove_team 'team_name'
... | def function[remove_team, parameter[name, profile]]:
constant[
Remove a github team.
name
The name of the team to be removed.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.remo... | keyword[def] identifier[remove_team] ( identifier[name] , identifier[profile] = literal[string] ):
literal[string]
identifier[team_info] = identifier[get_team] ( identifier[name] , identifier[profile] = identifier[profile] )
keyword[if] keyword[not] identifier[team_info] :
identifier[log] .... | def remove_team(name, profile='github'):
"""
Remove a github team.
name
The name of the team to be removed.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.remove_team 'team_name'
... |
def update(self, **data):
"""
Update records in the table with +data+. Often combined with `where`,
as it acts on all records in the table unless restricted.
ex)
>>> Repo("foos").update(name="bar")
UPDATE foos SET name = "bar"
"""
data = data.items()
... | def function[update, parameter[self]]:
constant[
Update records in the table with +data+. Often combined with `where`,
as it acts on all records in the table unless restricted.
ex)
>>> Repo("foos").update(name="bar")
UPDATE foos SET name = "bar"
]
variab... | keyword[def] identifier[update] ( identifier[self] ,** identifier[data] ):
literal[string]
identifier[data] = identifier[data] . identifier[items] ()
identifier[update_command_arg] = literal[string] . identifier[join] ( literal[string] . identifier[format] ( identifier[entry] [ literal[int... | def update(self, **data):
"""
Update records in the table with +data+. Often combined with `where`,
as it acts on all records in the table unless restricted.
ex)
>>> Repo("foos").update(name="bar")
UPDATE foos SET name = "bar"
"""
data = data.items()
update_... |
def fnv(data, hval_init, fnv_prime, fnv_size):
"""
Core FNV hash algorithm used in FNV0 and FNV1.
"""
assert isinstance(data, bytes)
hval = hval_init
for byte in data:
hval = (hval * fnv_prime) % fnv_size
hval = hval ^ _get_byte(byte)
return hval | def function[fnv, parameter[data, hval_init, fnv_prime, fnv_size]]:
constant[
Core FNV hash algorithm used in FNV0 and FNV1.
]
assert[call[name[isinstance], parameter[name[data], name[bytes]]]]
variable[hval] assign[=] name[hval_init]
for taget[name[byte]] in starred[name[data]] begi... | keyword[def] identifier[fnv] ( identifier[data] , identifier[hval_init] , identifier[fnv_prime] , identifier[fnv_size] ):
literal[string]
keyword[assert] identifier[isinstance] ( identifier[data] , identifier[bytes] )
identifier[hval] = identifier[hval_init]
keyword[for] identifier[byte] key... | def fnv(data, hval_init, fnv_prime, fnv_size):
"""
Core FNV hash algorithm used in FNV0 and FNV1.
"""
assert isinstance(data, bytes)
hval = hval_init
for byte in data:
hval = hval * fnv_prime % fnv_size
hval = hval ^ _get_byte(byte) # depends on [control=['for'], data=['byte']]
... |
async def on_closing_async(self, reason):
"""
Overides partition pump on closing.
:param reason: The reason for the shutdown.
:type reason: str
"""
self.partition_receiver.eh_partition_pump.set_pump_status("Errored")
try:
await self.running
ex... | <ast.AsyncFunctionDef object at 0x7da2046225f0> | keyword[async] keyword[def] identifier[on_closing_async] ( identifier[self] , identifier[reason] ):
literal[string]
identifier[self] . identifier[partition_receiver] . identifier[eh_partition_pump] . identifier[set_pump_status] ( literal[string] )
keyword[try] :
keyword[await... | async def on_closing_async(self, reason):
"""
Overides partition pump on closing.
:param reason: The reason for the shutdown.
:type reason: str
"""
self.partition_receiver.eh_partition_pump.set_pump_status('Errored')
try:
await self.running # depends on [control=['t... |
def qteKillApplet(self, appletID: str):
"""
Destroy the applet with ID ``appletID``.
This method removes ``appletID`` from Qtmacs permanently - no
questions asked. It is the responsibility of the (macro)
programmer to use it responsibly.
If the applet was visible then t... | def function[qteKillApplet, parameter[self, appletID]]:
constant[
Destroy the applet with ID ``appletID``.
This method removes ``appletID`` from Qtmacs permanently - no
questions asked. It is the responsibility of the (macro)
programmer to use it responsibly.
If the app... | keyword[def] identifier[qteKillApplet] ( identifier[self] , identifier[appletID] : identifier[str] ):
literal[string]
identifier[ID_list] =[ identifier[_] . identifier[qteAppletID] () keyword[for] identifier[_] keyword[in] identifier[self] . identifier[_qteAppletList] ]
keywor... | def qteKillApplet(self, appletID: str):
"""
Destroy the applet with ID ``appletID``.
This method removes ``appletID`` from Qtmacs permanently - no
questions asked. It is the responsibility of the (macro)
programmer to use it responsibly.
If the applet was visible then the m... |
def interp_value(mass, age, feh, icol,
grid, mass_col, ages, fehs, grid_Ns):
# return_box):
"""mass, age, feh are *single values* at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the colum... | def function[interp_value, parameter[mass, age, feh, icol, grid, mass_col, ages, fehs, grid_Ns]]:
constant[mass, age, feh are *single values* at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the column index of mass
... | keyword[def] identifier[interp_value] ( identifier[mass] , identifier[age] , identifier[feh] , identifier[icol] ,
identifier[grid] , identifier[mass_col] , identifier[ages] , identifier[fehs] , identifier[grid_Ns] ):
literal[string]
identifier[Nage] = identifier[len] ( identifier[ages] )
identifie... | def interp_value(mass, age, feh, icol, grid, mass_col, ages, fehs, grid_Ns):
# return_box):
'mass, age, feh are *single values* at which values are desired\n\n icol is the column index of desired value\n grid is nfeh x nage x max(nmass) x ncols array\n mass_col is the column index of mass\n ages is ... |
def notify(self, msg):
"""Send a notification to all registered listeners.
msg : str
Message to send to each listener
"""
for listener in self.listeners:
self._send(listener, msg) | def function[notify, parameter[self, msg]]:
constant[Send a notification to all registered listeners.
msg : str
Message to send to each listener
]
for taget[name[listener]] in starred[name[self].listeners] begin[:]
call[name[self]._send, parameter[name[listen... | keyword[def] identifier[notify] ( identifier[self] , identifier[msg] ):
literal[string]
keyword[for] identifier[listener] keyword[in] identifier[self] . identifier[listeners] :
identifier[self] . identifier[_send] ( identifier[listener] , identifier[msg] ) | def notify(self, msg):
"""Send a notification to all registered listeners.
msg : str
Message to send to each listener
"""
for listener in self.listeners:
self._send(listener, msg) # depends on [control=['for'], data=['listener']] |
def execute(self, env, args):
""" Creates a new task.
`env`
Runtime ``Environment`` instance.
`args`
Arguments object from arg parser.
"""
task_name = args.task_name
clone_task = args.clone_task
if not env.task.create... | def function[execute, parameter[self, env, args]]:
constant[ Creates a new task.
`env`
Runtime ``Environment`` instance.
`args`
Arguments object from arg parser.
]
variable[task_name] assign[=] name[args].task_name
variable[clo... | keyword[def] identifier[execute] ( identifier[self] , identifier[env] , identifier[args] ):
literal[string]
identifier[task_name] = identifier[args] . identifier[task_name]
identifier[clone_task] = identifier[args] . identifier[clone_task]
keyword[if] keyword[not] identifier... | def execute(self, env, args):
""" Creates a new task.
`env`
Runtime ``Environment`` instance.
`args`
Arguments object from arg parser.
"""
task_name = args.task_name
clone_task = args.clone_task
if not env.task.create(task_name, clone_... |
def _establish_authenticated_session(self, kik_node):
"""
Updates the kik node and creates a new connection to kik servers.
This new connection will be initiated with another payload which proves
we have the credentials for a specific user. This is how authentication is done.
:p... | def function[_establish_authenticated_session, parameter[self, kik_node]]:
constant[
Updates the kik node and creates a new connection to kik servers.
This new connection will be initiated with another payload which proves
we have the credentials for a specific user. This is how authenti... | keyword[def] identifier[_establish_authenticated_session] ( identifier[self] , identifier[kik_node] ):
literal[string]
identifier[self] . identifier[kik_node] = identifier[kik_node]
identifier[log] . identifier[info] ( literal[string] )
identifier[self] . identifier[disconnect] ... | def _establish_authenticated_session(self, kik_node):
"""
Updates the kik node and creates a new connection to kik servers.
This new connection will be initiated with another payload which proves
we have the credentials for a specific user. This is how authentication is done.
:param... |
def prepare_query(query):
"""
Prepare a query object for the RAPI.
RAPI has lots of curious rules for coercing values.
This function operates on dicts in-place and has no return value.
@type query: dict
@param query: Query arguments
"""
for name in query:
value = query[name]
... | def function[prepare_query, parameter[query]]:
constant[
Prepare a query object for the RAPI.
RAPI has lots of curious rules for coercing values.
This function operates on dicts in-place and has no return value.
@type query: dict
@param query: Query arguments
]
for taget[name[... | keyword[def] identifier[prepare_query] ( identifier[query] ):
literal[string]
keyword[for] identifier[name] keyword[in] identifier[query] :
identifier[value] = identifier[query] [ identifier[name] ]
keyword[if] identifier[value] keyword[is] keyword[None] :
id... | def prepare_query(query):
"""
Prepare a query object for the RAPI.
RAPI has lots of curious rules for coercing values.
This function operates on dicts in-place and has no return value.
@type query: dict
@param query: Query arguments
"""
for name in query:
value = query[name]
... |
def _try_to_clean_garbage(self, writer_spec, exclude_list=()):
"""Tries to remove any files created by this shard that aren't needed.
Args:
writer_spec: writer_spec for the MR.
exclude_list: A list of filenames (strings) that should not be
removed.
"""
# Try to remove garbage (if an... | def function[_try_to_clean_garbage, parameter[self, writer_spec, exclude_list]]:
constant[Tries to remove any files created by this shard that aren't needed.
Args:
writer_spec: writer_spec for the MR.
exclude_list: A list of filenames (strings) that should not be
removed.
]
... | keyword[def] identifier[_try_to_clean_garbage] ( identifier[self] , identifier[writer_spec] , identifier[exclude_list] =()):
literal[string]
identifier[tmpl] = identifier[string] . identifier[Template] ( identifier[self] . identifier[_TMPFILE_PREFIX] )
identifier[prefix] = identifier[tmpl] .... | def _try_to_clean_garbage(self, writer_spec, exclude_list=()):
"""Tries to remove any files created by this shard that aren't needed.
Args:
writer_spec: writer_spec for the MR.
exclude_list: A list of filenames (strings) that should not be
removed.
"""
# Try to remove garbage (if an... |
def get_url_directory_string(url):
"""
Determines the url's directory string.
:param str url: the url to extract the directory string from
:return str: the directory string on the server
"""
domain = UrlExtractor.get_allowed_domain(url)
splitted_url = url.split(... | def function[get_url_directory_string, parameter[url]]:
constant[
Determines the url's directory string.
:param str url: the url to extract the directory string from
:return str: the directory string on the server
]
variable[domain] assign[=] call[name[UrlExtractor].get_... | keyword[def] identifier[get_url_directory_string] ( identifier[url] ):
literal[string]
identifier[domain] = identifier[UrlExtractor] . identifier[get_allowed_domain] ( identifier[url] )
identifier[splitted_url] = identifier[url] . identifier[split] ( literal[string] )
... | def get_url_directory_string(url):
"""
Determines the url's directory string.
:param str url: the url to extract the directory string from
:return str: the directory string on the server
"""
domain = UrlExtractor.get_allowed_domain(url)
splitted_url = url.split('/')
# th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.