code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def get_propagate_status(self, token, channel):
"""
Get the propagate status for a token/channel pair.
Arguments:
token (str): The token to check
channel (str): The channel to check
Returns:
str: The status code
"""
url = self.url('sd... | def function[get_propagate_status, parameter[self, token, channel]]:
constant[
Get the propagate status for a token/channel pair.
Arguments:
token (str): The token to check
channel (str): The channel to check
Returns:
str: The status code
]
... | keyword[def] identifier[get_propagate_status] ( identifier[self] , identifier[token] , identifier[channel] ):
literal[string]
identifier[url] = identifier[self] . identifier[url] ( literal[string] . identifier[format] ( identifier[token] , identifier[channel] ))
identifier[req] = identifie... | def get_propagate_status(self, token, channel):
"""
Get the propagate status for a token/channel pair.
Arguments:
token (str): The token to check
channel (str): The channel to check
Returns:
str: The status code
"""
url = self.url('sd/{}/{}/g... |
def createCitation(self, multiCite = False):
"""Creates a citation string, using the same format as other WOS citations, for the [Record](./Record.html#metaknowledge.Record) by reading the relevant special tags (`'year'`, `'J9'`, `'volume'`, `'beginningPage'`, `'DOI'`) and using it to create a [Citation](./Cita... | def function[createCitation, parameter[self, multiCite]]:
constant[Creates a citation string, using the same format as other WOS citations, for the [Record](./Record.html#metaknowledge.Record) by reading the relevant special tags (`'year'`, `'J9'`, `'volume'`, `'beginningPage'`, `'DOI'`) and using it to create ... | keyword[def] identifier[createCitation] ( identifier[self] , identifier[multiCite] = keyword[False] ):
literal[string]
keyword[from] . identifier[citation] keyword[import] identifier[Citation]
identifier[valsLst] =[]
keyword[if] identifier[multiCite] :
id... | def createCitation(self, multiCite=False):
"""Creates a citation string, using the same format as other WOS citations, for the [Record](./Record.html#metaknowledge.Record) by reading the relevant special tags (`'year'`, `'J9'`, `'volume'`, `'beginningPage'`, `'DOI'`) and using it to create a [Citation](./Citation.h... |
def process_dynesty_run(results):
"""Transforms results from a dynesty run into the nestcheck dictionary
format for analysis. This function has been tested with dynesty v9.2.0.
Note that the nestcheck point weights and evidence will not be exactly
the same as the dynesty ones as nestcheck calculates lo... | def function[process_dynesty_run, parameter[results]]:
constant[Transforms results from a dynesty run into the nestcheck dictionary
format for analysis. This function has been tested with dynesty v9.2.0.
Note that the nestcheck point weights and evidence will not be exactly
the same as the dynesty ... | keyword[def] identifier[process_dynesty_run] ( identifier[results] ):
literal[string]
identifier[samples] = identifier[np] . identifier[zeros] (( identifier[results] . identifier[samples] . identifier[shape] [ literal[int] ],
identifier[results] . identifier[samples] . identifier[shape] [ literal[int]... | def process_dynesty_run(results):
"""Transforms results from a dynesty run into the nestcheck dictionary
format for analysis. This function has been tested with dynesty v9.2.0.
Note that the nestcheck point weights and evidence will not be exactly
the same as the dynesty ones as nestcheck calculates lo... |
def find(self, tagtype, **kwargs):
'''Get the first tag with a type in this token '''
for t in self.__tags:
if t.tagtype == tagtype:
return t
if 'default' in kwargs:
return kwargs['default']
else:
raise LookupError("Token {} is not tagg... | def function[find, parameter[self, tagtype]]:
constant[Get the first tag with a type in this token ]
for taget[name[t]] in starred[name[self].__tags] begin[:]
if compare[name[t].tagtype equal[==] name[tagtype]] begin[:]
return[name[t]]
if compare[constant[default] in ... | keyword[def] identifier[find] ( identifier[self] , identifier[tagtype] ,** identifier[kwargs] ):
literal[string]
keyword[for] identifier[t] keyword[in] identifier[self] . identifier[__tags] :
keyword[if] identifier[t] . identifier[tagtype] == identifier[tagtype] :
... | def find(self, tagtype, **kwargs):
"""Get the first tag with a type in this token """
for t in self.__tags:
if t.tagtype == tagtype:
return t # depends on [control=['if'], data=[]] # depends on [control=['for'], data=['t']]
if 'default' in kwargs:
return kwargs['default'] # de... |
def get_charge(max_tdc, tdc_calibration_values, tdc_pixel_calibration): # Return the charge from calibration
''' Interpolatet the TDC calibration for each pixel from 0 to max_tdc'''
charge_calibration = np.zeros(shape=(80, 336, max_tdc))
for column in range(80):
for row in range(336):
a... | def function[get_charge, parameter[max_tdc, tdc_calibration_values, tdc_pixel_calibration]]:
constant[ Interpolatet the TDC calibration for each pixel from 0 to max_tdc]
variable[charge_calibration] assign[=] call[name[np].zeros, parameter[]]
for taget[name[column]] in starred[call[name[range], ... | keyword[def] identifier[get_charge] ( identifier[max_tdc] , identifier[tdc_calibration_values] , identifier[tdc_pixel_calibration] ):
literal[string]
identifier[charge_calibration] = identifier[np] . identifier[zeros] ( identifier[shape] =( literal[int] , literal[int] , identifier[max_tdc] ))
keyword[... | def get_charge(max_tdc, tdc_calibration_values, tdc_pixel_calibration): # Return the charge from calibration
' Interpolatet the TDC calibration for each pixel from 0 to max_tdc'
charge_calibration = np.zeros(shape=(80, 336, max_tdc))
for column in range(80):
for row in range(336):
actua... |
def from_string(self, value):
"""Convert string to list."""
# Remove optional []
if value.startswith('[') and value.endswith(']'):
text = value[1:-1].strip()
else:
text = value.strip()
# Result is a list
result = []
# If value starts with '... | def function[from_string, parameter[self, value]]:
constant[Convert string to list.]
if <ast.BoolOp object at 0x7da1b14509a0> begin[:]
variable[text] assign[=] call[call[name[value]][<ast.Slice object at 0x7da1b1451330>].strip, parameter[]]
variable[result] assign[=] list[[]]
... | keyword[def] identifier[from_string] ( identifier[self] , identifier[value] ):
literal[string]
keyword[if] identifier[value] . identifier[startswith] ( literal[string] ) keyword[and] identifier[value] . identifier[endswith] ( literal[string] ):
identifier[text] = identifier[... | def from_string(self, value):
"""Convert string to list."""
# Remove optional []
if value.startswith('[') and value.endswith(']'):
text = value[1:-1].strip() # depends on [control=['if'], data=[]]
else:
text = value.strip()
# Result is a list
result = []
# If value starts wi... |
def synteny_scan(points, xdist, ydist, N):
"""
This is the core single linkage algorithm which behaves in O(n):
iterate through the pairs, foreach pair we look back on the
adjacent pairs to find links
"""
clusters = Grouper()
n = len(points)
points.sort()
for i in range(n):
f... | def function[synteny_scan, parameter[points, xdist, ydist, N]]:
constant[
This is the core single linkage algorithm which behaves in O(n):
iterate through the pairs, foreach pair we look back on the
adjacent pairs to find links
]
variable[clusters] assign[=] call[name[Grouper], parameter... | keyword[def] identifier[synteny_scan] ( identifier[points] , identifier[xdist] , identifier[ydist] , identifier[N] ):
literal[string]
identifier[clusters] = identifier[Grouper] ()
identifier[n] = identifier[len] ( identifier[points] )
identifier[points] . identifier[sort] ()
keyword[for] id... | def synteny_scan(points, xdist, ydist, N):
"""
This is the core single linkage algorithm which behaves in O(n):
iterate through the pairs, foreach pair we look back on the
adjacent pairs to find links
"""
clusters = Grouper()
n = len(points)
points.sort()
for i in range(n):
f... |
def _load_at(self, time, channels=None):
"""Load a waveform at a given time."""
if channels is None:
channels = slice(None, None, None)
time = int(time)
time_o = time
ns = self.n_samples_trace
if not (0 <= time_o < ns):
raise ValueError("Invalid ti... | def function[_load_at, parameter[self, time, channels]]:
constant[Load a waveform at a given time.]
if compare[name[channels] is constant[None]] begin[:]
variable[channels] assign[=] call[name[slice], parameter[constant[None], constant[None], constant[None]]]
variable[time] assig... | keyword[def] identifier[_load_at] ( identifier[self] , identifier[time] , identifier[channels] = keyword[None] ):
literal[string]
keyword[if] identifier[channels] keyword[is] keyword[None] :
identifier[channels] = identifier[slice] ( keyword[None] , keyword[None] , keyword[None] )
... | def _load_at(self, time, channels=None):
"""Load a waveform at a given time."""
if channels is None:
channels = slice(None, None, None) # depends on [control=['if'], data=['channels']]
time = int(time)
time_o = time
ns = self.n_samples_trace
if not 0 <= time_o < ns:
raise ValueE... |
def every(secs):
'''
Generator that yields for every *secs* seconds.
Example:
>>> for _ in every(0.1):
... print('Hello')
You get ``Hello`` output every 0.1 seconds.
'''
time_stated = time.monotonic()
while True:
time_yielded = time.monotonic()
yield ti... | def function[every, parameter[secs]]:
constant[
Generator that yields for every *secs* seconds.
Example:
>>> for _ in every(0.1):
... print('Hello')
You get ``Hello`` output every 0.1 seconds.
]
variable[time_stated] assign[=] call[name[time].monotonic, parameter[]... | keyword[def] identifier[every] ( identifier[secs] ):
literal[string]
identifier[time_stated] = identifier[time] . identifier[monotonic] ()
keyword[while] keyword[True] :
identifier[time_yielded] = identifier[time] . identifier[monotonic] ()
keyword[yield] identifier[time_yielded] -... | def every(secs):
"""
Generator that yields for every *secs* seconds.
Example:
>>> for _ in every(0.1):
... print('Hello')
You get ``Hello`` output every 0.1 seconds.
"""
time_stated = time.monotonic()
while True:
time_yielded = time.monotonic()
yield (t... |
def raise_with_traceback(exc, traceback=Ellipsis):
"""
Raise exception with existing traceback.
If traceback is not passed, uses sys.exc_info() to get traceback.
"""
if traceback == Ellipsis:
_, _, traceback = sys.exc_info()
raise exc.with_traceback(traceback) | def function[raise_with_traceback, parameter[exc, traceback]]:
constant[
Raise exception with existing traceback.
If traceback is not passed, uses sys.exc_info() to get traceback.
]
if compare[name[traceback] equal[==] name[Ellipsis]] begin[:]
<ast.Tuple object at 0x7da20e9b1... | keyword[def] identifier[raise_with_traceback] ( identifier[exc] , identifier[traceback] = identifier[Ellipsis] ):
literal[string]
keyword[if] identifier[traceback] == identifier[Ellipsis] :
identifier[_] , identifier[_] , identifier[traceback] = identifier[sys] . identifier[exc_info] ()
keyw... | def raise_with_traceback(exc, traceback=Ellipsis):
"""
Raise exception with existing traceback.
If traceback is not passed, uses sys.exc_info() to get traceback.
"""
if traceback == Ellipsis:
(_, _, traceback) = sys.exc_info() # depends on [control=['if'], data=['traceback']]
raise exc.... |
def play_Tracks(self, tracks, channels, bpm=120):
"""Play a list of Tracks.
If an instance of MidiInstrument is used then the instrument will be
set automatically.
"""
self.notify_listeners(self.MSG_PLAY_TRACKS, {'tracks': tracks,
'channels': channels, 'bpm': bpm})
... | def function[play_Tracks, parameter[self, tracks, channels, bpm]]:
constant[Play a list of Tracks.
If an instance of MidiInstrument is used then the instrument will be
set automatically.
]
call[name[self].notify_listeners, parameter[name[self].MSG_PLAY_TRACKS, dictionary[[<ast.C... | keyword[def] identifier[play_Tracks] ( identifier[self] , identifier[tracks] , identifier[channels] , identifier[bpm] = literal[int] ):
literal[string]
identifier[self] . identifier[notify_listeners] ( identifier[self] . identifier[MSG_PLAY_TRACKS] ,{ literal[string] : identifier[tracks] ,
... | def play_Tracks(self, tracks, channels, bpm=120):
"""Play a list of Tracks.
If an instance of MidiInstrument is used then the instrument will be
set automatically.
"""
self.notify_listeners(self.MSG_PLAY_TRACKS, {'tracks': tracks, 'channels': channels, 'bpm': bpm})
# Set the right i... |
def list_inputs(self):
"""Return a string listing all the Step's input names and their types.
The types are returned in a copy/pastable format, so if the type is
`string`, `'string'` (with single quotes) is returned.
Returns:
str containing all input names and types.
... | def function[list_inputs, parameter[self]]:
constant[Return a string listing all the Step's input names and their types.
The types are returned in a copy/pastable format, so if the type is
`string`, `'string'` (with single quotes) is returned.
Returns:
str containing all in... | keyword[def] identifier[list_inputs] ( identifier[self] ):
literal[string]
identifier[doc] =[]
keyword[for] identifier[inp] , identifier[typ] keyword[in] identifier[self] . identifier[input_types] . identifier[items] ():
keyword[if] identifier[isinstance] ( identifier[typ]... | def list_inputs(self):
"""Return a string listing all the Step's input names and their types.
The types are returned in a copy/pastable format, so if the type is
`string`, `'string'` (with single quotes) is returned.
Returns:
str containing all input names and types.
""... |
def update(self, typ, id, **kwargs):
"""
update just fields sent by keyword args
"""
return self._load(self._request(typ, id=id, method='PUT', data=kwargs)) | def function[update, parameter[self, typ, id]]:
constant[
update just fields sent by keyword args
]
return[call[name[self]._load, parameter[call[name[self]._request, parameter[name[typ]]]]]] | keyword[def] identifier[update] ( identifier[self] , identifier[typ] , identifier[id] ,** identifier[kwargs] ):
literal[string]
keyword[return] identifier[self] . identifier[_load] ( identifier[self] . identifier[_request] ( identifier[typ] , identifier[id] = identifier[id] , identifier[method] = ... | def update(self, typ, id, **kwargs):
"""
update just fields sent by keyword args
"""
return self._load(self._request(typ, id=id, method='PUT', data=kwargs)) |
def dom_lt(graph):
"""Dominator algorithm from Lengauer-Tarjan"""
def _dfs(v, n):
semi[v] = n = n + 1
vertex[n] = label[v] = v
ancestor[v] = 0
for w in graph.all_sucs(v):
if not semi[w]:
parent[w] = v
n = _dfs(w, n)
pred[w]... | def function[dom_lt, parameter[graph]]:
constant[Dominator algorithm from Lengauer-Tarjan]
def function[_dfs, parameter[v, n]]:
call[name[semi]][name[v]] assign[=] binary_operation[name[n] + constant[1]]
call[name[vertex]][name[n]] assign[=] name[v]
call[n... | keyword[def] identifier[dom_lt] ( identifier[graph] ):
literal[string]
keyword[def] identifier[_dfs] ( identifier[v] , identifier[n] ):
identifier[semi] [ identifier[v] ]= identifier[n] = identifier[n] + literal[int]
identifier[vertex] [ identifier[n] ]= identifier[label] [ identifier[... | def dom_lt(graph):
"""Dominator algorithm from Lengauer-Tarjan"""
def _dfs(v, n):
semi[v] = n = n + 1
vertex[n] = label[v] = v
ancestor[v] = 0
for w in graph.all_sucs(v):
if not semi[w]:
parent[w] = v
n = _dfs(w, n) # depends on [cont... |
def _int2farray(ftype, num, length=None):
"""Convert a signed integer to an farray."""
if num < 0:
req_length = clog2(abs(num)) + 1
objs = _uint2objs(ftype, 2**req_length + num)
else:
req_length = clog2(num + 1) + 1
objs = _uint2objs(ftype, num, req_length)
if length:
... | def function[_int2farray, parameter[ftype, num, length]]:
constant[Convert a signed integer to an farray.]
if compare[name[num] less[<] constant[0]] begin[:]
variable[req_length] assign[=] binary_operation[call[name[clog2], parameter[call[name[abs], parameter[name[num]]]]] + constant[1]]... | keyword[def] identifier[_int2farray] ( identifier[ftype] , identifier[num] , identifier[length] = keyword[None] ):
literal[string]
keyword[if] identifier[num] < literal[int] :
identifier[req_length] = identifier[clog2] ( identifier[abs] ( identifier[num] ))+ literal[int]
identifier[objs... | def _int2farray(ftype, num, length=None):
"""Convert a signed integer to an farray."""
if num < 0:
req_length = clog2(abs(num)) + 1
objs = _uint2objs(ftype, 2 ** req_length + num) # depends on [control=['if'], data=['num']]
else:
req_length = clog2(num + 1) + 1
objs = _uint2... |
def get_user(uwnetid, include_course_summary=True):
"""
Return a list of BridgeUsers objects with custom fields
"""
url = author_uid_url(uwnetid) + "?%s" % CUSTOM_FIELD
if include_course_summary:
url = "%s&%s" % (url, COURSE_SUMMARY)
resp = get_resource(url)
return _process_json_resp... | def function[get_user, parameter[uwnetid, include_course_summary]]:
constant[
Return a list of BridgeUsers objects with custom fields
]
variable[url] assign[=] binary_operation[call[name[author_uid_url], parameter[name[uwnetid]]] + binary_operation[constant[?%s] <ast.Mod object at 0x7da2590d6920... | keyword[def] identifier[get_user] ( identifier[uwnetid] , identifier[include_course_summary] = keyword[True] ):
literal[string]
identifier[url] = identifier[author_uid_url] ( identifier[uwnetid] )+ literal[string] % identifier[CUSTOM_FIELD]
keyword[if] identifier[include_course_summary] :
i... | def get_user(uwnetid, include_course_summary=True):
"""
Return a list of BridgeUsers objects with custom fields
"""
url = author_uid_url(uwnetid) + '?%s' % CUSTOM_FIELD
if include_course_summary:
url = '%s&%s' % (url, COURSE_SUMMARY) # depends on [control=['if'], data=[]]
resp = get_res... |
def write_all_series_channel_values(self, read_f, write_f, channel,
values):
'''
Return all values for the specified channel of the type corresponding
to the function `f`, where `f` is either `self.series_resistance` or
`self.series_capacitance`.
... | def function[write_all_series_channel_values, parameter[self, read_f, write_f, channel, values]]:
constant[
Return all values for the specified channel of the type corresponding
to the function `f`, where `f` is either `self.series_resistance` or
`self.series_capacitance`.
]
... | keyword[def] identifier[write_all_series_channel_values] ( identifier[self] , identifier[read_f] , identifier[write_f] , identifier[channel] ,
identifier[values] ):
literal[string]
identifier[values] = identifier[copy] . identifier[deepcopy] (... | def write_all_series_channel_values(self, read_f, write_f, channel, values):
"""
Return all values for the specified channel of the type corresponding
to the function `f`, where `f` is either `self.series_resistance` or
`self.series_capacitance`.
"""
# Create a copy of the new va... |
def update(cls, resource, name, size, snapshot_profile,
background, cmdline=None, kernel=None):
""" Update this disk. """
if isinstance(size, tuple):
prefix, size = size
if prefix == '+':
disk_info = cls.info(resource)
current_size =... | def function[update, parameter[cls, resource, name, size, snapshot_profile, background, cmdline, kernel]]:
constant[ Update this disk. ]
if call[name[isinstance], parameter[name[size], name[tuple]]] begin[:]
<ast.Tuple object at 0x7da18dc07fa0> assign[=] name[size]
if com... | keyword[def] identifier[update] ( identifier[cls] , identifier[resource] , identifier[name] , identifier[size] , identifier[snapshot_profile] ,
identifier[background] , identifier[cmdline] = keyword[None] , identifier[kernel] = keyword[None] ):
literal[string]
keyword[if] identifier[isinstance] (... | def update(cls, resource, name, size, snapshot_profile, background, cmdline=None, kernel=None):
""" Update this disk. """
if isinstance(size, tuple):
(prefix, size) = size
if prefix == '+':
disk_info = cls.info(resource)
current_size = disk_info['size']
size =... |
def contextMenuEvent(self, event):
""" Shows the context menu at the cursor position
We need to take the event-based approach because ArgosPgPlotItem does derives from
QGraphicsWidget, and not from QWidget, and therefore doesn't have the
customContextMenuRequested signal.
... | def function[contextMenuEvent, parameter[self, event]]:
constant[ Shows the context menu at the cursor position
We need to take the event-based approach because ArgosPgPlotItem does derives from
QGraphicsWidget, and not from QWidget, and therefore doesn't have the
customCont... | keyword[def] identifier[contextMenuEvent] ( identifier[self] , identifier[event] ):
literal[string]
identifier[contextMenu] = identifier[QtWidgets] . identifier[QMenu] ()
keyword[for] identifier[action] keyword[in] identifier[self] . identifier[actions] ():
identifier[conte... | def contextMenuEvent(self, event):
""" Shows the context menu at the cursor position
We need to take the event-based approach because ArgosPgPlotItem does derives from
QGraphicsWidget, and not from QWidget, and therefore doesn't have the
customContextMenuRequested signal.
... |
def execute_locally(self):
"""Runs the equivalent command locally in a blocking way."""
# Make script file #
self.make_script()
# Do it #
with open(self.kwargs['out_file'], 'w') as handle:
sh.python(self.script_path, _out=handle, _err=handle) | def function[execute_locally, parameter[self]]:
constant[Runs the equivalent command locally in a blocking way.]
call[name[self].make_script, parameter[]]
with call[name[open], parameter[call[name[self].kwargs][constant[out_file]], constant[w]]] begin[:]
call[name[sh].python, par... | keyword[def] identifier[execute_locally] ( identifier[self] ):
literal[string]
identifier[self] . identifier[make_script] ()
keyword[with] identifier[open] ( identifier[self] . identifier[kwargs] [ literal[string] ], literal[string] ) keyword[as] identifier[handle] :
... | def execute_locally(self):
"""Runs the equivalent command locally in a blocking way."""
# Make script file #
self.make_script()
# Do it #
with open(self.kwargs['out_file'], 'w') as handle:
sh.python(self.script_path, _out=handle, _err=handle) # depends on [control=['with'], data=['handle']] |
def hasTablePermission(self, login, user, table, perm):
"""
Parameters:
- login
- user
- table
- perm
"""
self.send_hasTablePermission(login, user, table, perm)
return self.recv_hasTablePermission() | def function[hasTablePermission, parameter[self, login, user, table, perm]]:
constant[
Parameters:
- login
- user
- table
- perm
]
call[name[self].send_hasTablePermission, parameter[name[login], name[user], name[table], name[perm]]]
return[call[name[self].recv_hasTablePer... | keyword[def] identifier[hasTablePermission] ( identifier[self] , identifier[login] , identifier[user] , identifier[table] , identifier[perm] ):
literal[string]
identifier[self] . identifier[send_hasTablePermission] ( identifier[login] , identifier[user] , identifier[table] , identifier[perm] )
keyword... | def hasTablePermission(self, login, user, table, perm):
"""
Parameters:
- login
- user
- table
- perm
"""
self.send_hasTablePermission(login, user, table, perm)
return self.recv_hasTablePermission() |
def hoverLeaveEvent(self, event):
"""
Processes when this hotspot is entered.
:param event | <QHoverEvent>
:return <bool> | processed
"""
self._hovered = False
if self.toolTip():
QToolTip.hideText()
... | def function[hoverLeaveEvent, parameter[self, event]]:
constant[
Processes when this hotspot is entered.
:param event | <QHoverEvent>
:return <bool> | processed
]
name[self]._hovered assign[=] constant[False]
if call[name[self].toolTip, ... | keyword[def] identifier[hoverLeaveEvent] ( identifier[self] , identifier[event] ):
literal[string]
identifier[self] . identifier[_hovered] = keyword[False]
keyword[if] identifier[self] . identifier[toolTip] ():
identifier[QToolTip] . identifier[hideText] ()
k... | def hoverLeaveEvent(self, event):
"""
Processes when this hotspot is entered.
:param event | <QHoverEvent>
:return <bool> | processed
"""
self._hovered = False
if self.toolTip():
QToolTip.hideText() # depends on [control=['if'], data=[]]
... |
def tags( self ):
"""
Returns a list of all the tags assigned to this widget.
:return [<str>, ..]
"""
item = self.item(self.count() - 1)
count = self.count()
if ( item is self._createItem ):
count -= 1
return [... | def function[tags, parameter[self]]:
constant[
Returns a list of all the tags assigned to this widget.
:return [<str>, ..]
]
variable[item] assign[=] call[name[self].item, parameter[binary_operation[call[name[self].count, parameter[]] - constant[1]]]]
variabl... | keyword[def] identifier[tags] ( identifier[self] ):
literal[string]
identifier[item] = identifier[self] . identifier[item] ( identifier[self] . identifier[count] ()- literal[int] )
identifier[count] = identifier[self] . identifier[count] ()
keyword[if] ( identifier[item] keyw... | def tags(self):
"""
Returns a list of all the tags assigned to this widget.
:return [<str>, ..]
"""
item = self.item(self.count() - 1)
count = self.count()
if item is self._createItem:
count -= 1 # depends on [control=['if'], data=[]]
return [nativestrin... |
def _get_attrib(self, attr, convert_to_str=False):
"""
Given an attribute name, looks it up on the entry. Names that
start with ``tags.`` are looked up in the ``tags`` dictionary.
:param attr: Name of attribute to look up.
:type attr: ``str``
:param convert_to_str: Conve... | def function[_get_attrib, parameter[self, attr, convert_to_str]]:
constant[
Given an attribute name, looks it up on the entry. Names that
start with ``tags.`` are looked up in the ``tags`` dictionary.
:param attr: Name of attribute to look up.
:type attr: ``str``
:param ... | keyword[def] identifier[_get_attrib] ( identifier[self] , identifier[attr] , identifier[convert_to_str] = keyword[False] ):
literal[string]
keyword[if] identifier[attr] . identifier[startswith] ( literal[string] ):
identifier[tag] = identifier[attr] [ identifier[len] ( literal[string]... | def _get_attrib(self, attr, convert_to_str=False):
"""
Given an attribute name, looks it up on the entry. Names that
start with ``tags.`` are looked up in the ``tags`` dictionary.
:param attr: Name of attribute to look up.
:type attr: ``str``
:param convert_to_str: Convert r... |
def wrap(x):
"""
Wraps an element or integer type by serializing it and base64 encoding
the resulting bytes.
"""
# Detect the type so we can call the proper serialization routine
if isinstance(x, G1Element):
return _wrap(x, serializeG1)
elif isinstance(x, G2Element):
return... | def function[wrap, parameter[x]]:
constant[
Wraps an element or integer type by serializing it and base64 encoding
the resulting bytes.
]
if call[name[isinstance], parameter[name[x], name[G1Element]]] begin[:]
return[call[name[_wrap], parameter[name[x], name[serializeG1]]]] | keyword[def] identifier[wrap] ( identifier[x] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[x] , identifier[G1Element] ):
keyword[return] identifier[_wrap] ( identifier[x] , identifier[serializeG1] )
keyword[elif] identifier[isinstance] ( identifier[x] , identifi... | def wrap(x):
"""
Wraps an element or integer type by serializing it and base64 encoding
the resulting bytes.
"""
# Detect the type so we can call the proper serialization routine
if isinstance(x, G1Element):
return _wrap(x, serializeG1) # depends on [control=['if'], data=[]]
elif i... |
def cli(ctx, lsftdi, lsusb, lsserial, info):
"""System tools.\n
Install with `apio install system`"""
exit_code = 0
if lsftdi:
exit_code = System().lsftdi()
elif lsusb:
exit_code = System().lsusb()
elif lsserial:
exit_code = System().lsserial()
elif info:
... | def function[cli, parameter[ctx, lsftdi, lsusb, lsserial, info]]:
constant[System tools.
Install with `apio install system`]
variable[exit_code] assign[=] constant[0]
if name[lsftdi] begin[:]
variable[exit_code] assign[=] call[call[name[System], parameter[]].lsftdi, param... | keyword[def] identifier[cli] ( identifier[ctx] , identifier[lsftdi] , identifier[lsusb] , identifier[lsserial] , identifier[info] ):
literal[string]
identifier[exit_code] = literal[int]
keyword[if] identifier[lsftdi] :
identifier[exit_code] = identifier[System] (). identifier[lsftdi] ()
... | def cli(ctx, lsftdi, lsusb, lsserial, info):
"""System tools.
Install with `apio install system`"""
exit_code = 0
if lsftdi:
exit_code = System().lsftdi() # depends on [control=['if'], data=[]]
elif lsusb:
exit_code = System().lsusb() # depends on [control=['if'], data=[]]
... |
def table_convert_geometry(metadata, table_name):
"""Get table metadata from the database."""
from sqlalchemy import Table
from ..orm import Geometry
table = Table(table_name, metadata, autoload=True)
for c in table.columns:
# HACK! Sqlalchemy sees spatialte GEOMETRY types
# as NU... | def function[table_convert_geometry, parameter[metadata, table_name]]:
constant[Get table metadata from the database.]
from relative_module[sqlalchemy] import module[Table]
from relative_module[orm] import module[Geometry]
variable[table] assign[=] call[name[Table], parameter[name[table_name], n... | keyword[def] identifier[table_convert_geometry] ( identifier[metadata] , identifier[table_name] ):
literal[string]
keyword[from] identifier[sqlalchemy] keyword[import] identifier[Table]
keyword[from] .. identifier[orm] keyword[import] identifier[Geometry]
identifier[table] = identifier[Ta... | def table_convert_geometry(metadata, table_name):
"""Get table metadata from the database."""
from sqlalchemy import Table
from ..orm import Geometry
table = Table(table_name, metadata, autoload=True)
for c in table.columns:
# HACK! Sqlalchemy sees spatialte GEOMETRY types
# as NUMER... |
def p_simple_list1(p):
'''simple_list1 : simple_list1 AND_AND newline_list simple_list1
| simple_list1 OR_OR newline_list simple_list1
| simple_list1 AMPERSAND simple_list1
| simple_list1 SEMICOLON simple_list1
| pipeline_command'''
... | def function[p_simple_list1, parameter[p]]:
constant[simple_list1 : simple_list1 AND_AND newline_list simple_list1
| simple_list1 OR_OR newline_list simple_list1
| simple_list1 AMPERSAND simple_list1
| simple_list1 SEMICOLON simple_list1
... | keyword[def] identifier[p_simple_list1] ( identifier[p] ):
literal[string]
keyword[if] identifier[len] ( identifier[p] )== literal[int] :
identifier[p] [ literal[int] ]=[ identifier[p] [ literal[int] ]]
keyword[else] :
identifier[p] [ literal[int] ]= identifier[p] [ literal[int] ]
... | def p_simple_list1(p):
"""simple_list1 : simple_list1 AND_AND newline_list simple_list1
| simple_list1 OR_OR newline_list simple_list1
| simple_list1 AMPERSAND simple_list1
| simple_list1 SEMICOLON simple_list1
| pipeline_command"""
... |
def dayplot_magic(path_to_file='.', hyst_file="specimens.txt", rem_file='',
save=True, save_folder='.', fmt='svg', data_model=3,
interactive=False, contribution=None):
"""
Makes 'day plots' (Day et al. 1977) and squareness/coercivity plots
(Neel, 1955; plots after Tauxe e... | def function[dayplot_magic, parameter[path_to_file, hyst_file, rem_file, save, save_folder, fmt, data_model, interactive, contribution]]:
constant[
Makes 'day plots' (Day et al. 1977) and squareness/coercivity plots
(Neel, 1955; plots after Tauxe et al., 2002); plots 'linear mixing'
curve from Dunlo... | keyword[def] identifier[dayplot_magic] ( identifier[path_to_file] = literal[string] , identifier[hyst_file] = literal[string] , identifier[rem_file] = literal[string] ,
identifier[save] = keyword[True] , identifier[save_folder] = literal[string] , identifier[fmt] = literal[string] , identifier[data_model] = literal[... | def dayplot_magic(path_to_file='.', hyst_file='specimens.txt', rem_file='', save=True, save_folder='.', fmt='svg', data_model=3, interactive=False, contribution=None):
"""
Makes 'day plots' (Day et al. 1977) and squareness/coercivity plots
(Neel, 1955; plots after Tauxe et al., 2002); plots 'linear mixing'
... |
def get(self, sid):
"""
Constructs a AssetContext
:param sid: The sid
:returns: twilio.rest.serverless.v1.service.asset.AssetContext
:rtype: twilio.rest.serverless.v1.service.asset.AssetContext
"""
return AssetContext(self._version, service_sid=self._solution['s... | def function[get, parameter[self, sid]]:
constant[
Constructs a AssetContext
:param sid: The sid
:returns: twilio.rest.serverless.v1.service.asset.AssetContext
:rtype: twilio.rest.serverless.v1.service.asset.AssetContext
]
return[call[name[AssetContext], parameter[n... | keyword[def] identifier[get] ( identifier[self] , identifier[sid] ):
literal[string]
keyword[return] identifier[AssetContext] ( identifier[self] . identifier[_version] , identifier[service_sid] = identifier[self] . identifier[_solution] [ literal[string] ], identifier[sid] = identifier[sid] ,) | def get(self, sid):
"""
Constructs a AssetContext
:param sid: The sid
:returns: twilio.rest.serverless.v1.service.asset.AssetContext
:rtype: twilio.rest.serverless.v1.service.asset.AssetContext
"""
return AssetContext(self._version, service_sid=self._solution['service_s... |
def _truncate_float(matchobj, format_str='0.2g'):
"""Truncate long floats
Args:
matchobj (re.Match): contains original float
format_str (str): format specifier
Returns:
str: returns truncated float
"""
if matchobj.group(0):
return format(float(matchobj.group(0)), form... | def function[_truncate_float, parameter[matchobj, format_str]]:
constant[Truncate long floats
Args:
matchobj (re.Match): contains original float
format_str (str): format specifier
Returns:
str: returns truncated float
]
if call[name[matchobj].group, parameter[constant... | keyword[def] identifier[_truncate_float] ( identifier[matchobj] , identifier[format_str] = literal[string] ):
literal[string]
keyword[if] identifier[matchobj] . identifier[group] ( literal[int] ):
keyword[return] identifier[format] ( identifier[float] ( identifier[matchobj] . identifier[group] (... | def _truncate_float(matchobj, format_str='0.2g'):
"""Truncate long floats
Args:
matchobj (re.Match): contains original float
format_str (str): format specifier
Returns:
str: returns truncated float
"""
if matchobj.group(0):
return format(float(matchobj.group(0)), form... |
def prettify(elem):
"""Return a pretty-printed XML string for the Element."""
rough_string = E.tostring(elem, 'utf-8')
reparsed = minidom.parseString(rough_string)
return reparsed.toprettyxml(indent=' ').strip() | def function[prettify, parameter[elem]]:
constant[Return a pretty-printed XML string for the Element.]
variable[rough_string] assign[=] call[name[E].tostring, parameter[name[elem], constant[utf-8]]]
variable[reparsed] assign[=] call[name[minidom].parseString, parameter[name[rough_string]]]
r... | keyword[def] identifier[prettify] ( identifier[elem] ):
literal[string]
identifier[rough_string] = identifier[E] . identifier[tostring] ( identifier[elem] , literal[string] )
identifier[reparsed] = identifier[minidom] . identifier[parseString] ( identifier[rough_string] )
keyword[return] identif... | def prettify(elem):
"""Return a pretty-printed XML string for the Element."""
rough_string = E.tostring(elem, 'utf-8')
reparsed = minidom.parseString(rough_string)
return reparsed.toprettyxml(indent=' ').strip() |
def inspect_select_calculation(self):
"""Inspect the result of the CifSelectCalculation, verifying that it produced a CifData output node."""
try:
node = self.ctx.cif_select
self.ctx.cif = node.outputs.cif
except exceptions.NotExistent:
self.report('aborting: ... | def function[inspect_select_calculation, parameter[self]]:
constant[Inspect the result of the CifSelectCalculation, verifying that it produced a CifData output node.]
<ast.Try object at 0x7da18f58cc70> | keyword[def] identifier[inspect_select_calculation] ( identifier[self] ):
literal[string]
keyword[try] :
identifier[node] = identifier[self] . identifier[ctx] . identifier[cif_select]
identifier[self] . identifier[ctx] . identifier[cif] = identifier[node] . identifier[out... | def inspect_select_calculation(self):
"""Inspect the result of the CifSelectCalculation, verifying that it produced a CifData output node."""
try:
node = self.ctx.cif_select
self.ctx.cif = node.outputs.cif # depends on [control=['try'], data=[]]
except exceptions.NotExistent:
self.r... |
def run_command(self, input_file, output_dir=None):
"""Return the command for running bfconvert as a list.
:param input_file: path to microscopy image to be converted
:param ouput_dir: directory to write output tiff files to
:returns: list
"""
base_name = os.path... | def function[run_command, parameter[self, input_file, output_dir]]:
constant[Return the command for running bfconvert as a list.
:param input_file: path to microscopy image to be converted
:param ouput_dir: directory to write output tiff files to
:returns: list
]
... | keyword[def] identifier[run_command] ( identifier[self] , identifier[input_file] , identifier[output_dir] = keyword[None] ):
literal[string]
identifier[base_name] = identifier[os] . identifier[path] . identifier[basename] ( identifier[input_file] )
identifier[name] , identifier[suffix] = i... | def run_command(self, input_file, output_dir=None):
"""Return the command for running bfconvert as a list.
:param input_file: path to microscopy image to be converted
:param ouput_dir: directory to write output tiff files to
:returns: list
"""
base_name = os.path.basenam... |
def get_pwm_list(pwm_id_list, pseudocountProb=0.0001):
"""Get a list of Attract PWM's.
# Arguments
pwm_id_list: List of id's from the `PWM_id` column in `get_metadata()` table
pseudocountProb: Added pseudocount probabilities to the PWM
# Returns
List of `concise.utils.pwm.PWM` inst... | def function[get_pwm_list, parameter[pwm_id_list, pseudocountProb]]:
constant[Get a list of Attract PWM's.
# Arguments
pwm_id_list: List of id's from the `PWM_id` column in `get_metadata()` table
pseudocountProb: Added pseudocount probabilities to the PWM
# Returns
List of `con... | keyword[def] identifier[get_pwm_list] ( identifier[pwm_id_list] , identifier[pseudocountProb] = literal[int] ):
literal[string]
identifier[l] = identifier[load_motif_db] ( identifier[ATTRACT_PWM] )
identifier[l] ={ identifier[k] . identifier[split] ()[ literal[int] ]: identifier[v] keyword[for] iden... | def get_pwm_list(pwm_id_list, pseudocountProb=0.0001):
"""Get a list of Attract PWM's.
# Arguments
pwm_id_list: List of id's from the `PWM_id` column in `get_metadata()` table
pseudocountProb: Added pseudocount probabilities to the PWM
# Returns
List of `concise.utils.pwm.PWM` inst... |
def _parse_title(file_path):
"""
Parse a title from a file name
"""
title = file_path
title = title.split('/')[-1]
title = '.'.join(title.split('.')[:-1])
title = ' '.join(title.split('-'))
title = ' '.join([
word.capitalize()
for word in title.split(' ')
])
retur... | def function[_parse_title, parameter[file_path]]:
constant[
Parse a title from a file name
]
variable[title] assign[=] name[file_path]
variable[title] assign[=] call[call[name[title].split, parameter[constant[/]]]][<ast.UnaryOp object at 0x7da1b1bc11e0>]
variable[title] assign[=]... | keyword[def] identifier[_parse_title] ( identifier[file_path] ):
literal[string]
identifier[title] = identifier[file_path]
identifier[title] = identifier[title] . identifier[split] ( literal[string] )[- literal[int] ]
identifier[title] = literal[string] . identifier[join] ( identifier[title] . i... | def _parse_title(file_path):
"""
Parse a title from a file name
"""
title = file_path
title = title.split('/')[-1]
title = '.'.join(title.split('.')[:-1])
title = ' '.join(title.split('-'))
title = ' '.join([word.capitalize() for word in title.split(' ')])
return title |
def escalatees(self):
"""
Gets the task escalatees
"""
if not self.can_update():
self._tcex.handle_error(910, [self.type])
for e in self.tc_requests.escalatees(self.api_type, self.api_sub_type, self.unique_id):
yield e | def function[escalatees, parameter[self]]:
constant[
Gets the task escalatees
]
if <ast.UnaryOp object at 0x7da18f810400> begin[:]
call[name[self]._tcex.handle_error, parameter[constant[910], list[[<ast.Attribute object at 0x7da18f812140>]]]]
for taget[name[e]] in... | keyword[def] identifier[escalatees] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[can_update] ():
identifier[self] . identifier[_tcex] . identifier[handle_error] ( literal[int] ,[ identifier[self] . identifier[type] ])
keyword[... | def escalatees(self):
"""
Gets the task escalatees
"""
if not self.can_update():
self._tcex.handle_error(910, [self.type]) # depends on [control=['if'], data=[]]
for e in self.tc_requests.escalatees(self.api_type, self.api_sub_type, self.unique_id):
yield e # depends on [co... |
def dedupFasta(reads):
"""
Remove sequence duplicates (based on sequence) from FASTA.
@param reads: a C{dark.reads.Reads} instance.
@return: a generator of C{dark.reads.Read} instances with no duplicates.
"""
seen = set()
add = seen.add
for read in reads:
hash_ = md5(read.sequen... | def function[dedupFasta, parameter[reads]]:
constant[
Remove sequence duplicates (based on sequence) from FASTA.
@param reads: a C{dark.reads.Reads} instance.
@return: a generator of C{dark.reads.Read} instances with no duplicates.
]
variable[seen] assign[=] call[name[set], parameter[]]... | keyword[def] identifier[dedupFasta] ( identifier[reads] ):
literal[string]
identifier[seen] = identifier[set] ()
identifier[add] = identifier[seen] . identifier[add]
keyword[for] identifier[read] keyword[in] identifier[reads] :
identifier[hash_] = identifier[md5] ( identifier[read] .... | def dedupFasta(reads):
"""
Remove sequence duplicates (based on sequence) from FASTA.
@param reads: a C{dark.reads.Reads} instance.
@return: a generator of C{dark.reads.Read} instances with no duplicates.
"""
seen = set()
add = seen.add
for read in reads:
hash_ = md5(read.sequen... |
def constrained_by(self):
"""
returns a list of parameters that constrain this parameter
"""
if self._is_constraint is None:
return []
params = []
for var in self.is_constraint._vars:
param = var.get_parameter()
if param.uniqueid != sel... | def function[constrained_by, parameter[self]]:
constant[
returns a list of parameters that constrain this parameter
]
if compare[name[self]._is_constraint is constant[None]] begin[:]
return[list[[]]]
variable[params] assign[=] list[[]]
for taget[name[var]] in star... | keyword[def] identifier[constrained_by] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_is_constraint] keyword[is] keyword[None] :
keyword[return] []
identifier[params] =[]
keyword[for] identifier[var] keyword[in] identifier[self... | def constrained_by(self):
"""
returns a list of parameters that constrain this parameter
"""
if self._is_constraint is None:
return [] # depends on [control=['if'], data=[]]
params = []
for var in self.is_constraint._vars:
param = var.get_parameter()
if param.uni... |
def attribute_changed(self):
"""
Triggers the host model(s) :meth:`umbra.ui.models.GraphModel.attribute_changed` method.
:return: Method success.
:rtype: bool
"""
for model in umbra.ui.models.GraphModel.find_model(self):
headers = model.horizontal_headers.va... | def function[attribute_changed, parameter[self]]:
constant[
Triggers the host model(s) :meth:`umbra.ui.models.GraphModel.attribute_changed` method.
:return: Method success.
:rtype: bool
]
for taget[name[model]] in starred[call[name[umbra].ui.models.GraphModel.find_model,... | keyword[def] identifier[attribute_changed] ( identifier[self] ):
literal[string]
keyword[for] identifier[model] keyword[in] identifier[umbra] . identifier[ui] . identifier[models] . identifier[GraphModel] . identifier[find_model] ( identifier[self] ):
identifier[headers] = identifi... | def attribute_changed(self):
"""
Triggers the host model(s) :meth:`umbra.ui.models.GraphModel.attribute_changed` method.
:return: Method success.
:rtype: bool
"""
for model in umbra.ui.models.GraphModel.find_model(self):
headers = model.horizontal_headers.values()
... |
def group_copy(name, copyname, **kwargs):
"""
Copy routing group.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:copy', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
'copyname': copyname,
}) | def function[group_copy, parameter[name, copyname]]:
constant[
Copy routing group.
]
variable[ctx] assign[=] call[name[Context], parameter[]]
call[name[ctx].execute_action, parameter[constant[group:copy]]] | keyword[def] identifier[group_copy] ( identifier[name] , identifier[copyname] ,** identifier[kwargs] ):
literal[string]
identifier[ctx] = identifier[Context] (** identifier[kwargs] )
identifier[ctx] . identifier[execute_action] ( literal[string] ,**{
literal[string] : identifier[ctx] . identifier... | def group_copy(name, copyname, **kwargs):
"""
Copy routing group.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:copy', **{'storage': ctx.repo.create_secure_service('storage'), 'name': name, 'copyname': copyname}) |
def cublasSetStream(handle, id):
"""
Set current CUBLAS library stream.
Parameters
----------
handle : id
CUBLAS context.
id : int
Stream ID.
"""
status = _libcublas.cublasSetStream_v2(handle, id)
cublasCheckStatus(status) | def function[cublasSetStream, parameter[handle, id]]:
constant[
Set current CUBLAS library stream.
Parameters
----------
handle : id
CUBLAS context.
id : int
Stream ID.
]
variable[status] assign[=] call[name[_libcublas].cublasSetStream_v2, parameter[name[han... | keyword[def] identifier[cublasSetStream] ( identifier[handle] , identifier[id] ):
literal[string]
identifier[status] = identifier[_libcublas] . identifier[cublasSetStream_v2] ( identifier[handle] , identifier[id] )
identifier[cublasCheckStatus] ( identifier[status] ) | def cublasSetStream(handle, id):
"""
Set current CUBLAS library stream.
Parameters
----------
handle : id
CUBLAS context.
id : int
Stream ID.
"""
status = _libcublas.cublasSetStream_v2(handle, id)
cublasCheckStatus(status) |
def validate_variable_type(var_name, var_type, value):
"""Ensures the value is the correct variable type.
Args:
var_name (str): The name of the defined variable on a blueprint.
var_type (type): The type that the value should be.
value (obj): The object representing the value provided fo... | def function[validate_variable_type, parameter[var_name, var_type, value]]:
constant[Ensures the value is the correct variable type.
Args:
var_name (str): The name of the defined variable on a blueprint.
var_type (type): The type that the value should be.
value (obj): The object rep... | keyword[def] identifier[validate_variable_type] ( identifier[var_name] , identifier[var_type] , identifier[value] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[var_type] , identifier[CFNType] ):
identifier[value] = identifier[CFNParameter] ( identifier[name] = identifier[var... | def validate_variable_type(var_name, var_type, value):
"""Ensures the value is the correct variable type.
Args:
var_name (str): The name of the defined variable on a blueprint.
var_type (type): The type that the value should be.
value (obj): The object representing the value provided fo... |
def _id(self):
"""What this object is equal to."""
return (self.__class__, self.number_of_needles, self.needle_positions,
self.left_end_needle) | def function[_id, parameter[self]]:
constant[What this object is equal to.]
return[tuple[[<ast.Attribute object at 0x7da20c6c4490>, <ast.Attribute object at 0x7da20c6c5b10>, <ast.Attribute object at 0x7da20c6c73a0>, <ast.Attribute object at 0x7da20c6c5030>]]] | keyword[def] identifier[_id] ( identifier[self] ):
literal[string]
keyword[return] ( identifier[self] . identifier[__class__] , identifier[self] . identifier[number_of_needles] , identifier[self] . identifier[needle_positions] ,
identifier[self] . identifier[left_end_needle] ) | def _id(self):
"""What this object is equal to."""
return (self.__class__, self.number_of_needles, self.needle_positions, self.left_end_needle) |
def _getTypename(self, defn):
""" Returns the SQL typename required to store the given FieldDefinition """
return 'REAL' if defn.type.float or 'TIME' in defn.type.name or defn.dntoeu else 'INTEGER' | def function[_getTypename, parameter[self, defn]]:
constant[ Returns the SQL typename required to store the given FieldDefinition ]
return[<ast.IfExp object at 0x7da18f721b70>] | keyword[def] identifier[_getTypename] ( identifier[self] , identifier[defn] ):
literal[string]
keyword[return] literal[string] keyword[if] identifier[defn] . identifier[type] . identifier[float] keyword[or] literal[string] keyword[in] identifier[defn] . identifier[type] . identifier[name] k... | def _getTypename(self, defn):
""" Returns the SQL typename required to store the given FieldDefinition """
return 'REAL' if defn.type.float or 'TIME' in defn.type.name or defn.dntoeu else 'INTEGER' |
def pretty_print_model(devicemodel):
"""Prints out a device model in the terminal by parsing dict."""
PRETTY_PRINT_MODEL = """Device Model ID: %(deviceModelId)s
Project ID: %(projectId)s
Device Type: %(deviceType)s"""
logging.info(PRETTY_PRINT_MODEL % devicemodel)
if 'traits' in devicemo... | def function[pretty_print_model, parameter[devicemodel]]:
constant[Prints out a device model in the terminal by parsing dict.]
variable[PRETTY_PRINT_MODEL] assign[=] constant[Device Model ID: %(deviceModelId)s
Project ID: %(projectId)s
Device Type: %(deviceType)s]
call[name[loggi... | keyword[def] identifier[pretty_print_model] ( identifier[devicemodel] ):
literal[string]
identifier[PRETTY_PRINT_MODEL] = literal[string]
identifier[logging] . identifier[info] ( identifier[PRETTY_PRINT_MODEL] % identifier[devicemodel] )
keyword[if] literal[string] keyword[in] identifier[devi... | def pretty_print_model(devicemodel):
"""Prints out a device model in the terminal by parsing dict."""
PRETTY_PRINT_MODEL = 'Device Model ID: %(deviceModelId)s\n Project ID: %(projectId)s\n Device Type: %(deviceType)s'
logging.info(PRETTY_PRINT_MODEL % devicemodel)
if 'traits' in devicemode... |
def _print_help(self):
"""
Help is automatically generated from the __doc__ of the subclass if present
and from the names of the args of run(). Therefore args names selection
is more important than ever here !
"""
options = self._print_usage('\n ', file=sys.stdout)
... | def function[_print_help, parameter[self]]:
constant[
Help is automatically generated from the __doc__ of the subclass if present
and from the names of the args of run(). Therefore args names selection
is more important than ever here !
]
variable[options] assign[=] call[... | keyword[def] identifier[_print_help] ( identifier[self] ):
literal[string]
identifier[options] = identifier[self] . identifier[_print_usage] ( literal[string] , identifier[file] = identifier[sys] . identifier[stdout] )
keyword[if] identifier[self] . identifier[docstring] :
id... | def _print_help(self):
"""
Help is automatically generated from the __doc__ of the subclass if present
and from the names of the args of run(). Therefore args names selection
is more important than ever here !
"""
options = self._print_usage('\n ', file=sys.stdout)
if self.d... |
def _get_token(self, req):
""" Get the token from the Authorization header
If the header is actually malformed where Bearer Auth was
indicated by the request then an InvalidAuthSyntax exception
is raised. Otherwise an AuthRequired exception since it's
unclear in this scenario if... | def function[_get_token, parameter[self, req]]:
constant[ Get the token from the Authorization header
If the header is actually malformed where Bearer Auth was
indicated by the request then an InvalidAuthSyntax exception
is raised. Otherwise an AuthRequired exception since it's
... | keyword[def] identifier[_get_token] ( identifier[self] , identifier[req] ):
literal[string]
identifier[self] . identifier[_validate_auth_scheme] ( identifier[req] )
keyword[try] :
keyword[return] identifier[naked] ( identifier[req] . identifier[auth] . identifier[split] ( l... | def _get_token(self, req):
""" Get the token from the Authorization header
If the header is actually malformed where Bearer Auth was
indicated by the request then an InvalidAuthSyntax exception
is raised. Otherwise an AuthRequired exception since it's
unclear in this scenario if the... |
def user(self):
""" Return a (deferred) cached Koji user name for this change. """
# Note, do any tasks really have an "owner_id", or are they all
# "owner"?
owner_id = getattr(self.task, 'owner_id', self.task.owner)
return self.task.connection.cache.user_name(owner_id) | def function[user, parameter[self]]:
constant[ Return a (deferred) cached Koji user name for this change. ]
variable[owner_id] assign[=] call[name[getattr], parameter[name[self].task, constant[owner_id], name[self].task.owner]]
return[call[name[self].task.connection.cache.user_name, parameter[name[o... | keyword[def] identifier[user] ( identifier[self] ):
literal[string]
identifier[owner_id] = identifier[getattr] ( identifier[self] . identifier[task] , literal[string] , identifier[self] . identifier[task] . identifier[owner] )
keyword[return] identifier[self] . identifie... | def user(self):
""" Return a (deferred) cached Koji user name for this change. """
# Note, do any tasks really have an "owner_id", or are they all
# "owner"?
owner_id = getattr(self.task, 'owner_id', self.task.owner)
return self.task.connection.cache.user_name(owner_id) |
def vfolders(access_key):
'''
List and manage virtual folders.
'''
fields = [
('Name', 'name'),
('Created At', 'created_at'),
('Last Used', 'last_used'),
('Max Files', 'max_files'),
('Max Size', 'max_size'),
]
if access_key is None:
q = 'query { vf... | def function[vfolders, parameter[access_key]]:
constant[
List and manage virtual folders.
]
variable[fields] assign[=] list[[<ast.Tuple object at 0x7da20c6aa770>, <ast.Tuple object at 0x7da20c6a8bb0>, <ast.Tuple object at 0x7da20c6a89d0>, <ast.Tuple object at 0x7da20c6abcd0>, <ast.Tuple object a... | keyword[def] identifier[vfolders] ( identifier[access_key] ):
literal[string]
identifier[fields] =[
( literal[string] , literal[string] ),
( literal[string] , literal[string] ),
( literal[string] , literal[string] ),
( literal[string] , literal[string] ),
( literal[string] , literal[str... | def vfolders(access_key):
"""
List and manage virtual folders.
"""
fields = [('Name', 'name'), ('Created At', 'created_at'), ('Last Used', 'last_used'), ('Max Files', 'max_files'), ('Max Size', 'max_size')]
if access_key is None:
q = 'query { vfolders { $fields } }' # depends on [control=['... |
def value_to_db(self, value):
""" Returns field's single value prepared for saving into a database. """
assert isinstance(value, datetime.datetime)
try:
value = value - datetime.datetime(1970, 1, 1)
except OverflowError:
raise tldap.exceptions.ValidationError("is... | def function[value_to_db, parameter[self, value]]:
constant[ Returns field's single value prepared for saving into a database. ]
assert[call[name[isinstance], parameter[name[value], name[datetime].datetime]]]
<ast.Try object at 0x7da20c76e3e0>
variable[value] assign[=] binary_operation[name[valu... | keyword[def] identifier[value_to_db] ( identifier[self] , identifier[value] ):
literal[string]
keyword[assert] identifier[isinstance] ( identifier[value] , identifier[datetime] . identifier[datetime] )
keyword[try] :
identifier[value] = identifier[value] - identifier[datetim... | def value_to_db(self, value):
""" Returns field's single value prepared for saving into a database. """
assert isinstance(value, datetime.datetime)
try:
value = value - datetime.datetime(1970, 1, 1) # depends on [control=['try'], data=[]]
except OverflowError:
raise tldap.exceptions.Val... |
def get_field(self, field, idx):
"""
Return the field ``field`` of elements ``idx`` in the group
:param field: field name
:param idx: element idx
:return: values of the requested field
"""
ret = []
scalar = False
# TODO: ensure idx is unique in t... | def function[get_field, parameter[self, field, idx]]:
constant[
Return the field ``field`` of elements ``idx`` in the group
:param field: field name
:param idx: element idx
:return: values of the requested field
]
variable[ret] assign[=] list[[]]
variable... | keyword[def] identifier[get_field] ( identifier[self] , identifier[field] , identifier[idx] ):
literal[string]
identifier[ret] =[]
identifier[scalar] = keyword[False]
keyword[if] identifier[isinstance] ( identifier[idx] ,( identifier[int] , identifier[float] , identif... | def get_field(self, field, idx):
"""
Return the field ``field`` of elements ``idx`` in the group
:param field: field name
:param idx: element idx
:return: values of the requested field
"""
ret = []
scalar = False
# TODO: ensure idx is unique in this Group
if ... |
def set_description(self, description=None):
"""Sets a description.
arg: description (string): the new description
raise: InvalidArgument - description is invalid
raise: NoAccess - metadata.is_readonly() is true
raise: NullArgument - description is null
compliance:... | def function[set_description, parameter[self, description]]:
constant[Sets a description.
arg: description (string): the new description
raise: InvalidArgument - description is invalid
raise: NoAccess - metadata.is_readonly() is true
raise: NullArgument - description is nu... | keyword[def] identifier[set_description] ( identifier[self] , identifier[description] = keyword[None] ):
literal[string]
keyword[if] identifier[description] keyword[is] keyword[None] :
keyword[raise] identifier[NullArgument] ()
identifier[metadata] = identifier[Metadata] (... | def set_description(self, description=None):
"""Sets a description.
arg: description (string): the new description
raise: InvalidArgument - description is invalid
raise: NoAccess - metadata.is_readonly() is true
raise: NullArgument - description is null
compliance: man... |
def install(path, capture_error=False): # type: (str, bool) -> None
"""Install a Python module in the executing Python environment.
Args:
path (str): Real path location of the Python module.
capture_error (bool): Default false. If True, the running process captures the
stderr, and ... | def function[install, parameter[path, capture_error]]:
constant[Install a Python module in the executing Python environment.
Args:
path (str): Real path location of the Python module.
capture_error (bool): Default false. If True, the running process captures the
stderr, and appe... | keyword[def] identifier[install] ( identifier[path] , identifier[capture_error] = keyword[False] ):
literal[string]
identifier[cmd] = literal[string] % identifier[_process] . identifier[python_executable] ()
keyword[if] identifier[has_requirements] ( identifier[path] ):
identifier[cmd] += l... | def install(path, capture_error=False): # type: (str, bool) -> None
'Install a Python module in the executing Python environment.\n Args:\n path (str): Real path location of the Python module.\n capture_error (bool): Default false. If True, the running process captures the\n stderr, an... |
def run(self, stim, merge=True, **merge_kwargs):
''' Executes the graph by calling all Transformers in sequence.
Args:
stim (str, Stim, list): One or more valid inputs to any
Transformer's 'transform' call.
merge (bool): If True, all results are merged into a sin... | def function[run, parameter[self, stim, merge]]:
constant[ Executes the graph by calling all Transformers in sequence.
Args:
stim (str, Stim, list): One or more valid inputs to any
Transformer's 'transform' call.
merge (bool): If True, all results are merged into... | keyword[def] identifier[run] ( identifier[self] , identifier[stim] , identifier[merge] = keyword[True] ,** identifier[merge_kwargs] ):
literal[string]
identifier[results] = identifier[list] ( identifier[chain] (*[ identifier[self] . identifier[run_node] ( identifier[n] , identifier[stim] ) keyword[... | def run(self, stim, merge=True, **merge_kwargs):
""" Executes the graph by calling all Transformers in sequence.
Args:
stim (str, Stim, list): One or more valid inputs to any
Transformer's 'transform' call.
merge (bool): If True, all results are merged into a single ... |
def precompute(self, cache_dir=None, swath_usage=0, **kwargs):
"""Generate row and column arrays and store it for later use."""
if kwargs.get('mask') is not None:
LOG.warning("'mask' parameter has no affect during EWA "
"resampling")
del kwargs
source... | def function[precompute, parameter[self, cache_dir, swath_usage]]:
constant[Generate row and column arrays and store it for later use.]
if compare[call[name[kwargs].get, parameter[constant[mask]]] is_not constant[None]] begin[:]
call[name[LOG].warning, parameter[constant['mask' parameter... | keyword[def] identifier[precompute] ( identifier[self] , identifier[cache_dir] = keyword[None] , identifier[swath_usage] = literal[int] ,** identifier[kwargs] ):
literal[string]
keyword[if] identifier[kwargs] . identifier[get] ( literal[string] ) keyword[is] keyword[not] keyword[None] :
... | def precompute(self, cache_dir=None, swath_usage=0, **kwargs):
"""Generate row and column arrays and store it for later use."""
if kwargs.get('mask') is not None:
LOG.warning("'mask' parameter has no affect during EWA resampling") # depends on [control=['if'], data=[]]
del kwargs
source_geo_def... |
def match(tgt, opts=None):
'''
Matches based on range cluster
'''
if not opts:
opts = __opts__
if HAS_RANGE:
range_ = seco.range.Range(opts['range_server'])
try:
return opts['grains']['fqdn'] in range_.expand(tgt)
except seco.range.RangeException as exc:
... | def function[match, parameter[tgt, opts]]:
constant[
Matches based on range cluster
]
if <ast.UnaryOp object at 0x7da18fe90b50> begin[:]
variable[opts] assign[=] name[__opts__]
if name[HAS_RANGE] begin[:]
variable[range_] assign[=] call[name[seco].range.Ra... | keyword[def] identifier[match] ( identifier[tgt] , identifier[opts] = keyword[None] ):
literal[string]
keyword[if] keyword[not] identifier[opts] :
identifier[opts] = identifier[__opts__]
keyword[if] identifier[HAS_RANGE] :
identifier[range_] = identifier[seco] . identifier[range]... | def match(tgt, opts=None):
"""
Matches based on range cluster
"""
if not opts:
opts = __opts__ # depends on [control=['if'], data=[]]
if HAS_RANGE:
range_ = seco.range.Range(opts['range_server'])
try:
return opts['grains']['fqdn'] in range_.expand(tgt) # depends... |
def catch_gzip_errors(f):
"""
A decorator to handle gzip encoding errors which have been known to
happen during hydration.
"""
def new_f(self, *args, **kwargs):
try:
return f(self, *args, **kwargs)
except requests.exceptions.ContentDecodingError as e:
log.warn... | def function[catch_gzip_errors, parameter[f]]:
constant[
A decorator to handle gzip encoding errors which have been known to
happen during hydration.
]
def function[new_f, parameter[self]]:
<ast.Try object at 0x7da1b18e66b0>
return[name[new_f]] | keyword[def] identifier[catch_gzip_errors] ( identifier[f] ):
literal[string]
keyword[def] identifier[new_f] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ):
keyword[try] :
keyword[return] identifier[f] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] )
... | def catch_gzip_errors(f):
"""
A decorator to handle gzip encoding errors which have been known to
happen during hydration.
"""
def new_f(self, *args, **kwargs):
try:
return f(self, *args, **kwargs) # depends on [control=['try'], data=[]]
except requests.exceptions.Conte... |
def save_xml(self, doc, element):
'''Save this target component into an xml.dom.Element object.'''
element.setAttributeNS(RTS_NS, RTS_NS_S + 'componentId',
self.component_id)
element.setAttributeNS(RTS_NS, RTS_NS_S + 'instanceName',
s... | def function[save_xml, parameter[self, doc, element]]:
constant[Save this target component into an xml.dom.Element object.]
call[name[element].setAttributeNS, parameter[name[RTS_NS], binary_operation[name[RTS_NS_S] + constant[componentId]], name[self].component_id]]
call[name[element].setAttribu... | keyword[def] identifier[save_xml] ( identifier[self] , identifier[doc] , identifier[element] ):
literal[string]
identifier[element] . identifier[setAttributeNS] ( identifier[RTS_NS] , identifier[RTS_NS_S] + literal[string] ,
identifier[self] . identifier[component_id] )
identifier... | def save_xml(self, doc, element):
"""Save this target component into an xml.dom.Element object."""
element.setAttributeNS(RTS_NS, RTS_NS_S + 'componentId', self.component_id)
element.setAttributeNS(RTS_NS, RTS_NS_S + 'instanceName', self.instance_name)
for p in self.properties:
new_prop_element ... |
def check_in_lambda():
"""
Return None if SDK is not loaded in AWS Lambda worker.
Otherwise drop a touch file and return a lambda context.
"""
if not os.getenv(LAMBDA_TASK_ROOT_KEY):
return None
try:
os.mkdir(TOUCH_FILE_DIR)
except OSError:
log.debug('directory %s al... | def function[check_in_lambda, parameter[]]:
constant[
Return None if SDK is not loaded in AWS Lambda worker.
Otherwise drop a touch file and return a lambda context.
]
if <ast.UnaryOp object at 0x7da1b07bc0a0> begin[:]
return[constant[None]]
<ast.Try object at 0x7da1b07be290>
... | keyword[def] identifier[check_in_lambda] ():
literal[string]
keyword[if] keyword[not] identifier[os] . identifier[getenv] ( identifier[LAMBDA_TASK_ROOT_KEY] ):
keyword[return] keyword[None]
keyword[try] :
identifier[os] . identifier[mkdir] ( identifier[TOUCH_FILE_DIR] )
key... | def check_in_lambda():
"""
Return None if SDK is not loaded in AWS Lambda worker.
Otherwise drop a touch file and return a lambda context.
"""
if not os.getenv(LAMBDA_TASK_ROOT_KEY):
return None # depends on [control=['if'], data=[]]
try:
os.mkdir(TOUCH_FILE_DIR) # depends on [... |
def get_all_methods(entry_point=ALL, protocol=ALL, sort_methods=False):
"""For backward compatibility. Use registry.get_all_methods() instead (with same arguments)"""
return registry.get_all_methods(entry_point=entry_point, protocol=protocol, sort_methods=sort_methods) | def function[get_all_methods, parameter[entry_point, protocol, sort_methods]]:
constant[For backward compatibility. Use registry.get_all_methods() instead (with same arguments)]
return[call[name[registry].get_all_methods, parameter[]]] | keyword[def] identifier[get_all_methods] ( identifier[entry_point] = identifier[ALL] , identifier[protocol] = identifier[ALL] , identifier[sort_methods] = keyword[False] ):
literal[string]
keyword[return] identifier[registry] . identifier[get_all_methods] ( identifier[entry_point] = identifier[entry_point... | def get_all_methods(entry_point=ALL, protocol=ALL, sort_methods=False):
"""For backward compatibility. Use registry.get_all_methods() instead (with same arguments)"""
return registry.get_all_methods(entry_point=entry_point, protocol=protocol, sort_methods=sort_methods) |
def _query(event=None,
method='GET',
args=None,
header_dict=None,
data=None):
'''
Make a web call to IFTTT.
'''
secret_key = __salt__['config.get']('ifttt.secret_key') or \
__salt__['config.get']('ifttt:secret_key')
path = 'https://maker.ifttt.com/... | def function[_query, parameter[event, method, args, header_dict, data]]:
constant[
Make a web call to IFTTT.
]
variable[secret_key] assign[=] <ast.BoolOp object at 0x7da1b215f040>
variable[path] assign[=] call[constant[https://maker.ifttt.com/trigger/{0}/with/key/{1}].format, parameter[n... | keyword[def] identifier[_query] ( identifier[event] = keyword[None] ,
identifier[method] = literal[string] ,
identifier[args] = keyword[None] ,
identifier[header_dict] = keyword[None] ,
identifier[data] = keyword[None] ):
literal[string]
identifier[secret_key] = identifier[__salt__] [ literal[string] ]... | def _query(event=None, method='GET', args=None, header_dict=None, data=None):
"""
Make a web call to IFTTT.
"""
secret_key = __salt__['config.get']('ifttt.secret_key') or __salt__['config.get']('ifttt:secret_key')
path = 'https://maker.ifttt.com/trigger/{0}/with/key/{1}'.format(event, secret_key)
... |
def correspondent(self):
"""
:returns: The username of the user with whom the logged in user is
conversing in this :class:`~.MessageThread`.
"""
try:
return self._correspondent_xpb.one_(self._thread_element).strip()
except IndexError:
rai... | def function[correspondent, parameter[self]]:
constant[
:returns: The username of the user with whom the logged in user is
conversing in this :class:`~.MessageThread`.
]
<ast.Try object at 0x7da1b261f130> | keyword[def] identifier[correspondent] ( identifier[self] ):
literal[string]
keyword[try] :
keyword[return] identifier[self] . identifier[_correspondent_xpb] . identifier[one_] ( identifier[self] . identifier[_thread_element] ). identifier[strip] ()
keyword[except] identifie... | def correspondent(self):
"""
:returns: The username of the user with whom the logged in user is
conversing in this :class:`~.MessageThread`.
"""
try:
return self._correspondent_xpb.one_(self._thread_element).strip() # depends on [control=['try'], data=[]]
except In... |
def footprint(config, nside=None):
"""
UNTESTED.
Should return a boolean array representing the pixels in the footprint.
"""
config = Config(config)
if nside is None:
nside = config['coords']['nside_pixel']
elif nside < config['coords']['nside_catalog']:
raise Exception('Requ... | def function[footprint, parameter[config, nside]]:
constant[
UNTESTED.
Should return a boolean array representing the pixels in the footprint.
]
variable[config] assign[=] call[name[Config], parameter[name[config]]]
if compare[name[nside] is constant[None]] begin[:]
v... | keyword[def] identifier[footprint] ( identifier[config] , identifier[nside] = keyword[None] ):
literal[string]
identifier[config] = identifier[Config] ( identifier[config] )
keyword[if] identifier[nside] keyword[is] keyword[None] :
identifier[nside] = identifier[config] [ literal[string] ]... | def footprint(config, nside=None):
"""
UNTESTED.
Should return a boolean array representing the pixels in the footprint.
"""
config = Config(config)
if nside is None:
nside = config['coords']['nside_pixel'] # depends on [control=['if'], data=['nside']]
elif nside < config['coords'][... |
def unsubscribe(self, client):
"""Unsubscribe a client from all channels."""
for channel in self.channels.values():
channel.unsubscribe(client) | def function[unsubscribe, parameter[self, client]]:
constant[Unsubscribe a client from all channels.]
for taget[name[channel]] in starred[call[name[self].channels.values, parameter[]]] begin[:]
call[name[channel].unsubscribe, parameter[name[client]]] | keyword[def] identifier[unsubscribe] ( identifier[self] , identifier[client] ):
literal[string]
keyword[for] identifier[channel] keyword[in] identifier[self] . identifier[channels] . identifier[values] ():
identifier[channel] . identifier[unsubscribe] ( identifier[client] ) | def unsubscribe(self, client):
"""Unsubscribe a client from all channels."""
for channel in self.channels.values():
channel.unsubscribe(client) # depends on [control=['for'], data=['channel']] |
def Login(self, name, username=None, password=None, noSsl=False, port=None, dumpXml=None, proxy=None,
autoRefresh=YesOrNo.FALSE):
"""
Login method authenticates and connects to UCS.
- name specifies the IP Address IMC Server.
- username specifies the username credential.
- passwo... | def function[Login, parameter[self, name, username, password, noSsl, port, dumpXml, proxy, autoRefresh]]:
constant[
Login method authenticates and connects to UCS.
- name specifies the IP Address IMC Server.
- username specifies the username credential.
- password specifies the ... | keyword[def] identifier[Login] ( identifier[self] , identifier[name] , identifier[username] = keyword[None] , identifier[password] = keyword[None] , identifier[noSsl] = keyword[False] , identifier[port] = keyword[None] , identifier[dumpXml] = keyword[None] , identifier[proxy] = keyword[None] ,
identifier[autoRefresh... | def Login(self, name, username=None, password=None, noSsl=False, port=None, dumpXml=None, proxy=None, autoRefresh=YesOrNo.FALSE):
"""
Login method authenticates and connects to UCS.
- name specifies the IP Address IMC Server.
- username specifies the username credential.
- password ... |
def stat(path, format):
"""Call stat on file
:param path: HDFS Path
:param format: Stat format
:returns: Stat output
:raises: IOError: If unsuccessful
"""
cmd = "hadoop fs -stat %s %s" % (format, path)
rcode, stdout, stderr = _checked_hadoop_fs_command(cmd)
return stdout.rstrip() | def function[stat, parameter[path, format]]:
constant[Call stat on file
:param path: HDFS Path
:param format: Stat format
:returns: Stat output
:raises: IOError: If unsuccessful
]
variable[cmd] assign[=] binary_operation[constant[hadoop fs -stat %s %s] <ast.Mod object at 0x7da2590d6... | keyword[def] identifier[stat] ( identifier[path] , identifier[format] ):
literal[string]
identifier[cmd] = literal[string] %( identifier[format] , identifier[path] )
identifier[rcode] , identifier[stdout] , identifier[stderr] = identifier[_checked_hadoop_fs_command] ( identifier[cmd] )
keyword[re... | def stat(path, format):
"""Call stat on file
:param path: HDFS Path
:param format: Stat format
:returns: Stat output
:raises: IOError: If unsuccessful
"""
cmd = 'hadoop fs -stat %s %s' % (format, path)
(rcode, stdout, stderr) = _checked_hadoop_fs_command(cmd)
return stdout.rstrip() |
def _send_ffe(self, pid, app_id, app_flags, fr):
"""Send a flood-fill end packet.
The cores and regions that the application should be loaded to will
have been specified by a stream of flood-fill core select packets
(FFCS).
"""
arg1 = (NNCommands.flood_fill_end << 24) | ... | def function[_send_ffe, parameter[self, pid, app_id, app_flags, fr]]:
constant[Send a flood-fill end packet.
The cores and regions that the application should be loaded to will
have been specified by a stream of flood-fill core select packets
(FFCS).
]
variable[arg1] ass... | keyword[def] identifier[_send_ffe] ( identifier[self] , identifier[pid] , identifier[app_id] , identifier[app_flags] , identifier[fr] ):
literal[string]
identifier[arg1] =( identifier[NNCommands] . identifier[flood_fill_end] << literal[int] )| identifier[pid]
identifier[arg2] =( identifie... | def _send_ffe(self, pid, app_id, app_flags, fr):
"""Send a flood-fill end packet.
The cores and regions that the application should be loaded to will
have been specified by a stream of flood-fill core select packets
(FFCS).
"""
arg1 = NNCommands.flood_fill_end << 24 | pid
ar... |
def decommission_brokers(self, broker_ids):
"""Decommission a list of brokers trying to keep the replication group
the brokers belong to balanced.
:param broker_ids: list of string representing valid broker ids in the cluster
:raises: InvalidBrokerIdError when the id is invalid.
... | def function[decommission_brokers, parameter[self, broker_ids]]:
constant[Decommission a list of brokers trying to keep the replication group
the brokers belong to balanced.
:param broker_ids: list of string representing valid broker ids in the cluster
:raises: InvalidBrokerIdError when... | keyword[def] identifier[decommission_brokers] ( identifier[self] , identifier[broker_ids] ):
literal[string]
identifier[groups] = identifier[set] ()
keyword[for] identifier[b_id] keyword[in] identifier[broker_ids] :
keyword[try] :
identifier[broker] = ident... | def decommission_brokers(self, broker_ids):
"""Decommission a list of brokers trying to keep the replication group
the brokers belong to balanced.
:param broker_ids: list of string representing valid broker ids in the cluster
:raises: InvalidBrokerIdError when the id is invalid.
"""... |
def success(text):
'''Display a success message'''
print(' '.join((green('✔'), white(text))))
sys.stdout.flush() | def function[success, parameter[text]]:
constant[Display a success message]
call[name[print], parameter[call[constant[ ].join, parameter[tuple[[<ast.Call object at 0x7da18f7209d0>, <ast.Call object at 0x7da18f723be0>]]]]]]
call[name[sys].stdout.flush, parameter[]] | keyword[def] identifier[success] ( identifier[text] ):
literal[string]
identifier[print] ( literal[string] . identifier[join] (( identifier[green] ( literal[string] ), identifier[white] ( identifier[text] ))))
identifier[sys] . identifier[stdout] . identifier[flush] () | def success(text):
"""Display a success message"""
print(' '.join((green('✔'), white(text))))
sys.stdout.flush() |
def get_cytoBand_hg19(self):
""" Get UCSC cytoBand table for Build 37.
Returns
-------
pandas.DataFrame
cytoBand table if loading was successful, else None
"""
if self._cytoBand_hg19 is None:
self._cytoBand_hg19 = self._load_cytoBand(self._get_pat... | def function[get_cytoBand_hg19, parameter[self]]:
constant[ Get UCSC cytoBand table for Build 37.
Returns
-------
pandas.DataFrame
cytoBand table if loading was successful, else None
]
if compare[name[self]._cytoBand_hg19 is constant[None]] begin[:]
... | keyword[def] identifier[get_cytoBand_hg19] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_cytoBand_hg19] keyword[is] keyword[None] :
identifier[self] . identifier[_cytoBand_hg19] = identifier[self] . identifier[_load_cytoBand] ( identifier[self] . i... | def get_cytoBand_hg19(self):
""" Get UCSC cytoBand table for Build 37.
Returns
-------
pandas.DataFrame
cytoBand table if loading was successful, else None
"""
if self._cytoBand_hg19 is None:
self._cytoBand_hg19 = self._load_cytoBand(self._get_path_cytoBand_h... |
def _get_cache_key(self, obj):
"""Derive cache key for given object."""
if obj is not None:
# Make sure that key is REALLY unique.
return '{}-{}'.format(id(self), obj.pk)
return "{}-None".format(id(self)) | def function[_get_cache_key, parameter[self, obj]]:
constant[Derive cache key for given object.]
if compare[name[obj] is_not constant[None]] begin[:]
return[call[constant[{}-{}].format, parameter[call[name[id], parameter[name[self]]], name[obj].pk]]]
return[call[constant[{}-None].format, par... | keyword[def] identifier[_get_cache_key] ( identifier[self] , identifier[obj] ):
literal[string]
keyword[if] identifier[obj] keyword[is] keyword[not] keyword[None] :
keyword[return] literal[string] . identifier[format] ( identifier[id] ( identifier[self] ), identifier[obj]... | def _get_cache_key(self, obj):
"""Derive cache key for given object."""
if obj is not None:
# Make sure that key is REALLY unique.
return '{}-{}'.format(id(self), obj.pk) # depends on [control=['if'], data=['obj']]
return '{}-None'.format(id(self)) |
def TryLink( self, text, extension ):
"""Compiles the program given in text to an executable env.Program,
using extension as file extension (e.g. '.c'). Returns 1, if
compilation was successful, 0 otherwise. The target is saved in
self.lastTarget (for further processing).
"""
... | def function[TryLink, parameter[self, text, extension]]:
constant[Compiles the program given in text to an executable env.Program,
using extension as file extension (e.g. '.c'). Returns 1, if
compilation was successful, 0 otherwise. The target is saved in
self.lastTarget (for further pro... | keyword[def] identifier[TryLink] ( identifier[self] , identifier[text] , identifier[extension] ):
literal[string]
keyword[return] identifier[self] . identifier[TryBuild] ( identifier[self] . identifier[env] . identifier[Program] , identifier[text] , identifier[extension] ) | def TryLink(self, text, extension):
"""Compiles the program given in text to an executable env.Program,
using extension as file extension (e.g. '.c'). Returns 1, if
compilation was successful, 0 otherwise. The target is saved in
self.lastTarget (for further processing).
"""
retur... |
def set_is_playable(self, is_playable):
'''Sets the listitem's playable flag'''
value = 'false'
if is_playable:
value = 'true'
self.set_property('isPlayable', value)
self.is_folder = not is_playable | def function[set_is_playable, parameter[self, is_playable]]:
constant[Sets the listitem's playable flag]
variable[value] assign[=] constant[false]
if name[is_playable] begin[:]
variable[value] assign[=] constant[true]
call[name[self].set_property, parameter[constant[isPla... | keyword[def] identifier[set_is_playable] ( identifier[self] , identifier[is_playable] ):
literal[string]
identifier[value] = literal[string]
keyword[if] identifier[is_playable] :
identifier[value] = literal[string]
identifier[self] . identifier[set_property] ( lite... | def set_is_playable(self, is_playable):
"""Sets the listitem's playable flag"""
value = 'false'
if is_playable:
value = 'true' # depends on [control=['if'], data=[]]
self.set_property('isPlayable', value)
self.is_folder = not is_playable |
def collect(self, *keys, **kwargs):
"""Generator function traversing
tree structure to collect values of a specified key.
:param keys: the keys to look for in the report
:type key: str
:keyword recursive: look for key in children nodes
:type recursive: bool
:keyw... | def function[collect, parameter[self]]:
constant[Generator function traversing
tree structure to collect values of a specified key.
:param keys: the keys to look for in the report
:type key: str
:keyword recursive: look for key in children nodes
:type recursive: bool
... | keyword[def] identifier[collect] ( identifier[self] ,* identifier[keys] ,** identifier[kwargs] ):
literal[string]
keyword[if] keyword[not] identifier[keys] :
keyword[raise] identifier[Exception] ( literal[string] )
identifier[has_values] = identifier[functools] . identifier... | def collect(self, *keys, **kwargs):
"""Generator function traversing
tree structure to collect values of a specified key.
:param keys: the keys to look for in the report
:type key: str
:keyword recursive: look for key in children nodes
:type recursive: bool
:keyword ... |
def get_zones(self):
"""
Get all zones
"""
home_data = self.get_home()
if not home_data['isSuccess']:
return []
zones = []
for receiver in home_data['data']['receivers']:
for zone in receiver['zones']:
zones.append(zone)
... | def function[get_zones, parameter[self]]:
constant[
Get all zones
]
variable[home_data] assign[=] call[name[self].get_home, parameter[]]
if <ast.UnaryOp object at 0x7da18f58d990> begin[:]
return[list[[]]]
variable[zones] assign[=] list[[]]
for taget[name[r... | keyword[def] identifier[get_zones] ( identifier[self] ):
literal[string]
identifier[home_data] = identifier[self] . identifier[get_home] ()
keyword[if] keyword[not] identifier[home_data] [ literal[string] ]:
keyword[return] []
identifier[zones] =[]
keywor... | def get_zones(self):
"""
Get all zones
"""
home_data = self.get_home()
if not home_data['isSuccess']:
return [] # depends on [control=['if'], data=[]]
zones = []
for receiver in home_data['data']['receivers']:
for zone in receiver['zones']:
zones.append(z... |
def cublasDestroy(handle):
"""
Release CUBLAS resources.
Releases hardware resources used by CUBLAS.
Parameters
----------
handle : void_p
CUBLAS context.
"""
status = _libcublas.cublasDestroy_v2(ctypes.c_void_p(handle))
cublasCheckStatus(status) | def function[cublasDestroy, parameter[handle]]:
constant[
Release CUBLAS resources.
Releases hardware resources used by CUBLAS.
Parameters
----------
handle : void_p
CUBLAS context.
]
variable[status] assign[=] call[name[_libcublas].cublasDestroy_v2, parameter[... | keyword[def] identifier[cublasDestroy] ( identifier[handle] ):
literal[string]
identifier[status] = identifier[_libcublas] . identifier[cublasDestroy_v2] ( identifier[ctypes] . identifier[c_void_p] ( identifier[handle] ))
identifier[cublasCheckStatus] ( identifier[status] ) | def cublasDestroy(handle):
"""
Release CUBLAS resources.
Releases hardware resources used by CUBLAS.
Parameters
----------
handle : void_p
CUBLAS context.
"""
status = _libcublas.cublasDestroy_v2(ctypes.c_void_p(handle))
cublasCheckStatus(status) |
def _translate_special_values(self, obj_to_translate):
"""
you may want to write plugins for values which are not known before build:
e.g. id of built image, base image name,... this method will therefore
translate some reserved values to the runtime values
"""
translatio... | def function[_translate_special_values, parameter[self, obj_to_translate]]:
constant[
you may want to write plugins for values which are not known before build:
e.g. id of built image, base image name,... this method will therefore
translate some reserved values to the runtime values
... | keyword[def] identifier[_translate_special_values] ( identifier[self] , identifier[obj_to_translate] ):
literal[string]
identifier[translation_dict] ={
literal[string] : identifier[self] . identifier[workflow] . identifier[builder] . identifier[image_id] ,
literal[string] : identi... | def _translate_special_values(self, obj_to_translate):
"""
you may want to write plugins for values which are not known before build:
e.g. id of built image, base image name,... this method will therefore
translate some reserved values to the runtime values
"""
translation_dict =... |
def add_tip(self, tip_length) -> None:
"""
Add a tip to the pipette for position tracking and validation
(effectively updates the pipette's critical point)
:param tip_length: a positive, non-zero float representing the distance
in Z from the end of the pipette nozzle to the ... | def function[add_tip, parameter[self, tip_length]]:
constant[
Add a tip to the pipette for position tracking and validation
(effectively updates the pipette's critical point)
:param tip_length: a positive, non-zero float representing the distance
in Z from the end of the pip... | keyword[def] identifier[add_tip] ( identifier[self] , identifier[tip_length] )-> keyword[None] :
literal[string]
keyword[assert] identifier[tip_length] > literal[int] , literal[string]
keyword[assert] keyword[not] identifier[self] . identifier[has_tip]
identifier[self] . iden... | def add_tip(self, tip_length) -> None:
"""
Add a tip to the pipette for position tracking and validation
(effectively updates the pipette's critical point)
:param tip_length: a positive, non-zero float representing the distance
in Z from the end of the pipette nozzle to the end ... |
def expandf(m, format): # noqa A002
"""Expand the string using the format replace pattern or function."""
_assert_expandable(format, True)
return _apply_replace_backrefs(m, format, flags=FORMAT) | def function[expandf, parameter[m, format]]:
constant[Expand the string using the format replace pattern or function.]
call[name[_assert_expandable], parameter[name[format], constant[True]]]
return[call[name[_apply_replace_backrefs], parameter[name[m], name[format]]]] | keyword[def] identifier[expandf] ( identifier[m] , identifier[format] ):
literal[string]
identifier[_assert_expandable] ( identifier[format] , keyword[True] )
keyword[return] identifier[_apply_replace_backrefs] ( identifier[m] , identifier[format] , identifier[flags] = identifier[FORMAT] ) | def expandf(m, format): # noqa A002
'Expand the string using the format replace pattern or function.'
_assert_expandable(format, True)
return _apply_replace_backrefs(m, format, flags=FORMAT) |
def transform_parallel(self, data: List[str]) -> List[List[int]]:
"""
Transform List of documents into List[List[int]]. Uses process based
threading on all available cores. If only processing a small number of
documents ( < 10k ) then consider using the method `transform` instead.
... | def function[transform_parallel, parameter[self, data]]:
constant[
Transform List of documents into List[List[int]]. Uses process based
threading on all available cores. If only processing a small number of
documents ( < 10k ) then consider using the method `transform` instead.
... | keyword[def] identifier[transform_parallel] ( identifier[self] , identifier[data] : identifier[List] [ identifier[str] ])-> identifier[List] [ identifier[List] [ identifier[int] ]]:
literal[string]
identifier[logging] . identifier[warning] ( literal[string] )
identifier[tokenized_data] = i... | def transform_parallel(self, data: List[str]) -> List[List[int]]:
"""
Transform List of documents into List[List[int]]. Uses process based
threading on all available cores. If only processing a small number of
documents ( < 10k ) then consider using the method `transform` instead.
... |
def intersectingPoint(self, p):
"""
given a point, get intervals in the tree that are intersected.
:param p: intersection point
:return: the list of intersected intervals
"""
# perfect match
if p == self.data.mid:
return self.data.ends
if p > self.data.mid:
# we know all in... | def function[intersectingPoint, parameter[self, p]]:
constant[
given a point, get intervals in the tree that are intersected.
:param p: intersection point
:return: the list of intersected intervals
]
if compare[name[p] equal[==] name[self].data.mid] begin[:]
return[name[self].da... | keyword[def] identifier[intersectingPoint] ( identifier[self] , identifier[p] ):
literal[string]
keyword[if] identifier[p] == identifier[self] . identifier[data] . identifier[mid] :
keyword[return] identifier[self] . identifier[data] . identifier[ends]
keyword[if] identifier[p] > iden... | def intersectingPoint(self, p):
"""
given a point, get intervals in the tree that are intersected.
:param p: intersection point
:return: the list of intersected intervals
"""
# perfect match
if p == self.data.mid:
return self.data.ends # depends on [control=['if'], data=[]]
if ... |
def create_url_adapter(self, request: Optional[BaseRequestWebsocket]) -> Optional[MapAdapter]:
"""Create and return a URL adapter.
This will create the adapter based on the request if present
otherwise the app configuration.
"""
if request is not None:
host = request... | def function[create_url_adapter, parameter[self, request]]:
constant[Create and return a URL adapter.
This will create the adapter based on the request if present
otherwise the app configuration.
]
if compare[name[request] is_not constant[None]] begin[:]
variable... | keyword[def] identifier[create_url_adapter] ( identifier[self] , identifier[request] : identifier[Optional] [ identifier[BaseRequestWebsocket] ])-> identifier[Optional] [ identifier[MapAdapter] ]:
literal[string]
keyword[if] identifier[request] keyword[is] keyword[not] keyword[None] :
... | def create_url_adapter(self, request: Optional[BaseRequestWebsocket]) -> Optional[MapAdapter]:
"""Create and return a URL adapter.
This will create the adapter based on the request if present
otherwise the app configuration.
"""
if request is not None:
host = request.host
... |
def apply(self, func, *args, **kwargs):
"""Apply the provided function and combine the results together in the
same way as apply from groupby in pandas.
This returns a DataFrame.
"""
self._prep_pandas_groupby()
def key_by_index(data):
"""Key each row by its ... | def function[apply, parameter[self, func]]:
constant[Apply the provided function and combine the results together in the
same way as apply from groupby in pandas.
This returns a DataFrame.
]
call[name[self]._prep_pandas_groupby, parameter[]]
def function[key_by_index, pa... | keyword[def] identifier[apply] ( identifier[self] , identifier[func] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[self] . identifier[_prep_pandas_groupby] ()
keyword[def] identifier[key_by_index] ( identifier[data] ):
literal[string]
... | def apply(self, func, *args, **kwargs):
"""Apply the provided function and combine the results together in the
same way as apply from groupby in pandas.
This returns a DataFrame.
"""
self._prep_pandas_groupby()
def key_by_index(data):
"""Key each row by its index.
... |
def calcEL(self,**kwargs):
"""
NAME:
calcEL
PURPOSE:
calculate the energy and angular momentum
INPUT:
scipy.integrate.quadrature keywords
OUTPUT:
(E,L)
HISTORY:
2012-07-26 - Written - Bovy (IAS)
""" ... | def function[calcEL, parameter[self]]:
constant[
NAME:
calcEL
PURPOSE:
calculate the energy and angular momentum
INPUT:
scipy.integrate.quadrature keywords
OUTPUT:
(E,L)
HISTORY:
2012-07-26 - Written - Bovy (IAS)
... | keyword[def] identifier[calcEL] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[E] , identifier[L] = identifier[calcELAxi] ( identifier[self] . identifier[_R] , identifier[self] . identifier[_vR] , identifier[self] . identifier[_vT] , identifier[self] . identifier[_pot] )
... | def calcEL(self, **kwargs):
"""
NAME:
calcEL
PURPOSE:
calculate the energy and angular momentum
INPUT:
scipy.integrate.quadrature keywords
OUTPUT:
(E,L)
HISTORY:
2012-07-26 - Written - Bovy (IAS)
"""
(E, L) = ... |
def output(self):
"""Rank 3 array representing output time series. Axis 0 is time,
axis 1 ranges across output variables of a single simulation,
axis 2 ranges across different simulation instances."""
subts = [s.output for s in self.sims]
sub_ndim = subts[0].ndim
if sub... | def function[output, parameter[self]]:
constant[Rank 3 array representing output time series. Axis 0 is time,
axis 1 ranges across output variables of a single simulation,
axis 2 ranges across different simulation instances.]
variable[subts] assign[=] <ast.ListComp object at 0x7da20434... | keyword[def] identifier[output] ( identifier[self] ):
literal[string]
identifier[subts] =[ identifier[s] . identifier[output] keyword[for] identifier[s] keyword[in] identifier[self] . identifier[sims] ]
identifier[sub_ndim] = identifier[subts] [ literal[int] ]. identifier[ndim]
... | def output(self):
"""Rank 3 array representing output time series. Axis 0 is time,
axis 1 ranges across output variables of a single simulation,
axis 2 ranges across different simulation instances."""
subts = [s.output for s in self.sims]
sub_ndim = subts[0].ndim
if sub_ndim is 1:
... |
def wait_until_text_contains(self, locator, text, timeout=None):
"""
Waits for an element's text to contain <text>
@type locator: webdriverwrapper.support.locator.Locator
@param locator: locator used to find element
@type text: str
@param tex... | def function[wait_until_text_contains, parameter[self, locator, text, timeout]]:
constant[
Waits for an element's text to contain <text>
@type locator: webdriverwrapper.support.locator.Locator
@param locator: locator used to find element
@type text: ... | keyword[def] identifier[wait_until_text_contains] ( identifier[self] , identifier[locator] , identifier[text] , identifier[timeout] = keyword[None] ):
literal[string]
identifier[timeout] = identifier[timeout] keyword[if] identifier[timeout] keyword[is] keyword[not] keyword[None] keyword[else]... | def wait_until_text_contains(self, locator, text, timeout=None):
"""
Waits for an element's text to contain <text>
@type locator: webdriverwrapper.support.locator.Locator
@param locator: locator used to find element
@type text: str
@param text: ... |
def transform_data(self, data):
"""Apply pre-processing transformation to data, and add it to data
dict.
Parameters
---------
data : instance of Segments
segments including 'data' (ChanTime)
Returns
-------
instance of Segments
sa... | def function[transform_data, parameter[self, data]]:
constant[Apply pre-processing transformation to data, and add it to data
dict.
Parameters
---------
data : instance of Segments
segments including 'data' (ChanTime)
Returns
-------
instance... | keyword[def] identifier[transform_data] ( identifier[self] , identifier[data] ):
literal[string]
identifier[trans] = identifier[self] . identifier[trans]
identifier[differ] = identifier[trans] [ literal[string] ]. identifier[get_value] ()
identifier[bandpass] = identifier[trans] ... | def transform_data(self, data):
"""Apply pre-processing transformation to data, and add it to data
dict.
Parameters
---------
data : instance of Segments
segments including 'data' (ChanTime)
Returns
-------
instance of Segments
same o... |
def merge_graphs(self, other_docgraph, verbose=False):
"""
Merges another document graph into the current one, thereby adding all
the necessary nodes and edges (with attributes, layers etc.).
NOTE: This will only work if both graphs have exactly the same
tokenization.
""... | def function[merge_graphs, parameter[self, other_docgraph, verbose]]:
constant[
Merges another document graph into the current one, thereby adding all
the necessary nodes and edges (with attributes, layers etc.).
NOTE: This will only work if both graphs have exactly the same
tok... | keyword[def] identifier[merge_graphs] ( identifier[self] , identifier[other_docgraph] , identifier[verbose] = keyword[False] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[self] , literal[string] ):
identifier[self] . identifier[merged_rootnodes] . i... | def merge_graphs(self, other_docgraph, verbose=False):
"""
Merges another document graph into the current one, thereby adding all
the necessary nodes and edges (with attributes, layers etc.).
NOTE: This will only work if both graphs have exactly the same
tokenization.
"""
... |
def request(self, path, method='GET', params=None, type=REST_TYPE):
"""Builds a request, gets a response and decodes it."""
response_text = self._get_http_client(type).request(path, method, params)
if not response_text:
return response_text
response_json = json.loads(respon... | def function[request, parameter[self, path, method, params, type]]:
constant[Builds a request, gets a response and decodes it.]
variable[response_text] assign[=] call[call[name[self]._get_http_client, parameter[name[type]]].request, parameter[name[path], name[method], name[params]]]
if <ast.Unar... | keyword[def] identifier[request] ( identifier[self] , identifier[path] , identifier[method] = literal[string] , identifier[params] = keyword[None] , identifier[type] = identifier[REST_TYPE] ):
literal[string]
identifier[response_text] = identifier[self] . identifier[_get_http_client] ( identifier[t... | def request(self, path, method='GET', params=None, type=REST_TYPE):
"""Builds a request, gets a response and decodes it."""
response_text = self._get_http_client(type).request(path, method, params)
if not response_text:
return response_text # depends on [control=['if'], data=[]]
response_json =... |
def search(self, query, subreddit=None, sort=None, syntax=None,
period=None, *args, **kwargs):
"""Return a generator for submissions that match the search query.
:param query: The query string to search for. If query is a URL only
submissions which link to that URL will be re... | def function[search, parameter[self, query, subreddit, sort, syntax, period]]:
constant[Return a generator for submissions that match the search query.
:param query: The query string to search for. If query is a URL only
submissions which link to that URL will be returned.
:param su... | keyword[def] identifier[search] ( identifier[self] , identifier[query] , identifier[subreddit] = keyword[None] , identifier[sort] = keyword[None] , identifier[syntax] = keyword[None] ,
identifier[period] = keyword[None] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[param... | def search(self, query, subreddit=None, sort=None, syntax=None, period=None, *args, **kwargs):
"""Return a generator for submissions that match the search query.
:param query: The query string to search for. If query is a URL only
submissions which link to that URL will be returned.
:pa... |
def DEFINE_float(self, name, default, help, constant=False):
"""A helper for defining float options."""
self.AddOption(
type_info.Float(name=name, default=default, description=help),
constant=constant) | def function[DEFINE_float, parameter[self, name, default, help, constant]]:
constant[A helper for defining float options.]
call[name[self].AddOption, parameter[call[name[type_info].Float, parameter[]]]] | keyword[def] identifier[DEFINE_float] ( identifier[self] , identifier[name] , identifier[default] , identifier[help] , identifier[constant] = keyword[False] ):
literal[string]
identifier[self] . identifier[AddOption] (
identifier[type_info] . identifier[Float] ( identifier[name] = identifier[name] , i... | def DEFINE_float(self, name, default, help, constant=False):
"""A helper for defining float options."""
self.AddOption(type_info.Float(name=name, default=default, description=help), constant=constant) |
def http_proxy(self, proxy, proxy_port, user=None, password=None):
"""
.. versionadded:: 0.5.7
Requires SMC and engine version >= 6.4
Set http proxy settings for Antivirus updates.
:param str proxy: proxy IP address
:param str,int proxy_port: proxy p... | def function[http_proxy, parameter[self, proxy, proxy_port, user, password]]:
constant[
.. versionadded:: 0.5.7
Requires SMC and engine version >= 6.4
Set http proxy settings for Antivirus updates.
:param str proxy: proxy IP address
:param str,int pr... | keyword[def] identifier[http_proxy] ( identifier[self] , identifier[proxy] , identifier[proxy_port] , identifier[user] = keyword[None] , identifier[password] = keyword[None] ):
literal[string]
identifier[self] . identifier[update] (
identifier[antivirus_http_proxy] = identifier[proxy] ,
... | def http_proxy(self, proxy, proxy_port, user=None, password=None):
"""
.. versionadded:: 0.5.7
Requires SMC and engine version >= 6.4
Set http proxy settings for Antivirus updates.
:param str proxy: proxy IP address
:param str,int proxy_port: proxy port
... |
def available_dataset_names(self, reader_name=None, composites=False):
"""Get the list of the names of the available datasets."""
return sorted(set(x.name for x in self.available_dataset_ids(
reader_name=reader_name, composites=composites))) | def function[available_dataset_names, parameter[self, reader_name, composites]]:
constant[Get the list of the names of the available datasets.]
return[call[name[sorted], parameter[call[name[set], parameter[<ast.GeneratorExp object at 0x7da1b1d8d4e0>]]]]] | keyword[def] identifier[available_dataset_names] ( identifier[self] , identifier[reader_name] = keyword[None] , identifier[composites] = keyword[False] ):
literal[string]
keyword[return] identifier[sorted] ( identifier[set] ( identifier[x] . identifier[name] keyword[for] identifier[x] keyword[i... | def available_dataset_names(self, reader_name=None, composites=False):
"""Get the list of the names of the available datasets."""
return sorted(set((x.name for x in self.available_dataset_ids(reader_name=reader_name, composites=composites)))) |
def check_user_can_view_comments(user_info, recid):
"""Check if the user is authorized to view comments for given
recid.
Returns the same type as acc_authorize_action
"""
# Check user can view the record itself first
(auth_code, auth_msg) = check_user_can_view_record(user_info, recid)
if au... | def function[check_user_can_view_comments, parameter[user_info, recid]]:
constant[Check if the user is authorized to view comments for given
recid.
Returns the same type as acc_authorize_action
]
<ast.Tuple object at 0x7da204620a90> assign[=] call[name[check_user_can_view_record], parameter... | keyword[def] identifier[check_user_can_view_comments] ( identifier[user_info] , identifier[recid] ):
literal[string]
( identifier[auth_code] , identifier[auth_msg] )= identifier[check_user_can_view_record] ( identifier[user_info] , identifier[recid] )
keyword[if] identifier[auth_code] :
... | def check_user_can_view_comments(user_info, recid):
"""Check if the user is authorized to view comments for given
recid.
Returns the same type as acc_authorize_action
"""
# Check user can view the record itself first
(auth_code, auth_msg) = check_user_can_view_record(user_info, recid)
if au... |
def _encode_datetime(self, dt):
"""Encode a datetime in the format '%Y-%m-%dT%H:%M:%SZ'.
The datetime can be naieve (doesn't have timezone info) or aware
(it does have a tzinfo attribute set). Regardless, the datetime
is transformed into UTC.
"""
if dt.tzinfo is None:
... | def function[_encode_datetime, parameter[self, dt]]:
constant[Encode a datetime in the format '%Y-%m-%dT%H:%M:%SZ'.
The datetime can be naieve (doesn't have timezone info) or aware
(it does have a tzinfo attribute set). Regardless, the datetime
is transformed into UTC.
]
... | keyword[def] identifier[_encode_datetime] ( identifier[self] , identifier[dt] ):
literal[string]
keyword[if] identifier[dt] . identifier[tzinfo] keyword[is] keyword[None] :
identifier[dt] = identifier[dt] . identifier[replace] ( identifier[tzinfo] = identifier[datetime] . i... | def _encode_datetime(self, dt):
"""Encode a datetime in the format '%Y-%m-%dT%H:%M:%SZ'.
The datetime can be naieve (doesn't have timezone info) or aware
(it does have a tzinfo attribute set). Regardless, the datetime
is transformed into UTC.
"""
if dt.tzinfo is None:
# ... |
def create(self, name, backend_router_id, flavor, instances, test=False):
"""Orders a Virtual_ReservedCapacityGroup
:param string name: Name for the new reserved capacity
:param int backend_router_id: This selects the pod. See create_options for a list
:param string flavor: Capacity Key... | def function[create, parameter[self, name, backend_router_id, flavor, instances, test]]:
constant[Orders a Virtual_ReservedCapacityGroup
:param string name: Name for the new reserved capacity
:param int backend_router_id: This selects the pod. See create_options for a list
:param string... | keyword[def] identifier[create] ( identifier[self] , identifier[name] , identifier[backend_router_id] , identifier[flavor] , identifier[instances] , identifier[test] = keyword[False] ):
literal[string]
identifier[args] =( identifier[self] . identifier[capacity_package] , literal[int] ,[ i... | def create(self, name, backend_router_id, flavor, instances, test=False):
"""Orders a Virtual_ReservedCapacityGroup
:param string name: Name for the new reserved capacity
:param int backend_router_id: This selects the pod. See create_options for a list
:param string flavor: Capacity KeyName... |
def get_maven_id(jar_path):
"""Extract Maven coordinates from a given JAR file, if possible.
JARs build by Maven (most popular Java build system) contain
'pom.properties' file. We can extract Maven coordinates
from there.
"""
props = {}
try:
with zip... | def function[get_maven_id, parameter[jar_path]]:
constant[Extract Maven coordinates from a given JAR file, if possible.
JARs build by Maven (most popular Java build system) contain
'pom.properties' file. We can extract Maven coordinates
from there.
]
variable[props] ass... | keyword[def] identifier[get_maven_id] ( identifier[jar_path] ):
literal[string]
identifier[props] ={}
keyword[try] :
keyword[with] identifier[zipfile] . identifier[ZipFile] ( identifier[jar_path] ) keyword[as] identifier[f] :
identifier[r] = identifier[re] .... | def get_maven_id(jar_path):
"""Extract Maven coordinates from a given JAR file, if possible.
JARs build by Maven (most popular Java build system) contain
'pom.properties' file. We can extract Maven coordinates
from there.
"""
props = {}
try:
with zipfile.ZipFile(jar... |
def wp_status(self):
'''show status of wp download'''
try:
print("Have %u of %u waypoints" % (self.wploader.count()+len(self.wp_received), self.wploader.expected_count))
except Exception:
print("Have %u waypoints" % (self.wploader.count()+len(self.wp_received))) | def function[wp_status, parameter[self]]:
constant[show status of wp download]
<ast.Try object at 0x7da18f09ca60> | keyword[def] identifier[wp_status] ( identifier[self] ):
literal[string]
keyword[try] :
identifier[print] ( literal[string] %( identifier[self] . identifier[wploader] . identifier[count] ()+ identifier[len] ( identifier[self] . identifier[wp_received] ), identifier[self] . identifier[w... | def wp_status(self):
"""show status of wp download"""
try:
print('Have %u of %u waypoints' % (self.wploader.count() + len(self.wp_received), self.wploader.expected_count)) # depends on [control=['try'], data=[]]
except Exception:
print('Have %u waypoints' % (self.wploader.count() + len(self... |
def _infer_transform_options(transform):
"""
figure out what transform options should be by examining the provided
regexes for keywords
"""
TransformOptions = collections.namedtuple("TransformOptions",
['CB', 'dual_index', 'triple_index', 'MB', 'SB'])
... | def function[_infer_transform_options, parameter[transform]]:
constant[
figure out what transform options should be by examining the provided
regexes for keywords
]
variable[TransformOptions] assign[=] call[name[collections].namedtuple, parameter[constant[TransformOptions], list[[<ast.Consta... | keyword[def] identifier[_infer_transform_options] ( identifier[transform] ):
literal[string]
identifier[TransformOptions] = identifier[collections] . identifier[namedtuple] ( literal[string] ,
[ literal[string] , literal[string] , literal[string] , literal[string] , literal[string] ])
identifier[C... | def _infer_transform_options(transform):
"""
figure out what transform options should be by examining the provided
regexes for keywords
"""
TransformOptions = collections.namedtuple('TransformOptions', ['CB', 'dual_index', 'triple_index', 'MB', 'SB'])
CB = False
SB = False
MB = False
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.