code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def byte_href_anchors_state_machine(self):
'''
byte-based state machine extractor of anchor tags, so we can
compute byte offsets for anchor texts and associate them with
their href.
Generates tuple(href_string, first_byte, byte_length, anchor_text)
'''
ta... | def function[byte_href_anchors_state_machine, parameter[self]]:
constant[
byte-based state machine extractor of anchor tags, so we can
compute byte offsets for anchor texts and associate them with
their href.
Generates tuple(href_string, first_byte, byte_length, anchor_t... | keyword[def] identifier[byte_href_anchors_state_machine] ( identifier[self] ):
literal[string]
identifier[tag_depth] = literal[int]
identifier[a_tag_depth] = literal[int]
identifier[vals] =[]
identifier[href] = keyword[None]
identifier[idx_bytes] = identifier[... | def byte_href_anchors_state_machine(self):
"""
byte-based state machine extractor of anchor tags, so we can
compute byte offsets for anchor texts and associate them with
their href.
Generates tuple(href_string, first_byte, byte_length, anchor_text)
"""
tag_depth ... |
def checkPortAvailable(ha):
"""Checks whether the given port is available"""
# Not sure why OS would allow binding to one type and not other.
# Checking for port available for TCP and UDP.
sockTypes = (socket.SOCK_DGRAM, socket.SOCK_STREAM)
for typ in sockTypes:
sock = socket.socket(socket.A... | def function[checkPortAvailable, parameter[ha]]:
constant[Checks whether the given port is available]
variable[sockTypes] assign[=] tuple[[<ast.Attribute object at 0x7da1b16c3310>, <ast.Attribute object at 0x7da1b16c08e0>]]
for taget[name[typ]] in starred[name[sockTypes]] begin[:]
... | keyword[def] identifier[checkPortAvailable] ( identifier[ha] ):
literal[string]
identifier[sockTypes] =( identifier[socket] . identifier[SOCK_DGRAM] , identifier[socket] . identifier[SOCK_STREAM] )
keyword[for] identifier[typ] keyword[in] identifier[sockTypes] :
identifier[sock] ... | def checkPortAvailable(ha):
"""Checks whether the given port is available"""
# Not sure why OS would allow binding to one type and not other.
# Checking for port available for TCP and UDP.
sockTypes = (socket.SOCK_DGRAM, socket.SOCK_STREAM)
for typ in sockTypes:
sock = socket.socket(socket.A... |
def get_bytes(self, line_number):
"""Get the bytes representing needle positions or None.
:param int line_number: the line number to take the bytes from
:rtype: bytes
:return: the bytes that represent the message or :obj:`None` if no
data is there for the line.
Depend... | def function[get_bytes, parameter[self, line_number]]:
constant[Get the bytes representing needle positions or None.
:param int line_number: the line number to take the bytes from
:rtype: bytes
:return: the bytes that represent the message or :obj:`None` if no
data is there fo... | keyword[def] identifier[get_bytes] ( identifier[self] , identifier[line_number] ):
literal[string]
keyword[if] identifier[line_number] keyword[not] keyword[in] identifier[self] . identifier[_needle_position_bytes_cache] :
identifier[line] = identifier[self] . identifier[_get] ( ide... | def get_bytes(self, line_number):
"""Get the bytes representing needle positions or None.
:param int line_number: the line number to take the bytes from
:rtype: bytes
:return: the bytes that represent the message or :obj:`None` if no
data is there for the line.
Depending ... |
def load_shapefile(self, feature_type, base_path):
"""Load downloaded shape file to QGIS Main Window.
TODO: This is cut & paste from OSM - refactor to have one method
:param feature_type: What kind of features should be downloaded.
Currently 'buildings', 'building-points' or 'roads... | def function[load_shapefile, parameter[self, feature_type, base_path]]:
constant[Load downloaded shape file to QGIS Main Window.
TODO: This is cut & paste from OSM - refactor to have one method
:param feature_type: What kind of features should be downloaded.
Currently 'buildings', ... | keyword[def] identifier[load_shapefile] ( identifier[self] , identifier[feature_type] , identifier[base_path] ):
literal[string]
identifier[path] = literal[string] % identifier[base_path]
keyword[if] keyword[not] identifier[os] . identifier[path] . identifier[exists] ( identifier[path... | def load_shapefile(self, feature_type, base_path):
"""Load downloaded shape file to QGIS Main Window.
TODO: This is cut & paste from OSM - refactor to have one method
:param feature_type: What kind of features should be downloaded.
Currently 'buildings', 'building-points' or 'roads' ar... |
def any_commaseparatedinteger_field(field, **kwargs):
"""
Return random value for CharField
>>> result = any_field(models.CommaSeparatedIntegerField(max_length=10))
>>> type(result)
<type 'str'>
>>> [int(num) for num in result.split(',')] and 'OK'
'OK'
"""
nums_count = fie... | def function[any_commaseparatedinteger_field, parameter[field]]:
constant[
Return random value for CharField
>>> result = any_field(models.CommaSeparatedIntegerField(max_length=10))
>>> type(result)
<type 'str'>
>>> [int(num) for num in result.split(',')] and 'OK'
'OK'
]
var... | keyword[def] identifier[any_commaseparatedinteger_field] ( identifier[field] ,** identifier[kwargs] ):
literal[string]
identifier[nums_count] = identifier[field] . identifier[max_length] / literal[int]
identifier[nums] =[ identifier[str] ( identifier[xunit] . identifier[any_int] ( identifier[min_v... | def any_commaseparatedinteger_field(field, **kwargs):
"""
Return random value for CharField
>>> result = any_field(models.CommaSeparatedIntegerField(max_length=10))
>>> type(result)
<type 'str'>
>>> [int(num) for num in result.split(',')] and 'OK'
'OK'
"""
nums_count = field.max_len... |
def instance(cls):
"""
Singleton to return only one instance of BaseManager.
:returns: instance of BaseManager
"""
if not hasattr(cls, "_instance") or cls._instance is None:
cls._instance = cls()
return cls._instance | def function[instance, parameter[cls]]:
constant[
Singleton to return only one instance of BaseManager.
:returns: instance of BaseManager
]
if <ast.BoolOp object at 0x7da2044c29e0> begin[:]
name[cls]._instance assign[=] call[name[cls], parameter[]]
return[nam... | keyword[def] identifier[instance] ( identifier[cls] ):
literal[string]
keyword[if] keyword[not] identifier[hasattr] ( identifier[cls] , literal[string] ) keyword[or] identifier[cls] . identifier[_instance] keyword[is] keyword[None] :
identifier[cls] . identifier[_instance] = iden... | def instance(cls):
"""
Singleton to return only one instance of BaseManager.
:returns: instance of BaseManager
"""
if not hasattr(cls, '_instance') or cls._instance is None:
cls._instance = cls() # depends on [control=['if'], data=[]]
return cls._instance |
def portCnt(port):
"""
recursively count number of ports without children
"""
if port.children:
return sum(map(lambda p: portCnt(p), port.children))
else:
return 1 | def function[portCnt, parameter[port]]:
constant[
recursively count number of ports without children
]
if name[port].children begin[:]
return[call[name[sum], parameter[call[name[map], parameter[<ast.Lambda object at 0x7da1b2240910>, name[port].children]]]]] | keyword[def] identifier[portCnt] ( identifier[port] ):
literal[string]
keyword[if] identifier[port] . identifier[children] :
keyword[return] identifier[sum] ( identifier[map] ( keyword[lambda] identifier[p] : identifier[portCnt] ( identifier[p] ), identifier[port] . identifier[children] ))
... | def portCnt(port):
"""
recursively count number of ports without children
"""
if port.children:
return sum(map(lambda p: portCnt(p), port.children)) # depends on [control=['if'], data=[]]
else:
return 1 |
def get_coords(x, y, params):
"""
Transforms the given coordinates from plane-space to Mandelbrot-space (real and imaginary).
:param x: X coordinate on the plane.
:param y: Y coordinate on the plane.
:param params: Current application parameters.
:type params: params.Params
:return: Tuple c... | def function[get_coords, parameter[x, y, params]]:
constant[
Transforms the given coordinates from plane-space to Mandelbrot-space (real and imaginary).
:param x: X coordinate on the plane.
:param y: Y coordinate on the plane.
:param params: Current application parameters.
:type params: par... | keyword[def] identifier[get_coords] ( identifier[x] , identifier[y] , identifier[params] ):
literal[string]
identifier[n_x] = identifier[x] * literal[int] / identifier[params] . identifier[plane_w] * identifier[params] . identifier[plane_ratio] - literal[int]
identifier[n_y] = identifier[y] * literal... | def get_coords(x, y, params):
"""
Transforms the given coordinates from plane-space to Mandelbrot-space (real and imaginary).
:param x: X coordinate on the plane.
:param y: Y coordinate on the plane.
:param params: Current application parameters.
:type params: params.Params
:return: Tuple c... |
def resolve_links(self, link_resolver):
"""
Banana banana
"""
self.type_link = None
self.type_tokens = []
for child in self.get_children_symbols():
child.resolve_links(link_resolver)
for tok in self.input_tokens:
if isinstance(tok, Link):... | def function[resolve_links, parameter[self, link_resolver]]:
constant[
Banana banana
]
name[self].type_link assign[=] constant[None]
name[self].type_tokens assign[=] list[[]]
for taget[name[child]] in starred[call[name[self].get_children_symbols, parameter[]]] begin[:]
... | keyword[def] identifier[resolve_links] ( identifier[self] , identifier[link_resolver] ):
literal[string]
identifier[self] . identifier[type_link] = keyword[None]
identifier[self] . identifier[type_tokens] =[]
keyword[for] identifier[child] keyword[in] identifier[self] . ident... | def resolve_links(self, link_resolver):
"""
Banana banana
"""
self.type_link = None
self.type_tokens = []
for child in self.get_children_symbols():
child.resolve_links(link_resolver) # depends on [control=['for'], data=['child']]
for tok in self.input_tokens:
if isin... |
def update_position(self):
'''update position text'''
state = self.state
pos = self.mouse_pos
newtext = ''
alt = 0
if pos is not None:
(lat,lon) = self.coordinates(pos.x, pos.y)
newtext += 'Cursor: %f %f (%s)' % (lat, lon, mp_util.latlon_to_grid((l... | def function[update_position, parameter[self]]:
constant[update position text]
variable[state] assign[=] name[self].state
variable[pos] assign[=] name[self].mouse_pos
variable[newtext] assign[=] constant[]
variable[alt] assign[=] constant[0]
if compare[name[pos] is_not co... | keyword[def] identifier[update_position] ( identifier[self] ):
literal[string]
identifier[state] = identifier[self] . identifier[state]
identifier[pos] = identifier[self] . identifier[mouse_pos]
identifier[newtext] = literal[string]
identifier[alt] = literal[int]
... | def update_position(self):
"""update position text"""
state = self.state
pos = self.mouse_pos
newtext = ''
alt = 0
if pos is not None:
(lat, lon) = self.coordinates(pos.x, pos.y)
newtext += 'Cursor: %f %f (%s)' % (lat, lon, mp_util.latlon_to_grid((lat, lon)))
if state.ele... |
def draw_text(self, content):
"""Draws text cell content to context"""
wx2pango_alignment = {
"left": pango.ALIGN_LEFT,
"center": pango.ALIGN_CENTER,
"right": pango.ALIGN_RIGHT,
}
cell_attributes = self.code_array.cell_attributes[self.key]
a... | def function[draw_text, parameter[self, content]]:
constant[Draws text cell content to context]
variable[wx2pango_alignment] assign[=] dictionary[[<ast.Constant object at 0x7da1b1543dc0>, <ast.Constant object at 0x7da1b1543d90>, <ast.Constant object at 0x7da1b1543d60>], [<ast.Attribute object at 0x7da1b... | keyword[def] identifier[draw_text] ( identifier[self] , identifier[content] ):
literal[string]
identifier[wx2pango_alignment] ={
literal[string] : identifier[pango] . identifier[ALIGN_LEFT] ,
literal[string] : identifier[pango] . identifier[ALIGN_CENTER] ,
literal[string... | def draw_text(self, content):
"""Draws text cell content to context"""
wx2pango_alignment = {'left': pango.ALIGN_LEFT, 'center': pango.ALIGN_CENTER, 'right': pango.ALIGN_RIGHT}
cell_attributes = self.code_array.cell_attributes[self.key]
angle = cell_attributes['angle']
if angle in [-90, 90]:
... |
def get_axis_grid(self, ind):
"""
Returns the grid for a particular axis.
Args:
ind (int): Axis index.
"""
ng = self.dim
num_pts = ng[ind]
lengths = self.structure.lattice.abc
return [i / num_pts * lengths[ind] for i in range(num_pts)] | def function[get_axis_grid, parameter[self, ind]]:
constant[
Returns the grid for a particular axis.
Args:
ind (int): Axis index.
]
variable[ng] assign[=] name[self].dim
variable[num_pts] assign[=] call[name[ng]][name[ind]]
variable[lengths] assign[=]... | keyword[def] identifier[get_axis_grid] ( identifier[self] , identifier[ind] ):
literal[string]
identifier[ng] = identifier[self] . identifier[dim]
identifier[num_pts] = identifier[ng] [ identifier[ind] ]
identifier[lengths] = identifier[self] . identifier[structure] . identifier[... | def get_axis_grid(self, ind):
"""
Returns the grid for a particular axis.
Args:
ind (int): Axis index.
"""
ng = self.dim
num_pts = ng[ind]
lengths = self.structure.lattice.abc
return [i / num_pts * lengths[ind] for i in range(num_pts)] |
def create_folder(dirpath, overwrite=False):
""" Will create dirpath folder. If dirpath already exists and overwrite is False,
will append a '+' suffix to dirpath until dirpath does not exist."""
if not overwrite:
while op.exists(dirpath):
dirpath += '+'
os.m... | def function[create_folder, parameter[dirpath, overwrite]]:
constant[ Will create dirpath folder. If dirpath already exists and overwrite is False,
will append a '+' suffix to dirpath until dirpath does not exist.]
if <ast.UnaryOp object at 0x7da1afe39540> begin[:]
while call[nam... | keyword[def] identifier[create_folder] ( identifier[dirpath] , identifier[overwrite] = keyword[False] ):
literal[string]
keyword[if] keyword[not] identifier[overwrite] :
keyword[while] identifier[op] . identifier[exists] ( identifier[dirpath] ):
identifier[dirpath] ... | def create_folder(dirpath, overwrite=False):
""" Will create dirpath folder. If dirpath already exists and overwrite is False,
will append a '+' suffix to dirpath until dirpath does not exist."""
if not overwrite:
while op.exists(dirpath):
dirpath += '+' # depends on [control=['whil... |
def scs2e(sc, sclkch):
"""
Convert a spacecraft clock string to ephemeris seconds past J2000 (ET).
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/scs2e_c.html
:param sc: NAIF integer code for a spacecraft.
:type sc: int
:param sclkch: An SCLK string.
:type sclkch: str
:return:... | def function[scs2e, parameter[sc, sclkch]]:
constant[
Convert a spacecraft clock string to ephemeris seconds past J2000 (ET).
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/scs2e_c.html
:param sc: NAIF integer code for a spacecraft.
:type sc: int
:param sclkch: An SCLK string.
... | keyword[def] identifier[scs2e] ( identifier[sc] , identifier[sclkch] ):
literal[string]
identifier[sc] = identifier[ctypes] . identifier[c_int] ( identifier[sc] )
identifier[sclkch] = identifier[stypes] . identifier[stringToCharP] ( identifier[sclkch] )
identifier[et] = identifier[ctypes] . ident... | def scs2e(sc, sclkch):
"""
Convert a spacecraft clock string to ephemeris seconds past J2000 (ET).
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/scs2e_c.html
:param sc: NAIF integer code for a spacecraft.
:type sc: int
:param sclkch: An SCLK string.
:type sclkch: str
:return:... |
def as_cache_key(self, ireq):
"""
Given a requirement, return its cache key. This behavior is a little weird in order to allow backwards
compatibility with cache files. For a requirement without extras, this will return, for example:
("ipython", "2.1.0")
For a requirement with ... | def function[as_cache_key, parameter[self, ireq]]:
constant[
Given a requirement, return its cache key. This behavior is a little weird in order to allow backwards
compatibility with cache files. For a requirement without extras, this will return, for example:
("ipython", "2.1.0")
... | keyword[def] identifier[as_cache_key] ( identifier[self] , identifier[ireq] ):
literal[string]
identifier[name] , identifier[version] , identifier[extras] = identifier[as_tuple] ( identifier[ireq] )
keyword[if] keyword[not] identifier[extras] :
identifier[extras_string] = li... | def as_cache_key(self, ireq):
"""
Given a requirement, return its cache key. This behavior is a little weird in order to allow backwards
compatibility with cache files. For a requirement without extras, this will return, for example:
("ipython", "2.1.0")
For a requirement with extr... |
def get_developer_package(path, format=None):
"""Create a developer package.
Args:
path (str): Path to dir containing package definition file.
format (str): Package definition file format, detected if None.
Returns:
`DeveloperPackage`.
"""
from rez.developer_package import ... | def function[get_developer_package, parameter[path, format]]:
constant[Create a developer package.
Args:
path (str): Path to dir containing package definition file.
format (str): Package definition file format, detected if None.
Returns:
`DeveloperPackage`.
]
from relat... | keyword[def] identifier[get_developer_package] ( identifier[path] , identifier[format] = keyword[None] ):
literal[string]
keyword[from] identifier[rez] . identifier[developer_package] keyword[import] identifier[DeveloperPackage]
keyword[return] identifier[DeveloperPackage] . identifier[from_path]... | def get_developer_package(path, format=None):
"""Create a developer package.
Args:
path (str): Path to dir containing package definition file.
format (str): Package definition file format, detected if None.
Returns:
`DeveloperPackage`.
"""
from rez.developer_package import ... |
def check_time(self):
""" Make sure our Honeypot time is consistent, and not too far off
from the actual time. """
poll = self.config['timecheck']['poll']
ntp_poll = self.config['timecheck']['ntp_pool']
while True:
clnt = ntplib.NTPClient()
try:
... | def function[check_time, parameter[self]]:
constant[ Make sure our Honeypot time is consistent, and not too far off
from the actual time. ]
variable[poll] assign[=] call[call[name[self].config][constant[timecheck]]][constant[poll]]
variable[ntp_poll] assign[=] call[call[name[self].config... | keyword[def] identifier[check_time] ( identifier[self] ):
literal[string]
identifier[poll] = identifier[self] . identifier[config] [ literal[string] ][ literal[string] ]
identifier[ntp_poll] = identifier[self] . identifier[config] [ literal[string] ][ literal[string] ]
keyword[wh... | def check_time(self):
""" Make sure our Honeypot time is consistent, and not too far off
from the actual time. """
poll = self.config['timecheck']['poll']
ntp_poll = self.config['timecheck']['ntp_pool']
while True:
clnt = ntplib.NTPClient()
try:
response = clnt.reques... |
def get_or_create(
cls, name: sym.Symbol, module: types.ModuleType = None
) -> "Namespace":
"""Get the namespace bound to the symbol `name` in the global namespace
cache, creating it if it does not exist.
Return the namespace."""
return cls._NAMESPACES.swap(Namespace.__get_or... | def function[get_or_create, parameter[cls, name, module]]:
constant[Get the namespace bound to the symbol `name` in the global namespace
cache, creating it if it does not exist.
Return the namespace.]
return[call[call[name[cls]._NAMESPACES.swap, parameter[name[Namespace].__get_or_create, nam... | keyword[def] identifier[get_or_create] (
identifier[cls] , identifier[name] : identifier[sym] . identifier[Symbol] , identifier[module] : identifier[types] . identifier[ModuleType] = keyword[None]
)-> literal[string] :
literal[string]
keyword[return] identifier[cls] . identifier[_NAMESPACES] . i... | def get_or_create(cls, name: sym.Symbol, module: types.ModuleType=None) -> 'Namespace':
"""Get the namespace bound to the symbol `name` in the global namespace
cache, creating it if it does not exist.
Return the namespace."""
return cls._NAMESPACES.swap(Namespace.__get_or_create, name, module=mo... |
def md5sum(self, f):
''' md5sums a file, returning the hex digest
Parameters:
- f filename string
'''
m = hashlib.md5()
fh = open(f, 'r')
while 1:
chunk = fh.read(BUF_SIZE)
if not chunk: break
m.update(chunk)
... | def function[md5sum, parameter[self, f]]:
constant[ md5sums a file, returning the hex digest
Parameters:
- f filename string
]
variable[m] assign[=] call[name[hashlib].md5, parameter[]]
variable[fh] assign[=] call[name[open], parameter[name[f], constant[r... | keyword[def] identifier[md5sum] ( identifier[self] , identifier[f] ):
literal[string]
identifier[m] = identifier[hashlib] . identifier[md5] ()
identifier[fh] = identifier[open] ( identifier[f] , literal[string] )
keyword[while] literal[int] :
identifier[chunk] = iden... | def md5sum(self, f):
""" md5sums a file, returning the hex digest
Parameters:
- f filename string
"""
m = hashlib.md5()
fh = open(f, 'r')
while 1:
chunk = fh.read(BUF_SIZE)
if not chunk:
break # depends on [control=['if'], data=[]]
... |
def iscm_md_append_array(self, arraypath, member):
"""
Append a member to a metadata array entry
"""
array_path = string.split(arraypath, ".")
array_key = array_path.pop()
current = self.metadata
for k in array_path:
if not current.has_key(k):
... | def function[iscm_md_append_array, parameter[self, arraypath, member]]:
constant[
Append a member to a metadata array entry
]
variable[array_path] assign[=] call[name[string].split, parameter[name[arraypath], constant[.]]]
variable[array_key] assign[=] call[name[array_path].pop, ... | keyword[def] identifier[iscm_md_append_array] ( identifier[self] , identifier[arraypath] , identifier[member] ):
literal[string]
identifier[array_path] = identifier[string] . identifier[split] ( identifier[arraypath] , literal[string] )
identifier[array_key] = identifier[array_path] . iden... | def iscm_md_append_array(self, arraypath, member):
"""
Append a member to a metadata array entry
"""
array_path = string.split(arraypath, '.')
array_key = array_path.pop()
current = self.metadata
for k in array_path:
if not current.has_key(k):
current[k] = {} # d... |
def uand(self):
"""Unary AND reduction operator"""
return reduce(operator.and_, self._items, self.ftype.box(1)) | def function[uand, parameter[self]]:
constant[Unary AND reduction operator]
return[call[name[reduce], parameter[name[operator].and_, name[self]._items, call[name[self].ftype.box, parameter[constant[1]]]]]] | keyword[def] identifier[uand] ( identifier[self] ):
literal[string]
keyword[return] identifier[reduce] ( identifier[operator] . identifier[and_] , identifier[self] . identifier[_items] , identifier[self] . identifier[ftype] . identifier[box] ( literal[int] )) | def uand(self):
"""Unary AND reduction operator"""
return reduce(operator.and_, self._items, self.ftype.box(1)) |
def keys(self, start=None, stop=None):
"""Like :meth:`items` but returns only the keys."""
return (item[0] for item in self.items(start, stop)) | def function[keys, parameter[self, start, stop]]:
constant[Like :meth:`items` but returns only the keys.]
return[<ast.GeneratorExp object at 0x7da1b0a1d660>] | keyword[def] identifier[keys] ( identifier[self] , identifier[start] = keyword[None] , identifier[stop] = keyword[None] ):
literal[string]
keyword[return] ( identifier[item] [ literal[int] ] keyword[for] identifier[item] keyword[in] identifier[self] . identifier[items] ( identifier[start] , iden... | def keys(self, start=None, stop=None):
"""Like :meth:`items` but returns only the keys."""
return (item[0] for item in self.items(start, stop)) |
def _prm_read_dictionary(self, leaf, full_name):
"""Loads data that was originally a dictionary when stored
:param leaf:
PyTables table containing the dictionary data
:param full_name:
Full name of the parameter or result whose data is to be loaded
:return:
... | def function[_prm_read_dictionary, parameter[self, leaf, full_name]]:
constant[Loads data that was originally a dictionary when stored
:param leaf:
PyTables table containing the dictionary data
:param full_name:
Full name of the parameter or result whose data is to be... | keyword[def] identifier[_prm_read_dictionary] ( identifier[self] , identifier[leaf] , identifier[full_name] ):
literal[string]
keyword[try] :
identifier[temp_table] = identifier[self] . identifier[_prm_read_table] ( identifier[leaf] , identifier[full_name] )
... | def _prm_read_dictionary(self, leaf, full_name):
"""Loads data that was originally a dictionary when stored
:param leaf:
PyTables table containing the dictionary data
:param full_name:
Full name of the parameter or result whose data is to be loaded
:return:
... |
def unquote_header_value(value):
r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
:param value: the header value to unquote.
"""
if value and value[0] == value[-1] == '"':
# thi... | def function[unquote_header_value, parameter[value]]:
constant[Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
:param value: the header value to unquote.
]
if <ast.BoolOp object at... | keyword[def] identifier[unquote_header_value] ( identifier[value] ):
literal[string]
keyword[if] identifier[value] keyword[and] identifier[value] [ literal[int] ]== identifier[value] [- literal[int] ]== literal[string] :
identifier[value] = identifier[value] [ literal[int] :... | def unquote_header_value(value):
"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
:param value: the header value to unquote.
"""
if value and value[0] == value[-1] == '"':
# this... |
def subnet_get(auth=None, **kwargs):
'''
Get a single subnet
filters
A Python dictionary of filter conditions to push down
CLI Example:
.. code-block:: bash
salt '*' neutronng.subnet_get name=subnet1
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(**kwarg... | def function[subnet_get, parameter[auth]]:
constant[
Get a single subnet
filters
A Python dictionary of filter conditions to push down
CLI Example:
.. code-block:: bash
salt '*' neutronng.subnet_get name=subnet1
]
variable[cloud] assign[=] call[name[get_operator_... | keyword[def] identifier[subnet_get] ( identifier[auth] = keyword[None] ,** identifier[kwargs] ):
literal[string]
identifier[cloud] = identifier[get_operator_cloud] ( identifier[auth] )
identifier[kwargs] = identifier[_clean_kwargs] (** identifier[kwargs] )
keyword[return] identifier[cloud] . ide... | def subnet_get(auth=None, **kwargs):
"""
Get a single subnet
filters
A Python dictionary of filter conditions to push down
CLI Example:
.. code-block:: bash
salt '*' neutronng.subnet_get name=subnet1
"""
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(**kwarg... |
def get_functions_and_classes(package):
"""Retun lists of functions and classes from a package.
Parameters
----------
package : python package object
Returns
--------
list, list : list of classes and functions
Each sublist consists of [name, member] sublists.
"""
classes, ... | def function[get_functions_and_classes, parameter[package]]:
constant[Retun lists of functions and classes from a package.
Parameters
----------
package : python package object
Returns
--------
list, list : list of classes and functions
Each sublist consists of [name, member] s... | keyword[def] identifier[get_functions_and_classes] ( identifier[package] ):
literal[string]
identifier[classes] , identifier[functions] =[],[]
keyword[for] identifier[name] , identifier[member] keyword[in] identifier[inspect] . identifier[getmembers] ( identifier[package] ):
keyword[if] k... | def get_functions_and_classes(package):
"""Retun lists of functions and classes from a package.
Parameters
----------
package : python package object
Returns
--------
list, list : list of classes and functions
Each sublist consists of [name, member] sublists.
"""
(classes,... |
def findSubCommand(args):
"""
Given a list ['foo','bar', 'baz'], attempts to create a command name in the
format 'foo-bar-baz'. If that command exists, we run it. If it doesn't, we
check to see if foo-bar exists, in which case we run `foo-bar baz`. We keep
taking chunks off the end of the command name and add... | def function[findSubCommand, parameter[args]]:
constant[
Given a list ['foo','bar', 'baz'], attempts to create a command name in the
format 'foo-bar-baz'. If that command exists, we run it. If it doesn't, we
check to see if foo-bar exists, in which case we run `foo-bar baz`. We keep
taking chunks off th... | keyword[def] identifier[findSubCommand] ( identifier[args] ):
literal[string]
keyword[for] identifier[n] keyword[in] identifier[range] ( identifier[len] ( identifier[args] )- literal[int] ):
identifier[command] = literal[string] . identifier[join] ( identifier[args] [:( identifier[len] ( ident... | def findSubCommand(args):
"""
Given a list ['foo','bar', 'baz'], attempts to create a command name in the
format 'foo-bar-baz'. If that command exists, we run it. If it doesn't, we
check to see if foo-bar exists, in which case we run `foo-bar baz`. We keep
taking chunks off the end of the command name and a... |
def forum_topic_list(self, title_matches=None, title=None,
category_id=None):
"""Function to get forum topics.
Parameters:
title_matches (str): Search body for the given terms.
title (str): Exact title match.
category_id (int): Can be: 0, 1, ... | def function[forum_topic_list, parameter[self, title_matches, title, category_id]]:
constant[Function to get forum topics.
Parameters:
title_matches (str): Search body for the given terms.
title (str): Exact title match.
category_id (int): Can be: 0, 1, 2 (General, T... | keyword[def] identifier[forum_topic_list] ( identifier[self] , identifier[title_matches] = keyword[None] , identifier[title] = keyword[None] ,
identifier[category_id] = keyword[None] ):
literal[string]
identifier[params] ={
literal[string] : identifier[title_matches] ,
literal[st... | def forum_topic_list(self, title_matches=None, title=None, category_id=None):
"""Function to get forum topics.
Parameters:
title_matches (str): Search body for the given terms.
title (str): Exact title match.
category_id (int): Can be: 0, 1, 2 (General, Tags, Bugs & Feat... |
def bytes2human(n, fmt='%(value).1f %(symbol)s', symbols='customary'):
"""
Convert n bytes into a human readable string based on format.
symbols can be either "customary", "customary_ext", "iec" or "iec_ext",
see: http://goo.gl/kTQMs
"""
n = int(n)
if n < 0:
raise ValueError("n < 0")... | def function[bytes2human, parameter[n, fmt, symbols]]:
constant[
Convert n bytes into a human readable string based on format.
symbols can be either "customary", "customary_ext", "iec" or "iec_ext",
see: http://goo.gl/kTQMs
]
variable[n] assign[=] call[name[int], parameter[name[n]]]
... | keyword[def] identifier[bytes2human] ( identifier[n] , identifier[fmt] = literal[string] , identifier[symbols] = literal[string] ):
literal[string]
identifier[n] = identifier[int] ( identifier[n] )
keyword[if] identifier[n] < literal[int] :
keyword[raise] identifier[ValueError] ( literal[st... | def bytes2human(n, fmt='%(value).1f %(symbol)s', symbols='customary'):
"""
Convert n bytes into a human readable string based on format.
symbols can be either "customary", "customary_ext", "iec" or "iec_ext",
see: http://goo.gl/kTQMs
"""
n = int(n)
if n < 0:
raise ValueError('n < 0')... |
def _build_connection_pool(cls, session: AppSession):
'''Create connection pool.'''
args = session.args
connect_timeout = args.connect_timeout
read_timeout = args.read_timeout
if args.timeout:
connect_timeout = read_timeout = args.timeout
if args.limit_rate:... | def function[_build_connection_pool, parameter[cls, session]]:
constant[Create connection pool.]
variable[args] assign[=] name[session].args
variable[connect_timeout] assign[=] name[args].connect_timeout
variable[read_timeout] assign[=] name[args].read_timeout
if name[args].timeo... | keyword[def] identifier[_build_connection_pool] ( identifier[cls] , identifier[session] : identifier[AppSession] ):
literal[string]
identifier[args] = identifier[session] . identifier[args]
identifier[connect_timeout] = identifier[args] . identifier[connect_timeout]
identifier[r... | def _build_connection_pool(cls, session: AppSession):
"""Create connection pool."""
args = session.args
connect_timeout = args.connect_timeout
read_timeout = args.read_timeout
if args.timeout:
connect_timeout = read_timeout = args.timeout # depends on [control=['if'], data=[]]
if args.l... |
def reports(self):
"""
Create reports from the abundance estimation
"""
logging.info('Creating CLARK report for {} files'.format(self.extension))
# Create a workbook to store the report. Using xlsxwriter rather than a simple csv format, as I want to be
# able to have appr... | def function[reports, parameter[self]]:
constant[
Create reports from the abundance estimation
]
call[name[logging].info, parameter[call[constant[Creating CLARK report for {} files].format, parameter[name[self].extension]]]]
variable[workbook] assign[=] call[name[xlsxwriter].Work... | keyword[def] identifier[reports] ( identifier[self] ):
literal[string]
identifier[logging] . identifier[info] ( literal[string] . identifier[format] ( identifier[self] . identifier[extension] ))
identifier[workbook] = identifier[xlsxwriter] . identifier[Workbook] ( identi... | def reports(self):
"""
Create reports from the abundance estimation
"""
logging.info('Creating CLARK report for {} files'.format(self.extension))
# Create a workbook to store the report. Using xlsxwriter rather than a simple csv format, as I want to be
# able to have appropriately sized,... |
def is_agari(self, tiles_34, open_sets_34=None):
"""
Determine was it win or not
:param tiles_34: 34 tiles format array
:param open_sets_34: array of array of 34 tiles format
:return: boolean
"""
# we will modify them later, so we need to use a copy
tiles ... | def function[is_agari, parameter[self, tiles_34, open_sets_34]]:
constant[
Determine was it win or not
:param tiles_34: 34 tiles format array
:param open_sets_34: array of array of 34 tiles format
:return: boolean
]
variable[tiles] assign[=] call[name[copy].deepco... | keyword[def] identifier[is_agari] ( identifier[self] , identifier[tiles_34] , identifier[open_sets_34] = keyword[None] ):
literal[string]
identifier[tiles] = identifier[copy] . identifier[deepcopy] ( identifier[tiles_34] )
keyword[if] identifier[open_sets_34] :... | def is_agari(self, tiles_34, open_sets_34=None):
"""
Determine was it win or not
:param tiles_34: 34 tiles format array
:param open_sets_34: array of array of 34 tiles format
:return: boolean
"""
# we will modify them later, so we need to use a copy
tiles = copy.deepc... |
def _generate_request_head_bytes(method, endpoint, headers):
"""
:type method: str
:type endpoint: str
:type headers: dict[str, str]
:rtype: bytes
"""
head_string = _FORMAT_METHOD_AND_ENDPOINT.format(method, endpoint)
header_tuples = sorted((k, headers[k]) for k in headers)
for na... | def function[_generate_request_head_bytes, parameter[method, endpoint, headers]]:
constant[
:type method: str
:type endpoint: str
:type headers: dict[str, str]
:rtype: bytes
]
variable[head_string] assign[=] call[name[_FORMAT_METHOD_AND_ENDPOINT].format, parameter[name[method], name... | keyword[def] identifier[_generate_request_head_bytes] ( identifier[method] , identifier[endpoint] , identifier[headers] ):
literal[string]
identifier[head_string] = identifier[_FORMAT_METHOD_AND_ENDPOINT] . identifier[format] ( identifier[method] , identifier[endpoint] )
identifier[header_tuples] = i... | def _generate_request_head_bytes(method, endpoint, headers):
"""
:type method: str
:type endpoint: str
:type headers: dict[str, str]
:rtype: bytes
"""
head_string = _FORMAT_METHOD_AND_ENDPOINT.format(method, endpoint)
header_tuples = sorted(((k, headers[k]) for k in headers))
for (n... |
def set_context(pid_file, context_info):
"""Set context of running notebook.
:param context_info: dict of extra context parameters, see comm.py comments
"""
assert type(context_info) == dict
port_file = get_context_file_name(pid_file)
with open(port_file, "wt") as f:
f.write(json.dumps... | def function[set_context, parameter[pid_file, context_info]]:
constant[Set context of running notebook.
:param context_info: dict of extra context parameters, see comm.py comments
]
assert[compare[call[name[type], parameter[name[context_info]]] equal[==] name[dict]]]
variable[port_file] ass... | keyword[def] identifier[set_context] ( identifier[pid_file] , identifier[context_info] ):
literal[string]
keyword[assert] identifier[type] ( identifier[context_info] )== identifier[dict]
identifier[port_file] = identifier[get_context_file_name] ( identifier[pid_file] )
keyword[with] identifie... | def set_context(pid_file, context_info):
"""Set context of running notebook.
:param context_info: dict of extra context parameters, see comm.py comments
"""
assert type(context_info) == dict
port_file = get_context_file_name(pid_file)
with open(port_file, 'wt') as f:
f.write(json.dumps(... |
def _instantiateFont(self, path):
"""
Return a instance of a font object
with all the given subclasses
"""
return self._fontClass(path,
libClass=self._libClass,
kerningClass=self._kerningClass,
groupsClass=self._groupsClass,
infoCla... | def function[_instantiateFont, parameter[self, path]]:
constant[
Return a instance of a font object
with all the given subclasses
]
return[call[name[self]._fontClass, parameter[name[path]]]] | keyword[def] identifier[_instantiateFont] ( identifier[self] , identifier[path] ):
literal[string]
keyword[return] identifier[self] . identifier[_fontClass] ( identifier[path] ,
identifier[libClass] = identifier[self] . identifier[_libClass] ,
identifier[kerningClass] = identifie... | def _instantiateFont(self, path):
"""
Return a instance of a font object
with all the given subclasses
"""
return self._fontClass(path, libClass=self._libClass, kerningClass=self._kerningClass, groupsClass=self._groupsClass, infoClass=self._infoClass, featuresClass=self._featuresClass, g... |
def vm_disk_save(name, kwargs=None, call=None):
'''
Sets the disk to be saved in the given image.
.. versionadded:: 2016.3.0
name
The name of the VM containing the disk to save.
disk_id
The ID of the disk to save.
image_name
The name of the new image where the disk wi... | def function[vm_disk_save, parameter[name, kwargs, call]]:
constant[
Sets the disk to be saved in the given image.
.. versionadded:: 2016.3.0
name
The name of the VM containing the disk to save.
disk_id
The ID of the disk to save.
image_name
The name of the new im... | keyword[def] identifier[vm_disk_save] ( identifier[name] , identifier[kwargs] = keyword[None] , identifier[call] = keyword[None] ):
literal[string]
keyword[if] identifier[call] != literal[string] :
keyword[raise] identifier[SaltCloudSystemExit] (
literal[string]
)
keyword... | def vm_disk_save(name, kwargs=None, call=None):
"""
Sets the disk to be saved in the given image.
.. versionadded:: 2016.3.0
name
The name of the VM containing the disk to save.
disk_id
The ID of the disk to save.
image_name
The name of the new image where the disk wi... |
def _index_file(self):
"""Open and index the contour file
This function populates the internal list of contours
as strings which will be available as `self.data`.
"""
with self.filename.open() as fd:
data = fd.read()
ident = "Contour in frame"
self._... | def function[_index_file, parameter[self]]:
constant[Open and index the contour file
This function populates the internal list of contours
as strings which will be available as `self.data`.
]
with call[name[self].filename.open, parameter[]] begin[:]
variable[data... | keyword[def] identifier[_index_file] ( identifier[self] ):
literal[string]
keyword[with] identifier[self] . identifier[filename] . identifier[open] () keyword[as] identifier[fd] :
identifier[data] = identifier[fd] . identifier[read] ()
identifier[ident] = literal[string]
... | def _index_file(self):
"""Open and index the contour file
This function populates the internal list of contours
as strings which will be available as `self.data`.
"""
with self.filename.open() as fd:
data = fd.read() # depends on [control=['with'], data=['fd']]
ident = 'Con... |
def embed_check_categorical_event_shape(
categorical_param, name="embed_check_categorical_event_shape"):
"""Embeds checks that categorical distributions don't have too many classes.
A categorical-type distribution is one which, e.g., returns the class label
rather than a one-hot encoding. E.g., `Categorical... | def function[embed_check_categorical_event_shape, parameter[categorical_param, name]]:
constant[Embeds checks that categorical distributions don't have too many classes.
A categorical-type distribution is one which, e.g., returns the class label
rather than a one-hot encoding. E.g., `Categorical(probs)`.
... | keyword[def] identifier[embed_check_categorical_event_shape] (
identifier[categorical_param] , identifier[name] = literal[string] ):
literal[string]
keyword[with] identifier[tf] . identifier[name_scope] ( identifier[name] ):
identifier[x] = identifier[tf] . identifier[convert_to_tensor] ( identifier[val... | def embed_check_categorical_event_shape(categorical_param, name='embed_check_categorical_event_shape'):
"""Embeds checks that categorical distributions don't have too many classes.
A categorical-type distribution is one which, e.g., returns the class label
rather than a one-hot encoding. E.g., `Categorical(pr... |
def output(self, _filename):
"""
_filename is not used
Args:
_filename(string)
"""
txt = ''
for contract in self.slither.contracts_derived:
txt += '\n{}:\n'.format(contract.name)
table = PrettyTable(['Name', 'Type'])
... | def function[output, parameter[self, _filename]]:
constant[
_filename is not used
Args:
_filename(string)
]
variable[txt] assign[=] constant[]
for taget[name[contract]] in starred[name[self].slither.contracts_derived] begin[:]
<ast.AugAssig... | keyword[def] identifier[output] ( identifier[self] , identifier[_filename] ):
literal[string]
identifier[txt] = literal[string]
keyword[for] identifier[contract] keyword[in] identifier[self] . identifier[slither] . identifier[contracts_derived] :
identifier[txt] += litera... | def output(self, _filename):
"""
_filename is not used
Args:
_filename(string)
"""
txt = ''
for contract in self.slither.contracts_derived:
txt += '\n{}:\n'.format(contract.name)
table = PrettyTable(['Name', 'Type'])
for variable in con... |
def check_background(qpi):
"""Check QPimage background data
Parameters
----------
qpi: qpimage.core.QPImage
Raises
------
IntegrityCheckError
if the check fails
"""
for imdat in [qpi._amp, qpi._pha]:
try:
fit, attrs = imdat.get_bg(key="fit", ret_attrs=Tr... | def function[check_background, parameter[qpi]]:
constant[Check QPimage background data
Parameters
----------
qpi: qpimage.core.QPImage
Raises
------
IntegrityCheckError
if the check fails
]
for taget[name[imdat]] in starred[list[[<ast.Attribute object at 0x7da1b1140... | keyword[def] identifier[check_background] ( identifier[qpi] ):
literal[string]
keyword[for] identifier[imdat] keyword[in] [ identifier[qpi] . identifier[_amp] , identifier[qpi] . identifier[_pha] ]:
keyword[try] :
identifier[fit] , identifier[attrs] = identifier[imdat] . identifier[... | def check_background(qpi):
"""Check QPimage background data
Parameters
----------
qpi: qpimage.core.QPImage
Raises
------
IntegrityCheckError
if the check fails
"""
for imdat in [qpi._amp, qpi._pha]:
try:
(fit, attrs) = imdat.get_bg(key='fit', ret_attrs=... |
def add(self, type):
# type: (InternalType) -> None
"""
Add type to the runtime type samples.
"""
try:
if isinstance(type, SetType):
if EMPTY_SET_TYPE in self.types_hashable:
self.types_hashable.remove(EMPTY_SET_TYPE)
el... | def function[add, parameter[self, type]]:
constant[
Add type to the runtime type samples.
]
<ast.Try object at 0x7da18c4cca60> | keyword[def] identifier[add] ( identifier[self] , identifier[type] ):
literal[string]
keyword[try] :
keyword[if] identifier[isinstance] ( identifier[type] , identifier[SetType] ):
keyword[if] identifier[EMPTY_SET_TYPE] keyword[in] identifier[self] . identifier[typ... | def add(self, type):
# type: (InternalType) -> None
'\n Add type to the runtime type samples.\n '
try:
if isinstance(type, SetType):
if EMPTY_SET_TYPE in self.types_hashable:
self.types_hashable.remove(EMPTY_SET_TYPE) # depends on [control=['if'], data=['EM... |
def mkArrayUpdater(nextItemVal: Value, indexes: Tuple[Value],
invalidate: bool):
"""
Create value updater for simulation for value of array type
:param nextVal: instance of Value which will be asssiggned to signal
:param indexes: tuple on indexes where value should be updated
... | def function[mkArrayUpdater, parameter[nextItemVal, indexes, invalidate]]:
constant[
Create value updater for simulation for value of array type
:param nextVal: instance of Value which will be asssiggned to signal
:param indexes: tuple on indexes where value should be updated
in target arra... | keyword[def] identifier[mkArrayUpdater] ( identifier[nextItemVal] : identifier[Value] , identifier[indexes] : identifier[Tuple] [ identifier[Value] ],
identifier[invalidate] : identifier[bool] ):
literal[string]
keyword[def] identifier[updater] ( identifier[currentVal] ):
keyword[if] identifier... | def mkArrayUpdater(nextItemVal: Value, indexes: Tuple[Value], invalidate: bool):
"""
Create value updater for simulation for value of array type
:param nextVal: instance of Value which will be asssiggned to signal
:param indexes: tuple on indexes where value should be updated
in target array
... |
def showEditor(self):
"""Creates and shows an editor for this Stimulus"""
if self.editor is not None:
editor = self.editor()
editor.setModel(self)
factory = get_stimulus_factory(self._stim.stimType())
editor.editingFinished.connect(factory.update)
... | def function[showEditor, parameter[self]]:
constant[Creates and shows an editor for this Stimulus]
if compare[name[self].editor is_not constant[None]] begin[:]
variable[editor] assign[=] call[name[self].editor, parameter[]]
call[name[editor].setModel, parameter[name[self]... | keyword[def] identifier[showEditor] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[editor] keyword[is] keyword[not] keyword[None] :
identifier[editor] = identifier[self] . identifier[editor] ()
identifier[editor] . identifier[setModel] ... | def showEditor(self):
"""Creates and shows an editor for this Stimulus"""
if self.editor is not None:
editor = self.editor()
editor.setModel(self)
factory = get_stimulus_factory(self._stim.stimType())
editor.editingFinished.connect(factory.update)
return editor # depends... |
def write_to_file(self, out_data):
"""
Outputs data to a netCDF file. If the file does not exist, it will be created. Otherwise, additional variables
are appended to the current file
Args:
out_data: Full-path and name of output netCDF file
"""
full_var_name =... | def function[write_to_file, parameter[self, out_data]]:
constant[
Outputs data to a netCDF file. If the file does not exist, it will be created. Otherwise, additional variables
are appended to the current file
Args:
out_data: Full-path and name of output netCDF file
... | keyword[def] identifier[write_to_file] ( identifier[self] , identifier[out_data] ):
literal[string]
identifier[full_var_name] = identifier[self] . identifier[consensus_type] + literal[string] + identifier[self] . identifier[variable]
keyword[if] literal[string] keyword[in] identifier[s... | def write_to_file(self, out_data):
"""
Outputs data to a netCDF file. If the file does not exist, it will be created. Otherwise, additional variables
are appended to the current file
Args:
out_data: Full-path and name of output netCDF file
"""
full_var_name = self.co... |
def write_quick(self, addr):
"""write_quick(addr)
Perform SMBus Quick transaction.
"""
self._set_addr(addr)
if SMBUS.i2c_smbus_write_quick(self._fd, SMBUS.I2C_SMBUS_WRITE) != 0:
raise IOError(ffi.errno) | def function[write_quick, parameter[self, addr]]:
constant[write_quick(addr)
Perform SMBus Quick transaction.
]
call[name[self]._set_addr, parameter[name[addr]]]
if compare[call[name[SMBUS].i2c_smbus_write_quick, parameter[name[self]._fd, name[SMBUS].I2C_SMBUS_WRITE]] not_equal[... | keyword[def] identifier[write_quick] ( identifier[self] , identifier[addr] ):
literal[string]
identifier[self] . identifier[_set_addr] ( identifier[addr] )
keyword[if] identifier[SMBUS] . identifier[i2c_smbus_write_quick] ( identifier[self] . identifier[_fd] , identifier[SMBUS] . identifi... | def write_quick(self, addr):
"""write_quick(addr)
Perform SMBus Quick transaction.
"""
self._set_addr(addr)
if SMBUS.i2c_smbus_write_quick(self._fd, SMBUS.I2C_SMBUS_WRITE) != 0:
raise IOError(ffi.errno) # depends on [control=['if'], data=[]] |
def get_snpeff_info(snpeff_string, snpeff_header):
"""Make the vep annotations into a dictionaries
A snpeff dictionary will have the snpeff column names as keys and
the vep annotations as values.
The dictionaries are stored in a list.
One dictionary for each transcript.
... | def function[get_snpeff_info, parameter[snpeff_string, snpeff_header]]:
constant[Make the vep annotations into a dictionaries
A snpeff dictionary will have the snpeff column names as keys and
the vep annotations as values.
The dictionaries are stored in a list.
One diction... | keyword[def] identifier[get_snpeff_info] ( identifier[snpeff_string] , identifier[snpeff_header] ):
literal[string]
identifier[snpeff_annotations] =[
identifier[dict] ( identifier[zip] ( identifier[snpeff_header] , identifier[snpeff_annotation] . identifier[split] ( literal[string] )))
keyword[f... | def get_snpeff_info(snpeff_string, snpeff_header):
"""Make the vep annotations into a dictionaries
A snpeff dictionary will have the snpeff column names as keys and
the vep annotations as values.
The dictionaries are stored in a list.
One dictionary for each transcript.
... |
def concat(cls, variables, dim='concat_dim', positions=None,
shortcut=False):
"""Specialized version of Variable.concat for IndexVariable objects.
This exists because we want to avoid converting Index objects to NumPy
arrays, if possible.
"""
if not isinstance(dim... | def function[concat, parameter[cls, variables, dim, positions, shortcut]]:
constant[Specialized version of Variable.concat for IndexVariable objects.
This exists because we want to avoid converting Index objects to NumPy
arrays, if possible.
]
if <ast.UnaryOp object at 0x7da18ed... | keyword[def] identifier[concat] ( identifier[cls] , identifier[variables] , identifier[dim] = literal[string] , identifier[positions] = keyword[None] ,
identifier[shortcut] = keyword[False] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[dim] , identifier[str] ):
... | def concat(cls, variables, dim='concat_dim', positions=None, shortcut=False):
"""Specialized version of Variable.concat for IndexVariable objects.
This exists because we want to avoid converting Index objects to NumPy
arrays, if possible.
"""
if not isinstance(dim, str):
(dim,) ... |
def point_before_card(self, card, x, y):
"""Return whether ``(x, y)`` is somewhere before ``card``, given how I
know cards to be arranged.
If the cards are being stacked down and to the right, that
means I'm testing whether ``(x, y)`` is above or to the left
of the card.
... | def function[point_before_card, parameter[self, card, x, y]]:
constant[Return whether ``(x, y)`` is somewhere before ``card``, given how I
know cards to be arranged.
If the cards are being stacked down and to the right, that
means I'm testing whether ``(x, y)`` is above or to the left
... | keyword[def] identifier[point_before_card] ( identifier[self] , identifier[card] , identifier[x] , identifier[y] ):
literal[string]
keyword[def] identifier[ycmp] ():
keyword[if] identifier[self] . identifier[card_y_hint_step] == literal[int] :
keyword[return] keywor... | def point_before_card(self, card, x, y):
"""Return whether ``(x, y)`` is somewhere before ``card``, given how I
know cards to be arranged.
If the cards are being stacked down and to the right, that
means I'm testing whether ``(x, y)`` is above or to the left
of the card.
""... |
def filesizeformat(bytes, sep=' '):
"""
Formats the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB,
102 B, 2.3 GB etc).
Grabbed from Django (http://www.djangoproject.com), slightly modified.
:param bytes: size in bytes (as integer)
:param sep: string separator between number and a... | def function[filesizeformat, parameter[bytes, sep]]:
constant[
Formats the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB,
102 B, 2.3 GB etc).
Grabbed from Django (http://www.djangoproject.com), slightly modified.
:param bytes: size in bytes (as integer)
:param sep: string sep... | keyword[def] identifier[filesizeformat] ( identifier[bytes] , identifier[sep] = literal[string] ):
literal[string]
keyword[try] :
identifier[bytes] = identifier[float] ( identifier[bytes] )
keyword[except] ( identifier[TypeError] , identifier[ValueError] , identifier[UnicodeDecodeError] ):
... | def filesizeformat(bytes, sep=' '):
"""
Formats the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB,
102 B, 2.3 GB etc).
Grabbed from Django (http://www.djangoproject.com), slightly modified.
:param bytes: size in bytes (as integer)
:param sep: string separator between number and a... |
def engine(self):
"""
Return an engine instance, creating it if it doesn't exist.
Recreate the engine connection if it wasn't originally created
by the current process.
"""
pid = os.getpid()
conn = SQLAlchemyTarget._engine_dict.get(self.connection_string)
... | def function[engine, parameter[self]]:
constant[
Return an engine instance, creating it if it doesn't exist.
Recreate the engine connection if it wasn't originally created
by the current process.
]
variable[pid] assign[=] call[name[os].getpid, parameter[]]
variab... | keyword[def] identifier[engine] ( identifier[self] ):
literal[string]
identifier[pid] = identifier[os] . identifier[getpid] ()
identifier[conn] = identifier[SQLAlchemyTarget] . identifier[_engine_dict] . identifier[get] ( identifier[self] . identifier[connection_string] )
keyword[... | def engine(self):
"""
Return an engine instance, creating it if it doesn't exist.
Recreate the engine connection if it wasn't originally created
by the current process.
"""
pid = os.getpid()
conn = SQLAlchemyTarget._engine_dict.get(self.connection_string)
if not conn or ... |
def returnTradeHistory(self, currencyPair, start=None, end=None):
"""Returns the past 200 trades for a given market, or up to 50,000
trades between a range specified in UNIX timestamps by the "start"
and "end" GET parameters."""
return self._public('returnTradeHistory', currencyPair=curr... | def function[returnTradeHistory, parameter[self, currencyPair, start, end]]:
constant[Returns the past 200 trades for a given market, or up to 50,000
trades between a range specified in UNIX timestamps by the "start"
and "end" GET parameters.]
return[call[name[self]._public, parameter[consta... | keyword[def] identifier[returnTradeHistory] ( identifier[self] , identifier[currencyPair] , identifier[start] = keyword[None] , identifier[end] = keyword[None] ):
literal[string]
keyword[return] identifier[self] . identifier[_public] ( literal[string] , identifier[currencyPair] = identifier[curren... | def returnTradeHistory(self, currencyPair, start=None, end=None):
"""Returns the past 200 trades for a given market, or up to 50,000
trades between a range specified in UNIX timestamps by the "start"
and "end" GET parameters."""
return self._public('returnTradeHistory', currencyPair=currencyPair... |
def all_logging_disabled(highest_level=logging.CRITICAL):
"""Disable all logging temporarily.
A context manager that will prevent any logging messages triggered during the body from being processed.
Args:
highest_level: the maximum logging level that is being blocked
"""
previous_level = l... | def function[all_logging_disabled, parameter[highest_level]]:
constant[Disable all logging temporarily.
A context manager that will prevent any logging messages triggered during the body from being processed.
Args:
highest_level: the maximum logging level that is being blocked
]
va... | keyword[def] identifier[all_logging_disabled] ( identifier[highest_level] = identifier[logging] . identifier[CRITICAL] ):
literal[string]
identifier[previous_level] = identifier[logging] . identifier[root] . identifier[manager] . identifier[disable]
identifier[logging] . identifier[disable] ( identif... | def all_logging_disabled(highest_level=logging.CRITICAL):
"""Disable all logging temporarily.
A context manager that will prevent any logging messages triggered during the body from being processed.
Args:
highest_level: the maximum logging level that is being blocked
"""
previous_level = l... |
def get_content_hashes(image_path,
level=None,
regexp=None,
include_files=None,
tag_root=True,
level_filter=None,
skip_files=None,
version=None,
... | def function[get_content_hashes, parameter[image_path, level, regexp, include_files, tag_root, level_filter, skip_files, version, include_sizes]]:
constant[get_content_hashes is like get_image_hash, but it returns a complete dictionary
of file names (keys) and their respective hashes (values). This functio... | keyword[def] identifier[get_content_hashes] ( identifier[image_path] ,
identifier[level] = keyword[None] ,
identifier[regexp] = keyword[None] ,
identifier[include_files] = keyword[None] ,
identifier[tag_root] = keyword[True] ,
identifier[level_filter] = keyword[None] ,
identifier[skip_files] = keyword[None] ,
... | def get_content_hashes(image_path, level=None, regexp=None, include_files=None, tag_root=True, level_filter=None, skip_files=None, version=None, include_sizes=True):
"""get_content_hashes is like get_image_hash, but it returns a complete dictionary
of file names (keys) and their respective hashes (values). Thi... |
def Connect(cls, usb, banner=b'notadb', rsa_keys=None, auth_timeout_ms=100):
"""Establish a new connection to the device.
Args:
usb: A USBHandle with BulkRead and BulkWrite methods.
banner: A string to send as a host identifier.
rsa_keys: List of AuthSigner subclass instan... | def function[Connect, parameter[cls, usb, banner, rsa_keys, auth_timeout_ms]]:
constant[Establish a new connection to the device.
Args:
usb: A USBHandle with BulkRead and BulkWrite methods.
banner: A string to send as a host identifier.
rsa_keys: List of AuthSigner subclas... | keyword[def] identifier[Connect] ( identifier[cls] , identifier[usb] , identifier[banner] = literal[string] , identifier[rsa_keys] = keyword[None] , identifier[auth_timeout_ms] = literal[int] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[banner] , identifier[... | def Connect(cls, usb, banner=b'notadb', rsa_keys=None, auth_timeout_ms=100):
"""Establish a new connection to the device.
Args:
usb: A USBHandle with BulkRead and BulkWrite methods.
banner: A string to send as a host identifier.
rsa_keys: List of AuthSigner subclass instances ... |
def get_names():
"""
Return a list of names.
"""
return [n.strip() for n in codecs.open(os.path.join("data", "names.txt"),"rb",'utf8').readlines()] | def function[get_names, parameter[]]:
constant[
Return a list of names.
]
return[<ast.ListComp object at 0x7da20e9610f0>] | keyword[def] identifier[get_names] ():
literal[string]
keyword[return] [ identifier[n] . identifier[strip] () keyword[for] identifier[n] keyword[in] identifier[codecs] . identifier[open] ( identifier[os] . identifier[path] . identifier[join] ( literal[string] , literal[string] ), literal[string] , liter... | def get_names():
"""
Return a list of names.
"""
return [n.strip() for n in codecs.open(os.path.join('data', 'names.txt'), 'rb', 'utf8').readlines()] |
def patch_namespaced_replica_set(self, name, namespace, body, **kwargs): # noqa: E501
"""patch_namespaced_replica_set # noqa: E501
partially update the specified ReplicaSet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, ple... | def function[patch_namespaced_replica_set, parameter[self, name, namespace, body]]:
constant[patch_namespaced_replica_set # noqa: E501
partially update the specified ReplicaSet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, ... | keyword[def] identifier[patch_namespaced_replica_set] ( identifier[self] , identifier[name] , identifier[namespace] , identifier[body] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] [ literal[string] ]= keyword[True]
keyword[if] identifier[kwargs] . identifier[get] ( litera... | def patch_namespaced_replica_set(self, name, namespace, body, **kwargs): # noqa: E501
"patch_namespaced_replica_set # noqa: E501\n\n partially update the specified ReplicaSet # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, pleas... |
def add_child_gradebook(self, gradebook_id, child_id):
"""Adds a child to a gradebook.
arg: gradebook_id (osid.id.Id): the ``Id`` of a gradebook
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: AlreadyExists - ``gradebook_id`` is already a parent of
... | def function[add_child_gradebook, parameter[self, gradebook_id, child_id]]:
constant[Adds a child to a gradebook.
arg: gradebook_id (osid.id.Id): the ``Id`` of a gradebook
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: AlreadyExists - ``gradebook_id`` is already a... | keyword[def] identifier[add_child_gradebook] ( identifier[self] , identifier[gradebook_id] , identifier[child_id] ):
literal[string]
keyword[if] identifier[self] . identifier[_catalog_session] keyword[is] keyword[not] keyword[None] :
keyword[return] identifier[se... | def add_child_gradebook(self, gradebook_id, child_id):
"""Adds a child to a gradebook.
arg: gradebook_id (osid.id.Id): the ``Id`` of a gradebook
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: AlreadyExists - ``gradebook_id`` is already a parent of
``ch... |
def resolve_feats(feat_list, seqin, seqref, start, locus, missing, verbose=False, verbosity=0):
"""
resolve_feats - Resolves features from alignments
:param feat_list: List of the found features
:type feat_list: ``List``
:param seqin: The input sequence
:type seqin: ``str``
:param locus: Th... | def function[resolve_feats, parameter[feat_list, seqin, seqref, start, locus, missing, verbose, verbosity]]:
constant[
resolve_feats - Resolves features from alignments
:param feat_list: List of the found features
:type feat_list: ``List``
:param seqin: The input sequence
:type seqin: ``str... | keyword[def] identifier[resolve_feats] ( identifier[feat_list] , identifier[seqin] , identifier[seqref] , identifier[start] , identifier[locus] , identifier[missing] , identifier[verbose] = keyword[False] , identifier[verbosity] = literal[int] ):
literal[string]
identifier[structures] = identifier[get_stru... | def resolve_feats(feat_list, seqin, seqref, start, locus, missing, verbose=False, verbosity=0):
"""
resolve_feats - Resolves features from alignments
:param feat_list: List of the found features
:type feat_list: ``List``
:param seqin: The input sequence
:type seqin: ``str``
:param locus: Th... |
def p_SimpleSyntax(self, p):
"""SimpleSyntax : INTEGER
| INTEGER integerSubType
| INTEGER enumSpec
| INTEGER32
| INTEGER32 integerSubType
| UPPERCASE_IDENTIFIER enumSpec
... | def function[p_SimpleSyntax, parameter[self, p]]:
constant[SimpleSyntax : INTEGER
| INTEGER integerSubType
| INTEGER enumSpec
| INTEGER32
| INTEGER32 integerSubType
| UPPERCASE_IDENTIFIER enum... | keyword[def] identifier[p_SimpleSyntax] ( identifier[self] , identifier[p] ):
literal[string]
identifier[n] = identifier[len] ( identifier[p] )
keyword[if] identifier[n] == literal[int] :
identifier[p] [ literal[int] ]=( literal[string] , identifier[p] [ literal[int] ])
... | def p_SimpleSyntax(self, p):
"""SimpleSyntax : INTEGER
| INTEGER integerSubType
| INTEGER enumSpec
| INTEGER32
| INTEGER32 integerSubType
| UPPERCASE_IDENTIFIER enumSpec
| ... |
def get_app(
database_uri,
exclude_tables=None,
user_models=None,
reflect_all=True,
read_only=False,
schema=None):
"""Return an application instance connected to the database described in
*database_uri*.
:param str database_uri: The URI connection string for ... | def function[get_app, parameter[database_uri, exclude_tables, user_models, reflect_all, read_only, schema]]:
constant[Return an application instance connected to the database described in
*database_uri*.
:param str database_uri: The URI connection string for the database
:param list exclude_tables:... | keyword[def] identifier[get_app] (
identifier[database_uri] ,
identifier[exclude_tables] = keyword[None] ,
identifier[user_models] = keyword[None] ,
identifier[reflect_all] = keyword[True] ,
identifier[read_only] = keyword[False] ,
identifier[schema] = keyword[None] ):
literal[string]
identifier[app]... | def get_app(database_uri, exclude_tables=None, user_models=None, reflect_all=True, read_only=False, schema=None):
"""Return an application instance connected to the database described in
*database_uri*.
:param str database_uri: The URI connection string for the database
:param list exclude_tables: A li... |
def MakeSubparser(subparsers, parents, method, arguments=None):
"""Returns an argparse subparser to create a 'subcommand' to adb."""
name = ('-'.join(re.split(r'([A-Z][a-z]+)', method.__name__)[1:-1:2])).lower()
help = method.__doc__.splitlines()[0]
subparser = subparsers.add_parser(
name=name, ... | def function[MakeSubparser, parameter[subparsers, parents, method, arguments]]:
constant[Returns an argparse subparser to create a 'subcommand' to adb.]
variable[name] assign[=] call[call[constant[-].join, parameter[call[call[name[re].split, parameter[constant[([A-Z][a-z]+)], name[method].__name__]]][<a... | keyword[def] identifier[MakeSubparser] ( identifier[subparsers] , identifier[parents] , identifier[method] , identifier[arguments] = keyword[None] ):
literal[string]
identifier[name] =( literal[string] . identifier[join] ( identifier[re] . identifier[split] ( literal[string] , identifier[method] . identifi... | def MakeSubparser(subparsers, parents, method, arguments=None):
"""Returns an argparse subparser to create a 'subcommand' to adb."""
name = '-'.join(re.split('([A-Z][a-z]+)', method.__name__)[1:-1:2]).lower()
help = method.__doc__.splitlines()[0]
subparser = subparsers.add_parser(name=name, description=... |
def _assemble(self):
"""Calls the appropriate assemble method based on policies."""
for stmt in self.statements:
pol = self.processed_policies[stmt.uuid]
if _is_whitelisted(stmt):
self._dispatch(stmt, 'assemble', self.model, self.agent_set,
... | def function[_assemble, parameter[self]]:
constant[Calls the appropriate assemble method based on policies.]
for taget[name[stmt]] in starred[name[self].statements] begin[:]
variable[pol] assign[=] call[name[self].processed_policies][name[stmt].uuid]
if call[name[_is_whit... | keyword[def] identifier[_assemble] ( identifier[self] ):
literal[string]
keyword[for] identifier[stmt] keyword[in] identifier[self] . identifier[statements] :
identifier[pol] = identifier[self] . identifier[processed_policies] [ identifier[stmt] . identifier[uuid] ]
key... | def _assemble(self):
"""Calls the appropriate assemble method based on policies."""
for stmt in self.statements:
pol = self.processed_policies[stmt.uuid]
if _is_whitelisted(stmt):
self._dispatch(stmt, 'assemble', self.model, self.agent_set, pol.parameters) # depends on [control=['if... |
def set_selinux_context(path,
user=None,
role=None,
type=None, # pylint: disable=W0622
range=None, # pylint: disable=W0622
persist=False):
'''
.. versionchanged:: Neon
Added pers... | def function[set_selinux_context, parameter[path, user, role, type, range, persist]]:
constant[
.. versionchanged:: Neon
Added persist option
Set a specific SELinux label on a given path
CLI Example:
.. code-block:: bash
salt '*' file.set_selinux_context path <user> <role> <... | keyword[def] identifier[set_selinux_context] ( identifier[path] ,
identifier[user] = keyword[None] ,
identifier[role] = keyword[None] ,
identifier[type] = keyword[None] ,
identifier[range] = keyword[None] ,
identifier[persist] = keyword[False] ):
literal[string]
keyword[if] keyword[not] identifier[a... | def set_selinux_context(path, user=None, role=None, type=None, range=None, persist=False): # pylint: disable=W0622
# pylint: disable=W0622
"\n .. versionchanged:: Neon\n\n Added persist option\n\n Set a specific SELinux label on a given path\n\n CLI Example:\n\n .. code-block:: bash\n\n ... |
def _add_cloud_distro_check(cloud_archive_release, openstack_release):
"""Add the cloud pocket, but also check the cloud_archive_release against
the current distro, and use the openstack_release as the full lookup.
This just calls _add_cloud_pocket() with the openstack_release as pocket
to get the corr... | def function[_add_cloud_distro_check, parameter[cloud_archive_release, openstack_release]]:
constant[Add the cloud pocket, but also check the cloud_archive_release against
the current distro, and use the openstack_release as the full lookup.
This just calls _add_cloud_pocket() with the openstack_releas... | keyword[def] identifier[_add_cloud_distro_check] ( identifier[cloud_archive_release] , identifier[openstack_release] ):
literal[string]
identifier[_verify_is_ubuntu_rel] ( identifier[cloud_archive_release] , identifier[openstack_release] )
identifier[_add_cloud_pocket] ( literal[string] . identifier[f... | def _add_cloud_distro_check(cloud_archive_release, openstack_release):
"""Add the cloud pocket, but also check the cloud_archive_release against
the current distro, and use the openstack_release as the full lookup.
This just calls _add_cloud_pocket() with the openstack_release as pocket
to get the corr... |
def query(self, sql, *args, **kwargs):
"""Executes an SQL SELECT query and returns rows generator.
:param sql: query to execute
:param args: parameters iterable
:param kwargs: parameters iterable
:return: rows generator
:rtype: generator
"""
with self.loc... | def function[query, parameter[self, sql]]:
constant[Executes an SQL SELECT query and returns rows generator.
:param sql: query to execute
:param args: parameters iterable
:param kwargs: parameters iterable
:return: rows generator
:rtype: generator
]
with ... | keyword[def] identifier[query] ( identifier[self] , identifier[sql] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[with] identifier[self] . identifier[locked] () keyword[as] identifier[conn] :
keyword[for] identifier[row] keyword[in] identifier[conn] . ident... | def query(self, sql, *args, **kwargs):
"""Executes an SQL SELECT query and returns rows generator.
:param sql: query to execute
:param args: parameters iterable
:param kwargs: parameters iterable
:return: rows generator
:rtype: generator
"""
with self.locked() as... |
def top(
df,
value: str,
limit: int,
order: str = 'asc',
group: Union[str, List[str]] = None
):
"""
Get the top or flop N results based on a column value for each specified group columns
---
### Parameters
*mandatory :*
- `value` (*str*): column name on... | def function[top, parameter[df, value, limit, order, group]]:
constant[
Get the top or flop N results based on a column value for each specified group columns
---
### Parameters
*mandatory :*
- `value` (*str*): column name on which you will rank the results
- `limit` (*int*): Number t... | keyword[def] identifier[top] (
identifier[df] ,
identifier[value] : identifier[str] ,
identifier[limit] : identifier[int] ,
identifier[order] : identifier[str] = literal[string] ,
identifier[group] : identifier[Union] [ identifier[str] , identifier[List] [ identifier[str] ]]= keyword[None]
):
literal[strin... | def top(df, value: str, limit: int, order: str='asc', group: Union[str, List[str]]=None):
"""
Get the top or flop N results based on a column value for each specified group columns
---
### Parameters
*mandatory :*
- `value` (*str*): column name on which you will rank the results
- `limit`... |
def register(cls, name, encode, decode):
"""Add a codec to the registry.
Registers a codec with the given `name` (a string) to be used with the
given `encode` and `decode` functions, which take a `bytes` object and
return another one. An existing codec is replaced.
>>> import ... | def function[register, parameter[cls, name, encode, decode]]:
constant[Add a codec to the registry.
Registers a codec with the given `name` (a string) to be used with the
given `encode` and `decode` functions, which take a `bytes` object and
return another one. An existing codec is rep... | keyword[def] identifier[register] ( identifier[cls] , identifier[name] , identifier[encode] , identifier[decode] ):
literal[string]
identifier[cls] . identifier[_codecs] [ identifier[name] ]= identifier[cls] . identifier[_codec] ( identifier[encode] , identifier[decode] ) | def register(cls, name, encode, decode):
"""Add a codec to the registry.
Registers a codec with the given `name` (a string) to be used with the
given `encode` and `decode` functions, which take a `bytes` object and
return another one. An existing codec is replaced.
>>> import bina... |
def run_hook(self, hook, *args, **kwargs):
"""
Loop over all plugins and invoke function `hook` with `args` and
`kwargs` in each of them. If the plugin does not have the function, it
is skipped.
"""
for plugin in self.raw_plugins:
if hasattr(plugin, hook):
... | def function[run_hook, parameter[self, hook]]:
constant[
Loop over all plugins and invoke function `hook` with `args` and
`kwargs` in each of them. If the plugin does not have the function, it
is skipped.
]
for taget[name[plugin]] in starred[name[self].raw_plugins] begin[... | keyword[def] identifier[run_hook] ( identifier[self] , identifier[hook] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[for] identifier[plugin] keyword[in] identifier[self] . identifier[raw_plugins] :
keyword[if] identifier[hasattr] ( identifier[plugin] , iden... | def run_hook(self, hook, *args, **kwargs):
"""
Loop over all plugins and invoke function `hook` with `args` and
`kwargs` in each of them. If the plugin does not have the function, it
is skipped.
"""
for plugin in self.raw_plugins:
if hasattr(plugin, hook):
sel... |
def get_object(self, *args, **kwargs):
'''Only talk owners can see talks, unless they've been accepted'''
object_ = super(TalkView, self).get_object(*args, **kwargs)
if not object_.can_view(self.request.user):
raise PermissionDenied
return object_ | def function[get_object, parameter[self]]:
constant[Only talk owners can see talks, unless they've been accepted]
variable[object_] assign[=] call[call[name[super], parameter[name[TalkView], name[self]]].get_object, parameter[<ast.Starred object at 0x7da1b0ea1a80>]]
if <ast.UnaryOp object at 0x7... | keyword[def] identifier[get_object] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[object_] = identifier[super] ( identifier[TalkView] , identifier[self] ). identifier[get_object] (* identifier[args] ,** identifier[kwargs] )
keyword[if] keyword... | def get_object(self, *args, **kwargs):
"""Only talk owners can see talks, unless they've been accepted"""
object_ = super(TalkView, self).get_object(*args, **kwargs)
if not object_.can_view(self.request.user):
raise PermissionDenied # depends on [control=['if'], data=[]]
return object_ |
def _get_two_data_sources(self):
"""Get two sensible data sources, which may be the same."""
selected_display_items = self.selected_display_items
if len(selected_display_items) < 2:
selected_display_items = list()
display_item = self.selected_display_item
if d... | def function[_get_two_data_sources, parameter[self]]:
constant[Get two sensible data sources, which may be the same.]
variable[selected_display_items] assign[=] name[self].selected_display_items
if compare[call[name[len], parameter[name[selected_display_items]]] less[<] constant[2]] begin[:]
... | keyword[def] identifier[_get_two_data_sources] ( identifier[self] ):
literal[string]
identifier[selected_display_items] = identifier[self] . identifier[selected_display_items]
keyword[if] identifier[len] ( identifier[selected_display_items] )< literal[int] :
identifier[selec... | def _get_two_data_sources(self):
"""Get two sensible data sources, which may be the same."""
selected_display_items = self.selected_display_items
if len(selected_display_items) < 2:
selected_display_items = list()
display_item = self.selected_display_item
if display_item:
... |
def _iter_text_wave(
self, text, numbers, step=1,
fore=None, back=None, style=None, rgb_mode=False):
""" Yield colorized characters from `text`, using a wave of `numbers`.
Arguments:
text : String to be colorized.
numbers : A list/tuple ... | def function[_iter_text_wave, parameter[self, text, numbers, step, fore, back, style, rgb_mode]]:
constant[ Yield colorized characters from `text`, using a wave of `numbers`.
Arguments:
text : String to be colorized.
numbers : A list/tuple of numbers (256 color... | keyword[def] identifier[_iter_text_wave] (
identifier[self] , identifier[text] , identifier[numbers] , identifier[step] = literal[int] ,
identifier[fore] = keyword[None] , identifier[back] = keyword[None] , identifier[style] = keyword[None] , identifier[rgb_mode] = keyword[False] ):
literal[string]
... | def _iter_text_wave(self, text, numbers, step=1, fore=None, back=None, style=None, rgb_mode=False):
""" Yield colorized characters from `text`, using a wave of `numbers`.
Arguments:
text : String to be colorized.
numbers : A list/tuple of numbers (256 colors).
... |
def to_string(self, buf=None, columns=None, col_space=None, header=True,
index=True, na_rep='NaN', formatters=None, float_format=None,
sparsify=None, index_names=True, justify=None,
max_rows=None, max_cols=None, show_dimensions=False,
decimal='.', ... | def function[to_string, parameter[self, buf, columns, col_space, header, index, na_rep, formatters, float_format, sparsify, index_names, justify, max_rows, max_cols, show_dimensions, decimal, line_width]]:
constant[
Render a DataFrame to a console-friendly tabular output.
%(shared_params)s
... | keyword[def] identifier[to_string] ( identifier[self] , identifier[buf] = keyword[None] , identifier[columns] = keyword[None] , identifier[col_space] = keyword[None] , identifier[header] = keyword[True] ,
identifier[index] = keyword[True] , identifier[na_rep] = literal[string] , identifier[formatters] = keyword[None... | def to_string(self, buf=None, columns=None, col_space=None, header=True, index=True, na_rep='NaN', formatters=None, float_format=None, sparsify=None, index_names=True, justify=None, max_rows=None, max_cols=None, show_dimensions=False, decimal='.', line_width=None):
"""
Render a DataFrame to a console-friend... |
def prune(self):
"""
On a subtree where the root node's s_center is empty,
return a new subtree with no empty s_centers.
"""
if not self[0] or not self[1]: # if I have an empty branch
direction = not self[0] # graft the other branch here
#if trace... | def function[prune, parameter[self]]:
constant[
On a subtree where the root node's s_center is empty,
return a new subtree with no empty s_centers.
]
if <ast.BoolOp object at 0x7da1b12cb010> begin[:]
variable[direction] assign[=] <ast.UnaryOp object at 0x7da18f58d... | keyword[def] identifier[prune] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] [ literal[int] ] keyword[or] keyword[not] identifier[self] [ literal[int] ]:
identifier[direction] = keyword[not] identifier[self] [ literal[int] ]
... | def prune(self):
"""
On a subtree where the root node's s_center is empty,
return a new subtree with no empty s_centers.
"""
if not self[0] or not self[1]: # if I have an empty branch
direction = not self[0] # graft the other branch here
#if trace:
# print('G... |
def generateName(nodeName: str, instId: int):
"""
Create and return the name for a replica using its nodeName and
instanceId.
Ex: Alpha:1
"""
if isinstance(nodeName, str):
# Because sometimes it is bytes (why?)
if ":" in nodeName:
... | def function[generateName, parameter[nodeName, instId]]:
constant[
Create and return the name for a replica using its nodeName and
instanceId.
Ex: Alpha:1
]
if call[name[isinstance], parameter[name[nodeName], name[str]]] begin[:]
if compare[constant[:] in... | keyword[def] identifier[generateName] ( identifier[nodeName] : identifier[str] , identifier[instId] : identifier[int] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[nodeName] , identifier[str] ):
keyword[if] literal[string] keyword[in] identifier[nodeN... | def generateName(nodeName: str, instId: int):
"""
Create and return the name for a replica using its nodeName and
instanceId.
Ex: Alpha:1
"""
if isinstance(nodeName, str):
# Because sometimes it is bytes (why?)
if ':' in nodeName:
# Because in some ca... |
def supports_calendar_type(self, calendar_type=None):
"""Tests if the given calendar type is supported.
arg: calendar_type (osid.type.Type): a calendar Type
return: (boolean) - ``true`` if the type is supported, ``false``
otherwise
raise: IllegalState - syntax is not... | def function[supports_calendar_type, parameter[self, calendar_type]]:
constant[Tests if the given calendar type is supported.
arg: calendar_type (osid.type.Type): a calendar Type
return: (boolean) - ``true`` if the type is supported, ``false``
otherwise
raise: Illega... | keyword[def] identifier[supports_calendar_type] ( identifier[self] , identifier[calendar_type] = keyword[None] ):
literal[string]
keyword[from] . identifier[osid_errors] keyword[import] identifier[IllegalState] , identifier[NullArgument]
keyword[if] keyword[not] identifier[ca... | def supports_calendar_type(self, calendar_type=None):
"""Tests if the given calendar type is supported.
arg: calendar_type (osid.type.Type): a calendar Type
return: (boolean) - ``true`` if the type is supported, ``false``
otherwise
raise: IllegalState - syntax is not a `... |
def setup_logging(args, conf):
"""Setup logging"""
logging_format = "%(asctime)s [%(levelname)s]: %(name)s (%(module)s.%(funcName)s; " \
"%(filename)s:%(lineno)d)\n %(message)s"
if getattr(args, "verbose", None):
debug_logger = logging.StreamHandler(sys.stdout)
debug... | def function[setup_logging, parameter[args, conf]]:
constant[Setup logging]
variable[logging_format] assign[=] constant[%(asctime)s [%(levelname)s]: %(name)s (%(module)s.%(funcName)s; %(filename)s:%(lineno)d)
%(message)s]
if call[name[getattr], parameter[name[args], constant[verbose], consta... | keyword[def] identifier[setup_logging] ( identifier[args] , identifier[conf] ):
literal[string]
identifier[logging_format] = literal[string] literal[string]
keyword[if] identifier[getattr] ( identifier[args] , literal[string] , keyword[None] ):
identifier[debug_logger] = identifier[loggin... | def setup_logging(args, conf):
"""Setup logging"""
logging_format = '%(asctime)s [%(levelname)s]: %(name)s (%(module)s.%(funcName)s; %(filename)s:%(lineno)d)\n %(message)s'
if getattr(args, 'verbose', None):
debug_logger = logging.StreamHandler(sys.stdout)
debug_logger.addFilter(LogLevelF... |
def load_modules(self, data=None, proxy=None):
'''
Load the modules into the state
'''
log.info('Loading fresh modules for state activity')
# Load a modified client interface that looks like the interface used
# from the minion, but uses remote execution
#
... | def function[load_modules, parameter[self, data, proxy]]:
constant[
Load the modules into the state
]
call[name[log].info, parameter[constant[Loading fresh modules for state activity]]]
name[self].functions assign[=] call[name[salt].client.FunctionWrapper, parameter[name[self].op... | keyword[def] identifier[load_modules] ( identifier[self] , identifier[data] = keyword[None] , identifier[proxy] = keyword[None] ):
literal[string]
identifier[log] . identifier[info] ( literal[string] )
identifier[self] . identifier[functions] = identifier[salt] .... | def load_modules(self, data=None, proxy=None):
"""
Load the modules into the state
"""
log.info('Loading fresh modules for state activity')
# Load a modified client interface that looks like the interface used
# from the minion, but uses remote execution
#
self.functions = salt.c... |
def downcase_word(event):
"""
Lowercase the current (or following) word.
"""
buff = event.current_buffer
for i in range(event.arg): # XXX: not DRY: see meta_c and meta_u!!
pos = buff.document.find_next_word_ending()
words = buff.document.text_after_cursor[:pos]
buff.insert_... | def function[downcase_word, parameter[event]]:
constant[
Lowercase the current (or following) word.
]
variable[buff] assign[=] name[event].current_buffer
for taget[name[i]] in starred[call[name[range], parameter[name[event].arg]]] begin[:]
variable[pos] assign[=] call[nam... | keyword[def] identifier[downcase_word] ( identifier[event] ):
literal[string]
identifier[buff] = identifier[event] . identifier[current_buffer]
keyword[for] identifier[i] keyword[in] identifier[range] ( identifier[event] . identifier[arg] ):
identifier[pos] = identifier[buff] . identifie... | def downcase_word(event):
"""
Lowercase the current (or following) word.
"""
buff = event.current_buffer
for i in range(event.arg): # XXX: not DRY: see meta_c and meta_u!!
pos = buff.document.find_next_word_ending()
words = buff.document.text_after_cursor[:pos]
buff.insert_t... |
def status_favourite(self, id):
"""
Favourite a status.
Returns a `toot dict`_ with the favourited status.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/favourite'.format(str(id))
return self.__api_request('POST', url) | def function[status_favourite, parameter[self, id]]:
constant[
Favourite a status.
Returns a `toot dict`_ with the favourited status.
]
variable[id] assign[=] call[name[self].__unpack_id, parameter[name[id]]]
variable[url] assign[=] call[constant[/api/v1/statuses/{0}/fav... | keyword[def] identifier[status_favourite] ( identifier[self] , identifier[id] ):
literal[string]
identifier[id] = identifier[self] . identifier[__unpack_id] ( identifier[id] )
identifier[url] = literal[string] . identifier[format] ( identifier[str] ( identifier[id] ))
keyword[retu... | def status_favourite(self, id):
"""
Favourite a status.
Returns a `toot dict`_ with the favourited status.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/favourite'.format(str(id))
return self.__api_request('POST', url) |
def _set_rbridge_id(self, v, load=False):
"""
Setter method for rbridge_id, mapped from YANG variable /preprovision/rbridge_id (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_rbridge_id is considered as a private
method. Backends looking to populate this varia... | def function[_set_rbridge_id, parameter[self, v, load]]:
constant[
Setter method for rbridge_id, mapped from YANG variable /preprovision/rbridge_id (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_rbridge_id is considered as a private
method. Backends looki... | keyword[def] identifier[_set_rbridge_id] ( identifier[self] , identifier[v] , identifier[load] = keyword[False] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[v] , literal[string] ):
identifier[v] = identifier[v] . identifier[_utype] ( identifier[v] )
keyword[try] :
ide... | def _set_rbridge_id(self, v, load=False):
"""
Setter method for rbridge_id, mapped from YANG variable /preprovision/rbridge_id (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_rbridge_id is considered as a private
method. Backends looking to populate this varia... |
def check_json(json_type):
"""
Checks whether json_type is a dict or a string. If it is already a dict, it is returned as-is.
If it is not, it is converted to a dict by means of json.loads(json_type)
:param json_type:
:return:
"""
try:
str_types = (str... | def function[check_json, parameter[json_type]]:
constant[
Checks whether json_type is a dict or a string. If it is already a dict, it is returned as-is.
If it is not, it is converted to a dict by means of json.loads(json_type)
:param json_type:
:return:
]
<ast.Try obj... | keyword[def] identifier[check_json] ( identifier[json_type] ):
literal[string]
keyword[try] :
identifier[str_types] =( identifier[str] , identifier[unicode] )
keyword[except] identifier[NameError] :
identifier[str_types] =( identifier[str] ,)
keyword[if... | def check_json(json_type):
"""
Checks whether json_type is a dict or a string. If it is already a dict, it is returned as-is.
If it is not, it is converted to a dict by means of json.loads(json_type)
:param json_type:
:return:
"""
try:
str_types = (str, unicode) ... |
def hardware_connector_sfp_breakout(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
hardware = ET.SubElement(config, "hardware", xmlns="urn:brocade.com:mgmt:brocade-hardware")
connector = ET.SubElement(hardware, "connector")
name_key = ET.SubElem... | def function[hardware_connector_sfp_breakout, parameter[self]]:
constant[Auto Generated Code
]
variable[config] assign[=] call[name[ET].Element, parameter[constant[config]]]
variable[hardware] assign[=] call[name[ET].SubElement, parameter[name[config], constant[hardware]]]
variab... | keyword[def] identifier[hardware_connector_sfp_breakout] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[config] = identifier[ET] . identifier[Element] ( literal[string] )
identifier[hardware] = identifier[ET] . identifier[SubElement] ( identifier[config] , literal[... | def hardware_connector_sfp_breakout(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element('config')
hardware = ET.SubElement(config, 'hardware', xmlns='urn:brocade.com:mgmt:brocade-hardware')
connector = ET.SubElement(hardware, 'connector')
name_key = ET.SubElement(connector, 'name... |
def keypoint_rot90(keypoint, factor, rows, cols, **params):
"""Rotates a keypoint by 90 degrees CCW (see np.rot90)
Args:
keypoint (tuple): A tuple (x, y, angle, scale).
factor (int): Number of CCW rotations. Must be in range [0;3] See np.rot90.
rows (int): Image rows.
cols (int)... | def function[keypoint_rot90, parameter[keypoint, factor, rows, cols]]:
constant[Rotates a keypoint by 90 degrees CCW (see np.rot90)
Args:
keypoint (tuple): A tuple (x, y, angle, scale).
factor (int): Number of CCW rotations. Must be in range [0;3] See np.rot90.
rows (int): Image row... | keyword[def] identifier[keypoint_rot90] ( identifier[keypoint] , identifier[factor] , identifier[rows] , identifier[cols] ,** identifier[params] ):
literal[string]
keyword[if] identifier[factor] < literal[int] keyword[or] identifier[factor] > literal[int] :
keyword[raise] identifier[ValueError... | def keypoint_rot90(keypoint, factor, rows, cols, **params):
"""Rotates a keypoint by 90 degrees CCW (see np.rot90)
Args:
keypoint (tuple): A tuple (x, y, angle, scale).
factor (int): Number of CCW rotations. Must be in range [0;3] See np.rot90.
rows (int): Image rows.
cols (int)... |
def _view_filter(self):
"""
Overrides OsidSession._view_filter to add sequestering filter.
"""
view_filter = OsidSession._view_filter(self)
if self._sequestered_view == SEQUESTERED:
view_filter['sequestered'] = False
return view_filter | def function[_view_filter, parameter[self]]:
constant[
Overrides OsidSession._view_filter to add sequestering filter.
]
variable[view_filter] assign[=] call[name[OsidSession]._view_filter, parameter[name[self]]]
if compare[name[self]._sequestered_view equal[==] name[SEQUESTERED]... | keyword[def] identifier[_view_filter] ( identifier[self] ):
literal[string]
identifier[view_filter] = identifier[OsidSession] . identifier[_view_filter] ( identifier[self] )
keyword[if] identifier[self] . identifier[_sequestered_view] == identifier[SEQUESTERED] :
identifier[v... | def _view_filter(self):
"""
Overrides OsidSession._view_filter to add sequestering filter.
"""
view_filter = OsidSession._view_filter(self)
if self._sequestered_view == SEQUESTERED:
view_filter['sequestered'] = False # depends on [control=['if'], data=[]]
return view_filter |
def upload_delete(self, token, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/attachments#delete-upload"
api_path = "/api/v2/uploads/{token}.json"
api_path = api_path.format(token=token)
return self.call(api_path, method="DELETE", **kwargs) | def function[upload_delete, parameter[self, token]]:
constant[https://developer.zendesk.com/rest_api/docs/core/attachments#delete-upload]
variable[api_path] assign[=] constant[/api/v2/uploads/{token}.json]
variable[api_path] assign[=] call[name[api_path].format, parameter[]]
return[call[name... | keyword[def] identifier[upload_delete] ( identifier[self] , identifier[token] ,** identifier[kwargs] ):
literal[string]
identifier[api_path] = literal[string]
identifier[api_path] = identifier[api_path] . identifier[format] ( identifier[token] = identifier[token] )
keyword[return... | def upload_delete(self, token, **kwargs):
"""https://developer.zendesk.com/rest_api/docs/core/attachments#delete-upload"""
api_path = '/api/v2/uploads/{token}.json'
api_path = api_path.format(token=token)
return self.call(api_path, method='DELETE', **kwargs) |
def where_pivot(self, column, operator=None, value=None, boolean="and"):
"""
Set a where clause for a pivot table column.
:param column: The column of the where clause, can also be a QueryBuilder instance for sub where
:type column: str|Builder
:param operator: The operator of ... | def function[where_pivot, parameter[self, column, operator, value, boolean]]:
constant[
Set a where clause for a pivot table column.
:param column: The column of the where clause, can also be a QueryBuilder instance for sub where
:type column: str|Builder
:param operator: The o... | keyword[def] identifier[where_pivot] ( identifier[self] , identifier[column] , identifier[operator] = keyword[None] , identifier[value] = keyword[None] , identifier[boolean] = literal[string] ):
literal[string]
identifier[self] . identifier[_pivot_wheres] . identifier[append] ([ identifier[column] ... | def where_pivot(self, column, operator=None, value=None, boolean='and'):
"""
Set a where clause for a pivot table column.
:param column: The column of the where clause, can also be a QueryBuilder instance for sub where
:type column: str|Builder
:param operator: The operator of the ... |
def master_compile(master_opts, minion_opts, grains, id_, saltenv):
'''
Compile the master side low state data, and build the hidden state file
'''
st_ = MasterHighState(master_opts, minion_opts, grains, id_, saltenv)
return st_.compile_highstate() | def function[master_compile, parameter[master_opts, minion_opts, grains, id_, saltenv]]:
constant[
Compile the master side low state data, and build the hidden state file
]
variable[st_] assign[=] call[name[MasterHighState], parameter[name[master_opts], name[minion_opts], name[grains], name[id_]... | keyword[def] identifier[master_compile] ( identifier[master_opts] , identifier[minion_opts] , identifier[grains] , identifier[id_] , identifier[saltenv] ):
literal[string]
identifier[st_] = identifier[MasterHighState] ( identifier[master_opts] , identifier[minion_opts] , identifier[grains] , identifier[id_... | def master_compile(master_opts, minion_opts, grains, id_, saltenv):
"""
Compile the master side low state data, and build the hidden state file
"""
st_ = MasterHighState(master_opts, minion_opts, grains, id_, saltenv)
return st_.compile_highstate() |
def multithreader(args, paths):
"""Execute multiple processes at once."""
def shellprocess(path):
"""Return a ready-to-use subprocess."""
import subprocess
return subprocess.Popen(args + [path],
stderr=subprocess.DEVNULL,
s... | def function[multithreader, parameter[args, paths]]:
constant[Execute multiple processes at once.]
def function[shellprocess, parameter[path]]:
constant[Return a ready-to-use subprocess.]
import module[subprocess]
return[call[name[subprocess].Popen, parameter[binary_opera... | keyword[def] identifier[multithreader] ( identifier[args] , identifier[paths] ):
literal[string]
keyword[def] identifier[shellprocess] ( identifier[path] ):
literal[string]
keyword[import] identifier[subprocess]
keyword[return] identifier[subprocess] . identifier[Popen] ( i... | def multithreader(args, paths):
"""Execute multiple processes at once."""
def shellprocess(path):
"""Return a ready-to-use subprocess."""
import subprocess
return subprocess.Popen(args + [path], stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL)
processes = [shellprocess(path) fo... |
def create(self, label=None, name=None, cidr=None):
"""
Wraps the basic create() call to handle specific failures.
"""
try:
return super(CloudNetworkClient, self).create(label=label,
name=name, cidr=cidr)
except exc.BadRequest as e:
msg... | def function[create, parameter[self, label, name, cidr]]:
constant[
Wraps the basic create() call to handle specific failures.
]
<ast.Try object at 0x7da2054a4820> | keyword[def] identifier[create] ( identifier[self] , identifier[label] = keyword[None] , identifier[name] = keyword[None] , identifier[cidr] = keyword[None] ):
literal[string]
keyword[try] :
keyword[return] identifier[super] ( identifier[CloudNetworkClient] , identifier[self] ). ident... | def create(self, label=None, name=None, cidr=None):
"""
Wraps the basic create() call to handle specific failures.
"""
try:
return super(CloudNetworkClient, self).create(label=label, name=name, cidr=cidr) # depends on [control=['try'], data=[]]
except exc.BadRequest as e:
ms... |
def get_live_league_games(self):
"""Returns a dictionary containing a list of ticked games in progress
:return: dictionary of live games, see :doc:`responses </responses>`
"""
url = self.__build_url(urls.GET_LIVE_LEAGUE_GAMES)
req = self.executor(url)
if self.logger:
... | def function[get_live_league_games, parameter[self]]:
constant[Returns a dictionary containing a list of ticked games in progress
:return: dictionary of live games, see :doc:`responses </responses>`
]
variable[url] assign[=] call[name[self].__build_url, parameter[name[urls].GET_LIVE_LEA... | keyword[def] identifier[get_live_league_games] ( identifier[self] ):
literal[string]
identifier[url] = identifier[self] . identifier[__build_url] ( identifier[urls] . identifier[GET_LIVE_LEAGUE_GAMES] )
identifier[req] = identifier[self] . identifier[executor] ( identifier[url] )
... | def get_live_league_games(self):
"""Returns a dictionary containing a list of ticked games in progress
:return: dictionary of live games, see :doc:`responses </responses>`
"""
url = self.__build_url(urls.GET_LIVE_LEAGUE_GAMES)
req = self.executor(url)
if self.logger:
self.logger... |
def genes_by_alias(self, build='37', genes=None):
"""Return a dictionary with hgnc symbols as keys and a list of hgnc ids
as value.
If a gene symbol is listed as primary the list of ids will only consist
of that entry if not the gene can not be determined so the result is a list
... | def function[genes_by_alias, parameter[self, build, genes]]:
constant[Return a dictionary with hgnc symbols as keys and a list of hgnc ids
as value.
If a gene symbol is listed as primary the list of ids will only consist
of that entry if not the gene can not be determined so the re... | keyword[def] identifier[genes_by_alias] ( identifier[self] , identifier[build] = literal[string] , identifier[genes] = keyword[None] ):
literal[string]
identifier[LOG] . identifier[info] ( literal[string] )
identifier[alias_genes] ={}
keyword[if] keyword[not] i... | def genes_by_alias(self, build='37', genes=None):
"""Return a dictionary with hgnc symbols as keys and a list of hgnc ids
as value.
If a gene symbol is listed as primary the list of ids will only consist
of that entry if not the gene can not be determined so the result is a list
... |
def format_script(sensor_graph):
"""Create a binary script containing this sensor graph.
This function produces a repeatable script by applying a known sorting
order to all constants and config variables when iterating over those
dictionaries.
Args:
sensor_graph (SensorGraph): the sensor g... | def function[format_script, parameter[sensor_graph]]:
constant[Create a binary script containing this sensor graph.
This function produces a repeatable script by applying a known sorting
order to all constants and config variables when iterating over those
dictionaries.
Args:
sensor_gr... | keyword[def] identifier[format_script] ( identifier[sensor_graph] ):
literal[string]
identifier[records] =[]
identifier[records] . identifier[append] ( identifier[SetGraphOnlineRecord] ( keyword[False] , identifier[address] = literal[int] ))
identifier[records] . identifier[append] ( identifier... | def format_script(sensor_graph):
"""Create a binary script containing this sensor graph.
This function produces a repeatable script by applying a known sorting
order to all constants and config variables when iterating over those
dictionaries.
Args:
sensor_graph (SensorGraph): the sensor g... |
def load_uint_b(buffer, width):
"""
Loads fixed size integer from the buffer
:param buffer:
:return:
"""
result = 0
for idx in range(width):
result += buffer[idx] << (8 * idx)
return result | def function[load_uint_b, parameter[buffer, width]]:
constant[
Loads fixed size integer from the buffer
:param buffer:
:return:
]
variable[result] assign[=] constant[0]
for taget[name[idx]] in starred[call[name[range], parameter[name[width]]]] begin[:]
<ast.AugAssign obje... | keyword[def] identifier[load_uint_b] ( identifier[buffer] , identifier[width] ):
literal[string]
identifier[result] = literal[int]
keyword[for] identifier[idx] keyword[in] identifier[range] ( identifier[width] ):
identifier[result] += identifier[buffer] [ identifier[idx] ]<<( literal[int]... | def load_uint_b(buffer, width):
"""
Loads fixed size integer from the buffer
:param buffer:
:return:
"""
result = 0
for idx in range(width):
result += buffer[idx] << 8 * idx # depends on [control=['for'], data=['idx']]
return result |
def lock(self):
'''
Try to get locked the file
- the function will wait until the file is unlocked if 'wait' was defined as locktype
- the funciton will raise AlreadyLocked exception if 'lock' was defined as locktype
'''
# Open file
self.__fd = open(self.__lockfi... | def function[lock, parameter[self]]:
constant[
Try to get locked the file
- the function will wait until the file is unlocked if 'wait' was defined as locktype
- the funciton will raise AlreadyLocked exception if 'lock' was defined as locktype
]
name[self].__fd assign[=] ... | keyword[def] identifier[lock] ( identifier[self] ):
literal[string]
identifier[self] . identifier[__fd] = identifier[open] ( identifier[self] . identifier[__lockfile] , literal[string] )
keyword[if] identifier[self] . identifier[__locktype] == literal[string] :
... | def lock(self):
"""
Try to get locked the file
- the function will wait until the file is unlocked if 'wait' was defined as locktype
- the funciton will raise AlreadyLocked exception if 'lock' was defined as locktype
"""
# Open file
self.__fd = open(self.__lockfile, 'w')
... |
def _valid_encoding(elt):
'''Does this node have a valid encoding?
'''
enc = _find_encstyle(elt)
if not enc or enc == _SOAP.ENC: return 1
for e in enc.split():
if e.startswith(_SOAP.ENC):
# XXX Is this correct? Once we find a Sec5 compatible
# XXX encoding, should we... | def function[_valid_encoding, parameter[elt]]:
constant[Does this node have a valid encoding?
]
variable[enc] assign[=] call[name[_find_encstyle], parameter[name[elt]]]
if <ast.BoolOp object at 0x7da1b1594280> begin[:]
return[constant[1]]
for taget[name[e]] in starred[call[na... | keyword[def] identifier[_valid_encoding] ( identifier[elt] ):
literal[string]
identifier[enc] = identifier[_find_encstyle] ( identifier[elt] )
keyword[if] keyword[not] identifier[enc] keyword[or] identifier[enc] == identifier[_SOAP] . identifier[ENC] : keyword[return] literal[int]
keyword[f... | def _valid_encoding(elt):
"""Does this node have a valid encoding?
"""
enc = _find_encstyle(elt)
if not enc or enc == _SOAP.ENC:
return 1 # depends on [control=['if'], data=[]]
for e in enc.split():
if e.startswith(_SOAP.ENC):
# XXX Is this correct? Once we find a Sec5 ... |
def search_for_recipient(self, email, timeout=None, content_type=None):
"""
Get content of emails, sent to a specific email address.
@Params
email - the recipient email address to search for
timeout - seconds to try beore timing out
content_type - type of email string to ... | def function[search_for_recipient, parameter[self, email, timeout, content_type]]:
constant[
Get content of emails, sent to a specific email address.
@Params
email - the recipient email address to search for
timeout - seconds to try beore timing out
content_type - type of... | keyword[def] identifier[search_for_recipient] ( identifier[self] , identifier[email] , identifier[timeout] = keyword[None] , identifier[content_type] = keyword[None] ):
literal[string]
keyword[return] identifier[self] . identifier[search] ( identifier[timeout] = identifier[timeout] ,
iden... | def search_for_recipient(self, email, timeout=None, content_type=None):
"""
Get content of emails, sent to a specific email address.
@Params
email - the recipient email address to search for
timeout - seconds to try beore timing out
content_type - type of email string to retu... |
def paste_buffer(pymux, variables):
"""
Paste clipboard content into buffer.
"""
pane = pymux.arrangement.get_active_pane()
pane.process.write_input(get_app().clipboard.get_data().text, paste=True) | def function[paste_buffer, parameter[pymux, variables]]:
constant[
Paste clipboard content into buffer.
]
variable[pane] assign[=] call[name[pymux].arrangement.get_active_pane, parameter[]]
call[name[pane].process.write_input, parameter[call[call[name[get_app], parameter[]].clipboard.get... | keyword[def] identifier[paste_buffer] ( identifier[pymux] , identifier[variables] ):
literal[string]
identifier[pane] = identifier[pymux] . identifier[arrangement] . identifier[get_active_pane] ()
identifier[pane] . identifier[process] . identifier[write_input] ( identifier[get_app] (). identifier[cli... | def paste_buffer(pymux, variables):
"""
Paste clipboard content into buffer.
"""
pane = pymux.arrangement.get_active_pane()
pane.process.write_input(get_app().clipboard.get_data().text, paste=True) |
def is_obsoleted_by_pid(pid):
"""Return True if ``pid`` is referenced in the obsoletedBy field of any object.
This will return True even if the PID is in the obsoletes field of an object that
does not exist on the local MN, such as replica that is in an incomplete chain.
"""
return d1_gmn.app.mode... | def function[is_obsoleted_by_pid, parameter[pid]]:
constant[Return True if ``pid`` is referenced in the obsoletedBy field of any object.
This will return True even if the PID is in the obsoletes field of an object that
does not exist on the local MN, such as replica that is in an incomplete chain.
... | keyword[def] identifier[is_obsoleted_by_pid] ( identifier[pid] ):
literal[string]
keyword[return] identifier[d1_gmn] . identifier[app] . identifier[models] . identifier[ScienceObject] . identifier[objects] . identifier[filter] (
identifier[obsoleted_by__did] = identifier[pid]
). identifier[exist... | def is_obsoleted_by_pid(pid):
"""Return True if ``pid`` is referenced in the obsoletedBy field of any object.
This will return True even if the PID is in the obsoletes field of an object that
does not exist on the local MN, such as replica that is in an incomplete chain.
"""
return d1_gmn.app.mode... |
def _phir(self, tau, delta):
"""Residual contribution to the free Helmholtz energy
Parameters
----------
tau : float
Inverse reduced temperature Tc/T, [-]
delta : float
Reduced density rho/rhoc, [-]
Returns
-------
prop : dict
... | def function[_phir, parameter[self, tau, delta]]:
constant[Residual contribution to the free Helmholtz energy
Parameters
----------
tau : float
Inverse reduced temperature Tc/T, [-]
delta : float
Reduced density rho/rhoc, [-]
Returns
----... | keyword[def] identifier[_phir] ( identifier[self] , identifier[tau] , identifier[delta] ):
literal[string]
identifier[fir] = identifier[fird] = identifier[firdd] = identifier[firt] = identifier[firtt] = identifier[firdt] = literal[int]
identifier[nr1] = identifier[self] . identi... | def _phir(self, tau, delta):
"""Residual contribution to the free Helmholtz energy
Parameters
----------
tau : float
Inverse reduced temperature Tc/T, [-]
delta : float
Reduced density rho/rhoc, [-]
Returns
-------
prop : dict
... |
def orifice_expansibility(D, Do, P1, P2, k):
r'''Calculates the expansibility factor for orifice plate calculations
based on the geometry of the plate, measured pressures of the orifice, and
the isentropic exponent of the fluid.
.. math::
\epsilon = 1 - (0.351 + 0.256\beta^4 + 0.93\beta^8)
... | def function[orifice_expansibility, parameter[D, Do, P1, P2, k]]:
constant[Calculates the expansibility factor for orifice plate calculations
based on the geometry of the plate, measured pressures of the orifice, and
the isentropic exponent of the fluid.
.. math::
\epsilon = 1 - (0.351 ... | keyword[def] identifier[orifice_expansibility] ( identifier[D] , identifier[Do] , identifier[P1] , identifier[P2] , identifier[k] ):
literal[string]
identifier[beta] = identifier[Do] / identifier[D]
identifier[beta2] = identifier[beta] * identifier[beta]
identifier[beta4] = identifier[beta2] * ... | def orifice_expansibility(D, Do, P1, P2, k):
"""Calculates the expansibility factor for orifice plate calculations
based on the geometry of the plate, measured pressures of the orifice, and
the isentropic exponent of the fluid.
.. math::
\\epsilon = 1 - (0.351 + 0.256\\beta^4 + 0.93\\beta^8... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.