code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def netmiko_commands(*commands, **kwargs):
'''
.. versionadded:: 2019.2.0
Invoke one or more commands to be executed on the remote device, via Netmiko.
Returns a list of strings, with the output from each command.
commands
A list of commands to be executed.
expect_string
Regul... | def function[netmiko_commands, parameter[]]:
constant[
.. versionadded:: 2019.2.0
Invoke one or more commands to be executed on the remote device, via Netmiko.
Returns a list of strings, with the output from each command.
commands
A list of commands to be executed.
expect_string
... | keyword[def] identifier[netmiko_commands] (* identifier[commands] ,** identifier[kwargs] ):
literal[string]
identifier[conn] = identifier[netmiko_conn] (** identifier[kwargs] )
identifier[ret] =[]
keyword[for] identifier[cmd] keyword[in] identifier[commands] :
identifier[ret] . identi... | def netmiko_commands(*commands, **kwargs):
"""
.. versionadded:: 2019.2.0
Invoke one or more commands to be executed on the remote device, via Netmiko.
Returns a list of strings, with the output from each command.
commands
A list of commands to be executed.
expect_string
Regul... |
def main():
""" Get arguments and call the execution function"""
if len(sys.argv) < 6:
print("Usage: %s server_url username password namespace' \
' classname" % sys.argv[0])
print('Using internal defaults')
server_url = SERVER_URL
namespace = TEST_NAMESPACE
... | def function[main, parameter[]]:
constant[ Get arguments and call the execution function]
if compare[call[name[len], parameter[name[sys].argv]] less[<] constant[6]] begin[:]
call[name[print], parameter[binary_operation[constant[Usage: %s server_url username password namespace' ... | keyword[def] identifier[main] ():
literal[string]
keyword[if] identifier[len] ( identifier[sys] . identifier[argv] )< literal[int] :
identifier[print] ( literal[string] % identifier[sys] . identifier[argv] [ literal[int] ])
identifier[print] ( literal[string] )
identifier[serve... | def main():
""" Get arguments and call the execution function"""
if len(sys.argv) < 6:
print("Usage: %s server_url username password namespace' ' classname" % sys.argv[0])
print('Using internal defaults')
server_url = SERVER_URL
namespace = TEST_NAMESPACE
us... |
def _wrapped_unsigned_mul(a, b):
"""
Perform wrapped unsigned multiplication on two StridedIntervals.
:param a: The first operand (StridedInterval)
:param b: The second operand (StridedInterval)
:return: The multiplication result
"""
if a.bits != b.bits:
... | def function[_wrapped_unsigned_mul, parameter[a, b]]:
constant[
Perform wrapped unsigned multiplication on two StridedIntervals.
:param a: The first operand (StridedInterval)
:param b: The second operand (StridedInterval)
:return: The multiplication result
]
if c... | keyword[def] identifier[_wrapped_unsigned_mul] ( identifier[a] , identifier[b] ):
literal[string]
keyword[if] identifier[a] . identifier[bits] != identifier[b] . identifier[bits] :
identifier[logger] . identifier[warning] ( literal[string] )
identifier[bits] = identifier[max... | def _wrapped_unsigned_mul(a, b):
"""
Perform wrapped unsigned multiplication on two StridedIntervals.
:param a: The first operand (StridedInterval)
:param b: The second operand (StridedInterval)
:return: The multiplication result
"""
if a.bits != b.bits:
logger.w... |
def doesNotMatch(self, value, caseSensitive=True):
"""
Sets the operator type to Query.Op.DoesNotMatch and sets the \
value to the inputted value.
:param value <variant>
:return self (useful for chaining)
:usage |>>> from ... | def function[doesNotMatch, parameter[self, value, caseSensitive]]:
constant[
Sets the operator type to Query.Op.DoesNotMatch and sets the value to the inputted value.
:param value <variant>
:return self (useful for chaining)
:u... | keyword[def] identifier[doesNotMatch] ( identifier[self] , identifier[value] , identifier[caseSensitive] = keyword[True] ):
literal[string]
identifier[newq] = identifier[self] . identifier[copy] ()
identifier[newq] . identifier[setOp] ( identifier[Query] . identifier[Op] . identifier[DoesN... | def doesNotMatch(self, value, caseSensitive=True):
"""
Sets the operator type to Query.Op.DoesNotMatch and sets the value to the inputted value.
:param value <variant>
:return self (useful for chaining)
:usage |>>> from orb im... |
def as_markdown(self):
"""Gets report as json
:return: json-formatted report
"""
labels, data = self._get_table()
table = MarkdownTable(labels, data)
return str(table) | def function[as_markdown, parameter[self]]:
constant[Gets report as json
:return: json-formatted report
]
<ast.Tuple object at 0x7da1b1ec1c90> assign[=] call[name[self]._get_table, parameter[]]
variable[table] assign[=] call[name[MarkdownTable], parameter[name[labels], name[data... | keyword[def] identifier[as_markdown] ( identifier[self] ):
literal[string]
identifier[labels] , identifier[data] = identifier[self] . identifier[_get_table] ()
identifier[table] = identifier[MarkdownTable] ( identifier[labels] , identifier[data] )
keyword[return] identifier[str]... | def as_markdown(self):
"""Gets report as json
:return: json-formatted report
"""
(labels, data) = self._get_table()
table = MarkdownTable(labels, data)
return str(table) |
def _create(opener,
format_code,
files,
filter_code=None,
block_size=16384):
"""Create an archive from a collection of files (not recursive)."""
a = _archive_write_new()
_set_write_context(a, format_code, filter_code)
_LOGGER.debug("Opening archive (crea... | def function[_create, parameter[opener, format_code, files, filter_code, block_size]]:
constant[Create an archive from a collection of files (not recursive).]
variable[a] assign[=] call[name[_archive_write_new], parameter[]]
call[name[_set_write_context], parameter[name[a], name[format_code], na... | keyword[def] identifier[_create] ( identifier[opener] ,
identifier[format_code] ,
identifier[files] ,
identifier[filter_code] = keyword[None] ,
identifier[block_size] = literal[int] ):
literal[string]
identifier[a] = identifier[_archive_write_new] ()
identifier[_set_write_context] ( identifier[a]... | def _create(opener, format_code, files, filter_code=None, block_size=16384):
"""Create an archive from a collection of files (not recursive)."""
a = _archive_write_new()
_set_write_context(a, format_code, filter_code)
_LOGGER.debug('Opening archive (create).')
opener(a)
# Use the standard uid/gi... |
def convert_bytes(b):
'''Convert a number of bytes into a human readable memory usage, bytes,
kilo, mega, giga, tera, peta, exa, zetta, yotta'''
if b is None:
return '#NA'
for s in reversed(memory_symbols):
if b >= memory_size[s]:
value = float(b) / memory_size[s]
ret... | def function[convert_bytes, parameter[b]]:
constant[Convert a number of bytes into a human readable memory usage, bytes,
kilo, mega, giga, tera, peta, exa, zetta, yotta]
if compare[name[b] is constant[None]] begin[:]
return[constant[#NA]]
for taget[name[s]] in starred[call[name[reversed]... | keyword[def] identifier[convert_bytes] ( identifier[b] ):
literal[string]
keyword[if] identifier[b] keyword[is] keyword[None] :
keyword[return] literal[string]
keyword[for] identifier[s] keyword[in] identifier[reversed] ( identifier[memory_symbols] ):
keyword[if] identifier[... | def convert_bytes(b):
"""Convert a number of bytes into a human readable memory usage, bytes,
kilo, mega, giga, tera, peta, exa, zetta, yotta"""
if b is None:
return '#NA' # depends on [control=['if'], data=[]]
for s in reversed(memory_symbols):
if b >= memory_size[s]:
value = f... |
def write_pa11y_config(item):
"""
The only way that pa11y will see the same page that scrapy sees
is to make sure that pa11y requests the page with the same headers.
However, the only way to configure request headers with pa11y is to
write them into a config file.
This function will create a co... | def function[write_pa11y_config, parameter[item]]:
constant[
The only way that pa11y will see the same page that scrapy sees
is to make sure that pa11y requests the page with the same headers.
However, the only way to configure request headers with pa11y is to
write them into a config file.
... | keyword[def] identifier[write_pa11y_config] ( identifier[item] ):
literal[string]
identifier[config] ={
literal[string] :{
literal[string] : identifier[item] [ literal[string] ],
},
}
identifier[config_file] = identifier[tempfile] . identifier[NamedTemporaryFile] (
identifier[mo... | def write_pa11y_config(item):
"""
The only way that pa11y will see the same page that scrapy sees
is to make sure that pa11y requests the page with the same headers.
However, the only way to configure request headers with pa11y is to
write them into a config file.
This function will create a co... |
def getSwapStats(self):
"""Return information on swap partition and / or files.
@return: Dictionary of stats.
"""
info_dict = {}
try:
fp = open(swapsFile, 'r')
data = fp.read()
fp.close()
except:
ra... | def function[getSwapStats, parameter[self]]:
constant[Return information on swap partition and / or files.
@return: Dictionary of stats.
]
variable[info_dict] assign[=] dictionary[[], []]
<ast.Try object at 0x7da18dc9bd00>
variable[lines] assign[=] c... | keyword[def] identifier[getSwapStats] ( identifier[self] ):
literal[string]
identifier[info_dict] ={}
keyword[try] :
identifier[fp] = identifier[open] ( identifier[swapsFile] , literal[string] )
identifier[data] = identifier[fp] . identifier[read] ()
... | def getSwapStats(self):
"""Return information on swap partition and / or files.
@return: Dictionary of stats.
"""
info_dict = {}
try:
fp = open(swapsFile, 'r')
data = fp.read()
fp.close() # depends on [control=['try'], data=[]]
except:
... |
def start(name):
'''
Start a VM
CLI Example:
.. code-block:: bash
salt '*' vboxmanage.start my_vm
'''
ret = {}
cmd = '{0} startvm {1}'.format(vboxcmd(), name)
ret = salt.modules.cmdmod.run(cmd).splitlines()
return ret | def function[start, parameter[name]]:
constant[
Start a VM
CLI Example:
.. code-block:: bash
salt '*' vboxmanage.start my_vm
]
variable[ret] assign[=] dictionary[[], []]
variable[cmd] assign[=] call[constant[{0} startvm {1}].format, parameter[call[name[vboxcmd], parame... | keyword[def] identifier[start] ( identifier[name] ):
literal[string]
identifier[ret] ={}
identifier[cmd] = literal[string] . identifier[format] ( identifier[vboxcmd] (), identifier[name] )
identifier[ret] = identifier[salt] . identifier[modules] . identifier[cmdmod] . identifier[run] ( identifier... | def start(name):
"""
Start a VM
CLI Example:
.. code-block:: bash
salt '*' vboxmanage.start my_vm
"""
ret = {}
cmd = '{0} startvm {1}'.format(vboxcmd(), name)
ret = salt.modules.cmdmod.run(cmd).splitlines()
return ret |
def new(self, isdir, isparent, name, parent):
# type: (bool, bool, bytes, Optional[UDFFileEntry]) -> None
'''
A method to create a new UDF File Identifier.
Parameters:
isdir - Whether this File Identifier is a directory.
isparent - Whether this File Identifier is a par... | def function[new, parameter[self, isdir, isparent, name, parent]]:
constant[
A method to create a new UDF File Identifier.
Parameters:
isdir - Whether this File Identifier is a directory.
isparent - Whether this File Identifier is a parent (..).
name - The name for th... | keyword[def] identifier[new] ( identifier[self] , identifier[isdir] , identifier[isparent] , identifier[name] , identifier[parent] ):
literal[string]
keyword[if] identifier[self] . identifier[_initialized] :
keyword[raise] identifier[pycdlibexception] . identifier[PyCdlibInternalErr... | def new(self, isdir, isparent, name, parent):
# type: (bool, bool, bytes, Optional[UDFFileEntry]) -> None
'\n A method to create a new UDF File Identifier.\n\n Parameters:\n isdir - Whether this File Identifier is a directory.\n isparent - Whether this File Identifier is a parent (... |
def _set_policy(self, v, load=False):
"""
Setter method for policy, mapped from YANG variable /mpls_state/policy (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_policy is considered as a private
method. Backends looking to populate this variable should
... | def function[_set_policy, parameter[self, v, load]]:
constant[
Setter method for policy, mapped from YANG variable /mpls_state/policy (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_policy is considered as a private
method. Backends looking to populat... | keyword[def] identifier[_set_policy] ( 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_policy(self, v, load=False):
"""
Setter method for policy, mapped from YANG variable /mpls_state/policy (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_policy is considered as a private
method. Backends looking to populate this variable should
... |
def get_next_batch(self):
"""
This method is called from the manager. It must return a list or a generator
of BaseRecord objects.
When it has nothing else to read, it must set class variable "finished" to True.
"""
messages = self.get_from_kafka()
if messages:
... | def function[get_next_batch, parameter[self]]:
constant[
This method is called from the manager. It must return a list or a generator
of BaseRecord objects.
When it has nothing else to read, it must set class variable "finished" to True.
]
variable[messages] assign[=] cal... | keyword[def] identifier[get_next_batch] ( identifier[self] ):
literal[string]
identifier[messages] = identifier[self] . identifier[get_from_kafka] ()
keyword[if] identifier[messages] :
keyword[for] identifier[message] keyword[in] identifier[messages] :
ide... | def get_next_batch(self):
"""
This method is called from the manager. It must return a list or a generator
of BaseRecord objects.
When it has nothing else to read, it must set class variable "finished" to True.
"""
messages = self.get_from_kafka()
if messages:
for mes... |
def _const_node_to_py_ast(ctx: GeneratorContext, lisp_ast: Const) -> GeneratedPyAST:
"""Generate Python AST nodes for a :const Lisp AST node.
Nested values in collections for :const nodes are not parsed. Consequently,
this function cannot be called recursively for those nested values. Instead,
call `_c... | def function[_const_node_to_py_ast, parameter[ctx, lisp_ast]]:
constant[Generate Python AST nodes for a :const Lisp AST node.
Nested values in collections for :const nodes are not parsed. Consequently,
this function cannot be called recursively for those nested values. Instead,
call `_const_val_to_... | keyword[def] identifier[_const_node_to_py_ast] ( identifier[ctx] : identifier[GeneratorContext] , identifier[lisp_ast] : identifier[Const] )-> identifier[GeneratedPyAST] :
literal[string]
keyword[assert] identifier[lisp_ast] . identifier[op] == identifier[NodeOp] . identifier[CONST]
identifier[node_... | def _const_node_to_py_ast(ctx: GeneratorContext, lisp_ast: Const) -> GeneratedPyAST:
"""Generate Python AST nodes for a :const Lisp AST node.
Nested values in collections for :const nodes are not parsed. Consequently,
this function cannot be called recursively for those nested values. Instead,
call `_c... |
def convertor(geometry, method="wgs2gcj"):
"""
convert wgs84 to gcj
referencing by https://github.com/wandergis/coordTransform_py
"""
if geometry['type'] == 'Point':
coords = geometry['coordinates']
coords[0], coords[1] = methods[method](coords[0], coords[1])
elif geometry['type'... | def function[convertor, parameter[geometry, method]]:
constant[
convert wgs84 to gcj
referencing by https://github.com/wandergis/coordTransform_py
]
if compare[call[name[geometry]][constant[type]] equal[==] constant[Point]] begin[:]
variable[coords] assign[=] call[name[geomet... | keyword[def] identifier[convertor] ( identifier[geometry] , identifier[method] = literal[string] ):
literal[string]
keyword[if] identifier[geometry] [ literal[string] ]== literal[string] :
identifier[coords] = identifier[geometry] [ literal[string] ]
identifier[coords] [ literal[int] ], ... | def convertor(geometry, method='wgs2gcj'):
"""
convert wgs84 to gcj
referencing by https://github.com/wandergis/coordTransform_py
"""
if geometry['type'] == 'Point':
coords = geometry['coordinates']
(coords[0], coords[1]) = methods[method](coords[0], coords[1]) # depends on [control... |
def get_command(self, ctx: click.Context, name: str) -> click.Command:
"""Return the relevant command given the context and name.
.. warning::
This differs substaintially from Flask in that it allows
for the inbuilt commands to be overridden.
"""
info = ctx.ensu... | def function[get_command, parameter[self, ctx, name]]:
constant[Return the relevant command given the context and name.
.. warning::
This differs substaintially from Flask in that it allows
for the inbuilt commands to be overridden.
]
variable[info] assign[=] ca... | keyword[def] identifier[get_command] ( identifier[self] , identifier[ctx] : identifier[click] . identifier[Context] , identifier[name] : identifier[str] )-> identifier[click] . identifier[Command] :
literal[string]
identifier[info] = identifier[ctx] . identifier[ensure_object] ( identifier[ScriptIn... | def get_command(self, ctx: click.Context, name: str) -> click.Command:
"""Return the relevant command given the context and name.
.. warning::
This differs substaintially from Flask in that it allows
for the inbuilt commands to be overridden.
"""
info = ctx.ensure_objec... |
def add_samples_stats(samples_table, samples):
"""
Add stats fields to samples table.
The following information is added to each row:
- Notes (warnings, errors) resulting from the analysis
- Number of Events
- Acquisition Time (s)
The following information is added for each ro... | def function[add_samples_stats, parameter[samples_table, samples]]:
constant[
Add stats fields to samples table.
The following information is added to each row:
- Notes (warnings, errors) resulting from the analysis
- Number of Events
- Acquisition Time (s)
The following i... | keyword[def] identifier[add_samples_stats] ( identifier[samples_table] , identifier[samples] ):
literal[string]
identifier[samples_table_index_name] = identifier[samples_table] . identifier[index] . identifier[name]
identifier[notes] =[]
identifier[n_events] =[]
identifier[a... | def add_samples_stats(samples_table, samples):
"""
Add stats fields to samples table.
The following information is added to each row:
- Notes (warnings, errors) resulting from the analysis
- Number of Events
- Acquisition Time (s)
The following information is added for each ro... |
def get_module_parser(mod, modname, parents=[], add_help=True):
"""
Returns an argument parser for the sub-command's CLI.
:param mod: the sub-command's python module
:param modnam: the string name of the python module
:return: ArgumentParser
"""
return argparse.ArgumentParser(
us... | def function[get_module_parser, parameter[mod, modname, parents, add_help]]:
constant[
Returns an argument parser for the sub-command's CLI.
:param mod: the sub-command's python module
:param modnam: the string name of the python module
:return: ArgumentParser
]
return[call[name[argp... | keyword[def] identifier[get_module_parser] ( identifier[mod] , identifier[modname] , identifier[parents] =[], identifier[add_help] = keyword[True] ):
literal[string]
keyword[return] identifier[argparse] . identifier[ArgumentParser] (
identifier[usage] = identifier[configuration] . identifier[EXECUTAB... | def get_module_parser(mod, modname, parents=[], add_help=True):
"""
Returns an argument parser for the sub-command's CLI.
:param mod: the sub-command's python module
:param modnam: the string name of the python module
:return: ArgumentParser
"""
return argparse.ArgumentParser(usage=confi... |
def write_gif(filename, images, duration=0.1, repeat=True, dither=False,
nq=0, sub_rectangles=True, dispose=None):
""" write_gif(filename, images, duration=0.1, repeat=True, dither=False,
nq=0, sub_rectangles=True, dispose=None)
Write an animated gif from the specified image... | def function[write_gif, parameter[filename, images, duration, repeat, dither, nq, sub_rectangles, dispose]]:
constant[ write_gif(filename, images, duration=0.1, repeat=True, dither=False,
nq=0, sub_rectangles=True, dispose=None)
Write an animated gif from the specified images.
Para... | keyword[def] identifier[write_gif] ( identifier[filename] , identifier[images] , identifier[duration] = literal[int] , identifier[repeat] = keyword[True] , identifier[dither] = keyword[False] ,
identifier[nq] = literal[int] , identifier[sub_rectangles] = keyword[True] , identifier[dispose] = keyword[None] ):
li... | def write_gif(filename, images, duration=0.1, repeat=True, dither=False, nq=0, sub_rectangles=True, dispose=None):
""" write_gif(filename, images, duration=0.1, repeat=True, dither=False,
nq=0, sub_rectangles=True, dispose=None)
Write an animated gif from the specified images.
Paramete... |
def fastas(self, download=False):
""" Dict of filepaths for all fasta files associated with code.
Parameters
----------
download : bool
If True, downloads the fasta file from the PDB.
If False, uses the ampal Protein.fasta property
Defaults to False -... | def function[fastas, parameter[self, download]]:
constant[ Dict of filepaths for all fasta files associated with code.
Parameters
----------
download : bool
If True, downloads the fasta file from the PDB.
If False, uses the ampal Protein.fasta property
... | keyword[def] identifier[fastas] ( identifier[self] , identifier[download] = keyword[False] ):
literal[string]
identifier[fastas_dict] ={}
identifier[fasta_dir] = identifier[os] . identifier[path] . identifier[join] ( identifier[self] . identifier[parent_dir] , literal[string] )
ke... | def fastas(self, download=False):
""" Dict of filepaths for all fasta files associated with code.
Parameters
----------
download : bool
If True, downloads the fasta file from the PDB.
If False, uses the ampal Protein.fasta property
Defaults to False - thi... |
def coarse_grain(coarse_grain):
"""Validate a macro coarse-graining."""
partition(coarse_grain.partition)
if len(coarse_grain.partition) != len(coarse_grain.grouping):
raise ValueError('output and state groupings must be the same size')
for part, group in zip(coarse_grain.partition, coarse_gra... | def function[coarse_grain, parameter[coarse_grain]]:
constant[Validate a macro coarse-graining.]
call[name[partition], parameter[name[coarse_grain].partition]]
if compare[call[name[len], parameter[name[coarse_grain].partition]] not_equal[!=] call[name[len], parameter[name[coarse_grain].grouping]... | keyword[def] identifier[coarse_grain] ( identifier[coarse_grain] ):
literal[string]
identifier[partition] ( identifier[coarse_grain] . identifier[partition] )
keyword[if] identifier[len] ( identifier[coarse_grain] . identifier[partition] )!= identifier[len] ( identifier[coarse_grain] . identifier[gr... | def coarse_grain(coarse_grain):
"""Validate a macro coarse-graining."""
partition(coarse_grain.partition)
if len(coarse_grain.partition) != len(coarse_grain.grouping):
raise ValueError('output and state groupings must be the same size') # depends on [control=['if'], data=[]]
for (part, group) i... |
def register_monitor(self, devices, events, callback):
"""Register a callback when events happen.
If this method is called, it is guaranteed to take effect before the
next call to ``_notify_event`` after this method returns. This method
is safe to call from within a callback that is it... | def function[register_monitor, parameter[self, devices, events, callback]]:
constant[Register a callback when events happen.
If this method is called, it is guaranteed to take effect before the
next call to ``_notify_event`` after this method returns. This method
is safe to call from w... | keyword[def] identifier[register_monitor] ( identifier[self] , identifier[devices] , identifier[events] , identifier[callback] ):
literal[string]
identifier[events] = identifier[list] ( identifier[events] )
identifier[devices] = identifier[list] ( identifier[devices] )
... | def register_monitor(self, devices, events, callback):
"""Register a callback when events happen.
If this method is called, it is guaranteed to take effect before the
next call to ``_notify_event`` after this method returns. This method
is safe to call from within a callback that is itself... |
def is_excel_file(inputfile):
""" Return whether the provided file is a CSV file or not.
This checks if the first row of the file can be splitted by ',' and
if the resulting line contains more than 4 columns (Markers, linkage
group, chromosome, trait).
"""
try:
xlrd.open_workbook(inputf... | def function[is_excel_file, parameter[inputfile]]:
constant[ Return whether the provided file is a CSV file or not.
This checks if the first row of the file can be splitted by ',' and
if the resulting line contains more than 4 columns (Markers, linkage
group, chromosome, trait).
]
<ast.Try ... | keyword[def] identifier[is_excel_file] ( identifier[inputfile] ):
literal[string]
keyword[try] :
identifier[xlrd] . identifier[open_workbook] ( identifier[inputfile] )
keyword[except] identifier[Exception] keyword[as] identifier[err] :
identifier[print] ( identifier[err] )
... | def is_excel_file(inputfile):
""" Return whether the provided file is a CSV file or not.
This checks if the first row of the file can be splitted by ',' and
if the resulting line contains more than 4 columns (Markers, linkage
group, chromosome, trait).
"""
try:
xlrd.open_workbook(inputf... |
def request_instance(vm_):
'''
Request a VM from Azure.
'''
compconn = get_conn(client_type='compute')
# pylint: disable=invalid-name
CachingTypes = getattr(
compute_models, 'CachingTypes'
)
# pylint: disable=invalid-name
DataDisk = getattr(
compute_models, 'DataDisk... | def function[request_instance, parameter[vm_]]:
constant[
Request a VM from Azure.
]
variable[compconn] assign[=] call[name[get_conn], parameter[]]
variable[CachingTypes] assign[=] call[name[getattr], parameter[name[compute_models], constant[CachingTypes]]]
variable[DataDisk] ass... | keyword[def] identifier[request_instance] ( identifier[vm_] ):
literal[string]
identifier[compconn] = identifier[get_conn] ( identifier[client_type] = literal[string] )
identifier[CachingTypes] = identifier[getattr] (
identifier[compute_models] , literal[string]
)
identifier[... | def request_instance(vm_):
"""
Request a VM from Azure.
"""
compconn = get_conn(client_type='compute')
# pylint: disable=invalid-name
CachingTypes = getattr(compute_models, 'CachingTypes')
# pylint: disable=invalid-name
DataDisk = getattr(compute_models, 'DataDisk')
# pylint: disable... |
def config_from_url(u, **kwargs):
"""
Returns dict containing zmq configuration arguments
parsed from xbahn url
Arguments:
- u (urlparse.urlparse result)
Returns:
dict:
- id (str): connection index key
- typ_str (str): string representation of zmq socket ... | def function[config_from_url, parameter[u]]:
constant[
Returns dict containing zmq configuration arguments
parsed from xbahn url
Arguments:
- u (urlparse.urlparse result)
Returns:
dict:
- id (str): connection index key
- typ_str (str): string represent... | keyword[def] identifier[config_from_url] ( identifier[u] ,** identifier[kwargs] ):
literal[string]
identifier[path] = identifier[u] . identifier[path] . identifier[lstrip] ( literal[string] ). identifier[split] ( literal[string] )
keyword[if] identifier[len] ( identifier[path] )> literal[int] keyw... | def config_from_url(u, **kwargs):
"""
Returns dict containing zmq configuration arguments
parsed from xbahn url
Arguments:
- u (urlparse.urlparse result)
Returns:
dict:
- id (str): connection index key
- typ_str (str): string representation of zmq socket t... |
def request_permission(cls, fine=True):
""" Requests permission and returns an async result that returns
a boolean indicating if the permission was granted or denied.
"""
app = AndroidApplication.instance()
permission = (cls.ACCESS_FINE_PERMISSION
... | def function[request_permission, parameter[cls, fine]]:
constant[ Requests permission and returns an async result that returns
a boolean indicating if the permission was granted or denied.
]
variable[app] assign[=] call[name[AndroidApplication].instance, parameter[]]
v... | keyword[def] identifier[request_permission] ( identifier[cls] , identifier[fine] = keyword[True] ):
literal[string]
identifier[app] = identifier[AndroidApplication] . identifier[instance] ()
identifier[permission] =( identifier[cls] . identifier[ACCESS_FINE_PERMISSION]
keyword[if... | def request_permission(cls, fine=True):
""" Requests permission and returns an async result that returns
a boolean indicating if the permission was granted or denied.
"""
app = AndroidApplication.instance()
permission = cls.ACCESS_FINE_PERMISSION if fine else cls.ACCESS_COARSE_PER... |
def is_isomorphic_to(self, other):
"""
Returns true if all fields of other struct are isomorphic to this
struct's fields
"""
return (isinstance(other, self.__class__)
and
len(self.fields) == len(other.fields)
and
all... | def function[is_isomorphic_to, parameter[self, other]]:
constant[
Returns true if all fields of other struct are isomorphic to this
struct's fields
]
return[<ast.BoolOp object at 0x7da1b00cb160>] | keyword[def] identifier[is_isomorphic_to] ( identifier[self] , identifier[other] ):
literal[string]
keyword[return] ( identifier[isinstance] ( identifier[other] , identifier[self] . identifier[__class__] )
keyword[and]
identifier[len] ( identifier[self] . identifier[fields] )== i... | def is_isomorphic_to(self, other):
"""
Returns true if all fields of other struct are isomorphic to this
struct's fields
"""
return isinstance(other, self.__class__) and len(self.fields) == len(other.fields) and all((a.is_isomorphic_to(b) for (a, b) in zip(self.fields, other.fields))) |
def configure_widget_for_editing(self, widget):
""" A widget have to be added to the editor, it is configured here in order to be conformant
to the editor
"""
if not 'editor_varname' in widget.attributes:
return
widget.onclick.do(self.on_widget_selection... | def function[configure_widget_for_editing, parameter[self, widget]]:
constant[ A widget have to be added to the editor, it is configured here in order to be conformant
to the editor
]
if <ast.UnaryOp object at 0x7da207f01c30> begin[:]
return[None]
call[name[widget].o... | keyword[def] identifier[configure_widget_for_editing] ( identifier[self] , identifier[widget] ):
literal[string]
keyword[if] keyword[not] literal[string] keyword[in] identifier[widget] . identifier[attributes] :
keyword[return]
identifier[widget] . identifier[onclick] . ... | def configure_widget_for_editing(self, widget):
""" A widget have to be added to the editor, it is configured here in order to be conformant
to the editor
"""
if not 'editor_varname' in widget.attributes:
return # depends on [control=['if'], data=[]]
widget.onclick.do(self.on_w... |
def check_parallel_run(self): # pragma: no cover, not with unit tests...
"""Check (in pid file) if there isn't already a daemon running.
If yes and do_replace: kill it.
Keep in self.fpid the File object to the pid file. Will be used by writepid.
:return: None
"""
# TODO... | def function[check_parallel_run, parameter[self]]:
constant[Check (in pid file) if there isn't already a daemon running.
If yes and do_replace: kill it.
Keep in self.fpid the File object to the pid file. Will be used by writepid.
:return: None
]
if compare[name[os].name ... | keyword[def] identifier[check_parallel_run] ( identifier[self] ):
literal[string]
keyword[if] identifier[os] . identifier[name] == literal[string] :
identifier[logger] . identifier[warning] ( literal[string] )
identifier[self] . identifier[__open_pidfile] ( ident... | def check_parallel_run(self): # pragma: no cover, not with unit tests...
"Check (in pid file) if there isn't already a daemon running.\n If yes and do_replace: kill it.\n Keep in self.fpid the File object to the pid file. Will be used by writepid.\n\n :return: None\n "
# TODO: other... |
def setShowGrid( self, state ):
"""
Sets whether or not this delegate should draw its grid lines.
:param state | <bool>
"""
delegate = self.itemDelegate()
if ( isinstance(delegate, XTreeWidgetDelegate) ):
delegate.setShowGrid(state) | def function[setShowGrid, parameter[self, state]]:
constant[
Sets whether or not this delegate should draw its grid lines.
:param state | <bool>
]
variable[delegate] assign[=] call[name[self].itemDelegate, parameter[]]
if call[name[isinstance], parameter[nam... | keyword[def] identifier[setShowGrid] ( identifier[self] , identifier[state] ):
literal[string]
identifier[delegate] = identifier[self] . identifier[itemDelegate] ()
keyword[if] ( identifier[isinstance] ( identifier[delegate] , identifier[XTreeWidgetDelegate] )):
identifier... | def setShowGrid(self, state):
"""
Sets whether or not this delegate should draw its grid lines.
:param state | <bool>
"""
delegate = self.itemDelegate()
if isinstance(delegate, XTreeWidgetDelegate):
delegate.setShowGrid(state) # depends on [control=['if'], data... |
def collect_split_adjustments(self,
adjustments_for_sid,
requested_qtr_data,
dates,
sid,
sid_idx,
sid_estimates,
... | def function[collect_split_adjustments, parameter[self, adjustments_for_sid, requested_qtr_data, dates, sid, sid_idx, sid_estimates, split_adjusted_asof_idx, pre_adjustments, post_adjustments, requested_split_adjusted_columns]]:
constant[
Collect split adjustments for future quarters. Re-apply adjustmen... | keyword[def] identifier[collect_split_adjustments] ( identifier[self] ,
identifier[adjustments_for_sid] ,
identifier[requested_qtr_data] ,
identifier[dates] ,
identifier[sid] ,
identifier[sid_idx] ,
identifier[sid_estimates] ,
identifier[split_adjusted_asof_idx] ,
identifier[pre_adjustments] ,
identifier[pos... | def collect_split_adjustments(self, adjustments_for_sid, requested_qtr_data, dates, sid, sid_idx, sid_estimates, split_adjusted_asof_idx, pre_adjustments, post_adjustments, requested_split_adjusted_columns):
"""
Collect split adjustments for future quarters. Re-apply adjustments
that would be overwr... |
def handle_document(self, item_session: ItemSession, filename: str) -> Actions:
'''Process a successful document response.
Returns:
A value from :class:`.hook.Actions`.
'''
self._waiter.reset()
action = self.handle_response(item_session)
if action == Action... | def function[handle_document, parameter[self, item_session, filename]]:
constant[Process a successful document response.
Returns:
A value from :class:`.hook.Actions`.
]
call[name[self]._waiter.reset, parameter[]]
variable[action] assign[=] call[name[self].handle_resp... | keyword[def] identifier[handle_document] ( identifier[self] , identifier[item_session] : identifier[ItemSession] , identifier[filename] : identifier[str] )-> identifier[Actions] :
literal[string]
identifier[self] . identifier[_waiter] . identifier[reset] ()
identifier[action] = identifier... | def handle_document(self, item_session: ItemSession, filename: str) -> Actions:
"""Process a successful document response.
Returns:
A value from :class:`.hook.Actions`.
"""
self._waiter.reset()
action = self.handle_response(item_session)
if action == Actions.NORMAL:
... |
def removeAssociation(self, server_url, handle):
"""Remove an association if it exists. Do nothing if it does not.
(str, str) -> bool
"""
assoc = self.getAssociation(server_url, handle)
if assoc is None:
return 0
else:
filename = self.getAssociati... | def function[removeAssociation, parameter[self, server_url, handle]]:
constant[Remove an association if it exists. Do nothing if it does not.
(str, str) -> bool
]
variable[assoc] assign[=] call[name[self].getAssociation, parameter[name[server_url], name[handle]]]
if compare[name... | keyword[def] identifier[removeAssociation] ( identifier[self] , identifier[server_url] , identifier[handle] ):
literal[string]
identifier[assoc] = identifier[self] . identifier[getAssociation] ( identifier[server_url] , identifier[handle] )
keyword[if] identifier[assoc] keyword[is] keyw... | def removeAssociation(self, server_url, handle):
"""Remove an association if it exists. Do nothing if it does not.
(str, str) -> bool
"""
assoc = self.getAssociation(server_url, handle)
if assoc is None:
return 0 # depends on [control=['if'], data=[]]
else:
filename = s... |
def item(*args, **kwargs):
'''
.. versionadded:: 0.16.2
Return one or more pillar entries from the :ref:`in-memory pillar data
<pillar-in-memory>`.
delimiter
Delimiter used to traverse nested dictionaries.
.. note::
This is different from :py:func:`pillar.get
... | def function[item, parameter[]]:
constant[
.. versionadded:: 0.16.2
Return one or more pillar entries from the :ref:`in-memory pillar data
<pillar-in-memory>`.
delimiter
Delimiter used to traverse nested dictionaries.
.. note::
This is different from :py:func:`pill... | keyword[def] identifier[item] (* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[ret] ={}
identifier[default] = identifier[kwargs] . identifier[get] ( literal[string] , literal[string] )
identifier[delimiter] = identifier[kwargs] . identifier[get] ( literal[string] , identif... | def item(*args, **kwargs):
"""
.. versionadded:: 0.16.2
Return one or more pillar entries from the :ref:`in-memory pillar data
<pillar-in-memory>`.
delimiter
Delimiter used to traverse nested dictionaries.
.. note::
This is different from :py:func:`pillar.get
... |
def map_names(lang="en"):
"""This resource returns an dictionary of the localized map names for
the specified language. Only maps with events are listed - if you need a
list of all maps, use ``maps.json`` instead.
:param lang: The language to query the names for.
:return: the response is a dictiona... | def function[map_names, parameter[lang]]:
constant[This resource returns an dictionary of the localized map names for
the specified language. Only maps with events are listed - if you need a
list of all maps, use ``maps.json`` instead.
:param lang: The language to query the names for.
:return: ... | keyword[def] identifier[map_names] ( identifier[lang] = literal[string] ):
literal[string]
identifier[cache_name] = literal[string] % identifier[lang]
identifier[data] = identifier[get_cached] ( literal[string] , identifier[cache_name] , identifier[params] = identifier[dict] ( identifier[lang] = iden... | def map_names(lang='en'):
"""This resource returns an dictionary of the localized map names for
the specified language. Only maps with events are listed - if you need a
list of all maps, use ``maps.json`` instead.
:param lang: The language to query the names for.
:return: the response is a dictiona... |
def msg2usernames(msg, processor=None, legacy=False, **config):
""" Return a set of FAS usernames associated with a message. """
return processor.usernames(msg, **config) | def function[msg2usernames, parameter[msg, processor, legacy]]:
constant[ Return a set of FAS usernames associated with a message. ]
return[call[name[processor].usernames, parameter[name[msg]]]] | keyword[def] identifier[msg2usernames] ( identifier[msg] , identifier[processor] = keyword[None] , identifier[legacy] = keyword[False] ,** identifier[config] ):
literal[string]
keyword[return] identifier[processor] . identifier[usernames] ( identifier[msg] ,** identifier[config] ) | def msg2usernames(msg, processor=None, legacy=False, **config):
""" Return a set of FAS usernames associated with a message. """
return processor.usernames(msg, **config) |
def index(request, obj_id=None):
"""Handles a request based on method and calls the appropriate function"""
if request.method == 'GET':
return get(request, obj_id)
elif request.method == 'POST':
return post(request)
elif request.method == 'PUT':
getPutData(request)
return... | def function[index, parameter[request, obj_id]]:
constant[Handles a request based on method and calls the appropriate function]
if compare[name[request].method equal[==] constant[GET]] begin[:]
return[call[name[get], parameter[name[request], name[obj_id]]]] | keyword[def] identifier[index] ( identifier[request] , identifier[obj_id] = keyword[None] ):
literal[string]
keyword[if] identifier[request] . identifier[method] == literal[string] :
keyword[return] identifier[get] ( identifier[request] , identifier[obj_id] )
keyword[elif] identifier[reque... | def index(request, obj_id=None):
"""Handles a request based on method and calls the appropriate function"""
if request.method == 'GET':
return get(request, obj_id) # depends on [control=['if'], data=[]]
elif request.method == 'POST':
return post(request) # depends on [control=['if'], data=... |
def del_doc(self, doc):
"""
Delete a document
"""
if not self.index_writer:
self.index_writer = self.index.writer()
if not self.label_guesser_updater:
self.label_guesser_updater = self.label_guesser.get_updater()
logger.info("Removing doc from the ... | def function[del_doc, parameter[self, doc]]:
constant[
Delete a document
]
if <ast.UnaryOp object at 0x7da20c76f250> begin[:]
name[self].index_writer assign[=] call[name[self].index.writer, parameter[]]
if <ast.UnaryOp object at 0x7da20c76f9d0> begin[:]
... | keyword[def] identifier[del_doc] ( identifier[self] , identifier[doc] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[index_writer] :
identifier[self] . identifier[index_writer] = identifier[self] . identifier[index] . identifier[writer] ()
keyword[... | def del_doc(self, doc):
"""
Delete a document
"""
if not self.index_writer:
self.index_writer = self.index.writer() # depends on [control=['if'], data=[]]
if not self.label_guesser_updater:
self.label_guesser_updater = self.label_guesser.get_updater() # depends on [control=... |
def disable_user():
"""
Disables a user in the data store
.. example::
$ curl http://localhost:5000/disable_user -X POST \
-H "Authorization: Bearer <your_token>" \
-d '{"username":"Walter"}'
"""
req = flask.request.get_json(force=True)
usr = User.query.filter_by(use... | def function[disable_user, parameter[]]:
constant[
Disables a user in the data store
.. example::
$ curl http://localhost:5000/disable_user -X POST -H "Authorization: Bearer <your_token>" -d '{"username":"Walter"}'
]
variable[req] assign[=] call[name[flask].reque... | keyword[def] identifier[disable_user] ():
literal[string]
identifier[req] = identifier[flask] . identifier[request] . identifier[get_json] ( identifier[force] = keyword[True] )
identifier[usr] = identifier[User] . identifier[query] . identifier[filter_by] ( identifier[username] = identifier[req] . ide... | def disable_user():
"""
Disables a user in the data store
.. example::
$ curl http://localhost:5000/disable_user -X POST -H "Authorization: Bearer <your_token>" -d '{"username":"Walter"}'
"""
req = flask.request.get_json(force=True)
usr = User.query.filter_by(usernam... |
def abort(self):
"""
Abort an initiated SASL authentication process. The expected result
state is ``failure``.
"""
if self._state == SASLState.INITIAL:
raise RuntimeError("SASL authentication hasn't started yet")
if self._state == SASLState.SUCCESS_SIMULATE_C... | def function[abort, parameter[self]]:
constant[
Abort an initiated SASL authentication process. The expected result
state is ``failure``.
]
if compare[name[self]._state equal[==] name[SASLState].INITIAL] begin[:]
<ast.Raise object at 0x7da18f722e60>
if compare[nam... | keyword[def] identifier[abort] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_state] == identifier[SASLState] . identifier[INITIAL] :
keyword[raise] identifier[RuntimeError] ( literal[string] )
keyword[if] identifier[self] . identifier[_st... | def abort(self):
"""
Abort an initiated SASL authentication process. The expected result
state is ``failure``.
"""
if self._state == SASLState.INITIAL:
raise RuntimeError("SASL authentication hasn't started yet") # depends on [control=['if'], data=[]]
if self._state == SASLS... |
def find_period(y, Tapprox):
""" Find oscillation period of y(t).
Parameter Tapprox is the approximate period. The code finds the time
between 0.7 * Tapprox and 1.3 * Tapprox where y(t)[1] = d/dt theta(t)
vanishes. This is the period.
"""
def dtheta_dt(t):
""" vanishes when dtheta/dt = ... | def function[find_period, parameter[y, Tapprox]]:
constant[ Find oscillation period of y(t).
Parameter Tapprox is the approximate period. The code finds the time
between 0.7 * Tapprox and 1.3 * Tapprox where y(t)[1] = d/dt theta(t)
vanishes. This is the period.
]
def function[dtheta_dt,... | keyword[def] identifier[find_period] ( identifier[y] , identifier[Tapprox] ):
literal[string]
keyword[def] identifier[dtheta_dt] ( identifier[t] ):
literal[string]
keyword[return] identifier[y] ( identifier[t] )[ literal[int] ]
keyword[return] identifier[gv] . identifier[root] . ... | def find_period(y, Tapprox):
""" Find oscillation period of y(t).
Parameter Tapprox is the approximate period. The code finds the time
between 0.7 * Tapprox and 1.3 * Tapprox where y(t)[1] = d/dt theta(t)
vanishes. This is the period.
"""
def dtheta_dt(t):
""" vanishes when dtheta/dt =... |
def one(self):
"""Return a tensor of all ones.
Examples
--------
>>> space = odl.rn(3)
>>> x = space.one()
>>> x
rn(3).element([ 1., 1., 1.])
"""
return self.element(np.ones(self.shape, dtype=self.dtype,
order... | def function[one, parameter[self]]:
constant[Return a tensor of all ones.
Examples
--------
>>> space = odl.rn(3)
>>> x = space.one()
>>> x
rn(3).element([ 1., 1., 1.])
]
return[call[name[self].element, parameter[call[name[np].ones, parameter[name[s... | keyword[def] identifier[one] ( identifier[self] ):
literal[string]
keyword[return] identifier[self] . identifier[element] ( identifier[np] . identifier[ones] ( identifier[self] . identifier[shape] , identifier[dtype] = identifier[self] . identifier[dtype] ,
identifier[order] = identifier[... | def one(self):
"""Return a tensor of all ones.
Examples
--------
>>> space = odl.rn(3)
>>> x = space.one()
>>> x
rn(3).element([ 1., 1., 1.])
"""
return self.element(np.ones(self.shape, dtype=self.dtype, order=self.default_order)) |
def _SetHeader(self, new_values):
"""Sets header of table to the given tuple.
Args:
new_values: Tuple of new header values.
"""
row = self.row_class()
row.row = 0
for v in new_values:
row[v] = v
self._table[0] = row | def function[_SetHeader, parameter[self, new_values]]:
constant[Sets header of table to the given tuple.
Args:
new_values: Tuple of new header values.
]
variable[row] assign[=] call[name[self].row_class, parameter[]]
name[row].row assign[=] constant[0]
for taget[name[v]] i... | keyword[def] identifier[_SetHeader] ( identifier[self] , identifier[new_values] ):
literal[string]
identifier[row] = identifier[self] . identifier[row_class] ()
identifier[row] . identifier[row] = literal[int]
keyword[for] identifier[v] keyword[in] identifier[new_values] :
... | def _SetHeader(self, new_values):
"""Sets header of table to the given tuple.
Args:
new_values: Tuple of new header values.
"""
row = self.row_class()
row.row = 0
for v in new_values:
row[v] = v # depends on [control=['for'], data=['v']]
self._table[0] = row |
def post_build(self, pkt, pay):
""" Implements the swap-bytes functionality when building
this is based on a copy of the Packet.self_build default method.
The goal is to affect only the CAN layer data and keep
under layers (e.g LinuxCooked) unchanged
"""
if conf.contribs... | def function[post_build, parameter[self, pkt, pay]]:
constant[ Implements the swap-bytes functionality when building
this is based on a copy of the Packet.self_build default method.
The goal is to affect only the CAN layer data and keep
under layers (e.g LinuxCooked) unchanged
]... | keyword[def] identifier[post_build] ( identifier[self] , identifier[pkt] , identifier[pay] ):
literal[string]
keyword[if] identifier[conf] . identifier[contribs] [ literal[string] ][ literal[string] ]:
keyword[return] identifier[CAN] . identifier[inv_endianness] ( identifier[pkt] )+ ... | def post_build(self, pkt, pay):
""" Implements the swap-bytes functionality when building
this is based on a copy of the Packet.self_build default method.
The goal is to affect only the CAN layer data and keep
under layers (e.g LinuxCooked) unchanged
"""
if conf.contribs['CAN'][... |
def projective_measurement_constraints(*parties):
"""Return a set of constraints that define projective measurements.
:param parties: Measurements of different parties.
:type A: list or tuple of list of list of
:class:`sympy.physics.quantum.operator.HermitianOperator`.
:returns: substitut... | def function[projective_measurement_constraints, parameter[]]:
constant[Return a set of constraints that define projective measurements.
:param parties: Measurements of different parties.
:type A: list or tuple of list of list of
:class:`sympy.physics.quantum.operator.HermitianOperator`.
... | keyword[def] identifier[projective_measurement_constraints] (* identifier[parties] ):
literal[string]
identifier[substitutions] ={}
keyword[if] identifier[isinstance] ( identifier[parties] [ literal[int] ][ literal[int] ][ literal[int] ], identifier[list] ):
identifier[parties] = identi... | def projective_measurement_constraints(*parties):
"""Return a set of constraints that define projective measurements.
:param parties: Measurements of different parties.
:type A: list or tuple of list of list of
:class:`sympy.physics.quantum.operator.HermitianOperator`.
:returns: substitut... |
def propertyContainer(self, ulBuffer):
"""retrieves the property container of an buffer."""
fn = self.function_table.propertyContainer
result = fn(ulBuffer)
return result | def function[propertyContainer, parameter[self, ulBuffer]]:
constant[retrieves the property container of an buffer.]
variable[fn] assign[=] name[self].function_table.propertyContainer
variable[result] assign[=] call[name[fn], parameter[name[ulBuffer]]]
return[name[result]] | keyword[def] identifier[propertyContainer] ( identifier[self] , identifier[ulBuffer] ):
literal[string]
identifier[fn] = identifier[self] . identifier[function_table] . identifier[propertyContainer]
identifier[result] = identifier[fn] ( identifier[ulBuffer] )
keyword[return] id... | def propertyContainer(self, ulBuffer):
"""retrieves the property container of an buffer."""
fn = self.function_table.propertyContainer
result = fn(ulBuffer)
return result |
def hashmodel(model, library=None):
'''Calculate the Hash id of metaclass ``meta``'''
library = library or 'python-stdnet'
meta = model._meta
sha = hashlib.sha1(to_bytes('{0}({1})'.format(library, meta)))
hash = sha.hexdigest()[:8]
meta.hash = hash
if hash in _model_dict:
rai... | def function[hashmodel, parameter[model, library]]:
constant[Calculate the Hash id of metaclass ``meta``]
variable[library] assign[=] <ast.BoolOp object at 0x7da1b0e6fc70>
variable[meta] assign[=] name[model]._meta
variable[sha] assign[=] call[name[hashlib].sha1, parameter[call[name[to_b... | keyword[def] identifier[hashmodel] ( identifier[model] , identifier[library] = keyword[None] ):
literal[string]
identifier[library] = identifier[library] keyword[or] literal[string]
identifier[meta] = identifier[model] . identifier[_meta]
identifier[sha] = identifier[hashlib] . identifier... | def hashmodel(model, library=None):
"""Calculate the Hash id of metaclass ``meta``"""
library = library or 'python-stdnet'
meta = model._meta
sha = hashlib.sha1(to_bytes('{0}({1})'.format(library, meta)))
hash = sha.hexdigest()[:8]
meta.hash = hash
if hash in _model_dict:
raise KeyEr... |
def enrich(self, sample, ontologyClass, path, callback=None, output='application/json'):
""" Class Enrichment Service from: /analyzer/enrichment
Arguments:
sample: A list of CURIEs for nodes whose attributes are to be tested for enrichment. For example, a list of genes.
ontol... | def function[enrich, parameter[self, sample, ontologyClass, path, callback, output]]:
constant[ Class Enrichment Service from: /analyzer/enrichment
Arguments:
sample: A list of CURIEs for nodes whose attributes are to be tested for enrichment. For example, a list of genes.
on... | keyword[def] identifier[enrich] ( identifier[self] , identifier[sample] , identifier[ontologyClass] , identifier[path] , identifier[callback] = keyword[None] , identifier[output] = literal[string] ):
literal[string]
identifier[kwargs] ={ literal[string] : identifier[sample] , literal[string] : ide... | def enrich(self, sample, ontologyClass, path, callback=None, output='application/json'):
""" Class Enrichment Service from: /analyzer/enrichment
Arguments:
sample: A list of CURIEs for nodes whose attributes are to be tested for enrichment. For example, a list of genes.
ontologyC... |
def unpack_message(buffer):
"""Unpack the whole buffer, including header pack.
Args:
buffer (bytes): Bytes representation of a openflow message.
Returns:
object: Instance of openflow message.
"""
hdr_size = Header().get_size()
hdr_buff, msg_buff = buffer[:hdr_size], buffer[hdr... | def function[unpack_message, parameter[buffer]]:
constant[Unpack the whole buffer, including header pack.
Args:
buffer (bytes): Bytes representation of a openflow message.
Returns:
object: Instance of openflow message.
]
variable[hdr_size] assign[=] call[call[name[Header],... | keyword[def] identifier[unpack_message] ( identifier[buffer] ):
literal[string]
identifier[hdr_size] = identifier[Header] (). identifier[get_size] ()
identifier[hdr_buff] , identifier[msg_buff] = identifier[buffer] [: identifier[hdr_size] ], identifier[buffer] [ identifier[hdr_size] :]
identifier... | def unpack_message(buffer):
"""Unpack the whole buffer, including header pack.
Args:
buffer (bytes): Bytes representation of a openflow message.
Returns:
object: Instance of openflow message.
"""
hdr_size = Header().get_size()
(hdr_buff, msg_buff) = (buffer[:hdr_size], buffer[... |
def delete_async(self, url, name, callback=None, params=None, headers=None):
"""
Asynchronous DELETE request with the process pool.
"""
if not name: name = ''
params = params or {}
headers = headers or {}
endpoint = self._build_endpoint_url(url, name)
self... | def function[delete_async, parameter[self, url, name, callback, params, headers]]:
constant[
Asynchronous DELETE request with the process pool.
]
if <ast.UnaryOp object at 0x7da204963070> begin[:]
variable[name] assign[=] constant[]
variable[params] assign[=] <ast... | keyword[def] identifier[delete_async] ( identifier[self] , identifier[url] , identifier[name] , identifier[callback] = keyword[None] , identifier[params] = keyword[None] , identifier[headers] = keyword[None] ):
literal[string]
keyword[if] keyword[not] identifier[name] : identifier[name] = literal... | def delete_async(self, url, name, callback=None, params=None, headers=None):
"""
Asynchronous DELETE request with the process pool.
"""
if not name:
name = '' # depends on [control=['if'], data=[]]
params = params or {}
headers = headers or {}
endpoint = self._build_endpoint... |
def add_samples(self, samples: Iterable[Sample]) -> None:
"""Add samples in an iterable to this :class:`SampleSheet`."""
for sample in samples:
self.add_sample(sample) | def function[add_samples, parameter[self, samples]]:
constant[Add samples in an iterable to this :class:`SampleSheet`.]
for taget[name[sample]] in starred[name[samples]] begin[:]
call[name[self].add_sample, parameter[name[sample]]] | keyword[def] identifier[add_samples] ( identifier[self] , identifier[samples] : identifier[Iterable] [ identifier[Sample] ])-> keyword[None] :
literal[string]
keyword[for] identifier[sample] keyword[in] identifier[samples] :
identifier[self] . identifier[add_sample] ( identifier[sam... | def add_samples(self, samples: Iterable[Sample]) -> None:
"""Add samples in an iterable to this :class:`SampleSheet`."""
for sample in samples:
self.add_sample(sample) # depends on [control=['for'], data=['sample']] |
def indexSearch(self, indexes):
"""Filters the data by a list of indexes.
Args:
indexes (list of int): List of index numbers to return.
Returns:
list: A list containing all indexes with filtered data. Matches
will be `True`, the remaining items will be `Fals... | def function[indexSearch, parameter[self, indexes]]:
constant[Filters the data by a list of indexes.
Args:
indexes (list of int): List of index numbers to return.
Returns:
list: A list containing all indexes with filtered data. Matches
will be `True`, the re... | keyword[def] identifier[indexSearch] ( identifier[self] , identifier[indexes] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_dataFrame] . identifier[empty] :
identifier[filter0] = identifier[self] . identifier[_dataFrame] . identifier[index] ==- literal[i... | def indexSearch(self, indexes):
"""Filters the data by a list of indexes.
Args:
indexes (list of int): List of index numbers to return.
Returns:
list: A list containing all indexes with filtered data. Matches
will be `True`, the remaining items will be `False`. ... |
def get_txn(self, txn_name, txn_uri):
'''
Retrieves known transaction and adds to self.txns.
TODO:
Perhaps this should send a keep-alive request as well? Obviously still needed, and would reset timer.
Args:
txn_prefix (str, rdflib.term.URIRef): uri of the transaction. e.g. http://localhost:8080/rest/t... | def function[get_txn, parameter[self, txn_name, txn_uri]]:
constant[
Retrieves known transaction and adds to self.txns.
TODO:
Perhaps this should send a keep-alive request as well? Obviously still needed, and would reset timer.
Args:
txn_prefix (str, rdflib.term.URIRef): uri of the transaction. e... | keyword[def] identifier[get_txn] ( identifier[self] , identifier[txn_name] , identifier[txn_uri] ):
literal[string]
identifier[txn_uri] = identifier[self] . identifier[parse_uri] ( identifier[txn_uri] )
identifier[txn_response] = identifier[self] . identifier[api] . identifier[http_request] ( liter... | def get_txn(self, txn_name, txn_uri):
"""
Retrieves known transaction and adds to self.txns.
TODO:
Perhaps this should send a keep-alive request as well? Obviously still needed, and would reset timer.
Args:
txn_prefix (str, rdflib.term.URIRef): uri of the transaction. e.g. http://localhost:8080/rest/... |
def add_helpingmaterials(config, helping_materials_file, helping_type):
"""Add helping materials to a project."""
res = _add_helpingmaterials(config, helping_materials_file, helping_type)
click.echo(res) | def function[add_helpingmaterials, parameter[config, helping_materials_file, helping_type]]:
constant[Add helping materials to a project.]
variable[res] assign[=] call[name[_add_helpingmaterials], parameter[name[config], name[helping_materials_file], name[helping_type]]]
call[name[click].echo, p... | keyword[def] identifier[add_helpingmaterials] ( identifier[config] , identifier[helping_materials_file] , identifier[helping_type] ):
literal[string]
identifier[res] = identifier[_add_helpingmaterials] ( identifier[config] , identifier[helping_materials_file] , identifier[helping_type] )
identifier[cl... | def add_helpingmaterials(config, helping_materials_file, helping_type):
"""Add helping materials to a project."""
res = _add_helpingmaterials(config, helping_materials_file, helping_type)
click.echo(res) |
def reduce_stack(array3D, z_function):
"""Return 2D array projection of the input 3D array.
The input function is applied to each line of an input x, y value.
:param array3D: 3D numpy.array
:param z_function: function to use for the projection (e.g. :func:`max`)
"""
xmax, ymax, _ = array3D.sha... | def function[reduce_stack, parameter[array3D, z_function]]:
constant[Return 2D array projection of the input 3D array.
The input function is applied to each line of an input x, y value.
:param array3D: 3D numpy.array
:param z_function: function to use for the projection (e.g. :func:`max`)
]
... | keyword[def] identifier[reduce_stack] ( identifier[array3D] , identifier[z_function] ):
literal[string]
identifier[xmax] , identifier[ymax] , identifier[_] = identifier[array3D] . identifier[shape]
identifier[projection] = identifier[np] . identifier[zeros] (( identifier[xmax] , identifier[ymax] ), i... | def reduce_stack(array3D, z_function):
"""Return 2D array projection of the input 3D array.
The input function is applied to each line of an input x, y value.
:param array3D: 3D numpy.array
:param z_function: function to use for the projection (e.g. :func:`max`)
"""
(xmax, ymax, _) = array3D.s... |
def _Open(self, path_spec=None, mode='rb'):
"""Opens the file-like object defined by path specification.
Args:
path_spec (Optional[PathSpec]): path specification.
mode (Optional[str]): file access mode.
Raises:
AccessError: if the access to open the file was denied.
IOError: if the... | def function[_Open, parameter[self, path_spec, mode]]:
constant[Opens the file-like object defined by path specification.
Args:
path_spec (Optional[PathSpec]): path specification.
mode (Optional[str]): file access mode.
Raises:
AccessError: if the access to open the file was denied.
... | keyword[def] identifier[_Open] ( identifier[self] , identifier[path_spec] = keyword[None] , identifier[mode] = literal[string] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_file_object_set_in_init] keyword[and] keyword[not] identifier[path_spec] :
keyword[raise] id... | def _Open(self, path_spec=None, mode='rb'):
"""Opens the file-like object defined by path specification.
Args:
path_spec (Optional[PathSpec]): path specification.
mode (Optional[str]): file access mode.
Raises:
AccessError: if the access to open the file was denied.
IOError: if the... |
def list_nodes(call=None):
''' Return a list of the BareMetal servers that are on the provider.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
items = query(method='servers')
ret = {}
for node in... | def function[list_nodes, parameter[call]]:
constant[ Return a list of the BareMetal servers that are on the provider.
]
if compare[name[call] equal[==] constant[action]] begin[:]
<ast.Raise object at 0x7da2046225c0>
variable[items] assign[=] call[name[query], parameter[]]
var... | keyword[def] identifier[list_nodes] ( identifier[call] = keyword[None] ):
literal[string]
keyword[if] identifier[call] == literal[string] :
keyword[raise] identifier[SaltCloudSystemExit] (
literal[string]
)
identifier[items] = identifier[query] ( identifier[method] = lite... | def list_nodes(call=None):
""" Return a list of the BareMetal servers that are on the provider.
"""
if call == 'action':
raise SaltCloudSystemExit('The list_nodes function must be called with -f or --function.') # depends on [control=['if'], data=[]]
items = query(method='servers')
ret = {}... |
def pretokenized_t2t_dataset(dataset_name=gin.REQUIRED,
text2self=False,
data_dir=gin.REQUIRED,
dataset_split="train",
batch_size=gin.REQUIRED,
sequence_length=gin.REQUIRED,
... | def function[pretokenized_t2t_dataset, parameter[dataset_name, text2self, data_dir, dataset_split, batch_size, sequence_length, vocabulary]]:
constant[Loads the Tensor2tensor dataset specified by dataset_name.
Args:
dataset_name: TensorFlow Datasets dataset name.
text2self: a boolean
data_dir: st... | keyword[def] identifier[pretokenized_t2t_dataset] ( identifier[dataset_name] = identifier[gin] . identifier[REQUIRED] ,
identifier[text2self] = keyword[False] ,
identifier[data_dir] = identifier[gin] . identifier[REQUIRED] ,
identifier[dataset_split] = literal[string] ,
identifier[batch_size] = identifier[gin] . ... | def pretokenized_t2t_dataset(dataset_name=gin.REQUIRED, text2self=False, data_dir=gin.REQUIRED, dataset_split='train', batch_size=gin.REQUIRED, sequence_length=gin.REQUIRED, vocabulary=None):
"""Loads the Tensor2tensor dataset specified by dataset_name.
Args:
dataset_name: TensorFlow Datasets dataset name.
... |
def add_ui_from_string(self, buffer, length=-1):
"""add_ui_from_string(buffer, length=-1)
{{ all }}
"""
return Gtk.UIManager.add_ui_from_string(self, buffer, length) | def function[add_ui_from_string, parameter[self, buffer, length]]:
constant[add_ui_from_string(buffer, length=-1)
{{ all }}
]
return[call[name[Gtk].UIManager.add_ui_from_string, parameter[name[self], name[buffer], name[length]]]] | keyword[def] identifier[add_ui_from_string] ( identifier[self] , identifier[buffer] , identifier[length] =- literal[int] ):
literal[string]
keyword[return] identifier[Gtk] . identifier[UIManager] . identifier[add_ui_from_string] ( identifier[self] , identifier[buffer] , identifier[length] ) | def add_ui_from_string(self, buffer, length=-1):
"""add_ui_from_string(buffer, length=-1)
{{ all }}
"""
return Gtk.UIManager.add_ui_from_string(self, buffer, length) |
def plot(args):
"""
%prog plot input.bed seqid
Plot the matchings between the reconstructed pseudomolecules and the maps.
Two types of visualizations are available in one canvas:
1. Parallel axes, and matching markers are shown in connecting lines;
2. Scatter plot.
"""
from jcvi.graphi... | def function[plot, parameter[args]]:
constant[
%prog plot input.bed seqid
Plot the matchings between the reconstructed pseudomolecules and the maps.
Two types of visualizations are available in one canvas:
1. Parallel axes, and matching markers are shown in connecting lines;
2. Scatter plo... | keyword[def] identifier[plot] ( identifier[args] ):
literal[string]
keyword[from] identifier[jcvi] . identifier[graphics] . identifier[base] keyword[import] identifier[plt] , identifier[savefig] , identifier[normalize_axes] , identifier[set2] , identifier[panel_labels] , identifier[shorten]
keywor... | def plot(args):
"""
%prog plot input.bed seqid
Plot the matchings between the reconstructed pseudomolecules and the maps.
Two types of visualizations are available in one canvas:
1. Parallel axes, and matching markers are shown in connecting lines;
2. Scatter plot.
"""
from jcvi.graphi... |
def _generate_bearer_token(consumer_key, consumer_secret):
"""
Return the bearer token for a given pair of consumer key and secret values.
"""
data = [('grant_type', 'client_credentials')]
resp = requests.post(OAUTH_ENDPOINT,
data=data,
auth=(consume... | def function[_generate_bearer_token, parameter[consumer_key, consumer_secret]]:
constant[
Return the bearer token for a given pair of consumer key and secret values.
]
variable[data] assign[=] list[[<ast.Tuple object at 0x7da1b12771c0>]]
variable[resp] assign[=] call[name[requests].post,... | keyword[def] identifier[_generate_bearer_token] ( identifier[consumer_key] , identifier[consumer_secret] ):
literal[string]
identifier[data] =[( literal[string] , literal[string] )]
identifier[resp] = identifier[requests] . identifier[post] ( identifier[OAUTH_ENDPOINT] ,
identifier[data] = identi... | def _generate_bearer_token(consumer_key, consumer_secret):
"""
Return the bearer token for a given pair of consumer key and secret values.
"""
data = [('grant_type', 'client_credentials')]
resp = requests.post(OAUTH_ENDPOINT, data=data, auth=(consumer_key, consumer_secret))
logger.warning('Grabb... |
def timezone(self):
"""
Return timezone. Offset from UTC.
"""
date = self.message.get('date')
timezone = 0
try:
_, timezone = convert_mail_date(date)
finally:
return timezone | def function[timezone, parameter[self]]:
constant[
Return timezone. Offset from UTC.
]
variable[date] assign[=] call[name[self].message.get, parameter[constant[date]]]
variable[timezone] assign[=] constant[0]
<ast.Try object at 0x7da1b0844340> | keyword[def] identifier[timezone] ( identifier[self] ):
literal[string]
identifier[date] = identifier[self] . identifier[message] . identifier[get] ( literal[string] )
identifier[timezone] = literal[int]
keyword[try] :
identifier[_] , identifier[timezone] = identifi... | def timezone(self):
"""
Return timezone. Offset from UTC.
"""
date = self.message.get('date')
timezone = 0
try:
(_, timezone) = convert_mail_date(date) # depends on [control=['try'], data=[]]
finally:
return timezone |
def rename(self, from_path, to_path):
"""
Rename file.
:type from_path: str
:param from_path: the path of the source file
:type to_path: str
:param to_path: the path of the destination file
:raises: :exc:`~exceptions.IOError`
"""
_complain_ifclose... | def function[rename, parameter[self, from_path, to_path]]:
constant[
Rename file.
:type from_path: str
:param from_path: the path of the source file
:type to_path: str
:param to_path: the path of the destination file
:raises: :exc:`~exceptions.IOError`
]
... | keyword[def] identifier[rename] ( identifier[self] , identifier[from_path] , identifier[to_path] ):
literal[string]
identifier[_complain_ifclosed] ( identifier[self] . identifier[closed] )
keyword[return] identifier[self] . identifier[fs] . identifier[rename] ( identifier[from_path] , ide... | def rename(self, from_path, to_path):
"""
Rename file.
:type from_path: str
:param from_path: the path of the source file
:type to_path: str
:param to_path: the path of the destination file
:raises: :exc:`~exceptions.IOError`
"""
_complain_ifclosed(self.c... |
def add_prefix(self, prefix, flags, prf):
"""Add network prefix.
Args:
prefix (str): network prefix.
flags (str): network prefix flags, please refer thread documentation for details
prf (str): network prf, please refer thread documentation for details
"""
... | def function[add_prefix, parameter[self, prefix, flags, prf]]:
constant[Add network prefix.
Args:
prefix (str): network prefix.
flags (str): network prefix flags, please refer thread documentation for details
prf (str): network prf, please refer thread documentation ... | keyword[def] identifier[add_prefix] ( identifier[self] , identifier[prefix] , identifier[flags] , identifier[prf] ):
literal[string]
identifier[self] . identifier[_req] ( literal[string] %( identifier[prefix] , identifier[flags] , identifier[prf] ))
identifier[time] . identifier[sleep] ( l... | def add_prefix(self, prefix, flags, prf):
"""Add network prefix.
Args:
prefix (str): network prefix.
flags (str): network prefix flags, please refer thread documentation for details
prf (str): network prf, please refer thread documentation for details
"""
sel... |
def unregister_message_callback(self, type_, from_):
"""
Unregister a callback previously registered with
:meth:`register_message_callback`.
:param type_: Message type to listen for.
:type type_: :class:`~.MessageType` or :data:`None`
:param from_: Sender JID to listen f... | def function[unregister_message_callback, parameter[self, type_, from_]]:
constant[
Unregister a callback previously registered with
:meth:`register_message_callback`.
:param type_: Message type to listen for.
:type type_: :class:`~.MessageType` or :data:`None`
:param fr... | keyword[def] identifier[unregister_message_callback] ( identifier[self] , identifier[type_] , identifier[from_] ):
literal[string]
keyword[if] identifier[type_] keyword[is] keyword[not] keyword[None] :
identifier[type_] = identifier[self] . identifier[_coerce_enum] ( identifier[typ... | def unregister_message_callback(self, type_, from_):
"""
Unregister a callback previously registered with
:meth:`register_message_callback`.
:param type_: Message type to listen for.
:type type_: :class:`~.MessageType` or :data:`None`
:param from_: Sender JID to listen for.
... |
def check_dimensional_vertical_coordinate(self, ds):
'''
Check units for variables defining vertical position are valid under
CF.
CF §4.3.1 The units attribute for dimensional coordinates will be a string
formatted as per the udunits.dat file.
The acceptable units for v... | def function[check_dimensional_vertical_coordinate, parameter[self, ds]]:
constant[
Check units for variables defining vertical position are valid under
CF.
CF §4.3.1 The units attribute for dimensional coordinates will be a string
formatted as per the udunits.dat file.
... | keyword[def] identifier[check_dimensional_vertical_coordinate] ( identifier[self] , identifier[ds] ):
literal[string]
identifier[ret_val] =[]
identifier[z_variables] = identifier[cfutil] . identifier[get_z_variables] ( identifier[ds] )
keyword[for] identifier[name] keyw... | def check_dimensional_vertical_coordinate(self, ds):
"""
Check units for variables defining vertical position are valid under
CF.
CF §4.3.1 The units attribute for dimensional coordinates will be a string
formatted as per the udunits.dat file.
The acceptable units for verti... |
def effect_emd(d1, d2):
"""Compute the EMD between two effect repertoires.
Because the nodes are independent, the EMD between effect repertoires is
equal to the sum of the EMDs between the marginal distributions of each
node, and the EMD between marginal distribution for a node is the absolute
diff... | def function[effect_emd, parameter[d1, d2]]:
constant[Compute the EMD between two effect repertoires.
Because the nodes are independent, the EMD between effect repertoires is
equal to the sum of the EMDs between the marginal distributions of each
node, and the EMD between marginal distribution for ... | keyword[def] identifier[effect_emd] ( identifier[d1] , identifier[d2] ):
literal[string]
keyword[return] identifier[sum] ( identifier[abs] ( identifier[marginal_zero] ( identifier[d1] , identifier[i] )- identifier[marginal_zero] ( identifier[d2] , identifier[i] ))
keyword[for] identifier[i] keyword... | def effect_emd(d1, d2):
"""Compute the EMD between two effect repertoires.
Because the nodes are independent, the EMD between effect repertoires is
equal to the sum of the EMDs between the marginal distributions of each
node, and the EMD between marginal distribution for a node is the absolute
diff... |
def _store_cached_zone_variable(self, zone_id, name, value):
"""
Stores the current known value of a zone variable into the cache.
Calls any zone callbacks.
"""
zone_state = self._zone_state.setdefault(zone_id, {})
name = name.lower()
zone_state[name] = value
... | def function[_store_cached_zone_variable, parameter[self, zone_id, name, value]]:
constant[
Stores the current known value of a zone variable into the cache.
Calls any zone callbacks.
]
variable[zone_state] assign[=] call[name[self]._zone_state.setdefault, parameter[name[zone_id]... | keyword[def] identifier[_store_cached_zone_variable] ( identifier[self] , identifier[zone_id] , identifier[name] , identifier[value] ):
literal[string]
identifier[zone_state] = identifier[self] . identifier[_zone_state] . identifier[setdefault] ( identifier[zone_id] ,{})
identifier[name] =... | def _store_cached_zone_variable(self, zone_id, name, value):
"""
Stores the current known value of a zone variable into the cache.
Calls any zone callbacks.
"""
zone_state = self._zone_state.setdefault(zone_id, {})
name = name.lower()
zone_state[name] = value
logger.debug('Zo... |
def addSpecfile(self, specfiles, path):
"""Prepares the container for loading ``mrc`` files by adding specfile
entries to ``self.info``. Use :func:`MsrunContainer.load()` afterwards
to actually import the files
:param specfiles: the name of an ms-run file or a list of names
:typ... | def function[addSpecfile, parameter[self, specfiles, path]]:
constant[Prepares the container for loading ``mrc`` files by adding specfile
entries to ``self.info``. Use :func:`MsrunContainer.load()` afterwards
to actually import the files
:param specfiles: the name of an ms-run file or a... | keyword[def] identifier[addSpecfile] ( identifier[self] , identifier[specfiles] , identifier[path] ):
literal[string]
keyword[for] identifier[specfile] keyword[in] identifier[aux] . identifier[toList] ( identifier[specfiles] ):
keyword[if] identifier[specfile] keyword[not] keywor... | def addSpecfile(self, specfiles, path):
"""Prepares the container for loading ``mrc`` files by adding specfile
entries to ``self.info``. Use :func:`MsrunContainer.load()` afterwards
to actually import the files
:param specfiles: the name of an ms-run file or a list of names
:type sp... |
def respond(text=None, ssml=None, attributes=None, reprompt_text=None,
reprompt_ssml=None, end_session=True):
""" Build a dict containing a valid response to an Alexa request.
If speech output is desired, either of `text` or `ssml` should
be specified.
:param text: Plain text speech output... | def function[respond, parameter[text, ssml, attributes, reprompt_text, reprompt_ssml, end_session]]:
constant[ Build a dict containing a valid response to an Alexa request.
If speech output is desired, either of `text` or `ssml` should
be specified.
:param text: Plain text speech output to be said... | keyword[def] identifier[respond] ( identifier[text] = keyword[None] , identifier[ssml] = keyword[None] , identifier[attributes] = keyword[None] , identifier[reprompt_text] = keyword[None] ,
identifier[reprompt_ssml] = keyword[None] , identifier[end_session] = keyword[True] ):
literal[string]
identifier[o... | def respond(text=None, ssml=None, attributes=None, reprompt_text=None, reprompt_ssml=None, end_session=True):
""" Build a dict containing a valid response to an Alexa request.
If speech output is desired, either of `text` or `ssml` should
be specified.
:param text: Plain text speech output to be said ... |
def ack(self):
"""Acknowledge this message as being processed.,
This will remove the message from the queue.
:raises MessageStateError: If the message has already been
acknowledged/requeued/rejected.
"""
if self.acknowledged:
raise self.MessageStateError... | def function[ack, parameter[self]]:
constant[Acknowledge this message as being processed.,
This will remove the message from the queue.
:raises MessageStateError: If the message has already been
acknowledged/requeued/rejected.
]
if name[self].acknowledged begin[:]
... | keyword[def] identifier[ack] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[acknowledged] :
keyword[raise] identifier[self] . identifier[MessageStateError] (
literal[string] % identifier[self] . identifier[_state] )
identifier[se... | def ack(self):
"""Acknowledge this message as being processed.,
This will remove the message from the queue.
:raises MessageStateError: If the message has already been
acknowledged/requeued/rejected.
"""
if self.acknowledged:
raise self.MessageStateError('Message al... |
def setup_logging(filename, log_dir=None, force_setup=False):
''' Try to load logging configuration from a file. Set level to INFO if failed.
'''
if not force_setup and ChirpCLI.SETUP_COMPLETED:
logging.debug("Master logging has been setup. This call will be ignored.")
return
if log_dir ... | def function[setup_logging, parameter[filename, log_dir, force_setup]]:
constant[ Try to load logging configuration from a file. Set level to INFO if failed.
]
if <ast.BoolOp object at 0x7da1b11768f0> begin[:]
call[name[logging].debug, parameter[constant[Master logging has been setup... | keyword[def] identifier[setup_logging] ( identifier[filename] , identifier[log_dir] = keyword[None] , identifier[force_setup] = keyword[False] ):
literal[string]
keyword[if] keyword[not] identifier[force_setup] keyword[and] identifier[ChirpCLI] . identifier[SETUP_COMPLETED] :
identifier[loggin... | def setup_logging(filename, log_dir=None, force_setup=False):
""" Try to load logging configuration from a file. Set level to INFO if failed.
"""
if not force_setup and ChirpCLI.SETUP_COMPLETED:
logging.debug('Master logging has been setup. This call will be ignored.')
return # depends on [... |
def _effective_filename(self):
# type: () -> str
"""
Returns the filename which is effectively used by the application. If
overridden by an environment variable, it will return that filename.
"""
# same logic for the configuration filename. First, check if we were
... | def function[_effective_filename, parameter[self]]:
constant[
Returns the filename which is effectively used by the application. If
overridden by an environment variable, it will return that filename.
]
variable[config_filename] assign[=] constant[]
if name[self].filename... | keyword[def] identifier[_effective_filename] ( identifier[self] ):
literal[string]
identifier[config_filename] = literal[string]
keyword[if] identifier[self] . identifier[filename] :
identifier[config_filename] = identifier[self] . identifier[filename]
... | def _effective_filename(self):
# type: () -> str
'\n Returns the filename which is effectively used by the application. If\n overridden by an environment variable, it will return that filename.\n '
# same logic for the configuration filename. First, check if we were
# initialized wi... |
def get_path(self, x: int, y: int) -> List[Tuple[int, int]]:
"""Return a list of (x, y) steps to reach the goal point, if possible.
"""
lib.TCOD_dijkstra_path_set(self._path_c, x, y)
path = []
pointer_x = ffi.new("int[2]")
pointer_y = pointer_x + 1
while lib.TCOD_... | def function[get_path, parameter[self, x, y]]:
constant[Return a list of (x, y) steps to reach the goal point, if possible.
]
call[name[lib].TCOD_dijkstra_path_set, parameter[name[self]._path_c, name[x], name[y]]]
variable[path] assign[=] list[[]]
variable[pointer_x] assign[=] ca... | keyword[def] identifier[get_path] ( identifier[self] , identifier[x] : identifier[int] , identifier[y] : identifier[int] )-> identifier[List] [ identifier[Tuple] [ identifier[int] , identifier[int] ]]:
literal[string]
identifier[lib] . identifier[TCOD_dijkstra_path_set] ( identifier[self] . identif... | def get_path(self, x: int, y: int) -> List[Tuple[int, int]]:
"""Return a list of (x, y) steps to reach the goal point, if possible.
"""
lib.TCOD_dijkstra_path_set(self._path_c, x, y)
path = []
pointer_x = ffi.new('int[2]')
pointer_y = pointer_x + 1
while lib.TCOD_dijkstra_path_walk(self.... |
def raise_dependencies_check(self, ref_check, hosts, services, timeperiods, macromodulations,
checkmodulations, checks):
# pylint: disable=too-many-locals, too-many-nested-blocks
"""Get checks that we depend on if EVERY following conditions is met::
* timeperiod... | def function[raise_dependencies_check, parameter[self, ref_check, hosts, services, timeperiods, macromodulations, checkmodulations, checks]]:
constant[Get checks that we depend on if EVERY following conditions is met::
* timeperiod is valid
* dep.last_state_update < now - cls.cached_check_horiz... | keyword[def] identifier[raise_dependencies_check] ( identifier[self] , identifier[ref_check] , identifier[hosts] , identifier[services] , identifier[timeperiods] , identifier[macromodulations] ,
identifier[checkmodulations] , identifier[checks] ):
literal[string]
identifier[now] = identifier[time... | def raise_dependencies_check(self, ref_check, hosts, services, timeperiods, macromodulations, checkmodulations, checks):
# pylint: disable=too-many-locals, too-many-nested-blocks
'Get checks that we depend on if EVERY following conditions is met::\n\n * timeperiod is valid\n * dep.last_state_updat... |
def _get_final_set(self, sets, pk, sort_options):
"""
Called by _collection to get the final set to work on. Return the name
of the set to use, and a list of keys to delete once the collection is
really called (in case of a computed set based on multiple ones)
"""
conn = ... | def function[_get_final_set, parameter[self, sets, pk, sort_options]]:
constant[
Called by _collection to get the final set to work on. Return the name
of the set to use, and a list of keys to delete once the collection is
really called (in case of a computed set based on multiple ones)
... | keyword[def] identifier[_get_final_set] ( identifier[self] , identifier[sets] , identifier[pk] , identifier[sort_options] ):
literal[string]
identifier[conn] = identifier[self] . identifier[cls] . identifier[get_connection] ()
identifier[all_sets] = identifier[set] ()
identifier[t... | def _get_final_set(self, sets, pk, sort_options):
"""
Called by _collection to get the final set to work on. Return the name
of the set to use, and a list of keys to delete once the collection is
really called (in case of a computed set based on multiple ones)
"""
conn = self.cls... |
def execute_sql(self, statement):
"""
Executes a single SQL statement.
:param statement: SQL string
:return: String response
:rtype: str
"""
path = '/archive/{}/sql'.format(self._instance)
req = archive_pb2.ExecuteSqlRequest()
req.statement = stat... | def function[execute_sql, parameter[self, statement]]:
constant[
Executes a single SQL statement.
:param statement: SQL string
:return: String response
:rtype: str
]
variable[path] assign[=] call[constant[/archive/{}/sql].format, parameter[name[self]._instance]]
... | keyword[def] identifier[execute_sql] ( identifier[self] , identifier[statement] ):
literal[string]
identifier[path] = literal[string] . identifier[format] ( identifier[self] . identifier[_instance] )
identifier[req] = identifier[archive_pb2] . identifier[ExecuteSqlRequest] ()
iden... | def execute_sql(self, statement):
"""
Executes a single SQL statement.
:param statement: SQL string
:return: String response
:rtype: str
"""
path = '/archive/{}/sql'.format(self._instance)
req = archive_pb2.ExecuteSqlRequest()
req.statement = statement
respon... |
def emit(self, span_datas):
"""
:type span_datas: list of :class:
`~opencensus.trace.span_data.SpanData`
:param list of opencensus.trace.span_data.SpanData span_datas:
SpanData tuples to emit
"""
# convert to the legacy trace json for easier refactoring
... | def function[emit, parameter[self, span_datas]]:
constant[
:type span_datas: list of :class:
`~opencensus.trace.span_data.SpanData`
:param list of opencensus.trace.span_data.SpanData span_datas:
SpanData tuples to emit
]
variable[legacy_trace_json] assign[... | keyword[def] identifier[emit] ( identifier[self] , identifier[span_datas] ):
literal[string]
identifier[legacy_trace_json] = identifier[span_data] . identifier[format_legacy_trace_json] ( identifier[span_datas] )
identifier[self] . identifier[logger] . identifier[info] ( ... | def emit(self, span_datas):
"""
:type span_datas: list of :class:
`~opencensus.trace.span_data.SpanData`
:param list of opencensus.trace.span_data.SpanData span_datas:
SpanData tuples to emit
"""
# convert to the legacy trace json for easier refactoring
# TODO... |
def local_property(f):
'''Decorator to be used in conjunction with :class:`LocalMixin` methods.
'''
name = f.__name__
def _(self):
local = self.local
if name not in local:
setattr(local, name, f(self))
return getattr(local, name)
return property(_, doc=f.__doc__... | def function[local_property, parameter[f]]:
constant[Decorator to be used in conjunction with :class:`LocalMixin` methods.
]
variable[name] assign[=] name[f].__name__
def function[_, parameter[self]]:
variable[local] assign[=] name[self].local
if compare[name[... | keyword[def] identifier[local_property] ( identifier[f] ):
literal[string]
identifier[name] = identifier[f] . identifier[__name__]
keyword[def] identifier[_] ( identifier[self] ):
identifier[local] = identifier[self] . identifier[local]
keyword[if] identifier[name] keyword[not]... | def local_property(f):
"""Decorator to be used in conjunction with :class:`LocalMixin` methods.
"""
name = f.__name__
def _(self):
local = self.local
if name not in local:
setattr(local, name, f(self)) # depends on [control=['if'], data=['name', 'local']]
return get... |
def make_headers(keep_alive=None, accept_encoding=None, user_agent=None,
basic_auth=None, proxy_basic_auth=None, disable_cache=None):
"""
Shortcuts for generating request headers.
:param keep_alive:
If ``True``, adds 'connection: keep-alive' header.
:param accept_encoding:
... | def function[make_headers, parameter[keep_alive, accept_encoding, user_agent, basic_auth, proxy_basic_auth, disable_cache]]:
constant[
Shortcuts for generating request headers.
:param keep_alive:
If ``True``, adds 'connection: keep-alive' header.
:param accept_encoding:
Can be a bo... | keyword[def] identifier[make_headers] ( identifier[keep_alive] = keyword[None] , identifier[accept_encoding] = keyword[None] , identifier[user_agent] = keyword[None] ,
identifier[basic_auth] = keyword[None] , identifier[proxy_basic_auth] = keyword[None] , identifier[disable_cache] = keyword[None] ):
literal[str... | def make_headers(keep_alive=None, accept_encoding=None, user_agent=None, basic_auth=None, proxy_basic_auth=None, disable_cache=None):
"""
Shortcuts for generating request headers.
:param keep_alive:
If ``True``, adds 'connection: keep-alive' header.
:param accept_encoding:
Can be a boo... |
def execute(self, context):
"""Upload a file to Azure Blob Storage."""
hook = WasbHook(wasb_conn_id=self.wasb_conn_id)
self.log.info(
'Uploading %s to wasb://%s '
'as %s'.format(self.file_path, self.container_name, self.blob_name)
)
hook.load_file(self.fil... | def function[execute, parameter[self, context]]:
constant[Upload a file to Azure Blob Storage.]
variable[hook] assign[=] call[name[WasbHook], parameter[]]
call[name[self].log.info, parameter[call[constant[Uploading %s to wasb://%s as %s].format, parameter[name[self].file_path, name[self].contain... | keyword[def] identifier[execute] ( identifier[self] , identifier[context] ):
literal[string]
identifier[hook] = identifier[WasbHook] ( identifier[wasb_conn_id] = identifier[self] . identifier[wasb_conn_id] )
identifier[self] . identifier[log] . identifier[info] (
literal[string]
... | def execute(self, context):
"""Upload a file to Azure Blob Storage."""
hook = WasbHook(wasb_conn_id=self.wasb_conn_id)
self.log.info('Uploading %s to wasb://%s as %s'.format(self.file_path, self.container_name, self.blob_name))
hook.load_file(self.file_path, self.container_name, self.blob_name, **self.l... |
def from_http(cls, headers: Mapping[str, str], body: bytes,
*, secret: Optional[str] = None) -> "Event":
"""Construct an event from HTTP headers and JSON body data.
The mapping providing the headers is expected to support lowercase keys.
Since this method assumes the body of ... | def function[from_http, parameter[cls, headers, body]]:
constant[Construct an event from HTTP headers and JSON body data.
The mapping providing the headers is expected to support lowercase keys.
Since this method assumes the body of the HTTP request is JSON, a check
is performed for a ... | keyword[def] identifier[from_http] ( identifier[cls] , identifier[headers] : identifier[Mapping] [ identifier[str] , identifier[str] ], identifier[body] : identifier[bytes] ,
*, identifier[secret] : identifier[Optional] [ identifier[str] ]= keyword[None] )-> literal[string] :
literal[string]
keywor... | def from_http(cls, headers: Mapping[str, str], body: bytes, *, secret: Optional[str]=None) -> 'Event':
"""Construct an event from HTTP headers and JSON body data.
The mapping providing the headers is expected to support lowercase keys.
Since this method assumes the body of the HTTP request is JSON... |
def time(self, target=None):
"""
Get server time.
Optional arguments:
* target=None - Target server.
"""
with self.lock:
if target:
self.send('TIME %s' % target)
else:
self.send('TIME')
time = ''
... | def function[time, parameter[self, target]]:
constant[
Get server time.
Optional arguments:
* target=None - Target server.
]
with name[self].lock begin[:]
if name[target] begin[:]
call[name[self].send, parameter[binary_operation[con... | keyword[def] identifier[time] ( identifier[self] , identifier[target] = keyword[None] ):
literal[string]
keyword[with] identifier[self] . identifier[lock] :
keyword[if] identifier[target] :
identifier[self] . identifier[send] ( literal[string] % identifier[target] )
... | def time(self, target=None):
"""
Get server time.
Optional arguments:
* target=None - Target server.
"""
with self.lock:
if target:
self.send('TIME %s' % target) # depends on [control=['if'], data=[]]
else:
self.send('TIME')
time =... |
def cache_persist(self):
"""
Saves the current trained data to the cache.
This is initiated by the program using this module
"""
filename = self.get_cache_location()
pickle.dump(self.categories, open(filename, 'wb')) | def function[cache_persist, parameter[self]]:
constant[
Saves the current trained data to the cache.
This is initiated by the program using this module
]
variable[filename] assign[=] call[name[self].get_cache_location, parameter[]]
call[name[pickle].dump, parameter[name[s... | keyword[def] identifier[cache_persist] ( identifier[self] ):
literal[string]
identifier[filename] = identifier[self] . identifier[get_cache_location] ()
identifier[pickle] . identifier[dump] ( identifier[self] . identifier[categories] , identifier[open] ( identifier[filename] , literal[str... | def cache_persist(self):
"""
Saves the current trained data to the cache.
This is initiated by the program using this module
"""
filename = self.get_cache_location()
pickle.dump(self.categories, open(filename, 'wb')) |
def area(self):
"""
Mesh surface area
Returns
-------
area : float
Total area of the mesh.
"""
mprop = vtk.vtkMassProperties()
mprop.SetInputData(self)
return mprop.GetSurfaceArea() | def function[area, parameter[self]]:
constant[
Mesh surface area
Returns
-------
area : float
Total area of the mesh.
]
variable[mprop] assign[=] call[name[vtk].vtkMassProperties, parameter[]]
call[name[mprop].SetInputData, parameter[name[sel... | keyword[def] identifier[area] ( identifier[self] ):
literal[string]
identifier[mprop] = identifier[vtk] . identifier[vtkMassProperties] ()
identifier[mprop] . identifier[SetInputData] ( identifier[self] )
keyword[return] identifier[mprop] . identifier[GetSurfaceArea] () | def area(self):
"""
Mesh surface area
Returns
-------
area : float
Total area of the mesh.
"""
mprop = vtk.vtkMassProperties()
mprop.SetInputData(self)
return mprop.GetSurfaceArea() |
def CheckApproversForLabel(self, token, client_urn, requester, approvers,
label):
"""Checks if requester and approvers have approval privileges for labels.
Checks against list of approvers for each label defined in approvers.yaml to
determine if the list of approvers is suffici... | def function[CheckApproversForLabel, parameter[self, token, client_urn, requester, approvers, label]]:
constant[Checks if requester and approvers have approval privileges for labels.
Checks against list of approvers for each label defined in approvers.yaml to
determine if the list of approvers is suffi... | keyword[def] identifier[CheckApproversForLabel] ( identifier[self] , identifier[token] , identifier[client_urn] , identifier[requester] , identifier[approvers] ,
identifier[label] ):
literal[string]
identifier[auth] = identifier[self] . identifier[reader] . identifier[GetAuthorizationForSubject] ( identif... | def CheckApproversForLabel(self, token, client_urn, requester, approvers, label):
"""Checks if requester and approvers have approval privileges for labels.
Checks against list of approvers for each label defined in approvers.yaml to
determine if the list of approvers is sufficient.
Args:
token: ... |
def get_scaled(self, magnitude):
""" Return a unit vector parallel to this one. """
result = self.copy()
result.scale(magnitude)
return result | def function[get_scaled, parameter[self, magnitude]]:
constant[ Return a unit vector parallel to this one. ]
variable[result] assign[=] call[name[self].copy, parameter[]]
call[name[result].scale, parameter[name[magnitude]]]
return[name[result]] | keyword[def] identifier[get_scaled] ( identifier[self] , identifier[magnitude] ):
literal[string]
identifier[result] = identifier[self] . identifier[copy] ()
identifier[result] . identifier[scale] ( identifier[magnitude] )
keyword[return] identifier[result] | def get_scaled(self, magnitude):
""" Return a unit vector parallel to this one. """
result = self.copy()
result.scale(magnitude)
return result |
def esummary(database: str, ids=False, webenv=False, query_key=False, count=False, retstart=False, retmax=False,
api_key=False, email=False, **kwargs) -> Optional[List[EsummaryResult]]:
"""Get document summaries using the Entrez ESearch API.
Parameters
----------
database : str
Ent... | def function[esummary, parameter[database, ids, webenv, query_key, count, retstart, retmax, api_key, email]]:
constant[Get document summaries using the Entrez ESearch API.
Parameters
----------
database : str
Entez database to search.
ids : list or str
List of IDs to submit to t... | keyword[def] identifier[esummary] ( identifier[database] : identifier[str] , identifier[ids] = keyword[False] , identifier[webenv] = keyword[False] , identifier[query_key] = keyword[False] , identifier[count] = keyword[False] , identifier[retstart] = keyword[False] , identifier[retmax] = keyword[False] ,
identifier[... | def esummary(database: str, ids=False, webenv=False, query_key=False, count=False, retstart=False, retmax=False, api_key=False, email=False, **kwargs) -> Optional[List[EsummaryResult]]:
"""Get document summaries using the Entrez ESearch API.
Parameters
----------
database : str
Entez database t... |
def in_file(self, fn: str) -> Iterator[InsertionPoint]:
"""
Returns an iterator over all of the insertion points in a given file.
"""
logger.debug("finding insertion points in file: %s", fn)
yield from self.__file_insertions.get(fn, []) | def function[in_file, parameter[self, fn]]:
constant[
Returns an iterator over all of the insertion points in a given file.
]
call[name[logger].debug, parameter[constant[finding insertion points in file: %s], name[fn]]]
<ast.YieldFrom object at 0x7da18fe92f20> | keyword[def] identifier[in_file] ( identifier[self] , identifier[fn] : identifier[str] )-> identifier[Iterator] [ identifier[InsertionPoint] ]:
literal[string]
identifier[logger] . identifier[debug] ( literal[string] , identifier[fn] )
keyword[yield] keyword[from] identifier[self] . iden... | def in_file(self, fn: str) -> Iterator[InsertionPoint]:
"""
Returns an iterator over all of the insertion points in a given file.
"""
logger.debug('finding insertion points in file: %s', fn)
yield from self.__file_insertions.get(fn, []) |
def name(self):
"""User name (the same name as on the users community profile page).
:rtype: str
"""
uid = self.user_id
if self._iface_user.get_id() == uid:
return self._iface.get_my_name()
return self._iface.get_name(uid) | def function[name, parameter[self]]:
constant[User name (the same name as on the users community profile page).
:rtype: str
]
variable[uid] assign[=] name[self].user_id
if compare[call[name[self]._iface_user.get_id, parameter[]] equal[==] name[uid]] begin[:]
return[call[... | keyword[def] identifier[name] ( identifier[self] ):
literal[string]
identifier[uid] = identifier[self] . identifier[user_id]
keyword[if] identifier[self] . identifier[_iface_user] . identifier[get_id] ()== identifier[uid] :
keyword[return] identifier[self] . identifier[_if... | def name(self):
"""User name (the same name as on the users community profile page).
:rtype: str
"""
uid = self.user_id
if self._iface_user.get_id() == uid:
return self._iface.get_my_name() # depends on [control=['if'], data=[]]
return self._iface.get_name(uid) |
def clear_feature_symlinks(self, feature_name):
""" Clear the symlinks for a feature in the symlinked path """
logger.debug("Clearing feature symlinks for %s" % feature_name)
feature_path = self.install_directory(feature_name)
for d in ('bin', 'lib'):
if os.path.exists(os.pat... | def function[clear_feature_symlinks, parameter[self, feature_name]]:
constant[ Clear the symlinks for a feature in the symlinked path ]
call[name[logger].debug, parameter[binary_operation[constant[Clearing feature symlinks for %s] <ast.Mod object at 0x7da2590d6920> name[feature_name]]]]
variable... | keyword[def] identifier[clear_feature_symlinks] ( identifier[self] , identifier[feature_name] ):
literal[string]
identifier[logger] . identifier[debug] ( literal[string] % identifier[feature_name] )
identifier[feature_path] = identifier[self] . identifier[install_directory] ( identifier[fe... | def clear_feature_symlinks(self, feature_name):
""" Clear the symlinks for a feature in the symlinked path """
logger.debug('Clearing feature symlinks for %s' % feature_name)
feature_path = self.install_directory(feature_name)
for d in ('bin', 'lib'):
if os.path.exists(os.path.join(self.root_dir... |
def get_info(self):
'''Return ResourceInfo instances.'''
if self._min_disk:
for path in self._resource_paths:
usage = psutil.disk_usage(path)
yield ResourceInfo(path, usage.free, self._min_disk)
if self._min_memory:
usage = psutil.virtual... | def function[get_info, parameter[self]]:
constant[Return ResourceInfo instances.]
if name[self]._min_disk begin[:]
for taget[name[path]] in starred[name[self]._resource_paths] begin[:]
variable[usage] assign[=] call[name[psutil].disk_usage, parameter[name[path]]]
... | keyword[def] identifier[get_info] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_min_disk] :
keyword[for] identifier[path] keyword[in] identifier[self] . identifier[_resource_paths] :
identifier[usage] = identifier[psutil] . identi... | def get_info(self):
"""Return ResourceInfo instances."""
if self._min_disk:
for path in self._resource_paths:
usage = psutil.disk_usage(path)
yield ResourceInfo(path, usage.free, self._min_disk) # depends on [control=['for'], data=['path']] # depends on [control=['if'], data=[]... |
def print_napps(napps):
"""Print status, name and description."""
if not napps:
print('No NApps found.')
return
stat_w = 6 # We already know the size of Status col
name_w = max(len(n[1]) for n in napps)
desc_w = max(len(n[2]) for n in napps)
term... | def function[print_napps, parameter[napps]]:
constant[Print status, name and description.]
if <ast.UnaryOp object at 0x7da1b242c6a0> begin[:]
call[name[print], parameter[constant[No NApps found.]]]
return[None]
variable[stat_w] assign[=] constant[6]
variable[name_... | keyword[def] identifier[print_napps] ( identifier[napps] ):
literal[string]
keyword[if] keyword[not] identifier[napps] :
identifier[print] ( literal[string] )
keyword[return]
identifier[stat_w] = literal[int]
identifier[name_w] = identifier[max] ( id... | def print_napps(napps):
"""Print status, name and description."""
if not napps:
print('No NApps found.')
return # depends on [control=['if'], data=[]]
stat_w = 6 # We already know the size of Status col
name_w = max((len(n[1]) for n in napps))
desc_w = max((len(n[2]) for n in napps... |
def validate_tpa_user_id(self, value):
"""
Validates the tpa_user_id, if is given, to see if there is an existing EnterpriseCustomerUser for it.
It first uses the third party auth api to find the associated username to do the lookup.
"""
enterprise_customer = self.context.get('e... | def function[validate_tpa_user_id, parameter[self, value]]:
constant[
Validates the tpa_user_id, if is given, to see if there is an existing EnterpriseCustomerUser for it.
It first uses the third party auth api to find the associated username to do the lookup.
]
variable[enterpr... | keyword[def] identifier[validate_tpa_user_id] ( identifier[self] , identifier[value] ):
literal[string]
identifier[enterprise_customer] = identifier[self] . identifier[context] . identifier[get] ( literal[string] )
keyword[try] :
identifier[tpa_client] = identifier[ThirdParty... | def validate_tpa_user_id(self, value):
"""
Validates the tpa_user_id, if is given, to see if there is an existing EnterpriseCustomerUser for it.
It first uses the third party auth api to find the associated username to do the lookup.
"""
enterprise_customer = self.context.get('enterpris... |
def guess_uri_type(uri: str, hint: str=None):
"""Return a guess for the URI type based on the URI string `uri`.
If `hint` is given, it is assumed to be the correct type.
Otherwise, the URI is inspected using urlparse, and we try to guess
whether it's a remote Git repository, a remote downloadable archi... | def function[guess_uri_type, parameter[uri, hint]]:
constant[Return a guess for the URI type based on the URI string `uri`.
If `hint` is given, it is assumed to be the correct type.
Otherwise, the URI is inspected using urlparse, and we try to guess
whether it's a remote Git repository, a remote do... | keyword[def] identifier[guess_uri_type] ( identifier[uri] : identifier[str] , identifier[hint] : identifier[str] = keyword[None] ):
literal[string]
keyword[if] identifier[hint] :
keyword[return] identifier[hint]
identifier[norm_uri] = identifier[uri] . identifier[lower] ()
identi... | def guess_uri_type(uri: str, hint: str=None):
"""Return a guess for the URI type based on the URI string `uri`.
If `hint` is given, it is assumed to be the correct type.
Otherwise, the URI is inspected using urlparse, and we try to guess
whether it's a remote Git repository, a remote downloadable archi... |
def apply(self, doc):
"""
Generate MentionTables from a Document by parsing all of its Tables.
:param doc: The ``Document`` to parse.
:type doc: ``Document``
:raises TypeError: If the input doc is not of type ``Document``.
"""
if not isinstance(doc, Document):
... | def function[apply, parameter[self, doc]]:
constant[
Generate MentionTables from a Document by parsing all of its Tables.
:param doc: The ``Document`` to parse.
:type doc: ``Document``
:raises TypeError: If the input doc is not of type ``Document``.
]
if <ast.Una... | keyword[def] identifier[apply] ( identifier[self] , identifier[doc] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[doc] , identifier[Document] ):
keyword[raise] identifier[TypeError] (
literal[string]
)
keyword[for... | def apply(self, doc):
"""
Generate MentionTables from a Document by parsing all of its Tables.
:param doc: The ``Document`` to parse.
:type doc: ``Document``
:raises TypeError: If the input doc is not of type ``Document``.
"""
if not isinstance(doc, Document):
ra... |
def set_order_by_clip(self, a, b):
'''
Determine which SplitPiece is the leftmost based
on the side of the longest clipping operation
'''
if self.is_left_clip(a.cigar):
self.query_left = b
self.query_right = a
else:
self.query_left = a
... | def function[set_order_by_clip, parameter[self, a, b]]:
constant[
Determine which SplitPiece is the leftmost based
on the side of the longest clipping operation
]
if call[name[self].is_left_clip, parameter[name[a].cigar]] begin[:]
name[self].query_left assign[=] n... | keyword[def] identifier[set_order_by_clip] ( identifier[self] , identifier[a] , identifier[b] ):
literal[string]
keyword[if] identifier[self] . identifier[is_left_clip] ( identifier[a] . identifier[cigar] ):
identifier[self] . identifier[query_left] = identifier[b]
ident... | def set_order_by_clip(self, a, b):
"""
Determine which SplitPiece is the leftmost based
on the side of the longest clipping operation
"""
if self.is_left_clip(a.cigar):
self.query_left = b
self.query_right = a # depends on [control=['if'], data=[]]
else:
self... |
def remove_orbit(self, component=None, **kwargs):
"""
[NOT IMPLEMENTED]
Shortcut to :meth:`remove_component` but with kind='star'
"""
kwargs.setdefault('kind', 'orbit')
return self.remove_component(component, **kwargs) | def function[remove_orbit, parameter[self, component]]:
constant[
[NOT IMPLEMENTED]
Shortcut to :meth:`remove_component` but with kind='star'
]
call[name[kwargs].setdefault, parameter[constant[kind], constant[orbit]]]
return[call[name[self].remove_component, parameter[name[c... | keyword[def] identifier[remove_orbit] ( identifier[self] , identifier[component] = keyword[None] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] . identifier[setdefault] ( literal[string] , literal[string] )
keyword[return] identifier[self] . identifier[remove_component] ( id... | def remove_orbit(self, component=None, **kwargs):
"""
[NOT IMPLEMENTED]
Shortcut to :meth:`remove_component` but with kind='star'
"""
kwargs.setdefault('kind', 'orbit')
return self.remove_component(component, **kwargs) |
def getDataset(self, id_):
"""
Returns a dataset with the specified ID, or raises a
DatasetNotFoundException if it does not exist.
"""
if id_ not in self._datasetIdMap:
raise exceptions.DatasetNotFoundException(id_)
return self._datasetIdMap[id_] | def function[getDataset, parameter[self, id_]]:
constant[
Returns a dataset with the specified ID, or raises a
DatasetNotFoundException if it does not exist.
]
if compare[name[id_] <ast.NotIn object at 0x7da2590d7190> name[self]._datasetIdMap] begin[:]
<ast.Raise object a... | keyword[def] identifier[getDataset] ( identifier[self] , identifier[id_] ):
literal[string]
keyword[if] identifier[id_] keyword[not] keyword[in] identifier[self] . identifier[_datasetIdMap] :
keyword[raise] identifier[exceptions] . identifier[DatasetNotFoundException] ( identifier... | def getDataset(self, id_):
"""
Returns a dataset with the specified ID, or raises a
DatasetNotFoundException if it does not exist.
"""
if id_ not in self._datasetIdMap:
raise exceptions.DatasetNotFoundException(id_) # depends on [control=['if'], data=['id_']]
return self._da... |
def is_in_schedule_mode(self):
"""Returns True if base_station is currently on a scheduled mode."""
resource = "schedule"
mode_event = self.publish_and_get_event(resource)
if mode_event and mode_event.get("resource", None) == "schedule":
properties = mode_event.get('propertie... | def function[is_in_schedule_mode, parameter[self]]:
constant[Returns True if base_station is currently on a scheduled mode.]
variable[resource] assign[=] constant[schedule]
variable[mode_event] assign[=] call[name[self].publish_and_get_event, parameter[name[resource]]]
if <ast.BoolOp obj... | keyword[def] identifier[is_in_schedule_mode] ( identifier[self] ):
literal[string]
identifier[resource] = literal[string]
identifier[mode_event] = identifier[self] . identifier[publish_and_get_event] ( identifier[resource] )
keyword[if] identifier[mode_event] keyword[and] iden... | def is_in_schedule_mode(self):
"""Returns True if base_station is currently on a scheduled mode."""
resource = 'schedule'
mode_event = self.publish_and_get_event(resource)
if mode_event and mode_event.get('resource', None) == 'schedule':
properties = mode_event.get('properties')
return p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.