code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def _sample_item(self, **kwargs):
"""Sample an item from the pool according to the instrumental
distribution
"""
t = self.t_
# Update instrumental distribution
self._calc_inst_pmf()
if self.record_inst_hist:
inst_pmf = self._inst_pmf[:,t]
els... | def function[_sample_item, parameter[self]]:
constant[Sample an item from the pool according to the instrumental
distribution
]
variable[t] assign[=] name[self].t_
call[name[self]._calc_inst_pmf, parameter[]]
if name[self].record_inst_hist begin[:]
variabl... | keyword[def] identifier[_sample_item] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[t] = identifier[self] . identifier[t_]
identifier[self] . identifier[_calc_inst_pmf] ()
keyword[if] identifier[self] . identifier[record_inst_hist] :
... | def _sample_item(self, **kwargs):
"""Sample an item from the pool according to the instrumental
distribution
"""
t = self.t_
# Update instrumental distribution
self._calc_inst_pmf()
if self.record_inst_hist:
inst_pmf = self._inst_pmf[:, t] # depends on [control=['if'], data=... |
def setPluginPath(cls, pluginpath):
"""
Sets the plugin path for this class to the given path. The inputted
pluginpath value can either be a list of strings, or a string
containing paths separated by the OS specific path separator (':' on
Mac & Linux, ';' on Windows)
... | def function[setPluginPath, parameter[cls, pluginpath]]:
constant[
Sets the plugin path for this class to the given path. The inputted
pluginpath value can either be a list of strings, or a string
containing paths separated by the OS specific path separator (':' on
Mac & Linux, ... | keyword[def] identifier[setPluginPath] ( identifier[cls] , identifier[pluginpath] ):
literal[string]
identifier[setattr] ( identifier[cls] , literal[string] % identifier[cls] . identifier[__name__] , keyword[None] )
identifier[cls] . identifier[addPluginPath] ( identifier[pluginpath] ) | def setPluginPath(cls, pluginpath):
"""
Sets the plugin path for this class to the given path. The inputted
pluginpath value can either be a list of strings, or a string
containing paths separated by the OS specific path separator (':' on
Mac & Linux, ';' on Windows)
... |
def _find_experiment_tag(self):
"""Finds the experiment associcated with the metadata.EXPERIMENT_TAG tag.
Caches the experiment if it was found.
Returns:
The experiment or None if no such experiment is found.
"""
with self._experiment_from_tag_lock:
if self._experiment_from_tag is None... | def function[_find_experiment_tag, parameter[self]]:
constant[Finds the experiment associcated with the metadata.EXPERIMENT_TAG tag.
Caches the experiment if it was found.
Returns:
The experiment or None if no such experiment is found.
]
with name[self]._experiment_from_tag_lock begi... | keyword[def] identifier[_find_experiment_tag] ( identifier[self] ):
literal[string]
keyword[with] identifier[self] . identifier[_experiment_from_tag_lock] :
keyword[if] identifier[self] . identifier[_experiment_from_tag] keyword[is] keyword[None] :
identifier[mapping] = identifier[self]... | def _find_experiment_tag(self):
"""Finds the experiment associcated with the metadata.EXPERIMENT_TAG tag.
Caches the experiment if it was found.
Returns:
The experiment or None if no such experiment is found.
"""
with self._experiment_from_tag_lock:
if self._experiment_from_tag is No... |
def postinit(self, dest=None, values=None):
"""Do some setup after initialisation.
:param dest: Where to print to.
:type dest: NodeNG or None
:param values: What to print.
:type values: list(NodeNG) or None
"""
self.dest = dest
self.values = values | def function[postinit, parameter[self, dest, values]]:
constant[Do some setup after initialisation.
:param dest: Where to print to.
:type dest: NodeNG or None
:param values: What to print.
:type values: list(NodeNG) or None
]
name[self].dest assign[=] name[dest]... | keyword[def] identifier[postinit] ( identifier[self] , identifier[dest] = keyword[None] , identifier[values] = keyword[None] ):
literal[string]
identifier[self] . identifier[dest] = identifier[dest]
identifier[self] . identifier[values] = identifier[values] | def postinit(self, dest=None, values=None):
"""Do some setup after initialisation.
:param dest: Where to print to.
:type dest: NodeNG or None
:param values: What to print.
:type values: list(NodeNG) or None
"""
self.dest = dest
self.values = values |
def get_response_for_url(self, url):
"""
Accepts a fully-qualified url.
Returns an HttpResponse, passing through all headers and the status code.
"""
if not url or "//" not in url:
raise ValueError("Missing or invalid url: %s" % url)
render_url = self.BASE_U... | def function[get_response_for_url, parameter[self, url]]:
constant[
Accepts a fully-qualified url.
Returns an HttpResponse, passing through all headers and the status code.
]
if <ast.BoolOp object at 0x7da1b1b14910> begin[:]
<ast.Raise object at 0x7da1b1b15ea0>
va... | keyword[def] identifier[get_response_for_url] ( identifier[self] , identifier[url] ):
literal[string]
keyword[if] keyword[not] identifier[url] keyword[or] literal[string] keyword[not] keyword[in] identifier[url] :
keyword[raise] identifier[ValueError] ( literal[string] % ident... | def get_response_for_url(self, url):
"""
Accepts a fully-qualified url.
Returns an HttpResponse, passing through all headers and the status code.
"""
if not url or '//' not in url:
raise ValueError('Missing or invalid url: %s' % url) # depends on [control=['if'], data=[]]
re... |
def get_fitted_lv1_prim(self, reqef, bitcount):
"""
request
r - A C 0 1
e -|? ! ! ! !
s A|? ✓ ✓ 0 1 Check this logic
u C|? m ✓ 0 1
l 0|? M M 0 !
t 1|? M M ! 1
- = No Care
A = arbitrary
C = Constant
0 = ZERO
1... | def function[get_fitted_lv1_prim, parameter[self, reqef, bitcount]]:
constant[
request
r - A C 0 1
e -|? ! ! ! !
s A|? ✓ ✓ 0 1 Check this logic
u C|? m ✓ 0 1
l 0|? M M 0 !
t 1|? M M ! 1
- = No Care
A = arbitrary
C = Constant... | keyword[def] identifier[get_fitted_lv1_prim] ( identifier[self] , identifier[reqef] , identifier[bitcount] ):
literal[string]
identifier[res] = identifier[self] . identifier[_fitted_lv1_prim_cache] . identifier[get] ( identifier[reqef] )
keyword[if] identifier[res] :
keyword[... | def get_fitted_lv1_prim(self, reqef, bitcount):
"""
request
r - A C 0 1
e -|? ! ! ! !
s A|? ✓ ✓ 0 1 Check this logic
u C|? m ✓ 0 1
l 0|? M M 0 !
t 1|? M M ! 1
- = No Care
A = arbitrary
C = Constant
0 = ZERO
1 = O... |
def get_oauth_token_key_name(self, provider):
"""
Returns the token_key name for the oauth provider
if none is configured defaults to oauth_token
this is configured using OAUTH_PROVIDERS and token_key key.
"""
for _provider in self.oauth_providers:
... | def function[get_oauth_token_key_name, parameter[self, provider]]:
constant[
Returns the token_key name for the oauth provider
if none is configured defaults to oauth_token
this is configured using OAUTH_PROVIDERS and token_key key.
]
for taget[name[_provider]... | keyword[def] identifier[get_oauth_token_key_name] ( identifier[self] , identifier[provider] ):
literal[string]
keyword[for] identifier[_provider] keyword[in] identifier[self] . identifier[oauth_providers] :
keyword[if] identifier[_provider] [ literal[string] ]== identifier[provider... | def get_oauth_token_key_name(self, provider):
"""
Returns the token_key name for the oauth provider
if none is configured defaults to oauth_token
this is configured using OAUTH_PROVIDERS and token_key key.
"""
for _provider in self.oauth_providers:
if _provide... |
def merge(l1, l2):
"""
merge 2 lines together
"""
x1, y1, x2, y2 = l1
xx1, yy1, xx2, yy2 = l2
comb = ((x1, y1, xx1, yy1),
(x1, y1, xx2, yy2),
(x2, y2, xx1, yy1),
(x2, y2, xx2, yy2))
d = [length(c) for c in comb]
i = argmax(d)
dist = d[i]
mid... | def function[merge, parameter[l1, l2]]:
constant[
merge 2 lines together
]
<ast.Tuple object at 0x7da20c993f40> assign[=] name[l1]
<ast.Tuple object at 0x7da20c992d70> assign[=] name[l2]
variable[comb] assign[=] tuple[[<ast.Tuple object at 0x7da20c993f70>, <ast.Tuple object at 0x... | keyword[def] identifier[merge] ( identifier[l1] , identifier[l2] ):
literal[string]
identifier[x1] , identifier[y1] , identifier[x2] , identifier[y2] = identifier[l1]
identifier[xx1] , identifier[yy1] , identifier[xx2] , identifier[yy2] = identifier[l2]
identifier[comb] =(( identifier[x1] , id... | def merge(l1, l2):
"""
merge 2 lines together
"""
(x1, y1, x2, y2) = l1
(xx1, yy1, xx2, yy2) = l2
comb = ((x1, y1, xx1, yy1), (x1, y1, xx2, yy2), (x2, y2, xx1, yy1), (x2, y2, xx2, yy2))
d = [length(c) for c in comb]
i = argmax(d)
dist = d[i]
mid = middle(comb[i])
a = (angle(l... |
def roles(self):
""" Roles accessor """
roles = list(self.__roles)
default_role = Role(
handle='user',
title='User role',
description='All registered users get this role by default'
)
roles.append(default_role)
return tuple(roles) | def function[roles, parameter[self]]:
constant[ Roles accessor ]
variable[roles] assign[=] call[name[list], parameter[name[self].__roles]]
variable[default_role] assign[=] call[name[Role], parameter[]]
call[name[roles].append, parameter[name[default_role]]]
return[call[name[tuple], p... | keyword[def] identifier[roles] ( identifier[self] ):
literal[string]
identifier[roles] = identifier[list] ( identifier[self] . identifier[__roles] )
identifier[default_role] = identifier[Role] (
identifier[handle] = literal[string] ,
identifier[title] = literal[string] ,
... | def roles(self):
""" Roles accessor """
roles = list(self.__roles)
default_role = Role(handle='user', title='User role', description='All registered users get this role by default')
roles.append(default_role)
return tuple(roles) |
def check_int(self, param, error_msg):
"""
This function check if the parameter is int.
If yes, the function returns the parameter,
if not, it raises error message.
**Args:**
* `param` : parameter to check (int or similar)
* `error_ms` : lowest ... | def function[check_int, parameter[self, param, error_msg]]:
constant[
This function check if the parameter is int.
If yes, the function returns the parameter,
if not, it raises error message.
**Args:**
* `param` : parameter to check (int or similar)
... | keyword[def] identifier[check_int] ( identifier[self] , identifier[param] , identifier[error_msg] ):
literal[string]
keyword[if] identifier[type] ( identifier[param] )== identifier[int] :
keyword[return] identifier[int] ( identifier[param] )
keyword[else] :
keyw... | def check_int(self, param, error_msg):
"""
This function check if the parameter is int.
If yes, the function returns the parameter,
if not, it raises error message.
**Args:**
* `param` : parameter to check (int or similar)
* `error_ms` : lowest allo... |
def start_cluster_server(self, num_gpus=1, rdma=False):
"""Convenience function to access ``TFNode.start_cluster_server`` directly from this object instance."""
return TFNode.start_cluster_server(self, num_gpus, rdma) | def function[start_cluster_server, parameter[self, num_gpus, rdma]]:
constant[Convenience function to access ``TFNode.start_cluster_server`` directly from this object instance.]
return[call[name[TFNode].start_cluster_server, parameter[name[self], name[num_gpus], name[rdma]]]] | keyword[def] identifier[start_cluster_server] ( identifier[self] , identifier[num_gpus] = literal[int] , identifier[rdma] = keyword[False] ):
literal[string]
keyword[return] identifier[TFNode] . identifier[start_cluster_server] ( identifier[self] , identifier[num_gpus] , identifier[rdma] ) | def start_cluster_server(self, num_gpus=1, rdma=False):
"""Convenience function to access ``TFNode.start_cluster_server`` directly from this object instance."""
return TFNode.start_cluster_server(self, num_gpus, rdma) |
def sync(self, folders):
"""Syncs a list of folders to their assicated buckets.
folders: A list of 2-tuples in the form (folder, bucket)
"""
if not folders:
raise ValueError("No folders to sync given")
for folder in folders:
self.sync_folder(*fold... | def function[sync, parameter[self, folders]]:
constant[Syncs a list of folders to their assicated buckets.
folders: A list of 2-tuples in the form (folder, bucket)
]
if <ast.UnaryOp object at 0x7da18fe91870> begin[:]
<ast.Raise object at 0x7da18fe926e0>
for taget... | keyword[def] identifier[sync] ( identifier[self] , identifier[folders] ):
literal[string]
keyword[if] keyword[not] identifier[folders] :
keyword[raise] identifier[ValueError] ( literal[string] )
keyword[for] identifier[folder] keyword[in] identifier[folders] :
... | def sync(self, folders):
"""Syncs a list of folders to their assicated buckets.
folders: A list of 2-tuples in the form (folder, bucket)
"""
if not folders:
raise ValueError('No folders to sync given') # depends on [control=['if'], data=[]]
for folder in folders:
se... |
def create_launch_configuration(name, image_id, key_name=None,
vpc_id=None, vpc_name=None,
security_groups=None, user_data=None,
instance_type='m1.small', kernel_id=None,
ramdisk_id=None, bloc... | def function[create_launch_configuration, parameter[name, image_id, key_name, vpc_id, vpc_name, security_groups, user_data, instance_type, kernel_id, ramdisk_id, block_device_mappings, instance_monitoring, spot_price, instance_profile_name, ebs_optimized, associate_public_ip_address, volume_type, delete_on_termination,... | keyword[def] identifier[create_launch_configuration] ( identifier[name] , identifier[image_id] , identifier[key_name] = keyword[None] ,
identifier[vpc_id] = keyword[None] , identifier[vpc_name] = keyword[None] ,
identifier[security_groups] = keyword[None] , identifier[user_data] = keyword[None] ,
identifier[instan... | def create_launch_configuration(name, image_id, key_name=None, vpc_id=None, vpc_name=None, security_groups=None, user_data=None, instance_type='m1.small', kernel_id=None, ramdisk_id=None, block_device_mappings=None, instance_monitoring=False, spot_price=None, instance_profile_name=None, ebs_optimized=False, associate_p... |
def pass_to_client(self, event, data, *args):
"""Passes data up to the client via a Queue().
:param event:
:param data:
:param args:
:return:
"""
self.q.put((event, data, *args)) | def function[pass_to_client, parameter[self, event, data]]:
constant[Passes data up to the client via a Queue().
:param event:
:param data:
:param args:
:return:
]
call[name[self].q.put, parameter[tuple[[<ast.Name object at 0x7da2041d8a30>, <ast.Name object at 0x... | keyword[def] identifier[pass_to_client] ( identifier[self] , identifier[event] , identifier[data] ,* identifier[args] ):
literal[string]
identifier[self] . identifier[q] . identifier[put] (( identifier[event] , identifier[data] ,* identifier[args] )) | def pass_to_client(self, event, data, *args):
"""Passes data up to the client via a Queue().
:param event:
:param data:
:param args:
:return:
"""
self.q.put((event, data, *args)) |
def consume(generator): # pragma: no cover
"""
Helper function to consume a synchronous or asynchronous generator.
Arguments:
generator (generator|asyncgenerator): generator to consume.
Returns:
list
"""
# If synchronous generator, just consume and return as list
if hasatt... | def function[consume, parameter[generator]]:
constant[
Helper function to consume a synchronous or asynchronous generator.
Arguments:
generator (generator|asyncgenerator): generator to consume.
Returns:
list
]
if call[name[hasattr], parameter[name[generator], constant[_... | keyword[def] identifier[consume] ( identifier[generator] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[generator] , literal[string] ):
keyword[return] identifier[list] ( identifier[generator] )
keyword[if] keyword[not] identifier[PY_35] :
keyword[raise] i... | def consume(generator): # pragma: no cover
'\n Helper function to consume a synchronous or asynchronous generator.\n\n Arguments:\n generator (generator|asyncgenerator): generator to consume.\n\n Returns:\n list\n '
# If synchronous generator, just consume and return as list
if ha... |
def _format_msg(text, width, indent=0, prefix=""):
r"""
Format exception message.
Replace newline characters \n with ``\n``, ` with \` and then wrap text as
needed
"""
text = repr(text).replace("`", "\\`").replace("\\n", " ``\\n`` ")
sindent = " " * indent if not prefix else prefix
wrap... | def function[_format_msg, parameter[text, width, indent, prefix]]:
constant[
Format exception message.
Replace newline characters \n with ``\n``, ` with \` and then wrap text as
needed
]
variable[text] assign[=] call[call[call[name[repr], parameter[name[text]]].replace, parameter[consta... | keyword[def] identifier[_format_msg] ( identifier[text] , identifier[width] , identifier[indent] = literal[int] , identifier[prefix] = literal[string] ):
literal[string]
identifier[text] = identifier[repr] ( identifier[text] ). identifier[replace] ( literal[string] , literal[string] ). identifier[replace] ... | def _format_msg(text, width, indent=0, prefix=''):
"""
Format exception message.
Replace newline characters \\n with ``\\n``, ` with \\` and then wrap text as
needed
"""
text = repr(text).replace('`', '\\`').replace('\\n', ' ``\\n`` ')
sindent = ' ' * indent if not prefix else prefix
wr... |
def get_value(self, subsystem, option):
"""
Read the given value from the given subsystem.
Do not include the subsystem name in the option name.
Only call this method if the given subsystem is available.
"""
assert subsystem in self, 'Subsystem {} is missing'.format(subsy... | def function[get_value, parameter[self, subsystem, option]]:
constant[
Read the given value from the given subsystem.
Do not include the subsystem name in the option name.
Only call this method if the given subsystem is available.
]
assert[compare[name[subsystem] in name[self... | keyword[def] identifier[get_value] ( identifier[self] , identifier[subsystem] , identifier[option] ):
literal[string]
keyword[assert] identifier[subsystem] keyword[in] identifier[self] , literal[string] . identifier[format] ( identifier[subsystem] )
keyword[return] identifier[util] . i... | def get_value(self, subsystem, option):
"""
Read the given value from the given subsystem.
Do not include the subsystem name in the option name.
Only call this method if the given subsystem is available.
"""
assert subsystem in self, 'Subsystem {} is missing'.format(subsystem)
... |
def all_pairs_normalized_distances_reference(X):
"""
Reference implementation of normalized all-pairs distance, used
for testing the more efficient implementation above for equivalence.
"""
n_samples, n_cols = X.shape
# matrix of mean squared difference between between samples
D = np.ones((n... | def function[all_pairs_normalized_distances_reference, parameter[X]]:
constant[
Reference implementation of normalized all-pairs distance, used
for testing the more efficient implementation above for equivalence.
]
<ast.Tuple object at 0x7da207f03df0> assign[=] name[X].shape
variable... | keyword[def] identifier[all_pairs_normalized_distances_reference] ( identifier[X] ):
literal[string]
identifier[n_samples] , identifier[n_cols] = identifier[X] . identifier[shape]
identifier[D] = identifier[np] . identifier[ones] (( identifier[n_samples] , identifier[n_samples] ), identifier[dty... | def all_pairs_normalized_distances_reference(X):
"""
Reference implementation of normalized all-pairs distance, used
for testing the more efficient implementation above for equivalence.
"""
(n_samples, n_cols) = X.shape
# matrix of mean squared difference between between samples
D = np.ones(... |
def transition_run(self,
pipeline_key,
blocking_slot_keys=None,
fanned_out_pipelines=None,
pipelines_to_run=None):
"""Marks an asynchronous or generator pipeline as running.
Does nothing if the pipeline is no longer in a runnab... | def function[transition_run, parameter[self, pipeline_key, blocking_slot_keys, fanned_out_pipelines, pipelines_to_run]]:
constant[Marks an asynchronous or generator pipeline as running.
Does nothing if the pipeline is no longer in a runnable state.
Args:
pipeline_key: The db.Key of the _Pipeline... | keyword[def] identifier[transition_run] ( identifier[self] ,
identifier[pipeline_key] ,
identifier[blocking_slot_keys] = keyword[None] ,
identifier[fanned_out_pipelines] = keyword[None] ,
identifier[pipelines_to_run] = keyword[None] ):
literal[string]
keyword[def] identifier[txn] ():
identifier... | def transition_run(self, pipeline_key, blocking_slot_keys=None, fanned_out_pipelines=None, pipelines_to_run=None):
"""Marks an asynchronous or generator pipeline as running.
Does nothing if the pipeline is no longer in a runnable state.
Args:
pipeline_key: The db.Key of the _PipelineRecord to update... |
def create_state_multi_precision(self, index, weight):
"""Creates auxiliary state for a given weight, including FP32 high
precision copy if original weight is FP16.
This method is provided to perform automatic mixed precision training
for optimizers that do not support it themselves.
... | def function[create_state_multi_precision, parameter[self, index, weight]]:
constant[Creates auxiliary state for a given weight, including FP32 high
precision copy if original weight is FP16.
This method is provided to perform automatic mixed precision training
for optimizers that do no... | keyword[def] identifier[create_state_multi_precision] ( identifier[self] , identifier[index] , identifier[weight] ):
literal[string]
identifier[weight_master_copy] = keyword[None]
keyword[if] identifier[self] . identifier[multi_precision] keyword[and] identifier[weight] . identifier[dt... | def create_state_multi_precision(self, index, weight):
"""Creates auxiliary state for a given weight, including FP32 high
precision copy if original weight is FP16.
This method is provided to perform automatic mixed precision training
for optimizers that do not support it themselves.
... |
def benchmark(self, func, gpu_args, threads, grid, times):
"""runs the kernel and measures time repeatedly, returns average time
Runs the kernel and measures kernel execution time repeatedly, number of
iterations is set during the creation of CudaFunctions. Benchmark returns
a robust av... | def function[benchmark, parameter[self, func, gpu_args, threads, grid, times]]:
constant[runs the kernel and measures time repeatedly, returns average time
Runs the kernel and measures kernel execution time repeatedly, number of
iterations is set during the creation of CudaFunctions. Benchmark ... | keyword[def] identifier[benchmark] ( identifier[self] , identifier[func] , identifier[gpu_args] , identifier[threads] , identifier[grid] , identifier[times] ):
literal[string]
identifier[start] = identifier[drv] . identifier[Event] ()
identifier[end] = identifier[drv] . identifier[Event] (... | def benchmark(self, func, gpu_args, threads, grid, times):
"""runs the kernel and measures time repeatedly, returns average time
Runs the kernel and measures kernel execution time repeatedly, number of
iterations is set during the creation of CudaFunctions. Benchmark returns
a robust averag... |
def minibatch_by_words(items, size, tuples=True, count_words=len):
"""Create minibatches of a given number of words."""
if isinstance(size, int):
size_ = itertools.repeat(size)
else:
size_ = size
items = iter(items)
while True:
batch_size = next(size_)
batch = []
... | def function[minibatch_by_words, parameter[items, size, tuples, count_words]]:
constant[Create minibatches of a given number of words.]
if call[name[isinstance], parameter[name[size], name[int]]] begin[:]
variable[size_] assign[=] call[name[itertools].repeat, parameter[name[size]]]
... | keyword[def] identifier[minibatch_by_words] ( identifier[items] , identifier[size] , identifier[tuples] = keyword[True] , identifier[count_words] = identifier[len] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[size] , identifier[int] ):
identifier[size_] = identifier[itertool... | def minibatch_by_words(items, size, tuples=True, count_words=len):
"""Create minibatches of a given number of words."""
if isinstance(size, int):
size_ = itertools.repeat(size) # depends on [control=['if'], data=[]]
else:
size_ = size
items = iter(items)
while True:
batch_si... |
def get_media_timestamp(self, last_timestamp=None):
"""
Retrieves the most recent timestamp of the media in the static root.
If last_timestamp is given, retrieves the first timestamp more recent than this value.
"""
r = self.local_renderer
_latest_timestamp = -1e99999999... | def function[get_media_timestamp, parameter[self, last_timestamp]]:
constant[
Retrieves the most recent timestamp of the media in the static root.
If last_timestamp is given, retrieves the first timestamp more recent than this value.
]
variable[r] assign[=] name[self].local_rend... | keyword[def] identifier[get_media_timestamp] ( identifier[self] , identifier[last_timestamp] = keyword[None] ):
literal[string]
identifier[r] = identifier[self] . identifier[local_renderer]
identifier[_latest_timestamp] =- literal[int]
keyword[for] identifier[path] keyword[in]... | def get_media_timestamp(self, last_timestamp=None):
"""
Retrieves the most recent timestamp of the media in the static root.
If last_timestamp is given, retrieves the first timestamp more recent than this value.
"""
r = self.local_renderer
_latest_timestamp = -1e309
for path in ... |
def gen_slide_seg_list(mm_begin, mm_end, seg_duration, slide_step):
"""
生成时间片开始时刻列表,时间片以slide_step步长进行滑动
:param mm_begin:
:param mm_end:
:param seg_duration:
:param slide_step:
:return:
"""
seg_begin_list = [i for i in
range(mm_begin, mm_end - seg_duration + 1, ... | def function[gen_slide_seg_list, parameter[mm_begin, mm_end, seg_duration, slide_step]]:
constant[
生成时间片开始时刻列表,时间片以slide_step步长进行滑动
:param mm_begin:
:param mm_end:
:param seg_duration:
:param slide_step:
:return:
]
variable[seg_begin_list] assign[=] <ast.ListComp object at 0x... | keyword[def] identifier[gen_slide_seg_list] ( identifier[mm_begin] , identifier[mm_end] , identifier[seg_duration] , identifier[slide_step] ):
literal[string]
identifier[seg_begin_list] =[ identifier[i] keyword[for] identifier[i] keyword[in]
identifier[range] ( identifier[mm_begin] , identifier[mm... | def gen_slide_seg_list(mm_begin, mm_end, seg_duration, slide_step):
"""
生成时间片开始时刻列表,时间片以slide_step步长进行滑动
:param mm_begin:
:param mm_end:
:param seg_duration:
:param slide_step:
:return:
"""
seg_begin_list = [i for i in range(mm_begin, mm_end - seg_duration + 1, slide_step)]
seg_l... |
def add_skip_connection(self, u, v, connection_type):
""" Add a skip-connection to the descriptor.
Args:
u: Number of convolutional layers before the starting point.
v: Number of convolutional layers before the ending point.
connection_type: Must be either CONCAT_CONN... | def function[add_skip_connection, parameter[self, u, v, connection_type]]:
constant[ Add a skip-connection to the descriptor.
Args:
u: Number of convolutional layers before the starting point.
v: Number of convolutional layers before the ending point.
connection_type:... | keyword[def] identifier[add_skip_connection] ( identifier[self] , identifier[u] , identifier[v] , identifier[connection_type] ):
literal[string]
keyword[if] identifier[connection_type] keyword[not] keyword[in] [ identifier[self] . identifier[CONCAT_CONNECT] , identifier[self] . identifier[ADD_CO... | def add_skip_connection(self, u, v, connection_type):
""" Add a skip-connection to the descriptor.
Args:
u: Number of convolutional layers before the starting point.
v: Number of convolutional layers before the ending point.
connection_type: Must be either CONCAT_CONNECT ... |
def kma(inputfile_1, out_path, databases, db_path_kma, min_cov=0.6,
threshold=0.9, kma_path="cge/kma/kma", sample_name="",
inputfile_2=None, kma_mrs=None, kma_gapopen=None,
kma_gapextend=None, kma_penalty=None, kma_reward=None, kma_pm=None,
kma_fpm=None, kma_memmode=False... | def function[kma, parameter[inputfile_1, out_path, databases, db_path_kma, min_cov, threshold, kma_path, sample_name, inputfile_2, kma_mrs, kma_gapopen, kma_gapextend, kma_penalty, kma_reward, kma_pm, kma_fpm, kma_memmode, kma_nanopore, debug, kma_add_args]]:
constant[
I expect that there will only b... | keyword[def] identifier[kma] ( identifier[inputfile_1] , identifier[out_path] , identifier[databases] , identifier[db_path_kma] , identifier[min_cov] = literal[int] ,
identifier[threshold] = literal[int] , identifier[kma_path] = literal[string] , identifier[sample_name] = literal[string] ,
identifier[inputfile_2] =... | def kma(inputfile_1, out_path, databases, db_path_kma, min_cov=0.6, threshold=0.9, kma_path='cge/kma/kma', sample_name='', inputfile_2=None, kma_mrs=None, kma_gapopen=None, kma_gapextend=None, kma_penalty=None, kma_reward=None, kma_pm=None, kma_fpm=None, kma_memmode=False, kma_nanopore=False, debug=False, kma_add_args=... |
def read_sha1(
file_path,
buf_size = None,
start_byte = 0,
read_size = None,
extra_hashers = [], # update(data) will be called on all of these
):
'''
Determines the sha1 hash of a file in chunks, to prevent loading the entire file at once into memory
'''
read_size = read_size or os.s... | def function[read_sha1, parameter[file_path, buf_size, start_byte, read_size, extra_hashers]]:
constant[
Determines the sha1 hash of a file in chunks, to prevent loading the entire file at once into memory
]
variable[read_size] assign[=] <ast.BoolOp object at 0x7da204567820>
variable[buf... | keyword[def] identifier[read_sha1] (
identifier[file_path] ,
identifier[buf_size] = keyword[None] ,
identifier[start_byte] = literal[int] ,
identifier[read_size] = keyword[None] ,
identifier[extra_hashers] =[],
):
literal[string]
identifier[read_size] = identifier[read_size] keyword[or] identifier[o... | def read_sha1(file_path, buf_size=None, start_byte=0, read_size=None, extra_hashers=[]): # update(data) will be called on all of these
'\n Determines the sha1 hash of a file in chunks, to prevent loading the entire file at once into memory\n '
read_size = read_size or os.stat(file_path).st_size
buf_s... |
def addContinuousSet(self, continuousSet):
"""
Adds the specified continuousSet to this dataset.
"""
id_ = continuousSet.getId()
self._continuousSetIdMap[id_] = continuousSet
self._continuousSetIds.append(id_)
name = continuousSet.getLocalId()
self._contin... | def function[addContinuousSet, parameter[self, continuousSet]]:
constant[
Adds the specified continuousSet to this dataset.
]
variable[id_] assign[=] call[name[continuousSet].getId, parameter[]]
call[name[self]._continuousSetIdMap][name[id_]] assign[=] name[continuousSet]
... | keyword[def] identifier[addContinuousSet] ( identifier[self] , identifier[continuousSet] ):
literal[string]
identifier[id_] = identifier[continuousSet] . identifier[getId] ()
identifier[self] . identifier[_continuousSetIdMap] [ identifier[id_] ]= identifier[continuousSet]
identif... | def addContinuousSet(self, continuousSet):
"""
Adds the specified continuousSet to this dataset.
"""
id_ = continuousSet.getId()
self._continuousSetIdMap[id_] = continuousSet
self._continuousSetIds.append(id_)
name = continuousSet.getLocalId()
self._continuousSetNameMap[name] = c... |
def update_payload_in_draft_for_edit_extension(self, upload_stream, publisher_name, extension_name, draft_id, file_name=None, **kwargs):
"""UpdatePayloadInDraftForEditExtension.
[Preview API]
:param object upload_stream: Stream to upload
:param str publisher_name:
:param str exte... | def function[update_payload_in_draft_for_edit_extension, parameter[self, upload_stream, publisher_name, extension_name, draft_id, file_name]]:
constant[UpdatePayloadInDraftForEditExtension.
[Preview API]
:param object upload_stream: Stream to upload
:param str publisher_name:
:pa... | keyword[def] identifier[update_payload_in_draft_for_edit_extension] ( identifier[self] , identifier[upload_stream] , identifier[publisher_name] , identifier[extension_name] , identifier[draft_id] , identifier[file_name] = keyword[None] ,** identifier[kwargs] ):
literal[string]
identifier[route_valu... | def update_payload_in_draft_for_edit_extension(self, upload_stream, publisher_name, extension_name, draft_id, file_name=None, **kwargs):
"""UpdatePayloadInDraftForEditExtension.
[Preview API]
:param object upload_stream: Stream to upload
:param str publisher_name:
:param str extensio... |
def user_config_file(self):
"""Get the absolute path to the user config file."""
return os.path.join(
get_user_config_dir(self.app_name, self.app_author),
self.filename) | def function[user_config_file, parameter[self]]:
constant[Get the absolute path to the user config file.]
return[call[name[os].path.join, parameter[call[name[get_user_config_dir], parameter[name[self].app_name, name[self].app_author]], name[self].filename]]] | keyword[def] identifier[user_config_file] ( identifier[self] ):
literal[string]
keyword[return] identifier[os] . identifier[path] . identifier[join] (
identifier[get_user_config_dir] ( identifier[self] . identifier[app_name] , identifier[self] . identifier[app_author] ),
identifi... | def user_config_file(self):
"""Get the absolute path to the user config file."""
return os.path.join(get_user_config_dir(self.app_name, self.app_author), self.filename) |
def process_item(self, item, spider):
"""
Use the Pa11y command line tool to get an a11y report.
"""
config_file = write_pa11y_config(item)
args = [
self.pa11y_path,
item["url"],
'--config={file}'.format(file=config_file.name),
]
... | def function[process_item, parameter[self, item, spider]]:
constant[
Use the Pa11y command line tool to get an a11y report.
]
variable[config_file] assign[=] call[name[write_pa11y_config], parameter[name[item]]]
variable[args] assign[=] list[[<ast.Attribute object at 0x7da18ede47... | keyword[def] identifier[process_item] ( identifier[self] , identifier[item] , identifier[spider] ):
literal[string]
identifier[config_file] = identifier[write_pa11y_config] ( identifier[item] )
identifier[args] =[
identifier[self] . identifier[pa11y_path] ,
identifier[ite... | def process_item(self, item, spider):
"""
Use the Pa11y command line tool to get an a11y report.
"""
config_file = write_pa11y_config(item)
args = [self.pa11y_path, item['url'], '--config={file}'.format(file=config_file.name)]
for (flag, value) in self.cli_flags.items():
args.app... |
def azm(self):
"""Corrected azimuth, taking into account backsight, declination, and compass corrections."""
azm1 = self.get('BEARING', None)
azm2 = self.get('AZM2', None)
if azm1 is None and azm2 is None:
return None
if azm2 is None:
return azm1 + self.de... | def function[azm, parameter[self]]:
constant[Corrected azimuth, taking into account backsight, declination, and compass corrections.]
variable[azm1] assign[=] call[name[self].get, parameter[constant[BEARING], constant[None]]]
variable[azm2] assign[=] call[name[self].get, parameter[constant[AZM2]... | keyword[def] identifier[azm] ( identifier[self] ):
literal[string]
identifier[azm1] = identifier[self] . identifier[get] ( literal[string] , keyword[None] )
identifier[azm2] = identifier[self] . identifier[get] ( literal[string] , keyword[None] )
keyword[if] identifier[azm1] key... | def azm(self):
"""Corrected azimuth, taking into account backsight, declination, and compass corrections."""
azm1 = self.get('BEARING', None)
azm2 = self.get('AZM2', None)
if azm1 is None and azm2 is None:
return None # depends on [control=['if'], data=[]]
if azm2 is None:
return az... |
def pm(client, event, channel, nick, rest):
'Arggh matey'
if rest:
rest = rest.strip()
Karma.store.change(rest, 2)
rcpt = rest
else:
rcpt = channel
if random.random() > 0.95:
return f"Arrggh ye be doin' great, grand work, {rcpt}!"
return f"Arrggh ye be doin' ... | def function[pm, parameter[client, event, channel, nick, rest]]:
constant[Arggh matey]
if name[rest] begin[:]
variable[rest] assign[=] call[name[rest].strip, parameter[]]
call[name[Karma].store.change, parameter[name[rest], constant[2]]]
variable[rcpt] ass... | keyword[def] identifier[pm] ( identifier[client] , identifier[event] , identifier[channel] , identifier[nick] , identifier[rest] ):
literal[string]
keyword[if] identifier[rest] :
identifier[rest] = identifier[rest] . identifier[strip] ()
identifier[Karma] . identifier[store] . identifier... | def pm(client, event, channel, nick, rest):
"""Arggh matey"""
if rest:
rest = rest.strip()
Karma.store.change(rest, 2)
rcpt = rest # depends on [control=['if'], data=[]]
else:
rcpt = channel
if random.random() > 0.95:
return f"Arrggh ye be doin' great, grand work... |
def _apply_callables(self, acl, obj=None):
""" Iterate over ACEs from :acl: and apply callable principals
if any.
Principals are passed 3 arguments on call:
:ace: Single ACE object that looks like (action, callable,
permission or [permission])
:request: C... | def function[_apply_callables, parameter[self, acl, obj]]:
constant[ Iterate over ACEs from :acl: and apply callable principals
if any.
Principals are passed 3 arguments on call:
:ace: Single ACE object that looks like (action, callable,
permission or [permission])
... | keyword[def] identifier[_apply_callables] ( identifier[self] , identifier[acl] , identifier[obj] = keyword[None] ):
literal[string]
identifier[new_acl] =[]
keyword[for] identifier[i] , identifier[ace] keyword[in] identifier[enumerate] ( identifier[acl] ):
identifier[princip... | def _apply_callables(self, acl, obj=None):
""" Iterate over ACEs from :acl: and apply callable principals
if any.
Principals are passed 3 arguments on call:
:ace: Single ACE object that looks like (action, callable,
permission or [permission])
:request: Curre... |
def getVentRequiredEnabled(self):
"""Returns True if enabled, False if disabled"""
command = '$GE'
settings = self.sendCommand(command)
flags = int(settings[2], 16)
return not (flags & 0x0004) | def function[getVentRequiredEnabled, parameter[self]]:
constant[Returns True if enabled, False if disabled]
variable[command] assign[=] constant[$GE]
variable[settings] assign[=] call[name[self].sendCommand, parameter[name[command]]]
variable[flags] assign[=] call[name[int], parameter[ca... | keyword[def] identifier[getVentRequiredEnabled] ( identifier[self] ):
literal[string]
identifier[command] = literal[string]
identifier[settings] = identifier[self] . identifier[sendCommand] ( identifier[command] )
identifier[flags] = identifier[int] ( identifier[settings] [ literal[int] ], liter... | def getVentRequiredEnabled(self):
"""Returns True if enabled, False if disabled"""
command = '$GE'
settings = self.sendCommand(command)
flags = int(settings[2], 16)
return not flags & 4 |
def _check_yaml_and_paths(ymlfilepath, yamldefs):
""" Checks YAML for errors and resolves all paths
"""
relpath = os.path.relpath(ymlfilepath)
if '/' not in relpath:
relpath = './%s' % relpath
pathroot = os.path.abspath(os.path.dirname(ymlfilepath))
for image... | def function[_check_yaml_and_paths, parameter[ymlfilepath, yamldefs]]:
constant[ Checks YAML for errors and resolves all paths
]
variable[relpath] assign[=] call[name[os].path.relpath, parameter[name[ymlfilepath]]]
if compare[constant[/] <ast.NotIn object at 0x7da2590d7190> name[relpath]... | keyword[def] identifier[_check_yaml_and_paths] ( identifier[ymlfilepath] , identifier[yamldefs] ):
literal[string]
identifier[relpath] = identifier[os] . identifier[path] . identifier[relpath] ( identifier[ymlfilepath] )
keyword[if] literal[string] keyword[not] keyword[in] identifier[r... | def _check_yaml_and_paths(ymlfilepath, yamldefs):
""" Checks YAML for errors and resolves all paths
"""
relpath = os.path.relpath(ymlfilepath)
if '/' not in relpath:
relpath = './%s' % relpath # depends on [control=['if'], data=['relpath']]
pathroot = os.path.abspath(os.path.dirname(yml... |
def find(self, value):
"""
returns a dictionary of items based on the a lowercase search
args:
value: the value to search by
"""
value = str(value).lower()
rtn_dict = RegistryDictionary()
for key, item in self.items():
if value in key.lowe... | def function[find, parameter[self, value]]:
constant[
returns a dictionary of items based on the a lowercase search
args:
value: the value to search by
]
variable[value] assign[=] call[call[name[str], parameter[name[value]]].lower, parameter[]]
variable[rtn_d... | keyword[def] identifier[find] ( identifier[self] , identifier[value] ):
literal[string]
identifier[value] = identifier[str] ( identifier[value] ). identifier[lower] ()
identifier[rtn_dict] = identifier[RegistryDictionary] ()
keyword[for] identifier[key] , identifier[item] keywor... | def find(self, value):
"""
returns a dictionary of items based on the a lowercase search
args:
value: the value to search by
"""
value = str(value).lower()
rtn_dict = RegistryDictionary()
for (key, item) in self.items():
if value in key.lower():
r... |
async def update_read_timestamp(self, read_timestamp=None):
"""Update the timestamp of the latest event which has been read.
This method will avoid making an API request if it will have no effect.
Args:
read_timestamp (datetime.datetime): (optional) Timestamp to set.
... | <ast.AsyncFunctionDef object at 0x7da20e74bca0> | keyword[async] keyword[def] identifier[update_read_timestamp] ( identifier[self] , identifier[read_timestamp] = keyword[None] ):
literal[string]
keyword[if] identifier[read_timestamp] keyword[is] keyword[None] :
identifier[read_timestamp] =( identifier[self] . identifier[events] [-... | async def update_read_timestamp(self, read_timestamp=None):
"""Update the timestamp of the latest event which has been read.
This method will avoid making an API request if it will have no effect.
Args:
read_timestamp (datetime.datetime): (optional) Timestamp to set.
De... |
def wait_for_server(host, port, cancel_event=None):
"""
Blocks until a local server is listening on the specified
host and port. Set cancel_event to cancel the wait.
This is intended to be used in conjunction with running
the Flask server.
"""
while not is_server_running(host, port):
... | def function[wait_for_server, parameter[host, port, cancel_event]]:
constant[
Blocks until a local server is listening on the specified
host and port. Set cancel_event to cancel the wait.
This is intended to be used in conjunction with running
the Flask server.
]
while <ast.UnaryOp ... | keyword[def] identifier[wait_for_server] ( identifier[host] , identifier[port] , identifier[cancel_event] = keyword[None] ):
literal[string]
keyword[while] keyword[not] identifier[is_server_running] ( identifier[host] , identifier[port] ):
keyword[if] identifier[cancel_event] keyword[and]... | def wait_for_server(host, port, cancel_event=None):
"""
Blocks until a local server is listening on the specified
host and port. Set cancel_event to cancel the wait.
This is intended to be used in conjunction with running
the Flask server.
"""
while not is_server_running(host, port):
... |
def stats_observer(population, num_generations, num_evaluations, args):
"""Print the statistics of the evolutionary computation to the screen.
This function displays the statistics of the evolutionary computation
to the screen. The output includes the generation number, the current
number of evalua... | def function[stats_observer, parameter[population, num_generations, num_evaluations, args]]:
constant[Print the statistics of the evolutionary computation to the screen.
This function displays the statistics of the evolutionary computation
to the screen. The output includes the generation number, t... | keyword[def] identifier[stats_observer] ( identifier[population] , identifier[num_generations] , identifier[num_evaluations] , identifier[args] ):
literal[string]
identifier[stats] = identifier[inspyred] . identifier[ec] . identifier[analysis] . identifier[fitness_statistics] ( identifier[population] )
... | def stats_observer(population, num_generations, num_evaluations, args):
"""Print the statistics of the evolutionary computation to the screen.
This function displays the statistics of the evolutionary computation
to the screen. The output includes the generation number, the current
number of evalua... |
def model_argmax(sess, x, predictions, samples, feed=None):
"""
Helper function that computes the current class prediction
:param sess: TF session
:param x: the input placeholder
:param predictions: the model's symbolic output
:param samples: numpy array with input samples (dims must match x)
:param feed:... | def function[model_argmax, parameter[sess, x, predictions, samples, feed]]:
constant[
Helper function that computes the current class prediction
:param sess: TF session
:param x: the input placeholder
:param predictions: the model's symbolic output
:param samples: numpy array with input samples (dims ... | keyword[def] identifier[model_argmax] ( identifier[sess] , identifier[x] , identifier[predictions] , identifier[samples] , identifier[feed] = keyword[None] ):
literal[string]
identifier[feed_dict] ={ identifier[x] : identifier[samples] }
keyword[if] identifier[feed] keyword[is] keyword[not] keyword[None... | def model_argmax(sess, x, predictions, samples, feed=None):
"""
Helper function that computes the current class prediction
:param sess: TF session
:param x: the input placeholder
:param predictions: the model's symbolic output
:param samples: numpy array with input samples (dims must match x)
:param fee... |
def improvise(oracle, seq_len, k=1, LRS=0, weight=None, continuity=1):
""" Given an oracle and length, generate an improvised sequence of the given length.
:param oracle: an indexed vmo object
:param seq_len: the length of the returned improvisation sequence
:param k: the starting improvisation time st... | def function[improvise, parameter[oracle, seq_len, k, LRS, weight, continuity]]:
constant[ Given an oracle and length, generate an improvised sequence of the given length.
:param oracle: an indexed vmo object
:param seq_len: the length of the returned improvisation sequence
:param k: the starting i... | keyword[def] identifier[improvise] ( identifier[oracle] , identifier[seq_len] , identifier[k] = literal[int] , identifier[LRS] = literal[int] , identifier[weight] = keyword[None] , identifier[continuity] = literal[int] ):
literal[string]
identifier[s] =[]
keyword[if] identifier[k] + identifier[conti... | def improvise(oracle, seq_len, k=1, LRS=0, weight=None, continuity=1):
""" Given an oracle and length, generate an improvised sequence of the given length.
:param oracle: an indexed vmo object
:param seq_len: the length of the returned improvisation sequence
:param k: the starting improvisation time st... |
def __field_to_subfields(self, field):
"""Fully describes data represented by field, including the nested case.
In the case that the field is not a message field, we have no fields nested
within a message definition, so we can simply return that field. However, in
the nested case, we can't simply descr... | def function[__field_to_subfields, parameter[self, field]]:
constant[Fully describes data represented by field, including the nested case.
In the case that the field is not a message field, we have no fields nested
within a message definition, so we can simply return that field. However, in
the nes... | keyword[def] identifier[__field_to_subfields] ( identifier[self] , identifier[field] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[field] , identifier[messages] . identifier[MessageField] ):
keyword[return] [[ identifier[field] ]]
identifier[result] =[]... | def __field_to_subfields(self, field):
"""Fully describes data represented by field, including the nested case.
In the case that the field is not a message field, we have no fields nested
within a message definition, so we can simply return that field. However, in
the nested case, we can't simply descr... |
def contract_creation_exceptions():
"""Special migration for the blueprint to support Keystone V3.
We drop all tenant_id columns and create project_id columns instead.
"""
return {
sa.Column: ['.'.join([table, 'project_id']) for table in get_tables()],
sa.Index: get_tables()
} | def function[contract_creation_exceptions, parameter[]]:
constant[Special migration for the blueprint to support Keystone V3.
We drop all tenant_id columns and create project_id columns instead.
]
return[dictionary[[<ast.Attribute object at 0x7da1b1b14a00>, <ast.Attribute object at 0x7da1b1b16d10>],... | keyword[def] identifier[contract_creation_exceptions] ():
literal[string]
keyword[return] {
identifier[sa] . identifier[Column] :[ literal[string] . identifier[join] ([ identifier[table] , literal[string] ]) keyword[for] identifier[table] keyword[in] identifier[get_tables] ()],
identifier[sa] ... | def contract_creation_exceptions():
"""Special migration for the blueprint to support Keystone V3.
We drop all tenant_id columns and create project_id columns instead.
"""
return {sa.Column: ['.'.join([table, 'project_id']) for table in get_tables()], sa.Index: get_tables()} |
def host_info(host=None):
'''
Return information about the host connected to this master
'''
data = query(host, quiet=True)
for id_ in data:
if 'vm_info' in data[id_]:
data[id_].pop('vm_info')
__jid_event__.fire_event({'data': data, 'outputter': 'nested'}, 'progress')
ret... | def function[host_info, parameter[host]]:
constant[
Return information about the host connected to this master
]
variable[data] assign[=] call[name[query], parameter[name[host]]]
for taget[name[id_]] in starred[name[data]] begin[:]
if compare[constant[vm_info] in call[nam... | keyword[def] identifier[host_info] ( identifier[host] = keyword[None] ):
literal[string]
identifier[data] = identifier[query] ( identifier[host] , identifier[quiet] = keyword[True] )
keyword[for] identifier[id_] keyword[in] identifier[data] :
keyword[if] literal[string] keyword[in] iden... | def host_info(host=None):
"""
Return information about the host connected to this master
"""
data = query(host, quiet=True)
for id_ in data:
if 'vm_info' in data[id_]:
data[id_].pop('vm_info') # depends on [control=['if'], data=[]] # depends on [control=['for'], data=['id_']]
... |
def fermat_potential(self, x_image, y_image, x_source, y_source, kwargs_lens, k=None):
"""
fermat potential (negative sign means earlier arrival time)
:param x_image: image position
:param y_image: image position
:param x_source: source position
:param y_source: source p... | def function[fermat_potential, parameter[self, x_image, y_image, x_source, y_source, kwargs_lens, k]]:
constant[
fermat potential (negative sign means earlier arrival time)
:param x_image: image position
:param y_image: image position
:param x_source: source position
:pa... | keyword[def] identifier[fermat_potential] ( identifier[self] , identifier[x_image] , identifier[y_image] , identifier[x_source] , identifier[y_source] , identifier[kwargs_lens] , identifier[k] = keyword[None] ):
literal[string]
identifier[potential] = identifier[self] . identifier[potential] ( ide... | def fermat_potential(self, x_image, y_image, x_source, y_source, kwargs_lens, k=None):
"""
fermat potential (negative sign means earlier arrival time)
:param x_image: image position
:param y_image: image position
:param x_source: source position
:param y_source: source posit... |
def drawWeibull(N, scale=1.0, shape=1.0, seed=0):
'''
Generate arrays of Weibull draws. The scale and shape inputs can be
numbers or list-likes. If a number, output is a length N array of draws from
the Weibull distribution with the given scale and shape. If a list, output
is a length T list whos... | def function[drawWeibull, parameter[N, scale, shape, seed]]:
constant[
Generate arrays of Weibull draws. The scale and shape inputs can be
numbers or list-likes. If a number, output is a length N array of draws from
the Weibull distribution with the given scale and shape. If a list, output
is ... | keyword[def] identifier[drawWeibull] ( identifier[N] , identifier[scale] = literal[int] , identifier[shape] = literal[int] , identifier[seed] = literal[int] ):
literal[string]
identifier[RNG] = identifier[np] . identifier[random] . identifier[RandomState] ( identifier[seed] )
keyword[if] identi... | def drawWeibull(N, scale=1.0, shape=1.0, seed=0):
"""
Generate arrays of Weibull draws. The scale and shape inputs can be
numbers or list-likes. If a number, output is a length N array of draws from
the Weibull distribution with the given scale and shape. If a list, output
is a length T list whose... |
def _check_and_update_params(self, required, params):
"""
Ensure all required parameters were passed to the API call and format
them correctly.
"""
for r in required:
if r not in params:
raise PayPalError("Missing required param: %s" % r)
# Up... | def function[_check_and_update_params, parameter[self, required, params]]:
constant[
Ensure all required parameters were passed to the API call and format
them correctly.
]
for taget[name[r]] in starred[name[required]] begin[:]
if compare[name[r] <ast.NotIn object... | keyword[def] identifier[_check_and_update_params] ( identifier[self] , identifier[required] , identifier[params] ):
literal[string]
keyword[for] identifier[r] keyword[in] identifier[required] :
keyword[if] identifier[r] keyword[not] keyword[in] identifier[params] :
... | def _check_and_update_params(self, required, params):
"""
Ensure all required parameters were passed to the API call and format
them correctly.
"""
for r in required:
if r not in params:
raise PayPalError('Missing required param: %s' % r) # depends on [control=['if']... |
def _init_kws(self, **kws_usr):
"""Return a dict containing user-specified plotting options."""
kws_self = {}
user_keys = set(kws_usr)
for objname, expset in self.exp_keys.items():
usrkeys_curr = user_keys.intersection(expset)
kws_self[objname] = get_kwargs(kws_us... | def function[_init_kws, parameter[self]]:
constant[Return a dict containing user-specified plotting options.]
variable[kws_self] assign[=] dictionary[[], []]
variable[user_keys] assign[=] call[name[set], parameter[name[kws_usr]]]
for taget[tuple[[<ast.Name object at 0x7da18f812d40>, <ast... | keyword[def] identifier[_init_kws] ( identifier[self] ,** identifier[kws_usr] ):
literal[string]
identifier[kws_self] ={}
identifier[user_keys] = identifier[set] ( identifier[kws_usr] )
keyword[for] identifier[objname] , identifier[expset] keyword[in] identifier[self] . identif... | def _init_kws(self, **kws_usr):
"""Return a dict containing user-specified plotting options."""
kws_self = {}
user_keys = set(kws_usr)
for (objname, expset) in self.exp_keys.items():
usrkeys_curr = user_keys.intersection(expset)
kws_self[objname] = get_kwargs(kws_usr, usrkeys_curr, usrke... |
def template(page=None, layout=None, **kwargs):
"""
Decorator to change the view template and layout.
It works on both View class and view methods
on class
only $layout is applied, everything else will be passed to the kwargs
Using as first argument, it will be the layout.
:fi... | def function[template, parameter[page, layout]]:
constant[
Decorator to change the view template and layout.
It works on both View class and view methods
on class
only $layout is applied, everything else will be passed to the kwargs
Using as first argument, it will be the layout.
... | keyword[def] identifier[template] ( identifier[page] = keyword[None] , identifier[layout] = keyword[None] ,** identifier[kwargs] ):
literal[string]
identifier[pkey] = literal[string]
keyword[def] identifier[decorator] ( identifier[f] ):
keyword[if] identifier[inspect] . identifier[isclass... | def template(page=None, layout=None, **kwargs):
"""
Decorator to change the view template and layout.
It works on both View class and view methods
on class
only $layout is applied, everything else will be passed to the kwargs
Using as first argument, it will be the layout.
:fi... |
def function_completions(
completion_text: str,
bel_spec: BELSpec,
function_list: list,
bel_fmt: str,
size: int,
) -> list:
"""Filter BEL functions by prefix
Args:
prefix: completion string
bel_fmt: short, medium, long BEL formats
spec: BEL specification
Returns... | def function[function_completions, parameter[completion_text, bel_spec, function_list, bel_fmt, size]]:
constant[Filter BEL functions by prefix
Args:
prefix: completion string
bel_fmt: short, medium, long BEL formats
spec: BEL specification
Returns:
list: list of BEL fu... | keyword[def] identifier[function_completions] (
identifier[completion_text] : identifier[str] ,
identifier[bel_spec] : identifier[BELSpec] ,
identifier[function_list] : identifier[list] ,
identifier[bel_fmt] : identifier[str] ,
identifier[size] : identifier[int] ,
)-> identifier[list] :
literal[string]
... | def function_completions(completion_text: str, bel_spec: BELSpec, function_list: list, bel_fmt: str, size: int) -> list:
"""Filter BEL functions by prefix
Args:
prefix: completion string
bel_fmt: short, medium, long BEL formats
spec: BEL specification
Returns:
list: list of... |
def display_files(self, pcs_files):
'''重新格式化一下文件列表, 去除不需要的信息
这一操作主要是为了便于接下来的查找工作.
文件的path都被提取出来, 然后放到了一个list中.
'''
tree_iters = []
for pcs_file in pcs_files:
path = pcs_file['path']
pixbuf, type_ = self.app.mime.get(path, pcs_file['isdir'],
... | def function[display_files, parameter[self, pcs_files]]:
constant[重新格式化一下文件列表, 去除不需要的信息
这一操作主要是为了便于接下来的查找工作.
文件的path都被提取出来, 然后放到了一个list中.
]
variable[tree_iters] assign[=] list[[]]
for taget[name[pcs_file]] in starred[name[pcs_files]] begin[:]
variable[pat... | keyword[def] identifier[display_files] ( identifier[self] , identifier[pcs_files] ):
literal[string]
identifier[tree_iters] =[]
keyword[for] identifier[pcs_file] keyword[in] identifier[pcs_files] :
identifier[path] = identifier[pcs_file] [ literal[string] ]
ide... | def display_files(self, pcs_files):
"""重新格式化一下文件列表, 去除不需要的信息
这一操作主要是为了便于接下来的查找工作.
文件的path都被提取出来, 然后放到了一个list中.
"""
tree_iters = []
for pcs_file in pcs_files:
path = pcs_file['path']
(pixbuf, type_) = self.app.mime.get(path, pcs_file['isdir'], icon_size=self.ICON_SIZE... |
def rpc_get_name_DID(self, name, **con_info):
"""
Given a name or subdomain, return its DID.
"""
did_info = None
if check_name(name):
did_info = self.get_name_DID_info(name)
elif check_subdomain(name):
did_info = self.get_subdomain_DID_info(name)
... | def function[rpc_get_name_DID, parameter[self, name]]:
constant[
Given a name or subdomain, return its DID.
]
variable[did_info] assign[=] constant[None]
if call[name[check_name], parameter[name[name]]] begin[:]
variable[did_info] assign[=] call[name[self].get_nam... | keyword[def] identifier[rpc_get_name_DID] ( identifier[self] , identifier[name] ,** identifier[con_info] ):
literal[string]
identifier[did_info] = keyword[None]
keyword[if] identifier[check_name] ( identifier[name] ):
identifier[did_info] = identifier[self] . identifier[get_... | def rpc_get_name_DID(self, name, **con_info):
"""
Given a name or subdomain, return its DID.
"""
did_info = None
if check_name(name):
did_info = self.get_name_DID_info(name) # depends on [control=['if'], data=[]]
elif check_subdomain(name):
did_info = self.get_subdomain_... |
def load_config(self, path='', in_candidate=False, empty_candidate=False, config_text=None):
"""
This method will load a block of config represented as a :py:class:`FortiConfig` object in the running
config, in the candidate config or in both.
Args:
* **path** (str) -- This ... | def function[load_config, parameter[self, path, in_candidate, empty_candidate, config_text]]:
constant[
This method will load a block of config represented as a :py:class:`FortiConfig` object in the running
config, in the candidate config or in both.
Args:
* **path** (str) -... | keyword[def] identifier[load_config] ( identifier[self] , identifier[path] = literal[string] , identifier[in_candidate] = keyword[False] , identifier[empty_candidate] = keyword[False] , identifier[config_text] = keyword[None] ):
literal[string]
identifier[logger] . identifier[info] ( literal[string... | def load_config(self, path='', in_candidate=False, empty_candidate=False, config_text=None):
"""
This method will load a block of config represented as a :py:class:`FortiConfig` object in the running
config, in the candidate config or in both.
Args:
* **path** (str) -- This is t... |
def open(self):
'''Initialises connection to q service.
If the connection hasn't been initialised yet, invoking the
:func:`.open` creates a new socket and performs a handshake with a q
service.
:raises: :class:`.QConnectionException`, :class:`.QAuthenticationE... | def function[open, parameter[self]]:
constant[Initialises connection to q service.
If the connection hasn't been initialised yet, invoking the
:func:`.open` creates a new socket and performs a handshake with a q
service.
:raises: :class:`.QConnectionException`... | keyword[def] identifier[open] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_connection] :
keyword[if] keyword[not] identifier[self] . identifier[host] :
keyword[raise] identifier[QConnectionException] ( literal[strin... | def open(self):
"""Initialises connection to q service.
If the connection hasn't been initialised yet, invoking the
:func:`.open` creates a new socket and performs a handshake with a q
service.
:raises: :class:`.QConnectionException`, :class:`.QAuthenticationExcep... |
def run_loop(leds=all_leds):
"""
Start the loop.
:param `leds`: Which LEDs to light up upon switch press.
:type `leds`: sequence of LED objects
"""
print('Loop started.\nPress Ctrl+C to break out of the loop.')
while 1:
try:
if switch():
[led.on() for led... | def function[run_loop, parameter[leds]]:
constant[
Start the loop.
:param `leds`: Which LEDs to light up upon switch press.
:type `leds`: sequence of LED objects
]
call[name[print], parameter[constant[Loop started.
Press Ctrl+C to break out of the loop.]]]
while constant[1] begi... | keyword[def] identifier[run_loop] ( identifier[leds] = identifier[all_leds] ):
literal[string]
identifier[print] ( literal[string] )
keyword[while] literal[int] :
keyword[try] :
keyword[if] identifier[switch] ():
[ identifier[led] . identifier[on] () keyword[for... | def run_loop(leds=all_leds):
"""
Start the loop.
:param `leds`: Which LEDs to light up upon switch press.
:type `leds`: sequence of LED objects
"""
print('Loop started.\nPress Ctrl+C to break out of the loop.')
while 1:
try:
if switch():
[led.on() for led... |
def process_backup_instance_faulty_msg(self,
backup_faulty: BackupInstanceFaulty,
frm: str) -> None:
'''
The method for processing BackupInstanceFaulty from nodes
and removing replicas with performance were deg... | def function[process_backup_instance_faulty_msg, parameter[self, backup_faulty, frm]]:
constant[
The method for processing BackupInstanceFaulty from nodes
and removing replicas with performance were degraded
:param backup_faulty: BackupInstanceFaulty message with instances for removing
... | keyword[def] identifier[process_backup_instance_faulty_msg] ( identifier[self] ,
identifier[backup_faulty] : identifier[BackupInstanceFaulty] ,
identifier[frm] : identifier[str] )-> keyword[None] :
literal[string]
identifier[logger] . identifier[debug] ( literal[string]
literal[string] ... | def process_backup_instance_faulty_msg(self, backup_faulty: BackupInstanceFaulty, frm: str) -> None:
"""
The method for processing BackupInstanceFaulty from nodes
and removing replicas with performance were degraded
:param backup_faulty: BackupInstanceFaulty message with instances for removi... |
def load_SUEWS_Forcing_met_df_pattern(path_input, forcingfile_met_pattern):
"""Short summary.
Parameters
----------
forcingfile_met_pattern : type
Description of parameter `forcingfile_met_pattern`.
Returns
-------
type
Description of returned object.
"""
# list o... | def function[load_SUEWS_Forcing_met_df_pattern, parameter[path_input, forcingfile_met_pattern]]:
constant[Short summary.
Parameters
----------
forcingfile_met_pattern : type
Description of parameter `forcingfile_met_pattern`.
Returns
-------
type
Description of returned... | keyword[def] identifier[load_SUEWS_Forcing_met_df_pattern] ( identifier[path_input] , identifier[forcingfile_met_pattern] ):
literal[string]
identifier[path_input] = identifier[path_input] . identifier[resolve] ()
identifier[list_file_MetForcing] = identifier[sorted] ([
identifier[f] ... | def load_SUEWS_Forcing_met_df_pattern(path_input, forcingfile_met_pattern):
"""Short summary.
Parameters
----------
forcingfile_met_pattern : type
Description of parameter `forcingfile_met_pattern`.
Returns
-------
type
Description of returned object.
"""
# list of... |
def _get_coordinates_for_dataset_keys(self, dsids):
"""Get all coordinates."""
coordinates = {}
for dsid in dsids:
cids = self._get_coordinates_for_dataset_key(dsid)
coordinates.setdefault(dsid, []).extend(cids)
return coordinates | def function[_get_coordinates_for_dataset_keys, parameter[self, dsids]]:
constant[Get all coordinates.]
variable[coordinates] assign[=] dictionary[[], []]
for taget[name[dsid]] in starred[name[dsids]] begin[:]
variable[cids] assign[=] call[name[self]._get_coordinates_for_dataset_... | keyword[def] identifier[_get_coordinates_for_dataset_keys] ( identifier[self] , identifier[dsids] ):
literal[string]
identifier[coordinates] ={}
keyword[for] identifier[dsid] keyword[in] identifier[dsids] :
identifier[cids] = identifier[self] . identifier[_get_coordinates_f... | def _get_coordinates_for_dataset_keys(self, dsids):
"""Get all coordinates."""
coordinates = {}
for dsid in dsids:
cids = self._get_coordinates_for_dataset_key(dsid)
coordinates.setdefault(dsid, []).extend(cids) # depends on [control=['for'], data=['dsid']]
return coordinates |
def connect(self, **kwargs):
"""
Connect to the Redis Server
:param kwargs: Parameters passed directly to redis library
:return: Boolean indicating if connection successful
:kwarg host: Hostname of the Redis server
:kwarg port: Port of the Redis server
:kwarg pa... | def function[connect, parameter[self]]:
constant[
Connect to the Redis Server
:param kwargs: Parameters passed directly to redis library
:return: Boolean indicating if connection successful
:kwarg host: Hostname of the Redis server
:kwarg port: Port of the Redis server
... | keyword[def] identifier[connect] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[self] . identifier[__db] = identifier[redis] . identifier[Redis] (** identifier[kwargs] )
keyword[try] :
identifier[self] . identifier[__db] . identifier[info] ()
... | def connect(self, **kwargs):
"""
Connect to the Redis Server
:param kwargs: Parameters passed directly to redis library
:return: Boolean indicating if connection successful
:kwarg host: Hostname of the Redis server
:kwarg port: Port of the Redis server
:kwarg passwo... |
def xypix_to_ipix(self, xypix, colwise=False):
"""Return the flattened pixel indices from an array multi-dimensional
pixel indices.
Parameters
----------
xypix : list
List of pixel indices in the order (LON,LAT,ENERGY).
colwise : bool
Use column-... | def function[xypix_to_ipix, parameter[self, xypix, colwise]]:
constant[Return the flattened pixel indices from an array multi-dimensional
pixel indices.
Parameters
----------
xypix : list
List of pixel indices in the order (LON,LAT,ENERGY).
colwise : bool
... | keyword[def] identifier[xypix_to_ipix] ( identifier[self] , identifier[xypix] , identifier[colwise] = keyword[False] ):
literal[string]
keyword[return] identifier[np] . identifier[ravel_multi_index] ( identifier[xypix] , identifier[self] . identifier[npix] ,
identifier[order] = literal[st... | def xypix_to_ipix(self, xypix, colwise=False):
"""Return the flattened pixel indices from an array multi-dimensional
pixel indices.
Parameters
----------
xypix : list
List of pixel indices in the order (LON,LAT,ENERGY).
colwise : bool
Use column-wise... |
def unpack_numeric(self, data, cimtype):
"""
Unpack a string value of a numeric CIM type and return its CIM data
type object, or None.
data (unicode string): CIM-XML string value, or None (in which case
None is returned).
cimtype (string): CIM data type name (e.g. 'ui... | def function[unpack_numeric, parameter[self, data, cimtype]]:
constant[
Unpack a string value of a numeric CIM type and return its CIM data
type object, or None.
data (unicode string): CIM-XML string value, or None (in which case
None is returned).
cimtype (string): C... | keyword[def] identifier[unpack_numeric] ( identifier[self] , identifier[data] , identifier[cimtype] ):
literal[string]
keyword[if] identifier[data] keyword[is] keyword[None] :
keyword[return] keyword[None]
identifier[data] = identifier[data] . identifier[st... | def unpack_numeric(self, data, cimtype):
"""
Unpack a string value of a numeric CIM type and return its CIM data
type object, or None.
data (unicode string): CIM-XML string value, or None (in which case
None is returned).
cimtype (string): CIM data type name (e.g. 'uint8'... |
def tapered_gutenberg_richter_pdf(moment, moment_threshold, beta,
corner_moment):
'''
Tapered Gutenberg-Richter Probability Density Function
:param float or numpy.ndarray moment:
Moment for calculation of rate
:param float or numpy.ndarray moment_threshold:
... | def function[tapered_gutenberg_richter_pdf, parameter[moment, moment_threshold, beta, corner_moment]]:
constant[
Tapered Gutenberg-Richter Probability Density Function
:param float or numpy.ndarray moment:
Moment for calculation of rate
:param float or numpy.ndarray moment_threshold:
... | keyword[def] identifier[tapered_gutenberg_richter_pdf] ( identifier[moment] , identifier[moment_threshold] , identifier[beta] ,
identifier[corner_moment] ):
literal[string]
keyword[return] (( identifier[beta] / identifier[moment] + literal[int] / identifier[corner_moment] )*
identifier[tapered_gutenb... | def tapered_gutenberg_richter_pdf(moment, moment_threshold, beta, corner_moment):
"""
Tapered Gutenberg-Richter Probability Density Function
:param float or numpy.ndarray moment:
Moment for calculation of rate
:param float or numpy.ndarray moment_threshold:
Threshold Moment of the dist... |
def ui_search_image(self, value):
"""
Setter for **self.__ui_search_image** attribute.
:param value: Attribute value.
:type value: unicode
"""
if value is not None:
assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format(
... | def function[ui_search_image, parameter[self, value]]:
constant[
Setter for **self.__ui_search_image** attribute.
:param value: Attribute value.
:type value: unicode
]
if compare[name[value] is_not constant[None]] begin[:]
assert[compare[call[name[type], paramete... | keyword[def] identifier[ui_search_image] ( identifier[self] , identifier[value] ):
literal[string]
keyword[if] identifier[value] keyword[is] keyword[not] keyword[None] :
keyword[assert] identifier[type] ( identifier[value] ) keyword[is] identifier[unicode] , literal[string] . id... | def ui_search_image(self, value):
"""
Setter for **self.__ui_search_image** attribute.
:param value: Attribute value.
:type value: unicode
"""
if value is not None:
assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format('ui_search_image', v... |
def _iter_cache(cachefile, gpstype=LIGOTimeGPS):
"""Internal method that yields a `_CacheEntry` for each line in the file
This method supports reading LAL- and (nested) FFL-format cache files.
"""
try:
path = os.path.abspath(cachefile.name)
except AttributeError:
path = None
for... | def function[_iter_cache, parameter[cachefile, gpstype]]:
constant[Internal method that yields a `_CacheEntry` for each line in the file
This method supports reading LAL- and (nested) FFL-format cache files.
]
<ast.Try object at 0x7da1b06082e0>
for taget[name[line]] in starred[name[cachefil... | keyword[def] identifier[_iter_cache] ( identifier[cachefile] , identifier[gpstype] = identifier[LIGOTimeGPS] ):
literal[string]
keyword[try] :
identifier[path] = identifier[os] . identifier[path] . identifier[abspath] ( identifier[cachefile] . identifier[name] )
keyword[except] identifier[At... | def _iter_cache(cachefile, gpstype=LIGOTimeGPS):
"""Internal method that yields a `_CacheEntry` for each line in the file
This method supports reading LAL- and (nested) FFL-format cache files.
"""
try:
path = os.path.abspath(cachefile.name) # depends on [control=['try'], data=[]]
except At... |
def connect(
self, login, password, authz_id=b"", starttls=False,
authmech=None):
"""Establish a connection with the server.
This function must be used. It read the server capabilities
and wraps calls to STARTTLS and AUTHENTICATE commands.
:param login: username... | def function[connect, parameter[self, login, password, authz_id, starttls, authmech]]:
constant[Establish a connection with the server.
This function must be used. It read the server capabilities
and wraps calls to STARTTLS and AUTHENTICATE commands.
:param login: username
:par... | keyword[def] identifier[connect] (
identifier[self] , identifier[login] , identifier[password] , identifier[authz_id] = literal[string] , identifier[starttls] = keyword[False] ,
identifier[authmech] = keyword[None] ):
literal[string]
keyword[try] :
identifier[self] . identifier[sock]... | def connect(self, login, password, authz_id=b'', starttls=False, authmech=None):
"""Establish a connection with the server.
This function must be used. It read the server capabilities
and wraps calls to STARTTLS and AUTHENTICATE commands.
:param login: username
:param password: cle... |
def close(self):
"""
Just send a message off to all the pool members which contains
the special :class:`_close_pool_message` sentinel.
"""
if self.is_master():
for i in range(self.size):
self.comm.isend(_close_pool_message(), dest=i + 1) | def function[close, parameter[self]]:
constant[
Just send a message off to all the pool members which contains
the special :class:`_close_pool_message` sentinel.
]
if call[name[self].is_master, parameter[]] begin[:]
for taget[name[i]] in starred[call[name[range],... | keyword[def] identifier[close] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[is_master] ():
keyword[for] identifier[i] keyword[in] identifier[range] ( identifier[self] . identifier[size] ):
identifier[self] . identifier[comm] . ide... | def close(self):
"""
Just send a message off to all the pool members which contains
the special :class:`_close_pool_message` sentinel.
"""
if self.is_master():
for i in range(self.size):
self.comm.isend(_close_pool_message(), dest=i + 1) # depends on [control=['for'... |
def insert(self):
"""persist the .fields"""
self.default_val = 0
#fields = self.fields
#fields = self.orm_class.depart(self.fields, is_update=False)
#self.set_fields(fields)
return self.interface.insert(
self.schema,
self.fields
)
... | def function[insert, parameter[self]]:
constant[persist the .fields]
name[self].default_val assign[=] constant[0]
return[call[name[self].interface.insert, parameter[name[self].schema, name[self].fields]]]
return[call[name[self].interface.insert, parameter[name[self].schema, name[self].fields]]] | keyword[def] identifier[insert] ( identifier[self] ):
literal[string]
identifier[self] . identifier[default_val] = literal[int]
keyword[return] identifier[self] . identifier[interface] . identifier[insert] (
identifier[self] . identifier[schema] ,
... | def insert(self):
"""persist the .fields"""
self.default_val = 0
#fields = self.fields
#fields = self.orm_class.depart(self.fields, is_update=False)
#self.set_fields(fields)
return self.interface.insert(self.schema, self.fields)
return self.interface.insert(self.schema, self.fields) |
def addLNT(LocalName, phenoId, predicate, g=None): # XXX deprecated
""" Add a local name for a phenotype from a pair of identifiers """
if g is None:
s = inspect.stack(0) # horribly inefficient
checkCalledInside('LocalNameManager', s)
g = s[1][0].f_locals # get globals of calling scop... | def function[addLNT, parameter[LocalName, phenoId, predicate, g]]:
constant[ Add a local name for a phenotype from a pair of identifiers ]
if compare[name[g] is constant[None]] begin[:]
variable[s] assign[=] call[name[inspect].stack, parameter[constant[0]]]
call[name[chec... | keyword[def] identifier[addLNT] ( identifier[LocalName] , identifier[phenoId] , identifier[predicate] , identifier[g] = keyword[None] ):
literal[string]
keyword[if] identifier[g] keyword[is] keyword[None] :
identifier[s] = identifier[inspect] . identifier[stack] ( literal[int] )
identi... | def addLNT(LocalName, phenoId, predicate, g=None): # XXX deprecated
' Add a local name for a phenotype from a pair of identifiers '
if g is None:
s = inspect.stack(0) # horribly inefficient
checkCalledInside('LocalNameManager', s)
g = s[1][0].f_locals # get globals of calling scope #... |
def bands(self, telescope):
"""Return a list of bands associated with the specified telescope."""
q = self._seen_bands.get(telescope)
if q is None:
return []
return list(q) | def function[bands, parameter[self, telescope]]:
constant[Return a list of bands associated with the specified telescope.]
variable[q] assign[=] call[name[self]._seen_bands.get, parameter[name[telescope]]]
if compare[name[q] is constant[None]] begin[:]
return[list[[]]]
return[call[na... | keyword[def] identifier[bands] ( identifier[self] , identifier[telescope] ):
literal[string]
identifier[q] = identifier[self] . identifier[_seen_bands] . identifier[get] ( identifier[telescope] )
keyword[if] identifier[q] keyword[is] keyword[None] :
keyword[return] []
... | def bands(self, telescope):
"""Return a list of bands associated with the specified telescope."""
q = self._seen_bands.get(telescope)
if q is None:
return [] # depends on [control=['if'], data=[]]
return list(q) |
def add_team_repo(repo_name, team_name, profile="github", permission=None):
'''
Adds a repository to a team with team_name.
repo_name
The name of the repository to add.
team_name
The name of the team of which to add the repository.
profile
The name of the profile configura... | def function[add_team_repo, parameter[repo_name, team_name, profile, permission]]:
constant[
Adds a repository to a team with team_name.
repo_name
The name of the repository to add.
team_name
The name of the team of which to add the repository.
profile
The name of the ... | keyword[def] identifier[add_team_repo] ( identifier[repo_name] , identifier[team_name] , identifier[profile] = literal[string] , identifier[permission] = keyword[None] ):
literal[string]
identifier[team] = identifier[get_team] ( identifier[team_name] , identifier[profile] = identifier[profile] )
keywo... | def add_team_repo(repo_name, team_name, profile='github', permission=None):
"""
Adds a repository to a team with team_name.
repo_name
The name of the repository to add.
team_name
The name of the team of which to add the repository.
profile
The name of the profile configura... |
def find_by_id(self, repoid):
"""
Returns the repo with the specified <repoid>
"""
for row in self.jsondata:
if repoid == row["repoid"]:
return self._infofromdict(row) | def function[find_by_id, parameter[self, repoid]]:
constant[
Returns the repo with the specified <repoid>
]
for taget[name[row]] in starred[name[self].jsondata] begin[:]
if compare[name[repoid] equal[==] call[name[row]][constant[repoid]]] begin[:]
return[call[... | keyword[def] identifier[find_by_id] ( identifier[self] , identifier[repoid] ):
literal[string]
keyword[for] identifier[row] keyword[in] identifier[self] . identifier[jsondata] :
keyword[if] identifier[repoid] == identifier[row] [ literal[string] ]:
keyword[return] ... | def find_by_id(self, repoid):
"""
Returns the repo with the specified <repoid>
"""
for row in self.jsondata:
if repoid == row['repoid']:
return self._infofromdict(row) # depends on [control=['if'], data=[]] # depends on [control=['for'], data=['row']] |
def _self_pipe(self):
"""
This sets up a self-pipe so we can hand back an fd to the caller
allowing the object to manage event triggers. The ends of the pipe are
set non-blocking so it doesn't really matter if a bunch of events fill
the pipe buffer.
"""
import fcntl
... | def function[_self_pipe, parameter[self]]:
constant[
This sets up a self-pipe so we can hand back an fd to the caller
allowing the object to manage event triggers. The ends of the pipe are
set non-blocking so it doesn't really matter if a bunch of events fill
the pipe buffer.
... | keyword[def] identifier[_self_pipe] ( identifier[self] ):
literal[string]
keyword[import] identifier[fcntl]
identifier[self] . identifier[_poll_fd] , identifier[self] . identifier[_poll_send] = identifier[os] . identifier[pipe] ()
keyword[for] identifier[fd] keyword[in] [ ide... | def _self_pipe(self):
"""
This sets up a self-pipe so we can hand back an fd to the caller
allowing the object to manage event triggers. The ends of the pipe are
set non-blocking so it doesn't really matter if a bunch of events fill
the pipe buffer.
"""
import fcntl
(sel... |
def evaluate(self, verbose=False, decode=True, passes=None, num_threads=1, apply_experimental=True):
"""Evaluates by creating a MultiIndex containing evaluated data and index.
See `LazyResult`
Returns
-------
MultiIndex
MultiIndex with evaluated data.
"""
... | def function[evaluate, parameter[self, verbose, decode, passes, num_threads, apply_experimental]]:
constant[Evaluates by creating a MultiIndex containing evaluated data and index.
See `LazyResult`
Returns
-------
MultiIndex
MultiIndex with evaluated data.
]... | keyword[def] identifier[evaluate] ( identifier[self] , identifier[verbose] = keyword[False] , identifier[decode] = keyword[True] , identifier[passes] = keyword[None] , identifier[num_threads] = literal[int] , identifier[apply_experimental] = keyword[True] ):
literal[string]
identifier[evaluated_dat... | def evaluate(self, verbose=False, decode=True, passes=None, num_threads=1, apply_experimental=True):
"""Evaluates by creating a MultiIndex containing evaluated data and index.
See `LazyResult`
Returns
-------
MultiIndex
MultiIndex with evaluated data.
"""
e... |
def timer_expired(self):
"""
This method is invoked in context of the timer thread, so we cannot
directly throw exceptions (we can, but they would be in the wrong
thread), so instead we shut down the socket of the connection.
When the timeout happens in early phases of the connec... | def function[timer_expired, parameter[self]]:
constant[
This method is invoked in context of the timer thread, so we cannot
directly throw exceptions (we can, but they would be in the wrong
thread), so instead we shut down the socket of the connection.
When the timeout happens in... | keyword[def] identifier[timer_expired] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_http_conn] . identifier[sock] keyword[is] keyword[not] keyword[None] :
identifier[self] . identifier[_shutdown] = keyword[True]
identifier[self] . i... | def timer_expired(self):
"""
This method is invoked in context of the timer thread, so we cannot
directly throw exceptions (we can, but they would be in the wrong
thread), so instead we shut down the socket of the connection.
When the timeout happens in early phases of the connection... |
def _construct_surface(lons, lats, upper_depth, lower_depth):
"""
Utility method that constructs and return a simple fault surface with top
edge specified by `lons` and `lats` and extending vertically from
`upper_depth` to `lower_depth`.
The underlying mesh is built by repeating the same coordinate... | def function[_construct_surface, parameter[lons, lats, upper_depth, lower_depth]]:
constant[
Utility method that constructs and return a simple fault surface with top
edge specified by `lons` and `lats` and extending vertically from
`upper_depth` to `lower_depth`.
The underlying mesh is built b... | keyword[def] identifier[_construct_surface] ( identifier[lons] , identifier[lats] , identifier[upper_depth] , identifier[lower_depth] ):
literal[string]
identifier[depths] = identifier[np] . identifier[array] ([
identifier[np] . identifier[zeros_like] ( identifier[lons] )+ identifier[upper_depth] ,
... | def _construct_surface(lons, lats, upper_depth, lower_depth):
"""
Utility method that constructs and return a simple fault surface with top
edge specified by `lons` and `lats` and extending vertically from
`upper_depth` to `lower_depth`.
The underlying mesh is built by repeating the same coordinate... |
def _get_salt_params():
'''
Try to get all sort of parameters for Server Density server info.
NOTE: Missing publicDNS and publicIPs parameters. There might be way of
getting them with salt-cloud.
'''
all_stats = __salt__['status.all_status']()
all_grains = __salt__['grains.items']()
par... | def function[_get_salt_params, parameter[]]:
constant[
Try to get all sort of parameters for Server Density server info.
NOTE: Missing publicDNS and publicIPs parameters. There might be way of
getting them with salt-cloud.
]
variable[all_stats] assign[=] call[call[name[__salt__]][consta... | keyword[def] identifier[_get_salt_params] ():
literal[string]
identifier[all_stats] = identifier[__salt__] [ literal[string] ]()
identifier[all_grains] = identifier[__salt__] [ literal[string] ]()
identifier[params] ={}
keyword[try] :
identifier[params] [ literal[string] ]= identifi... | def _get_salt_params():
"""
Try to get all sort of parameters for Server Density server info.
NOTE: Missing publicDNS and publicIPs parameters. There might be way of
getting them with salt-cloud.
"""
all_stats = __salt__['status.all_status']()
all_grains = __salt__['grains.items']()
par... |
def image_convert(fname,saveAs=True,showToo=False):
"""
Convert weird TIF files into web-friendly versions.
Auto contrast is applied (saturating lower and upper 0.1%).
make saveAs True to save as .TIF.png
make saveAs False and it won't save at all
make saveAs "someFile.jpg" to save i... | def function[image_convert, parameter[fname, saveAs, showToo]]:
constant[
Convert weird TIF files into web-friendly versions.
Auto contrast is applied (saturating lower and upper 0.1%).
make saveAs True to save as .TIF.png
make saveAs False and it won't save at all
make saveAs "s... | keyword[def] identifier[image_convert] ( identifier[fname] , identifier[saveAs] = keyword[True] , identifier[showToo] = keyword[False] ):
literal[string]
identifier[im] = identifier[scipy] . identifier[ndimage] . identifier[imread] ( identifier[fname] )
identifier[im] = identifier[np] . ide... | def image_convert(fname, saveAs=True, showToo=False):
"""
Convert weird TIF files into web-friendly versions.
Auto contrast is applied (saturating lower and upper 0.1%).
make saveAs True to save as .TIF.png
make saveAs False and it won't save at all
make saveAs "someFile.jpg" to save... |
def fillna(self, value, subset=None):
"""Replace null values, alias for ``na.fill()``.
:func:`DataFrame.fillna` and :func:`DataFrameNaFunctions.fill` are aliases of each other.
:param value: int, long, float, string, bool or dict.
Value to replace null values with.
If th... | def function[fillna, parameter[self, value, subset]]:
constant[Replace null values, alias for ``na.fill()``.
:func:`DataFrame.fillna` and :func:`DataFrameNaFunctions.fill` are aliases of each other.
:param value: int, long, float, string, bool or dict.
Value to replace null values w... | keyword[def] identifier[fillna] ( identifier[self] , identifier[value] , identifier[subset] = keyword[None] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[value] ,( identifier[float] , identifier[int] , identifier[long] , identifier[basestring] , identifier[bool] ... | def fillna(self, value, subset=None):
"""Replace null values, alias for ``na.fill()``.
:func:`DataFrame.fillna` and :func:`DataFrameNaFunctions.fill` are aliases of each other.
:param value: int, long, float, string, bool or dict.
Value to replace null values with.
If the va... |
async def close_websession(self):
"""Close web session if not already closed and created by us."""
# We do not close the web session if it was provided.
if self._supplied_websession or self._websession is None:
return
_LOGGER.debug('Closing connections')
# Need to se... | <ast.AsyncFunctionDef object at 0x7da1b1529570> | keyword[async] keyword[def] identifier[close_websession] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_supplied_websession] keyword[or] identifier[self] . identifier[_websession] keyword[is] keyword[None] :
keyword[return]
id... | async def close_websession(self):
"""Close web session if not already closed and created by us."""
# We do not close the web session if it was provided.
if self._supplied_websession or self._websession is None:
return # depends on [control=['if'], data=[]]
_LOGGER.debug('Closing connections')
... |
def slugify(text, length_limit=0, delimiter=u'-'):
"""Generates an ASCII-only slug of a string."""
result = []
for word in _punctuation_regex.split(text.lower()):
word = _available_unicode_handlers[0](word)
if word:
result.append(word)
slug = delimiter.join(result)
if len... | def function[slugify, parameter[text, length_limit, delimiter]]:
constant[Generates an ASCII-only slug of a string.]
variable[result] assign[=] list[[]]
for taget[name[word]] in starred[call[name[_punctuation_regex].split, parameter[call[name[text].lower, parameter[]]]]] begin[:]
... | keyword[def] identifier[slugify] ( identifier[text] , identifier[length_limit] = literal[int] , identifier[delimiter] = literal[string] ):
literal[string]
identifier[result] =[]
keyword[for] identifier[word] keyword[in] identifier[_punctuation_regex] . identifier[split] ( identifier[text] . identif... | def slugify(text, length_limit=0, delimiter=u'-'):
"""Generates an ASCII-only slug of a string."""
result = []
for word in _punctuation_regex.split(text.lower()):
word = _available_unicode_handlers[0](word)
if word:
result.append(word) # depends on [control=['if'], data=[]] # d... |
def markdown(self,md,base_url='..'):
"""
Process the documentation with Markdown to produce HTML.
"""
print("\nProcessing documentation comments...")
ford.sourceform.set_base_url(base_url)
if self.settings['warn'].lower() == 'true': print()
for src in self... | def function[markdown, parameter[self, md, base_url]]:
constant[
Process the documentation with Markdown to produce HTML.
]
call[name[print], parameter[constant[
Processing documentation comments...]]]
call[name[ford].sourceform.set_base_url, parameter[name[base_url]]]
if... | keyword[def] identifier[markdown] ( identifier[self] , identifier[md] , identifier[base_url] = literal[string] ):
literal[string]
identifier[print] ( literal[string] )
identifier[ford] . identifier[sourceform] . identifier[set_base_url] ( identifier[base_url] )
keyword[if] identi... | def markdown(self, md, base_url='..'):
"""
Process the documentation with Markdown to produce HTML.
"""
print('\nProcessing documentation comments...')
ford.sourceform.set_base_url(base_url)
if self.settings['warn'].lower() == 'true':
print() # depends on [control=['if'], data=[... |
def show_domain(self, domain_id):
"""
This method returns the specified domain.
Required parameters
domain_id:
Integer or Domain Name (e.g. domain.com), specifies the domain
to display.
"""
json = self.request('/domains/%s' % domain_i... | def function[show_domain, parameter[self, domain_id]]:
constant[
This method returns the specified domain.
Required parameters
domain_id:
Integer or Domain Name (e.g. domain.com), specifies the domain
to display.
]
variable[json] assi... | keyword[def] identifier[show_domain] ( identifier[self] , identifier[domain_id] ):
literal[string]
identifier[json] = identifier[self] . identifier[request] ( literal[string] % identifier[domain_id] , identifier[method] = literal[string] )
identifier[status] = identifier[json] . identifier... | def show_domain(self, domain_id):
"""
This method returns the specified domain.
Required parameters
domain_id:
Integer or Domain Name (e.g. domain.com), specifies the domain
to display.
"""
json = self.request('/domains/%s' % domain_id, metho... |
def element(cls, name, parent=None, interleave=None, occur=0):
"""Create an element node."""
node = cls("element", parent, interleave=interleave)
node.attr["name"] = name
node.occur = occur
return node | def function[element, parameter[cls, name, parent, interleave, occur]]:
constant[Create an element node.]
variable[node] assign[=] call[name[cls], parameter[constant[element], name[parent]]]
call[name[node].attr][constant[name]] assign[=] name[name]
name[node].occur assign[=] name[occur]... | keyword[def] identifier[element] ( identifier[cls] , identifier[name] , identifier[parent] = keyword[None] , identifier[interleave] = keyword[None] , identifier[occur] = literal[int] ):
literal[string]
identifier[node] = identifier[cls] ( literal[string] , identifier[parent] , identifier[interleave... | def element(cls, name, parent=None, interleave=None, occur=0):
"""Create an element node."""
node = cls('element', parent, interleave=interleave)
node.attr['name'] = name
node.occur = occur
return node |
def plot_cable_length(stats, plotpath):
"""
Cable length per MV grid district
"""
# cable and line kilometer distribution
f, axarr = plt.subplots(2, 2, sharex=True)
stats.hist(column=['Length of MV overhead lines'], bins=5, alpha=0.5, ax=axarr[0, 0])
stats.hist(column=['Length of MV undergr... | def function[plot_cable_length, parameter[stats, plotpath]]:
constant[
Cable length per MV grid district
]
<ast.Tuple object at 0x7da20c6a8c10> assign[=] call[name[plt].subplots, parameter[constant[2], constant[2]]]
call[name[stats].hist, parameter[]]
call[name[stats].hist, param... | keyword[def] identifier[plot_cable_length] ( identifier[stats] , identifier[plotpath] ):
literal[string]
identifier[f] , identifier[axarr] = identifier[plt] . identifier[subplots] ( literal[int] , literal[int] , identifier[sharex] = keyword[True] )
identifier[stats] . identifier[hist] ( identifi... | def plot_cable_length(stats, plotpath):
"""
Cable length per MV grid district
"""
# cable and line kilometer distribution
(f, axarr) = plt.subplots(2, 2, sharex=True)
stats.hist(column=['Length of MV overhead lines'], bins=5, alpha=0.5, ax=axarr[0, 0])
stats.hist(column=['Length of MV underg... |
def _convert_to_config(self):
"""self.parsed_data->self.config, parse unrecognized extra args via KVLoader."""
# remove subconfigs list from namespace before transforming the Namespace
if '_flags' in self.parsed_data:
subcs = self.parsed_data._flags
del self.parsed_data._... | def function[_convert_to_config, parameter[self]]:
constant[self.parsed_data->self.config, parse unrecognized extra args via KVLoader.]
if compare[constant[_flags] in name[self].parsed_data] begin[:]
variable[subcs] assign[=] name[self].parsed_data._flags
<ast.Delete object at 0x... | keyword[def] identifier[_convert_to_config] ( identifier[self] ):
literal[string]
keyword[if] literal[string] keyword[in] identifier[self] . identifier[parsed_data] :
identifier[subcs] = identifier[self] . identifier[parsed_data] . identifier[_flags]
keyword[d... | def _convert_to_config(self):
"""self.parsed_data->self.config, parse unrecognized extra args via KVLoader."""
# remove subconfigs list from namespace before transforming the Namespace
if '_flags' in self.parsed_data:
subcs = self.parsed_data._flags
del self.parsed_data._flags # depends on ... |
def _distribution_distance(simulated_trajectories, observed_trajectories_lookup, distribution):
"""
Returns the distance between the simulated and observed trajectory, w.r.t. the assumed distribution
:param simulated_trajectories: Simulated trajectories
:type simulated_trajectories: list[:class:`means.... | def function[_distribution_distance, parameter[simulated_trajectories, observed_trajectories_lookup, distribution]]:
constant[
Returns the distance between the simulated and observed trajectory, w.r.t. the assumed distribution
:param simulated_trajectories: Simulated trajectories
:type simulated_tr... | keyword[def] identifier[_distribution_distance] ( identifier[simulated_trajectories] , identifier[observed_trajectories_lookup] , identifier[distribution] ):
literal[string]
identifier[mean_variance_lookup] = identifier[_compile_mean_variance_lookup] ( identifier[simulated_trajectories] )
ident... | def _distribution_distance(simulated_trajectories, observed_trajectories_lookup, distribution):
"""
Returns the distance between the simulated and observed trajectory, w.r.t. the assumed distribution
:param simulated_trajectories: Simulated trajectories
:type simulated_trajectories: list[:class:`means.... |
def check_signature(signature, private_key, full_path, payload):
"""
Checks signature received and verifies that we are able to re-create
it from the private key, path, and payload given.
:param signature:
Signature received from request.
:param private_key:
Base 64, url encoded pri... | def function[check_signature, parameter[signature, private_key, full_path, payload]]:
constant[
Checks signature received and verifies that we are able to re-create
it from the private key, path, and payload given.
:param signature:
Signature received from request.
:param private_key:
... | keyword[def] identifier[check_signature] ( identifier[signature] , identifier[private_key] , identifier[full_path] , identifier[payload] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[private_key] , identifier[bytes] ):
identifier[private_key] = identifier[private_key] . ident... | def check_signature(signature, private_key, full_path, payload):
"""
Checks signature received and verifies that we are able to re-create
it from the private key, path, and payload given.
:param signature:
Signature received from request.
:param private_key:
Base 64, url encoded pri... |
def get(cls, key, default=None):
"""
Resembles the :meth:`dict.get` method.
:returns:
A configuration dictionary for specified provider.
"""
# Query datastore.
result = cls.query(cls.provider_name == key).get()
if result:
result_dict = ... | def function[get, parameter[cls, key, default]]:
constant[
Resembles the :meth:`dict.get` method.
:returns:
A configuration dictionary for specified provider.
]
variable[result] assign[=] call[call[name[cls].query, parameter[compare[name[cls].provider_name equal[==]... | keyword[def] identifier[get] ( identifier[cls] , identifier[key] , identifier[default] = keyword[None] ):
literal[string]
identifier[result] = identifier[cls] . identifier[query] ( identifier[cls] . identifier[provider_name] == identifier[key] ). identifier[get] ()
keyword[if] ... | def get(cls, key, default=None):
"""
Resembles the :meth:`dict.get` method.
:returns:
A configuration dictionary for specified provider.
"""
# Query datastore.
result = cls.query(cls.provider_name == key).get()
if result:
result_dict = result.to_dict()
... |
def saveOverlayToDicomCopy(input_dcmfilelist, output_dicom_dir, overlays,
crinfo, orig_shape):
""" Save overlay to dicom. """
from . import datawriter as dwriter
# import qmisc
if not os.path.exists(output_dicom_dir):
os.makedirs(output_dicom_dir)
import imtools.... | def function[saveOverlayToDicomCopy, parameter[input_dcmfilelist, output_dicom_dir, overlays, crinfo, orig_shape]]:
constant[ Save overlay to dicom. ]
from relative_module[None] import module[datawriter]
if <ast.UnaryOp object at 0x7da18dc99210> begin[:]
call[name[os].makedirs, param... | keyword[def] identifier[saveOverlayToDicomCopy] ( identifier[input_dcmfilelist] , identifier[output_dicom_dir] , identifier[overlays] ,
identifier[crinfo] , identifier[orig_shape] ):
literal[string]
keyword[from] . keyword[import] identifier[datawriter] keyword[as] identifier[dwriter]
keywo... | def saveOverlayToDicomCopy(input_dcmfilelist, output_dicom_dir, overlays, crinfo, orig_shape):
""" Save overlay to dicom. """
from . import datawriter as dwriter
# import qmisc
if not os.path.exists(output_dicom_dir):
os.makedirs(output_dicom_dir) # depends on [control=['if'], data=[]]
impo... |
def mission_request_list_send(self, target_system, target_component, force_mavlink1=False):
'''
Request the overall list of mission items from the system/component.
target_system : System ID (uint8_t)
target_component : Component ID (... | def function[mission_request_list_send, parameter[self, target_system, target_component, force_mavlink1]]:
constant[
Request the overall list of mission items from the system/component.
target_system : System ID (uint8_t)
target_component : C... | keyword[def] identifier[mission_request_list_send] ( identifier[self] , identifier[target_system] , identifier[target_component] , identifier[force_mavlink1] = keyword[False] ):
literal[string]
keyword[return] identifier[self] . identifier[send] ( identifier[self] . identifier[miss... | def mission_request_list_send(self, target_system, target_component, force_mavlink1=False):
"""
Request the overall list of mission items from the system/component.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
... |
def open_webpage(self, url):
"""Launch Web Browser and open url"""
params = ('<X_AppType>vc_app</X_AppType>'
'<X_LaunchKeyword>resource_id={resource_id}</X_LaunchKeyword>'
).format(resource_id=1063)
res = self.soap_request(URL_CONTROL_NRC, URN_REMOTE_CONTROL,
... | def function[open_webpage, parameter[self, url]]:
constant[Launch Web Browser and open url]
variable[params] assign[=] call[constant[<X_AppType>vc_app</X_AppType><X_LaunchKeyword>resource_id={resource_id}</X_LaunchKeyword>].format, parameter[]]
variable[res] assign[=] call[name[self].soap_reques... | keyword[def] identifier[open_webpage] ( identifier[self] , identifier[url] ):
literal[string]
identifier[params] =( literal[string]
literal[string]
). identifier[format] ( identifier[resource_id] = literal[int] )
identifier[res] = identifier[self] . identifier[soap_reque... | def open_webpage(self, url):
"""Launch Web Browser and open url"""
params = '<X_AppType>vc_app</X_AppType><X_LaunchKeyword>resource_id={resource_id}</X_LaunchKeyword>'.format(resource_id=1063)
res = self.soap_request(URL_CONTROL_NRC, URN_REMOTE_CONTROL, 'X_LaunchApp', params, body_elem='s')
root = ET.fr... |
def save(self, form, name, composite_form, commit):
"""
This method is called by
:meth:`django_superform.forms.SuperModelForm.save` in order to save the
modelform that this field takes care of and calls on the nested form's
``save()`` method. But only if
:meth:`~django_su... | def function[save, parameter[self, form, name, composite_form, commit]]:
constant[
This method is called by
:meth:`django_superform.forms.SuperModelForm.save` in order to save the
modelform that this field takes care of and calls on the nested form's
``save()`` method. But only i... | keyword[def] identifier[save] ( identifier[self] , identifier[form] , identifier[name] , identifier[composite_form] , identifier[commit] ):
literal[string]
keyword[if] identifier[self] . identifier[shall_save] ( identifier[form] , identifier[name] , identifier[composite_form] ):
keywo... | def save(self, form, name, composite_form, commit):
"""
This method is called by
:meth:`django_superform.forms.SuperModelForm.save` in order to save the
modelform that this field takes care of and calls on the nested form's
``save()`` method. But only if
:meth:`~django_superf... |
def _StartProfiling(self, configuration):
"""Starts profiling.
Args:
configuration (ProfilingConfiguration): profiling configuration.
"""
if not configuration:
return
if configuration.HaveProfileMemoryGuppy():
self._guppy_memory_profiler = profilers.GuppyMemoryProfiler(
... | def function[_StartProfiling, parameter[self, configuration]]:
constant[Starts profiling.
Args:
configuration (ProfilingConfiguration): profiling configuration.
]
if <ast.UnaryOp object at 0x7da18bc70580> begin[:]
return[None]
if call[name[configuration].HaveProfileMemoryG... | keyword[def] identifier[_StartProfiling] ( identifier[self] , identifier[configuration] ):
literal[string]
keyword[if] keyword[not] identifier[configuration] :
keyword[return]
keyword[if] identifier[configuration] . identifier[HaveProfileMemoryGuppy] ():
identifier[self] . identifie... | def _StartProfiling(self, configuration):
"""Starts profiling.
Args:
configuration (ProfilingConfiguration): profiling configuration.
"""
if not configuration:
return # depends on [control=['if'], data=[]]
if configuration.HaveProfileMemoryGuppy():
self._guppy_memory_profiler... |
def exec(self, *command_tokens, command_context=None, **command_env):
""" Execute command
:param command_tokens: command tokens to execute
:param command_context: command context
:param command_env: command environment
:return: WCommandResultProto
"""
if self.adapter().match(command_context, **command_en... | def function[exec, parameter[self]]:
constant[ Execute command
:param command_tokens: command tokens to execute
:param command_context: command context
:param command_env: command environment
:return: WCommandResultProto
]
if compare[call[call[name[self].adapter, parameter[]].match, parameter... | keyword[def] identifier[exec] ( identifier[self] ,* identifier[command_tokens] , identifier[command_context] = keyword[None] ,** identifier[command_env] ):
literal[string]
keyword[if] identifier[self] . identifier[adapter] (). identifier[match] ( identifier[command_context] ,** identifier[command_env] ) keywo... | def exec(self, *command_tokens, command_context=None, **command_env):
""" Execute command
:param command_tokens: command tokens to execute
:param command_context: command context
:param command_env: command environment
:return: WCommandResultProto
"""
if self.adapter().match(command_context, **comman... |
def get_user(self, id, **kwargs): # noqa: E501
"""Retrieves a user by identifier (email addr) # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user(id, asy... | def function[get_user, parameter[self, id]]:
constant[Retrieves a user by identifier (email addr) # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user(id, ... | keyword[def] identifier[get_user] ( identifier[self] , identifier[id] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] [ literal[string] ]= keyword[True]
keyword[if] identifier[kwargs] . identifier[get] ( literal[string] ):
keyword[return] identifier[self] . ide... | def get_user(self, id, **kwargs): # noqa: E501
'Retrieves a user by identifier (email addr) # noqa: E501\n\n # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.get_user(id, asyn... |
def object_upload(self, bucket, key, content, content_type):
"""Writes text content to the object.
Args:
bucket: the name of the bucket containing the object.
key: the key of the object to be written.
content: the text content to be written.
content_type: the type of text content.
R... | def function[object_upload, parameter[self, bucket, key, content, content_type]]:
constant[Writes text content to the object.
Args:
bucket: the name of the bucket containing the object.
key: the key of the object to be written.
content: the text content to be written.
content_type: ... | keyword[def] identifier[object_upload] ( identifier[self] , identifier[bucket] , identifier[key] , identifier[content] , identifier[content_type] ):
literal[string]
identifier[args] ={ literal[string] : literal[string] , literal[string] : identifier[key] }
identifier[headers] ={ literal[string] : iden... | def object_upload(self, bucket, key, content, content_type):
"""Writes text content to the object.
Args:
bucket: the name of the bucket containing the object.
key: the key of the object to be written.
content: the text content to be written.
content_type: the type of text content.
R... |
def scaleToBoxParam(quad, shape):
'''
so, you have a [quad] ((x0,y0),,,) inside a box [shape](width,height)
this function gives you center [x,y], and scale factor [x,y]
you would need to apply to [quad] in order to scale it to the same shape as the box
!quad corners needs to be sorted... | def function[scaleToBoxParam, parameter[quad, shape]]:
constant[
so, you have a [quad] ((x0,y0),,,) inside a box [shape](width,height)
this function gives you center [x,y], and scale factor [x,y]
you would need to apply to [quad] in order to scale it to the same shape as the box
!... | keyword[def] identifier[scaleToBoxParam] ( identifier[quad] , identifier[shape] ):
literal[string]
identifier[x0] = literal[int] *( identifier[quad] [ literal[int] ][ literal[int] ]+ identifier[quad] [ literal[int] ][ literal[int] ])
identifier[x1] = literal[int] *( identifier[quad] [ literal[in... | def scaleToBoxParam(quad, shape):
"""
so, you have a [quad] ((x0,y0),,,) inside a box [shape](width,height)
this function gives you center [x,y], and scale factor [x,y]
you would need to apply to [quad] in order to scale it to the same shape as the box
!quad corners needs to be sorted... |
def linkify_one_command_with_commands(self, commands, prop):
"""
Link a command
:param commands: object commands
:type commands: object
:param prop: property name
:type prop: str
:return: None
"""
if not hasattr(self, prop):
return
... | def function[linkify_one_command_with_commands, parameter[self, commands, prop]]:
constant[
Link a command
:param commands: object commands
:type commands: object
:param prop: property name
:type prop: str
:return: None
]
if <ast.UnaryOp object at... | keyword[def] identifier[linkify_one_command_with_commands] ( identifier[self] , identifier[commands] , identifier[prop] ):
literal[string]
keyword[if] keyword[not] identifier[hasattr] ( identifier[self] , identifier[prop] ):
keyword[return]
identifier[command] = identifie... | def linkify_one_command_with_commands(self, commands, prop):
"""
Link a command
:param commands: object commands
:type commands: object
:param prop: property name
:type prop: str
:return: None
"""
if not hasattr(self, prop):
return # depends on [... |
def reduce_by_flightmodes(self, flightmode_selections):
'''reduce data using flightmode selections'''
if len(flightmode_selections) == 0:
return
all_false = True
for s in flightmode_selections:
if s:
all_false = False
if all_false:
... | def function[reduce_by_flightmodes, parameter[self, flightmode_selections]]:
constant[reduce data using flightmode selections]
if compare[call[name[len], parameter[name[flightmode_selections]]] equal[==] constant[0]] begin[:]
return[None]
variable[all_false] assign[=] constant[True]
... | keyword[def] identifier[reduce_by_flightmodes] ( identifier[self] , identifier[flightmode_selections] ):
literal[string]
keyword[if] identifier[len] ( identifier[flightmode_selections] )== literal[int] :
keyword[return]
identifier[all_false] = keyword[True]
keyword... | def reduce_by_flightmodes(self, flightmode_selections):
"""reduce data using flightmode selections"""
if len(flightmode_selections) == 0:
return # depends on [control=['if'], data=[]]
all_false = True
for s in flightmode_selections:
if s:
all_false = False # depends on [con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.