code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def load_children(self):
"""
Load the subelements from the xml_element in its correspondent classes.
:returns: List of child objects.
:rtype: list
:raises CardinalityException: If there is more than one Version child.
"""
# Containers
children = list()
... | def function[load_children, parameter[self]]:
constant[
Load the subelements from the xml_element in its correspondent classes.
:returns: List of child objects.
:rtype: list
:raises CardinalityException: If there is more than one Version child.
]
variable[childre... | keyword[def] identifier[load_children] ( identifier[self] ):
literal[string]
identifier[children] = identifier[list] ()
identifier[statuses] = identifier[list] ()
identifier[version] = keyword[None]
identifier[titles] = identifier[list] ()
identifier[d... | def load_children(self):
"""
Load the subelements from the xml_element in its correspondent classes.
:returns: List of child objects.
:rtype: list
:raises CardinalityException: If there is more than one Version child.
"""
# Containers
children = list()
statuses =... |
def from_json(cls, json_data):
"""Instantiate a Credentials object from a JSON description of it.
The JSON should have been produced by calling .to_json() on the object.
Args:
json_data: string or bytes, JSON to deserialize.
Returns:
An instance of a Credential... | def function[from_json, parameter[cls, json_data]]:
constant[Instantiate a Credentials object from a JSON description of it.
The JSON should have been produced by calling .to_json() on the object.
Args:
json_data: string or bytes, JSON to deserialize.
Returns:
... | keyword[def] identifier[from_json] ( identifier[cls] , identifier[json_data] ):
literal[string]
identifier[data] = identifier[json] . identifier[loads] ( identifier[_helpers] . identifier[_from_bytes] ( identifier[json_data] ))
keyword[if] ( identifier[data] . identifier[get] ( literal[str... | def from_json(cls, json_data):
"""Instantiate a Credentials object from a JSON description of it.
The JSON should have been produced by calling .to_json() on the object.
Args:
json_data: string or bytes, JSON to deserialize.
Returns:
An instance of a Credentials su... |
def ToJson(self):
"""
Convert object members to a dictionary that can be parsed as JSON.
Returns:
dict:
"""
json = {}
json["hash"] = self.Hash.To0xString()
json["size"] = self.Size()
json["version"] = self.Version
json["previousblockh... | def function[ToJson, parameter[self]]:
constant[
Convert object members to a dictionary that can be parsed as JSON.
Returns:
dict:
]
variable[json] assign[=] dictionary[[], []]
call[name[json]][constant[hash]] assign[=] call[name[self].Hash.To0xString, param... | keyword[def] identifier[ToJson] ( identifier[self] ):
literal[string]
identifier[json] ={}
identifier[json] [ literal[string] ]= identifier[self] . identifier[Hash] . identifier[To0xString] ()
identifier[json] [ literal[string] ]= identifier[self] . identifier[Size] ()
id... | def ToJson(self):
"""
Convert object members to a dictionary that can be parsed as JSON.
Returns:
dict:
"""
json = {}
json['hash'] = self.Hash.To0xString()
json['size'] = self.Size()
json['version'] = self.Version
json['previousblockhash'] = self.PrevHash.To... |
def set_spcPct(self, value):
"""
Set spacing to *value* lines, e.g. 1.75 lines. A ./a:spcPts child is
removed if present.
"""
self._remove_spcPts()
spcPct = self.get_or_add_spcPct()
spcPct.val = value | def function[set_spcPct, parameter[self, value]]:
constant[
Set spacing to *value* lines, e.g. 1.75 lines. A ./a:spcPts child is
removed if present.
]
call[name[self]._remove_spcPts, parameter[]]
variable[spcPct] assign[=] call[name[self].get_or_add_spcPct, parameter[]]
... | keyword[def] identifier[set_spcPct] ( identifier[self] , identifier[value] ):
literal[string]
identifier[self] . identifier[_remove_spcPts] ()
identifier[spcPct] = identifier[self] . identifier[get_or_add_spcPct] ()
identifier[spcPct] . identifier[val] = identifier[value] | def set_spcPct(self, value):
"""
Set spacing to *value* lines, e.g. 1.75 lines. A ./a:spcPts child is
removed if present.
"""
self._remove_spcPts()
spcPct = self.get_or_add_spcPct()
spcPct.val = value |
def tag_limit_sibling_ordinal(tag, stop_tag_name):
"""
Count previous tags of the same name until it
reaches a tag name of type stop_tag, then stop counting
"""
tag_count = 1
for prev_tag in tag.previous_elements:
if prev_tag.name == tag.name:
tag_count += 1
if prev_t... | def function[tag_limit_sibling_ordinal, parameter[tag, stop_tag_name]]:
constant[
Count previous tags of the same name until it
reaches a tag name of type stop_tag, then stop counting
]
variable[tag_count] assign[=] constant[1]
for taget[name[prev_tag]] in starred[name[tag].previous_... | keyword[def] identifier[tag_limit_sibling_ordinal] ( identifier[tag] , identifier[stop_tag_name] ):
literal[string]
identifier[tag_count] = literal[int]
keyword[for] identifier[prev_tag] keyword[in] identifier[tag] . identifier[previous_elements] :
keyword[if] identifier[prev_tag] . iden... | def tag_limit_sibling_ordinal(tag, stop_tag_name):
"""
Count previous tags of the same name until it
reaches a tag name of type stop_tag, then stop counting
"""
tag_count = 1
for prev_tag in tag.previous_elements:
if prev_tag.name == tag.name:
tag_count += 1 # depends on [co... |
def get_exif_info(self):
"""return exif-tag dict
"""
_dict = {}
for tag in _EXIF_TAGS:
ret = self.img.attribute("EXIF:%s" % tag)
if ret and ret != 'unknown':
_dict[tag] = ret
return _dict | def function[get_exif_info, parameter[self]]:
constant[return exif-tag dict
]
variable[_dict] assign[=] dictionary[[], []]
for taget[name[tag]] in starred[name[_EXIF_TAGS]] begin[:]
variable[ret] assign[=] call[name[self].img.attribute, parameter[binary_operation[constant... | keyword[def] identifier[get_exif_info] ( identifier[self] ):
literal[string]
identifier[_dict] ={}
keyword[for] identifier[tag] keyword[in] identifier[_EXIF_TAGS] :
identifier[ret] = identifier[self] . identifier[img] . identifier[attribute] ( literal[string] % identifier[t... | def get_exif_info(self):
"""return exif-tag dict
"""
_dict = {}
for tag in _EXIF_TAGS:
ret = self.img.attribute('EXIF:%s' % tag)
if ret and ret != 'unknown':
_dict[tag] = ret # depends on [control=['if'], data=[]] # depends on [control=['for'], data=['tag']]
return ... |
def unregister_signals_oaiset(self):
"""Unregister signals oaiset."""
from .models import OAISet
from .receivers import after_insert_oai_set, \
after_update_oai_set, after_delete_oai_set
if contains(OAISet, 'after_insert', after_insert_oai_set):
remove(OAISet, 'af... | def function[unregister_signals_oaiset, parameter[self]]:
constant[Unregister signals oaiset.]
from relative_module[models] import module[OAISet]
from relative_module[receivers] import module[after_insert_oai_set], module[after_update_oai_set], module[after_delete_oai_set]
if call[name[contains]... | keyword[def] identifier[unregister_signals_oaiset] ( identifier[self] ):
literal[string]
keyword[from] . identifier[models] keyword[import] identifier[OAISet]
keyword[from] . identifier[receivers] keyword[import] identifier[after_insert_oai_set] , identifier[after_update_oai_set] , id... | def unregister_signals_oaiset(self):
"""Unregister signals oaiset."""
from .models import OAISet
from .receivers import after_insert_oai_set, after_update_oai_set, after_delete_oai_set
if contains(OAISet, 'after_insert', after_insert_oai_set):
remove(OAISet, 'after_insert', after_insert_oai_set)... |
def render_paginate(request, template, objects, per_page, extra_context={}):
"""
Paginated list of objects.
"""
paginator = Paginator(objects, per_page)
page = request.GET.get('page', 1)
get_params = '&'.join(['%s=%s' % (k, request.GET[k])
for k in request.GET if k != ... | def function[render_paginate, parameter[request, template, objects, per_page, extra_context]]:
constant[
Paginated list of objects.
]
variable[paginator] assign[=] call[name[Paginator], parameter[name[objects], name[per_page]]]
variable[page] assign[=] call[name[request].GET.get, paramet... | keyword[def] identifier[render_paginate] ( identifier[request] , identifier[template] , identifier[objects] , identifier[per_page] , identifier[extra_context] ={}):
literal[string]
identifier[paginator] = identifier[Paginator] ( identifier[objects] , identifier[per_page] )
identifier[page] = identifie... | def render_paginate(request, template, objects, per_page, extra_context={}):
"""
Paginated list of objects.
"""
paginator = Paginator(objects, per_page)
page = request.GET.get('page', 1)
get_params = '&'.join(['%s=%s' % (k, request.GET[k]) for k in request.GET if k != 'page'])
try:
p... |
def tree2text(tree_obj, indent=4):
# type: (TreeInfo, int) -> str
"""
Return text representation of a decision tree.
"""
parts = []
def _format_node(node, depth=0):
# type: (NodeInfo, int) -> None
def p(*args):
# type: (*str) -> None
parts.append(" " * de... | def function[tree2text, parameter[tree_obj, indent]]:
constant[
Return text representation of a decision tree.
]
variable[parts] assign[=] list[[]]
def function[_format_node, parameter[node, depth]]:
def function[p, parameter[]]:
call[name[parts].a... | keyword[def] identifier[tree2text] ( identifier[tree_obj] , identifier[indent] = literal[int] ):
literal[string]
identifier[parts] =[]
keyword[def] identifier[_format_node] ( identifier[node] , identifier[depth] = literal[int] ):
keyword[def] identifier[p] (* identifier[args] ):
... | def tree2text(tree_obj, indent=4):
# type: (TreeInfo, int) -> str
'\n Return text representation of a decision tree.\n '
parts = []
def _format_node(node, depth=0):
# type: (NodeInfo, int) -> None
def p(*args):
# type: (*str) -> None
parts.append(' ' * dep... |
def set_xlimits(self, row, column, min=None, max=None):
"""Set x-axis limits of a subplot.
:param row,column: specify the subplot.
:param min: minimal axis value
:param max: maximum axis value
"""
subplot = self.get_subplot_at(row, column)
subplot.set_xlimits(mi... | def function[set_xlimits, parameter[self, row, column, min, max]]:
constant[Set x-axis limits of a subplot.
:param row,column: specify the subplot.
:param min: minimal axis value
:param max: maximum axis value
]
variable[subplot] assign[=] call[name[self].get_subplot_at... | keyword[def] identifier[set_xlimits] ( identifier[self] , identifier[row] , identifier[column] , identifier[min] = keyword[None] , identifier[max] = keyword[None] ):
literal[string]
identifier[subplot] = identifier[self] . identifier[get_subplot_at] ( identifier[row] , identifier[column] )
... | def set_xlimits(self, row, column, min=None, max=None):
"""Set x-axis limits of a subplot.
:param row,column: specify the subplot.
:param min: minimal axis value
:param max: maximum axis value
"""
subplot = self.get_subplot_at(row, column)
subplot.set_xlimits(min, max) |
def __get_merge_versions(self, merge_id):
"""Get merge versions"""
versions = []
group_versions = self.client.merge_versions(merge_id)
for raw_versions in group_versions:
for version in json.loads(raw_versions):
version_id = version['id']
ve... | def function[__get_merge_versions, parameter[self, merge_id]]:
constant[Get merge versions]
variable[versions] assign[=] list[[]]
variable[group_versions] assign[=] call[name[self].client.merge_versions, parameter[name[merge_id]]]
for taget[name[raw_versions]] in starred[name[group_versi... | keyword[def] identifier[__get_merge_versions] ( identifier[self] , identifier[merge_id] ):
literal[string]
identifier[versions] =[]
identifier[group_versions] = identifier[self] . identifier[client] . identifier[merge_versions] ( identifier[merge_id] )
keyword[for] identifier[... | def __get_merge_versions(self, merge_id):
"""Get merge versions"""
versions = []
group_versions = self.client.merge_versions(merge_id)
for raw_versions in group_versions:
for version in json.loads(raw_versions):
version_id = version['id']
version_full_raw = self.client.me... |
def parse_variable(lexer: Lexer) -> VariableNode:
"""Variable: $Name"""
start = lexer.token
expect_token(lexer, TokenKind.DOLLAR)
return VariableNode(name=parse_name(lexer), loc=loc(lexer, start)) | def function[parse_variable, parameter[lexer]]:
constant[Variable: $Name]
variable[start] assign[=] name[lexer].token
call[name[expect_token], parameter[name[lexer], name[TokenKind].DOLLAR]]
return[call[name[VariableNode], parameter[]]] | keyword[def] identifier[parse_variable] ( identifier[lexer] : identifier[Lexer] )-> identifier[VariableNode] :
literal[string]
identifier[start] = identifier[lexer] . identifier[token]
identifier[expect_token] ( identifier[lexer] , identifier[TokenKind] . identifier[DOLLAR] )
keyword[return] id... | def parse_variable(lexer: Lexer) -> VariableNode:
"""Variable: $Name"""
start = lexer.token
expect_token(lexer, TokenKind.DOLLAR)
return VariableNode(name=parse_name(lexer), loc=loc(lexer, start)) |
def bvlpdu_contents(self, use_dict=None, as_class=dict):
"""Return the contents of an object as a dict."""
return key_value_contents(use_dict=use_dict, as_class=as_class,
key_values=(
('function', 'DeleteForeignDeviceTableEntry'),
('address', str(self.bvlciAdd... | def function[bvlpdu_contents, parameter[self, use_dict, as_class]]:
constant[Return the contents of an object as a dict.]
return[call[name[key_value_contents], parameter[]]] | keyword[def] identifier[bvlpdu_contents] ( identifier[self] , identifier[use_dict] = keyword[None] , identifier[as_class] = identifier[dict] ):
literal[string]
keyword[return] identifier[key_value_contents] ( identifier[use_dict] = identifier[use_dict] , identifier[as_class] = identifier[as_class]... | def bvlpdu_contents(self, use_dict=None, as_class=dict):
"""Return the contents of an object as a dict."""
return key_value_contents(use_dict=use_dict, as_class=as_class, key_values=(('function', 'DeleteForeignDeviceTableEntry'), ('address', str(self.bvlciAddress)))) |
def traverse(self, fn=None, specs=None, full_breadth=True):
"""
Traverses any nested DimensionedPlot returning a list
of all plots that match the specs. The specs should
be supplied as a list of either Plot types or callables,
which should return a boolean given the plot class.
... | def function[traverse, parameter[self, fn, specs, full_breadth]]:
constant[
Traverses any nested DimensionedPlot returning a list
of all plots that match the specs. The specs should
be supplied as a list of either Plot types or callables,
which should return a boolean given the p... | keyword[def] identifier[traverse] ( identifier[self] , identifier[fn] = keyword[None] , identifier[specs] = keyword[None] , identifier[full_breadth] = keyword[True] ):
literal[string]
identifier[accumulator] =[]
identifier[matches] = identifier[specs] keyword[is] keyword[None]
... | def traverse(self, fn=None, specs=None, full_breadth=True):
"""
Traverses any nested DimensionedPlot returning a list
of all plots that match the specs. The specs should
be supplied as a list of either Plot types or callables,
which should return a boolean given the plot class.
... |
def mouseReleaseEvent( self, event ):
"""
Overloads the mouse release event to ignore the event when the \
scene is in view mode, and release the selection block signal.
:param event <QMouseReleaseEvent>
"""
event.setAccepted(False)
if self._hotsp... | def function[mouseReleaseEvent, parameter[self, event]]:
constant[
Overloads the mouse release event to ignore the event when the scene is in view mode, and release the selection block signal.
:param event <QMouseReleaseEvent>
]
call[name[event].setAccept... | keyword[def] identifier[mouseReleaseEvent] ( identifier[self] , identifier[event] ):
literal[string]
identifier[event] . identifier[setAccepted] ( keyword[False] )
keyword[if] identifier[self] . identifier[_hotspotPressed] :
identifier[event] . identifier[accept] ()
... | def mouseReleaseEvent(self, event):
"""
Overloads the mouse release event to ignore the event when the scene is in view mode, and release the selection block signal.
:param event <QMouseReleaseEvent>
"""
event.setAccepted(False)
if self._hotspotPressed:
... |
def Pool(pool='AnyPool', **kwargs):
'''
Chooses between the different pools.
If ``pool == 'AnyPool'``, chooses based on availability.
'''
if pool == 'MPIPool':
return MPIPool(**kwargs)
elif pool == 'MultiPool':
return MultiPool(**kwargs)
elif pool == 'SerialPool':
r... | def function[Pool, parameter[pool]]:
constant[
Chooses between the different pools.
If ``pool == 'AnyPool'``, chooses based on availability.
]
if compare[name[pool] equal[==] constant[MPIPool]] begin[:]
return[call[name[MPIPool], parameter[]]] | keyword[def] identifier[Pool] ( identifier[pool] = literal[string] ,** identifier[kwargs] ):
literal[string]
keyword[if] identifier[pool] == literal[string] :
keyword[return] identifier[MPIPool] (** identifier[kwargs] )
keyword[elif] identifier[pool] == literal[string] :
keyword[... | def Pool(pool='AnyPool', **kwargs):
"""
Chooses between the different pools.
If ``pool == 'AnyPool'``, chooses based on availability.
"""
if pool == 'MPIPool':
return MPIPool(**kwargs) # depends on [control=['if'], data=[]]
elif pool == 'MultiPool':
return MultiPool(**kwargs) ... |
def read_folder(directory):
"""read text files in directory and returns them as array
Args:
directory: where the text files are
Returns:
Array of text
"""
res = []
for filename in os.listdir(directory):
with io.open(os.path.join(directory, filename), encoding="utf-8") a... | def function[read_folder, parameter[directory]]:
constant[read text files in directory and returns them as array
Args:
directory: where the text files are
Returns:
Array of text
]
variable[res] assign[=] list[[]]
for taget[name[filename]] in starred[call[name[os].li... | keyword[def] identifier[read_folder] ( identifier[directory] ):
literal[string]
identifier[res] =[]
keyword[for] identifier[filename] keyword[in] identifier[os] . identifier[listdir] ( identifier[directory] ):
keyword[with] identifier[io] . identifier[open] ( identifier[os] . identifier[p... | def read_folder(directory):
"""read text files in directory and returns them as array
Args:
directory: where the text files are
Returns:
Array of text
"""
res = []
for filename in os.listdir(directory):
with io.open(os.path.join(directory, filename), encoding='utf-8') a... |
def discretize_path(self, path):
"""
Given a list of entities, return a list of connected points.
Parameters
-----------
path: (n,) int, indexes of self.entities
Returns
-----------
discrete: (m, dimension)
"""
discrete = traversal.discre... | def function[discretize_path, parameter[self, path]]:
constant[
Given a list of entities, return a list of connected points.
Parameters
-----------
path: (n,) int, indexes of self.entities
Returns
-----------
discrete: (m, dimension)
]
va... | keyword[def] identifier[discretize_path] ( identifier[self] , identifier[path] ):
literal[string]
identifier[discrete] = identifier[traversal] . identifier[discretize_path] ( identifier[self] . identifier[entities] ,
identifier[self] . identifier[vertices] ,
identifier[path] ,
... | def discretize_path(self, path):
"""
Given a list of entities, return a list of connected points.
Parameters
-----------
path: (n,) int, indexes of self.entities
Returns
-----------
discrete: (m, dimension)
"""
discrete = traversal.discretize_pat... |
def visitObjectExpr(self, ctx: jsgParser.ObjectExprContext):
""" objectExpr: OBRACE membersDef? CBRACE
OBRACE (LEXER_ID_REF | ANY)? MAPSTO valueType ebnfSuffix? CBRACE
"""
if not self._name:
self._name = self._context.anon_id()
if ctx.membersDef():
... | def function[visitObjectExpr, parameter[self, ctx]]:
constant[ objectExpr: OBRACE membersDef? CBRACE
OBRACE (LEXER_ID_REF | ANY)? MAPSTO valueType ebnfSuffix? CBRACE
]
if <ast.UnaryOp object at 0x7da2045652d0> begin[:]
name[self]._name assign[=] call[name... | keyword[def] identifier[visitObjectExpr] ( identifier[self] , identifier[ctx] : identifier[jsgParser] . identifier[ObjectExprContext] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_name] :
identifier[self] . identifier[_name] = identifier[self] . identifie... | def visitObjectExpr(self, ctx: jsgParser.ObjectExprContext):
""" objectExpr: OBRACE membersDef? CBRACE
OBRACE (LEXER_ID_REF | ANY)? MAPSTO valueType ebnfSuffix? CBRACE
"""
if not self._name:
self._name = self._context.anon_id() # depends on [control=['if'], data=[]]
... |
def query_by_entity_uid(idd, kind=''):
'''
Query post2tag by certain post.
'''
if kind == '':
return TabPost2Tag.select(
TabPost2Tag,
TabTag.slug.alias('tag_slug'),
TabTag.name.alias('tag_name')
).join(
... | def function[query_by_entity_uid, parameter[idd, kind]]:
constant[
Query post2tag by certain post.
]
if compare[name[kind] equal[==] constant[]] begin[:]
return[call[call[call[call[name[TabPost2Tag].select, parameter[name[TabPost2Tag], call[name[TabTag].slug.alias, parameter[cons... | keyword[def] identifier[query_by_entity_uid] ( identifier[idd] , identifier[kind] = literal[string] ):
literal[string]
keyword[if] identifier[kind] == literal[string] :
keyword[return] identifier[TabPost2Tag] . identifier[select] (
identifier[TabPost2Tag] ,
... | def query_by_entity_uid(idd, kind=''):
"""
Query post2tag by certain post.
"""
if kind == '':
return TabPost2Tag.select(TabPost2Tag, TabTag.slug.alias('tag_slug'), TabTag.name.alias('tag_name')).join(TabTag, on=TabPost2Tag.tag_id == TabTag.uid).where((TabPost2Tag.post_id == idd) & (TabTa... |
def pipeline_counter(self):
"""
Get pipeline counter of current job instance.
Because instantiating job instance could be performed in different ways and those return different results,
we have to check where from to get counter of the pipeline.
:return: pipeline counter.
... | def function[pipeline_counter, parameter[self]]:
constant[
Get pipeline counter of current job instance.
Because instantiating job instance could be performed in different ways and those return different results,
we have to check where from to get counter of the pipeline.
:retu... | keyword[def] identifier[pipeline_counter] ( identifier[self] ):
literal[string]
keyword[if] literal[string] keyword[in] identifier[self] . identifier[data] keyword[and] identifier[self] . identifier[data] . identifier[pipeline_counter] :
keyword[return] identifier[self] . identif... | def pipeline_counter(self):
"""
Get pipeline counter of current job instance.
Because instantiating job instance could be performed in different ways and those return different results,
we have to check where from to get counter of the pipeline.
:return: pipeline counter.
"... |
def get_activity(self, id_num):
"""Return the activity with the given id.
Note that this contains more detailed information than returned
by `get_activities`.
"""
url = self._build_url('my', 'activities', id_num)
return self._json(url) | def function[get_activity, parameter[self, id_num]]:
constant[Return the activity with the given id.
Note that this contains more detailed information than returned
by `get_activities`.
]
variable[url] assign[=] call[name[self]._build_url, parameter[constant[my], constant[activ... | keyword[def] identifier[get_activity] ( identifier[self] , identifier[id_num] ):
literal[string]
identifier[url] = identifier[self] . identifier[_build_url] ( literal[string] , literal[string] , identifier[id_num] )
keyword[return] identifier[self] . identifier[_json] ( identifier[url] ) | def get_activity(self, id_num):
"""Return the activity with the given id.
Note that this contains more detailed information than returned
by `get_activities`.
"""
url = self._build_url('my', 'activities', id_num)
return self._json(url) |
def forward(self, Q_, p_, G_, h_, A_, b_):
"""Solve a batch of QPs.
This function solves a batch of QPs, each optimizing over
`nz` variables and having `nineq` inequality constraints
and `neq` equality constraints.
The optimization problem for each instance in the batch
... | def function[forward, parameter[self, Q_, p_, G_, h_, A_, b_]]:
constant[Solve a batch of QPs.
This function solves a batch of QPs, each optimizing over
`nz` variables and having `nineq` inequality constraints
and `neq` equality constraints.
The optimization problem for each ins... | keyword[def] identifier[forward] ( identifier[self] , identifier[Q_] , identifier[p_] , identifier[G_] , identifier[h_] , identifier[A_] , identifier[b_] ):
literal[string]
identifier[nBatch] = identifier[extract_nBatch] ( identifier[Q_] , identifier[p_] , identifier[G_] , identifier[h_] , identifi... | def forward(self, Q_, p_, G_, h_, A_, b_):
"""Solve a batch of QPs.
This function solves a batch of QPs, each optimizing over
`nz` variables and having `nineq` inequality constraints
and `neq` equality constraints.
The optimization problem for each instance in the batch
(dro... |
def __load(self, path):
"""Method to load the serialized dataset from disk."""
try:
path = os.path.abspath(path)
with open(path, 'rb') as df:
# loaded_dataset = pickle.load(df)
self.__data, self.__classes, self.__labels, \
self.__dt... | def function[__load, parameter[self, path]]:
constant[Method to load the serialized dataset from disk.]
<ast.Try object at 0x7da18f09d0f0> | keyword[def] identifier[__load] ( identifier[self] , identifier[path] ):
literal[string]
keyword[try] :
identifier[path] = identifier[os] . identifier[path] . identifier[abspath] ( identifier[path] )
keyword[with] identifier[open] ( identifier[path] , literal[string] ) ke... | def __load(self, path):
"""Method to load the serialized dataset from disk."""
try:
path = os.path.abspath(path)
with open(path, 'rb') as df:
# loaded_dataset = pickle.load(df)
(self.__data, self.__classes, self.__labels, self.__dtype, self.__description, self.__num_featu... |
def filter(self, *args, **kwargs):
"""
Adds WHERE arguments to the queryset, returning a new queryset
#TODO: show examples
:rtype: AbstractQuerySet
"""
#add arguments to the where clause filters
if len([x for x in kwargs.values() if x is None]):
rais... | def function[filter, parameter[self]]:
constant[
Adds WHERE arguments to the queryset, returning a new queryset
#TODO: show examples
:rtype: AbstractQuerySet
]
if call[name[len], parameter[<ast.ListComp object at 0x7da207f01030>]] begin[:]
<ast.Raise object at 0... | keyword[def] identifier[filter] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[if] identifier[len] ([ identifier[x] keyword[for] identifier[x] keyword[in] identifier[kwargs] . identifier[values] () keyword[if] identifier[x] keyword[is] keyw... | def filter(self, *args, **kwargs):
"""
Adds WHERE arguments to the queryset, returning a new queryset
#TODO: show examples
:rtype: AbstractQuerySet
"""
#add arguments to the where clause filters
if len([x for x in kwargs.values() if x is None]):
raise CQLEngineExcep... |
def get_active_terms_not_agreed_to(user):
"""Checks to see if a specified user has agreed to all the latest terms and conditions"""
if TERMS_EXCLUDE_USERS_WITH_PERM is not None:
if user.has_perm(TERMS_EXCLUDE_USERS_WITH_PERM) and not user.is_superuser:
# Django's has_perm() ... | def function[get_active_terms_not_agreed_to, parameter[user]]:
constant[Checks to see if a specified user has agreed to all the latest terms and conditions]
if compare[name[TERMS_EXCLUDE_USERS_WITH_PERM] is_not constant[None]] begin[:]
if <ast.BoolOp object at 0x7da1b12f18d0> begin[:]
... | keyword[def] identifier[get_active_terms_not_agreed_to] ( identifier[user] ):
literal[string]
keyword[if] identifier[TERMS_EXCLUDE_USERS_WITH_PERM] keyword[is] keyword[not] keyword[None] :
keyword[if] identifier[user] . identifier[has_perm] ( identifier[TERMS_EXCLUDE_USERS_WITH_P... | def get_active_terms_not_agreed_to(user):
"""Checks to see if a specified user has agreed to all the latest terms and conditions"""
if TERMS_EXCLUDE_USERS_WITH_PERM is not None:
if user.has_perm(TERMS_EXCLUDE_USERS_WITH_PERM) and (not user.is_superuser):
# Django's has_perm() returns True if... |
def css_class_cycler():
'''
Return a dictionary keyed by ``EventType`` abbreviations, whose values are an
iterable or cycle of CSS class names.
'''
FMT = 'evt-{0}-{1}'.format
return defaultdict(default_css_class_cycler, (
(e.abbr, itertools.cycle((FMT(e.abbr, 'even'), FMT(e.abbr, 'odd')... | def function[css_class_cycler, parameter[]]:
constant[
Return a dictionary keyed by ``EventType`` abbreviations, whose values are an
iterable or cycle of CSS class names.
]
variable[FMT] assign[=] constant[evt-{0}-{1}].format
return[call[name[defaultdict], parameter[name[default_css_cla... | keyword[def] identifier[css_class_cycler] ():
literal[string]
identifier[FMT] = literal[string] . identifier[format]
keyword[return] identifier[defaultdict] ( identifier[default_css_class_cycler] ,(
( identifier[e] . identifier[abbr] , identifier[itertools] . identifier[cycle] (( identifier[FMT]... | def css_class_cycler():
"""
Return a dictionary keyed by ``EventType`` abbreviations, whose values are an
iterable or cycle of CSS class names.
"""
FMT = 'evt-{0}-{1}'.format
return defaultdict(default_css_class_cycler, ((e.abbr, itertools.cycle((FMT(e.abbr, 'even'), FMT(e.abbr, 'odd')))) for e... |
def get_variants_in_region(self, chrom, start, end):
"""Iterate over variants in a region."""
region = self.get_vcf()(
"{}:{}-{}".format(chrom, start, end)
)
for v in region:
for coded_allele, g in self._make_genotypes(v.ALT, v.genotypes):
variant ... | def function[get_variants_in_region, parameter[self, chrom, start, end]]:
constant[Iterate over variants in a region.]
variable[region] assign[=] call[call[name[self].get_vcf, parameter[]], parameter[call[constant[{}:{}-{}].format, parameter[name[chrom], name[start], name[end]]]]]
for taget[name... | keyword[def] identifier[get_variants_in_region] ( identifier[self] , identifier[chrom] , identifier[start] , identifier[end] ):
literal[string]
identifier[region] = identifier[self] . identifier[get_vcf] ()(
literal[string] . identifier[format] ( identifier[chrom] , identifier[start] , ide... | def get_variants_in_region(self, chrom, start, end):
"""Iterate over variants in a region."""
region = self.get_vcf()('{}:{}-{}'.format(chrom, start, end))
for v in region:
for (coded_allele, g) in self._make_genotypes(v.ALT, v.genotypes):
variant = Variant(v.ID, v.CHROM, v.POS, [v.REF, ... |
def unitResponse(self,band):
"""This is used internally for :ref:`pysynphot-formula-effstim`
calculations."""
#sum = asumr(band,nwave)
total = band.throughput.sum()
return 2.5*math.log10(total) | def function[unitResponse, parameter[self, band]]:
constant[This is used internally for :ref:`pysynphot-formula-effstim`
calculations.]
variable[total] assign[=] call[name[band].throughput.sum, parameter[]]
return[binary_operation[constant[2.5] * call[name[math].log10, parameter[name[total]]... | keyword[def] identifier[unitResponse] ( identifier[self] , identifier[band] ):
literal[string]
identifier[total] = identifier[band] . identifier[throughput] . identifier[sum] ()
keyword[return] literal[int] * identifier[math] . identifier[log10] ( identifier[total] ) | def unitResponse(self, band):
"""This is used internally for :ref:`pysynphot-formula-effstim`
calculations."""
#sum = asumr(band,nwave)
total = band.throughput.sum()
return 2.5 * math.log10(total) |
def apply(self, func, axis, *args, **kwargs):
"""Apply func across given axis.
Args:
func: The function to apply.
axis: Target axis to apply the function along.
Returns:
A new PandasQueryCompiler.
"""
if callable(func):
return sel... | def function[apply, parameter[self, func, axis]]:
constant[Apply func across given axis.
Args:
func: The function to apply.
axis: Target axis to apply the function along.
Returns:
A new PandasQueryCompiler.
]
if call[name[callable], parameter... | keyword[def] identifier[apply] ( identifier[self] , identifier[func] , identifier[axis] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[if] identifier[callable] ( identifier[func] ):
keyword[return] identifier[self] . identifier[_callable_func] ( identifier[func... | def apply(self, func, axis, *args, **kwargs):
"""Apply func across given axis.
Args:
func: The function to apply.
axis: Target axis to apply the function along.
Returns:
A new PandasQueryCompiler.
"""
if callable(func):
return self._callable_... |
def execute(self, key: str, executable: str, *, capture_stdout: bool=False, capture_stderr: bool=False,
**acquire_kwargs) -> Tuple[Optional[int], Optional[bytes], Optional[bytes]]:
"""
Executes the given executable whilst holding the given lock.
:param key:
:param executa... | def function[execute, parameter[self, key, executable]]:
constant[
Executes the given executable whilst holding the given lock.
:param key:
:param executable:
:param capture_stdout:
:param capture_stderr:
:param acquire_kwargs:
:return:
]
v... | keyword[def] identifier[execute] ( identifier[self] , identifier[key] : identifier[str] , identifier[executable] : identifier[str] ,*, identifier[capture_stdout] : identifier[bool] = keyword[False] , identifier[capture_stderr] : identifier[bool] = keyword[False] ,
** identifier[acquire_kwargs] )-> identifier[Tuple] [... | def execute(self, key: str, executable: str, *, capture_stdout: bool=False, capture_stderr: bool=False, **acquire_kwargs) -> Tuple[Optional[int], Optional[bytes], Optional[bytes]]:
"""
Executes the given executable whilst holding the given lock.
:param key:
:param executable:
:param ... |
def url(self, url):
""" Set API URL endpoint
Args:
url: the url of the API endpoint
"""
if url and url.endswith('/'):
url = url[:-1]
self._url = url | def function[url, parameter[self, url]]:
constant[ Set API URL endpoint
Args:
url: the url of the API endpoint
]
if <ast.BoolOp object at 0x7da1b0d1e0e0> begin[:]
variable[url] assign[=] call[name[url]][<ast.Slice object at 0x7da1b0d1d7b0>]
na... | keyword[def] identifier[url] ( identifier[self] , identifier[url] ):
literal[string]
keyword[if] identifier[url] keyword[and] identifier[url] . identifier[endswith] ( literal[string] ):
identifier[url] = identifier[url] [:- literal[int] ]
identifier[self] . identifier[_url... | def url(self, url):
""" Set API URL endpoint
Args:
url: the url of the API endpoint
"""
if url and url.endswith('/'):
url = url[:-1] # depends on [control=['if'], data=[]]
self._url = url |
def get_wind_efficiency_curve(curve_name='all'):
r"""
Reads wind efficiency curve(s) specified in `curve_name`.
Parameters
----------
curve_name : str or list
Specifies the curve. Use 'all' to get all curves in a MultiIndex
DataFrame or one of the curve names to retrieve a single cu... | def function[get_wind_efficiency_curve, parameter[curve_name]]:
constant[
Reads wind efficiency curve(s) specified in `curve_name`.
Parameters
----------
curve_name : str or list
Specifies the curve. Use 'all' to get all curves in a MultiIndex
DataFrame or one of the curve names... | keyword[def] identifier[get_wind_efficiency_curve] ( identifier[curve_name] = literal[string] ):
literal[string]
identifier[possible_curve_names] =[ literal[string] , literal[string] , literal[string] ,
literal[string] , literal[string] ,
literal[string] , literal[string] ]
keyword[if] ide... | def get_wind_efficiency_curve(curve_name='all'):
"""
Reads wind efficiency curve(s) specified in `curve_name`.
Parameters
----------
curve_name : str or list
Specifies the curve. Use 'all' to get all curves in a MultiIndex
DataFrame or one of the curve names to retrieve a single cur... |
def update(self, volume_id, **kwargs):
"""
update an export
"""
# These arguments are allowed
self.allowed('update', kwargs,
['status', 'instance_id',
'mountpoint', 'ip', 'initiator', 'session_ip',
'session_initiato... | def function[update, parameter[self, volume_id]]:
constant[
update an export
]
call[name[self].allowed, parameter[constant[update], name[kwargs], list[[<ast.Constant object at 0x7da2041dbb80>, <ast.Constant object at 0x7da2041dbc10>, <ast.Constant object at 0x7da2041d8670>, <ast.Constant... | keyword[def] identifier[update] ( identifier[self] , identifier[volume_id] ,** identifier[kwargs] ):
literal[string]
identifier[self] . identifier[allowed] ( literal[string] , identifier[kwargs] ,
[ literal[string] , literal[string] ,
literal[string] , literal[string] , li... | def update(self, volume_id, **kwargs):
"""
update an export
"""
# These arguments are allowed
self.allowed('update', kwargs, ['status', 'instance_id', 'mountpoint', 'ip', 'initiator', 'session_ip', 'session_initiator'])
# Remove parameters that are None
params = self.unused(kwargs)
... |
def result(self, timeout=None):
"""Return the result of the call that the future represents.
Args:
timeout: The number of seconds to wait for the result if the future
isn't done. If None, then there is no limit on the wait time.
Returns:
The result of th... | def function[result, parameter[self, timeout]]:
constant[Return the result of the call that the future represents.
Args:
timeout: The number of seconds to wait for the result if the future
isn't done. If None, then there is no limit on the wait time.
Returns:
... | keyword[def] identifier[result] ( identifier[self] , identifier[timeout] = keyword[None] ):
literal[string]
keyword[if] identifier[self] . identifier[_state] == identifier[self] . identifier[RUNNING] :
identifier[self] . identifier[_context] . identifier[wait_all_futures] ([ identifie... | def result(self, timeout=None):
"""Return the result of the call that the future represents.
Args:
timeout: The number of seconds to wait for the result if the future
isn't done. If None, then there is no limit on the wait time.
Returns:
The result of the ca... |
def get_geo_index():
"""Get entire index of geographic name (key) and set of associated authors
(value).
"""
_dict = {}
for k, v in AUTHOR_EPITHET.items():
_dict[k] = set(v)
return _dict | def function[get_geo_index, parameter[]]:
constant[Get entire index of geographic name (key) and set of associated authors
(value).
]
variable[_dict] assign[=] dictionary[[], []]
for taget[tuple[[<ast.Name object at 0x7da2045670a0>, <ast.Name object at 0x7da2045645e0>]]] in starred[call[... | keyword[def] identifier[get_geo_index] ():
literal[string]
identifier[_dict] ={}
keyword[for] identifier[k] , identifier[v] keyword[in] identifier[AUTHOR_EPITHET] . identifier[items] ():
identifier[_dict] [ identifier[k] ]= identifier[set] ( identifier[v] )
keyword[return] identifie... | def get_geo_index():
"""Get entire index of geographic name (key) and set of associated authors
(value).
"""
_dict = {}
for (k, v) in AUTHOR_EPITHET.items():
_dict[k] = set(v) # depends on [control=['for'], data=[]]
return _dict |
def build(self, builder):
"""Build XML by appending to builder"""
builder.start("GlobalVariables", {})
make_element(builder, "StudyName", self.name)
make_element(builder, "StudyDescription", self.description)
make_element(builder, "ProtocolName", self.protocol_name)
build... | def function[build, parameter[self, builder]]:
constant[Build XML by appending to builder]
call[name[builder].start, parameter[constant[GlobalVariables], dictionary[[], []]]]
call[name[make_element], parameter[name[builder], constant[StudyName], name[self].name]]
call[name[make_element],... | keyword[def] identifier[build] ( identifier[self] , identifier[builder] ):
literal[string]
identifier[builder] . identifier[start] ( literal[string] ,{})
identifier[make_element] ( identifier[builder] , literal[string] , identifier[self] . identifier[name] )
identifier[make_elemen... | def build(self, builder):
"""Build XML by appending to builder"""
builder.start('GlobalVariables', {})
make_element(builder, 'StudyName', self.name)
make_element(builder, 'StudyDescription', self.description)
make_element(builder, 'ProtocolName', self.protocol_name)
builder.end('GlobalVariables'... |
def apply(self, q, bindings, fields, distinct=False):
""" Define a set of fields to return for a non-aggregated query. """
info = []
group_by = None
for field in self.parse(fields):
for concept in self.cube.model.match(field):
info.append(concept.ref)
... | def function[apply, parameter[self, q, bindings, fields, distinct]]:
constant[ Define a set of fields to return for a non-aggregated query. ]
variable[info] assign[=] list[[]]
variable[group_by] assign[=] constant[None]
for taget[name[field]] in starred[call[name[self].parse, parameter[n... | keyword[def] identifier[apply] ( identifier[self] , identifier[q] , identifier[bindings] , identifier[fields] , identifier[distinct] = keyword[False] ):
literal[string]
identifier[info] =[]
identifier[group_by] = keyword[None]
keyword[for] identifier[field] keyword[in] ident... | def apply(self, q, bindings, fields, distinct=False):
""" Define a set of fields to return for a non-aggregated query. """
info = []
group_by = None
for field in self.parse(fields):
for concept in self.cube.model.match(field):
info.append(concept.ref)
(table, column) = co... |
def _make_mountpoint(self, casename=None, var_name='mountpoint', suffix='', in_paths=False):
"""Creates a directory that can be used as a mountpoint. The directory is stored in :attr:`mountpoint`,
or the varname as specified by the argument. If in_paths is True, the path is stored in the :attr:`_paths`
... | def function[_make_mountpoint, parameter[self, casename, var_name, suffix, in_paths]]:
constant[Creates a directory that can be used as a mountpoint. The directory is stored in :attr:`mountpoint`,
or the varname as specified by the argument. If in_paths is True, the path is stored in the :attr:`_paths`
... | keyword[def] identifier[_make_mountpoint] ( identifier[self] , identifier[casename] = keyword[None] , identifier[var_name] = literal[string] , identifier[suffix] = literal[string] , identifier[in_paths] = keyword[False] ):
literal[string]
identifier[parser] = identifier[self] . identifier[disk] . i... | def _make_mountpoint(self, casename=None, var_name='mountpoint', suffix='', in_paths=False):
"""Creates a directory that can be used as a mountpoint. The directory is stored in :attr:`mountpoint`,
or the varname as specified by the argument. If in_paths is True, the path is stored in the :attr:`_paths`
... |
def methods():
"Names of operations provided by containerizers, as a set."
pairs = inspect.getmembers(Containerizer, predicate=inspect.ismethod)
return set(k for k, _ in pairs if k[0:1] != "_") | def function[methods, parameter[]]:
constant[Names of operations provided by containerizers, as a set.]
variable[pairs] assign[=] call[name[inspect].getmembers, parameter[name[Containerizer]]]
return[call[name[set], parameter[<ast.GeneratorExp object at 0x7da1b0be16f0>]]] | keyword[def] identifier[methods] ():
literal[string]
identifier[pairs] = identifier[inspect] . identifier[getmembers] ( identifier[Containerizer] , identifier[predicate] = identifier[inspect] . identifier[ismethod] )
keyword[return] identifier[set] ( identifier[k] keyword[for] identifier[k] , ident... | def methods():
"""Names of operations provided by containerizers, as a set."""
pairs = inspect.getmembers(Containerizer, predicate=inspect.ismethod)
return set((k for (k, _) in pairs if k[0:1] != '_')) |
def export_cmd(argv=sys.argv[1:]): # pragma: no cover
"""\
Export a model from one model persister to another.
The model persister to export to is supposed to be available in the
configuration file under the 'model_persister_export' key.
Usage:
pld-export [options]
Options:
--version=<v> Export a... | def function[export_cmd, parameter[argv]]:
constant[Export a model from one model persister to another.
The model persister to export to is supposed to be available in the
configuration file under the 'model_persister_export' key.
Usage:
pld-export [options]
Options:
--version=<v> Export a spe... | keyword[def] identifier[export_cmd] ( identifier[argv] = identifier[sys] . identifier[argv] [ literal[int] :]):
literal[string]
identifier[arguments] = identifier[docopt] ( identifier[export_cmd] . identifier[__doc__] , identifier[argv] = identifier[argv] )
identifier[model_version] = identifier[expor... | def export_cmd(argv=sys.argv[1:]): # pragma: no cover
"Export a model from one model persister to another.\n\nThe model persister to export to is supposed to be available in the\nconfiguration file under the 'model_persister_export' key.\n\nUsage:\n pld-export [options]\n\nOptions:\n --version=<v> Exp... |
def remove_node_by_value(self, value):
"""
Delete all nodes in ``self.node_list`` with the value ``value``.
Args:
value (Any): The value to find and delete owners of.
Returns: None
Example:
>>> from blur.markov.node import Node
>>> node_1 = ... | def function[remove_node_by_value, parameter[self, value]]:
constant[
Delete all nodes in ``self.node_list`` with the value ``value``.
Args:
value (Any): The value to find and delete owners of.
Returns: None
Example:
>>> from blur.markov.node import Nod... | keyword[def] identifier[remove_node_by_value] ( identifier[self] , identifier[value] ):
literal[string]
identifier[self] . identifier[node_list] =[ identifier[node] keyword[for] identifier[node] keyword[in] identifier[self] . identifier[node_list]
keyword[if] identifier[node] . ident... | def remove_node_by_value(self, value):
"""
Delete all nodes in ``self.node_list`` with the value ``value``.
Args:
value (Any): The value to find and delete owners of.
Returns: None
Example:
>>> from blur.markov.node import Node
>>> node_1 = Node... |
def setup(self, *args, **kwargs):
"""Set parameters for the compiler."""
if self.comp is None:
self.comp = Compiler(*args, **kwargs)
else:
self.comp.setup(*args, **kwargs) | def function[setup, parameter[self]]:
constant[Set parameters for the compiler.]
if compare[name[self].comp is constant[None]] begin[:]
name[self].comp assign[=] call[name[Compiler], parameter[<ast.Starred object at 0x7da20c6e4a90>]] | keyword[def] identifier[setup] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[if] identifier[self] . identifier[comp] keyword[is] keyword[None] :
identifier[self] . identifier[comp] = identifier[Compiler] (* identifier[args] ,** identifier[k... | def setup(self, *args, **kwargs):
"""Set parameters for the compiler."""
if self.comp is None:
self.comp = Compiler(*args, **kwargs) # depends on [control=['if'], data=[]]
else:
self.comp.setup(*args, **kwargs) |
def get_cart_deformed_cell(base_cryst, axis=0, size=1):
'''Return the cell deformed along one of the cartesian directions
Creates new deformed structure. The deformation is based on the
base structure and is performed along single axis. The axis is
specified as follows: 0,1,2 = x,y,z ; sheers: 3,4,5 = ... | def function[get_cart_deformed_cell, parameter[base_cryst, axis, size]]:
constant[Return the cell deformed along one of the cartesian directions
Creates new deformed structure. The deformation is based on the
base structure and is performed along single axis. The axis is
specified as follows: 0,1,2... | keyword[def] identifier[get_cart_deformed_cell] ( identifier[base_cryst] , identifier[axis] = literal[int] , identifier[size] = literal[int] ):
literal[string]
identifier[cryst] = identifier[Atoms] ( identifier[base_cryst] )
identifier[uc] = identifier[base_cryst] . identifier[get_cell] ()
identi... | def get_cart_deformed_cell(base_cryst, axis=0, size=1):
"""Return the cell deformed along one of the cartesian directions
Creates new deformed structure. The deformation is based on the
base structure and is performed along single axis. The axis is
specified as follows: 0,1,2 = x,y,z ; sheers: 3,4,5 = ... |
def relativize(self, absolute_address, target_region_id=None):
"""
Convert an absolute address to the memory offset in a memory region.
Note that if an address belongs to heap region is passed in to a stack region map, it will be converted to an
offset included in the closest stack fram... | def function[relativize, parameter[self, absolute_address, target_region_id]]:
constant[
Convert an absolute address to the memory offset in a memory region.
Note that if an address belongs to heap region is passed in to a stack region map, it will be converted to an
offset included in ... | keyword[def] identifier[relativize] ( identifier[self] , identifier[absolute_address] , identifier[target_region_id] = keyword[None] ):
literal[string]
keyword[if] identifier[target_region_id] keyword[is] keyword[None] :
keyword[if] identifier[self] . identifier[is_stack] :
... | def relativize(self, absolute_address, target_region_id=None):
"""
Convert an absolute address to the memory offset in a memory region.
Note that if an address belongs to heap region is passed in to a stack region map, it will be converted to an
offset included in the closest stack frame, a... |
def drop_schema(self):
"""Drop all gauged tables"""
try:
self.cursor.execute("""
DROP TABLE IF EXISTS gauged_data;
DROP TABLE IF EXISTS gauged_keys;
DROP TABLE IF EXISTS gauged_writer_history;
DROP TABLE IF EXISTS gauged_cache;
... | def function[drop_schema, parameter[self]]:
constant[Drop all gauged tables]
<ast.Try object at 0x7da1b23302b0> | keyword[def] identifier[drop_schema] ( identifier[self] ):
literal[string]
keyword[try] :
identifier[self] . identifier[cursor] . identifier[execute] ( literal[string] )
identifier[self] . identifier[db] . identifier[commit] ()
keyword[except] identifier[self] . ... | def drop_schema(self):
"""Drop all gauged tables"""
try:
self.cursor.execute('\n DROP TABLE IF EXISTS gauged_data;\n DROP TABLE IF EXISTS gauged_keys;\n DROP TABLE IF EXISTS gauged_writer_history;\n DROP TABLE IF EXISTS gauged_cache;\n ... |
async def pop(self, name, init=False):
'''
Remove a property from a node and return the value
'''
prop = self.form.prop(name)
if prop is None:
if self.snap.strict:
raise s_exc.NoSuchProp(name=name)
await self.snap.warn(f'No Such Property: {... | <ast.AsyncFunctionDef object at 0x7da18eb56620> | keyword[async] keyword[def] identifier[pop] ( identifier[self] , identifier[name] , identifier[init] = keyword[False] ):
literal[string]
identifier[prop] = identifier[self] . identifier[form] . identifier[prop] ( identifier[name] )
keyword[if] identifier[prop] keyword[is] keyword[None]... | async def pop(self, name, init=False):
"""
Remove a property from a node and return the value
"""
prop = self.form.prop(name)
if prop is None:
if self.snap.strict:
raise s_exc.NoSuchProp(name=name) # depends on [control=['if'], data=[]]
await self.snap.warn(f'No ... |
def add_remote(name, location):
'''
Adds a new location to install flatpak packages from.
Args:
name (str): The repository's name.
location (str): The location of the repository.
Returns:
dict: The ``result`` and ``output``.
CLI Example:
.. code-block:: bash
... | def function[add_remote, parameter[name, location]]:
constant[
Adds a new location to install flatpak packages from.
Args:
name (str): The repository's name.
location (str): The location of the repository.
Returns:
dict: The ``result`` and ``output``.
CLI Example:
... | keyword[def] identifier[add_remote] ( identifier[name] , identifier[location] ):
literal[string]
identifier[ret] ={ literal[string] : keyword[None] , literal[string] : literal[string] }
identifier[out] = identifier[__salt__] [ literal[string] ]( identifier[FLATPAK_BINARY_NAME] + literal[string] + iden... | def add_remote(name, location):
"""
Adds a new location to install flatpak packages from.
Args:
name (str): The repository's name.
location (str): The location of the repository.
Returns:
dict: The ``result`` and ``output``.
CLI Example:
.. code-block:: bash
... |
def print_detailed_traceback(self, space=None, file=None):
"""NOT_RPYTHON: Dump a nice detailed interpreter- and
application-level traceback, useful to debug the interpreter."""
if file is None:
file = sys.stderr
f = io.StringIO()
for i in range(len(self.debug_excs)-1... | def function[print_detailed_traceback, parameter[self, space, file]]:
constant[NOT_RPYTHON: Dump a nice detailed interpreter- and
application-level traceback, useful to debug the interpreter.]
if compare[name[file] is constant[None]] begin[:]
variable[file] assign[=] name[sys].st... | keyword[def] identifier[print_detailed_traceback] ( identifier[self] , identifier[space] = keyword[None] , identifier[file] = keyword[None] ):
literal[string]
keyword[if] identifier[file] keyword[is] keyword[None] :
identifier[file] = identifier[sys] . identifier[stderr]
i... | def print_detailed_traceback(self, space=None, file=None):
"""NOT_RPYTHON: Dump a nice detailed interpreter- and
application-level traceback, useful to debug the interpreter."""
if file is None:
file = sys.stderr # depends on [control=['if'], data=['file']]
f = io.StringIO()
for i in ra... |
def used_by(self, bundle):
"""
Indicates that this reference is being used by the given bundle.
This method should only be used by the framework.
:param bundle: A bundle using this reference
"""
if bundle is None or bundle is self.__bundle:
# Ignore
... | def function[used_by, parameter[self, bundle]]:
constant[
Indicates that this reference is being used by the given bundle.
This method should only be used by the framework.
:param bundle: A bundle using this reference
]
if <ast.BoolOp object at 0x7da1b039ac50> begin[:]
... | keyword[def] identifier[used_by] ( identifier[self] , identifier[bundle] ):
literal[string]
keyword[if] identifier[bundle] keyword[is] keyword[None] keyword[or] identifier[bundle] keyword[is] identifier[self] . identifier[__bundle] :
keyword[return]
keyword[w... | def used_by(self, bundle):
"""
Indicates that this reference is being used by the given bundle.
This method should only be used by the framework.
:param bundle: A bundle using this reference
"""
if bundle is None or bundle is self.__bundle:
# Ignore
return # dep... |
def _pretty_message(string, *params):
"""
Takes a multi-line string and does the following:
- dedents
- converts newlines with text before and after into a single line
- strips leading and trailing whitespace
:param string:
The string to format
:param *params:
Params to... | def function[_pretty_message, parameter[string]]:
constant[
Takes a multi-line string and does the following:
- dedents
- converts newlines with text before and after into a single line
- strips leading and trailing whitespace
:param string:
The string to format
:param *par... | keyword[def] identifier[_pretty_message] ( identifier[string] ,* identifier[params] ):
literal[string]
identifier[output] = identifier[textwrap] . identifier[dedent] ( identifier[string] )
keyword[if] identifier[output] . identifier[find] ( literal[string] )!=- literal[int] :
ide... | def _pretty_message(string, *params):
"""
Takes a multi-line string and does the following:
- dedents
- converts newlines with text before and after into a single line
- strips leading and trailing whitespace
:param string:
The string to format
:param *params:
Params to... |
def COOKIES(self):
""" Cookies parsed into a dictionary. Signed cookies are NOT decoded
automatically. See :meth:`get_cookie` for details.
"""
raw_dict = SimpleCookie(self.headers.get('Cookie',''))
cookies = {}
for cookie in six.itervalues(raw_dict):
cooki... | def function[COOKIES, parameter[self]]:
constant[ Cookies parsed into a dictionary. Signed cookies are NOT decoded
automatically. See :meth:`get_cookie` for details.
]
variable[raw_dict] assign[=] call[name[SimpleCookie], parameter[call[name[self].headers.get, parameter[constant[Cook... | keyword[def] identifier[COOKIES] ( identifier[self] ):
literal[string]
identifier[raw_dict] = identifier[SimpleCookie] ( identifier[self] . identifier[headers] . identifier[get] ( literal[string] , literal[string] ))
identifier[cookies] ={}
keyword[for] identifier[cookie] keywor... | def COOKIES(self):
""" Cookies parsed into a dictionary. Signed cookies are NOT decoded
automatically. See :meth:`get_cookie` for details.
"""
raw_dict = SimpleCookie(self.headers.get('Cookie', ''))
cookies = {}
for cookie in six.itervalues(raw_dict):
cookies[cookie.key] = co... |
def parse(self, filename):
"""
. reads 1 file
. if there is a compilation error, print a warning
. get root cursor and recurse
. for each STRUCT_DECL, register a new struct type
. for each UNION_DECL, register a new union type
. for each TYPEDEF_DECL, register a n... | def function[parse, parameter[self, filename]]:
constant[
. reads 1 file
. if there is a compilation error, print a warning
. get root cursor and recurse
. for each STRUCT_DECL, register a new struct type
. for each UNION_DECL, register a new union type
. for each... | keyword[def] identifier[parse] ( identifier[self] , identifier[filename] ):
literal[string]
identifier[index] = identifier[Index] . identifier[create] ()
identifier[self] . identifier[tu] = identifier[index] . identifier[parse] ( identifier[filename] , identifier[self] . identifier[flags] ... | def parse(self, filename):
"""
. reads 1 file
. if there is a compilation error, print a warning
. get root cursor and recurse
. for each STRUCT_DECL, register a new struct type
. for each UNION_DECL, register a new union type
. for each TYPEDEF_DECL, register a new a... |
async def open(self) -> '_BaseAgent':
"""
Context manager entry; open wallet.
For use when keeping agent open across multiple calls.
:return: current object
"""
LOGGER.debug('_BaseAgent.open >>>')
# Do not open pool independently: let relying party decide when ... | <ast.AsyncFunctionDef object at 0x7da2054a5e70> | keyword[async] keyword[def] identifier[open] ( identifier[self] )-> literal[string] :
literal[string]
identifier[LOGGER] . identifier[debug] ( literal[string] )
keyword[await] identifier[self] . identifier[wallet] . identifier[open] ()
identifier[LOGGER] . identifier... | async def open(self) -> '_BaseAgent':
"""
Context manager entry; open wallet.
For use when keeping agent open across multiple calls.
:return: current object
"""
LOGGER.debug('_BaseAgent.open >>>')
# Do not open pool independently: let relying party decide when to go on-line ... |
def getBaseNameScope(cls):
"""
Get root of name space
"""
s = NameScope(False)
s.setLevel(1)
s[0].update(cls._keywords_dict)
return s | def function[getBaseNameScope, parameter[cls]]:
constant[
Get root of name space
]
variable[s] assign[=] call[name[NameScope], parameter[constant[False]]]
call[name[s].setLevel, parameter[constant[1]]]
call[call[name[s]][constant[0]].update, parameter[name[cls]._keywords_... | keyword[def] identifier[getBaseNameScope] ( identifier[cls] ):
literal[string]
identifier[s] = identifier[NameScope] ( keyword[False] )
identifier[s] . identifier[setLevel] ( literal[int] )
identifier[s] [ literal[int] ]. identifier[update] ( identifier[cls] . identifier[_keywords... | def getBaseNameScope(cls):
"""
Get root of name space
"""
s = NameScope(False)
s.setLevel(1)
s[0].update(cls._keywords_dict)
return s |
def _get_day_of_month(other, day_option):
"""Find the day in `other`'s month that satisfies a BaseCFTimeOffset's
onOffset policy, as described by the `day_option` argument.
Parameters
----------
other : cftime.datetime
day_option : 'start', 'end'
'start': returns 1
'end': return... | def function[_get_day_of_month, parameter[other, day_option]]:
constant[Find the day in `other`'s month that satisfies a BaseCFTimeOffset's
onOffset policy, as described by the `day_option` argument.
Parameters
----------
other : cftime.datetime
day_option : 'start', 'end'
'start': ... | keyword[def] identifier[_get_day_of_month] ( identifier[other] , identifier[day_option] ):
literal[string]
keyword[if] identifier[day_option] == literal[string] :
keyword[return] literal[int]
keyword[elif] identifier[day_option] == literal[string] :
identifier[days_in_month] = i... | def _get_day_of_month(other, day_option):
"""Find the day in `other`'s month that satisfies a BaseCFTimeOffset's
onOffset policy, as described by the `day_option` argument.
Parameters
----------
other : cftime.datetime
day_option : 'start', 'end'
'start': returns 1
'end': return... |
def expand_dates(df, columns=[]):
"""
generate year, month, day features from specified date features
"""
columns = df.columns.intersection(columns)
df2 = df.reindex(columns=set(df.columns).difference(columns))
for column in columns:
df2[column + '_year'] = df[column].apply(lambda x: x.y... | def function[expand_dates, parameter[df, columns]]:
constant[
generate year, month, day features from specified date features
]
variable[columns] assign[=] call[name[df].columns.intersection, parameter[name[columns]]]
variable[df2] assign[=] call[name[df].reindex, parameter[]]
fo... | keyword[def] identifier[expand_dates] ( identifier[df] , identifier[columns] =[]):
literal[string]
identifier[columns] = identifier[df] . identifier[columns] . identifier[intersection] ( identifier[columns] )
identifier[df2] = identifier[df] . identifier[reindex] ( identifier[columns] = identifier[set... | def expand_dates(df, columns=[]):
"""
generate year, month, day features from specified date features
"""
columns = df.columns.intersection(columns)
df2 = df.reindex(columns=set(df.columns).difference(columns))
for column in columns:
df2[column + '_year'] = df[column].apply(lambda x: x.y... |
def get_file_samples(file_ids):
"""Get TCGA associated sample barcodes for a list of file IDs.
Params
------
file_ids : Iterable
The file IDs.
Returns
-------
`pandas.Series`
Series containing file IDs as index and corresponding sample barcodes.
"""
ass... | def function[get_file_samples, parameter[file_ids]]:
constant[Get TCGA associated sample barcodes for a list of file IDs.
Params
------
file_ids : Iterable
The file IDs.
Returns
-------
`pandas.Series`
Series containing file IDs as index and corresponding s... | keyword[def] identifier[get_file_samples] ( identifier[file_ids] ):
literal[string]
keyword[assert] identifier[isinstance] ( identifier[file_ids] , identifier[Iterable] )
identifier[payload] ={
literal[string] : identifier[json] . identifier[dumps] ({
literal[string] : literal[string]... | def get_file_samples(file_ids):
"""Get TCGA associated sample barcodes for a list of file IDs.
Params
------
file_ids : Iterable
The file IDs.
Returns
-------
`pandas.Series`
Series containing file IDs as index and corresponding sample barcodes.
"""
ass... |
def is_namedtuple(type_: Type[Any]) -> bool:
'''
Generated with typing.NamedTuple
'''
return _issubclass(type_, tuple) and hasattr(type_, '_field_types') and hasattr(type_, '_fields') | def function[is_namedtuple, parameter[type_]]:
constant[
Generated with typing.NamedTuple
]
return[<ast.BoolOp object at 0x7da20c993190>] | keyword[def] identifier[is_namedtuple] ( identifier[type_] : identifier[Type] [ identifier[Any] ])-> identifier[bool] :
literal[string]
keyword[return] identifier[_issubclass] ( identifier[type_] , identifier[tuple] ) keyword[and] identifier[hasattr] ( identifier[type_] , literal[string] ) keyword[and] ... | def is_namedtuple(type_: Type[Any]) -> bool:
"""
Generated with typing.NamedTuple
"""
return _issubclass(type_, tuple) and hasattr(type_, '_field_types') and hasattr(type_, '_fields') |
def get_user_agent():
""" Obtain the default user agent string sent to the server after
a successful handshake.
"""
from sys import platform, version_info
template = "neobolt/{} Python/{}.{}.{}-{}-{} ({})"
fields = (version,) + tuple(version_info) + (platform,)
return template.format(*fields... | def function[get_user_agent, parameter[]]:
constant[ Obtain the default user agent string sent to the server after
a successful handshake.
]
from relative_module[sys] import module[platform], module[version_info]
variable[template] assign[=] constant[neobolt/{} Python/{}.{}.{}-{}-{} ({})]
... | keyword[def] identifier[get_user_agent] ():
literal[string]
keyword[from] identifier[sys] keyword[import] identifier[platform] , identifier[version_info]
identifier[template] = literal[string]
identifier[fields] =( identifier[version] ,)+ identifier[tuple] ( identifier[version_info] )+( iden... | def get_user_agent():
""" Obtain the default user agent string sent to the server after
a successful handshake.
"""
from sys import platform, version_info
template = 'neobolt/{} Python/{}.{}.{}-{}-{} ({})'
fields = (version,) + tuple(version_info) + (platform,)
return template.format(*fields... |
def setTimescale( self, timescale ):
"""
Sets the timescale value for this widget to the inputed value.
:param timescale | <XGanttWidget.Timescale>
"""
self._timescale = timescale
# show hour/minute scale
if timescale == XGanttWidge... | def function[setTimescale, parameter[self, timescale]]:
constant[
Sets the timescale value for this widget to the inputed value.
:param timescale | <XGanttWidget.Timescale>
]
name[self]._timescale assign[=] name[timescale]
if compare[name[timescale] equal[==... | keyword[def] identifier[setTimescale] ( identifier[self] , identifier[timescale] ):
literal[string]
identifier[self] . identifier[_timescale] = identifier[timescale]
keyword[if] identifier[timescale] == identifier[XGanttWidget] . identifier[Timescale] . identifier[Minute] ... | def setTimescale(self, timescale):
"""
Sets the timescale value for this widget to the inputed value.
:param timescale | <XGanttWidget.Timescale>
"""
self._timescale = timescale # show hour/minute scale
if timescale == XGanttWidget.Timescale.Minute:
self._cellW... |
def _normalize_custom_param_name(name):
"""Replace curved quotes with straight quotes in a custom parameter name.
These should be the only keys with problematic (non-ascii) characters,
since they can be user-generated.
"""
replacements = (("\u2018", "'"), ("\u2019", "'"), ("\u201C", '"'), ("\u201D"... | def function[_normalize_custom_param_name, parameter[name]]:
constant[Replace curved quotes with straight quotes in a custom parameter name.
These should be the only keys with problematic (non-ascii) characters,
since they can be user-generated.
]
variable[replacements] assign[=] tuple[[<ast... | keyword[def] identifier[_normalize_custom_param_name] ( identifier[name] ):
literal[string]
identifier[replacements] =(( literal[string] , literal[string] ),( literal[string] , literal[string] ),( literal[string] , literal[string] ),( literal[string] , literal[string] ))
keyword[for] identifier[orig... | def _normalize_custom_param_name(name):
"""Replace curved quotes with straight quotes in a custom parameter name.
These should be the only keys with problematic (non-ascii) characters,
since they can be user-generated.
"""
replacements = (('‘', "'"), ('’', "'"), ('“', '"'), ('”', '"'))
for (orig... |
def begin_x(self):
"""
Return the X-position of the begin point of this connector, in
English Metric Units (as a |Length| object).
"""
cxnSp = self._element
x, cx, flipH = cxnSp.x, cxnSp.cx, cxnSp.flipH
begin_x = x+cx if flipH else x
return Emu(begin_x) | def function[begin_x, parameter[self]]:
constant[
Return the X-position of the begin point of this connector, in
English Metric Units (as a |Length| object).
]
variable[cxnSp] assign[=] name[self]._element
<ast.Tuple object at 0x7da18ede4310> assign[=] tuple[[<ast.Attribu... | keyword[def] identifier[begin_x] ( identifier[self] ):
literal[string]
identifier[cxnSp] = identifier[self] . identifier[_element]
identifier[x] , identifier[cx] , identifier[flipH] = identifier[cxnSp] . identifier[x] , identifier[cxnSp] . identifier[cx] , identifier[cxnSp] . identifier[f... | def begin_x(self):
"""
Return the X-position of the begin point of this connector, in
English Metric Units (as a |Length| object).
"""
cxnSp = self._element
(x, cx, flipH) = (cxnSp.x, cxnSp.cx, cxnSp.flipH)
begin_x = x + cx if flipH else x
return Emu(begin_x) |
def getTypedValueOrException(self, row):
'Returns the properly-typed value for the given row at this column, or an Exception object.'
return wrapply(self.type, wrapply(self.getValue, row)) | def function[getTypedValueOrException, parameter[self, row]]:
constant[Returns the properly-typed value for the given row at this column, or an Exception object.]
return[call[name[wrapply], parameter[name[self].type, call[name[wrapply], parameter[name[self].getValue, name[row]]]]]] | keyword[def] identifier[getTypedValueOrException] ( identifier[self] , identifier[row] ):
literal[string]
keyword[return] identifier[wrapply] ( identifier[self] . identifier[type] , identifier[wrapply] ( identifier[self] . identifier[getValue] , identifier[row] )) | def getTypedValueOrException(self, row):
"""Returns the properly-typed value for the given row at this column, or an Exception object."""
return wrapply(self.type, wrapply(self.getValue, row)) |
def get_output(script, expanded):
"""Get output of the script.
:param script: Console script.
:type script: str
:param expanded: Console script with expanded aliases.
:type expanded: str
:rtype: str
"""
if shell_logger.is_available():
return shell_logger.get_output(script)
... | def function[get_output, parameter[script, expanded]]:
constant[Get output of the script.
:param script: Console script.
:type script: str
:param expanded: Console script with expanded aliases.
:type expanded: str
:rtype: str
]
if call[name[shell_logger].is_available, parameter... | keyword[def] identifier[get_output] ( identifier[script] , identifier[expanded] ):
literal[string]
keyword[if] identifier[shell_logger] . identifier[is_available] ():
keyword[return] identifier[shell_logger] . identifier[get_output] ( identifier[script] )
keyword[if] identifier[settings] .... | def get_output(script, expanded):
"""Get output of the script.
:param script: Console script.
:type script: str
:param expanded: Console script with expanded aliases.
:type expanded: str
:rtype: str
"""
if shell_logger.is_available():
return shell_logger.get_output(script) # d... |
def store_node_label_meta(self, x, y, tx, ty, rot):
"""
This function stored coordinates-related metadate for a node
This function should not be called by the user
:param x: x location of node label or number
:type x: np.float64
:param y: y location of node label or num... | def function[store_node_label_meta, parameter[self, x, y, tx, ty, rot]]:
constant[
This function stored coordinates-related metadate for a node
This function should not be called by the user
:param x: x location of node label or number
:type x: np.float64
:param y: y lo... | keyword[def] identifier[store_node_label_meta] ( identifier[self] , identifier[x] , identifier[y] , identifier[tx] , identifier[ty] , identifier[rot] ):
literal[string]
identifier[self] . identifier[node_label_coords] [ literal[string] ]. identifier[append] ( identifier[x] )
iden... | def store_node_label_meta(self, x, y, tx, ty, rot):
"""
This function stored coordinates-related metadate for a node
This function should not be called by the user
:param x: x location of node label or number
:type x: np.float64
:param y: y location of node label or number
... |
def _process_response(response):
"""Process the raw AWS response, returning either the mapped exception
or deserialized response.
:param tornado.concurrent.Future response: The request future
:rtype: dict or list
:raises: sprockets_dynamodb.exceptions.DynamoDBException
... | def function[_process_response, parameter[response]]:
constant[Process the raw AWS response, returning either the mapped exception
or deserialized response.
:param tornado.concurrent.Future response: The request future
:rtype: dict or list
:raises: sprockets_dynamodb.exceptions... | keyword[def] identifier[_process_response] ( identifier[response] ):
literal[string]
identifier[error] = identifier[response] . identifier[exception] ()
keyword[if] identifier[error] :
keyword[if] identifier[isinstance] ( identifier[error] , identifier[aws_exceptions] . iden... | def _process_response(response):
"""Process the raw AWS response, returning either the mapped exception
or deserialized response.
:param tornado.concurrent.Future response: The request future
:rtype: dict or list
:raises: sprockets_dynamodb.exceptions.DynamoDBException
"""... |
def max_bipartite_matching2(bigraph):
"""Bipartie maximum matching
:param bigraph: adjacency list, index = vertex in U,
value = neighbor list in V
:comment: U and V can have different cardinalities
:returns: matching list, match[v] == u iff (u, v) in matching
:co... | def function[max_bipartite_matching2, parameter[bigraph]]:
constant[Bipartie maximum matching
:param bigraph: adjacency list, index = vertex in U,
value = neighbor list in V
:comment: U and V can have different cardinalities
:returns: matching list, match[v] == u... | keyword[def] identifier[max_bipartite_matching2] ( identifier[bigraph] ):
literal[string]
identifier[nU] = identifier[len] ( identifier[bigraph] )
identifier[nV] = literal[int]
keyword[for] identifier[adjlist] keyword[in] identifier[bigraph] :
keyword[for] identifier[v] k... | def max_bipartite_matching2(bigraph):
"""Bipartie maximum matching
:param bigraph: adjacency list, index = vertex in U,
value = neighbor list in V
:comment: U and V can have different cardinalities
:returns: matching list, match[v] == u iff (u, v) in matching
:co... |
def is_all_field_none(self):
"""
:rtype: bool
"""
if self._attachment_public_uuid is not None:
return False
if self._content_type is not None:
return False
if self._height is not None:
return False
if self._width is not None... | def function[is_all_field_none, parameter[self]]:
constant[
:rtype: bool
]
if compare[name[self]._attachment_public_uuid is_not constant[None]] begin[:]
return[constant[False]]
if compare[name[self]._content_type is_not constant[None]] begin[:]
return[constant[Fal... | keyword[def] identifier[is_all_field_none] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_attachment_public_uuid] keyword[is] keyword[not] keyword[None] :
keyword[return] keyword[False]
keyword[if] identifier[self] . identifier[_conte... | def is_all_field_none(self):
"""
:rtype: bool
"""
if self._attachment_public_uuid is not None:
return False # depends on [control=['if'], data=[]]
if self._content_type is not None:
return False # depends on [control=['if'], data=[]]
if self._height is not None:
... |
def getmessage(self) -> str:
""" parse self into unicode string as message content """
image = {}
for key, default in vars(self.__class__).items():
if not key.startswith('_') and key !='' and (not key in vars(QueueMessage).items()):
... | def function[getmessage, parameter[self]]:
constant[ parse self into unicode string as message content ]
variable[image] assign[=] dictionary[[], []]
for taget[tuple[[<ast.Name object at 0x7da207f994b0>, <ast.Name object at 0x7da207f9ab00>]]] in starred[call[call[name[vars], parameter[name[self]... | keyword[def] identifier[getmessage] ( identifier[self] )-> identifier[str] :
literal[string]
identifier[image] ={}
keyword[for] identifier[key] , identifier[default] keyword[in] identifier[vars] ( identifier[self] . identifier[__class__] ). identifier[items] ():
keyword[if]... | def getmessage(self) -> str:
""" parse self into unicode string as message content """
image = {}
for (key, default) in vars(self.__class__).items():
if not key.startswith('_') and key != '' and (not key in vars(QueueMessage).items()):
if isinstance(default, datetime.date):
... |
def _parse_attributes(self, attributes):
""" Ensure compliance with the spec's attributes section
Specifically, the attributes object of the single resource
object. This contains the key / values to be mapped to the
model.
:param attributes:
dict JSON API attributes... | def function[_parse_attributes, parameter[self, attributes]]:
constant[ Ensure compliance with the spec's attributes section
Specifically, the attributes object of the single resource
object. This contains the key / values to be mapped to the
model.
:param attributes:
... | keyword[def] identifier[_parse_attributes] ( identifier[self] , identifier[attributes] ):
literal[string]
identifier[link] = literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[attributes] , identifier[dict] ):
identifier[self] . identifier[fail] ... | def _parse_attributes(self, attributes):
""" Ensure compliance with the spec's attributes section
Specifically, the attributes object of the single resource
object. This contains the key / values to be mapped to the
model.
:param attributes:
dict JSON API attributes obj... |
def get_scope_path(self, scope_separator="::"):
"""
Generate a string that represents this component's declaration namespace
scope.
Parameters
----------
scope_separator: str
Override the separator between namespace scopes
"""
if self.parent_s... | def function[get_scope_path, parameter[self, scope_separator]]:
constant[
Generate a string that represents this component's declaration namespace
scope.
Parameters
----------
scope_separator: str
Override the separator between namespace scopes
]
... | keyword[def] identifier[get_scope_path] ( identifier[self] , identifier[scope_separator] = literal[string] ):
literal[string]
keyword[if] identifier[self] . identifier[parent_scope] keyword[is] keyword[None] :
keyword[return] literal[string]
keyword[elif] identifier[isin... | def get_scope_path(self, scope_separator='::'):
"""
Generate a string that represents this component's declaration namespace
scope.
Parameters
----------
scope_separator: str
Override the separator between namespace scopes
"""
if self.parent_scope is ... |
def from_raw(self, raw: RawScalar) -> Optional[ScalarValue]:
"""Return a cooked value of the receiver type.
Args:
raw: Raw value obtained from JSON parser.
"""
if isinstance(raw, str):
return raw | def function[from_raw, parameter[self, raw]]:
constant[Return a cooked value of the receiver type.
Args:
raw: Raw value obtained from JSON parser.
]
if call[name[isinstance], parameter[name[raw], name[str]]] begin[:]
return[name[raw]] | keyword[def] identifier[from_raw] ( identifier[self] , identifier[raw] : identifier[RawScalar] )-> identifier[Optional] [ identifier[ScalarValue] ]:
literal[string]
keyword[if] identifier[isinstance] ( identifier[raw] , identifier[str] ):
keyword[return] identifier[raw] | def from_raw(self, raw: RawScalar) -> Optional[ScalarValue]:
"""Return a cooked value of the receiver type.
Args:
raw: Raw value obtained from JSON parser.
"""
if isinstance(raw, str):
return raw # depends on [control=['if'], data=[]] |
def _index_by_name(self, name):
""":return: index of an item with name, or -1 if not found"""
for i, t in enumerate(self._cache):
if t[2] == name:
return i
# END found item
# END for each item in cache
return -1 | def function[_index_by_name, parameter[self, name]]:
constant[:return: index of an item with name, or -1 if not found]
for taget[tuple[[<ast.Name object at 0x7da1b22482b0>, <ast.Name object at 0x7da1b224ab90>]]] in starred[call[name[enumerate], parameter[name[self]._cache]]] begin[:]
if ... | keyword[def] identifier[_index_by_name] ( identifier[self] , identifier[name] ):
literal[string]
keyword[for] identifier[i] , identifier[t] keyword[in] identifier[enumerate] ( identifier[self] . identifier[_cache] ):
keyword[if] identifier[t] [ literal[int] ]== identifier[name] :
... | def _index_by_name(self, name):
""":return: index of an item with name, or -1 if not found"""
for (i, t) in enumerate(self._cache):
if t[2] == name:
return i # depends on [control=['if'], data=[]] # depends on [control=['for'], data=[]]
# END found item
# END for each item in cache... |
def tabulate(self):
"""Return a simplified version of the spectrum.
Composite spectrum can be overly complicated when it
has too many components and sub-components. This method
copies the following into a simple (tabulated) source spectrum:
* Name
* Wavelength array and... | def function[tabulate, parameter[self]]:
constant[Return a simplified version of the spectrum.
Composite spectrum can be overly complicated when it
has too many components and sub-components. This method
copies the following into a simple (tabulated) source spectrum:
* Name
... | keyword[def] identifier[tabulate] ( identifier[self] ):
literal[string]
identifier[sp] = identifier[ArraySourceSpectrum] ( identifier[wave] = identifier[self] . identifier[wave] ,
identifier[flux] = identifier[self] . identifier[flux] ,
identifier[waveunits] = identifier[self] . i... | def tabulate(self):
"""Return a simplified version of the spectrum.
Composite spectrum can be overly complicated when it
has too many components and sub-components. This method
copies the following into a simple (tabulated) source spectrum:
* Name
* Wavelength array and uni... |
def transform(self, Y):
r"""Compute all pairwise distances between `self.X_fit_` and `Y`.
Parameters
----------
y : array-like, shape = (n_samples_y, n_features)
Returns
-------
kernel : ndarray, shape = (n_samples_y, n_samples_X_fit\_)
Kernel matrix... | def function[transform, parameter[self, Y]]:
constant[Compute all pairwise distances between `self.X_fit_` and `Y`.
Parameters
----------
y : array-like, shape = (n_samples_y, n_features)
Returns
-------
kernel : ndarray, shape = (n_samples_y, n_samples_X_fit\_)... | keyword[def] identifier[transform] ( identifier[self] , identifier[Y] ):
literal[string]
identifier[check_is_fitted] ( identifier[self] , literal[string] )
identifier[n_samples_x] , identifier[n_features] = identifier[self] . identifier[X_fit_] . identifier[shape]
identifier[Y]... | def transform(self, Y):
"""Compute all pairwise distances between `self.X_fit_` and `Y`.
Parameters
----------
y : array-like, shape = (n_samples_y, n_features)
Returns
-------
kernel : ndarray, shape = (n_samples_y, n_samples_X_fit\\_)
Kernel matrix. Va... |
def illumg(method, target, ilusrc, et, fixref, abcorr, obsrvr, spoint):
"""
Find the illumination angles (phase, incidence, and
emission) at a specified surface point of a target body.
The surface of the target body may be represented by a triaxial
ellipsoid or by topographic data provided by D... | def function[illumg, parameter[method, target, ilusrc, et, fixref, abcorr, obsrvr, spoint]]:
constant[
Find the illumination angles (phase, incidence, and
emission) at a specified surface point of a target body.
The surface of the target body may be represented by a triaxial
ellipsoid or by... | keyword[def] identifier[illumg] ( identifier[method] , identifier[target] , identifier[ilusrc] , identifier[et] , identifier[fixref] , identifier[abcorr] , identifier[obsrvr] , identifier[spoint] ):
literal[string]
identifier[method] = identifier[stypes] . identifier[stringToCharP] ( identifier[method] )
... | def illumg(method, target, ilusrc, et, fixref, abcorr, obsrvr, spoint):
"""
Find the illumination angles (phase, incidence, and
emission) at a specified surface point of a target body.
The surface of the target body may be represented by a triaxial
ellipsoid or by topographic data provided by D... |
def bin(self, *columns, **vargs):
"""Group values by bin and compute counts per bin by column.
By default, bins are chosen to contain all values in all columns. The
following named arguments from numpy.histogram can be applied to
specialize bin widths:
If the original table has... | def function[bin, parameter[self]]:
constant[Group values by bin and compute counts per bin by column.
By default, bins are chosen to contain all values in all columns. The
following named arguments from numpy.histogram can be applied to
specialize bin widths:
If the original t... | keyword[def] identifier[bin] ( identifier[self] ,* identifier[columns] ,** identifier[vargs] ):
literal[string]
keyword[if] identifier[columns] :
identifier[self] = identifier[self] . identifier[select] (* identifier[columns] )
keyword[if] literal[string] keyword[in] ident... | def bin(self, *columns, **vargs):
"""Group values by bin and compute counts per bin by column.
By default, bins are chosen to contain all values in all columns. The
following named arguments from numpy.histogram can be applied to
specialize bin widths:
If the original table has n c... |
def heterozygosity_expected(af, ploidy, fill=np.nan):
"""Calculate the expected rate of heterozygosity for each variant
under Hardy-Weinberg equilibrium.
Parameters
----------
af : array_like, float, shape (n_variants, n_alleles)
Allele frequencies array.
ploidy : int
Sample pl... | def function[heterozygosity_expected, parameter[af, ploidy, fill]]:
constant[Calculate the expected rate of heterozygosity for each variant
under Hardy-Weinberg equilibrium.
Parameters
----------
af : array_like, float, shape (n_variants, n_alleles)
Allele frequencies array.
ploidy... | keyword[def] identifier[heterozygosity_expected] ( identifier[af] , identifier[ploidy] , identifier[fill] = identifier[np] . identifier[nan] ):
literal[string]
identifier[af] = identifier[asarray_ndim] ( identifier[af] , literal[int] )
identifier[out] = literal[int] - identifier[np] . iden... | def heterozygosity_expected(af, ploidy, fill=np.nan):
"""Calculate the expected rate of heterozygosity for each variant
under Hardy-Weinberg equilibrium.
Parameters
----------
af : array_like, float, shape (n_variants, n_alleles)
Allele frequencies array.
ploidy : int
Sample pl... |
def within_bounding_box(self, limits):
"""
Selects the earthquakes within a bounding box.
:parameter limits:
A list or a numpy array with four elements in the following order:
- min x (longitude)
- min y (latitude)
- max x (longitude)
... | def function[within_bounding_box, parameter[self, limits]]:
constant[
Selects the earthquakes within a bounding box.
:parameter limits:
A list or a numpy array with four elements in the following order:
- min x (longitude)
- min y (latitude)
... | keyword[def] identifier[within_bounding_box] ( identifier[self] , identifier[limits] ):
literal[string]
identifier[is_valid] = identifier[np] . identifier[logical_and] (
identifier[self] . identifier[catalogue] . identifier[data] [ literal[string] ]>= identifier[limits] [ literal[int] ],
... | def within_bounding_box(self, limits):
"""
Selects the earthquakes within a bounding box.
:parameter limits:
A list or a numpy array with four elements in the following order:
- min x (longitude)
- min y (latitude)
- max x (longitude)
... |
def _classify_no_operation(self, regs_init, regs_fini, mem_fini, written_regs, read_regs):
"""Classify no-operation gadgets.
"""
# TODO: Flags should be taken into account
matches = []
# Check that registers didn't change their value.
regs_changed = any(regs_init[r] != ... | def function[_classify_no_operation, parameter[self, regs_init, regs_fini, mem_fini, written_regs, read_regs]]:
constant[Classify no-operation gadgets.
]
variable[matches] assign[=] list[[]]
variable[regs_changed] assign[=] call[name[any], parameter[<ast.GeneratorExp object at 0x7da1b26a... | keyword[def] identifier[_classify_no_operation] ( identifier[self] , identifier[regs_init] , identifier[regs_fini] , identifier[mem_fini] , identifier[written_regs] , identifier[read_regs] ):
literal[string]
identifier[matches] =[]
identifier[regs_changed] = identifier[... | def _classify_no_operation(self, regs_init, regs_fini, mem_fini, written_regs, read_regs):
"""Classify no-operation gadgets.
"""
# TODO: Flags should be taken into account
matches = []
# Check that registers didn't change their value.
regs_changed = any((regs_init[r] != regs_fini[r] for r in... |
def has_cache(self):
"""Intended to be called before any call that might access the
cache. If the cache is not selected, then returns False,
otherwise the cache is build if needed and returns True."""
if not self.cache_enabled:
return False
if self._cache is None:
... | def function[has_cache, parameter[self]]:
constant[Intended to be called before any call that might access the
cache. If the cache is not selected, then returns False,
otherwise the cache is build if needed and returns True.]
if <ast.UnaryOp object at 0x7da2047e9150> begin[:]
ret... | keyword[def] identifier[has_cache] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[cache_enabled] :
keyword[return] keyword[False]
keyword[if] identifier[self] . identifier[_cache] keyword[is] keyword[None] :
ide... | def has_cache(self):
"""Intended to be called before any call that might access the
cache. If the cache is not selected, then returns False,
otherwise the cache is build if needed and returns True."""
if not self.cache_enabled:
return False # depends on [control=['if'], data=[]]
if ... |
def set_elems(self, subs, vals):
"""set_elems(subs, vals) sets the array elements specified by the list
of subscript values subs (each element of subs is a tuple of
subscripts identifying an array element) to the corresponding value
in vals."""
if isinstance(vals, (int,... | def function[set_elems, parameter[self, subs, vals]]:
constant[set_elems(subs, vals) sets the array elements specified by the list
of subscript values subs (each element of subs is a tuple of
subscripts identifying an array element) to the corresponding value
in vals.]
... | keyword[def] identifier[set_elems] ( identifier[self] , identifier[subs] , identifier[vals] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[vals] ,( identifier[int] , identifier[float] )):
identifier[vals] =[ identifier[vals] ]* identifier[len] ( identifier... | def set_elems(self, subs, vals):
"""set_elems(subs, vals) sets the array elements specified by the list
of subscript values subs (each element of subs is a tuple of
subscripts identifying an array element) to the corresponding value
in vals."""
if isinstance(vals, (int, float))... |
def reset(self):
""" Add a RESET message to the outgoing queue, send
it and consume all remaining messages.
"""
def fail(metadata):
raise ProtocolError("RESET failed %r" % metadata)
log_debug("[#%04X] C: RESET", self.local_port)
self._append(b"\x0F", respon... | def function[reset, parameter[self]]:
constant[ Add a RESET message to the outgoing queue, send
it and consume all remaining messages.
]
def function[fail, parameter[metadata]]:
<ast.Raise object at 0x7da207f01f30>
call[name[log_debug], parameter[constant[[#%04X] C: RESE... | keyword[def] identifier[reset] ( identifier[self] ):
literal[string]
keyword[def] identifier[fail] ( identifier[metadata] ):
keyword[raise] identifier[ProtocolError] ( literal[string] % identifier[metadata] )
identifier[log_debug] ( literal[string] , identifier[self] . ide... | def reset(self):
""" Add a RESET message to the outgoing queue, send
it and consume all remaining messages.
"""
def fail(metadata):
raise ProtocolError('RESET failed %r' % metadata)
log_debug('[#%04X] C: RESET', self.local_port)
self._append(b'\x0f', response=Response(self, on_... |
def _fetch_dimensions(self, dataset):
""" Declaring available dimensions like this is not mandatory,
but nice, especially if they differ from dataset to dataset.
If you are using a built in datatype, you can specify the dialect
you are expecting, to have values normalized. This scrap... | def function[_fetch_dimensions, parameter[self, dataset]]:
constant[ Declaring available dimensions like this is not mandatory,
but nice, especially if they differ from dataset to dataset.
If you are using a built in datatype, you can specify the dialect
you are expecting, to have va... | keyword[def] identifier[_fetch_dimensions] ( identifier[self] , identifier[dataset] ):
literal[string]
keyword[yield] identifier[Dimension] ( literal[string] ,
identifier[label] = literal[string] ,
identifier[datatype] = literal[string] ,
identifier[dialect] = literal[st... | def _fetch_dimensions(self, dataset):
""" Declaring available dimensions like this is not mandatory,
but nice, especially if they differ from dataset to dataset.
If you are using a built in datatype, you can specify the dialect
you are expecting, to have values normalized. This scraper w... |
def _srels_for(phys_reader, source_uri):
"""
Return |_SerializedRelationshipCollection| instance populated with
relationships for source identified by *source_uri*.
"""
rels_xml = phys_reader.rels_xml_for(source_uri)
return _SerializedRelationshipCollection.load_from_xml(... | def function[_srels_for, parameter[phys_reader, source_uri]]:
constant[
Return |_SerializedRelationshipCollection| instance populated with
relationships for source identified by *source_uri*.
]
variable[rels_xml] assign[=] call[name[phys_reader].rels_xml_for, parameter[name[sourc... | keyword[def] identifier[_srels_for] ( identifier[phys_reader] , identifier[source_uri] ):
literal[string]
identifier[rels_xml] = identifier[phys_reader] . identifier[rels_xml_for] ( identifier[source_uri] )
keyword[return] identifier[_SerializedRelationshipCollection] . identifier[load_fr... | def _srels_for(phys_reader, source_uri):
"""
Return |_SerializedRelationshipCollection| instance populated with
relationships for source identified by *source_uri*.
"""
rels_xml = phys_reader.rels_xml_for(source_uri)
return _SerializedRelationshipCollection.load_from_xml(source_uri.b... |
def writeGlyph(self,
name,
unicodes=None,
location=None,
masters=None,
note=None,
mute=False,
):
""" Add a new glyph to the current instance.
* name: the glyph name. Required.
* unicodes: unicode values f... | def function[writeGlyph, parameter[self, name, unicodes, location, masters, note, mute]]:
constant[ Add a new glyph to the current instance.
* name: the glyph name. Required.
* unicodes: unicode values for this glyph if it needs to be different from the unicode values associated with thi... | keyword[def] identifier[writeGlyph] ( identifier[self] ,
identifier[name] ,
identifier[unicodes] = keyword[None] ,
identifier[location] = keyword[None] ,
identifier[masters] = keyword[None] ,
identifier[note] = keyword[None] ,
identifier[mute] = keyword[False] ,
):
literal[string]
keyword[if]... | def writeGlyph(self, name, unicodes=None, location=None, masters=None, note=None, mute=False):
""" Add a new glyph to the current instance.
* name: the glyph name. Required.
* unicodes: unicode values for this glyph if it needs to be different from the unicode values associated with this gly... |
def plotBrightLimitInV(gBright, pdf=False, png=False):
"""
Plot the bright limit of Gaia in V as a function of (V-I).
Parameters
----------
gBright - The bright limit of Gaia in G
"""
vmini=np.linspace(0.0,6.0,1001)
gminv=gminvFromVmini(vmini)
vBright=gBright-gminv
fig=plt.figure(figsize=(10,6.5)... | def function[plotBrightLimitInV, parameter[gBright, pdf, png]]:
constant[
Plot the bright limit of Gaia in V as a function of (V-I).
Parameters
----------
gBright - The bright limit of Gaia in G
]
variable[vmini] assign[=] call[name[np].linspace, parameter[constant[0.0], constant[6.0], const... | keyword[def] identifier[plotBrightLimitInV] ( identifier[gBright] , identifier[pdf] = keyword[False] , identifier[png] = keyword[False] ):
literal[string]
identifier[vmini] = identifier[np] . identifier[linspace] ( literal[int] , literal[int] , literal[int] )
identifier[gminv] = identifier[gminvFromVmini] (... | def plotBrightLimitInV(gBright, pdf=False, png=False):
"""
Plot the bright limit of Gaia in V as a function of (V-I).
Parameters
----------
gBright - The bright limit of Gaia in G
"""
vmini = np.linspace(0.0, 6.0, 1001)
gminv = gminvFromVmini(vmini)
vBright = gBright - gminv
fig = plt.fi... |
def _get_concatenation(extractors, text, *, ignore_whitespace=True):
"""Returns a concatenation ParseNode whose children are the nodes returned by each of the
methods in the extractors enumerable.
If ignore_whitespace is True, whitespace will be ignored and then attached to the child it
preceeded.
"""
igno... | def function[_get_concatenation, parameter[extractors, text]]:
constant[Returns a concatenation ParseNode whose children are the nodes returned by each of the
methods in the extractors enumerable.
If ignore_whitespace is True, whitespace will be ignored and then attached to the child it
preceeded.
]
... | keyword[def] identifier[_get_concatenation] ( identifier[extractors] , identifier[text] ,*, identifier[ignore_whitespace] = keyword[True] ):
literal[string]
identifier[ignored_ws] , identifier[use_text] = identifier[_split_ignored] ( identifier[text] , identifier[ignore_whitespace] )
identifier[extractor] ... | def _get_concatenation(extractors, text, *, ignore_whitespace=True):
"""Returns a concatenation ParseNode whose children are the nodes returned by each of the
methods in the extractors enumerable.
If ignore_whitespace is True, whitespace will be ignored and then attached to the child it
preceeded.
"""
... |
def _ars_to_proxies(ars):
"""wait for async results and return proxy objects
Args:
ars: AsyncResult (or sequence of AsyncResults), each result type ``Ref``.
Returns:
Remote* proxy object (or list of them)
"""
if (isinstance(ars, Remote) or
isinstance(ars, numbers.Number) or
... | def function[_ars_to_proxies, parameter[ars]]:
constant[wait for async results and return proxy objects
Args:
ars: AsyncResult (or sequence of AsyncResults), each result type ``Ref``.
Returns:
Remote* proxy object (or list of them)
]
if <ast.BoolOp object at 0x7da1afea5f90> begi... | keyword[def] identifier[_ars_to_proxies] ( identifier[ars] ):
literal[string]
keyword[if] ( identifier[isinstance] ( identifier[ars] , identifier[Remote] ) keyword[or]
identifier[isinstance] ( identifier[ars] , identifier[numbers] . identifier[Number] ) keyword[or]
identifier[ars] keyword[is] ... | def _ars_to_proxies(ars):
"""wait for async results and return proxy objects
Args:
ars: AsyncResult (or sequence of AsyncResults), each result type ``Ref``.
Returns:
Remote* proxy object (or list of them)
"""
if isinstance(ars, Remote) or isinstance(ars, numbers.Number) or ars is None:
... |
def htmlCtxtUseOptions(self, options):
"""Applies the options to the parser context """
ret = libxml2mod.htmlCtxtUseOptions(self._o, options)
return ret | def function[htmlCtxtUseOptions, parameter[self, options]]:
constant[Applies the options to the parser context ]
variable[ret] assign[=] call[name[libxml2mod].htmlCtxtUseOptions, parameter[name[self]._o, name[options]]]
return[name[ret]] | keyword[def] identifier[htmlCtxtUseOptions] ( identifier[self] , identifier[options] ):
literal[string]
identifier[ret] = identifier[libxml2mod] . identifier[htmlCtxtUseOptions] ( identifier[self] . identifier[_o] , identifier[options] )
keyword[return] identifier[ret] | def htmlCtxtUseOptions(self, options):
"""Applies the options to the parser context """
ret = libxml2mod.htmlCtxtUseOptions(self._o, options)
return ret |
def do_cat(self, line):
"""cat FILENAME...
Concatenates files and sends to stdout.
"""
# note: when we get around to supporting cat from stdin, we'll need
# to write stdin to a temp file, and then copy the file
# since we need to know the filesize when cop... | def function[do_cat, parameter[self, line]]:
constant[cat FILENAME...
Concatenates files and sends to stdout.
]
variable[args] assign[=] call[name[self].line_to_args, parameter[name[line]]]
for taget[name[filename]] in starred[name[args]] begin[:]
variable[fil... | keyword[def] identifier[do_cat] ( identifier[self] , identifier[line] ):
literal[string]
identifier[args] = identifier[self] . identifier[line_to_args] ( identifier[line] )
keyword[for] identifier[filename] keyword[in] identifier[args] :
identifie... | def do_cat(self, line):
"""cat FILENAME...
Concatenates files and sends to stdout.
"""
# note: when we get around to supporting cat from stdin, we'll need
# to write stdin to a temp file, and then copy the file
# since we need to know the filesize when copying to the pybo... |
def get_contact_by_email(self, email):
""" Returns a Contact by it's email
:param email: email to get contact for
:return: Contact for specified email
:rtype: Contact
"""
if not email:
return None
email = email.strip()
query = self.q().any(co... | def function[get_contact_by_email, parameter[self, email]]:
constant[ Returns a Contact by it's email
:param email: email to get contact for
:return: Contact for specified email
:rtype: Contact
]
if <ast.UnaryOp object at 0x7da1b1b0f790> begin[:]
return[constant[... | keyword[def] identifier[get_contact_by_email] ( identifier[self] , identifier[email] ):
literal[string]
keyword[if] keyword[not] identifier[email] :
keyword[return] keyword[None]
identifier[email] = identifier[email] . identifier[strip] ()
identifier[query] = ide... | def get_contact_by_email(self, email):
""" Returns a Contact by it's email
:param email: email to get contact for
:return: Contact for specified email
:rtype: Contact
"""
if not email:
return None # depends on [control=['if'], data=[]]
email = email.strip()
quer... |
def get_serializer(name):
'''
Return the serialize function.
'''
try:
log.debug('Using %s as serializer', name)
return SERIALIZER_LOOKUP[name]
except KeyError:
msg = 'Serializer {} is not available'.format(name)
log.error(msg, exc_info=True)
raise InvalidSeria... | def function[get_serializer, parameter[name]]:
constant[
Return the serialize function.
]
<ast.Try object at 0x7da1b157dc00> | keyword[def] identifier[get_serializer] ( identifier[name] ):
literal[string]
keyword[try] :
identifier[log] . identifier[debug] ( literal[string] , identifier[name] )
keyword[return] identifier[SERIALIZER_LOOKUP] [ identifier[name] ]
keyword[except] identifier[KeyError] :
... | def get_serializer(name):
"""
Return the serialize function.
"""
try:
log.debug('Using %s as serializer', name)
return SERIALIZER_LOOKUP[name] # depends on [control=['try'], data=[]]
except KeyError:
msg = 'Serializer {} is not available'.format(name)
log.error(msg, ... |
def delete_entity(self, partition_key, row_key,
if_match='*'):
'''
Adds a delete entity operation to the batch. See
:func:`~azure.storage.table.tableservice.TableService.delete_entity` for more
information on deletes.
The operation will not be executed un... | def function[delete_entity, parameter[self, partition_key, row_key, if_match]]:
constant[
Adds a delete entity operation to the batch. See
:func:`~azure.storage.table.tableservice.TableService.delete_entity` for more
information on deletes.
The operation will not be executed u... | keyword[def] identifier[delete_entity] ( identifier[self] , identifier[partition_key] , identifier[row_key] ,
identifier[if_match] = literal[string] ):
literal[string]
identifier[request] = identifier[_delete_entity] ( identifier[partition_key] , identifier[row_key] , identifier[if_match] )
... | def delete_entity(self, partition_key, row_key, if_match='*'):
"""
Adds a delete entity operation to the batch. See
:func:`~azure.storage.table.tableservice.TableService.delete_entity` for more
information on deletes.
The operation will not be executed until the batch is committed... |
def vwap(bars):
"""
calculate vwap of entire time series
(input can be pandas series or numpy array)
bars are usually mid [ (h+l)/2 ] or typical [ (h+l+c)/3 ]
"""
typical = ((bars['high'] + bars['low'] + bars['close']) / 3).values
volume = bars['volume'].values
return pd.Series(index=ba... | def function[vwap, parameter[bars]]:
constant[
calculate vwap of entire time series
(input can be pandas series or numpy array)
bars are usually mid [ (h+l)/2 ] or typical [ (h+l+c)/3 ]
]
variable[typical] assign[=] binary_operation[binary_operation[binary_operation[call[name[bars]][cons... | keyword[def] identifier[vwap] ( identifier[bars] ):
literal[string]
identifier[typical] =(( identifier[bars] [ literal[string] ]+ identifier[bars] [ literal[string] ]+ identifier[bars] [ literal[string] ])/ literal[int] ). identifier[values]
identifier[volume] = identifier[bars] [ literal[string] ]. ... | def vwap(bars):
"""
calculate vwap of entire time series
(input can be pandas series or numpy array)
bars are usually mid [ (h+l)/2 ] or typical [ (h+l+c)/3 ]
"""
typical = ((bars['high'] + bars['low'] + bars['close']) / 3).values
volume = bars['volume'].values
return pd.Series(index=bar... |
def checkMultipleFiles(input):
""" Evaluates the input to determine whether there is 1 or more than 1 valid input file.
"""
f,i,o,a=buildFileList(input)
return len(f) > 1 | def function[checkMultipleFiles, parameter[input]]:
constant[ Evaluates the input to determine whether there is 1 or more than 1 valid input file.
]
<ast.Tuple object at 0x7da1b1a7fd60> assign[=] call[name[buildFileList], parameter[name[input]]]
return[compare[call[name[len], parameter[name[f]]]... | keyword[def] identifier[checkMultipleFiles] ( identifier[input] ):
literal[string]
identifier[f] , identifier[i] , identifier[o] , identifier[a] = identifier[buildFileList] ( identifier[input] )
keyword[return] identifier[len] ( identifier[f] )> literal[int] | def checkMultipleFiles(input):
""" Evaluates the input to determine whether there is 1 or more than 1 valid input file.
"""
(f, i, o, a) = buildFileList(input)
return len(f) > 1 |
def send_http_request_with_form_parameters(context, method):
"""
Parameters:
+-------------+--------------+
| param_name | param_value |
+=============+==============+
| param1 | value1 |
+-------------+--------------+
| param2 | value2 |
... | def function[send_http_request_with_form_parameters, parameter[context, method]]:
constant[
Parameters:
+-------------+--------------+
| param_name | param_value |
+=============+==============+
| param1 | value1 |
+-------------+--------------+
... | keyword[def] identifier[send_http_request_with_form_parameters] ( identifier[context] , identifier[method] ):
literal[string]
identifier[safe_add_http_request_context_to_behave_context] ( identifier[context] )
identifier[set_form_parameters] ( identifier[context] )
identifier[send_http_request] (... | def send_http_request_with_form_parameters(context, method):
"""
Parameters:
+-------------+--------------+
| param_name | param_value |
+=============+==============+
| param1 | value1 |
+-------------+--------------+
| param2 | value2 |
... |
def _model_error_corr(self, catchment1, catchment2):
"""
Return model error correlation between subject catchment and other catchment.
Methodology source: Kjeldsen & Jones, 2009, table 3
:param catchment1: catchment to calculate error correlation with
:type catchment1: :class:`... | def function[_model_error_corr, parameter[self, catchment1, catchment2]]:
constant[
Return model error correlation between subject catchment and other catchment.
Methodology source: Kjeldsen & Jones, 2009, table 3
:param catchment1: catchment to calculate error correlation with
... | keyword[def] identifier[_model_error_corr] ( identifier[self] , identifier[catchment1] , identifier[catchment2] ):
literal[string]
identifier[dist] = identifier[catchment1] . identifier[distance_to] ( identifier[catchment2] )
keyword[return] identifier[self] . identifier[_dist_corr] ( ide... | def _model_error_corr(self, catchment1, catchment2):
"""
Return model error correlation between subject catchment and other catchment.
Methodology source: Kjeldsen & Jones, 2009, table 3
:param catchment1: catchment to calculate error correlation with
:type catchment1: :class:`Catc... |
def derive_temporalnetwork(data, params):
"""
Derives connectivity from the data. A lot of data is inherently built with edges
(e.g. communication between two individuals).
However other networks are derived from the covariance of time series
(e.g. brain networks between two regions).
Covaria... | def function[derive_temporalnetwork, parameter[data, params]]:
constant[
Derives connectivity from the data. A lot of data is inherently built with edges
(e.g. communication between two individuals).
However other networks are derived from the covariance of time series
(e.g. brain networks bet... | keyword[def] identifier[derive_temporalnetwork] ( identifier[data] , identifier[params] ):
literal[string]
identifier[report] ={}
keyword[if] literal[string] keyword[not] keyword[in] identifier[params] . identifier[keys] ():
identifier[params] [ literal[string] ]= literal[string]
... | def derive_temporalnetwork(data, params):
"""
Derives connectivity from the data. A lot of data is inherently built with edges
(e.g. communication between two individuals).
However other networks are derived from the covariance of time series
(e.g. brain networks between two regions).
Covaria... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.