code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def flush_buffer(self):
''' Flush the buffer of the tail '''
if len(self.buffer) > 0:
return_value = ''.join(self.buffer)
self.buffer.clear()
self.send_message(return_value)
self.last_flush_date = datetime.datetime.now() | def function[flush_buffer, parameter[self]]:
constant[ Flush the buffer of the tail ]
if compare[call[name[len], parameter[name[self].buffer]] greater[>] constant[0]] begin[:]
variable[return_value] assign[=] call[constant[].join, parameter[name[self].buffer]]
call[name[s... | keyword[def] identifier[flush_buffer] ( identifier[self] ):
literal[string]
keyword[if] identifier[len] ( identifier[self] . identifier[buffer] )> literal[int] :
identifier[return_value] = literal[string] . identifier[join] ( identifier[self] . identifier[buffer] )
identi... | def flush_buffer(self):
""" Flush the buffer of the tail """
if len(self.buffer) > 0:
return_value = ''.join(self.buffer)
self.buffer.clear()
self.send_message(return_value)
self.last_flush_date = datetime.datetime.now() # depends on [control=['if'], data=[]] |
def correct_dmdt(d, dmind, dtind, blrange):
""" Dedisperses and resamples data *in place*.
Drops edges, since it assumes that data is read with overlapping chunks in time.
"""
data = numpyview(data_mem, 'complex64', datashape(d))
data_resamp = numpyview(data_resamp_mem, 'complex64', datashape(d))
... | def function[correct_dmdt, parameter[d, dmind, dtind, blrange]]:
constant[ Dedisperses and resamples data *in place*.
Drops edges, since it assumes that data is read with overlapping chunks in time.
]
variable[data] assign[=] call[name[numpyview], parameter[name[data_mem], constant[complex64], c... | keyword[def] identifier[correct_dmdt] ( identifier[d] , identifier[dmind] , identifier[dtind] , identifier[blrange] ):
literal[string]
identifier[data] = identifier[numpyview] ( identifier[data_mem] , literal[string] , identifier[datashape] ( identifier[d] ))
identifier[data_resamp] = identifier[nump... | def correct_dmdt(d, dmind, dtind, blrange):
""" Dedisperses and resamples data *in place*.
Drops edges, since it assumes that data is read with overlapping chunks in time.
"""
data = numpyview(data_mem, 'complex64', datashape(d))
data_resamp = numpyview(data_resamp_mem, 'complex64', datashape(d))
... |
def _supports(self, data):
""" Simply checks if data is supported """
if isinstance(data, Quantity):
return True
elif super(Brian2Result, self)._supports(data):
return True
return False | def function[_supports, parameter[self, data]]:
constant[ Simply checks if data is supported ]
if call[name[isinstance], parameter[name[data], name[Quantity]]] begin[:]
return[constant[True]]
return[constant[False]] | keyword[def] identifier[_supports] ( identifier[self] , identifier[data] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[data] , identifier[Quantity] ):
keyword[return] keyword[True]
keyword[elif] identifier[super] ( identifier[Brian2Result] , identifier... | def _supports(self, data):
""" Simply checks if data is supported """
if isinstance(data, Quantity):
return True # depends on [control=['if'], data=[]]
elif super(Brian2Result, self)._supports(data):
return True # depends on [control=['if'], data=[]]
return False |
def check_plan_id(self, plan_id) -> bool:
"""
Checks that the plan_id exists in the catalog
:return: boolean
"""
for plan in self.catalog().plans:
if plan.id == plan_id:
return True
return False | def function[check_plan_id, parameter[self, plan_id]]:
constant[
Checks that the plan_id exists in the catalog
:return: boolean
]
for taget[name[plan]] in starred[call[name[self].catalog, parameter[]].plans] begin[:]
if compare[name[plan].id equal[==] name[plan_id... | keyword[def] identifier[check_plan_id] ( identifier[self] , identifier[plan_id] )-> identifier[bool] :
literal[string]
keyword[for] identifier[plan] keyword[in] identifier[self] . identifier[catalog] (). identifier[plans] :
keyword[if] identifier[plan] . identifier[id] == identifie... | def check_plan_id(self, plan_id) -> bool:
"""
Checks that the plan_id exists in the catalog
:return: boolean
"""
for plan in self.catalog().plans:
if plan.id == plan_id:
return True # depends on [control=['if'], data=[]] # depends on [control=['for'], data=['plan']]... |
def link_blob_into_repository(self, session, digest, source_repo, target_repo):
"""
Links ("mounts" in Docker Registry terminology) a blob from one repository in a
registry into another repository in the same registry.
"""
self.log.debug("%s: Linking blob %s from %s to %s",
... | def function[link_blob_into_repository, parameter[self, session, digest, source_repo, target_repo]]:
constant[
Links ("mounts" in Docker Registry terminology) a blob from one repository in a
registry into another repository in the same registry.
]
call[name[self].log.debug, param... | keyword[def] identifier[link_blob_into_repository] ( identifier[self] , identifier[session] , identifier[digest] , identifier[source_repo] , identifier[target_repo] ):
literal[string]
identifier[self] . identifier[log] . identifier[debug] ( literal[string] ,
identifier[session] . identifie... | def link_blob_into_repository(self, session, digest, source_repo, target_repo):
"""
Links ("mounts" in Docker Registry terminology) a blob from one repository in a
registry into another repository in the same registry.
"""
self.log.debug('%s: Linking blob %s from %s to %s', session.regis... |
def p_reset(self, program):
"""
reset : RESET primary
"""
program[0] = node.Reset([program[2]])
self.verify_reg(program[2], 'qreg') | def function[p_reset, parameter[self, program]]:
constant[
reset : RESET primary
]
call[name[program]][constant[0]] assign[=] call[name[node].Reset, parameter[list[[<ast.Subscript object at 0x7da1b0382440>]]]]
call[name[self].verify_reg, parameter[call[name[program]][constant[2]]... | keyword[def] identifier[p_reset] ( identifier[self] , identifier[program] ):
literal[string]
identifier[program] [ literal[int] ]= identifier[node] . identifier[Reset] ([ identifier[program] [ literal[int] ]])
identifier[self] . identifier[verify_reg] ( identifier[program] [ literal[int] ]... | def p_reset(self, program):
"""
reset : RESET primary
"""
program[0] = node.Reset([program[2]])
self.verify_reg(program[2], 'qreg') |
def Nu_cylinder_Perkins_Leppert_1964(Re, Pr, mu=None, muw=None):
r'''Calculates Nusselt number for crossflow across a single tube as shown
in [1]_ at a specified `Re` and `Pr`, both evaluated at the free stream
temperature. Recommends a viscosity exponent correction of 0.25, which is
applied only if pro... | def function[Nu_cylinder_Perkins_Leppert_1964, parameter[Re, Pr, mu, muw]]:
constant[Calculates Nusselt number for crossflow across a single tube as shown
in [1]_ at a specified `Re` and `Pr`, both evaluated at the free stream
temperature. Recommends a viscosity exponent correction of 0.25, which is
... | keyword[def] identifier[Nu_cylinder_Perkins_Leppert_1964] ( identifier[Re] , identifier[Pr] , identifier[mu] = keyword[None] , identifier[muw] = keyword[None] ):
literal[string]
identifier[Nu] =( literal[int] * identifier[Re] ** literal[int] + literal[int] * identifier[Re] ** literal[int] )* identifier[Pr]... | def Nu_cylinder_Perkins_Leppert_1964(Re, Pr, mu=None, muw=None):
"""Calculates Nusselt number for crossflow across a single tube as shown
in [1]_ at a specified `Re` and `Pr`, both evaluated at the free stream
temperature. Recommends a viscosity exponent correction of 0.25, which is
applied only if prov... |
def run_git_shell(cls, cmd, cwd=None):
"""
Runs git shell command, reads output and decodes it into unicode string.
@param cmd: Command to be executed.
@type cmd: str
@type cwd: str
@param cwd: Working directory.
@rtype: str
@return: Output of the comma... | def function[run_git_shell, parameter[cls, cmd, cwd]]:
constant[
Runs git shell command, reads output and decodes it into unicode string.
@param cmd: Command to be executed.
@type cmd: str
@type cwd: str
@param cwd: Working directory.
@rtype: str
@retur... | keyword[def] identifier[run_git_shell] ( identifier[cls] , identifier[cmd] , identifier[cwd] = keyword[None] ):
literal[string]
identifier[p] = identifier[Popen] ( identifier[cmd] , identifier[shell] = keyword[True] , identifier[stdout] = identifier[PIPE] , identifier[cwd] = identifier[cwd] )
... | def run_git_shell(cls, cmd, cwd=None):
"""
Runs git shell command, reads output and decodes it into unicode string.
@param cmd: Command to be executed.
@type cmd: str
@type cwd: str
@param cwd: Working directory.
@rtype: str
@return: Output of the command.
... |
def summary(obj, indent=0):
'''Helper function to format repr strings for JObjects and friends.
Parameters
----------
obj
The object to repr
indent : int >= 0
indent each new line by `indent` spaces
Returns
-------
r : str
If `obj` has a `__summary__` method, i... | def function[summary, parameter[obj, indent]]:
constant[Helper function to format repr strings for JObjects and friends.
Parameters
----------
obj
The object to repr
indent : int >= 0
indent each new line by `indent` spaces
Returns
-------
r : str
If `obj` ... | keyword[def] identifier[summary] ( identifier[obj] , identifier[indent] = literal[int] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[obj] , literal[string] ):
identifier[rep] = identifier[obj] . identifier[__summary__] ()
keyword[elif] identifier[isinstance] ( identifier[o... | def summary(obj, indent=0):
"""Helper function to format repr strings for JObjects and friends.
Parameters
----------
obj
The object to repr
indent : int >= 0
indent each new line by `indent` spaces
Returns
-------
r : str
If `obj` has a `__summary__` method, i... |
def fit(self, Z):
"""Learn a list of feature name -> indices mappings.
Parameters
----------
Z : DictRDD with column 'X'
Dict(s) or Mapping(s) from feature names (arbitrary Python
objects) to feature values (strings or convertible to dtype).
Returns
... | def function[fit, parameter[self, Z]]:
constant[Learn a list of feature name -> indices mappings.
Parameters
----------
Z : DictRDD with column 'X'
Dict(s) or Mapping(s) from feature names (arbitrary Python
objects) to feature values (strings or convertible to dt... | keyword[def] identifier[fit] ( identifier[self] , identifier[Z] ):
literal[string]
identifier[X] = identifier[Z] [:, literal[string] ] keyword[if] identifier[isinstance] ( identifier[Z] , identifier[DictRDD] ) keyword[else] identifier[Z]
literal[string]
keyword[class] identi... | def fit(self, Z):
"""Learn a list of feature name -> indices mappings.
Parameters
----------
Z : DictRDD with column 'X'
Dict(s) or Mapping(s) from feature names (arbitrary Python
objects) to feature values (strings or convertible to dtype).
Returns
... |
def uclust_search_and_align_from_fasta_filepath(
query_fasta_filepath,
subject_fasta_filepath,
percent_ID=0.75,
enable_rev_strand_matching=True,
max_accepts=8,
max_rejects=32,
tmp_dir=gettempdir(),
HALT_EXEC=False):
""" query seqs against subject fasta... | def function[uclust_search_and_align_from_fasta_filepath, parameter[query_fasta_filepath, subject_fasta_filepath, percent_ID, enable_rev_strand_matching, max_accepts, max_rejects, tmp_dir, HALT_EXEC]]:
constant[ query seqs against subject fasta using uclust,
return global pw alignment of best match
... | keyword[def] identifier[uclust_search_and_align_from_fasta_filepath] (
identifier[query_fasta_filepath] ,
identifier[subject_fasta_filepath] ,
identifier[percent_ID] = literal[int] ,
identifier[enable_rev_strand_matching] = keyword[True] ,
identifier[max_accepts] = literal[int] ,
identifier[max_rejects] = liter... | def uclust_search_and_align_from_fasta_filepath(query_fasta_filepath, subject_fasta_filepath, percent_ID=0.75, enable_rev_strand_matching=True, max_accepts=8, max_rejects=32, tmp_dir=gettempdir(), HALT_EXEC=False):
""" query seqs against subject fasta using uclust,
return global pw alignment of best match
... |
def save(self, **kwargs):
"""Custom save method to process thumbnails and save image dimensions."""
is_new = self.pk is None
if is_new:
# Make filenames lowercase
self.img.name = self.img.name.lower()
# Call super method
super(Image, self).save(*... | def function[save, parameter[self]]:
constant[Custom save method to process thumbnails and save image dimensions.]
variable[is_new] assign[=] compare[name[self].pk is constant[None]]
if name[is_new] begin[:]
name[self].img.name assign[=] call[name[self].img.name.lower, parameter[... | keyword[def] identifier[save] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[is_new] = identifier[self] . identifier[pk] keyword[is] keyword[None]
keyword[if] identifier[is_new] :
identifier[self] . identifier[img] . identifier[name] = id... | def save(self, **kwargs):
"""Custom save method to process thumbnails and save image dimensions."""
is_new = self.pk is None
if is_new:
# Make filenames lowercase
self.img.name = self.img.name.lower() # depends on [control=['if'], data=[]]
# Call super method
super(Image, self).save... |
def connect(self):
"""
Creates connection to RabbitMQ server
"""
if self.connecting:
log.info('PikaClient: Already connecting to RabbitMQ')
return
log.info('PikaClient: Connecting to RabbitMQ')
self.connecting = True
self.connection = Tor... | def function[connect, parameter[self]]:
constant[
Creates connection to RabbitMQ server
]
if name[self].connecting begin[:]
call[name[log].info, parameter[constant[PikaClient: Already connecting to RabbitMQ]]]
return[None]
call[name[log].info, parameter[co... | keyword[def] identifier[connect] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[connecting] :
identifier[log] . identifier[info] ( literal[string] )
keyword[return]
identifier[log] . identifier[info] ( literal[string] )
... | def connect(self):
"""
Creates connection to RabbitMQ server
"""
if self.connecting:
log.info('PikaClient: Already connecting to RabbitMQ')
return # depends on [control=['if'], data=[]]
log.info('PikaClient: Connecting to RabbitMQ')
self.connecting = True
self.connec... |
def call_hook(self, hook, *args, **kwargs):
"""
Calls each registered hook
"""
for function in self.hooks[hook]:
function.__call__(*args, **kwargs) | def function[call_hook, parameter[self, hook]]:
constant[
Calls each registered hook
]
for taget[name[function]] in starred[call[name[self].hooks][name[hook]]] begin[:]
call[name[function].__call__, parameter[<ast.Starred object at 0x7da1b1914970>]] | keyword[def] identifier[call_hook] ( identifier[self] , identifier[hook] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[for] identifier[function] keyword[in] identifier[self] . identifier[hooks] [ identifier[hook] ]:
identifier[function] . identifier[__call__]... | def call_hook(self, hook, *args, **kwargs):
"""
Calls each registered hook
"""
for function in self.hooks[hook]:
function.__call__(*args, **kwargs) # depends on [control=['for'], data=['function']] |
def observer_update(self, message):
"""Called when update from observer is received."""
# Demultiplex observer update into multiple messages.
for action in ('added', 'changed', 'removed'):
for item in message[action]:
self.send_json(
{
... | def function[observer_update, parameter[self, message]]:
constant[Called when update from observer is received.]
for taget[name[action]] in starred[tuple[[<ast.Constant object at 0x7da20e9575b0>, <ast.Constant object at 0x7da20e9569e0>, <ast.Constant object at 0x7da20e957520>]]] begin[:]
... | keyword[def] identifier[observer_update] ( identifier[self] , identifier[message] ):
literal[string]
keyword[for] identifier[action] keyword[in] ( literal[string] , literal[string] , literal[string] ):
keyword[for] identifier[item] keyword[in] identifier[message] [ identi... | def observer_update(self, message):
"""Called when update from observer is received."""
# Demultiplex observer update into multiple messages.
for action in ('added', 'changed', 'removed'):
for item in message[action]:
self.send_json({'msg': action, 'observer': message['observer'], 'prima... |
def PyDbLite_to_csv(src,dest=None,dialect='excel'):
"""Convert a PyDbLite base to a CSV file
src is the PyDbLite.Base instance
dest is the file-like object for the CSV output
dialect is the same as in csv module"""
import csv
fieldnames = ["__id__","__version__"]+src.fields
if dest is... | def function[PyDbLite_to_csv, parameter[src, dest, dialect]]:
constant[Convert a PyDbLite base to a CSV file
src is the PyDbLite.Base instance
dest is the file-like object for the CSV output
dialect is the same as in csv module]
import module[csv]
variable[fieldnames] assign[=] binary_op... | keyword[def] identifier[PyDbLite_to_csv] ( identifier[src] , identifier[dest] = keyword[None] , identifier[dialect] = literal[string] ):
literal[string]
keyword[import] identifier[csv]
identifier[fieldnames] =[ literal[string] , literal[string] ]+ identifier[src] . identifier[fields]
keywo... | def PyDbLite_to_csv(src, dest=None, dialect='excel'):
"""Convert a PyDbLite base to a CSV file
src is the PyDbLite.Base instance
dest is the file-like object for the CSV output
dialect is the same as in csv module"""
import csv
fieldnames = ['__id__', '__version__'] + src.fields
if dest is N... |
def show(self):
"""
When dynamic, not all argument values may be available.
"""
copied = self.copy()
enumerated = [el for el in enumerate(copied)]
for (group_ind, specs) in enumerated:
if len(enumerated) > 1: print("Group %d" % group_ind)
ordering ... | def function[show, parameter[self]]:
constant[
When dynamic, not all argument values may be available.
]
variable[copied] assign[=] call[name[self].copy, parameter[]]
variable[enumerated] assign[=] <ast.ListComp object at 0x7da1afea6560>
for taget[tuple[[<ast.Name object ... | keyword[def] identifier[show] ( identifier[self] ):
literal[string]
identifier[copied] = identifier[self] . identifier[copy] ()
identifier[enumerated] =[ identifier[el] keyword[for] identifier[el] keyword[in] identifier[enumerate] ( identifier[copied] )]
keyword[for] ( identif... | def show(self):
"""
When dynamic, not all argument values may be available.
"""
copied = self.copy()
enumerated = [el for el in enumerate(copied)]
for (group_ind, specs) in enumerated:
if len(enumerated) > 1:
print('Group %d' % group_ind) # depends on [control=['if']... |
def _termination_callback(self, process_name, returncode):
"""
Called when the process has stopped.
:param returncode: Process returncode
"""
self._terminate_process_iou()
if returncode != 0:
if returncode == -11:
message = 'IOU VM "{}" proce... | def function[_termination_callback, parameter[self, process_name, returncode]]:
constant[
Called when the process has stopped.
:param returncode: Process returncode
]
call[name[self]._terminate_process_iou, parameter[]]
if compare[name[returncode] not_equal[!=] constant[... | keyword[def] identifier[_termination_callback] ( identifier[self] , identifier[process_name] , identifier[returncode] ):
literal[string]
identifier[self] . identifier[_terminate_process_iou] ()
keyword[if] identifier[returncode] != literal[int] :
keyword[if] identifier[retu... | def _termination_callback(self, process_name, returncode):
"""
Called when the process has stopped.
:param returncode: Process returncode
"""
self._terminate_process_iou()
if returncode != 0:
if returncode == -11:
message = 'IOU VM "{}" process has stopped with r... |
def verifymessage(self, address, signature, message):
"""Verify a signed message."""
return self.req("verifymessage", [address, signature, message]) | def function[verifymessage, parameter[self, address, signature, message]]:
constant[Verify a signed message.]
return[call[name[self].req, parameter[constant[verifymessage], list[[<ast.Name object at 0x7da18f09df60>, <ast.Name object at 0x7da18f09f6d0>, <ast.Name object at 0x7da18f09fbb0>]]]]] | keyword[def] identifier[verifymessage] ( identifier[self] , identifier[address] , identifier[signature] , identifier[message] ):
literal[string]
keyword[return] identifier[self] . identifier[req] ( literal[string] ,[ identifier[address] , identifier[signature] , identifier[message] ]) | def verifymessage(self, address, signature, message):
"""Verify a signed message."""
return self.req('verifymessage', [address, signature, message]) |
def to_realimag(z):
"""
Convert a complex hermitian matrix to a real valued doubled up representation, i.e., for
``Z = Z_r + 1j * Z_i`` return ``R(Z)``::
R(Z) = [ Z_r Z_i]
[-Z_i Z_r]
A complex hermitian matrix ``Z`` with elementwise real and imaginary parts
``Z = Z_r + 1... | def function[to_realimag, parameter[z]]:
constant[
Convert a complex hermitian matrix to a real valued doubled up representation, i.e., for
``Z = Z_r + 1j * Z_i`` return ``R(Z)``::
R(Z) = [ Z_r Z_i]
[-Z_i Z_r]
A complex hermitian matrix ``Z`` with elementwise real and im... | keyword[def] identifier[to_realimag] ( identifier[z] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[z] , identifier[qt] . identifier[Qobj] ):
identifier[z] = identifier[z] . identifier[data]
keyword[if] keyword[not] identifier[is_hermitian] ( identifier[z] ):
... | def to_realimag(z):
"""
Convert a complex hermitian matrix to a real valued doubled up representation, i.e., for
``Z = Z_r + 1j * Z_i`` return ``R(Z)``::
R(Z) = [ Z_r Z_i]
[-Z_i Z_r]
A complex hermitian matrix ``Z`` with elementwise real and imaginary parts
``Z = Z_r + 1... |
def _run_openstack_cmds(self, commands, commands_to_log=None, sync=False):
"""Execute/sends a CAPI (Command API) command to EOS.
In this method, list of commands is appended with prefix and
postfix commands - to make is understandble by EOS.
:param commands : List of command to be exec... | def function[_run_openstack_cmds, parameter[self, commands, commands_to_log, sync]]:
constant[Execute/sends a CAPI (Command API) command to EOS.
In this method, list of commands is appended with prefix and
postfix commands - to make is understandble by EOS.
:param commands : List of co... | keyword[def] identifier[_run_openstack_cmds] ( identifier[self] , identifier[commands] , identifier[commands_to_log] = keyword[None] , identifier[sync] = keyword[False] ):
literal[string]
identifier[full_command] = identifier[self] . identifier[_build_command] ( identifier[commands] , identifier[s... | def _run_openstack_cmds(self, commands, commands_to_log=None, sync=False):
"""Execute/sends a CAPI (Command API) command to EOS.
In this method, list of commands is appended with prefix and
postfix commands - to make is understandble by EOS.
:param commands : List of command to be executed... |
def GetFeatureService(self, itemId, returnURLOnly=False):
"""Obtains a feature service by item ID.
Args:
itemId (str): The feature service's item ID.
returnURLOnly (bool): A boolean value to return the URL of the feature service. Defaults to ``False``.
Returns:
... | def function[GetFeatureService, parameter[self, itemId, returnURLOnly]]:
constant[Obtains a feature service by item ID.
Args:
itemId (str): The feature service's item ID.
returnURLOnly (bool): A boolean value to return the URL of the feature service. Defaults to ``False``.
... | keyword[def] identifier[GetFeatureService] ( identifier[self] , identifier[itemId] , identifier[returnURLOnly] = keyword[False] ):
literal[string]
identifier[admin] = keyword[None]
identifier[item] = keyword[None]
keyword[try] :
identifier[admin] = identifier[arcres... | def GetFeatureService(self, itemId, returnURLOnly=False):
"""Obtains a feature service by item ID.
Args:
itemId (str): The feature service's item ID.
returnURLOnly (bool): A boolean value to return the URL of the feature service. Defaults to ``False``.
Returns:
W... |
def to_proj4(self, as_dict=False):
"""
Returns the CS as a proj4 formatted string or dict.
Arguments:
- **as_dict** (optional): If True, returns the proj4 string as a dict (defaults to False).
"""
string = "%s" % self.proj.to_proj4()
string += " %s" % self.geogc... | def function[to_proj4, parameter[self, as_dict]]:
constant[
Returns the CS as a proj4 formatted string or dict.
Arguments:
- **as_dict** (optional): If True, returns the proj4 string as a dict (defaults to False).
]
variable[string] assign[=] binary_operation[constant[%... | keyword[def] identifier[to_proj4] ( identifier[self] , identifier[as_dict] = keyword[False] ):
literal[string]
identifier[string] = literal[string] % identifier[self] . identifier[proj] . identifier[to_proj4] ()
identifier[string] += literal[string] % identifier[self] . identifier[geogcs] ... | def to_proj4(self, as_dict=False):
"""
Returns the CS as a proj4 formatted string or dict.
Arguments:
- **as_dict** (optional): If True, returns the proj4 string as a dict (defaults to False).
"""
string = '%s' % self.proj.to_proj4()
string += ' %s' % self.geogcs.to_proj4(t... |
def get_inventory_text(self):
"""Return the inventory information from the device."""
inventory_text = None
if self.inventory_cmd:
try:
inventory_text = self.device.send(self.inventory_cmd, timeout=120)
self.log('Inventory collected')
excep... | def function[get_inventory_text, parameter[self]]:
constant[Return the inventory information from the device.]
variable[inventory_text] assign[=] constant[None]
if name[self].inventory_cmd begin[:]
<ast.Try object at 0x7da1b2596c80>
return[name[inventory_text]] | keyword[def] identifier[get_inventory_text] ( identifier[self] ):
literal[string]
identifier[inventory_text] = keyword[None]
keyword[if] identifier[self] . identifier[inventory_cmd] :
keyword[try] :
identifier[inventory_text] = identifier[self] . identifier[... | def get_inventory_text(self):
"""Return the inventory information from the device."""
inventory_text = None
if self.inventory_cmd:
try:
inventory_text = self.device.send(self.inventory_cmd, timeout=120)
self.log('Inventory collected') # depends on [control=['try'], data=[]]
... |
def delete_all_versions(self, model_name, obj_pk):
"""Delete all versions of a cached instance."""
if self.cache:
for version in self.versions:
key = self.key_for(version, model_name, obj_pk)
self.cache.delete(key) | def function[delete_all_versions, parameter[self, model_name, obj_pk]]:
constant[Delete all versions of a cached instance.]
if name[self].cache begin[:]
for taget[name[version]] in starred[name[self].versions] begin[:]
variable[key] assign[=] call[name[self].key_f... | keyword[def] identifier[delete_all_versions] ( identifier[self] , identifier[model_name] , identifier[obj_pk] ):
literal[string]
keyword[if] identifier[self] . identifier[cache] :
keyword[for] identifier[version] keyword[in] identifier[self] . identifier[versions] :
... | def delete_all_versions(self, model_name, obj_pk):
"""Delete all versions of a cached instance."""
if self.cache:
for version in self.versions:
key = self.key_for(version, model_name, obj_pk)
self.cache.delete(key) # depends on [control=['for'], data=['version']] # depends on [... |
def switch_cursor(cursor_type, parent_window):
"""
Functions switches the cursor to cursor type
"""
watch = Gdk.Cursor(cursor_type)
window = parent_window.get_root_window()
window.set_cursor(watch) | def function[switch_cursor, parameter[cursor_type, parent_window]]:
constant[
Functions switches the cursor to cursor type
]
variable[watch] assign[=] call[name[Gdk].Cursor, parameter[name[cursor_type]]]
variable[window] assign[=] call[name[parent_window].get_root_window, parameter[]]
... | keyword[def] identifier[switch_cursor] ( identifier[cursor_type] , identifier[parent_window] ):
literal[string]
identifier[watch] = identifier[Gdk] . identifier[Cursor] ( identifier[cursor_type] )
identifier[window] = identifier[parent_window] . identifier[get_root_window] ()
identifier[window] .... | def switch_cursor(cursor_type, parent_window):
"""
Functions switches the cursor to cursor type
"""
watch = Gdk.Cursor(cursor_type)
window = parent_window.get_root_window()
window.set_cursor(watch) |
def get_item(filename, uuid):
"""
Read entry from JSON file
"""
with open(os.fsencode(str(filename)), "r") as f:
data = json.load(f)
results = [i for i in data if i["uuid"] == str(uuid)]
if results:
return results
return None | def function[get_item, parameter[filename, uuid]]:
constant[
Read entry from JSON file
]
with call[name[open], parameter[call[name[os].fsencode, parameter[call[name[str], parameter[name[filename]]]]], constant[r]]] begin[:]
variable[data] assign[=] call[name[json].load, parameter... | keyword[def] identifier[get_item] ( identifier[filename] , identifier[uuid] ):
literal[string]
keyword[with] identifier[open] ( identifier[os] . identifier[fsencode] ( identifier[str] ( identifier[filename] )), literal[string] ) keyword[as] identifier[f] :
identifier[data] = identifier[json] . i... | def get_item(filename, uuid):
"""
Read entry from JSON file
"""
with open(os.fsencode(str(filename)), 'r') as f:
data = json.load(f)
results = [i for i in data if i['uuid'] == str(uuid)]
if results:
return results # depends on [control=['if'], data=[]]
return... |
def get_course_by_sis_id(self, sis_course_id, params={}):
"""
Return course resource for given sis id.
"""
return self.get_course(self._sis_id(sis_course_id, sis_field="course"),
params) | def function[get_course_by_sis_id, parameter[self, sis_course_id, params]]:
constant[
Return course resource for given sis id.
]
return[call[name[self].get_course, parameter[call[name[self]._sis_id, parameter[name[sis_course_id]]], name[params]]]] | keyword[def] identifier[get_course_by_sis_id] ( identifier[self] , identifier[sis_course_id] , identifier[params] ={}):
literal[string]
keyword[return] identifier[self] . identifier[get_course] ( identifier[self] . identifier[_sis_id] ( identifier[sis_course_id] , identifier[sis_field] = literal[s... | def get_course_by_sis_id(self, sis_course_id, params={}):
"""
Return course resource for given sis id.
"""
return self.get_course(self._sis_id(sis_course_id, sis_field='course'), params) |
def wait(self, key, index=0, recursive=False, sorted=False, quorum=False,
timeout=None):
"""Waits until a node changes."""
return self.adapter.get(key, recursive=recursive, sorted=sorted,
quorum=quorum, wait=True, wait_index=index,
... | def function[wait, parameter[self, key, index, recursive, sorted, quorum, timeout]]:
constant[Waits until a node changes.]
return[call[name[self].adapter.get, parameter[name[key]]]] | keyword[def] identifier[wait] ( identifier[self] , identifier[key] , identifier[index] = literal[int] , identifier[recursive] = keyword[False] , identifier[sorted] = keyword[False] , identifier[quorum] = keyword[False] ,
identifier[timeout] = keyword[None] ):
literal[string]
keyword[return] ident... | def wait(self, key, index=0, recursive=False, sorted=False, quorum=False, timeout=None):
"""Waits until a node changes."""
return self.adapter.get(key, recursive=recursive, sorted=sorted, quorum=quorum, wait=True, wait_index=index, timeout=timeout) |
def convenience_calc_log_likelihood(self, params):
"""
Calculates the log-likelihood for this model and dataset.
"""
shapes, intercepts, betas = self.convenience_split_params(params)
args = [betas,
self.design_3d,
self.alt_id_vector,
... | def function[convenience_calc_log_likelihood, parameter[self, params]]:
constant[
Calculates the log-likelihood for this model and dataset.
]
<ast.Tuple object at 0x7da1b1307610> assign[=] call[name[self].convenience_split_params, parameter[name[params]]]
variable[args] assign[=]... | keyword[def] identifier[convenience_calc_log_likelihood] ( identifier[self] , identifier[params] ):
literal[string]
identifier[shapes] , identifier[intercepts] , identifier[betas] = identifier[self] . identifier[convenience_split_params] ( identifier[params] )
identifier[args] =[ identifi... | def convenience_calc_log_likelihood(self, params):
"""
Calculates the log-likelihood for this model and dataset.
"""
(shapes, intercepts, betas) = self.convenience_split_params(params)
args = [betas, self.design_3d, self.alt_id_vector, self.rows_to_obs, self.rows_to_alts, self.rows_to_mixers... |
def find_first_declaration(
declarations,
decl_type=None,
name=None,
parent=None,
recursive=True,
fullname=None):
"""
Returns first declaration that match criteria, defined by developer.
For more information about arguments see :class:`match_declaration_t`
... | def function[find_first_declaration, parameter[declarations, decl_type, name, parent, recursive, fullname]]:
constant[
Returns first declaration that match criteria, defined by developer.
For more information about arguments see :class:`match_declaration_t`
class.
:rtype: matched declaration :... | keyword[def] identifier[find_first_declaration] (
identifier[declarations] ,
identifier[decl_type] = keyword[None] ,
identifier[name] = keyword[None] ,
identifier[parent] = keyword[None] ,
identifier[recursive] = keyword[True] ,
identifier[fullname] = keyword[None] ):
literal[string]
identifier[decl... | def find_first_declaration(declarations, decl_type=None, name=None, parent=None, recursive=True, fullname=None):
"""
Returns first declaration that match criteria, defined by developer.
For more information about arguments see :class:`match_declaration_t`
class.
:rtype: matched declaration :class:... |
def new_feed(self, name: str, layer_shape: tuple):
"""
Creates a feed layer. This is usually the first layer in the network.
:param name: name of the layer
:return:
"""
feed_data = tf.placeholder(tf.float32, layer_shape, 'input')
self.__network.add_layer(name, la... | def function[new_feed, parameter[self, name, layer_shape]]:
constant[
Creates a feed layer. This is usually the first layer in the network.
:param name: name of the layer
:return:
]
variable[feed_data] assign[=] call[name[tf].placeholder, parameter[name[tf].float32, name[... | keyword[def] identifier[new_feed] ( identifier[self] , identifier[name] : identifier[str] , identifier[layer_shape] : identifier[tuple] ):
literal[string]
identifier[feed_data] = identifier[tf] . identifier[placeholder] ( identifier[tf] . identifier[float32] , identifier[layer_shape] , literal[str... | def new_feed(self, name: str, layer_shape: tuple):
"""
Creates a feed layer. This is usually the first layer in the network.
:param name: name of the layer
:return:
"""
feed_data = tf.placeholder(tf.float32, layer_shape, 'input')
self.__network.add_layer(name, layer_output=fe... |
def drop_slot(self, slot=None, drop_stack=False):
"""
Drop one or all items of the slot.
Does not wait for confirmation from the server. If you want that,
use a ``Task`` and ``yield inventory.async.drop_slot()`` instead.
If ``slot`` is None, drops the ``cursor_slot`` or, if tha... | def function[drop_slot, parameter[self, slot, drop_stack]]:
constant[
Drop one or all items of the slot.
Does not wait for confirmation from the server. If you want that,
use a ``Task`` and ``yield inventory.async.drop_slot()`` instead.
If ``slot`` is None, drops the ``cursor_s... | keyword[def] identifier[drop_slot] ( identifier[self] , identifier[slot] = keyword[None] , identifier[drop_stack] = keyword[False] ):
literal[string]
keyword[if] identifier[slot] keyword[is] keyword[None] :
keyword[if] identifier[self] . identifier[cursor_slot] . identifier[is_empt... | def drop_slot(self, slot=None, drop_stack=False):
"""
Drop one or all items of the slot.
Does not wait for confirmation from the server. If you want that,
use a ``Task`` and ``yield inventory.async.drop_slot()`` instead.
If ``slot`` is None, drops the ``cursor_slot`` or, if that's ... |
def _on_trigger(self, my_task):
"""
Enqueue a trigger, such that this tasks triggers multiple times later
when _on_complete() is called.
"""
self.queued += 1
# All tasks that have already completed need to be put back to
# READY.
for thetask in my_task.wor... | def function[_on_trigger, parameter[self, my_task]]:
constant[
Enqueue a trigger, such that this tasks triggers multiple times later
when _on_complete() is called.
]
<ast.AugAssign object at 0x7da1b0121e40>
for taget[name[thetask]] in starred[name[my_task].workflow.task_tree]... | keyword[def] identifier[_on_trigger] ( identifier[self] , identifier[my_task] ):
literal[string]
identifier[self] . identifier[queued] += literal[int]
keyword[for] identifier[thetask] keyword[in] identifier[my_task] . identifier[workflow] . identifier[task_tree] :
... | def _on_trigger(self, my_task):
"""
Enqueue a trigger, such that this tasks triggers multiple times later
when _on_complete() is called.
"""
self.queued += 1
# All tasks that have already completed need to be put back to
# READY.
for thetask in my_task.workflow.task_tree:
... |
def set_geoip_params(self, db_country=None, db_city=None):
"""Sets GeoIP parameters.
* http://uwsgi.readthedocs.io/en/latest/GeoIP.html
:param str|unicode db_country: Country database file path.
:param str|unicode db_city: City database file path. Example: ``GeoLiteCity.dat``.
... | def function[set_geoip_params, parameter[self, db_country, db_city]]:
constant[Sets GeoIP parameters.
* http://uwsgi.readthedocs.io/en/latest/GeoIP.html
:param str|unicode db_country: Country database file path.
:param str|unicode db_city: City database file path. Example: ``GeoLiteCi... | keyword[def] identifier[set_geoip_params] ( identifier[self] , identifier[db_country] = keyword[None] , identifier[db_city] = keyword[None] ):
literal[string]
identifier[self] . identifier[_set] ( literal[string] , identifier[db_country] , identifier[plugin] = literal[string] )
identifier[... | def set_geoip_params(self, db_country=None, db_city=None):
"""Sets GeoIP parameters.
* http://uwsgi.readthedocs.io/en/latest/GeoIP.html
:param str|unicode db_country: Country database file path.
:param str|unicode db_city: City database file path. Example: ``GeoLiteCity.dat``.
""... |
def raw(self):
r"""Return the raw corpus.
This is reconstructed by joining sub-components with the corpus' split
characters
Returns
-------
str
The raw corpus
Example
-------
>>> tqbf = 'The quick brown fox jumped over the lazy dog.\... | def function[raw, parameter[self]]:
constant[Return the raw corpus.
This is reconstructed by joining sub-components with the corpus' split
characters
Returns
-------
str
The raw corpus
Example
-------
>>> tqbf = 'The quick brown fox ... | keyword[def] identifier[raw] ( identifier[self] ):
literal[string]
identifier[doc_list] =[]
keyword[for] identifier[doc] keyword[in] identifier[self] . identifier[corpus] :
identifier[sent_list] =[]
keyword[for] identifier[sent] keyword[in] identifier[doc] :... | def raw(self):
"""Return the raw corpus.
This is reconstructed by joining sub-components with the corpus' split
characters
Returns
-------
str
The raw corpus
Example
-------
>>> tqbf = 'The quick brown fox jumped over the lazy dog.\\n'
... |
def get_probes_results(self):
"""Return the results of the RPM probes."""
probes_results = {}
probes_results_table = junos_views.junos_rpm_probes_results_table(self.device)
probes_results_table.get()
probes_results_items = probes_results_table.items()
for probe_result i... | def function[get_probes_results, parameter[self]]:
constant[Return the results of the RPM probes.]
variable[probes_results] assign[=] dictionary[[], []]
variable[probes_results_table] assign[=] call[name[junos_views].junos_rpm_probes_results_table, parameter[name[self].device]]
call[name... | keyword[def] identifier[get_probes_results] ( identifier[self] ):
literal[string]
identifier[probes_results] ={}
identifier[probes_results_table] = identifier[junos_views] . identifier[junos_rpm_probes_results_table] ( identifier[self] . identifier[device] )
identifier[probes_res... | def get_probes_results(self):
"""Return the results of the RPM probes."""
probes_results = {}
probes_results_table = junos_views.junos_rpm_probes_results_table(self.device)
probes_results_table.get()
probes_results_items = probes_results_table.items()
for probe_result in probes_results_items:
... |
def dgeodr(x, y, z, re, f):
"""
This routine computes the Jacobian of the transformation from
rectangular to geodetic coordinates.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dgeodr_c.html
:param x: X-coordinate of point.
:type x: float
:param y: Y-coordinate of point.
:typ... | def function[dgeodr, parameter[x, y, z, re, f]]:
constant[
This routine computes the Jacobian of the transformation from
rectangular to geodetic coordinates.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dgeodr_c.html
:param x: X-coordinate of point.
:type x: float
:param y: ... | keyword[def] identifier[dgeodr] ( identifier[x] , identifier[y] , identifier[z] , identifier[re] , identifier[f] ):
literal[string]
identifier[x] = identifier[ctypes] . identifier[c_double] ( identifier[x] )
identifier[y] = identifier[ctypes] . identifier[c_double] ( identifier[y] )
identifier[z]... | def dgeodr(x, y, z, re, f):
"""
This routine computes the Jacobian of the transformation from
rectangular to geodetic coordinates.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dgeodr_c.html
:param x: X-coordinate of point.
:type x: float
:param y: Y-coordinate of point.
:typ... |
def __single_arity_fn_to_py_ast(
ctx: GeneratorContext,
node: Fn,
method: FnMethod,
def_name: Optional[str] = None,
meta_node: Optional[MetaNode] = None,
) -> GeneratedPyAST:
"""Return a Python AST node for a function with a single arity."""
assert node.op == NodeOp.FN
assert method.op =... | def function[__single_arity_fn_to_py_ast, parameter[ctx, node, method, def_name, meta_node]]:
constant[Return a Python AST node for a function with a single arity.]
assert[compare[name[node].op equal[==] name[NodeOp].FN]]
assert[compare[name[method].op equal[==] name[NodeOp].FN_METHOD]]
variable... | keyword[def] identifier[__single_arity_fn_to_py_ast] (
identifier[ctx] : identifier[GeneratorContext] ,
identifier[node] : identifier[Fn] ,
identifier[method] : identifier[FnMethod] ,
identifier[def_name] : identifier[Optional] [ identifier[str] ]= keyword[None] ,
identifier[meta_node] : identifier[Optional] [ i... | def __single_arity_fn_to_py_ast(ctx: GeneratorContext, node: Fn, method: FnMethod, def_name: Optional[str]=None, meta_node: Optional[MetaNode]=None) -> GeneratedPyAST:
"""Return a Python AST node for a function with a single arity."""
assert node.op == NodeOp.FN
assert method.op == NodeOp.FN_METHOD
lisp... |
def from_string(source, args=None):
"""Renders a template string"""
if _has_jinja:
logger.info('Precompiling model with arguments: {}'.format(args))
return _jenv.from_string(source).render(args or {})
if args:
raise RuntimeError(_except_text)
return source | def function[from_string, parameter[source, args]]:
constant[Renders a template string]
if name[_has_jinja] begin[:]
call[name[logger].info, parameter[call[constant[Precompiling model with arguments: {}].format, parameter[name[args]]]]]
return[call[call[name[_jenv].from_string, p... | keyword[def] identifier[from_string] ( identifier[source] , identifier[args] = keyword[None] ):
literal[string]
keyword[if] identifier[_has_jinja] :
identifier[logger] . identifier[info] ( literal[string] . identifier[format] ( identifier[args] ))
keyword[return] identifier[_jenv] . ide... | def from_string(source, args=None):
"""Renders a template string"""
if _has_jinja:
logger.info('Precompiling model with arguments: {}'.format(args))
return _jenv.from_string(source).render(args or {}) # depends on [control=['if'], data=[]]
if args:
raise RuntimeError(_except_text) ... |
def add_roles(self, databaseName, roleNames, collectionName=None):
"""Add multiple roles
Args:
databaseName (str): Database Name
roleNames (list of RoleSpecs): roles
Keyword Args:
collectionName (str): Collection
Raises:
... | def function[add_roles, parameter[self, databaseName, roleNames, collectionName]]:
constant[Add multiple roles
Args:
databaseName (str): Database Name
roleNames (list of RoleSpecs): roles
Keyword Args:
collectionName (str): Collection
... | keyword[def] identifier[add_roles] ( identifier[self] , identifier[databaseName] , identifier[roleNames] , identifier[collectionName] = keyword[None] ):
literal[string]
keyword[for] identifier[roleName] keyword[in] identifier[roleNames] :
identifier[self] . identifier[add_role] ( id... | def add_roles(self, databaseName, roleNames, collectionName=None):
"""Add multiple roles
Args:
databaseName (str): Database Name
roleNames (list of RoleSpecs): roles
Keyword Args:
collectionName (str): Collection
Raises:
... |
def getSkeletalBoneDataCompressed(self, action, eMotionRange, pvCompressedData, unCompressedSize):
"""
Reads the state of the skeletal bone data in a compressed form that is suitable for
sending over the network. The required buffer size will never exceed ( sizeof(VR_BoneTransform_t)*boneCount +... | def function[getSkeletalBoneDataCompressed, parameter[self, action, eMotionRange, pvCompressedData, unCompressedSize]]:
constant[
Reads the state of the skeletal bone data in a compressed form that is suitable for
sending over the network. The required buffer size will never exceed ( sizeof(VR_B... | keyword[def] identifier[getSkeletalBoneDataCompressed] ( identifier[self] , identifier[action] , identifier[eMotionRange] , identifier[pvCompressedData] , identifier[unCompressedSize] ):
literal[string]
identifier[fn] = identifier[self] . identifier[function_table] . identifier[getSkeletalBoneData... | def getSkeletalBoneDataCompressed(self, action, eMotionRange, pvCompressedData, unCompressedSize):
"""
Reads the state of the skeletal bone data in a compressed form that is suitable for
sending over the network. The required buffer size will never exceed ( sizeof(VR_BoneTransform_t)*boneCount + 2).... |
def write_json_file(argname, cmd, basename, filename):
"""
Write JSON captured from the defined argname into the package's
egg-info directory using the specified filename.
"""
value = getattr(cmd.distribution, argname, None)
if isinstance(value, dict):
value = json.dumps(
v... | def function[write_json_file, parameter[argname, cmd, basename, filename]]:
constant[
Write JSON captured from the defined argname into the package's
egg-info directory using the specified filename.
]
variable[value] assign[=] call[name[getattr], parameter[name[cmd].distribution, name[argnam... | keyword[def] identifier[write_json_file] ( identifier[argname] , identifier[cmd] , identifier[basename] , identifier[filename] ):
literal[string]
identifier[value] = identifier[getattr] ( identifier[cmd] . identifier[distribution] , identifier[argname] , keyword[None] )
keyword[if] identifier[isins... | def write_json_file(argname, cmd, basename, filename):
"""
Write JSON captured from the defined argname into the package's
egg-info directory using the specified filename.
"""
value = getattr(cmd.distribution, argname, None)
if isinstance(value, dict):
value = json.dumps(value, indent=4,... |
def build_tags_part(tags, attr_normal, attr_focus):
"""
create an urwid.Columns widget (wrapped in approproate Attributes)
to display a list of tag strings, as part of a threadline.
:param tags: list of tag strings to include
:type tags: list of str
:param attr_normal: urwid attribute to use if... | def function[build_tags_part, parameter[tags, attr_normal, attr_focus]]:
constant[
create an urwid.Columns widget (wrapped in approproate Attributes)
to display a list of tag strings, as part of a threadline.
:param tags: list of tag strings to include
:type tags: list of str
:param attr_no... | keyword[def] identifier[build_tags_part] ( identifier[tags] , identifier[attr_normal] , identifier[attr_focus] ):
literal[string]
identifier[part_w] = keyword[None]
identifier[width] = keyword[None]
identifier[tag_widgets] =[]
identifier[cols] =[]
identifier[width] =- literal[int]
... | def build_tags_part(tags, attr_normal, attr_focus):
"""
create an urwid.Columns widget (wrapped in approproate Attributes)
to display a list of tag strings, as part of a threadline.
:param tags: list of tag strings to include
:type tags: list of str
:param attr_normal: urwid attribute to use if... |
def create_task(self, task_name=None, script=None, hyper_parameters=None, saved_result_keys=None, **kwargs):
"""Uploads a task to the database, timestamp will be added automatically.
Parameters
-----------
task_name : str
The task name.
script : str
File ... | def function[create_task, parameter[self, task_name, script, hyper_parameters, saved_result_keys]]:
constant[Uploads a task to the database, timestamp will be added automatically.
Parameters
-----------
task_name : str
The task name.
script : str
File nam... | keyword[def] identifier[create_task] ( identifier[self] , identifier[task_name] = keyword[None] , identifier[script] = keyword[None] , identifier[hyper_parameters] = keyword[None] , identifier[saved_result_keys] = keyword[None] ,** identifier[kwargs] ):
literal[string]
keyword[if] keyword[not] id... | def create_task(self, task_name=None, script=None, hyper_parameters=None, saved_result_keys=None, **kwargs):
"""Uploads a task to the database, timestamp will be added automatically.
Parameters
-----------
task_name : str
The task name.
script : str
File name... |
def parse_parameters(payflowpro_response_data):
"""
Parses a set of Payflow Pro response parameter name and value pairs into
a list of PayflowProObjects, and returns a tuple containing the object
list and a dictionary containing any unconsumed data.
The first item in the object list will alwa... | def function[parse_parameters, parameter[payflowpro_response_data]]:
constant[
Parses a set of Payflow Pro response parameter name and value pairs into
a list of PayflowProObjects, and returns a tuple containing the object
list and a dictionary containing any unconsumed data.
The first it... | keyword[def] identifier[parse_parameters] ( identifier[payflowpro_response_data] ):
literal[string]
keyword[def] identifier[build_class] ( identifier[klass] , identifier[unconsumed_data] ):
identifier[known_att_names_set] = identifier[set] ( identifier[klass] . identifier[base_fields] . identifie... | def parse_parameters(payflowpro_response_data):
"""
Parses a set of Payflow Pro response parameter name and value pairs into
a list of PayflowProObjects, and returns a tuple containing the object
list and a dictionary containing any unconsumed data.
The first item in the object list will alwa... |
def infer_import(self, context=None, asname=True):
"""infer an Import node: return the imported module/object"""
name = context.lookupname
if name is None:
raise exceptions.InferenceError(node=self, context=context)
try:
if asname:
yield self.do_import_module(self.real_name(... | def function[infer_import, parameter[self, context, asname]]:
constant[infer an Import node: return the imported module/object]
variable[name] assign[=] name[context].lookupname
if compare[name[name] is constant[None]] begin[:]
<ast.Raise object at 0x7da1b1e65d50>
<ast.Try object at ... | keyword[def] identifier[infer_import] ( identifier[self] , identifier[context] = keyword[None] , identifier[asname] = keyword[True] ):
literal[string]
identifier[name] = identifier[context] . identifier[lookupname]
keyword[if] identifier[name] keyword[is] keyword[None] :
keyword[raise] i... | def infer_import(self, context=None, asname=True):
"""infer an Import node: return the imported module/object"""
name = context.lookupname
if name is None:
raise exceptions.InferenceError(node=self, context=context) # depends on [control=['if'], data=[]]
try:
if asname:
yiel... |
def set_title(self, title):
"""
Set title. You can set multiple titles.
:Args:
- title: Title value
"""
self.title = title
self.add_metadata('DC', 'title', self.title) | def function[set_title, parameter[self, title]]:
constant[
Set title. You can set multiple titles.
:Args:
- title: Title value
]
name[self].title assign[=] name[title]
call[name[self].add_metadata, parameter[constant[DC], constant[title], name[self].title]] | keyword[def] identifier[set_title] ( identifier[self] , identifier[title] ):
literal[string]
identifier[self] . identifier[title] = identifier[title]
identifier[self] . identifier[add_metadata] ( literal[string] , literal[string] , identifier[self] . identifier[title] ) | def set_title(self, title):
"""
Set title. You can set multiple titles.
:Args:
- title: Title value
"""
self.title = title
self.add_metadata('DC', 'title', self.title) |
def ball_count(cls, ball_tally, strike_tally, pitch_res):
"""
Ball/Strike counter
:param ball_tally: Ball telly
:param strike_tally: Strike telly
:param pitch_res: pitching result(Retrosheet format)
:return: ball count, strike count
"""
b, s = ball_tally, ... | def function[ball_count, parameter[cls, ball_tally, strike_tally, pitch_res]]:
constant[
Ball/Strike counter
:param ball_tally: Ball telly
:param strike_tally: Strike telly
:param pitch_res: pitching result(Retrosheet format)
:return: ball count, strike count
]
... | keyword[def] identifier[ball_count] ( identifier[cls] , identifier[ball_tally] , identifier[strike_tally] , identifier[pitch_res] ):
literal[string]
identifier[b] , identifier[s] = identifier[ball_tally] , identifier[strike_tally]
keyword[if] identifier[pitch_res] == literal[string] :
... | def ball_count(cls, ball_tally, strike_tally, pitch_res):
"""
Ball/Strike counter
:param ball_tally: Ball telly
:param strike_tally: Strike telly
:param pitch_res: pitching result(Retrosheet format)
:return: ball count, strike count
"""
(b, s) = (ball_tally, strik... |
def mergeConfigObj(configObj, inputDict):
""" Merge the inputDict values into an existing given configObj instance.
The inputDict is a "flat" dict - it has no sections/sub-sections. The
configObj may have sub-sections nested to any depth. This will raise a
DuplicateKeyError if one of the inputDict key... | def function[mergeConfigObj, parameter[configObj, inputDict]]:
constant[ Merge the inputDict values into an existing given configObj instance.
The inputDict is a "flat" dict - it has no sections/sub-sections. The
configObj may have sub-sections nested to any depth. This will raise a
DuplicateKeyEr... | keyword[def] identifier[mergeConfigObj] ( identifier[configObj] , identifier[inputDict] ):
literal[string]
keyword[for] identifier[key] keyword[in] identifier[inputDict] :
keyword[if] identifier[countKey] ( identifier[configObj] , identifier[key] )> literal[int] :
keywo... | def mergeConfigObj(configObj, inputDict):
""" Merge the inputDict values into an existing given configObj instance.
The inputDict is a "flat" dict - it has no sections/sub-sections. The
configObj may have sub-sections nested to any depth. This will raise a
DuplicateKeyError if one of the inputDict key... |
def make_separate_indels_and_one_alt_with_all_snps_no_combinations(self, ref_seq):
'''Returns a VCF record, where each indel from this
cluster is in a separate ALT. Then all the remaining SNPs are
applied to make one ALT. If >1 SNP in same place, either one
might be used'''
final... | def function[make_separate_indels_and_one_alt_with_all_snps_no_combinations, parameter[self, ref_seq]]:
constant[Returns a VCF record, where each indel from this
cluster is in a separate ALT. Then all the remaining SNPs are
applied to make one ALT. If >1 SNP in same place, either one
mig... | keyword[def] identifier[make_separate_indels_and_one_alt_with_all_snps_no_combinations] ( identifier[self] , identifier[ref_seq] ):
literal[string]
identifier[final_start_position] = identifier[min] ([ identifier[x] . identifier[POS] keyword[for] identifier[x] keyword[in] identifier[self] . ide... | def make_separate_indels_and_one_alt_with_all_snps_no_combinations(self, ref_seq):
"""Returns a VCF record, where each indel from this
cluster is in a separate ALT. Then all the remaining SNPs are
applied to make one ALT. If >1 SNP in same place, either one
might be used"""
final_start_p... |
async def print_what_is_playing(loop):
"""Connect to device and print what is playing."""
details = conf.AppleTV(ADDRESS, NAME)
details.add_service(conf.DmapService(HSGID))
print('Connecting to {}'.format(details.address))
atv = pyatv.connect_to_apple_tv(details, loop)
try:
print((awai... | <ast.AsyncFunctionDef object at 0x7da18f7215d0> | keyword[async] keyword[def] identifier[print_what_is_playing] ( identifier[loop] ):
literal[string]
identifier[details] = identifier[conf] . identifier[AppleTV] ( identifier[ADDRESS] , identifier[NAME] )
identifier[details] . identifier[add_service] ( identifier[conf] . identifier[DmapService] ( iden... | async def print_what_is_playing(loop):
"""Connect to device and print what is playing."""
details = conf.AppleTV(ADDRESS, NAME)
details.add_service(conf.DmapService(HSGID))
print('Connecting to {}'.format(details.address))
atv = pyatv.connect_to_apple_tv(details, loop)
try:
print(await a... |
def lazy_module(modname, error_strings=None, lazy_mod_class=LazyModule,
level='leaf'):
"""Function allowing lazy importing of a module into the namespace.
A lazy module object is created, registered in `sys.modules`, and
returned. This is a hollow module; actual loading, and `ImportErrors... | def function[lazy_module, parameter[modname, error_strings, lazy_mod_class, level]]:
constant[Function allowing lazy importing of a module into the namespace.
A lazy module object is created, registered in `sys.modules`, and
returned. This is a hollow module; actual loading, and `ImportErrors` if
n... | keyword[def] identifier[lazy_module] ( identifier[modname] , identifier[error_strings] = keyword[None] , identifier[lazy_mod_class] = identifier[LazyModule] ,
identifier[level] = literal[string] ):
literal[string]
keyword[if] identifier[error_strings] keyword[is] keyword[None] :
identifier[err... | def lazy_module(modname, error_strings=None, lazy_mod_class=LazyModule, level='leaf'):
"""Function allowing lazy importing of a module into the namespace.
A lazy module object is created, registered in `sys.modules`, and
returned. This is a hollow module; actual loading, and `ImportErrors` if
not found... |
def resume(self):
"""
Resumes execution on all threads of the process.
@raise WindowsError: On error an exception is raised.
"""
if self.get_thread_count() == 0:
self.scan_threads() # only refresh the snapshot if empty
resumed = list()
try:
... | def function[resume, parameter[self]]:
constant[
Resumes execution on all threads of the process.
@raise WindowsError: On error an exception is raised.
]
if compare[call[name[self].get_thread_count, parameter[]] equal[==] constant[0]] begin[:]
call[name[self].sca... | keyword[def] identifier[resume] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[get_thread_count] ()== literal[int] :
identifier[self] . identifier[scan_threads] ()
identifier[resumed] = identifier[list] ()
keyword[try] :
... | def resume(self):
"""
Resumes execution on all threads of the process.
@raise WindowsError: On error an exception is raised.
"""
if self.get_thread_count() == 0:
self.scan_threads() # only refresh the snapshot if empty # depends on [control=['if'], data=[]]
resumed = list(... |
def windspeed(self, t):
"""Return the wind speed list at time `t`"""
ws = [0] * self.n
for i in range(self.n):
q = ceil(t / self.dt[i])
q_prev = 0 if q == 0 else q - 1
r = t % self.dt[i]
r = 0 if abs(r) < 1e-6 else r
if r == 0:
... | def function[windspeed, parameter[self, t]]:
constant[Return the wind speed list at time `t`]
variable[ws] assign[=] binary_operation[list[[<ast.Constant object at 0x7da20e74b3d0>]] * name[self].n]
for taget[name[i]] in starred[call[name[range], parameter[name[self].n]]] begin[:]
... | keyword[def] identifier[windspeed] ( identifier[self] , identifier[t] ):
literal[string]
identifier[ws] =[ literal[int] ]* identifier[self] . identifier[n]
keyword[for] identifier[i] keyword[in] identifier[range] ( identifier[self] . identifier[n] ):
identifier[q] = ident... | def windspeed(self, t):
"""Return the wind speed list at time `t`"""
ws = [0] * self.n
for i in range(self.n):
q = ceil(t / self.dt[i])
q_prev = 0 if q == 0 else q - 1
r = t % self.dt[i]
r = 0 if abs(r) < 1e-06 else r
if r == 0:
ws[i] = self.speed[i][q] #... |
def _loop_no_cache(self, helper_function, num, fragment):
""" Synthesize all fragments without using the cache """
self.log([u"Examining fragment %d (no cache)...", num])
# synthesize and get the duration of the output file
voice_code = self._language_to_voice_code(fragment.language)
... | def function[_loop_no_cache, parameter[self, helper_function, num, fragment]]:
constant[ Synthesize all fragments without using the cache ]
call[name[self].log, parameter[list[[<ast.Constant object at 0x7da18dc982e0>, <ast.Name object at 0x7da18dc99390>]]]]
variable[voice_code] assign[=] call[na... | keyword[def] identifier[_loop_no_cache] ( identifier[self] , identifier[helper_function] , identifier[num] , identifier[fragment] ):
literal[string]
identifier[self] . identifier[log] ([ literal[string] , identifier[num] ])
identifier[voice_code] = identifier[self] . identifier[_l... | def _loop_no_cache(self, helper_function, num, fragment):
""" Synthesize all fragments without using the cache """
self.log([u'Examining fragment %d (no cache)...', num])
# synthesize and get the duration of the output file
voice_code = self._language_to_voice_code(fragment.language)
self.log(u'Call... |
def from_dict(cls, copula_dict):
"""Set attributes with provided values."""
instance = cls()
instance.fitted = copula_dict['fitted']
instance.constant_value = copula_dict['constant_value']
if instance.fitted and not instance.constant_value:
instance.model = scipy.st... | def function[from_dict, parameter[cls, copula_dict]]:
constant[Set attributes with provided values.]
variable[instance] assign[=] call[name[cls], parameter[]]
name[instance].fitted assign[=] call[name[copula_dict]][constant[fitted]]
name[instance].constant_value assign[=] call[name[copul... | keyword[def] identifier[from_dict] ( identifier[cls] , identifier[copula_dict] ):
literal[string]
identifier[instance] = identifier[cls] ()
identifier[instance] . identifier[fitted] = identifier[copula_dict] [ literal[string] ]
identifier[instance] . identifier[constant_value] = ... | def from_dict(cls, copula_dict):
"""Set attributes with provided values."""
instance = cls()
instance.fitted = copula_dict['fitted']
instance.constant_value = copula_dict['constant_value']
if instance.fitted and (not instance.constant_value):
instance.model = scipy.stats.gaussian_kde([-1, 0,... |
def rm_watch(self, wd, rec=False, quiet=True):
"""
Removes watch(s).
@param wd: Watch Descriptor of the file or directory to unwatch.
Also accepts a list of WDs.
@type wd: int or list of int.
@param rec: Recursively removes watches on every already watched
... | def function[rm_watch, parameter[self, wd, rec, quiet]]:
constant[
Removes watch(s).
@param wd: Watch Descriptor of the file or directory to unwatch.
Also accepts a list of WDs.
@type wd: int or list of int.
@param rec: Recursively removes watches on every alr... | keyword[def] identifier[rm_watch] ( identifier[self] , identifier[wd] , identifier[rec] = keyword[False] , identifier[quiet] = keyword[True] ):
literal[string]
identifier[lwd] = identifier[self] . identifier[__format_param] ( identifier[wd] )
keyword[if] identifier[rec] :
ide... | def rm_watch(self, wd, rec=False, quiet=True):
"""
Removes watch(s).
@param wd: Watch Descriptor of the file or directory to unwatch.
Also accepts a list of WDs.
@type wd: int or list of int.
@param rec: Recursively removes watches on every already watched
... |
def get_osm_filter(network_type):
"""
Create a filter to query OSM for the specified network type.
Parameters
----------
network_type : string
{'walk', 'bike', 'drive', 'drive_service', 'all', 'all_private', 'none'}
what type of street or other network to get
Returns
------... | def function[get_osm_filter, parameter[network_type]]:
constant[
Create a filter to query OSM for the specified network type.
Parameters
----------
network_type : string
{'walk', 'bike', 'drive', 'drive_service', 'all', 'all_private', 'none'}
what type of street or other network... | keyword[def] identifier[get_osm_filter] ( identifier[network_type] ):
literal[string]
identifier[filters] ={}
identifier[filters] [ literal[string] ]=( literal[string]
literal[string]
literal[string]
literal[string] ). identifier[format] ( identifier[settings] . ... | def get_osm_filter(network_type):
"""
Create a filter to query OSM for the specified network type.
Parameters
----------
network_type : string
{'walk', 'bike', 'drive', 'drive_service', 'all', 'all_private', 'none'}
what type of street or other network to get
Returns
------... |
def plot_nodes_pcolor_to_ax(self, ax, nid, **kwargs):
"""Plot node data to an axes object
Parameters
----------
ax : axes object
axes to plot to
nid : int
node id pointing to the respective data set
cmap : string, optional
color map to... | def function[plot_nodes_pcolor_to_ax, parameter[self, ax, nid]]:
constant[Plot node data to an axes object
Parameters
----------
ax : axes object
axes to plot to
nid : int
node id pointing to the respective data set
cmap : string, optional
... | keyword[def] identifier[plot_nodes_pcolor_to_ax] ( identifier[self] , identifier[ax] , identifier[nid] ,** identifier[kwargs] ):
literal[string]
identifier[fig] = identifier[ax] . identifier[get_figure] ()
identifier[x] = identifier[self] . identifier[grid] . identifier[nodes] [ literal[st... | def plot_nodes_pcolor_to_ax(self, ax, nid, **kwargs):
"""Plot node data to an axes object
Parameters
----------
ax : axes object
axes to plot to
nid : int
node id pointing to the respective data set
cmap : string, optional
color map to use... |
def template_exists_db(self, template):
"""
Receives a template and checks if it exists in the database
using the template name and language
"""
name = utils.camel_to_snake(template[0]).upper()
language = utils.camel_to_snake(template[3])
try:
models.E... | def function[template_exists_db, parameter[self, template]]:
constant[
Receives a template and checks if it exists in the database
using the template name and language
]
variable[name] assign[=] call[call[name[utils].camel_to_snake, parameter[call[name[template]][constant[0]]]].u... | keyword[def] identifier[template_exists_db] ( identifier[self] , identifier[template] ):
literal[string]
identifier[name] = identifier[utils] . identifier[camel_to_snake] ( identifier[template] [ literal[int] ]). identifier[upper] ()
identifier[language] = identifier[utils] . identifier[ca... | def template_exists_db(self, template):
"""
Receives a template and checks if it exists in the database
using the template name and language
"""
name = utils.camel_to_snake(template[0]).upper()
language = utils.camel_to_snake(template[3])
try:
models.EmailTemplate.objects... |
def _set_weight(self, v, load=False):
"""
Setter method for weight, mapped from YANG variable /routing_system/route_map/content/set/weight (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_weight is considered as a private
method. Backends looking to popula... | def function[_set_weight, parameter[self, v, load]]:
constant[
Setter method for weight, mapped from YANG variable /routing_system/route_map/content/set/weight (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_weight is considered as a private
method. B... | keyword[def] identifier[_set_weight] ( identifier[self] , identifier[v] , identifier[load] = keyword[False] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[v] , literal[string] ):
identifier[v] = identifier[v] . identifier[_utype] ( identifier[v] )
keyword[try] :
identif... | def _set_weight(self, v, load=False):
"""
Setter method for weight, mapped from YANG variable /routing_system/route_map/content/set/weight (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_weight is considered as a private
method. Backends looking to popula... |
def seek(self, offset, whence=os.SEEK_SET):
"""Seeks to an offset within the file-like object.
Args:
offset (int): offset to seek to.
whence (Optional(int)): value that indicates whether offset is an absolute
or relative position within the file.
Raises:
IOError: if the seek fa... | def function[seek, parameter[self, offset, whence]]:
constant[Seeks to an offset within the file-like object.
Args:
offset (int): offset to seek to.
whence (Optional(int)): value that indicates whether offset is an absolute
or relative position within the file.
Raises:
IOEr... | keyword[def] identifier[seek] ( identifier[self] , identifier[offset] , identifier[whence] = identifier[os] . identifier[SEEK_SET] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_is_open] :
keyword[raise] identifier[IOError] ( literal[string] )
... | def seek(self, offset, whence=os.SEEK_SET):
"""Seeks to an offset within the file-like object.
Args:
offset (int): offset to seek to.
whence (Optional(int)): value that indicates whether offset is an absolute
or relative position within the file.
Raises:
IOError: if the seek fa... |
def _add_call_site(self, call_site_addr, call_target_addr, retn_addr):
"""
Registers a basic block as calling a function and returning somewhere.
:param call_site_addr: The address of a basic block that ends in a call.
:param call_target_addr: The address of the target of said... | def function[_add_call_site, parameter[self, call_site_addr, call_target_addr, retn_addr]]:
constant[
Registers a basic block as calling a function and returning somewhere.
:param call_site_addr: The address of a basic block that ends in a call.
:param call_target_addr: The ad... | keyword[def] identifier[_add_call_site] ( identifier[self] , identifier[call_site_addr] , identifier[call_target_addr] , identifier[retn_addr] ):
literal[string]
identifier[self] . identifier[_call_sites] [ identifier[call_site_addr] ]=( identifier[call_target_addr] , identifier[retn_addr] ) | def _add_call_site(self, call_site_addr, call_target_addr, retn_addr):
"""
Registers a basic block as calling a function and returning somewhere.
:param call_site_addr: The address of a basic block that ends in a call.
:param call_target_addr: The address of the target of said cal... |
def check_password_readable(self, section, fields):
"""Check if there is a readable configuration file and print a warning."""
if not fields:
return
# The information which of the configuration files
# included which option is not available. To avoid false positives,
... | def function[check_password_readable, parameter[self, section, fields]]:
constant[Check if there is a readable configuration file and print a warning.]
if <ast.UnaryOp object at 0x7da20e954f40> begin[:]
return[None]
if compare[call[name[len], parameter[name[self].read_ok]] not_equal[!=] ... | keyword[def] identifier[check_password_readable] ( identifier[self] , identifier[section] , identifier[fields] ):
literal[string]
keyword[if] keyword[not] identifier[fields] :
keyword[return]
keyword[if] identifier[len] ( identifier[s... | def check_password_readable(self, section, fields):
"""Check if there is a readable configuration file and print a warning."""
if not fields:
return # depends on [control=['if'], data=[]]
# The information which of the configuration files
# included which option is not available. To avoid fals... |
def get_master_url(request, image_id):
'''
get image's master url
...
:param request: http GET request /renderer/master/url/<image_id>/
:param image_id: the master image primary key
:return: master url in a json dictionary
'''
im = get_object_or_404(MasterImage, pk=image_id)
retur... | def function[get_master_url, parameter[request, image_id]]:
constant[
get image's master url
...
:param request: http GET request /renderer/master/url/<image_id>/
:param image_id: the master image primary key
:return: master url in a json dictionary
]
variable[im] assign[=] cal... | keyword[def] identifier[get_master_url] ( identifier[request] , identifier[image_id] ):
literal[string]
identifier[im] = identifier[get_object_or_404] ( identifier[MasterImage] , identifier[pk] = identifier[image_id] )
keyword[return] identifier[JsonResponse] ({ literal[string] : identifier[im] . id... | def get_master_url(request, image_id):
"""
get image's master url
...
:param request: http GET request /renderer/master/url/<image_id>/
:param image_id: the master image primary key
:return: master url in a json dictionary
"""
im = get_object_or_404(MasterImage, pk=image_id)
return... |
def calc_search_range(url, match_type, surt_ordered=True, url_canon=None):
"""
Canonicalize a url (either with custom canonicalizer or
standard canonicalizer with or without surt)
Then, compute a start and end search url search range
for a given match type.
Support match types:
* exact
... | def function[calc_search_range, parameter[url, match_type, surt_ordered, url_canon]]:
constant[
Canonicalize a url (either with custom canonicalizer or
standard canonicalizer with or without surt)
Then, compute a start and end search url search range
for a given match type.
Support match t... | keyword[def] identifier[calc_search_range] ( identifier[url] , identifier[match_type] , identifier[surt_ordered] = keyword[True] , identifier[url_canon] = keyword[None] ):
literal[string]
keyword[def] identifier[inc_last_char] ( identifier[x] ):
keyword[return] identifier[x] [ literal[int] :- li... | def calc_search_range(url, match_type, surt_ordered=True, url_canon=None):
"""
Canonicalize a url (either with custom canonicalizer or
standard canonicalizer with or without surt)
Then, compute a start and end search url search range
for a given match type.
Support match types:
* exact
... |
def from_payload(self, payload):
"""Init frame from binary data."""
self._software_version = payload[0:6]
self.hardware_version = payload[6]
self.product_group = payload[7]
self.product_type = payload[8] | def function[from_payload, parameter[self, payload]]:
constant[Init frame from binary data.]
name[self]._software_version assign[=] call[name[payload]][<ast.Slice object at 0x7da20c6c64d0>]
name[self].hardware_version assign[=] call[name[payload]][constant[6]]
name[self].product_group as... | keyword[def] identifier[from_payload] ( identifier[self] , identifier[payload] ):
literal[string]
identifier[self] . identifier[_software_version] = identifier[payload] [ literal[int] : literal[int] ]
identifier[self] . identifier[hardware_version] = identifier[payload] [ literal[int] ]
... | def from_payload(self, payload):
"""Init frame from binary data."""
self._software_version = payload[0:6]
self.hardware_version = payload[6]
self.product_group = payload[7]
self.product_type = payload[8] |
def activities(self, *args, **kwargs):
"""Retrieve activities belonging to this scope.
See :class:`pykechain.Client.activities` for available parameters.
"""
if self._client.match_app_version(label='wim', version='<2.0.0', default=True):
return self._client.activities(*args,... | def function[activities, parameter[self]]:
constant[Retrieve activities belonging to this scope.
See :class:`pykechain.Client.activities` for available parameters.
]
if call[name[self]._client.match_app_version, parameter[]] begin[:]
return[call[name[self]._client.activities, pa... | keyword[def] identifier[activities] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[if] identifier[self] . identifier[_client] . identifier[match_app_version] ( identifier[label] = literal[string] , identifier[version] = literal[string] , identifier[default... | def activities(self, *args, **kwargs):
"""Retrieve activities belonging to this scope.
See :class:`pykechain.Client.activities` for available parameters.
"""
if self._client.match_app_version(label='wim', version='<2.0.0', default=True):
return self._client.activities(*args, scope=self.... |
def setExtension(self, ext):
"""
Set a new file extension for the sequence.
Note:
A leading period will be added if none is provided.
Args:
ext (str): the new file extension
"""
if ext[0] != ".":
ext = "." + ext
self._ext = ut... | def function[setExtension, parameter[self, ext]]:
constant[
Set a new file extension for the sequence.
Note:
A leading period will be added if none is provided.
Args:
ext (str): the new file extension
]
if compare[call[name[ext]][constant[0]] not... | keyword[def] identifier[setExtension] ( identifier[self] , identifier[ext] ):
literal[string]
keyword[if] identifier[ext] [ literal[int] ]!= literal[string] :
identifier[ext] = literal[string] + identifier[ext]
identifier[self] . identifier[_ext] = identifier[utils] . identi... | def setExtension(self, ext):
"""
Set a new file extension for the sequence.
Note:
A leading period will be added if none is provided.
Args:
ext (str): the new file extension
"""
if ext[0] != '.':
ext = '.' + ext # depends on [control=['if'], dat... |
def _getitem(self, key, validate=False):
"""Return specified page from cache or file."""
key = int(key)
pages = self.pages
if key < 0:
key %= len(self)
elif self._indexed and key >= len(pages):
raise IndexError('index out of range')
if key < len(... | def function[_getitem, parameter[self, key, validate]]:
constant[Return specified page from cache or file.]
variable[key] assign[=] call[name[int], parameter[name[key]]]
variable[pages] assign[=] name[self].pages
if compare[name[key] less[<] constant[0]] begin[:]
<ast.AugAssign o... | keyword[def] identifier[_getitem] ( identifier[self] , identifier[key] , identifier[validate] = keyword[False] ):
literal[string]
identifier[key] = identifier[int] ( identifier[key] )
identifier[pages] = identifier[self] . identifier[pages]
keyword[if] identifier[key] < literal... | def _getitem(self, key, validate=False):
"""Return specified page from cache or file."""
key = int(key)
pages = self.pages
if key < 0:
key %= len(self) # depends on [control=['if'], data=['key']]
elif self._indexed and key >= len(pages):
raise IndexError('index out of range') # dep... |
def order_param(dts, axis=2):
"""Order parameter of phase synchronization"""
return np.abs(np.exp(1.0j * dts).mean(axis=axis)) | def function[order_param, parameter[dts, axis]]:
constant[Order parameter of phase synchronization]
return[call[name[np].abs, parameter[call[call[name[np].exp, parameter[binary_operation[constant[1j] * name[dts]]]].mean, parameter[]]]]] | keyword[def] identifier[order_param] ( identifier[dts] , identifier[axis] = literal[int] ):
literal[string]
keyword[return] identifier[np] . identifier[abs] ( identifier[np] . identifier[exp] ( literal[int] * identifier[dts] ). identifier[mean] ( identifier[axis] = identifier[axis] )) | def order_param(dts, axis=2):
"""Order parameter of phase synchronization"""
return np.abs(np.exp(1j * dts).mean(axis=axis)) |
def _add_record(self, record_set_class, name, values, ttl=60, weight=None,
region=None,set_identifier=None, alias_hosted_zone_id=None,
alias_dns_name=None):
"""
Convenience method for creating ResourceRecordSets. Most of the calls
are basically the same, t... | def function[_add_record, parameter[self, record_set_class, name, values, ttl, weight, region, set_identifier, alias_hosted_zone_id, alias_dns_name]]:
constant[
Convenience method for creating ResourceRecordSets. Most of the calls
are basically the same, this saves on repetition.
:rtype... | keyword[def] identifier[_add_record] ( identifier[self] , identifier[record_set_class] , identifier[name] , identifier[values] , identifier[ttl] = literal[int] , identifier[weight] = keyword[None] ,
identifier[region] = keyword[None] , identifier[set_identifier] = keyword[None] , identifier[alias_hosted_zone_id] = k... | def _add_record(self, record_set_class, name, values, ttl=60, weight=None, region=None, set_identifier=None, alias_hosted_zone_id=None, alias_dns_name=None):
"""
Convenience method for creating ResourceRecordSets. Most of the calls
are basically the same, this saves on repetition.
:rtype: t... |
def get_common_cbc_transforms(requested_params, variable_args,
valid_params=None):
"""Determines if any additional parameters from the InferenceFile are
needed to get derived parameters that user has asked for.
First it will try to add any base parameters that are required to ... | def function[get_common_cbc_transforms, parameter[requested_params, variable_args, valid_params]]:
constant[Determines if any additional parameters from the InferenceFile are
needed to get derived parameters that user has asked for.
First it will try to add any base parameters that are required to calc... | keyword[def] identifier[get_common_cbc_transforms] ( identifier[requested_params] , identifier[variable_args] ,
identifier[valid_params] = keyword[None] ):
literal[string]
identifier[variable_args] = identifier[set] ( identifier[variable_args] ) keyword[if] keyword[not] identifier[isinstance] ( identifi... | def get_common_cbc_transforms(requested_params, variable_args, valid_params=None):
"""Determines if any additional parameters from the InferenceFile are
needed to get derived parameters that user has asked for.
First it will try to add any base parameters that are required to calculate
the derived para... |
def _valid_locales(locales, normalize):
"""
Return a list of normalized locales that do not throw an ``Exception``
when set.
Parameters
----------
locales : str
A string where each locale is separated by a newline.
normalize : bool
Whether to call ``locale.normalize`` on eac... | def function[_valid_locales, parameter[locales, normalize]]:
constant[
Return a list of normalized locales that do not throw an ``Exception``
when set.
Parameters
----------
locales : str
A string where each locale is separated by a newline.
normalize : bool
Whether to c... | keyword[def] identifier[_valid_locales] ( identifier[locales] , identifier[normalize] ):
literal[string]
keyword[if] identifier[normalize] :
identifier[normalizer] = keyword[lambda] identifier[x] : identifier[locale] . identifier[normalize] ( identifier[x] . identifier[strip] ())
keyword[el... | def _valid_locales(locales, normalize):
"""
Return a list of normalized locales that do not throw an ``Exception``
when set.
Parameters
----------
locales : str
A string where each locale is separated by a newline.
normalize : bool
Whether to call ``locale.normalize`` on eac... |
def build_source_namespace_filter(namespaces: Strings) -> EdgePredicate:
"""Pass for edges whose source nodes have the given namespace or one of the given namespaces.
:param namespaces: The namespace or namespaces to filter by
"""
if isinstance(namespaces, str):
def source_namespace_filter(_, u... | def function[build_source_namespace_filter, parameter[namespaces]]:
constant[Pass for edges whose source nodes have the given namespace or one of the given namespaces.
:param namespaces: The namespace or namespaces to filter by
]
if call[name[isinstance], parameter[name[namespaces], name[str]]]... | keyword[def] identifier[build_source_namespace_filter] ( identifier[namespaces] : identifier[Strings] )-> identifier[EdgePredicate] :
literal[string]
keyword[if] identifier[isinstance] ( identifier[namespaces] , identifier[str] ):
keyword[def] identifier[source_namespace_filter] ( identifier[_] ... | def build_source_namespace_filter(namespaces: Strings) -> EdgePredicate:
"""Pass for edges whose source nodes have the given namespace or one of the given namespaces.
:param namespaces: The namespace or namespaces to filter by
"""
if isinstance(namespaces, str):
def source_namespace_filter(_, ... |
def mmInformation(NetworkName_presence=0, NetworkName_presence1=0,
TimeZone_presence=0, TimeZoneAndTime_presence=0,
LsaIdentifier_presence=0):
"""MM INFORMATION Section 9.2.15a"""
a = TpPd(pd=0x5)
b = MessageType(mesType=0x32) # 00110010
packet = a / b
if Network... | def function[mmInformation, parameter[NetworkName_presence, NetworkName_presence1, TimeZone_presence, TimeZoneAndTime_presence, LsaIdentifier_presence]]:
constant[MM INFORMATION Section 9.2.15a]
variable[a] assign[=] call[name[TpPd], parameter[]]
variable[b] assign[=] call[name[MessageType], par... | keyword[def] identifier[mmInformation] ( identifier[NetworkName_presence] = literal[int] , identifier[NetworkName_presence1] = literal[int] ,
identifier[TimeZone_presence] = literal[int] , identifier[TimeZoneAndTime_presence] = literal[int] ,
identifier[LsaIdentifier_presence] = literal[int] ):
literal[string]... | def mmInformation(NetworkName_presence=0, NetworkName_presence1=0, TimeZone_presence=0, TimeZoneAndTime_presence=0, LsaIdentifier_presence=0):
"""MM INFORMATION Section 9.2.15a"""
a = TpPd(pd=5)
b = MessageType(mesType=50) # 00110010
packet = a / b
if NetworkName_presence is 1:
c = NetworkN... |
def dispatch_webhook_request(url=None, method='GET', params=None,
json=None, data=None, headers=None, timeout=5):
"""Task dispatching to an URL.
:param url: The URL location of the HTTP callback task.
:param method: Method to use when dispatching the callback. Usually
`... | def function[dispatch_webhook_request, parameter[url, method, params, json, data, headers, timeout]]:
constant[Task dispatching to an URL.
:param url: The URL location of the HTTP callback task.
:param method: Method to use when dispatching the callback. Usually
`GET` or `POST`.
:param para... | keyword[def] identifier[dispatch_webhook_request] ( identifier[url] = keyword[None] , identifier[method] = literal[string] , identifier[params] = keyword[None] ,
identifier[json] = keyword[None] , identifier[data] = keyword[None] , identifier[headers] = keyword[None] , identifier[timeout] = literal[int] ):
lite... | def dispatch_webhook_request(url=None, method='GET', params=None, json=None, data=None, headers=None, timeout=5):
"""Task dispatching to an URL.
:param url: The URL location of the HTTP callback task.
:param method: Method to use when dispatching the callback. Usually
`GET` or `POST`.
:param pa... |
def cleanup(self):
"""
Destructive finishing up after execution stopped.
"""
for actor in self.actors:
if actor.skip:
continue
actor.cleanup()
super(ActorHandler, self).cleanup() | def function[cleanup, parameter[self]]:
constant[
Destructive finishing up after execution stopped.
]
for taget[name[actor]] in starred[name[self].actors] begin[:]
if name[actor].skip begin[:]
continue
call[name[actor].cleanup, parameter[]]
... | keyword[def] identifier[cleanup] ( identifier[self] ):
literal[string]
keyword[for] identifier[actor] keyword[in] identifier[self] . identifier[actors] :
keyword[if] identifier[actor] . identifier[skip] :
keyword[continue]
identifier[actor] . identifi... | def cleanup(self):
"""
Destructive finishing up after execution stopped.
"""
for actor in self.actors:
if actor.skip:
continue # depends on [control=['if'], data=[]]
actor.cleanup() # depends on [control=['for'], data=['actor']]
super(ActorHandler, self).cleanup... |
def parse(self, hcl, canonicalize=False):
""" Parse a HCL Job file. Returns a dict with the JSON formatted job.
This API endpoint is only supported from Nomad version 0.8.3.
https://www.nomadproject.io/api/jobs.html#parse-job
returns: dict
raises:
... | def function[parse, parameter[self, hcl, canonicalize]]:
constant[ Parse a HCL Job file. Returns a dict with the JSON formatted job.
This API endpoint is only supported from Nomad version 0.8.3.
https://www.nomadproject.io/api/jobs.html#parse-job
returns: dict
r... | keyword[def] identifier[parse] ( identifier[self] , identifier[hcl] , identifier[canonicalize] = keyword[False] ):
literal[string]
keyword[return] identifier[self] . identifier[request] ( literal[string] , identifier[json] ={ literal[string] : identifier[hcl] , literal[string] : identifier[canonic... | def parse(self, hcl, canonicalize=False):
""" Parse a HCL Job file. Returns a dict with the JSON formatted job.
This API endpoint is only supported from Nomad version 0.8.3.
https://www.nomadproject.io/api/jobs.html#parse-job
returns: dict
raises:
- no... |
def handle_post_request(self):
"""Handle incoming POST request to an Endpoint and marshal the request data
via the specified RequestHandler. :meth:`.CreateMixin.save_object`. is then
called and must be implemented by mixins implementing this interfce.
.. seealso::
:meth:`Cr... | def function[handle_post_request, parameter[self]]:
constant[Handle incoming POST request to an Endpoint and marshal the request data
via the specified RequestHandler. :meth:`.CreateMixin.save_object`. is then
called and must be implemented by mixins implementing this interfce.
.. seea... | keyword[def] identifier[handle_post_request] ( identifier[self] ):
literal[string]
identifier[self] . identifier[request] = identifier[self] . identifier[get_request_handler] ()
identifier[self] . identifier[obj] = identifier[self] . identifier[request] . identifier[process] (). identifier... | def handle_post_request(self):
"""Handle incoming POST request to an Endpoint and marshal the request data
via the specified RequestHandler. :meth:`.CreateMixin.save_object`. is then
called and must be implemented by mixins implementing this interfce.
.. seealso::
:meth:`Create... |
def load(self, path):
"""Load from disk
Parameters
----------
path : str
path to the directory which typically contains a config.pkl file and a model.bin file
Returns
-------
DepParser
parser itself
"""
config = _Config.lo... | def function[load, parameter[self, path]]:
constant[Load from disk
Parameters
----------
path : str
path to the directory which typically contains a config.pkl file and a model.bin file
Returns
-------
DepParser
parser itself
]
... | keyword[def] identifier[load] ( identifier[self] , identifier[path] ):
literal[string]
identifier[config] = identifier[_Config] . identifier[load] ( identifier[os] . identifier[path] . identifier[join] ( identifier[path] , literal[string] ))
identifier[config] . identifier[save_dir] = iden... | def load(self, path):
"""Load from disk
Parameters
----------
path : str
path to the directory which typically contains a config.pkl file and a model.bin file
Returns
-------
DepParser
parser itself
"""
config = _Config.load(os.pa... |
def get_completed_tasks(self):
"""Return a list of all completed tasks in this project.
:return: A list of all completed tasks in this project.
:rtype: list of :class:`pytodoist.todoist.Task`
>>> from pytodoist import todoist
>>> user = todoist.login('john.doe@gmail.com', 'pass... | def function[get_completed_tasks, parameter[self]]:
constant[Return a list of all completed tasks in this project.
:return: A list of all completed tasks in this project.
:rtype: list of :class:`pytodoist.todoist.Task`
>>> from pytodoist import todoist
>>> user = todoist.login(... | keyword[def] identifier[get_completed_tasks] ( identifier[self] ):
literal[string]
identifier[self] . identifier[owner] . identifier[sync] ()
identifier[tasks] =[]
identifier[offset] = literal[int]
keyword[while] keyword[True] :
identifier[response] = ident... | def get_completed_tasks(self):
"""Return a list of all completed tasks in this project.
:return: A list of all completed tasks in this project.
:rtype: list of :class:`pytodoist.todoist.Task`
>>> from pytodoist import todoist
>>> user = todoist.login('john.doe@gmail.com', 'password... |
def _verify_part_size(self):
"""
Verifies that the part size is smaller then the maximum part size
which is 5GB.
"""
if self._part_size > PartSize.MAXIMUM_UPLOAD_SIZE:
self._status = TransferState.FAILED
raise SbgError('Part size = {}b. Maximum part size i... | def function[_verify_part_size, parameter[self]]:
constant[
Verifies that the part size is smaller then the maximum part size
which is 5GB.
]
if compare[name[self]._part_size greater[>] name[PartSize].MAXIMUM_UPLOAD_SIZE] begin[:]
name[self]._status assign[=] name... | keyword[def] identifier[_verify_part_size] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_part_size] > identifier[PartSize] . identifier[MAXIMUM_UPLOAD_SIZE] :
identifier[self] . identifier[_status] = identifier[TransferState] . identifier[FAILED]
... | def _verify_part_size(self):
"""
Verifies that the part size is smaller then the maximum part size
which is 5GB.
"""
if self._part_size > PartSize.MAXIMUM_UPLOAD_SIZE:
self._status = TransferState.FAILED
raise SbgError('Part size = {}b. Maximum part size is {}b'.format(se... |
def current_song(self, song):
"""设置当前歌曲,将歌曲加入到播放列表,并发出 song_changed 信号
.. note::
该方法理论上只应该被 Player 对象调用。
"""
self._last_song = self.current_song
if song is None:
self._current_song = None
# add it to playlist if song not in playlist
elif ... | def function[current_song, parameter[self, song]]:
constant[设置当前歌曲,将歌曲加入到播放列表,并发出 song_changed 信号
.. note::
该方法理论上只应该被 Player 对象调用。
]
name[self]._last_song assign[=] name[self].current_song
if compare[name[song] is constant[None]] begin[:]
name[self]... | keyword[def] identifier[current_song] ( identifier[self] , identifier[song] ):
literal[string]
identifier[self] . identifier[_last_song] = identifier[self] . identifier[current_song]
keyword[if] identifier[song] keyword[is] keyword[None] :
identifier[self] . identifier[_cu... | def current_song(self, song):
"""设置当前歌曲,将歌曲加入到播放列表,并发出 song_changed 信号
.. note::
该方法理论上只应该被 Player 对象调用。
"""
self._last_song = self.current_song
if song is None:
self._current_song = None # depends on [control=['if'], data=[]]
# add it to playlist if song not in pl... |
def _build_model(self):
"""
Build the model.
"""
if "input_dim" not in self.settings:
raise ValueError("Model parameter input_dim cannot be None.")
self.sparse_linear = SparseLinear(
self.settings["input_dim"], self.cardinality, self.settings["bias"]
... | def function[_build_model, parameter[self]]:
constant[
Build the model.
]
if compare[constant[input_dim] <ast.NotIn object at 0x7da2590d7190> name[self].settings] begin[:]
<ast.Raise object at 0x7da18f00feb0>
name[self].sparse_linear assign[=] call[name[SparseLinear], par... | keyword[def] identifier[_build_model] ( identifier[self] ):
literal[string]
keyword[if] literal[string] keyword[not] keyword[in] identifier[self] . identifier[settings] :
keyword[raise] identifier[ValueError] ( literal[string] )
identifier[self] . identifier[sparse_line... | def _build_model(self):
"""
Build the model.
"""
if 'input_dim' not in self.settings:
raise ValueError('Model parameter input_dim cannot be None.') # depends on [control=['if'], data=[]]
self.sparse_linear = SparseLinear(self.settings['input_dim'], self.cardinality, self.settings['b... |
def str_def(self):
"""
:term:`string`: The exception as a string in a Python definition-style
format, e.g. for parsing by scripts:
.. code-block:: text
classname={}; connect_retries={}; message={};
"""
return "classname={!r}; connect_retries={!r}; message={!... | def function[str_def, parameter[self]]:
constant[
:term:`string`: The exception as a string in a Python definition-style
format, e.g. for parsing by scripts:
.. code-block:: text
classname={}; connect_retries={}; message={};
]
return[call[constant[classname={!r}... | keyword[def] identifier[str_def] ( identifier[self] ):
literal[string]
keyword[return] literal[string] . identifier[format] ( identifier[self] . identifier[__class__] . identifier[__name__] , identifier[self] . identifier[connect_retries] , identifier[self] . identifier[args] [ literal[int] ]) | def str_def(self):
"""
:term:`string`: The exception as a string in a Python definition-style
format, e.g. for parsing by scripts:
.. code-block:: text
classname={}; connect_retries={}; message={};
"""
return 'classname={!r}; connect_retries={!r}; message={!r};'.for... |
def process(self, data):
"""
Update the state based on the incoming data
This function updates the state of the DeviceSpec object, giving values for each
axis [x,y,z,roll,pitch,yaw] in range [-1.0, 1.0]
The state tuple is only set when all 6 DoF have been read correctly.... | def function[process, parameter[self, data]]:
constant[
Update the state based on the incoming data
This function updates the state of the DeviceSpec object, giving values for each
axis [x,y,z,roll,pitch,yaw] in range [-1.0, 1.0]
The state tuple is only set when all 6 Do... | keyword[def] identifier[process] ( identifier[self] , identifier[data] ):
literal[string]
identifier[button_changed] = keyword[False]
keyword[for] identifier[name] ,( identifier[chan] , identifier[b1] , identifier[b2] , identifier[flip] ) keyword[in] identifier[self] . identifier[mappi... | def process(self, data):
"""
Update the state based on the incoming data
This function updates the state of the DeviceSpec object, giving values for each
axis [x,y,z,roll,pitch,yaw] in range [-1.0, 1.0]
The state tuple is only set when all 6 DoF have been read correctly.
... |
def sys_dup(self, fd):
"""
Duplicates an open file descriptor
:rtype: int
:param fd: the open file descriptor to duplicate.
:return: the new file descriptor.
"""
if not self._is_fd_open(fd):
logger.info("DUP: Passed fd is not open. Returning EBADF")
... | def function[sys_dup, parameter[self, fd]]:
constant[
Duplicates an open file descriptor
:rtype: int
:param fd: the open file descriptor to duplicate.
:return: the new file descriptor.
]
if <ast.UnaryOp object at 0x7da1b000ef50> begin[:]
call[name[... | keyword[def] identifier[sys_dup] ( identifier[self] , identifier[fd] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_is_fd_open] ( identifier[fd] ):
identifier[logger] . identifier[info] ( literal[string] )
keyword[return] - identifier[errno] ... | def sys_dup(self, fd):
"""
Duplicates an open file descriptor
:rtype: int
:param fd: the open file descriptor to duplicate.
:return: the new file descriptor.
"""
if not self._is_fd_open(fd):
logger.info('DUP: Passed fd is not open. Returning EBADF')
return... |
def add_paths(self, paths):
"""
Adds entries to the Python path.
The given paths are normalized before being added to the left of the
list
:param paths: New paths to add
"""
if paths:
# Use new paths in priority
self._paths = list(paths) ... | def function[add_paths, parameter[self, paths]]:
constant[
Adds entries to the Python path.
The given paths are normalized before being added to the left of the
list
:param paths: New paths to add
]
if name[paths] begin[:]
name[self]._paths assig... | keyword[def] identifier[add_paths] ( identifier[self] , identifier[paths] ):
literal[string]
keyword[if] identifier[paths] :
identifier[self] . identifier[_paths] = identifier[list] ( identifier[paths] )+ identifier[self] . identifier[_paths] | def add_paths(self, paths):
"""
Adds entries to the Python path.
The given paths are normalized before being added to the left of the
list
:param paths: New paths to add
"""
if paths:
# Use new paths in priority
self._paths = list(paths) + self._paths #... |
def info(self):
"""return info about server as dict object"""
proc_info = {"name": self.name,
"params": self.cfg,
"alive": self.is_alive,
"optfile": self.config_path}
if self.is_alive:
proc_info['pid'] = self.proc.pid
... | def function[info, parameter[self]]:
constant[return info about server as dict object]
variable[proc_info] assign[=] dictionary[[<ast.Constant object at 0x7da18dc9b700>, <ast.Constant object at 0x7da18dc9a230>, <ast.Constant object at 0x7da18dc991e0>, <ast.Constant object at 0x7da18dc99d50>], [<ast.Attr... | keyword[def] identifier[info] ( identifier[self] ):
literal[string]
identifier[proc_info] ={ literal[string] : identifier[self] . identifier[name] ,
literal[string] : identifier[self] . identifier[cfg] ,
literal[string] : identifier[self] . identifier[is_alive] ,
literal[... | def info(self):
"""return info about server as dict object"""
proc_info = {'name': self.name, 'params': self.cfg, 'alive': self.is_alive, 'optfile': self.config_path}
if self.is_alive:
proc_info['pid'] = self.proc.pid # depends on [control=['if'], data=[]]
logger.debug('proc_info: {proc_info}'.... |
def get_matchers():
"""
Get matcher functions from treeherder.autoclassify.matchers
We classify matchers as any function treeherder.autoclassify.matchers with
a name ending in _matcher. This is currently overkill but protects against
the unwarey engineer adding new functions to the matchers module... | def function[get_matchers, parameter[]]:
constant[
Get matcher functions from treeherder.autoclassify.matchers
We classify matchers as any function treeherder.autoclassify.matchers with
a name ending in _matcher. This is currently overkill but protects against
the unwarey engineer adding new f... | keyword[def] identifier[get_matchers] ():
literal[string]
keyword[from] . keyword[import] identifier[matchers]
keyword[def] identifier[is_matcher_func] ( identifier[member] ):
keyword[return] identifier[inspect] . identifier[isfunction] ( identifier[member] ) keyword[and] identifier[mem... | def get_matchers():
"""
Get matcher functions from treeherder.autoclassify.matchers
We classify matchers as any function treeherder.autoclassify.matchers with
a name ending in _matcher. This is currently overkill but protects against
the unwarey engineer adding new functions to the matchers module... |
def _AddCredentialConfiguration(
self, path_spec, credential_type, credential_data):
"""Adds a credential configuration.
Args:
path_spec (dfvfs.PathSpec): path specification.
credential_type (str): credential type.
credential_data (bytes): credential data.
"""
credential_configu... | def function[_AddCredentialConfiguration, parameter[self, path_spec, credential_type, credential_data]]:
constant[Adds a credential configuration.
Args:
path_spec (dfvfs.PathSpec): path specification.
credential_type (str): credential type.
credential_data (bytes): credential data.
]
... | keyword[def] identifier[_AddCredentialConfiguration] (
identifier[self] , identifier[path_spec] , identifier[credential_type] , identifier[credential_data] ):
literal[string]
identifier[credential_configuration] = identifier[configurations] . identifier[CredentialConfiguration] (
identifier[credentia... | def _AddCredentialConfiguration(self, path_spec, credential_type, credential_data):
"""Adds a credential configuration.
Args:
path_spec (dfvfs.PathSpec): path specification.
credential_type (str): credential type.
credential_data (bytes): credential data.
"""
credential_configuration ... |
def QA_fetch_index_min(
code,
start, end,
format='numpy',
frequence='1min',
collections=DATABASE.index_min):
'获取股票分钟线'
if frequence in ['1min', '1m']:
frequence = '1min'
elif frequence in ['5min', '5m']:
frequence = '5min'
elif frequence in ['15min... | def function[QA_fetch_index_min, parameter[code, start, end, format, frequence, collections]]:
constant[获取股票分钟线]
if compare[name[frequence] in list[[<ast.Constant object at 0x7da1b1ff2b30>, <ast.Constant object at 0x7da1b1ff1000>]]] begin[:]
variable[frequence] assign[=] constant[1min]
... | keyword[def] identifier[QA_fetch_index_min] (
identifier[code] ,
identifier[start] , identifier[end] ,
identifier[format] = literal[string] ,
identifier[frequence] = literal[string] ,
identifier[collections] = identifier[DATABASE] . identifier[index_min] ):
literal[string]
keyword[if] identifier[freq... | def QA_fetch_index_min(code, start, end, format='numpy', frequence='1min', collections=DATABASE.index_min):
"""获取股票分钟线"""
if frequence in ['1min', '1m']:
frequence = '1min' # depends on [control=['if'], data=['frequence']]
elif frequence in ['5min', '5m']:
frequence = '5min' # depends on [... |
def distance(self, other, config):
"""
Returns the genetic distance between this genome and the other. This distance value
is used to compute genome compatibility for speciation.
"""
# Compute node gene distance component.
node_distance = 0.0
if self.nodes or oth... | def function[distance, parameter[self, other, config]]:
constant[
Returns the genetic distance between this genome and the other. This distance value
is used to compute genome compatibility for speciation.
]
variable[node_distance] assign[=] constant[0.0]
if <ast.BoolOp o... | keyword[def] identifier[distance] ( identifier[self] , identifier[other] , identifier[config] ):
literal[string]
identifier[node_distance] = literal[int]
keyword[if] identifier[self] . identifier[nodes] keyword[or] identifier[other] . identifier[nodes] :
identifi... | def distance(self, other, config):
"""
Returns the genetic distance between this genome and the other. This distance value
is used to compute genome compatibility for speciation.
"""
# Compute node gene distance component.
node_distance = 0.0
if self.nodes or other.nodes:
... |
def check_resource(resource):
'''
Check a resource availability against a linkchecker backend
The linkchecker used can be configured on a resource basis by setting
the `resource.extras['check:checker']` attribute with a key that points
to a valid `udata.linkcheckers` entrypoint. If not set, it will... | def function[check_resource, parameter[resource]]:
constant[
Check a resource availability against a linkchecker backend
The linkchecker used can be configured on a resource basis by setting
the `resource.extras['check:checker']` attribute with a key that points
to a valid `udata.linkcheckers` ... | keyword[def] identifier[check_resource] ( identifier[resource] ):
literal[string]
identifier[linkchecker_type] = identifier[resource] . identifier[extras] . identifier[get] ( literal[string] )
identifier[LinkChecker] = identifier[get_linkchecker] ( identifier[linkchecker_type] )
keyword[if] keyw... | def check_resource(resource):
"""
Check a resource availability against a linkchecker backend
The linkchecker used can be configured on a resource basis by setting
the `resource.extras['check:checker']` attribute with a key that points
to a valid `udata.linkcheckers` entrypoint. If not set, it will... |
def set_pulse_duration(self, duration):
"""
Sets the pulse duration for events in miliseconds when activate_line
is called
"""
if duration > 4294967295:
raise ValueError('Duration is too long. Please choose a value '
'less than 4294967296.... | def function[set_pulse_duration, parameter[self, duration]]:
constant[
Sets the pulse duration for events in miliseconds when activate_line
is called
]
if compare[name[duration] greater[>] constant[4294967295]] begin[:]
<ast.Raise object at 0x7da20e9b1c60>
variabl... | keyword[def] identifier[set_pulse_duration] ( identifier[self] , identifier[duration] ):
literal[string]
keyword[if] identifier[duration] > literal[int] :
keyword[raise] identifier[ValueError] ( literal[string]
literal[string] )
identifier[big_endian] = identi... | def set_pulse_duration(self, duration):
"""
Sets the pulse duration for events in miliseconds when activate_line
is called
"""
if duration > 4294967295:
raise ValueError('Duration is too long. Please choose a value less than 4294967296.') # depends on [control=['if'], data=[]]
... |
def IPT_to_XYZ(cobj, *args, **kwargs):
"""
Converts IPT to XYZ.
"""
ipt_values = numpy.array(cobj.get_value_tuple())
lms_values = numpy.dot(
numpy.linalg.inv(IPTColor.conversion_matrices['lms_to_ipt']),
ipt_values)
lms_prime = numpy.sign(lms_values) * numpy.abs(lms_values) ** (1... | def function[IPT_to_XYZ, parameter[cobj]]:
constant[
Converts IPT to XYZ.
]
variable[ipt_values] assign[=] call[name[numpy].array, parameter[call[name[cobj].get_value_tuple, parameter[]]]]
variable[lms_values] assign[=] call[name[numpy].dot, parameter[call[name[numpy].linalg.inv, paramet... | keyword[def] identifier[IPT_to_XYZ] ( identifier[cobj] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[ipt_values] = identifier[numpy] . identifier[array] ( identifier[cobj] . identifier[get_value_tuple] ())
identifier[lms_values] = identifier[numpy] . identifier[dot] (
i... | def IPT_to_XYZ(cobj, *args, **kwargs):
"""
Converts IPT to XYZ.
"""
ipt_values = numpy.array(cobj.get_value_tuple())
lms_values = numpy.dot(numpy.linalg.inv(IPTColor.conversion_matrices['lms_to_ipt']), ipt_values)
lms_prime = numpy.sign(lms_values) * numpy.abs(lms_values) ** (1 / 0.43)
xyz_v... |
def _get_config_dirs(self):
"""Return a list of directories where config files may be located.
following directories are returned::
./
../etc
~/
/etc/zvmsdk/
"""
_cwd = os.path.split(os.path.abspath(__file__))[0]
_pdir = os.pat... | def function[_get_config_dirs, parameter[self]]:
constant[Return a list of directories where config files may be located.
following directories are returned::
./
../etc
~/
/etc/zvmsdk/
]
variable[_cwd] assign[=] call[call[name[os].path.split, par... | keyword[def] identifier[_get_config_dirs] ( identifier[self] ):
literal[string]
identifier[_cwd] = identifier[os] . identifier[path] . identifier[split] ( identifier[os] . identifier[path] . identifier[abspath] ( identifier[__file__] ))[ literal[int] ]
identifier[_pdir] = identifier[os]... | def _get_config_dirs(self):
"""Return a list of directories where config files may be located.
following directories are returned::
./
../etc
~/
/etc/zvmsdk/
"""
_cwd = os.path.split(os.path.abspath(__file__))[0]
_pdir = os.path.split(_cwd)[0]
_e... |
def shutdown(self):
"""
Stop broker instance.
Closes all connected session, stop listening on network socket and free resources.
"""
try:
self._sessions = dict()
self._subscriptions = dict()
self._retained_messages = dict()
... | def function[shutdown, parameter[self]]:
constant[
Stop broker instance.
Closes all connected session, stop listening on network socket and free resources.
]
<ast.Try object at 0x7da18fe90760>
<ast.YieldFrom object at 0x7da18fe90f70>
if name[self]._broadcast_... | keyword[def] identifier[shutdown] ( identifier[self] ):
literal[string]
keyword[try] :
identifier[self] . identifier[_sessions] = identifier[dict] ()
identifier[self] . identifier[_subscriptions] = identifier[dict] ()
identifier[self] . identifier[_retained_me... | def shutdown(self):
"""
Stop broker instance.
Closes all connected session, stop listening on network socket and free resources.
"""
try:
self._sessions = dict()
self._subscriptions = dict()
self._retained_messages = dict()
self.transitions.shutdo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.