code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def get_metadata(self):
"""
Convert dictionary returned after docker inspect command into instance of ContainerMetadata class
:return: ContainerMetadata, container metadata instance
"""
inspect_data = self.inspect(refresh=True)
inspect_to_container_metadata(self.metadata,... | def function[get_metadata, parameter[self]]:
constant[
Convert dictionary returned after docker inspect command into instance of ContainerMetadata class
:return: ContainerMetadata, container metadata instance
]
variable[inspect_data] assign[=] call[name[self].inspect, parameter[]... | keyword[def] identifier[get_metadata] ( identifier[self] ):
literal[string]
identifier[inspect_data] = identifier[self] . identifier[inspect] ( identifier[refresh] = keyword[True] )
identifier[inspect_to_container_metadata] ( identifier[self] . identifier[metadata] , identifier[inspect_dat... | def get_metadata(self):
"""
Convert dictionary returned after docker inspect command into instance of ContainerMetadata class
:return: ContainerMetadata, container metadata instance
"""
inspect_data = self.inspect(refresh=True)
inspect_to_container_metadata(self.metadata, inspect_dat... |
def Hfus(T=298.15, P=101325, MW=None, AvailableMethods=False, Method=None, CASRN=''): # pragma: no cover
'''This function handles the calculation of a chemical's enthalpy of fusion.
Generally this, is used by the chemical class, as all parameters are passed.
Calling the function directly works okay.
E... | def function[Hfus, parameter[T, P, MW, AvailableMethods, Method, CASRN]]:
constant[This function handles the calculation of a chemical's enthalpy of fusion.
Generally this, is used by the chemical class, as all parameters are passed.
Calling the function directly works okay.
Enthalpy of fusion is a... | keyword[def] identifier[Hfus] ( identifier[T] = literal[int] , identifier[P] = literal[int] , identifier[MW] = keyword[None] , identifier[AvailableMethods] = keyword[False] , identifier[Method] = keyword[None] , identifier[CASRN] = literal[string] ):
literal[string]
keyword[def] identifier[list_methods] (... | def Hfus(T=298.15, P=101325, MW=None, AvailableMethods=False, Method=None, CASRN=''): # pragma: no cover
"This function handles the calculation of a chemical's enthalpy of fusion.\n Generally this, is used by the chemical class, as all parameters are passed.\n Calling the function directly works okay.\n\n ... |
def uniq2orderipix(uniq):
"""
convert a HEALPix pixel coded as a NUNIQ number
to a (norder, ipix) tuple
"""
order = ((np.log2(uniq//4)) // 2)
order = order.astype(int)
ipix = uniq - 4 * (4**order)
return order, ipix | def function[uniq2orderipix, parameter[uniq]]:
constant[
convert a HEALPix pixel coded as a NUNIQ number
to a (norder, ipix) tuple
]
variable[order] assign[=] binary_operation[call[name[np].log2, parameter[binary_operation[name[uniq] <ast.FloorDiv object at 0x7da2590d6bc0> constant[4]]]] <as... | keyword[def] identifier[uniq2orderipix] ( identifier[uniq] ):
literal[string]
identifier[order] =(( identifier[np] . identifier[log2] ( identifier[uniq] // literal[int] ))// literal[int] )
identifier[order] = identifier[order] . identifier[astype] ( identifier[int] )
identifier[ipix] = identifier... | def uniq2orderipix(uniq):
"""
convert a HEALPix pixel coded as a NUNIQ number
to a (norder, ipix) tuple
"""
order = np.log2(uniq // 4) // 2
order = order.astype(int)
ipix = uniq - 4 * 4 ** order
return (order, ipix) |
def get_input_vector(self, ind):
"""
Given an index, get the corresponding vector of the Input Matrix.
"""
dim = self.get_dimension()
b = fasttext.Vector(dim)
self.f.getInputVector(b, ind)
return np.array(b) | def function[get_input_vector, parameter[self, ind]]:
constant[
Given an index, get the corresponding vector of the Input Matrix.
]
variable[dim] assign[=] call[name[self].get_dimension, parameter[]]
variable[b] assign[=] call[name[fasttext].Vector, parameter[name[dim]]]
... | keyword[def] identifier[get_input_vector] ( identifier[self] , identifier[ind] ):
literal[string]
identifier[dim] = identifier[self] . identifier[get_dimension] ()
identifier[b] = identifier[fasttext] . identifier[Vector] ( identifier[dim] )
identifier[self] . identifier[f] . iden... | def get_input_vector(self, ind):
"""
Given an index, get the corresponding vector of the Input Matrix.
"""
dim = self.get_dimension()
b = fasttext.Vector(dim)
self.f.getInputVector(b, ind)
return np.array(b) |
def get_connection(db=DATABASE):
""" Returns a new connection to the database. """
return database.connect(host=HOST, port=PORT, user=USER, password=PASSWORD, database=db) | def function[get_connection, parameter[db]]:
constant[ Returns a new connection to the database. ]
return[call[name[database].connect, parameter[]]] | keyword[def] identifier[get_connection] ( identifier[db] = identifier[DATABASE] ):
literal[string]
keyword[return] identifier[database] . identifier[connect] ( identifier[host] = identifier[HOST] , identifier[port] = identifier[PORT] , identifier[user] = identifier[USER] , identifier[password] = identifie... | def get_connection(db=DATABASE):
""" Returns a new connection to the database. """
return database.connect(host=HOST, port=PORT, user=USER, password=PASSWORD, database=db) |
def tabfile2list(fname):
"tabfile2list"
#dat = mylib1.readfileasmac(fname)
#data = string.strip(dat)
data = mylib1.readfileasmac(fname)
#data = data[:-2]#remove the last return
alist = data.split('\r')#since I read it as a mac file
blist = alist[1].split('\t')
clist = []
for num in ... | def function[tabfile2list, parameter[fname]]:
constant[tabfile2list]
variable[data] assign[=] call[name[mylib1].readfileasmac, parameter[name[fname]]]
variable[alist] assign[=] call[name[data].split, parameter[constant[
]]]
variable[blist] assign[=] call[call[name[alist]][constant[1]].sp... | keyword[def] identifier[tabfile2list] ( identifier[fname] ):
literal[string]
identifier[data] = identifier[mylib1] . identifier[readfileasmac] ( identifier[fname] )
identifier[alist] = identifier[data] . identifier[split] ( literal[string] )
identifier[blist] = identifier[alist] [ ... | def tabfile2list(fname):
"""tabfile2list"""
#dat = mylib1.readfileasmac(fname)
#data = string.strip(dat)
data = mylib1.readfileasmac(fname)
#data = data[:-2]#remove the last return
alist = data.split('\r') #since I read it as a mac file
blist = alist[1].split('\t')
clist = []
for nu... |
def frameify(self, state, data):
"""Yield the data as a single frame."""
try:
yield state.recv_buf + data
except FrameSwitch:
pass
finally:
state.recv_buf = '' | def function[frameify, parameter[self, state, data]]:
constant[Yield the data as a single frame.]
<ast.Try object at 0x7da18f811690> | keyword[def] identifier[frameify] ( identifier[self] , identifier[state] , identifier[data] ):
literal[string]
keyword[try] :
keyword[yield] identifier[state] . identifier[recv_buf] + identifier[data]
keyword[except] identifier[FrameSwitch] :
keyword[pass]
... | def frameify(self, state, data):
"""Yield the data as a single frame."""
try:
yield (state.recv_buf + data) # depends on [control=['try'], data=[]]
except FrameSwitch:
pass # depends on [control=['except'], data=[]]
finally:
state.recv_buf = '' |
def compose(self, *things):
'''
compose applies multiple fsts onto a base implementation.
Pass the base implementation as last parameter.
fsts are merged from RIGHT TO LEFT (like function application)
e.g.:
class MyFST(object):
#place introductions and refine... | def function[compose, parameter[self]]:
constant[
compose applies multiple fsts onto a base implementation.
Pass the base implementation as last parameter.
fsts are merged from RIGHT TO LEFT (like function application)
e.g.:
class MyFST(object):
#place introd... | keyword[def] identifier[compose] ( identifier[self] ,* identifier[things] ):
literal[string]
keyword[if] keyword[not] identifier[len] ( identifier[things] ):
keyword[raise] identifier[CompositionError] ( literal[string] )
keyword[if] identifier[len] ( identifier[things] )=... | def compose(self, *things):
"""
compose applies multiple fsts onto a base implementation.
Pass the base implementation as last parameter.
fsts are merged from RIGHT TO LEFT (like function application)
e.g.:
class MyFST(object):
#place introductions and refinement... |
def permission_request_approve_link(context, perm):
"""
Renders a html link to the approve view of the given permission request.
Returns no content if the request-user has no permission to delete foreign
permissions.
"""
user = context['request'].user
if user.is_authenticated():
if u... | def function[permission_request_approve_link, parameter[context, perm]]:
constant[
Renders a html link to the approve view of the given permission request.
Returns no content if the request-user has no permission to delete foreign
permissions.
]
variable[user] assign[=] call[name[context... | keyword[def] identifier[permission_request_approve_link] ( identifier[context] , identifier[perm] ):
literal[string]
identifier[user] = identifier[context] [ literal[string] ]. identifier[user]
keyword[if] identifier[user] . identifier[is_authenticated] ():
keyword[if] identifier[user] . i... | def permission_request_approve_link(context, perm):
"""
Renders a html link to the approve view of the given permission request.
Returns no content if the request-user has no permission to delete foreign
permissions.
"""
user = context['request'].user
if user.is_authenticated():
if u... |
def open_json(file_name):
"""
returns json contents as string
"""
with open(file_name, "r") as json_data:
data = json.load(json_data)
return data | def function[open_json, parameter[file_name]]:
constant[
returns json contents as string
]
with call[name[open], parameter[name[file_name], constant[r]]] begin[:]
variable[data] assign[=] call[name[json].load, parameter[name[json_data]]]
return[name[data]] | keyword[def] identifier[open_json] ( identifier[file_name] ):
literal[string]
keyword[with] identifier[open] ( identifier[file_name] , literal[string] ) keyword[as] identifier[json_data] :
identifier[data] = identifier[json] . identifier[load] ( identifier[json_data] )
keyword[return] ... | def open_json(file_name):
"""
returns json contents as string
"""
with open(file_name, 'r') as json_data:
data = json.load(json_data)
return data # depends on [control=['with'], data=['json_data']] |
def data_contains_key_builder(key: str) -> NodePredicate: # noqa: D202
"""Build a filter that passes only on nodes that have the given key in their data dictionary.
:param key: A key for the node's data dictionary
"""
def data_contains_key(_: BELGraph, node: BaseEntity) -> bool:
"""Pass only ... | def function[data_contains_key_builder, parameter[key]]:
constant[Build a filter that passes only on nodes that have the given key in their data dictionary.
:param key: A key for the node's data dictionary
]
def function[data_contains_key, parameter[_, node]]:
constant[Pass only... | keyword[def] identifier[data_contains_key_builder] ( identifier[key] : identifier[str] )-> identifier[NodePredicate] :
literal[string]
keyword[def] identifier[data_contains_key] ( identifier[_] : identifier[BELGraph] , identifier[node] : identifier[BaseEntity] )-> identifier[bool] :
literal[stri... | def data_contains_key_builder(key: str) -> NodePredicate: # noqa: D202
"Build a filter that passes only on nodes that have the given key in their data dictionary.\n\n :param key: A key for the node's data dictionary\n "
def data_contains_key(_: BELGraph, node: BaseEntity) -> bool:
"""Pass only f... |
def to_surface(self, image, alpha=1.0):
"""
Converts a :py:mod:`PIL.Image` into a :class:`pygame.Surface`,
transforming it according to the ``transform`` and ``scale``
constructor arguments.
"""
assert(0.0 <= alpha <= 1.0)
if alpha < 1.0:
im = image.co... | def function[to_surface, parameter[self, image, alpha]]:
constant[
Converts a :py:mod:`PIL.Image` into a :class:`pygame.Surface`,
transforming it according to the ``transform`` and ``scale``
constructor arguments.
]
assert[compare[constant[0.0] less_or_equal[<=] name[alpha]]]... | keyword[def] identifier[to_surface] ( identifier[self] , identifier[image] , identifier[alpha] = literal[int] ):
literal[string]
keyword[assert] ( literal[int] <= identifier[alpha] <= literal[int] )
keyword[if] identifier[alpha] < literal[int] :
identifier[im] = identifier[im... | def to_surface(self, image, alpha=1.0):
"""
Converts a :py:mod:`PIL.Image` into a :class:`pygame.Surface`,
transforming it according to the ``transform`` and ``scale``
constructor arguments.
"""
assert 0.0 <= alpha <= 1.0
if alpha < 1.0:
im = image.convert('RGBA')
... |
def _get_digest(self, info):
"""
Get a digest from a dictionary by looking at keys of the form
'algo_digest'.
Returns a 2-tuple (algo, digest) if found, else None. Currently
looks only for SHA256, then MD5.
"""
result = None
for algo in ('sha256', 'md5'):... | def function[_get_digest, parameter[self, info]]:
constant[
Get a digest from a dictionary by looking at keys of the form
'algo_digest'.
Returns a 2-tuple (algo, digest) if found, else None. Currently
looks only for SHA256, then MD5.
]
variable[result] assign[=] ... | keyword[def] identifier[_get_digest] ( identifier[self] , identifier[info] ):
literal[string]
identifier[result] = keyword[None]
keyword[for] identifier[algo] keyword[in] ( literal[string] , literal[string] ):
identifier[key] = literal[string] % identifier[algo]
... | def _get_digest(self, info):
"""
Get a digest from a dictionary by looking at keys of the form
'algo_digest'.
Returns a 2-tuple (algo, digest) if found, else None. Currently
looks only for SHA256, then MD5.
"""
result = None
for algo in ('sha256', 'md5'):
key... |
def get_branching_nodes(self):
"""
Returns all nodes that has an out degree >= 2
"""
nodes = set()
for n in self.graph.nodes():
if self.graph.out_degree(n) >= 2:
nodes.add(n)
return nodes | def function[get_branching_nodes, parameter[self]]:
constant[
Returns all nodes that has an out degree >= 2
]
variable[nodes] assign[=] call[name[set], parameter[]]
for taget[name[n]] in starred[call[name[self].graph.nodes, parameter[]]] begin[:]
if compare[call[n... | keyword[def] identifier[get_branching_nodes] ( identifier[self] ):
literal[string]
identifier[nodes] = identifier[set] ()
keyword[for] identifier[n] keyword[in] identifier[self] . identifier[graph] . identifier[nodes] ():
keyword[if] identifier[self] . identifier[graph] . ... | def get_branching_nodes(self):
"""
Returns all nodes that has an out degree >= 2
"""
nodes = set()
for n in self.graph.nodes():
if self.graph.out_degree(n) >= 2:
nodes.add(n) # depends on [control=['if'], data=[]] # depends on [control=['for'], data=['n']]
return no... |
def link_android(self, path, pkg):
""" Link's the android project to this library.
1. Includes this project's directory in the app's
android/settings.gradle
It adds:
include ':<project-name>'
project(':<project-name>').projectDir = new File(
... | def function[link_android, parameter[self, path, pkg]]:
constant[ Link's the android project to this library.
1. Includes this project's directory in the app's
android/settings.gradle
It adds:
include ':<project-name>'
project(':<project-name>').... | keyword[def] identifier[link_android] ( identifier[self] , identifier[path] , identifier[pkg] ):
literal[string]
identifier[bundle_id] = identifier[self] . identifier[ctx] [ literal[string] ]
identifier[pkg_root] = identifier[join] ( identifier[path] , identifier[pkg] )
... | def link_android(self, path, pkg):
""" Link's the android project to this library.
1. Includes this project's directory in the app's
android/settings.gradle
It adds:
include ':<project-name>'
project(':<project-name>').projectDir = new File(
... |
def set_vnic_connectivity_status(nic_spec, to_connect):
"""
sets the device spec as connected or disconnected
:param nic_spec: the specification
:param to_connect: bool
"""
nic_spec.device.connectable = vim.vm.device.VirtualDevice.ConnectInfo()
nic... | def function[set_vnic_connectivity_status, parameter[nic_spec, to_connect]]:
constant[
sets the device spec as connected or disconnected
:param nic_spec: the specification
:param to_connect: bool
]
name[nic_spec].device.connectable assign[=] call[name[vim]... | keyword[def] identifier[set_vnic_connectivity_status] ( identifier[nic_spec] , identifier[to_connect] ):
literal[string]
identifier[nic_spec] . identifier[device] . identifier[connectable] = identifier[vim] . identifier[vm] . identifier[device] . identifier[VirtualDevice] . identifier[ConnectInfo] ... | def set_vnic_connectivity_status(nic_spec, to_connect):
"""
sets the device spec as connected or disconnected
:param nic_spec: the specification
:param to_connect: bool
"""
nic_spec.device.connectable = vim.vm.device.VirtualDevice.ConnectInfo()
nic_spec.device... |
def get_all_tags(filters=None, region=None, key=None, keyid=None, profile=None):
'''
Describe all tags matching the filter criteria, or all tags in the account otherwise.
.. versionadded:: 2018.3.0
filters
(dict) - Additional constraints on which volumes to return. Note that valid filters var... | def function[get_all_tags, parameter[filters, region, key, keyid, profile]]:
constant[
Describe all tags matching the filter criteria, or all tags in the account otherwise.
.. versionadded:: 2018.3.0
filters
(dict) - Additional constraints on which volumes to return. Note that valid filte... | keyword[def] identifier[get_all_tags] ( identifier[filters] = keyword[None] , identifier[region] = keyword[None] , identifier[key] = keyword[None] , identifier[keyid] = keyword[None] , identifier[profile] = keyword[None] ):
literal[string]
identifier[conn] = identifier[_get_conn] ( identifier[region] = ide... | def get_all_tags(filters=None, region=None, key=None, keyid=None, profile=None):
"""
Describe all tags matching the filter criteria, or all tags in the account otherwise.
.. versionadded:: 2018.3.0
filters
(dict) - Additional constraints on which volumes to return. Note that valid filters var... |
def laea2cf(area):
"""Return the cf grid mapping for the laea projection."""
proj_dict = area.proj_dict
args = dict(latitude_of_projection_origin=proj_dict.get('lat_0'),
longitude_of_projection_origin=proj_dict.get('lon_0'),
grid_mapping_name='lambert_azimuthal_equal_area',
... | def function[laea2cf, parameter[area]]:
constant[Return the cf grid mapping for the laea projection.]
variable[proj_dict] assign[=] name[area].proj_dict
variable[args] assign[=] call[name[dict], parameter[]]
return[name[args]] | keyword[def] identifier[laea2cf] ( identifier[area] ):
literal[string]
identifier[proj_dict] = identifier[area] . identifier[proj_dict]
identifier[args] = identifier[dict] ( identifier[latitude_of_projection_origin] = identifier[proj_dict] . identifier[get] ( literal[string] ),
identifier[longit... | def laea2cf(area):
"""Return the cf grid mapping for the laea projection."""
proj_dict = area.proj_dict
args = dict(latitude_of_projection_origin=proj_dict.get('lat_0'), longitude_of_projection_origin=proj_dict.get('lon_0'), grid_mapping_name='lambert_azimuthal_equal_area')
return args |
def replace_stripe_gateway_by_id(cls, stripe_gateway_id, stripe_gateway, **kwargs):
"""Replace StripeGateway
Replace all attributes of StripeGateway
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread =... | def function[replace_stripe_gateway_by_id, parameter[cls, stripe_gateway_id, stripe_gateway]]:
constant[Replace StripeGateway
Replace all attributes of StripeGateway
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
... | keyword[def] identifier[replace_stripe_gateway_by_id] ( identifier[cls] , identifier[stripe_gateway_id] , identifier[stripe_gateway] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] [ literal[string] ]= keyword[True]
keyword[if] identifier[kwargs] . identifier[get] ( literal[... | def replace_stripe_gateway_by_id(cls, stripe_gateway_id, stripe_gateway, **kwargs):
"""Replace StripeGateway
Replace all attributes of StripeGateway
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api... |
def output(self, resource):
"""Wrap a resource (as a flask view function).
This is for cases where the resource does not directly return
a response object. Now everything should be a Response object.
:param resource: The resource as a flask view function
"""
@wraps(reso... | def function[output, parameter[self, resource]]:
constant[Wrap a resource (as a flask view function).
This is for cases where the resource does not directly return
a response object. Now everything should be a Response object.
:param resource: The resource as a flask view function
... | keyword[def] identifier[output] ( identifier[self] , identifier[resource] ):
literal[string]
@ identifier[wraps] ( identifier[resource] )
keyword[def] identifier[wrapper] (* identifier[args] ,** identifier[kwargs] ):
identifier[rv] = identifier[resource] (* identifier[args] ,*... | def output(self, resource):
"""Wrap a resource (as a flask view function).
This is for cases where the resource does not directly return
a response object. Now everything should be a Response object.
:param resource: The resource as a flask view function
"""
@wraps(resource)
... |
def tofrequency(self, rf, v0, rfq):
"""Convert a Doppler type value (e.g. in radio mode) to a
frequency. The type of frequency (e.g. LSRK) and a rest frequency
(either as a frequency quantity (e.g. ``dm.constants('HI'))`` or
a frequency measure (e.g. ``dm.frequency('rest','5100MHz'))`` s... | def function[tofrequency, parameter[self, rf, v0, rfq]]:
constant[Convert a Doppler type value (e.g. in radio mode) to a
frequency. The type of frequency (e.g. LSRK) and a rest frequency
(either as a frequency quantity (e.g. ``dm.constants('HI'))`` or
a frequency measure (e.g. ``dm.frequ... | keyword[def] identifier[tofrequency] ( identifier[self] , identifier[rf] , identifier[v0] , identifier[rfq] ):
literal[string]
keyword[if] identifier[is_measure] ( identifier[rfq] ) keyword[and] identifier[rfq] [ literal[string] ]== literal[string] :
identifier[rfq] = identifier[dq] ... | def tofrequency(self, rf, v0, rfq):
"""Convert a Doppler type value (e.g. in radio mode) to a
frequency. The type of frequency (e.g. LSRK) and a rest frequency
(either as a frequency quantity (e.g. ``dm.constants('HI'))`` or
a frequency measure (e.g. ``dm.frequency('rest','5100MHz'))`` shoul... |
def rm_incomplete_des_asc(des_mask, asc_mask):
'''Remove descents-ascents that have no corresponding ascent-descent
Args
----
des_mask: ndarray
Boolean mask of descents in the depth data
asc_mask: ndarray
Boolean mask of ascents in the depth data
Returns
-------
des_mas... | def function[rm_incomplete_des_asc, parameter[des_mask, asc_mask]]:
constant[Remove descents-ascents that have no corresponding ascent-descent
Args
----
des_mask: ndarray
Boolean mask of descents in the depth data
asc_mask: ndarray
Boolean mask of ascents in the depth data
... | keyword[def] identifier[rm_incomplete_des_asc] ( identifier[des_mask] , identifier[asc_mask] ):
literal[string]
keyword[from] . keyword[import] identifier[utils]
identifier[des_start] , identifier[des_stop] = identifier[utils] . identifier[contiguous_regions] ( identifier[des_mask] )
iden... | def rm_incomplete_des_asc(des_mask, asc_mask):
"""Remove descents-ascents that have no corresponding ascent-descent
Args
----
des_mask: ndarray
Boolean mask of descents in the depth data
asc_mask: ndarray
Boolean mask of ascents in the depth data
Returns
-------
des_mas... |
def Overlay_setShowFPSCounter(self, show):
"""
Function path: Overlay.setShowFPSCounter
Domain: Overlay
Method name: setShowFPSCounter
Parameters:
Required arguments:
'show' (type: boolean) -> True for showing the FPS counter
No return value.
Description: Requests that backend shows th... | def function[Overlay_setShowFPSCounter, parameter[self, show]]:
constant[
Function path: Overlay.setShowFPSCounter
Domain: Overlay
Method name: setShowFPSCounter
Parameters:
Required arguments:
'show' (type: boolean) -> True for showing the FPS counter
No return value.
Descriptio... | keyword[def] identifier[Overlay_setShowFPSCounter] ( identifier[self] , identifier[show] ):
literal[string]
keyword[assert] identifier[isinstance] ( identifier[show] ,( identifier[bool] ,)
), literal[string] % identifier[type] (
identifier[show] )
identifier[subdom_funcs] = identifier[self] . identifi... | def Overlay_setShowFPSCounter(self, show):
"""
Function path: Overlay.setShowFPSCounter
Domain: Overlay
Method name: setShowFPSCounter
Parameters:
Required arguments:
'show' (type: boolean) -> True for showing the FPS counter
No return value.
Description: Requests that backend shows ... |
def convert_python_regex_to_ecma(value, flags=[]):
"""Convert Python regex to ECMA 262 regex.
If given value is already ECMA regex it will be returned unchanged.
:param string value: Python regex.
:param list flags: List of flags (allowed flags: `re.I`, `re.M`)
:return: ECMA 262 regex
:rtype: ... | def function[convert_python_regex_to_ecma, parameter[value, flags]]:
constant[Convert Python regex to ECMA 262 regex.
If given value is already ECMA regex it will be returned unchanged.
:param string value: Python regex.
:param list flags: List of flags (allowed flags: `re.I`, `re.M`)
:return:... | keyword[def] identifier[convert_python_regex_to_ecma] ( identifier[value] , identifier[flags] =[]):
literal[string]
keyword[if] identifier[is_ecma_regex] ( identifier[value] ):
keyword[return] identifier[value]
identifier[result_flags] =[ identifier[PYTHON_TO_ECMA_FLAGS] [ identifier[f] ]... | def convert_python_regex_to_ecma(value, flags=[]):
"""Convert Python regex to ECMA 262 regex.
If given value is already ECMA regex it will be returned unchanged.
:param string value: Python regex.
:param list flags: List of flags (allowed flags: `re.I`, `re.M`)
:return: ECMA 262 regex
:rtype: ... |
def push(self, components=None, yes=0):
"""
Executes all satchel configurators to apply pending changes to the server.
"""
from burlap import notifier
service = self.get_satchel('service')
self.lock()
try:
yes = int(yes)
if not yes:
... | def function[push, parameter[self, components, yes]]:
constant[
Executes all satchel configurators to apply pending changes to the server.
]
from relative_module[burlap] import module[notifier]
variable[service] assign[=] call[name[self].get_satchel, parameter[constant[service]]]
... | keyword[def] identifier[push] ( identifier[self] , identifier[components] = keyword[None] , identifier[yes] = literal[int] ):
literal[string]
keyword[from] identifier[burlap] keyword[import] identifier[notifier]
identifier[service] = identifier[self] . identifier[get_satchel] ( literal... | def push(self, components=None, yes=0):
"""
Executes all satchel configurators to apply pending changes to the server.
"""
from burlap import notifier
service = self.get_satchel('service')
self.lock()
try:
yes = int(yes)
if not yes:
# If we want to confirm... |
def fields_equal(self, instance, fields_to_ignore=("id", "change_date", "changed_by")):
"""
Compares this instance's fields to the supplied instance to test for equality.
This will ignore any fields in `fields_to_ignore`.
Note that this method ignores many-to-many fields.
Args:... | def function[fields_equal, parameter[self, instance, fields_to_ignore]]:
constant[
Compares this instance's fields to the supplied instance to test for equality.
This will ignore any fields in `fields_to_ignore`.
Note that this method ignores many-to-many fields.
Args:
... | keyword[def] identifier[fields_equal] ( identifier[self] , identifier[instance] , identifier[fields_to_ignore] =( literal[string] , literal[string] , literal[string] )):
literal[string]
keyword[for] identifier[field] keyword[in] identifier[self] . identifier[_meta] . identifier[get_fields] ():
... | def fields_equal(self, instance, fields_to_ignore=('id', 'change_date', 'changed_by')):
"""
Compares this instance's fields to the supplied instance to test for equality.
This will ignore any fields in `fields_to_ignore`.
Note that this method ignores many-to-many fields.
Args:
... |
def __get_issue_comments(self, issue_number):
"""Get issue comments"""
comments = []
group_comments = self.client.issue_comments(issue_number)
for raw_comments in group_comments:
for comment in json.loads(raw_comments):
comment_id = comment.get('id')
... | def function[__get_issue_comments, parameter[self, issue_number]]:
constant[Get issue comments]
variable[comments] assign[=] list[[]]
variable[group_comments] assign[=] call[name[self].client.issue_comments, parameter[name[issue_number]]]
for taget[name[raw_comments]] in starred[name[gro... | keyword[def] identifier[__get_issue_comments] ( identifier[self] , identifier[issue_number] ):
literal[string]
identifier[comments] =[]
identifier[group_comments] = identifier[self] . identifier[client] . identifier[issue_comments] ( identifier[issue_number] )
keyword[for] iden... | def __get_issue_comments(self, issue_number):
"""Get issue comments"""
comments = []
group_comments = self.client.issue_comments(issue_number)
for raw_comments in group_comments:
for comment in json.loads(raw_comments):
comment_id = comment.get('id')
comment['user_data'] ... |
def plotRealImg(sim, cam, rawdata, t: int, odir: Path=None, fg=None):
"""
sim: histfeas/simclass.py
cam: camclass.py
rawdata: nframe x ny x nx ndarray
t: integer index to read
odir: output directory (where to write results)
plots both cameras together,
and magnetic zenith 1-D cut line
... | def function[plotRealImg, parameter[sim, cam, rawdata, t, odir, fg]]:
constant[
sim: histfeas/simclass.py
cam: camclass.py
rawdata: nframe x ny x nx ndarray
t: integer index to read
odir: output directory (where to write results)
plots both cameras together,
and magnetic zenith 1-D ... | keyword[def] identifier[plotRealImg] ( identifier[sim] , identifier[cam] , identifier[rawdata] , identifier[t] : identifier[int] , identifier[odir] : identifier[Path] = keyword[None] , identifier[fg] = keyword[None] ):
literal[string]
identifier[ncols] = identifier[len] ( identifier[cam] )
identi... | def plotRealImg(sim, cam, rawdata, t: int, odir: Path=None, fg=None):
"""
sim: histfeas/simclass.py
cam: camclass.py
rawdata: nframe x ny x nx ndarray
t: integer index to read
odir: output directory (where to write results)
plots both cameras together,
and magnetic zenith 1-D cut line
... |
def rollback(using=None, sid=None):
"""
Possibility of calling transaction.rollback() in new Django versions (in atomic block).
Important: transaction savepoint (sid) is required for Django < 1.8
"""
if sid:
django.db.transaction.savepoint_rollback(sid)
else:
try:
dj... | def function[rollback, parameter[using, sid]]:
constant[
Possibility of calling transaction.rollback() in new Django versions (in atomic block).
Important: transaction savepoint (sid) is required for Django < 1.8
]
if name[sid] begin[:]
call[name[django].db.transaction.savepo... | keyword[def] identifier[rollback] ( identifier[using] = keyword[None] , identifier[sid] = keyword[None] ):
literal[string]
keyword[if] identifier[sid] :
identifier[django] . identifier[db] . identifier[transaction] . identifier[savepoint_rollback] ( identifier[sid] )
keyword[else] :
... | def rollback(using=None, sid=None):
"""
Possibility of calling transaction.rollback() in new Django versions (in atomic block).
Important: transaction savepoint (sid) is required for Django < 1.8
"""
if sid:
django.db.transaction.savepoint_rollback(sid) # depends on [control=['if'], data=[]... |
def _validate_write(self, address):
"""Raises an exception if the address is not allowed to be set
in this context, based on txn outputs.
Notes:
Checks that the address is either listed fully as one of the
outputs, or some portion of the address is listed as a namespace
... | def function[_validate_write, parameter[self, address]]:
constant[Raises an exception if the address is not allowed to be set
in this context, based on txn outputs.
Notes:
Checks that the address is either listed fully as one of the
outputs, or some portion of the addres... | keyword[def] identifier[_validate_write] ( identifier[self] , identifier[address] ):
literal[string]
keyword[if] keyword[not] identifier[any] ( identifier[address] . identifier[startswith] ( identifier[ns] ) keyword[for] identifier[ns] keyword[in] identifier[self] . identifier[_write_list] ):... | def _validate_write(self, address):
"""Raises an exception if the address is not allowed to be set
in this context, based on txn outputs.
Notes:
Checks that the address is either listed fully as one of the
outputs, or some portion of the address is listed as a namespace
... |
def DiffDoArrays(self, oldObj, newObj, isElementLinks):
"""Diff two DataObject arrays"""
if len(oldObj) != len(newObj):
__Log__.debug('DiffDoArrays: Array lengths do not match %d != %d'
% (len(oldObj), len(newObj)))
return False
for i, j in zip(oldObj, newObj):
i... | def function[DiffDoArrays, parameter[self, oldObj, newObj, isElementLinks]]:
constant[Diff two DataObject arrays]
if compare[call[name[len], parameter[name[oldObj]]] not_equal[!=] call[name[len], parameter[name[newObj]]]] begin[:]
call[name[__Log__].debug, parameter[binary_operation[cons... | keyword[def] identifier[DiffDoArrays] ( identifier[self] , identifier[oldObj] , identifier[newObj] , identifier[isElementLinks] ):
literal[string]
keyword[if] identifier[len] ( identifier[oldObj] )!= identifier[len] ( identifier[newObj] ):
identifier[__Log__] . identifier[debug] ( literal[st... | def DiffDoArrays(self, oldObj, newObj, isElementLinks):
"""Diff two DataObject arrays"""
if len(oldObj) != len(newObj):
__Log__.debug('DiffDoArrays: Array lengths do not match %d != %d' % (len(oldObj), len(newObj)))
return False # depends on [control=['if'], data=[]]
for (i, j) in zip(oldOb... |
def gsea(data, gene_sets, cls, outdir='GSEA_', min_size=15, max_size=500, permutation_num=1000,
weighted_score_type=1,permutation_type='gene_set', method='log2_ratio_of_classes',
ascending=False, processes=1, figsize=(6.5,6), format='pdf',
graph_num=20, no_plot=False, seed=None, verbose=False... | def function[gsea, parameter[data, gene_sets, cls, outdir, min_size, max_size, permutation_num, weighted_score_type, permutation_type, method, ascending, processes, figsize, format, graph_num, no_plot, seed, verbose]]:
constant[ Run Gene Set Enrichment Analysis.
:param data: Gene expression data table, Pan... | keyword[def] identifier[gsea] ( identifier[data] , identifier[gene_sets] , identifier[cls] , identifier[outdir] = literal[string] , identifier[min_size] = literal[int] , identifier[max_size] = literal[int] , identifier[permutation_num] = literal[int] ,
identifier[weighted_score_type] = literal[int] , identifier[perm... | def gsea(data, gene_sets, cls, outdir='GSEA_', min_size=15, max_size=500, permutation_num=1000, weighted_score_type=1, permutation_type='gene_set', method='log2_ratio_of_classes', ascending=False, processes=1, figsize=(6.5, 6), format='pdf', graph_num=20, no_plot=False, seed=None, verbose=False):
""" Run Gene Set E... |
def reload_handler(self, c, e):
"""This handles reloads."""
cmd = self.is_reload(e)
cmdchar = self.config['core']['cmdchar']
if cmd is not None:
# If we're in a minimal reload state, only the owner can do stuff, as we can't rely on the db working.
if self.reload_e... | def function[reload_handler, parameter[self, c, e]]:
constant[This handles reloads.]
variable[cmd] assign[=] call[name[self].is_reload, parameter[name[e]]]
variable[cmdchar] assign[=] call[call[name[self].config][constant[core]]][constant[cmdchar]]
if compare[name[cmd] is_not constant[No... | keyword[def] identifier[reload_handler] ( identifier[self] , identifier[c] , identifier[e] ):
literal[string]
identifier[cmd] = identifier[self] . identifier[is_reload] ( identifier[e] )
identifier[cmdchar] = identifier[self] . identifier[config] [ literal[string] ][ literal[string] ]
... | def reload_handler(self, c, e):
"""This handles reloads."""
cmd = self.is_reload(e)
cmdchar = self.config['core']['cmdchar']
if cmd is not None:
# If we're in a minimal reload state, only the owner can do stuff, as we can't rely on the db working.
if self.reload_event.set():
... |
def referenced_tables(self):
"""Return referenced tables from job statistics, if present.
See:
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#statistics.query.referencedTables
:rtype: list of dict
:returns: mappings describing the query plan, or an empty list
... | def function[referenced_tables, parameter[self]]:
constant[Return referenced tables from job statistics, if present.
See:
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#statistics.query.referencedTables
:rtype: list of dict
:returns: mappings describing the query... | keyword[def] identifier[referenced_tables] ( identifier[self] ):
literal[string]
identifier[tables] =[]
identifier[datasets_by_project_name] ={}
keyword[for] identifier[table] keyword[in] identifier[self] . identifier[_job_statistics] (). identifier[get] ( literal[string] ,())... | def referenced_tables(self):
"""Return referenced tables from job statistics, if present.
See:
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#statistics.query.referencedTables
:rtype: list of dict
:returns: mappings describing the query plan, or an empty list
... |
def parse(self):
"""
Parses format string looking for substitutions
This method is responsible for returning a list of fields (as strings)
to include in all log messages.
"""
standard_formatters = re.compile(r'\((.+?)\)', re.IGNORECASE)
return standard_formatters... | def function[parse, parameter[self]]:
constant[
Parses format string looking for substitutions
This method is responsible for returning a list of fields (as strings)
to include in all log messages.
]
variable[standard_formatters] assign[=] call[name[re].compile, paramete... | keyword[def] identifier[parse] ( identifier[self] ):
literal[string]
identifier[standard_formatters] = identifier[re] . identifier[compile] ( literal[string] , identifier[re] . identifier[IGNORECASE] )
keyword[return] identifier[standard_formatters] . identifier[findall] ( identifier[self... | def parse(self):
"""
Parses format string looking for substitutions
This method is responsible for returning a list of fields (as strings)
to include in all log messages.
"""
standard_formatters = re.compile('\\((.+?)\\)', re.IGNORECASE)
return standard_formatters.findall(se... |
def get_user_groups(self, dn, group_search_dn=None, _connection=None):
"""
Gets a list of groups a user at dn is a member of
Args:
dn (str): The dn of the user to find memberships for.
_connection (ldap3.Connection): A connection object to use when
search... | def function[get_user_groups, parameter[self, dn, group_search_dn, _connection]]:
constant[
Gets a list of groups a user at dn is a member of
Args:
dn (str): The dn of the user to find memberships for.
_connection (ldap3.Connection): A connection object to use when
... | keyword[def] identifier[get_user_groups] ( identifier[self] , identifier[dn] , identifier[group_search_dn] = keyword[None] , identifier[_connection] = keyword[None] ):
literal[string]
identifier[connection] = identifier[_connection]
keyword[if] keyword[not] identifier[connection] :
... | def get_user_groups(self, dn, group_search_dn=None, _connection=None):
"""
Gets a list of groups a user at dn is a member of
Args:
dn (str): The dn of the user to find memberships for.
_connection (ldap3.Connection): A connection object to use when
searching.... |
def setGroups(self, *args, **kwargs):
"""Adds the groups to which this client belongs.
The 'groupKeys' field of the client holds a list of the
encodedKeys of the groups to which this client belongs.
Returns the number of requests done to Mambu.
"""
requests = 0
... | def function[setGroups, parameter[self]]:
constant[Adds the groups to which this client belongs.
The 'groupKeys' field of the client holds a list of the
encodedKeys of the groups to which this client belongs.
Returns the number of requests done to Mambu.
]
variable[requ... | keyword[def] identifier[setGroups] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[requests] = literal[int]
identifier[groups] =[]
keyword[try] :
keyword[for] identifier[gk] keyword[in] identifier[self] [ literal[string... | def setGroups(self, *args, **kwargs):
"""Adds the groups to which this client belongs.
The 'groupKeys' field of the client holds a list of the
encodedKeys of the groups to which this client belongs.
Returns the number of requests done to Mambu.
"""
requests = 0
groups = []
... |
def cast(self, val: str):
"""converts string to type requested by `cast_as`"""
try:
return getattr(self, 'cast_as_{}'.format(
self.cast_as.__name__.lower()))(val)
except AttributeError:
return self.cast_as(val) | def function[cast, parameter[self, val]]:
constant[converts string to type requested by `cast_as`]
<ast.Try object at 0x7da1b0553820> | keyword[def] identifier[cast] ( identifier[self] , identifier[val] : identifier[str] ):
literal[string]
keyword[try] :
keyword[return] identifier[getattr] ( identifier[self] , literal[string] . identifier[format] (
identifier[self] . identifier[cast_as] . identifier[__nam... | def cast(self, val: str):
"""converts string to type requested by `cast_as`"""
try:
return getattr(self, 'cast_as_{}'.format(self.cast_as.__name__.lower()))(val) # depends on [control=['try'], data=[]]
except AttributeError:
return self.cast_as(val) # depends on [control=['except'], data=[... |
def get_value_by_row_col(self, row, col):
"""Get raster value by (row, col).
Args:
row: row number.
col: col number.
Returns:
raster value, None if the input are invalid.
"""
if row < 0 or row >= self.nRows or col < 0 or col >= self.nCols:
... | def function[get_value_by_row_col, parameter[self, row, col]]:
constant[Get raster value by (row, col).
Args:
row: row number.
col: col number.
Returns:
raster value, None if the input are invalid.
]
if <ast.BoolOp object at 0x7da1b244a0e0> b... | keyword[def] identifier[get_value_by_row_col] ( identifier[self] , identifier[row] , identifier[col] ):
literal[string]
keyword[if] identifier[row] < literal[int] keyword[or] identifier[row] >= identifier[self] . identifier[nRows] keyword[or] identifier[col] < literal[int] keyword[or] identi... | def get_value_by_row_col(self, row, col):
"""Get raster value by (row, col).
Args:
row: row number.
col: col number.
Returns:
raster value, None if the input are invalid.
"""
if row < 0 or row >= self.nRows or col < 0 or (col >= self.nCols):
... |
def newline(self, node=None, extra=0):
"""Add one or more newlines before the next write."""
self._new_lines = max(self._new_lines, 1 + extra)
if node is not None and node.lineno != self._last_line:
self._write_debug_info = node.lineno
self._last_line = node.lineno | def function[newline, parameter[self, node, extra]]:
constant[Add one or more newlines before the next write.]
name[self]._new_lines assign[=] call[name[max], parameter[name[self]._new_lines, binary_operation[constant[1] + name[extra]]]]
if <ast.BoolOp object at 0x7da1b1ea19f0> begin[:]
... | keyword[def] identifier[newline] ( identifier[self] , identifier[node] = keyword[None] , identifier[extra] = literal[int] ):
literal[string]
identifier[self] . identifier[_new_lines] = identifier[max] ( identifier[self] . identifier[_new_lines] , literal[int] + identifier[extra] )
keyword[... | def newline(self, node=None, extra=0):
"""Add one or more newlines before the next write."""
self._new_lines = max(self._new_lines, 1 + extra)
if node is not None and node.lineno != self._last_line:
self._write_debug_info = node.lineno
self._last_line = node.lineno # depends on [control=['i... |
def removecolkeyword(self, columnname, keyword):
"""Remove a column keyword.
It is similar to :func:`removekeyword`.
"""
if isinstance(keyword, str):
self._removekeyword(columnname, keyword, -1)
else:
self._removekeyword(columnname, '', keyword) | def function[removecolkeyword, parameter[self, columnname, keyword]]:
constant[Remove a column keyword.
It is similar to :func:`removekeyword`.
]
if call[name[isinstance], parameter[name[keyword], name[str]]] begin[:]
call[name[self]._removekeyword, parameter[name[colum... | keyword[def] identifier[removecolkeyword] ( identifier[self] , identifier[columnname] , identifier[keyword] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[keyword] , identifier[str] ):
identifier[self] . identifier[_removekeyword] ( identifier[columnname] , identif... | def removecolkeyword(self, columnname, keyword):
"""Remove a column keyword.
It is similar to :func:`removekeyword`.
"""
if isinstance(keyword, str):
self._removekeyword(columnname, keyword, -1) # depends on [control=['if'], data=[]]
else:
self._removekeyword(columnname, '... |
def verify_relayable_signature(public_key, doc, signature):
"""
Verify the signed XML elements to have confidence that the claimed
author did actually generate this message.
"""
sig_hash = _create_signature_hash(doc)
cipher = PKCS1_v1_5.new(RSA.importKey(public_key))
return cipher.verify(sig... | def function[verify_relayable_signature, parameter[public_key, doc, signature]]:
constant[
Verify the signed XML elements to have confidence that the claimed
author did actually generate this message.
]
variable[sig_hash] assign[=] call[name[_create_signature_hash], parameter[name[doc]]]
... | keyword[def] identifier[verify_relayable_signature] ( identifier[public_key] , identifier[doc] , identifier[signature] ):
literal[string]
identifier[sig_hash] = identifier[_create_signature_hash] ( identifier[doc] )
identifier[cipher] = identifier[PKCS1_v1_5] . identifier[new] ( identifier[RSA] . iden... | def verify_relayable_signature(public_key, doc, signature):
"""
Verify the signed XML elements to have confidence that the claimed
author did actually generate this message.
"""
sig_hash = _create_signature_hash(doc)
cipher = PKCS1_v1_5.new(RSA.importKey(public_key))
return cipher.verify(sig... |
def worker_logstart(self, node, nodeid, location):
"""Emitted when a node calls the pytest_runtest_logstart hook."""
self.config.hook.pytest_runtest_logstart(nodeid=nodeid, location=location) | def function[worker_logstart, parameter[self, node, nodeid, location]]:
constant[Emitted when a node calls the pytest_runtest_logstart hook.]
call[name[self].config.hook.pytest_runtest_logstart, parameter[]] | keyword[def] identifier[worker_logstart] ( identifier[self] , identifier[node] , identifier[nodeid] , identifier[location] ):
literal[string]
identifier[self] . identifier[config] . identifier[hook] . identifier[pytest_runtest_logstart] ( identifier[nodeid] = identifier[nodeid] , identifier[locatio... | def worker_logstart(self, node, nodeid, location):
"""Emitted when a node calls the pytest_runtest_logstart hook."""
self.config.hook.pytest_runtest_logstart(nodeid=nodeid, location=location) |
def unicodeInScripts(uv, scripts):
""" Check UnicodeData's ScriptExtension property for unicode codepoint
'uv' and return True if it intersects with the set of 'scripts' provided,
False if it does not intersect.
Return None for 'Common' script ('Zyyy').
"""
sx = unicodedata.script_extension(unic... | def function[unicodeInScripts, parameter[uv, scripts]]:
constant[ Check UnicodeData's ScriptExtension property for unicode codepoint
'uv' and return True if it intersects with the set of 'scripts' provided,
False if it does not intersect.
Return None for 'Common' script ('Zyyy').
]
varia... | keyword[def] identifier[unicodeInScripts] ( identifier[uv] , identifier[scripts] ):
literal[string]
identifier[sx] = identifier[unicodedata] . identifier[script_extension] ( identifier[unichr] ( identifier[uv] ))
keyword[if] literal[string] keyword[in] identifier[sx] :
keyword[return] key... | def unicodeInScripts(uv, scripts):
""" Check UnicodeData's ScriptExtension property for unicode codepoint
'uv' and return True if it intersects with the set of 'scripts' provided,
False if it does not intersect.
Return None for 'Common' script ('Zyyy').
"""
sx = unicodedata.script_extension(unic... |
def _mq_callback(self, message):
""" method processes messages from Synergy Worker and updates corresponding Timetable record,
as well as the job itself
:param message: <MqTransmission> mq message """
try:
self.logger.info('UowStatusListener {')
mq_reques... | def function[_mq_callback, parameter[self, message]]:
constant[ method processes messages from Synergy Worker and updates corresponding Timetable record,
as well as the job itself
:param message: <MqTransmission> mq message ]
<ast.Try object at 0x7da207f9b730> | keyword[def] identifier[_mq_callback] ( identifier[self] , identifier[message] ):
literal[string]
keyword[try] :
identifier[self] . identifier[logger] . identifier[info] ( literal[string] )
identifier[mq_request] = identifier[MqTransmission] . identifier[from_json] ( iden... | def _mq_callback(self, message):
""" method processes messages from Synergy Worker and updates corresponding Timetable record,
as well as the job itself
:param message: <MqTransmission> mq message """
try:
self.logger.info('UowStatusListener {')
mq_request = MqTransmissio... |
def keep_session_alive(self):
"""If the session expired, logs back in."""
try:
self.resources()
except xmlrpclib.Fault as fault:
if fault.faultCode == 5:
self.login()
else:
raise | def function[keep_session_alive, parameter[self]]:
constant[If the session expired, logs back in.]
<ast.Try object at 0x7da18f720580> | keyword[def] identifier[keep_session_alive] ( identifier[self] ):
literal[string]
keyword[try] :
identifier[self] . identifier[resources] ()
keyword[except] identifier[xmlrpclib] . identifier[Fault] keyword[as] identifier[fault] :
keyword[if] identifier[fault... | def keep_session_alive(self):
"""If the session expired, logs back in."""
try:
self.resources() # depends on [control=['try'], data=[]]
except xmlrpclib.Fault as fault:
if fault.faultCode == 5:
self.login() # depends on [control=['if'], data=[]]
else:
raise ... |
def parse(self):
"""Parse a Supybot IRC stream.
Returns an iterator of dicts. Each dicts contains information
about the date, type, nick and body of a single log entry.
:returns: iterator of parsed lines
:raises ParseError: when an invalid line is found parsing the given
... | def function[parse, parameter[self]]:
constant[Parse a Supybot IRC stream.
Returns an iterator of dicts. Each dicts contains information
about the date, type, nick and body of a single log entry.
:returns: iterator of parsed lines
:raises ParseError: when an invalid line is fo... | keyword[def] identifier[parse] ( identifier[self] ):
literal[string]
keyword[for] identifier[line] keyword[in] identifier[self] . identifier[stream] :
identifier[line] = identifier[line] . identifier[rstrip] ( literal[string] )
identifier[self] . identifier[nline] += li... | def parse(self):
"""Parse a Supybot IRC stream.
Returns an iterator of dicts. Each dicts contains information
about the date, type, nick and body of a single log entry.
:returns: iterator of parsed lines
:raises ParseError: when an invalid line is found parsing the given
... |
def _get_svc_path(name='*', status=None):
'''
Return a list of paths to services with ``name`` that have the specified ``status``
name
a glob for service name. default is '*'
status
None : all services (no filter, default choice)
'DISABLED' : available service(s) that is ... | def function[_get_svc_path, parameter[name, status]]:
constant[
Return a list of paths to services with ``name`` that have the specified ``status``
name
a glob for service name. default is '*'
status
None : all services (no filter, default choice)
'DISABLED' : availab... | keyword[def] identifier[_get_svc_path] ( identifier[name] = literal[string] , identifier[status] = keyword[None] ):
literal[string]
keyword[if] keyword[not] identifier[SERVICE_DIR] :
keyword[raise] identifier[CommandExecutionError] ( literal[string] )
... | def _get_svc_path(name='*', status=None):
"""
Return a list of paths to services with ``name`` that have the specified ``status``
name
a glob for service name. default is '*'
status
None : all services (no filter, default choice)
'DISABLED' : available service(s) that is ... |
def codify(combination):
"""
Gets escape-codes for flag combinations.
Arguments:
combination (int): Either a single integer-convertible flag
or an OR'd flag-combination.
Returns:
A semi-colon-delimited string of appropriate escape sequences.
Raises:
errors.FlagError if the combination is out-of-r... | def function[codify, parameter[combination]]:
constant[
Gets escape-codes for flag combinations.
Arguments:
combination (int): Either a single integer-convertible flag
or an OR'd flag-combination.
Returns:
A semi-colon-delimited string of appropriate escape sequences.
Raises:
errors.FlagErr... | keyword[def] identifier[codify] ( identifier[combination] ):
literal[string]
keyword[if] ( identifier[isinstance] ( identifier[combination] , identifier[int] ) keyword[and]
( identifier[combination] < literal[int] keyword[or] identifier[combination] >= identifier[LIMIT] )):
keyword[raise] identifier[er... | def codify(combination):
"""
Gets escape-codes for flag combinations.
Arguments:
combination (int): Either a single integer-convertible flag
or an OR'd flag-combination.
Returns:
A semi-colon-delimited string of appropriate escape sequences.
Raises:
errors.FlagError if the combination is out-of... |
def send(self, msg, error_check=False):
"""
Send a raw string with the CR-LF appended to it.
Required arguments:
* msg - Message to send.
Optional arguments:
* error_check=False - Check for errors.
If an error is found the relevant exception will be raised.
... | def function[send, parameter[self, msg, error_check]]:
constant[
Send a raw string with the CR-LF appended to it.
Required arguments:
* msg - Message to send.
Optional arguments:
* error_check=False - Check for errors.
If an error is found the relevant exception w... | keyword[def] identifier[send] ( identifier[self] , identifier[msg] , identifier[error_check] = keyword[False] ):
literal[string]
keyword[with] identifier[self] . identifier[lock] :
identifier[msg] = identifier[msg] . identifier[replace] ( literal[string] , literal[string] ). identifie... | def send(self, msg, error_check=False):
"""
Send a raw string with the CR-LF appended to it.
Required arguments:
* msg - Message to send.
Optional arguments:
* error_check=False - Check for errors.
If an error is found the relevant exception will be raised.
""... |
def read_price_data(files, name_func=None):
"""
Convenience function for reading in pricing data from csv files
Parameters
----------
files: list
List of strings refering to csv files to read data in from, first
column should be dates
name_func: func
A function to apply ... | def function[read_price_data, parameter[files, name_func]]:
constant[
Convenience function for reading in pricing data from csv files
Parameters
----------
files: list
List of strings refering to csv files to read data in from, first
column should be dates
name_func: func
... | keyword[def] identifier[read_price_data] ( identifier[files] , identifier[name_func] = keyword[None] ):
literal[string]
keyword[if] identifier[name_func] keyword[is] keyword[None] :
keyword[def] identifier[name_func] ( identifier[x] ):
keyword[return] identifier[os] . identifier[... | def read_price_data(files, name_func=None):
"""
Convenience function for reading in pricing data from csv files
Parameters
----------
files: list
List of strings refering to csv files to read data in from, first
column should be dates
name_func: func
A function to apply ... |
async def insert(**data):
"""
RPC method for inserting data to the table
:return: None
"""
table = data.get('table')
try:
clickhouse_queries.insert_into_table(table, data)
return 'Data was successfully inserted into table'
except ServerException as e:
exception_cod... | <ast.AsyncFunctionDef object at 0x7da1b0aa6830> | keyword[async] keyword[def] identifier[insert] (** identifier[data] ):
literal[string]
identifier[table] = identifier[data] . identifier[get] ( literal[string] )
keyword[try] :
identifier[clickhouse_queries] . identifier[insert_into_table] ( identifier[table] , identifier[data] )
... | async def insert(**data):
"""
RPC method for inserting data to the table
:return: None
"""
table = data.get('table')
try:
clickhouse_queries.insert_into_table(table, data)
return 'Data was successfully inserted into table' # depends on [control=['try'], data=[]]
except Serve... |
def update(self):
"""Update disk I/O stats using the input method."""
# Init new stats
stats = self.get_init_value()
if self.input_method == 'local':
# Update stats using the standard system lib
# Grab the stat using the psutil disk_io_counters method
... | def function[update, parameter[self]]:
constant[Update disk I/O stats using the input method.]
variable[stats] assign[=] call[name[self].get_init_value, parameter[]]
if compare[name[self].input_method equal[==] constant[local]] begin[:]
<ast.Try object at 0x7da18f09eb60>
... | keyword[def] identifier[update] ( identifier[self] ):
literal[string]
identifier[stats] = identifier[self] . identifier[get_init_value] ()
keyword[if] identifier[self] . identifier[input_method] == literal[string] :
... | def update(self):
"""Update disk I/O stats using the input method."""
# Init new stats
stats = self.get_init_value()
if self.input_method == 'local':
# Update stats using the standard system lib
# Grab the stat using the psutil disk_io_counters method
# read_count: number of read... |
def hash_codeblocks(text, hashes):
"""Hashes codeblocks (<pre> elements).
Codeblocks are strictly defined to be (non-list) lines that are
indented at least 4 spaces from the newline. Exactly 4 spaces will
be stripped from the beginning of the line -- any leading
whitespace after that is preserved.
... | def function[hash_codeblocks, parameter[text, hashes]]:
constant[Hashes codeblocks (<pre> elements).
Codeblocks are strictly defined to be (non-list) lines that are
indented at least 4 spaces from the newline. Exactly 4 spaces will
be stripped from the beginning of the line -- any leading
white... | keyword[def] identifier[hash_codeblocks] ( identifier[text] , identifier[hashes] ):
literal[string]
keyword[def] identifier[sub] ( identifier[match] ):
identifier[block] = identifier[match] . identifier[group] ( literal[int] ). identifier[rstrip] ( literal[string] )
identifier[block] = i... | def hash_codeblocks(text, hashes):
"""Hashes codeblocks (<pre> elements).
Codeblocks are strictly defined to be (non-list) lines that are
indented at least 4 spaces from the newline. Exactly 4 spaces will
be stripped from the beginning of the line -- any leading
whitespace after that is preserved.
... |
def get_dependencies(self, version=None):
'''
Parameters
----------
version: str
string representing version number whose dependencies you are
looking up
'''
version = _process_version(self, version)
history = self.get_history()
f... | def function[get_dependencies, parameter[self, version]]:
constant[
Parameters
----------
version: str
string representing version number whose dependencies you are
looking up
]
variable[version] assign[=] call[name[_process_version], parameter[nam... | keyword[def] identifier[get_dependencies] ( identifier[self] , identifier[version] = keyword[None] ):
literal[string]
identifier[version] = identifier[_process_version] ( identifier[self] , identifier[version] )
identifier[history] = identifier[self] . identifier[get_history] ()
... | def get_dependencies(self, version=None):
"""
Parameters
----------
version: str
string representing version number whose dependencies you are
looking up
"""
version = _process_version(self, version)
history = self.get_history()
for v in reversed(h... |
def register_processor(self, processor):
"""
Register a new processor.
Note that processors are called in the order that they are registered.
"""
if not callable(processor):
raise ValueError('Processor %s is not callable.' % processor.__class__.__name__)
else... | def function[register_processor, parameter[self, processor]]:
constant[
Register a new processor.
Note that processors are called in the order that they are registered.
]
if <ast.UnaryOp object at 0x7da207f031c0> begin[:]
<ast.Raise object at 0x7da207f03700> | keyword[def] identifier[register_processor] ( identifier[self] , identifier[processor] ):
literal[string]
keyword[if] keyword[not] identifier[callable] ( identifier[processor] ):
keyword[raise] identifier[ValueError] ( literal[string] % identifier[processor] . identifier[__class__] ... | def register_processor(self, processor):
"""
Register a new processor.
Note that processors are called in the order that they are registered.
"""
if not callable(processor):
raise ValueError('Processor %s is not callable.' % processor.__class__.__name__) # depends on [control=[... |
def fields(self, fields):
"""Sets `sysparm_fields` after joining the given list of `fields`
:param fields: List of fields to include in the response
:raise:
:InvalidUsage: if fields is of an unexpected type
"""
if not isinstance(fields, list):
raise Inva... | def function[fields, parameter[self, fields]]:
constant[Sets `sysparm_fields` after joining the given list of `fields`
:param fields: List of fields to include in the response
:raise:
:InvalidUsage: if fields is of an unexpected type
]
if <ast.UnaryOp object at 0x7da... | keyword[def] identifier[fields] ( identifier[self] , identifier[fields] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[fields] , identifier[list] ):
keyword[raise] identifier[InvalidUsage] ( literal[string] )
identifier[self] . identifier[... | def fields(self, fields):
"""Sets `sysparm_fields` after joining the given list of `fields`
:param fields: List of fields to include in the response
:raise:
:InvalidUsage: if fields is of an unexpected type
"""
if not isinstance(fields, list):
raise InvalidUsage('fie... |
def startCc(CallControlCapabilities_presence=0):
"""START CC Section 9.3.23a"""
a = TpPd(pd=0x3)
b = MessageType(mesType=0x9) # 00001001
packet = a / b
if CallControlCapabilities_presence is 1:
c = CallControlCapabilitiesHdr(ieiCCC=0x15, eightBitCCC=0x0)
packet = paclet / c
retu... | def function[startCc, parameter[CallControlCapabilities_presence]]:
constant[START CC Section 9.3.23a]
variable[a] assign[=] call[name[TpPd], parameter[]]
variable[b] assign[=] call[name[MessageType], parameter[]]
variable[packet] assign[=] binary_operation[name[a] / name[b]]
if ... | keyword[def] identifier[startCc] ( identifier[CallControlCapabilities_presence] = literal[int] ):
literal[string]
identifier[a] = identifier[TpPd] ( identifier[pd] = literal[int] )
identifier[b] = identifier[MessageType] ( identifier[mesType] = literal[int] )
identifier[packet] = identifier[a] / ... | def startCc(CallControlCapabilities_presence=0):
"""START CC Section 9.3.23a"""
a = TpPd(pd=3)
b = MessageType(mesType=9) # 00001001
packet = a / b
if CallControlCapabilities_presence is 1:
c = CallControlCapabilitiesHdr(ieiCCC=21, eightBitCCC=0)
packet = paclet / c # depends on [c... |
def load_sensor_composites(self, sensor_name):
"""Load all compositor configs for the provided sensor."""
config_filename = sensor_name + ".yaml"
LOG.debug("Looking for composites config file %s", config_filename)
composite_configs = config_search_paths(
os.path.join("composi... | def function[load_sensor_composites, parameter[self, sensor_name]]:
constant[Load all compositor configs for the provided sensor.]
variable[config_filename] assign[=] binary_operation[name[sensor_name] + constant[.yaml]]
call[name[LOG].debug, parameter[constant[Looking for composites config file... | keyword[def] identifier[load_sensor_composites] ( identifier[self] , identifier[sensor_name] ):
literal[string]
identifier[config_filename] = identifier[sensor_name] + literal[string]
identifier[LOG] . identifier[debug] ( literal[string] , identifier[config_filename] )
identifier... | def load_sensor_composites(self, sensor_name):
"""Load all compositor configs for the provided sensor."""
config_filename = sensor_name + '.yaml'
LOG.debug('Looking for composites config file %s', config_filename)
composite_configs = config_search_paths(os.path.join('composites', config_filename), self.... |
def get_tab(self, tab_name, allow_disabled=False):
"""Returns a specific tab from this tab group.
If the tab is not allowed or not enabled this method returns ``None``.
If the tab is disabled but you wish to return it anyway, you can pass
``True`` to the allow_disabled argument.
... | def function[get_tab, parameter[self, tab_name, allow_disabled]]:
constant[Returns a specific tab from this tab group.
If the tab is not allowed or not enabled this method returns ``None``.
If the tab is disabled but you wish to return it anyway, you can pass
``True`` to the allow_disa... | keyword[def] identifier[get_tab] ( identifier[self] , identifier[tab_name] , identifier[allow_disabled] = keyword[False] ):
literal[string]
identifier[tab] = identifier[self] . identifier[_tabs] . identifier[get] ( identifier[tab_name] , keyword[None] )
keyword[if] identifier[tab] keywor... | def get_tab(self, tab_name, allow_disabled=False):
"""Returns a specific tab from this tab group.
If the tab is not allowed or not enabled this method returns ``None``.
If the tab is disabled but you wish to return it anyway, you can pass
``True`` to the allow_disabled argument.
""... |
def connectRelay(self):
"""Builds the target protocol and connects it to the relay transport.
"""
self.protocol = self.connector.buildProtocol(None)
self.connected = True
self.protocol.makeConnection(self) | def function[connectRelay, parameter[self]]:
constant[Builds the target protocol and connects it to the relay transport.
]
name[self].protocol assign[=] call[name[self].connector.buildProtocol, parameter[constant[None]]]
name[self].connected assign[=] constant[True]
call[name[sel... | keyword[def] identifier[connectRelay] ( identifier[self] ):
literal[string]
identifier[self] . identifier[protocol] = identifier[self] . identifier[connector] . identifier[buildProtocol] ( keyword[None] )
identifier[self] . identifier[connected] = keyword[True]
identifier[self] .... | def connectRelay(self):
"""Builds the target protocol and connects it to the relay transport.
"""
self.protocol = self.connector.buildProtocol(None)
self.connected = True
self.protocol.makeConnection(self) |
def prompt_unset_inputs(self, force=False):
""" Prompt for unset input values """
for k, v in self._inputs.items():
if force or v.is_empty(False):
self.get_input(k, force=force) | def function[prompt_unset_inputs, parameter[self, force]]:
constant[ Prompt for unset input values ]
for taget[tuple[[<ast.Name object at 0x7da20c7c92a0>, <ast.Name object at 0x7da20c7ca980>]]] in starred[call[name[self]._inputs.items, parameter[]]] begin[:]
if <ast.BoolOp object at 0x7d... | keyword[def] identifier[prompt_unset_inputs] ( identifier[self] , identifier[force] = keyword[False] ):
literal[string]
keyword[for] identifier[k] , identifier[v] keyword[in] identifier[self] . identifier[_inputs] . identifier[items] ():
keyword[if] identifier[force] keyword[or] ... | def prompt_unset_inputs(self, force=False):
""" Prompt for unset input values """
for (k, v) in self._inputs.items():
if force or v.is_empty(False):
self.get_input(k, force=force) # depends on [control=['if'], data=[]] # depends on [control=['for'], data=[]] |
def hook_key(key, callback, suppress=False):
"""
Hooks key up and key down events for a single key. Returns the event handler
created. To remove a hooked key use `unhook_key(key)` or
`unhook_key(handler)`.
Note: this function shares state with hotkeys, so `clear_all_hotkeys`
affects it aswell.
... | def function[hook_key, parameter[key, callback, suppress]]:
constant[
Hooks key up and key down events for a single key. Returns the event handler
created. To remove a hooked key use `unhook_key(key)` or
`unhook_key(handler)`.
Note: this function shares state with hotkeys, so `clear_all_hotkeys... | keyword[def] identifier[hook_key] ( identifier[key] , identifier[callback] , identifier[suppress] = keyword[False] ):
literal[string]
identifier[_listener] . identifier[start_if_necessary] ()
identifier[store] = identifier[_listener] . identifier[blocking_keys] keyword[if] identifier[suppress] keyw... | def hook_key(key, callback, suppress=False):
"""
Hooks key up and key down events for a single key. Returns the event handler
created. To remove a hooked key use `unhook_key(key)` or
`unhook_key(handler)`.
Note: this function shares state with hotkeys, so `clear_all_hotkeys`
affects it aswell.
... |
def get_medium_attachments_of_controller(self, name):
"""Returns an array of medium attachments which are attached to the
the controller with the given name.
in name of type str
return medium_attachments of type :class:`IMediumAttachment`
raises :class:`VBoxErrorObjectNotFound... | def function[get_medium_attachments_of_controller, parameter[self, name]]:
constant[Returns an array of medium attachments which are attached to the
the controller with the given name.
in name of type str
return medium_attachments of type :class:`IMediumAttachment`
raises :cla... | keyword[def] identifier[get_medium_attachments_of_controller] ( identifier[self] , identifier[name] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[name] , identifier[basestring] ):
keyword[raise] identifier[TypeError] ( literal[string] )
ide... | def get_medium_attachments_of_controller(self, name):
"""Returns an array of medium attachments which are attached to the
the controller with the given name.
in name of type str
return medium_attachments of type :class:`IMediumAttachment`
raises :class:`VBoxErrorObjectNotFound`
... |
def get_current_instruction(self) -> Dict:
"""Gets the current instruction for this GlobalState.
:return:
"""
instructions = self.environment.code.instruction_list
return instructions[self.mstate.pc] | def function[get_current_instruction, parameter[self]]:
constant[Gets the current instruction for this GlobalState.
:return:
]
variable[instructions] assign[=] name[self].environment.code.instruction_list
return[call[name[instructions]][name[self].mstate.pc]] | keyword[def] identifier[get_current_instruction] ( identifier[self] )-> identifier[Dict] :
literal[string]
identifier[instructions] = identifier[self] . identifier[environment] . identifier[code] . identifier[instruction_list]
keyword[return] identifier[instructions] [ identifier[self] ... | def get_current_instruction(self) -> Dict:
"""Gets the current instruction for this GlobalState.
:return:
"""
instructions = self.environment.code.instruction_list
return instructions[self.mstate.pc] |
def create_WCSname(wcsname):
""" Verify that a valid WCSNAME has been provided, and if not, create a
default WCSNAME based on current date.
"""
if util.is_blank(wcsname):
ptime = fileutil.getDate()
wcsname = "User_"+ptime
return wcsname | def function[create_WCSname, parameter[wcsname]]:
constant[ Verify that a valid WCSNAME has been provided, and if not, create a
default WCSNAME based on current date.
]
if call[name[util].is_blank, parameter[name[wcsname]]] begin[:]
variable[ptime] assign[=] call[name[fileuti... | keyword[def] identifier[create_WCSname] ( identifier[wcsname] ):
literal[string]
keyword[if] identifier[util] . identifier[is_blank] ( identifier[wcsname] ):
identifier[ptime] = identifier[fileutil] . identifier[getDate] ()
identifier[wcsname] = literal[string] + identifier[ptime]
... | def create_WCSname(wcsname):
""" Verify that a valid WCSNAME has been provided, and if not, create a
default WCSNAME based on current date.
"""
if util.is_blank(wcsname):
ptime = fileutil.getDate()
wcsname = 'User_' + ptime # depends on [control=['if'], data=[]]
return wcsname |
def write_iocs(self, directory=None, source=None):
"""
Serializes IOCs to a directory.
:param directory: Directory to write IOCs to. If not provided, the current working directory is used.
:param source: Dictionary contianing iocid -> IOC mapping. Defaults to self.iocs_10. This is not... | def function[write_iocs, parameter[self, directory, source]]:
constant[
Serializes IOCs to a directory.
:param directory: Directory to write IOCs to. If not provided, the current working directory is used.
:param source: Dictionary contianing iocid -> IOC mapping. Defaults to self.ioc... | keyword[def] identifier[write_iocs] ( identifier[self] , identifier[directory] = keyword[None] , identifier[source] = keyword[None] ):
literal[string]
literal[string]
keyword[if] keyword[not] identifier[source] :
identifier[source] = identifier[self] . identifier[iocs_10]
... | def write_iocs(self, directory=None, source=None):
"""
Serializes IOCs to a directory.
:param directory: Directory to write IOCs to. If not provided, the current working directory is used.
:param source: Dictionary contianing iocid -> IOC mapping. Defaults to self.iocs_10. This is not nor... |
def reassign_ids(doc, verbose = False):
"""
Assign new IDs to all rows in all LSC tables in doc so that there
are no collisions when the LIGO_LW elements are merged.
"""
# Can't simply run reassign_ids() on doc because we need to
# construct a fresh old --> new mapping within each LIGO_LW block.
for n, elem in e... | def function[reassign_ids, parameter[doc, verbose]]:
constant[
Assign new IDs to all rows in all LSC tables in doc so that there
are no collisions when the LIGO_LW elements are merged.
]
for taget[tuple[[<ast.Name object at 0x7da18dc06e00>, <ast.Name object at 0x7da18dc07b80>]]] in starred[call[name[... | keyword[def] identifier[reassign_ids] ( identifier[doc] , identifier[verbose] = keyword[False] ):
literal[string]
keyword[for] identifier[n] , identifier[elem] keyword[in] identifier[enumerate] ( identifier[doc] . identifier[childNodes] ):
keyword[if] identifier[verbose] :
identifier[print] >> ide... | def reassign_ids(doc, verbose=False):
"""
Assign new IDs to all rows in all LSC tables in doc so that there
are no collisions when the LIGO_LW elements are merged.
""" # Can't simply run reassign_ids() on doc because we need to
# construct a fresh old --> new mapping within each LIGO_LW block.
for (n, e... |
def averaged(*values):
"""
Returns the mean of all supplied values. One or more *values* can be
specified. For example, to light a :class:`~gpiozero.PWMLED` as the average
of several potentiometers connected to an :class:`~gpiozero.MCP3008` ADC::
from gpiozero import MCP3008, PWMLED
fro... | def function[averaged, parameter[]]:
constant[
Returns the mean of all supplied values. One or more *values* can be
specified. For example, to light a :class:`~gpiozero.PWMLED` as the average
of several potentiometers connected to an :class:`~gpiozero.MCP3008` ADC::
from gpiozero import MCP... | keyword[def] identifier[averaged] (* identifier[values] ):
literal[string]
identifier[values] =[ identifier[_normalize] ( identifier[v] ) keyword[for] identifier[v] keyword[in] identifier[values] ]
keyword[for] identifier[v] keyword[in] identifier[zip] (* identifier[values] ):
keyword[y... | def averaged(*values):
"""
Returns the mean of all supplied values. One or more *values* can be
specified. For example, to light a :class:`~gpiozero.PWMLED` as the average
of several potentiometers connected to an :class:`~gpiozero.MCP3008` ADC::
from gpiozero import MCP3008, PWMLED
fro... |
def sendline(self, data, linesep=os.linesep):
'''
Send the provided data to the terminal appending a line feed.
'''
return self.send('{0}{1}'.format(data, linesep)) | def function[sendline, parameter[self, data, linesep]]:
constant[
Send the provided data to the terminal appending a line feed.
]
return[call[name[self].send, parameter[call[constant[{0}{1}].format, parameter[name[data], name[linesep]]]]]] | keyword[def] identifier[sendline] ( identifier[self] , identifier[data] , identifier[linesep] = identifier[os] . identifier[linesep] ):
literal[string]
keyword[return] identifier[self] . identifier[send] ( literal[string] . identifier[format] ( identifier[data] , identifier[linesep] )) | def sendline(self, data, linesep=os.linesep):
"""
Send the provided data to the terminal appending a line feed.
"""
return self.send('{0}{1}'.format(data, linesep)) |
def parse_spec(self):
"""Parse the specification of how to recruit participants.
Example: recruiters = bots: 5, mturk: 1
"""
recruiters = []
spec = get_config().get("recruiters")
for match in self.SPEC_RE.finditer(spec):
name = match.group(1)
coun... | def function[parse_spec, parameter[self]]:
constant[Parse the specification of how to recruit participants.
Example: recruiters = bots: 5, mturk: 1
]
variable[recruiters] assign[=] list[[]]
variable[spec] assign[=] call[call[name[get_config], parameter[]].get, parameter[constant... | keyword[def] identifier[parse_spec] ( identifier[self] ):
literal[string]
identifier[recruiters] =[]
identifier[spec] = identifier[get_config] (). identifier[get] ( literal[string] )
keyword[for] identifier[match] keyword[in] identifier[self] . identifier[SPEC_RE] . identifier[... | def parse_spec(self):
"""Parse the specification of how to recruit participants.
Example: recruiters = bots: 5, mturk: 1
"""
recruiters = []
spec = get_config().get('recruiters')
for match in self.SPEC_RE.finditer(spec):
name = match.group(1)
count = int(match.group(2))
... |
def _build_kernel_function_declaration(self, name='kernel'):
"""Build and return kernel function declaration"""
array_declarations, array_dimensions = self._build_array_declarations(with_init=False)
scalar_declarations = self._build_scalar_declarations(with_init=False)
const_declarations... | def function[_build_kernel_function_declaration, parameter[self, name]]:
constant[Build and return kernel function declaration]
<ast.Tuple object at 0x7da20c6c59f0> assign[=] call[name[self]._build_array_declarations, parameter[]]
variable[scalar_declarations] assign[=] call[name[self]._build_sc... | keyword[def] identifier[_build_kernel_function_declaration] ( identifier[self] , identifier[name] = literal[string] ):
literal[string]
identifier[array_declarations] , identifier[array_dimensions] = identifier[self] . identifier[_build_array_declarations] ( identifier[with_init] = keyword[False] )
... | def _build_kernel_function_declaration(self, name='kernel'):
"""Build and return kernel function declaration"""
(array_declarations, array_dimensions) = self._build_array_declarations(with_init=False)
scalar_declarations = self._build_scalar_declarations(with_init=False)
const_declarations = self._build... |
def _set_auto_fields(self, model_obj):
"""Set the values of the auto field using counter"""
for field_name, field_obj in \
self.entity_cls.meta_.auto_fields:
counter_key = f'{self.schema_name}_{field_name}'
if not (field_name in model_obj and model_obj[field_name]... | def function[_set_auto_fields, parameter[self, model_obj]]:
constant[Set the values of the auto field using counter]
for taget[tuple[[<ast.Name object at 0x7da1b1bba410>, <ast.Name object at 0x7da1b1bbb7c0>]]] in starred[name[self].entity_cls.meta_.auto_fields] begin[:]
variable[counter_... | keyword[def] identifier[_set_auto_fields] ( identifier[self] , identifier[model_obj] ):
literal[string]
keyword[for] identifier[field_name] , identifier[field_obj] keyword[in] identifier[self] . identifier[entity_cls] . identifier[meta_] . identifier[auto_fields] :
identifier[counte... | def _set_auto_fields(self, model_obj):
"""Set the values of the auto field using counter"""
for (field_name, field_obj) in self.entity_cls.meta_.auto_fields:
counter_key = f'{self.schema_name}_{field_name}'
if not (field_name in model_obj and model_obj[field_name] is not None):
# Inc... |
def add_wic_ports(self, wic_slot):
"""
Add the ports for a specific WIC to the node['ports'] dictionary
:param str wic_slot: WIC Slot (wic0)
"""
wic_slot_number = int(wic_slot[3])
wic_adapter = self.node['properties'][wic_slot]
num_ports = ADAPTER_MATRIX[wic_ada... | def function[add_wic_ports, parameter[self, wic_slot]]:
constant[
Add the ports for a specific WIC to the node['ports'] dictionary
:param str wic_slot: WIC Slot (wic0)
]
variable[wic_slot_number] assign[=] call[name[int], parameter[call[name[wic_slot]][constant[3]]]]
var... | keyword[def] identifier[add_wic_ports] ( identifier[self] , identifier[wic_slot] ):
literal[string]
identifier[wic_slot_number] = identifier[int] ( identifier[wic_slot] [ literal[int] ])
identifier[wic_adapter] = identifier[self] . identifier[node] [ literal[string] ][ identifier[wic_slot]... | def add_wic_ports(self, wic_slot):
"""
Add the ports for a specific WIC to the node['ports'] dictionary
:param str wic_slot: WIC Slot (wic0)
"""
wic_slot_number = int(wic_slot[3])
wic_adapter = self.node['properties'][wic_slot]
num_ports = ADAPTER_MATRIX[wic_adapter]['ports']
... |
def button_clicked(self, button):
"""Action when button was clicked.
Parameters
----------
button : instance of QPushButton
which button was pressed
"""
if button is self.idx_ok:
fn = Path(self.filename)
xp_format = self.xp... | def function[button_clicked, parameter[self, button]]:
constant[Action when button was clicked.
Parameters
----------
button : instance of QPushButton
which button was pressed
]
if compare[name[button] is name[self].idx_ok] begin[:]
variable[f... | keyword[def] identifier[button_clicked] ( identifier[self] , identifier[button] ):
literal[string]
keyword[if] identifier[button] keyword[is] identifier[self] . identifier[idx_ok] :
identifier[fn] = identifier[Path] ( identifier[self] . identifier[filename] )
identifier... | def button_clicked(self, button):
"""Action when button was clicked.
Parameters
----------
button : instance of QPushButton
which button was pressed
"""
if button is self.idx_ok:
fn = Path(self.filename)
xp_format = self.xp_format.get_value()
... |
def _keys(self, pattern):
"""Execute the KEYS command on all Redis shards.
Args:
pattern: The KEYS pattern to query.
Returns:
The concatenated list of results from all shards.
"""
result = []
for client in self.redis_clients:
result.e... | def function[_keys, parameter[self, pattern]]:
constant[Execute the KEYS command on all Redis shards.
Args:
pattern: The KEYS pattern to query.
Returns:
The concatenated list of results from all shards.
]
variable[result] assign[=] list[[]]
for t... | keyword[def] identifier[_keys] ( identifier[self] , identifier[pattern] ):
literal[string]
identifier[result] =[]
keyword[for] identifier[client] keyword[in] identifier[self] . identifier[redis_clients] :
identifier[result] . identifier[extend] ( identifier[list] ( identifi... | def _keys(self, pattern):
"""Execute the KEYS command on all Redis shards.
Args:
pattern: The KEYS pattern to query.
Returns:
The concatenated list of results from all shards.
"""
result = []
for client in self.redis_clients:
result.extend(list(clien... |
def riemann_metric( Y, laplacian, n_dim=None, invert_h=False, mode_inv = 'svd'):
"""
Parameters
----------
Y: array-like, shape = (n_samples, mdimY )
The embedding coordinates of the points
laplacian: array-like, shape = (n_samples, n_samples)
The Laplacian of the data. It is recomme... | def function[riemann_metric, parameter[Y, laplacian, n_dim, invert_h, mode_inv]]:
constant[
Parameters
----------
Y: array-like, shape = (n_samples, mdimY )
The embedding coordinates of the points
laplacian: array-like, shape = (n_samples, n_samples)
The Laplacian of the data. It... | keyword[def] identifier[riemann_metric] ( identifier[Y] , identifier[laplacian] , identifier[n_dim] = keyword[None] , identifier[invert_h] = keyword[False] , identifier[mode_inv] = literal[string] ):
literal[string]
identifier[n_samples] = identifier[laplacian] . identifier[shape] [ literal[int] ]
ide... | def riemann_metric(Y, laplacian, n_dim=None, invert_h=False, mode_inv='svd'):
"""
Parameters
----------
Y: array-like, shape = (n_samples, mdimY )
The embedding coordinates of the points
laplacian: array-like, shape = (n_samples, n_samples)
The Laplacian of the data. It is recommende... |
def marker_for_line(self, line):
"""
Returns the marker that is displayed at the specified line number if
any.
:param line: The marker line.
:return: Marker of None
:rtype: pyqode.core.Marker
"""
block = self.editor.document().findBlockByNumber(line)
... | def function[marker_for_line, parameter[self, line]]:
constant[
Returns the marker that is displayed at the specified line number if
any.
:param line: The marker line.
:return: Marker of None
:rtype: pyqode.core.Marker
]
variable[block] assign[=] call[ca... | keyword[def] identifier[marker_for_line] ( identifier[self] , identifier[line] ):
literal[string]
identifier[block] = identifier[self] . identifier[editor] . identifier[document] (). identifier[findBlockByNumber] ( identifier[line] )
keyword[try] :
keyword[return] identifier[... | def marker_for_line(self, line):
"""
Returns the marker that is displayed at the specified line number if
any.
:param line: The marker line.
:return: Marker of None
:rtype: pyqode.core.Marker
"""
block = self.editor.document().findBlockByNumber(line)
try:
... |
def get_attribute(self, attribute_name, no_cache=False):
""" Gets the passed attribute of this group.
:param attribute_name: The name of the attribute to get.
:type attribute_name: str
:param no_cache (optional): Set to True to pull the attribute directly from an LDAP search instea... | def function[get_attribute, parameter[self, attribute_name, no_cache]]:
constant[ Gets the passed attribute of this group.
:param attribute_name: The name of the attribute to get.
:type attribute_name: str
:param no_cache (optional): Set to True to pull the attribute directly from an LD... | keyword[def] identifier[get_attribute] ( identifier[self] , identifier[attribute_name] , identifier[no_cache] = keyword[False] ):
literal[string]
identifier[attributes] = identifier[self] . identifier[get_attributes] ( identifier[no_cache] )
keyword[if] identifier[attribute_name] ... | def get_attribute(self, attribute_name, no_cache=False):
""" Gets the passed attribute of this group.
:param attribute_name: The name of the attribute to get.
:type attribute_name: str
:param no_cache (optional): Set to True to pull the attribute directly from an LDAP search instead of
... |
def select_io( hash ):
"""
Returns the relevant i/o for a method whose call is characterized by the hash
:param hash: The hash for the CallDescriptor
:rtype list(tuple( hash, stack, methodname, returnval, args, packet_num )):
"""
load_cache(True)
global CACHE_
res = []
record_used(... | def function[select_io, parameter[hash]]:
constant[
Returns the relevant i/o for a method whose call is characterized by the hash
:param hash: The hash for the CallDescriptor
:rtype list(tuple( hash, stack, methodname, returnval, args, packet_num )):
]
call[name[load_cache], parameter[... | keyword[def] identifier[select_io] ( identifier[hash] ):
literal[string]
identifier[load_cache] ( keyword[True] )
keyword[global] identifier[CACHE_]
identifier[res] =[]
identifier[record_used] ( literal[string] , identifier[hash] )
keyword[for] identifier[d] keyword[in] identifier[... | def select_io(hash):
"""
Returns the relevant i/o for a method whose call is characterized by the hash
:param hash: The hash for the CallDescriptor
:rtype list(tuple( hash, stack, methodname, returnval, args, packet_num )):
"""
load_cache(True)
global CACHE_
res = []
record_used('c... |
def symmetric_difference(self, that):
"""
Return a new set with elements in either *self* or *that* but not both.
"""
diff = self._set.symmetric_difference(that)
return self._fromset(diff, key=self._key) | def function[symmetric_difference, parameter[self, that]]:
constant[
Return a new set with elements in either *self* or *that* but not both.
]
variable[diff] assign[=] call[name[self]._set.symmetric_difference, parameter[name[that]]]
return[call[name[self]._fromset, parameter[name[di... | keyword[def] identifier[symmetric_difference] ( identifier[self] , identifier[that] ):
literal[string]
identifier[diff] = identifier[self] . identifier[_set] . identifier[symmetric_difference] ( identifier[that] )
keyword[return] identifier[self] . identifier[_fromset] ( identifier[diff] ... | def symmetric_difference(self, that):
"""
Return a new set with elements in either *self* or *that* but not both.
"""
diff = self._set.symmetric_difference(that)
return self._fromset(diff, key=self._key) |
def Max(self, k):
"""Computes the CDF of the maximum of k selections from this dist.
k: int
returns: new Cdf
"""
cdf = self.MakeCdf()
cdf.ps = [p ** k for p in cdf.ps]
return cdf | def function[Max, parameter[self, k]]:
constant[Computes the CDF of the maximum of k selections from this dist.
k: int
returns: new Cdf
]
variable[cdf] assign[=] call[name[self].MakeCdf, parameter[]]
name[cdf].ps assign[=] <ast.ListComp object at 0x7da1b03828c0>
ret... | keyword[def] identifier[Max] ( identifier[self] , identifier[k] ):
literal[string]
identifier[cdf] = identifier[self] . identifier[MakeCdf] ()
identifier[cdf] . identifier[ps] =[ identifier[p] ** identifier[k] keyword[for] identifier[p] keyword[in] identifier[cdf] . identifier[ps] ]
... | def Max(self, k):
"""Computes the CDF of the maximum of k selections from this dist.
k: int
returns: new Cdf
"""
cdf = self.MakeCdf()
cdf.ps = [p ** k for p in cdf.ps]
return cdf |
def _raise_from_invalid_response(error):
"""Re-wrap and raise an ``InvalidResponse`` exception.
:type error: :exc:`google.resumable_media.InvalidResponse`
:param error: A caught exception from the ``google-resumable-media``
library.
:raises: :class:`~google.cloud.exceptions.GoogleClo... | def function[_raise_from_invalid_response, parameter[error]]:
constant[Re-wrap and raise an ``InvalidResponse`` exception.
:type error: :exc:`google.resumable_media.InvalidResponse`
:param error: A caught exception from the ``google-resumable-media``
library.
:raises: :class:`~go... | keyword[def] identifier[_raise_from_invalid_response] ( identifier[error] ):
literal[string]
identifier[response] = identifier[error] . identifier[response]
identifier[error_message] = identifier[str] ( identifier[error] )
identifier[message] = literal[string] . identifier[format] (
identi... | def _raise_from_invalid_response(error):
"""Re-wrap and raise an ``InvalidResponse`` exception.
:type error: :exc:`google.resumable_media.InvalidResponse`
:param error: A caught exception from the ``google-resumable-media``
library.
:raises: :class:`~google.cloud.exceptions.GoogleClo... |
def run(self, force=False):
"""
Build a MBTile file.
force -- overwrite if MBTiles file already exists.
"""
if os.path.exists(self.filepath):
if force:
logger.warn(_("%s already exists. Overwrite.") % self.filepath)
os.remove(self.file... | def function[run, parameter[self, force]]:
constant[
Build a MBTile file.
force -- overwrite if MBTiles file already exists.
]
if call[name[os].path.exists, parameter[name[self].filepath]] begin[:]
if name[force] begin[:]
call[name[logger]... | keyword[def] identifier[run] ( identifier[self] , identifier[force] = keyword[False] ):
literal[string]
keyword[if] identifier[os] . identifier[path] . identifier[exists] ( identifier[self] . identifier[filepath] ):
keyword[if] identifier[force] :
identifier[logger] ... | def run(self, force=False):
"""
Build a MBTile file.
force -- overwrite if MBTiles file already exists.
"""
if os.path.exists(self.filepath):
if force:
logger.warn(_('%s already exists. Overwrite.') % self.filepath)
os.remove(self.filepath) # depends on ... |
def shard_filename(path, tag, shard_num, total_shards):
"""Create filename for data shard."""
return os.path.join(
path, "%s-%s-%s-%.5d-of-%.5d" % (_PREFIX, _ENCODE_TAG, tag, shard_num, total_shards)) | def function[shard_filename, parameter[path, tag, shard_num, total_shards]]:
constant[Create filename for data shard.]
return[call[name[os].path.join, parameter[name[path], binary_operation[constant[%s-%s-%s-%.5d-of-%.5d] <ast.Mod object at 0x7da2590d6920> tuple[[<ast.Name object at 0x7da18c4cdea0>, <ast.Na... | keyword[def] identifier[shard_filename] ( identifier[path] , identifier[tag] , identifier[shard_num] , identifier[total_shards] ):
literal[string]
keyword[return] identifier[os] . identifier[path] . identifier[join] (
identifier[path] , literal[string] %( identifier[_PREFIX] , identifier[_ENCODE_TAG] , ide... | def shard_filename(path, tag, shard_num, total_shards):
"""Create filename for data shard."""
return os.path.join(path, '%s-%s-%s-%.5d-of-%.5d' % (_PREFIX, _ENCODE_TAG, tag, shard_num, total_shards)) |
def get_average_record(self, n):
"""Returns a list of average current numbers, each representing the
average over the last n data points.
Args:
n: Number of data points to average over.
Returns:
A list of average current values.
"""
history_deque... | def function[get_average_record, parameter[self, n]]:
constant[Returns a list of average current numbers, each representing the
average over the last n data points.
Args:
n: Number of data points to average over.
Returns:
A list of average current values.
... | keyword[def] identifier[get_average_record] ( identifier[self] , identifier[n] ):
literal[string]
identifier[history_deque] = identifier[collections] . identifier[deque] ()
identifier[averages] =[]
keyword[for] identifier[d] keyword[in] identifier[self] . identifier[data_points... | def get_average_record(self, n):
"""Returns a list of average current numbers, each representing the
average over the last n data points.
Args:
n: Number of data points to average over.
Returns:
A list of average current values.
"""
history_deque = colle... |
def _log10_Inorm_extern_planckint(self, Teff):
"""
Internal function to compute normal passband intensities using
the external WD machinery that employs blackbody approximation.
@Teff: effective temperature in K
Returns: log10(Inorm)
"""
log10_Inorm = libphoebe... | def function[_log10_Inorm_extern_planckint, parameter[self, Teff]]:
constant[
Internal function to compute normal passband intensities using
the external WD machinery that employs blackbody approximation.
@Teff: effective temperature in K
Returns: log10(Inorm)
]
... | keyword[def] identifier[_log10_Inorm_extern_planckint] ( identifier[self] , identifier[Teff] ):
literal[string]
identifier[log10_Inorm] = identifier[libphoebe] . identifier[wd_planckint] ( identifier[Teff] , identifier[self] . identifier[extern_wd_idx] , identifier[self] . identifier[wd_data] [ li... | def _log10_Inorm_extern_planckint(self, Teff):
"""
Internal function to compute normal passband intensities using
the external WD machinery that employs blackbody approximation.
@Teff: effective temperature in K
Returns: log10(Inorm)
"""
log10_Inorm = libphoebe.wd_planc... |
def add_group_user(self, group_id, user_id):
"""
Adds an existing user to a group.
:param group_id: The unique ID of the group.
:type group_id: ``str``
:param user_id: The unique ID of the user.
:type user_id: ``str``
"""
data = {
... | def function[add_group_user, parameter[self, group_id, user_id]]:
constant[
Adds an existing user to a group.
:param group_id: The unique ID of the group.
:type group_id: ``str``
:param user_id: The unique ID of the user.
:type user_id: ``str``
... | keyword[def] identifier[add_group_user] ( identifier[self] , identifier[group_id] , identifier[user_id] ):
literal[string]
identifier[data] ={
literal[string] : identifier[user_id]
}
identifier[response] = identifier[self] . identifier[_perform_request] (
identi... | def add_group_user(self, group_id, user_id):
"""
Adds an existing user to a group.
:param group_id: The unique ID of the group.
:type group_id: ``str``
:param user_id: The unique ID of the user.
:type user_id: ``str``
"""
data = {'id': use... |
def remove_dynamodb_tables():
"""Remove the Blockade DynamoDB tables."""
logger.debug("[#] Removing DynamoDB tables")
client = boto3.client('dynamodb', region_name=PRIMARY_REGION)
responses = list()
for label in DYNAMODB_TABLES:
logger.debug("[*] Removing %s table" % (label))
try:
... | def function[remove_dynamodb_tables, parameter[]]:
constant[Remove the Blockade DynamoDB tables.]
call[name[logger].debug, parameter[constant[[#] Removing DynamoDB tables]]]
variable[client] assign[=] call[name[boto3].client, parameter[constant[dynamodb]]]
variable[responses] assign[=] c... | keyword[def] identifier[remove_dynamodb_tables] ():
literal[string]
identifier[logger] . identifier[debug] ( literal[string] )
identifier[client] = identifier[boto3] . identifier[client] ( literal[string] , identifier[region_name] = identifier[PRIMARY_REGION] )
identifier[responses] = identifier... | def remove_dynamodb_tables():
"""Remove the Blockade DynamoDB tables."""
logger.debug('[#] Removing DynamoDB tables')
client = boto3.client('dynamodb', region_name=PRIMARY_REGION)
responses = list()
for label in DYNAMODB_TABLES:
logger.debug('[*] Removing %s table' % label)
try:
... |
def get_server_setting(settings, server=_DEFAULT_SERVER):
'''
Get the value of the setting for the SMTP virtual server.
:param str settings: A list of the setting names.
:param str server: The SMTP server name.
:return: A dictionary of the provided settings and their values.
:rtype: dict
... | def function[get_server_setting, parameter[settings, server]]:
constant[
Get the value of the setting for the SMTP virtual server.
:param str settings: A list of the setting names.
:param str server: The SMTP server name.
:return: A dictionary of the provided settings and their values.
:rt... | keyword[def] identifier[get_server_setting] ( identifier[settings] , identifier[server] = identifier[_DEFAULT_SERVER] ):
literal[string]
identifier[ret] = identifier[dict] ()
keyword[if] keyword[not] identifier[settings] :
identifier[_LOG] . identifier[warning] ( literal[string] )
... | def get_server_setting(settings, server=_DEFAULT_SERVER):
"""
Get the value of the setting for the SMTP virtual server.
:param str settings: A list of the setting names.
:param str server: The SMTP server name.
:return: A dictionary of the provided settings and their values.
:rtype: dict
... |
def entry_path(cls, project, location, entry_group, entry):
"""Return a fully-qualified entry string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}",
project=project,
location=locatio... | def function[entry_path, parameter[cls, project, location, entry_group, entry]]:
constant[Return a fully-qualified entry string.]
return[call[name[google].api_core.path_template.expand, parameter[constant[projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}]]]] | keyword[def] identifier[entry_path] ( identifier[cls] , identifier[project] , identifier[location] , identifier[entry_group] , identifier[entry] ):
literal[string]
keyword[return] identifier[google] . identifier[api_core] . identifier[path_template] . identifier[expand] (
literal[string] ... | def entry_path(cls, project, location, entry_group, entry):
"""Return a fully-qualified entry string."""
return google.api_core.path_template.expand('projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}', project=project, location=location, entry_group=entry_group, entry=entry) |
def rpc(rtype=None):
"""Decorator marks a method for export.
:param type: Specifies which :py:class:`Type` this method will return.
The return type (rtype) must be one of:
- An instance of :py:class:`p4p.Type`
- None, in which case the method must return a :py:class:`p4p.Value`
- One of the N... | def function[rpc, parameter[rtype]]:
constant[Decorator marks a method for export.
:param type: Specifies which :py:class:`Type` this method will return.
The return type (rtype) must be one of:
- An instance of :py:class:`p4p.Type`
- None, in which case the method must return a :py:class:`p4p... | keyword[def] identifier[rpc] ( identifier[rtype] = keyword[None] ):
literal[string]
identifier[wrap] = keyword[None]
keyword[if] identifier[rtype] keyword[is] keyword[None] keyword[or] identifier[isinstance] ( identifier[rtype] , identifier[Type] ):
keyword[pass]
keyword[elif] id... | def rpc(rtype=None):
"""Decorator marks a method for export.
:param type: Specifies which :py:class:`Type` this method will return.
The return type (rtype) must be one of:
- An instance of :py:class:`p4p.Type`
- None, in which case the method must return a :py:class:`p4p.Value`
- One of the N... |
def plot(self, flip=False, ax_channels=None, ax=None, *args, **kwargs):
"""
{_gate_plot_doc}
"""
if ax == None:
ax = pl.gca()
kwargs.setdefault('color', 'black')
if ax_channels is not None:
flip = self._find_orientation(ax_channels)
if n... | def function[plot, parameter[self, flip, ax_channels, ax]]:
constant[
{_gate_plot_doc}
]
if compare[name[ax] equal[==] constant[None]] begin[:]
variable[ax] assign[=] call[name[pl].gca, parameter[]]
call[name[kwargs].setdefault, parameter[constant[color], constant... | keyword[def] identifier[plot] ( identifier[self] , identifier[flip] = keyword[False] , identifier[ax_channels] = keyword[None] , identifier[ax] = keyword[None] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[if] identifier[ax] == keyword[None] :
identifier[ax] = ... | def plot(self, flip=False, ax_channels=None, ax=None, *args, **kwargs):
"""
{_gate_plot_doc}
"""
if ax == None:
ax = pl.gca() # depends on [control=['if'], data=['ax']]
kwargs.setdefault('color', 'black')
if ax_channels is not None:
flip = self._find_orientation(ax_chann... |
def prt_hier_down(self, goid, prt=sys.stdout):
"""Write hierarchy for all GO IDs below GO ID in arg, goid."""
wrhiercfg = self._get_wrhiercfg()
obj = WrHierPrt(self.gosubdag.go2obj, self.gosubdag.go2nt, wrhiercfg, prt)
obj.prt_hier_rec(goid)
return obj.items_list | def function[prt_hier_down, parameter[self, goid, prt]]:
constant[Write hierarchy for all GO IDs below GO ID in arg, goid.]
variable[wrhiercfg] assign[=] call[name[self]._get_wrhiercfg, parameter[]]
variable[obj] assign[=] call[name[WrHierPrt], parameter[name[self].gosubdag.go2obj, name[self].go... | keyword[def] identifier[prt_hier_down] ( identifier[self] , identifier[goid] , identifier[prt] = identifier[sys] . identifier[stdout] ):
literal[string]
identifier[wrhiercfg] = identifier[self] . identifier[_get_wrhiercfg] ()
identifier[obj] = identifier[WrHierPrt] ( identifier[self] . ide... | def prt_hier_down(self, goid, prt=sys.stdout):
"""Write hierarchy for all GO IDs below GO ID in arg, goid."""
wrhiercfg = self._get_wrhiercfg()
obj = WrHierPrt(self.gosubdag.go2obj, self.gosubdag.go2nt, wrhiercfg, prt)
obj.prt_hier_rec(goid)
return obj.items_list |
def _rc_sinterstore(self, dst, src, *args):
"""
Store the difference of sets ``src``, ``args`` into a new
set named ``dest``. Returns the number of keys in the new set.
"""
args = list_or_args(src, args)
result = self.sinter(*args)
if result is not set([]):
... | def function[_rc_sinterstore, parameter[self, dst, src]]:
constant[
Store the difference of sets ``src``, ``args`` into a new
set named ``dest``. Returns the number of keys in the new set.
]
variable[args] assign[=] call[name[list_or_args], parameter[name[src], name[args]]]
... | keyword[def] identifier[_rc_sinterstore] ( identifier[self] , identifier[dst] , identifier[src] ,* identifier[args] ):
literal[string]
identifier[args] = identifier[list_or_args] ( identifier[src] , identifier[args] )
identifier[result] = identifier[self] . identifier[sinter] (* identifier... | def _rc_sinterstore(self, dst, src, *args):
"""
Store the difference of sets ``src``, ``args`` into a new
set named ``dest``. Returns the number of keys in the new set.
"""
args = list_or_args(src, args)
result = self.sinter(*args)
if result is not set([]):
return self.... |
def add_record_check(self, actions, table, func):
# emitted after query
# table: 'table_name'
# column: ('table_name', 'column_name')
assert isinstance(table, str), '`table` must be table name'
for i in actions:
assert i not in (A.QUERY, A.CREATE), "meaningless action... | def function[add_record_check, parameter[self, actions, table, func]]:
assert[call[name[isinstance], parameter[name[table], name[str]]]]
for taget[name[i]] in starred[name[actions]] begin[:]
assert[compare[name[i] <ast.NotIn object at 0x7da2590d7190> tuple[[<ast.Attribute object at 0x7da1b00674f0>, ... | keyword[def] identifier[add_record_check] ( identifier[self] , identifier[actions] , identifier[table] , identifier[func] ):
keyword[assert] identifier[isinstance] ( identifier[table] , identifier[str] ), literal[string]
keyword[for] identifier[i] keyword[in] identifier[actions] :
... | def add_record_check(self, actions, table, func):
# emitted after query
# table: 'table_name'
# column: ('table_name', 'column_name')
assert isinstance(table, str), '`table` must be table name'
for i in actions:
assert i not in (A.QUERY, A.CREATE), 'meaningless action check with record: [%s]... |
def set_precision(cls, precision):
"""Set the number of decimal places used to report percentages."""
assert 0 <= precision < 10
cls._precision = precision
cls._near0 = 1.0 / 10**precision
cls._near100 = 100.0 - cls._near0 | def function[set_precision, parameter[cls, precision]]:
constant[Set the number of decimal places used to report percentages.]
assert[compare[constant[0] less_or_equal[<=] name[precision]]]
name[cls]._precision assign[=] name[precision]
name[cls]._near0 assign[=] binary_operation[constant[1.... | keyword[def] identifier[set_precision] ( identifier[cls] , identifier[precision] ):
literal[string]
keyword[assert] literal[int] <= identifier[precision] < literal[int]
identifier[cls] . identifier[_precision] = identifier[precision]
identifier[cls] . identifier[_near0] = liter... | def set_precision(cls, precision):
"""Set the number of decimal places used to report percentages."""
assert 0 <= precision < 10
cls._precision = precision
cls._near0 = 1.0 / 10 ** precision
cls._near100 = 100.0 - cls._near0 |
def admin_required(obj):
"""
Requires that the user be logged AND be set as a superuser
"""
decorator = request_passes_test(lambda r, *args, **kwargs: r.user.is_superuser)
return wrap_object(obj, decorator) | def function[admin_required, parameter[obj]]:
constant[
Requires that the user be logged AND be set as a superuser
]
variable[decorator] assign[=] call[name[request_passes_test], parameter[<ast.Lambda object at 0x7da1b27a71c0>]]
return[call[name[wrap_object], parameter[name[obj], name[decora... | keyword[def] identifier[admin_required] ( identifier[obj] ):
literal[string]
identifier[decorator] = identifier[request_passes_test] ( keyword[lambda] identifier[r] ,* identifier[args] ,** identifier[kwargs] : identifier[r] . identifier[user] . identifier[is_superuser] )
keyword[return] identifier[w... | def admin_required(obj):
"""
Requires that the user be logged AND be set as a superuser
"""
decorator = request_passes_test(lambda r, *args, **kwargs: r.user.is_superuser)
return wrap_object(obj, decorator) |
def begin(self, frame):
"""
Handles BEGING command: Starts a new transaction.
"""
if not frame.transaction:
raise ProtocolError("Missing transaction for BEGIN command.")
self.engine.transactions[frame.transaction] = [] | def function[begin, parameter[self, frame]]:
constant[
Handles BEGING command: Starts a new transaction.
]
if <ast.UnaryOp object at 0x7da1b1942f80> begin[:]
<ast.Raise object at 0x7da1b1943760>
call[name[self].engine.transactions][name[frame].transaction] assign[=] list[... | keyword[def] identifier[begin] ( identifier[self] , identifier[frame] ):
literal[string]
keyword[if] keyword[not] identifier[frame] . identifier[transaction] :
keyword[raise] identifier[ProtocolError] ( literal[string] )
identifier[self] . identifier[engine] . identifier[t... | def begin(self, frame):
"""
Handles BEGING command: Starts a new transaction.
"""
if not frame.transaction:
raise ProtocolError('Missing transaction for BEGIN command.') # depends on [control=['if'], data=[]]
self.engine.transactions[frame.transaction] = [] |
def process(cls, post, render=True):
"""
This method takes the post data and renders it
:param post:
:param render:
:return:
"""
post["slug"] = cls.create_slug(post["title"])
post["editable"] = cls.is_author(post, current_user)
post["url"] = cls.co... | def function[process, parameter[cls, post, render]]:
constant[
This method takes the post data and renders it
:param post:
:param render:
:return:
]
call[name[post]][constant[slug]] assign[=] call[name[cls].create_slug, parameter[call[name[post]][constant[title]]]... | keyword[def] identifier[process] ( identifier[cls] , identifier[post] , identifier[render] = keyword[True] ):
literal[string]
identifier[post] [ literal[string] ]= identifier[cls] . identifier[create_slug] ( identifier[post] [ literal[string] ])
identifier[post] [ literal[string] ]= identi... | def process(cls, post, render=True):
"""
This method takes the post data and renders it
:param post:
:param render:
:return:
"""
post['slug'] = cls.create_slug(post['title'])
post['editable'] = cls.is_author(post, current_user)
post['url'] = cls.construct_url(post... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.