code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def files(xscript=0, yscript=1, eyscript=None, exscript=None, g=None, plotter=xy_databoxes, paths=None, **kwargs):
"""
This will load a bunch of data files, generate data based on the supplied
scripts, and then plot this data using the specified databox plotter.
xscript, yscript, eyscript, exscript ... | def function[files, parameter[xscript, yscript, eyscript, exscript, g, plotter, paths]]:
constant[
This will load a bunch of data files, generate data based on the supplied
scripts, and then plot this data using the specified databox plotter.
xscript, yscript, eyscript, exscript scripts to gener... | keyword[def] identifier[files] ( identifier[xscript] = literal[int] , identifier[yscript] = literal[int] , identifier[eyscript] = keyword[None] , identifier[exscript] = keyword[None] , identifier[g] = keyword[None] , identifier[plotter] = identifier[xy_databoxes] , identifier[paths] = keyword[None] ,** identifier[kwa... | def files(xscript=0, yscript=1, eyscript=None, exscript=None, g=None, plotter=xy_databoxes, paths=None, **kwargs):
"""
This will load a bunch of data files, generate data based on the supplied
scripts, and then plot this data using the specified databox plotter.
xscript, yscript, eyscript, exscript ... |
def already_coords(self, address):
"""test used to see if we have coordinates or address"""
m = re.search(self.COORD_MATCH, address)
return (m != None) | def function[already_coords, parameter[self, address]]:
constant[test used to see if we have coordinates or address]
variable[m] assign[=] call[name[re].search, parameter[name[self].COORD_MATCH, name[address]]]
return[compare[name[m] not_equal[!=] constant[None]]] | keyword[def] identifier[already_coords] ( identifier[self] , identifier[address] ):
literal[string]
identifier[m] = identifier[re] . identifier[search] ( identifier[self] . identifier[COORD_MATCH] , identifier[address] )
keyword[return] ( identifier[m] != keyword[None] ) | def already_coords(self, address):
"""test used to see if we have coordinates or address"""
m = re.search(self.COORD_MATCH, address)
return m != None |
def parse(self, limit=None):
"""
IMPC data is delivered in three separate csv files OR
in one integrated file, each with the same file format.
:param limit:
:return:
"""
if limit is not None:
LOG.info("Only parsing first %s rows fo each file", str(li... | def function[parse, parameter[self, limit]]:
constant[
IMPC data is delivered in three separate csv files OR
in one integrated file, each with the same file format.
:param limit:
:return:
]
if compare[name[limit] is_not constant[None]] begin[:]
c... | keyword[def] identifier[parse] ( identifier[self] , identifier[limit] = keyword[None] ):
literal[string]
keyword[if] identifier[limit] keyword[is] keyword[not] keyword[None] :
identifier[LOG] . identifier[info] ( literal[string] , identifier[str] ( identifier[limit] ))
id... | def parse(self, limit=None):
"""
IMPC data is delivered in three separate csv files OR
in one integrated file, each with the same file format.
:param limit:
:return:
"""
if limit is not None:
LOG.info('Only parsing first %s rows fo each file', str(limit)) # dep... |
async def recv_trailing_metadata(self):
"""Coroutine to wait for trailers with trailing metadata from the
server.
.. note:: This coroutine will be called implicitly at exit from
this call (context manager's exit), if not called before explicitly.
May raise :py:class:`~grpcl... | <ast.AsyncFunctionDef object at 0x7da1b08bd240> | keyword[async] keyword[def] identifier[recv_trailing_metadata] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_end_done] :
keyword[raise] identifier[ProtocolError] ( literal[string] )
keyword[if] (
keyword[not] ident... | async def recv_trailing_metadata(self):
"""Coroutine to wait for trailers with trailing metadata from the
server.
.. note:: This coroutine will be called implicitly at exit from
this call (context manager's exit), if not called before explicitly.
May raise :py:class:`~grpclib.e... |
def isqref(object):
"""
Get whether the object is a I{qualified reference}.
@param object: An object to be tested.
@type object: I{any}
@rtype: boolean
@see: L{qualify}
"""
return (
isinstance(object, tuple) and
len(object) == 2 and
isinstance(object[0], basestrin... | def function[isqref, parameter[object]]:
constant[
Get whether the object is a I{qualified reference}.
@param object: An object to be tested.
@type object: I{any}
@rtype: boolean
@see: L{qualify}
]
return[<ast.BoolOp object at 0x7da1b08e5060>] | keyword[def] identifier[isqref] ( identifier[object] ):
literal[string]
keyword[return] (
identifier[isinstance] ( identifier[object] , identifier[tuple] ) keyword[and]
identifier[len] ( identifier[object] )== literal[int] keyword[and]
identifier[isinstance] ( identifier[object] [ literal... | def isqref(object):
"""
Get whether the object is a I{qualified reference}.
@param object: An object to be tested.
@type object: I{any}
@rtype: boolean
@see: L{qualify}
"""
return isinstance(object, tuple) and len(object) == 2 and isinstance(object[0], basestring) and isinstance(object[1... |
def load_qrandom():
"""
Loads a set of 10000 random numbers generated by qrandom.
This dataset can be used when you want to do some limited tests with "true"
random data without an internet connection.
Returns:
int array
the dataset
"""
fname = "datasets/qrandom.npy"
with pkg_resources.resou... | def function[load_qrandom, parameter[]]:
constant[
Loads a set of 10000 random numbers generated by qrandom.
This dataset can be used when you want to do some limited tests with "true"
random data without an internet connection.
Returns:
int array
the dataset
]
variable[fname] assi... | keyword[def] identifier[load_qrandom] ():
literal[string]
identifier[fname] = literal[string]
keyword[with] identifier[pkg_resources] . identifier[resource_stream] ( identifier[__name__] , identifier[fname] ) keyword[as] identifier[f] :
keyword[return] identifier[np] . identifier[load] ( identifier... | def load_qrandom():
"""
Loads a set of 10000 random numbers generated by qrandom.
This dataset can be used when you want to do some limited tests with "true"
random data without an internet connection.
Returns:
int array
the dataset
"""
fname = 'datasets/qrandom.npy'
with pkg_resources... |
def scene_name(frames):
"""parse a scene.name message"""
# "scene.name" <scene_id> <config>
reader = MessageReader(frames)
results = reader.string("command").uint32("scene_id").string("name").assert_end().get()
if results.command != "scene.name":
raise MessageParserEr... | def function[scene_name, parameter[frames]]:
constant[parse a scene.name message]
variable[reader] assign[=] call[name[MessageReader], parameter[name[frames]]]
variable[results] assign[=] call[call[call[call[call[name[reader].string, parameter[constant[command]]].uint32, parameter[constant[scene... | keyword[def] identifier[scene_name] ( identifier[frames] ):
literal[string]
identifier[reader] = identifier[MessageReader] ( identifier[frames] )
identifier[results] = identifier[reader] . identifier[string] ( literal[string] ). identifier[uint32] ( literal[string] ). identifier[s... | def scene_name(frames):
"""parse a scene.name message"""
# "scene.name" <scene_id> <config>
reader = MessageReader(frames)
results = reader.string('command').uint32('scene_id').string('name').assert_end().get()
if results.command != 'scene.name':
raise MessageParserError("Command is not 'sce... |
def get_project_pod_spec(volume_mounts,
volumes,
image,
command,
args,
ports,
env_vars=None,
env_from=None,
container_na... | def function[get_project_pod_spec, parameter[volume_mounts, volumes, image, command, args, ports, env_vars, env_from, container_name, resources, node_selector, affinity, tolerations, image_pull_policy, restart_policy, service_account_name]]:
constant[Pod spec to be used to create pods for project: tensorboard, ... | keyword[def] identifier[get_project_pod_spec] ( identifier[volume_mounts] ,
identifier[volumes] ,
identifier[image] ,
identifier[command] ,
identifier[args] ,
identifier[ports] ,
identifier[env_vars] = keyword[None] ,
identifier[env_from] = keyword[None] ,
identifier[container_name] = keyword[None] ,
identif... | def get_project_pod_spec(volume_mounts, volumes, image, command, args, ports, env_vars=None, env_from=None, container_name=None, resources=None, node_selector=None, affinity=None, tolerations=None, image_pull_policy=None, restart_policy=None, service_account_name=None):
"""Pod spec to be used to create pods for pro... |
def killCells(self, percent=0.05):
"""
Changes the percentage of cells that are now considered dead. The first
time you call this method a permutation list is set up. Calls change the
number of cells considered dead.
"""
numColumns = numpy.prod(self.getColumnDimensions())
if self.zombiePerm... | def function[killCells, parameter[self, percent]]:
constant[
Changes the percentage of cells that are now considered dead. The first
time you call this method a permutation list is set up. Calls change the
number of cells considered dead.
]
variable[numColumns] assign[=] call[name[numpy]... | keyword[def] identifier[killCells] ( identifier[self] , identifier[percent] = literal[int] ):
literal[string]
identifier[numColumns] = identifier[numpy] . identifier[prod] ( identifier[self] . identifier[getColumnDimensions] ())
keyword[if] identifier[self] . identifier[zombiePermutation] keyword[i... | def killCells(self, percent=0.05):
"""
Changes the percentage of cells that are now considered dead. The first
time you call this method a permutation list is set up. Calls change the
number of cells considered dead.
"""
numColumns = numpy.prod(self.getColumnDimensions())
if self.zombiePermu... |
def link_sources(self):
"Returns potential Link or Stream sources."
if isinstance(self, GenericOverlayPlot):
zorders = []
elif self.batched:
zorders = list(range(self.zorder, self.zorder+len(self.hmap.last)))
else:
zorders = [self.zorder]
if i... | def function[link_sources, parameter[self]]:
constant[Returns potential Link or Stream sources.]
if call[name[isinstance], parameter[name[self], name[GenericOverlayPlot]]] begin[:]
variable[zorders] assign[=] list[[]]
if <ast.BoolOp object at 0x7da18fe93610> begin[:]
... | keyword[def] identifier[link_sources] ( identifier[self] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[self] , identifier[GenericOverlayPlot] ):
identifier[zorders] =[]
keyword[elif] identifier[self] . identifier[batched] :
identifier[zorder... | def link_sources(self):
"""Returns potential Link or Stream sources."""
if isinstance(self, GenericOverlayPlot):
zorders = [] # depends on [control=['if'], data=[]]
elif self.batched:
zorders = list(range(self.zorder, self.zorder + len(self.hmap.last))) # depends on [control=['if'], data=[... |
def do_exit(self, arg):
''' Exit the shell. '''
if self.arm.is_connected():
self.arm.disconnect()
print('Bye!')
return True | def function[do_exit, parameter[self, arg]]:
constant[ Exit the shell. ]
if call[name[self].arm.is_connected, parameter[]] begin[:]
call[name[self].arm.disconnect, parameter[]]
call[name[print], parameter[constant[Bye!]]]
return[constant[True]] | keyword[def] identifier[do_exit] ( identifier[self] , identifier[arg] ):
literal[string]
keyword[if] identifier[self] . identifier[arm] . identifier[is_connected] ():
identifier[self] . identifier[arm] . identifier[disconnect] ()
identifier[print] ( literal[string] )
... | def do_exit(self, arg):
""" Exit the shell. """
if self.arm.is_connected():
self.arm.disconnect() # depends on [control=['if'], data=[]]
print('Bye!')
return True |
def get_qutip_module(required_version='3.2'):
"""
Attempts to return the qutip module, but
silently returns ``None`` if it can't be
imported, or doesn't have version at
least ``required_version``.
:param str required_version: Valid input to
``distutils.version.LooseVersion``.
:retur... | def function[get_qutip_module, parameter[required_version]]:
constant[
Attempts to return the qutip module, but
silently returns ``None`` if it can't be
imported, or doesn't have version at
least ``required_version``.
:param str required_version: Valid input to
``distutils.version.L... | keyword[def] identifier[get_qutip_module] ( identifier[required_version] = literal[string] ):
literal[string]
keyword[try] :
keyword[import] identifier[qutip] keyword[as] identifier[qt]
keyword[from] identifier[distutils] . identifier[version] keyword[import] identifier[LooseVersio... | def get_qutip_module(required_version='3.2'):
"""
Attempts to return the qutip module, but
silently returns ``None`` if it can't be
imported, or doesn't have version at
least ``required_version``.
:param str required_version: Valid input to
``distutils.version.LooseVersion``.
:retur... |
def from_file(cls, filename):
"""
Construct an APIDefinition by parsing the given `filename`.
If PyYAML is installed, YAML files are supported.
JSON files are always supported.
:param filename: The filename to read.
:rtype: APIDefinition
"""
with open(fi... | def function[from_file, parameter[cls, filename]]:
constant[
Construct an APIDefinition by parsing the given `filename`.
If PyYAML is installed, YAML files are supported.
JSON files are always supported.
:param filename: The filename to read.
:rtype: APIDefinition
... | keyword[def] identifier[from_file] ( identifier[cls] , identifier[filename] ):
literal[string]
keyword[with] identifier[open] ( identifier[filename] ) keyword[as] identifier[infp] :
keyword[if] identifier[filename] . identifier[endswith] ( literal[string] ) keyword[or] identifier[f... | def from_file(cls, filename):
"""
Construct an APIDefinition by parsing the given `filename`.
If PyYAML is installed, YAML files are supported.
JSON files are always supported.
:param filename: The filename to read.
:rtype: APIDefinition
"""
with open(filename) ... |
def wsgiref_thread_arbiter(wsgi, host, port):
'probably not suitable for production use; example of threaded server'
import wsgiref.simple_server
httpd = wsgiref.simple_server.make_server(host, port, wsgi)
httpd.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
def start_server():
... | def function[wsgiref_thread_arbiter, parameter[wsgi, host, port]]:
constant[probably not suitable for production use; example of threaded server]
import module[wsgiref.simple_server]
variable[httpd] assign[=] call[name[wsgiref].simple_server.make_server, parameter[name[host], name[port], name[wsgi]]... | keyword[def] identifier[wsgiref_thread_arbiter] ( identifier[wsgi] , identifier[host] , identifier[port] ):
literal[string]
keyword[import] identifier[wsgiref] . identifier[simple_server]
identifier[httpd] = identifier[wsgiref] . identifier[simple_server] . identifier[make_server] ( identifier[host]... | def wsgiref_thread_arbiter(wsgi, host, port):
"""probably not suitable for production use; example of threaded server"""
import wsgiref.simple_server
httpd = wsgiref.simple_server.make_server(host, port, wsgi)
httpd.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
def start_server():
... |
def query(method='servers', server_id=None, command=None, args=None,
http_method='GET', root='api_root'):
''' Make a call to the Scaleway API.
'''
if root == 'api_root':
default_url = 'https://cp-par1.scaleway.com'
else:
default_url = 'https://api-marketplace.scaleway.com'
... | def function[query, parameter[method, server_id, command, args, http_method, root]]:
constant[ Make a call to the Scaleway API.
]
if compare[name[root] equal[==] constant[api_root]] begin[:]
variable[default_url] assign[=] constant[https://cp-par1.scaleway.com]
variable[base_... | keyword[def] identifier[query] ( identifier[method] = literal[string] , identifier[server_id] = keyword[None] , identifier[command] = keyword[None] , identifier[args] = keyword[None] ,
identifier[http_method] = literal[string] , identifier[root] = literal[string] ):
literal[string]
keyword[if] identifie... | def query(method='servers', server_id=None, command=None, args=None, http_method='GET', root='api_root'):
""" Make a call to the Scaleway API.
"""
if root == 'api_root':
default_url = 'https://cp-par1.scaleway.com' # depends on [control=['if'], data=[]]
else:
default_url = 'https://api-... |
def _array_repeat(t, expr):
"""Is this really that useful?
Repeat an array like a Python list using modular arithmetic,
scalar subqueries, and PostgreSQL's ARRAY function.
This is inefficient if PostgreSQL allocates memory for the entire sequence
and the output column. A quick glance at PostgreSQL... | def function[_array_repeat, parameter[t, expr]]:
constant[Is this really that useful?
Repeat an array like a Python list using modular arithmetic,
scalar subqueries, and PostgreSQL's ARRAY function.
This is inefficient if PostgreSQL allocates memory for the entire sequence
and the output colum... | keyword[def] identifier[_array_repeat] ( identifier[t] , identifier[expr] ):
literal[string]
identifier[raw] , identifier[times] = identifier[map] ( identifier[t] . identifier[translate] , identifier[expr] . identifier[op] (). identifier[args] )
identifier[array] = identifier[sa] . identifi... | def _array_repeat(t, expr):
"""Is this really that useful?
Repeat an array like a Python list using modular arithmetic,
scalar subqueries, and PostgreSQL's ARRAY function.
This is inefficient if PostgreSQL allocates memory for the entire sequence
and the output column. A quick glance at PostgreSQL... |
def predict(self, parsed_json):
"""
Parameters
----------
parsed_json : dict
with keys 'data' and 'id', where 'data' contains a recording and
'id' is the id on write-math.com for debugging purposes
"""
evaluate = utils.evaluate_model_single_recordi... | def function[predict, parameter[self, parsed_json]]:
constant[
Parameters
----------
parsed_json : dict
with keys 'data' and 'id', where 'data' contains a recording and
'id' is the id on write-math.com for debugging purposes
]
variable[evaluate] as... | keyword[def] identifier[predict] ( identifier[self] , identifier[parsed_json] ):
literal[string]
identifier[evaluate] = identifier[utils] . identifier[evaluate_model_single_recording_preloaded]
identifier[results] = identifier[evaluate] ( identifier[self] . identifier[preprocessing_queue]... | def predict(self, parsed_json):
"""
Parameters
----------
parsed_json : dict
with keys 'data' and 'id', where 'data' contains a recording and
'id' is the id on write-math.com for debugging purposes
"""
evaluate = utils.evaluate_model_single_recording_prelo... |
def create_from_euler_angles(cls, rx, ry, rz, degrees=False):
""" Classmethod to create a quaternion given the euler angles.
"""
if degrees:
rx, ry, rz = np.radians([rx, ry, rz])
# Obtain quaternions
qx = Quaternion(np.cos(rx/2), 0, 0, np.sin(rx/2))
qy = Quate... | def function[create_from_euler_angles, parameter[cls, rx, ry, rz, degrees]]:
constant[ Classmethod to create a quaternion given the euler angles.
]
if name[degrees] begin[:]
<ast.Tuple object at 0x7da18c4cfbb0> assign[=] call[name[np].radians, parameter[list[[<ast.Name object at ... | keyword[def] identifier[create_from_euler_angles] ( identifier[cls] , identifier[rx] , identifier[ry] , identifier[rz] , identifier[degrees] = keyword[False] ):
literal[string]
keyword[if] identifier[degrees] :
identifier[rx] , identifier[ry] , identifier[rz] = identifier[np] . identi... | def create_from_euler_angles(cls, rx, ry, rz, degrees=False):
""" Classmethod to create a quaternion given the euler angles.
"""
if degrees:
(rx, ry, rz) = np.radians([rx, ry, rz]) # depends on [control=['if'], data=[]]
# Obtain quaternions
qx = Quaternion(np.cos(rx / 2), 0, 0, np.sin(r... |
def from_bytearray(self, stream):
"""
Constructs this frame from input data stream, consuming as many bytes as necessary from
the beginning of the stream.
If stream does not contain enough data to construct a complete modbus frame, an EOFError
is raised and no data is consumed.
... | def function[from_bytearray, parameter[self, stream]]:
constant[
Constructs this frame from input data stream, consuming as many bytes as necessary from
the beginning of the stream.
If stream does not contain enough data to construct a complete modbus frame, an EOFError
is raise... | keyword[def] identifier[from_bytearray] ( identifier[self] , identifier[stream] ):
literal[string]
identifier[fmt] = literal[string]
identifier[size_header] = identifier[struct] . identifier[calcsize] ( identifier[fmt] )
keyword[if] identifier[len] ( identifier[stream] )< identi... | def from_bytearray(self, stream):
"""
Constructs this frame from input data stream, consuming as many bytes as necessary from
the beginning of the stream.
If stream does not contain enough data to construct a complete modbus frame, an EOFError
is raised and no data is consumed.
... |
def _set_ip_vrrp_extended(self, v, load=False):
"""
Setter method for ip_vrrp_extended, mapped from YANG variable /routing_system/interface/ve/ip/ip_vrrp_extended (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_ip_vrrp_extended is considered as a private
... | def function[_set_ip_vrrp_extended, parameter[self, v, load]]:
constant[
Setter method for ip_vrrp_extended, mapped from YANG variable /routing_system/interface/ve/ip/ip_vrrp_extended (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_ip_vrrp_extended is con... | keyword[def] identifier[_set_ip_vrrp_extended] ( identifier[self] , identifier[v] , identifier[load] = keyword[False] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[v] , literal[string] ):
identifier[v] = identifier[v] . identifier[_utype] ( identifier[v] )
keyword[try] :
... | def _set_ip_vrrp_extended(self, v, load=False):
"""
Setter method for ip_vrrp_extended, mapped from YANG variable /routing_system/interface/ve/ip/ip_vrrp_extended (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_ip_vrrp_extended is considered as a private
... |
def top_commenters(self, num):
"""Return a markdown representation of the top commenters."""
num = min(num, len(self.commenters))
if num <= 0:
return ''
top_commenters = sorted(
iteritems(self.commenters),
key=lambda x: (-sum(y.score for y in x[1]),
... | def function[top_commenters, parameter[self, num]]:
constant[Return a markdown representation of the top commenters.]
variable[num] assign[=] call[name[min], parameter[name[num], call[name[len], parameter[name[self].commenters]]]]
if compare[name[num] less_or_equal[<=] constant[0]] begin[:]
... | keyword[def] identifier[top_commenters] ( identifier[self] , identifier[num] ):
literal[string]
identifier[num] = identifier[min] ( identifier[num] , identifier[len] ( identifier[self] . identifier[commenters] ))
keyword[if] identifier[num] <= literal[int] :
keyword[return] ... | def top_commenters(self, num):
"""Return a markdown representation of the top commenters."""
num = min(num, len(self.commenters))
if num <= 0:
return '' # depends on [control=['if'], data=[]]
top_commenters = sorted(iteritems(self.commenters), key=lambda x: (-sum((y.score for y in x[1])), -len(... |
def decode(self, ids):
"""Decodes a list of integers into text."""
ids = text_encoder.pad_decr(ids)
subword_ids = ids
del ids
subwords = []
# Some ids correspond to bytes. Because unicode characters are composed of
# possibly multiple bytes, we attempt to decode contiguous lists of bytes
... | def function[decode, parameter[self, ids]]:
constant[Decodes a list of integers into text.]
variable[ids] assign[=] call[name[text_encoder].pad_decr, parameter[name[ids]]]
variable[subword_ids] assign[=] name[ids]
<ast.Delete object at 0x7da1b20125f0>
variable[subwords] assign[=] lis... | keyword[def] identifier[decode] ( identifier[self] , identifier[ids] ):
literal[string]
identifier[ids] = identifier[text_encoder] . identifier[pad_decr] ( identifier[ids] )
identifier[subword_ids] = identifier[ids]
keyword[del] identifier[ids]
identifier[subwords] =[]
... | def decode(self, ids):
"""Decodes a list of integers into text."""
ids = text_encoder.pad_decr(ids)
subword_ids = ids
del ids
subwords = []
# Some ids correspond to bytes. Because unicode characters are composed of
# possibly multiple bytes, we attempt to decode contiguous lists of bytes
... |
def _get_relative_ext(of, sf):
"""Retrieve relative extension given the original and secondary files.
"""
def half_finished_trim(orig, prefix):
return (os.path.basename(prefix).count(".") > 0 and
os.path.basename(orig).count(".") == os.path.basename(prefix).count("."))
# Handle r... | def function[_get_relative_ext, parameter[of, sf]]:
constant[Retrieve relative extension given the original and secondary files.
]
def function[half_finished_trim, parameter[orig, prefix]]:
return[<ast.BoolOp object at 0x7da1b18ffd60>]
if compare[call[name[of].find, parameter[constan... | keyword[def] identifier[_get_relative_ext] ( identifier[of] , identifier[sf] ):
literal[string]
keyword[def] identifier[half_finished_trim] ( identifier[orig] , identifier[prefix] ):
keyword[return] ( identifier[os] . identifier[path] . identifier[basename] ( identifier[prefix] ). identifier[coun... | def _get_relative_ext(of, sf):
"""Retrieve relative extension given the original and secondary files.
"""
def half_finished_trim(orig, prefix):
return os.path.basename(prefix).count('.') > 0 and os.path.basename(orig).count('.') == os.path.basename(prefix).count('.')
# Handle remote files
i... |
def get_queryset(self):
"""
Returns queryset instance.
:rtype: django.db.models.query.QuerySet.
"""
queryset = super(IndexView, self).get_queryset()
search_form = self.get_search_form()
if search_form.is_valid():
query_str = search_form.cleaned_... | def function[get_queryset, parameter[self]]:
constant[
Returns queryset instance.
:rtype: django.db.models.query.QuerySet.
]
variable[queryset] assign[=] call[call[name[super], parameter[name[IndexView], name[self]]].get_queryset, parameter[]]
variable[search_form] assig... | keyword[def] identifier[get_queryset] ( identifier[self] ):
literal[string]
identifier[queryset] = identifier[super] ( identifier[IndexView] , identifier[self] ). identifier[get_queryset] ()
identifier[search_form] = identifier[self] . identifier[get_search_form] ()
keyword[if] ... | def get_queryset(self):
"""
Returns queryset instance.
:rtype: django.db.models.query.QuerySet.
"""
queryset = super(IndexView, self).get_queryset()
search_form = self.get_search_form()
if search_form.is_valid():
query_str = search_form.cleaned_data.get('q', '').strip()
... |
def container_name(self):
"""
The container_name is the concatenation of ``image_name`` and a uuid1 string
We also remove the url portion of the ``image_name`` before using it.
"""
if getattr(self, "_container_name", NotSpecified) is NotSpecified:
self.container_name... | def function[container_name, parameter[self]]:
constant[
The container_name is the concatenation of ``image_name`` and a uuid1 string
We also remove the url portion of the ``image_name`` before using it.
]
if compare[call[name[getattr], parameter[name[self], constant[_container_... | keyword[def] identifier[container_name] ( identifier[self] ):
literal[string]
keyword[if] identifier[getattr] ( identifier[self] , literal[string] , identifier[NotSpecified] ) keyword[is] identifier[NotSpecified] :
identifier[self] . identifier[container_name] = literal[string] . ide... | def container_name(self):
"""
The container_name is the concatenation of ``image_name`` and a uuid1 string
We also remove the url portion of the ``image_name`` before using it.
"""
if getattr(self, '_container_name', NotSpecified) is NotSpecified:
self.container_name = '{0}-{1}'... |
def _get_action_profile(x, indptr):
"""
Obtain a tuple of mixed actions from a flattened action profile.
Parameters
----------
x : array_like(float, ndim=1)
Array of flattened mixed action profile of length equal to n_0 +
... + n_N-1, where `out[indptr[i]:indptr[i+1]]` contains play... | def function[_get_action_profile, parameter[x, indptr]]:
constant[
Obtain a tuple of mixed actions from a flattened action profile.
Parameters
----------
x : array_like(float, ndim=1)
Array of flattened mixed action profile of length equal to n_0 +
... + n_N-1, where `out[indptr... | keyword[def] identifier[_get_action_profile] ( identifier[x] , identifier[indptr] ):
literal[string]
identifier[N] = identifier[len] ( identifier[indptr] )- literal[int]
identifier[action_profile] = identifier[tuple] ( identifier[x] [ identifier[indptr] [ identifier[i] ]: identifier[indptr] [ identif... | def _get_action_profile(x, indptr):
"""
Obtain a tuple of mixed actions from a flattened action profile.
Parameters
----------
x : array_like(float, ndim=1)
Array of flattened mixed action profile of length equal to n_0 +
... + n_N-1, where `out[indptr[i]:indptr[i+1]]` contains play... |
def RunStateMethod(self, method_name, request=None, responses=None):
"""Completes the request by calling the state method.
Args:
method_name: The name of the state method to call.
request: A RequestState protobuf.
responses: A list of GrrMessages responding to the request.
"""
if self... | def function[RunStateMethod, parameter[self, method_name, request, responses]]:
constant[Completes the request by calling the state method.
Args:
method_name: The name of the state method to call.
request: A RequestState protobuf.
responses: A list of GrrMessages responding to the request... | keyword[def] identifier[RunStateMethod] ( identifier[self] , identifier[method_name] , identifier[request] = keyword[None] , identifier[responses] = keyword[None] ):
literal[string]
keyword[if] identifier[self] . identifier[_TerminationPending] ():
keyword[return]
identifier[client_id] = key... | def RunStateMethod(self, method_name, request=None, responses=None):
"""Completes the request by calling the state method.
Args:
method_name: The name of the state method to call.
request: A RequestState protobuf.
responses: A list of GrrMessages responding to the request.
"""
if self... |
async def open_interface_message(self, message, context):
"""Handle an open_interface message.
See :meth:`AbstractDeviceAdapter.open_interface`.
"""
conn_string = message.get('connection_string')
interface = message.get('interface')
client_id = context.user_data
... | <ast.AsyncFunctionDef object at 0x7da204344040> | keyword[async] keyword[def] identifier[open_interface_message] ( identifier[self] , identifier[message] , identifier[context] ):
literal[string]
identifier[conn_string] = identifier[message] . identifier[get] ( literal[string] )
identifier[interface] = identifier[message] . identifier[ge... | async def open_interface_message(self, message, context):
"""Handle an open_interface message.
See :meth:`AbstractDeviceAdapter.open_interface`.
"""
conn_string = message.get('connection_string')
interface = message.get('interface')
client_id = context.user_data
await self.open_inte... |
def render(self, context, request=None):
"""Render component"""
context['component'] = self
return render_to_string(self.template_name, context, request) | def function[render, parameter[self, context, request]]:
constant[Render component]
call[name[context]][constant[component]] assign[=] name[self]
return[call[name[render_to_string], parameter[name[self].template_name, name[context], name[request]]]] | keyword[def] identifier[render] ( identifier[self] , identifier[context] , identifier[request] = keyword[None] ):
literal[string]
identifier[context] [ literal[string] ]= identifier[self]
keyword[return] identifier[render_to_string] ( identifier[self] . identifier[template_name] , identi... | def render(self, context, request=None):
"""Render component"""
context['component'] = self
return render_to_string(self.template_name, context, request) |
def partial_transform(self, traj):
"""Featurize an MD trajectory into a vector space derived from
residue-residue distances
Parameters
----------
traj : mdtraj.Trajectory
A molecular dynamics trajectory to featurize.
Returns
-------
features ... | def function[partial_transform, parameter[self, traj]]:
constant[Featurize an MD trajectory into a vector space derived from
residue-residue distances
Parameters
----------
traj : mdtraj.Trajectory
A molecular dynamics trajectory to featurize.
Returns
... | keyword[def] identifier[partial_transform] ( identifier[self] , identifier[traj] ):
literal[string]
keyword[if] identifier[self] . identifier[soft_min] :
identifier[distances] , identifier[_] = identifier[md] . identifier[compute_contacts] ( identifier[traj] , identifier[self] . ident... | def partial_transform(self, traj):
"""Featurize an MD trajectory into a vector space derived from
residue-residue distances
Parameters
----------
traj : mdtraj.Trajectory
A molecular dynamics trajectory to featurize.
Returns
-------
features : np... |
def validate(self, value):
"""
Accepts: str, unicode
Returns: unicode
"""
val = value
if isinstance(val, str):
#FIXME: unsafe decoding
val = unicode(value)
val = super(String, self).validate(val)
if not isinstance(val, unicode):
... | def function[validate, parameter[self, value]]:
constant[
Accepts: str, unicode
Returns: unicode
]
variable[val] assign[=] name[value]
if call[name[isinstance], parameter[name[val], name[str]]] begin[:]
variable[val] assign[=] call[name[unicode], parameter... | keyword[def] identifier[validate] ( identifier[self] , identifier[value] ):
literal[string]
identifier[val] = identifier[value]
keyword[if] identifier[isinstance] ( identifier[val] , identifier[str] ):
identifier[val] = identifier[unicode] ( identifier[value] )
... | def validate(self, value):
"""
Accepts: str, unicode
Returns: unicode
"""
val = value
if isinstance(val, str):
#FIXME: unsafe decoding
val = unicode(value) # depends on [control=['if'], data=[]]
val = super(String, self).validate(val)
if not isinstance(val, u... |
def _publish_grade(self, score, only_if_higher=None):
"""
Publish a grade to the runtime.
"""
grade_dict = {
'value': score.raw_earned,
'max_value': score.raw_possible,
'only_if_higher': only_if_higher,
}
self.runtime.publish(self, 'gra... | def function[_publish_grade, parameter[self, score, only_if_higher]]:
constant[
Publish a grade to the runtime.
]
variable[grade_dict] assign[=] dictionary[[<ast.Constant object at 0x7da18f722170>, <ast.Constant object at 0x7da18f720670>, <ast.Constant object at 0x7da18f720370>], [<ast.A... | keyword[def] identifier[_publish_grade] ( identifier[self] , identifier[score] , identifier[only_if_higher] = keyword[None] ):
literal[string]
identifier[grade_dict] ={
literal[string] : identifier[score] . identifier[raw_earned] ,
literal[string] : identifier[score] . identifier[... | def _publish_grade(self, score, only_if_higher=None):
"""
Publish a grade to the runtime.
"""
grade_dict = {'value': score.raw_earned, 'max_value': score.raw_possible, 'only_if_higher': only_if_higher}
self.runtime.publish(self, 'grade', grade_dict) |
def __get_trace_facvar(self, polynomial):
"""Return dense vector representation of a polynomial. This function is
nearly identical to __push_facvar_sparse, but instead of pushing
sparse entries to the constraint matrices, it returns a dense
vector.
"""
facvar = [0] * (sel... | def function[__get_trace_facvar, parameter[self, polynomial]]:
constant[Return dense vector representation of a polynomial. This function is
nearly identical to __push_facvar_sparse, but instead of pushing
sparse entries to the constraint matrices, it returns a dense
vector.
]
... | keyword[def] identifier[__get_trace_facvar] ( identifier[self] , identifier[polynomial] ):
literal[string]
identifier[facvar] =[ literal[int] ]*( identifier[self] . identifier[n_vars] + literal[int] )
identifier[F] ={}
keyword[for] identifier[i] keyword[in] identifier[range] ( ... | def __get_trace_facvar(self, polynomial):
"""Return dense vector representation of a polynomial. This function is
nearly identical to __push_facvar_sparse, but instead of pushing
sparse entries to the constraint matrices, it returns a dense
vector.
"""
facvar = [0] * (self.n_vars... |
def getButtonIdNameFromEnum(self, eButtonId):
"""returns the name of an EVRButtonId enum value. This function is deprecated in favor of the new IVRInput system."""
fn = self.function_table.getButtonIdNameFromEnum
result = fn(eButtonId)
return result | def function[getButtonIdNameFromEnum, parameter[self, eButtonId]]:
constant[returns the name of an EVRButtonId enum value. This function is deprecated in favor of the new IVRInput system.]
variable[fn] assign[=] name[self].function_table.getButtonIdNameFromEnum
variable[result] assign[=] call[na... | keyword[def] identifier[getButtonIdNameFromEnum] ( identifier[self] , identifier[eButtonId] ):
literal[string]
identifier[fn] = identifier[self] . identifier[function_table] . identifier[getButtonIdNameFromEnum]
identifier[result] = identifier[fn] ( identifier[eButtonId] )
keywo... | def getButtonIdNameFromEnum(self, eButtonId):
"""returns the name of an EVRButtonId enum value. This function is deprecated in favor of the new IVRInput system."""
fn = self.function_table.getButtonIdNameFromEnum
result = fn(eButtonId)
return result |
def error(self, msg):
"""Called to handle an error message received from the server.
This method just logs the error message
returned:
NO_RESPONSE_NEEDED
"""
body = msg['body'].replace(NULL, '')
brief_msg = ""
if 'message' in msg['headers']:
... | def function[error, parameter[self, msg]]:
constant[Called to handle an error message received from the server.
This method just logs the error message
returned:
NO_RESPONSE_NEEDED
]
variable[body] assign[=] call[call[name[msg]][constant[body]].replace, parameter[n... | keyword[def] identifier[error] ( identifier[self] , identifier[msg] ):
literal[string]
identifier[body] = identifier[msg] [ literal[string] ]. identifier[replace] ( identifier[NULL] , literal[string] )
identifier[brief_msg] = literal[string]
keyword[if] literal[string] keyword... | def error(self, msg):
"""Called to handle an error message received from the server.
This method just logs the error message
returned:
NO_RESPONSE_NEEDED
"""
body = msg['body'].replace(NULL, '')
brief_msg = ''
if 'message' in msg['headers']:
brief_msg = msg... |
def _construct_deutsch_jozsa_circuit(self):
"""
Builds the Deutsch-Jozsa circuit. Which can determine whether a function f mapping
:math:`\{0,1\}^n \to \{0,1\}` is constant or balanced, provided that it is one of them.
:return: A program corresponding to the desired instance of Deutsch ... | def function[_construct_deutsch_jozsa_circuit, parameter[self]]:
constant[
Builds the Deutsch-Jozsa circuit. Which can determine whether a function f mapping
:math:`\{0,1\}^n o \{0,1\}` is constant or balanced, provided that it is one of them.
:return: A program corresponding to the de... | keyword[def] identifier[_construct_deutsch_jozsa_circuit] ( identifier[self] ):
literal[string]
identifier[dj_prog] = identifier[Program] ()
identifier[dj_prog] . identifier[inst] ( identifier[X] ( identifier[self] . identifier[ancillas] [ literal[int] ]), identifier[H] ( identif... | def _construct_deutsch_jozsa_circuit(self):
"""
Builds the Deutsch-Jozsa circuit. Which can determine whether a function f mapping
:math:`\\{0,1\\}^n o \\{0,1\\}` is constant or balanced, provided that it is one of them.
:return: A program corresponding to the desired instance of Deutsch J... |
def copy(self, name, load_existing_results=False):
"""
Returns a copy of the bpp object with the same parameter settings
but with the files.mcmcfiles and files.outfiles attributes cleared,
and with a new 'name' attribute.
Parameters
----------
name (st... | def function[copy, parameter[self, name, load_existing_results]]:
constant[
Returns a copy of the bpp object with the same parameter settings
but with the files.mcmcfiles and files.outfiles attributes cleared,
and with a new 'name' attribute.
Parameters
------... | keyword[def] identifier[copy] ( identifier[self] , identifier[name] , identifier[load_existing_results] = keyword[False] ):
literal[string]
identifier[subdict] ={ identifier[i] : identifier[j] keyword[for] identifier[i] , identifier[j] keyword[in] identifier[self] . identifier[__dict_... | def copy(self, name, load_existing_results=False):
"""
Returns a copy of the bpp object with the same parameter settings
but with the files.mcmcfiles and files.outfiles attributes cleared,
and with a new 'name' attribute.
Parameters
----------
name (str):
... |
def _get_content(cls, url, headers=HTTP_HEADERS):
"""
Get http content
:param url: contents url
:param headers: http header
:return: BeautifulSoup object
"""
session = requests.Session()
return session.get(url, headers=headers) | def function[_get_content, parameter[cls, url, headers]]:
constant[
Get http content
:param url: contents url
:param headers: http header
:return: BeautifulSoup object
]
variable[session] assign[=] call[name[requests].Session, parameter[]]
return[call[name[ses... | keyword[def] identifier[_get_content] ( identifier[cls] , identifier[url] , identifier[headers] = identifier[HTTP_HEADERS] ):
literal[string]
identifier[session] = identifier[requests] . identifier[Session] ()
keyword[return] identifier[session] . identifier[get] ( identifier[url] , ident... | def _get_content(cls, url, headers=HTTP_HEADERS):
"""
Get http content
:param url: contents url
:param headers: http header
:return: BeautifulSoup object
"""
session = requests.Session()
return session.get(url, headers=headers) |
def send_theme_file(self, filename):
"""
Function used to send static theme files from the theme folder to the browser.
"""
cache_timeout = self.get_send_file_max_age(filename)
return send_from_directory(self.config['THEME_STATIC_FOLDER'], filename,
... | def function[send_theme_file, parameter[self, filename]]:
constant[
Function used to send static theme files from the theme folder to the browser.
]
variable[cache_timeout] assign[=] call[name[self].get_send_file_max_age, parameter[name[filename]]]
return[call[name[send_from_director... | keyword[def] identifier[send_theme_file] ( identifier[self] , identifier[filename] ):
literal[string]
identifier[cache_timeout] = identifier[self] . identifier[get_send_file_max_age] ( identifier[filename] )
keyword[return] identifier[send_from_directory] ( identifier[self] . identifier[c... | def send_theme_file(self, filename):
"""
Function used to send static theme files from the theme folder to the browser.
"""
cache_timeout = self.get_send_file_max_age(filename)
return send_from_directory(self.config['THEME_STATIC_FOLDER'], filename, cache_timeout=cache_timeout) |
def generate_contents(startpath, outfilename=DEFAULT_BUILDFILE):
"""
Generate a build file (yaml) based on the contents of a
directory tree.
"""
def _ignored_name(name):
return (
name.startswith('.') or
name == PACKAGE_DIR_NAME or
name.endswith('~') or
... | def function[generate_contents, parameter[startpath, outfilename]]:
constant[
Generate a build file (yaml) based on the contents of a
directory tree.
]
def function[_ignored_name, parameter[name]]:
return[<ast.BoolOp object at 0x7da1b1240ac0>]
def function[_generate_contents,... | keyword[def] identifier[generate_contents] ( identifier[startpath] , identifier[outfilename] = identifier[DEFAULT_BUILDFILE] ):
literal[string]
keyword[def] identifier[_ignored_name] ( identifier[name] ):
keyword[return] (
identifier[name] . identifier[startswith] ( literal[string] ) key... | def generate_contents(startpath, outfilename=DEFAULT_BUILDFILE):
"""
Generate a build file (yaml) based on the contents of a
directory tree.
"""
def _ignored_name(name):
return name.startswith('.') or name == PACKAGE_DIR_NAME or name.endswith('~') or (name == outfilename)
def _generate... |
def retrieve(self, operation, field=None):
"""Retrieve a position in this collection.
:param operation: Name of an operation
:type operation: :class:`Operation`
:param field: Name of field for sort order
:type field: str
:return: The position for this operation
:... | def function[retrieve, parameter[self, operation, field]]:
constant[Retrieve a position in this collection.
:param operation: Name of an operation
:type operation: :class:`Operation`
:param field: Name of field for sort order
:type field: str
:return: The position for th... | keyword[def] identifier[retrieve] ( identifier[self] , identifier[operation] , identifier[field] = keyword[None] ):
literal[string]
identifier[obj] = identifier[self] . identifier[_get] ( identifier[operation] , identifier[field] )
keyword[if] identifier[obj] keyword[is] keyword[None] :... | def retrieve(self, operation, field=None):
"""Retrieve a position in this collection.
:param operation: Name of an operation
:type operation: :class:`Operation`
:param field: Name of field for sort order
:type field: str
:return: The position for this operation
:rtyp... |
def connect_ex(self, addr):
"""
Call the :meth:`connect_ex` method of the underlying socket and set up
SSL on the socket, using the Context object supplied to this Connection
object at creation. Note that if the :meth:`connect_ex` method of the
socket doesn't return 0, SSL won't ... | def function[connect_ex, parameter[self, addr]]:
constant[
Call the :meth:`connect_ex` method of the underlying socket and set up
SSL on the socket, using the Context object supplied to this Connection
object at creation. Note that if the :meth:`connect_ex` method of the
socket d... | keyword[def] identifier[connect_ex] ( identifier[self] , identifier[addr] ):
literal[string]
identifier[connect_ex] = identifier[self] . identifier[_socket] . identifier[connect_ex]
identifier[self] . identifier[set_connect_state] ()
keyword[return] identifier[connect_ex] ( iden... | def connect_ex(self, addr):
"""
Call the :meth:`connect_ex` method of the underlying socket and set up
SSL on the socket, using the Context object supplied to this Connection
object at creation. Note that if the :meth:`connect_ex` method of the
socket doesn't return 0, SSL won't be i... |
def emit(self,rlen=150):
"""Emit a read based on a source sequence"""
source_tx = self._source.emit()
source_read = self._cutter.cut(source_tx)
if self._flip and self.options.rand.random() < 0.5: source_read = source_read.rc()
srname = self.options.rand.uuid4()
seqfull = FASTQ('@'+se... | def function[emit, parameter[self, rlen]]:
constant[Emit a read based on a source sequence]
variable[source_tx] assign[=] call[name[self]._source.emit, parameter[]]
variable[source_read] assign[=] call[name[self]._cutter.cut, parameter[name[source_tx]]]
if <ast.BoolOp object at 0x7da1b0a... | keyword[def] identifier[emit] ( identifier[self] , identifier[rlen] = literal[int] ):
literal[string]
identifier[source_tx] = identifier[self] . identifier[_source] . identifier[emit] ()
identifier[source_read] = identifier[self] . identifier[_cutter] . identifier[cut] ( identifier[source_tx] )
... | def emit(self, rlen=150):
"""Emit a read based on a source sequence"""
source_tx = self._source.emit()
source_read = self._cutter.cut(source_tx)
if self._flip and self.options.rand.random() < 0.5:
source_read = source_read.rc() # depends on [control=['if'], data=[]]
srname = self.options.ra... |
def login(self):
"""Login to the ZoneMinder API."""
_LOGGER.debug("Attempting to login to ZoneMinder")
login_post = {'view': 'console', 'action': 'login'}
if self._username:
login_post['username'] = self._username
if self._password:
login_post['password']... | def function[login, parameter[self]]:
constant[Login to the ZoneMinder API.]
call[name[_LOGGER].debug, parameter[constant[Attempting to login to ZoneMinder]]]
variable[login_post] assign[=] dictionary[[<ast.Constant object at 0x7da20e954220>, <ast.Constant object at 0x7da20e954bb0>], [<ast.Const... | keyword[def] identifier[login] ( identifier[self] ):
literal[string]
identifier[_LOGGER] . identifier[debug] ( literal[string] )
identifier[login_post] ={ literal[string] : literal[string] , literal[string] : literal[string] }
keyword[if] identifier[self] . identifier[_username]... | def login(self):
"""Login to the ZoneMinder API."""
_LOGGER.debug('Attempting to login to ZoneMinder')
login_post = {'view': 'console', 'action': 'login'}
if self._username:
login_post['username'] = self._username # depends on [control=['if'], data=[]]
if self._password:
login_post[... |
def createWindow(self,cls=None,caption_t=None,*args,**kwargs):
"""
createWindow(cls=window.PengWindow, *args, **kwargs)
Creates a new window using the supplied ``cls``\ .
If ``cls`` is not given, :py:class:`peng3d.window.PengWindow()` will be used.
Any ... | def function[createWindow, parameter[self, cls, caption_t]]:
constant[
createWindow(cls=window.PengWindow, *args, **kwargs)
Creates a new window using the supplied ``cls``\ .
If ``cls`` is not given, :py:class:`peng3d.window.PengWindow()` will be used.
... | keyword[def] identifier[createWindow] ( identifier[self] , identifier[cls] = keyword[None] , identifier[caption_t] = keyword[None] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[if] identifier[cls] keyword[is] keyword[None] :
keyword[from] . keyword[import] i... | def createWindow(self, cls=None, caption_t=None, *args, **kwargs):
"""
createWindow(cls=window.PengWindow, *args, **kwargs)
Creates a new window using the supplied ``cls``\\ .
If ``cls`` is not given, :py:class:`peng3d.window.PengWindow()` will be used.
Any... |
def get_keywords_from_local_file(
local_file, taxonomy_name, output_mode="text",
output_limit=None, spires=False,
match_mode="full", no_cache=False, with_author_keywords=False,
rebuild_cache=False, only_core_tags=False, extract_acronyms=False):
"""Output keywords reading a local file... | def function[get_keywords_from_local_file, parameter[local_file, taxonomy_name, output_mode, output_limit, spires, match_mode, no_cache, with_author_keywords, rebuild_cache, only_core_tags, extract_acronyms]]:
constant[Output keywords reading a local file.
Arguments and output are the same as for :see: get... | keyword[def] identifier[get_keywords_from_local_file] (
identifier[local_file] , identifier[taxonomy_name] , identifier[output_mode] = literal[string] ,
identifier[output_limit] = keyword[None] , identifier[spires] = keyword[False] ,
identifier[match_mode] = literal[string] , identifier[no_cache] = keyword[False] ... | def get_keywords_from_local_file(local_file, taxonomy_name, output_mode='text', output_limit=None, spires=False, match_mode='full', no_cache=False, with_author_keywords=False, rebuild_cache=False, only_core_tags=False, extract_acronyms=False):
"""Output keywords reading a local file.
Arguments and output are t... |
def overlay(repository, files, version, debug=False):
"""
Overlay files from the specified repository/version into the given
directory and return None.
:param repository: A string containing the path to the repository to be
extracted.
:param files: A list of `FileConfig` objects.
:param ve... | def function[overlay, parameter[repository, files, version, debug]]:
constant[
Overlay files from the specified repository/version into the given
directory and return None.
:param repository: A string containing the path to the repository to be
extracted.
:param files: A list of `FileConfi... | keyword[def] identifier[overlay] ( identifier[repository] , identifier[files] , identifier[version] , identifier[debug] = keyword[False] ):
literal[string]
keyword[with] identifier[util] . identifier[saved_cwd] ():
identifier[os] . identifier[chdir] ( identifier[repository] )
identifier[... | def overlay(repository, files, version, debug=False):
"""
Overlay files from the specified repository/version into the given
directory and return None.
:param repository: A string containing the path to the repository to be
extracted.
:param files: A list of `FileConfig` objects.
:param ve... |
def _set_last_rcvd_interface(self, v, load=False):
"""
Setter method for last_rcvd_interface, mapped from YANG variable /brocade_interface_ext_rpc/get_interface_detail/input/last_rcvd_interface (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_last_rcvd_interfa... | def function[_set_last_rcvd_interface, parameter[self, v, load]]:
constant[
Setter method for last_rcvd_interface, mapped from YANG variable /brocade_interface_ext_rpc/get_interface_detail/input/last_rcvd_interface (container)
If this variable is read-only (config: false) in the
source YANG file, th... | keyword[def] identifier[_set_last_rcvd_interface] ( identifier[self] , identifier[v] , identifier[load] = keyword[False] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[v] , literal[string] ):
identifier[v] = identifier[v] . identifier[_utype] ( identifier[v] )
keyword[try] :
... | def _set_last_rcvd_interface(self, v, load=False):
"""
Setter method for last_rcvd_interface, mapped from YANG variable /brocade_interface_ext_rpc/get_interface_detail/input/last_rcvd_interface (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_last_rcvd_interfa... |
def base(number, input_base=10, output_base=10, max_depth=10,
string=False, recurring=True):
"""
Converts a number from any base to any another.
Args:
number(tuple|str|int): The number to convert.
input_base(int): The base to convert from (defualt 10).
output_base(i... | def function[base, parameter[number, input_base, output_base, max_depth, string, recurring]]:
constant[
Converts a number from any base to any another.
Args:
number(tuple|str|int): The number to convert.
input_base(int): The base to convert from (defualt 10).
output_base(int): T... | keyword[def] identifier[base] ( identifier[number] , identifier[input_base] = literal[int] , identifier[output_base] = literal[int] , identifier[max_depth] = literal[int] ,
identifier[string] = keyword[False] , identifier[recurring] = keyword[True] ):
literal[string]
keyword[if] identifier[type]... | def base(number, input_base=10, output_base=10, max_depth=10, string=False, recurring=True):
"""
Converts a number from any base to any another.
Args:
number(tuple|str|int): The number to convert.
input_base(int): The base to convert from (defualt 10).
output_base(int): The base to ... |
def pseudo_inv_components(self,maxsing=None,eigthresh=1.0e-5,truncate=True):
""" Get the (optionally) truncated SVD components
Parameters
----------
maxsing : int
the number of singular components to use. If None,
maxsing is calculated using Matrix.get_maxsing()... | def function[pseudo_inv_components, parameter[self, maxsing, eigthresh, truncate]]:
constant[ Get the (optionally) truncated SVD components
Parameters
----------
maxsing : int
the number of singular components to use. If None,
maxsing is calculated using Matrix.... | keyword[def] identifier[pseudo_inv_components] ( identifier[self] , identifier[maxsing] = keyword[None] , identifier[eigthresh] = literal[int] , identifier[truncate] = keyword[True] ):
literal[string]
keyword[if] identifier[maxsing] keyword[is] keyword[None] :
identifier[maxsing] =... | def pseudo_inv_components(self, maxsing=None, eigthresh=1e-05, truncate=True):
""" Get the (optionally) truncated SVD components
Parameters
----------
maxsing : int
the number of singular components to use. If None,
maxsing is calculated using Matrix.get_maxsing() a... |
def _query(function,
consul_url,
token=None,
method='GET',
api_version='v1',
data=None,
query_params=None):
'''
Consul object method function to construct and execute on the API URL.
:param api_url: The Consul api url.
:param api_ver... | def function[_query, parameter[function, consul_url, token, method, api_version, data, query_params]]:
constant[
Consul object method function to construct and execute on the API URL.
:param api_url: The Consul api url.
:param api_version The Consul api version
:param function: The Cons... | keyword[def] identifier[_query] ( identifier[function] ,
identifier[consul_url] ,
identifier[token] = keyword[None] ,
identifier[method] = literal[string] ,
identifier[api_version] = literal[string] ,
identifier[data] = keyword[None] ,
identifier[query_params] = keyword[None] ):
literal[string]
keyw... | def _query(function, consul_url, token=None, method='GET', api_version='v1', data=None, query_params=None):
"""
Consul object method function to construct and execute on the API URL.
:param api_url: The Consul api url.
:param api_version The Consul api version
:param function: The Consul ap... |
def get_standard_fwl_rules(self, firewall_id):
"""Get the rules of a standard firewall.
:param integer firewall_id: the instance ID of the standard firewall
:returns: A list of the rules.
"""
svc = self.client['Network_Component_Firewall']
return svc.getRules(id=firewal... | def function[get_standard_fwl_rules, parameter[self, firewall_id]]:
constant[Get the rules of a standard firewall.
:param integer firewall_id: the instance ID of the standard firewall
:returns: A list of the rules.
]
variable[svc] assign[=] call[name[self].client][constant[Netwo... | keyword[def] identifier[get_standard_fwl_rules] ( identifier[self] , identifier[firewall_id] ):
literal[string]
identifier[svc] = identifier[self] . identifier[client] [ literal[string] ]
keyword[return] identifier[svc] . identifier[getRules] ( identifier[id] = identifier[firewall_id] , ... | def get_standard_fwl_rules(self, firewall_id):
"""Get the rules of a standard firewall.
:param integer firewall_id: the instance ID of the standard firewall
:returns: A list of the rules.
"""
svc = self.client['Network_Component_Firewall']
return svc.getRules(id=firewall_id, mask=RU... |
def fetch(args):
"""
%prog fetch "query"
OR
%prog fetch queries.txt
Please provide a UniProt compatible `query` to retrieve data. If `query` contains
spaces, please remember to "quote" it.
You can also specify a `filename` which contains queries, one per line.
Follow this syntax <... | def function[fetch, parameter[args]]:
constant[
%prog fetch "query"
OR
%prog fetch queries.txt
Please provide a UniProt compatible `query` to retrieve data. If `query` contains
spaces, please remember to "quote" it.
You can also specify a `filename` which contains queries, one per ... | keyword[def] identifier[fetch] ( identifier[args] ):
literal[string]
keyword[import] identifier[re]
keyword[import] identifier[csv]
identifier[p] = identifier[OptionParser] ( identifier[fetch] . identifier[__doc__] )
identifier[p] . identifier[add_option] ( literal[string] , identifier[... | def fetch(args):
"""
%prog fetch "query"
OR
%prog fetch queries.txt
Please provide a UniProt compatible `query` to retrieve data. If `query` contains
spaces, please remember to "quote" it.
You can also specify a `filename` which contains queries, one per line.
Follow this syntax <... |
def mylogger(name=None, filename=None, indent_offset=7, level=_logging.DEBUG, stream_level=_logging.WARN, file_level=_logging.INFO):
"""
Sets up logging to *filename*.debug.log, *filename*.log, and the terminal. *indent_offset* attempts to line up the lowest indent level to 0. Custom levels:
* *level*: Par... | def function[mylogger, parameter[name, filename, indent_offset, level, stream_level, file_level]]:
constant[
Sets up logging to *filename*.debug.log, *filename*.log, and the terminal. *indent_offset* attempts to line up the lowest indent level to 0. Custom levels:
* *level*: Parent logging level.
*... | keyword[def] identifier[mylogger] ( identifier[name] = keyword[None] , identifier[filename] = keyword[None] , identifier[indent_offset] = literal[int] , identifier[level] = identifier[_logging] . identifier[DEBUG] , identifier[stream_level] = identifier[_logging] . identifier[WARN] , identifier[file_level] = identifi... | def mylogger(name=None, filename=None, indent_offset=7, level=_logging.DEBUG, stream_level=_logging.WARN, file_level=_logging.INFO):
"""
Sets up logging to *filename*.debug.log, *filename*.log, and the terminal. *indent_offset* attempts to line up the lowest indent level to 0. Custom levels:
* *level*: Par... |
def post_build(self, pkt, pay):
"""
Apply the previous methods according to the writing cipher type.
"""
# Compute the length of TLSPlaintext fragment
hdr, frag = pkt[:5], pkt[5:]
if not isinstance(self.tls_session.rcs.cipher, Cipher_NULL):
frag = self._tls_au... | def function[post_build, parameter[self, pkt, pay]]:
constant[
Apply the previous methods according to the writing cipher type.
]
<ast.Tuple object at 0x7da1b21bb940> assign[=] tuple[[<ast.Subscript object at 0x7da1b21b9d50>, <ast.Subscript object at 0x7da1b21bacb0>]]
if <ast.Una... | keyword[def] identifier[post_build] ( identifier[self] , identifier[pkt] , identifier[pay] ):
literal[string]
identifier[hdr] , identifier[frag] = identifier[pkt] [: literal[int] ], identifier[pkt] [ literal[int] :]
keyword[if] keyword[not] identifier[isinstance] ( identifier[se... | def post_build(self, pkt, pay):
"""
Apply the previous methods according to the writing cipher type.
"""
# Compute the length of TLSPlaintext fragment
(hdr, frag) = (pkt[:5], pkt[5:])
if not isinstance(self.tls_session.rcs.cipher, Cipher_NULL):
frag = self._tls_auth_encrypt(frag)... |
def compress(func):
"""Compress result with deflate algorithm if the client ask for it."""
def wrapper(*args, **kwargs):
"""Wrapper that take one function and return the compressed result."""
ret = func(*args, **kwargs)
logger.debug('Receive {} {} request with header: {}'.format(
... | def function[compress, parameter[func]]:
constant[Compress result with deflate algorithm if the client ask for it.]
def function[wrapper, parameter[]]:
constant[Wrapper that take one function and return the compressed result.]
variable[ret] assign[=] call[name[func], para... | keyword[def] identifier[compress] ( identifier[func] ):
literal[string]
keyword[def] identifier[wrapper] (* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[ret] = identifier[func] (* identifier[args] ,** identifier[kwargs] )
identifier[logger] . identifier... | def compress(func):
"""Compress result with deflate algorithm if the client ask for it."""
def wrapper(*args, **kwargs):
"""Wrapper that take one function and return the compressed result."""
ret = func(*args, **kwargs)
logger.debug('Receive {} {} request with header: {}'.format(request... |
def shutdown_kernel(self, kernel_id):
"""Shutdown a kernel by its kernel uuid.
Parameters
==========
kernel_id : uuid
The id of the kernel to shutdown.
"""
self.get_kernel(kernel_id).shutdown_kernel()
del self._kernels[kernel_id] | def function[shutdown_kernel, parameter[self, kernel_id]]:
constant[Shutdown a kernel by its kernel uuid.
Parameters
==========
kernel_id : uuid
The id of the kernel to shutdown.
]
call[call[name[self].get_kernel, parameter[name[kernel_id]]].shutdown_kernel, ... | keyword[def] identifier[shutdown_kernel] ( identifier[self] , identifier[kernel_id] ):
literal[string]
identifier[self] . identifier[get_kernel] ( identifier[kernel_id] ). identifier[shutdown_kernel] ()
keyword[del] identifier[self] . identifier[_kernels] [ identifier[kernel_id] ] | def shutdown_kernel(self, kernel_id):
"""Shutdown a kernel by its kernel uuid.
Parameters
==========
kernel_id : uuid
The id of the kernel to shutdown.
"""
self.get_kernel(kernel_id).shutdown_kernel()
del self._kernels[kernel_id] |
def calc_q0_perc_uz_v1(self):
"""Perform the upper zone layer routine which determines percolation
to the lower zone layer and the fast response of the hland model.
Note that the system behaviour of this method depends strongly on the
specifications of the options |RespArea| and |RecStep|.
Required... | def function[calc_q0_perc_uz_v1, parameter[self]]:
constant[Perform the upper zone layer routine which determines percolation
to the lower zone layer and the fast response of the hland model.
Note that the system behaviour of this method depends strongly on the
specifications of the options |RespAre... | keyword[def] identifier[calc_q0_perc_uz_v1] ( identifier[self] ):
literal[string]
identifier[con] = identifier[self] . identifier[parameters] . identifier[control] . identifier[fastaccess]
identifier[der] = identifier[self] . identifier[parameters] . identifier[derived] . identifier[fastaccess]
... | def calc_q0_perc_uz_v1(self):
"""Perform the upper zone layer routine which determines percolation
to the lower zone layer and the fast response of the hland model.
Note that the system behaviour of this method depends strongly on the
specifications of the options |RespArea| and |RecStep|.
Required... |
def lookup_ip(self, mac):
"""Look for a lease object with given mac address and return the
assigned ip address.
@type mac: str
@rtype: str or None
@raises ValueError:
@raises OmapiError:
@raises OmapiErrorNotFound: if no lease object with the given mac could be found
@raises OmapiErrorAttributeNotFound... | def function[lookup_ip, parameter[self, mac]]:
constant[Look for a lease object with given mac address and return the
assigned ip address.
@type mac: str
@rtype: str or None
@raises ValueError:
@raises OmapiError:
@raises OmapiErrorNotFound: if no lease object with the given mac could be found
@r... | keyword[def] identifier[lookup_ip] ( identifier[self] , identifier[mac] ):
literal[string]
identifier[res] = identifier[self] . identifier[lookup_by_lease] ( identifier[mac] = identifier[mac] )
keyword[try] :
keyword[return] identifier[res] [ literal[string] ]
keyword[except] identifier[KeyError] :... | def lookup_ip(self, mac):
"""Look for a lease object with given mac address and return the
assigned ip address.
@type mac: str
@rtype: str or None
@raises ValueError:
@raises OmapiError:
@raises OmapiErrorNotFound: if no lease object with the given mac could be found
@raises OmapiErrorAttributeNotFou... |
def update_feature(self, dataset, fid, feature):
"""Inserts or updates a feature in a dataset.
Parameters
----------
dataset : str
The dataset id.
fid : str
The feature id.
If the dataset has no feature with the giv... | def function[update_feature, parameter[self, dataset, fid, feature]]:
constant[Inserts or updates a feature in a dataset.
Parameters
----------
dataset : str
The dataset id.
fid : str
The feature id.
If the dataset ... | keyword[def] identifier[update_feature] ( identifier[self] , identifier[dataset] , identifier[fid] , identifier[feature] ):
literal[string]
identifier[uri] = identifier[URITemplate] (
identifier[self] . identifier[baseuri] + literal[string] ). identifier[expand] (
identifier[owne... | def update_feature(self, dataset, fid, feature):
"""Inserts or updates a feature in a dataset.
Parameters
----------
dataset : str
The dataset id.
fid : str
The feature id.
If the dataset has no feature with the given f... |
def parse_rst_content(content, state):
"""Parse rST-formatted string content into docutils nodes
Parameters
----------
content : `str`
ReStructuredText-formatted content
state : ``docutils.statemachine.State``
Usually the directive's ``state`` attribute.
Returns
-------
... | def function[parse_rst_content, parameter[content, state]]:
constant[Parse rST-formatted string content into docutils nodes
Parameters
----------
content : `str`
ReStructuredText-formatted content
state : ``docutils.statemachine.State``
Usually the directive's ``state`` attribut... | keyword[def] identifier[parse_rst_content] ( identifier[content] , identifier[state] ):
literal[string]
identifier[container_node] = identifier[nodes] . identifier[section] ()
identifier[container_node] . identifier[document] = identifier[state] . identifier[document]
identifier[viewl... | def parse_rst_content(content, state):
"""Parse rST-formatted string content into docutils nodes
Parameters
----------
content : `str`
ReStructuredText-formatted content
state : ``docutils.statemachine.State``
Usually the directive's ``state`` attribute.
Returns
-------
... |
def remove(self):
'''
a method to remove collection and all records in the collection
:return: string with confirmation of deletion
'''
title = '%s.remove' % self.__class__.__name__
# request bucket delete
self.s3.delete_bucket(self.bucket_na... | def function[remove, parameter[self]]:
constant[
a method to remove collection and all records in the collection
:return: string with confirmation of deletion
]
variable[title] assign[=] binary_operation[constant[%s.remove] <ast.Mod object at 0x7da2590d6920> name[self].__cl... | keyword[def] identifier[remove] ( identifier[self] ):
literal[string]
identifier[title] = literal[string] % identifier[self] . identifier[__class__] . identifier[__name__]
identifier[self] . identifier[s3] . identifier[delete_bucket] ( identifier[self] . identifier[bucket_name... | def remove(self):
"""
a method to remove collection and all records in the collection
:return: string with confirmation of deletion
"""
title = '%s.remove' % self.__class__.__name__ # request bucket delete
self.s3.delete_bucket(self.bucket_name)
# return confirmation
... |
def is_datetime64_ns_dtype(arr_or_dtype):
"""
Check whether the provided array or dtype is of the datetime64[ns] dtype.
Parameters
----------
arr_or_dtype : array-like
The array or dtype to check.
Returns
-------
boolean
Whether or not the array or dtype is of the datet... | def function[is_datetime64_ns_dtype, parameter[arr_or_dtype]]:
constant[
Check whether the provided array or dtype is of the datetime64[ns] dtype.
Parameters
----------
arr_or_dtype : array-like
The array or dtype to check.
Returns
-------
boolean
Whether or not the... | keyword[def] identifier[is_datetime64_ns_dtype] ( identifier[arr_or_dtype] ):
literal[string]
keyword[if] identifier[arr_or_dtype] keyword[is] keyword[None] :
keyword[return] keyword[False]
keyword[try] :
identifier[tipo] = identifier[_get_dtype] ( identifier[arr_or_dtype] )
... | def is_datetime64_ns_dtype(arr_or_dtype):
"""
Check whether the provided array or dtype is of the datetime64[ns] dtype.
Parameters
----------
arr_or_dtype : array-like
The array or dtype to check.
Returns
-------
boolean
Whether or not the array or dtype is of the datet... |
def assign(self, droplet_id):
"""
Assign the floating IP to a droplet
:param droplet_id: the droplet to assign the floating IP to as either
an ID or a `Droplet` object
:type droplet_id: integer or `Droplet`
:return: an `Action` representing the in-progress operation ... | def function[assign, parameter[self, droplet_id]]:
constant[
Assign the floating IP to a droplet
:param droplet_id: the droplet to assign the floating IP to as either
an ID or a `Droplet` object
:type droplet_id: integer or `Droplet`
:return: an `Action` representing... | keyword[def] identifier[assign] ( identifier[self] , identifier[droplet_id] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[droplet_id] , identifier[Droplet] ):
identifier[droplet_id] = identifier[droplet_id] . identifier[id]
keyword[return] identifier[se... | def assign(self, droplet_id):
"""
Assign the floating IP to a droplet
:param droplet_id: the droplet to assign the floating IP to as either
an ID or a `Droplet` object
:type droplet_id: integer or `Droplet`
:return: an `Action` representing the in-progress operation on t... |
def is_alert_present(self):
"""Tests if an alert is present
@return: True if alert is present, False otherwise
"""
current_frame = None
try:
current_frame = self.driver.current_window_handle
a = self.driver.switch_to_alert()
a.text
exc... | def function[is_alert_present, parameter[self]]:
constant[Tests if an alert is present
@return: True if alert is present, False otherwise
]
variable[current_frame] assign[=] constant[None]
<ast.Try object at 0x7da1b1075960>
return[constant[True]] | keyword[def] identifier[is_alert_present] ( identifier[self] ):
literal[string]
identifier[current_frame] = keyword[None]
keyword[try] :
identifier[current_frame] = identifier[self] . identifier[driver] . identifier[current_window_handle]
identifier[a] = identif... | def is_alert_present(self):
"""Tests if an alert is present
@return: True if alert is present, False otherwise
"""
current_frame = None
try:
current_frame = self.driver.current_window_handle
a = self.driver.switch_to_alert()
a.text # depends on [control=['try'], dat... |
def create_brand(cls, brand, **kwargs):
"""Create Brand
Create a new Brand
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.create_brand(brand, async=True)
>>> result = thread.get()
... | def function[create_brand, parameter[cls, brand]]:
constant[Create Brand
Create a new Brand
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.create_brand(brand, async=True)
>>> result =... | keyword[def] identifier[create_brand] ( identifier[cls] , identifier[brand] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] [ literal[string] ]= keyword[True]
keyword[if] identifier[kwargs] . identifier[get] ( literal[string] ):
keyword[return] identifier[cls] ... | def create_brand(cls, brand, **kwargs):
"""Create Brand
Create a new Brand
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.create_brand(brand, async=True)
>>> result = thread.get()
... |
def display_user(value, arg):
''' Return 'You' if value is equal to arg.
Parameters:
value should be a userprofile
arg should be another user.
Ideally, value should be a userprofile from an object and arg the user logged in.
'''
if value.user == arg and arg.username !... | def function[display_user, parameter[value, arg]]:
constant[ Return 'You' if value is equal to arg.
Parameters:
value should be a userprofile
arg should be another user.
Ideally, value should be a userprofile from an object and arg the user logged in.
]
if <as... | keyword[def] identifier[display_user] ( identifier[value] , identifier[arg] ):
literal[string]
keyword[if] identifier[value] . identifier[user] == identifier[arg] keyword[and] identifier[arg] . identifier[username] != identifier[ANONYMOUS_USERNAME] :
keyword[return] literal[string]
keywo... | def display_user(value, arg):
""" Return 'You' if value is equal to arg.
Parameters:
value should be a userprofile
arg should be another user.
Ideally, value should be a userprofile from an object and arg the user logged in.
"""
if value.user == arg and arg.username !... |
def set_issuer(self, issuer):
"""
Set the issuer of this certificate.
:param issuer: The issuer.
:type issuer: :py:class:`X509Name`
:return: ``None``
"""
self._set_name(_lib.X509_set_issuer_name, issuer)
self._issuer_invalidator.clear() | def function[set_issuer, parameter[self, issuer]]:
constant[
Set the issuer of this certificate.
:param issuer: The issuer.
:type issuer: :py:class:`X509Name`
:return: ``None``
]
call[name[self]._set_name, parameter[name[_lib].X509_set_issuer_name, name[issuer]]... | keyword[def] identifier[set_issuer] ( identifier[self] , identifier[issuer] ):
literal[string]
identifier[self] . identifier[_set_name] ( identifier[_lib] . identifier[X509_set_issuer_name] , identifier[issuer] )
identifier[self] . identifier[_issuer_invalidator] . identifier[clear] () | def set_issuer(self, issuer):
"""
Set the issuer of this certificate.
:param issuer: The issuer.
:type issuer: :py:class:`X509Name`
:return: ``None``
"""
self._set_name(_lib.X509_set_issuer_name, issuer)
self._issuer_invalidator.clear() |
def list_required(self, type=None, service=None): # pylint: disable=redefined-builtin
"""
Displays all packages required by the current role
based on the documented services provided.
"""
from burlap.common import (
required_system_packages,
required_pytho... | def function[list_required, parameter[self, type, service]]:
constant[
Displays all packages required by the current role
based on the documented services provided.
]
from relative_module[burlap.common] import module[required_system_packages], module[required_python_packages], module... | keyword[def] identifier[list_required] ( identifier[self] , identifier[type] = keyword[None] , identifier[service] = keyword[None] ):
literal[string]
keyword[from] identifier[burlap] . identifier[common] keyword[import] (
identifier[required_system_packages] ,
identifier[require... | def list_required(self, type=None, service=None): # pylint: disable=redefined-builtin
'\n Displays all packages required by the current role\n based on the documented services provided.\n '
from burlap.common import required_system_packages, required_python_packages, required_ruby_packages... |
def multilingual_flatpage(request, url):
"""
Multilingual flat page view.
Models: `multilingual.flatpages.models`
Templates: Uses the template defined by the ``template_name`` field,
or `flatpages/default.html` if template_name is not defined.
Context:
flatpage
`flatpage... | def function[multilingual_flatpage, parameter[request, url]]:
constant[
Multilingual flat page view.
Models: `multilingual.flatpages.models`
Templates: Uses the template defined by the ``template_name`` field,
or `flatpages/default.html` if template_name is not defined.
Context:
... | keyword[def] identifier[multilingual_flatpage] ( identifier[request] , identifier[url] ):
literal[string]
keyword[if] keyword[not] identifier[url] . identifier[endswith] ( literal[string] ) keyword[and] identifier[settings] . identifier[APPEND_SLASH] :
keyword[return] identifier[HttpResponseRe... | def multilingual_flatpage(request, url):
"""
Multilingual flat page view.
Models: `multilingual.flatpages.models`
Templates: Uses the template defined by the ``template_name`` field,
or `flatpages/default.html` if template_name is not defined.
Context:
flatpage
`flatpage... |
def check_mod_enabled(mod):
'''
Checks to see if the specific mod symlink is in /etc/apache2/mods-enabled.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.check_mod_enabled status
salt '*' ... | def function[check_mod_enabled, parameter[mod]]:
constant[
Checks to see if the specific mod symlink is in /etc/apache2/mods-enabled.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.check_mod_e... | keyword[def] identifier[check_mod_enabled] ( identifier[mod] ):
literal[string]
keyword[if] identifier[mod] . identifier[endswith] ( literal[string] ) keyword[or] identifier[mod] . identifier[endswith] ( literal[string] ):
identifier[mod_file] = identifier[mod]
keyword[else] :
ide... | def check_mod_enabled(mod):
"""
Checks to see if the specific mod symlink is in /etc/apache2/mods-enabled.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.check_mod_enabled status
salt '*' ... |
def get_dummies(
data,
prefix=None,
prefix_sep="_",
dummy_na=False,
columns=None,
sparse=False,
drop_first=False,
dtype=None,
):
"""Convert categorical variable into indicator variables.
Args:
data (array-like, Series, or DataFrame): data to encode.
prefix (strin... | def function[get_dummies, parameter[data, prefix, prefix_sep, dummy_na, columns, sparse, drop_first, dtype]]:
constant[Convert categorical variable into indicator variables.
Args:
data (array-like, Series, or DataFrame): data to encode.
prefix (string, [string]): Prefix to apply to each enc... | keyword[def] identifier[get_dummies] (
identifier[data] ,
identifier[prefix] = keyword[None] ,
identifier[prefix_sep] = literal[string] ,
identifier[dummy_na] = keyword[False] ,
identifier[columns] = keyword[None] ,
identifier[sparse] = keyword[False] ,
identifier[drop_first] = keyword[False] ,
identifier[dty... | def get_dummies(data, prefix=None, prefix_sep='_', dummy_na=False, columns=None, sparse=False, drop_first=False, dtype=None):
"""Convert categorical variable into indicator variables.
Args:
data (array-like, Series, or DataFrame): data to encode.
prefix (string, [string]): Prefix to apply to ea... |
def render_tree(tree, list_all=True, show_only=None, frozen=False, exclude=None):
"""Convert tree to string representation
:param dict tree: the package tree
:param bool list_all: whether to list all the pgks at the root
level or only those that are the
s... | def function[render_tree, parameter[tree, list_all, show_only, frozen, exclude]]:
constant[Convert tree to string representation
:param dict tree: the package tree
:param bool list_all: whether to list all the pgks at the root
level or only those that are the
... | keyword[def] identifier[render_tree] ( identifier[tree] , identifier[list_all] = keyword[True] , identifier[show_only] = keyword[None] , identifier[frozen] = keyword[False] , identifier[exclude] = keyword[None] ):
literal[string]
identifier[tree] = identifier[sorted_tree] ( identifier[tree] )
identifi... | def render_tree(tree, list_all=True, show_only=None, frozen=False, exclude=None):
"""Convert tree to string representation
:param dict tree: the package tree
:param bool list_all: whether to list all the pgks at the root
level or only those that are the
s... |
def edit_file(self, file_name):
"""Edit file in place, returns a list of modifications (unified diff).
Arguments:
file_name (str, unicode): The name of the file.
"""
with io.open(file_name, "r", encoding=self.encoding) as from_file:
try:
from_lines... | def function[edit_file, parameter[self, file_name]]:
constant[Edit file in place, returns a list of modifications (unified diff).
Arguments:
file_name (str, unicode): The name of the file.
]
with call[name[io].open, parameter[name[file_name], constant[r]]] begin[:]
<a... | keyword[def] identifier[edit_file] ( identifier[self] , identifier[file_name] ):
literal[string]
keyword[with] identifier[io] . identifier[open] ( identifier[file_name] , literal[string] , identifier[encoding] = identifier[self] . identifier[encoding] ) keyword[as] identifier[from_file] :
... | def edit_file(self, file_name):
"""Edit file in place, returns a list of modifications (unified diff).
Arguments:
file_name (str, unicode): The name of the file.
"""
with io.open(file_name, 'r', encoding=self.encoding) as from_file:
try:
from_lines = from_file.rea... |
def _traverse_tree(tree, path):
"""Traverses the permission tree, returning the permission at given permission path."""
path_steps = (step for step in path.split('.') if step != '')
# Special handling for first step, because the first step isn't under 'objects'
first_step = path_steps.ne... | def function[_traverse_tree, parameter[tree, path]]:
constant[Traverses the permission tree, returning the permission at given permission path.]
variable[path_steps] assign[=] <ast.GeneratorExp object at 0x7da20c6aba90>
variable[first_step] assign[=] call[name[path_steps].next, parameter[]]
... | keyword[def] identifier[_traverse_tree] ( identifier[tree] , identifier[path] ):
literal[string]
identifier[path_steps] =( identifier[step] keyword[for] identifier[step] keyword[in] identifier[path] . identifier[split] ( literal[string] ) keyword[if] identifier[step] != literal[string] )
... | def _traverse_tree(tree, path):
"""Traverses the permission tree, returning the permission at given permission path."""
path_steps = (step for step in path.split('.') if step != '')
# Special handling for first step, because the first step isn't under 'objects'
first_step = path_steps.next()
subtree... |
def initialize(self):
"""See :meth:`pymlab.sensors.Device.initialize` for more information.
Calls `initialize()` on all devices connected to the bus.
"""
Device.initialize(self)
for child in iter(self.children.values()):
child.initialize() | def function[initialize, parameter[self]]:
constant[See :meth:`pymlab.sensors.Device.initialize` for more information.
Calls `initialize()` on all devices connected to the bus.
]
call[name[Device].initialize, parameter[name[self]]]
for taget[name[child]] in starred[call[name[ite... | keyword[def] identifier[initialize] ( identifier[self] ):
literal[string]
identifier[Device] . identifier[initialize] ( identifier[self] )
keyword[for] identifier[child] keyword[in] identifier[iter] ( identifier[self] . identifier[children] . identifier[values] ()):
identif... | def initialize(self):
"""See :meth:`pymlab.sensors.Device.initialize` for more information.
Calls `initialize()` on all devices connected to the bus.
"""
Device.initialize(self)
for child in iter(self.children.values()):
child.initialize() # depends on [control=['for'], data=['chil... |
def ansi_sgr(text, fg=None, bg=None, style=None, reset=True, **sgr):
"""
Apply desired SGR commands to given text.
:param text:
Text or anything convertible to text
:param fg:
(optional) Foreground color. Choose one of
``black``, ``red``, ``green``, ``yellow``, ``blue``, ``magen... | def function[ansi_sgr, parameter[text, fg, bg, style, reset]]:
constant[
Apply desired SGR commands to given text.
:param text:
Text or anything convertible to text
:param fg:
(optional) Foreground color. Choose one of
``black``, ``red``, ``green``, ``yellow``, ``blue``, ``m... | keyword[def] identifier[ansi_sgr] ( identifier[text] , identifier[fg] = keyword[None] , identifier[bg] = keyword[None] , identifier[style] = keyword[None] , identifier[reset] = keyword[True] ,** identifier[sgr] ):
literal[string]
identifier[text] = identifier[type] ( literal[string] )( identifier[text... | def ansi_sgr(text, fg=None, bg=None, style=None, reset=True, **sgr):
"""
Apply desired SGR commands to given text.
:param text:
Text or anything convertible to text
:param fg:
(optional) Foreground color. Choose one of
``black``, ``red``, ``green``, ``yellow``, ``blue``, ``magen... |
def on_setup_ssh(self, b):
"""ATTENTION: modifying the order of operations in this function can lead to unexpected problems"""
with self._setup_ssh_out:
clear_output()
self._ssh_keygen()
#temporary passwords
password = self.__password
proxy_pa... | def function[on_setup_ssh, parameter[self, b]]:
constant[ATTENTION: modifying the order of operations in this function can lead to unexpected problems]
with name[self]._setup_ssh_out begin[:]
call[name[clear_output], parameter[]]
call[name[self]._ssh_keygen, parameter[]]
... | keyword[def] identifier[on_setup_ssh] ( identifier[self] , identifier[b] ):
literal[string]
keyword[with] identifier[self] . identifier[_setup_ssh_out] :
identifier[clear_output] ()
identifier[self] . identifier[_ssh_keygen] ()
identifier[passwo... | def on_setup_ssh(self, b):
"""ATTENTION: modifying the order of operations in this function can lead to unexpected problems"""
with self._setup_ssh_out:
clear_output()
self._ssh_keygen()
#temporary passwords
password = self.__password
proxy_password = self.__proxy_passwor... |
def calculate_partition_movement(prev_assignment, curr_assignment):
"""Calculate the partition movements from initial to current assignment.
Algorithm:
For each partition in initial assignment
# If replica set different in current assignment:
# Get Difference in sets
:rty... | def function[calculate_partition_movement, parameter[prev_assignment, curr_assignment]]:
constant[Calculate the partition movements from initial to current assignment.
Algorithm:
For each partition in initial assignment
# If replica set different in current assignment:
# ... | keyword[def] identifier[calculate_partition_movement] ( identifier[prev_assignment] , identifier[curr_assignment] ):
literal[string]
identifier[total_movements] = literal[int]
identifier[movements] ={}
keyword[for] identifier[prev_partition] , identifier[prev_replicas] keyword[in] identifier[... | def calculate_partition_movement(prev_assignment, curr_assignment):
"""Calculate the partition movements from initial to current assignment.
Algorithm:
For each partition in initial assignment
# If replica set different in current assignment:
# Get Difference in sets
:rty... |
def types(self):
"""
List of the known event types
"""
r = requests.get(self.evaluator_url + 'types')
r.raise_for_status()
return r.json() | def function[types, parameter[self]]:
constant[
List of the known event types
]
variable[r] assign[=] call[name[requests].get, parameter[binary_operation[name[self].evaluator_url + constant[types]]]]
call[name[r].raise_for_status, parameter[]]
return[call[name[r].json, parame... | keyword[def] identifier[types] ( identifier[self] ):
literal[string]
identifier[r] = identifier[requests] . identifier[get] ( identifier[self] . identifier[evaluator_url] + literal[string] )
identifier[r] . identifier[raise_for_status] ()
keyword[return] identifier[r] . identifie... | def types(self):
"""
List of the known event types
"""
r = requests.get(self.evaluator_url + 'types')
r.raise_for_status()
return r.json() |
def update_style(self, mapping):
"""Use to update fill-color"""
default = {
"presentation:background-visible": "true",
"presentation:background-objects-visible": "true",
"draw:fill": "solid",
"draw:fill-color": "#772953",
"draw:fill-image-width... | def function[update_style, parameter[self, mapping]]:
constant[Use to update fill-color]
variable[default] assign[=] dictionary[[<ast.Constant object at 0x7da20c7c8c10>, <ast.Constant object at 0x7da20c7c9840>, <ast.Constant object at 0x7da20c7ca440>, <ast.Constant object at 0x7da20c7c96c0>, <ast.Consta... | keyword[def] identifier[update_style] ( identifier[self] , identifier[mapping] ):
literal[string]
identifier[default] ={
literal[string] : literal[string] ,
literal[string] : literal[string] ,
literal[string] : literal[string] ,
literal[string] : literal[string] ... | def update_style(self, mapping):
"""Use to update fill-color"""
default = {'presentation:background-visible': 'true', 'presentation:background-objects-visible': 'true', 'draw:fill': 'solid', 'draw:fill-color': '#772953', 'draw:fill-image-width': '0cm', 'draw:fill-image-height': '0cm', 'presentation:display-foot... |
def make_serializable(data):
"""Ensure data is serializable."""
if is_serializable(data):
return data
# if numpy array convert to list
try:
return data.tolist()
except AttributeError:
pass
except Exception as e:
logger.debug('{} exception ({}): {}'.format(type(e)... | def function[make_serializable, parameter[data]]:
constant[Ensure data is serializable.]
if call[name[is_serializable], parameter[name[data]]] begin[:]
return[name[data]]
<ast.Try object at 0x7da1b040a620>
if call[name[isinstance], parameter[name[data], name[dict]]] begin[:]
... | keyword[def] identifier[make_serializable] ( identifier[data] ):
literal[string]
keyword[if] identifier[is_serializable] ( identifier[data] ):
keyword[return] identifier[data]
keyword[try] :
keyword[return] identifier[data] . identifier[tolist] ()
keyword[except] ... | def make_serializable(data):
"""Ensure data is serializable."""
if is_serializable(data):
return data # depends on [control=['if'], data=[]]
# if numpy array convert to list
try:
return data.tolist() # depends on [control=['try'], data=[]]
except AttributeError:
pass # dep... |
def confd_state_snmp_version_v2c(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
confd_state = ET.SubElement(config, "confd-state", xmlns="http://tail-f.com/yang/confd-monitoring")
snmp = ET.SubElement(confd_state, "snmp")
version = ET.SubElement... | def function[confd_state_snmp_version_v2c, parameter[self]]:
constant[Auto Generated Code
]
variable[config] assign[=] call[name[ET].Element, parameter[constant[config]]]
variable[confd_state] assign[=] call[name[ET].SubElement, parameter[name[config], constant[confd-state]]]
var... | keyword[def] identifier[confd_state_snmp_version_v2c] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[config] = identifier[ET] . identifier[Element] ( literal[string] )
identifier[confd_state] = identifier[ET] . identifier[SubElement] ( identifier[config] , literal[... | def confd_state_snmp_version_v2c(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element('config')
confd_state = ET.SubElement(config, 'confd-state', xmlns='http://tail-f.com/yang/confd-monitoring')
snmp = ET.SubElement(confd_state, 'snmp')
version = ET.SubElement(snmp, 'version')
... |
def png_as_base64_str(self, scale=1, module_color=(0, 0, 0, 255),
background=(255, 255, 255, 255), quiet_zone=4):
"""This method uses the png render and returns the PNG image encoded as
base64 string. This can be useful for creating dynamic PNG images for
web developmen... | def function[png_as_base64_str, parameter[self, scale, module_color, background, quiet_zone]]:
constant[This method uses the png render and returns the PNG image encoded as
base64 string. This can be useful for creating dynamic PNG images for
web development, since no file needs to be created.
... | keyword[def] identifier[png_as_base64_str] ( identifier[self] , identifier[scale] = literal[int] , identifier[module_color] =( literal[int] , literal[int] , literal[int] , literal[int] ),
identifier[background] =( literal[int] , literal[int] , literal[int] , literal[int] ), identifier[quiet_zone] = literal[int] ):
... | def png_as_base64_str(self, scale=1, module_color=(0, 0, 0, 255), background=(255, 255, 255, 255), quiet_zone=4):
"""This method uses the png render and returns the PNG image encoded as
base64 string. This can be useful for creating dynamic PNG images for
web development, since no file needs to be c... |
def Task(func, *args, **kwargs):
"""Adapts a callback-based asynchronous function for use in coroutines.
Takes a function (and optional additional arguments) and runs it with
those arguments plus a ``callback`` keyword argument. The argument passed
to the callback is returned as the result of the yiel... | def function[Task, parameter[func]]:
constant[Adapts a callback-based asynchronous function for use in coroutines.
Takes a function (and optional additional arguments) and runs it with
those arguments plus a ``callback`` keyword argument. The argument passed
to the callback is returned as the resu... | keyword[def] identifier[Task] ( identifier[func] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[future] = identifier[Future] ()
keyword[def] identifier[handle_exception] ( identifier[typ] , identifier[value] , identifier[tb] ):
keyword[if] identifier[future] . ide... | def Task(func, *args, **kwargs):
"""Adapts a callback-based asynchronous function for use in coroutines.
Takes a function (and optional additional arguments) and runs it with
those arguments plus a ``callback`` keyword argument. The argument passed
to the callback is returned as the result of the yiel... |
def unwrap_errors(path_replace):
# type: (Union[Text, Mapping[Text, Text]]) -> Iterator[None]
"""Get a context to map OS errors to their `fs.errors` counterpart.
The context will re-write the paths in resource exceptions to be
in the same context as the wrapped filesystem.
The only parameter may b... | def function[unwrap_errors, parameter[path_replace]]:
constant[Get a context to map OS errors to their `fs.errors` counterpart.
The context will re-write the paths in resource exceptions to be
in the same context as the wrapped filesystem.
The only parameter may be the path from the parent, if onl... | keyword[def] identifier[unwrap_errors] ( identifier[path_replace] ):
literal[string]
keyword[try] :
keyword[yield]
keyword[except] identifier[errors] . identifier[ResourceError] keyword[as] identifier[e] :
keyword[if] identifier[hasattr] ( identifier[e] , literal[string] ):
... | def unwrap_errors(path_replace):
# type: (Union[Text, Mapping[Text, Text]]) -> Iterator[None]
'Get a context to map OS errors to their `fs.errors` counterpart.\n\n The context will re-write the paths in resource exceptions to be\n in the same context as the wrapped filesystem.\n\n The only parameter ma... |
def rename(self, new_id):
"""
Renames the DatabaseObject to have ID_KEY new_id. This is the only
way allowed by DatabaseObject to change the ID_KEY of an object.
Trying to modify ID_KEY in the dictionary will raise an exception.
@param new_id: the new value for ID_KEY
... | def function[rename, parameter[self, new_id]]:
constant[
Renames the DatabaseObject to have ID_KEY new_id. This is the only
way allowed by DatabaseObject to change the ID_KEY of an object.
Trying to modify ID_KEY in the dictionary will raise an exception.
@param new_id:... | keyword[def] identifier[rename] ( identifier[self] , identifier[new_id] ):
literal[string]
identifier[old_id] = identifier[dict] . identifier[__getitem__] ( identifier[self] , identifier[ID_KEY] )
identifier[dict] . identifier[__setitem__] ( identifier[self] , identifier[ID_KEY] , identifi... | def rename(self, new_id):
"""
Renames the DatabaseObject to have ID_KEY new_id. This is the only
way allowed by DatabaseObject to change the ID_KEY of an object.
Trying to modify ID_KEY in the dictionary will raise an exception.
@param new_id: the new value for ID_KEY
... |
def save_vtq():
"""Exit on Signal"""
global vtq
print('Saving VirusTotal Query Cache...')
pickle.dump(vtq, open('vtq.pkl', 'wb'), protocol=pickle.HIGHEST_PROTOCOL)
sys.exit() | def function[save_vtq, parameter[]]:
constant[Exit on Signal]
<ast.Global object at 0x7da18bccaa40>
call[name[print], parameter[constant[Saving VirusTotal Query Cache...]]]
call[name[pickle].dump, parameter[name[vtq], call[name[open], parameter[constant[vtq.pkl], constant[wb]]]]]
cal... | keyword[def] identifier[save_vtq] ():
literal[string]
keyword[global] identifier[vtq]
identifier[print] ( literal[string] )
identifier[pickle] . identifier[dump] ( identifier[vtq] , identifier[open] ( literal[string] , literal[string] ), identifier[protocol] = identifier[pickle] . identifier[H... | def save_vtq():
"""Exit on Signal"""
global vtq
print('Saving VirusTotal Query Cache...')
pickle.dump(vtq, open('vtq.pkl', 'wb'), protocol=pickle.HIGHEST_PROTOCOL)
sys.exit() |
def _instant_search(self):
"""Determine possible keys after a push or pop
"""
_keys = []
for k,v in self.searchables.iteritems():
if self.string in v:
_keys.append(k)
self.candidates.append(_keys) | def function[_instant_search, parameter[self]]:
constant[Determine possible keys after a push or pop
]
variable[_keys] assign[=] list[[]]
for taget[tuple[[<ast.Name object at 0x7da18c4cf250>, <ast.Name object at 0x7da18c4cf2e0>]]] in starred[call[name[self].searchables.iteritems, paramet... | keyword[def] identifier[_instant_search] ( identifier[self] ):
literal[string]
identifier[_keys] =[]
keyword[for] identifier[k] , identifier[v] keyword[in] identifier[self] . identifier[searchables] . identifier[iteritems] ():
keyword[if] identifier[self] . identifier[stri... | def _instant_search(self):
"""Determine possible keys after a push or pop
"""
_keys = []
for (k, v) in self.searchables.iteritems():
if self.string in v:
_keys.append(k) # depends on [control=['if'], data=[]] # depends on [control=['for'], data=[]]
self.candidates.append(_k... |
def _create_config_file(out_dir, samples):
"""Provide configuration file hiding duplicate columns.
Future entry point for providing top level configuration of output reports.
"""
out_file = os.path.join(out_dir, "multiqc_config.yaml")
out = {"table_columns_visible": dict()}
# Avoid duplicated ... | def function[_create_config_file, parameter[out_dir, samples]]:
constant[Provide configuration file hiding duplicate columns.
Future entry point for providing top level configuration of output reports.
]
variable[out_file] assign[=] call[name[os].path.join, parameter[name[out_dir], constant[mul... | keyword[def] identifier[_create_config_file] ( identifier[out_dir] , identifier[samples] ):
literal[string]
identifier[out_file] = identifier[os] . identifier[path] . identifier[join] ( identifier[out_dir] , literal[string] )
identifier[out] ={ literal[string] : identifier[dict] ()}
keyword... | def _create_config_file(out_dir, samples):
"""Provide configuration file hiding duplicate columns.
Future entry point for providing top level configuration of output reports.
"""
out_file = os.path.join(out_dir, 'multiqc_config.yaml')
out = {'table_columns_visible': dict()}
# Avoid duplicated b... |
def p_expression_eql(self, p):
'expression : expression EQL expression'
p[0] = Eql(p[1], p[3], lineno=p.lineno(1))
p.set_lineno(0, p.lineno(1)) | def function[p_expression_eql, parameter[self, p]]:
constant[expression : expression EQL expression]
call[name[p]][constant[0]] assign[=] call[name[Eql], parameter[call[name[p]][constant[1]], call[name[p]][constant[3]]]]
call[name[p].set_lineno, parameter[constant[0], call[name[p].lineno, parame... | keyword[def] identifier[p_expression_eql] ( identifier[self] , identifier[p] ):
literal[string]
identifier[p] [ literal[int] ]= identifier[Eql] ( identifier[p] [ literal[int] ], identifier[p] [ literal[int] ], identifier[lineno] = identifier[p] . identifier[lineno] ( literal[int] ))
identi... | def p_expression_eql(self, p):
"""expression : expression EQL expression"""
p[0] = Eql(p[1], p[3], lineno=p.lineno(1))
p.set_lineno(0, p.lineno(1)) |
def create(self, sip_domain_sid):
"""
Create a new TerminatingSipDomainInstance
:param unicode sip_domain_sid: The SID of the SIP Domain to associate with the trunk
:returns: Newly created TerminatingSipDomainInstance
:rtype: twilio.rest.trunking.v1.trunk.terminating_sip_domain... | def function[create, parameter[self, sip_domain_sid]]:
constant[
Create a new TerminatingSipDomainInstance
:param unicode sip_domain_sid: The SID of the SIP Domain to associate with the trunk
:returns: Newly created TerminatingSipDomainInstance
:rtype: twilio.rest.trunking.v1.t... | keyword[def] identifier[create] ( identifier[self] , identifier[sip_domain_sid] ):
literal[string]
identifier[data] = identifier[values] . identifier[of] ({ literal[string] : identifier[sip_domain_sid] ,})
identifier[payload] = identifier[self] . identifier[_version] . identifier[create] ... | def create(self, sip_domain_sid):
"""
Create a new TerminatingSipDomainInstance
:param unicode sip_domain_sid: The SID of the SIP Domain to associate with the trunk
:returns: Newly created TerminatingSipDomainInstance
:rtype: twilio.rest.trunking.v1.trunk.terminating_sip_domain.Ter... |
def get_tmpdir(requested_tmpdir=None, prefix="", create=True):
'''get a temporary directory for an operation. If SREGISTRY_TMPDIR
is set, return that. Otherwise, return the output of tempfile.mkdtemp
Parameters
==========
requested_tmpdir: an optional requested temporary directory, firs... | def function[get_tmpdir, parameter[requested_tmpdir, prefix, create]]:
constant[get a temporary directory for an operation. If SREGISTRY_TMPDIR
is set, return that. Otherwise, return the output of tempfile.mkdtemp
Parameters
==========
requested_tmpdir: an optional requested tempora... | keyword[def] identifier[get_tmpdir] ( identifier[requested_tmpdir] = keyword[None] , identifier[prefix] = literal[string] , identifier[create] = keyword[True] ):
literal[string]
keyword[from] identifier[sregistry] . identifier[defaults] keyword[import] identifier[SREGISTRY_TMPDIR]
identifier... | def get_tmpdir(requested_tmpdir=None, prefix='', create=True):
"""get a temporary directory for an operation. If SREGISTRY_TMPDIR
is set, return that. Otherwise, return the output of tempfile.mkdtemp
Parameters
==========
requested_tmpdir: an optional requested temporary directory, firs... |
def jx_type(column):
"""
return the jx_type for given column
"""
if column.es_column.endswith(EXISTS_TYPE):
return EXISTS
return es_type_to_json_type[column.es_type] | def function[jx_type, parameter[column]]:
constant[
return the jx_type for given column
]
if call[name[column].es_column.endswith, parameter[name[EXISTS_TYPE]]] begin[:]
return[name[EXISTS]]
return[call[name[es_type_to_json_type]][name[column].es_type]] | keyword[def] identifier[jx_type] ( identifier[column] ):
literal[string]
keyword[if] identifier[column] . identifier[es_column] . identifier[endswith] ( identifier[EXISTS_TYPE] ):
keyword[return] identifier[EXISTS]
keyword[return] identifier[es_type_to_json_type] [ identifier[column] . id... | def jx_type(column):
"""
return the jx_type for given column
"""
if column.es_column.endswith(EXISTS_TYPE):
return EXISTS # depends on [control=['if'], data=[]]
return es_type_to_json_type[column.es_type] |
def handle_client_stream(self, stream, is_unix=False):
""" Handles stream of data received from client. """
assert stream
data = []
stream.settimeout(2)
while True:
try:
if is_unix:
buf = stream.recv(1024)
else:
... | def function[handle_client_stream, parameter[self, stream, is_unix]]:
constant[ Handles stream of data received from client. ]
assert[name[stream]]
variable[data] assign[=] list[[]]
call[name[stream].settimeout, parameter[constant[2]]]
while constant[True] begin[:]
<ast.Try o... | keyword[def] identifier[handle_client_stream] ( identifier[self] , identifier[stream] , identifier[is_unix] = keyword[False] ):
literal[string]
keyword[assert] identifier[stream]
identifier[data] =[]
identifier[stream] . identifier[settimeout] ( literal[int] )
keyword[... | def handle_client_stream(self, stream, is_unix=False):
""" Handles stream of data received from client. """
assert stream
data = []
stream.settimeout(2)
while True:
try:
if is_unix:
buf = stream.recv(1024) # depends on [control=['if'], data=[]]
else:
... |
def _find_scalac_plugins(self, scalac_plugins, classpath):
"""Returns a map from plugin name to list of plugin classpath entries.
The first entry in each list is the classpath entry containing the plugin metadata.
The rest are the internal transitive deps of the plugin.
This allows us to have in-repo ... | def function[_find_scalac_plugins, parameter[self, scalac_plugins, classpath]]:
constant[Returns a map from plugin name to list of plugin classpath entries.
The first entry in each list is the classpath entry containing the plugin metadata.
The rest are the internal transitive deps of the plugin.
... | keyword[def] identifier[_find_scalac_plugins] ( identifier[self] , identifier[scalac_plugins] , identifier[classpath] ):
literal[string]
identifier[plugin_names] ={ identifier[p] keyword[for] identifier[val] keyword[in] identifier[scalac_plugins] keyword[for] identifier[p] keyword[in] identifi... | def _find_scalac_plugins(self, scalac_plugins, classpath):
"""Returns a map from plugin name to list of plugin classpath entries.
The first entry in each list is the classpath entry containing the plugin metadata.
The rest are the internal transitive deps of the plugin.
This allows us to have in-repo ... |
def replace(self, **updates):
"""Return a new profile with the given updates.
Unspecified fields will be the same as this instance. See `__new__`
for details on the arguments.
"""
state = self.dump()
state.update(updates)
return self.__class__(**state) | def function[replace, parameter[self]]:
constant[Return a new profile with the given updates.
Unspecified fields will be the same as this instance. See `__new__`
for details on the arguments.
]
variable[state] assign[=] call[name[self].dump, parameter[]]
call[name[state]... | keyword[def] identifier[replace] ( identifier[self] ,** identifier[updates] ):
literal[string]
identifier[state] = identifier[self] . identifier[dump] ()
identifier[state] . identifier[update] ( identifier[updates] )
keyword[return] identifier[self] . identifier[__class__] (** id... | def replace(self, **updates):
"""Return a new profile with the given updates.
Unspecified fields will be the same as this instance. See `__new__`
for details on the arguments.
"""
state = self.dump()
state.update(updates)
return self.__class__(**state) |
def getAccountRole(store, accountNames):
"""
Retrieve the first Role in the given store which corresponds an account
name in C{accountNames}.
Note: the implementation currently ignores all of the values in
C{accountNames} except for the first.
@param accountNames: A C{list} of two-tuples of ac... | def function[getAccountRole, parameter[store, accountNames]]:
constant[
Retrieve the first Role in the given store which corresponds an account
name in C{accountNames}.
Note: the implementation currently ignores all of the values in
C{accountNames} except for the first.
@param accountNames... | keyword[def] identifier[getAccountRole] ( identifier[store] , identifier[accountNames] ):
literal[string]
keyword[for] ( identifier[localpart] , identifier[domain] ) keyword[in] identifier[accountNames] :
keyword[return] identifier[getPrimaryRole] ( identifier[store] , literal[string] %( identif... | def getAccountRole(store, accountNames):
"""
Retrieve the first Role in the given store which corresponds an account
name in C{accountNames}.
Note: the implementation currently ignores all of the values in
C{accountNames} except for the first.
@param accountNames: A C{list} of two-tuples of ac... |
def to_python(self, value):
""" Return a str representation of the hexadecimal """
if isinstance(value, six.string_types):
return value
if value is None:
return value
return _unsigned_integer_to_hex_string(value) | def function[to_python, parameter[self, value]]:
constant[ Return a str representation of the hexadecimal ]
if call[name[isinstance], parameter[name[value], name[six].string_types]] begin[:]
return[name[value]]
if compare[name[value] is constant[None]] begin[:]
return[name[value]... | keyword[def] identifier[to_python] ( identifier[self] , identifier[value] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[value] , identifier[six] . identifier[string_types] ):
keyword[return] identifier[value]
keyword[if] identifier[value] keyword[is] keyword[None] :
keywor... | def to_python(self, value):
""" Return a str representation of the hexadecimal """
if isinstance(value, six.string_types):
return value # depends on [control=['if'], data=[]]
if value is None:
return value # depends on [control=['if'], data=['value']]
return _unsigned_integer_to_hex_st... |
def get_idp_choices():
"""
Get a list of identity providers choices for enterprise customer.
Return:
A list of choices of all identity providers, None if it can not get any available identity provider.
"""
try:
from third_party_auth.provider import Registry # pylint: disable=redef... | def function[get_idp_choices, parameter[]]:
constant[
Get a list of identity providers choices for enterprise customer.
Return:
A list of choices of all identity providers, None if it can not get any available identity provider.
]
<ast.Try object at 0x7da18f09c190>
variable[firs... | keyword[def] identifier[get_idp_choices] ():
literal[string]
keyword[try] :
keyword[from] identifier[third_party_auth] . identifier[provider] keyword[import] identifier[Registry]
keyword[except] identifier[ImportError] keyword[as] identifier[exception] :
identifier[LOGGER] . i... | def get_idp_choices():
"""
Get a list of identity providers choices for enterprise customer.
Return:
A list of choices of all identity providers, None if it can not get any available identity provider.
"""
try:
from third_party_auth.provider import Registry # pylint: disable=redefi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.