code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def start_slaves(slave_dir,exe_rel_path,pst_rel_path,num_slaves=None,slave_root="..",
port=4004,rel_path=None,local=True,cleanup=True,master_dir=None,
verbose=False,silent_master=False):
""" start a group of pest(++) slaves on the local machine
Parameters
----------
sl... | def function[start_slaves, parameter[slave_dir, exe_rel_path, pst_rel_path, num_slaves, slave_root, port, rel_path, local, cleanup, master_dir, verbose, silent_master]]:
constant[ start a group of pest(++) slaves on the local machine
Parameters
----------
slave_dir : str
the path to a comp... | keyword[def] identifier[start_slaves] ( identifier[slave_dir] , identifier[exe_rel_path] , identifier[pst_rel_path] , identifier[num_slaves] = keyword[None] , identifier[slave_root] = literal[string] ,
identifier[port] = literal[int] , identifier[rel_path] = keyword[None] , identifier[local] = keyword[True] , identi... | def start_slaves(slave_dir, exe_rel_path, pst_rel_path, num_slaves=None, slave_root='..', port=4004, rel_path=None, local=True, cleanup=True, master_dir=None, verbose=False, silent_master=False):
""" start a group of pest(++) slaves on the local machine
Parameters
----------
slave_dir : str
th... |
def get_events(self, from_=None, to=None):
"""Query a slice of the events.
Events are always returned in the order the were added.
Parameters:
from_ -- if not None, return only events added after the event with
id `from_`. If None, return from the start of history.... | def function[get_events, parameter[self, from_, to]]:
constant[Query a slice of the events.
Events are always returned in the order the were added.
Parameters:
from_ -- if not None, return only events added after the event with
id `from_`. If None, return from the ... | keyword[def] identifier[get_events] ( identifier[self] , identifier[from_] = keyword[None] , identifier[to] = keyword[None] ):
literal[string]
keyword[if] identifier[from_] keyword[and] ( identifier[from_] keyword[not] keyword[in] identifier[self] . identifier[keys] keyword[or] identifier[fr... | def get_events(self, from_=None, to=None):
"""Query a slice of the events.
Events are always returned in the order the were added.
Parameters:
from_ -- if not None, return only events added after the event with
id `from_`. If None, return from the start of history.
... |
def saveget(self,con):
"save, return old value. todo: make the expire() atomic with a redis script"
k,v=self.kv()
oldv=con.getset(k,v)
if self.TTL is not None: con.expire(k,self.TTL)
return None if oldv is None else msgpack.loads(oldv) | def function[saveget, parameter[self, con]]:
constant[save, return old value. todo: make the expire() atomic with a redis script]
<ast.Tuple object at 0x7da204564d00> assign[=] call[name[self].kv, parameter[]]
variable[oldv] assign[=] call[name[con].getset, parameter[name[k], name[v]]]
i... | keyword[def] identifier[saveget] ( identifier[self] , identifier[con] ):
literal[string]
identifier[k] , identifier[v] = identifier[self] . identifier[kv] ()
identifier[oldv] = identifier[con] . identifier[getset] ( identifier[k] , identifier[v] )
keyword[if] identifier[self] . identifier[TT... | def saveget(self, con):
"""save, return old value. todo: make the expire() atomic with a redis script"""
(k, v) = self.kv()
oldv = con.getset(k, v)
if self.TTL is not None:
con.expire(k, self.TTL) # depends on [control=['if'], data=[]]
return None if oldv is None else msgpack.loads(oldv) |
def build_extension(self, ext):
"""
build clrmagic.dll using csc or mcs
"""
if sys.platform == "win32":
_clr_compiler = "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\csc.exe"
else:
_clr_compiler = "mcs"
cmd = [
_clr_compiler,
... | def function[build_extension, parameter[self, ext]]:
constant[
build clrmagic.dll using csc or mcs
]
if compare[name[sys].platform equal[==] constant[win32]] begin[:]
variable[_clr_compiler] assign[=] constant[C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe]
... | keyword[def] identifier[build_extension] ( identifier[self] , identifier[ext] ):
literal[string]
keyword[if] identifier[sys] . identifier[platform] == literal[string] :
identifier[_clr_compiler] = literal[string]
keyword[else] :
identifier[_clr_compiler] = liter... | def build_extension(self, ext):
"""
build clrmagic.dll using csc or mcs
"""
if sys.platform == 'win32':
_clr_compiler = 'C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\csc.exe' # depends on [control=['if'], data=[]]
else:
_clr_compiler = 'mcs'
cmd = [_clr_compiler, '... |
def create_stemmer(self, isDev=False):
""" Returns Stemmer instance """
words = self.get_words(isDev)
dictionary = ArrayDictionary(words)
stemmer = Stemmer(dictionary)
resultCache = ArrayCache()
cachedStemmer = CachedStemmer(resultCache, stemmer)
return cachedS... | def function[create_stemmer, parameter[self, isDev]]:
constant[ Returns Stemmer instance ]
variable[words] assign[=] call[name[self].get_words, parameter[name[isDev]]]
variable[dictionary] assign[=] call[name[ArrayDictionary], parameter[name[words]]]
variable[stemmer] assign[=] call[name... | keyword[def] identifier[create_stemmer] ( identifier[self] , identifier[isDev] = keyword[False] ):
literal[string]
identifier[words] = identifier[self] . identifier[get_words] ( identifier[isDev] )
identifier[dictionary] = identifier[ArrayDictionary] ( identifier[words] )
identif... | def create_stemmer(self, isDev=False):
""" Returns Stemmer instance """
words = self.get_words(isDev)
dictionary = ArrayDictionary(words)
stemmer = Stemmer(dictionary)
resultCache = ArrayCache()
cachedStemmer = CachedStemmer(resultCache, stemmer)
return cachedStemmer |
def display_fitsfile(self, chname, fitspath, dowait):
"""Load (``fitspath``) into channel (``chname``).
(The parameter ``dowait`` is currently ignored.)
"""
# TEMP: dowait ignored
self.fv.gui_do(self.fv.open_uris, [fitspath], chname=chname)
return 0 | def function[display_fitsfile, parameter[self, chname, fitspath, dowait]]:
constant[Load (``fitspath``) into channel (``chname``).
(The parameter ``dowait`` is currently ignored.)
]
call[name[self].fv.gui_do, parameter[name[self].fv.open_uris, list[[<ast.Name object at 0x7da207f98520>]]... | keyword[def] identifier[display_fitsfile] ( identifier[self] , identifier[chname] , identifier[fitspath] , identifier[dowait] ):
literal[string]
identifier[self] . identifier[fv] . identifier[gui_do] ( identifier[self] . identifier[fv] . identifier[open_uris] ,[ identifier[fitspath] ], ide... | def display_fitsfile(self, chname, fitspath, dowait):
"""Load (``fitspath``) into channel (``chname``).
(The parameter ``dowait`` is currently ignored.)
"""
# TEMP: dowait ignored
self.fv.gui_do(self.fv.open_uris, [fitspath], chname=chname)
return 0 |
def create_datastore(self, schema=None, primary_key=None,
delete_first=0, path=None):
# type: (Optional[List[Dict]], Optional[str], int, Optional[str]) -> None
"""For tabular data, create a resource in the HDX datastore which enables data preview in HDX. If no schema is provided... | def function[create_datastore, parameter[self, schema, primary_key, delete_first, path]]:
constant[For tabular data, create a resource in the HDX datastore which enables data preview in HDX. If no schema is provided
all fields are assumed to be text. If path is not supplied, the file is first downloaded... | keyword[def] identifier[create_datastore] ( identifier[self] , identifier[schema] = keyword[None] , identifier[primary_key] = keyword[None] ,
identifier[delete_first] = literal[int] , identifier[path] = keyword[None] ):
literal[string]
keyword[if] identifier[delete_first] == literal[int] :
... | def create_datastore(self, schema=None, primary_key=None, delete_first=0, path=None):
# type: (Optional[List[Dict]], Optional[str], int, Optional[str]) -> None
"For tabular data, create a resource in the HDX datastore which enables data preview in HDX. If no schema is provided\n all fields are assumed to... |
def public_ip_address_create_or_update(name, resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
Create or update a public IP address within a specified resource group.
:param name: The name of the public IP address to create.
:param resource_group: The resource group name assigned to the
... | def function[public_ip_address_create_or_update, parameter[name, resource_group]]:
constant[
.. versionadded:: 2019.2.0
Create or update a public IP address within a specified resource group.
:param name: The name of the public IP address to create.
:param resource_group: The resource group n... | keyword[def] identifier[public_ip_address_create_or_update] ( identifier[name] , identifier[resource_group] ,** identifier[kwargs] ):
literal[string]
keyword[if] literal[string] keyword[not] keyword[in] identifier[kwargs] :
identifier[rg_props] = identifier[__salt__] [ literal[string] ](
... | def public_ip_address_create_or_update(name, resource_group, **kwargs):
"""
.. versionadded:: 2019.2.0
Create or update a public IP address within a specified resource group.
:param name: The name of the public IP address to create.
:param resource_group: The resource group name assigned to the
... |
def colors(self, value):
"""
Converts color strings into a color listing.
"""
if isinstance(value, str):
# Must import here to avoid recursive import
from .palettes import PALETTES
if value not in PALETTES:
raise YellowbrickValueError(... | def function[colors, parameter[self, value]]:
constant[
Converts color strings into a color listing.
]
if call[name[isinstance], parameter[name[value], name[str]]] begin[:]
from relative_module[palettes] import module[PALETTES]
if compare[name[value] <ast.NotIn ob... | keyword[def] identifier[colors] ( identifier[self] , identifier[value] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[value] , identifier[str] ):
keyword[from] . identifier[palettes] keyword[import] identifier[PALETTES]
keyword[if] identi... | def colors(self, value):
"""
Converts color strings into a color listing.
"""
if isinstance(value, str):
# Must import here to avoid recursive import
from .palettes import PALETTES
if value not in PALETTES:
raise YellowbrickValueError("'{}' is not a registered... |
def onchange(self, new_value):
"""Called when the user changes the TextInput content.
With single_line=True it fires in case of focus lost and Enter key pressed.
With single_line=False it fires at each key released.
Args:
new_value (str): the new string content of the TextIn... | def function[onchange, parameter[self, new_value]]:
constant[Called when the user changes the TextInput content.
With single_line=True it fires in case of focus lost and Enter key pressed.
With single_line=False it fires at each key released.
Args:
new_value (str): the new s... | keyword[def] identifier[onchange] ( identifier[self] , identifier[new_value] ):
literal[string]
identifier[self] . identifier[disable_refresh] ()
identifier[self] . identifier[set_value] ( identifier[new_value] )
identifier[self] . identifier[enable_refresh] ()
keyword[re... | def onchange(self, new_value):
"""Called when the user changes the TextInput content.
With single_line=True it fires in case of focus lost and Enter key pressed.
With single_line=False it fires at each key released.
Args:
new_value (str): the new string content of the TextInput.... |
def print_overwrite(*args, **kwargs):
""" Move to the beginning of the current line, and print some text.
Arguments:
Same as `print()`.
Keyword Arguments:
Same as `print()`, except `end` defaults to '' (empty str),
and these:
delay : Time in secon... | def function[print_overwrite, parameter[]]:
constant[ Move to the beginning of the current line, and print some text.
Arguments:
Same as `print()`.
Keyword Arguments:
Same as `print()`, except `end` defaults to '' (empty str),
and these:
delay... | keyword[def] identifier[print_overwrite] (* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] . identifier[setdefault] ( literal[string] , identifier[sys] . identifier[stdout] )
identifier[kwargs] . identifier[setdefault] ( literal[string] , literal[string] )
identifie... | def print_overwrite(*args, **kwargs):
""" Move to the beginning of the current line, and print some text.
Arguments:
Same as `print()`.
Keyword Arguments:
Same as `print()`, except `end` defaults to '' (empty str),
and these:
delay : Time in secon... |
def get_commit_message(self, commit_sha):
"""
Return the commit message for the current commit hash,
replace #<PRID> with GH-<PRID>
"""
cmd = ["git", "show", "-s", "--format=%B", commit_sha]
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
message =... | def function[get_commit_message, parameter[self, commit_sha]]:
constant[
Return the commit message for the current commit hash,
replace #<PRID> with GH-<PRID>
]
variable[cmd] assign[=] list[[<ast.Constant object at 0x7da1b2309900>, <ast.Constant object at 0x7da1b230a7a0>, <ast.Co... | keyword[def] identifier[get_commit_message] ( identifier[self] , identifier[commit_sha] ):
literal[string]
identifier[cmd] =[ literal[string] , literal[string] , literal[string] , literal[string] , identifier[commit_sha] ]
identifier[output] = identifier[subprocess] . identifier[check_outp... | def get_commit_message(self, commit_sha):
"""
Return the commit message for the current commit hash,
replace #<PRID> with GH-<PRID>
"""
cmd = ['git', 'show', '-s', '--format=%B', commit_sha]
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
message = output.strip().... |
def list_containers(self):
"""
List all available podman containers.
:return: collection of instances of :class:`conu.PodmanContainer`
"""
containers = []
for container in self._list_podman_containers():
identifier = container["ID"]
name = contain... | def function[list_containers, parameter[self]]:
constant[
List all available podman containers.
:return: collection of instances of :class:`conu.PodmanContainer`
]
variable[containers] assign[=] list[[]]
for taget[name[container]] in starred[call[name[self]._list_podman_... | keyword[def] identifier[list_containers] ( identifier[self] ):
literal[string]
identifier[containers] =[]
keyword[for] identifier[container] keyword[in] identifier[self] . identifier[_list_podman_containers] ():
identifier[identifier] = identifier[container] [ literal[strin... | def list_containers(self):
"""
List all available podman containers.
:return: collection of instances of :class:`conu.PodmanContainer`
"""
containers = []
for container in self._list_podman_containers():
identifier = container['ID']
name = container['Names']
... |
def moveTo(self, newX=0, newY=0):
"""!
\~english
Move vertex of rectangles to new point (x,y)
@param newX: Coordinated X value
@param newY: Coordinated Y value
\~chinese
移动矩形到新坐标点 (x,y)
@param newX: 坐标 X
@param newY: 坐标 Y
"""
self.... | def function[moveTo, parameter[self, newX, newY]]:
constant[!
\~english
Move vertex of rectangles to new point (x,y)
@param newX: Coordinated X value
@param newY: Coordinated Y value
\~chinese
移动矩形到新坐标点 (x,y)
@param newX: 坐标 X
@param newY: 坐标 Y
... | keyword[def] identifier[moveTo] ( identifier[self] , identifier[newX] = literal[int] , identifier[newY] = literal[int] ):
literal[string]
identifier[self] . identifier[x] = identifier[newX]
identifier[self] . identifier[y] = identifier[newY] | def moveTo(self, newX=0, newY=0):
"""!
\\~english
Move vertex of rectangles to new point (x,y)
@param newX: Coordinated X value
@param newY: Coordinated Y value
\\~chinese
移动矩形到新坐标点 (x,y)
@param newX: 坐标 X
@param newY: 坐标 Y
"""
self.x = ne... |
def _aload16(ins):
''' Loads a 16 bit value from a memory address
If 2nd arg. start with '*', it is always treated as
an indirect value.
'''
output = _addr(ins.quad[2])
output.append('ld e, (hl)')
output.append('inc hl')
output.append('ld d, (hl)')
output.append('ex de, hl')
out... | def function[_aload16, parameter[ins]]:
constant[ Loads a 16 bit value from a memory address
If 2nd arg. start with '*', it is always treated as
an indirect value.
]
variable[output] assign[=] call[name[_addr], parameter[call[name[ins].quad][constant[2]]]]
call[name[output].append, p... | keyword[def] identifier[_aload16] ( identifier[ins] ):
literal[string]
identifier[output] = identifier[_addr] ( identifier[ins] . identifier[quad] [ literal[int] ])
identifier[output] . identifier[append] ( literal[string] )
identifier[output] . identifier[append] ( literal[string] )
identi... | def _aload16(ins):
""" Loads a 16 bit value from a memory address
If 2nd arg. start with '*', it is always treated as
an indirect value.
"""
output = _addr(ins.quad[2])
output.append('ld e, (hl)')
output.append('inc hl')
output.append('ld d, (hl)')
output.append('ex de, hl')
outp... |
def app(*args, **kwargs):
"""Create a vaex app, the QApplication mainloop must be started.
In ipython notebook/jupyter do the following:
>>> import vaex.ui.main # this causes the qt api level to be set properly
>>> import vaex
Next cell:
>>> %gui qt
Next cell:
>>> app = vaex.app()
... | def function[app, parameter[]]:
constant[Create a vaex app, the QApplication mainloop must be started.
In ipython notebook/jupyter do the following:
>>> import vaex.ui.main # this causes the qt api level to be set properly
>>> import vaex
Next cell:
>>> %gui qt
Next cell:
>>> a... | keyword[def] identifier[app] (* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[import] identifier[vaex] . identifier[ui] . identifier[main]
keyword[return] identifier[vaex] . identifier[ui] . identifier[main] . identifier[VaexApp] () | def app(*args, **kwargs):
"""Create a vaex app, the QApplication mainloop must be started.
In ipython notebook/jupyter do the following:
>>> import vaex.ui.main # this causes the qt api level to be set properly
>>> import vaex
Next cell:
>>> %gui qt
Next cell:
>>> app = vaex.app()
... |
def obtain_to(filename):
"""
Return the digital elevation map projected to the lat lon matrix coordenates.
Keyword arguments:
filename -- the name of a netcdf file.
"""
root, _ = nc.open(filename)
lat, lon = nc.getvar(root, 'lat')[0,:], nc.getvar(root, 'lon')[0,:]
nc.close(root)
ret... | def function[obtain_to, parameter[filename]]:
constant[
Return the digital elevation map projected to the lat lon matrix coordenates.
Keyword arguments:
filename -- the name of a netcdf file.
]
<ast.Tuple object at 0x7da18f00cbb0> assign[=] call[name[nc].open, parameter[name[filename]]]... | keyword[def] identifier[obtain_to] ( identifier[filename] ):
literal[string]
identifier[root] , identifier[_] = identifier[nc] . identifier[open] ( identifier[filename] )
identifier[lat] , identifier[lon] = identifier[nc] . identifier[getvar] ( identifier[root] , literal[string] )[ literal[int] ,:], i... | def obtain_to(filename):
"""
Return the digital elevation map projected to the lat lon matrix coordenates.
Keyword arguments:
filename -- the name of a netcdf file.
"""
(root, _) = nc.open(filename)
(lat, lon) = (nc.getvar(root, 'lat')[0, :], nc.getvar(root, 'lon')[0, :])
nc.close(root)... |
def next(self, verifyPad=False):
"""Manually iterate through the data loaded in Instrument object.
Bounds of iteration and iteration type (day/file) are set by
`bounds` attribute.
Note
----
If there were no previous calls to load then the
first... | def function[next, parameter[self, verifyPad]]:
constant[Manually iterate through the data loaded in Instrument object.
Bounds of iteration and iteration type (day/file) are set by
`bounds` attribute.
Note
----
If there were no previous calls to load th... | keyword[def] identifier[next] ( identifier[self] , identifier[verifyPad] = keyword[False] ):
literal[string]
keyword[if] identifier[self] . identifier[_iter_type] == literal[string] :
keyword[if] identifier[self] . identifier[date] keyword[is] keyword[not] keyword[None] :
... | def next(self, verifyPad=False):
"""Manually iterate through the data loaded in Instrument object.
Bounds of iteration and iteration type (day/file) are set by
`bounds` attribute.
Note
----
If there were no previous calls to load then the
first day... |
def prepare_hmet(self):
"""
Prepare HMET data for simulation
"""
if self._prepare_lsm_hmet:
netcdf_file_path = None
hmet_ascii_output_folder = None
if self.output_netcdf:
netcdf_file_path = '{0}_hmet.nc'.format(self.project_manager.name... | def function[prepare_hmet, parameter[self]]:
constant[
Prepare HMET data for simulation
]
if name[self]._prepare_lsm_hmet begin[:]
variable[netcdf_file_path] assign[=] constant[None]
variable[hmet_ascii_output_folder] assign[=] constant[None]
... | keyword[def] identifier[prepare_hmet] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_prepare_lsm_hmet] :
identifier[netcdf_file_path] = keyword[None]
identifier[hmet_ascii_output_folder] = keyword[None]
keyword[if] identif... | def prepare_hmet(self):
"""
Prepare HMET data for simulation
"""
if self._prepare_lsm_hmet:
netcdf_file_path = None
hmet_ascii_output_folder = None
if self.output_netcdf:
netcdf_file_path = '{0}_hmet.nc'.format(self.project_manager.name)
if self.ho... |
def has_ssd(self):
"""Return true if any of the drive under ArrayControllers is ssd"""
for member in self.get_members():
if member.physical_drives.has_ssd:
return True
return False | def function[has_ssd, parameter[self]]:
constant[Return true if any of the drive under ArrayControllers is ssd]
for taget[name[member]] in starred[call[name[self].get_members, parameter[]]] begin[:]
if name[member].physical_drives.has_ssd begin[:]
return[constant[True]]
r... | keyword[def] identifier[has_ssd] ( identifier[self] ):
literal[string]
keyword[for] identifier[member] keyword[in] identifier[self] . identifier[get_members] ():
keyword[if] identifier[member] . identifier[physical_drives] . identifier[has_ssd] :
keyword[return] k... | def has_ssd(self):
"""Return true if any of the drive under ArrayControllers is ssd"""
for member in self.get_members():
if member.physical_drives.has_ssd:
return True # depends on [control=['if'], data=[]] # depends on [control=['for'], data=['member']]
return False |
def criar_ip(self, id_vlan, id_equipamento, descricao):
"""Aloca um IP em uma VLAN para um equipamento.
Insere um novo IP para a VLAN e o associa ao equipamento.
:param id_vlan: Identificador da vlan.
:param id_equipamento: Identificador do equipamento.
:param descricao: Descri... | def function[criar_ip, parameter[self, id_vlan, id_equipamento, descricao]]:
constant[Aloca um IP em uma VLAN para um equipamento.
Insere um novo IP para a VLAN e o associa ao equipamento.
:param id_vlan: Identificador da vlan.
:param id_equipamento: Identificador do equipamento.
... | keyword[def] identifier[criar_ip] ( identifier[self] , identifier[id_vlan] , identifier[id_equipamento] , identifier[descricao] ):
literal[string]
identifier[ip_map] = identifier[dict] ()
identifier[ip_map] [ literal[string] ]= identifier[id_vlan]
identifier[ip_map] [ literal[str... | def criar_ip(self, id_vlan, id_equipamento, descricao):
"""Aloca um IP em uma VLAN para um equipamento.
Insere um novo IP para a VLAN e o associa ao equipamento.
:param id_vlan: Identificador da vlan.
:param id_equipamento: Identificador do equipamento.
:param descricao: Descriçao ... |
def create_item(self, name):
"""
create a new todo list item
"""
elem = self.controlled_list.create_item(name)
if elem:
return TodoElementUX(parent=self, controlled_element=elem) | def function[create_item, parameter[self, name]]:
constant[
create a new todo list item
]
variable[elem] assign[=] call[name[self].controlled_list.create_item, parameter[name[name]]]
if name[elem] begin[:]
return[call[name[TodoElementUX], parameter[]]] | keyword[def] identifier[create_item] ( identifier[self] , identifier[name] ):
literal[string]
identifier[elem] = identifier[self] . identifier[controlled_list] . identifier[create_item] ( identifier[name] )
keyword[if] identifier[elem] :
keyword[return] identifier[TodoElemen... | def create_item(self, name):
"""
create a new todo list item
"""
elem = self.controlled_list.create_item(name)
if elem:
return TodoElementUX(parent=self, controlled_element=elem) # depends on [control=['if'], data=[]] |
def write_log_file(namespace, document):
"""Writes a line to a log file
Arguments:
namespace {str} -- namespace of document
document {dict} -- document to write to the logs
"""
log_timestamp = asctime(gmtime(document[TS]))
with open("{}{}.{}.log".format(LOG_DIR, namespace, DAY_S... | def function[write_log_file, parameter[namespace, document]]:
constant[Writes a line to a log file
Arguments:
namespace {str} -- namespace of document
document {dict} -- document to write to the logs
]
variable[log_timestamp] assign[=] call[name[asctime], parameter[call[name... | keyword[def] identifier[write_log_file] ( identifier[namespace] , identifier[document] ):
literal[string]
identifier[log_timestamp] = identifier[asctime] ( identifier[gmtime] ( identifier[document] [ identifier[TS] ]))
keyword[with] identifier[open] ( literal[string] . identifier[format] ( identifier... | def write_log_file(namespace, document):
"""Writes a line to a log file
Arguments:
namespace {str} -- namespace of document
document {dict} -- document to write to the logs
"""
log_timestamp = asctime(gmtime(document[TS]))
with open('{}{}.{}.log'.format(LOG_DIR, namespace, DAY_S... |
def remaining_time(self):
"""
estimates the time remaining until script is finished
"""
elapsed_time = (datetime.datetime.now() - self.start_time).total_seconds()
# safety to avoid devision by zero
if self.progress == 0:
self.progress = 1
estimated_to... | def function[remaining_time, parameter[self]]:
constant[
estimates the time remaining until script is finished
]
variable[elapsed_time] assign[=] call[binary_operation[call[name[datetime].datetime.now, parameter[]] - name[self].start_time].total_seconds, parameter[]]
if compare[n... | keyword[def] identifier[remaining_time] ( identifier[self] ):
literal[string]
identifier[elapsed_time] =( identifier[datetime] . identifier[datetime] . identifier[now] ()- identifier[self] . identifier[start_time] ). identifier[total_seconds] ()
keyword[if] identifier[self] . ide... | def remaining_time(self):
"""
estimates the time remaining until script is finished
"""
elapsed_time = (datetime.datetime.now() - self.start_time).total_seconds()
# safety to avoid devision by zero
if self.progress == 0:
self.progress = 1 # depends on [control=['if'], data=[]]
... |
def get_caller(stack_index=2, root_dir=None):
''' Returns file.py:lineno of your caller. A stack_index of 2 will provide
the caller of the function calling this function. Notice that stack_index
of 2 or more will fail if called from global scope. '''
caller = inspect.getframeinfo(inspect.stack()[stack_i... | def function[get_caller, parameter[stack_index, root_dir]]:
constant[ Returns file.py:lineno of your caller. A stack_index of 2 will provide
the caller of the function calling this function. Notice that stack_index
of 2 or more will fail if called from global scope. ]
variable[caller] assign... | keyword[def] identifier[get_caller] ( identifier[stack_index] = literal[int] , identifier[root_dir] = keyword[None] ):
literal[string]
identifier[caller] = identifier[inspect] . identifier[getframeinfo] ( identifier[inspect] . identifier[stack] ()[ identifier[stack_index] ][ literal[int] ])
identifier[f... | def get_caller(stack_index=2, root_dir=None):
""" Returns file.py:lineno of your caller. A stack_index of 2 will provide
the caller of the function calling this function. Notice that stack_index
of 2 or more will fail if called from global scope. """
caller = inspect.getframeinfo(inspect.stack()[sta... |
def delayed_burst_run(self, target_cycles_per_sec):
""" Run CPU not faster than given speedlimit """
old_cycles = self.cycles
start_time = time.time()
self.burst_run()
is_duration = time.time() - start_time
new_cycles = self.cycles - old_cycles
try:
... | def function[delayed_burst_run, parameter[self, target_cycles_per_sec]]:
constant[ Run CPU not faster than given speedlimit ]
variable[old_cycles] assign[=] name[self].cycles
variable[start_time] assign[=] call[name[time].time, parameter[]]
call[name[self].burst_run, parameter[]]
... | keyword[def] identifier[delayed_burst_run] ( identifier[self] , identifier[target_cycles_per_sec] ):
literal[string]
identifier[old_cycles] = identifier[self] . identifier[cycles]
identifier[start_time] = identifier[time] . identifier[time] ()
identifier[self] . identifier[burst... | def delayed_burst_run(self, target_cycles_per_sec):
""" Run CPU not faster than given speedlimit """
old_cycles = self.cycles
start_time = time.time()
self.burst_run()
is_duration = time.time() - start_time
new_cycles = self.cycles - old_cycles
try:
is_cycles_per_sec = new_cycles / i... |
def base64_encodestring(instr):
'''
Encode a string as base64 using the "legacy" Python interface.
Among other possible differences, the "legacy" encoder includes
a newline ('\\n') character after every 76 characters and always
at the end of the encoded string.
'''
return salt.utils.stringu... | def function[base64_encodestring, parameter[instr]]:
constant[
Encode a string as base64 using the "legacy" Python interface.
Among other possible differences, the "legacy" encoder includes
a newline ('\n') character after every 76 characters and always
at the end of the encoded string.
]
... | keyword[def] identifier[base64_encodestring] ( identifier[instr] ):
literal[string]
keyword[return] identifier[salt] . identifier[utils] . identifier[stringutils] . identifier[to_unicode] (
identifier[base64] . identifier[encodestring] ( identifier[salt] . identifier[utils] . identifier[stringutils] ... | def base64_encodestring(instr):
"""
Encode a string as base64 using the "legacy" Python interface.
Among other possible differences, the "legacy" encoder includes
a newline ('\\n') character after every 76 characters and always
at the end of the encoded string.
"""
return salt.utils.stringu... |
def check_important_variables(self):
"""
Check all the variables needed are defined
"""
if len(self.important_variables - set(self.args.keys())):
raise TypeError("Some important variables are not set") | def function[check_important_variables, parameter[self]]:
constant[
Check all the variables needed are defined
]
if call[name[len], parameter[binary_operation[name[self].important_variables - call[name[set], parameter[call[name[self].args.keys, parameter[]]]]]]] begin[:]
<ast.Rai... | keyword[def] identifier[check_important_variables] ( identifier[self] ):
literal[string]
keyword[if] identifier[len] ( identifier[self] . identifier[important_variables] - identifier[set] ( identifier[self] . identifier[args] . identifier[keys] ())):
keyword[raise] identifier[TypeErr... | def check_important_variables(self):
"""
Check all the variables needed are defined
"""
if len(self.important_variables - set(self.args.keys())):
raise TypeError('Some important variables are not set') # depends on [control=['if'], data=[]] |
def find_globals_and_nonlocals(node, globs, nonlocals, code, version):
"""search a node of parse tree to find variable names that need a
either 'global' or 'nonlocal' statements added."""
for n in node:
if isinstance(n, SyntaxTree):
globs, nonlocals = find_globals_and_nonlocals(n, globs,... | def function[find_globals_and_nonlocals, parameter[node, globs, nonlocals, code, version]]:
constant[search a node of parse tree to find variable names that need a
either 'global' or 'nonlocal' statements added.]
for taget[name[n]] in starred[name[node]] begin[:]
if call[name[isinsta... | keyword[def] identifier[find_globals_and_nonlocals] ( identifier[node] , identifier[globs] , identifier[nonlocals] , identifier[code] , identifier[version] ):
literal[string]
keyword[for] identifier[n] keyword[in] identifier[node] :
keyword[if] identifier[isinstance] ( identifier[n] , identifi... | def find_globals_and_nonlocals(node, globs, nonlocals, code, version):
"""search a node of parse tree to find variable names that need a
either 'global' or 'nonlocal' statements added."""
for n in node:
if isinstance(n, SyntaxTree):
(globs, nonlocals) = find_globals_and_nonlocals(n, glob... |
def ip_address():
"""Get the IP address used for public connections."""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# 8.8.8.8 is the google public DNS
s.connect(("8.8.8.8", 53))
ip = s.getsockname()[0]
s.close()
return ip | def function[ip_address, parameter[]]:
constant[Get the IP address used for public connections.]
variable[s] assign[=] call[name[socket].socket, parameter[name[socket].AF_INET, name[socket].SOCK_DGRAM]]
call[name[s].connect, parameter[tuple[[<ast.Constant object at 0x7da1b1971120>, <ast.Constant... | keyword[def] identifier[ip_address] ():
literal[string]
identifier[s] = identifier[socket] . identifier[socket] ( identifier[socket] . identifier[AF_INET] , identifier[socket] . identifier[SOCK_DGRAM] )
identifier[s] . identifier[connect] (( literal[string] , literal[int] ))
identifier[ip] =... | def ip_address():
"""Get the IP address used for public connections."""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# 8.8.8.8 is the google public DNS
s.connect(('8.8.8.8', 53))
ip = s.getsockname()[0]
s.close()
return ip |
def get_table_keys_name(self, table_name, keys):
"""
Given a set of keys, extracts the key and range key
"""
table = self.tables.get(table_name)
if not table:
return None, None
else:
if len(keys) == 1:
for key in keys:
... | def function[get_table_keys_name, parameter[self, table_name, keys]]:
constant[
Given a set of keys, extracts the key and range key
]
variable[table] assign[=] call[name[self].tables.get, parameter[name[table_name]]]
if <ast.UnaryOp object at 0x7da1b1980130> begin[:]
retu... | keyword[def] identifier[get_table_keys_name] ( identifier[self] , identifier[table_name] , identifier[keys] ):
literal[string]
identifier[table] = identifier[self] . identifier[tables] . identifier[get] ( identifier[table_name] )
keyword[if] keyword[not] identifier[table] :
... | def get_table_keys_name(self, table_name, keys):
"""
Given a set of keys, extracts the key and range key
"""
table = self.tables.get(table_name)
if not table:
return (None, None) # depends on [control=['if'], data=[]]
else:
if len(keys) == 1:
for key in keys:... |
def play_alert(zones, alert_uri, alert_volume=20, alert_duration=0, fade_back=False):
"""
Demo function using soco.snapshot across multiple Sonos players.
Args:
zones (set): a set of SoCo objects
alert_uri (str): uri that Sonos can play as an alert
alert_volume (int): volume level f... | def function[play_alert, parameter[zones, alert_uri, alert_volume, alert_duration, fade_back]]:
constant[
Demo function using soco.snapshot across multiple Sonos players.
Args:
zones (set): a set of SoCo objects
alert_uri (str): uri that Sonos can play as an alert
alert_volume (... | keyword[def] identifier[play_alert] ( identifier[zones] , identifier[alert_uri] , identifier[alert_volume] = literal[int] , identifier[alert_duration] = literal[int] , identifier[fade_back] = keyword[False] ):
literal[string]
keyword[for] identifier[zone] keyword[in] identifier[zones] :
i... | def play_alert(zones, alert_uri, alert_volume=20, alert_duration=0, fade_back=False):
"""
Demo function using soco.snapshot across multiple Sonos players.
Args:
zones (set): a set of SoCo objects
alert_uri (str): uri that Sonos can play as an alert
alert_volume (int): volume level f... |
def create_cluster(self, node_list, cluster_attrs={}, node_attrs={}):
'''
API:
create_cluster(self, node_list, cluster_attrs, node_attrs)
Description:
Creates a cluster from the node given in the node list.
Input:
node_list: List of nodes in the cluste... | def function[create_cluster, parameter[self, node_list, cluster_attrs, node_attrs]]:
constant[
API:
create_cluster(self, node_list, cluster_attrs, node_attrs)
Description:
Creates a cluster from the node given in the node list.
Input:
node_list: List o... | keyword[def] identifier[create_cluster] ( identifier[self] , identifier[node_list] , identifier[cluster_attrs] ={}, identifier[node_attrs] ={}):
literal[string]
keyword[if] literal[string] keyword[in] identifier[cluster_attrs] :
keyword[if] literal[string] keyword[in] identifier[... | def create_cluster(self, node_list, cluster_attrs={}, node_attrs={}):
"""
API:
create_cluster(self, node_list, cluster_attrs, node_attrs)
Description:
Creates a cluster from the node given in the node list.
Input:
node_list: List of nodes in the cluster.
... |
def check_page_for_warnings(html: str) -> None:
"""
Checks if is any warnings on page if so raises an exception
"""
soup = BeautifulSoup(html, 'html.parser')
warnings = soup.find_all('div', {'class': 'service_msg_warning'})
if warnings:
exception_msg = '; '.join((warning.get_text() for w... | def function[check_page_for_warnings, parameter[html]]:
constant[
Checks if is any warnings on page if so raises an exception
]
variable[soup] assign[=] call[name[BeautifulSoup], parameter[name[html], constant[html.parser]]]
variable[warnings] assign[=] call[name[soup].find_all, paramete... | keyword[def] identifier[check_page_for_warnings] ( identifier[html] : identifier[str] )-> keyword[None] :
literal[string]
identifier[soup] = identifier[BeautifulSoup] ( identifier[html] , literal[string] )
identifier[warnings] = identifier[soup] . identifier[find_all] ( literal[string] ,{ literal[stri... | def check_page_for_warnings(html: str) -> None:
"""
Checks if is any warnings on page if so raises an exception
"""
soup = BeautifulSoup(html, 'html.parser')
warnings = soup.find_all('div', {'class': 'service_msg_warning'})
if warnings:
exception_msg = '; '.join((warning.get_text() for w... |
def load(self):
"""Loads configuration file"""
# Config files prior to 0.2.4 dor not have config version keys
old_config = not self.cfg_file.Exists("config_version")
# Reset data
self.data.__dict__.update(self.defaults.__dict__)
for key in self.defaults.__dict__:
... | def function[load, parameter[self]]:
constant[Loads configuration file]
variable[old_config] assign[=] <ast.UnaryOp object at 0x7da1b16fc700>
call[name[self].data.__dict__.update, parameter[name[self].defaults.__dict__]]
for taget[name[key]] in starred[name[self].defaults.__dict__] begin... | keyword[def] identifier[load] ( identifier[self] ):
literal[string]
identifier[old_config] = keyword[not] identifier[self] . identifier[cfg_file] . identifier[Exists] ( literal[string] )
identifier[self] . identifier[data] . identifier[__dict__] . identifier[update] ( ... | def load(self):
"""Loads configuration file"""
# Config files prior to 0.2.4 dor not have config version keys
old_config = not self.cfg_file.Exists('config_version')
# Reset data
self.data.__dict__.update(self.defaults.__dict__)
for key in self.defaults.__dict__:
if self.cfg_file.Exists(... |
def bar(self, height='thickness', sort=False, reverse=False,
legend=None, ax=None, figsize=None, **kwargs):
"""
Make a bar plot of thickness per interval.
Args:
height (str): The property of the primary component to plot.
sort (bool or function): Eith... | def function[bar, parameter[self, height, sort, reverse, legend, ax, figsize]]:
constant[
Make a bar plot of thickness per interval.
Args:
height (str): The property of the primary component to plot.
sort (bool or function): Either pass a boolean indicating wheth... | keyword[def] identifier[bar] ( identifier[self] , identifier[height] = literal[string] , identifier[sort] = keyword[False] , identifier[reverse] = keyword[False] ,
identifier[legend] = keyword[None] , identifier[ax] = keyword[None] , identifier[figsize] = keyword[None] ,** identifier[kwargs] ):
literal[stri... | def bar(self, height='thickness', sort=False, reverse=False, legend=None, ax=None, figsize=None, **kwargs):
"""
Make a bar plot of thickness per interval.
Args:
height (str): The property of the primary component to plot.
sort (bool or function): Either pass a boolea... |
def table_formatter(self, dataframe, inc_header=1, inc_index=1):
"""Return a table formatter for the dataframe. Saves the user the need to import this class"""
return TableFormatter(dataframe, inc_header=inc_header, inc_index=inc_index) | def function[table_formatter, parameter[self, dataframe, inc_header, inc_index]]:
constant[Return a table formatter for the dataframe. Saves the user the need to import this class]
return[call[name[TableFormatter], parameter[name[dataframe]]]] | keyword[def] identifier[table_formatter] ( identifier[self] , identifier[dataframe] , identifier[inc_header] = literal[int] , identifier[inc_index] = literal[int] ):
literal[string]
keyword[return] identifier[TableFormatter] ( identifier[dataframe] , identifier[inc_header] = identifier[inc_header]... | def table_formatter(self, dataframe, inc_header=1, inc_index=1):
"""Return a table formatter for the dataframe. Saves the user the need to import this class"""
return TableFormatter(dataframe, inc_header=inc_header, inc_index=inc_index) |
def _configure_app(app_):
"""Configure the Flask WSGI app."""
app_.url_map.strict_slashes = False
app_.config.from_object(default_settings)
app_.config.from_envvar('JOB_CONFIG', silent=True)
db_url = app_.config.get('SQLALCHEMY_DATABASE_URI')
if not db_url:
raise Exception('No db_url in ... | def function[_configure_app, parameter[app_]]:
constant[Configure the Flask WSGI app.]
name[app_].url_map.strict_slashes assign[=] constant[False]
call[name[app_].config.from_object, parameter[name[default_settings]]]
call[name[app_].config.from_envvar, parameter[constant[JOB_CONFIG]]]
... | keyword[def] identifier[_configure_app] ( identifier[app_] ):
literal[string]
identifier[app_] . identifier[url_map] . identifier[strict_slashes] = keyword[False]
identifier[app_] . identifier[config] . identifier[from_object] ( identifier[default_settings] )
identifier[app_] . identifier[config... | def _configure_app(app_):
"""Configure the Flask WSGI app."""
app_.url_map.strict_slashes = False
app_.config.from_object(default_settings)
app_.config.from_envvar('JOB_CONFIG', silent=True)
db_url = app_.config.get('SQLALCHEMY_DATABASE_URI')
if not db_url:
raise Exception('No db_url in ... |
def update_campaign_archive(self, campaign_id, **kwargs): # noqa: E501
"""Archive a campaign. # noqa: E501
This command will archive a campaign. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
... | def function[update_campaign_archive, parameter[self, campaign_id]]:
constant[Archive a campaign. # noqa: E501
This command will archive a campaign. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=Tru... | keyword[def] identifier[update_campaign_archive] ( identifier[self] , identifier[campaign_id] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] [ literal[string] ]= keyword[True]
keyword[if] identifier[kwargs] . identifier[get] ( literal[string] ):
keyword[return]... | def update_campaign_archive(self, campaign_id, **kwargs): # noqa: E501
'Archive a campaign. # noqa: E501\n\n This command will archive a campaign. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass asynchronous=True\n ... |
def image(self, render_mode):
""" Get the image associated with a particular render mode """
if render_mode == RenderMode.SEGMASK:
return self.query_im
elif render_mode == RenderMode.COLOR:
return self.color_im
elif render_mode == RenderMode.DEPTH:
ret... | def function[image, parameter[self, render_mode]]:
constant[ Get the image associated with a particular render mode ]
if compare[name[render_mode] equal[==] name[RenderMode].SEGMASK] begin[:]
return[name[self].query_im] | keyword[def] identifier[image] ( identifier[self] , identifier[render_mode] ):
literal[string]
keyword[if] identifier[render_mode] == identifier[RenderMode] . identifier[SEGMASK] :
keyword[return] identifier[self] . identifier[query_im]
keyword[elif] identifier[render_mode... | def image(self, render_mode):
""" Get the image associated with a particular render mode """
if render_mode == RenderMode.SEGMASK:
return self.query_im # depends on [control=['if'], data=[]]
elif render_mode == RenderMode.COLOR:
return self.color_im # depends on [control=['if'], data=[]]
... |
def validate_enum_attribute(fully_qualified_name: str, spec: Dict[str, Any], attribute: str,
candidates: Set[Union[str, int, float]]) -> Optional[InvalidValueError]:
""" Validates to ensure that the value of an attribute lies within an allowed set of candidates """
if attribute not ... | def function[validate_enum_attribute, parameter[fully_qualified_name, spec, attribute, candidates]]:
constant[ Validates to ensure that the value of an attribute lies within an allowed set of candidates ]
if compare[name[attribute] <ast.NotIn object at 0x7da2590d7190> name[spec]] begin[:]
return... | keyword[def] identifier[validate_enum_attribute] ( identifier[fully_qualified_name] : identifier[str] , identifier[spec] : identifier[Dict] [ identifier[str] , identifier[Any] ], identifier[attribute] : identifier[str] ,
identifier[candidates] : identifier[Set] [ identifier[Union] [ identifier[str] , identifier[int]... | def validate_enum_attribute(fully_qualified_name: str, spec: Dict[str, Any], attribute: str, candidates: Set[Union[str, int, float]]) -> Optional[InvalidValueError]:
""" Validates to ensure that the value of an attribute lies within an allowed set of candidates """
if attribute not in spec:
return # de... |
def create_plugin(plugin_data,
verify_plugin=True,
conn=None):
"""
:param plugin_data: <dict> dict matching Plugin()
:param verify_plugin: <bool>
:param conn: <rethinkdb.DefaultConnection>
:return: <dict> rethinkdb insert response value
"""
assert isinstan... | def function[create_plugin, parameter[plugin_data, verify_plugin, conn]]:
constant[
:param plugin_data: <dict> dict matching Plugin()
:param verify_plugin: <bool>
:param conn: <rethinkdb.DefaultConnection>
:return: <dict> rethinkdb insert response value
]
assert[call[name[isinstance], pa... | keyword[def] identifier[create_plugin] ( identifier[plugin_data] ,
identifier[verify_plugin] = keyword[True] ,
identifier[conn] = keyword[None] ):
literal[string]
keyword[assert] identifier[isinstance] ( identifier[plugin_data] , identifier[dict] )
keyword[if] identifier[verify_plugin] keyword[an... | def create_plugin(plugin_data, verify_plugin=True, conn=None):
"""
:param plugin_data: <dict> dict matching Plugin()
:param verify_plugin: <bool>
:param conn: <rethinkdb.DefaultConnection>
:return: <dict> rethinkdb insert response value
"""
assert isinstance(plugin_data, dict)
if verify_... |
def default(self, obj):
"""
Convert QuerySet objects to their list counter-parts
"""
if isinstance(obj, models.Model):
return self.encode(model_to_dict(obj))
elif isinstance(obj, models.query.QuerySet):
return serializers.serialize('json', obj)
els... | def function[default, parameter[self, obj]]:
constant[
Convert QuerySet objects to their list counter-parts
]
if call[name[isinstance], parameter[name[obj], name[models].Model]] begin[:]
return[call[name[self].encode, parameter[call[name[model_to_dict], parameter[name[obj]]]]]] | keyword[def] identifier[default] ( identifier[self] , identifier[obj] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[obj] , identifier[models] . identifier[Model] ):
keyword[return] identifier[self] . identifier[encode] ( identifier[model_to_dict] ( identifier[obj... | def default(self, obj):
"""
Convert QuerySet objects to their list counter-parts
"""
if isinstance(obj, models.Model):
return self.encode(model_to_dict(obj)) # depends on [control=['if'], data=[]]
elif isinstance(obj, models.query.QuerySet):
return serializers.serialize('jso... |
def run(vrn_info, calls_by_name, somatic_info, do_plots=True, handle_failures=True):
"""Run BubbleTree given variant calls, CNVs and somatic
"""
if "seq2c" in calls_by_name:
cnv_info = calls_by_name["seq2c"]
elif "cnvkit" in calls_by_name:
cnv_info = calls_by_name["cnvkit"]
else:
... | def function[run, parameter[vrn_info, calls_by_name, somatic_info, do_plots, handle_failures]]:
constant[Run BubbleTree given variant calls, CNVs and somatic
]
if compare[constant[seq2c] in name[calls_by_name]] begin[:]
variable[cnv_info] assign[=] call[name[calls_by_name]][constant[... | keyword[def] identifier[run] ( identifier[vrn_info] , identifier[calls_by_name] , identifier[somatic_info] , identifier[do_plots] = keyword[True] , identifier[handle_failures] = keyword[True] ):
literal[string]
keyword[if] literal[string] keyword[in] identifier[calls_by_name] :
identifier[cnv_i... | def run(vrn_info, calls_by_name, somatic_info, do_plots=True, handle_failures=True):
"""Run BubbleTree given variant calls, CNVs and somatic
"""
if 'seq2c' in calls_by_name:
cnv_info = calls_by_name['seq2c'] # depends on [control=['if'], data=['calls_by_name']]
elif 'cnvkit' in calls_by_name:
... |
def close(self):
"""
Closes this QEMU VM.
"""
if not (yield from super().close()):
return False
self.acpi_shutdown = False
yield from self.stop()
for adapter in self._ethernet_adapters:
if adapter is not None:
for nio in ... | def function[close, parameter[self]]:
constant[
Closes this QEMU VM.
]
if <ast.UnaryOp object at 0x7da18eb56320> begin[:]
return[constant[False]]
name[self].acpi_shutdown assign[=] constant[False]
<ast.YieldFrom object at 0x7da18eb54490>
for taget[name[ada... | keyword[def] identifier[close] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] ( keyword[yield] keyword[from] identifier[super] (). identifier[close] ()):
keyword[return] keyword[False]
identifier[self] . identifier[acpi_shutdown] = keyword[False]
... | def close(self):
"""
Closes this QEMU VM.
"""
if not (yield from super().close()):
return False # depends on [control=['if'], data=[]]
self.acpi_shutdown = False
yield from self.stop()
for adapter in self._ethernet_adapters:
if adapter is not None:
for ni... |
def requirements(fname):
"""
Generator to parse requirements.txt file
Supports bits of extended pip format (git urls)
"""
with open(fname) as f:
for line in f:
match = re.search('#egg=(.*)$', line)
if match:
yield match.groups()[0]
else:
... | def function[requirements, parameter[fname]]:
constant[
Generator to parse requirements.txt file
Supports bits of extended pip format (git urls)
]
with call[name[open], parameter[name[fname]]] begin[:]
for taget[name[line]] in starred[name[f]] begin[:]
... | keyword[def] identifier[requirements] ( identifier[fname] ):
literal[string]
keyword[with] identifier[open] ( identifier[fname] ) keyword[as] identifier[f] :
keyword[for] identifier[line] keyword[in] identifier[f] :
identifier[match] = identifier[re] . identifier[search] ( litera... | def requirements(fname):
"""
Generator to parse requirements.txt file
Supports bits of extended pip format (git urls)
"""
with open(fname) as f:
for line in f:
match = re.search('#egg=(.*)$', line)
if match:
yield match.groups()[0] # depends on [cont... |
def read(*paths):
"""Build a file path from *paths* and return the contents."""
with open(os.path.join(*paths), 'r') as file_handler:
return file_handler.read() | def function[read, parameter[]]:
constant[Build a file path from *paths* and return the contents.]
with call[name[open], parameter[call[name[os].path.join, parameter[<ast.Starred object at 0x7da2041d9a20>]], constant[r]]] begin[:]
return[call[name[file_handler].read, parameter[]]] | keyword[def] identifier[read] (* identifier[paths] ):
literal[string]
keyword[with] identifier[open] ( identifier[os] . identifier[path] . identifier[join] (* identifier[paths] ), literal[string] ) keyword[as] identifier[file_handler] :
keyword[return] identifier[file_handler] . identifier[read... | def read(*paths):
"""Build a file path from *paths* and return the contents."""
with open(os.path.join(*paths), 'r') as file_handler:
return file_handler.read() # depends on [control=['with'], data=['file_handler']] |
def setObsoletedByResponse(
self, pid, obsoletedByPid, serialVersion, vendorSpecific=None
):
"""CNCore.setObsoletedBy(session, pid, obsoletedByPid, serialVersion) → boolean
https://releases.dataone.org/online/api-
documentation-v2.0.1/apis/CN_APIs.html#CNCore.setObsoletedBy.
... | def function[setObsoletedByResponse, parameter[self, pid, obsoletedByPid, serialVersion, vendorSpecific]]:
constant[CNCore.setObsoletedBy(session, pid, obsoletedByPid, serialVersion) → boolean
https://releases.dataone.org/online/api-
documentation-v2.0.1/apis/CN_APIs.html#CNCore.setObsoletedBy.
... | keyword[def] identifier[setObsoletedByResponse] (
identifier[self] , identifier[pid] , identifier[obsoletedByPid] , identifier[serialVersion] , identifier[vendorSpecific] = keyword[None]
):
literal[string]
identifier[mmp_dict] ={
literal[string] : identifier[obsoletedByPid] ,
li... | def setObsoletedByResponse(self, pid, obsoletedByPid, serialVersion, vendorSpecific=None):
"""CNCore.setObsoletedBy(session, pid, obsoletedByPid, serialVersion) → boolean
https://releases.dataone.org/online/api-
documentation-v2.0.1/apis/CN_APIs.html#CNCore.setObsoletedBy.
Args:
p... |
def _simple_new(cls, values, name=None, dtype=None, **kwargs):
"""
We require that we have a dtype compat for the values. If we are passed
a non-dtype compat, then coerce using the constructor.
Must be careful not to recurse.
"""
if not hasattr(values, 'dtype'):
... | def function[_simple_new, parameter[cls, values, name, dtype]]:
constant[
We require that we have a dtype compat for the values. If we are passed
a non-dtype compat, then coerce using the constructor.
Must be careful not to recurse.
]
if <ast.UnaryOp object at 0x7da1b234... | keyword[def] identifier[_simple_new] ( identifier[cls] , identifier[values] , identifier[name] = keyword[None] , identifier[dtype] = keyword[None] ,** identifier[kwargs] ):
literal[string]
keyword[if] keyword[not] identifier[hasattr] ( identifier[values] , literal[string] ):
keyword[... | def _simple_new(cls, values, name=None, dtype=None, **kwargs):
"""
We require that we have a dtype compat for the values. If we are passed
a non-dtype compat, then coerce using the constructor.
Must be careful not to recurse.
"""
if not hasattr(values, 'dtype'):
if (valu... |
def from_file(cls, filename, **kwargs):
"""Create a reddening law from file.
If filename has 'fits' or 'fit' suffix, it is read as FITS.
Otherwise, it is read as ASCII.
Parameters
----------
filename : str
Reddening law filename.
kwargs : dict
... | def function[from_file, parameter[cls, filename]]:
constant[Create a reddening law from file.
If filename has 'fits' or 'fit' suffix, it is read as FITS.
Otherwise, it is read as ASCII.
Parameters
----------
filename : str
Reddening law filename.
kw... | keyword[def] identifier[from_file] ( identifier[cls] , identifier[filename] ,** identifier[kwargs] ):
literal[string]
keyword[if] literal[string] keyword[not] keyword[in] identifier[kwargs] :
identifier[kwargs] [ literal[string] ]= identifier[cls] . identifier[_internal_flux_unit] ... | def from_file(cls, filename, **kwargs):
"""Create a reddening law from file.
If filename has 'fits' or 'fit' suffix, it is read as FITS.
Otherwise, it is read as ASCII.
Parameters
----------
filename : str
Reddening law filename.
kwargs : dict
... |
def sleep_here(count, t):
"""simple function that takes args, prints a short message, sleeps for a time, and returns the same args"""
import time,sys
print("hi from engine %i" % id)
sys.stdout.flush()
time.sleep(t)
return count,t | def function[sleep_here, parameter[count, t]]:
constant[simple function that takes args, prints a short message, sleeps for a time, and returns the same args]
import module[time], module[sys]
call[name[print], parameter[binary_operation[constant[hi from engine %i] <ast.Mod object at 0x7da2590d6920> ... | keyword[def] identifier[sleep_here] ( identifier[count] , identifier[t] ):
literal[string]
keyword[import] identifier[time] , identifier[sys]
identifier[print] ( literal[string] % identifier[id] )
identifier[sys] . identifier[stdout] . identifier[flush] ()
identifier[time] . identifier[sle... | def sleep_here(count, t):
"""simple function that takes args, prints a short message, sleeps for a time, and returns the same args"""
import time, sys
print('hi from engine %i' % id)
sys.stdout.flush()
time.sleep(t)
return (count, t) |
def load_logs(optimizer, logs):
"""Load previous ...
"""
import json
if isinstance(logs, str):
logs = [logs]
for log in logs:
with open(log, "r") as j:
while True:
try:
iteration = next(j)
except StopIteration:
... | def function[load_logs, parameter[optimizer, logs]]:
constant[Load previous ...
]
import module[json]
if call[name[isinstance], parameter[name[logs], name[str]]] begin[:]
variable[logs] assign[=] list[[<ast.Name object at 0x7da1b21e38e0>]]
for taget[name[log]] in starred... | keyword[def] identifier[load_logs] ( identifier[optimizer] , identifier[logs] ):
literal[string]
keyword[import] identifier[json]
keyword[if] identifier[isinstance] ( identifier[logs] , identifier[str] ):
identifier[logs] =[ identifier[logs] ]
keyword[for] identifier[log] keyword[... | def load_logs(optimizer, logs):
"""Load previous ...
"""
import json
if isinstance(logs, str):
logs = [logs] # depends on [control=['if'], data=[]]
for log in logs:
with open(log, 'r') as j:
while True:
try:
iteration = next(j) # dep... |
def contains_parent_dir(fpath, dirs):
"""
Returns true if paths in dirs start with fpath.
Precondition: dirs and fpath should be normalized before calling
this function.
"""
# Note: this function is used nowhere in pygccxml but is used
# at least by pypluplus; so it should stay here.
... | def function[contains_parent_dir, parameter[fpath, dirs]]:
constant[
Returns true if paths in dirs start with fpath.
Precondition: dirs and fpath should be normalized before calling
this function.
]
return[call[name[bool], parameter[<ast.ListComp object at 0x7da18dc98f10>]]] | keyword[def] identifier[contains_parent_dir] ( identifier[fpath] , identifier[dirs] ):
literal[string]
keyword[return] identifier[bool] ([ identifier[x] keyword[for] identifier[x] keyword[in] identifier[dirs] keyword[if] identifier[_f] ( identifier[fpath] , identifier[x] )]) | def contains_parent_dir(fpath, dirs):
"""
Returns true if paths in dirs start with fpath.
Precondition: dirs and fpath should be normalized before calling
this function.
"""
# Note: this function is used nowhere in pygccxml but is used
# at least by pypluplus; so it should stay here.
r... |
def Add(self, category, label, age):
"""Adds another instance of this category into the active_days counter.
We automatically count the event towards all relevant active_days. For
example, if the category "Windows" was seen 8 days ago it will be counted
towards the 30 day active, 14 day active but not ... | def function[Add, parameter[self, category, label, age]]:
constant[Adds another instance of this category into the active_days counter.
We automatically count the event towards all relevant active_days. For
example, if the category "Windows" was seen 8 days ago it will be counted
towards the 30 day... | keyword[def] identifier[Add] ( identifier[self] , identifier[category] , identifier[label] , identifier[age] ):
literal[string]
identifier[now] = identifier[rdfvalue] . identifier[RDFDatetime] . identifier[Now] ()
identifier[category] = identifier[utils] . identifier[SmartUnicode] ( identifier[categor... | def Add(self, category, label, age):
"""Adds another instance of this category into the active_days counter.
We automatically count the event towards all relevant active_days. For
example, if the category "Windows" was seen 8 days ago it will be counted
towards the 30 day active, 14 day active but not ... |
def remove_nonspeech_fragments(self, zero_length_only=False):
"""
Remove ``NONSPEECH`` fragments from the list.
If ``zero_length_only`` is ``True``, remove only
those fragments with zero length,
and make all the others ``REGULAR``.
:param bool zero_length_only: remove o... | def function[remove_nonspeech_fragments, parameter[self, zero_length_only]]:
constant[
Remove ``NONSPEECH`` fragments from the list.
If ``zero_length_only`` is ``True``, remove only
those fragments with zero length,
and make all the others ``REGULAR``.
:param bool zero_... | keyword[def] identifier[remove_nonspeech_fragments] ( identifier[self] , identifier[zero_length_only] = keyword[False] ):
literal[string]
identifier[self] . identifier[log] ( literal[string] )
identifier[nonspeech] = identifier[list] ( identifier[self] . identifier[nonspeech_fragments] )
... | def remove_nonspeech_fragments(self, zero_length_only=False):
"""
Remove ``NONSPEECH`` fragments from the list.
If ``zero_length_only`` is ``True``, remove only
those fragments with zero length,
and make all the others ``REGULAR``.
:param bool zero_length_only: remove only ... |
def _ReadData(self, file_object, file_offset, data_size):
"""Reads data.
Args:
file_object (dvfvs.FileIO): a file-like object to read.
file_offset (int): offset of the data relative to the start of
the file-like object.
data_size (int): size of the data. The resulting data size much... | def function[_ReadData, parameter[self, file_object, file_offset, data_size]]:
constant[Reads data.
Args:
file_object (dvfvs.FileIO): a file-like object to read.
file_offset (int): offset of the data relative to the start of
the file-like object.
data_size (int): size of the dat... | keyword[def] identifier[_ReadData] ( identifier[self] , identifier[file_object] , identifier[file_offset] , identifier[data_size] ):
literal[string]
keyword[if] keyword[not] identifier[file_object] :
keyword[raise] identifier[ValueError] ( literal[string] )
identifier[file_object] . identif... | def _ReadData(self, file_object, file_offset, data_size):
"""Reads data.
Args:
file_object (dvfvs.FileIO): a file-like object to read.
file_offset (int): offset of the data relative to the start of
the file-like object.
data_size (int): size of the data. The resulting data size much... |
def compute_hkdf(ikm, salt):
"""
Standard hkdf algorithm
:param {Buffer} ikm Input key material.
:param {Buffer} salt Salt value.
:return {Buffer} Strong key material.
@private
"""
prk = hmac.new(salt, ikm, hashlib.sha256).digest()
info_bits_update = info_bits + bytearray(chr(1), 'ut... | def function[compute_hkdf, parameter[ikm, salt]]:
constant[
Standard hkdf algorithm
:param {Buffer} ikm Input key material.
:param {Buffer} salt Salt value.
:return {Buffer} Strong key material.
@private
]
variable[prk] assign[=] call[call[name[hmac].new, parameter[name[salt], na... | keyword[def] identifier[compute_hkdf] ( identifier[ikm] , identifier[salt] ):
literal[string]
identifier[prk] = identifier[hmac] . identifier[new] ( identifier[salt] , identifier[ikm] , identifier[hashlib] . identifier[sha256] ). identifier[digest] ()
identifier[info_bits_update] = identifier[info_bit... | def compute_hkdf(ikm, salt):
"""
Standard hkdf algorithm
:param {Buffer} ikm Input key material.
:param {Buffer} salt Salt value.
:return {Buffer} Strong key material.
@private
"""
prk = hmac.new(salt, ikm, hashlib.sha256).digest()
info_bits_update = info_bits + bytearray(chr(1), 'ut... |
def job_listener(event):
'''Listens to completed job'''
job_id = event.job.args[0]
if event.code == events.EVENT_JOB_MISSED:
db.mark_job_as_missed(job_id)
elif event.exception:
if isinstance(event.exception, util.JobError):
error_object = event.exception.as_dict()
el... | def function[job_listener, parameter[event]]:
constant[Listens to completed job]
variable[job_id] assign[=] call[name[event].job.args][constant[0]]
if compare[name[event].code equal[==] name[events].EVENT_JOB_MISSED] begin[:]
call[name[db].mark_job_as_missed, parameter[name[job_i... | keyword[def] identifier[job_listener] ( identifier[event] ):
literal[string]
identifier[job_id] = identifier[event] . identifier[job] . identifier[args] [ literal[int] ]
keyword[if] identifier[event] . identifier[code] == identifier[events] . identifier[EVENT_JOB_MISSED] :
identifier[db] . ... | def job_listener(event):
"""Listens to completed job"""
job_id = event.job.args[0]
if event.code == events.EVENT_JOB_MISSED:
db.mark_job_as_missed(job_id) # depends on [control=['if'], data=[]]
elif event.exception:
if isinstance(event.exception, util.JobError):
error_object... |
def key_click(self, key):
"""
为自定义菜单 ``(click)`` 事件添加 handler 的简便方法。
**@key_click('KEYNAME')** 用来为特定 key 的点击事件添加 handler 方法。
"""
def wraps(f):
argc = len(signature(f).parameters.keys())
@self.click
def onclick(message, session=None):
... | def function[key_click, parameter[self, key]]:
constant[
为自定义菜单 ``(click)`` 事件添加 handler 的简便方法。
**@key_click('KEYNAME')** 用来为特定 key 的点击事件添加 handler 方法。
]
def function[wraps, parameter[f]]:
variable[argc] assign[=] call[name[len], parameter[call[call[name[signatur... | keyword[def] identifier[key_click] ( identifier[self] , identifier[key] ):
literal[string]
keyword[def] identifier[wraps] ( identifier[f] ):
identifier[argc] = identifier[len] ( identifier[signature] ( identifier[f] ). identifier[parameters] . identifier[keys] ())
@ iden... | def key_click(self, key):
"""
为自定义菜单 ``(click)`` 事件添加 handler 的简便方法。
**@key_click('KEYNAME')** 用来为特定 key 的点击事件添加 handler 方法。
"""
def wraps(f):
argc = len(signature(f).parameters.keys())
@self.click
def onclick(message, session=None):
if message.key ... |
def saveFormatFile(self, filename, format):
"""Dump an XML document to a file. Will use compression if
compiled in and enabled. If @filename is "-" the stdout
file is used. If @format is set then the document will be
indented on output. Note that @format = 1 provide node
... | def function[saveFormatFile, parameter[self, filename, format]]:
constant[Dump an XML document to a file. Will use compression if
compiled in and enabled. If @filename is "-" the stdout
file is used. If @format is set then the document will be
indented on output. Note that @format ... | keyword[def] identifier[saveFormatFile] ( identifier[self] , identifier[filename] , identifier[format] ):
literal[string]
identifier[ret] = identifier[libxml2mod] . identifier[xmlSaveFormatFile] ( identifier[filename] , identifier[self] . identifier[_o] , identifier[format] )
keyword[retur... | def saveFormatFile(self, filename, format):
"""Dump an XML document to a file. Will use compression if
compiled in and enabled. If @filename is "-" the stdout
file is used. If @format is set then the document will be
indented on output. Note that @format = 1 provide node
inde... |
def list_user_topics(self, start=0):
"""
发表的话题
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_LIST_USER_PUBLISHED_TOPICS % self.api.user_alias, params={'start': start})
return build_list_result(self._parse_topic_table(xml, 'title,comme... | def function[list_user_topics, parameter[self, start]]:
constant[
发表的话题
:param start: 翻页
:return: 带下一页的列表
]
variable[xml] assign[=] call[name[self].api.xml, parameter[binary_operation[name[API_GROUP_LIST_USER_PUBLISHED_TOPICS] <ast.Mod object at 0x7da2590d6920> n... | keyword[def] identifier[list_user_topics] ( identifier[self] , identifier[start] = literal[int] ):
literal[string]
identifier[xml] = identifier[self] . identifier[api] . identifier[xml] ( identifier[API_GROUP_LIST_USER_PUBLISHED_TOPICS] % identifier[self] . identifier[api] . identifier[user_alias] ... | def list_user_topics(self, start=0):
"""
发表的话题
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_LIST_USER_PUBLISHED_TOPICS % self.api.user_alias, params={'start': start})
return build_list_result(self._parse_topic_table(xml, 'title,comment,created,g... |
def alter(self, operation, timeout=None, metadata=None, credentials=None):
"""Runs alter operation."""
return self.stub.Alter(operation, timeout=timeout, metadata=metadata,
credentials=credentials) | def function[alter, parameter[self, operation, timeout, metadata, credentials]]:
constant[Runs alter operation.]
return[call[name[self].stub.Alter, parameter[name[operation]]]] | keyword[def] identifier[alter] ( identifier[self] , identifier[operation] , identifier[timeout] = keyword[None] , identifier[metadata] = keyword[None] , identifier[credentials] = keyword[None] ):
literal[string]
keyword[return] identifier[self] . identifier[stub] . identifier[Alter] ( identifier[o... | def alter(self, operation, timeout=None, metadata=None, credentials=None):
"""Runs alter operation."""
return self.stub.Alter(operation, timeout=timeout, metadata=metadata, credentials=credentials) |
def unique_list(input_list):
r"""
For a given list (of points) remove any duplicates
"""
output_list = []
if len(input_list) > 0:
dim = _sp.shape(input_list)[1]
for i in input_list:
match = False
for j in output_list:
if dim == 3:
... | def function[unique_list, parameter[input_list]]:
constant[
For a given list (of points) remove any duplicates
]
variable[output_list] assign[=] list[[]]
if compare[call[name[len], parameter[name[input_list]]] greater[>] constant[0]] begin[:]
variable[dim] assign[=] call[... | keyword[def] identifier[unique_list] ( identifier[input_list] ):
literal[string]
identifier[output_list] =[]
keyword[if] identifier[len] ( identifier[input_list] )> literal[int] :
identifier[dim] = identifier[_sp] . identifier[shape] ( identifier[input_list] )[ literal[int] ]
keywor... | def unique_list(input_list):
"""
For a given list (of points) remove any duplicates
"""
output_list = []
if len(input_list) > 0:
dim = _sp.shape(input_list)[1]
for i in input_list:
match = False
for j in output_list:
if dim == 3:
... |
def execute_code_block(elem, doc):
"""Executes a code block by passing it to the executor.
Args:
elem The AST element.
doc The document.
Returns:
The output of the command.
"""
command = select_executor(elem, doc).split(' ')
code = elem.text
if 'plt' in elem.attrib... | def function[execute_code_block, parameter[elem, doc]]:
constant[Executes a code block by passing it to the executor.
Args:
elem The AST element.
doc The document.
Returns:
The output of the command.
]
variable[command] assign[=] call[call[name[select_executor], pa... | keyword[def] identifier[execute_code_block] ( identifier[elem] , identifier[doc] ):
literal[string]
identifier[command] = identifier[select_executor] ( identifier[elem] , identifier[doc] ). identifier[split] ( literal[string] )
identifier[code] = identifier[elem] . identifier[text]
keyword[if] ... | def execute_code_block(elem, doc):
"""Executes a code block by passing it to the executor.
Args:
elem The AST element.
doc The document.
Returns:
The output of the command.
"""
command = select_executor(elem, doc).split(' ')
code = elem.text
if 'plt' in elem.attrib... |
def joint_sfs_folded(ac1, ac2, n1=None, n2=None):
"""Compute the joint folded site frequency spectrum between two
populations.
Parameters
----------
ac1 : array_like, int, shape (n_variants, 2)
Allele counts for the first population.
ac2 : array_like, int, shape (n_variants, 2)
... | def function[joint_sfs_folded, parameter[ac1, ac2, n1, n2]]:
constant[Compute the joint folded site frequency spectrum between two
populations.
Parameters
----------
ac1 : array_like, int, shape (n_variants, 2)
Allele counts for the first population.
ac2 : array_like, int, shape (n_... | keyword[def] identifier[joint_sfs_folded] ( identifier[ac1] , identifier[ac2] , identifier[n1] = keyword[None] , identifier[n2] = keyword[None] ):
literal[string]
identifier[ac1] , identifier[n1] = identifier[_check_ac_n] ( identifier[ac1] , identifier[n1] )
identifier[ac2] , identifier[n2] = id... | def joint_sfs_folded(ac1, ac2, n1=None, n2=None):
"""Compute the joint folded site frequency spectrum between two
populations.
Parameters
----------
ac1 : array_like, int, shape (n_variants, 2)
Allele counts for the first population.
ac2 : array_like, int, shape (n_variants, 2)
... |
def findObjects(self, template=()):
"""
find the objects matching the template pattern
:param template: list of attributes tuples (attribute,value).
The default value is () and all the objects are returned
:type template: list
:return: a list of object ids
:rty... | def function[findObjects, parameter[self, template]]:
constant[
find the objects matching the template pattern
:param template: list of attributes tuples (attribute,value).
The default value is () and all the objects are returned
:type template: list
:return: a list of... | keyword[def] identifier[findObjects] ( identifier[self] , identifier[template] =()):
literal[string]
identifier[t] = identifier[self] . identifier[_template2ckattrlist] ( identifier[template] )
identifier[result] = identifier[PyKCS11] . identifier[LowLevel] . identifier[ckobjlist... | def findObjects(self, template=()):
"""
find the objects matching the template pattern
:param template: list of attributes tuples (attribute,value).
The default value is () and all the objects are returned
:type template: list
:return: a list of object ids
:rtype: ... |
def _toggleSectionActiveState(self, sectionName, state, skipList):
""" Make an entire section (minus skipList items) either active or
inactive. sectionName is the same as the param's scope. """
# Get model data, the list of pars
theParamList = self._taskParsObj.getParList()
... | def function[_toggleSectionActiveState, parameter[self, sectionName, state, skipList]]:
constant[ Make an entire section (minus skipList items) either active or
inactive. sectionName is the same as the param's scope. ]
variable[theParamList] assign[=] call[name[self]._taskParsObj.getParList... | keyword[def] identifier[_toggleSectionActiveState] ( identifier[self] , identifier[sectionName] , identifier[state] , identifier[skipList] ):
literal[string]
identifier[theParamList] = identifier[self] . identifier[_taskParsObj] . identifier[getParList] ()
keyword[for] ... | def _toggleSectionActiveState(self, sectionName, state, skipList):
""" Make an entire section (minus skipList items) either active or
inactive. sectionName is the same as the param's scope. """
# Get model data, the list of pars
theParamList = self._taskParsObj.getParList()
# Loop over thei... |
def fut_ticker(gen_ticker: str, dt, freq: str, log=logs.LOG_LEVEL) -> str:
"""
Get proper ticker from generic ticker
Args:
gen_ticker: generic ticker
dt: date
freq: futures contract frequency
log: level of logs
Returns:
str: exact futures ticker
"""
logg... | def function[fut_ticker, parameter[gen_ticker, dt, freq, log]]:
constant[
Get proper ticker from generic ticker
Args:
gen_ticker: generic ticker
dt: date
freq: futures contract frequency
log: level of logs
Returns:
str: exact futures ticker
]
var... | keyword[def] identifier[fut_ticker] ( identifier[gen_ticker] : identifier[str] , identifier[dt] , identifier[freq] : identifier[str] , identifier[log] = identifier[logs] . identifier[LOG_LEVEL] )-> identifier[str] :
literal[string]
identifier[logger] = identifier[logs] . identifier[get_logger] ( identifier... | def fut_ticker(gen_ticker: str, dt, freq: str, log=logs.LOG_LEVEL) -> str:
"""
Get proper ticker from generic ticker
Args:
gen_ticker: generic ticker
dt: date
freq: futures contract frequency
log: level of logs
Returns:
str: exact futures ticker
"""
logg... |
def columns_dataset(self):
"""
Generate the columns and the whole dataset.
"""
data = {}
words_total = {}
for instance, words in self.raw_dataset.items():
words_item_total = {}
for word in words:
words_total.setdefault(word, 0)
... | def function[columns_dataset, parameter[self]]:
constant[
Generate the columns and the whole dataset.
]
variable[data] assign[=] dictionary[[], []]
variable[words_total] assign[=] dictionary[[], []]
for taget[tuple[[<ast.Name object at 0x7da1b1d99960>, <ast.Name object at... | keyword[def] identifier[columns_dataset] ( identifier[self] ):
literal[string]
identifier[data] ={}
identifier[words_total] ={}
keyword[for] identifier[instance] , identifier[words] keyword[in] identifier[self] . identifier[raw_dataset] . identifier[items] ():
ide... | def columns_dataset(self):
"""
Generate the columns and the whole dataset.
"""
data = {}
words_total = {}
for (instance, words) in self.raw_dataset.items():
words_item_total = {}
for word in words:
words_total.setdefault(word, 0)
words_item_total.s... |
def database_caller_creator(self, name=None):
'''creates a sqlite3 db
returns the related connection object
which will be later used to spawn the cursor
'''
try:
if name:
database = name + '.db'
else:
database = 'sqlite_' +... | def function[database_caller_creator, parameter[self, name]]:
constant[creates a sqlite3 db
returns the related connection object
which will be later used to spawn the cursor
]
<ast.Try object at 0x7da1b08e4280>
return[name[conn]] | keyword[def] identifier[database_caller_creator] ( identifier[self] , identifier[name] = keyword[None] ):
literal[string]
keyword[try] :
keyword[if] identifier[name] :
identifier[database] = identifier[name] + literal[string]
keyword[else] :
... | def database_caller_creator(self, name=None):
"""creates a sqlite3 db
returns the related connection object
which will be later used to spawn the cursor
"""
try:
if name:
database = name + '.db' # depends on [control=['if'], data=[]]
else:
databas... |
def start_collecting_data(self, queues=None, edge=None, edge_type=None):
"""Tells the queues to collect data on agents' arrival, service
start, and departure times.
If none of the parameters are given then every
:class:`.QueueServer` will start collecting data.
Parameters
... | def function[start_collecting_data, parameter[self, queues, edge, edge_type]]:
constant[Tells the queues to collect data on agents' arrival, service
start, and departure times.
If none of the parameters are given then every
:class:`.QueueServer` will start collecting data.
Para... | keyword[def] identifier[start_collecting_data] ( identifier[self] , identifier[queues] = keyword[None] , identifier[edge] = keyword[None] , identifier[edge_type] = keyword[None] ):
literal[string]
identifier[queues] = identifier[_get_queues] ( identifier[self] . identifier[g] , identifier[queues] ,... | def start_collecting_data(self, queues=None, edge=None, edge_type=None):
"""Tells the queues to collect data on agents' arrival, service
start, and departure times.
If none of the parameters are given then every
:class:`.QueueServer` will start collecting data.
Parameters
-... |
def merge(polylines, mx_dist=4):
"""
point by line segment comparison
merge polylines if points are close
"""
l = len(polylines)
to_remove = set()
for n in range(l - 1, -1, -1):
if n not in to_remove:
c = polylines[n]
for p0, p1 in zip(c[:-1], c[1:]):
... | def function[merge, parameter[polylines, mx_dist]]:
constant[
point by line segment comparison
merge polylines if points are close
]
variable[l] assign[=] call[name[len], parameter[name[polylines]]]
variable[to_remove] assign[=] call[name[set], parameter[]]
for taget[name[n]]... | keyword[def] identifier[merge] ( identifier[polylines] , identifier[mx_dist] = literal[int] ):
literal[string]
identifier[l] = identifier[len] ( identifier[polylines] )
identifier[to_remove] = identifier[set] ()
keyword[for] identifier[n] keyword[in] identifier[range] ( identifier[l] - literal... | def merge(polylines, mx_dist=4):
"""
point by line segment comparison
merge polylines if points are close
"""
l = len(polylines)
to_remove = set()
for n in range(l - 1, -1, -1):
if n not in to_remove:
c = polylines[n]
for (p0, p1) in zip(c[:-1], c[1:]):
... |
def get_md5hash(self, bucket_name, object_name):
"""
Gets the MD5 hash of an object in Google Cloud Storage.
:param bucket_name: The Google cloud storage bucket where the blob_name is.
:type bucket_name: str
:param object_name: The name of the object to check in the Google cloud... | def function[get_md5hash, parameter[self, bucket_name, object_name]]:
constant[
Gets the MD5 hash of an object in Google Cloud Storage.
:param bucket_name: The Google cloud storage bucket where the blob_name is.
:type bucket_name: str
:param object_name: The name of the object t... | keyword[def] identifier[get_md5hash] ( identifier[self] , identifier[bucket_name] , identifier[object_name] ):
literal[string]
identifier[self] . identifier[log] . identifier[info] ( literal[string]
literal[string] , identifier[object_name] , identifier[bucket_name] )
identifier[... | def get_md5hash(self, bucket_name, object_name):
"""
Gets the MD5 hash of an object in Google Cloud Storage.
:param bucket_name: The Google cloud storage bucket where the blob_name is.
:type bucket_name: str
:param object_name: The name of the object to check in the Google cloud
... |
def _get_api_events(self, function):
"""
Method to return a dictionary of API Events on the function
:param SamResource function: Function Resource object
:return dict: Dictionary of API events along with any other configuration passed to it.
Example: {
FooEv... | def function[_get_api_events, parameter[self, function]]:
constant[
Method to return a dictionary of API Events on the function
:param SamResource function: Function Resource object
:return dict: Dictionary of API events along with any other configuration passed to it.
Examp... | keyword[def] identifier[_get_api_events] ( identifier[self] , identifier[function] ):
literal[string]
keyword[if] keyword[not] ( identifier[function] . identifier[valid] () keyword[and]
identifier[isinstance] ( identifier[function] . identifier[properties] , identifier[dict] ) keyword[a... | def _get_api_events(self, function):
"""
Method to return a dictionary of API Events on the function
:param SamResource function: Function Resource object
:return dict: Dictionary of API events along with any other configuration passed to it.
Example: {
FooEvent:... |
def _aux_type(self, i):
"""Data-type of the array's ith aux data.
Returns
-------
numpy.dtype
This BaseSparseNDArray's aux data type.
"""
aux_type = ctypes.c_int()
check_call(_LIB.MXNDArrayGetAuxType(self.handle, i, ctypes.byref(aux_type)))
re... | def function[_aux_type, parameter[self, i]]:
constant[Data-type of the array's ith aux data.
Returns
-------
numpy.dtype
This BaseSparseNDArray's aux data type.
]
variable[aux_type] assign[=] call[name[ctypes].c_int, parameter[]]
call[name[check_call]... | keyword[def] identifier[_aux_type] ( identifier[self] , identifier[i] ):
literal[string]
identifier[aux_type] = identifier[ctypes] . identifier[c_int] ()
identifier[check_call] ( identifier[_LIB] . identifier[MXNDArrayGetAuxType] ( identifier[self] . identifier[handle] , identifier[i] , id... | def _aux_type(self, i):
"""Data-type of the array's ith aux data.
Returns
-------
numpy.dtype
This BaseSparseNDArray's aux data type.
"""
aux_type = ctypes.c_int()
check_call(_LIB.MXNDArrayGetAuxType(self.handle, i, ctypes.byref(aux_type)))
return _DTYPE_MX_T... |
def register_type(env_type, alias=None):
"""Registers environment type.
:param str|unicode|Environment env_type: Environment type or its alias
(for already registered types).
:param str|unicode alias: Alias to register type under. If not set type name is used.
:rtype: Environment
"""
... | def function[register_type, parameter[env_type, alias]]:
constant[Registers environment type.
:param str|unicode|Environment env_type: Environment type or its alias
(for already registered types).
:param str|unicode alias: Alias to register type under. If not set type name is used.
:rtype... | keyword[def] identifier[register_type] ( identifier[env_type] , identifier[alias] = keyword[None] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[env_type] , identifier[string_types] ):
identifier[env_type] = identifier[TYPES] [ identifier[env_type] ]
keyword[if] identif... | def register_type(env_type, alias=None):
"""Registers environment type.
:param str|unicode|Environment env_type: Environment type or its alias
(for already registered types).
:param str|unicode alias: Alias to register type under. If not set type name is used.
:rtype: Environment
"""
... |
def has_method(obj, name):
"""
Checks if object has a method with specified name.
:param obj: an object to introspect.
:param name: a name of the method to check.
:return: true if the object has the method and false if it doesn't.
"""
if obj == None:
... | def function[has_method, parameter[obj, name]]:
constant[
Checks if object has a method with specified name.
:param obj: an object to introspect.
:param name: a name of the method to check.
:return: true if the object has the method and false if it doesn't.
]
i... | keyword[def] identifier[has_method] ( identifier[obj] , identifier[name] ):
literal[string]
keyword[if] identifier[obj] == keyword[None] :
keyword[raise] identifier[Exception] ( literal[string] )
keyword[if] identifier[name] == keyword[None] :
keyword[raise] i... | def has_method(obj, name):
"""
Checks if object has a method with specified name.
:param obj: an object to introspect.
:param name: a name of the method to check.
:return: true if the object has the method and false if it doesn't.
"""
if obj == None:
raise Exce... |
def evaluate(self, sequence):
"""
Compute the lineage on the sequence.
:param sequence: Sequence to compute
:return: Evaluated sequence
"""
last_cache_index = self.cache_scan()
transformations = self.transformations[last_cache_index:]
return self.engine.e... | def function[evaluate, parameter[self, sequence]]:
constant[
Compute the lineage on the sequence.
:param sequence: Sequence to compute
:return: Evaluated sequence
]
variable[last_cache_index] assign[=] call[name[self].cache_scan, parameter[]]
variable[transformat... | keyword[def] identifier[evaluate] ( identifier[self] , identifier[sequence] ):
literal[string]
identifier[last_cache_index] = identifier[self] . identifier[cache_scan] ()
identifier[transformations] = identifier[self] . identifier[transformations] [ identifier[last_cache_index] :]
... | def evaluate(self, sequence):
"""
Compute the lineage on the sequence.
:param sequence: Sequence to compute
:return: Evaluated sequence
"""
last_cache_index = self.cache_scan()
transformations = self.transformations[last_cache_index:]
return self.engine.evaluate(sequence... |
def setParseAction( self, *fns, **kwargs ):
"""Define action to perform when successfully matching parse element definition.
Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)},
C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where:
- s = t... | def function[setParseAction, parameter[self]]:
constant[Define action to perform when successfully matching parse element definition.
Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)},
C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where:
- s ... | keyword[def] identifier[setParseAction] ( identifier[self] ,* identifier[fns] ,** identifier[kwargs] ):
literal[string]
identifier[self] . identifier[parseAction] = identifier[list] ( identifier[map] ( identifier[_trim_arity] , identifier[list] ( identifier[fns] )))
identifier[self] . i... | def setParseAction(self, *fns, **kwargs):
"""Define action to perform when successfully matching parse element definition.
Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)},
C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where:
- s = the origina... |
def rgb_2_hex(self, r, g, b):
"""
convert a rgb color to hex
"""
return "#{:02X}{:02X}{:02X}".format(int(r * 255), int(g * 255), int(b * 255)) | def function[rgb_2_hex, parameter[self, r, g, b]]:
constant[
convert a rgb color to hex
]
return[call[constant[#{:02X}{:02X}{:02X}].format, parameter[call[name[int], parameter[binary_operation[name[r] * constant[255]]]], call[name[int], parameter[binary_operation[name[g] * constant[255]]]], ... | keyword[def] identifier[rgb_2_hex] ( identifier[self] , identifier[r] , identifier[g] , identifier[b] ):
literal[string]
keyword[return] literal[string] . identifier[format] ( identifier[int] ( identifier[r] * literal[int] ), identifier[int] ( identifier[g] * literal[int] ), identifier[int] ( iden... | def rgb_2_hex(self, r, g, b):
"""
convert a rgb color to hex
"""
return '#{:02X}{:02X}{:02X}'.format(int(r * 255), int(g * 255), int(b * 255)) |
def rectangle(self, x1, y1, x2, y2, color="black", outline=False, outline_color="black"):
"""
Draws a rectangle between 2 points
:param int x1:
The x position of the starting point.
:param int y1:
The y position of the starting point.
:param int x2:
... | def function[rectangle, parameter[self, x1, y1, x2, y2, color, outline, outline_color]]:
constant[
Draws a rectangle between 2 points
:param int x1:
The x position of the starting point.
:param int y1:
The y position of the starting point.
:param int x2... | keyword[def] identifier[rectangle] ( identifier[self] , identifier[x1] , identifier[y1] , identifier[x2] , identifier[y2] , identifier[color] = literal[string] , identifier[outline] = keyword[False] , identifier[outline_color] = literal[string] ):
literal[string]
keyword[return] identifier[self] .... | def rectangle(self, x1, y1, x2, y2, color='black', outline=False, outline_color='black'):
"""
Draws a rectangle between 2 points
:param int x1:
The x position of the starting point.
:param int y1:
The y position of the starting point.
:param int x2:
... |
def consume(self, callback, queue, previous_consumer=None):
"""
Register a message consumer that executes the provided callback when
messages are received.
The queue must exist prior to calling this method. If a consumer
already exists for the given queue, the callback is simply... | def function[consume, parameter[self, callback, queue, previous_consumer]]:
constant[
Register a message consumer that executes the provided callback when
messages are received.
The queue must exist prior to calling this method. If a consumer
already exists for the given queue, ... | keyword[def] identifier[consume] ( identifier[self] , identifier[callback] , identifier[queue] , identifier[previous_consumer] = keyword[None] ):
literal[string]
keyword[if] identifier[queue] keyword[in] identifier[self] . identifier[_consumers] :
identifier[self] . identifier[_cons... | def consume(self, callback, queue, previous_consumer=None):
"""
Register a message consumer that executes the provided callback when
messages are received.
The queue must exist prior to calling this method. If a consumer
already exists for the given queue, the callback is simply upd... |
def monitor():
"""Connect to receiver and show events as they occur.
Pulls the following arguments from the command line:
:param device:
Unix device where the PLM is attached
:param address:
Insteon address of the device to link with
:param group:
Insteon group for the link... | def function[monitor, parameter[]]:
constant[Connect to receiver and show events as they occur.
Pulls the following arguments from the command line:
:param device:
Unix device where the PLM is attached
:param address:
Insteon address of the device to link with
:param group:
... | keyword[def] identifier[monitor] ():
literal[string]
identifier[parser] = identifier[argparse] . identifier[ArgumentParser] ( identifier[description] = identifier[__doc__] )
identifier[parser] . identifier[add_argument] ( literal[string] , identifier[default] = literal[string] ,
identifier[help] ... | def monitor():
"""Connect to receiver and show events as they occur.
Pulls the following arguments from the command line:
:param device:
Unix device where the PLM is attached
:param address:
Insteon address of the device to link with
:param group:
Insteon group for the link... |
def setCurrentRecord( self, record ):
"""
Sets the current record for this browser to the inputed record.
:param record | <orb.Table> || None
"""
mode = self.currentMode()
if ( mode == XOrbBrowserWidget.Mode.Detail ):
self.detailWidget().... | def function[setCurrentRecord, parameter[self, record]]:
constant[
Sets the current record for this browser to the inputed record.
:param record | <orb.Table> || None
]
variable[mode] assign[=] call[name[self].currentMode, parameter[]]
if compare[name[mode] ... | keyword[def] identifier[setCurrentRecord] ( identifier[self] , identifier[record] ):
literal[string]
identifier[mode] = identifier[self] . identifier[currentMode] ()
keyword[if] ( identifier[mode] == identifier[XOrbBrowserWidget] . identifier[Mode] . identifier[Detail] ):
... | def setCurrentRecord(self, record):
"""
Sets the current record for this browser to the inputed record.
:param record | <orb.Table> || None
"""
mode = self.currentMode()
if mode == XOrbBrowserWidget.Mode.Detail:
self.detailWidget().setCurrentRecord(record) # de... |
def unregister(self, model):
"""
Unregister a permission handler from the model
Parameters
----------
model : django model class
A django model class
Raises
------
KeyError
Raise when the model have not registered in registry yet.... | def function[unregister, parameter[self, model]]:
constant[
Unregister a permission handler from the model
Parameters
----------
model : django model class
A django model class
Raises
------
KeyError
Raise when the model have not ... | keyword[def] identifier[unregister] ( identifier[self] , identifier[model] ):
literal[string]
keyword[if] identifier[model] keyword[not] keyword[in] identifier[self] . identifier[_registry] :
keyword[raise] identifier[KeyError] ( literal[string]
literal[string] % ide... | def unregister(self, model):
"""
Unregister a permission handler from the model
Parameters
----------
model : django model class
A django model class
Raises
------
KeyError
Raise when the model have not registered in registry yet.
... |
def ticket(self, handler, arg):
"""
Register a ticket timer. Ticket timers are very fast in the case where
you use a lot of timers (thousands), and frequently remove and add them.
The main use case is expiry timers for servers that handle many clients,
and which reset the expiry timer for each message r... | def function[ticket, parameter[self, handler, arg]]:
constant[
Register a ticket timer. Ticket timers are very fast in the case where
you use a lot of timers (thousands), and frequently remove and add them.
The main use case is expiry timers for servers that handle many clients,
and which reset the expi... | keyword[def] identifier[ticket] ( identifier[self] , identifier[handler] , identifier[arg] ):
literal[string]
keyword[return] identifier[c_void_p] ( identifier[lib] . identifier[zloop_ticket] ( identifier[self] . identifier[_as_parameter_] , identifier[handler] , identifier[arg] )) | def ticket(self, handler, arg):
"""
Register a ticket timer. Ticket timers are very fast in the case where
you use a lot of timers (thousands), and frequently remove and add them.
The main use case is expiry timers for servers that handle many clients,
and which reset the expiry timer for each message recei... |
def concatenate(samplesets, defaults=None):
"""Combine SampleSets.
Args:
samplesets (iterable[:obj:`.SampleSet`):
An iterable of sample sets.
defaults (dict, optional):
Dictionary mapping data vector names to the corresponding default values.
Returns:
:obj:... | def function[concatenate, parameter[samplesets, defaults]]:
constant[Combine SampleSets.
Args:
samplesets (iterable[:obj:`.SampleSet`):
An iterable of sample sets.
defaults (dict, optional):
Dictionary mapping data vector names to the corresponding default values.
... | keyword[def] identifier[concatenate] ( identifier[samplesets] , identifier[defaults] = keyword[None] ):
literal[string]
identifier[itertup] = identifier[iter] ( identifier[samplesets] )
keyword[try] :
identifier[first] = identifier[next] ( identifier[itertup] )
keyword[except] identif... | def concatenate(samplesets, defaults=None):
"""Combine SampleSets.
Args:
samplesets (iterable[:obj:`.SampleSet`):
An iterable of sample sets.
defaults (dict, optional):
Dictionary mapping data vector names to the corresponding default values.
Returns:
:obj:... |
def file_md5sum(filename):
"""
:param filename: The filename of the file to process
:returns: The MD5 hash of the file
"""
hash_md5 = hashlib.md5()
with open(filename, 'rb') as f:
for chunk in iter(lambda: f.read(1024 * 4), b''):
hash_md5.update(chunk)
return hash_md5.hex... | def function[file_md5sum, parameter[filename]]:
constant[
:param filename: The filename of the file to process
:returns: The MD5 hash of the file
]
variable[hash_md5] assign[=] call[name[hashlib].md5, parameter[]]
with call[name[open], parameter[name[filename], constant[rb]]] begin[:... | keyword[def] identifier[file_md5sum] ( identifier[filename] ):
literal[string]
identifier[hash_md5] = identifier[hashlib] . identifier[md5] ()
keyword[with] identifier[open] ( identifier[filename] , literal[string] ) keyword[as] identifier[f] :
keyword[for] identifier[chunk] keyword[in] ... | def file_md5sum(filename):
"""
:param filename: The filename of the file to process
:returns: The MD5 hash of the file
"""
hash_md5 = hashlib.md5()
with open(filename, 'rb') as f:
for chunk in iter(lambda : f.read(1024 * 4), b''):
hash_md5.update(chunk) # depends on [control... |
def lazy_load_modules(*modules):
"""
Decorator to load module to perform related operation for specific function
and delete the module from imports once the task is done. GC frees the memory
related to module during clean-up.
"""
def decorator(function):
def wrapper(*args, **kwargs):
... | def function[lazy_load_modules, parameter[]]:
constant[
Decorator to load module to perform related operation for specific function
and delete the module from imports once the task is done. GC frees the memory
related to module during clean-up.
]
def function[decorator, parameter[functi... | keyword[def] identifier[lazy_load_modules] (* identifier[modules] ):
literal[string]
keyword[def] identifier[decorator] ( identifier[function] ):
keyword[def] identifier[wrapper] (* identifier[args] ,** identifier[kwargs] ):
identifier[module_dict] ={}
keyword[for] id... | def lazy_load_modules(*modules):
"""
Decorator to load module to perform related operation for specific function
and delete the module from imports once the task is done. GC frees the memory
related to module during clean-up.
"""
def decorator(function):
def wrapper(*args, **kwargs):
... |
def WriteInit(self, out):
"""Write a simple __init__.py for the generated client."""
printer = self._GetPrinter(out)
if self.__init_wildcards_file:
printer('"""Common imports for generated %s client library."""',
self.__client_info.package)
printer('# ... | def function[WriteInit, parameter[self, out]]:
constant[Write a simple __init__.py for the generated client.]
variable[printer] assign[=] call[name[self]._GetPrinter, parameter[name[out]]]
if name[self].__init_wildcards_file begin[:]
call[name[printer], parameter[constant["""Comm... | keyword[def] identifier[WriteInit] ( identifier[self] , identifier[out] ):
literal[string]
identifier[printer] = identifier[self] . identifier[_GetPrinter] ( identifier[out] )
keyword[if] identifier[self] . identifier[__init_wildcards_file] :
identifier[printer] ( literal[str... | def WriteInit(self, out):
"""Write a simple __init__.py for the generated client."""
printer = self._GetPrinter(out)
if self.__init_wildcards_file:
printer('"""Common imports for generated %s client library."""', self.__client_info.package)
printer('# pylint:disable=wildcard-import') # depe... |
def request(self, name, *args, **kwargs):
r"""Send an API request or notification to nvim.
It is rarely needed to call this function directly, as most API
functions have python wrapper functions. The `api` object can
be also be used to call API functions as methods:
vim.api... | def function[request, parameter[self, name]]:
constant[Send an API request or notification to nvim.
It is rarely needed to call this function directly, as most API
functions have python wrapper functions. The `api` object can
be also be used to call API functions as methods:
... | keyword[def] identifier[request] ( identifier[self] , identifier[name] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[if] ( identifier[self] . identifier[_session] . identifier[_loop_thread] keyword[is] keyword[not] keyword[None]
keyword[and] identifier[threadin... | def request(self, name, *args, **kwargs):
"""Send an API request or notification to nvim.
It is rarely needed to call this function directly, as most API
functions have python wrapper functions. The `api` object can
be also be used to call API functions as methods:
vim.api.err_... |
def add_virtual_columns_cartesian_velocities_to_spherical(self, x="x", y="y", z="z", vx="vx", vy="vy", vz="vz", vr="vr", vlong="vlong", vlat="vlat", distance=None):
"""Concert velocities from a cartesian to a spherical coordinate system
TODO: errors
:param x: name of x column (input)
:... | def function[add_virtual_columns_cartesian_velocities_to_spherical, parameter[self, x, y, z, vx, vy, vz, vr, vlong, vlat, distance]]:
constant[Concert velocities from a cartesian to a spherical coordinate system
TODO: errors
:param x: name of x column (input)
:param y: y
... | keyword[def] identifier[add_virtual_columns_cartesian_velocities_to_spherical] ( identifier[self] , identifier[x] = literal[string] , identifier[y] = literal[string] , identifier[z] = literal[string] , identifier[vx] = literal[string] , identifier[vy] = literal[string] , identifier[vz] = literal[string] , identifier[... | def add_virtual_columns_cartesian_velocities_to_spherical(self, x='x', y='y', z='z', vx='vx', vy='vy', vz='vz', vr='vr', vlong='vlong', vlat='vlat', distance=None):
"""Concert velocities from a cartesian to a spherical coordinate system
TODO: errors
:param x: name of x column (input)
:para... |
def update_phase(self, environment, data, prediction, user, item, correct, time, answer_id, **kwargs):
"""
After the prediction update the environment and persist some
information for the predictive model.
Args:
environment (proso.models.environment.Environment):
... | def function[update_phase, parameter[self, environment, data, prediction, user, item, correct, time, answer_id]]:
constant[
After the prediction update the environment and persist some
information for the predictive model.
Args:
environment (proso.models.environment.Environm... | keyword[def] identifier[update_phase] ( identifier[self] , identifier[environment] , identifier[data] , identifier[prediction] , identifier[user] , identifier[item] , identifier[correct] , identifier[time] , identifier[answer_id] ,** identifier[kwargs] ):
literal[string]
keyword[pass] | def update_phase(self, environment, data, prediction, user, item, correct, time, answer_id, **kwargs):
"""
After the prediction update the environment and persist some
information for the predictive model.
Args:
environment (proso.models.environment.Environment):
... |
def read_with_selection(func):
"""Decorate a Table read method to apply ``selection`` keyword
"""
def wrapper(*args, **kwargs):
"""Execute a function, then apply a selection filter
"""
# parse selection
selection = kwargs.pop('selection', None) or []
# read table
... | def function[read_with_selection, parameter[func]]:
constant[Decorate a Table read method to apply ``selection`` keyword
]
def function[wrapper, parameter[]]:
constant[Execute a function, then apply a selection filter
]
variable[selection] assign[=] <ast.BoolO... | keyword[def] identifier[read_with_selection] ( identifier[func] ):
literal[string]
keyword[def] identifier[wrapper] (* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[selection] = identifier[kwargs] . identifier[pop] ( literal[string] , keyword[None] ) key... | def read_with_selection(func):
"""Decorate a Table read method to apply ``selection`` keyword
"""
def wrapper(*args, **kwargs):
"""Execute a function, then apply a selection filter
"""
# parse selection
selection = kwargs.pop('selection', None) or []
# read table
... |
def send_signature_reminder(self, signature_id):
"""
Send a reminder email
@signature_id: Id of signature
@document_id: Id of document
"""
connection = Connection(self.token)
connection.set_url(self.production, self.SIGNS_SEND_REMINDER_URL % signature_id)
... | def function[send_signature_reminder, parameter[self, signature_id]]:
constant[
Send a reminder email
@signature_id: Id of signature
@document_id: Id of document
]
variable[connection] assign[=] call[name[Connection], parameter[name[self].token]]
call[name[connect... | keyword[def] identifier[send_signature_reminder] ( identifier[self] , identifier[signature_id] ):
literal[string]
identifier[connection] = identifier[Connection] ( identifier[self] . identifier[token] )
identifier[connection] . identifier[set_url] ( identifier[self] . identifier[productio... | def send_signature_reminder(self, signature_id):
"""
Send a reminder email
@signature_id: Id of signature
@document_id: Id of document
"""
connection = Connection(self.token)
connection.set_url(self.production, self.SIGNS_SEND_REMINDER_URL % signature_id)
return connectio... |
def get_tmhmm_predictions(self, tmhmm_results, custom_gene_mapping=None):
"""Parse TMHMM results and store in the representative sequences.
This is a basic function to parse pre-run TMHMM results. Run TMHMM from the
web service (http://www.cbs.dtu.dk/services/TMHMM/) by doing the following:
... | def function[get_tmhmm_predictions, parameter[self, tmhmm_results, custom_gene_mapping]]:
constant[Parse TMHMM results and store in the representative sequences.
This is a basic function to parse pre-run TMHMM results. Run TMHMM from the
web service (http://www.cbs.dtu.dk/services/TMHMM/) by do... | keyword[def] identifier[get_tmhmm_predictions] ( identifier[self] , identifier[tmhmm_results] , identifier[custom_gene_mapping] = keyword[None] ):
literal[string]
identifier[tmhmm_dict] = identifier[ssbio] . identifier[protein] . identifier[sequence] . identifier[properties] . identifier[t... | def get_tmhmm_predictions(self, tmhmm_results, custom_gene_mapping=None):
"""Parse TMHMM results and store in the representative sequences.
This is a basic function to parse pre-run TMHMM results. Run TMHMM from the
web service (http://www.cbs.dtu.dk/services/TMHMM/) by doing the following:
... |
def absolute_path(user_path):
"""
Some paths must be made absolute, this will attempt to convert them.
"""
if os.path.abspath(user_path):
return unix_path_coercion(user_path)
else:
try:
openaccess_epub.utils.evaluate_relative_path(relative=user_path)
except:
... | def function[absolute_path, parameter[user_path]]:
constant[
Some paths must be made absolute, this will attempt to convert them.
]
if call[name[os].path.abspath, parameter[name[user_path]]] begin[:]
return[call[name[unix_path_coercion], parameter[name[user_path]]]] | keyword[def] identifier[absolute_path] ( identifier[user_path] ):
literal[string]
keyword[if] identifier[os] . identifier[path] . identifier[abspath] ( identifier[user_path] ):
keyword[return] identifier[unix_path_coercion] ( identifier[user_path] )
keyword[else] :
keyword[try] :
... | def absolute_path(user_path):
"""
Some paths must be made absolute, this will attempt to convert them.
"""
if os.path.abspath(user_path):
return unix_path_coercion(user_path) # depends on [control=['if'], data=[]]
else:
try:
openaccess_epub.utils.evaluate_relative_path(r... |
def locate(self, point, _verify=True):
r"""Find a point on the current surface.
Solves for :math:`s` and :math:`t` in :math:`B(s, t) = p`.
This method acts as a (partial) inverse to :meth:`evaluate_cartesian`.
.. warning::
A unique solution is only guaranteed if the curren... | def function[locate, parameter[self, point, _verify]]:
constant[Find a point on the current surface.
Solves for :math:`s` and :math:`t` in :math:`B(s, t) = p`.
This method acts as a (partial) inverse to :meth:`evaluate_cartesian`.
.. warning::
A unique solution is only gua... | keyword[def] identifier[locate] ( identifier[self] , identifier[point] , identifier[_verify] = keyword[True] ):
literal[string]
keyword[if] identifier[_verify] :
keyword[if] identifier[self] . identifier[_dimension] != literal[int] :
keyword[raise] identifier[NotImp... | def locate(self, point, _verify=True):
"""Find a point on the current surface.
Solves for :math:`s` and :math:`t` in :math:`B(s, t) = p`.
This method acts as a (partial) inverse to :meth:`evaluate_cartesian`.
.. warning::
A unique solution is only guaranteed if the current sur... |
def remove_accessibility_type(self, accessibility_type=None):
"""Removes an accessibility type.
:param accessibility_type: accessibility type to remove
:type accessibility_type: ``osid.type.Type``
:raise: ``NoAccess`` -- ``Metadata.isReadOnly()`` is ``true``
:raise: ``NotFound``... | def function[remove_accessibility_type, parameter[self, accessibility_type]]:
constant[Removes an accessibility type.
:param accessibility_type: accessibility type to remove
:type accessibility_type: ``osid.type.Type``
:raise: ``NoAccess`` -- ``Metadata.isReadOnly()`` is ``true``
... | keyword[def] identifier[remove_accessibility_type] ( identifier[self] , identifier[accessibility_type] = keyword[None] ):
literal[string]
keyword[if] identifier[accessibility_type] keyword[is] keyword[None] :
keyword[raise] identifier[NullArgument]
identifier[metadata] = ... | def remove_accessibility_type(self, accessibility_type=None):
"""Removes an accessibility type.
:param accessibility_type: accessibility type to remove
:type accessibility_type: ``osid.type.Type``
:raise: ``NoAccess`` -- ``Metadata.isReadOnly()`` is ``true``
:raise: ``NotFound`` -- ... |
def bdib(self, ticker, start_datetime, end_datetime, event_type, interval,
elms=None):
"""
Get Open, High, Low, Close, Volume, and numEvents for a ticker.
Return pandas DataFrame
Parameters
----------
ticker: string
String corresponding to ticker... | def function[bdib, parameter[self, ticker, start_datetime, end_datetime, event_type, interval, elms]]:
constant[
Get Open, High, Low, Close, Volume, and numEvents for a ticker.
Return pandas DataFrame
Parameters
----------
ticker: string
String corresponding ... | keyword[def] identifier[bdib] ( identifier[self] , identifier[ticker] , identifier[start_datetime] , identifier[end_datetime] , identifier[event_type] , identifier[interval] ,
identifier[elms] = keyword[None] ):
literal[string]
identifier[elms] =[] keyword[if] keyword[not] identifier[elms] keyw... | def bdib(self, ticker, start_datetime, end_datetime, event_type, interval, elms=None):
"""
Get Open, High, Low, Close, Volume, and numEvents for a ticker.
Return pandas DataFrame
Parameters
----------
ticker: string
String corresponding to ticker
start_da... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.