code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def validate(template_dict, schema=None):
"""
Is this a valid SAM template dictionary
:param dict template_dict: Data to be validated
:param dict schema: Optional, dictionary containing JSON Schema representing SAM template
:return: Empty string if there are no validation errors... | def function[validate, parameter[template_dict, schema]]:
constant[
Is this a valid SAM template dictionary
:param dict template_dict: Data to be validated
:param dict schema: Optional, dictionary containing JSON Schema representing SAM template
:return: Empty string if there ar... | keyword[def] identifier[validate] ( identifier[template_dict] , identifier[schema] = keyword[None] ):
literal[string]
keyword[if] keyword[not] identifier[schema] :
identifier[schema] = identifier[SamTemplateValidator] . identifier[_read_schema] ()
identifier[validation_err... | def validate(template_dict, schema=None):
"""
Is this a valid SAM template dictionary
:param dict template_dict: Data to be validated
:param dict schema: Optional, dictionary containing JSON Schema representing SAM template
:return: Empty string if there are no validation errors in ... |
def _exception(etype, eval_, etrace):
""" Wrap exception in debugger if not in tty """
if hasattr(sys, 'ps1') or not sys.stderr.isatty():
# we are in interactive mode or we don't have a tty-like
# device, so we call the default hook
sys.__excepthook__(etype, eval_, et... | def function[_exception, parameter[etype, eval_, etrace]]:
constant[ Wrap exception in debugger if not in tty ]
if <ast.BoolOp object at 0x7da18f58cbe0> begin[:]
call[name[sys].__excepthook__, parameter[name[etype], name[eval_], name[etrace]]] | keyword[def] identifier[_exception] ( identifier[etype] , identifier[eval_] , identifier[etrace] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[sys] , literal[string] ) keyword[or] keyword[not] identifier[sys] . identifier[stderr] . identifier[isatty] ():
... | def _exception(etype, eval_, etrace):
""" Wrap exception in debugger if not in tty """
if hasattr(sys, 'ps1') or not sys.stderr.isatty():
# we are in interactive mode or we don't have a tty-like
# device, so we call the default hook
sys.__excepthook__(etype, eval_, etrace) # depends on ... |
def caches(self, options={}):
"""Query the server for a list of caches, parse the JSON response, and
return the result.
Keyword arguments:
options -- a dict of arguments to send with the request. See
http://dev.iron.io/cache/reference/api/#list_caches for more
... | def function[caches, parameter[self, options]]:
constant[Query the server for a list of caches, parse the JSON response, and
return the result.
Keyword arguments:
options -- a dict of arguments to send with the request. See
http://dev.iron.io/cache/reference/api/#list... | keyword[def] identifier[caches] ( identifier[self] , identifier[options] ={}):
literal[string]
identifier[query] = identifier[urllib] . identifier[urlencode] ( identifier[options] )
identifier[url] = literal[string]
keyword[if] identifier[query] != literal[string] :
... | def caches(self, options={}):
"""Query the server for a list of caches, parse the JSON response, and
return the result.
Keyword arguments:
options -- a dict of arguments to send with the request. See
http://dev.iron.io/cache/reference/api/#list_caches for more
... |
def extend_list(self, data, parsed_args):
"""Add subnet information to a network list."""
neutron_client = self.get_client()
search_opts = {'fields': ['id', 'cidr']}
if self.pagination_support:
page_size = parsed_args.page_size
if page_size:
search... | def function[extend_list, parameter[self, data, parsed_args]]:
constant[Add subnet information to a network list.]
variable[neutron_client] assign[=] call[name[self].get_client, parameter[]]
variable[search_opts] assign[=] dictionary[[<ast.Constant object at 0x7da18f7215d0>], [<ast.List object a... | keyword[def] identifier[extend_list] ( identifier[self] , identifier[data] , identifier[parsed_args] ):
literal[string]
identifier[neutron_client] = identifier[self] . identifier[get_client] ()
identifier[search_opts] ={ literal[string] :[ literal[string] , literal[string] ]}
keyw... | def extend_list(self, data, parsed_args):
"""Add subnet information to a network list."""
neutron_client = self.get_client()
search_opts = {'fields': ['id', 'cidr']}
if self.pagination_support:
page_size = parsed_args.page_size
if page_size:
search_opts.update({'limit': page_... |
def parse_snpeff_log(self, f):
""" Go through log file looking for snpeff output """
keys = {
'# Summary table': [
'Genome', 'Number_of_variants_before_filter',
'Number_of_known_variants', 'Number_of_effects',
'Genome_total_length', 'Change_ra... | def function[parse_snpeff_log, parameter[self, f]]:
constant[ Go through log file looking for snpeff output ]
variable[keys] assign[=] dictionary[[<ast.Constant object at 0x7da1b1e5c310>, <ast.Constant object at 0x7da1b1e5de70>, <ast.Constant object at 0x7da1b1e5eb30>, <ast.Constant object at 0x7da1b1e5... | keyword[def] identifier[parse_snpeff_log] ( identifier[self] , identifier[f] ):
literal[string]
identifier[keys] ={
literal[string] :[
literal[string] , literal[string] ,
literal[string] , literal[string] ,
literal[string] , literal[string]
],
... | def parse_snpeff_log(self, f):
""" Go through log file looking for snpeff output """
keys = {'# Summary table': ['Genome', 'Number_of_variants_before_filter', 'Number_of_known_variants', 'Number_of_effects', 'Genome_total_length', 'Change_rate'], '# Effects by impact': ['HIGH', 'LOW', 'MODERATE', 'MODIFIER'], '... |
def uninstall(self):
"""Uninstall this importer if possible and un-import any modules imported by it."""
if not self._uninstallable:
_tracer().log('Not uninstalling {}'.format(self), V=9)
return
if self in sys.meta_path:
sys.meta_path.remove(self)
maybe_exposed = frozenset(os.path.j... | def function[uninstall, parameter[self]]:
constant[Uninstall this importer if possible and un-import any modules imported by it.]
if <ast.UnaryOp object at 0x7da204623d90> begin[:]
call[call[name[_tracer], parameter[]].log, parameter[call[constant[Not uninstalling {}].format, parameter[n... | keyword[def] identifier[uninstall] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_uninstallable] :
identifier[_tracer] (). identifier[log] ( literal[string] . identifier[format] ( identifier[self] ), identifier[V] = literal[int] )
keyword[retur... | def uninstall(self):
"""Uninstall this importer if possible and un-import any modules imported by it."""
if not self._uninstallable:
_tracer().log('Not uninstalling {}'.format(self), V=9)
return # depends on [control=['if'], data=[]]
if self in sys.meta_path:
sys.meta_path.remove(se... |
def agent_intents(self):
"""Returns a list of intent json objects"""
endpoint = self._intent_uri()
intents = self._get(endpoint) # should be list of dicts
if isinstance(intents, dict): # if error: intents = {status: {error}}
raise Exception(intents["status"])
retur... | def function[agent_intents, parameter[self]]:
constant[Returns a list of intent json objects]
variable[endpoint] assign[=] call[name[self]._intent_uri, parameter[]]
variable[intents] assign[=] call[name[self]._get, parameter[name[endpoint]]]
if call[name[isinstance], parameter[name[inten... | keyword[def] identifier[agent_intents] ( identifier[self] ):
literal[string]
identifier[endpoint] = identifier[self] . identifier[_intent_uri] ()
identifier[intents] = identifier[self] . identifier[_get] ( identifier[endpoint] )
keyword[if] identifier[isinstance] ( identifier[int... | def agent_intents(self):
"""Returns a list of intent json objects"""
endpoint = self._intent_uri()
intents = self._get(endpoint) # should be list of dicts
if isinstance(intents, dict): # if error: intents = {status: {error}}
raise Exception(intents['status']) # depends on [control=['if'], dat... |
def _partition_index_names(provisioned_index_names, index_names):
'''Returns 3 disjoint sets of indexes: existing, to be created, and to be deleted.'''
existing_index_names = set()
new_index_names = set()
for name in index_names:
if name in provisioned_index_names:
existing_index_nam... | def function[_partition_index_names, parameter[provisioned_index_names, index_names]]:
constant[Returns 3 disjoint sets of indexes: existing, to be created, and to be deleted.]
variable[existing_index_names] assign[=] call[name[set], parameter[]]
variable[new_index_names] assign[=] call[name[set... | keyword[def] identifier[_partition_index_names] ( identifier[provisioned_index_names] , identifier[index_names] ):
literal[string]
identifier[existing_index_names] = identifier[set] ()
identifier[new_index_names] = identifier[set] ()
keyword[for] identifier[name] keyword[in] identifier[index_n... | def _partition_index_names(provisioned_index_names, index_names):
"""Returns 3 disjoint sets of indexes: existing, to be created, and to be deleted."""
existing_index_names = set()
new_index_names = set()
for name in index_names:
if name in provisioned_index_names:
existing_index_nam... |
def exact(cls, value, precision=None):
"""Convert an integer, float or BigFloat with no loss of precision.
Also convert a string with given precision.
This constructor makes no use of the current context.
"""
# figure out precision to use
if isinstance(value, six.string_... | def function[exact, parameter[cls, value, precision]]:
constant[Convert an integer, float or BigFloat with no loss of precision.
Also convert a string with given precision.
This constructor makes no use of the current context.
]
if call[name[isinstance], parameter[name[value], n... | keyword[def] identifier[exact] ( identifier[cls] , identifier[value] , identifier[precision] = keyword[None] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[value] , identifier[six] . identifier[string_types] ):
keyword[if] identifier[precision] keyword[i... | def exact(cls, value, precision=None):
"""Convert an integer, float or BigFloat with no loss of precision.
Also convert a string with given precision.
This constructor makes no use of the current context.
"""
# figure out precision to use
if isinstance(value, six.string_types):
... |
def description(self, value):
"""
Setter for **self.__description** attribute.
:param value: Attribute value.
:type value: unicode
"""
if value is not None:
assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format(
... | def function[description, parameter[self, value]]:
constant[
Setter for **self.__description** attribute.
:param value: Attribute value.
:type value: unicode
]
if compare[name[value] is_not constant[None]] begin[:]
assert[compare[call[name[type], parameter[name[v... | keyword[def] identifier[description] ( identifier[self] , identifier[value] ):
literal[string]
keyword[if] identifier[value] keyword[is] keyword[not] keyword[None] :
keyword[assert] identifier[type] ( identifier[value] ) keyword[is] identifier[unicode] , literal[string] . identi... | def description(self, value):
"""
Setter for **self.__description** attribute.
:param value: Attribute value.
:type value: unicode
"""
if value is not None:
assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format('description', value) # dep... |
def _from_dict(cls, _dict):
"""Initialize a DocumentStatus object from a json dictionary."""
args = {}
if 'document_id' in _dict:
args['document_id'] = _dict.get('document_id')
else:
raise ValueError(
'Required property \'document_id\' not present ... | def function[_from_dict, parameter[cls, _dict]]:
constant[Initialize a DocumentStatus object from a json dictionary.]
variable[args] assign[=] dictionary[[], []]
if compare[constant[document_id] in name[_dict]] begin[:]
call[name[args]][constant[document_id]] assign[=] call[name[... | keyword[def] identifier[_from_dict] ( identifier[cls] , identifier[_dict] ):
literal[string]
identifier[args] ={}
keyword[if] literal[string] keyword[in] identifier[_dict] :
identifier[args] [ literal[string] ]= identifier[_dict] . identifier[get] ( literal[string] )
... | def _from_dict(cls, _dict):
"""Initialize a DocumentStatus object from a json dictionary."""
args = {}
if 'document_id' in _dict:
args['document_id'] = _dict.get('document_id') # depends on [control=['if'], data=['_dict']]
else:
raise ValueError("Required property 'document_id' not pres... |
def cmd(send, msg, args):
"""Gets a stock quote.
Syntax: {command} [symbol]
Powered by markit on demand (http://dev.markitondemand.com)
"""
parser = arguments.ArgParser(args['config'])
parser.add_argument('stock', nargs='?', default=random_stock())
try:
cmdargs = parser.parse_args(... | def function[cmd, parameter[send, msg, args]]:
constant[Gets a stock quote.
Syntax: {command} [symbol]
Powered by markit on demand (http://dev.markitondemand.com)
]
variable[parser] assign[=] call[name[arguments].ArgParser, parameter[call[name[args]][constant[config]]]]
call[name[p... | keyword[def] identifier[cmd] ( identifier[send] , identifier[msg] , identifier[args] ):
literal[string]
identifier[parser] = identifier[arguments] . identifier[ArgParser] ( identifier[args] [ literal[string] ])
identifier[parser] . identifier[add_argument] ( literal[string] , identifier[nargs] = liter... | def cmd(send, msg, args):
"""Gets a stock quote.
Syntax: {command} [symbol]
Powered by markit on demand (http://dev.markitondemand.com)
"""
parser = arguments.ArgParser(args['config'])
parser.add_argument('stock', nargs='?', default=random_stock())
try:
cmdargs = parser.parse_args(... |
def findUniques(mapF):
"""Finds the unique markers in a MAP.
:param mapF: representation of a ``map`` file.
:type mapF: list
:returns: a :py:class:`dict` containing unique markers (according to their
genomic localisation).
"""
uSNPs = {}
dSNPs = defaultdict(list)
for i,... | def function[findUniques, parameter[mapF]]:
constant[Finds the unique markers in a MAP.
:param mapF: representation of a ``map`` file.
:type mapF: list
:returns: a :py:class:`dict` containing unique markers (according to their
genomic localisation).
]
variable[uSNPs] as... | keyword[def] identifier[findUniques] ( identifier[mapF] ):
literal[string]
identifier[uSNPs] ={}
identifier[dSNPs] = identifier[defaultdict] ( identifier[list] )
keyword[for] identifier[i] , identifier[row] keyword[in] identifier[enumerate] ( identifier[mapF] ):
identifier[chromosome]... | def findUniques(mapF):
"""Finds the unique markers in a MAP.
:param mapF: representation of a ``map`` file.
:type mapF: list
:returns: a :py:class:`dict` containing unique markers (according to their
genomic localisation).
"""
uSNPs = {}
dSNPs = defaultdict(list)
for (i... |
def showProfileMenu(self, point):
"""
Prompts the user for profile menu options. Editing needs to be enabled
for this to work.
"""
if not self.isEditingEnabled():
return
trigger = self.actionAt(point)
if (isinstance(trigger, XViewPro... | def function[showProfileMenu, parameter[self, point]]:
constant[
Prompts the user for profile menu options. Editing needs to be enabled
for this to work.
]
if <ast.UnaryOp object at 0x7da1b24e1510> begin[:]
return[None]
variable[trigger] assign[=] call[name[self]... | keyword[def] identifier[showProfileMenu] ( identifier[self] , identifier[point] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[isEditingEnabled] ():
keyword[return]
identifier[trigger] = identifier[self] . identifier[actionAt] ( identifier[p... | def showProfileMenu(self, point):
"""
Prompts the user for profile menu options. Editing needs to be enabled
for this to work.
"""
if not self.isEditingEnabled():
return # depends on [control=['if'], data=[]]
trigger = self.actionAt(point)
if isinstance(trigger, XViewPr... |
def taubin(script, iterations=10, t_lambda=0.5, t_mu=-0.53, selected=False):
""" The lambda & mu Taubin smoothing, it make two steps of smoothing, forth
and back, for each iteration.
Based on:
Gabriel Taubin
"A signal processing approach to fair surface design"
Siggraph 1995
Args:
... | def function[taubin, parameter[script, iterations, t_lambda, t_mu, selected]]:
constant[ The lambda & mu Taubin smoothing, it make two steps of smoothing, forth
and back, for each iteration.
Based on:
Gabriel Taubin
"A signal processing approach to fair surface design"
Siggraph 1995
... | keyword[def] identifier[taubin] ( identifier[script] , identifier[iterations] = literal[int] , identifier[t_lambda] = literal[int] , identifier[t_mu] =- literal[int] , identifier[selected] = keyword[False] ):
literal[string]
identifier[filter_xml] = literal[string] . identifier[join] ([
literal[string... | def taubin(script, iterations=10, t_lambda=0.5, t_mu=-0.53, selected=False):
""" The lambda & mu Taubin smoothing, it make two steps of smoothing, forth
and back, for each iteration.
Based on:
Gabriel Taubin
"A signal processing approach to fair surface design"
Siggraph 1995
Args:
... |
def volreg(dset,suffix='_volreg',base=3,tshift=3,dfile_suffix='_volreg.1D'):
'''simple interface to 3dvolreg
:suffix: suffix to add to ``dset`` for volreg'ed file
:base: either a number or ``dset[#]`` of the base image to register to
:tshift: if a number, then tshift ... | def function[volreg, parameter[dset, suffix, base, tshift, dfile_suffix]]:
constant[simple interface to 3dvolreg
:suffix: suffix to add to ``dset`` for volreg'ed file
:base: either a number or ``dset[#]`` of the base image to register to
:tshift: if a number, then... | keyword[def] identifier[volreg] ( identifier[dset] , identifier[suffix] = literal[string] , identifier[base] = literal[int] , identifier[tshift] = literal[int] , identifier[dfile_suffix] = literal[string] ):
literal[string]
identifier[cmd] =[ literal[string] , literal[string] , identifier[nl] . identifier[... | def volreg(dset, suffix='_volreg', base=3, tshift=3, dfile_suffix='_volreg.1D'):
"""simple interface to 3dvolreg
:suffix: suffix to add to ``dset`` for volreg'ed file
:base: either a number or ``dset[#]`` of the base image to register to
:tshift: if a number, then tsh... |
def get_hypergeometric_stats(N, indices):
"""Calculates hypergeom. p-values and fold enrichments for all cutoffs.
Parameters
----------
N: int
The length of the list
indices: `numpy.ndarray` with ``dtype=np.uint16``
The (sorted) indices of the "1's" in the list.
"""
assert ... | def function[get_hypergeometric_stats, parameter[N, indices]]:
constant[Calculates hypergeom. p-values and fold enrichments for all cutoffs.
Parameters
----------
N: int
The length of the list
indices: `numpy.ndarray` with ``dtype=np.uint16``
The (sorted) indices of the "1's" i... | keyword[def] identifier[get_hypergeometric_stats] ( identifier[N] , identifier[indices] ):
literal[string]
keyword[assert] identifier[isinstance] ( identifier[N] ,( identifier[int] , identifier[np] . identifier[integer] ))
keyword[assert] identifier[isinstance] ( identifier[indices] , identifier[np]... | def get_hypergeometric_stats(N, indices):
"""Calculates hypergeom. p-values and fold enrichments for all cutoffs.
Parameters
----------
N: int
The length of the list
indices: `numpy.ndarray` with ``dtype=np.uint16``
The (sorted) indices of the "1's" in the list.
"""
assert ... |
def fetch(self, path, sender, msg):
"""
Start a transfer for a registered path.
:param str path:
File path.
:param mitogen.core.Sender sender:
Sender to receive file data.
:returns:
Dict containing the file metadata:
* ``size``: F... | def function[fetch, parameter[self, path, sender, msg]]:
constant[
Start a transfer for a registered path.
:param str path:
File path.
:param mitogen.core.Sender sender:
Sender to receive file data.
:returns:
Dict containing the file metadata:... | keyword[def] identifier[fetch] ( identifier[self] , identifier[path] , identifier[sender] , identifier[msg] ):
literal[string]
keyword[if] identifier[path] keyword[not] keyword[in] identifier[self] . identifier[_paths] keyword[and] keyword[not] identifier[self] . identifier[_prefix_is_author... | def fetch(self, path, sender, msg):
"""
Start a transfer for a registered path.
:param str path:
File path.
:param mitogen.core.Sender sender:
Sender to receive file data.
:returns:
Dict containing the file metadata:
* ``size``: File ... |
def diffusion_mds(means, weights, d, diffusion_rounds=10):
"""
Dimensionality reduction using MDS, while running diffusion on W.
Args:
means (array): genes x clusters
weights (array): clusters x cells
d (int): desired dimensionality
Returns:
W_reduced (array): array of ... | def function[diffusion_mds, parameter[means, weights, d, diffusion_rounds]]:
constant[
Dimensionality reduction using MDS, while running diffusion on W.
Args:
means (array): genes x clusters
weights (array): clusters x cells
d (int): desired dimensionality
Returns:
... | keyword[def] identifier[diffusion_mds] ( identifier[means] , identifier[weights] , identifier[d] , identifier[diffusion_rounds] = literal[int] ):
literal[string]
keyword[for] identifier[i] keyword[in] identifier[range] ( identifier[diffusion_rounds] ):
identifier[weights] = identifier[weights] ... | def diffusion_mds(means, weights, d, diffusion_rounds=10):
"""
Dimensionality reduction using MDS, while running diffusion on W.
Args:
means (array): genes x clusters
weights (array): clusters x cells
d (int): desired dimensionality
Returns:
W_reduced (array): array of ... |
def _metadata_endpoint(self, context):
"""
Endpoint for retrieving the backend metadata
:type context: satosa.context.Context
:rtype: satosa.response.Response
:param context: The current context
:return: response with metadata
"""
satosa_logging(logger, l... | def function[_metadata_endpoint, parameter[self, context]]:
constant[
Endpoint for retrieving the backend metadata
:type context: satosa.context.Context
:rtype: satosa.response.Response
:param context: The current context
:return: response with metadata
]
... | keyword[def] identifier[_metadata_endpoint] ( identifier[self] , identifier[context] ):
literal[string]
identifier[satosa_logging] ( identifier[logger] , identifier[logging] . identifier[DEBUG] , literal[string] , identifier[context] . identifier[state] )
identifier[metadata_string] = ide... | def _metadata_endpoint(self, context):
"""
Endpoint for retrieving the backend metadata
:type context: satosa.context.Context
:rtype: satosa.response.Response
:param context: The current context
:return: response with metadata
"""
satosa_logging(logger, logging.D... |
def source_sum_err(self):
"""
The uncertainty of `~photutils.SourceProperties.source_sum`,
propagated from the input ``error`` array.
``source_sum_err`` is the quadrature sum of the total errors
over the non-masked pixels within the source segment:
.. math:: \\Delta F =... | def function[source_sum_err, parameter[self]]:
constant[
The uncertainty of `~photutils.SourceProperties.source_sum`,
propagated from the input ``error`` array.
``source_sum_err`` is the quadrature sum of the total errors
over the non-masked pixels within the source segment:
... | keyword[def] identifier[source_sum_err] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_error] keyword[is] keyword[not] keyword[None] :
keyword[if] identifier[self] . identifier[_is_completely_masked] :
keyword[return] identifier... | def source_sum_err(self):
"""
The uncertainty of `~photutils.SourceProperties.source_sum`,
propagated from the input ``error`` array.
``source_sum_err`` is the quadrature sum of the total errors
over the non-masked pixels within the source segment:
.. math:: \\Delta F = \\s... |
def _remote_methodcall(id, method_name, *args, **kwargs):
"""(Executed on remote engine) convert Ids to real objects, call method """
obj = distob.engine[id]
nargs = []
for a in args:
if isinstance(a, Id):
nargs.append(distob.engine[a])
elif (isinstance(a, collections.Sequenc... | def function[_remote_methodcall, parameter[id, method_name]]:
constant[(Executed on remote engine) convert Ids to real objects, call method ]
variable[obj] assign[=] call[name[distob].engine][name[id]]
variable[nargs] assign[=] list[[]]
for taget[name[a]] in starred[name[args]] begin[:]
... | keyword[def] identifier[_remote_methodcall] ( identifier[id] , identifier[method_name] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[obj] = identifier[distob] . identifier[engine] [ identifier[id] ]
identifier[nargs] =[]
keyword[for] identifier[a] keyword[in] identif... | def _remote_methodcall(id, method_name, *args, **kwargs):
"""(Executed on remote engine) convert Ids to real objects, call method """
obj = distob.engine[id]
nargs = []
for a in args:
if isinstance(a, Id):
nargs.append(distob.engine[a]) # depends on [control=['if'], data=[]]
... |
def getSegmentKeys(self, segment):
"""
Get the different keys for 1 defined segment
:param segment: Segment to find. Ex : PV1, PID
"""
return list(filter(lambda x: x.startswith(segment), self.getAliasedKeys())) | def function[getSegmentKeys, parameter[self, segment]]:
constant[
Get the different keys for 1 defined segment
:param segment: Segment to find. Ex : PV1, PID
]
return[call[name[list], parameter[call[name[filter], parameter[<ast.Lambda object at 0x7da204623fa0>, call[name[self... | keyword[def] identifier[getSegmentKeys] ( identifier[self] , identifier[segment] ):
literal[string]
keyword[return] identifier[list] ( identifier[filter] ( keyword[lambda] identifier[x] : identifier[x] . identifier[startswith] ( identifier[segment] ), identifier[self] . identifier[getAliasedKeys]... | def getSegmentKeys(self, segment):
"""
Get the different keys for 1 defined segment
:param segment: Segment to find. Ex : PV1, PID
"""
return list(filter(lambda x: x.startswith(segment), self.getAliasedKeys())) |
def split_title(self, title, splitter):
"""\
Split the title to best part possible
"""
large_text_length = 0
large_text_index = 0
title_pieces = splitter.split(title)
# find the largest title piece
for i in range(len(title_pieces)):
current = ... | def function[split_title, parameter[self, title, splitter]]:
constant[ Split the title to best part possible
]
variable[large_text_length] assign[=] constant[0]
variable[large_text_index] assign[=] constant[0]
variable[title_pieces] assign[=] call[name[splitter].split, par... | keyword[def] identifier[split_title] ( identifier[self] , identifier[title] , identifier[splitter] ):
literal[string]
identifier[large_text_length] = literal[int]
identifier[large_text_index] = literal[int]
identifier[title_pieces] = identifier[splitter] . identifier[split] ( id... | def split_title(self, title, splitter):
""" Split the title to best part possible
"""
large_text_length = 0
large_text_index = 0
title_pieces = splitter.split(title)
# find the largest title piece
for i in range(len(title_pieces)):
current = title_pieces[i]
if len(... |
def skip(self, count):
'''
Skip up to [count] cases, default behavior is to just mutate [count] times
:count: number of cases to skip
:rtype: int
:return: number of cases skipped
'''
skipped = 0
for _ in range(count):
if self.mutate():
... | def function[skip, parameter[self, count]]:
constant[
Skip up to [count] cases, default behavior is to just mutate [count] times
:count: number of cases to skip
:rtype: int
:return: number of cases skipped
]
variable[skipped] assign[=] constant[0]
for tag... | keyword[def] identifier[skip] ( identifier[self] , identifier[count] ):
literal[string]
identifier[skipped] = literal[int]
keyword[for] identifier[_] keyword[in] identifier[range] ( identifier[count] ):
keyword[if] identifier[self] . identifier[mutate] ():
... | def skip(self, count):
"""
Skip up to [count] cases, default behavior is to just mutate [count] times
:count: number of cases to skip
:rtype: int
:return: number of cases skipped
"""
skipped = 0
for _ in range(count):
if self.mutate():
skipped += ... |
def create_round_trip_tear_sheet(returns, positions, transactions,
sector_mappings=None,
estimate_intraday='infer', return_fig=False):
"""
Generate a number of figures and plots describing the duration,
frequency, and profitability of trade "... | def function[create_round_trip_tear_sheet, parameter[returns, positions, transactions, sector_mappings, estimate_intraday, return_fig]]:
constant[
Generate a number of figures and plots describing the duration,
frequency, and profitability of trade "round trips."
A round trip is started when a new l... | keyword[def] identifier[create_round_trip_tear_sheet] ( identifier[returns] , identifier[positions] , identifier[transactions] ,
identifier[sector_mappings] = keyword[None] ,
identifier[estimate_intraday] = literal[string] , identifier[return_fig] = keyword[False] ):
literal[string]
identifier[positions... | def create_round_trip_tear_sheet(returns, positions, transactions, sector_mappings=None, estimate_intraday='infer', return_fig=False):
"""
Generate a number of figures and plots describing the duration,
frequency, and profitability of trade "round trips."
A round trip is started when a new long or short... |
def add_interval(self, start, end, data=None):
'''
Inserts an interval to the tree.
Note that when inserting we do not maintain appropriate sorting of the "mid" data structure.
This should be done after all intervals are inserted.
'''
# Ignore intervals of 0 or negative ... | def function[add_interval, parameter[self, start, end, data]]:
constant[
Inserts an interval to the tree.
Note that when inserting we do not maintain appropriate sorting of the "mid" data structure.
This should be done after all intervals are inserted.
]
if compare[binar... | keyword[def] identifier[add_interval] ( identifier[self] , identifier[start] , identifier[end] , identifier[data] = keyword[None] ):
literal[string]
keyword[if] ( identifier[end] - identifier[start] )<= literal[int] :
keyword[return]
keyword[if] identifier[self] . i... | def add_interval(self, start, end, data=None):
"""
Inserts an interval to the tree.
Note that when inserting we do not maintain appropriate sorting of the "mid" data structure.
This should be done after all intervals are inserted.
"""
# Ignore intervals of 0 or negative length
... |
def rm(config, name, bucket):
""" Delete lambda function, role, and zipfile """
# options should override config if it is there
myname = name or config.name
mybucket = bucket or config.bucket
click.echo('Deleting {} from {}'.format(myname, mybucket))
lambder.delete_function(myname, mybucket) | def function[rm, parameter[config, name, bucket]]:
constant[ Delete lambda function, role, and zipfile ]
variable[myname] assign[=] <ast.BoolOp object at 0x7da1b0fda9e0>
variable[mybucket] assign[=] <ast.BoolOp object at 0x7da1b0e0f9a0>
call[name[click].echo, parameter[call[constant[Dele... | keyword[def] identifier[rm] ( identifier[config] , identifier[name] , identifier[bucket] ):
literal[string]
identifier[myname] = identifier[name] keyword[or] identifier[config] . identifier[name]
identifier[mybucket] = identifier[bucket] keyword[or] identifier[config] . identifier[bucket]
... | def rm(config, name, bucket):
""" Delete lambda function, role, and zipfile """
# options should override config if it is there
myname = name or config.name
mybucket = bucket or config.bucket
click.echo('Deleting {} from {}'.format(myname, mybucket))
lambder.delete_function(myname, mybucket) |
def process_image_field(self, data):
"""
Process perseus fields like questions and hints, which look like:
.. code-block:: python
{
"content": "md string including imgs like  and ",
"images": {
"URL-key": {"width": 4... | def function[process_image_field, parameter[self, data]]:
constant[
Process perseus fields like questions and hints, which look like:
.. code-block:: python
{
"content": "md string including imgs like  and ",
"images": {
... | keyword[def] identifier[process_image_field] ( identifier[self] , identifier[data] ):
literal[string]
identifier[new_images_dict] = identifier[copy] . identifier[deepcopy] ( identifier[data] [ literal[string] ])
identifier[image_files] =[]
identifier[image_replacements] ... | def process_image_field(self, data):
"""
Process perseus fields like questions and hints, which look like:
.. code-block:: python
{
"content": "md string including imgs like  and ",
"images": {
"URL-key": {"width": 425, ... |
def _update_templatetype(templatetype, existing_tt=None):
"""
Add or update a templatetype. If an existing template type is passed in,
update that one. Otherwise search for an existing one. If not found, add.
"""
if existing_tt is None:
if "id" in templatetype and templatetype.id is ... | def function[_update_templatetype, parameter[templatetype, existing_tt]]:
constant[
Add or update a templatetype. If an existing template type is passed in,
update that one. Otherwise search for an existing one. If not found, add.
]
if compare[name[existing_tt] is constant[None]] beg... | keyword[def] identifier[_update_templatetype] ( identifier[templatetype] , identifier[existing_tt] = keyword[None] ):
literal[string]
keyword[if] identifier[existing_tt] keyword[is] keyword[None] :
keyword[if] literal[string] keyword[in] identifier[templatetype] keyword[and] identifier[tem... | def _update_templatetype(templatetype, existing_tt=None):
"""
Add or update a templatetype. If an existing template type is passed in,
update that one. Otherwise search for an existing one. If not found, add.
"""
if existing_tt is None:
if 'id' in templatetype and templatetype.id is ... |
def bedrooms(self):
"""
This method gets the number of bedrooms.
:return:
"""
try:
if self._data_from_search:
info = self._data_from_search.find(
'ul', {"class": "info"}).text
s = info.split('|')
nb =... | def function[bedrooms, parameter[self]]:
constant[
This method gets the number of bedrooms.
:return:
]
<ast.Try object at 0x7da1b0625600> | keyword[def] identifier[bedrooms] ( identifier[self] ):
literal[string]
keyword[try] :
keyword[if] identifier[self] . identifier[_data_from_search] :
identifier[info] = identifier[self] . identifier[_data_from_search] . identifier[find] (
literal[stri... | def bedrooms(self):
"""
This method gets the number of bedrooms.
:return:
"""
try:
if self._data_from_search:
info = self._data_from_search.find('ul', {'class': 'info'}).text
s = info.split('|')
nb = s[1].strip()
return int(nb.split... |
def store_initial_k2k_session(auth_url, request, scoped_auth_ref,
unscoped_auth_ref):
"""Stores session variables if there are k2k service providers
This stores variables related to Keystone2Keystone federation. This
function gets skipped if there are no Keystone service provi... | def function[store_initial_k2k_session, parameter[auth_url, request, scoped_auth_ref, unscoped_auth_ref]]:
constant[Stores session variables if there are k2k service providers
This stores variables related to Keystone2Keystone federation. This
function gets skipped if there are no Keystone service prov... | keyword[def] identifier[store_initial_k2k_session] ( identifier[auth_url] , identifier[request] , identifier[scoped_auth_ref] ,
identifier[unscoped_auth_ref] ):
literal[string]
identifier[keystone_provider_id] = identifier[request] . identifier[session] . identifier[get] ( literal[string] , keyword[None] ... | def store_initial_k2k_session(auth_url, request, scoped_auth_ref, unscoped_auth_ref):
"""Stores session variables if there are k2k service providers
This stores variables related to Keystone2Keystone federation. This
function gets skipped if there are no Keystone service providers.
An unscoped token to... |
def get_tree(profile, sha, recursive=True):
"""Fetch a tree.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect with.
sha
... | def function[get_tree, parameter[profile, sha, recursive]]:
constant[Fetch a tree.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect wi... | keyword[def] identifier[get_tree] ( identifier[profile] , identifier[sha] , identifier[recursive] = keyword[True] ):
literal[string]
identifier[resource] = literal[string] + identifier[sha]
keyword[if] identifier[recursive] :
identifier[resource] += literal[string]
identifier[data] = ... | def get_tree(profile, sha, recursive=True):
"""Fetch a tree.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect with.
sha
... |
def is_bare(self):
"""
:data:`True` if the repository has no working tree, :data:`False` if it does.
The value of this property is computed by checking whether the
``.bzr/checkout`` directory exists (it doesn't exist in Bazaar
repositories created using ``bzr branch --no-tree ..... | def function[is_bare, parameter[self]]:
constant[
:data:`True` if the repository has no working tree, :data:`False` if it does.
The value of this property is computed by checking whether the
``.bzr/checkout`` directory exists (it doesn't exist in Bazaar
repositories created usin... | keyword[def] identifier[is_bare] ( identifier[self] ):
literal[string]
identifier[self] . identifier[create] ()
identifier[checkout_directory] = identifier[os] . identifier[path] . identifier[join] ( identifier[self] . identifier[vcs_directory] , literal[string] )
... | def is_bare(self):
"""
:data:`True` if the repository has no working tree, :data:`False` if it does.
The value of this property is computed by checking whether the
``.bzr/checkout`` directory exists (it doesn't exist in Bazaar
repositories created using ``bzr branch --no-tree ...``)... |
async def ListSubnets(self, space_tag, zone):
'''
space_tag : str
zone : str
Returns -> typing.Sequence[~Subnet]
'''
# map input types to rpc msg
_params = dict()
msg = dict(type='DiscoverSpaces',
request='ListSubnets',
... | <ast.AsyncFunctionDef object at 0x7da1b0e24b50> | keyword[async] keyword[def] identifier[ListSubnets] ( identifier[self] , identifier[space_tag] , identifier[zone] ):
literal[string]
identifier[_params] = identifier[dict] ()
identifier[msg] = identifier[dict] ( identifier[type] = literal[string] ,
identifier[request] = ... | async def ListSubnets(self, space_tag, zone):
"""
space_tag : str
zone : str
Returns -> typing.Sequence[~Subnet]
"""
# map input types to rpc msg
_params = dict()
msg = dict(type='DiscoverSpaces', request='ListSubnets', version=2, params=_params)
_params['space-tag'] ... |
def spreadDF(symbol, token='', version=''):
'''This returns an array of effective spread, eligible volume, and price improvement of a stock, by market.
Unlike volume-by-venue, this will only return a venue if effective spread is not ‘N/A’. Values are sorted in descending order by effectiveSpread.
Lower effe... | def function[spreadDF, parameter[symbol, token, version]]:
constant[This returns an array of effective spread, eligible volume, and price improvement of a stock, by market.
Unlike volume-by-venue, this will only return a venue if effective spread is not ‘N/A’. Values are sorted in descending order by effect... | keyword[def] identifier[spreadDF] ( identifier[symbol] , identifier[token] = literal[string] , identifier[version] = literal[string] ):
literal[string]
identifier[df] = identifier[pd] . identifier[DataFrame] ( identifier[spread] ( identifier[symbol] , identifier[token] , identifier[version] ))
identif... | def spreadDF(symbol, token='', version=''):
"""This returns an array of effective spread, eligible volume, and price improvement of a stock, by market.
Unlike volume-by-venue, this will only return a venue if effective spread is not ‘N/A’. Values are sorted in descending order by effectiveSpread.
Lower effe... |
def _handle_ignores(testtag):
"""Checks if the specified test tag has attribute "ignores"; if it
does, a <global ignore="true" /> tag is created for each variable
name in the list.
"""
if "ignores" in testtag.attrib:
from xml.etree.ElementTree import Element
for varname in re.split("... | def function[_handle_ignores, parameter[testtag]]:
constant[Checks if the specified test tag has attribute "ignores"; if it
does, a <global ignore="true" /> tag is created for each variable
name in the list.
]
if compare[constant[ignores] in name[testtag].attrib] begin[:]
from relati... | keyword[def] identifier[_handle_ignores] ( identifier[testtag] ):
literal[string]
keyword[if] literal[string] keyword[in] identifier[testtag] . identifier[attrib] :
keyword[from] identifier[xml] . identifier[etree] . identifier[ElementTree] keyword[import] identifier[Element]
keywo... | def _handle_ignores(testtag):
"""Checks if the specified test tag has attribute "ignores"; if it
does, a <global ignore="true" /> tag is created for each variable
name in the list.
"""
if 'ignores' in testtag.attrib:
from xml.etree.ElementTree import Element
for varname in re.split('... |
def GetSOAPPart(self):
'''Get the SOAP body part.
'''
head, part = self.parts[0]
return StringIO.StringIO(part.getvalue()) | def function[GetSOAPPart, parameter[self]]:
constant[Get the SOAP body part.
]
<ast.Tuple object at 0x7da1b1320610> assign[=] call[name[self].parts][constant[0]]
return[call[name[StringIO].StringIO, parameter[call[name[part].getvalue, parameter[]]]]] | keyword[def] identifier[GetSOAPPart] ( identifier[self] ):
literal[string]
identifier[head] , identifier[part] = identifier[self] . identifier[parts] [ literal[int] ]
keyword[return] identifier[StringIO] . identifier[StringIO] ( identifier[part] . identifier[getvalue] ()) | def GetSOAPPart(self):
"""Get the SOAP body part.
"""
(head, part) = self.parts[0]
return StringIO.StringIO(part.getvalue()) |
def consolidate_tess_fitslc(lclist,
normalize=True,
filterqualityflags=False,
nanfilter=None,
timestoignore=None,
headerkeys=LCHEADERKEYS,
datakeys=LCDA... | def function[consolidate_tess_fitslc, parameter[lclist, normalize, filterqualityflags, nanfilter, timestoignore, headerkeys, datakeys, sapkeys, pdckeys, topkeys, apkeys]]:
constant[This consolidates a list of LCs for a single TIC object.
NOTE: if light curve time arrays contain nans, these and their associ... | keyword[def] identifier[consolidate_tess_fitslc] ( identifier[lclist] ,
identifier[normalize] = keyword[True] ,
identifier[filterqualityflags] = keyword[False] ,
identifier[nanfilter] = keyword[None] ,
identifier[timestoignore] = keyword[None] ,
identifier[headerkeys] = identifier[LCHEADERKEYS] ,
identifier[dat... | def consolidate_tess_fitslc(lclist, normalize=True, filterqualityflags=False, nanfilter=None, timestoignore=None, headerkeys=LCHEADERKEYS, datakeys=LCDATAKEYS, sapkeys=LCSAPKEYS, pdckeys=LCPDCKEYS, topkeys=LCTOPKEYS, apkeys=LCAPERTUREKEYS):
"""This consolidates a list of LCs for a single TIC object.
NOTE: if l... |
def infer_declared_from_conditions(conds, namespace=None):
''' like infer_declared except that it is passed a set of first party
caveat conditions as a list of string rather than a set of macaroons.
'''
conflicts = []
# If we can't resolve that standard namespace, then we'll look for
# just bare... | def function[infer_declared_from_conditions, parameter[conds, namespace]]:
constant[ like infer_declared except that it is passed a set of first party
caveat conditions as a list of string rather than a set of macaroons.
]
variable[conflicts] assign[=] list[[]]
if compare[name[namespace]... | keyword[def] identifier[infer_declared_from_conditions] ( identifier[conds] , identifier[namespace] = keyword[None] ):
literal[string]
identifier[conflicts] =[]
keyword[if] identifier[namespace] keyword[is] keyword[None] :
identifier[namespace] = identifier[Namespace] ()
... | def infer_declared_from_conditions(conds, namespace=None):
""" like infer_declared except that it is passed a set of first party
caveat conditions as a list of string rather than a set of macaroons.
"""
conflicts = []
# If we can't resolve that standard namespace, then we'll look for
# just bare... |
def discover_upnp_devices(
self, st="upnp:rootdevice", timeout=2, mx=1, retries=1
):
"""
sends an SSDP discovery packet to the network and collects
the devices that replies to it. A dictionary is returned
using the devices unique usn as key
"""
# prepare UDP s... | def function[discover_upnp_devices, parameter[self, st, timeout, mx, retries]]:
constant[
sends an SSDP discovery packet to the network and collects
the devices that replies to it. A dictionary is returned
using the devices unique usn as key
]
variable[s] assign[=] call[n... | keyword[def] identifier[discover_upnp_devices] (
identifier[self] , identifier[st] = literal[string] , identifier[timeout] = literal[int] , identifier[mx] = literal[int] , identifier[retries] = literal[int]
):
literal[string]
identifier[s] = identifier[socket] . identifier[socket] (
... | def discover_upnp_devices(self, st='upnp:rootdevice', timeout=2, mx=1, retries=1):
"""
sends an SSDP discovery packet to the network and collects
the devices that replies to it. A dictionary is returned
using the devices unique usn as key
"""
# prepare UDP socket to transfer the ... |
def extract_plain_text(self, reduce: bool = False) -> str:
"""
Extract text segments from the message, joined by single space.
:param reduce: reduce the message before extracting
:return: the joined string
"""
if reduce:
self.reduce()
result = ''
... | def function[extract_plain_text, parameter[self, reduce]]:
constant[
Extract text segments from the message, joined by single space.
:param reduce: reduce the message before extracting
:return: the joined string
]
if name[reduce] begin[:]
call[name[self].... | keyword[def] identifier[extract_plain_text] ( identifier[self] , identifier[reduce] : identifier[bool] = keyword[False] )-> identifier[str] :
literal[string]
keyword[if] identifier[reduce] :
identifier[self] . identifier[reduce] ()
identifier[result] = literal[string]
... | def extract_plain_text(self, reduce: bool=False) -> str:
"""
Extract text segments from the message, joined by single space.
:param reduce: reduce the message before extracting
:return: the joined string
"""
if reduce:
self.reduce() # depends on [control=['if'], data=[]... |
def _from_dict(cls, _dict):
"""Initialize a Voices object from a json dictionary."""
args = {}
if 'voices' in _dict:
args['voices'] = [
Voice._from_dict(x) for x in (_dict.get('voices'))
]
else:
raise ValueError(
'Requir... | def function[_from_dict, parameter[cls, _dict]]:
constant[Initialize a Voices object from a json dictionary.]
variable[args] assign[=] dictionary[[], []]
if compare[constant[voices] in name[_dict]] begin[:]
call[name[args]][constant[voices]] assign[=] <ast.ListComp object at 0x7d... | keyword[def] identifier[_from_dict] ( identifier[cls] , identifier[_dict] ):
literal[string]
identifier[args] ={}
keyword[if] literal[string] keyword[in] identifier[_dict] :
identifier[args] [ literal[string] ]=[
identifier[Voice] . identifier[_from_dict] ( ide... | def _from_dict(cls, _dict):
"""Initialize a Voices object from a json dictionary."""
args = {}
if 'voices' in _dict:
args['voices'] = [Voice._from_dict(x) for x in _dict.get('voices')] # depends on [control=['if'], data=['_dict']]
else:
raise ValueError("Required property 'voices' not p... |
def add(self, name, obj=None):
"""Add the view named `name` to the report text"""
if obj:
text = '\n::\n\n' + indent(str(obj))
else:
text = views.view(name, self.dstore)
if text:
title = self.title[name]
line = '-' * len(title)
... | def function[add, parameter[self, name, obj]]:
constant[Add the view named `name` to the report text]
if name[obj] begin[:]
variable[text] assign[=] binary_operation[constant[
::
] + call[name[indent], parameter[call[name[str], parameter[name[obj]]]]]]
if name[text] begin[:]
... | keyword[def] identifier[add] ( identifier[self] , identifier[name] , identifier[obj] = keyword[None] ):
literal[string]
keyword[if] identifier[obj] :
identifier[text] = literal[string] + identifier[indent] ( identifier[str] ( identifier[obj] ))
keyword[else] :
id... | def add(self, name, obj=None):
"""Add the view named `name` to the report text"""
if obj:
text = '\n::\n\n' + indent(str(obj)) # depends on [control=['if'], data=[]]
else:
text = views.view(name, self.dstore)
if text:
title = self.title[name]
line = '-' * len(title)
... |
def log_in(self):
"""Perform the `log_in` task to setup the API session for future data requests."""
if not self.password:
# Password wasn't give, ask for it now
self.password = getpass.getpass('Password: ')
utils.pending_message('Performing login...')
login_res... | def function[log_in, parameter[self]]:
constant[Perform the `log_in` task to setup the API session for future data requests.]
if <ast.UnaryOp object at 0x7da1b0de5900> begin[:]
name[self].password assign[=] call[name[getpass].getpass, parameter[constant[Password: ]]]
call[name[ut... | keyword[def] identifier[log_in] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[password] :
identifier[self] . identifier[password] = identifier[getpass] . identifier[getpass] ( literal[string] )
identifier[utils] . iden... | def log_in(self):
"""Perform the `log_in` task to setup the API session for future data requests."""
if not self.password:
# Password wasn't give, ask for it now
self.password = getpass.getpass('Password: ') # depends on [control=['if'], data=[]]
utils.pending_message('Performing login...')... |
def unregister_editorstack(self, editorstack):
"""Removing editorstack only if it's not the last remaining"""
self.remove_last_focus_editorstack(editorstack)
if len(self.editorstacks) > 1:
index = self.editorstacks.index(editorstack)
self.editorstacks.pop(index)
... | def function[unregister_editorstack, parameter[self, editorstack]]:
constant[Removing editorstack only if it's not the last remaining]
call[name[self].remove_last_focus_editorstack, parameter[name[editorstack]]]
if compare[call[name[len], parameter[name[self].editorstacks]] greater[>] constant[1... | keyword[def] identifier[unregister_editorstack] ( identifier[self] , identifier[editorstack] ):
literal[string]
identifier[self] . identifier[remove_last_focus_editorstack] ( identifier[editorstack] )
keyword[if] identifier[len] ( identifier[self] . identifier[editorstacks] )> literal[... | def unregister_editorstack(self, editorstack):
"""Removing editorstack only if it's not the last remaining"""
self.remove_last_focus_editorstack(editorstack)
if len(self.editorstacks) > 1:
index = self.editorstacks.index(editorstack)
self.editorstacks.pop(index)
return True # depend... |
def apply_exclusions(self,exclusions):
""" Trim sky catalog to remove any sources within regions specified by
exclusions file.
"""
# parse exclusion file into list of positions and distances
exclusion_coords = tweakutils.parse_exclusions(exclusions)
if exclusion_coord... | def function[apply_exclusions, parameter[self, exclusions]]:
constant[ Trim sky catalog to remove any sources within regions specified by
exclusions file.
]
variable[exclusion_coords] assign[=] call[name[tweakutils].parse_exclusions, parameter[name[exclusions]]]
if compare[na... | keyword[def] identifier[apply_exclusions] ( identifier[self] , identifier[exclusions] ):
literal[string]
identifier[exclusion_coords] = identifier[tweakutils] . identifier[parse_exclusions] ( identifier[exclusions] )
keyword[if] identifier[exclusion_coords] keyword[is] keyword[... | def apply_exclusions(self, exclusions):
""" Trim sky catalog to remove any sources within regions specified by
exclusions file.
"""
# parse exclusion file into list of positions and distances
exclusion_coords = tweakutils.parse_exclusions(exclusions)
if exclusion_coords is None:
... |
def asterisk_to_min_max(field, time_filter, search_engine_endpoint, actual_params=None):
"""
traduce [* TO *] to something like [MIN-INDEXED-DATE TO MAX-INDEXED-DATE]
:param field: map the stats to this field.
:param time_filter: this is the value to be translated. think in "[* TO 2000]"
:param sear... | def function[asterisk_to_min_max, parameter[field, time_filter, search_engine_endpoint, actual_params]]:
constant[
traduce [* TO *] to something like [MIN-INDEXED-DATE TO MAX-INDEXED-DATE]
:param field: map the stats to this field.
:param time_filter: this is the value to be translated. think in "[*... | keyword[def] identifier[asterisk_to_min_max] ( identifier[field] , identifier[time_filter] , identifier[search_engine_endpoint] , identifier[actual_params] = keyword[None] ):
literal[string]
keyword[if] identifier[actual_params] :
keyword[raise] identifier[NotImplemented] ( literal[string] )
... | def asterisk_to_min_max(field, time_filter, search_engine_endpoint, actual_params=None):
"""
traduce [* TO *] to something like [MIN-INDEXED-DATE TO MAX-INDEXED-DATE]
:param field: map the stats to this field.
:param time_filter: this is the value to be translated. think in "[* TO 2000]"
:param sear... |
def delete_blobs(self, blobs, on_error=None, client=None):
"""Deletes a list of blobs from the current bucket.
Uses :meth:`delete_blob` to delete each individual blob.
If :attr:`user_project` is set, bills the API request to that project.
:type blobs: list
:param blobs: A list... | def function[delete_blobs, parameter[self, blobs, on_error, client]]:
constant[Deletes a list of blobs from the current bucket.
Uses :meth:`delete_blob` to delete each individual blob.
If :attr:`user_project` is set, bills the API request to that project.
:type blobs: list
:pa... | keyword[def] identifier[delete_blobs] ( identifier[self] , identifier[blobs] , identifier[on_error] = keyword[None] , identifier[client] = keyword[None] ):
literal[string]
keyword[for] identifier[blob] keyword[in] identifier[blobs] :
keyword[try] :
identifier[blob_n... | def delete_blobs(self, blobs, on_error=None, client=None):
"""Deletes a list of blobs from the current bucket.
Uses :meth:`delete_blob` to delete each individual blob.
If :attr:`user_project` is set, bills the API request to that project.
:type blobs: list
:param blobs: A list of ... |
def Pdew_mixture(T=None, zs=None, Psats=None, CASRNs=None,
AvailableMethods=False, Method=None): # pragma: no cover
'''
>>> Pdew_mixture(zs=[0.5, 0.5], Psats=[1400, 7000])
2333.3333333333335
'''
def list_methods():
methods = []
if none_and_length_check((Psats, zs)):... | def function[Pdew_mixture, parameter[T, zs, Psats, CASRNs, AvailableMethods, Method]]:
constant[
>>> Pdew_mixture(zs=[0.5, 0.5], Psats=[1400, 7000])
2333.3333333333335
]
def function[list_methods, parameter[]]:
variable[methods] assign[=] list[[]]
if call[name... | keyword[def] identifier[Pdew_mixture] ( identifier[T] = keyword[None] , identifier[zs] = keyword[None] , identifier[Psats] = keyword[None] , identifier[CASRNs] = keyword[None] ,
identifier[AvailableMethods] = keyword[False] , identifier[Method] = keyword[None] ):
literal[string]
keyword[def] identifier[l... | def Pdew_mixture(T=None, zs=None, Psats=None, CASRNs=None, AvailableMethods=False, Method=None): # pragma: no cover
'\n >>> Pdew_mixture(zs=[0.5, 0.5], Psats=[1400, 7000])\n 2333.3333333333335\n '
def list_methods():
methods = []
if none_and_length_check((Psats, zs)):
meth... |
def get_device_configs():
'''
Return a `pandas.DataFrame`, where each row corresponds to an available
device configuration, including the `device` (i.e., the name of the
device).
'''
frames = []
for i in range(2):
for device in get_video_sources():
df_device_i = get_conf... | def function[get_device_configs, parameter[]]:
constant[
Return a `pandas.DataFrame`, where each row corresponds to an available
device configuration, including the `device` (i.e., the name of the
device).
]
variable[frames] assign[=] list[[]]
for taget[name[i]] in starred[call[n... | keyword[def] identifier[get_device_configs] ():
literal[string]
identifier[frames] =[]
keyword[for] identifier[i] keyword[in] identifier[range] ( literal[int] ):
keyword[for] identifier[device] keyword[in] identifier[get_video_sources] ():
identifier[df_device_i] = identif... | def get_device_configs():
"""
Return a `pandas.DataFrame`, where each row corresponds to an available
device configuration, including the `device` (i.e., the name of the
device).
"""
frames = []
for i in range(2):
for device in get_video_sources():
df_device_i = get_confi... |
def _as_document(self, partition):
""" Converts partition to document indexed by to FTS index.
Args:
partition (orm.Partition): partition to convert.
Returns:
dict with structure matches to BasePartitionIndex._schema.
"""
doc = super(self.__class__, sel... | def function[_as_document, parameter[self, partition]]:
constant[ Converts partition to document indexed by to FTS index.
Args:
partition (orm.Partition): partition to convert.
Returns:
dict with structure matches to BasePartitionIndex._schema.
]
variab... | keyword[def] identifier[_as_document] ( identifier[self] , identifier[partition] ):
literal[string]
identifier[doc] = identifier[super] ( identifier[self] . identifier[__class__] , identifier[self] ). identifier[_as_document] ( identifier[partition] )
identifier[doc] [ literal[st... | def _as_document(self, partition):
""" Converts partition to document indexed by to FTS index.
Args:
partition (orm.Partition): partition to convert.
Returns:
dict with structure matches to BasePartitionIndex._schema.
"""
doc = super(self.__class__, self)._as_d... |
def to_placeholder(self, name=None, db_type=None):
"""Returns a placeholder for the specified name, by applying the instance's format strings.
:name: if None an unamed placeholder is returned, otherwise a named placeholder is returned.
:db_type: if not None the placeholder is typecast.
"""
if name ... | def function[to_placeholder, parameter[self, name, db_type]]:
constant[Returns a placeholder for the specified name, by applying the instance's format strings.
:name: if None an unamed placeholder is returned, otherwise a named placeholder is returned.
:db_type: if not None the placeholder is typecast.... | keyword[def] identifier[to_placeholder] ( identifier[self] , identifier[name] = keyword[None] , identifier[db_type] = keyword[None] ):
literal[string]
keyword[if] identifier[name] keyword[is] keyword[None] :
identifier[placeholder] = identifier[self] . identifier[unnamed_placeholder]
keywor... | def to_placeholder(self, name=None, db_type=None):
"""Returns a placeholder for the specified name, by applying the instance's format strings.
:name: if None an unamed placeholder is returned, otherwise a named placeholder is returned.
:db_type: if not None the placeholder is typecast.
"""
if name ... |
def _discard_config(self):
"""Set candidate_cfg to current running-config. Erase the merge_cfg file."""
discard_candidate = "copy running-config {}".format(
self._gen_full_path(self.candidate_cfg)
)
discard_merge = "copy null: {}".format(self._gen_full_path(self.merge_cfg))
... | def function[_discard_config, parameter[self]]:
constant[Set candidate_cfg to current running-config. Erase the merge_cfg file.]
variable[discard_candidate] assign[=] call[constant[copy running-config {}].format, parameter[call[name[self]._gen_full_path, parameter[name[self].candidate_cfg]]]]
va... | keyword[def] identifier[_discard_config] ( identifier[self] ):
literal[string]
identifier[discard_candidate] = literal[string] . identifier[format] (
identifier[self] . identifier[_gen_full_path] ( identifier[self] . identifier[candidate_cfg] )
)
identifier[discard_merge] ... | def _discard_config(self):
"""Set candidate_cfg to current running-config. Erase the merge_cfg file."""
discard_candidate = 'copy running-config {}'.format(self._gen_full_path(self.candidate_cfg))
discard_merge = 'copy null: {}'.format(self._gen_full_path(self.merge_cfg))
self.device.send_command_expect... |
def upload(self, thread_uuid, file_path, description=None):
""" Upload a file to LinShare using its rest api.
The uploaded document uuid will be returned"""
url = "threads/%s/entries" % thread_uuid
return self.core.upload(file_path, url, description) | def function[upload, parameter[self, thread_uuid, file_path, description]]:
constant[ Upload a file to LinShare using its rest api.
The uploaded document uuid will be returned]
variable[url] assign[=] binary_operation[constant[threads/%s/entries] <ast.Mod object at 0x7da2590d6920> name[thread_uu... | keyword[def] identifier[upload] ( identifier[self] , identifier[thread_uuid] , identifier[file_path] , identifier[description] = keyword[None] ):
literal[string]
identifier[url] = literal[string] % identifier[thread_uuid]
keyword[return] identifier[self] . identifier[core] . identifier[u... | def upload(self, thread_uuid, file_path, description=None):
""" Upload a file to LinShare using its rest api.
The uploaded document uuid will be returned"""
url = 'threads/%s/entries' % thread_uuid
return self.core.upload(file_path, url, description) |
def peered(name):
'''
Check if node is peered.
name
The remote host with which to peer.
.. code-block:: yaml
peer-cluster:
glusterfs.peered:
- name: two
peer-clusters:
glusterfs.peered:
- names:
- one
- t... | def function[peered, parameter[name]]:
constant[
Check if node is peered.
name
The remote host with which to peer.
.. code-block:: yaml
peer-cluster:
glusterfs.peered:
- name: two
peer-clusters:
glusterfs.peered:
- names:
... | keyword[def] identifier[peered] ( identifier[name] ):
literal[string]
identifier[ret] ={ literal[string] : identifier[name] ,
literal[string] :{},
literal[string] : literal[string] ,
literal[string] : keyword[False] }
keyword[try] :
identifier[suc] . identifier[check_name] ( i... | def peered(name):
"""
Check if node is peered.
name
The remote host with which to peer.
.. code-block:: yaml
peer-cluster:
glusterfs.peered:
- name: two
peer-clusters:
glusterfs.peered:
- names:
- one
- t... |
def write_hypergraph(hgr, colored = False):
"""
Return a string specifying the given hypergraph in DOT Language.
@type hgr: hypergraph
@param hgr: Hypergraph.
@type colored: boolean
@param colored: Whether hyperedges should be colored.
@rtype: string
@return: String specify... | def function[write_hypergraph, parameter[hgr, colored]]:
constant[
Return a string specifying the given hypergraph in DOT Language.
@type hgr: hypergraph
@param hgr: Hypergraph.
@type colored: boolean
@param colored: Whether hyperedges should be colored.
@rtype: string
... | keyword[def] identifier[write_hypergraph] ( identifier[hgr] , identifier[colored] = keyword[False] ):
literal[string]
identifier[dotG] = identifier[pydot] . identifier[Dot] ()
keyword[if] keyword[not] literal[string] keyword[in] identifier[dir] ( identifier[hgr] ):
identifier[dotG] . ide... | def write_hypergraph(hgr, colored=False):
"""
Return a string specifying the given hypergraph in DOT Language.
@type hgr: hypergraph
@param hgr: Hypergraph.
@type colored: boolean
@param colored: Whether hyperedges should be colored.
@rtype: string
@return: String specifyin... |
def initialize_parse_state(self, build_file):
"""Creates a fresh parse state for the given build file.
:param build_file: The BUILD file to set up a new ParseState for.
:type build_file: :class:`pants.base.build_file.BuildFile`
:returns: A fresh ParseState for parsing the given `build_file` with.
:... | def function[initialize_parse_state, parameter[self, build_file]]:
constant[Creates a fresh parse state for the given build file.
:param build_file: The BUILD file to set up a new ParseState for.
:type build_file: :class:`pants.base.build_file.BuildFile`
:returns: A fresh ParseState for parsing the... | keyword[def] identifier[initialize_parse_state] ( identifier[self] , identifier[build_file] ):
literal[string]
identifier[type_aliases] = identifier[self] . identifier[_exposed_object_by_alias] . identifier[copy] ()
identifier[parse_context] = identifier[ParseContext] ( identi... | def initialize_parse_state(self, build_file):
"""Creates a fresh parse state for the given build file.
:param build_file: The BUILD file to set up a new ParseState for.
:type build_file: :class:`pants.base.build_file.BuildFile`
:returns: A fresh ParseState for parsing the given `build_file` with.
:... |
def _get_codes(self):
"""
Get the codes.
Returns
-------
codes : integer array view
A non writable view of the `codes` array.
"""
v = self._codes.view()
v.flags.writeable = False
return v | def function[_get_codes, parameter[self]]:
constant[
Get the codes.
Returns
-------
codes : integer array view
A non writable view of the `codes` array.
]
variable[v] assign[=] call[name[self]._codes.view, parameter[]]
name[v].flags.writeable ... | keyword[def] identifier[_get_codes] ( identifier[self] ):
literal[string]
identifier[v] = identifier[self] . identifier[_codes] . identifier[view] ()
identifier[v] . identifier[flags] . identifier[writeable] = keyword[False]
keyword[return] identifier[v] | def _get_codes(self):
"""
Get the codes.
Returns
-------
codes : integer array view
A non writable view of the `codes` array.
"""
v = self._codes.view()
v.flags.writeable = False
return v |
def get_ec_numbers(cls, entry):
"""
get list of models.ECNumber objects from XML node entry
:param entry: XML node entry
:return: list of models.ECNumber objects
"""
ec_numbers = []
for ec in entry.iterfind("./protein/recommendedName/ecNumber"):
ec_... | def function[get_ec_numbers, parameter[cls, entry]]:
constant[
get list of models.ECNumber objects from XML node entry
:param entry: XML node entry
:return: list of models.ECNumber objects
]
variable[ec_numbers] assign[=] list[[]]
for taget[name[ec]] in starred[... | keyword[def] identifier[get_ec_numbers] ( identifier[cls] , identifier[entry] ):
literal[string]
identifier[ec_numbers] =[]
keyword[for] identifier[ec] keyword[in] identifier[entry] . identifier[iterfind] ( literal[string] ):
identifier[ec_numbers] . identifier[append] ( i... | def get_ec_numbers(cls, entry):
"""
get list of models.ECNumber objects from XML node entry
:param entry: XML node entry
:return: list of models.ECNumber objects
"""
ec_numbers = []
for ec in entry.iterfind('./protein/recommendedName/ecNumber'):
ec_numbers.append(mo... |
def init_logger(self):
"""Init logger."""
if not self.result_logger:
if not os.path.exists(self.local_dir):
os.makedirs(self.local_dir)
if not self.logdir:
self.logdir = tempfile.mkdtemp(
prefix="{}_{}".format(
... | def function[init_logger, parameter[self]]:
constant[Init logger.]
if <ast.UnaryOp object at 0x7da2044c1060> begin[:]
if <ast.UnaryOp object at 0x7da20cabe890> begin[:]
call[name[os].makedirs, parameter[name[self].local_dir]]
if <ast.UnaryOp object... | keyword[def] identifier[init_logger] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[result_logger] :
keyword[if] keyword[not] identifier[os] . identifier[path] . identifier[exists] ( identifier[self] . identifier[local_dir] ):
... | def init_logger(self):
"""Init logger."""
if not self.result_logger:
if not os.path.exists(self.local_dir):
os.makedirs(self.local_dir) # depends on [control=['if'], data=[]]
if not self.logdir:
self.logdir = tempfile.mkdtemp(prefix='{}_{}'.format(str(self)[:MAX_LEN_IDEN... |
def set_proxy(self, host, port, user, password):
'''
Sets the proxy server host and port for the HTTP CONNECT Tunnelling.
host:
Address of the proxy. Ex: '192.168.0.100'
port:
Port of the proxy. Ex: 6000
user:
User for proxy authorization.
... | def function[set_proxy, parameter[self, host, port, user, password]]:
constant[
Sets the proxy server host and port for the HTTP CONNECT Tunnelling.
host:
Address of the proxy. Ex: '192.168.0.100'
port:
Port of the proxy. Ex: 6000
user:
User f... | keyword[def] identifier[set_proxy] ( identifier[self] , identifier[host] , identifier[port] , identifier[user] , identifier[password] ):
literal[string]
identifier[self] . identifier[proxy_host] = identifier[host]
identifier[self] . identifier[proxy_port] = identifier[port]
iden... | def set_proxy(self, host, port, user, password):
"""
Sets the proxy server host and port for the HTTP CONNECT Tunnelling.
host:
Address of the proxy. Ex: '192.168.0.100'
port:
Port of the proxy. Ex: 6000
user:
User for proxy authorization.
... |
def findRequirements(platform):
"""
Read the requirements.txt file and parse into requirements for setup's
install_requirements option.
"""
includePycapnp = platform not in WINDOWS_PLATFORMS
requirementsPath = fixPath(os.path.join(PY_BINDINGS, "requirements.txt"))
return [
line.strip()
for line in... | def function[findRequirements, parameter[platform]]:
constant[
Read the requirements.txt file and parse into requirements for setup's
install_requirements option.
]
variable[includePycapnp] assign[=] compare[name[platform] <ast.NotIn object at 0x7da2590d7190> name[WINDOWS_PLATFORMS]]
varia... | keyword[def] identifier[findRequirements] ( identifier[platform] ):
literal[string]
identifier[includePycapnp] = identifier[platform] keyword[not] keyword[in] identifier[WINDOWS_PLATFORMS]
identifier[requirementsPath] = identifier[fixPath] ( identifier[os] . identifier[path] . identifier[join] ( identif... | def findRequirements(platform):
"""
Read the requirements.txt file and parse into requirements for setup's
install_requirements option.
"""
includePycapnp = platform not in WINDOWS_PLATFORMS
requirementsPath = fixPath(os.path.join(PY_BINDINGS, 'requirements.txt'))
return [line.strip() for line in ... |
def merge(self, other):
"""
Combine this region with other.
"""
if not isinstance(other, one):
other = one(other)
new = concatenate((self.coordinates, other.coordinates))
unique = set([tuple(x) for x in new.tolist()])
final = asarray([list(x) for x in ... | def function[merge, parameter[self, other]]:
constant[
Combine this region with other.
]
if <ast.UnaryOp object at 0x7da1b095d090> begin[:]
variable[other] assign[=] call[name[one], parameter[name[other]]]
variable[new] assign[=] call[name[concatenate], parameter[... | keyword[def] identifier[merge] ( identifier[self] , identifier[other] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[other] , identifier[one] ):
identifier[other] = identifier[one] ( identifier[other] )
identifier[new] = identifier[concatenat... | def merge(self, other):
"""
Combine this region with other.
"""
if not isinstance(other, one):
other = one(other) # depends on [control=['if'], data=[]]
new = concatenate((self.coordinates, other.coordinates))
unique = set([tuple(x) for x in new.tolist()])
final = asarray([l... |
def plot_directory(directory, recursive=False, regex='*',
save_prefix='', save_suffix='', axis=None, **kwargs):
"""
Create and save an ANTsPy plot for every image matching a given regular
expression in a directory, optionally recursively. This is a good function
for quick visualize exploration of a... | def function[plot_directory, parameter[directory, recursive, regex, save_prefix, save_suffix, axis]]:
constant[
Create and save an ANTsPy plot for every image matching a given regular
expression in a directory, optionally recursively. This is a good function
for quick visualize exploration of all of... | keyword[def] identifier[plot_directory] ( identifier[directory] , identifier[recursive] = keyword[False] , identifier[regex] = literal[string] ,
identifier[save_prefix] = literal[string] , identifier[save_suffix] = literal[string] , identifier[axis] = keyword[None] ,** identifier[kwargs] ):
literal[string]
... | def plot_directory(directory, recursive=False, regex='*', save_prefix='', save_suffix='', axis=None, **kwargs):
"""
Create and save an ANTsPy plot for every image matching a given regular
expression in a directory, optionally recursively. This is a good function
for quick visualize exploration of all of... |
def callback(msg, _):
"""Callback function called by libnl upon receiving messages from the kernel.
Positional arguments:
msg -- nl_msg class instance containing the data sent by the kernel.
Returns:
An integer, value of NL_OK. It tells libnl to proceed with processing the next kernel message.
... | def function[callback, parameter[msg, _]]:
constant[Callback function called by libnl upon receiving messages from the kernel.
Positional arguments:
msg -- nl_msg class instance containing the data sent by the kernel.
Returns:
An integer, value of NL_OK. It tells libnl to proceed with processi... | keyword[def] identifier[callback] ( identifier[msg] , identifier[_] ):
literal[string]
identifier[nlh] = identifier[nlmsg_hdr] ( identifier[msg] )
identifier[iface] = identifier[ifinfomsg] ( identifier[nlmsg_data] ( identifier[nlh] ))
identifier[hdr] = identifier[IFLA_RTA] ( identifier[iface... | def callback(msg, _):
"""Callback function called by libnl upon receiving messages from the kernel.
Positional arguments:
msg -- nl_msg class instance containing the data sent by the kernel.
Returns:
An integer, value of NL_OK. It tells libnl to proceed with processing the next kernel message.
... |
def _process_messages(self, messages, ignore_unknown_message_types=False):
"""Performs message processing.
:param dict messages: indexed by message id dict with messages data
:param bool ignore_unknown_message_types: whether to silence exceptions
:raises UnknownMessageTypeError:
... | def function[_process_messages, parameter[self, messages, ignore_unknown_message_types]]:
constant[Performs message processing.
:param dict messages: indexed by message id dict with messages data
:param bool ignore_unknown_message_types: whether to silence exceptions
:raises UnknownMess... | keyword[def] identifier[_process_messages] ( identifier[self] , identifier[messages] , identifier[ignore_unknown_message_types] = keyword[False] ):
literal[string]
keyword[with] identifier[self] . identifier[before_after_send_handling] ():
keyword[for] identifier[message_id] , identi... | def _process_messages(self, messages, ignore_unknown_message_types=False):
"""Performs message processing.
:param dict messages: indexed by message id dict with messages data
:param bool ignore_unknown_message_types: whether to silence exceptions
:raises UnknownMessageTypeError:
"""... |
def update_tenant(
self,
tenant,
update_mask=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Updates specified tenant.
Example:
>>> from google.cloud impor... | def function[update_tenant, parameter[self, tenant, update_mask, retry, timeout, metadata]]:
constant[
Updates specified tenant.
Example:
>>> from google.cloud import talent_v4beta1
>>>
>>> client = talent_v4beta1.TenantServiceClient()
>>>
... | keyword[def] identifier[update_tenant] (
identifier[self] ,
identifier[tenant] ,
identifier[update_mask] = keyword[None] ,
identifier[retry] = identifier[google] . identifier[api_core] . identifier[gapic_v1] . identifier[method] . identifier[DEFAULT] ,
identifier[timeout] = identifier[google] . identifier[api_co... | def update_tenant(self, tenant, update_mask=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None):
"""
Updates specified tenant.
Example:
>>> from google.cloud import talent_v4beta1
>>>
>>> client = t... |
def mdot(*args):
"""Computes a matrix product of multiple ndarrays
This is a convenience function to avoid constructs such as np.dot(A, np.dot(B, np.dot(C, D))) and instead
use mdot(A, B, C, D).
Parameters
----------
*args : an arbitrarily long list of ndarrays that must be compatible for mult... | def function[mdot, parameter[]]:
constant[Computes a matrix product of multiple ndarrays
This is a convenience function to avoid constructs such as np.dot(A, np.dot(B, np.dot(C, D))) and instead
use mdot(A, B, C, D).
Parameters
----------
*args : an arbitrarily long list of ndarrays that m... | keyword[def] identifier[mdot] (* identifier[args] ):
literal[string]
keyword[if] identifier[len] ( identifier[args] )< literal[int] :
keyword[raise] identifier[ValueError] ( literal[string] )
keyword[elif] identifier[len] ( identifier[args] )== literal[int] :
keyword[return] iden... | def mdot(*args):
"""Computes a matrix product of multiple ndarrays
This is a convenience function to avoid constructs such as np.dot(A, np.dot(B, np.dot(C, D))) and instead
use mdot(A, B, C, D).
Parameters
----------
*args : an arbitrarily long list of ndarrays that must be compatible for mult... |
def best_fit_distribution(data, bins=200, ax=None):
"""Model data by finding best fit distribution to data"""
# Get histogram of original data
y, x = np.histogram(data, bins=bins, normed=True)
x = (x + np.roll(x, -1))[:-1] / 2.0
# Distributions to check
DISTRIBUTIONS = [
st.alph... | def function[best_fit_distribution, parameter[data, bins, ax]]:
constant[Model data by finding best fit distribution to data]
<ast.Tuple object at 0x7da18f58fe80> assign[=] call[name[np].histogram, parameter[name[data]]]
variable[x] assign[=] binary_operation[call[binary_operation[name[x] + call... | keyword[def] identifier[best_fit_distribution] ( identifier[data] , identifier[bins] = literal[int] , identifier[ax] = keyword[None] ):
literal[string]
identifier[y] , identifier[x] = identifier[np] . identifier[histogram] ( identifier[data] , identifier[bins] = identifier[bins] , identifier[normed] =... | def best_fit_distribution(data, bins=200, ax=None):
"""Model data by finding best fit distribution to data"""
# Get histogram of original data
(y, x) = np.histogram(data, bins=bins, normed=True)
x = (x + np.roll(x, -1))[:-1] / 2.0
# Distributions to check
DISTRIBUTIONS = [st.alpha, st.anglit, st... |
def delete(self, params=None):
"""Delete this resource from the server, passing the specified query parameters.
If this resource doesn't support ``DELETE``, a :py:exc:`.JIRAError`
will be raised; subclasses that specialize this method will only raise errors
in case of user error.
... | def function[delete, parameter[self, params]]:
constant[Delete this resource from the server, passing the specified query parameters.
If this resource doesn't support ``DELETE``, a :py:exc:`.JIRAError`
will be raised; subclasses that specialize this method will only raise errors
in case... | keyword[def] identifier[delete] ( identifier[self] , identifier[params] = keyword[None] ):
literal[string]
keyword[if] identifier[self] . identifier[_options] [ literal[string] ]:
keyword[if] keyword[not] identifier[hasattr] ( identifier[self] . identifier[_session] , literal[string... | def delete(self, params=None):
"""Delete this resource from the server, passing the specified query parameters.
If this resource doesn't support ``DELETE``, a :py:exc:`.JIRAError`
will be raised; subclasses that specialize this method will only raise errors
in case of user error.
:... |
def get_grade_system_admin_session(self):
"""Gets the ``OsidSession`` associated with the grade system administration service.
return: (osid.grading.GradeSystemAdminSession) - a
``GradeSystemAdminSession``
raise: OperationFailed - unable to complete request
raise: Unim... | def function[get_grade_system_admin_session, parameter[self]]:
constant[Gets the ``OsidSession`` associated with the grade system administration service.
return: (osid.grading.GradeSystemAdminSession) - a
``GradeSystemAdminSession``
raise: OperationFailed - unable to complete r... | keyword[def] identifier[get_grade_system_admin_session] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[supports_grade_system_admin] ():
keyword[raise] identifier[errors] . identifier[Unimplemented] ()
keyword[return... | def get_grade_system_admin_session(self):
"""Gets the ``OsidSession`` associated with the grade system administration service.
return: (osid.grading.GradeSystemAdminSession) - a
``GradeSystemAdminSession``
raise: OperationFailed - unable to complete request
raise: Unimplem... |
def __parse_dict(self):
''' Parses dictionary with according rules '''
i = 0
lines = self.lines
for line in lines:
line = line.split('/')
word = line[0]
flags = line[1] if len(line) > 1 else None
# Base Word
self.num_words += ... | def function[__parse_dict, parameter[self]]:
constant[ Parses dictionary with according rules ]
variable[i] assign[=] constant[0]
variable[lines] assign[=] name[self].lines
for taget[name[line]] in starred[name[lines]] begin[:]
variable[line] assign[=] call[name[line].spl... | keyword[def] identifier[__parse_dict] ( identifier[self] ):
literal[string]
identifier[i] = literal[int]
identifier[lines] = identifier[self] . identifier[lines]
keyword[for] identifier[line] keyword[in] identifier[lines] :
identifier[line] = identifier[line] . ... | def __parse_dict(self):
""" Parses dictionary with according rules """
i = 0
lines = self.lines
for line in lines:
line = line.split('/')
word = line[0]
flags = line[1] if len(line) > 1 else None
# Base Word
self.num_words += 1
if flags != None:
... |
def find_guest(name, quiet=False, path=None):
'''
Returns the host for a container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.find_guest name
'''
if quiet:
log... | def function[find_guest, parameter[name, quiet, path]]:
constant[
Returns the host for a container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.find_guest name
]
... | keyword[def] identifier[find_guest] ( identifier[name] , identifier[quiet] = keyword[False] , identifier[path] = keyword[None] ):
literal[string]
keyword[if] identifier[quiet] :
identifier[log] . identifier[warning] ( literal[string]
literal[string] )
keyword[for] identifier[data]... | def find_guest(name, quiet=False, path=None):
"""
Returns the host for a container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.find_guest name
"""
if quiet:
log... |
def get_policies(self):
"""Returns all the Policies under the Identity namespace.
Returns:
(list): A list containing all the Policies under the Identity
namespace.
"""
prefix = _IDENTITY_NS + _POLICY_NS
policylist_list = [
_create_from_by... | def function[get_policies, parameter[self]]:
constant[Returns all the Policies under the Identity namespace.
Returns:
(list): A list containing all the Policies under the Identity
namespace.
]
variable[prefix] assign[=] binary_operation[name[_IDENTITY_NS] + n... | keyword[def] identifier[get_policies] ( identifier[self] ):
literal[string]
identifier[prefix] = identifier[_IDENTITY_NS] + identifier[_POLICY_NS]
identifier[policylist_list] =[
identifier[_create_from_bytes] ( identifier[d] , identifier[identity_pb2] . identifier[PolicyList] )
... | def get_policies(self):
"""Returns all the Policies under the Identity namespace.
Returns:
(list): A list containing all the Policies under the Identity
namespace.
"""
prefix = _IDENTITY_NS + _POLICY_NS
policylist_list = [_create_from_bytes(d, identity_pb2.Policy... |
def get_indelcaller(d_or_c):
"""Retrieve string for indelcaller to use, or empty string if not specified.
"""
config = d_or_c if isinstance(d_or_c, dict) and "config" in d_or_c else d_or_c
indelcaller = config["algorithm"].get("indelcaller", "")
if not indelcaller:
indelcaller = ""
if is... | def function[get_indelcaller, parameter[d_or_c]]:
constant[Retrieve string for indelcaller to use, or empty string if not specified.
]
variable[config] assign[=] <ast.IfExp object at 0x7da1b18fb700>
variable[indelcaller] assign[=] call[call[name[config]][constant[algorithm]].get, parameter[c... | keyword[def] identifier[get_indelcaller] ( identifier[d_or_c] ):
literal[string]
identifier[config] = identifier[d_or_c] keyword[if] identifier[isinstance] ( identifier[d_or_c] , identifier[dict] ) keyword[and] literal[string] keyword[in] identifier[d_or_c] keyword[else] identifier[d_or_c]
ide... | def get_indelcaller(d_or_c):
"""Retrieve string for indelcaller to use, or empty string if not specified.
"""
config = d_or_c if isinstance(d_or_c, dict) and 'config' in d_or_c else d_or_c
indelcaller = config['algorithm'].get('indelcaller', '')
if not indelcaller:
indelcaller = '' # depend... |
def elekta_icon_fbp(ray_transform,
padding=False, filter_type='Hann', frequency_scaling=0.6,
parker_weighting=True):
"""Approximation of the FDK reconstruction used in the Elekta Icon.
Parameters
----------
ray_transform : `RayTransform`
The ray transform... | def function[elekta_icon_fbp, parameter[ray_transform, padding, filter_type, frequency_scaling, parker_weighting]]:
constant[Approximation of the FDK reconstruction used in the Elekta Icon.
Parameters
----------
ray_transform : `RayTransform`
The ray transform to be used, should have an Ele... | keyword[def] identifier[elekta_icon_fbp] ( identifier[ray_transform] ,
identifier[padding] = keyword[False] , identifier[filter_type] = literal[string] , identifier[frequency_scaling] = literal[int] ,
identifier[parker_weighting] = keyword[True] ):
literal[string]
identifier[fbp_op] = identifier[odl] . i... | def elekta_icon_fbp(ray_transform, padding=False, filter_type='Hann', frequency_scaling=0.6, parker_weighting=True):
"""Approximation of the FDK reconstruction used in the Elekta Icon.
Parameters
----------
ray_transform : `RayTransform`
The ray transform to be used, should have an Elekta Icon ... |
def _parse_float_vec(vec):
"""
Parse a vector of float values representing IBM 8 byte floats into
native 8 byte floats.
"""
dtype = np.dtype('>u4,>u4')
vec1 = vec.view(dtype=dtype)
xport1 = vec1['f0']
xport2 = vec1['f1']
# Start by setting first half of ieee number to first half of... | def function[_parse_float_vec, parameter[vec]]:
constant[
Parse a vector of float values representing IBM 8 byte floats into
native 8 byte floats.
]
variable[dtype] assign[=] call[name[np].dtype, parameter[constant[>u4,>u4]]]
variable[vec1] assign[=] call[name[vec].view, parameter[]]... | keyword[def] identifier[_parse_float_vec] ( identifier[vec] ):
literal[string]
identifier[dtype] = identifier[np] . identifier[dtype] ( literal[string] )
identifier[vec1] = identifier[vec] . identifier[view] ( identifier[dtype] = identifier[dtype] )
identifier[xport1] = identifier[vec1] [ litera... | def _parse_float_vec(vec):
"""
Parse a vector of float values representing IBM 8 byte floats into
native 8 byte floats.
"""
dtype = np.dtype('>u4,>u4')
vec1 = vec.view(dtype=dtype)
xport1 = vec1['f0']
xport2 = vec1['f1']
# Start by setting first half of ieee number to first half of I... |
def _createStatsDict(self, headers, rows):
"""Utility method that returns database stats as a nested dictionary.
@param headers: List of columns in query result.
@param rows: List of rows in query result.
@return: Nested dictionary of values.
Fi... | def function[_createStatsDict, parameter[self, headers, rows]]:
constant[Utility method that returns database stats as a nested dictionary.
@param headers: List of columns in query result.
@param rows: List of rows in query result.
@return: Nested dictionary of values.... | keyword[def] identifier[_createStatsDict] ( identifier[self] , identifier[headers] , identifier[rows] ):
literal[string]
identifier[dbstats] ={}
keyword[for] identifier[row] keyword[in] identifier[rows] :
identifier[dbstats] [ identifier[row] [ literal[int] ]]= identifier[d... | def _createStatsDict(self, headers, rows):
"""Utility method that returns database stats as a nested dictionary.
@param headers: List of columns in query result.
@param rows: List of rows in query result.
@return: Nested dictionary of values.
First ... |
def prepare_everything(self):
"""Convenience method to make the actual |HydPy| instance runable."""
self.prepare_network()
self.init_models()
self.load_conditions()
with hydpy.pub.options.warnmissingobsfile(False):
self.prepare_nodeseries()
self.prepare_models... | def function[prepare_everything, parameter[self]]:
constant[Convenience method to make the actual |HydPy| instance runable.]
call[name[self].prepare_network, parameter[]]
call[name[self].init_models, parameter[]]
call[name[self].load_conditions, parameter[]]
with call[name[hydpy]... | keyword[def] identifier[prepare_everything] ( identifier[self] ):
literal[string]
identifier[self] . identifier[prepare_network] ()
identifier[self] . identifier[init_models] ()
identifier[self] . identifier[load_conditions] ()
keyword[with] identifier[hydpy] . identifie... | def prepare_everything(self):
"""Convenience method to make the actual |HydPy| instance runable."""
self.prepare_network()
self.init_models()
self.load_conditions()
with hydpy.pub.options.warnmissingobsfile(False):
self.prepare_nodeseries() # depends on [control=['with'], data=[]]
self.... |
def which(program):
" Check program is exists. "
head, _ = op.split(program)
if head:
if is_exe(program):
return program
else:
for path in environ["PATH"].split(pathsep):
exe_file = op.join(path, program)
if is_exe(exe_file):
return e... | def function[which, parameter[program]]:
constant[ Check program is exists. ]
<ast.Tuple object at 0x7da1b0af8550> assign[=] call[name[op].split, parameter[name[program]]]
if name[head] begin[:]
if call[name[is_exe], parameter[name[program]]] begin[:]
return[name[prog... | keyword[def] identifier[which] ( identifier[program] ):
literal[string]
identifier[head] , identifier[_] = identifier[op] . identifier[split] ( identifier[program] )
keyword[if] identifier[head] :
keyword[if] identifier[is_exe] ( identifier[program] ):
keyword[return] identi... | def which(program):
""" Check program is exists. """
(head, _) = op.split(program)
if head:
if is_exe(program):
return program # depends on [control=['if'], data=[]] # depends on [control=['if'], data=[]]
else:
for path in environ['PATH'].split(pathsep):
exe_fil... |
def build_model(self, n_features, n_classes):
"""Create the computational graph of the model.
:param n_features: Number of features.
:param n_classes: number of classes.
:return: self
"""
self._create_placeholders(n_features, n_classes)
self._create_layers(n_clas... | def function[build_model, parameter[self, n_features, n_classes]]:
constant[Create the computational graph of the model.
:param n_features: Number of features.
:param n_classes: number of classes.
:return: self
]
call[name[self]._create_placeholders, parameter[name[n_fea... | keyword[def] identifier[build_model] ( identifier[self] , identifier[n_features] , identifier[n_classes] ):
literal[string]
identifier[self] . identifier[_create_placeholders] ( identifier[n_features] , identifier[n_classes] )
identifier[self] . identifier[_create_layers] ( identifier[n_cl... | def build_model(self, n_features, n_classes):
"""Create the computational graph of the model.
:param n_features: Number of features.
:param n_classes: number of classes.
:return: self
"""
self._create_placeholders(n_features, n_classes)
self._create_layers(n_classes)
sel... |
def properties(self):
"""All reaction properties as a dict"""
properties = {'id': self._id,
'reversible': self._rev,
'equation': self._equation}
if 'name' in self._root.attrib:
properties['name'] = self._root.get('name')
if self._lo... | def function[properties, parameter[self]]:
constant[All reaction properties as a dict]
variable[properties] assign[=] dictionary[[<ast.Constant object at 0x7da20c6c6080>, <ast.Constant object at 0x7da20c6c5e40>, <ast.Constant object at 0x7da20c6c58d0>], [<ast.Attribute object at 0x7da20c6c7d00>, <ast.At... | keyword[def] identifier[properties] ( identifier[self] ):
literal[string]
identifier[properties] ={ literal[string] : identifier[self] . identifier[_id] ,
literal[string] : identifier[self] . identifier[_rev] ,
literal[string] : identifier[self] . identifier[_equation] }
... | def properties(self):
"""All reaction properties as a dict"""
properties = {'id': self._id, 'reversible': self._rev, 'equation': self._equation}
if 'name' in self._root.attrib:
properties['name'] = self._root.get('name') # depends on [control=['if'], data=[]]
if self._lower_flux is not None:
... |
def _record_extension(self, bank_id, key, value):
"""
To structure a record extension property bean
"""
record_bean = {
'value': value,
'displayName': self._text_bean(key),
'description': self._text_bean(key),
'displayLabel': self._text_bea... | def function[_record_extension, parameter[self, bank_id, key, value]]:
constant[
To structure a record extension property bean
]
variable[record_bean] assign[=] dictionary[[<ast.Constant object at 0x7da18f812ef0>, <ast.Constant object at 0x7da18f8131f0>, <ast.Constant object at 0x7da18f8... | keyword[def] identifier[_record_extension] ( identifier[self] , identifier[bank_id] , identifier[key] , identifier[value] ):
literal[string]
identifier[record_bean] ={
literal[string] : identifier[value] ,
literal[string] : identifier[self] . identifier[_text_bean] ( identifier[ke... | def _record_extension(self, bank_id, key, value):
"""
To structure a record extension property bean
"""
record_bean = {'value': value, 'displayName': self._text_bean(key), 'description': self._text_bean(key), 'displayLabel': self._text_bean(key), 'associatedId': str(bank_id)}
return record_b... |
def mroc(adjacency_matrix, alpha):
"""
Extracts hierarchical community features using the MROC method.
Introduced in: Wang, X., Tang, L., Liu, H., & Wang, L. (2013).
Learning with multi-resolution overlapping communities.
Knowledge and information systems, 36(2), 517-5... | def function[mroc, parameter[adjacency_matrix, alpha]]:
constant[
Extracts hierarchical community features using the MROC method.
Introduced in: Wang, X., Tang, L., Liu, H., & Wang, L. (2013).
Learning with multi-resolution overlapping communities.
Knowledge and in... | keyword[def] identifier[mroc] ( identifier[adjacency_matrix] , identifier[alpha] ):
literal[string]
identifier[number_of_nodes] = identifier[adjacency_matrix] . identifier[shape] [ literal[int] ]
identifier[base_list] = identifier[list] ()
identifier[base_row] = identifi... | def mroc(adjacency_matrix, alpha):
"""
Extracts hierarchical community features using the MROC method.
Introduced in: Wang, X., Tang, L., Liu, H., & Wang, L. (2013).
Learning with multi-resolution overlapping communities.
Knowledge and information systems, 36(2), 517-5... |
def end_body(self):
"""Ends the whole document. This should be called the last"""
if self.write_copy_script:
self.write(
'<textarea id="c" class="invisible"></textarea>'
'<script>'
'function cp(t){'
'var c=document.getElementByI... | def function[end_body, parameter[self]]:
constant[Ends the whole document. This should be called the last]
if name[self].write_copy_script begin[:]
call[name[self].write, parameter[constant[<textarea id="c" class="invisible"></textarea><script>function cp(t){var c=document.getElementById... | keyword[def] identifier[end_body] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[write_copy_script] :
identifier[self] . identifier[write] (
literal[string]
literal[string]
literal[string]
literal[... | def end_body(self):
"""Ends the whole document. This should be called the last"""
if self.write_copy_script:
self.write('<textarea id="c" class="invisible"></textarea><script>function cp(t){var c=document.getElementById("c");c.value=t;c.select();try{document.execCommand("copy")}catch(e){}}</script>') #... |
def _constraint_lb_and_ub_to_gurobi_sense_rhs_and_range_value(lb, ub):
"""Helper function used by Constraint and Model"""
if lb is None and ub is None:
raise Exception("Free constraint ...")
elif lb is None:
sense = '<'
rhs = float(ub)
range_value = 0.
elif ub is None:
... | def function[_constraint_lb_and_ub_to_gurobi_sense_rhs_and_range_value, parameter[lb, ub]]:
constant[Helper function used by Constraint and Model]
if <ast.BoolOp object at 0x7da1b0ccafe0> begin[:]
<ast.Raise object at 0x7da1b0cca1a0>
return[tuple[[<ast.Name object at 0x7da1b0ccace0>, <ast.Na... | keyword[def] identifier[_constraint_lb_and_ub_to_gurobi_sense_rhs_and_range_value] ( identifier[lb] , identifier[ub] ):
literal[string]
keyword[if] identifier[lb] keyword[is] keyword[None] keyword[and] identifier[ub] keyword[is] keyword[None] :
keyword[raise] identifier[Exception] ( litera... | def _constraint_lb_and_ub_to_gurobi_sense_rhs_and_range_value(lb, ub):
"""Helper function used by Constraint and Model"""
if lb is None and ub is None:
raise Exception('Free constraint ...') # depends on [control=['if'], data=[]]
elif lb is None:
sense = '<'
rhs = float(ub)
... |
def put_motion_detection_xml(self, xml):
""" Put request with xml Motion Detection """
_LOGGING.debug('xml:')
_LOGGING.debug("%s", xml)
headers = DEFAULT_HEADERS
headers['Content-Length'] = len(xml)
headers['Host'] = self._host
response = requests.put(self.motio... | def function[put_motion_detection_xml, parameter[self, xml]]:
constant[ Put request with xml Motion Detection ]
call[name[_LOGGING].debug, parameter[constant[xml:]]]
call[name[_LOGGING].debug, parameter[constant[%s], name[xml]]]
variable[headers] assign[=] name[DEFAULT_HEADERS]
c... | keyword[def] identifier[put_motion_detection_xml] ( identifier[self] , identifier[xml] ):
literal[string]
identifier[_LOGGING] . identifier[debug] ( literal[string] )
identifier[_LOGGING] . identifier[debug] ( literal[string] , identifier[xml] )
identifier[headers] = identifier[... | def put_motion_detection_xml(self, xml):
""" Put request with xml Motion Detection """
_LOGGING.debug('xml:')
_LOGGING.debug('%s', xml)
headers = DEFAULT_HEADERS
headers['Content-Length'] = len(xml)
headers['Host'] = self._host
response = requests.put(self.motion_url, auth=HTTPBasicAuth(self... |
def setup(self):
"""
Configures the actor before execution.
:return: None if successful, otherwise error message
:rtype: str
"""
result = super(ActorHandler, self).setup()
if result is None:
self.update_parent()
try:
self.c... | def function[setup, parameter[self]]:
constant[
Configures the actor before execution.
:return: None if successful, otherwise error message
:rtype: str
]
variable[result] assign[=] call[call[name[super], parameter[name[ActorHandler], name[self]]].setup, parameter[]]
... | keyword[def] identifier[setup] ( identifier[self] ):
literal[string]
identifier[result] = identifier[super] ( identifier[ActorHandler] , identifier[self] ). identifier[setup] ()
keyword[if] identifier[result] keyword[is] keyword[None] :
identifier[self] . identifier[update_... | def setup(self):
"""
Configures the actor before execution.
:return: None if successful, otherwise error message
:rtype: str
"""
result = super(ActorHandler, self).setup()
if result is None:
self.update_parent()
try:
self.check_actors(self.actors)... |
def create_dbsecurity_group(self, name, description=None):
"""
Create a new security group for your account.
This will create the security group within the region you
are currently connected to.
:type name: string
:param name: The name of the new security group
... | def function[create_dbsecurity_group, parameter[self, name, description]]:
constant[
Create a new security group for your account.
This will create the security group within the region you
are currently connected to.
:type name: string
:param name: The name of the new se... | keyword[def] identifier[create_dbsecurity_group] ( identifier[self] , identifier[name] , identifier[description] = keyword[None] ):
literal[string]
identifier[params] ={ literal[string] : identifier[name] }
keyword[if] identifier[description] :
identifier[params] [ literal[st... | def create_dbsecurity_group(self, name, description=None):
"""
Create a new security group for your account.
This will create the security group within the region you
are currently connected to.
:type name: string
:param name: The name of the new security group
:typ... |
def _get_digraph_char(self, cli):
" Return `False`, or the Digraph symbol to be used. "
if cli.quoted_insert:
return '^'
if cli.vi_state.waiting_for_digraph:
if cli.vi_state.digraph_symbol1:
return cli.vi_state.digraph_symbol1
return '?'
... | def function[_get_digraph_char, parameter[self, cli]]:
constant[ Return `False`, or the Digraph symbol to be used. ]
if name[cli].quoted_insert begin[:]
return[constant[^]]
if name[cli].vi_state.waiting_for_digraph begin[:]
if name[cli].vi_state.digraph_symbol1 begin[:]
... | keyword[def] identifier[_get_digraph_char] ( identifier[self] , identifier[cli] ):
literal[string]
keyword[if] identifier[cli] . identifier[quoted_insert] :
keyword[return] literal[string]
keyword[if] identifier[cli] . identifier[vi_state] . identifier[waiting_for_digraph]... | def _get_digraph_char(self, cli):
""" Return `False`, or the Digraph symbol to be used. """
if cli.quoted_insert:
return '^' # depends on [control=['if'], data=[]]
if cli.vi_state.waiting_for_digraph:
if cli.vi_state.digraph_symbol1:
return cli.vi_state.digraph_symbol1 # depend... |
def play(self, source, *, after=None):
"""Plays an :class:`AudioSource`.
The finalizer, ``after`` is called after the source has been exhausted
or an error occurred.
If an error happens while the audio player is running, the exception is
caught and the audio player is then stop... | def function[play, parameter[self, source]]:
constant[Plays an :class:`AudioSource`.
The finalizer, ``after`` is called after the source has been exhausted
or an error occurred.
If an error happens while the audio player is running, the exception is
caught and the audio player ... | keyword[def] identifier[play] ( identifier[self] , identifier[source] ,*, identifier[after] = keyword[None] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[is_connected] ():
keyword[raise] identifier[ClientException] ( literal[string] )
keyword[i... | def play(self, source, *, after=None):
"""Plays an :class:`AudioSource`.
The finalizer, ``after`` is called after the source has been exhausted
or an error occurred.
If an error happens while the audio player is running, the exception is
caught and the audio player is then stopped.... |
def getmacbyip6(ip6, chainCC=0):
"""Returns the MAC address corresponding to an IPv6 address
neighborCache.get() method is used on instantiated neighbor cache.
Resolution mechanism is described in associated doc string.
(chainCC parameter value ends up being passed to sending function
used to per... | def function[getmacbyip6, parameter[ip6, chainCC]]:
constant[Returns the MAC address corresponding to an IPv6 address
neighborCache.get() method is used on instantiated neighbor cache.
Resolution mechanism is described in associated doc string.
(chainCC parameter value ends up being passed to send... | keyword[def] identifier[getmacbyip6] ( identifier[ip6] , identifier[chainCC] = literal[int] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[ip6] , identifier[Net6] ):
identifier[ip6] = identifier[str] ( identifier[ip6] )
keyword[if] identifier[in6_ismaddr] ( identifier[... | def getmacbyip6(ip6, chainCC=0):
"""Returns the MAC address corresponding to an IPv6 address
neighborCache.get() method is used on instantiated neighbor cache.
Resolution mechanism is described in associated doc string.
(chainCC parameter value ends up being passed to sending function
used to per... |
def add_function(self, function_id=None, function=None, inputs=None,
outputs=None, input_domain=None, weight=None,
inp_weight=None, out_weight=None, description=None,
filters=None, await_domain=None, await_result=None,
**kwargs):
... | def function[add_function, parameter[self, function_id, function, inputs, outputs, input_domain, weight, inp_weight, out_weight, description, filters, await_domain, await_result]]:
constant[
Add a single function node to dispatcher.
:param function_id:
Function node id.
... | keyword[def] identifier[add_function] ( identifier[self] , identifier[function_id] = keyword[None] , identifier[function] = keyword[None] , identifier[inputs] = keyword[None] ,
identifier[outputs] = keyword[None] , identifier[input_domain] = keyword[None] , identifier[weight] = keyword[None] ,
identifier[inp_weight... | def add_function(self, function_id=None, function=None, inputs=None, outputs=None, input_domain=None, weight=None, inp_weight=None, out_weight=None, description=None, filters=None, await_domain=None, await_result=None, **kwargs):
"""
Add a single function node to dispatcher.
:param function_id:
... |
def accuracy(mod_y, ref_y, summary=True, name="accuracy"):
"""Accuracy computation op.
Parameters
----------
mod_y : tf.Tensor
Model output tensor.
ref_y : tf.Tensor
Reference input tensor.
summary : bool, optional (default = True)
... | def function[accuracy, parameter[mod_y, ref_y, summary, name]]:
constant[Accuracy computation op.
Parameters
----------
mod_y : tf.Tensor
Model output tensor.
ref_y : tf.Tensor
Reference input tensor.
summary : bool, optional (default = True)
... | keyword[def] identifier[accuracy] ( identifier[mod_y] , identifier[ref_y] , identifier[summary] = keyword[True] , identifier[name] = literal[string] ):
literal[string]
keyword[with] identifier[tf] . identifier[name_scope] ( identifier[name] ):
identifier[mod_pred] = identifier[tf] . i... | def accuracy(mod_y, ref_y, summary=True, name='accuracy'):
"""Accuracy computation op.
Parameters
----------
mod_y : tf.Tensor
Model output tensor.
ref_y : tf.Tensor
Reference input tensor.
summary : bool, optional (default = True)
Whet... |
def from_triples(cls, triples):
"""
Decode triples, as from :meth:`to_triples`, into an Eds object.
"""
nids, nd, edges = [], {}, []
for src, rel, tgt in triples:
if src not in nd:
nids.append(src)
nd[src] = {'pred': None, 'lnk': None, ... | def function[from_triples, parameter[cls, triples]]:
constant[
Decode triples, as from :meth:`to_triples`, into an Eds object.
]
<ast.Tuple object at 0x7da1b0471870> assign[=] tuple[[<ast.List object at 0x7da1b0472890>, <ast.Dict object at 0x7da1b0472980>, <ast.List object at 0x7da1b0470... | keyword[def] identifier[from_triples] ( identifier[cls] , identifier[triples] ):
literal[string]
identifier[nids] , identifier[nd] , identifier[edges] =[],{},[]
keyword[for] identifier[src] , identifier[rel] , identifier[tgt] keyword[in] identifier[triples] :
keyword[if] i... | def from_triples(cls, triples):
"""
Decode triples, as from :meth:`to_triples`, into an Eds object.
"""
(nids, nd, edges) = ([], {}, [])
for (src, rel, tgt) in triples:
if src not in nd:
nids.append(src)
nd[src] = {'pred': None, 'lnk': None, 'carg': None, 'si'... |
def find_entity(self, x):
"""
Get the entity that has the specified name (or synonym).
Parameters
----------
x : string
Name or synonym for the target entity.
"""
qstr = self.prefixes + """
SELECT ?x WHERE {{
?x rn:hasName... | def function[find_entity, parameter[self, x]]:
constant[
Get the entity that has the specified name (or synonym).
Parameters
----------
x : string
Name or synonym for the target entity.
]
variable[qstr] assign[=] binary_operation[name[self].prefixes +... | keyword[def] identifier[find_entity] ( identifier[self] , identifier[x] ):
literal[string]
identifier[qstr] = identifier[self] . identifier[prefixes] + literal[string] . identifier[format] ( identifier[x] )
identifier[res] = identifier[self] . identifier[graph] . identifier[query] ( ident... | def find_entity(self, x):
"""
Get the entity that has the specified name (or synonym).
Parameters
----------
x : string
Name or synonym for the target entity.
"""
qstr = self.prefixes + '\n SELECT ?x WHERE {{\n ?x rn:hasName "{0}" .\... |
def fork_procs_insanity_check(p_string):
"""
This function checks if the pipeline string contains a process between
the fork start token or end token and the separator (lane) token. Checks for
the absence of processes in one of the branches of the fork ['|)' and '(|']
and for the existence of a proc... | def function[fork_procs_insanity_check, parameter[p_string]]:
constant[
This function checks if the pipeline string contains a process between
the fork start token or end token and the separator (lane) token. Checks for
the absence of processes in one of the branches of the fork ['|)' and '(|']
... | keyword[def] identifier[fork_procs_insanity_check] ( identifier[p_string] ):
literal[string]
keyword[if] identifier[FORK_TOKEN] + identifier[LANE_TOKEN] keyword[in] identifier[p_string] keyword[or] identifier[LANE_TOKEN] + identifier[CLOSE_TOKEN] keyword[in] identifier[p_string] key... | def fork_procs_insanity_check(p_string):
"""
This function checks if the pipeline string contains a process between
the fork start token or end token and the separator (lane) token. Checks for
the absence of processes in one of the branches of the fork ['|)' and '(|']
and for the existence of a proc... |
def create_pod(
name,
namespace,
metadata,
spec,
source,
template,
saltenv,
**kwargs):
'''
Creates the kubernetes deployment as defined by the user.
'''
body = __create_object_body(
kind='Pod',
obj_class=kubernetes.client.V1... | def function[create_pod, parameter[name, namespace, metadata, spec, source, template, saltenv]]:
constant[
Creates the kubernetes deployment as defined by the user.
]
variable[body] assign[=] call[name[__create_object_body], parameter[]]
variable[cfg] assign[=] call[name[_setup_conn], pa... | keyword[def] identifier[create_pod] (
identifier[name] ,
identifier[namespace] ,
identifier[metadata] ,
identifier[spec] ,
identifier[source] ,
identifier[template] ,
identifier[saltenv] ,
** identifier[kwargs] ):
literal[string]
identifier[body] = identifier[__create_object_body] (
identifier[... | def create_pod(name, namespace, metadata, spec, source, template, saltenv, **kwargs):
"""
Creates the kubernetes deployment as defined by the user.
"""
body = __create_object_body(kind='Pod', obj_class=kubernetes.client.V1Pod, spec_creator=__dict_to_pod_spec, name=name, namespace=namespace, metadata=met... |
def reset(self):
"""
Clear the active cells.
"""
self.bumpPhases = np.empty((2,0), dtype="float")
self.phaseDisplacement = np.empty((0,2), dtype="float")
self.cellsForActivePhases = np.empty(0, dtype="int")
self.activeCells = np.empty(0, dtype="int")
self.learningCells = np.empty(0, dtyp... | def function[reset, parameter[self]]:
constant[
Clear the active cells.
]
name[self].bumpPhases assign[=] call[name[np].empty, parameter[tuple[[<ast.Constant object at 0x7da1b0830ac0>, <ast.Constant object at 0x7da1b0832140>]]]]
name[self].phaseDisplacement assign[=] call[name[np].empty,... | keyword[def] identifier[reset] ( identifier[self] ):
literal[string]
identifier[self] . identifier[bumpPhases] = identifier[np] . identifier[empty] (( literal[int] , literal[int] ), identifier[dtype] = literal[string] )
identifier[self] . identifier[phaseDisplacement] = identifier[np] . identifier[emp... | def reset(self):
"""
Clear the active cells.
"""
self.bumpPhases = np.empty((2, 0), dtype='float')
self.phaseDisplacement = np.empty((0, 2), dtype='float')
self.cellsForActivePhases = np.empty(0, dtype='int')
self.activeCells = np.empty(0, dtype='int')
self.learningCells = np.empty(0, dt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.