code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def get_certificate(self, cert_id, **kwargs): # noqa: E501
"""Get trusted certificate by ID. # noqa: E501
An endpoint for retrieving a trusted certificate by ID. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/trusted-certificates/{cert-id} -H 'Authorization: Bearer API_KEY'` # noq... | def function[get_certificate, parameter[self, cert_id]]:
constant[Get trusted certificate by ID. # noqa: E501
An endpoint for retrieving a trusted certificate by ID. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/trusted-certificates/{cert-id} -H 'Authorization: Bearer API_KEY'` # ... | keyword[def] identifier[get_certificate] ( identifier[self] , identifier[cert_id] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] [ literal[string] ]= keyword[True]
keyword[if] identifier[kwargs] . identifier[get] ( literal[string] ):
keyword[return] identifier... | def get_certificate(self, cert_id, **kwargs): # noqa: E501
"Get trusted certificate by ID. # noqa: E501\n\n An endpoint for retrieving a trusted certificate by ID. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/trusted-certificates/{cert-id} -H 'Authorization: Bearer API_KEY'` # noqa: E... |
def disable_logging(lines, min_level_value, max_level_value):
"""Disables logging statements in these lines whose logging level falls
between the specified minimum and maximum levels."""
output = ''
while lines:
line = lines[0]
ret = RE_LOGGING_START.match(line)
if not ret:
... | def function[disable_logging, parameter[lines, min_level_value, max_level_value]]:
constant[Disables logging statements in these lines whose logging level falls
between the specified minimum and maximum levels.]
variable[output] assign[=] constant[]
while name[lines] begin[:]
... | keyword[def] identifier[disable_logging] ( identifier[lines] , identifier[min_level_value] , identifier[max_level_value] ):
literal[string]
identifier[output] = literal[string]
keyword[while] identifier[lines] :
identifier[line] = identifier[lines] [ literal[int] ]
identifier[ret] ... | def disable_logging(lines, min_level_value, max_level_value):
"""Disables logging statements in these lines whose logging level falls
between the specified minimum and maximum levels."""
output = ''
while lines:
line = lines[0]
ret = RE_LOGGING_START.match(line)
if not ret:
... |
def distributeParams(self,param_name,param_count,center,spread,dist_type):
'''
Distributes heterogeneous values of one parameter to the AgentTypes in self.agents.
Parameters
----------
param_name : string
Name of the parameter to be assigned.
param_count : in... | def function[distributeParams, parameter[self, param_name, param_count, center, spread, dist_type]]:
constant[
Distributes heterogeneous values of one parameter to the AgentTypes in self.agents.
Parameters
----------
param_name : string
Name of the parameter to be as... | keyword[def] identifier[distributeParams] ( identifier[self] , identifier[param_name] , identifier[param_count] , identifier[center] , identifier[spread] , identifier[dist_type] ):
literal[string]
keyword[if] identifier[dist_type] == literal[string] :
identifier[para... | def distributeParams(self, param_name, param_count, center, spread, dist_type):
"""
Distributes heterogeneous values of one parameter to the AgentTypes in self.agents.
Parameters
----------
param_name : string
Name of the parameter to be assigned.
param_count : i... |
def LEB128toint(LEBinput):
'''
Convert unsigned LEB128 hex to integer
'''
reversedbytes = hexreverse(LEBinput)
binstr = ""
for i in range(len(LEBinput) // 2):
if i == 0:
assert int(reversedbytes[2*i:(2*i + 2)],16) < 128
else:
assert int(reversedbytes[2*i:... | def function[LEB128toint, parameter[LEBinput]]:
constant[
Convert unsigned LEB128 hex to integer
]
variable[reversedbytes] assign[=] call[name[hexreverse], parameter[name[LEBinput]]]
variable[binstr] assign[=] constant[]
for taget[name[i]] in starred[call[name[range], parameter[b... | keyword[def] identifier[LEB128toint] ( identifier[LEBinput] ):
literal[string]
identifier[reversedbytes] = identifier[hexreverse] ( identifier[LEBinput] )
identifier[binstr] = literal[string]
keyword[for] identifier[i] keyword[in] identifier[range] ( identifier[len] ( identifier[LEBinput] )/... | def LEB128toint(LEBinput):
"""
Convert unsigned LEB128 hex to integer
"""
reversedbytes = hexreverse(LEBinput)
binstr = ''
for i in range(len(LEBinput) // 2):
if i == 0:
assert int(reversedbytes[2 * i:2 * i + 2], 16) < 128 # depends on [control=['if'], data=['i']]
el... |
def fit_from_cfg(cls, choosers, chosen_fname, alternatives, cfgname, outcfgname=None):
"""
Parameters
----------
choosers : DataFrame
A dataframe of rows of agents that have made choices.
chosen_fname : string
A string indicating the column in the choosers... | def function[fit_from_cfg, parameter[cls, choosers, chosen_fname, alternatives, cfgname, outcfgname]]:
constant[
Parameters
----------
choosers : DataFrame
A dataframe of rows of agents that have made choices.
chosen_fname : string
A string indicating the ... | keyword[def] identifier[fit_from_cfg] ( identifier[cls] , identifier[choosers] , identifier[chosen_fname] , identifier[alternatives] , identifier[cfgname] , identifier[outcfgname] = keyword[None] ):
literal[string]
identifier[logger] . identifier[debug] ( literal[string] . identifier[format] ( iden... | def fit_from_cfg(cls, choosers, chosen_fname, alternatives, cfgname, outcfgname=None):
"""
Parameters
----------
choosers : DataFrame
A dataframe of rows of agents that have made choices.
chosen_fname : string
A string indicating the column in the choosers dat... |
def plot_predict(self,h=5,past_values=20,intervals=True,**kwargs):
""" Makes forecast with the estimated model
Parameters
----------
h : int (default : 5)
How many steps ahead would you like to forecast?
past_values : int (default : 20)
How many pa... | def function[plot_predict, parameter[self, h, past_values, intervals]]:
constant[ Makes forecast with the estimated model
Parameters
----------
h : int (default : 5)
How many steps ahead would you like to forecast?
past_values : int (default : 20)
How ma... | keyword[def] identifier[plot_predict] ( identifier[self] , identifier[h] = literal[int] , identifier[past_values] = literal[int] , identifier[intervals] = keyword[True] ,** identifier[kwargs] ):
literal[string]
keyword[import] identifier[matplotlib] . identifier[pyplot] keyword[as] identifier[pl... | def plot_predict(self, h=5, past_values=20, intervals=True, **kwargs):
""" Makes forecast with the estimated model
Parameters
----------
h : int (default : 5)
How many steps ahead would you like to forecast?
past_values : int (default : 20)
How many past obs... |
def replace_namespaced_controller_revision(self, name, namespace, body, **kwargs): # noqa: E501
"""replace_namespaced_controller_revision # noqa: E501
replace the specified ControllerRevision # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronou... | def function[replace_namespaced_controller_revision, parameter[self, name, namespace, body]]:
constant[replace_namespaced_controller_revision # noqa: E501
replace the specified ControllerRevision # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchro... | keyword[def] identifier[replace_namespaced_controller_revision] ( identifier[self] , identifier[name] , identifier[namespace] , identifier[body] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] [ literal[string] ]= keyword[True]
keyword[if] identifier[kwargs] . identifier[get... | def replace_namespaced_controller_revision(self, name, namespace, body, **kwargs): # noqa: E501
"replace_namespaced_controller_revision # noqa: E501\n\n replace the specified ControllerRevision # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous ... |
def _get_address_family(table, instance):
"""
Function to derive address family from a junos table name.
:params table: The name of the routing table
:returns: address family
"""
address_family_mapping = {"inet": "ipv4", "inet6": "ipv6", "inetflow": "flow"}
if in... | def function[_get_address_family, parameter[table, instance]]:
constant[
Function to derive address family from a junos table name.
:params table: The name of the routing table
:returns: address family
]
variable[address_family_mapping] assign[=] dictionary[[<ast.Constan... | keyword[def] identifier[_get_address_family] ( identifier[table] , identifier[instance] ):
literal[string]
identifier[address_family_mapping] ={ literal[string] : literal[string] , literal[string] : literal[string] , literal[string] : literal[string] }
keyword[if] identifier[instance] == ... | def _get_address_family(table, instance):
"""
Function to derive address family from a junos table name.
:params table: The name of the routing table
:returns: address family
"""
address_family_mapping = {'inet': 'ipv4', 'inet6': 'ipv6', 'inetflow': 'flow'}
if instance == 'm... |
def wait_for_master_death(self):
"""Wait for a master timeout and take the lead if necessary
:return: None
"""
logger.info("Waiting for master death")
timeout = 1.0
self.last_master_ping = time.time()
master_timeout = 300
for arbiter_link in self.conf.ar... | def function[wait_for_master_death, parameter[self]]:
constant[Wait for a master timeout and take the lead if necessary
:return: None
]
call[name[logger].info, parameter[constant[Waiting for master death]]]
variable[timeout] assign[=] constant[1.0]
name[self].last_master... | keyword[def] identifier[wait_for_master_death] ( identifier[self] ):
literal[string]
identifier[logger] . identifier[info] ( literal[string] )
identifier[timeout] = literal[int]
identifier[self] . identifier[last_master_ping] = identifier[time] . identifier[time] ()
ide... | def wait_for_master_death(self):
"""Wait for a master timeout and take the lead if necessary
:return: None
"""
logger.info('Waiting for master death')
timeout = 1.0
self.last_master_ping = time.time()
master_timeout = 300
for arbiter_link in self.conf.arbiters:
if not ar... |
def copy_from_scratch(file_mapping, dry_run=True):
"""Copy output files from scratch area """
for key, value in file_mapping.items():
if dry_run:
print ("copy %s %s" % (value, key))
else:
try:
outdir = os.path.dirname(key)
... | def function[copy_from_scratch, parameter[file_mapping, dry_run]]:
constant[Copy output files from scratch area ]
for taget[tuple[[<ast.Name object at 0x7da18f8103a0>, <ast.Name object at 0x7da18f8127a0>]]] in starred[call[name[file_mapping].items, parameter[]]] begin[:]
if name[dry_run]... | keyword[def] identifier[copy_from_scratch] ( identifier[file_mapping] , identifier[dry_run] = keyword[True] ):
literal[string]
keyword[for] identifier[key] , identifier[value] keyword[in] identifier[file_mapping] . identifier[items] ():
keyword[if] identifier[dry_run] :
... | def copy_from_scratch(file_mapping, dry_run=True):
"""Copy output files from scratch area """
for (key, value) in file_mapping.items():
if dry_run:
print('copy %s %s' % (value, key)) # depends on [control=['if'], data=[]]
else:
try:
outdir = os.path.dirna... |
def get(self):
"""Get the first public IP address returned by one of the online services."""
q = queue.Queue()
for u, j, k in urls:
t = threading.Thread(target=self._get_ip_public, args=(q, u, j, k))
t.daemon = True
t.start()
timer = Timer(self.timeo... | def function[get, parameter[self]]:
constant[Get the first public IP address returned by one of the online services.]
variable[q] assign[=] call[name[queue].Queue, parameter[]]
for taget[tuple[[<ast.Name object at 0x7da18f58d5a0>, <ast.Name object at 0x7da18f58cb50>, <ast.Name object at 0x7da18f... | keyword[def] identifier[get] ( identifier[self] ):
literal[string]
identifier[q] = identifier[queue] . identifier[Queue] ()
keyword[for] identifier[u] , identifier[j] , identifier[k] keyword[in] identifier[urls] :
identifier[t] = identifier[threading] . identifier[Thread] ... | def get(self):
"""Get the first public IP address returned by one of the online services."""
q = queue.Queue()
for (u, j, k) in urls:
t = threading.Thread(target=self._get_ip_public, args=(q, u, j, k))
t.daemon = True
t.start() # depends on [control=['for'], data=[]]
timer = Tim... |
def union(self, other):
"""
Compute the union bounding box of this bounding box and another one.
This is equivalent to drawing a bounding box around all corners points of both
bounding boxes.
Parameters
----------
other : imgaug.BoundingBox
Other bou... | def function[union, parameter[self, other]]:
constant[
Compute the union bounding box of this bounding box and another one.
This is equivalent to drawing a bounding box around all corners points of both
bounding boxes.
Parameters
----------
other : imgaug.Boundi... | keyword[def] identifier[union] ( identifier[self] , identifier[other] ):
literal[string]
keyword[return] identifier[BoundingBox] (
identifier[x1] = identifier[min] ( identifier[self] . identifier[x1] , identifier[other] . identifier[x1] ),
identifier[y1] = identifier[min] ( ident... | def union(self, other):
"""
Compute the union bounding box of this bounding box and another one.
This is equivalent to drawing a bounding box around all corners points of both
bounding boxes.
Parameters
----------
other : imgaug.BoundingBox
Other boundin... |
def _increase_logging(self, loggers):
"""! @brief Increase logging level for a set of subloggers."""
if self._log_level_delta <= 0:
level = max(1, self._default_log_level + self._log_level_delta - 10)
for logger in loggers:
logging.getLogger(logger).setLevel(level... | def function[_increase_logging, parameter[self, loggers]]:
constant[! @brief Increase logging level for a set of subloggers.]
if compare[name[self]._log_level_delta less_or_equal[<=] constant[0]] begin[:]
variable[level] assign[=] call[name[max], parameter[constant[1], binary_operation[b... | keyword[def] identifier[_increase_logging] ( identifier[self] , identifier[loggers] ):
literal[string]
keyword[if] identifier[self] . identifier[_log_level_delta] <= literal[int] :
identifier[level] = identifier[max] ( literal[int] , identifier[self] . identifier[_default_log_level] +... | def _increase_logging(self, loggers):
"""! @brief Increase logging level for a set of subloggers."""
if self._log_level_delta <= 0:
level = max(1, self._default_log_level + self._log_level_delta - 10)
for logger in loggers:
logging.getLogger(logger).setLevel(level) # depends on [con... |
def generate_yaml_file(filename, contents):
"""Creates a yaml file with the given content."""
with open(filename, 'w') as file:
file.write(yaml.dump(contents, default_flow_style=False)) | def function[generate_yaml_file, parameter[filename, contents]]:
constant[Creates a yaml file with the given content.]
with call[name[open], parameter[name[filename], constant[w]]] begin[:]
call[name[file].write, parameter[call[name[yaml].dump, parameter[name[contents]]]]] | keyword[def] identifier[generate_yaml_file] ( identifier[filename] , identifier[contents] ):
literal[string]
keyword[with] identifier[open] ( identifier[filename] , literal[string] ) keyword[as] identifier[file] :
identifier[file] . identifier[write] ( identifier[yaml] . identifier[dump] ( ident... | def generate_yaml_file(filename, contents):
"""Creates a yaml file with the given content."""
with open(filename, 'w') as file:
file.write(yaml.dump(contents, default_flow_style=False)) # depends on [control=['with'], data=['file']] |
def construct_scalar(self, node):
'''
Verify integers and pass them in correctly is they are declared
as octal
'''
if node.tag == 'tag:yaml.org,2002:int':
if node.value == '0':
pass
elif node.value.startswith('0') and not node.value.startsw... | def function[construct_scalar, parameter[self, node]]:
constant[
Verify integers and pass them in correctly is they are declared
as octal
]
if compare[name[node].tag equal[==] constant[tag:yaml.org,2002:int]] begin[:]
if compare[name[node].value equal[==] constant... | keyword[def] identifier[construct_scalar] ( identifier[self] , identifier[node] ):
literal[string]
keyword[if] identifier[node] . identifier[tag] == literal[string] :
keyword[if] identifier[node] . identifier[value] == literal[string] :
keyword[pass]
ke... | def construct_scalar(self, node):
"""
Verify integers and pass them in correctly is they are declared
as octal
"""
if node.tag == 'tag:yaml.org,2002:int':
if node.value == '0':
pass # depends on [control=['if'], data=[]]
elif node.value.startswith('0') and (n... |
def term(term, xpath=None, escape=True):
""" Escapes <, > and & characters in the given term for inclusion into XML (like the search query).
Also wrap the term in XML tags if xpath is specified.
Note that this function doesn't escape the @, $, " and other symbols that are meaningful in a search quer... | def function[term, parameter[term, xpath, escape]]:
constant[ Escapes <, > and & characters in the given term for inclusion into XML (like the search query).
Also wrap the term in XML tags if xpath is specified.
Note that this function doesn't escape the @, $, " and other symbols that are meanin... | keyword[def] identifier[term] ( identifier[term] , identifier[xpath] = keyword[None] , identifier[escape] = keyword[True] ):
literal[string]
identifier[prefix] =[]
identifier[postfix] =[]
keyword[if] identifier[xpath] :
identifier[tags] = identifier[xpath] . identifier[split] ( literal[... | def term(term, xpath=None, escape=True):
""" Escapes <, > and & characters in the given term for inclusion into XML (like the search query).
Also wrap the term in XML tags if xpath is specified.
Note that this function doesn't escape the @, $, " and other symbols that are meaningful in a search quer... |
def estimate_shift(signal, genome=None, windowsize=5000, thresh=None,
nwindows=1000, maxlag=500, array_kwargs=None,
verbose=False):
"""
Experimental: cross-correlation to estimate the shift width of ChIP-seq
data
This can be interpreted as the binding site footprin... | def function[estimate_shift, parameter[signal, genome, windowsize, thresh, nwindows, maxlag, array_kwargs, verbose]]:
constant[
Experimental: cross-correlation to estimate the shift width of ChIP-seq
data
This can be interpreted as the binding site footprint.
For ChIP-seq, the plus and minus s... | keyword[def] identifier[estimate_shift] ( identifier[signal] , identifier[genome] = keyword[None] , identifier[windowsize] = literal[int] , identifier[thresh] = keyword[None] ,
identifier[nwindows] = literal[int] , identifier[maxlag] = literal[int] , identifier[array_kwargs] = keyword[None] ,
identifier[verbose] = ... | def estimate_shift(signal, genome=None, windowsize=5000, thresh=None, nwindows=1000, maxlag=500, array_kwargs=None, verbose=False):
"""
Experimental: cross-correlation to estimate the shift width of ChIP-seq
data
This can be interpreted as the binding site footprint.
For ChIP-seq, the plus and min... |
def change_crypto_domain_config(self, crypto_domain_index, access_mode):
"""
Change the access mode for a crypto domain that is currently included
in the crypto configuration of this partition.
The access mode will be changed for the specified crypto domain on all
crypto adapter... | def function[change_crypto_domain_config, parameter[self, crypto_domain_index, access_mode]]:
constant[
Change the access mode for a crypto domain that is currently included
in the crypto configuration of this partition.
The access mode will be changed for the specified crypto domain on... | keyword[def] identifier[change_crypto_domain_config] ( identifier[self] , identifier[crypto_domain_index] , identifier[access_mode] ):
literal[string]
identifier[body] ={ literal[string] : identifier[crypto_domain_index] ,
literal[string] : identifier[access_mode] }
identifier[sel... | def change_crypto_domain_config(self, crypto_domain_index, access_mode):
"""
Change the access mode for a crypto domain that is currently included
in the crypto configuration of this partition.
The access mode will be changed for the specified crypto domain on all
crypto adapters cu... |
def frange(start, stop, step, precision):
"""A generator that will generate a range of floats."""
value = start
while round(value, precision) < stop:
yield round(value, precision)
value += step | def function[frange, parameter[start, stop, step, precision]]:
constant[A generator that will generate a range of floats.]
variable[value] assign[=] name[start]
while compare[call[name[round], parameter[name[value], name[precision]]] less[<] name[stop]] begin[:]
<ast.Yield object... | keyword[def] identifier[frange] ( identifier[start] , identifier[stop] , identifier[step] , identifier[precision] ):
literal[string]
identifier[value] = identifier[start]
keyword[while] identifier[round] ( identifier[value] , identifier[precision] )< identifier[stop] :
keyword[yield] ident... | def frange(start, stop, step, precision):
"""A generator that will generate a range of floats."""
value = start
while round(value, precision) < stop:
yield round(value, precision)
value += step # depends on [control=['while'], data=[]] |
def _add_jobs(self):
""" Add configured jobs.
"""
for name, params in self.jobs.items():
if params.active:
params.handler = params.handler(params)
self.sched.add_cron_job(params.handler.run, **params.schedule) | def function[_add_jobs, parameter[self]]:
constant[ Add configured jobs.
]
for taget[tuple[[<ast.Name object at 0x7da207f009d0>, <ast.Name object at 0x7da207f03370>]]] in starred[call[name[self].jobs.items, parameter[]]] begin[:]
if name[params].active begin[:]
... | keyword[def] identifier[_add_jobs] ( identifier[self] ):
literal[string]
keyword[for] identifier[name] , identifier[params] keyword[in] identifier[self] . identifier[jobs] . identifier[items] ():
keyword[if] identifier[params] . identifier[active] :
identifier[para... | def _add_jobs(self):
""" Add configured jobs.
"""
for (name, params) in self.jobs.items():
if params.active:
params.handler = params.handler(params)
self.sched.add_cron_job(params.handler.run, **params.schedule) # depends on [control=['if'], data=[]] # depends on [contr... |
def parseSearchTerm(term):
"""
Turn a string search query into a two-tuple of a search term and a
dictionary of search keywords.
"""
terms = []
keywords = {}
for word in term.split():
if word.count(':') == 1:
k, v = word.split(u':')
if k and v:
... | def function[parseSearchTerm, parameter[term]]:
constant[
Turn a string search query into a two-tuple of a search term and a
dictionary of search keywords.
]
variable[terms] assign[=] list[[]]
variable[keywords] assign[=] dictionary[[], []]
for taget[name[word]] in starred[ca... | keyword[def] identifier[parseSearchTerm] ( identifier[term] ):
literal[string]
identifier[terms] =[]
identifier[keywords] ={}
keyword[for] identifier[word] keyword[in] identifier[term] . identifier[split] ():
keyword[if] identifier[word] . identifier[count] ( literal[string] )== lite... | def parseSearchTerm(term):
"""
Turn a string search query into a two-tuple of a search term and a
dictionary of search keywords.
"""
terms = []
keywords = {}
for word in term.split():
if word.count(':') == 1:
(k, v) = word.split(u':')
if k and v:
... |
def replace(self):
"""
Used to replace a matched string with another.
:return: The data after replacement.
:rtype: str
"""
if self.replace_with: # pylint: disable=no-member
return substrings(
self.regex,
self.replace_with, #... | def function[replace, parameter[self]]:
constant[
Used to replace a matched string with another.
:return: The data after replacement.
:rtype: str
]
if name[self].replace_with begin[:]
return[call[name[substrings], parameter[name[self].regex, name[self].replace_wi... | keyword[def] identifier[replace] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[replace_with] :
keyword[return] identifier[substrings] (
identifier[self] . identifier[regex] ,
identifier[self] . identifier[replace_with] ,
... | def replace(self):
"""
Used to replace a matched string with another.
:return: The data after replacement.
:rtype: str
"""
if self.replace_with: # pylint: disable=no-member
# pylint: disable=no-member
# pylint: disable=no-member
return substrings(self.re... |
def check_no_element_by_selector(self, selector):
"""Assert an element does not exist matching the given selector."""
elems = find_elements_by_jquery(world.browser, selector)
if elems:
raise AssertionError("Expected no matching elements, found {}.".format(
len(elems))) | def function[check_no_element_by_selector, parameter[self, selector]]:
constant[Assert an element does not exist matching the given selector.]
variable[elems] assign[=] call[name[find_elements_by_jquery], parameter[name[world].browser, name[selector]]]
if name[elems] begin[:]
<ast.Raise ... | keyword[def] identifier[check_no_element_by_selector] ( identifier[self] , identifier[selector] ):
literal[string]
identifier[elems] = identifier[find_elements_by_jquery] ( identifier[world] . identifier[browser] , identifier[selector] )
keyword[if] identifier[elems] :
keyword[raise] identi... | def check_no_element_by_selector(self, selector):
"""Assert an element does not exist matching the given selector."""
elems = find_elements_by_jquery(world.browser, selector)
if elems:
raise AssertionError('Expected no matching elements, found {}.'.format(len(elems))) # depends on [control=['if'], ... |
def define_threshold(dat, s_freq, method, value, nbins=120):
"""Return the value of the threshold based on relative values.
Parameters
----------
dat : ndarray (dtype='float')
vector with the data after selection-transformation
s_freq : float
sampling frequency
method : str
... | def function[define_threshold, parameter[dat, s_freq, method, value, nbins]]:
constant[Return the value of the threshold based on relative values.
Parameters
----------
dat : ndarray (dtype='float')
vector with the data after selection-transformation
s_freq : float
sampling freq... | keyword[def] identifier[define_threshold] ( identifier[dat] , identifier[s_freq] , identifier[method] , identifier[value] , identifier[nbins] = literal[int] ):
literal[string]
keyword[if] identifier[method] == literal[string] :
identifier[value] = identifier[value] * identifier[mean] ( identifier... | def define_threshold(dat, s_freq, method, value, nbins=120):
"""Return the value of the threshold based on relative values.
Parameters
----------
dat : ndarray (dtype='float')
vector with the data after selection-transformation
s_freq : float
sampling frequency
method : str
... |
def mp_spawn(self):
""" Spawn worker processes (using multiprocessing) """
processes = []
for x in range(self.queue_worker_amount):
process = multiprocessing.Process(target=self.mp_worker)
process.start()
processes.append(process)
for process in proces... | def function[mp_spawn, parameter[self]]:
constant[ Spawn worker processes (using multiprocessing) ]
variable[processes] assign[=] list[[]]
for taget[name[x]] in starred[call[name[range], parameter[name[self].queue_worker_amount]]] begin[:]
variable[process] assign[=] call[name[mu... | keyword[def] identifier[mp_spawn] ( identifier[self] ):
literal[string]
identifier[processes] =[]
keyword[for] identifier[x] keyword[in] identifier[range] ( identifier[self] . identifier[queue_worker_amount] ):
identifier[process] = identifier[multiprocessing] . identifier[... | def mp_spawn(self):
""" Spawn worker processes (using multiprocessing) """
processes = []
for x in range(self.queue_worker_amount):
process = multiprocessing.Process(target=self.mp_worker)
process.start()
processes.append(process) # depends on [control=['for'], data=[]]
for proc... |
def prefix_iter(self, ns_uri):
"""Gets an iterator over the prefixes for the given namespace."""
ni = self.__lookup_uri(ns_uri)
return iter(ni.prefixes) | def function[prefix_iter, parameter[self, ns_uri]]:
constant[Gets an iterator over the prefixes for the given namespace.]
variable[ni] assign[=] call[name[self].__lookup_uri, parameter[name[ns_uri]]]
return[call[name[iter], parameter[name[ni].prefixes]]] | keyword[def] identifier[prefix_iter] ( identifier[self] , identifier[ns_uri] ):
literal[string]
identifier[ni] = identifier[self] . identifier[__lookup_uri] ( identifier[ns_uri] )
keyword[return] identifier[iter] ( identifier[ni] . identifier[prefixes] ) | def prefix_iter(self, ns_uri):
"""Gets an iterator over the prefixes for the given namespace."""
ni = self.__lookup_uri(ns_uri)
return iter(ni.prefixes) |
def create(self, client=None):
"""API call: create the zone via a PUT request
See
https://cloud.google.com/dns/api/v1/managedZones/create
:type client: :class:`google.cloud.dns.client.Client`
:param client:
(Optional) the client to use. If not passed, falls back t... | def function[create, parameter[self, client]]:
constant[API call: create the zone via a PUT request
See
https://cloud.google.com/dns/api/v1/managedZones/create
:type client: :class:`google.cloud.dns.client.Client`
:param client:
(Optional) the client to use. If no... | keyword[def] identifier[create] ( identifier[self] , identifier[client] = keyword[None] ):
literal[string]
identifier[client] = identifier[self] . identifier[_require_client] ( identifier[client] )
identifier[path] = literal[string] %( identifier[self] . identifier[project] ,)
ide... | def create(self, client=None):
"""API call: create the zone via a PUT request
See
https://cloud.google.com/dns/api/v1/managedZones/create
:type client: :class:`google.cloud.dns.client.Client`
:param client:
(Optional) the client to use. If not passed, falls back to th... |
def update_deployment_targets(self, machines, project, deployment_group_id):
"""UpdateDeploymentTargets.
[Preview API] Update tags of a list of deployment targets in a deployment group.
:param [DeploymentTargetUpdateParameter] machines: Deployment targets with tags to udpdate.
:param str... | def function[update_deployment_targets, parameter[self, machines, project, deployment_group_id]]:
constant[UpdateDeploymentTargets.
[Preview API] Update tags of a list of deployment targets in a deployment group.
:param [DeploymentTargetUpdateParameter] machines: Deployment targets with tags to ... | keyword[def] identifier[update_deployment_targets] ( identifier[self] , identifier[machines] , identifier[project] , identifier[deployment_group_id] ):
literal[string]
identifier[route_values] ={}
keyword[if] identifier[project] keyword[is] keyword[not] keyword[None] :
ide... | def update_deployment_targets(self, machines, project, deployment_group_id):
"""UpdateDeploymentTargets.
[Preview API] Update tags of a list of deployment targets in a deployment group.
:param [DeploymentTargetUpdateParameter] machines: Deployment targets with tags to udpdate.
:param str pro... |
def get_sort_field(attr, model):
"""
Get's the field to sort on for the given
attr.
Currently returns attr if it is a field on
the given model.
If the models has an attribute matching that name
and that value has an attribute 'sort_field' than
that value is used.
TODO: Provide a w... | def function[get_sort_field, parameter[attr, model]]:
constant[
Get's the field to sort on for the given
attr.
Currently returns attr if it is a field on
the given model.
If the models has an attribute matching that name
and that value has an attribute 'sort_field' than
that value ... | keyword[def] identifier[get_sort_field] ( identifier[attr] , identifier[model] ):
literal[string]
keyword[try] :
keyword[if] identifier[model] . identifier[_meta] . identifier[get_field] ( identifier[attr] ):
keyword[return] identifier[attr]
keyword[except] identifier[FieldD... | def get_sort_field(attr, model):
"""
Get's the field to sort on for the given
attr.
Currently returns attr if it is a field on
the given model.
If the models has an attribute matching that name
and that value has an attribute 'sort_field' than
that value is used.
TODO: Provide a w... |
def _sample_actions(self,
state: Sequence[tf.Tensor]) -> Tuple[Sequence[tf.Tensor], tf.Tensor, tf.Tensor]:
'''Returns sampled action fluents and tensors related to the sampling.
Args:
state (Sequence[tf.Tensor]): A list of state fluents.
Returns:
Tuple[Seque... | def function[_sample_actions, parameter[self, state]]:
constant[Returns sampled action fluents and tensors related to the sampling.
Args:
state (Sequence[tf.Tensor]): A list of state fluents.
Returns:
Tuple[Sequence[tf.Tensor], tf.Tensor, tf.Tensor]: A tuple with
... | keyword[def] identifier[_sample_actions] ( identifier[self] ,
identifier[state] : identifier[Sequence] [ identifier[tf] . identifier[Tensor] ])-> identifier[Tuple] [ identifier[Sequence] [ identifier[tf] . identifier[Tensor] ], identifier[tf] . identifier[Tensor] , identifier[tf] . identifier[Tensor] ]:
lit... | def _sample_actions(self, state: Sequence[tf.Tensor]) -> Tuple[Sequence[tf.Tensor], tf.Tensor, tf.Tensor]:
"""Returns sampled action fluents and tensors related to the sampling.
Args:
state (Sequence[tf.Tensor]): A list of state fluents.
Returns:
Tuple[Sequence[tf.Tensor], ... |
def makeringlatticeCIJ(n, k, seed=None):
'''
This function generates a directed lattice network with toroidal
boundary counditions (i.e. with ring-like "wrapping around").
Parameters
----------
N : int
number of vertices
K : int
number of edges
seed : hashable, optional
... | def function[makeringlatticeCIJ, parameter[n, k, seed]]:
constant[
This function generates a directed lattice network with toroidal
boundary counditions (i.e. with ring-like "wrapping around").
Parameters
----------
N : int
number of vertices
K : int
number of edges
... | keyword[def] identifier[makeringlatticeCIJ] ( identifier[n] , identifier[k] , identifier[seed] = keyword[None] ):
literal[string]
identifier[rng] = identifier[get_rng] ( identifier[seed] )
identifier[CIJ] = identifier[np] . identifier[zeros] (( identifier[n] , identifier[n] ))
identifier[CIJ... | def makeringlatticeCIJ(n, k, seed=None):
"""
This function generates a directed lattice network with toroidal
boundary counditions (i.e. with ring-like "wrapping around").
Parameters
----------
N : int
number of vertices
K : int
number of edges
seed : hashable, optional
... |
def utf8(value):
"""Converts a string argument to a byte string.
If the argument is already a byte string or None, it is returned unchanged.
Otherwise it must be a unicode string and is encoded as utf8.
"""
if isinstance(value, _UTF8_TYPES):
return value
elif isinstance(value, u... | def function[utf8, parameter[value]]:
constant[Converts a string argument to a byte string.
If the argument is already a byte string or None, it is returned unchanged.
Otherwise it must be a unicode string and is encoded as utf8.
]
if call[name[isinstance], parameter[name[value], name[_UTF8... | keyword[def] identifier[utf8] ( identifier[value] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[value] , identifier[_UTF8_TYPES] ):
keyword[return] identifier[value]
keyword[elif] identifier[isinstance] ( identifier[value] , identifier[unicode_type] ):
k... | def utf8(value):
"""Converts a string argument to a byte string.
If the argument is already a byte string or None, it is returned unchanged.
Otherwise it must be a unicode string and is encoded as utf8.
"""
if isinstance(value, _UTF8_TYPES):
return value # depends on [control=['if'], data=... |
def get(key, default=''):
'''
.. versionadded: 0.14.0
Attempt to retrieve the named value from opts, pillar, grains of the master
config, if the named value is not available return the passed default.
The default return is an empty string.
The value can also represent a value in a nested dict ... | def function[get, parameter[key, default]]:
constant[
.. versionadded: 0.14.0
Attempt to retrieve the named value from opts, pillar, grains of the master
config, if the named value is not available return the passed default.
The default return is an empty string.
The value can also represe... | keyword[def] identifier[get] ( identifier[key] , identifier[default] = literal[string] ):
literal[string]
identifier[ret] = identifier[salt] . identifier[utils] . identifier[data] . identifier[traverse_dict_and_list] ( identifier[__opts__] , identifier[key] , literal[string] )
keyword[if] identifier[... | def get(key, default=''):
"""
.. versionadded: 0.14.0
Attempt to retrieve the named value from opts, pillar, grains of the master
config, if the named value is not available return the passed default.
The default return is an empty string.
The value can also represent a value in a nested dict ... |
def ndims(self):
"""Returns the rank of this shape, or None if it is unspecified."""
if self._dims is None:
return None
else:
if self._ndims is None:
self._ndims = len(self._dims)
return self._ndims | def function[ndims, parameter[self]]:
constant[Returns the rank of this shape, or None if it is unspecified.]
if compare[name[self]._dims is constant[None]] begin[:]
return[constant[None]] | keyword[def] identifier[ndims] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_dims] keyword[is] keyword[None] :
keyword[return] keyword[None]
keyword[else] :
keyword[if] identifier[self] . identifier[_ndims] keyword[is] ke... | def ndims(self):
"""Returns the rank of this shape, or None if it is unspecified."""
if self._dims is None:
return None # depends on [control=['if'], data=[]]
else:
if self._ndims is None:
self._ndims = len(self._dims) # depends on [control=['if'], data=[]]
return self.... |
def deduplicate(pairs, aa=False, ignore_primer_regions=False):
'''
Removes duplicate sequences from a list of Pair objects.
If a Pair has heavy and light chains, both chains must identically match heavy and light chains
from another Pair to be considered a duplicate. If a Pair has only a single chain,
... | def function[deduplicate, parameter[pairs, aa, ignore_primer_regions]]:
constant[
Removes duplicate sequences from a list of Pair objects.
If a Pair has heavy and light chains, both chains must identically match heavy and light chains
from another Pair to be considered a duplicate. If a Pair has on... | keyword[def] identifier[deduplicate] ( identifier[pairs] , identifier[aa] = keyword[False] , identifier[ignore_primer_regions] = keyword[False] ):
literal[string]
identifier[nr_pairs] =[]
identifier[just_pairs] =[ identifier[p] keyword[for] identifier[p] keyword[in] identifier[pairs] keyword[if] ... | def deduplicate(pairs, aa=False, ignore_primer_regions=False):
"""
Removes duplicate sequences from a list of Pair objects.
If a Pair has heavy and light chains, both chains must identically match heavy and light chains
from another Pair to be considered a duplicate. If a Pair has only a single chain,
... |
async def get_firmware_version(self):
"""
This method retrieves the Firmata firmware version
:returns: Firmata firmware version
"""
current_time = time.time()
if self.query_reply_data.get(PrivateConstants.REPORT_FIRMWARE) == '':
await self._send_sysex(Private... | <ast.AsyncFunctionDef object at 0x7da18dc9b5b0> | keyword[async] keyword[def] identifier[get_firmware_version] ( identifier[self] ):
literal[string]
identifier[current_time] = identifier[time] . identifier[time] ()
keyword[if] identifier[self] . identifier[query_reply_data] . identifier[get] ( identifier[PrivateConstants] . identifier[R... | async def get_firmware_version(self):
"""
This method retrieves the Firmata firmware version
:returns: Firmata firmware version
"""
current_time = time.time()
if self.query_reply_data.get(PrivateConstants.REPORT_FIRMWARE) == '':
await self._send_sysex(PrivateConstants.REPORT... |
def _expand_alts_and_remove_duplicates_in_list(cls, vcf_records, ref_seq, indel_gap=100):
'''Input: list of VCF records, all from the same CHROM. ref_seq = sequence
of that CHROM. Expands any record in the list that has >ALT, into
one record per ALT. Removes duplicated records, where REF and ALT... | def function[_expand_alts_and_remove_duplicates_in_list, parameter[cls, vcf_records, ref_seq, indel_gap]]:
constant[Input: list of VCF records, all from the same CHROM. ref_seq = sequence
of that CHROM. Expands any record in the list that has >ALT, into
one record per ALT. Removes duplicated rec... | keyword[def] identifier[_expand_alts_and_remove_duplicates_in_list] ( identifier[cls] , identifier[vcf_records] , identifier[ref_seq] , identifier[indel_gap] = literal[int] ):
literal[string]
identifier[expanded_vcf_records] = identifier[VcfClusterer] . identifier[_expand_alts_in_vcf_record_list] (... | def _expand_alts_and_remove_duplicates_in_list(cls, vcf_records, ref_seq, indel_gap=100):
"""Input: list of VCF records, all from the same CHROM. ref_seq = sequence
of that CHROM. Expands any record in the list that has >ALT, into
one record per ALT. Removes duplicated records, where REF and ALT
... |
def run(self, arguments, show_help=True):
"""
Program entry point.
Please note that the first item in ``arguments`` is discarded,
as it is assumed to be the script/invocation name;
pass a "dumb" placeholder if you call this method with
an argument different that ``sys.ar... | def function[run, parameter[self, arguments, show_help]]:
constant[
Program entry point.
Please note that the first item in ``arguments`` is discarded,
as it is assumed to be the script/invocation name;
pass a "dumb" placeholder if you call this method with
an argument d... | keyword[def] identifier[run] ( identifier[self] , identifier[arguments] , identifier[show_help] = keyword[True] ):
literal[string]
keyword[if] identifier[self] . identifier[use_sys] :
keyword[if] keyword[not] identifier[gf] . identifier[FROZEN] :
k... | def run(self, arguments, show_help=True):
"""
Program entry point.
Please note that the first item in ``arguments`` is discarded,
as it is assumed to be the script/invocation name;
pass a "dumb" placeholder if you call this method with
an argument different that ``sys.argv``... |
def delete_collection(db_name, collection_name, host='localhost', port=27017):
"""Almost exclusively for testing."""
client = MongoClient("mongodb://%s:%d" % (host, port))
client[db_name].drop_collection(collection_name) | def function[delete_collection, parameter[db_name, collection_name, host, port]]:
constant[Almost exclusively for testing.]
variable[client] assign[=] call[name[MongoClient], parameter[binary_operation[constant[mongodb://%s:%d] <ast.Mod object at 0x7da2590d6920> tuple[[<ast.Name object at 0x7da2047eb1c0... | keyword[def] identifier[delete_collection] ( identifier[db_name] , identifier[collection_name] , identifier[host] = literal[string] , identifier[port] = literal[int] ):
literal[string]
identifier[client] = identifier[MongoClient] ( literal[string] %( identifier[host] , identifier[port] ))
identifier[c... | def delete_collection(db_name, collection_name, host='localhost', port=27017):
"""Almost exclusively for testing."""
client = MongoClient('mongodb://%s:%d' % (host, port))
client[db_name].drop_collection(collection_name) |
def transformer_latent_decoder(x,
encoder_output,
ed_attention_bias,
hparams,
name=None):
"""Transformer decoder over latents using latent_attention_type.
Args:
x: Tensor of shape [batch,... | def function[transformer_latent_decoder, parameter[x, encoder_output, ed_attention_bias, hparams, name]]:
constant[Transformer decoder over latents using latent_attention_type.
Args:
x: Tensor of shape [batch, length_q, hparams.hidden_size]. length_q is the
latent length, which is
height * wi... | keyword[def] identifier[transformer_latent_decoder] ( identifier[x] ,
identifier[encoder_output] ,
identifier[ed_attention_bias] ,
identifier[hparams] ,
identifier[name] = keyword[None] ):
literal[string]
keyword[with] identifier[tf] . identifier[variable_scope] ( identifier[name] , identifier[default_nam... | def transformer_latent_decoder(x, encoder_output, ed_attention_bias, hparams, name=None):
"""Transformer decoder over latents using latent_attention_type.
Args:
x: Tensor of shape [batch, length_q, hparams.hidden_size]. length_q is the
latent length, which is
height * width * hparams.num_latents ... |
def set_log_type_name(self, logType, name):
"""
Set a logtype name.
:Parameters:
#. logType (string): A defined logging type.
#. name (string): The logtype new name.
"""
assert logType in self.__logTypeStdoutFlags.keys(), "logType '%s' not defined" %logType... | def function[set_log_type_name, parameter[self, logType, name]]:
constant[
Set a logtype name.
:Parameters:
#. logType (string): A defined logging type.
#. name (string): The logtype new name.
]
assert[compare[name[logType] in call[name[self].__logTypeStdoutFla... | keyword[def] identifier[set_log_type_name] ( identifier[self] , identifier[logType] , identifier[name] ):
literal[string]
keyword[assert] identifier[logType] keyword[in] identifier[self] . identifier[__logTypeStdoutFlags] . identifier[keys] (), literal[string] % identifier[logType]
key... | def set_log_type_name(self, logType, name):
"""
Set a logtype name.
:Parameters:
#. logType (string): A defined logging type.
#. name (string): The logtype new name.
"""
assert logType in self.__logTypeStdoutFlags.keys(), "logType '%s' not defined" % logType
as... |
def as_dict(self):
"""
Return a ditionary mapping time slide IDs to offset
dictionaries.
"""
d = {}
for row in self:
if row.time_slide_id not in d:
d[row.time_slide_id] = offsetvector.offsetvector()
if row.instrument in d[row.time_slide_id]:
raise KeyError("'%s': duplicate instrument '%s'" % (... | def function[as_dict, parameter[self]]:
constant[
Return a ditionary mapping time slide IDs to offset
dictionaries.
]
variable[d] assign[=] dictionary[[], []]
for taget[name[row]] in starred[name[self]] begin[:]
if compare[name[row].time_slide_id <ast.NotIn object at 0x7da2... | keyword[def] identifier[as_dict] ( identifier[self] ):
literal[string]
identifier[d] ={}
keyword[for] identifier[row] keyword[in] identifier[self] :
keyword[if] identifier[row] . identifier[time_slide_id] keyword[not] keyword[in] identifier[d] :
identifier[d] [ identifier[row] . identifier[t... | def as_dict(self):
"""
Return a ditionary mapping time slide IDs to offset
dictionaries.
"""
d = {}
for row in self:
if row.time_slide_id not in d:
d[row.time_slide_id] = offsetvector.offsetvector() # depends on [control=['if'], data=['d']]
if row.instrument in d[row.time_... |
def create_info_endpoint(self, name, data):
"""Create an endpoint to serve info GET requests."""
# make sure data is serializable
data = make_serializable(data)
# create generic restful resource to serve static JSON data
class InfoBase(Resource):
@staticmethod
... | def function[create_info_endpoint, parameter[self, name, data]]:
constant[Create an endpoint to serve info GET requests.]
variable[data] assign[=] call[name[make_serializable], parameter[name[data]]]
class class[InfoBase, parameter[]] begin[:]
def function[get, parameter[]]:
... | keyword[def] identifier[create_info_endpoint] ( identifier[self] , identifier[name] , identifier[data] ):
literal[string]
identifier[data] = identifier[make_serializable] ( identifier[data] )
keyword[class] identifier[InfoBase] ( identifier[Resource] ):
@ id... | def create_info_endpoint(self, name, data):
"""Create an endpoint to serve info GET requests."""
# make sure data is serializable
data = make_serializable(data)
# create generic restful resource to serve static JSON data
class InfoBase(Resource):
@staticmethod
def get():
... |
def fromtabix(filename, reference=None, start=None, stop=None, region=None,
header=None):
"""
Extract rows from a tabix indexed file, e.g.::
>>> import petl as etl
>>> # activate bio extensions
... import petlx.bio
>>> table1 = etl.fromtabix('fixture/test.bed.gz',
... | def function[fromtabix, parameter[filename, reference, start, stop, region, header]]:
constant[
Extract rows from a tabix indexed file, e.g.::
>>> import petl as etl
>>> # activate bio extensions
... import petlx.bio
>>> table1 = etl.fromtabix('fixture/test.bed.gz',
... | keyword[def] identifier[fromtabix] ( identifier[filename] , identifier[reference] = keyword[None] , identifier[start] = keyword[None] , identifier[stop] = keyword[None] , identifier[region] = keyword[None] ,
identifier[header] = keyword[None] ):
literal[string]
keyword[return] identifier[TabixView] ( id... | def fromtabix(filename, reference=None, start=None, stop=None, region=None, header=None):
"""
Extract rows from a tabix indexed file, e.g.::
>>> import petl as etl
>>> # activate bio extensions
... import petlx.bio
>>> table1 = etl.fromtabix('fixture/test.bed.gz',
... ... |
def word_similarity_explorer(corpus,
category,
category_name,
not_category_name,
target_term,
nlp=None,
alpha=0.01,
m... | def function[word_similarity_explorer, parameter[corpus, category, category_name, not_category_name, target_term, nlp, alpha, max_p_val]]:
constant[
Parameters
----------
corpus : Corpus
Corpus to use.
category : str
Name of category column as it appears in original data frame.
... | keyword[def] identifier[word_similarity_explorer] ( identifier[corpus] ,
identifier[category] ,
identifier[category_name] ,
identifier[not_category_name] ,
identifier[target_term] ,
identifier[nlp] = keyword[None] ,
identifier[alpha] = literal[int] ,
identifier[max_p_val] = literal[int] ,
** identifier[kwargs]... | def word_similarity_explorer(corpus, category, category_name, not_category_name, target_term, nlp=None, alpha=0.01, max_p_val=0.1, **kwargs):
"""
Parameters
----------
corpus : Corpus
Corpus to use.
category : str
Name of category column as it appears in original data frame.
cate... |
def load_system_host_keys(self, filename=None):
"""
Load host keys from a system (read-only) file. Host keys read with
this method will not be saved back by `save_host_keys`.
This method can be called multiple times. Each new set of host keys
will be merged with the existing s... | def function[load_system_host_keys, parameter[self, filename]]:
constant[
Load host keys from a system (read-only) file. Host keys read with
this method will not be saved back by `save_host_keys`.
This method can be called multiple times. Each new set of host keys
will be merg... | keyword[def] identifier[load_system_host_keys] ( identifier[self] , identifier[filename] = keyword[None] ):
literal[string]
keyword[if] identifier[filename] keyword[is] keyword[None] :
identifier[filename] = identifier[os] . identifier[path] . identifier[expanduser] ( liter... | def load_system_host_keys(self, filename=None):
"""
Load host keys from a system (read-only) file. Host keys read with
this method will not be saved back by `save_host_keys`.
This method can be called multiple times. Each new set of host keys
will be merged with the existing set (... |
def _get_changes_from_diff_dict(diff_dict):
'''
Returns a list of string message of the differences in a diff dict.
Each inner message is tabulated one tab deeper
'''
changes_strings = []
for p in diff_dict.keys():
if not isinstance(diff_dict[p], dict):
raise ValueError('Une... | def function[_get_changes_from_diff_dict, parameter[diff_dict]]:
constant[
Returns a list of string message of the differences in a diff dict.
Each inner message is tabulated one tab deeper
]
variable[changes_strings] assign[=] list[[]]
for taget[name[p]] in starred[call[name[diff_d... | keyword[def] identifier[_get_changes_from_diff_dict] ( identifier[diff_dict] ):
literal[string]
identifier[changes_strings] =[]
keyword[for] identifier[p] keyword[in] identifier[diff_dict] . identifier[keys] ():
keyword[if] keyword[not] identifier[isinstance] ( identifier[diff_dict] [ id... | def _get_changes_from_diff_dict(diff_dict):
"""
Returns a list of string message of the differences in a diff dict.
Each inner message is tabulated one tab deeper
"""
changes_strings = []
for p in diff_dict.keys():
if not isinstance(diff_dict[p], dict):
raise ValueError("Une... |
def filter_image(im_name, out_base, step_size=None, box_size=None, twopass=False, cores=None, mask=True, compressed=False, nslice=None):
"""
Create a background and noise image from an input image.
Resulting images are written to `outbase_bkg.fits` and `outbase_rms.fits`
Parameters
----------
i... | def function[filter_image, parameter[im_name, out_base, step_size, box_size, twopass, cores, mask, compressed, nslice]]:
constant[
Create a background and noise image from an input image.
Resulting images are written to `outbase_bkg.fits` and `outbase_rms.fits`
Parameters
----------
im_name... | keyword[def] identifier[filter_image] ( identifier[im_name] , identifier[out_base] , identifier[step_size] = keyword[None] , identifier[box_size] = keyword[None] , identifier[twopass] = keyword[False] , identifier[cores] = keyword[None] , identifier[mask] = keyword[True] , identifier[compressed] = keyword[False] , id... | def filter_image(im_name, out_base, step_size=None, box_size=None, twopass=False, cores=None, mask=True, compressed=False, nslice=None):
"""
Create a background and noise image from an input image.
Resulting images are written to `outbase_bkg.fits` and `outbase_rms.fits`
Parameters
----------
i... |
def get_task(self, task_id):
"""Get task meta for task by ``task_id``.
:keyword exception_retry_count: How many times to retry by
transaction rollback on exception. This could theoretically
happen in a race condition if another worker is trying to
create the same tas... | def function[get_task, parameter[self, task_id]]:
constant[Get task meta for task by ``task_id``.
:keyword exception_retry_count: How many times to retry by
transaction rollback on exception. This could theoretically
happen in a race condition if another worker is trying to
... | keyword[def] identifier[get_task] ( identifier[self] , identifier[task_id] ):
literal[string]
keyword[try] :
keyword[return] identifier[self] . identifier[get] ( identifier[task_id] = identifier[task_id] )
keyword[except] identifier[self] . identifier[model] . identifier[Doe... | def get_task(self, task_id):
"""Get task meta for task by ``task_id``.
:keyword exception_retry_count: How many times to retry by
transaction rollback on exception. This could theoretically
happen in a race condition if another worker is trying to
create the same task. T... |
def get_reminders_per_page(self, per_page=1000, page=1, params=None):
"""
Get reminders per page
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:param params: Search parameters. Default: {}
:return: list
"""
... | def function[get_reminders_per_page, parameter[self, per_page, page, params]]:
constant[
Get reminders per page
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:param params: Search parameters. Default: {}
:return: list
... | keyword[def] identifier[get_reminders_per_page] ( identifier[self] , identifier[per_page] = literal[int] , identifier[page] = literal[int] , identifier[params] = keyword[None] ):
literal[string]
keyword[return] identifier[self] . identifier[_get_resource_per_page] ( identifier[resource] = identifi... | def get_reminders_per_page(self, per_page=1000, page=1, params=None):
"""
Get reminders per page
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:param params: Search parameters. Default: {}
:return: list
"""
return s... |
def add_cset_entries(self, ordered_rev_list, timestamp=False, number_forward=True):
'''
Adds a list of revisions to the table. Assumes ordered_rev_list is an ordered
based on how changesets are found in the changelog. Going forwards or backwards is dealt
with by flipping the list
... | def function[add_cset_entries, parameter[self, ordered_rev_list, timestamp, number_forward]]:
constant[
Adds a list of revisions to the table. Assumes ordered_rev_list is an ordered
based on how changesets are found in the changelog. Going forwards or backwards is dealt
with by flipping ... | keyword[def] identifier[add_cset_entries] ( identifier[self] , identifier[ordered_rev_list] , identifier[timestamp] = keyword[False] , identifier[number_forward] = keyword[True] ):
literal[string]
keyword[with] identifier[self] . identifier[conn] . identifier[transaction] () keyword[as] identifie... | def add_cset_entries(self, ordered_rev_list, timestamp=False, number_forward=True):
"""
Adds a list of revisions to the table. Assumes ordered_rev_list is an ordered
based on how changesets are found in the changelog. Going forwards or backwards is dealt
with by flipping the list
:pa... |
def get_branch_mutation_matrix(self, node, full_sequence=False):
"""uses results from marginal ancestral inference to return a joint
distribution of the sequence states at both ends of the branch.
Parameters
----------
node : Phylo.clade
node of the tree
full... | def function[get_branch_mutation_matrix, parameter[self, node, full_sequence]]:
constant[uses results from marginal ancestral inference to return a joint
distribution of the sequence states at both ends of the branch.
Parameters
----------
node : Phylo.clade
node of ... | keyword[def] identifier[get_branch_mutation_matrix] ( identifier[self] , identifier[node] , identifier[full_sequence] = keyword[False] ):
literal[string]
identifier[pp] , identifier[pc] = identifier[self] . identifier[marginal_branch_profile] ( identifier[node] )
identifier[expQt... | def get_branch_mutation_matrix(self, node, full_sequence=False):
"""uses results from marginal ancestral inference to return a joint
distribution of the sequence states at both ends of the branch.
Parameters
----------
node : Phylo.clade
node of the tree
full_seq... |
def extractClips(self, specsFilePathOrStr, outputDir=None, zipOutput=False):
"""Extract clips according to the specification file or string.
Arguments:
specsFilePathOrStr (str): Specification file path or string
outputDir (str): Location of the extracted clips
... | def function[extractClips, parameter[self, specsFilePathOrStr, outputDir, zipOutput]]:
constant[Extract clips according to the specification file or string.
Arguments:
specsFilePathOrStr (str): Specification file path or string
outputDir (str): Location of the extracted ... | keyword[def] identifier[extractClips] ( identifier[self] , identifier[specsFilePathOrStr] , identifier[outputDir] = keyword[None] , identifier[zipOutput] = keyword[False] ):
literal[string]
identifier[clips] = identifier[SpecsParser] . identifier[parse] ( identifier[specsFilePathOrStr] )
... | def extractClips(self, specsFilePathOrStr, outputDir=None, zipOutput=False):
"""Extract clips according to the specification file or string.
Arguments:
specsFilePathOrStr (str): Specification file path or string
outputDir (str): Location of the extracted clips
zi... |
def _get_base_defaultLayer(self):
"""
This is the environment implementation of
:attr:`BaseFont.defaultLayer`. Return the
default layer as a :class:`BaseLayer` object.
The layer will be normalized with
:func:`normalizers.normalizeLayer`.
Subclasses must override ... | def function[_get_base_defaultLayer, parameter[self]]:
constant[
This is the environment implementation of
:attr:`BaseFont.defaultLayer`. Return the
default layer as a :class:`BaseLayer` object.
The layer will be normalized with
:func:`normalizers.normalizeLayer`.
... | keyword[def] identifier[_get_base_defaultLayer] ( identifier[self] ):
literal[string]
identifier[name] = identifier[self] . identifier[defaultLayerName]
identifier[layer] = identifier[self] . identifier[getLayer] ( identifier[name] )
keyword[return] identifier[layer] | def _get_base_defaultLayer(self):
"""
This is the environment implementation of
:attr:`BaseFont.defaultLayer`. Return the
default layer as a :class:`BaseLayer` object.
The layer will be normalized with
:func:`normalizers.normalizeLayer`.
Subclasses must override this... |
def decode(codec, stream, image):
"""Reads an entire image.
Wraps the openjp2 library function opj_decode.
Parameters
----------
codec : CODEC_TYPE
The JPEG2000 codec
stream : STREAM_TYPE_P
The stream to decode.
image : ImageType
Output image structure.
Raises
... | def function[decode, parameter[codec, stream, image]]:
constant[Reads an entire image.
Wraps the openjp2 library function opj_decode.
Parameters
----------
codec : CODEC_TYPE
The JPEG2000 codec
stream : STREAM_TYPE_P
The stream to decode.
image : ImageType
Outpu... | keyword[def] identifier[decode] ( identifier[codec] , identifier[stream] , identifier[image] ):
literal[string]
identifier[OPENJP2] . identifier[opj_decode] . identifier[argtypes] =[ identifier[CODEC_TYPE] , identifier[STREAM_TYPE_P] ,
identifier[ctypes] . identifier[POINTER] ( identifier[ImageType] )... | def decode(codec, stream, image):
"""Reads an entire image.
Wraps the openjp2 library function opj_decode.
Parameters
----------
codec : CODEC_TYPE
The JPEG2000 codec
stream : STREAM_TYPE_P
The stream to decode.
image : ImageType
Output image structure.
Raises
... |
def read_file(self, file_name, section=None):
"""Read settings from specified ``section`` of config file."""
file_name, section = self.parse_file_name_and_section(file_name, section)
if not os.path.isfile(file_name):
raise SettingsFileNotFoundError(file_name)
parser = self.ma... | def function[read_file, parameter[self, file_name, section]]:
constant[Read settings from specified ``section`` of config file.]
<ast.Tuple object at 0x7da204960070> assign[=] call[name[self].parse_file_name_and_section, parameter[name[file_name], name[section]]]
if <ast.UnaryOp object at 0x7da2... | keyword[def] identifier[read_file] ( identifier[self] , identifier[file_name] , identifier[section] = keyword[None] ):
literal[string]
identifier[file_name] , identifier[section] = identifier[self] . identifier[parse_file_name_and_section] ( identifier[file_name] , identifier[section] )
ke... | def read_file(self, file_name, section=None):
"""Read settings from specified ``section`` of config file."""
(file_name, section) = self.parse_file_name_and_section(file_name, section)
if not os.path.isfile(file_name):
raise SettingsFileNotFoundError(file_name) # depends on [control=['if'], data=[]... |
def create_dataset(self, owner_id, **kwargs):
"""Create a new dataset
:param owner_id: Username of the owner of the new dataset
:type owner_id: str
:param title: Dataset title (will be used to generate dataset id on
creation)
:type title: str
:param descripti... | def function[create_dataset, parameter[self, owner_id]]:
constant[Create a new dataset
:param owner_id: Username of the owner of the new dataset
:type owner_id: str
:param title: Dataset title (will be used to generate dataset id on
creation)
:type title: str
... | keyword[def] identifier[create_dataset] ( identifier[self] , identifier[owner_id] ,** identifier[kwargs] ):
literal[string]
identifier[request] = identifier[self] . identifier[__build_dataset_obj] (
keyword[lambda] : identifier[_swagger] . identifier[DatasetCreateRequest] (
identi... | def create_dataset(self, owner_id, **kwargs):
"""Create a new dataset
:param owner_id: Username of the owner of the new dataset
:type owner_id: str
:param title: Dataset title (will be used to generate dataset id on
creation)
:type title: str
:param description: ... |
def _import_templates(force=False):
"""Import templates from disk into database
Reads all templates from disk and adds them to the database. By default, any template that has been modified by
the user will not be updated. This can however be changed by setting `force` to `True`, which causes all templates
... | def function[_import_templates, parameter[force]]:
constant[Import templates from disk into database
Reads all templates from disk and adds them to the database. By default, any template that has been modified by
the user will not be updated. This can however be changed by setting `force` to `True`, wh... | keyword[def] identifier[_import_templates] ( identifier[force] = keyword[False] ):
literal[string]
identifier[tmplpath] = identifier[os] . identifier[path] . identifier[join] ( identifier[resource_filename] ( literal[string] , literal[string] ), literal[string] )
identifier[disk_templates] ={ identifi... | def _import_templates(force=False):
"""Import templates from disk into database
Reads all templates from disk and adds them to the database. By default, any template that has been modified by
the user will not be updated. This can however be changed by setting `force` to `True`, which causes all templates
... |
def evaluate_service_changes(services, envs, repo_root, func):
"""
Given a dict of services, and a list of environments, apply the diff
function to evaluate the differences between the target environments
and the rendered templates.
Sub-services (names with '.' in them) are skipped.
"""
for... | def function[evaluate_service_changes, parameter[services, envs, repo_root, func]]:
constant[
Given a dict of services, and a list of environments, apply the diff
function to evaluate the differences between the target environments
and the rendered templates.
Sub-services (names with '.' in the... | keyword[def] identifier[evaluate_service_changes] ( identifier[services] , identifier[envs] , identifier[repo_root] , identifier[func] ):
literal[string]
keyword[for] identifier[service_name] , identifier[service] keyword[in] identifier[services] . identifier[iteritems] ():
keyword[for] ident... | def evaluate_service_changes(services, envs, repo_root, func):
"""
Given a dict of services, and a list of environments, apply the diff
function to evaluate the differences between the target environments
and the rendered templates.
Sub-services (names with '.' in them) are skipped.
"""
for... |
def get_function_from_bot_intent_trigger(self, event):
"""
For the given event build ARN and return the configured function
"""
intent = event.get('currentIntent')
if intent:
intent = intent.get('name')
if intent:
return self.settings.AWS_B... | def function[get_function_from_bot_intent_trigger, parameter[self, event]]:
constant[
For the given event build ARN and return the configured function
]
variable[intent] assign[=] call[name[event].get, parameter[constant[currentIntent]]]
if name[intent] begin[:]
v... | keyword[def] identifier[get_function_from_bot_intent_trigger] ( identifier[self] , identifier[event] ):
literal[string]
identifier[intent] = identifier[event] . identifier[get] ( literal[string] )
keyword[if] identifier[intent] :
identifier[intent] = identifier[intent] . iden... | def get_function_from_bot_intent_trigger(self, event):
"""
For the given event build ARN and return the configured function
"""
intent = event.get('currentIntent')
if intent:
intent = intent.get('name')
if intent:
return self.settings.AWS_BOT_EVENT_MAPPING.get('{}... |
def add(
self,
method=None, # method or ``Response``
url=None,
body="",
adding_headers=None,
*args,
**kwargs
):
"""
A basic request:
>>> responses.add(responses.GET, 'http://example.com')
You can also directly pass an object ... | def function[add, parameter[self, method, url, body, adding_headers]]:
constant[
A basic request:
>>> responses.add(responses.GET, 'http://example.com')
You can also directly pass an object which implements the
``BaseResponse`` interface:
>>> responses.add(Response(...... | keyword[def] identifier[add] (
identifier[self] ,
identifier[method] = keyword[None] ,
identifier[url] = keyword[None] ,
identifier[body] = literal[string] ,
identifier[adding_headers] = keyword[None] ,
* identifier[args] ,
** identifier[kwargs]
):
literal[string]
keyword[if] identifier[isin... | def add(self, method=None, url=None, body='', adding_headers=None, *args, **kwargs): # method or ``Response``
"\n A basic request:\n\n >>> responses.add(responses.GET, 'http://example.com')\n\n You can also directly pass an object which implements the\n ``BaseResponse`` interface:\n\n ... |
def check_dependencies(dependencies, module):
"""
Ensure dependencies of a module are listed in settings.INSTALLED_APPS
:dependencies string | list: list of dependencies to check
:module string: string representing the path to the current app
"""
if type(dependencies) == str:
dependenci... | def function[check_dependencies, parameter[dependencies, module]]:
constant[
Ensure dependencies of a module are listed in settings.INSTALLED_APPS
:dependencies string | list: list of dependencies to check
:module string: string representing the path to the current app
]
if compare[call... | keyword[def] identifier[check_dependencies] ( identifier[dependencies] , identifier[module] ):
literal[string]
keyword[if] identifier[type] ( identifier[dependencies] )== identifier[str] :
identifier[dependencies] =[ identifier[dependencies] ]
keyword[elif] identifier[type] ( identifier[dep... | def check_dependencies(dependencies, module):
"""
Ensure dependencies of a module are listed in settings.INSTALLED_APPS
:dependencies string | list: list of dependencies to check
:module string: string representing the path to the current app
"""
if type(dependencies) == str:
dependenci... |
def validate_svc_catalog_endpoint_data(self, expected, actual,
openstack_release=None):
"""Validate service catalog endpoint data. Pick the correct validator
for the OpenStack version. Expected data should be in the v2 format:
{
'se... | def function[validate_svc_catalog_endpoint_data, parameter[self, expected, actual, openstack_release]]:
constant[Validate service catalog endpoint data. Pick the correct validator
for the OpenStack version. Expected data should be in the v2 format:
{
'service_name1': [
... | keyword[def] identifier[validate_svc_catalog_endpoint_data] ( identifier[self] , identifier[expected] , identifier[actual] ,
identifier[openstack_release] = keyword[None] ):
literal[string]
identifier[validation_function] = identifier[self] . identifier[validate_v2_svc_catalog_endpoint_data]
... | def validate_svc_catalog_endpoint_data(self, expected, actual, openstack_release=None):
"""Validate service catalog endpoint data. Pick the correct validator
for the OpenStack version. Expected data should be in the v2 format:
{
'service_name1': [
{
... |
def walk_paths(self,
base: Optional[pathlib.PurePath] = pathlib.PurePath()) \
-> Iterator[pathlib.PurePath]:
"""
Recursively traverse all paths inside this entity, including the entity
itself.
:param base: The base path to prepend to the entity name.
... | def function[walk_paths, parameter[self, base]]:
constant[
Recursively traverse all paths inside this entity, including the entity
itself.
:param base: The base path to prepend to the entity name.
:return: An iterator of paths.
]
<ast.Raise object at 0x7da1b242ae00> | keyword[def] identifier[walk_paths] ( identifier[self] ,
identifier[base] : identifier[Optional] [ identifier[pathlib] . identifier[PurePath] ]= identifier[pathlib] . identifier[PurePath] ())-> identifier[Iterator] [ identifier[pathlib] . identifier[PurePath] ]:
literal[string]
keyword[raise] ide... | def walk_paths(self, base: Optional[pathlib.PurePath]=pathlib.PurePath()) -> Iterator[pathlib.PurePath]:
"""
Recursively traverse all paths inside this entity, including the entity
itself.
:param base: The base path to prepend to the entity name.
:return: An iterator of paths.
... |
def run(self, node):
"""
Captures the use of exclude in ModelForm Meta
"""
if not self.checker_applies(node):
return
issues = []
for body in node.body:
if not isinstance(body, ast.ClassDef):
continue
for element in body... | def function[run, parameter[self, node]]:
constant[
Captures the use of exclude in ModelForm Meta
]
if <ast.UnaryOp object at 0x7da1b0780970> begin[:]
return[None]
variable[issues] assign[=] list[[]]
for taget[name[body]] in starred[name[node].body] begin[:]
... | keyword[def] identifier[run] ( identifier[self] , identifier[node] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[checker_applies] ( identifier[node] ):
keyword[return]
identifier[issues] =[]
keyword[for] identifier[body] keyword[in] ... | def run(self, node):
"""
Captures the use of exclude in ModelForm Meta
"""
if not self.checker_applies(node):
return # depends on [control=['if'], data=[]]
issues = []
for body in node.body:
if not isinstance(body, ast.ClassDef):
continue # depends on [contr... |
def print_usage(actions):
"""Print the usage information. (Help screen)"""
actions = actions.items()
actions.sort()
print('usage: %s <action> [<options>]' % basename(sys.argv[0]))
print(' %s --help' % basename(sys.argv[0]))
print()
print('actions:')
for name, (func, doc, arguments... | def function[print_usage, parameter[actions]]:
constant[Print the usage information. (Help screen)]
variable[actions] assign[=] call[name[actions].items, parameter[]]
call[name[actions].sort, parameter[]]
call[name[print], parameter[binary_operation[constant[usage: %s <action> [<options... | keyword[def] identifier[print_usage] ( identifier[actions] ):
literal[string]
identifier[actions] = identifier[actions] . identifier[items] ()
identifier[actions] . identifier[sort] ()
identifier[print] ( literal[string] % identifier[basename] ( identifier[sys] . identifier[argv] [ literal[int] ]... | def print_usage(actions):
"""Print the usage information. (Help screen)"""
actions = actions.items()
actions.sort()
print('usage: %s <action> [<options>]' % basename(sys.argv[0]))
print(' %s --help' % basename(sys.argv[0]))
print()
print('actions:')
for (name, (func, doc, argument... |
def _symbol_bottom_simple(x, model_hparams, vocab_size, name, reuse):
"""Bottom transformation for symbols."""
with tf.variable_scope(name, reuse=reuse):
# Ensure the inputs are 3-D
if len(x.get_shape()) == 4:
x = tf.squeeze(x, axis=3)
while len(x.get_shape()) < 3:
x = tf.expand_dims(x, axis... | def function[_symbol_bottom_simple, parameter[x, model_hparams, vocab_size, name, reuse]]:
constant[Bottom transformation for symbols.]
with call[name[tf].variable_scope, parameter[name[name]]] begin[:]
if compare[call[name[len], parameter[call[name[x].get_shape, parameter[]]]] equal[==]... | keyword[def] identifier[_symbol_bottom_simple] ( identifier[x] , identifier[model_hparams] , identifier[vocab_size] , identifier[name] , identifier[reuse] ):
literal[string]
keyword[with] identifier[tf] . identifier[variable_scope] ( identifier[name] , identifier[reuse] = identifier[reuse] ):
keyword[... | def _symbol_bottom_simple(x, model_hparams, vocab_size, name, reuse):
"""Bottom transformation for symbols."""
with tf.variable_scope(name, reuse=reuse):
# Ensure the inputs are 3-D
if len(x.get_shape()) == 4:
x = tf.squeeze(x, axis=3) # depends on [control=['if'], data=[]]
... |
def get_constituents(self, index_ticker, date=None, only_list=False):
""" Get a list of all constituents of a given index.
index_ticker - Datastream ticker for index
date - date for which list should be retrieved (if None then
list of present constitue... | def function[get_constituents, parameter[self, index_ticker, date, only_list]]:
constant[ Get a list of all constituents of a given index.
index_ticker - Datastream ticker for index
date - date for which list should be retrieved (if None then
list of p... | keyword[def] identifier[get_constituents] ( identifier[self] , identifier[index_ticker] , identifier[date] = keyword[None] , identifier[only_list] = keyword[False] ):
literal[string]
keyword[if] identifier[date] keyword[is] keyword[not] keyword[None] :
identifier[str_date] = identi... | def get_constituents(self, index_ticker, date=None, only_list=False):
""" Get a list of all constituents of a given index.
index_ticker - Datastream ticker for index
date - date for which list should be retrieved (if None then
list of present constituents ... |
def rouge_2_fscore(predictions, labels, **unused_kwargs):
"""ROUGE-2 F1 score computation between labels and predictions.
This is an approximate ROUGE scoring method since we do not glue word pieces
or decode the ids and tokenize the output.
Args:
predictions: tensor, model predictions
labels: tensor,... | def function[rouge_2_fscore, parameter[predictions, labels]]:
constant[ROUGE-2 F1 score computation between labels and predictions.
This is an approximate ROUGE scoring method since we do not glue word pieces
or decode the ids and tokenize the output.
Args:
predictions: tensor, model predictions
... | keyword[def] identifier[rouge_2_fscore] ( identifier[predictions] , identifier[labels] ,** identifier[unused_kwargs] ):
literal[string]
identifier[outputs] = identifier[tf] . identifier[to_int32] ( identifier[tf] . identifier[argmax] ( identifier[predictions] , identifier[axis] =- literal[int] ))
identi... | def rouge_2_fscore(predictions, labels, **unused_kwargs):
"""ROUGE-2 F1 score computation between labels and predictions.
This is an approximate ROUGE scoring method since we do not glue word pieces
or decode the ids and tokenize the output.
Args:
predictions: tensor, model predictions
labels: tenso... |
def asyncWrite(self):
"""
A function to write files asynchronously to the job store such that subsequent jobs are
not delayed by a long write operation.
"""
try:
while True:
try:
# Block for up to two seconds waiting for a file
... | def function[asyncWrite, parameter[self]]:
constant[
A function to write files asynchronously to the job store such that subsequent jobs are
not delayed by a long write operation.
]
<ast.Try object at 0x7da20c6a9090> | keyword[def] identifier[asyncWrite] ( identifier[self] ):
literal[string]
keyword[try] :
keyword[while] keyword[True] :
keyword[try] :
identifier[args] = identifier[self] . identifier[queue] . identifier[get] ( identifier[timeout]... | def asyncWrite(self):
"""
A function to write files asynchronously to the job store such that subsequent jobs are
not delayed by a long write operation.
"""
try:
while True:
try:
# Block for up to two seconds waiting for a file
args = s... |
def gru(name, input, state, kernel_r, kernel_u, kernel_c, bias_r, bias_u, bias_c, new_state, number_of_gates = 2):
''' - zt = f(Xt*Wz + Ht_1*Rz + Wbz + Rbz)
- rt = f(Xt*Wr + Ht_1*Rr + Wbr + Rbr)
- ht = g(Xt*Wh + (rt . Ht_1)*Rh + Rbh + Wbh)
- Ht = (1-zt).ht + zt.Ht_1
'''
... | def function[gru, parameter[name, input, state, kernel_r, kernel_u, kernel_c, bias_r, bias_u, bias_c, new_state, number_of_gates]]:
constant[ - zt = f(Xt*Wz + Ht_1*Rz + Wbz + Rbz)
- rt = f(Xt*Wr + Ht_1*Rr + Wbr + Rbr)
- ht = g(Xt*Wh + (rt . Ht_1)*Rh + Rbh + Wbh)
- Ht = (1-z... | keyword[def] identifier[gru] ( identifier[name] , identifier[input] , identifier[state] , identifier[kernel_r] , identifier[kernel_u] , identifier[kernel_c] , identifier[bias_r] , identifier[bias_u] , identifier[bias_c] , identifier[new_state] , identifier[number_of_gates] = literal[int] ):
literal[string]
... | def gru(name, input, state, kernel_r, kernel_u, kernel_c, bias_r, bias_u, bias_c, new_state, number_of_gates=2):
""" - zt = f(Xt*Wz + Ht_1*Rz + Wbz + Rbz)
- rt = f(Xt*Wr + Ht_1*Rr + Wbr + Rbr)
- ht = g(Xt*Wh + (rt . Ht_1)*Rh + Rbh + Wbh)
- Ht = (1-zt).ht + zt.Ht_1
"""
n... |
def configure_app(**kwargs):
"""Builds up the settings using the same method as logan"""
sys_args = sys.argv
args, command, command_args = parse_args(sys_args[1:])
parser = OptionParser()
parser.add_option('--config', metavar='CONFIG')
(options, logan_args) = parser.parse_args(args)
config_p... | def function[configure_app, parameter[]]:
constant[Builds up the settings using the same method as logan]
variable[sys_args] assign[=] name[sys].argv
<ast.Tuple object at 0x7da20c993460> assign[=] call[name[parse_args], parameter[call[name[sys_args]][<ast.Slice object at 0x7da20c990e50>]]]
... | keyword[def] identifier[configure_app] (** identifier[kwargs] ):
literal[string]
identifier[sys_args] = identifier[sys] . identifier[argv]
identifier[args] , identifier[command] , identifier[command_args] = identifier[parse_args] ( identifier[sys_args] [ literal[int] :])
identifier[parser] = ide... | def configure_app(**kwargs):
"""Builds up the settings using the same method as logan"""
sys_args = sys.argv
(args, command, command_args) = parse_args(sys_args[1:])
parser = OptionParser()
parser.add_option('--config', metavar='CONFIG')
(options, logan_args) = parser.parse_args(args)
config... |
def isInstalledBuild(self):
"""
Determines if the Engine is an Installed Build
"""
sentinelFile = os.path.join(self.getEngineRoot(), 'Engine', 'Build', 'InstalledBuild.txt')
return os.path.exists(sentinelFile) | def function[isInstalledBuild, parameter[self]]:
constant[
Determines if the Engine is an Installed Build
]
variable[sentinelFile] assign[=] call[name[os].path.join, parameter[call[name[self].getEngineRoot, parameter[]], constant[Engine], constant[Build], constant[InstalledBuild.txt]]]
return[ca... | keyword[def] identifier[isInstalledBuild] ( identifier[self] ):
literal[string]
identifier[sentinelFile] = identifier[os] . identifier[path] . identifier[join] ( identifier[self] . identifier[getEngineRoot] (), literal[string] , literal[string] , literal[string] )
keyword[return] identifier[os] . identifie... | def isInstalledBuild(self):
"""
Determines if the Engine is an Installed Build
"""
sentinelFile = os.path.join(self.getEngineRoot(), 'Engine', 'Build', 'InstalledBuild.txt')
return os.path.exists(sentinelFile) |
def deploy_file(file_path, bucket):
""" Uploads a file to an S3 bucket, as a public file. """
# Paths look like:
# index.html
# css/bootstrap.min.css
logger.info("Deploying {0}".format(file_path))
# Upload the actual file to file_path
k = Key(bucket)
k.key = file_path
try:
... | def function[deploy_file, parameter[file_path, bucket]]:
constant[ Uploads a file to an S3 bucket, as a public file. ]
call[name[logger].info, parameter[call[constant[Deploying {0}].format, parameter[name[file_path]]]]]
variable[k] assign[=] call[name[Key], parameter[name[bucket]]]
name[... | keyword[def] identifier[deploy_file] ( identifier[file_path] , identifier[bucket] ):
literal[string]
identifier[logger] . identifier[info] ( literal[string] . identifier[format] ( identifier[file_path] ))
identifier[k] = identifier[Key] ( identifier[bucket] )
identifier[k] ... | def deploy_file(file_path, bucket):
""" Uploads a file to an S3 bucket, as a public file. """
# Paths look like:
# index.html
# css/bootstrap.min.css
logger.info('Deploying {0}'.format(file_path))
# Upload the actual file to file_path
k = Key(bucket)
k.key = file_path
try:
... |
def approveproposal(self, proposal_ids, account=None, approver=None, **kwargs):
""" Approve Proposal
:param list proposal_id: Ids of the proposals
:param str appprover: The account or key to use for approval
(defaults to ``account``)
:param str account: (opti... | def function[approveproposal, parameter[self, proposal_ids, account, approver]]:
constant[ Approve Proposal
:param list proposal_id: Ids of the proposals
:param str appprover: The account or key to use for approval
(defaults to ``account``)
:param str account... | keyword[def] identifier[approveproposal] ( identifier[self] , identifier[proposal_ids] , identifier[account] = keyword[None] , identifier[approver] = keyword[None] ,** identifier[kwargs] ):
literal[string]
keyword[from] . identifier[proposal] keyword[import] identifier[Proposal]
keywor... | def approveproposal(self, proposal_ids, account=None, approver=None, **kwargs):
""" Approve Proposal
:param list proposal_id: Ids of the proposals
:param str appprover: The account or key to use for approval
(defaults to ``account``)
:param str account: (optional... |
def table(self):
"""Return a large string of the entire table ready to be printed to the terminal."""
ascii_table = super(UnixTable, self).table
optimized = ascii_table.replace('\033(B\033(0', '')
return optimized | def function[table, parameter[self]]:
constant[Return a large string of the entire table ready to be printed to the terminal.]
variable[ascii_table] assign[=] call[name[super], parameter[name[UnixTable], name[self]]].table
variable[optimized] assign[=] call[name[ascii_table].replace, parameter[c... | keyword[def] identifier[table] ( identifier[self] ):
literal[string]
identifier[ascii_table] = identifier[super] ( identifier[UnixTable] , identifier[self] ). identifier[table]
identifier[optimized] = identifier[ascii_table] . identifier[replace] ( literal[string] , literal[string] )
... | def table(self):
"""Return a large string of the entire table ready to be printed to the terminal."""
ascii_table = super(UnixTable, self).table
optimized = ascii_table.replace('\x1b(B\x1b(0', '')
return optimized |
def LEVINSON(r, order=None, allow_singularity=False):
r"""Levinson-Durbin recursion.
Find the coefficients of a length(r)-1 order autoregressive linear process
:param r: autocorrelation sequence of length N + 1 (first element being the zero-lag autocorrelation)
:param order: requested order of the aut... | def function[LEVINSON, parameter[r, order, allow_singularity]]:
constant[Levinson-Durbin recursion.
Find the coefficients of a length(r)-1 order autoregressive linear process
:param r: autocorrelation sequence of length N + 1 (first element being the zero-lag autocorrelation)
:param order: request... | keyword[def] identifier[LEVINSON] ( identifier[r] , identifier[order] = keyword[None] , identifier[allow_singularity] = keyword[False] ):
literal[string]
identifier[T0] = identifier[numpy] . identifier[real] ( identifier[r] [ literal[int] ])
identifier[T] = identifier[r] [ literal[int] :]
id... | def LEVINSON(r, order=None, allow_singularity=False):
"""Levinson-Durbin recursion.
Find the coefficients of a length(r)-1 order autoregressive linear process
:param r: autocorrelation sequence of length N + 1 (first element being the zero-lag autocorrelation)
:param order: requested order of the auto... |
def p_new_expr_nobf(self, p):
"""new_expr_nobf : member_expr_nobf
| NEW new_expr
"""
if len(p) == 2:
p[0] = p[1]
else:
p[0] = self.asttypes.NewExpr(p[2])
p[0].setpos(p) | def function[p_new_expr_nobf, parameter[self, p]]:
constant[new_expr_nobf : member_expr_nobf
| NEW new_expr
]
if compare[call[name[len], parameter[name[p]]] equal[==] constant[2]] begin[:]
call[name[p]][constant[0]] assign[=] call[name[p]][constant[1]] | keyword[def] identifier[p_new_expr_nobf] ( identifier[self] , identifier[p] ):
literal[string]
keyword[if] identifier[len] ( identifier[p] )== literal[int] :
identifier[p] [ literal[int] ]= identifier[p] [ literal[int] ]
keyword[else] :
identifier[p] [ literal[in... | def p_new_expr_nobf(self, p):
"""new_expr_nobf : member_expr_nobf
| NEW new_expr
"""
if len(p) == 2:
p[0] = p[1] # depends on [control=['if'], data=[]]
else:
p[0] = self.asttypes.NewExpr(p[2])
p[0].setpos(p) |
def get_initial_data(self, request, user, profile, client):
"""
Return initial data for the setup form. The function can be
controlled with ``SOCIALREGISTRATION_INITIAL_DATA_FUNCTION``.
:param request: The current request object
:param user: The unsaved user object
:para... | def function[get_initial_data, parameter[self, request, user, profile, client]]:
constant[
Return initial data for the setup form. The function can be
controlled with ``SOCIALREGISTRATION_INITIAL_DATA_FUNCTION``.
:param request: The current request object
:param user: The unsave... | keyword[def] identifier[get_initial_data] ( identifier[self] , identifier[request] , identifier[user] , identifier[profile] , identifier[client] ):
literal[string]
keyword[if] identifier[INITAL_DATA_FUNCTION] :
identifier[func] = identifier[self] . identifier[import_attribute] ( ident... | def get_initial_data(self, request, user, profile, client):
"""
Return initial data for the setup form. The function can be
controlled with ``SOCIALREGISTRATION_INITIAL_DATA_FUNCTION``.
:param request: The current request object
:param user: The unsaved user object
:param pr... |
def _logspace_mean(log_values):
"""Evaluate `Log[E[values]]` in a stable manner.
Args:
log_values: `Tensor` holding `Log[values]`.
Returns:
`Tensor` of same `dtype` as `log_values`, reduced across dim 0.
`Log[Mean[values]]`.
"""
# center = Max[Log[values]], with stop-gradient
# The center ... | def function[_logspace_mean, parameter[log_values]]:
constant[Evaluate `Log[E[values]]` in a stable manner.
Args:
log_values: `Tensor` holding `Log[values]`.
Returns:
`Tensor` of same `dtype` as `log_values`, reduced across dim 0.
`Log[Mean[values]]`.
]
variable[center] assign[=] ... | keyword[def] identifier[_logspace_mean] ( identifier[log_values] ):
literal[string]
identifier[center] = identifier[tf] . identifier[stop_gradient] ( identifier[_sample_max] ( identifier[log_values] ))
identifier[centered_values] = identifier[tf] . identifier[math] . identifier[exp] ( identi... | def _logspace_mean(log_values):
"""Evaluate `Log[E[values]]` in a stable manner.
Args:
log_values: `Tensor` holding `Log[values]`.
Returns:
`Tensor` of same `dtype` as `log_values`, reduced across dim 0.
`Log[Mean[values]]`.
"""
# center = Max[Log[values]], with stop-gradient
# The c... |
def get_report_hook(self):
"""
Return a callback function suitable for using reporthook argument of urllib(.request).urlretrieve
:return: function object
"""
def report_hook(chunkNumber, chunkSize, totalSize):
if totalSize != -1 and not self._callback.range_initialize... | def function[get_report_hook, parameter[self]]:
constant[
Return a callback function suitable for using reporthook argument of urllib(.request).urlretrieve
:return: function object
]
def function[report_hook, parameter[chunkNumber, chunkSize, totalSize]]:
if <ast.... | keyword[def] identifier[get_report_hook] ( identifier[self] ):
literal[string]
keyword[def] identifier[report_hook] ( identifier[chunkNumber] , identifier[chunkSize] , identifier[totalSize] ):
keyword[if] identifier[totalSize] !=- literal[int] keyword[and] keyword[not] identifier[... | def get_report_hook(self):
"""
Return a callback function suitable for using reporthook argument of urllib(.request).urlretrieve
:return: function object
"""
def report_hook(chunkNumber, chunkSize, totalSize):
if totalSize != -1 and (not self._callback.range_initialized()):
... |
def define_residues_for_plotting_topology(self,cutoff):
"""
This function defines the residues for plotting in case only a topology file has been submitted.
In this case the residence time analysis in not necessary and it is enough just to find all
residues within a cutoff distance.
... | def function[define_residues_for_plotting_topology, parameter[self, cutoff]]:
constant[
This function defines the residues for plotting in case only a topology file has been submitted.
In this case the residence time analysis in not necessary and it is enough just to find all
residues wi... | keyword[def] identifier[define_residues_for_plotting_topology] ( identifier[self] , identifier[cutoff] ):
literal[string]
identifier[n] = identifier[AtomNeighborSearch] ( identifier[self] . identifier[universe] . identifier[select_atoms] ( literal[string] + identifier[str] ( iden... | def define_residues_for_plotting_topology(self, cutoff):
"""
This function defines the residues for plotting in case only a topology file has been submitted.
In this case the residence time analysis in not necessary and it is enough just to find all
residues within a cutoff distance.
... |
def dependency_status(data):
"""Return abstracted status of dependencies.
- ``STATUS_ERROR`` .. one dependency has error status or was deleted
- ``STATUS_DONE`` .. all dependencies have done status
- ``None`` .. other
"""
parents_statuses = set(
DataDependency.objects.filter(
... | def function[dependency_status, parameter[data]]:
constant[Return abstracted status of dependencies.
- ``STATUS_ERROR`` .. one dependency has error status or was deleted
- ``STATUS_DONE`` .. all dependencies have done status
- ``None`` .. other
]
variable[parents_statuses] assign[=] ca... | keyword[def] identifier[dependency_status] ( identifier[data] ):
literal[string]
identifier[parents_statuses] = identifier[set] (
identifier[DataDependency] . identifier[objects] . identifier[filter] (
identifier[child] = identifier[data] , identifier[kind] = identifier[DataDependency] . identifi... | def dependency_status(data):
"""Return abstracted status of dependencies.
- ``STATUS_ERROR`` .. one dependency has error status or was deleted
- ``STATUS_DONE`` .. all dependencies have done status
- ``None`` .. other
"""
parents_statuses = set(DataDependency.objects.filter(child=data, kind=Da... |
def div(computation: BaseComputation) -> None:
"""
Division
"""
numerator, denominator = computation.stack_pop(num_items=2, type_hint=constants.UINT256)
if denominator == 0:
result = 0
else:
result = (numerator // denominator) & constants.UINT_256_MAX
computation.stack_push... | def function[div, parameter[computation]]:
constant[
Division
]
<ast.Tuple object at 0x7da1b1602350> assign[=] call[name[computation].stack_pop, parameter[]]
if compare[name[denominator] equal[==] constant[0]] begin[:]
variable[result] assign[=] constant[0]
call[n... | keyword[def] identifier[div] ( identifier[computation] : identifier[BaseComputation] )-> keyword[None] :
literal[string]
identifier[numerator] , identifier[denominator] = identifier[computation] . identifier[stack_pop] ( identifier[num_items] = literal[int] , identifier[type_hint] = identifier[constants] .... | def div(computation: BaseComputation) -> None:
"""
Division
"""
(numerator, denominator) = computation.stack_pop(num_items=2, type_hint=constants.UINT256)
if denominator == 0:
result = 0 # depends on [control=['if'], data=[]]
else:
result = numerator // denominator & constants.U... |
def warn_deprecated(since, message='', name='', alternative='', pending=False,
obj_type='attribute', addendum=''):
"""Display deprecation warning in a standard way.
Parameters
----------
since : str
The release at which this API became deprecated.
message : str, optiona... | def function[warn_deprecated, parameter[since, message, name, alternative, pending, obj_type, addendum]]:
constant[Display deprecation warning in a standard way.
Parameters
----------
since : str
The release at which this API became deprecated.
message : str, optional
Override ... | keyword[def] identifier[warn_deprecated] ( identifier[since] , identifier[message] = literal[string] , identifier[name] = literal[string] , identifier[alternative] = literal[string] , identifier[pending] = keyword[False] ,
identifier[obj_type] = literal[string] , identifier[addendum] = literal[string] ):
litera... | def warn_deprecated(since, message='', name='', alternative='', pending=False, obj_type='attribute', addendum=''):
"""Display deprecation warning in a standard way.
Parameters
----------
since : str
The release at which this API became deprecated.
message : str, optional
Override t... |
def save_to_store(self):
"""Save index to store.
:raise AttributeError: If no datastore is defined
"""
if not self._store:
raise AttributeError('No datastore defined!')
saved_data = self.save_to_data(in_place=True)
data = Serializer.serialize(saved_data)
... | def function[save_to_store, parameter[self]]:
constant[Save index to store.
:raise AttributeError: If no datastore is defined
]
if <ast.UnaryOp object at 0x7da1b190ee00> begin[:]
<ast.Raise object at 0x7da1b190e6b0>
variable[saved_data] assign[=] call[name[self].save_to... | keyword[def] identifier[save_to_store] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_store] :
keyword[raise] identifier[AttributeError] ( literal[string] )
identifier[saved_data] = identifier[self] . identifier[save_to_data] (... | def save_to_store(self):
"""Save index to store.
:raise AttributeError: If no datastore is defined
"""
if not self._store:
raise AttributeError('No datastore defined!') # depends on [control=['if'], data=[]]
saved_data = self.save_to_data(in_place=True)
data = Serializer.seria... |
def auto_override_class(cls, force = False, force_recursive = False):
"""Works like auto_override, but is only applicable to classes.
"""
if not pytypes.checking_enabled:
return cls
assert(isclass(cls))
if not force and is_no_type_check(cls):
return cls
# To play it safe we avoid... | def function[auto_override_class, parameter[cls, force, force_recursive]]:
constant[Works like auto_override, but is only applicable to classes.
]
if <ast.UnaryOp object at 0x7da18ede4a60> begin[:]
return[name[cls]]
assert[call[name[isclass], parameter[name[cls]]]]
if <ast.BoolOp... | keyword[def] identifier[auto_override_class] ( identifier[cls] , identifier[force] = keyword[False] , identifier[force_recursive] = keyword[False] ):
literal[string]
keyword[if] keyword[not] identifier[pytypes] . identifier[checking_enabled] :
keyword[return] identifier[cls]
keyword[asser... | def auto_override_class(cls, force=False, force_recursive=False):
"""Works like auto_override, but is only applicable to classes.
"""
if not pytypes.checking_enabled:
return cls # depends on [control=['if'], data=[]]
assert isclass(cls)
if not force and is_no_type_check(cls):
return... |
def p_l_expression(self, p):
''' l : expression
'''
_LOGGER.debug("l -> expresion")
l = TypedList( [ p[1] ] )
p[0] = l | def function[p_l_expression, parameter[self, p]]:
constant[ l : expression
]
call[name[_LOGGER].debug, parameter[constant[l -> expresion]]]
variable[l] assign[=] call[name[TypedList], parameter[list[[<ast.Subscript object at 0x7da20c7cb610>]]]]
call[name[p]][constant[... | keyword[def] identifier[p_l_expression] ( identifier[self] , identifier[p] ):
literal[string]
identifier[_LOGGER] . identifier[debug] ( literal[string] )
identifier[l] = identifier[TypedList] ([ identifier[p] [ literal[int] ]])
identifier[p] [ literal[int] ]= identifier[l] | def p_l_expression(self, p):
""" l : expression
"""
_LOGGER.debug('l -> expresion')
l = TypedList([p[1]])
p[0] = l |
def init(scope, app, settings):
"""Plugin for serving static files in development mode"""
cfg = settings.get('rw.static', {})
static = Static()
scope['static'] = static
scope['template_env'].globals['static'] = static
for base_uri, sources in cfg.items():
full_paths = []
for sour... | def function[init, parameter[scope, app, settings]]:
constant[Plugin for serving static files in development mode]
variable[cfg] assign[=] call[name[settings].get, parameter[constant[rw.static], dictionary[[], []]]]
variable[static] assign[=] call[name[Static], parameter[]]
call[name[sco... | keyword[def] identifier[init] ( identifier[scope] , identifier[app] , identifier[settings] ):
literal[string]
identifier[cfg] = identifier[settings] . identifier[get] ( literal[string] ,{})
identifier[static] = identifier[Static] ()
identifier[scope] [ literal[string] ]= identifier[static]
... | def init(scope, app, settings):
"""Plugin for serving static files in development mode"""
cfg = settings.get('rw.static', {})
static = Static()
scope['static'] = static
scope['template_env'].globals['static'] = static
for (base_uri, sources) in cfg.items():
full_paths = []
for so... |
def parse_member(
cls,
obj: dict,
collection: "DtsCollection",
direction: str,
**additional_parameters) -> List["DtsCollection"]:
""" Parse the member value of a Collection response
and returns the list of object while setting the graph
... | def function[parse_member, parameter[cls, obj, collection, direction]]:
constant[ Parse the member value of a Collection response
and returns the list of object while setting the graph
relationship based on `direction`
:param obj: PyLD parsed JSON+LD
:param collection: Collectio... | keyword[def] identifier[parse_member] (
identifier[cls] ,
identifier[obj] : identifier[dict] ,
identifier[collection] : literal[string] ,
identifier[direction] : identifier[str] ,
** identifier[additional_parameters] )-> identifier[List] [ literal[string] ]:
literal[string]
identifier[members] ... | def parse_member(cls, obj: dict, collection: 'DtsCollection', direction: str, **additional_parameters) -> List['DtsCollection']:
""" Parse the member value of a Collection response
and returns the list of object while setting the graph
relationship based on `direction`
:param obj: PyLD pars... |
def _escape_identifiers(self, item):
"""
This function escapes column and table names
@param item:
"""
if self._escape_char == '':
return item
for field in self._reserved_identifiers:
if item.find('.%s' % field) != -1:
_str = "%s%s... | def function[_escape_identifiers, parameter[self, item]]:
constant[
This function escapes column and table names
@param item:
]
if compare[name[self]._escape_char equal[==] constant[]] begin[:]
return[name[item]]
for taget[name[field]] in starred[name[self]._reser... | keyword[def] identifier[_escape_identifiers] ( identifier[self] , identifier[item] ):
literal[string]
keyword[if] identifier[self] . identifier[_escape_char] == literal[string] :
keyword[return] identifier[item]
keyword[for] identifier[field] keyword[in] identifier[self... | def _escape_identifiers(self, item):
"""
This function escapes column and table names
@param item:
"""
if self._escape_char == '':
return item # depends on [control=['if'], data=[]]
for field in self._reserved_identifiers:
if item.find('.%s' % field) != -1:
... |
def unpack_systemtime(self, offset):
"""
Returns a datetime from the QWORD Windows SYSTEMTIME timestamp
starting at the relative offset.
See http://msdn.microsoft.com/en-us/library/ms724950%28VS.85%29.aspx
Arguments:
- `offset`: The relative offset from the start of t... | def function[unpack_systemtime, parameter[self, offset]]:
constant[
Returns a datetime from the QWORD Windows SYSTEMTIME timestamp
starting at the relative offset.
See http://msdn.microsoft.com/en-us/library/ms724950%28VS.85%29.aspx
Arguments:
- `offset`: The relative... | keyword[def] identifier[unpack_systemtime] ( identifier[self] , identifier[offset] ):
literal[string]
identifier[o] = identifier[self] . identifier[_offset] + identifier[offset]
keyword[try] :
identifier[parts] = identifier[struct] . identifier[unpack_from] ( literal[string] ... | def unpack_systemtime(self, offset):
"""
Returns a datetime from the QWORD Windows SYSTEMTIME timestamp
starting at the relative offset.
See http://msdn.microsoft.com/en-us/library/ms724950%28VS.85%29.aspx
Arguments:
- `offset`: The relative offset from the start of the b... |
def collections(cloud=None, api_key=None, version=None, **kwargs):
"""
This is a status report endpoint. It is used to get the status on all of the collections currently trained, as
well as some basic statistics on their accuracies.
Inputs
api_key (optional) - String: Your API key, required only if... | def function[collections, parameter[cloud, api_key, version]]:
constant[
This is a status report endpoint. It is used to get the status on all of the collections currently trained, as
well as some basic statistics on their accuracies.
Inputs
api_key (optional) - String: Your API key, required o... | keyword[def] identifier[collections] ( identifier[cloud] = keyword[None] , identifier[api_key] = keyword[None] , identifier[version] = keyword[None] ,** identifier[kwargs] ):
literal[string]
identifier[url_params] ={ literal[string] : keyword[False] , literal[string] : identifier[api_key] , literal[string]... | def collections(cloud=None, api_key=None, version=None, **kwargs):
"""
This is a status report endpoint. It is used to get the status on all of the collections currently trained, as
well as some basic statistics on their accuracies.
Inputs
api_key (optional) - String: Your API key, required only if... |
def jbcorrelation(sites_or_distances, imt, vs30_clustering=False):
"""
Returns the Jayaram-Baker correlation model.
:param sites_or_distances:
SiteCollection instance o ristance matrix
:param imt:
Intensity Measure Type (PGA or SA)
:param vs30_clustering:... | def function[jbcorrelation, parameter[sites_or_distances, imt, vs30_clustering]]:
constant[
Returns the Jayaram-Baker correlation model.
:param sites_or_distances:
SiteCollection instance o ristance matrix
:param imt:
Intensity Measure Type (PGA or SA)
:p... | keyword[def] identifier[jbcorrelation] ( identifier[sites_or_distances] , identifier[imt] , identifier[vs30_clustering] = keyword[False] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[sites_or_distances] , literal[string] ):
identifier[distances] = identifier[sites_or... | def jbcorrelation(sites_or_distances, imt, vs30_clustering=False):
"""
Returns the Jayaram-Baker correlation model.
:param sites_or_distances:
SiteCollection instance o ristance matrix
:param imt:
Intensity Measure Type (PGA or SA)
:param vs30_clustering:
... |
def delete(ctx, opts, owner_repo_package, yes):
"""
Delete a package from a repository.
- OWNER/REPO/PACKAGE: Specify the OWNER namespace (i.e. user or org), the
REPO name where the package is stored, and the PACKAGE name (slug) of the
package itself. All separated by a slash.
Example: 'your... | def function[delete, parameter[ctx, opts, owner_repo_package, yes]]:
constant[
Delete a package from a repository.
- OWNER/REPO/PACKAGE: Specify the OWNER namespace (i.e. user or org), the
REPO name where the package is stored, and the PACKAGE name (slug) of the
package itself. All separated by... | keyword[def] identifier[delete] ( identifier[ctx] , identifier[opts] , identifier[owner_repo_package] , identifier[yes] ):
literal[string]
identifier[owner] , identifier[repo] , identifier[slug] = identifier[owner_repo_package]
identifier[delete_args] ={
literal[string] : identifier[click] . id... | def delete(ctx, opts, owner_repo_package, yes):
"""
Delete a package from a repository.
- OWNER/REPO/PACKAGE: Specify the OWNER namespace (i.e. user or org), the
REPO name where the package is stored, and the PACKAGE name (slug) of the
package itself. All separated by a slash.
Example: 'your... |
def open_hist(self):
"""
Open the HIST file located in the in self.outdir.
Returns :class:`HistFile` object, None if file could not be found or file is not readable.
"""
if not self.hist_path:
if self.status == self.S_OK:
logger.critical("%s reached S_... | def function[open_hist, parameter[self]]:
constant[
Open the HIST file located in the in self.outdir.
Returns :class:`HistFile` object, None if file could not be found or file is not readable.
]
if <ast.UnaryOp object at 0x7da18dc98760> begin[:]
if compare[name[se... | keyword[def] identifier[open_hist] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[hist_path] :
keyword[if] identifier[self] . identifier[status] == identifier[self] . identifier[S_OK] :
identifier[logger] . identifier[cr... | def open_hist(self):
"""
Open the HIST file located in the in self.outdir.
Returns :class:`HistFile` object, None if file could not be found or file is not readable.
"""
if not self.hist_path:
if self.status == self.S_OK:
logger.critical("%s reached S_OK but didn't pr... |
def convert_date(obj):
"""Returns a DATE column as a date object:
>>> date_or_None('2007-02-26')
datetime.date(2007, 2, 26)
Illegal values are returned as None:
>>> date_or_None('2007-02-31') is None
True
>>> date_or_None('0000-00-00') is None
True
"""
try:
... | def function[convert_date, parameter[obj]]:
constant[Returns a DATE column as a date object:
>>> date_or_None('2007-02-26')
datetime.date(2007, 2, 26)
Illegal values are returned as None:
>>> date_or_None('2007-02-31') is None
True
>>> date_or_None('0000-00-00') is None
... | keyword[def] identifier[convert_date] ( identifier[obj] ):
literal[string]
keyword[try] :
keyword[return] identifier[datetime] . identifier[date] (*[ identifier[int] ( identifier[x] ) keyword[for] identifier[x] keyword[in] identifier[obj] . identifier[split] ( literal[string] , literal[int] )]... | def convert_date(obj):
"""Returns a DATE column as a date object:
>>> date_or_None('2007-02-26')
datetime.date(2007, 2, 26)
Illegal values are returned as None:
>>> date_or_None('2007-02-31') is None
True
>>> date_or_None('0000-00-00') is None
True
"""
try:
... |
def health():
"""Check the health of this service."""
up_time = time.time() - START_TIME
response = dict(service=__service_id__,
uptime='{:.2f}s'.format(up_time))
return response, HTTPStatus.OK | def function[health, parameter[]]:
constant[Check the health of this service.]
variable[up_time] assign[=] binary_operation[call[name[time].time, parameter[]] - name[START_TIME]]
variable[response] assign[=] call[name[dict], parameter[]]
return[tuple[[<ast.Name object at 0x7da1b05fb640>, <as... | keyword[def] identifier[health] ():
literal[string]
identifier[up_time] = identifier[time] . identifier[time] ()- identifier[START_TIME]
identifier[response] = identifier[dict] ( identifier[service] = identifier[__service_id__] ,
identifier[uptime] = literal[string] . identifier[format] ( identi... | def health():
"""Check the health of this service."""
up_time = time.time() - START_TIME
response = dict(service=__service_id__, uptime='{:.2f}s'.format(up_time))
return (response, HTTPStatus.OK) |
def project_create_notif(self, tenant_id, tenant_name):
"""Tenant Create notification. """
if not self.fw_init:
return
self.os_helper.create_router('_'.join([fw_constants.TENANT_EDGE_RTR,
tenant_name]),
... | def function[project_create_notif, parameter[self, tenant_id, tenant_name]]:
constant[Tenant Create notification. ]
if <ast.UnaryOp object at 0x7da1b1be5e40> begin[:]
return[None]
call[name[self].os_helper.create_router, parameter[call[constant[_].join, parameter[list[[<ast.Attribute obj... | keyword[def] identifier[project_create_notif] ( identifier[self] , identifier[tenant_id] , identifier[tenant_name] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[fw_init] :
keyword[return]
identifier[self] . identifier[os_helper] . identifier[crea... | def project_create_notif(self, tenant_id, tenant_name):
"""Tenant Create notification. """
if not self.fw_init:
return # depends on [control=['if'], data=[]]
self.os_helper.create_router('_'.join([fw_constants.TENANT_EDGE_RTR, tenant_name]), tenant_id, []) |
def pem_as_string(cert):
"""
Only return False if the certificate is a file path. Otherwise it
is a file object or raw string and will need to be fed to the
file open context.
"""
if hasattr(cert, 'read'): # File object - return as is
return cert
cert = cert.encode('utf-8') if isinst... | def function[pem_as_string, parameter[cert]]:
constant[
Only return False if the certificate is a file path. Otherwise it
is a file object or raw string and will need to be fed to the
file open context.
]
if call[name[hasattr], parameter[name[cert], constant[read]]] begin[:]
retu... | keyword[def] identifier[pem_as_string] ( identifier[cert] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[cert] , literal[string] ):
keyword[return] identifier[cert]
identifier[cert] = identifier[cert] . identifier[encode] ( literal[string] ) keyword[if] identifier[isinsta... | def pem_as_string(cert):
"""
Only return False if the certificate is a file path. Otherwise it
is a file object or raw string and will need to be fed to the
file open context.
"""
if hasattr(cert, 'read'): # File object - return as is
return cert # depends on [control=['if'], data=[]]
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.