code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def get_export_launch_description_form(self):
"""Returns a form for editing the virtual system description.
Since the data for the form are fetched from the cloud a
progress object is also returned to indicate if/when the form
is ready to be used.
out form of type :class:`IVirtu... | def function[get_export_launch_description_form, parameter[self]]:
constant[Returns a form for editing the virtual system description.
Since the data for the form are fetched from the cloud a
progress object is also returned to indicate if/when the form
is ready to be used.
out ... | keyword[def] identifier[get_export_launch_description_form] ( identifier[self] ):
literal[string]
( identifier[progress] , identifier[form] )= identifier[self] . identifier[_call] ( literal[string] )
identifier[progress] = identifier[IProgress] ( identifier[progress] )
identifier[f... | def get_export_launch_description_form(self):
"""Returns a form for editing the virtual system description.
Since the data for the form are fetched from the cloud a
progress object is also returned to indicate if/when the form
is ready to be used.
out form of type :class:`IVirtualSy... |
def dispatch(self, producer=None):
"""
Dispatch the event, sending a message to the queue using a producer.
:param producer: optional `Producer` to replace the default one.
"""
log.info('@Event.dispatch `{}` with subject `{}`'
.format(self.name, self.subject))
... | def function[dispatch, parameter[self, producer]]:
constant[
Dispatch the event, sending a message to the queue using a producer.
:param producer: optional `Producer` to replace the default one.
]
call[name[log].info, parameter[call[constant[@Event.dispatch `{}` with subject `{}`... | keyword[def] identifier[dispatch] ( identifier[self] , identifier[producer] = keyword[None] ):
literal[string]
identifier[log] . identifier[info] ( literal[string]
. identifier[format] ( identifier[self] . identifier[name] , identifier[self] . identifier[subject] ))
identifier[pro... | def dispatch(self, producer=None):
"""
Dispatch the event, sending a message to the queue using a producer.
:param producer: optional `Producer` to replace the default one.
"""
log.info('@Event.dispatch `{}` with subject `{}`'.format(self.name, self.subject))
producer = producer or R... |
def onecmd_plus_hooks(self, line: str, pyscript_bridge_call: bool = False) -> bool:
"""Top-level function called by cmdloop() to handle parsing a line and running the command and all of its hooks.
:param line: line of text read from input
:param pyscript_bridge_call: This should only ever be se... | def function[onecmd_plus_hooks, parameter[self, line, pyscript_bridge_call]]:
constant[Top-level function called by cmdloop() to handle parsing a line and running the command and all of its hooks.
:param line: line of text read from input
:param pyscript_bridge_call: This should only ever be se... | keyword[def] identifier[onecmd_plus_hooks] ( identifier[self] , identifier[line] : identifier[str] , identifier[pyscript_bridge_call] : identifier[bool] = keyword[False] )-> identifier[bool] :
literal[string]
keyword[import] identifier[datetime]
identifier[stop] = keyword[False]
... | def onecmd_plus_hooks(self, line: str, pyscript_bridge_call: bool=False) -> bool:
"""Top-level function called by cmdloop() to handle parsing a line and running the command and all of its hooks.
:param line: line of text read from input
:param pyscript_bridge_call: This should only ever be set to T... |
def _loadFromHStruct(self, dtype: HdlType, bitAddr: int):
"""
Parse HStruct type to this transaction template instance
:return: address of it's end
"""
for f in dtype.fields:
t = f.dtype
origin = f
isPadding = f.name is None
if is... | def function[_loadFromHStruct, parameter[self, dtype, bitAddr]]:
constant[
Parse HStruct type to this transaction template instance
:return: address of it's end
]
for taget[name[f]] in starred[name[dtype].fields] begin[:]
variable[t] assign[=] name[f].dtype
... | keyword[def] identifier[_loadFromHStruct] ( identifier[self] , identifier[dtype] : identifier[HdlType] , identifier[bitAddr] : identifier[int] ):
literal[string]
keyword[for] identifier[f] keyword[in] identifier[dtype] . identifier[fields] :
identifier[t] = identifier[f] . identifie... | def _loadFromHStruct(self, dtype: HdlType, bitAddr: int):
"""
Parse HStruct type to this transaction template instance
:return: address of it's end
"""
for f in dtype.fields:
t = f.dtype
origin = f
isPadding = f.name is None
if isPadding:
widt... |
def where(self, column, operator=Null(), value=None, boolean="and"):
"""
Add a where clause to the query
:param column: The column of the where clause, can also be a QueryBuilder instance for sub where
:type column: str|Builder
:param operator: The operator of the where clause
... | def function[where, parameter[self, column, operator, value, boolean]]:
constant[
Add a where clause to the query
:param column: The column of the where clause, can also be a QueryBuilder instance for sub where
:type column: str|Builder
:param operator: The operator of the wher... | keyword[def] identifier[where] ( identifier[self] , identifier[column] , identifier[operator] = identifier[Null] (), identifier[value] = keyword[None] , identifier[boolean] = literal[string] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[column] , identifier[Builder] ):
... | def where(self, column, operator=Null(), value=None, boolean='and'):
"""
Add a where clause to the query
:param column: The column of the where clause, can also be a QueryBuilder instance for sub where
:type column: str|Builder
:param operator: The operator of the where clause
... |
def _FormatSocketInet32Token(self, token_data):
"""Formats an Internet socket token as a dictionary of values.
Args:
token_data (bsm_token_data_sockinet32): AUT_SOCKINET32 token data.
Returns:
dict[str, str]: token values.
"""
protocol = bsmtoken.BSM_PROTOCOLS.get(token_data.socket_fam... | def function[_FormatSocketInet32Token, parameter[self, token_data]]:
constant[Formats an Internet socket token as a dictionary of values.
Args:
token_data (bsm_token_data_sockinet32): AUT_SOCKINET32 token data.
Returns:
dict[str, str]: token values.
]
variable[protocol] assign[... | keyword[def] identifier[_FormatSocketInet32Token] ( identifier[self] , identifier[token_data] ):
literal[string]
identifier[protocol] = identifier[bsmtoken] . identifier[BSM_PROTOCOLS] . identifier[get] ( identifier[token_data] . identifier[socket_family] , literal[string] )
identifier[ip_address] = i... | def _FormatSocketInet32Token(self, token_data):
"""Formats an Internet socket token as a dictionary of values.
Args:
token_data (bsm_token_data_sockinet32): AUT_SOCKINET32 token data.
Returns:
dict[str, str]: token values.
"""
protocol = bsmtoken.BSM_PROTOCOLS.get(token_data.socket_fam... |
def adjoint(self):
"""Adjoint of this operator, a `SamplingOperator`.
The ``'char_fun'`` variant of this operator corresponds to the
``'integrate'`` sampling operator, and ``'dirac'`` corresponds to
``'point_eval'``.
Examples
--------
>>> space = odl.uniform_dis... | def function[adjoint, parameter[self]]:
constant[Adjoint of this operator, a `SamplingOperator`.
The ``'char_fun'`` variant of this operator corresponds to the
``'integrate'`` sampling operator, and ``'dirac'`` corresponds to
``'point_eval'``.
Examples
--------
... | keyword[def] identifier[adjoint] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[variant] == literal[string] :
identifier[variant] = literal[string]
keyword[elif] identifier[self] . identifier[variant] == literal[string] :
identi... | def adjoint(self):
"""Adjoint of this operator, a `SamplingOperator`.
The ``'char_fun'`` variant of this operator corresponds to the
``'integrate'`` sampling operator, and ``'dirac'`` corresponds to
``'point_eval'``.
Examples
--------
>>> space = odl.uniform_discr([... |
def _generic_action_parser(self):
"""Generic parser for Actions."""
actions = []
while True:
action_code = unpack_ui8(self._src)
if action_code == 0:
break
action_name = ACTION_NAMES[action_code]
if action_code > 128:
... | def function[_generic_action_parser, parameter[self]]:
constant[Generic parser for Actions.]
variable[actions] assign[=] list[[]]
while constant[True] begin[:]
variable[action_code] assign[=] call[name[unpack_ui8], parameter[name[self]._src]]
if compare[name[actio... | keyword[def] identifier[_generic_action_parser] ( identifier[self] ):
literal[string]
identifier[actions] =[]
keyword[while] keyword[True] :
identifier[action_code] = identifier[unpack_ui8] ( identifier[self] . identifier[_src] )
keyword[if] identifier[action_co... | def _generic_action_parser(self):
"""Generic parser for Actions."""
actions = []
while True:
action_code = unpack_ui8(self._src)
if action_code == 0:
break # depends on [control=['if'], data=[]]
action_name = ACTION_NAMES[action_code]
if action_code > 128:
... |
def begin(self, sql=None):
"""Begin a transaction."""
self._transaction = True
try:
begin = self._con.begin
except AttributeError:
return self._con.query(sql or 'begin')
else:
# use existing method if available
if sql:
... | def function[begin, parameter[self, sql]]:
constant[Begin a transaction.]
name[self]._transaction assign[=] constant[True]
<ast.Try object at 0x7da20c6e77c0> | keyword[def] identifier[begin] ( identifier[self] , identifier[sql] = keyword[None] ):
literal[string]
identifier[self] . identifier[_transaction] = keyword[True]
keyword[try] :
identifier[begin] = identifier[self] . identifier[_con] . identifier[begin]
keyword[exce... | def begin(self, sql=None):
"""Begin a transaction."""
self._transaction = True
try:
begin = self._con.begin # depends on [control=['try'], data=[]]
except AttributeError:
return self._con.query(sql or 'begin') # depends on [control=['except'], data=[]]
else:
# use existing ... |
def draw_progress_bar(cb, message, value, max_value):
"""
:type cb: cursebox.Cursebox
"""
m_x = cb.width // 2
m_y = cb.height // 2
w = len(message) + 4
h = 3
draw_box(cb, m_x - w // 2, m_y - 1, w, h)
message = " %s " % message
i = int((value / max_value) * (len(message) + 2))
... | def function[draw_progress_bar, parameter[cb, message, value, max_value]]:
constant[
:type cb: cursebox.Cursebox
]
variable[m_x] assign[=] binary_operation[name[cb].width <ast.FloorDiv object at 0x7da2590d6bc0> constant[2]]
variable[m_y] assign[=] binary_operation[name[cb].height <ast.Fl... | keyword[def] identifier[draw_progress_bar] ( identifier[cb] , identifier[message] , identifier[value] , identifier[max_value] ):
literal[string]
identifier[m_x] = identifier[cb] . identifier[width] // literal[int]
identifier[m_y] = identifier[cb] . identifier[height] // literal[int]
identifier[... | def draw_progress_bar(cb, message, value, max_value):
"""
:type cb: cursebox.Cursebox
"""
m_x = cb.width // 2
m_y = cb.height // 2
w = len(message) + 4
h = 3
draw_box(cb, m_x - w // 2, m_y - 1, w, h)
message = ' %s ' % message
i = int(value / max_value * (len(message) + 2))
m... |
def write_Text_into_file( text, old_file_name, out_dir, suffix='__split', verbose=True ):
''' Based on *old_file_name*, *suffix* and *out_dir*, constructs a new file name and
writes *text* (in the ascii normalised JSON format) into the new file.
'''
name = os.path.basename( old_file_name )
if ... | def function[write_Text_into_file, parameter[text, old_file_name, out_dir, suffix, verbose]]:
constant[ Based on *old_file_name*, *suffix* and *out_dir*, constructs a new file name and
writes *text* (in the ascii normalised JSON format) into the new file.
]
variable[name] assign[=] call[nam... | keyword[def] identifier[write_Text_into_file] ( identifier[text] , identifier[old_file_name] , identifier[out_dir] , identifier[suffix] = literal[string] , identifier[verbose] = keyword[True] ):
literal[string]
identifier[name] = identifier[os] . identifier[path] . identifier[basename] ( identifier[old_fil... | def write_Text_into_file(text, old_file_name, out_dir, suffix='__split', verbose=True):
""" Based on *old_file_name*, *suffix* and *out_dir*, constructs a new file name and
writes *text* (in the ascii normalised JSON format) into the new file.
"""
name = os.path.basename(old_file_name)
if '.' i... |
def t_INCLUDE(self, t):
'include'
#
# Now eat up the next two tokens which must be
# 1 - the name of the include file, and
# 2 - a terminating semicolon
#
# Then push the current lexer onto the stack, create a new one from
# the include file, and push it o... | def function[t_INCLUDE, parameter[self, t]]:
constant[include]
variable[next_token] assign[=] call[name[self].lexer.token, parameter[]]
variable[lineno] assign[=] name[next_token].lineno
if call[name[isinstance], parameter[name[next_token].value, name[str]]] begin[:]
vari... | keyword[def] identifier[t_INCLUDE] ( identifier[self] , identifier[t] ):
literal[string]
identifier[next_token] = identifier[self] . identifier[lexer] . identifier[token] ()
identifier[lineno] = identifier[nex... | def t_INCLUDE(self, t):
"""include"""
#
# Now eat up the next two tokens which must be
# 1 - the name of the include file, and
# 2 - a terminating semicolon
#
# Then push the current lexer onto the stack, create a new one from
# the include file, and push it onto the stack.
#
# W... |
def get_iso_time(date_part, time_part):
r"""Combign date and time into an iso datetime."""
str_date = datetime.datetime.strptime(
date_part, '%m/%d/%Y').strftime('%Y-%m-%d')
str_time = datetime.datetime.strptime(
time_part, '%I:%M %p').strftime('%H:%M:%S')
return str_date + "T" +... | def function[get_iso_time, parameter[date_part, time_part]]:
constant[Combign date and time into an iso datetime.]
variable[str_date] assign[=] call[call[name[datetime].datetime.strptime, parameter[name[date_part], constant[%m/%d/%Y]]].strftime, parameter[constant[%Y-%m-%d]]]
variable[str_time] ... | keyword[def] identifier[get_iso_time] ( identifier[date_part] , identifier[time_part] ):
literal[string]
identifier[str_date] = identifier[datetime] . identifier[datetime] . identifier[strptime] (
identifier[date_part] , literal[string] ). identifier[strftime] ( literal[string] )
identifier[s... | def get_iso_time(date_part, time_part):
"""Combign date and time into an iso datetime."""
str_date = datetime.datetime.strptime(date_part, '%m/%d/%Y').strftime('%Y-%m-%d')
str_time = datetime.datetime.strptime(time_part, '%I:%M %p').strftime('%H:%M:%S')
return str_date + 'T' + str_time + '-7:00' |
def _do_tcp_check(self, ip, results):
"""
Attempt to establish a TCP connection.
If not successful, record the IP in the results dict.
Always closes the connection at the end.
"""
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
soc... | def function[_do_tcp_check, parameter[self, ip, results]]:
constant[
Attempt to establish a TCP connection.
If not successful, record the IP in the results dict.
Always closes the connection at the end.
]
<ast.Try object at 0x7da18c4ce050> | keyword[def] identifier[_do_tcp_check] ( identifier[self] , identifier[ip] , identifier[results] ):
literal[string]
keyword[try] :
identifier[sock] = identifier[socket] . identifier[socket] ( identifier[socket] . identifier[AF_INET] , identifier[socket] . identifier[SOCK_STREAM] )
... | def _do_tcp_check(self, ip, results):
"""
Attempt to establish a TCP connection.
If not successful, record the IP in the results dict.
Always closes the connection at the end.
"""
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(1)
... |
def center(self):
'''
Point whose coordinates are (midX,midY,origin.z), Point.
'''
return Point(self.midX, self.midY, self.origin.z) | def function[center, parameter[self]]:
constant[
Point whose coordinates are (midX,midY,origin.z), Point.
]
return[call[name[Point], parameter[name[self].midX, name[self].midY, name[self].origin.z]]] | keyword[def] identifier[center] ( identifier[self] ):
literal[string]
keyword[return] identifier[Point] ( identifier[self] . identifier[midX] , identifier[self] . identifier[midY] , identifier[self] . identifier[origin] . identifier[z] ) | def center(self):
"""
Point whose coordinates are (midX,midY,origin.z), Point.
"""
return Point(self.midX, self.midY, self.origin.z) |
def translate_row_col_to_index(self, row, col):
"""
Given a (row, col) tuple, return the corresponding index.
(Row and col params are 0-based.)
Negative row/col values are turned into zero.
"""
try:
result = self._line_start_indexes[row]
line = se... | def function[translate_row_col_to_index, parameter[self, row, col]]:
constant[
Given a (row, col) tuple, return the corresponding index.
(Row and col params are 0-based.)
Negative row/col values are turned into zero.
]
<ast.Try object at 0x7da18f00c9a0>
<ast.AugAssign ob... | keyword[def] identifier[translate_row_col_to_index] ( identifier[self] , identifier[row] , identifier[col] ):
literal[string]
keyword[try] :
identifier[result] = identifier[self] . identifier[_line_start_indexes] [ identifier[row] ]
identifier[line] = identifier[self] . id... | def translate_row_col_to_index(self, row, col):
"""
Given a (row, col) tuple, return the corresponding index.
(Row and col params are 0-based.)
Negative row/col values are turned into zero.
"""
try:
result = self._line_start_indexes[row]
line = self.lines[row] #... |
def percent_records_missing_location(user, method=None):
"""
Return the percentage of records missing a location parameter.
"""
if len(user.records) == 0:
return 0.
missing_locations = sum([1 for record in user.records if record.position._get_location(user) is None])
return float(missi... | def function[percent_records_missing_location, parameter[user, method]]:
constant[
Return the percentage of records missing a location parameter.
]
if compare[call[name[len], parameter[name[user].records]] equal[==] constant[0]] begin[:]
return[constant[0.0]]
variable[missing_loc... | keyword[def] identifier[percent_records_missing_location] ( identifier[user] , identifier[method] = keyword[None] ):
literal[string]
keyword[if] identifier[len] ( identifier[user] . identifier[records] )== literal[int] :
keyword[return] literal[int]
identifier[missing_locations] = identi... | def percent_records_missing_location(user, method=None):
"""
Return the percentage of records missing a location parameter.
"""
if len(user.records) == 0:
return 0.0 # depends on [control=['if'], data=[]]
missing_locations = sum([1 for record in user.records if record.position._get_location... |
def get_sub_dsp(self, nodes_bunch, edges_bunch=None):
"""
Returns the sub-dispatcher induced by given node and edge bunches.
The induced sub-dispatcher contains the available nodes in nodes_bunch
and edges between those nodes, excluding those that are in edges_bunch.
The availa... | def function[get_sub_dsp, parameter[self, nodes_bunch, edges_bunch]]:
constant[
Returns the sub-dispatcher induced by given node and edge bunches.
The induced sub-dispatcher contains the available nodes in nodes_bunch
and edges between those nodes, excluding those that are in edges_bunc... | keyword[def] identifier[get_sub_dsp] ( identifier[self] , identifier[nodes_bunch] , identifier[edges_bunch] = keyword[None] ):
literal[string]
identifier[nodes_bunch] =[ identifier[self] . identifier[get_node] ( identifier[u] )[ literal[int] ][ literal[int] ] keyword[for] identifier[u] ... | def get_sub_dsp(self, nodes_bunch, edges_bunch=None):
"""
Returns the sub-dispatcher induced by given node and edge bunches.
The induced sub-dispatcher contains the available nodes in nodes_bunch
and edges between those nodes, excluding those that are in edges_bunch.
The available ... |
def onAIOCompletion(self):
"""
Call when eventfd notified events are available.
"""
event_count = self.eventfd.read()
trace('eventfd reports %i events' % event_count)
# Even though eventfd signaled activity, even though it may give us
# some number of pending even... | def function[onAIOCompletion, parameter[self]]:
constant[
Call when eventfd notified events are available.
]
variable[event_count] assign[=] call[name[self].eventfd.read, parameter[]]
call[name[trace], parameter[binary_operation[constant[eventfd reports %i events] <ast.Mod object... | keyword[def] identifier[onAIOCompletion] ( identifier[self] ):
literal[string]
identifier[event_count] = identifier[self] . identifier[eventfd] . identifier[read] ()
identifier[trace] ( literal[string] % identifier[event_count] )
identi... | def onAIOCompletion(self):
"""
Call when eventfd notified events are available.
"""
event_count = self.eventfd.read()
trace('eventfd reports %i events' % event_count)
# Even though eventfd signaled activity, even though it may give us
# some number of pending events, some events seem... |
def daterange_end(value):
'''Parse a date range end boundary'''
if not value:
return None
elif isinstance(value, datetime):
return value.date()
elif isinstance(value, date):
return value
result = parse_dt(value).date()
dashes = value.count('-')
if dashes >= 2:
... | def function[daterange_end, parameter[value]]:
constant[Parse a date range end boundary]
if <ast.UnaryOp object at 0x7da18f09f220> begin[:]
return[constant[None]]
variable[result] assign[=] call[call[name[parse_dt], parameter[name[value]]].date, parameter[]]
variable[dashes] assi... | keyword[def] identifier[daterange_end] ( identifier[value] ):
literal[string]
keyword[if] keyword[not] identifier[value] :
keyword[return] keyword[None]
keyword[elif] identifier[isinstance] ( identifier[value] , identifier[datetime] ):
keyword[return] identifier[value] . identi... | def daterange_end(value):
"""Parse a date range end boundary"""
if not value:
return None # depends on [control=['if'], data=[]]
elif isinstance(value, datetime):
return value.date() # depends on [control=['if'], data=[]]
elif isinstance(value, date):
return value # depends on... |
def fetch_libzmq(savedir):
"""download and extract libzmq"""
dest = pjoin(savedir, 'zeromq')
if os.path.exists(dest):
info("already have %s" % dest)
return
path = fetch_archive(savedir, libzmq_url, fname=libzmq, checksum=libzmq_checksum)
tf = tarfile.open(path)
with_version = pjo... | def function[fetch_libzmq, parameter[savedir]]:
constant[download and extract libzmq]
variable[dest] assign[=] call[name[pjoin], parameter[name[savedir], constant[zeromq]]]
if call[name[os].path.exists, parameter[name[dest]]] begin[:]
call[name[info], parameter[binary_operation[c... | keyword[def] identifier[fetch_libzmq] ( identifier[savedir] ):
literal[string]
identifier[dest] = identifier[pjoin] ( identifier[savedir] , literal[string] )
keyword[if] identifier[os] . identifier[path] . identifier[exists] ( identifier[dest] ):
identifier[info] ( literal[string] % identifi... | def fetch_libzmq(savedir):
"""download and extract libzmq"""
dest = pjoin(savedir, 'zeromq')
if os.path.exists(dest):
info('already have %s' % dest)
return # depends on [control=['if'], data=[]]
path = fetch_archive(savedir, libzmq_url, fname=libzmq, checksum=libzmq_checksum)
tf = t... |
def check_for_wdiff():
"""
Checks if the `wdiff` command can be found.
Raises:
WdiffNotFoundError: if ``wdiff`` is not found.
"""
cmd = ['which', CMD_WDIFF]
DEVNULL = open(os.devnull, 'wb')
proc = sub.Popen(cmd, stdout=DEVNULL)
proc.wait()
DEVNULL.close()
if proc.returncode != 0:
msg = "t... | def function[check_for_wdiff, parameter[]]:
constant[
Checks if the `wdiff` command can be found.
Raises:
WdiffNotFoundError: if ``wdiff`` is not found.
]
variable[cmd] assign[=] list[[<ast.Constant object at 0x7da1b23345b0>, <ast.Name object at 0x7da1b23349d0>]]
variable[DEVNULL] a... | keyword[def] identifier[check_for_wdiff] ():
literal[string]
identifier[cmd] =[ literal[string] , identifier[CMD_WDIFF] ]
identifier[DEVNULL] = identifier[open] ( identifier[os] . identifier[devnull] , literal[string] )
identifier[proc] = identifier[sub] . identifier[Popen] ( identifier[cmd] , identifier... | def check_for_wdiff():
"""
Checks if the `wdiff` command can be found.
Raises:
WdiffNotFoundError: if ``wdiff`` is not found.
"""
cmd = ['which', CMD_WDIFF]
DEVNULL = open(os.devnull, 'wb')
proc = sub.Popen(cmd, stdout=DEVNULL)
proc.wait()
DEVNULL.close()
if proc.returncode != 0... |
def execute_lines(self, lines):
"""Execute lines and give focus to shell"""
self.shell.execute_lines(to_text_string(lines))
self.shell.setFocus() | def function[execute_lines, parameter[self, lines]]:
constant[Execute lines and give focus to shell]
call[name[self].shell.execute_lines, parameter[call[name[to_text_string], parameter[name[lines]]]]]
call[name[self].shell.setFocus, parameter[]] | keyword[def] identifier[execute_lines] ( identifier[self] , identifier[lines] ):
literal[string]
identifier[self] . identifier[shell] . identifier[execute_lines] ( identifier[to_text_string] ( identifier[lines] ))
identifier[self] . identifier[shell] . identifier[setFocus] () | def execute_lines(self, lines):
"""Execute lines and give focus to shell"""
self.shell.execute_lines(to_text_string(lines))
self.shell.setFocus() |
def find(self, package, **kwargs):
"""
Find method.
Args:
package (str): package to find.
**kwargs (): additional keyword arguments.
Returns:
PackageSpec: the PackageSpec corresponding to the package, or None.
"""
spec = find_spec(pac... | def function[find, parameter[self, package]]:
constant[
Find method.
Args:
package (str): package to find.
**kwargs (): additional keyword arguments.
Returns:
PackageSpec: the PackageSpec corresponding to the package, or None.
]
varia... | keyword[def] identifier[find] ( identifier[self] , identifier[package] ,** identifier[kwargs] ):
literal[string]
identifier[spec] = identifier[find_spec] ( identifier[package] )
keyword[if] identifier[spec] keyword[is] keyword[None] :
keyword[return] keyword[None]
... | def find(self, package, **kwargs):
"""
Find method.
Args:
package (str): package to find.
**kwargs (): additional keyword arguments.
Returns:
PackageSpec: the PackageSpec corresponding to the package, or None.
"""
spec = find_spec(package)
... |
def half_light_radius_source(self, kwargs_source, center_x=0, center_y=0, deltaPix=None, numPix=None):
"""
computes numerically the half-light-radius of the deflector light and the total photon flux
:param kwargs_source:
:return:
"""
if numPix is None:
numPix... | def function[half_light_radius_source, parameter[self, kwargs_source, center_x, center_y, deltaPix, numPix]]:
constant[
computes numerically the half-light-radius of the deflector light and the total photon flux
:param kwargs_source:
:return:
]
if compare[name[numPix] is... | keyword[def] identifier[half_light_radius_source] ( identifier[self] , identifier[kwargs_source] , identifier[center_x] = literal[int] , identifier[center_y] = literal[int] , identifier[deltaPix] = keyword[None] , identifier[numPix] = keyword[None] ):
literal[string]
keyword[if] identifier[numPix]... | def half_light_radius_source(self, kwargs_source, center_x=0, center_y=0, deltaPix=None, numPix=None):
"""
computes numerically the half-light-radius of the deflector light and the total photon flux
:param kwargs_source:
:return:
"""
if numPix is None:
numPix = 1000 # d... |
async def send_schema(self, schema_data_json: str) -> str:
"""
Send schema to ledger, then retrieve it as written to the ledger and return it.
Raise BadLedgerTxn on failure. Raise BadAttribute for attribute name with spaces or
reserved for indy-sdk.
If schema already exists on l... | <ast.AsyncFunctionDef object at 0x7da20c6a89a0> | keyword[async] keyword[def] identifier[send_schema] ( identifier[self] , identifier[schema_data_json] : identifier[str] )-> identifier[str] :
literal[string]
identifier[LOGGER] . identifier[debug] ( literal[string] , identifier[schema_data_json] )
identifier[schema_data] = identifier[js... | async def send_schema(self, schema_data_json: str) -> str:
"""
Send schema to ledger, then retrieve it as written to the ledger and return it.
Raise BadLedgerTxn on failure. Raise BadAttribute for attribute name with spaces or
reserved for indy-sdk.
If schema already exists on ledge... |
def load_hash_configuration(self, hash_name):
"""
Loads and returns hash configuration
"""
conf = self.mongo_object.find_one(
{'hash_conf_name': hash_name + '_conf'}
)
return pickle.loads(conf['hash_configuration']) if conf is not None\
else None | def function[load_hash_configuration, parameter[self, hash_name]]:
constant[
Loads and returns hash configuration
]
variable[conf] assign[=] call[name[self].mongo_object.find_one, parameter[dictionary[[<ast.Constant object at 0x7da1b0866380>], [<ast.BinOp object at 0x7da1b0864bb0>]]]]
... | keyword[def] identifier[load_hash_configuration] ( identifier[self] , identifier[hash_name] ):
literal[string]
identifier[conf] = identifier[self] . identifier[mongo_object] . identifier[find_one] (
{ literal[string] : identifier[hash_name] + literal[string] }
)
keyword[ret... | def load_hash_configuration(self, hash_name):
"""
Loads and returns hash configuration
"""
conf = self.mongo_object.find_one({'hash_conf_name': hash_name + '_conf'})
return pickle.loads(conf['hash_configuration']) if conf is not None else None |
def get_process_hardware_breakpoints(self, dwProcessId):
"""
@see: L{get_thread_hardware_breakpoints}
@type dwProcessId: int
@param dwProcessId: Process global ID.
@rtype: list of tuple( int, L{HardwareBreakpoint} )
@return: All hardware breakpoints for each thread in... | def function[get_process_hardware_breakpoints, parameter[self, dwProcessId]]:
constant[
@see: L{get_thread_hardware_breakpoints}
@type dwProcessId: int
@param dwProcessId: Process global ID.
@rtype: list of tuple( int, L{HardwareBreakpoint} )
@return: All hardware bre... | keyword[def] identifier[get_process_hardware_breakpoints] ( identifier[self] , identifier[dwProcessId] ):
literal[string]
identifier[result] = identifier[list] ()
identifier[aProcess] = identifier[self] . identifier[system] . identifier[get_process] ( identifier[dwProcessId] )
key... | def get_process_hardware_breakpoints(self, dwProcessId):
"""
@see: L{get_thread_hardware_breakpoints}
@type dwProcessId: int
@param dwProcessId: Process global ID.
@rtype: list of tuple( int, L{HardwareBreakpoint} )
@return: All hardware breakpoints for each thread in the... |
def protein_ids(self, contig=None, strand=None):
"""
What are all the protein IDs
(optionally restrict to a given chromosome and/or strand)
"""
protein_ids = self._all_feature_values(
column="protein_id",
feature="CDS",
contig=contig,
... | def function[protein_ids, parameter[self, contig, strand]]:
constant[
What are all the protein IDs
(optionally restrict to a given chromosome and/or strand)
]
variable[protein_ids] assign[=] call[name[self]._all_feature_values, parameter[]]
return[<ast.ListComp object at 0x7d... | keyword[def] identifier[protein_ids] ( identifier[self] , identifier[contig] = keyword[None] , identifier[strand] = keyword[None] ):
literal[string]
identifier[protein_ids] = identifier[self] . identifier[_all_feature_values] (
identifier[column] = literal[string] ,
identifier[fea... | def protein_ids(self, contig=None, strand=None):
"""
What are all the protein IDs
(optionally restrict to a given chromosome and/or strand)
"""
protein_ids = self._all_feature_values(column='protein_id', feature='CDS', contig=contig, strand=strand, distinct=True)
# drop None values
... |
def check_consistent_length(*arrays):
"""Check that all arrays have consistent first dimensions.
Checks whether all objects in arrays have the same shape or length.
Parameters
----------
arrays : list or tuple of input objects.
Objects that will be checked for consistent length.
"""
... | def function[check_consistent_length, parameter[]]:
constant[Check that all arrays have consistent first dimensions.
Checks whether all objects in arrays have the same shape or length.
Parameters
----------
arrays : list or tuple of input objects.
Objects that will be checked for consi... | keyword[def] identifier[check_consistent_length] (* identifier[arrays] ):
literal[string]
identifier[uniques] = identifier[np] . identifier[unique] ([ identifier[_num_samples] ( identifier[X] ) keyword[for] identifier[X] keyword[in] identifier[arrays] keyword[if] identifier[X] keyword[is] keyword[n... | def check_consistent_length(*arrays):
"""Check that all arrays have consistent first dimensions.
Checks whether all objects in arrays have the same shape or length.
Parameters
----------
arrays : list or tuple of input objects.
Objects that will be checked for consistent length.
"""
... |
def convert_iris(directory, output_directory, output_filename='iris.hdf5'):
"""Convert the Iris dataset to HDF5.
Converts the Iris dataset to an HDF5 dataset compatible with
:class:`fuel.datasets.Iris`. The converted dataset is
saved as 'iris.hdf5'.
This method assumes the existence of the file `ir... | def function[convert_iris, parameter[directory, output_directory, output_filename]]:
constant[Convert the Iris dataset to HDF5.
Converts the Iris dataset to an HDF5 dataset compatible with
:class:`fuel.datasets.Iris`. The converted dataset is
saved as 'iris.hdf5'.
This method assumes the existe... | keyword[def] identifier[convert_iris] ( identifier[directory] , identifier[output_directory] , identifier[output_filename] = literal[string] ):
literal[string]
identifier[classes] ={ literal[string] : literal[int] , literal[string] : literal[int] , literal[string] : literal[int] }
identifier[data] = i... | def convert_iris(directory, output_directory, output_filename='iris.hdf5'):
"""Convert the Iris dataset to HDF5.
Converts the Iris dataset to an HDF5 dataset compatible with
:class:`fuel.datasets.Iris`. The converted dataset is
saved as 'iris.hdf5'.
This method assumes the existence of the file `ir... |
def draw_strokes(stroke_based_drawings):
"""
Visualizes drawings (ground truth or predictions) by
returning images to represent the stroke-based data from
the user.
Parameters
----------
stroke_based_drawings: SArray or list
An `SArray` of type `list`. Each element in the SArray
... | def function[draw_strokes, parameter[stroke_based_drawings]]:
constant[
Visualizes drawings (ground truth or predictions) by
returning images to represent the stroke-based data from
the user.
Parameters
----------
stroke_based_drawings: SArray or list
An `SArray` of type `list`... | keyword[def] identifier[draw_strokes] ( identifier[stroke_based_drawings] ):
literal[string]
identifier[single_input] = keyword[False]
keyword[if] ( keyword[not] identifier[isinstance] ( identifier[stroke_based_drawings] , identifier[_tc] . identifier[SArray] )
keyword[and] keyword[not] ident... | def draw_strokes(stroke_based_drawings):
"""
Visualizes drawings (ground truth or predictions) by
returning images to represent the stroke-based data from
the user.
Parameters
----------
stroke_based_drawings: SArray or list
An `SArray` of type `list`. Each element in the SArray
... |
def reload_extension(self, name):
"""Atomically reloads an extension.
This replaces the extension with the same extension, only refreshed. This is
equivalent to a :meth:`unload_extension` followed by a :meth:`load_extension`
except done in an atomic way. That is, if an operation fails m... | def function[reload_extension, parameter[self, name]]:
constant[Atomically reloads an extension.
This replaces the extension with the same extension, only refreshed. This is
equivalent to a :meth:`unload_extension` followed by a :meth:`load_extension`
except done in an atomic way. That ... | keyword[def] identifier[reload_extension] ( identifier[self] , identifier[name] ):
literal[string]
identifier[lib] = identifier[self] . identifier[__extensions] . identifier[get] ( identifier[name] )
keyword[if] identifier[lib] keyword[is] keyword[None] :
keyword[raise] i... | def reload_extension(self, name):
"""Atomically reloads an extension.
This replaces the extension with the same extension, only refreshed. This is
equivalent to a :meth:`unload_extension` followed by a :meth:`load_extension`
except done in an atomic way. That is, if an operation fails mid-r... |
def enable_precompute(panel):
"""Schedule a precompute task for `panel`"""
use_metis = panel['data_source']['source_type'] == 'querybuilder'
if use_metis:
query = panel['data_source']['query']
else:
query = "u'''%s'''" % panel['data_source']['code']
precompute = panel['data_source']['precompute']
ti... | def function[enable_precompute, parameter[panel]]:
constant[Schedule a precompute task for `panel`]
variable[use_metis] assign[=] compare[call[call[name[panel]][constant[data_source]]][constant[source_type]] equal[==] constant[querybuilder]]
if name[use_metis] begin[:]
variable[q... | keyword[def] identifier[enable_precompute] ( identifier[panel] ):
literal[string]
identifier[use_metis] = identifier[panel] [ literal[string] ][ literal[string] ]== literal[string]
keyword[if] identifier[use_metis] :
identifier[query] = identifier[panel] [ literal[string] ][ literal[string] ]
keyw... | def enable_precompute(panel):
"""Schedule a precompute task for `panel`"""
use_metis = panel['data_source']['source_type'] == 'querybuilder'
if use_metis:
query = panel['data_source']['query'] # depends on [control=['if'], data=[]]
else:
query = "u'''%s'''" % panel['data_source']['code'... |
def get(self, name: str, default: Any = None) -> Any:
"""Return the first value, either the default or actual"""
return super().get(name, [default])[0] | def function[get, parameter[self, name, default]]:
constant[Return the first value, either the default or actual]
return[call[call[call[name[super], parameter[]].get, parameter[name[name], list[[<ast.Name object at 0x7da1b1616e00>]]]]][constant[0]]] | keyword[def] identifier[get] ( identifier[self] , identifier[name] : identifier[str] , identifier[default] : identifier[Any] = keyword[None] )-> identifier[Any] :
literal[string]
keyword[return] identifier[super] (). identifier[get] ( identifier[name] ,[ identifier[default] ])[ literal[int] ] | def get(self, name: str, default: Any=None) -> Any:
"""Return the first value, either the default or actual"""
return super().get(name, [default])[0] |
def _build_flags(self):
"""
Function builds kwargs variable for run_window
"""
# Check if all entries for selected arguments are nonempty
for arg_dict in [x for x in self.args.values() if self.arg_is_selected(x)]:
if 'entry' in arg_dict and not arg_dict['entry'].get_t... | def function[_build_flags, parameter[self]]:
constant[
Function builds kwargs variable for run_window
]
for taget[name[arg_dict]] in starred[<ast.ListComp object at 0x7da1b0fae7a0>] begin[:]
if <ast.BoolOp object at 0x7da1b0fae620> begin[:]
call[na... | keyword[def] identifier[_build_flags] ( identifier[self] ):
literal[string]
keyword[for] identifier[arg_dict] keyword[in] [ identifier[x] keyword[for] identifier[x] keyword[in] identifier[self] . identifier[args] . identifier[values] () keyword[if] identifier[self] . identifier[arg_... | def _build_flags(self):
"""
Function builds kwargs variable for run_window
"""
# Check if all entries for selected arguments are nonempty
for arg_dict in [x for x in self.args.values() if self.arg_is_selected(x)]:
if 'entry' in arg_dict and (not arg_dict['entry'].get_text()):
... |
def add_jump(self, name, min, max, num, warp=None, var_type=float):
""" An integer/float-valued enumerable with `num` items, bounded
between [`min`, `max`]. Note that the right endpoint of the interval
includes `max`. This is a wrapper around the add_enum. `jump` can be
a float or int.
... | def function[add_jump, parameter[self, name, min, max, num, warp, var_type]]:
constant[ An integer/float-valued enumerable with `num` items, bounded
between [`min`, `max`]. Note that the right endpoint of the interval
includes `max`. This is a wrapper around the add_enum. `jump` can be
a... | keyword[def] identifier[add_jump] ( identifier[self] , identifier[name] , identifier[min] , identifier[max] , identifier[num] , identifier[warp] = keyword[None] , identifier[var_type] = identifier[float] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[var_type] , i... | def add_jump(self, name, min, max, num, warp=None, var_type=float):
""" An integer/float-valued enumerable with `num` items, bounded
between [`min`, `max`]. Note that the right endpoint of the interval
includes `max`. This is a wrapper around the add_enum. `jump` can be
a float or int.
... |
def calculate_gradient(self, batch_info, device, model, rollout):
""" Calculate loss of the supplied rollout """
assert isinstance(rollout, Trajectories), "ACER algorithm requires trajectory input"
local_epsilon = 1e-6
evaluator = model.evaluate(rollout)
actions = evaluator.ge... | def function[calculate_gradient, parameter[self, batch_info, device, model, rollout]]:
constant[ Calculate loss of the supplied rollout ]
assert[call[name[isinstance], parameter[name[rollout], name[Trajectories]]]]
variable[local_epsilon] assign[=] constant[1e-06]
variable[evaluator] assign[... | keyword[def] identifier[calculate_gradient] ( identifier[self] , identifier[batch_info] , identifier[device] , identifier[model] , identifier[rollout] ):
literal[string]
keyword[assert] identifier[isinstance] ( identifier[rollout] , identifier[Trajectories] ), literal[string]
identifier... | def calculate_gradient(self, batch_info, device, model, rollout):
""" Calculate loss of the supplied rollout """
assert isinstance(rollout, Trajectories), 'ACER algorithm requires trajectory input'
local_epsilon = 1e-06
evaluator = model.evaluate(rollout)
actions = evaluator.get('rollout:actions')
... |
def set_lcm_config(config_mode=None,
config_mode_freq=None,
refresh_freq=None,
reboot_if_needed=None,
action_after_reboot=None,
refresh_mode=None,
certificate_id=None,
configuration_id=No... | def function[set_lcm_config, parameter[config_mode, config_mode_freq, refresh_freq, reboot_if_needed, action_after_reboot, refresh_mode, certificate_id, configuration_id, allow_module_overwrite, debug_mode, status_retention_days]]:
constant[
For detailed descriptions of the parameters see:
https://msdn.... | keyword[def] identifier[set_lcm_config] ( identifier[config_mode] = keyword[None] ,
identifier[config_mode_freq] = keyword[None] ,
identifier[refresh_freq] = keyword[None] ,
identifier[reboot_if_needed] = keyword[None] ,
identifier[action_after_reboot] = keyword[None] ,
identifier[refresh_mode] = keyword[None] ,... | def set_lcm_config(config_mode=None, config_mode_freq=None, refresh_freq=None, reboot_if_needed=None, action_after_reboot=None, refresh_mode=None, certificate_id=None, configuration_id=None, allow_module_overwrite=None, debug_mode=False, status_retention_days=None):
"""
For detailed descriptions of the paramete... |
def _get_boxes(pos, size=None, margin=0, keep_aspect_ratio=True):
"""Generate non-overlapping boxes in NDC from a set of positions."""
# Get x, y.
pos = np.asarray(pos, dtype=np.float64)
x, y = pos.T
x = x[:, np.newaxis]
y = y[:, np.newaxis]
w, h = size if size is not None else _get_box_si... | def function[_get_boxes, parameter[pos, size, margin, keep_aspect_ratio]]:
constant[Generate non-overlapping boxes in NDC from a set of positions.]
variable[pos] assign[=] call[name[np].asarray, parameter[name[pos]]]
<ast.Tuple object at 0x7da1b13860b0> assign[=] name[pos].T
variable[x] ... | keyword[def] identifier[_get_boxes] ( identifier[pos] , identifier[size] = keyword[None] , identifier[margin] = literal[int] , identifier[keep_aspect_ratio] = keyword[True] ):
literal[string]
identifier[pos] = identifier[np] . identifier[asarray] ( identifier[pos] , identifier[dtype] = identifier[np]... | def _get_boxes(pos, size=None, margin=0, keep_aspect_ratio=True):
"""Generate non-overlapping boxes in NDC from a set of positions."""
# Get x, y.
pos = np.asarray(pos, dtype=np.float64)
(x, y) = pos.T
x = x[:, np.newaxis]
y = y[:, np.newaxis]
(w, h) = size if size is not None else _get_box_... |
def load_any_file(filename):
"""
Attempts to load filename by trial-and-error
Returns:
file: A DataFile descendant, whose specific class depends on the file format detected, or None
if the file canonot be loaded
"""
import f311
# Splits attempts using ((binary X text) file) cri... | def function[load_any_file, parameter[filename]]:
constant[
Attempts to load filename by trial-and-error
Returns:
file: A DataFile descendant, whose specific class depends on the file format detected, or None
if the file canonot be loaded
]
import module[f311]
if call[na... | keyword[def] identifier[load_any_file] ( identifier[filename] ):
literal[string]
keyword[import] identifier[f311]
keyword[if] identifier[a99] . identifier[is_text_file] ( identifier[filename] ):
keyword[return] identifier[load_with_classes] ( identifier[filename] , identifier[f311] ... | def load_any_file(filename):
"""
Attempts to load filename by trial-and-error
Returns:
file: A DataFile descendant, whose specific class depends on the file format detected, or None
if the file canonot be loaded
"""
import f311
# Splits attempts using ((binary X text) file) crit... |
def get_meta_type_by_name(name):
data = get_default_metadata_data()
child_data = get_child_metadata_data()
for item in data["metadataObjects"]:
if 'xmlName' in item and item['xmlName'] == name:
return item
for item in child_data:
if 'xmlName' in item and item['xmlName'] == na... | def function[get_meta_type_by_name, parameter[name]]:
variable[data] assign[=] call[name[get_default_metadata_data], parameter[]]
variable[child_data] assign[=] call[name[get_child_metadata_data], parameter[]]
for taget[name[item]] in starred[call[name[data]][constant[metadataObjects]]] begin[:]... | keyword[def] identifier[get_meta_type_by_name] ( identifier[name] ):
identifier[data] = identifier[get_default_metadata_data] ()
identifier[child_data] = identifier[get_child_metadata_data] ()
keyword[for] identifier[item] keyword[in] identifier[data] [ literal[string] ]:
keyword[if] liter... | def get_meta_type_by_name(name):
data = get_default_metadata_data()
child_data = get_child_metadata_data()
for item in data['metadataObjects']:
if 'xmlName' in item and item['xmlName'] == name:
return item # depends on [control=['if'], data=[]] # depends on [control=['for'], data=['ite... |
def difference_update(self, other):
"""Update self to include only the difference with other."""
other = set(other)
indices_to_delete = set()
for i, elem in enumerate(self):
if elem in other:
indices_to_delete.add(i)
if indices_to_delete:
self._delete_values_by_index(indices_to_delete) | def function[difference_update, parameter[self, other]]:
constant[Update self to include only the difference with other.]
variable[other] assign[=] call[name[set], parameter[name[other]]]
variable[indices_to_delete] assign[=] call[name[set], parameter[]]
for taget[tuple[[<ast.Name object... | keyword[def] identifier[difference_update] ( identifier[self] , identifier[other] ):
literal[string]
identifier[other] = identifier[set] ( identifier[other] )
identifier[indices_to_delete] = identifier[set] ()
keyword[for] identifier[i] , identifier[elem] keyword[in] identifier[enumerate] ( identifier... | def difference_update(self, other):
"""Update self to include only the difference with other."""
other = set(other)
indices_to_delete = set()
for (i, elem) in enumerate(self):
if elem in other:
indices_to_delete.add(i) # depends on [control=['if'], data=[]] # depends on [control=['... |
def _set_ldp_protocol_stats_instance_total(self, v, load=False):
"""
Setter method for ldp_protocol_stats_instance_total, mapped from YANG variable /mpls_state/ldp/statistics/ldp_protocol_stats_instance_total (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_ld... | def function[_set_ldp_protocol_stats_instance_total, parameter[self, v, load]]:
constant[
Setter method for ldp_protocol_stats_instance_total, mapped from YANG variable /mpls_state/ldp/statistics/ldp_protocol_stats_instance_total (container)
If this variable is read-only (config: false) in the
sourc... | keyword[def] identifier[_set_ldp_protocol_stats_instance_total] ( identifier[self] , identifier[v] , identifier[load] = keyword[False] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[v] , literal[string] ):
identifier[v] = identifier[v] . identifier[_utype] ( identifier[v] )
ke... | def _set_ldp_protocol_stats_instance_total(self, v, load=False):
"""
Setter method for ldp_protocol_stats_instance_total, mapped from YANG variable /mpls_state/ldp/statistics/ldp_protocol_stats_instance_total (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_ld... |
def analysis(self):
"""Get musical analysis of the song using the librosa library
"""
if self._analysis is not None:
return self._analysis
if self.cache_dir is not None:
path = os.path.join(self.cache_dir, self.checksum)
try:
if self.r... | def function[analysis, parameter[self]]:
constant[Get musical analysis of the song using the librosa library
]
if compare[name[self]._analysis is_not constant[None]] begin[:]
return[name[self]._analysis]
if compare[name[self].cache_dir is_not constant[None]] begin[:]
... | keyword[def] identifier[analysis] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_analysis] keyword[is] keyword[not] keyword[None] :
keyword[return] identifier[self] . identifier[_analysis]
keyword[if] identifier[self] . identifier[cach... | def analysis(self):
"""Get musical analysis of the song using the librosa library
"""
if self._analysis is not None:
return self._analysis # depends on [control=['if'], data=[]]
if self.cache_dir is not None:
path = os.path.join(self.cache_dir, self.checksum)
try:
... |
def json_http_resp(handler):
"""
Automatically serialize return value to the body of a successfull HTTP
response.
Returns a 500 error if the response cannot be serialized
Usage::
>>> from lambda_decorators import json_http_resp
>>> @json_http_resp
... def handler(event, context):
... return {... | def function[json_http_resp, parameter[handler]]:
constant[
Automatically serialize return value to the body of a successfull HTTP
response.
Returns a 500 error if the response cannot be serialized
Usage::
>>> from lambda_decorators import json_http_resp
>>> @json_http_resp
... def handler(event,... | keyword[def] identifier[json_http_resp] ( identifier[handler] ):
literal[string]
@ identifier[wraps] ( identifier[handler] )
keyword[def] identifier[wrapper] ( identifier[event] , identifier[context] ):
identifier[response] = identifier[handler] ( identifier[event] , identifier[context] )
... | def json_http_resp(handler):
"""
Automatically serialize return value to the body of a successfull HTTP
response.
Returns a 500 error if the response cannot be serialized
Usage::
>>> from lambda_decorators import json_http_resp
>>> @json_http_resp
... def handler(event, context):
... return {... |
def glyph(dataset, orient=True, scale=True, factor=1.0, geom=None):
"""
Copies a geometric representation (called a glyph) to every
point in the input dataset. The glyph may be oriented along
the input vectors, and it may be scaled according to scalar
data or vector magnitude.
... | def function[glyph, parameter[dataset, orient, scale, factor, geom]]:
constant[
Copies a geometric representation (called a glyph) to every
point in the input dataset. The glyph may be oriented along
the input vectors, and it may be scaled according to scalar
data or vector magn... | keyword[def] identifier[glyph] ( identifier[dataset] , identifier[orient] = keyword[True] , identifier[scale] = keyword[True] , identifier[factor] = literal[int] , identifier[geom] = keyword[None] ):
literal[string]
keyword[if] identifier[geom] keyword[is] keyword[None] :
identifier... | def glyph(dataset, orient=True, scale=True, factor=1.0, geom=None):
"""
Copies a geometric representation (called a glyph) to every
point in the input dataset. The glyph may be oriented along
the input vectors, and it may be scaled according to scalar
data or vector magnitude.
... |
def QoI_Dist(poly, dist, sample=10000, **kws):
"""
Constructs distributions for the quantity of interests.
The function constructs a kernel density estimator (KDE) for each
polynomial (poly) by sampling it. With the KDEs, distributions (Dists) are
constructed. The Dists can be used for e.g. plott... | def function[QoI_Dist, parameter[poly, dist, sample]]:
constant[
Constructs distributions for the quantity of interests.
The function constructs a kernel density estimator (KDE) for each
polynomial (poly) by sampling it. With the KDEs, distributions (Dists) are
constructed. The Dists can be u... | keyword[def] identifier[QoI_Dist] ( identifier[poly] , identifier[dist] , identifier[sample] = literal[int] ,** identifier[kws] ):
literal[string]
identifier[shape] = identifier[poly] . identifier[shape]
identifier[poly] = identifier[polynomials] . identifier[flatten] ( identifier[poly] )
identi... | def QoI_Dist(poly, dist, sample=10000, **kws):
"""
Constructs distributions for the quantity of interests.
The function constructs a kernel density estimator (KDE) for each
polynomial (poly) by sampling it. With the KDEs, distributions (Dists) are
constructed. The Dists can be used for e.g. plott... |
async def numbered_page(self):
"""lets you type a page number to go to"""
to_delete = []
to_delete.append(await self.bot.send_message(self.message.channel, 'What page do you want to go to?'))
msg = await self.bot.wait_for_message(author=self.author, channel=self.message.channel,
... | <ast.AsyncFunctionDef object at 0x7da1b2818610> | keyword[async] keyword[def] identifier[numbered_page] ( identifier[self] ):
literal[string]
identifier[to_delete] =[]
identifier[to_delete] . identifier[append] ( keyword[await] identifier[self] . identifier[bot] . identifier[send_message] ( identifier[self] . identifier[message] . ident... | async def numbered_page(self):
"""lets you type a page number to go to"""
to_delete = []
to_delete.append(await self.bot.send_message(self.message.channel, 'What page do you want to go to?'))
msg = await self.bot.wait_for_message(author=self.author, channel=self.message.channel, check=lambda m: m.conten... |
def _write_config(self, memory):
"""Write the configuration for this gate to memory."""
memory.seek(0)
memory.write(struct.pack("<5I",
# sim_length
self._simulator.length,
# input_a_key
... | def function[_write_config, parameter[self, memory]]:
constant[Write the configuration for this gate to memory.]
call[name[memory].seek, parameter[constant[0]]]
call[name[memory].write, parameter[call[name[struct].pack, parameter[constant[<5I], name[self]._simulator.length, <ast.IfExp object at ... | keyword[def] identifier[_write_config] ( identifier[self] , identifier[memory] ):
literal[string]
identifier[memory] . identifier[seek] ( literal[int] )
identifier[memory] . identifier[write] ( identifier[struct] . identifier[pack] ( literal[string] ,
identifier[self] . i... | def _write_config(self, memory):
"""Write the configuration for this gate to memory."""
memory.seek(0)
# sim_length
# input_a_key
# input_b_key
# output_key
# lut
memory.write(struct.pack('<5I', self._simulator.length, self._inputs['a'].routing_key if self._inputs['a'] is not None else 4... |
def region_code_for_number(numobj):
"""Returns the region where a phone number is from.
This could be used for geocoding at the region level. Only guarantees
correct results for valid, full numbers (not short-codes, or invalid
numbers).
Arguments:
numobj -- The phone number object whose origin... | def function[region_code_for_number, parameter[numobj]]:
constant[Returns the region where a phone number is from.
This could be used for geocoding at the region level. Only guarantees
correct results for valid, full numbers (not short-codes, or invalid
numbers).
Arguments:
numobj -- The p... | keyword[def] identifier[region_code_for_number] ( identifier[numobj] ):
literal[string]
identifier[country_code] = identifier[numobj] . identifier[country_code]
identifier[regions] = identifier[COUNTRY_CODE_TO_REGION_CODE] . identifier[get] ( identifier[country_code] , keyword[None] )
keyword[if... | def region_code_for_number(numobj):
"""Returns the region where a phone number is from.
This could be used for geocoding at the region level. Only guarantees
correct results for valid, full numbers (not short-codes, or invalid
numbers).
Arguments:
numobj -- The phone number object whose origin... |
def serialize(self, value, **kwargs):
"""Serialize every item of the list."""
return [self.item_type.serialize(val, **kwargs) for val in value] | def function[serialize, parameter[self, value]]:
constant[Serialize every item of the list.]
return[<ast.ListComp object at 0x7da1b1ad3970>] | keyword[def] identifier[serialize] ( identifier[self] , identifier[value] ,** identifier[kwargs] ):
literal[string]
keyword[return] [ identifier[self] . identifier[item_type] . identifier[serialize] ( identifier[val] ,** identifier[kwargs] ) keyword[for] identifier[val] keyword[in] identifier[va... | def serialize(self, value, **kwargs):
"""Serialize every item of the list."""
return [self.item_type.serialize(val, **kwargs) for val in value] |
def match(self, other_version):
"""Returns True if other_version matches.
Args:
other_version: string, of the form "x[.y[.x]]" where {x,y,z} can be a
number or a wildcard.
"""
major, minor, patch = _str_to_version(other_version, allow_wildcard=True)
return (major in [self.major, "*"] ... | def function[match, parameter[self, other_version]]:
constant[Returns True if other_version matches.
Args:
other_version: string, of the form "x[.y[.x]]" where {x,y,z} can be a
number or a wildcard.
]
<ast.Tuple object at 0x7da1b1e8e5c0> assign[=] call[name[_str_to_version], param... | keyword[def] identifier[match] ( identifier[self] , identifier[other_version] ):
literal[string]
identifier[major] , identifier[minor] , identifier[patch] = identifier[_str_to_version] ( identifier[other_version] , identifier[allow_wildcard] = keyword[True] )
keyword[return] ( identifier[major] keywo... | def match(self, other_version):
"""Returns True if other_version matches.
Args:
other_version: string, of the form "x[.y[.x]]" where {x,y,z} can be a
number or a wildcard.
"""
(major, minor, patch) = _str_to_version(other_version, allow_wildcard=True)
return major in [self.major, '*']... |
def cli_run_viz(source=None, outputpath="", theme="", verbose=False):
"""
This application is a wrapper on the main ontospy-viz script. It generates docs for all models in the local library. Using the Complex-html template..
@todo allow to pass a custom folder ..
> python -m ontospy.viz.scripts.export_all -o ~/Des... | def function[cli_run_viz, parameter[source, outputpath, theme, verbose]]:
constant[
This application is a wrapper on the main ontospy-viz script. It generates docs for all models in the local library. Using the Complex-html template..
@todo allow to pass a custom folder ..
> python -m ontospy.viz.scripts.expor... | keyword[def] identifier[cli_run_viz] ( identifier[source] = keyword[None] , identifier[outputpath] = literal[string] , identifier[theme] = literal[string] , identifier[verbose] = keyword[False] ):
literal[string]
keyword[if] identifier[outputpath] :
keyword[if] keyword[not] ( identifier[os] . i... | def cli_run_viz(source=None, outputpath='', theme='', verbose=False):
"""
This application is a wrapper on the main ontospy-viz script. It generates docs for all models in the local library. Using the Complex-html template..
@todo allow to pass a custom folder ..
> python -m ontospy.viz.scripts.export_all -o ~/Des... |
def cmd_jshell(ip, port, verbose):
"""Control a web browser through Websockets.
Bind a port (default: 3333) and listen for HTTP connections.
On connection, send a JavaScript code that opens a WebSocket that
can be used to send commands to the connected browser.
You can write the commands directly... | def function[cmd_jshell, parameter[ip, port, verbose]]:
constant[Control a web browser through Websockets.
Bind a port (default: 3333) and listen for HTTP connections.
On connection, send a JavaScript code that opens a WebSocket that
can be used to send commands to the connected browser.
You ... | keyword[def] identifier[cmd_jshell] ( identifier[ip] , identifier[port] , identifier[verbose] ):
literal[string]
keyword[global] identifier[hook_js]
identifier[hook_js] = identifier[hook_js] . identifier[format] ( identifier[ip] = identifier[ip] , identifier[port] = identifier[port] )
identif... | def cmd_jshell(ip, port, verbose):
"""Control a web browser through Websockets.
Bind a port (default: 3333) and listen for HTTP connections.
On connection, send a JavaScript code that opens a WebSocket that
can be used to send commands to the connected browser.
You can write the commands directly... |
def _add_constraint(self, constraint):
"""
Adds constraint to the ProbModelXML.
"""
constraint_data = self.data['probnet']['AdditionalConstraints'][constraint]
constraint_element = etree.SubElement(
self.additional_constraints, 'Constraint', attrib={'name': constraint... | def function[_add_constraint, parameter[self, constraint]]:
constant[
Adds constraint to the ProbModelXML.
]
variable[constraint_data] assign[=] call[call[call[name[self].data][constant[probnet]]][constant[AdditionalConstraints]]][name[constraint]]
variable[constraint_element] as... | keyword[def] identifier[_add_constraint] ( identifier[self] , identifier[constraint] ):
literal[string]
identifier[constraint_data] = identifier[self] . identifier[data] [ literal[string] ][ literal[string] ][ identifier[constraint] ]
identifier[constraint_element] = identifier[etree] . id... | def _add_constraint(self, constraint):
"""
Adds constraint to the ProbModelXML.
"""
constraint_data = self.data['probnet']['AdditionalConstraints'][constraint]
constraint_element = etree.SubElement(self.additional_constraints, 'Constraint', attrib={'name': constraint})
for argument in so... |
def paintEvent(self, event):
"""
Pains the messages and the visible area on the panel.
:param event: paint event infos
"""
if self.isVisible():
# fill background
self._background_brush = QtGui.QBrush(self.editor.background)
painter = QtGui.QPai... | def function[paintEvent, parameter[self, event]]:
constant[
Pains the messages and the visible area on the panel.
:param event: paint event infos
]
if call[name[self].isVisible, parameter[]] begin[:]
name[self]._background_brush assign[=] call[name[QtGui].QBrush, ... | keyword[def] identifier[paintEvent] ( identifier[self] , identifier[event] ):
literal[string]
keyword[if] identifier[self] . identifier[isVisible] ():
identifier[self] . identifier[_background_brush] = identifier[QtGui] . identifier[QBrush] ( identifier[self] . identifier[edi... | def paintEvent(self, event):
"""
Pains the messages and the visible area on the panel.
:param event: paint event infos
"""
if self.isVisible():
# fill background
self._background_brush = QtGui.QBrush(self.editor.background)
painter = QtGui.QPainter(self)
p... |
def cmd_delete_doc(docid):
"""
Arguments: <document_id>
Delete a document.
Possible JSON replies:
--
{ "status": "ok", "docid": "xxxx" }
--
{
"status": "error", "exception": "yyy",
"reason": "xxxx", "args": "(xxxx, )"
}
"""
dsearc... | def function[cmd_delete_doc, parameter[docid]]:
constant[
Arguments: <document_id>
Delete a document.
Possible JSON replies:
--
{ "status": "ok", "docid": "xxxx" }
--
{
"status": "error", "exception": "yyy",
"reason": "xxxx", "args": "(xxxx, ... | keyword[def] identifier[cmd_delete_doc] ( identifier[docid] ):
literal[string]
identifier[dsearch] = identifier[get_docsearch] ()
identifier[doc] = identifier[dsearch] . identifier[get] ( identifier[docid] )
keyword[if] identifier[doc] keyword[is] keyword[None] :
keyword[raise] ident... | def cmd_delete_doc(docid):
"""
Arguments: <document_id>
Delete a document.
Possible JSON replies:
--
{ "status": "ok", "docid": "xxxx" }
--
{
"status": "error", "exception": "yyy",
"reason": "xxxx", "args": "(xxxx, )"
}
"""
dsearc... |
def websafe_dither(self):
"""Return the two websafe colors nearest to this one.
Returns:
A tuple of two grapefruit.Color instances which are the two
web safe colors closest this one.
>>> c = Color.from_rgb(1.0, 0.45, 0.0)
>>> c1, c2 = c.websafe_dither()
>>> c1
Color(1.0, 0.4, 0.0, ... | def function[websafe_dither, parameter[self]]:
constant[Return the two websafe colors nearest to this one.
Returns:
A tuple of two grapefruit.Color instances which are the two
web safe colors closest this one.
>>> c = Color.from_rgb(1.0, 0.45, 0.0)
>>> c1, c2 = c.websafe_dither()
>... | keyword[def] identifier[websafe_dither] ( identifier[self] ):
literal[string]
keyword[return] (
identifier[Color] ( identifier[rgb_to_websafe] (* identifier[self] . identifier[__rgb] ), literal[string] , identifier[self] . identifier[__a] , identifier[self] . identifier[__wref] ),
identifier[Colo... | def websafe_dither(self):
"""Return the two websafe colors nearest to this one.
Returns:
A tuple of two grapefruit.Color instances which are the two
web safe colors closest this one.
>>> c = Color.from_rgb(1.0, 0.45, 0.0)
>>> c1, c2 = c.websafe_dither()
>>> c1
Color(1.0, 0.4, 0.0, ... |
def gblocks(self,
new_path = None,
seq_type = 'nucl' or 'prot'):
"""Apply the gblocks filtering algorithm to the alignment.
See http://molevol.cmima.csic.es/castresana/Gblocks/Gblocks_documentation.html
Need to rename all sequences, because it will complain with l... | def function[gblocks, parameter[self, new_path, seq_type]]:
constant[Apply the gblocks filtering algorithm to the alignment.
See http://molevol.cmima.csic.es/castresana/Gblocks/Gblocks_documentation.html
Need to rename all sequences, because it will complain with long names.]
if compare[... | keyword[def] identifier[gblocks] ( identifier[self] ,
identifier[new_path] = keyword[None] ,
identifier[seq_type] = literal[string] keyword[or] literal[string] ):
literal[string]
keyword[if] identifier[new_path] keyword[is] keyword[None] : identifier[final] = identifier[self] . iden... | def gblocks(self, new_path=None, seq_type='nucl' or 'prot'):
"""Apply the gblocks filtering algorithm to the alignment.
See http://molevol.cmima.csic.es/castresana/Gblocks/Gblocks_documentation.html
Need to rename all sequences, because it will complain with long names."""
# Temporary path #
... |
def get_bpm_tasks(self, **kwargs):
"""
List of (recently) active BPM tasks.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callb... | def function[get_bpm_tasks, parameter[self]]:
constant[
List of (recently) active BPM tasks.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
... | keyword[def] identifier[get_bpm_tasks] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] [ literal[string] ]= keyword[True]
keyword[if] identifier[kwargs] . identifier[get] ( literal[string] ):
keyword[return] identifier[self] . identifier[get_... | def get_bpm_tasks(self, **kwargs):
"""
List of (recently) active BPM tasks.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_... |
def start_shell(local_ns: Dict=None, banner: str=''):
"""Create and immediately drop into a Python shell.
If IPython version 5 or greater is available it will be used instead
of the built-in python shell.
:param local_ns: An optional dict containing the global namespace of
the n... | def function[start_shell, parameter[local_ns, banner]]:
constant[Create and immediately drop into a Python shell.
If IPython version 5 or greater is available it will be used instead
of the built-in python shell.
:param local_ns: An optional dict containing the global namespace of
... | keyword[def] identifier[start_shell] ( identifier[local_ns] : identifier[Dict] = keyword[None] , identifier[banner] : identifier[str] = literal[string] ):
literal[string]
keyword[if] identifier[IPYTHON_SHELL_AVAILABLE] :
identifier[terminal] = identifier[embed] . identifier[InteractiveS... | def start_shell(local_ns: Dict=None, banner: str=''):
"""Create and immediately drop into a Python shell.
If IPython version 5 or greater is available it will be used instead
of the built-in python shell.
:param local_ns: An optional dict containing the global namespace of
the n... |
def from_dict(self, subj_files):
"""
Parameters
----------
subj_files: dict of str
file_path -> int/str
"""
for group_label in subj_files:
try:
group_files = subj_files[group_label]
self.items.extend([self._load_imag... | def function[from_dict, parameter[self, subj_files]]:
constant[
Parameters
----------
subj_files: dict of str
file_path -> int/str
]
for taget[name[group_label]] in starred[name[subj_files]] begin[:]
<ast.Try object at 0x7da1afe0cf70> | keyword[def] identifier[from_dict] ( identifier[self] , identifier[subj_files] ):
literal[string]
keyword[for] identifier[group_label] keyword[in] identifier[subj_files] :
keyword[try] :
identifier[group_files] = identifier[subj_files] [ identifier[group_label] ]
... | def from_dict(self, subj_files):
"""
Parameters
----------
subj_files: dict of str
file_path -> int/str
"""
for group_label in subj_files:
try:
group_files = subj_files[group_label]
self.items.extend([self._load_image(get_abspath(imgf))... |
def _create_markup_plugin(language, model):
"""
Create a new MarkupPlugin class that represents the plugin type.
"""
form = type("{0}MarkupItemForm".format(language.capitalize()), (MarkupItemForm,), {
'default_language': language,
})
classname = "{0}MarkupPlugin".format(language.capital... | def function[_create_markup_plugin, parameter[language, model]]:
constant[
Create a new MarkupPlugin class that represents the plugin type.
]
variable[form] assign[=] call[name[type], parameter[call[constant[{0}MarkupItemForm].format, parameter[call[name[language].capitalize, parameter[]]]], tup... | keyword[def] identifier[_create_markup_plugin] ( identifier[language] , identifier[model] ):
literal[string]
identifier[form] = identifier[type] ( literal[string] . identifier[format] ( identifier[language] . identifier[capitalize] ()),( identifier[MarkupItemForm] ,),{
literal[string] : identifier[lan... | def _create_markup_plugin(language, model):
"""
Create a new MarkupPlugin class that represents the plugin type.
"""
form = type('{0}MarkupItemForm'.format(language.capitalize()), (MarkupItemForm,), {'default_language': language})
classname = '{0}MarkupPlugin'.format(language.capitalize())
Plugi... |
def experiment(ctx, project, experiment): # pylint:disable=redefined-outer-name
"""Commands for experiments."""
ctx.obj = ctx.obj or {}
ctx.obj['project'] = project
ctx.obj['experiment'] = experiment | def function[experiment, parameter[ctx, project, experiment]]:
constant[Commands for experiments.]
name[ctx].obj assign[=] <ast.BoolOp object at 0x7da1affc30a0>
call[name[ctx].obj][constant[project]] assign[=] name[project]
call[name[ctx].obj][constant[experiment]] assign[=] name[experim... | keyword[def] identifier[experiment] ( identifier[ctx] , identifier[project] , identifier[experiment] ):
literal[string]
identifier[ctx] . identifier[obj] = identifier[ctx] . identifier[obj] keyword[or] {}
identifier[ctx] . identifier[obj] [ literal[string] ]= identifier[project]
identifier[ctx]... | def experiment(ctx, project, experiment): # pylint:disable=redefined-outer-name
'Commands for experiments.'
ctx.obj = ctx.obj or {}
ctx.obj['project'] = project
ctx.obj['experiment'] = experiment |
def get_cmdclass():
""" DEPRICATE """
try:
from Cython.Distutils import build_ext
cmdclass = {'build_ext': build_ext}
return cmdclass
except Exception as ex:
print(ex)
print('WARNING: Cython is not installed. This is only a problem if you are building C extensions')
... | def function[get_cmdclass, parameter[]]:
constant[ DEPRICATE ]
<ast.Try object at 0x7da1b24bdb40> | keyword[def] identifier[get_cmdclass] ():
literal[string]
keyword[try] :
keyword[from] identifier[Cython] . identifier[Distutils] keyword[import] identifier[build_ext]
identifier[cmdclass] ={ literal[string] : identifier[build_ext] }
keyword[return] identifier[cmdclass]
... | def get_cmdclass():
""" DEPRICATE """
try:
from Cython.Distutils import build_ext
cmdclass = {'build_ext': build_ext}
return cmdclass # depends on [control=['try'], data=[]]
except Exception as ex:
print(ex)
print('WARNING: Cython is not installed. This is only a pro... |
def get_index_line(self,lnum):
""" Take the 1-indexed line number and return its index information"""
if lnum < 1:
sys.stderr.write("ERROR: line number should be greater than zero\n")
sys.exit()
elif lnum > len(self._lines):
sys.stderr.write("ERROR: too far this line nuber is not in index\... | def function[get_index_line, parameter[self, lnum]]:
constant[ Take the 1-indexed line number and return its index information]
if compare[name[lnum] less[<] constant[1]] begin[:]
call[name[sys].stderr.write, parameter[constant[ERROR: line number should be greater than zero
]]]
... | keyword[def] identifier[get_index_line] ( identifier[self] , identifier[lnum] ):
literal[string]
keyword[if] identifier[lnum] < literal[int] :
identifier[sys] . identifier[stderr] . identifier[write] ( literal[string] )
identifier[sys] . identifier[exit] ()
keyword[elif] identifier[lnu... | def get_index_line(self, lnum):
""" Take the 1-indexed line number and return its index information"""
if lnum < 1:
sys.stderr.write('ERROR: line number should be greater than zero\n')
sys.exit() # depends on [control=['if'], data=[]]
elif lnum > len(self._lines):
sys.stderr.write('... |
def _set_packet_timestamp(self, v, load=False):
"""
Setter method for packet_timestamp, mapped from YANG variable /interface/port_channel/system/packet_timestamp (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_packet_timestamp is considered as a private
m... | def function[_set_packet_timestamp, parameter[self, v, load]]:
constant[
Setter method for packet_timestamp, mapped from YANG variable /interface/port_channel/system/packet_timestamp (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_packet_timestamp is cons... | keyword[def] identifier[_set_packet_timestamp] ( identifier[self] , identifier[v] , identifier[load] = keyword[False] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[v] , literal[string] ):
identifier[v] = identifier[v] . identifier[_utype] ( identifier[v] )
keyword[try] :
... | def _set_packet_timestamp(self, v, load=False):
"""
Setter method for packet_timestamp, mapped from YANG variable /interface/port_channel/system/packet_timestamp (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_packet_timestamp is considered as a private
m... |
def read_from(fpath, verbose=None, aslines=False, strict=True, n=None, errors='replace'):
r""" Reads text from a file. Automatically returns utf8.
Args:
fpath (str): file path
aslines (bool): if True returns list of lines
verbose (bool): verbosity flag
Returns:
str: text fr... | def function[read_from, parameter[fpath, verbose, aslines, strict, n, errors]]:
constant[ Reads text from a file. Automatically returns utf8.
Args:
fpath (str): file path
aslines (bool): if True returns list of lines
verbose (bool): verbosity flag
Returns:
str: text fro... | keyword[def] identifier[read_from] ( identifier[fpath] , identifier[verbose] = keyword[None] , identifier[aslines] = keyword[False] , identifier[strict] = keyword[True] , identifier[n] = keyword[None] , identifier[errors] = literal[string] ):
literal[string]
keyword[if] identifier[n] keyword[is] keyword... | def read_from(fpath, verbose=None, aslines=False, strict=True, n=None, errors='replace'):
""" Reads text from a file. Automatically returns utf8.
Args:
fpath (str): file path
aslines (bool): if True returns list of lines
verbose (bool): verbosity flag
Returns:
str: text fro... |
def state(self, states=None):
"""Filter by state.
:param tags: States to filter.
:type tags: ``list``
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node`
"""
if states is None or not states:
return self
nodes = []
f... | def function[state, parameter[self, states]]:
constant[Filter by state.
:param tags: States to filter.
:type tags: ``list``
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node`
]
if <ast.BoolOp object at 0x7da1b1395c60> begin[:]
return[... | keyword[def] identifier[state] ( identifier[self] , identifier[states] = keyword[None] ):
literal[string]
keyword[if] identifier[states] keyword[is] keyword[None] keyword[or] keyword[not] identifier[states] :
keyword[return] identifier[self]
identifier[nodes] =[]
... | def state(self, states=None):
"""Filter by state.
:param tags: States to filter.
:type tags: ``list``
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node`
"""
if states is None or not states:
return self # depends on [control=['if'], data=[]]
... |
def run_bafRegress(filenames, out_prefix, extract_filename, freq_filename,
options):
"""Runs the bafRegress function.
:param filenames: the set of all sample files.
:param out_prefix: the output prefix.
:param extract_filename: the name of the markers to extract.
:param freq_file... | def function[run_bafRegress, parameter[filenames, out_prefix, extract_filename, freq_filename, options]]:
constant[Runs the bafRegress function.
:param filenames: the set of all sample files.
:param out_prefix: the output prefix.
:param extract_filename: the name of the markers to extract.
:par... | keyword[def] identifier[run_bafRegress] ( identifier[filenames] , identifier[out_prefix] , identifier[extract_filename] , identifier[freq_filename] ,
identifier[options] ):
literal[string]
identifier[command] =[
literal[string] ,
literal[string] ,
literal[string] , identifier[freq_file... | def run_bafRegress(filenames, out_prefix, extract_filename, freq_filename, options):
"""Runs the bafRegress function.
:param filenames: the set of all sample files.
:param out_prefix: the output prefix.
:param extract_filename: the name of the markers to extract.
:param freq_filename: the name of t... |
def flatten_tree_to_ident_hashes(item_or_tree,
lucent_id=TRANSLUCENT_BINDER_ID):
"""Flatten a tree to id and version values (ident_hash)."""
if 'contents' in item_or_tree:
tree = item_or_tree
if tree['id'] != lucent_id:
yield tree['id']
for i ... | def function[flatten_tree_to_ident_hashes, parameter[item_or_tree, lucent_id]]:
constant[Flatten a tree to id and version values (ident_hash).]
if compare[constant[contents] in name[item_or_tree]] begin[:]
variable[tree] assign[=] name[item_or_tree]
if compare[call[name[t... | keyword[def] identifier[flatten_tree_to_ident_hashes] ( identifier[item_or_tree] ,
identifier[lucent_id] = identifier[TRANSLUCENT_BINDER_ID] ):
literal[string]
keyword[if] literal[string] keyword[in] identifier[item_or_tree] :
identifier[tree] = identifier[item_or_tree]
keyword[if] ... | def flatten_tree_to_ident_hashes(item_or_tree, lucent_id=TRANSLUCENT_BINDER_ID):
"""Flatten a tree to id and version values (ident_hash)."""
if 'contents' in item_or_tree:
tree = item_or_tree
if tree['id'] != lucent_id:
yield tree['id'] # depends on [control=['if'], data=[]]
... |
async def service(self, limit=None, quota: Optional[Quota] = None) -> int:
"""
Service `limit` number of received messages in this stack.
:param limit: the maximum number of messages to be processed. If None,
processes all of the messages in rxMsgs.
:return: the number of messag... | <ast.AsyncFunctionDef object at 0x7da1b16b17b0> | keyword[async] keyword[def] identifier[service] ( identifier[self] , identifier[limit] = keyword[None] , identifier[quota] : identifier[Optional] [ identifier[Quota] ]= keyword[None] )-> identifier[int] :
literal[string]
keyword[if] identifier[self] . identifier[listener] :
keyword[a... | async def service(self, limit=None, quota: Optional[Quota]=None) -> int:
"""
Service `limit` number of received messages in this stack.
:param limit: the maximum number of messages to be processed. If None,
processes all of the messages in rxMsgs.
:return: the number of messages pro... |
def message(self):
'the standard message which can be transfer'
return {
'source':
'account',
'frequence':
self.frequence,
'account_cookie':
self.account_cookie,
'portfolio_cookie':
self.portfolio_cookie,
... | def function[message, parameter[self]]:
constant[the standard message which can be transfer]
return[dictionary[[<ast.Constant object at 0x7da1b20466b0>, <ast.Constant object at 0x7da1b20454b0>, <ast.Constant object at 0x7da1b2047ca0>, <ast.Constant object at 0x7da1b20442b0>, <ast.Constant object at 0x7da1b2... | keyword[def] identifier[message] ( identifier[self] ):
literal[string]
keyword[return] {
literal[string] :
literal[string] ,
literal[string] :
identifier[self] . identifier[frequence] ,
literal[string] :
identifier[self] . identifier[account_coo... | def message(self):
"""the standard message which can be transfer"""
return {'source': 'account', 'frequence': self.frequence, 'account_cookie': self.account_cookie, 'portfolio_cookie': self.portfolio_cookie, 'user_cookie': self.user_cookie, 'broker': self.broker, 'market_type': self.market_type, 'strategy_name'... |
def amint_to_char(am, hij=False, use_L=False):
'''Convert an angular momentum integer to a character
The input is a list (to handle sp, spd, ... orbitals). The return
value is a string
For example, converts [0] to 's' and [0,1,2] to 'spd'
If hij is True, the ordering spdfghijkl is used. Otherwise... | def function[amint_to_char, parameter[am, hij, use_L]]:
constant[Convert an angular momentum integer to a character
The input is a list (to handle sp, spd, ... orbitals). The return
value is a string
For example, converts [0] to 's' and [0,1,2] to 'spd'
If hij is True, the ordering spdfghijkl... | keyword[def] identifier[amint_to_char] ( identifier[am] , identifier[hij] = keyword[False] , identifier[use_L] = keyword[False] ):
literal[string]
keyword[if] identifier[use_L] keyword[and] identifier[am] ==[ literal[int] , literal[int] ]:
keyword[return] literal[string]
keyword[if] id... | def amint_to_char(am, hij=False, use_L=False):
"""Convert an angular momentum integer to a character
The input is a list (to handle sp, spd, ... orbitals). The return
value is a string
For example, converts [0] to 's' and [0,1,2] to 'spd'
If hij is True, the ordering spdfghijkl is used. Otherwise... |
def teardown_app_request(self, func: Callable) -> Callable:
"""Add a teardown request function to the app.
This is designed to be used as a decorator, and has the same
arguments as :meth:`~quart.Quart.teardown_request`. It applies
to all requests to the app this blueprint is registered ... | def function[teardown_app_request, parameter[self, func]]:
constant[Add a teardown request function to the app.
This is designed to be used as a decorator, and has the same
arguments as :meth:`~quart.Quart.teardown_request`. It applies
to all requests to the app this blueprint is regist... | keyword[def] identifier[teardown_app_request] ( identifier[self] , identifier[func] : identifier[Callable] )-> identifier[Callable] :
literal[string]
identifier[self] . identifier[record_once] ( keyword[lambda] identifier[state] : identifier[state] . identifier[app] . identifier[teardown_request] ... | def teardown_app_request(self, func: Callable) -> Callable:
"""Add a teardown request function to the app.
This is designed to be used as a decorator, and has the same
arguments as :meth:`~quart.Quart.teardown_request`. It applies
to all requests to the app this blueprint is registered on. ... |
def dequote_docstring(text):
"""Remove the quotes delimiting a docstring."""
# TODO: Process escaped characters unless raw mode?
text = text.strip()
if len(text) > 6 and text[:3] == text[-3:] == '"""':
# Standard case, """..."""
return text[3:-3]
if len(text) > 7 and text[:4] in ('u"... | def function[dequote_docstring, parameter[text]]:
constant[Remove the quotes delimiting a docstring.]
variable[text] assign[=] call[name[text].strip, parameter[]]
if <ast.BoolOp object at 0x7da204346140> begin[:]
return[call[name[text]][<ast.Slice object at 0x7da204347e50>]]
if <... | keyword[def] identifier[dequote_docstring] ( identifier[text] ):
literal[string]
identifier[text] = identifier[text] . identifier[strip] ()
keyword[if] identifier[len] ( identifier[text] )> literal[int] keyword[and] identifier[text] [: literal[int] ]== identifier[text] [- literal[int] :]== lit... | def dequote_docstring(text):
"""Remove the quotes delimiting a docstring."""
# TODO: Process escaped characters unless raw mode?
text = text.strip()
if len(text) > 6 and text[:3] == text[-3:] == '"""':
# Standard case, """..."""
return text[3:-3] # depends on [control=['if'], data=[]]
... |
def waypoint_request_send(self, seq):
'''wrapper for waypoint_request_send'''
if self.mavlink10():
self.mav.mission_request_send(self.target_system, self.target_component, seq)
else:
self.mav.waypoint_request_send(self.target_system, self.target_component, seq) | def function[waypoint_request_send, parameter[self, seq]]:
constant[wrapper for waypoint_request_send]
if call[name[self].mavlink10, parameter[]] begin[:]
call[name[self].mav.mission_request_send, parameter[name[self].target_system, name[self].target_component, name[seq]]] | keyword[def] identifier[waypoint_request_send] ( identifier[self] , identifier[seq] ):
literal[string]
keyword[if] identifier[self] . identifier[mavlink10] ():
identifier[self] . identifier[mav] . identifier[mission_request_send] ( identifier[self] . identifier[target_system] , identi... | def waypoint_request_send(self, seq):
"""wrapper for waypoint_request_send"""
if self.mavlink10():
self.mav.mission_request_send(self.target_system, self.target_component, seq) # depends on [control=['if'], data=[]]
else:
self.mav.waypoint_request_send(self.target_system, self.target_compon... |
def text_justification(words, max_width):
'''
:type words: list
:type max_width: int
:rtype: list
'''
ret = [] # return value
row_len = 0 # current length of strs in a row
row_words = [] # current words in a row
index = 0 # the index of current word in words
is_first_word = T... | def function[text_justification, parameter[words, max_width]]:
constant[
:type words: list
:type max_width: int
:rtype: list
]
variable[ret] assign[=] list[[]]
variable[row_len] assign[=] constant[0]
variable[row_words] assign[=] list[[]]
variable[index] assign[=]... | keyword[def] identifier[text_justification] ( identifier[words] , identifier[max_width] ):
literal[string]
identifier[ret] =[]
identifier[row_len] = literal[int]
identifier[row_words] =[]
identifier[index] = literal[int]
identifier[is_first_word] = keyword[True]
keyword[while] ... | def text_justification(words, max_width):
"""
:type words: list
:type max_width: int
:rtype: list
"""
ret = [] # return value
row_len = 0 # current length of strs in a row
row_words = [] # current words in a row
index = 0 # the index of current word in words
is_first_word = T... |
def collect_scalar_summands(cls, ops, kwargs):
"""Collect :class:`ValueScalar` and :class:`ScalarExpression` summands
Example:
>>> srepr(collect_scalar_summands(Scalar, (1, 2, 3), {}))
'ScalarValue(6)'
>>> collect_scalar_summands(Scalar, (1, 1, -1), {})
One
>>> collect_s... | def function[collect_scalar_summands, parameter[cls, ops, kwargs]]:
constant[Collect :class:`ValueScalar` and :class:`ScalarExpression` summands
Example:
>>> srepr(collect_scalar_summands(Scalar, (1, 2, 3), {}))
'ScalarValue(6)'
>>> collect_scalar_summands(Scalar, (1, 1, -1), {})
... | keyword[def] identifier[collect_scalar_summands] ( identifier[cls] , identifier[ops] , identifier[kwargs] ):
literal[string]
keyword[from] identifier[qnet] . identifier[algebra] . identifier[core] . identifier[scalar_algebra] keyword[import] (
identifier[Zero] , identifier[One] , iden... | def collect_scalar_summands(cls, ops, kwargs):
"""Collect :class:`ValueScalar` and :class:`ScalarExpression` summands
Example:
>>> srepr(collect_scalar_summands(Scalar, (1, 2, 3), {}))
'ScalarValue(6)'
>>> collect_scalar_summands(Scalar, (1, 1, -1), {})
One
>>> collect_s... |
def delete_load_balancer(access_token, subscription_id, resource_group, lb_name):
'''Delete a load balancer.
Args:
access_token (str): A valid Azure authentication token.
subscription_id (str): Azure subscription id.
resource_group (str): Azure resource group name.
lb_name (str)... | def function[delete_load_balancer, parameter[access_token, subscription_id, resource_group, lb_name]]:
constant[Delete a load balancer.
Args:
access_token (str): A valid Azure authentication token.
subscription_id (str): Azure subscription id.
resource_group (str): Azure resource gr... | keyword[def] identifier[delete_load_balancer] ( identifier[access_token] , identifier[subscription_id] , identifier[resource_group] , identifier[lb_name] ):
literal[string]
identifier[endpoint] = literal[string] . identifier[join] ([ identifier[get_rm_endpoint] (),
literal[string] , identifier[subscri... | def delete_load_balancer(access_token, subscription_id, resource_group, lb_name):
"""Delete a load balancer.
Args:
access_token (str): A valid Azure authentication token.
subscription_id (str): Azure subscription id.
resource_group (str): Azure resource group name.
lb_name (str)... |
def make_abstract_dist(req_to_install):
"""Factory to make an abstract dist object.
Preconditions: Either an editable req with a source_dir, or satisfied_by or
a wheel link, or a non-editable req with a source_dir.
:return: A concrete DistAbstraction.
"""
if req_to_install.editable:
re... | def function[make_abstract_dist, parameter[req_to_install]]:
constant[Factory to make an abstract dist object.
Preconditions: Either an editable req with a source_dir, or satisfied_by or
a wheel link, or a non-editable req with a source_dir.
:return: A concrete DistAbstraction.
]
if na... | keyword[def] identifier[make_abstract_dist] ( identifier[req_to_install] ):
literal[string]
keyword[if] identifier[req_to_install] . identifier[editable] :
keyword[return] identifier[IsSDist] ( identifier[req_to_install] )
keyword[elif] identifier[req_to_install] . identifier[link] keywor... | def make_abstract_dist(req_to_install):
"""Factory to make an abstract dist object.
Preconditions: Either an editable req with a source_dir, or satisfied_by or
a wheel link, or a non-editable req with a source_dir.
:return: A concrete DistAbstraction.
"""
if req_to_install.editable:
re... |
def _set_debug_level(self, debug_level):
"""
:type debug_level: int, between 0-2
:param debug_level: configure verbosity of log
"""
mapping = {
0: logging.ERROR,
1: logging.INFO,
2: logging.DEBUG,
}
self.setLevel(
mapping[min(debug_level, 2)],
) | def function[_set_debug_level, parameter[self, debug_level]]:
constant[
:type debug_level: int, between 0-2
:param debug_level: configure verbosity of log
]
variable[mapping] assign[=] dictionary[[<ast.Constant object at 0x7da20c6e63b0>, <ast.Constant object at 0x7da20c6e73a0>, <ast.Constant... | keyword[def] identifier[_set_debug_level] ( identifier[self] , identifier[debug_level] ):
literal[string]
identifier[mapping] ={
literal[int] : identifier[logging] . identifier[ERROR] ,
literal[int] : identifier[logging] . identifier[INFO] ,
literal[int] : identifier[logging] . identifier[DE... | def _set_debug_level(self, debug_level):
"""
:type debug_level: int, between 0-2
:param debug_level: configure verbosity of log
"""
mapping = {0: logging.ERROR, 1: logging.INFO, 2: logging.DEBUG}
self.setLevel(mapping[min(debug_level, 2)]) |
def virtualenv_exists(self, virtualenv_dir=None):
"""
Returns true if the virtual environment has been created.
"""
r = self.local_renderer
ret = True
with self.settings(warn_only=True):
ret = r.run_or_local('ls {virtualenv_dir}') or ''
ret = 'cann... | def function[virtualenv_exists, parameter[self, virtualenv_dir]]:
constant[
Returns true if the virtual environment has been created.
]
variable[r] assign[=] name[self].local_renderer
variable[ret] assign[=] constant[True]
with call[name[self].settings, parameter[]] begin... | keyword[def] identifier[virtualenv_exists] ( identifier[self] , identifier[virtualenv_dir] = keyword[None] ):
literal[string]
identifier[r] = identifier[self] . identifier[local_renderer]
identifier[ret] = keyword[True]
keyword[with] identifier[self] . identifier[settings] ( id... | def virtualenv_exists(self, virtualenv_dir=None):
"""
Returns true if the virtual environment has been created.
"""
r = self.local_renderer
ret = True
with self.settings(warn_only=True):
ret = r.run_or_local('ls {virtualenv_dir}') or ''
ret = 'cannot access' not in ret.st... |
def distinct(self, selector=identity):
'''Eliminate duplicate elements from a sequence.
Note: This method uses deferred execution.
Args:
selector: An optional single argument function the result of which
is the value compared for uniqueness against elements already
... | def function[distinct, parameter[self, selector]]:
constant[Eliminate duplicate elements from a sequence.
Note: This method uses deferred execution.
Args:
selector: An optional single argument function the result of which
is the value compared for uniqueness against... | keyword[def] identifier[distinct] ( identifier[self] , identifier[selector] = identifier[identity] ):
literal[string]
keyword[if] identifier[self] . identifier[closed] ():
keyword[raise] identifier[ValueError] ( literal[string]
literal[string] )
keyword[if] k... | def distinct(self, selector=identity):
"""Eliminate duplicate elements from a sequence.
Note: This method uses deferred execution.
Args:
selector: An optional single argument function the result of which
is the value compared for uniqueness against elements already
... |
def view_similarity_matrix(self, data=None, labels=None, figsize=None,
filename=None):
"""Plot the similarity map according to the activation map
:param data: Optional parameter for data points to calculate the
similarity with
:type data: nump... | def function[view_similarity_matrix, parameter[self, data, labels, figsize, filename]]:
constant[Plot the similarity map according to the activation map
:param data: Optional parameter for data points to calculate the
similarity with
:type data: numpy.array
:param f... | keyword[def] identifier[view_similarity_matrix] ( identifier[self] , identifier[data] = keyword[None] , identifier[labels] = keyword[None] , identifier[figsize] = keyword[None] ,
identifier[filename] = keyword[None] ):
literal[string]
keyword[if] keyword[not] identifier[have_heatmap] :
... | def view_similarity_matrix(self, data=None, labels=None, figsize=None, filename=None):
"""Plot the similarity map according to the activation map
:param data: Optional parameter for data points to calculate the
similarity with
:type data: numpy.array
:param figsize: Opt... |
def _golbub_welsch(orders, coeff1, coeff2):
"""Recurrence coefficients to abscisas and weights."""
abscisas, weights = [], []
for dim, order in enumerate(orders):
if order:
bands = numpy.zeros((2, order))
bands[0] = coeff1[dim, :order]
bands[1, :-1] = numpy.sqrt(... | def function[_golbub_welsch, parameter[orders, coeff1, coeff2]]:
constant[Recurrence coefficients to abscisas and weights.]
<ast.Tuple object at 0x7da204345960> assign[=] tuple[[<ast.List object at 0x7da204346980>, <ast.List object at 0x7da204346cb0>]]
for taget[tuple[[<ast.Name object at 0x7da2... | keyword[def] identifier[_golbub_welsch] ( identifier[orders] , identifier[coeff1] , identifier[coeff2] ):
literal[string]
identifier[abscisas] , identifier[weights] =[],[]
keyword[for] identifier[dim] , identifier[order] keyword[in] identifier[enumerate] ( identifier[orders] ):
keyword[if... | def _golbub_welsch(orders, coeff1, coeff2):
"""Recurrence coefficients to abscisas and weights."""
(abscisas, weights) = ([], [])
for (dim, order) in enumerate(orders):
if order:
bands = numpy.zeros((2, order))
bands[0] = coeff1[dim, :order]
bands[1, :-1] = numpy.... |
def calculate_logevidence(cls, filename, thin_start=None, thin_end=None,
thin_interval=None):
"""Calculates the log evidence from the given file using ``emcee_pt``'s
thermodynamic integration.
Parameters
----------
filename : str
Name of... | def function[calculate_logevidence, parameter[cls, filename, thin_start, thin_end, thin_interval]]:
constant[Calculates the log evidence from the given file using ``emcee_pt``'s
thermodynamic integration.
Parameters
----------
filename : str
Name of the file to read ... | keyword[def] identifier[calculate_logevidence] ( identifier[cls] , identifier[filename] , identifier[thin_start] = keyword[None] , identifier[thin_end] = keyword[None] ,
identifier[thin_interval] = keyword[None] ):
literal[string]
keyword[with] identifier[cls] . identifier[_io] ( identifier[filen... | def calculate_logevidence(cls, filename, thin_start=None, thin_end=None, thin_interval=None):
"""Calculates the log evidence from the given file using ``emcee_pt``'s
thermodynamic integration.
Parameters
----------
filename : str
Name of the file to read the samples from... |
def getHelpAsString(docstring=False, show_ver=True):
"""
Return useful help from a file in the script directory called
``__taskname__.help``
"""
install_dir = os.path.dirname(__file__)
taskname = util.base_taskname(__taskname__, __package__)
htmlfile = os.path.join(install_dir, 'htmlhelp', ... | def function[getHelpAsString, parameter[docstring, show_ver]]:
constant[
Return useful help from a file in the script directory called
``__taskname__.help``
]
variable[install_dir] assign[=] call[name[os].path.dirname, parameter[name[__file__]]]
variable[taskname] assign[=] call[nam... | keyword[def] identifier[getHelpAsString] ( identifier[docstring] = keyword[False] , identifier[show_ver] = keyword[True] ):
literal[string]
identifier[install_dir] = identifier[os] . identifier[path] . identifier[dirname] ( identifier[__file__] )
identifier[taskname] = identifier[util] . identifier[ba... | def getHelpAsString(docstring=False, show_ver=True):
"""
Return useful help from a file in the script directory called
``__taskname__.help``
"""
install_dir = os.path.dirname(__file__)
taskname = util.base_taskname(__taskname__, __package__)
htmlfile = os.path.join(install_dir, 'htmlhelp', ... |
def add_facts_stream(self, assessment, data_type, options, data):
"""
To add facts data stream to a Assessment
:param datastream: string
:param data_type: string
:param options: dict
:param data: Stream
"""
url = self.get_fact_url(assessment,options)
... | def function[add_facts_stream, parameter[self, assessment, data_type, options, data]]:
constant[
To add facts data stream to a Assessment
:param datastream: string
:param data_type: string
:param options: dict
:param data: Stream
]
variable[url] assign[=]... | keyword[def] identifier[add_facts_stream] ( identifier[self] , identifier[assessment] , identifier[data_type] , identifier[options] , identifier[data] ):
literal[string]
identifier[url] = identifier[self] . identifier[get_fact_url] ( identifier[assessment] , identifier[options] )
identif... | def add_facts_stream(self, assessment, data_type, options, data):
"""
To add facts data stream to a Assessment
:param datastream: string
:param data_type: string
:param options: dict
:param data: Stream
"""
url = self.get_fact_url(assessment, options)
form_da... |
def authenticate(self, username, password, priv_lvl=TAC_PLUS_PRIV_LVL_MIN,
authen_type=TAC_PLUS_AUTHEN_TYPE_ASCII,
chap_ppp_id=None, chap_challenge=None,
rem_addr=TAC_PLUS_VIRTUAL_REM_ADDR, port=TAC_PLUS_VIRTUAL_PORT):
"""
Authenticate to a ... | def function[authenticate, parameter[self, username, password, priv_lvl, authen_type, chap_ppp_id, chap_challenge, rem_addr, port]]:
constant[
Authenticate to a TACACS+ server with a username and password.
:param username:
:param password:
:param priv_lvl:
:param authen_... | keyword[def] identifier[authenticate] ( identifier[self] , identifier[username] , identifier[password] , identifier[priv_lvl] = identifier[TAC_PLUS_PRIV_LVL_MIN] ,
identifier[authen_type] = identifier[TAC_PLUS_AUTHEN_TYPE_ASCII] ,
identifier[chap_ppp_id] = keyword[None] , identifier[chap_challenge] = keyword[None] ... | def authenticate(self, username, password, priv_lvl=TAC_PLUS_PRIV_LVL_MIN, authen_type=TAC_PLUS_AUTHEN_TYPE_ASCII, chap_ppp_id=None, chap_challenge=None, rem_addr=TAC_PLUS_VIRTUAL_REM_ADDR, port=TAC_PLUS_VIRTUAL_PORT):
"""
Authenticate to a TACACS+ server with a username and password.
:param userna... |
def populateFromFile(self, dataUrl):
"""
Populates the instance variables of this ReferencSet from the
data URL.
"""
self._dataUrl = dataUrl
fastaFile = self.getFastaFile()
for referenceName in fastaFile.references:
reference = HtslibReference(self, re... | def function[populateFromFile, parameter[self, dataUrl]]:
constant[
Populates the instance variables of this ReferencSet from the
data URL.
]
name[self]._dataUrl assign[=] name[dataUrl]
variable[fastaFile] assign[=] call[name[self].getFastaFile, parameter[]]
for t... | keyword[def] identifier[populateFromFile] ( identifier[self] , identifier[dataUrl] ):
literal[string]
identifier[self] . identifier[_dataUrl] = identifier[dataUrl]
identifier[fastaFile] = identifier[self] . identifier[getFastaFile] ()
keyword[for] identifier[referenceName] keyw... | def populateFromFile(self, dataUrl):
"""
Populates the instance variables of this ReferencSet from the
data URL.
"""
self._dataUrl = dataUrl
fastaFile = self.getFastaFile()
for referenceName in fastaFile.references:
reference = HtslibReference(self, referenceName)
... |
def exec(self, command_str, **command_env):
""" Execute the given command (command will be split into tokens, every space that is a part of a token
must be quoted)
:param command_str: command to execute
:param command_env: command environment
:return: WCommandResultProto
"""
env = self.__vars.copy()
en... | def function[exec, parameter[self, command_str]]:
constant[ Execute the given command (command will be split into tokens, every space that is a part of a token
must be quoted)
:param command_str: command to execute
:param command_env: command environment
:return: WCommandResultProto
]
variabl... | keyword[def] identifier[exec] ( identifier[self] , identifier[command_str] ,** identifier[command_env] ):
literal[string]
identifier[env] = identifier[self] . identifier[__vars] . identifier[copy] ()
identifier[env] . identifier[update] ( identifier[command_env] )
identifier[command_tokens] = identifier... | def exec(self, command_str, **command_env):
""" Execute the given command (command will be split into tokens, every space that is a part of a token
must be quoted)
:param command_str: command to execute
:param command_env: command environment
:return: WCommandResultProto
"""
env = self.__vars.copy()
... |
def remove_file(filepath, dry_run=False):
"""Remove the file at filepath
Catches exception if the file does not exist.
If dry_run is True, print name of file to be removed, but do not remove it.
"""
if dry_run:
sys.stdout.write("rm %s\n" % filepath)
else:
try:
os.re... | def function[remove_file, parameter[filepath, dry_run]]:
constant[Remove the file at filepath
Catches exception if the file does not exist.
If dry_run is True, print name of file to be removed, but do not remove it.
]
if name[dry_run] begin[:]
call[name[sys].stdout.write, p... | keyword[def] identifier[remove_file] ( identifier[filepath] , identifier[dry_run] = keyword[False] ):
literal[string]
keyword[if] identifier[dry_run] :
identifier[sys] . identifier[stdout] . identifier[write] ( literal[string] % identifier[filepath] )
keyword[else] :
keyword[try] :
... | def remove_file(filepath, dry_run=False):
"""Remove the file at filepath
Catches exception if the file does not exist.
If dry_run is True, print name of file to be removed, but do not remove it.
"""
if dry_run:
sys.stdout.write('rm %s\n' % filepath) # depends on [control=['if'], data=[]]
... |
def median(values, simple=True, mean_weight=0.0):
"""
RETURN MEDIAN VALUE
IF simple=False THEN IN THE EVENT MULTIPLE INSTANCES OF THE
MEDIAN VALUE, THE MEDIAN IS INTERPOLATED BASED ON ITS POSITION
IN THE MEDIAN RANGE
mean_weight IS TO PICK A MEDIAN VALUE IN THE ODD CASE THAT IS
CLOSER TO T... | def function[median, parameter[values, simple, mean_weight]]:
constant[
RETURN MEDIAN VALUE
IF simple=False THEN IN THE EVENT MULTIPLE INSTANCES OF THE
MEDIAN VALUE, THE MEDIAN IS INTERPOLATED BASED ON ITS POSITION
IN THE MEDIAN RANGE
mean_weight IS TO PICK A MEDIAN VALUE IN THE ODD CASE T... | keyword[def] identifier[median] ( identifier[values] , identifier[simple] = keyword[True] , identifier[mean_weight] = literal[int] ):
literal[string]
keyword[if] identifier[OR] ( identifier[v] == keyword[None] keyword[for] identifier[v] keyword[in] identifier[values] ):
identifier[Log] . ide... | def median(values, simple=True, mean_weight=0.0):
"""
RETURN MEDIAN VALUE
IF simple=False THEN IN THE EVENT MULTIPLE INSTANCES OF THE
MEDIAN VALUE, THE MEDIAN IS INTERPOLATED BASED ON ITS POSITION
IN THE MEDIAN RANGE
mean_weight IS TO PICK A MEDIAN VALUE IN THE ODD CASE THAT IS
CLOSER TO T... |
def Loc(kind, loc=None):
"""A rule that accepts a token of kind ``kind`` and returns its location, or returns None."""
@llrule(loc, lambda parser: [kind])
def rule(parser):
result = parser._accept(kind)
if result is unmatched:
return result
return result.loc
return ru... | def function[Loc, parameter[kind, loc]]:
constant[A rule that accepts a token of kind ``kind`` and returns its location, or returns None.]
def function[rule, parameter[parser]]:
variable[result] assign[=] call[name[parser]._accept, parameter[name[kind]]]
if compare[name[r... | keyword[def] identifier[Loc] ( identifier[kind] , identifier[loc] = keyword[None] ):
literal[string]
@ identifier[llrule] ( identifier[loc] , keyword[lambda] identifier[parser] :[ identifier[kind] ])
keyword[def] identifier[rule] ( identifier[parser] ):
identifier[result] = identifier[parser... | def Loc(kind, loc=None):
"""A rule that accepts a token of kind ``kind`` and returns its location, or returns None."""
@llrule(loc, lambda parser: [kind])
def rule(parser):
result = parser._accept(kind)
if result is unmatched:
return result # depends on [control=['if'], data=['... |
def _delete(self, route, headers=None, failure_message=None):
"""
Execute a delete request and return the result
:param headers:
:return:
"""
headers = self._get_headers(headers)
response_lambda = (lambda: requests.delete(
self._get_qualified_route(rou... | def function[_delete, parameter[self, route, headers, failure_message]]:
constant[
Execute a delete request and return the result
:param headers:
:return:
]
variable[headers] assign[=] call[name[self]._get_headers, parameter[name[headers]]]
variable[response_lambd... | keyword[def] identifier[_delete] ( identifier[self] , identifier[route] , identifier[headers] = keyword[None] , identifier[failure_message] = keyword[None] ):
literal[string]
identifier[headers] = identifier[self] . identifier[_get_headers] ( identifier[headers] )
identifier[response_lambd... | def _delete(self, route, headers=None, failure_message=None):
"""
Execute a delete request and return the result
:param headers:
:return:
"""
headers = self._get_headers(headers)
response_lambda = lambda : requests.delete(self._get_qualified_route(route), headers=headers, ver... |
def find(self, resource_id, query=None):
"""
Finds a single resource by ID related to the current space.
"""
return self.proxy.find(resource_id, query=query) | def function[find, parameter[self, resource_id, query]]:
constant[
Finds a single resource by ID related to the current space.
]
return[call[name[self].proxy.find, parameter[name[resource_id]]]] | keyword[def] identifier[find] ( identifier[self] , identifier[resource_id] , identifier[query] = keyword[None] ):
literal[string]
keyword[return] identifier[self] . identifier[proxy] . identifier[find] ( identifier[resource_id] , identifier[query] = identifier[query] ) | def find(self, resource_id, query=None):
"""
Finds a single resource by ID related to the current space.
"""
return self.proxy.find(resource_id, query=query) |
def get_client_from_json_dict(client_class, config_dict, **kwargs):
"""Return a SDK client initialized with a JSON auth dict.
The easiest way to obtain this content is to call the following CLI commands:
.. code:: bash
az ad sp create-for-rbac --sdk-auth
This method will fill automatically t... | def function[get_client_from_json_dict, parameter[client_class, config_dict]]:
constant[Return a SDK client initialized with a JSON auth dict.
The easiest way to obtain this content is to call the following CLI commands:
.. code:: bash
az ad sp create-for-rbac --sdk-auth
This method will... | keyword[def] identifier[get_client_from_json_dict] ( identifier[client_class] , identifier[config_dict] ,** identifier[kwargs] ):
literal[string]
identifier[is_graphrbac] = identifier[client_class] . identifier[__name__] == literal[string]
identifier[parameters] ={
literal[string] : identifier[c... | def get_client_from_json_dict(client_class, config_dict, **kwargs):
"""Return a SDK client initialized with a JSON auth dict.
The easiest way to obtain this content is to call the following CLI commands:
.. code:: bash
az ad sp create-for-rbac --sdk-auth
This method will fill automatically t... |
def load_resource_module(self):
"""Fetch the resource list"""
# Attempt to load the dependencies module
try:
name = '{}.{}'.format(self.name, 'dependencies')
self.dependencies_module = importlib.import_module(name)
except ModuleNotFoundError as err:
ra... | def function[load_resource_module, parameter[self]]:
constant[Fetch the resource list]
<ast.Try object at 0x7da1b23471f0>
<ast.Try object at 0x7da1b23461d0>
if <ast.UnaryOp object at 0x7da1b2347220> begin[:]
<ast.Raise object at 0x7da1b2347820>
<ast.Try object at 0x7da18dc99960>
... | keyword[def] identifier[load_resource_module] ( identifier[self] ):
literal[string]
keyword[try] :
identifier[name] = literal[string] . identifier[format] ( identifier[self] . identifier[name] , literal[string] )
identifier[self] . identifier[dependencies_module] ... | def load_resource_module(self):
"""Fetch the resource list"""
# Attempt to load the dependencies module
try:
name = '{}.{}'.format(self.name, 'dependencies')
self.dependencies_module = importlib.import_module(name) # depends on [control=['try'], data=[]]
except ModuleNotFoundError as er... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.