code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def parse_radia_multi_alt(infile, outfile):
"""
This function will parse the vcf to detect sites having multiple alt alleles and pick out on the
most likely ones.
INFILE : open file handle for the input vcf
OUTFILE : open file handle for the output vcf
The columns in INFILE are
[0] CHROM
... | def function[parse_radia_multi_alt, parameter[infile, outfile]]:
constant[
This function will parse the vcf to detect sites having multiple alt alleles and pick out on the
most likely ones.
INFILE : open file handle for the input vcf
OUTFILE : open file handle for the output vcf
The columns... | keyword[def] identifier[parse_radia_multi_alt] ( identifier[infile] , identifier[outfile] ):
literal[string]
keyword[for] identifier[line] keyword[in] identifier[infile] :
keyword[if] identifier[line] . identifier[startswith] ( literal[string] ):
identifier[print] ( identifie... | def parse_radia_multi_alt(infile, outfile):
"""
This function will parse the vcf to detect sites having multiple alt alleles and pick out on the
most likely ones.
INFILE : open file handle for the input vcf
OUTFILE : open file handle for the output vcf
The columns in INFILE are
[0] CHROM
... |
def _relabel_to_obo(d):
"""Change the keys of ``d`` to use Obo labels.
"""
return {
owl_to_obo.get(old_k, old_k): old_v
for old_k, old_v in six.iteritems(d)
} | def function[_relabel_to_obo, parameter[d]]:
constant[Change the keys of ``d`` to use Obo labels.
]
return[<ast.DictComp object at 0x7da1b138ac50>] | keyword[def] identifier[_relabel_to_obo] ( identifier[d] ):
literal[string]
keyword[return] {
identifier[owl_to_obo] . identifier[get] ( identifier[old_k] , identifier[old_k] ): identifier[old_v]
keyword[for] identifier[old_k] , identifier[old_v] keyword[in] identifier[six] . ... | def _relabel_to_obo(d):
"""Change the keys of ``d`` to use Obo labels.
"""
return {owl_to_obo.get(old_k, old_k): old_v for (old_k, old_v) in six.iteritems(d)} |
def RegisterAnyElement(cls):
'''If find registered TypeCode instance, add Wrapper class
to TypeCode class serialmap and Re-RegisterType. Provides
Any serialzation of any instances of the Wrapper.
'''
for k,v in cls.types_dict.items():
what = Any.serialmap.get(k)
... | def function[RegisterAnyElement, parameter[cls]]:
constant[If find registered TypeCode instance, add Wrapper class
to TypeCode class serialmap and Re-RegisterType. Provides
Any serialzation of any instances of the Wrapper.
]
for taget[tuple[[<ast.Name object at 0x7da2047e9390>,... | keyword[def] identifier[RegisterAnyElement] ( identifier[cls] ):
literal[string]
keyword[for] identifier[k] , identifier[v] keyword[in] identifier[cls] . identifier[types_dict] . identifier[items] ():
identifier[what] = identifier[Any] . identifier[serialmap] . identifier[get] ( ide... | def RegisterAnyElement(cls):
"""If find registered TypeCode instance, add Wrapper class
to TypeCode class serialmap and Re-RegisterType. Provides
Any serialzation of any instances of the Wrapper.
"""
for (k, v) in cls.types_dict.items():
what = Any.serialmap.get(k)
if w... |
def pa11y_counts(results):
"""
Given a list of pa11y results, return three integers:
number of errors, number of warnings, and number of notices.
"""
num_error = 0
num_warning = 0
num_notice = 0
for result in results:
if result['type'] == 'error':
num_error += 1
... | def function[pa11y_counts, parameter[results]]:
constant[
Given a list of pa11y results, return three integers:
number of errors, number of warnings, and number of notices.
]
variable[num_error] assign[=] constant[0]
variable[num_warning] assign[=] constant[0]
variable[num_no... | keyword[def] identifier[pa11y_counts] ( identifier[results] ):
literal[string]
identifier[num_error] = literal[int]
identifier[num_warning] = literal[int]
identifier[num_notice] = literal[int]
keyword[for] identifier[result] keyword[in] identifier[results] :
keyword[if] ident... | def pa11y_counts(results):
"""
Given a list of pa11y results, return three integers:
number of errors, number of warnings, and number of notices.
"""
num_error = 0
num_warning = 0
num_notice = 0
for result in results:
if result['type'] == 'error':
num_error += 1 # de... |
def find_valid_random_signature(s: int) -> Tuple[int, int]:
"""
Find v and r valid values for a given s
:param s: random value
:return: v, r
"""
for _ in range(10000):
r = int(os.urandom(31).hex(), 16)
v = (r % 2) + 27
if r < secpk1n:
... | def function[find_valid_random_signature, parameter[s]]:
constant[
Find v and r valid values for a given s
:param s: random value
:return: v, r
]
for taget[name[_]] in starred[call[name[range], parameter[constant[10000]]]] begin[:]
variable[r] assign[=] ca... | keyword[def] identifier[find_valid_random_signature] ( identifier[s] : identifier[int] )-> identifier[Tuple] [ identifier[int] , identifier[int] ]:
literal[string]
keyword[for] identifier[_] keyword[in] identifier[range] ( literal[int] ):
identifier[r] = identifier[int] ( identifier... | def find_valid_random_signature(s: int) -> Tuple[int, int]:
"""
Find v and r valid values for a given s
:param s: random value
:return: v, r
"""
for _ in range(10000):
r = int(os.urandom(31).hex(), 16)
v = r % 2 + 27
if r < secpk1n:
tx = Transa... |
def parse_octal(self, text, i):
"""Parse octal value."""
value = int(text, 8)
if value > 0xFF and self.is_bytes:
# Re fails on octal greater than `0o377` or `0xFF`
raise ValueError("octal escape value outside of range 0-0o377!")
else:
single = self.ge... | def function[parse_octal, parameter[self, text, i]]:
constant[Parse octal value.]
variable[value] assign[=] call[name[int], parameter[name[text], constant[8]]]
if <ast.BoolOp object at 0x7da1b04ec6a0> begin[:]
<ast.Raise object at 0x7da1b04efa00> | keyword[def] identifier[parse_octal] ( identifier[self] , identifier[text] , identifier[i] ):
literal[string]
identifier[value] = identifier[int] ( identifier[text] , literal[int] )
keyword[if] identifier[value] > literal[int] keyword[and] identifier[self] . identifier[is_bytes] :
... | def parse_octal(self, text, i):
"""Parse octal value."""
value = int(text, 8)
if value > 255 and self.is_bytes:
# Re fails on octal greater than `0o377` or `0xFF`
raise ValueError('octal escape value outside of range 0-0o377!') # depends on [control=['if'], data=[]]
else:
single... |
def list_nodes(call=None):
'''
Return a list of the VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
ret = {}
nodes = list_nodes_full()
if 'error' in nodes:
... | def function[list_nodes, parameter[call]]:
constant[
Return a list of the VMs that are on the provider
]
if compare[name[call] equal[==] constant[action]] begin[:]
<ast.Raise object at 0x7da1b1c37cd0>
variable[ret] assign[=] dictionary[[], []]
variable[nodes] assign[=] ca... | keyword[def] identifier[list_nodes] ( identifier[call] = keyword[None] ):
literal[string]
keyword[if] identifier[call] == literal[string] :
keyword[raise] identifier[SaltCloudSystemExit] (
literal[string]
)
identifier[ret] ={}
identifier[nodes] = identifier[list_node... | def list_nodes(call=None):
"""
Return a list of the VMs that are on the provider
"""
if call == 'action':
raise SaltCloudSystemExit('The list_nodes function must be called with -f or --function.') # depends on [control=['if'], data=[]]
ret = {}
nodes = list_nodes_full()
if 'error' i... |
def enforce_reset(self):
"""enforce parameter bounds on the ensemble by resetting
violating vals to bound
"""
ub = (self.ubnd * (1.0+self.bound_tol)).to_dict()
lb = (self.lbnd * (1.0 - self.bound_tol)).to_dict()
#for iname,name in enumerate(self.columns):
#se... | def function[enforce_reset, parameter[self]]:
constant[enforce parameter bounds on the ensemble by resetting
violating vals to bound
]
variable[ub] assign[=] call[binary_operation[name[self].ubnd * binary_operation[constant[1.0] + name[self].bound_tol]].to_dict, parameter[]]
vari... | keyword[def] identifier[enforce_reset] ( identifier[self] ):
literal[string]
identifier[ub] =( identifier[self] . identifier[ubnd] *( literal[int] + identifier[self] . identifier[bound_tol] )). identifier[to_dict] ()
identifier[lb] =( identifier[self] . identifier[lbnd] *( literal[int] - ... | def enforce_reset(self):
"""enforce parameter bounds on the ensemble by resetting
violating vals to bound
"""
ub = (self.ubnd * (1.0 + self.bound_tol)).to_dict()
lb = (self.lbnd * (1.0 - self.bound_tol)).to_dict()
#for iname,name in enumerate(self.columns):
#self.loc[self.loc[:,name]... |
def _on_entry(self, event):
"""
Callback for the Entry widget, sets the Scale variable to the appropriate value.
:param event: Tkinter event
"""
contents = self._entry.get()
if contents == "":
return
try:
value = self._variable.set... | def function[_on_entry, parameter[self, event]]:
constant[
Callback for the Entry widget, sets the Scale variable to the appropriate value.
:param event: Tkinter event
]
variable[contents] assign[=] call[name[self]._entry.get, parameter[]]
if compare[name[content... | keyword[def] identifier[_on_entry] ( identifier[self] , identifier[event] ):
literal[string]
identifier[contents] = identifier[self] . identifier[_entry] . identifier[get] ()
keyword[if] identifier[contents] == literal[string] :
keyword[return]
keyword[try] :
... | def _on_entry(self, event):
"""
Callback for the Entry widget, sets the Scale variable to the appropriate value.
:param event: Tkinter event
"""
contents = self._entry.get()
if contents == '':
return # depends on [control=['if'], data=[]]
try:
value = se... |
def _generate_csv_header_line(*, header_names, header_prefix='', header=True, sep=',', newline='\n'):
"""
Helper function to generate a CSV header line depending on
the combination of arguments provided.
"""
if isinstance(header, str): # user-provided header line
header_line = header + newl... | def function[_generate_csv_header_line, parameter[]]:
constant[
Helper function to generate a CSV header line depending on
the combination of arguments provided.
]
if call[name[isinstance], parameter[name[header], name[str]]] begin[:]
variable[header_line] assign[=] binary_op... | keyword[def] identifier[_generate_csv_header_line] (*, identifier[header_names] , identifier[header_prefix] = literal[string] , identifier[header] = keyword[True] , identifier[sep] = literal[string] , identifier[newline] = literal[string] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[... | def _generate_csv_header_line(*, header_names, header_prefix='', header=True, sep=',', newline='\n'):
"""
Helper function to generate a CSV header line depending on
the combination of arguments provided.
"""
if isinstance(header, str): # user-provided header line
header_line = header + newl... |
def is_widget_required_attribute(widget):
"""
Is this widget required?
"""
if not widget.is_required:
return False
if isinstance(widget, WIDGETS_NO_REQUIRED):
return False
return True | def function[is_widget_required_attribute, parameter[widget]]:
constant[
Is this widget required?
]
if <ast.UnaryOp object at 0x7da1b1d39cc0> begin[:]
return[constant[False]]
if call[name[isinstance], parameter[name[widget], name[WIDGETS_NO_REQUIRED]]] begin[:]
return[con... | keyword[def] identifier[is_widget_required_attribute] ( identifier[widget] ):
literal[string]
keyword[if] keyword[not] identifier[widget] . identifier[is_required] :
keyword[return] keyword[False]
keyword[if] identifier[isinstance] ( identifier[widget] , identifier[WIDGETS_NO_REQUIRED] )... | def is_widget_required_attribute(widget):
"""
Is this widget required?
"""
if not widget.is_required:
return False # depends on [control=['if'], data=[]]
if isinstance(widget, WIDGETS_NO_REQUIRED):
return False # depends on [control=['if'], data=[]]
return True |
def update_value(self, id_number, new_value, metadata=None):
"""
Update a canned value
:type id_number: int
:param id_number: canned value ID number
:type new_value: str
:param new_value: New canned value value
:type metadata: str
:param metadata: Optio... | def function[update_value, parameter[self, id_number, new_value, metadata]]:
constant[
Update a canned value
:type id_number: int
:param id_number: canned value ID number
:type new_value: str
:param new_value: New canned value value
:type metadata: str
... | keyword[def] identifier[update_value] ( identifier[self] , identifier[id_number] , identifier[new_value] , identifier[metadata] = keyword[None] ):
literal[string]
identifier[data] ={
literal[string] : identifier[id_number] ,
literal[string] : identifier[new_value]
}
... | def update_value(self, id_number, new_value, metadata=None):
"""
Update a canned value
:type id_number: int
:param id_number: canned value ID number
:type new_value: str
:param new_value: New canned value value
:type metadata: str
:param metadata: Optional ... |
def with_git(repo,
target_dir=None,
limit=None,
refspec="HEAD",
clone=True,
rev_list_args=None,
version_filter=lambda version: True):
"""
Decorate a project class with git-based version information.
This adds two attributes to a ... | def function[with_git, parameter[repo, target_dir, limit, refspec, clone, rev_list_args, version_filter]]:
constant[
Decorate a project class with git-based version information.
This adds two attributes to a project class:
- A `versions` method that returns a list of available versions
... | keyword[def] identifier[with_git] ( identifier[repo] ,
identifier[target_dir] = keyword[None] ,
identifier[limit] = keyword[None] ,
identifier[refspec] = literal[string] ,
identifier[clone] = keyword[True] ,
identifier[rev_list_args] = keyword[None] ,
identifier[version_filter] = keyword[lambda] identifier[ver... | def with_git(repo, target_dir=None, limit=None, refspec='HEAD', clone=True, rev_list_args=None, version_filter=lambda version: True):
"""
Decorate a project class with git-based version information.
This adds two attributes to a project class:
- A `versions` method that returns a list of available ... |
def get_actions(self, request):
"""Disable the "delete selected" admin action.
Otherwise the action is present even though has_delete_permission is False, it just doesn't
work.
"""
actions = super(CertificateMixin, self).get_actions(request)
actions.pop('delete_selected'... | def function[get_actions, parameter[self, request]]:
constant[Disable the "delete selected" admin action.
Otherwise the action is present even though has_delete_permission is False, it just doesn't
work.
]
variable[actions] assign[=] call[call[name[super], parameter[name[Certifi... | keyword[def] identifier[get_actions] ( identifier[self] , identifier[request] ):
literal[string]
identifier[actions] = identifier[super] ( identifier[CertificateMixin] , identifier[self] ). identifier[get_actions] ( identifier[request] )
identifier[actions] . identifier[pop] ( literal[stri... | def get_actions(self, request):
"""Disable the "delete selected" admin action.
Otherwise the action is present even though has_delete_permission is False, it just doesn't
work.
"""
actions = super(CertificateMixin, self).get_actions(request)
actions.pop('delete_selected', '')
re... |
def artist_top_tracks(self, spotify_id, country):
"""Get an artists top tracks per country with their ID.
Parameters
----------
spotify_id : str
The spotify_id to search by.
country : COUNTRY_TP
COUNTRY
"""
route = Route('GET', '/artists/{... | def function[artist_top_tracks, parameter[self, spotify_id, country]]:
constant[Get an artists top tracks per country with their ID.
Parameters
----------
spotify_id : str
The spotify_id to search by.
country : COUNTRY_TP
COUNTRY
]
variabl... | keyword[def] identifier[artist_top_tracks] ( identifier[self] , identifier[spotify_id] , identifier[country] ):
literal[string]
identifier[route] = identifier[Route] ( literal[string] , literal[string] , identifier[spotify_id] = identifier[spotify_id] )
identifier[payload] ={ literal[strin... | def artist_top_tracks(self, spotify_id, country):
"""Get an artists top tracks per country with their ID.
Parameters
----------
spotify_id : str
The spotify_id to search by.
country : COUNTRY_TP
COUNTRY
"""
route = Route('GET', '/artists/{spotify_... |
def _update_data(self, *data_dict, **kwargs):
"""
A private method to process and update entity values correctly.
:param data: A dictionary of values to be updated for the entity
:param kwargs: keyword arguments with key-value pairs to be updated
"""
# Load each of the ... | def function[_update_data, parameter[self]]:
constant[
A private method to process and update entity values correctly.
:param data: A dictionary of values to be updated for the entity
:param kwargs: keyword arguments with key-value pairs to be updated
]
name[self].errors... | keyword[def] identifier[_update_data] ( identifier[self] ,* identifier[data_dict] ,** identifier[kwargs] ):
literal[string]
identifier[self] . identifier[errors] ={}
keyword[for] identifier[data] keyword[in] identifier[data_dict] :
keyword[if] keyword[not] iden... | def _update_data(self, *data_dict, **kwargs):
"""
A private method to process and update entity values correctly.
:param data: A dictionary of values to be updated for the entity
:param kwargs: keyword arguments with key-value pairs to be updated
"""
# Load each of the fields gi... |
def run_iter(self, mine=False, jid=None):
'''
Execute and yield returns as they come in, do not print to the display
mine
The Single objects will use mine_functions defined in the roster,
pillar, or master config (they will be checked in that order) and
will ... | def function[run_iter, parameter[self, mine, jid]]:
constant[
Execute and yield returns as they come in, do not print to the display
mine
The Single objects will use mine_functions defined in the roster,
pillar, or master config (they will be checked in that order) and
... | keyword[def] identifier[run_iter] ( identifier[self] , identifier[mine] = keyword[False] , identifier[jid] = keyword[None] ):
literal[string]
identifier[fstr] = literal[string] . identifier[format] ( identifier[self] . identifier[opts] [ literal[string] ])
identifier[jid] = identifier[self... | def run_iter(self, mine=False, jid=None):
"""
Execute and yield returns as they come in, do not print to the display
mine
The Single objects will use mine_functions defined in the roster,
pillar, or master config (they will be checked in that order) and
will modi... |
def getQCAnalyses(self):
"""
Return the Quality Control analyses.
:returns: a list of QC analyses
:rtype: List of ReferenceAnalysis/DuplicateAnalysis
"""
qc_types = ['ReferenceAnalysis', 'DuplicateAnalysis']
analyses = self.getAnalyses()
return [a for a in... | def function[getQCAnalyses, parameter[self]]:
constant[
Return the Quality Control analyses.
:returns: a list of QC analyses
:rtype: List of ReferenceAnalysis/DuplicateAnalysis
]
variable[qc_types] assign[=] list[[<ast.Constant object at 0x7da1b2344fd0>, <ast.Constant obj... | keyword[def] identifier[getQCAnalyses] ( identifier[self] ):
literal[string]
identifier[qc_types] =[ literal[string] , literal[string] ]
identifier[analyses] = identifier[self] . identifier[getAnalyses] ()
keyword[return] [ identifier[a] keyword[for] identifier[a] keyword[in] ... | def getQCAnalyses(self):
"""
Return the Quality Control analyses.
:returns: a list of QC analyses
:rtype: List of ReferenceAnalysis/DuplicateAnalysis
"""
qc_types = ['ReferenceAnalysis', 'DuplicateAnalysis']
analyses = self.getAnalyses()
return [a for a in analyses if a.p... |
def _lookup_qrz_callsign(self, callsign=None, apikey=None, apiv="1.3.3"):
""" Performs the callsign lookup against the QRZ.com XML API:
"""
if apikey is None:
raise AttributeError("Session Key Missing")
callsign = callsign.upper()
response = self._request_callsign_... | def function[_lookup_qrz_callsign, parameter[self, callsign, apikey, apiv]]:
constant[ Performs the callsign lookup against the QRZ.com XML API:
]
if compare[name[apikey] is constant[None]] begin[:]
<ast.Raise object at 0x7da1b0f59ed0>
variable[callsign] assign[=] call[name[calls... | keyword[def] identifier[_lookup_qrz_callsign] ( identifier[self] , identifier[callsign] = keyword[None] , identifier[apikey] = keyword[None] , identifier[apiv] = literal[string] ):
literal[string]
keyword[if] identifier[apikey] keyword[is] keyword[None] :
keyword[raise] identifier... | def _lookup_qrz_callsign(self, callsign=None, apikey=None, apiv='1.3.3'):
""" Performs the callsign lookup against the QRZ.com XML API:
"""
if apikey is None:
raise AttributeError('Session Key Missing') # depends on [control=['if'], data=[]]
callsign = callsign.upper()
response = self._... |
def _update_dprx(self):
"""Update `dprx`."""
if 'beta' in self.freeparams:
for r in range(self.nsites):
self.dprx['beta'][r] = self.prx[r] * (self.ln_pi_codon[r]
- scipy.dot(self.ln_pi_codon[r], self.prx[r]))
if 'eta' in self.freeparams:
... | def function[_update_dprx, parameter[self]]:
constant[Update `dprx`.]
if compare[constant[beta] in name[self].freeparams] begin[:]
for taget[name[r]] in starred[call[name[range], parameter[name[self].nsites]]] begin[:]
call[call[name[self].dprx][constant[beta]]][n... | keyword[def] identifier[_update_dprx] ( identifier[self] ):
literal[string]
keyword[if] literal[string] keyword[in] identifier[self] . identifier[freeparams] :
keyword[for] identifier[r] keyword[in] identifier[range] ( identifier[self] . identifier[nsites] ):
ide... | def _update_dprx(self):
"""Update `dprx`."""
if 'beta' in self.freeparams:
for r in range(self.nsites):
self.dprx['beta'][r] = self.prx[r] * (self.ln_pi_codon[r] - scipy.dot(self.ln_pi_codon[r], self.prx[r])) # depends on [control=['for'], data=['r']] # depends on [control=['if'], data=[]]... |
def find(**criteria):
"""
Find a single *component* class with the given criteria.
Finds classes indexed with :meth:`register`
:raises SearchMultipleFoundError: if more than one result found
:raises SearchNoneFoundError: if nothing found
::
from cqparts.search import find
imp... | def function[find, parameter[]]:
constant[
Find a single *component* class with the given criteria.
Finds classes indexed with :meth:`register`
:raises SearchMultipleFoundError: if more than one result found
:raises SearchNoneFoundError: if nothing found
::
from cqparts.search im... | keyword[def] identifier[find] (** identifier[criteria] ):
literal[string]
identifier[results] = identifier[search] (** identifier[criteria] )
keyword[if] identifier[len] ( identifier[results] )> literal[int] :
keyword[raise] identifier[SearchMultipleFoundError] ( literal[string] ... | def find(**criteria):
"""
Find a single *component* class with the given criteria.
Finds classes indexed with :meth:`register`
:raises SearchMultipleFoundError: if more than one result found
:raises SearchNoneFoundError: if nothing found
::
from cqparts.search import find
imp... |
def vec_angle(a, b):
"""
Calculate angle between two vectors
"""
cosang = np.dot(a, b)
sinang = fast_norm(np.cross(a, b))
return np.arctan2(sinang, cosang) | def function[vec_angle, parameter[a, b]]:
constant[
Calculate angle between two vectors
]
variable[cosang] assign[=] call[name[np].dot, parameter[name[a], name[b]]]
variable[sinang] assign[=] call[name[fast_norm], parameter[call[name[np].cross, parameter[name[a], name[b]]]]]
return[c... | keyword[def] identifier[vec_angle] ( identifier[a] , identifier[b] ):
literal[string]
identifier[cosang] = identifier[np] . identifier[dot] ( identifier[a] , identifier[b] )
identifier[sinang] = identifier[fast_norm] ( identifier[np] . identifier[cross] ( identifier[a] , identifier[b] ))
keyword[... | def vec_angle(a, b):
"""
Calculate angle between two vectors
"""
cosang = np.dot(a, b)
sinang = fast_norm(np.cross(a, b))
return np.arctan2(sinang, cosang) |
def mainline(self):
""" Returns the main line of the game (variation A) as a 'GameTree'."""
if self.variations:
return GameTree(self.data + self.variations[0].mainline())
else:
return self | def function[mainline, parameter[self]]:
constant[ Returns the main line of the game (variation A) as a 'GameTree'.]
if name[self].variations begin[:]
return[call[name[GameTree], parameter[binary_operation[name[self].data + call[call[name[self].variations][constant[0]].mainline, parameter[]]]]]] | keyword[def] identifier[mainline] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[variations] :
keyword[return] identifier[GameTree] ( identifier[self] . identifier[data] + identifier[self] . identifier[variations] [ literal[int] ]. identifier[mainline] ())
keyword[else... | def mainline(self):
""" Returns the main line of the game (variation A) as a 'GameTree'."""
if self.variations:
return GameTree(self.data + self.variations[0].mainline()) # depends on [control=['if'], data=[]]
else:
return self |
def overlap(args):
"""
%prog overlap <a|a.fasta> <b|b.fasta>
Check overlaps between two fasta records. The arguments can be genBank IDs
instead of FASTA files. In case of IDs, the sequences will be downloaded
first.
"""
from jcvi.formats.blast import chain_HSPs
p = OptionParser(overlap... | def function[overlap, parameter[args]]:
constant[
%prog overlap <a|a.fasta> <b|b.fasta>
Check overlaps between two fasta records. The arguments can be genBank IDs
instead of FASTA files. In case of IDs, the sequences will be downloaded
first.
]
from relative_module[jcvi.formats.blast] i... | keyword[def] identifier[overlap] ( identifier[args] ):
literal[string]
keyword[from] identifier[jcvi] . identifier[formats] . identifier[blast] keyword[import] identifier[chain_HSPs]
identifier[p] = identifier[OptionParser] ( identifier[overlap] . identifier[__doc__] )
identifier[p] . identi... | def overlap(args):
"""
%prog overlap <a|a.fasta> <b|b.fasta>
Check overlaps between two fasta records. The arguments can be genBank IDs
instead of FASTA files. In case of IDs, the sequences will be downloaded
first.
"""
from jcvi.formats.blast import chain_HSPs
p = OptionParser(overlap.... |
def hardware_flexport_flexport_type_instance(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
hardware = ET.SubElement(config, "hardware", xmlns="urn:brocade.com:mgmt:brocade-hardware")
flexport = ET.SubElement(hardware, "flexport")
id_key = ET.Su... | def function[hardware_flexport_flexport_type_instance, parameter[self]]:
constant[Auto Generated Code
]
variable[config] assign[=] call[name[ET].Element, parameter[constant[config]]]
variable[hardware] assign[=] call[name[ET].SubElement, parameter[name[config], constant[hardware]]]
... | keyword[def] identifier[hardware_flexport_flexport_type_instance] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[config] = identifier[ET] . identifier[Element] ( literal[string] )
identifier[hardware] = identifier[ET] . identifier[SubElement] ( identifier[config] ,... | def hardware_flexport_flexport_type_instance(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element('config')
hardware = ET.SubElement(config, 'hardware', xmlns='urn:brocade.com:mgmt:brocade-hardware')
flexport = ET.SubElement(hardware, 'flexport')
id_key = ET.SubElement(flexport, '... |
def _load_config_include(self, include_directory):
"""Load included configuration files.
Args:
include_directory (str): The name of the config include directory.
Returns:
list: A list of all profiles for the current App.
"""
include_directory = os.path.j... | def function[_load_config_include, parameter[self, include_directory]]:
constant[Load included configuration files.
Args:
include_directory (str): The name of the config include directory.
Returns:
list: A list of all profiles for the current App.
]
vari... | keyword[def] identifier[_load_config_include] ( identifier[self] , identifier[include_directory] ):
literal[string]
identifier[include_directory] = identifier[os] . identifier[path] . identifier[join] ( identifier[self] . identifier[app_path] , identifier[include_directory] )
keyword[if] ... | def _load_config_include(self, include_directory):
"""Load included configuration files.
Args:
include_directory (str): The name of the config include directory.
Returns:
list: A list of all profiles for the current App.
"""
include_directory = os.path.join(self... |
def transform_model(cls) -> None:
"""
Anything that uses the ModelMeta needs _meta and id.
Also keep track of relationships and make them in the related model class.
"""
if cls.name != "Model":
appname = "models"
for mcls in cls.get_children():
if isinstance(mcls, ClassDe... | def function[transform_model, parameter[cls]]:
constant[
Anything that uses the ModelMeta needs _meta and id.
Also keep track of relationships and make them in the related model class.
]
if compare[name[cls].name not_equal[!=] constant[Model]] begin[:]
variable[appname] assig... | keyword[def] identifier[transform_model] ( identifier[cls] )-> keyword[None] :
literal[string]
keyword[if] identifier[cls] . identifier[name] != literal[string] :
identifier[appname] = literal[string]
keyword[for] identifier[mcls] keyword[in] identifier[cls] . identifier[get_children... | def transform_model(cls) -> None:
"""
Anything that uses the ModelMeta needs _meta and id.
Also keep track of relationships and make them in the related model class.
"""
if cls.name != 'Model':
appname = 'models'
for mcls in cls.get_children():
if isinstance(mcls, ClassDe... |
def get_user(self, id):
"""
Returns details about the user for the given id.
Use get_user_by_email() or get_user_by_username() for help
identifiying the id.
"""
self.assert_has_permission('scim.read')
return self._get(self.uri + '/Users/%s' % (id)) | def function[get_user, parameter[self, id]]:
constant[
Returns details about the user for the given id.
Use get_user_by_email() or get_user_by_username() for help
identifiying the id.
]
call[name[self].assert_has_permission, parameter[constant[scim.read]]]
return[cal... | keyword[def] identifier[get_user] ( identifier[self] , identifier[id] ):
literal[string]
identifier[self] . identifier[assert_has_permission] ( literal[string] )
keyword[return] identifier[self] . identifier[_get] ( identifier[self] . identifier[uri] + literal[string] %( identifier[id] )) | def get_user(self, id):
"""
Returns details about the user for the given id.
Use get_user_by_email() or get_user_by_username() for help
identifiying the id.
"""
self.assert_has_permission('scim.read')
return self._get(self.uri + '/Users/%s' % id) |
def _process_json_response(self, response):
''' Process a given response '''
json_response = self._get_json_response(response)
if self.response_callback is not None:
json_response = self.response_callback(json_response)
response._content = json.dumps(json_respon... | def function[_process_json_response, parameter[self, response]]:
constant[ Process a given response ]
variable[json_response] assign[=] call[name[self]._get_json_response, parameter[name[response]]]
if compare[name[self].response_callback is_not constant[None]] begin[:]
variable[... | keyword[def] identifier[_process_json_response] ( identifier[self] , identifier[response] ):
literal[string]
identifier[json_response] = identifier[self] . identifier[_get_json_response] ( identifier[response] )
keyword[if] identifier[self] . identifier[response_callback] keyword[is] ... | def _process_json_response(self, response):
""" Process a given response """
json_response = self._get_json_response(response)
if self.response_callback is not None:
json_response = self.response_callback(json_response)
response._content = json.dumps(json_response) # depends on [control=['i... |
def runDynTask(task):
'''
Run a dynamic task and return the result.
Example:
foo = runDynTask( ('baz.faz.Foo', (), {} ) )
'''
func = getDynLocal(task[0])
if func is None:
raise s_exc.NoSuchFunc(name=task[0])
return func(*task[1], **task[2]) | def function[runDynTask, parameter[task]]:
constant[
Run a dynamic task and return the result.
Example:
foo = runDynTask( ('baz.faz.Foo', (), {} ) )
]
variable[func] assign[=] call[name[getDynLocal], parameter[call[name[task]][constant[0]]]]
if compare[name[func] is consta... | keyword[def] identifier[runDynTask] ( identifier[task] ):
literal[string]
identifier[func] = identifier[getDynLocal] ( identifier[task] [ literal[int] ])
keyword[if] identifier[func] keyword[is] keyword[None] :
keyword[raise] identifier[s_exc] . identifier[NoSuchFunc] ( identifier[name] =... | def runDynTask(task):
"""
Run a dynamic task and return the result.
Example:
foo = runDynTask( ('baz.faz.Foo', (), {} ) )
"""
func = getDynLocal(task[0])
if func is None:
raise s_exc.NoSuchFunc(name=task[0]) # depends on [control=['if'], data=[]]
return func(*task[1], **t... |
def compress_pdf(pdf_fpath, output_fname=None):
""" uses ghostscript to write a pdf """
import utool as ut
ut.assertpath(pdf_fpath)
suffix = '_' + ut.get_datestamp(False) + '_compressed'
print('pdf_fpath = %r' % (pdf_fpath,))
output_pdf_fpath = ut.augpath(pdf_fpath, suffix, newfname=output_fname... | def function[compress_pdf, parameter[pdf_fpath, output_fname]]:
constant[ uses ghostscript to write a pdf ]
import module[utool] as alias[ut]
call[name[ut].assertpath, parameter[name[pdf_fpath]]]
variable[suffix] assign[=] binary_operation[binary_operation[constant[_] + call[name[ut].get_dat... | keyword[def] identifier[compress_pdf] ( identifier[pdf_fpath] , identifier[output_fname] = keyword[None] ):
literal[string]
keyword[import] identifier[utool] keyword[as] identifier[ut]
identifier[ut] . identifier[assertpath] ( identifier[pdf_fpath] )
identifier[suffix] = literal[string] + ide... | def compress_pdf(pdf_fpath, output_fname=None):
""" uses ghostscript to write a pdf """
import utool as ut
ut.assertpath(pdf_fpath)
suffix = '_' + ut.get_datestamp(False) + '_compressed'
print('pdf_fpath = %r' % (pdf_fpath,))
output_pdf_fpath = ut.augpath(pdf_fpath, suffix, newfname=output_fname... |
def set_fixed_parameters(self, parameters):
""" Set parameters of transform """
if not isinstance(parameters, np.ndarray):
parameters = np.asarray(parameters)
libfn = utils.get_lib_fn('setTransformFixedParameters%s'%self._libsuffix)
libfn(self.pointer, parameters.tolist()) | def function[set_fixed_parameters, parameter[self, parameters]]:
constant[ Set parameters of transform ]
if <ast.UnaryOp object at 0x7da1b151a560> begin[:]
variable[parameters] assign[=] call[name[np].asarray, parameter[name[parameters]]]
variable[libfn] assign[=] call[name[utils... | keyword[def] identifier[set_fixed_parameters] ( identifier[self] , identifier[parameters] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[parameters] , identifier[np] . identifier[ndarray] ):
identifier[parameters] = identifier[np] . identifier[asarray... | def set_fixed_parameters(self, parameters):
""" Set parameters of transform """
if not isinstance(parameters, np.ndarray):
parameters = np.asarray(parameters) # depends on [control=['if'], data=[]]
libfn = utils.get_lib_fn('setTransformFixedParameters%s' % self._libsuffix)
libfn(self.pointer, p... |
def _read_feather_columns(path, columns, num_splits): # pragma: no cover
"""Use a Ray task to read columns from Feather into a Pandas DataFrame.
Note: Ray functions are not detected by codecov (thus pragma: no cover)
Args:
path: The path of the Feather file.
columns: The list of column na... | def function[_read_feather_columns, parameter[path, columns, num_splits]]:
constant[Use a Ray task to read columns from Feather into a Pandas DataFrame.
Note: Ray functions are not detected by codecov (thus pragma: no cover)
Args:
path: The path of the Feather file.
columns: The list o... | keyword[def] identifier[_read_feather_columns] ( identifier[path] , identifier[columns] , identifier[num_splits] ):
literal[string]
keyword[from] identifier[pyarrow] keyword[import] identifier[feather]
identifier[df] = identifier[feather] . identifier[read_feather] ( identifier[path] , identifier... | def _read_feather_columns(path, columns, num_splits): # pragma: no cover
'Use a Ray task to read columns from Feather into a Pandas DataFrame.\n\n Note: Ray functions are not detected by codecov (thus pragma: no cover)\n\n Args:\n path: The path of the Feather file.\n columns: The list of colum... |
def imdb(limit=None, shuffle=True):
"""Downloads (and caches) IMDB Moview Reviews. 25k training data, 25k test data
Args:
limit: get only first N items for each class
Returns:
[X_train, y_train, X_test, y_test]
"""
movie_review_url = 'http://ai.stanford.edu/~amaas/data/sentiment/a... | def function[imdb, parameter[limit, shuffle]]:
constant[Downloads (and caches) IMDB Moview Reviews. 25k training data, 25k test data
Args:
limit: get only first N items for each class
Returns:
[X_train, y_train, X_test, y_test]
]
variable[movie_review_url] assign[=] constan... | keyword[def] identifier[imdb] ( identifier[limit] = keyword[None] , identifier[shuffle] = keyword[True] ):
literal[string]
identifier[movie_review_url] = literal[string]
identifier[path] = identifier[keras] . identifier[utils] . identifier[get_file] (
literal[string] , identifier[movie_re... | def imdb(limit=None, shuffle=True):
"""Downloads (and caches) IMDB Moview Reviews. 25k training data, 25k test data
Args:
limit: get only first N items for each class
Returns:
[X_train, y_train, X_test, y_test]
"""
movie_review_url = 'http://ai.stanford.edu/~amaas/data/sentiment/ac... |
def mul(lhs: Any, rhs: Any, default: Any = RaiseTypeErrorIfNotProvided) -> Any:
"""Returns lhs * rhs, or else a default if the operator is not implemented.
This method is mostly used by __pow__ methods trying to return
NotImplemented instead of causing a TypeError.
Args:
lhs: Left hand side of... | def function[mul, parameter[lhs, rhs, default]]:
constant[Returns lhs * rhs, or else a default if the operator is not implemented.
This method is mostly used by __pow__ methods trying to return
NotImplemented instead of causing a TypeError.
Args:
lhs: Left hand side of the multiplication.
... | keyword[def] identifier[mul] ( identifier[lhs] : identifier[Any] , identifier[rhs] : identifier[Any] , identifier[default] : identifier[Any] = identifier[RaiseTypeErrorIfNotProvided] )-> identifier[Any] :
literal[string]
identifier[left_mul] = identifier[getattr] ( identifier[lhs] , literal[string] , ... | def mul(lhs: Any, rhs: Any, default: Any=RaiseTypeErrorIfNotProvided) -> Any:
"""Returns lhs * rhs, or else a default if the operator is not implemented.
This method is mostly used by __pow__ methods trying to return
NotImplemented instead of causing a TypeError.
Args:
lhs: Left hand side of t... |
def password_present(name, password):
'''
Ensures the given password is set on the ESXi host. Passwords cannot be obtained from
host, so if a password is set in this state, the ``vsphere.update_host_password``
function will always run (except when using test=True functionality) and the state's
chang... | def function[password_present, parameter[name, password]]:
constant[
Ensures the given password is set on the ESXi host. Passwords cannot be obtained from
host, so if a password is set in this state, the ``vsphere.update_host_password``
function will always run (except when using test=True functiona... | keyword[def] identifier[password_present] ( identifier[name] , identifier[password] ):
literal[string]
identifier[ret] ={ literal[string] : identifier[name] ,
literal[string] : keyword[True] ,
literal[string] :{ literal[string] : literal[string] ,
literal[string] : literal[string] },
li... | def password_present(name, password):
"""
Ensures the given password is set on the ESXi host. Passwords cannot be obtained from
host, so if a password is set in this state, the ``vsphere.update_host_password``
function will always run (except when using test=True functionality) and the state's
chang... |
def process_exception_message(exception):
"""
Process an exception message.
Args:
exception: The exception to process.
Returns:
A filtered string summarizing the exception.
"""
exception_message = str(exception)
for replace_char in ['\t',... | def function[process_exception_message, parameter[exception]]:
constant[
Process an exception message.
Args:
exception: The exception to process.
Returns:
A filtered string summarizing the exception.
]
variable[exception_message] assign[=] call[n... | keyword[def] identifier[process_exception_message] ( identifier[exception] ):
literal[string]
identifier[exception_message] = identifier[str] ( identifier[exception] )
keyword[for] identifier[replace_char] keyword[in] [ literal[string] , literal[string] , literal[string] ]:
... | def process_exception_message(exception):
"""
Process an exception message.
Args:
exception: The exception to process.
Returns:
A filtered string summarizing the exception.
"""
exception_message = str(exception)
for replace_char in ['\t', '\n', '\\n'... |
def filter_time_frame(start, delta):
"""Filter :class:`.Line` objects by their connection time.
:param start: a time expression (see -s argument on --help for its format)
to filter log lines that are before this time.
:type start: string
:param delta: a relative time expression (see -s argument o... | def function[filter_time_frame, parameter[start, delta]]:
constant[Filter :class:`.Line` objects by their connection time.
:param start: a time expression (see -s argument on --help for its format)
to filter log lines that are before this time.
:type start: string
:param delta: a relative tim... | keyword[def] identifier[filter_time_frame] ( identifier[start] , identifier[delta] ):
literal[string]
identifier[start_value] = identifier[start]
identifier[delta_value] = identifier[delta]
identifier[end_value] = keyword[None]
keyword[if] identifier[start_value] keyword[is] keyword[n... | def filter_time_frame(start, delta):
"""Filter :class:`.Line` objects by their connection time.
:param start: a time expression (see -s argument on --help for its format)
to filter log lines that are before this time.
:type start: string
:param delta: a relative time expression (see -s argument o... |
def match(version, match_expr):
"""Compare two versions through a comparison
:param str version: a version string
:param str match_expr: operator and version; valid operators are
< smaller than
> greater than
>= greator or equal than
<= smaller or equal than
... | def function[match, parameter[version, match_expr]]:
constant[Compare two versions through a comparison
:param str version: a version string
:param str match_expr: operator and version; valid operators are
< smaller than
> greater than
>= greator or equal than
... | keyword[def] identifier[match] ( identifier[version] , identifier[match_expr] ):
literal[string]
identifier[prefix] = identifier[match_expr] [: literal[int] ]
keyword[if] identifier[prefix] keyword[in] ( literal[string] , literal[string] , literal[string] , literal[string] ):
identifier[mat... | def match(version, match_expr):
"""Compare two versions through a comparison
:param str version: a version string
:param str match_expr: operator and version; valid operators are
< smaller than
> greater than
>= greator or equal than
<= smaller or equal than
... |
def _set_snps(self, snps, build=37):
""" Set `_snps` and `_build` properties of this ``Individual``.
Notes
-----
Intended to be used internally to `lineage`.
Parameters
----------
snps : pandas.DataFrame
individual's genetic data normalized for use w... | def function[_set_snps, parameter[self, snps, build]]:
constant[ Set `_snps` and `_build` properties of this ``Individual``.
Notes
-----
Intended to be used internally to `lineage`.
Parameters
----------
snps : pandas.DataFrame
individual's genetic d... | keyword[def] identifier[_set_snps] ( identifier[self] , identifier[snps] , identifier[build] = literal[int] ):
literal[string]
identifier[self] . identifier[_snps] = identifier[snps]
identifier[self] . identifier[_build] = identifier[build] | def _set_snps(self, snps, build=37):
""" Set `_snps` and `_build` properties of this ``Individual``.
Notes
-----
Intended to be used internally to `lineage`.
Parameters
----------
snps : pandas.DataFrame
individual's genetic data normalized for use with ... |
def list_backends(_):
"""List all available backends."""
backends = [b.__name__ for b in available_backends()]
print('\n'.join(backends)) | def function[list_backends, parameter[_]]:
constant[List all available backends.]
variable[backends] assign[=] <ast.ListComp object at 0x7da18eb54070>
call[name[print], parameter[call[constant[
].join, parameter[name[backends]]]]] | keyword[def] identifier[list_backends] ( identifier[_] ):
literal[string]
identifier[backends] =[ identifier[b] . identifier[__name__] keyword[for] identifier[b] keyword[in] identifier[available_backends] ()]
identifier[print] ( literal[string] . identifier[join] ( identifier[backends] )) | def list_backends(_):
"""List all available backends."""
backends = [b.__name__ for b in available_backends()]
print('\n'.join(backends)) |
def generic_is_view_attribute(parents, attrs):
"""Generates is_X_attribute function for given parents and attrs."""
def is_attribute(node):
return _attribute_is_magic(node, attrs, parents)
return is_attribute | def function[generic_is_view_attribute, parameter[parents, attrs]]:
constant[Generates is_X_attribute function for given parents and attrs.]
def function[is_attribute, parameter[node]]:
return[call[name[_attribute_is_magic], parameter[name[node], name[attrs], name[parents]]]]
return[name[is_... | keyword[def] identifier[generic_is_view_attribute] ( identifier[parents] , identifier[attrs] ):
literal[string]
keyword[def] identifier[is_attribute] ( identifier[node] ):
keyword[return] identifier[_attribute_is_magic] ( identifier[node] , identifier[attrs] , identifier[parents] )
keyword[... | def generic_is_view_attribute(parents, attrs):
"""Generates is_X_attribute function for given parents and attrs."""
def is_attribute(node):
return _attribute_is_magic(node, attrs, parents)
return is_attribute |
def configure_logging(verbose, logger):
"""Configures the logging used."""
if not verbose:
log_level = logging.WARNING
elif verbose == 1:
log_level = logging.INFO
else:
log_level = logging.DEBUG
logger.setLevel(log_level)
ch = colorlog.StreamHandler()
ch.setLevel(log_... | def function[configure_logging, parameter[verbose, logger]]:
constant[Configures the logging used.]
if <ast.UnaryOp object at 0x7da1b19cd3f0> begin[:]
variable[log_level] assign[=] name[logging].WARNING
call[name[logger].setLevel, parameter[name[log_level]]]
variable[ch] ... | keyword[def] identifier[configure_logging] ( identifier[verbose] , identifier[logger] ):
literal[string]
keyword[if] keyword[not] identifier[verbose] :
identifier[log_level] = identifier[logging] . identifier[WARNING]
keyword[elif] identifier[verbose] == literal[int] :
identifier... | def configure_logging(verbose, logger):
"""Configures the logging used."""
if not verbose:
log_level = logging.WARNING # depends on [control=['if'], data=[]]
elif verbose == 1:
log_level = logging.INFO # depends on [control=['if'], data=[]]
else:
log_level = logging.DEBUG
l... |
def PreprocessSources(
self, artifacts_registry_object, source_path_specs,
resolver_context=None):
"""Preprocesses the sources.
Args:
artifacts_registry_object (artifacts.ArtifactDefinitionsRegistry):
artifact definitions registry.
source_path_specs (list[dfvfs.PathSpec]): pat... | def function[PreprocessSources, parameter[self, artifacts_registry_object, source_path_specs, resolver_context]]:
constant[Preprocesses the sources.
Args:
artifacts_registry_object (artifacts.ArtifactDefinitionsRegistry):
artifact definitions registry.
source_path_specs (list[dfvfs.Pa... | keyword[def] identifier[PreprocessSources] (
identifier[self] , identifier[artifacts_registry_object] , identifier[source_path_specs] ,
identifier[resolver_context] = keyword[None] ):
literal[string]
identifier[detected_operating_systems] =[]
keyword[for] identifier[source_path_spec] keyword[in] ... | def PreprocessSources(self, artifacts_registry_object, source_path_specs, resolver_context=None):
"""Preprocesses the sources.
Args:
artifacts_registry_object (artifacts.ArtifactDefinitionsRegistry):
artifact definitions registry.
source_path_specs (list[dfvfs.PathSpec]): path specificati... |
def broadcast_status(self, status):
"""Broadcast transient status information to all listeners"""
self._broadcast(
"transient.status",
json.dumps(status),
headers={"expires": str(int((15 + time.time()) * 1000))},
) | def function[broadcast_status, parameter[self, status]]:
constant[Broadcast transient status information to all listeners]
call[name[self]._broadcast, parameter[constant[transient.status], call[name[json].dumps, parameter[name[status]]]]] | keyword[def] identifier[broadcast_status] ( identifier[self] , identifier[status] ):
literal[string]
identifier[self] . identifier[_broadcast] (
literal[string] ,
identifier[json] . identifier[dumps] ( identifier[status] ),
identifier[headers] ={ literal[string] : identif... | def broadcast_status(self, status):
"""Broadcast transient status information to all listeners"""
self._broadcast('transient.status', json.dumps(status), headers={'expires': str(int((15 + time.time()) * 1000))}) |
def cublasSspr(handle, uplo, n, alpha, x, incx, AP):
"""
Rank-1 operation on real symmetric-packed matrix.
"""
status = _libcublas.cublasSspr_v2(handle,
_CUBLAS_FILL_MODE[uplo], n,
c... | def function[cublasSspr, parameter[handle, uplo, n, alpha, x, incx, AP]]:
constant[
Rank-1 operation on real symmetric-packed matrix.
]
variable[status] assign[=] call[name[_libcublas].cublasSspr_v2, parameter[name[handle], call[name[_CUBLAS_FILL_MODE]][name[uplo]], name[n], call[name[ctypes].b... | keyword[def] identifier[cublasSspr] ( identifier[handle] , identifier[uplo] , identifier[n] , identifier[alpha] , identifier[x] , identifier[incx] , identifier[AP] ):
literal[string]
identifier[status] = identifier[_libcublas] . identifier[cublasSspr_v2] ( identifier[handle] ,
identifier[_CUBLAS_FILL... | def cublasSspr(handle, uplo, n, alpha, x, incx, AP):
"""
Rank-1 operation on real symmetric-packed matrix.
"""
status = _libcublas.cublasSspr_v2(handle, _CUBLAS_FILL_MODE[uplo], n, ctypes.byref(ctypes.c_float(alpha)), int(x), incx, int(AP))
cublasCheckStatus(status) |
def set_panel_label(label, ax=None, x=0.05, y=0.9):
"""Add a panel label to the figure/axes, by default in the top-left corner
Parameters
----------
label : str
text to be added as panel label
ax : matplotlib.Axes, optional
panel to which to add the panel label
x : number, defau... | def function[set_panel_label, parameter[label, ax, x, y]]:
constant[Add a panel label to the figure/axes, by default in the top-left corner
Parameters
----------
label : str
text to be added as panel label
ax : matplotlib.Axes, optional
panel to which to add the panel label
... | keyword[def] identifier[set_panel_label] ( identifier[label] , identifier[ax] = keyword[None] , identifier[x] = literal[int] , identifier[y] = literal[int] ):
literal[string]
keyword[def] identifier[_lim_loc] ( identifier[lim] , identifier[loc] ):
keyword[return] identifier[lim] [ literal[int] ]... | def set_panel_label(label, ax=None, x=0.05, y=0.9):
"""Add a panel label to the figure/axes, by default in the top-left corner
Parameters
----------
label : str
text to be added as panel label
ax : matplotlib.Axes, optional
panel to which to add the panel label
x : number, defau... |
def _parse_ND_at_response(self, packet_info):
"""
If the given packet is a successful AT response for an ND
command, parse the parameter field.
"""
if packet_info['id'] == 'at_response' and \
packet_info['command'].lower() == b'nd' and \
packet_inf... | def function[_parse_ND_at_response, parameter[self, packet_info]]:
constant[
If the given packet is a successful AT response for an ND
command, parse the parameter field.
]
if <ast.BoolOp object at 0x7da1b1b86a70> begin[:]
variable[result] assign[=] dictionary[[],... | keyword[def] identifier[_parse_ND_at_response] ( identifier[self] , identifier[packet_info] ):
literal[string]
keyword[if] identifier[packet_info] [ literal[string] ]== literal[string] keyword[and] identifier[packet_info] [ literal[string] ]. identifier[lower] ()== literal[string] keyword[and] ... | def _parse_ND_at_response(self, packet_info):
"""
If the given packet is a successful AT response for an ND
command, parse the parameter field.
"""
if packet_info['id'] == 'at_response' and packet_info['command'].lower() == b'nd' and (packet_info['status'] == b'\x00'):
result = {... |
def process_pkcs7(self, data, name):
"""
Process PKCS7 signature with certificate in it.
:param data:
:param name:
:return:
"""
from cryptography.hazmat.backends.openssl.backend import backend
from cryptography.hazmat.backends.openssl.x509 import _Certific... | def function[process_pkcs7, parameter[self, data, name]]:
constant[
Process PKCS7 signature with certificate in it.
:param data:
:param name:
:return:
]
from relative_module[cryptography.hazmat.backends.openssl.backend] import module[backend]
from relative_module[... | keyword[def] identifier[process_pkcs7] ( identifier[self] , identifier[data] , identifier[name] ):
literal[string]
keyword[from] identifier[cryptography] . identifier[hazmat] . identifier[backends] . identifier[openssl] . identifier[backend] keyword[import] identifier[backend]
keyword[... | def process_pkcs7(self, data, name):
"""
Process PKCS7 signature with certificate in it.
:param data:
:param name:
:return:
"""
from cryptography.hazmat.backends.openssl.backend import backend
from cryptography.hazmat.backends.openssl.x509 import _Certificate
# DE... |
def format(self, record):
"""
Calls the standard formatter, but will indent all of the log messages
by our current indentation level.
"""
formatted = super(IndentingFormatter, self).format(record)
prefix = ''
if self.add_timestamp:
prefix = self.format... | def function[format, parameter[self, record]]:
constant[
Calls the standard formatter, but will indent all of the log messages
by our current indentation level.
]
variable[formatted] assign[=] call[call[name[super], parameter[name[IndentingFormatter], name[self]]].format, paramet... | keyword[def] identifier[format] ( identifier[self] , identifier[record] ):
literal[string]
identifier[formatted] = identifier[super] ( identifier[IndentingFormatter] , identifier[self] ). identifier[format] ( identifier[record] )
identifier[prefix] = literal[string]
keyword[if] ... | def format(self, record):
"""
Calls the standard formatter, but will indent all of the log messages
by our current indentation level.
"""
formatted = super(IndentingFormatter, self).format(record)
prefix = ''
if self.add_timestamp:
prefix = self.formatTime(record, '%Y-%m-... |
def ranked_attributes(self):
"""
Returns the matrix of ranked attributes from the last run.
:return: the Numpy matrix
:rtype: ndarray
"""
matrix = javabridge.call(self.jobject, "rankedAttributes", "()[[D")
if matrix is None:
return None
else:
... | def function[ranked_attributes, parameter[self]]:
constant[
Returns the matrix of ranked attributes from the last run.
:return: the Numpy matrix
:rtype: ndarray
]
variable[matrix] assign[=] call[name[javabridge].call, parameter[name[self].jobject, constant[rankedAttribut... | keyword[def] identifier[ranked_attributes] ( identifier[self] ):
literal[string]
identifier[matrix] = identifier[javabridge] . identifier[call] ( identifier[self] . identifier[jobject] , literal[string] , literal[string] )
keyword[if] identifier[matrix] keyword[is] keyword[None] :
... | def ranked_attributes(self):
"""
Returns the matrix of ranked attributes from the last run.
:return: the Numpy matrix
:rtype: ndarray
"""
matrix = javabridge.call(self.jobject, 'rankedAttributes', '()[[D')
if matrix is None:
return None # depends on [control=['if'],... |
def setup(self):
"""Continue the run process blocking on MasterControlProgram.run"""
# If the app was invoked to specified to prepend the path, do so now
if self.args.prepend_path:
self._prepend_python_path(self.args.prepend_path) | def function[setup, parameter[self]]:
constant[Continue the run process blocking on MasterControlProgram.run]
if name[self].args.prepend_path begin[:]
call[name[self]._prepend_python_path, parameter[name[self].args.prepend_path]] | keyword[def] identifier[setup] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[args] . identifier[prepend_path] :
identifier[self] . identifier[_prepend_python_path] ( identifier[self] . identifier[args] . identifier[prepend_path] ) | def setup(self):
"""Continue the run process blocking on MasterControlProgram.run"""
# If the app was invoked to specified to prepend the path, do so now
if self.args.prepend_path:
self._prepend_python_path(self.args.prepend_path) # depends on [control=['if'], data=[]] |
def _makeService(self):
"""
Construct a service for the endpoint as described.
"""
if self._endpointService is None:
_service = service
else:
_service = self._endpointService
return _service(
self.description.encode('ascii'), self.facto... | def function[_makeService, parameter[self]]:
constant[
Construct a service for the endpoint as described.
]
if compare[name[self]._endpointService is constant[None]] begin[:]
variable[_service] assign[=] name[service]
return[call[name[_service], parameter[call[name[se... | keyword[def] identifier[_makeService] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_endpointService] keyword[is] keyword[None] :
identifier[_service] = identifier[service]
keyword[else] :
identifier[_service] = identifier[sel... | def _makeService(self):
"""
Construct a service for the endpoint as described.
"""
if self._endpointService is None:
_service = service # depends on [control=['if'], data=[]]
else:
_service = self._endpointService
return _service(self.description.encode('ascii'), self.fa... |
def struct_types(self):
"""
Return an iterator over the struct types defined in
the module. The iterator will yield a TypeRef.
"""
it = ffi.lib.LLVMPY_ModuleTypesIter(self)
return _TypesIterator(it, dict(module=self)) | def function[struct_types, parameter[self]]:
constant[
Return an iterator over the struct types defined in
the module. The iterator will yield a TypeRef.
]
variable[it] assign[=] call[name[ffi].lib.LLVMPY_ModuleTypesIter, parameter[name[self]]]
return[call[name[_TypesIterator... | keyword[def] identifier[struct_types] ( identifier[self] ):
literal[string]
identifier[it] = identifier[ffi] . identifier[lib] . identifier[LLVMPY_ModuleTypesIter] ( identifier[self] )
keyword[return] identifier[_TypesIterator] ( identifier[it] , identifier[dict] ( identifier[module] = id... | def struct_types(self):
"""
Return an iterator over the struct types defined in
the module. The iterator will yield a TypeRef.
"""
it = ffi.lib.LLVMPY_ModuleTypesIter(self)
return _TypesIterator(it, dict(module=self)) |
def lock(self):
'''Lock card with SCardBeginTransaction.'''
component = self.component
while True:
if isinstance(
component,
smartcard.pcsc.PCSCCardConnection.PCSCCardConnection):
hresult = SCardBeginTransaction(component.hcard... | def function[lock, parameter[self]]:
constant[Lock card with SCardBeginTransaction.]
variable[component] assign[=] name[self].component
while constant[True] begin[:]
if call[name[isinstance], parameter[name[component], name[smartcard].pcsc.PCSCCardConnection.PCSCCardConnection]] ... | keyword[def] identifier[lock] ( identifier[self] ):
literal[string]
identifier[component] = identifier[self] . identifier[component]
keyword[while] keyword[True] :
keyword[if] identifier[isinstance] (
identifier[component] ,
identifier[smartcard] ... | def lock(self):
"""Lock card with SCardBeginTransaction."""
component = self.component
while True:
if isinstance(component, smartcard.pcsc.PCSCCardConnection.PCSCCardConnection):
hresult = SCardBeginTransaction(component.hcard)
if 0 != hresult:
raise CardConne... |
def prepare_extensible(self):
"""
This function finishes initialization, must be called once all field descriptors and tag have been filled.
"""
# see if extensible and store cycle len
for k in self._tags:
if "extensible" in k:
cycle_len = int(k.split(... | def function[prepare_extensible, parameter[self]]:
constant[
This function finishes initialization, must be called once all field descriptors and tag have been filled.
]
for taget[name[k]] in starred[name[self]._tags] begin[:]
if compare[constant[extensible] in name[k]] b... | keyword[def] identifier[prepare_extensible] ( identifier[self] ):
literal[string]
keyword[for] identifier[k] keyword[in] identifier[self] . identifier[_tags] :
keyword[if] literal[string] keyword[in] identifier[k] :
identifier[cycle_len] = identifier[int... | def prepare_extensible(self):
"""
This function finishes initialization, must be called once all field descriptors and tag have been filled.
"""
# see if extensible and store cycle len
for k in self._tags:
if 'extensible' in k:
cycle_len = int(k.split(':')[1])
... |
def route_to_route_network(gtfs, walking_threshold, start_time, end_time):
"""
Creates networkx graph where the nodes are bus routes and a edge indicates that there is a possibility to transfer
between the routes
:param gtfs:
:param walking_threshold:
:param start_time:
:param end_time:
... | def function[route_to_route_network, parameter[gtfs, walking_threshold, start_time, end_time]]:
constant[
Creates networkx graph where the nodes are bus routes and a edge indicates that there is a possibility to transfer
between the routes
:param gtfs:
:param walking_threshold:
:param start_... | keyword[def] identifier[route_to_route_network] ( identifier[gtfs] , identifier[walking_threshold] , identifier[start_time] , identifier[end_time] ):
literal[string]
identifier[graph] = identifier[networkx] . identifier[Graph] ()
identifier[routes] = identifier[gtfs] . identifier[get_table] ( literal[... | def route_to_route_network(gtfs, walking_threshold, start_time, end_time):
"""
Creates networkx graph where the nodes are bus routes and a edge indicates that there is a possibility to transfer
between the routes
:param gtfs:
:param walking_threshold:
:param start_time:
:param end_time:
... |
def future_datetime(self, end_date='+30d', tzinfo=None):
"""
Get a DateTime object based on a random date between 1 second form now
and a given date.
Accepts date strings that can be recognized by strtotime().
:param end_date Defaults to "+30d"
:param tzinfo: timezone, i... | def function[future_datetime, parameter[self, end_date, tzinfo]]:
constant[
Get a DateTime object based on a random date between 1 second form now
and a given date.
Accepts date strings that can be recognized by strtotime().
:param end_date Defaults to "+30d"
:param tzin... | keyword[def] identifier[future_datetime] ( identifier[self] , identifier[end_date] = literal[string] , identifier[tzinfo] = keyword[None] ):
literal[string]
keyword[return] identifier[self] . identifier[date_time_between] (
identifier[start_date] = literal[string] , identifier[end_date] =... | def future_datetime(self, end_date='+30d', tzinfo=None):
"""
Get a DateTime object based on a random date between 1 second form now
and a given date.
Accepts date strings that can be recognized by strtotime().
:param end_date Defaults to "+30d"
:param tzinfo: timezone, insta... |
def filter_results(source, results, aggressive):
"""Filter out spurious reports from pycodestyle.
If aggressive is True, we allow possibly unsafe fixes (E711, E712).
"""
non_docstring_string_line_numbers = multiline_string_lines(
source, include_docstrings=False)
all_string_line_numbers = ... | def function[filter_results, parameter[source, results, aggressive]]:
constant[Filter out spurious reports from pycodestyle.
If aggressive is True, we allow possibly unsafe fixes (E711, E712).
]
variable[non_docstring_string_line_numbers] assign[=] call[name[multiline_string_lines], parameter[... | keyword[def] identifier[filter_results] ( identifier[source] , identifier[results] , identifier[aggressive] ):
literal[string]
identifier[non_docstring_string_line_numbers] = identifier[multiline_string_lines] (
identifier[source] , identifier[include_docstrings] = keyword[False] )
identifier[all... | def filter_results(source, results, aggressive):
"""Filter out spurious reports from pycodestyle.
If aggressive is True, we allow possibly unsafe fixes (E711, E712).
"""
non_docstring_string_line_numbers = multiline_string_lines(source, include_docstrings=False)
all_string_line_numbers = multiline... |
def i2c_slave_last_transmit_size(self):
"""Returns the number of bytes transmitted by the slave."""
ret = api.py_aa_i2c_slave_write_stats(self.handle)
_raise_error_if_negative(ret)
return ret | def function[i2c_slave_last_transmit_size, parameter[self]]:
constant[Returns the number of bytes transmitted by the slave.]
variable[ret] assign[=] call[name[api].py_aa_i2c_slave_write_stats, parameter[name[self].handle]]
call[name[_raise_error_if_negative], parameter[name[ret]]]
return[nam... | keyword[def] identifier[i2c_slave_last_transmit_size] ( identifier[self] ):
literal[string]
identifier[ret] = identifier[api] . identifier[py_aa_i2c_slave_write_stats] ( identifier[self] . identifier[handle] )
identifier[_raise_error_if_negative] ( identifier[ret] )
keyword[return... | def i2c_slave_last_transmit_size(self):
"""Returns the number of bytes transmitted by the slave."""
ret = api.py_aa_i2c_slave_write_stats(self.handle)
_raise_error_if_negative(ret)
return ret |
def union_conforms(element: Union, etype, namespace: Dict[str, Any], conforms: Callable) -> bool:
""" Determine whether element conforms to at least one of the types in etype
:param element: element to test
:param etype: type to test against
:param namespace: Namespace to use for resolving forward refe... | def function[union_conforms, parameter[element, etype, namespace, conforms]]:
constant[ Determine whether element conforms to at least one of the types in etype
:param element: element to test
:param etype: type to test against
:param namespace: Namespace to use for resolving forward references
... | keyword[def] identifier[union_conforms] ( identifier[element] : identifier[Union] , identifier[etype] , identifier[namespace] : identifier[Dict] [ identifier[str] , identifier[Any] ], identifier[conforms] : identifier[Callable] )-> identifier[bool] :
literal[string]
keyword[return] identifier[any] ( ident... | def union_conforms(element: Union, etype, namespace: Dict[str, Any], conforms: Callable) -> bool:
""" Determine whether element conforms to at least one of the types in etype
:param element: element to test
:param etype: type to test against
:param namespace: Namespace to use for resolving forward refe... |
def dircolorize(path, name_only=True):
"""Use user dircolors settings to colorize a string which is a path.
If name_only is True, it does this by the name rules (*.x) only; it
will not check the filesystem to colorize things like pipes, block devs,
doors, etc."""
if not name_only:
raise NotI... | def function[dircolorize, parameter[path, name_only]]:
constant[Use user dircolors settings to colorize a string which is a path.
If name_only is True, it does this by the name rules (*.x) only; it
will not check the filesystem to colorize things like pipes, block devs,
doors, etc.]
if <ast.... | keyword[def] identifier[dircolorize] ( identifier[path] , identifier[name_only] = keyword[True] ):
literal[string]
keyword[if] keyword[not] identifier[name_only] :
keyword[raise] identifier[NotImplemented] ( literal[string] )
keyword[for] identifier[k] , identifier[regex] keyword[in] id... | def dircolorize(path, name_only=True):
"""Use user dircolors settings to colorize a string which is a path.
If name_only is True, it does this by the name rules (*.x) only; it
will not check the filesystem to colorize things like pipes, block devs,
doors, etc."""
if not name_only:
raise NotI... |
def portfolio(self) -> List[PortfolioItem]:
"""
List of portfolio items of the default account.
"""
account = self.wrapper.accounts[0]
return [v for v in self.wrapper.portfolio[account].values()] | def function[portfolio, parameter[self]]:
constant[
List of portfolio items of the default account.
]
variable[account] assign[=] call[name[self].wrapper.accounts][constant[0]]
return[<ast.ListComp object at 0x7da20c794f10>] | keyword[def] identifier[portfolio] ( identifier[self] )-> identifier[List] [ identifier[PortfolioItem] ]:
literal[string]
identifier[account] = identifier[self] . identifier[wrapper] . identifier[accounts] [ literal[int] ]
keyword[return] [ identifier[v] keyword[for] identifier[v] keywo... | def portfolio(self) -> List[PortfolioItem]:
"""
List of portfolio items of the default account.
"""
account = self.wrapper.accounts[0]
return [v for v in self.wrapper.portfolio[account].values()] |
def facets(self):
"""Provides facets support. REQUIRES VALID HTTPS!"""
self.verify_integrity()
if self.__facets_enabled:
data = json.dumps({
'trustedFacets' : [{
'version': { 'major': 1, 'minor' : 0 },
'ids': self.__facets_list... | def function[facets, parameter[self]]:
constant[Provides facets support. REQUIRES VALID HTTPS!]
call[name[self].verify_integrity, parameter[]]
if name[self].__facets_enabled begin[:]
variable[data] assign[=] call[name[json].dumps, parameter[dictionary[[<ast.Constant object at 0x7... | keyword[def] identifier[facets] ( identifier[self] ):
literal[string]
identifier[self] . identifier[verify_integrity] ()
keyword[if] identifier[self] . identifier[__facets_enabled] :
identifier[data] = identifier[json] . identifier[dumps] ({
literal[string] :[{
... | def facets(self):
"""Provides facets support. REQUIRES VALID HTTPS!"""
self.verify_integrity()
if self.__facets_enabled:
data = json.dumps({'trustedFacets': [{'version': {'major': 1, 'minor': 0}, 'ids': self.__facets_list}]}, sort_keys=True, indent=2, separators=(',', ': '))
mime = 'applicat... |
def tomof(self, indent=0, maxline=MAX_MOF_LINE):
"""
Return a MOF string with the declaration of this CIM method for use in
a CIM class declaration.
The order of parameters and qualifiers is preserved.
Parameters:
indent (:term:`integer`): Number of spaces to indent ... | def function[tomof, parameter[self, indent, maxline]]:
constant[
Return a MOF string with the declaration of this CIM method for use in
a CIM class declaration.
The order of parameters and qualifiers is preserved.
Parameters:
indent (:term:`integer`): Number of space... | keyword[def] identifier[tomof] ( identifier[self] , identifier[indent] = literal[int] , identifier[maxline] = identifier[MAX_MOF_LINE] ):
literal[string]
identifier[mof] =[]
keyword[if] identifier[self] . identifier[qualifiers] :
identifier[mof] . identifier[append] ( ident... | def tomof(self, indent=0, maxline=MAX_MOF_LINE):
"""
Return a MOF string with the declaration of this CIM method for use in
a CIM class declaration.
The order of parameters and qualifiers is preserved.
Parameters:
indent (:term:`integer`): Number of spaces to indent each... |
def query_repos(gh_session, orgs=None, repos=None, public_only=True):
"""
Yields GitHub3.py repo objects for provided orgs and repo names
If orgs and repos are BOTH empty, execute special mode of getting ALL
repositories from the GitHub Server.
If public_only is True, will return only those repos ... | def function[query_repos, parameter[gh_session, orgs, repos, public_only]]:
constant[
Yields GitHub3.py repo objects for provided orgs and repo names
If orgs and repos are BOTH empty, execute special mode of getting ALL
repositories from the GitHub Server.
If public_only is True, will return o... | keyword[def] identifier[query_repos] ( identifier[gh_session] , identifier[orgs] = keyword[None] , identifier[repos] = keyword[None] , identifier[public_only] = keyword[True] ):
literal[string]
keyword[if] identifier[orgs] keyword[is] keyword[None] :
identifier[orgs] =[]
keyword[if] iden... | def query_repos(gh_session, orgs=None, repos=None, public_only=True):
"""
Yields GitHub3.py repo objects for provided orgs and repo names
If orgs and repos are BOTH empty, execute special mode of getting ALL
repositories from the GitHub Server.
If public_only is True, will return only those repos ... |
def absolute_url (base_url, base_ref, parent_url):
"""
Search for the absolute url to detect the link type. This does not
join any url fragments together!
@param base_url: base url from a link tag
@type base_url: string or None
@param base_ref: base url from <base> tag
@type base_ref: strin... | def function[absolute_url, parameter[base_url, base_ref, parent_url]]:
constant[
Search for the absolute url to detect the link type. This does not
join any url fragments together!
@param base_url: base url from a link tag
@type base_url: string or None
@param base_ref: base url from <base>... | keyword[def] identifier[absolute_url] ( identifier[base_url] , identifier[base_ref] , identifier[parent_url] ):
literal[string]
keyword[if] identifier[base_url] keyword[and] identifier[urlutil] . identifier[url_is_absolute] ( identifier[base_url] ):
keyword[return] identifier[base_url]
k... | def absolute_url(base_url, base_ref, parent_url):
"""
Search for the absolute url to detect the link type. This does not
join any url fragments together!
@param base_url: base url from a link tag
@type base_url: string or None
@param base_ref: base url from <base> tag
@type base_ref: string... |
def produce_projection_explorer(corpus,
category,
word2vec_model=None,
projection_model=None,
embeddings=None,
term_acceptance_re=re.compile('[a-z]{3,}'),
... | def function[produce_projection_explorer, parameter[corpus, category, word2vec_model, projection_model, embeddings, term_acceptance_re, show_axes]]:
constant[
Parameters
----------
corpus : ParsedCorpus
It is highly recommended to use a stoplisted, unigram corpus-- `corpus.get_stoplisted_uni... | keyword[def] identifier[produce_projection_explorer] ( identifier[corpus] ,
identifier[category] ,
identifier[word2vec_model] = keyword[None] ,
identifier[projection_model] = keyword[None] ,
identifier[embeddings] = keyword[None] ,
identifier[term_acceptance_re] = identifier[re] . identifier[compile] ( literal[s... | def produce_projection_explorer(corpus, category, word2vec_model=None, projection_model=None, embeddings=None, term_acceptance_re=re.compile('[a-z]{3,}'), show_axes=False, **kwargs):
"""
Parameters
----------
corpus : ParsedCorpus
It is highly recommended to use a stoplisted, unigram corpus-- `c... |
def read_data(self, size):
"""Receive data from the device.
If the read fails for any reason, an :obj:`IOError` exception
is raised.
:param size: the number of bytes to read.
:type size: int
:return: the data received.
:rtype: list(int)
"""
r... | def function[read_data, parameter[self, size]]:
constant[Receive data from the device.
If the read fails for any reason, an :obj:`IOError` exception
is raised.
:param size: the number of bytes to read.
:type size: int
:return: the data received.
:rtype: list(... | keyword[def] identifier[read_data] ( identifier[self] , identifier[size] ):
literal[string]
identifier[result] = identifier[list] ()
keyword[while] identifier[size] > literal[int] :
identifier[count] = identifier[min] ( identifier[size] , literal[int] )
identifie... | def read_data(self, size):
"""Receive data from the device.
If the read fails for any reason, an :obj:`IOError` exception
is raised.
:param size: the number of bytes to read.
:type size: int
:return: the data received.
:rtype: list(int)
"""
result = ... |
def BSR(cpu, dest, src):
"""
Bit scan reverse.
Searches the source operand (second operand) for the most significant
set bit (1 bit). If a most significant 1 bit is found, its bit index is
stored in the destination operand (first operand). The source operand
can be a reg... | def function[BSR, parameter[cpu, dest, src]]:
constant[
Bit scan reverse.
Searches the source operand (second operand) for the most significant
set bit (1 bit). If a most significant 1 bit is found, its bit index is
stored in the destination operand (first operand). The source o... | keyword[def] identifier[BSR] ( identifier[cpu] , identifier[dest] , identifier[src] ):
literal[string]
identifier[value] = identifier[src] . identifier[read] ()
identifier[flag] = identifier[Operators] . identifier[EXTRACT] ( identifier[value] , identifier[src] . identifier[size] - literal... | def BSR(cpu, dest, src):
"""
Bit scan reverse.
Searches the source operand (second operand) for the most significant
set bit (1 bit). If a most significant 1 bit is found, its bit index is
stored in the destination operand (first operand). The source operand
can be a registe... |
def build_and_filter(base_folder, size_pyramid, factor, thresh_factor=1):
"""Build a filtered pyramid of contact maps
Build a fragment pyramid for multi-scale analysis and remove high sparsity
(i.e. low-coverage) and short fragments.
Parameters
----------
base_folder : str or pathlib.Path
... | def function[build_and_filter, parameter[base_folder, size_pyramid, factor, thresh_factor]]:
constant[Build a filtered pyramid of contact maps
Build a fragment pyramid for multi-scale analysis and remove high sparsity
(i.e. low-coverage) and short fragments.
Parameters
----------
base_fol... | keyword[def] identifier[build_and_filter] ( identifier[base_folder] , identifier[size_pyramid] , identifier[factor] , identifier[thresh_factor] = literal[int] ):
literal[string]
identifier[min_bin_per_contig] = literal[int]
identifier[fact_sub_sampling] = identifier[factor]
identifier[all_pyr... | def build_and_filter(base_folder, size_pyramid, factor, thresh_factor=1):
"""Build a filtered pyramid of contact maps
Build a fragment pyramid for multi-scale analysis and remove high sparsity
(i.e. low-coverage) and short fragments.
Parameters
----------
base_folder : str or pathlib.Path
... |
def resp_graph_raw(dataframe, image_name, dir='./'):
"""Response time graph for raw data
:param pandas.DataFrame dataframe: the raw results dataframe
:param str image_name: the output file name
:param str dir: the output directory
:return: None
"""
factor = int(len(dataframe) / 10)
df =... | def function[resp_graph_raw, parameter[dataframe, image_name, dir]]:
constant[Response time graph for raw data
:param pandas.DataFrame dataframe: the raw results dataframe
:param str image_name: the output file name
:param str dir: the output directory
:return: None
]
variable[facto... | keyword[def] identifier[resp_graph_raw] ( identifier[dataframe] , identifier[image_name] , identifier[dir] = literal[string] ):
literal[string]
identifier[factor] = identifier[int] ( identifier[len] ( identifier[dataframe] )/ literal[int] )
identifier[df] = identifier[dataframe] . identifier[reset_ind... | def resp_graph_raw(dataframe, image_name, dir='./'):
"""Response time graph for raw data
:param pandas.DataFrame dataframe: the raw results dataframe
:param str image_name: the output file name
:param str dir: the output directory
:return: None
"""
factor = int(len(dataframe) / 10)
df =... |
def prepare(self, node):
"""
Initialise values to prepare typing computation.
Reorder functions to avoid dependencies issues and prepare typing
computation setting typing values for Pythonic functions.
"""
def register(name, module):
""" Recursively save fun... | def function[prepare, parameter[self, node]]:
constant[
Initialise values to prepare typing computation.
Reorder functions to avoid dependencies issues and prepare typing
computation setting typing values for Pythonic functions.
]
def function[register, parameter[name, m... | keyword[def] identifier[prepare] ( identifier[self] , identifier[node] ):
literal[string]
keyword[def] identifier[register] ( identifier[name] , identifier[module] ):
literal[string]
keyword[for] identifier[fname] , identifier[function] keyword[in] identifier[module]... | def prepare(self, node):
"""
Initialise values to prepare typing computation.
Reorder functions to avoid dependencies issues and prepare typing
computation setting typing values for Pythonic functions.
"""
def register(name, module):
""" Recursively save function typing... |
def delete(self, drop_database=True):
"""
Delete the site entry
@param drop_database: Drop the sites associated MySQL database
@type drop_database: bool
"""
self.disable()
Session.delete(self)
if drop_database and self.db_name:
mysql = cr... | def function[delete, parameter[self, drop_database]]:
constant[
Delete the site entry
@param drop_database: Drop the sites associated MySQL database
@type drop_database: bool
]
call[name[self].disable, parameter[]]
call[name[Session].delete, parameter[name[se... | keyword[def] identifier[delete] ( identifier[self] , identifier[drop_database] = keyword[True] ):
literal[string]
identifier[self] . identifier[disable] ()
identifier[Session] . identifier[delete] ( identifier[self] )
keyword[if] identifier[drop_database] keyword[and] identifi... | def delete(self, drop_database=True):
"""
Delete the site entry
@param drop_database: Drop the sites associated MySQL database
@type drop_database: bool
"""
self.disable()
Session.delete(self)
if drop_database and self.db_name:
mysql = create_engine('mysql://... |
def chassis_name(self, **kwargs):
"""Get device's chassis name/Model.
Args:
rbridge_id (str): The rbridge ID of the device
callback (function): A function executed upon completion of the
method. The only parameter passed to `callback` will be the
... | def function[chassis_name, parameter[self]]:
constant[Get device's chassis name/Model.
Args:
rbridge_id (str): The rbridge ID of the device
callback (function): A function executed upon completion of the
method. The only parameter passed to `callback` will be th... | keyword[def] identifier[chassis_name] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[namespace] = literal[string]
identifier[rbridge_id] = identifier[kwargs] . identifier[pop] ( literal[string] , literal[string] )
identifier[chassis_name] = literal[string... | def chassis_name(self, **kwargs):
"""Get device's chassis name/Model.
Args:
rbridge_id (str): The rbridge ID of the device
callback (function): A function executed upon completion of the
method. The only parameter passed to `callback` will be the
``E... |
def enable_global_annotations_decorator(flag = True, retrospective = True):
"""Enables or disables global annotation mode via decorators.
See flag global_annotations_decorator.
In contrast to setting the flag directly, this function provides
a retrospective option. If retrospective is true, this will al... | def function[enable_global_annotations_decorator, parameter[flag, retrospective]]:
constant[Enables or disables global annotation mode via decorators.
See flag global_annotations_decorator.
In contrast to setting the flag directly, this function provides
a retrospective option. If retrospective is t... | keyword[def] identifier[enable_global_annotations_decorator] ( identifier[flag] = keyword[True] , identifier[retrospective] = keyword[True] ):
literal[string]
keyword[global] identifier[global_annotations_decorator]
identifier[global_annotations_decorator] = identifier[flag]
keyword[if] ident... | def enable_global_annotations_decorator(flag=True, retrospective=True):
"""Enables or disables global annotation mode via decorators.
See flag global_annotations_decorator.
In contrast to setting the flag directly, this function provides
a retrospective option. If retrospective is true, this will also
... |
def pipe(data, *fns):
"""Apply functions recursively on your data
:param data: the data
:param fns: functions
:returns: an object
>>> inc = lambda x: x + 1
>>> pipe(42, inc, str)
'43'
"""
return reduce(lambda acc, f: f(acc), fns, data) | def function[pipe, parameter[data]]:
constant[Apply functions recursively on your data
:param data: the data
:param fns: functions
:returns: an object
>>> inc = lambda x: x + 1
>>> pipe(42, inc, str)
'43'
]
return[call[name[reduce], parameter[<ast.Lambda object at 0x7da1b1418f... | keyword[def] identifier[pipe] ( identifier[data] ,* identifier[fns] ):
literal[string]
keyword[return] identifier[reduce] ( keyword[lambda] identifier[acc] , identifier[f] : identifier[f] ( identifier[acc] ), identifier[fns] , identifier[data] ) | def pipe(data, *fns):
"""Apply functions recursively on your data
:param data: the data
:param fns: functions
:returns: an object
>>> inc = lambda x: x + 1
>>> pipe(42, inc, str)
'43'
"""
return reduce(lambda acc, f: f(acc), fns, data) |
def write_int8(self, value, little_endian=True):
"""
Pack the value as a signed byte and write 1 byte to the stream.
Args:
value:
little_endian (bool): specify the endianness. (Default) Little endian.
Returns:
int: the number of bytes written.
... | def function[write_int8, parameter[self, value, little_endian]]:
constant[
Pack the value as a signed byte and write 1 byte to the stream.
Args:
value:
little_endian (bool): specify the endianness. (Default) Little endian.
Returns:
int: the number of... | keyword[def] identifier[write_int8] ( identifier[self] , identifier[value] , identifier[little_endian] = keyword[True] ):
literal[string]
keyword[if] identifier[little_endian] :
identifier[endian] = literal[string]
keyword[else] :
identifier[endian] = literal[st... | def write_int8(self, value, little_endian=True):
"""
Pack the value as a signed byte and write 1 byte to the stream.
Args:
value:
little_endian (bool): specify the endianness. (Default) Little endian.
Returns:
int: the number of bytes written.
""... |
def _mulf16(ins):
""" Multiplies 2 32bit (16.16) fixed point numbers. The result is pushed onto the stack.
"""
op1, op2 = tuple(ins.quad[2:])
if _f_ops(op1, op2) is not None:
op1, op2 = _f_ops(op1, op2)
if op2 == 1: # A * 1 => A
output = _f16_oper(op1)
output.a... | def function[_mulf16, parameter[ins]]:
constant[ Multiplies 2 32bit (16.16) fixed point numbers. The result is pushed onto the stack.
]
<ast.Tuple object at 0x7da1b06f9f30> assign[=] call[name[tuple], parameter[call[name[ins].quad][<ast.Slice object at 0x7da1b06face0>]]]
if compare[call[name... | keyword[def] identifier[_mulf16] ( identifier[ins] ):
literal[string]
identifier[op1] , identifier[op2] = identifier[tuple] ( identifier[ins] . identifier[quad] [ literal[int] :])
keyword[if] identifier[_f_ops] ( identifier[op1] , identifier[op2] ) keyword[is] keyword[not] keyword[None] :
... | def _mulf16(ins):
""" Multiplies 2 32bit (16.16) fixed point numbers. The result is pushed onto the stack.
"""
(op1, op2) = tuple(ins.quad[2:])
if _f_ops(op1, op2) is not None:
(op1, op2) = _f_ops(op1, op2)
if op2 == 1: # A * 1 => A
output = _f16_oper(op1)
output... |
def ParseOptions(cls, options, configuration_object):
"""Parses and validates options.
Args:
options (argparse.Namespace): parser options.
configuration_object (CLITool): object to be configured by the argument
helper.
Raises:
BadConfigObject: when the configuration object is o... | def function[ParseOptions, parameter[cls, options, configuration_object]]:
constant[Parses and validates options.
Args:
options (argparse.Namespace): parser options.
configuration_object (CLITool): object to be configured by the argument
helper.
Raises:
BadConfigObject: whe... | keyword[def] identifier[ParseOptions] ( identifier[cls] , identifier[options] , identifier[configuration_object] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[configuration_object] , identifier[tools] . identifier[CLITool] ):
keyword[raise] identifier[errors] . i... | def ParseOptions(cls, options, configuration_object):
"""Parses and validates options.
Args:
options (argparse.Namespace): parser options.
configuration_object (CLITool): object to be configured by the argument
helper.
Raises:
BadConfigObject: when the configuration object is o... |
def load_param(params, ctx=None):
"""same as mx.model.load_checkpoint, but do not load symnet and will convert context"""
if ctx is None:
ctx = mx.cpu()
save_dict = mx.nd.load(params)
arg_params = {}
aux_params = {}
for k, v in save_dict.items():
tp, name = k.split(':', 1)
... | def function[load_param, parameter[params, ctx]]:
constant[same as mx.model.load_checkpoint, but do not load symnet and will convert context]
if compare[name[ctx] is constant[None]] begin[:]
variable[ctx] assign[=] call[name[mx].cpu, parameter[]]
variable[save_dict] assign[=] cal... | keyword[def] identifier[load_param] ( identifier[params] , identifier[ctx] = keyword[None] ):
literal[string]
keyword[if] identifier[ctx] keyword[is] keyword[None] :
identifier[ctx] = identifier[mx] . identifier[cpu] ()
identifier[save_dict] = identifier[mx] . identifier[nd] . identifier[l... | def load_param(params, ctx=None):
"""same as mx.model.load_checkpoint, but do not load symnet and will convert context"""
if ctx is None:
ctx = mx.cpu() # depends on [control=['if'], data=['ctx']]
save_dict = mx.nd.load(params)
arg_params = {}
aux_params = {}
for (k, v) in save_dict.ite... |
def getreferingobjs(self, iddgroups=None, fields=None):
"""Get a list of objects that refer to this object"""
return getreferingobjs(self, iddgroups=iddgroups, fields=fields) | def function[getreferingobjs, parameter[self, iddgroups, fields]]:
constant[Get a list of objects that refer to this object]
return[call[name[getreferingobjs], parameter[name[self]]]] | keyword[def] identifier[getreferingobjs] ( identifier[self] , identifier[iddgroups] = keyword[None] , identifier[fields] = keyword[None] ):
literal[string]
keyword[return] identifier[getreferingobjs] ( identifier[self] , identifier[iddgroups] = identifier[iddgroups] , identifier[fields] = identifi... | def getreferingobjs(self, iddgroups=None, fields=None):
"""Get a list of objects that refer to this object"""
return getreferingobjs(self, iddgroups=iddgroups, fields=fields) |
def _safe_cache(memory, func, **kwargs):
""" A wrapper for mem.cache that flushes the cache if the version
number of nibabel has changed.
"""
cachedir = memory.cachedir
if cachedir is None or cachedir in __CACHE_CHECKED:
return memory.cache(func, **kwargs)
version_file = os.path.jo... | def function[_safe_cache, parameter[memory, func]]:
constant[ A wrapper for mem.cache that flushes the cache if the version
number of nibabel has changed.
]
variable[cachedir] assign[=] name[memory].cachedir
if <ast.BoolOp object at 0x7da1b008f4c0> begin[:]
return[call[name[m... | keyword[def] identifier[_safe_cache] ( identifier[memory] , identifier[func] ,** identifier[kwargs] ):
literal[string]
identifier[cachedir] = identifier[memory] . identifier[cachedir]
keyword[if] identifier[cachedir] keyword[is] keyword[None] keyword[or] identifier[cachedir] keyword[in] ident... | def _safe_cache(memory, func, **kwargs):
""" A wrapper for mem.cache that flushes the cache if the version
number of nibabel has changed.
"""
cachedir = memory.cachedir
if cachedir is None or cachedir in __CACHE_CHECKED:
return memory.cache(func, **kwargs) # depends on [control=['if'], ... |
def serve(info, host, port, reload, debugger, eager_loading, with_threads):
'''
Runs a local udata development server.
This local server is recommended for development purposes only but it
can also be used for simple intranet deployments.
By default it will not support any sort of concurrency at a... | def function[serve, parameter[info, host, port, reload, debugger, eager_loading, with_threads]]:
constant[
Runs a local udata development server.
This local server is recommended for development purposes only but it
can also be used for simple intranet deployments.
By default it will not suppo... | keyword[def] identifier[serve] ( identifier[info] , identifier[host] , identifier[port] , identifier[reload] , identifier[debugger] , identifier[eager_loading] , identifier[with_threads] ):
literal[string]
identifier[logger] = identifier[logging] . identifier[getLogger] ( literal[string] )
i... | def serve(info, host, port, reload, debugger, eager_loading, with_threads):
"""
Runs a local udata development server.
This local server is recommended for development purposes only but it
can also be used for simple intranet deployments.
By default it will not support any sort of concurrency at a... |
def _all(self, *args, **kwargs):
'''
Return all the summary of the particular system.
'''
data = dict()
data['software'] = self._software(**kwargs)
data['system'] = self._system(**kwargs)
data['services'] = self._services(**kwargs)
try:
data['c... | def function[_all, parameter[self]]:
constant[
Return all the summary of the particular system.
]
variable[data] assign[=] call[name[dict], parameter[]]
call[name[data]][constant[software]] assign[=] call[name[self]._software, parameter[]]
call[name[data]][constant[system... | keyword[def] identifier[_all] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[data] = identifier[dict] ()
identifier[data] [ literal[string] ]= identifier[self] . identifier[_software] (** identifier[kwargs] )
identifier[data] [ literal[... | def _all(self, *args, **kwargs):
"""
Return all the summary of the particular system.
"""
data = dict()
data['software'] = self._software(**kwargs)
data['system'] = self._system(**kwargs)
data['services'] = self._services(**kwargs)
try:
data['configuration'] = self._confi... |
def get_adjusted_value(
self,
assets,
field,
dt,
perspective_dt,
data_frequency):
'''
TODO:
for external data (fetch_csv) support, need to update logic here.
'''
return self.backend.get_spot_value(
... | def function[get_adjusted_value, parameter[self, assets, field, dt, perspective_dt, data_frequency]]:
constant[
TODO:
for external data (fetch_csv) support, need to update logic here.
]
return[call[name[self].backend.get_spot_value, parameter[name[assets], name[field], name[dt], name... | keyword[def] identifier[get_adjusted_value] (
identifier[self] ,
identifier[assets] ,
identifier[field] ,
identifier[dt] ,
identifier[perspective_dt] ,
identifier[data_frequency] ):
literal[string]
keyword[return] identifier[self] . identifier[backend] . identifier[get_spot_value] (
... | def get_adjusted_value(self, assets, field, dt, perspective_dt, data_frequency):
"""
TODO:
for external data (fetch_csv) support, need to update logic here.
"""
return self.backend.get_spot_value(assets, field, dt, data_frequency, self.quantopian_compatible) |
def write_json_flag(flag, fobj, **kwargs):
"""Write a `DataQualityFlag` to a JSON file
Parameters
----------
flag : `DataQualityFlag`
data to write
fobj : `str`, `file`
target file (or filename) to write
**kwargs
other keyword arguments to pass to :func:`json.dump`
... | def function[write_json_flag, parameter[flag, fobj]]:
constant[Write a `DataQualityFlag` to a JSON file
Parameters
----------
flag : `DataQualityFlag`
data to write
fobj : `str`, `file`
target file (or filename) to write
**kwargs
other keyword arguments to pass to ... | keyword[def] identifier[write_json_flag] ( identifier[flag] , identifier[fobj] ,** identifier[kwargs] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[fobj] , identifier[string_types] ):
keyword[with] identifier[open] ( identifier[fobj] , literal[string] ) keyword[as] ide... | def write_json_flag(flag, fobj, **kwargs):
"""Write a `DataQualityFlag` to a JSON file
Parameters
----------
flag : `DataQualityFlag`
data to write
fobj : `str`, `file`
target file (or filename) to write
**kwargs
other keyword arguments to pass to :func:`json.dump`
... |
def _position_autocorrelation_fitting_eqn(t, Gamma, AngTrapFreq):
"""
The value of the fitting equation:
exp(-t*Gamma/2) * (cos(t* sqrt(Omega**2 - Gamma**2 /4)) + Gamma* sin(t* sqrt(Omega**2-Gamma**2 /4))/(2* sqrt(Omega**2 - Gamma**2 /4)))
[eqn 4.20 taken from DOI: DOI: 10.1007/978-1-4614-6031-2]
to... | def function[_position_autocorrelation_fitting_eqn, parameter[t, Gamma, AngTrapFreq]]:
constant[
The value of the fitting equation:
exp(-t*Gamma/2) * (cos(t* sqrt(Omega**2 - Gamma**2 /4)) + Gamma* sin(t* sqrt(Omega**2-Gamma**2 /4))/(2* sqrt(Omega**2 - Gamma**2 /4)))
[eqn 4.20 taken from DOI: DOI: 10... | keyword[def] identifier[_position_autocorrelation_fitting_eqn] ( identifier[t] , identifier[Gamma] , identifier[AngTrapFreq] ):
literal[string]
keyword[return] identifier[_np] . identifier[exp] (- identifier[t] * identifier[Gamma] / literal[int] )*( identifier[_np] . identifier[cos] ( identifier[t] * iden... | def _position_autocorrelation_fitting_eqn(t, Gamma, AngTrapFreq):
"""
The value of the fitting equation:
exp(-t*Gamma/2) * (cos(t* sqrt(Omega**2 - Gamma**2 /4)) + Gamma* sin(t* sqrt(Omega**2-Gamma**2 /4))/(2* sqrt(Omega**2 - Gamma**2 /4)))
[eqn 4.20 taken from DOI: DOI: 10.1007/978-1-4614-6031-2]
to... |
def generate_validation_function(self, uri, name):
"""
Generate validation function for given uri with given name
"""
self._validation_functions_done.add(uri)
self.l('')
with self._resolver.resolving(uri) as definition:
with self.l('def {}(data):', name):
... | def function[generate_validation_function, parameter[self, uri, name]]:
constant[
Generate validation function for given uri with given name
]
call[name[self]._validation_functions_done.add, parameter[name[uri]]]
call[name[self].l, parameter[constant[]]]
with call[name[se... | keyword[def] identifier[generate_validation_function] ( identifier[self] , identifier[uri] , identifier[name] ):
literal[string]
identifier[self] . identifier[_validation_functions_done] . identifier[add] ( identifier[uri] )
identifier[self] . identifier[l] ( literal[string] )
key... | def generate_validation_function(self, uri, name):
"""
Generate validation function for given uri with given name
"""
self._validation_functions_done.add(uri)
self.l('')
with self._resolver.resolving(uri) as definition:
with self.l('def {}(data):', name):
self.generat... |
def value(self):
"""
Covariance matrix.
Returns
-------
K : ndarray
Matrix K = LLᵀ + ϵI, for a very small positive number ϵ.
"""
K = dot(self.L, self.L.T)
return K + self._epsilon * eye(K.shape[0]) | def function[value, parameter[self]]:
constant[
Covariance matrix.
Returns
-------
K : ndarray
Matrix K = LLᵀ + ϵI, for a very small positive number ϵ.
]
variable[K] assign[=] call[name[dot], parameter[name[self].L, name[self].L.T]]
return[binary_... | keyword[def] identifier[value] ( identifier[self] ):
literal[string]
identifier[K] = identifier[dot] ( identifier[self] . identifier[L] , identifier[self] . identifier[L] . identifier[T] )
keyword[return] identifier[K] + identifier[self] . identifier[_epsilon] * identifier[eye] ( identifi... | def value(self):
"""
Covariance matrix.
Returns
-------
K : ndarray
Matrix K = LLᵀ + ϵI, for a very small positive number ϵ.
"""
K = dot(self.L, self.L.T)
return K + self._epsilon * eye(K.shape[0]) |
def ordinal_encoding(X_in, mapping=None, cols=None, handle_unknown='value', handle_missing='value'):
"""
Ordinal encoding uses a single column of integers to represent the classes. An optional mapping dict can be passed
in, in this case we use the knowledge that there is some true order to the c... | def function[ordinal_encoding, parameter[X_in, mapping, cols, handle_unknown, handle_missing]]:
constant[
Ordinal encoding uses a single column of integers to represent the classes. An optional mapping dict can be passed
in, in this case we use the knowledge that there is some true order to the ... | keyword[def] identifier[ordinal_encoding] ( identifier[X_in] , identifier[mapping] = keyword[None] , identifier[cols] = keyword[None] , identifier[handle_unknown] = literal[string] , identifier[handle_missing] = literal[string] ):
literal[string]
identifier[return_nan_series] = identifier[pd] . id... | def ordinal_encoding(X_in, mapping=None, cols=None, handle_unknown='value', handle_missing='value'):
"""
Ordinal encoding uses a single column of integers to represent the classes. An optional mapping dict can be passed
in, in this case we use the knowledge that there is some true order to the class... |
def event_source_mapping_exists(UUID=None, EventSourceArn=None,
FunctionName=None,
region=None, key=None, keyid=None, profile=None):
'''
Given an event source mapping ID or an event source ARN and FunctionName,
check whether the mapping exists.... | def function[event_source_mapping_exists, parameter[UUID, EventSourceArn, FunctionName, region, key, keyid, profile]]:
constant[
Given an event source mapping ID or an event source ARN and FunctionName,
check whether the mapping exists.
Returns True if the given alias exists and returns False if th... | keyword[def] identifier[event_source_mapping_exists] ( identifier[UUID] = keyword[None] , identifier[EventSourceArn] = keyword[None] ,
identifier[FunctionName] = keyword[None] ,
identifier[region] = keyword[None] , identifier[key] = keyword[None] , identifier[keyid] = keyword[None] , identifier[profile] = keyword[N... | def event_source_mapping_exists(UUID=None, EventSourceArn=None, FunctionName=None, region=None, key=None, keyid=None, profile=None):
"""
Given an event source mapping ID or an event source ARN and FunctionName,
check whether the mapping exists.
Returns True if the given alias exists and returns False i... |
def _match_greedily(reaction, compound_formula, score_func):
"""Match compounds greedily based on score function.
Args:
reaction: Reaction equation :class:`psamm.reaction.Reaction`.
compound_formula: Dictionary mapping compound IDs to
:class:`psamm.formula.Formula`. Formulas must be... | def function[_match_greedily, parameter[reaction, compound_formula, score_func]]:
constant[Match compounds greedily based on score function.
Args:
reaction: Reaction equation :class:`psamm.reaction.Reaction`.
compound_formula: Dictionary mapping compound IDs to
:class:`psamm.for... | keyword[def] identifier[_match_greedily] ( identifier[reaction] , identifier[compound_formula] , identifier[score_func] ):
literal[string]
identifier[uninstantiated_left] , identifier[uninstantiated_right] = identifier[_reaction_to_dicts] ( identifier[reaction] )
keyword[def] identifier[compound_ins... | def _match_greedily(reaction, compound_formula, score_func):
"""Match compounds greedily based on score function.
Args:
reaction: Reaction equation :class:`psamm.reaction.Reaction`.
compound_formula: Dictionary mapping compound IDs to
:class:`psamm.formula.Formula`. Formulas must be... |
def reindex(self, newIndexIDs=None, newIndexNames=None, newIndexClassNames=None, newIndexTagNames=None):
'''
reindex - reindex the tree. Optionally, change what fields are indexed.
@param newIndexIDs <bool/None> - None to leave same, otherwise new value to index IDs
... | def function[reindex, parameter[self, newIndexIDs, newIndexNames, newIndexClassNames, newIndexTagNames]]:
constant[
reindex - reindex the tree. Optionally, change what fields are indexed.
@param newIndexIDs <bool/None> - None to leave same, otherwise new value to index IDs
... | keyword[def] identifier[reindex] ( identifier[self] , identifier[newIndexIDs] = keyword[None] , identifier[newIndexNames] = keyword[None] , identifier[newIndexClassNames] = keyword[None] , identifier[newIndexTagNames] = keyword[None] ):
literal[string]
keyword[if] identifier[newIndexIDs] keyword[... | def reindex(self, newIndexIDs=None, newIndexNames=None, newIndexClassNames=None, newIndexTagNames=None):
"""
reindex - reindex the tree. Optionally, change what fields are indexed.
@param newIndexIDs <bool/None> - None to leave same, otherwise new value to index IDs
... |
def removeTab(self, index):
"""
Removes tab at index ``index``.
This method will emits tab_closed for the removed tab.
:param index: index of the tab to remove.
"""
widget = self.widget(index)
try:
self._widgets.remove(widget)
except ValueErr... | def function[removeTab, parameter[self, index]]:
constant[
Removes tab at index ``index``.
This method will emits tab_closed for the removed tab.
:param index: index of the tab to remove.
]
variable[widget] assign[=] call[name[self].widget, parameter[name[index]]]
<... | keyword[def] identifier[removeTab] ( identifier[self] , identifier[index] ):
literal[string]
identifier[widget] = identifier[self] . identifier[widget] ( identifier[index] )
keyword[try] :
identifier[self] . identifier[_widgets] . identifier[remove] ( identifier[widget] )
... | def removeTab(self, index):
"""
Removes tab at index ``index``.
This method will emits tab_closed for the removed tab.
:param index: index of the tab to remove.
"""
widget = self.widget(index)
try:
self._widgets.remove(widget) # depends on [control=['try'], data=[]... |
def createExportNeuroML2 (netParams=None, simConfig=None, reference=None, connections=True, stimulations=True, output=False, format='xml'):
''' Sequence of commands to create and export network to NeuroML2 '''
from .. import sim
import __main__ as top
if not netParams: netParams = top.netParams
if n... | def function[createExportNeuroML2, parameter[netParams, simConfig, reference, connections, stimulations, output, format]]:
constant[ Sequence of commands to create and export network to NeuroML2 ]
from relative_module[None] import module[sim]
import module[__main__] as alias[top]
if <ast.UnaryOp... | keyword[def] identifier[createExportNeuroML2] ( identifier[netParams] = keyword[None] , identifier[simConfig] = keyword[None] , identifier[reference] = keyword[None] , identifier[connections] = keyword[True] , identifier[stimulations] = keyword[True] , identifier[output] = keyword[False] , identifier[format] = litera... | def createExportNeuroML2(netParams=None, simConfig=None, reference=None, connections=True, stimulations=True, output=False, format='xml'):
""" Sequence of commands to create and export network to NeuroML2 """
from .. import sim
import __main__ as top
if not netParams:
netParams = top.netParams ... |
def run_hook(hook_name, *args, **kwargs):
"""Runs the passed hook on all registered plugins
The function checks, whether the hook is available in the plugin.
:param hook_name: Name of the hook, corresponds to the function name being called
:param args: Arguments
:param kwargs: Keyword arguments
... | def function[run_hook, parameter[hook_name]]:
constant[Runs the passed hook on all registered plugins
The function checks, whether the hook is available in the plugin.
:param hook_name: Name of the hook, corresponds to the function name being called
:param args: Arguments
:param kwargs: Keywor... | keyword[def] identifier[run_hook] ( identifier[hook_name] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[for] identifier[module] keyword[in] identifier[plugin_dict] . identifier[values] ():
keyword[if] identifier[hasattr] ( identifier[module] , literal[string] ) keyword[... | def run_hook(hook_name, *args, **kwargs):
"""Runs the passed hook on all registered plugins
The function checks, whether the hook is available in the plugin.
:param hook_name: Name of the hook, corresponds to the function name being called
:param args: Arguments
:param kwargs: Keyword arguments
... |
def count_authors_by_annotation(graph: BELGraph, annotation: str = 'Subgraph') -> Mapping[str, typing.Counter[str]]:
"""Group the author counters by sub-graphs induced by the annotation.
:param graph: A BEL graph
:param annotation: The annotation to use to group the graph
:return: A dictionary of Count... | def function[count_authors_by_annotation, parameter[graph, annotation]]:
constant[Group the author counters by sub-graphs induced by the annotation.
:param graph: A BEL graph
:param annotation: The annotation to use to group the graph
:return: A dictionary of Counters {subgraph name: Counter from {... | keyword[def] identifier[count_authors_by_annotation] ( identifier[graph] : identifier[BELGraph] , identifier[annotation] : identifier[str] = literal[string] )-> identifier[Mapping] [ identifier[str] , identifier[typing] . identifier[Counter] [ identifier[str] ]]:
literal[string]
identifier[authors] = ident... | def count_authors_by_annotation(graph: BELGraph, annotation: str='Subgraph') -> Mapping[str, typing.Counter[str]]:
"""Group the author counters by sub-graphs induced by the annotation.
:param graph: A BEL graph
:param annotation: The annotation to use to group the graph
:return: A dictionary of Counter... |
def get_matches(expr_lst, ts):
"""
Get a list of TimeSeries objects that match the given expression.
:param list expr_lst: Expression
:param list ts: TimeSeries
:return list new_ts: Matched time series objects
:return list idxs: Indices of matched objects
"""
logger_ts.info("enter get_ma... | def function[get_matches, parameter[expr_lst, ts]]:
constant[
Get a list of TimeSeries objects that match the given expression.
:param list expr_lst: Expression
:param list ts: TimeSeries
:return list new_ts: Matched time series objects
:return list idxs: Indices of matched objects
]
... | keyword[def] identifier[get_matches] ( identifier[expr_lst] , identifier[ts] ):
literal[string]
identifier[logger_ts] . identifier[info] ( literal[string] )
identifier[new_ts] =[]
identifier[idxs] =[]
identifier[match] = keyword[False]
keyword[try] :
keyword[for] identifier[i... | def get_matches(expr_lst, ts):
"""
Get a list of TimeSeries objects that match the given expression.
:param list expr_lst: Expression
:param list ts: TimeSeries
:return list new_ts: Matched time series objects
:return list idxs: Indices of matched objects
"""
logger_ts.info('enter get_ma... |
def publisher(self_url=None, hub_url=None):
"""This decorator makes it easier to implement a websub publisher. You use
it on an endpoint, and Link headers will automatically be added. To also
include these links in your template html/atom/rss (and you should!) you
can use the following to get the raw li... | def function[publisher, parameter[self_url, hub_url]]:
constant[This decorator makes it easier to implement a websub publisher. You use
it on an endpoint, and Link headers will automatically be added. To also
include these links in your template html/atom/rss (and you should!) you
can use the follow... | keyword[def] identifier[publisher] ( identifier[self_url] = keyword[None] , identifier[hub_url] = keyword[None] ):
literal[string]
keyword[def] identifier[decorator] ( identifier[topic_view] ):
@ identifier[functools] . identifier[wraps] ( identifier[topic_view] )
keyword[def] identifier... | def publisher(self_url=None, hub_url=None):
"""This decorator makes it easier to implement a websub publisher. You use
it on an endpoint, and Link headers will automatically be added. To also
include these links in your template html/atom/rss (and you should!) you
can use the following to get the raw li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.