code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def handle(self, *args, **options):
"""gets data from WordPress site"""
# TODO: refactor these with .get
if 'username' in options:
self.username = options['username']
else:
self.username = None
if 'password' in options:
self.password = options[... | def function[handle, parameter[self]]:
constant[gets data from WordPress site]
if compare[constant[username] in name[options]] begin[:]
name[self].username assign[=] call[name[options]][constant[username]]
if compare[constant[password] in name[options]] begin[:]
n... | keyword[def] identifier[handle] ( identifier[self] ,* identifier[args] ,** identifier[options] ):
literal[string]
keyword[if] literal[string] keyword[in] identifier[options] :
identifier[self] . identifier[username] = identifier[options] [ literal[string] ]
keyword... | def handle(self, *args, **options):
"""gets data from WordPress site"""
# TODO: refactor these with .get
if 'username' in options:
self.username = options['username'] # depends on [control=['if'], data=['options']]
else:
self.username = None
if 'password' in options:
self.pa... |
def get_free_shipping_by_id(cls, free_shipping_id, **kwargs):
"""Find FreeShipping
Return single instance of FreeShipping by its ID.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.get_free_sh... | def function[get_free_shipping_by_id, parameter[cls, free_shipping_id]]:
constant[Find FreeShipping
Return single instance of FreeShipping by its ID.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread ... | keyword[def] identifier[get_free_shipping_by_id] ( identifier[cls] , identifier[free_shipping_id] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] [ literal[string] ]= keyword[True]
keyword[if] identifier[kwargs] . identifier[get] ( literal[string] ):
keyword[ret... | def get_free_shipping_by_id(cls, free_shipping_id, **kwargs):
"""Find FreeShipping
Return single instance of FreeShipping by its ID.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.get_free_shippi... |
def experiment_property(prop):
"""Get a property of the experiment by name."""
exp = experiment(session)
p = getattr(exp, prop)
return success_response(field=prop, data=p, request_type=prop) | def function[experiment_property, parameter[prop]]:
constant[Get a property of the experiment by name.]
variable[exp] assign[=] call[name[experiment], parameter[name[session]]]
variable[p] assign[=] call[name[getattr], parameter[name[exp], name[prop]]]
return[call[name[success_response], par... | keyword[def] identifier[experiment_property] ( identifier[prop] ):
literal[string]
identifier[exp] = identifier[experiment] ( identifier[session] )
identifier[p] = identifier[getattr] ( identifier[exp] , identifier[prop] )
keyword[return] identifier[success_response] ( identifier[field] = identi... | def experiment_property(prop):
"""Get a property of the experiment by name."""
exp = experiment(session)
p = getattr(exp, prop)
return success_response(field=prop, data=p, request_type=prop) |
def connect_by_mapping(self, si, vm, mapping, default_network, reserved_networks, logger, promiscuous_mode):
"""
gets the mapping to the vnics and connects it to the vm
:param default_network:
:param si: ServiceInstance
:param vm: vim.VirtualMachine
:param mapping: [VmNet... | def function[connect_by_mapping, parameter[self, si, vm, mapping, default_network, reserved_networks, logger, promiscuous_mode]]:
constant[
gets the mapping to the vnics and connects it to the vm
:param default_network:
:param si: ServiceInstance
:param vm: vim.VirtualMachine
... | keyword[def] identifier[connect_by_mapping] ( identifier[self] , identifier[si] , identifier[vm] , identifier[mapping] , identifier[default_network] , identifier[reserved_networks] , identifier[logger] , identifier[promiscuous_mode] ):
literal[string]
identifier[request_mapping] =[]
ident... | def connect_by_mapping(self, si, vm, mapping, default_network, reserved_networks, logger, promiscuous_mode):
"""
gets the mapping to the vnics and connects it to the vm
:param default_network:
:param si: ServiceInstance
:param vm: vim.VirtualMachine
:param mapping: [VmNetwork... |
def _remove_end_gaps(sequence):
'''Removes double-stranded gaps from ends of the sequence.
:returns: The current sequence with terminal double-strand gaps ('-')
removed.
:rtype: coral.DNA
'''
# Count terminal blank sequences
def count_end_gaps(seq):
gap = coral.DNA('-')
... | def function[_remove_end_gaps, parameter[sequence]]:
constant[Removes double-stranded gaps from ends of the sequence.
:returns: The current sequence with terminal double-strand gaps ('-')
removed.
:rtype: coral.DNA
]
def function[count_end_gaps, parameter[seq]]:
... | keyword[def] identifier[_remove_end_gaps] ( identifier[sequence] ):
literal[string]
keyword[def] identifier[count_end_gaps] ( identifier[seq] ):
identifier[gap] = identifier[coral] . identifier[DNA] ( literal[string] )
identifier[count] = literal[int]
keyword[for] identif... | def _remove_end_gaps(sequence):
"""Removes double-stranded gaps from ends of the sequence.
:returns: The current sequence with terminal double-strand gaps ('-')
removed.
:rtype: coral.DNA
"""
# Count terminal blank sequences
def count_end_gaps(seq):
gap = coral.DNA('-')
... |
def add_group_members(self, members):
"""Add a new group member to the groups list
:param members: member name
:type members: str
:return: None
"""
if not isinstance(members, list):
members = [members]
if not getattr(self, 'group_members', None):
... | def function[add_group_members, parameter[self, members]]:
constant[Add a new group member to the groups list
:param members: member name
:type members: str
:return: None
]
if <ast.UnaryOp object at 0x7da18f58c820> begin[:]
variable[members] assign[=] lis... | keyword[def] identifier[add_group_members] ( identifier[self] , identifier[members] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[members] , identifier[list] ):
identifier[members] =[ identifier[members] ]
keyword[if] keyword[not] identif... | def add_group_members(self, members):
"""Add a new group member to the groups list
:param members: member name
:type members: str
:return: None
"""
if not isinstance(members, list):
members = [members] # depends on [control=['if'], data=[]]
if not getattr(self, 'gro... |
def create_push_handlers():
"""Create a handler for upload per package format."""
# pylint: disable=fixme
# HACK: hacky territory - Dynamically generate a handler for each of the
# package formats, until we have slightly more clever 'guess type'
# handling. :-)
handlers = create_push_handlers.ha... | def function[create_push_handlers, parameter[]]:
constant[Create a handler for upload per package format.]
variable[handlers] assign[=] dictionary[[], []]
variable[context] assign[=] call[name[get_package_formats], parameter[]]
for taget[tuple[[<ast.Name object at 0x7da1b197c130>, <ast.N... | keyword[def] identifier[create_push_handlers] ():
literal[string]
identifier[handlers] = identifier[create_push_handlers] . identifier[handlers] ={}
identifier[context] = identifier[create_push_handlers] . identifier[context] = identifier[get_package_formats] ()
keyword[for] ... | def create_push_handlers():
"""Create a handler for upload per package format."""
# pylint: disable=fixme
# HACK: hacky territory - Dynamically generate a handler for each of the
# package formats, until we have slightly more clever 'guess type'
# handling. :-)
handlers = create_push_handlers.ha... |
def project_exists(response: 'environ.Response', path: str) -> bool:
"""
Determines whether or not a project exists at the specified path
:param response:
:param path:
:return:
"""
if os.path.exists(path):
return True
response.fail(
code='PROJECT_NOT_FOUND',
me... | def function[project_exists, parameter[response, path]]:
constant[
Determines whether or not a project exists at the specified path
:param response:
:param path:
:return:
]
if call[name[os].path.exists, parameter[name[path]]] begin[:]
return[constant[True]]
call[call... | keyword[def] identifier[project_exists] ( identifier[response] : literal[string] , identifier[path] : identifier[str] )-> identifier[bool] :
literal[string]
keyword[if] identifier[os] . identifier[path] . identifier[exists] ( identifier[path] ):
keyword[return] keyword[True]
identifier[r... | def project_exists(response: 'environ.Response', path: str) -> bool:
"""
Determines whether or not a project exists at the specified path
:param response:
:param path:
:return:
"""
if os.path.exists(path):
return True # depends on [control=['if'], data=[]]
response.fail(code='P... |
def info(self, page, version=None):
"""Returns informations of *page*. Informations of the last version
is returned if *version* is not set.
"""
return (self._dokuwiki.send('wiki.getPageInfoVersion', page, version)
if version is not None
else self._dokuwik... | def function[info, parameter[self, page, version]]:
constant[Returns informations of *page*. Informations of the last version
is returned if *version* is not set.
]
return[<ast.IfExp object at 0x7da20c76dde0>] | keyword[def] identifier[info] ( identifier[self] , identifier[page] , identifier[version] = keyword[None] ):
literal[string]
keyword[return] ( identifier[self] . identifier[_dokuwiki] . identifier[send] ( literal[string] , identifier[page] , identifier[version] )
keyword[if] identifier[ve... | def info(self, page, version=None):
"""Returns informations of *page*. Informations of the last version
is returned if *version* is not set.
"""
return self._dokuwiki.send('wiki.getPageInfoVersion', page, version) if version is not None else self._dokuwiki.send('wiki.getPageInfo', page) |
def handle_no_start_state(self):
"""Handles the situation, when no start state exists during execution
The method waits, until a transition is created. It then checks again for an existing start state and waits
again, if this is not the case. It returns the None state if the the state machine w... | def function[handle_no_start_state, parameter[self]]:
constant[Handles the situation, when no start state exists during execution
The method waits, until a transition is created. It then checks again for an existing start state and waits
again, if this is not the case. It returns the None state... | keyword[def] identifier[handle_no_start_state] ( identifier[self] ):
literal[string]
identifier[start_state] = identifier[self] . identifier[get_start_state] ( identifier[set_final_outcome] = keyword[True] )
keyword[while] keyword[not] identifier[start_state] :
iden... | def handle_no_start_state(self):
"""Handles the situation, when no start state exists during execution
The method waits, until a transition is created. It then checks again for an existing start state and waits
again, if this is not the case. It returns the None state if the the state machine was s... |
def try_pop(d, key, default):
"""
>>> d = {"a": "b", "c": "d", "e": "f"}
>>> try_pop(d, "g", "default")
'default'
>>> d
{'a': 'b', 'c': 'd', 'e': 'f'}
>>> try_pop(d, "c", "default")
'd'
>>> d
{'a': 'b', 'e': 'f'}
"""
value = d.get(key, default)
if key in d:
d.... | def function[try_pop, parameter[d, key, default]]:
constant[
>>> d = {"a": "b", "c": "d", "e": "f"}
>>> try_pop(d, "g", "default")
'default'
>>> d
{'a': 'b', 'c': 'd', 'e': 'f'}
>>> try_pop(d, "c", "default")
'd'
>>> d
{'a': 'b', 'e': 'f'}
]
variable[value] assign... | keyword[def] identifier[try_pop] ( identifier[d] , identifier[key] , identifier[default] ):
literal[string]
identifier[value] = identifier[d] . identifier[get] ( identifier[key] , identifier[default] )
keyword[if] identifier[key] keyword[in] identifier[d] :
identifier[d] . identifier[pop] ... | def try_pop(d, key, default):
"""
>>> d = {"a": "b", "c": "d", "e": "f"}
>>> try_pop(d, "g", "default")
'default'
>>> d
{'a': 'b', 'c': 'd', 'e': 'f'}
>>> try_pop(d, "c", "default")
'd'
>>> d
{'a': 'b', 'e': 'f'}
"""
value = d.get(key, default)
if key in d:
d.... |
def make_linked_folder(sym_path):
"""
Create a folder in the ~/.autolens directory and create a sym link to it at the provided path.
If both folders already exist then nothing is changed. If the source folder exists but the destination folder does
not then the source folder is removed and replaced so a... | def function[make_linked_folder, parameter[sym_path]]:
constant[
Create a folder in the ~/.autolens directory and create a sym link to it at the provided path.
If both folders already exist then nothing is changed. If the source folder exists but the destination folder does
not then the source fold... | keyword[def] identifier[make_linked_folder] ( identifier[sym_path] ):
literal[string]
identifier[source_path] = identifier[path_for] ( identifier[sym_path] )
keyword[if] identifier[os] . identifier[path] . identifier[exists] ( identifier[source_path] ) keyword[and] keyword[not] identifier[os] . ide... | def make_linked_folder(sym_path):
"""
Create a folder in the ~/.autolens directory and create a sym link to it at the provided path.
If both folders already exist then nothing is changed. If the source folder exists but the destination folder does
not then the source folder is removed and replaced so a... |
def select_idle_worker(action, action_space, select_worker):
"""Select an idle worker."""
del action_space
action.action_ui.select_idle_worker.type = select_worker | def function[select_idle_worker, parameter[action, action_space, select_worker]]:
constant[Select an idle worker.]
<ast.Delete object at 0x7da18f00cc40>
name[action].action_ui.select_idle_worker.type assign[=] name[select_worker] | keyword[def] identifier[select_idle_worker] ( identifier[action] , identifier[action_space] , identifier[select_worker] ):
literal[string]
keyword[del] identifier[action_space]
identifier[action] . identifier[action_ui] . identifier[select_idle_worker] . identifier[type] = identifier[select_worker] | def select_idle_worker(action, action_space, select_worker):
"""Select an idle worker."""
del action_space
action.action_ui.select_idle_worker.type = select_worker |
def aslist(generator):
'Function decorator to transform a generator into a list'
def wrapper(*args, **kwargs):
return list(generator(*args, **kwargs))
return wrapper | def function[aslist, parameter[generator]]:
constant[Function decorator to transform a generator into a list]
def function[wrapper, parameter[]]:
return[call[name[list], parameter[call[name[generator], parameter[<ast.Starred object at 0x7da1b0fc1870>]]]]]
return[name[wrapper]] | keyword[def] identifier[aslist] ( identifier[generator] ):
literal[string]
keyword[def] identifier[wrapper] (* identifier[args] ,** identifier[kwargs] ):
keyword[return] identifier[list] ( identifier[generator] (* identifier[args] ,** identifier[kwargs] ))
keyword[return] identifier[wrappe... | def aslist(generator):
"""Function decorator to transform a generator into a list"""
def wrapper(*args, **kwargs):
return list(generator(*args, **kwargs))
return wrapper |
def escape_windows_cmd_string(s):
"""Returns a string that is usable by the Windows cmd.exe.
The escaping is based on details here and emperical testing:
http://www.robvanderwoude.com/escapechars.php
"""
for c in '()%!^<>&|"':
s = s.replace(c, '^' + c)
s = s.replace('/?', '/.')
retur... | def function[escape_windows_cmd_string, parameter[s]]:
constant[Returns a string that is usable by the Windows cmd.exe.
The escaping is based on details here and emperical testing:
http://www.robvanderwoude.com/escapechars.php
]
for taget[name[c]] in starred[constant[()%!^<>&|"]] begin[:]
... | keyword[def] identifier[escape_windows_cmd_string] ( identifier[s] ):
literal[string]
keyword[for] identifier[c] keyword[in] literal[string] :
identifier[s] = identifier[s] . identifier[replace] ( identifier[c] , literal[string] + identifier[c] )
identifier[s] = identifier[s] . identifier[... | def escape_windows_cmd_string(s):
"""Returns a string that is usable by the Windows cmd.exe.
The escaping is based on details here and emperical testing:
http://www.robvanderwoude.com/escapechars.php
"""
for c in '()%!^<>&|"':
s = s.replace(c, '^' + c) # depends on [control=['for'], data=['... |
def sort(ctx):
"""Sort the variants of a vcf file"""
head = ctx.parent.head
vcf_handle = ctx.parent.handle
outfile = ctx.parent.outfile
silent = ctx.parent.silent
print_headers(head, outfile=outfile, silent=silent)
for line in sort_variants(vcf_handle):
print_variant(variant_line=l... | def function[sort, parameter[ctx]]:
constant[Sort the variants of a vcf file]
variable[head] assign[=] name[ctx].parent.head
variable[vcf_handle] assign[=] name[ctx].parent.handle
variable[outfile] assign[=] name[ctx].parent.outfile
variable[silent] assign[=] name[ctx].parent.sil... | keyword[def] identifier[sort] ( identifier[ctx] ):
literal[string]
identifier[head] = identifier[ctx] . identifier[parent] . identifier[head]
identifier[vcf_handle] = identifier[ctx] . identifier[parent] . identifier[handle]
identifier[outfile] = identifier[ctx] . identifier[parent] . identifie... | def sort(ctx):
"""Sort the variants of a vcf file"""
head = ctx.parent.head
vcf_handle = ctx.parent.handle
outfile = ctx.parent.outfile
silent = ctx.parent.silent
print_headers(head, outfile=outfile, silent=silent)
for line in sort_variants(vcf_handle):
print_variant(variant_line=lin... |
def kpoints(self):
"""
Generate gamma center k-points mesh grid for GW calc,
which is requested by GW calculation.
"""
return Kpoints.automatic_density_by_vol(self.structure,
self.reciprocal_density,
... | def function[kpoints, parameter[self]]:
constant[
Generate gamma center k-points mesh grid for GW calc,
which is requested by GW calculation.
]
return[call[name[Kpoints].automatic_density_by_vol, parameter[name[self].structure, name[self].reciprocal_density]]] | keyword[def] identifier[kpoints] ( identifier[self] ):
literal[string]
keyword[return] identifier[Kpoints] . identifier[automatic_density_by_vol] ( identifier[self] . identifier[structure] ,
identifier[self] . identifier[reciprocal_density] ,
identifier[force_gamma] = keyword[Tru... | def kpoints(self):
"""
Generate gamma center k-points mesh grid for GW calc,
which is requested by GW calculation.
"""
return Kpoints.automatic_density_by_vol(self.structure, self.reciprocal_density, force_gamma=True) |
def _theorem6p3():
"""See Theorem 6.3 in paper.
Prunes (s,b) when (s,a) is explored, b (almost) simplicial in (s,a), and a (almost) simplicial in (s,b)
"""
pruning_set3 = set()
def _prune3(x, as_list, b):
for a in as_list:
key = (tuple(x), a, b) # (s,a,b) with (s,a) explored
... | def function[_theorem6p3, parameter[]]:
constant[See Theorem 6.3 in paper.
Prunes (s,b) when (s,a) is explored, b (almost) simplicial in (s,a), and a (almost) simplicial in (s,b)
]
variable[pruning_set3] assign[=] call[name[set], parameter[]]
def function[_prune3, parameter[x, as_list, b... | keyword[def] identifier[_theorem6p3] ():
literal[string]
identifier[pruning_set3] = identifier[set] ()
keyword[def] identifier[_prune3] ( identifier[x] , identifier[as_list] , identifier[b] ):
keyword[for] identifier[a] keyword[in] identifier[as_list] :
identifier[key] =( id... | def _theorem6p3():
"""See Theorem 6.3 in paper.
Prunes (s,b) when (s,a) is explored, b (almost) simplicial in (s,a), and a (almost) simplicial in (s,b)
"""
pruning_set3 = set()
def _prune3(x, as_list, b):
for a in as_list:
key = (tuple(x), a, b) # (s,a,b) with (s,a) explored
... |
async def exec_loop(stdout, stderr, kernel, mode, code, *, opts=None,
vprint_done=print_done, is_multi=False):
'''
Fully streamed asynchronous version of the execute loop.
'''
async with kernel.stream_execute(code, mode=mode, opts=opts) as stream:
async for result in stream:
... | <ast.AsyncFunctionDef object at 0x7da1b0ff21d0> | keyword[async] keyword[def] identifier[exec_loop] ( identifier[stdout] , identifier[stderr] , identifier[kernel] , identifier[mode] , identifier[code] ,*, identifier[opts] = keyword[None] ,
identifier[vprint_done] = identifier[print_done] , identifier[is_multi] = keyword[False] ):
literal[string]
keyword... | async def exec_loop(stdout, stderr, kernel, mode, code, *, opts=None, vprint_done=print_done, is_multi=False):
"""
Fully streamed asynchronous version of the execute loop.
"""
async with kernel.stream_execute(code, mode=mode, opts=opts) as stream:
async for result in stream:
if resul... |
def _find_address_values_in_chain(self, base_contexts, addresses_to_find):
"""Breadth first search through the chain of contexts searching for
the bytes values at the addresses in addresses_to_find.
Args:
base_contexts (list of str): The context ids to start with.
addres... | def function[_find_address_values_in_chain, parameter[self, base_contexts, addresses_to_find]]:
constant[Breadth first search through the chain of contexts searching for
the bytes values at the addresses in addresses_to_find.
Args:
base_contexts (list of str): The context ids to sta... | keyword[def] identifier[_find_address_values_in_chain] ( identifier[self] , identifier[base_contexts] , identifier[addresses_to_find] ):
literal[string]
identifier[contexts_in_chain] = identifier[deque] ()
identifier[contexts_in_chain] . identifier[extend] ( identifier[base_contexts] )
... | def _find_address_values_in_chain(self, base_contexts, addresses_to_find):
"""Breadth first search through the chain of contexts searching for
the bytes values at the addresses in addresses_to_find.
Args:
base_contexts (list of str): The context ids to start with.
addresses_... |
def collapsesum(data_frame, by = None, var = None):
'''
Pour une variable, fonction qui calcule la moyenne pondérée au sein de chaque groupe.
'''
assert by is not None
assert var is not None
grouped = data_frame.groupby([by])
return grouped.apply(lambda x: weighted_sum(groupe = x, var =var)) | def function[collapsesum, parameter[data_frame, by, var]]:
constant[
Pour une variable, fonction qui calcule la moyenne pondérée au sein de chaque groupe.
]
assert[compare[name[by] is_not constant[None]]]
assert[compare[name[var] is_not constant[None]]]
variable[grouped] assign[=] call[n... | keyword[def] identifier[collapsesum] ( identifier[data_frame] , identifier[by] = keyword[None] , identifier[var] = keyword[None] ):
literal[string]
keyword[assert] identifier[by] keyword[is] keyword[not] keyword[None]
keyword[assert] identifier[var] keyword[is] keyword[not] keyword[None]
... | def collapsesum(data_frame, by=None, var=None):
"""
Pour une variable, fonction qui calcule la moyenne pondérée au sein de chaque groupe.
"""
assert by is not None
assert var is not None
grouped = data_frame.groupby([by])
return grouped.apply(lambda x: weighted_sum(groupe=x, var=var)) |
def save_form_data(self, instance, data):
"""
Handle data sent from MultiValueField forms that set ppoi values.
`instance`: The model instance that is being altered via a form
`data`: The data sent from the form to this field which can be either:
* `None`: This is unset data fro... | def function[save_form_data, parameter[self, instance, data]]:
constant[
Handle data sent from MultiValueField forms that set ppoi values.
`instance`: The model instance that is being altered via a form
`data`: The data sent from the form to this field which can be either:
* `No... | keyword[def] identifier[save_form_data] ( identifier[self] , identifier[instance] , identifier[data] ):
literal[string]
identifier[to_assign] = identifier[data]
keyword[if] identifier[data] keyword[and] identifier[isinstance] ( identifier[data] , identifier[tuple] ):
... | def save_form_data(self, instance, data):
"""
Handle data sent from MultiValueField forms that set ppoi values.
`instance`: The model instance that is being altered via a form
`data`: The data sent from the form to this field which can be either:
* `None`: This is unset data from an... |
def getBytesForString(self, u):
"""
Returns the corresponding utf-8 encoded string for a given unicode
object. If there is no string, one is encoded.
@since: 0.6
"""
h = hash(u)
s = self._unicodes.get(h, None)
if s is not None:
return s
... | def function[getBytesForString, parameter[self, u]]:
constant[
Returns the corresponding utf-8 encoded string for a given unicode
object. If there is no string, one is encoded.
@since: 0.6
]
variable[h] assign[=] call[name[hash], parameter[name[u]]]
variable[s] a... | keyword[def] identifier[getBytesForString] ( identifier[self] , identifier[u] ):
literal[string]
identifier[h] = identifier[hash] ( identifier[u] )
identifier[s] = identifier[self] . identifier[_unicodes] . identifier[get] ( identifier[h] , keyword[None] )
keyword[if] identifier... | def getBytesForString(self, u):
"""
Returns the corresponding utf-8 encoded string for a given unicode
object. If there is no string, one is encoded.
@since: 0.6
"""
h = hash(u)
s = self._unicodes.get(h, None)
if s is not None:
return s # depends on [control=['i... |
def get_seconds_description(self):
"""Generates a description for only the SECONDS portion of the expression
Returns:
The SECONDS description
"""
return self.get_segment_description(
self._expression_parts[0],
_("every second"),
lambda s... | def function[get_seconds_description, parameter[self]]:
constant[Generates a description for only the SECONDS portion of the expression
Returns:
The SECONDS description
]
return[call[name[self].get_segment_description, parameter[call[name[self]._expression_parts][constant[0]], ... | keyword[def] identifier[get_seconds_description] ( identifier[self] ):
literal[string]
keyword[return] identifier[self] . identifier[get_segment_description] (
identifier[self] . identifier[_expression_parts] [ literal[int] ],
identifier[_] ( literal[string] ),
keyword[... | def get_seconds_description(self):
"""Generates a description for only the SECONDS portion of the expression
Returns:
The SECONDS description
"""
return self.get_segment_description(self._expression_parts[0], _('every second'), lambda s: s, lambda s: _('every {0} seconds').format(s... |
def parse(self, string, lexer=None):
"""
Interpret a string.
:param string: The input to lex and parse.
:param lexer: The lexer to use. A new one will be created if not
provided.
:return: An object representation of the input.
"""
if... | def function[parse, parameter[self, string, lexer]]:
constant[
Interpret a string.
:param string: The input to lex and parse.
:param lexer: The lexer to use. A new one will be created if not
provided.
:return: An object representation of the input.
... | keyword[def] identifier[parse] ( identifier[self] , identifier[string] , identifier[lexer] = keyword[None] ):
literal[string]
keyword[if] keyword[not] identifier[lexer] :
identifier[lexer] = identifier[Lexer] (). identifier[lexer]
keyword[return] identifier[self] . identi... | def parse(self, string, lexer=None):
"""
Interpret a string.
:param string: The input to lex and parse.
:param lexer: The lexer to use. A new one will be created if not
provided.
:return: An object representation of the input.
"""
if not lex... |
def sigma_clip(arrin, niter=4, nsig=4, extra={}, verbose=False):
"""
NAME:
sigma_clip()
PURPOSE:
Calculate the mean/stdev of an array with sigma clipping. Iterate
niter times, removing elements that are outside nsig, and recalculating
mean/stdev.
CALLING SEQUENC... | def function[sigma_clip, parameter[arrin, niter, nsig, extra, verbose]]:
constant[
NAME:
sigma_clip()
PURPOSE:
Calculate the mean/stdev of an array with sigma clipping. Iterate
niter times, removing elements that are outside nsig, and recalculating
mean/stdev.
CALLING... | keyword[def] identifier[sigma_clip] ( identifier[arrin] , identifier[niter] = literal[int] , identifier[nsig] = literal[int] , identifier[extra] ={}, identifier[verbose] = keyword[False] ):
literal[string]
identifier[arr] = identifier[numpy] . identifier[array] ( identifier[arrin] , identifier[ndmin] = l... | def sigma_clip(arrin, niter=4, nsig=4, extra={}, verbose=False):
"""
NAME:
sigma_clip()
PURPOSE:
Calculate the mean/stdev of an array with sigma clipping. Iterate
niter times, removing elements that are outside nsig, and recalculating
mean/stdev.
CALLING SEQUENCE:
m... |
def read_from_hdx(identifier, configuration=None):
# type: (str, Optional[Configuration]) -> Optional['ResourceView']
"""Reads the resource view given by identifier from HDX and returns ResourceView object
Args:
identifier (str): Identifier of resource view
configuration... | def function[read_from_hdx, parameter[identifier, configuration]]:
constant[Reads the resource view given by identifier from HDX and returns ResourceView object
Args:
identifier (str): Identifier of resource view
configuration (Optional[Configuration]): HDX configuration. Defaul... | keyword[def] identifier[read_from_hdx] ( identifier[identifier] , identifier[configuration] = keyword[None] ):
literal[string]
identifier[resourceview] = identifier[ResourceView] ( identifier[configuration] = identifier[configuration] )
identifier[result] = identifier[resourceview] . ide... | def read_from_hdx(identifier, configuration=None):
# type: (str, Optional[Configuration]) -> Optional['ResourceView']
'Reads the resource view given by identifier from HDX and returns ResourceView object\n\n Args:\n identifier (str): Identifier of resource view\n configuration (Opti... |
def zavg(self, name, score_start, score_end):
"""
Returns the average of elements of the sorted set stored at the
specified key which have scores in the range [score_start,score_end].
.. note:: The range is [``score_start``, ``score_end``]
:param string name: th... | def function[zavg, parameter[self, name, score_start, score_end]]:
constant[
Returns the average of elements of the sorted set stored at the
specified key which have scores in the range [score_start,score_end].
.. note:: The range is [``score_start``, ``score_end``]
... | keyword[def] identifier[zavg] ( identifier[self] , identifier[name] , identifier[score_start] , identifier[score_end] ):
literal[string]
identifier[score_start] = identifier[get_integer_or_emptystring] ( literal[string] , identifier[score_start] )
identifier[score_end] = identifier[get_int... | def zavg(self, name, score_start, score_end):
"""
Returns the average of elements of the sorted set stored at the
specified key which have scores in the range [score_start,score_end].
.. note:: The range is [``score_start``, ``score_end``]
:param string name: the zs... |
def restore_defaults(self):
"""
Recursively restore default values to all members
that have them.
This method will only work for a ConfigObj that was created
with a configspec and has been validated.
It doesn't delete or modify entries without default values.
""... | def function[restore_defaults, parameter[self]]:
constant[
Recursively restore default values to all members
that have them.
This method will only work for a ConfigObj that was created
with a configspec and has been validated.
It doesn't delete or modify entries without... | keyword[def] identifier[restore_defaults] ( identifier[self] ):
literal[string]
keyword[for] identifier[key] keyword[in] identifier[self] . identifier[default_values] :
identifier[self] . identifier[restore_default] ( identifier[key] )
keyword[for] identifier[section] ke... | def restore_defaults(self):
"""
Recursively restore default values to all members
that have them.
This method will only work for a ConfigObj that was created
with a configspec and has been validated.
It doesn't delete or modify entries without default values.
"""
... |
async def field(self, elem=None, elem_type=None, params=None):
"""
Archive field
:param elem:
:param elem_type:
:param params:
:return:
"""
elem_type = elem_type if elem_type else elem.__class__
fvalue = None
src = elem
if issubcla... | <ast.AsyncFunctionDef object at 0x7da1b24504f0> | keyword[async] keyword[def] identifier[field] ( identifier[self] , identifier[elem] = keyword[None] , identifier[elem_type] = keyword[None] , identifier[params] = keyword[None] ):
literal[string]
identifier[elem_type] = identifier[elem_type] keyword[if] identifier[elem_type] keyword[else] iden... | async def field(self, elem=None, elem_type=None, params=None):
"""
Archive field
:param elem:
:param elem_type:
:param params:
:return:
"""
elem_type = elem_type if elem_type else elem.__class__
fvalue = None
src = elem
if issubclass(elem_type, x.UVari... |
def fetch_open_data(cls, flag, start, end, **kwargs):
"""Fetch Open Data timeline segments into a flag.
flag : `str`
the name of the flag to query
start : `int`, `str`
the GPS start time (or parseable date string) to query
end : `int`, `str`
the GPS... | def function[fetch_open_data, parameter[cls, flag, start, end]]:
constant[Fetch Open Data timeline segments into a flag.
flag : `str`
the name of the flag to query
start : `int`, `str`
the GPS start time (or parseable date string) to query
end : `int`, `str`
... | keyword[def] identifier[fetch_open_data] ( identifier[cls] , identifier[flag] , identifier[start] , identifier[end] ,** identifier[kwargs] ):
literal[string]
identifier[start] = identifier[to_gps] ( identifier[start] ). identifier[gpsSeconds]
identifier[end] = identifier[to_gps] ( identif... | def fetch_open_data(cls, flag, start, end, **kwargs):
"""Fetch Open Data timeline segments into a flag.
flag : `str`
the name of the flag to query
start : `int`, `str`
the GPS start time (or parseable date string) to query
end : `int`, `str`
the GPS end... |
def make_class(clsname, func, attrs):
"""Turn a funcs list element into a class object."""
clsdict = {"__set__": create_setter(func, attrs)}
if len(attrs) > 0:
clsdict["__init__"] = create_init(attrs)
clsobj = type(str(clsname), (Descriptor, ), clsdict)
clsobj.__doc__ = docstrings.get(clsnam... | def function[make_class, parameter[clsname, func, attrs]]:
constant[Turn a funcs list element into a class object.]
variable[clsdict] assign[=] dictionary[[<ast.Constant object at 0x7da1b021d8d0>], [<ast.Call object at 0x7da1b021d960>]]
if compare[call[name[len], parameter[name[attrs]]] greater[... | keyword[def] identifier[make_class] ( identifier[clsname] , identifier[func] , identifier[attrs] ):
literal[string]
identifier[clsdict] ={ literal[string] : identifier[create_setter] ( identifier[func] , identifier[attrs] )}
keyword[if] identifier[len] ( identifier[attrs] )> literal[int] :
i... | def make_class(clsname, func, attrs):
"""Turn a funcs list element into a class object."""
clsdict = {'__set__': create_setter(func, attrs)}
if len(attrs) > 0:
clsdict['__init__'] = create_init(attrs) # depends on [control=['if'], data=[]]
clsobj = type(str(clsname), (Descriptor,), clsdict)
... |
def quick_layout_save(self):
"""Save layout dialog"""
get = CONF.get
set_ = CONF.set
names = get('quick_layouts', 'names')
order = get('quick_layouts', 'order')
active = get('quick_layouts', 'active')
dlg = self.dialog_layout_save(self, names)
... | def function[quick_layout_save, parameter[self]]:
constant[Save layout dialog]
variable[get] assign[=] name[CONF].get
variable[set_] assign[=] name[CONF].set
variable[names] assign[=] call[name[get], parameter[constant[quick_layouts], constant[names]]]
variable[order] assign[=] c... | keyword[def] identifier[quick_layout_save] ( identifier[self] ):
literal[string]
identifier[get] = identifier[CONF] . identifier[get]
identifier[set_] = identifier[CONF] . identifier[set]
identifier[names] = identifier[get] ( literal[string] , literal[string] )
ide... | def quick_layout_save(self):
"""Save layout dialog"""
get = CONF.get
set_ = CONF.set
names = get('quick_layouts', 'names')
order = get('quick_layouts', 'order')
active = get('quick_layouts', 'active')
dlg = self.dialog_layout_save(self, names)
if dlg.exec_():
name = dlg.combo_box... |
def remove_mixin(target, name, mixedin=None, replace=True):
"""Remove a mixin with name (and reference) from targetand returns the
replaced one or None.
:param mixedin: a mixedin value or the last defined mixedin if is None
(by default).
:param bool replace: If True (default... | def function[remove_mixin, parameter[target, name, mixedin, replace]]:
constant[Remove a mixin with name (and reference) from targetand returns the
replaced one or None.
:param mixedin: a mixedin value or the last defined mixedin if is None
(by default).
:param bool replace:... | keyword[def] identifier[remove_mixin] ( identifier[target] , identifier[name] , identifier[mixedin] = keyword[None] , identifier[replace] = keyword[True] ):
literal[string]
keyword[try] :
identifier[result] = identifier[getattr] ( identifier[target] , identifier[name] )
keyw... | def remove_mixin(target, name, mixedin=None, replace=True):
"""Remove a mixin with name (and reference) from targetand returns the
replaced one or None.
:param mixedin: a mixedin value or the last defined mixedin if is None
(by default).
:param bool replace: If True (default), t... |
def encode(self, text):
""" 对需要加密的明文进行填充补位
@param text: 需要进行填充补位操作的明文
@return: 补齐明文字符串
"""
text_length = len(text)
# 计算需要填充的位数
amount_to_pad = self.block_size - (text_length % self.block_size)
if amount_to_pad == 0:
amount_to_pad = self.block_s... | def function[encode, parameter[self, text]]:
constant[ 对需要加密的明文进行填充补位
@param text: 需要进行填充补位操作的明文
@return: 补齐明文字符串
]
variable[text_length] assign[=] call[name[len], parameter[name[text]]]
variable[amount_to_pad] assign[=] binary_operation[name[self].block_size - binary_ope... | keyword[def] identifier[encode] ( identifier[self] , identifier[text] ):
literal[string]
identifier[text_length] = identifier[len] ( identifier[text] )
identifier[amount_to_pad] = identifier[self] . identifier[block_size] -( identifier[text_length] % identifier[self] . identifier[... | def encode(self, text):
""" 对需要加密的明文进行填充补位
@param text: 需要进行填充补位操作的明文
@return: 补齐明文字符串
"""
text_length = len(text)
# 计算需要填充的位数
amount_to_pad = self.block_size - text_length % self.block_size
if amount_to_pad == 0:
amount_to_pad = self.block_size # depends on [control... |
def append_inflation_op(self, source=None):
"""Append a :class:`Inflation
<stellar_base.operation.Inflation>` operation to the list of
operations.
:param str source: The source address that is running the inflation
operation.
:return: This builder instance.
... | def function[append_inflation_op, parameter[self, source]]:
constant[Append a :class:`Inflation
<stellar_base.operation.Inflation>` operation to the list of
operations.
:param str source: The source address that is running the inflation
operation.
:return: This build... | keyword[def] identifier[append_inflation_op] ( identifier[self] , identifier[source] = keyword[None] ):
literal[string]
identifier[op] = identifier[operation] . identifier[Inflation] ( identifier[source] )
keyword[return] identifier[self] . identifier[append_op] ( identifier[op] ) | def append_inflation_op(self, source=None):
"""Append a :class:`Inflation
<stellar_base.operation.Inflation>` operation to the list of
operations.
:param str source: The source address that is running the inflation
operation.
:return: This builder instance.
"""
... |
def evolve_visual(msnake, fig=None, levelset=None, num_iters=20, background=None):
"""
Visual evolution of a morphological snake.
Parameters
----------
msnake : MorphGAC or MorphACWE instance
The morphological snake solver.
fig: object, optional
Handles to actual figure.
... | def function[evolve_visual, parameter[msnake, fig, levelset, num_iters, background]]:
constant[
Visual evolution of a morphological snake.
Parameters
----------
msnake : MorphGAC or MorphACWE instance
The morphological snake solver.
fig: object, optional
Handles to actua... | keyword[def] identifier[evolve_visual] ( identifier[msnake] , identifier[fig] = keyword[None] , identifier[levelset] = keyword[None] , identifier[num_iters] = literal[int] , identifier[background] = keyword[None] ):
literal[string]
keyword[if] identifier[levelset] keyword[is] keyword[not] keyword[None]... | def evolve_visual(msnake, fig=None, levelset=None, num_iters=20, background=None):
"""
Visual evolution of a morphological snake.
Parameters
----------
msnake : MorphGAC or MorphACWE instance
The morphological snake solver.
fig: object, optional
Handles to actual figure.
... |
def expect_constructor(target):
"""
Set an expectation on a ``ClassDouble`` constructor
:param ClassDouble target: The ClassDouble to set the expectation on.
:return: an ``Expectation`` for the __new__ method.
:raise: ``ConstructorDoubleError`` if target is not a ClassDouble.
"""
if not is... | def function[expect_constructor, parameter[target]]:
constant[
Set an expectation on a ``ClassDouble`` constructor
:param ClassDouble target: The ClassDouble to set the expectation on.
:return: an ``Expectation`` for the __new__ method.
:raise: ``ConstructorDoubleError`` if target is not a Cla... | keyword[def] identifier[expect_constructor] ( identifier[target] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[target] , identifier[ClassDouble] ):
keyword[raise] identifier[ConstructorDoubleError] (
literal[string] . identifier[format] ( identifier[ta... | def expect_constructor(target):
"""
Set an expectation on a ``ClassDouble`` constructor
:param ClassDouble target: The ClassDouble to set the expectation on.
:return: an ``Expectation`` for the __new__ method.
:raise: ``ConstructorDoubleError`` if target is not a ClassDouble.
"""
if not is... |
def run(self):
""" Construct the document id from the date and the url. """
document = {}
document['_id'] = hashlib.sha1('%s:%s' % (
self.date, self.url)).hexdigest()
with self.input().open() as handle:
document['content'] = handle.read(... | def function[run, parameter[self]]:
constant[ Construct the document id from the date and the url. ]
variable[document] assign[=] dictionary[[], []]
call[name[document]][constant[_id]] assign[=] call[call[name[hashlib].sha1, parameter[binary_operation[constant[%s:%s] <ast.Mod object at 0x7da2590... | keyword[def] identifier[run] ( identifier[self] ):
literal[string]
identifier[document] ={}
identifier[document] [ literal[string] ]= identifier[hashlib] . identifier[sha1] ( literal[string] %(
identifier[self] . identifier[date] , identifier[self] . identifier[url] )). identifier... | def run(self):
""" Construct the document id from the date and the url. """
document = {}
document['_id'] = hashlib.sha1('%s:%s' % (self.date, self.url)).hexdigest()
with self.input().open() as handle:
document['content'] = handle.read().decode('utf-8', 'ignore') # depends on [control=['with'],... |
def spam(self, msg, *args, **kw):
"""Log a message with level :data:`SPAM`. The arguments are interpreted as for :func:`logging.debug()`."""
if self.isEnabledFor(SPAM):
self._log(SPAM, msg, args, **kw) | def function[spam, parameter[self, msg]]:
constant[Log a message with level :data:`SPAM`. The arguments are interpreted as for :func:`logging.debug()`.]
if call[name[self].isEnabledFor, parameter[name[SPAM]]] begin[:]
call[name[self]._log, parameter[name[SPAM], name[msg], name[args]]] | keyword[def] identifier[spam] ( identifier[self] , identifier[msg] ,* identifier[args] ,** identifier[kw] ):
literal[string]
keyword[if] identifier[self] . identifier[isEnabledFor] ( identifier[SPAM] ):
identifier[self] . identifier[_log] ( identifier[SPAM] , identifier[msg] , identif... | def spam(self, msg, *args, **kw):
"""Log a message with level :data:`SPAM`. The arguments are interpreted as for :func:`logging.debug()`."""
if self.isEnabledFor(SPAM):
self._log(SPAM, msg, args, **kw) # depends on [control=['if'], data=[]] |
def cheby_op(G, c, signal, **kwargs):
r"""
Chebyshev polynomial of graph Laplacian applied to vector.
Parameters
----------
G : Graph
c : ndarray or list of ndarrays
Chebyshev coefficients for a Filter or a Filterbank
signal : ndarray
Signal to filter
Returns
------... | def function[cheby_op, parameter[G, c, signal]]:
constant[
Chebyshev polynomial of graph Laplacian applied to vector.
Parameters
----------
G : Graph
c : ndarray or list of ndarrays
Chebyshev coefficients for a Filter or a Filterbank
signal : ndarray
Signal to filter
... | keyword[def] identifier[cheby_op] ( identifier[G] , identifier[c] , identifier[signal] ,** identifier[kwargs] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[c] , identifier[np] . identifier[ndarray] ):
identifier[c] = identifier[np] . identifier[array] ( ide... | def cheby_op(G, c, signal, **kwargs):
"""
Chebyshev polynomial of graph Laplacian applied to vector.
Parameters
----------
G : Graph
c : ndarray or list of ndarrays
Chebyshev coefficients for a Filter or a Filterbank
signal : ndarray
Signal to filter
Returns
-------... |
def set_autostart(vm_, state='on', **kwargs):
'''
Set the autostart flag on a VM so that the VM will start with the host
system on reboot.
:param vm_: domain name
:param state: 'on' to auto start the pool, anything else to mark the
pool not to be started when the host boots
:p... | def function[set_autostart, parameter[vm_, state]]:
constant[
Set the autostart flag on a VM so that the VM will start with the host
system on reboot.
:param vm_: domain name
:param state: 'on' to auto start the pool, anything else to mark the
pool not to be started when the h... | keyword[def] identifier[set_autostart] ( identifier[vm_] , identifier[state] = literal[string] ,** identifier[kwargs] ):
literal[string]
identifier[conn] = identifier[__get_conn] (** identifier[kwargs] )
identifier[dom] = identifier[_get_domain] ( identifier[conn] , identifier[vm_] )
identi... | def set_autostart(vm_, state='on', **kwargs):
"""
Set the autostart flag on a VM so that the VM will start with the host
system on reboot.
:param vm_: domain name
:param state: 'on' to auto start the pool, anything else to mark the
pool not to be started when the host boots
:p... |
def walk_preorder(self):
"""Depth-first preorder walk over the cursor and its descendants.
Yields cursors.
"""
yield self
for child in self.get_children():
for descendant in child.walk_preorder():
yield descendant | def function[walk_preorder, parameter[self]]:
constant[Depth-first preorder walk over the cursor and its descendants.
Yields cursors.
]
<ast.Yield object at 0x7da1b2345a20>
for taget[name[child]] in starred[call[name[self].get_children, parameter[]]] begin[:]
for... | keyword[def] identifier[walk_preorder] ( identifier[self] ):
literal[string]
keyword[yield] identifier[self]
keyword[for] identifier[child] keyword[in] identifier[self] . identifier[get_children] ():
keyword[for] identifier[descendant] keyword[in] identifier[child] . i... | def walk_preorder(self):
"""Depth-first preorder walk over the cursor and its descendants.
Yields cursors.
"""
yield self
for child in self.get_children():
for descendant in child.walk_preorder():
yield descendant # depends on [control=['for'], data=['descendant']] # d... |
def __update_clusters(self):
"""!
@brief Calculate distance (in line with specified metric) to each point from the each cluster. Nearest points
are captured by according clusters and as a result clusters are updated.
@return (list) Updated clusters as list of cluste... | def function[__update_clusters, parameter[self]]:
constant[!
@brief Calculate distance (in line with specified metric) to each point from the each cluster. Nearest points
are captured by according clusters and as a result clusters are updated.
@return (list) Updated clus... | keyword[def] identifier[__update_clusters] ( identifier[self] ):
literal[string]
identifier[clusters] =[[] keyword[for] identifier[_] keyword[in] identifier[range] ( identifier[len] ( identifier[self] . identifier[__centers] ))]
identifier[dataset_differences] = identifier[self] ... | def __update_clusters(self):
"""!
@brief Calculate distance (in line with specified metric) to each point from the each cluster. Nearest points
are captured by according clusters and as a result clusters are updated.
@return (list) Updated clusters as list of clusters. Each ... |
def extract_filename_from_url(log, url):
"""
*get the filename from a URL.*
*Will return 'untitled.html', if no filename is found.*
**Key Arguments:**
- ``url`` -- the url to extract filename from
Returns:
- ``filename`` -- the filename
**Usage:**
.. code-block:: pyth... | def function[extract_filename_from_url, parameter[log, url]]:
constant[
*get the filename from a URL.*
*Will return 'untitled.html', if no filename is found.*
**Key Arguments:**
- ``url`` -- the url to extract filename from
Returns:
- ``filename`` -- the filename
**Usage:... | keyword[def] identifier[extract_filename_from_url] ( identifier[log] , identifier[url] ):
literal[string]
keyword[import] identifier[re]
keyword[try] :
identifier[log] . identifier[debug] ( literal[string] + identifier[url] )
identifier[reEoURL] = identifier[re] . identif... | def extract_filename_from_url(log, url):
"""
*get the filename from a URL.*
*Will return 'untitled.html', if no filename is found.*
**Key Arguments:**
- ``url`` -- the url to extract filename from
Returns:
- ``filename`` -- the filename
**Usage:**
.. code-block:: pyth... |
def delete_event_source_mapping(UUID=None, EventSourceArn=None, FunctionName=None,
region=None, key=None, keyid=None, profile=None):
'''
Given an event source mapping ID or an event source ARN and FunctionName,
delete the event source mapping
Returns {deleted: true} if t... | def function[delete_event_source_mapping, parameter[UUID, EventSourceArn, FunctionName, region, key, keyid, profile]]:
constant[
Given an event source mapping ID or an event source ARN and FunctionName,
delete the event source mapping
Returns {deleted: true} if the mapping was deleted and returns
... | keyword[def] identifier[delete_event_source_mapping] ( identifier[UUID] = keyword[None] , identifier[EventSourceArn] = keyword[None] , identifier[FunctionName] = keyword[None] ,
identifier[region] = keyword[None] , identifier[key] = keyword[None] , identifier[keyid] = keyword[None] , identifier[profile] = keyword[No... | def delete_event_source_mapping(UUID=None, EventSourceArn=None, FunctionName=None, region=None, key=None, keyid=None, profile=None):
"""
Given an event source mapping ID or an event source ARN and FunctionName,
delete the event source mapping
Returns {deleted: true} if the mapping was deleted and retur... |
def print_ast(f):
"""
:param f:
:type f: file
:return:
"""
for linenum,indent,value in iter_lines(f):
print("{0}{1}|{2}".format(str(linenum).rjust(3), ' ' * indent, value)) | def function[print_ast, parameter[f]]:
constant[
:param f:
:type f: file
:return:
]
for taget[tuple[[<ast.Name object at 0x7da1b141a3e0>, <ast.Name object at 0x7da1b14198a0>, <ast.Name object at 0x7da1b1419300>]]] in starred[call[name[iter_lines], parameter[name[f]]]] begin[:]
... | keyword[def] identifier[print_ast] ( identifier[f] ):
literal[string]
keyword[for] identifier[linenum] , identifier[indent] , identifier[value] keyword[in] identifier[iter_lines] ( identifier[f] ):
identifier[print] ( literal[string] . identifier[format] ( identifier[str] ( identifier[linenum] ... | def print_ast(f):
"""
:param f:
:type f: file
:return:
"""
for (linenum, indent, value) in iter_lines(f):
print('{0}{1}|{2}'.format(str(linenum).rjust(3), ' ' * indent, value)) # depends on [control=['for'], data=[]] |
def _transform_to_time_spent(records, split_interval, sections):
"""
Each call that crosses a boundary of the sections in the week-matrix is
split. These new records contain the amount of time
(in record.call_duration) spent talking in that specific section.
"""
t_records = []
week_nr = rec... | def function[_transform_to_time_spent, parameter[records, split_interval, sections]]:
constant[
Each call that crosses a boundary of the sections in the week-matrix is
split. These new records contain the amount of time
(in record.call_duration) spent talking in that specific section.
]
... | keyword[def] identifier[_transform_to_time_spent] ( identifier[records] , identifier[split_interval] , identifier[sections] ):
literal[string]
identifier[t_records] =[]
identifier[week_nr] = identifier[records] [ literal[int] ]. identifier[datetime] . identifier[isocalendar] ()[ literal[int] ]
... | def _transform_to_time_spent(records, split_interval, sections):
"""
Each call that crosses a boundary of the sections in the week-matrix is
split. These new records contain the amount of time
(in record.call_duration) spent talking in that specific section.
"""
t_records = []
week_nr = reco... |
def verify_request(self, uri, http_method='GET', body=None, headers=None,
scopes=None):
"""Validate client, code etc, return body + headers"""
request = Request(uri, http_method, body, headers)
request.token_type = self.find_token_type(request)
request.scopes = sco... | def function[verify_request, parameter[self, uri, http_method, body, headers, scopes]]:
constant[Validate client, code etc, return body + headers]
variable[request] assign[=] call[name[Request], parameter[name[uri], name[http_method], name[body], name[headers]]]
name[request].token_type assign[=... | keyword[def] identifier[verify_request] ( identifier[self] , identifier[uri] , identifier[http_method] = literal[string] , identifier[body] = keyword[None] , identifier[headers] = keyword[None] ,
identifier[scopes] = keyword[None] ):
literal[string]
identifier[request] = identifier[Request] ( iden... | def verify_request(self, uri, http_method='GET', body=None, headers=None, scopes=None):
"""Validate client, code etc, return body + headers"""
request = Request(uri, http_method, body, headers)
request.token_type = self.find_token_type(request)
request.scopes = scopes
token_type_handler = self.token... |
def __add_created_thread(self, event):
"""
Private method to automatically add new thread objects from debug events.
@type event: L{Event}
@param event: Event object.
"""
dwThreadId = event.get_tid()
hThread = event.get_thread_handle()
## if not self... | def function[__add_created_thread, parameter[self, event]]:
constant[
Private method to automatically add new thread objects from debug events.
@type event: L{Event}
@param event: Event object.
]
variable[dwThreadId] assign[=] call[name[event].get_tid, parameter[]]
... | keyword[def] identifier[__add_created_thread] ( identifier[self] , identifier[event] ):
literal[string]
identifier[dwThreadId] = identifier[event] . identifier[get_tid] ()
identifier[hThread] = identifier[event] . identifier[get_thread_handle] ()
keyword[if] keyword[not]... | def __add_created_thread(self, event):
"""
Private method to automatically add new thread objects from debug events.
@type event: L{Event}
@param event: Event object.
"""
dwThreadId = event.get_tid()
hThread = event.get_thread_handle()
## if not self.has_thread(d... |
def signature(name: str) -> Optional[Tuple]:
"""
Return the file or URL signature for name
:param name:
:return:
"""
return url_signature(name) if is_url(name) else file_signature(name) if is_file(name) else None | def function[signature, parameter[name]]:
constant[
Return the file or URL signature for name
:param name:
:return:
]
return[<ast.IfExp object at 0x7da18c4cc910>] | keyword[def] identifier[signature] ( identifier[name] : identifier[str] )-> identifier[Optional] [ identifier[Tuple] ]:
literal[string]
keyword[return] identifier[url_signature] ( identifier[name] ) keyword[if] identifier[is_url] ( identifier[name] ) keyword[else] identifier[file_signature] ( identifier... | def signature(name: str) -> Optional[Tuple]:
"""
Return the file or URL signature for name
:param name:
:return:
"""
return url_signature(name) if is_url(name) else file_signature(name) if is_file(name) else None |
def exe(self):
"""Get the current executor
Returns
-------
exe : mxnet.executor.Executor
"""
return self._buckets[self.curr_bucket_key]['exe'][tuple(self.data_shapes.items())] | def function[exe, parameter[self]]:
constant[Get the current executor
Returns
-------
exe : mxnet.executor.Executor
]
return[call[call[call[name[self]._buckets][name[self].curr_bucket_key]][constant[exe]]][call[name[tuple], parameter[call[name[self].data_shapes.items, parame... | keyword[def] identifier[exe] ( identifier[self] ):
literal[string]
keyword[return] identifier[self] . identifier[_buckets] [ identifier[self] . identifier[curr_bucket_key] ][ literal[string] ][ identifier[tuple] ( identifier[self] . identifier[data_shapes] . identifier[items] ())] | def exe(self):
"""Get the current executor
Returns
-------
exe : mxnet.executor.Executor
"""
return self._buckets[self.curr_bucket_key]['exe'][tuple(self.data_shapes.items())] |
def insert_history_item(self, parent, history_item, description, dummy=False):
"""Enters a single history item into the tree store
:param Gtk.TreeItem parent: Parent tree item
:param HistoryItem history_item: History item to be inserted
:param str description: A description to be added ... | def function[insert_history_item, parameter[self, parent, history_item, description, dummy]]:
constant[Enters a single history item into the tree store
:param Gtk.TreeItem parent: Parent tree item
:param HistoryItem history_item: History item to be inserted
:param str description: A des... | keyword[def] identifier[insert_history_item] ( identifier[self] , identifier[parent] , identifier[history_item] , identifier[description] , identifier[dummy] = keyword[False] ):
literal[string]
keyword[if] keyword[not] identifier[history_item] . identifier[state_reference] :
identifi... | def insert_history_item(self, parent, history_item, description, dummy=False):
"""Enters a single history item into the tree store
:param Gtk.TreeItem parent: Parent tree item
:param HistoryItem history_item: History item to be inserted
:param str description: A description to be added to t... |
def run_subcommand(netgear, args):
"""Runs the subcommand configured in args on the netgear session"""
subcommand = args.subcommand
if subcommand == "block_device" or subcommand == "allow_device":
return netgear.allow_block_device(args.mac_addr, BLOCK if subcommand == "block_device" else ALLOW)
... | def function[run_subcommand, parameter[netgear, args]]:
constant[Runs the subcommand configured in args on the netgear session]
variable[subcommand] assign[=] name[args].subcommand
if <ast.BoolOp object at 0x7da1b016e320> begin[:]
return[call[name[netgear].allow_block_device, parameter[n... | keyword[def] identifier[run_subcommand] ( identifier[netgear] , identifier[args] ):
literal[string]
identifier[subcommand] = identifier[args] . identifier[subcommand]
keyword[if] identifier[subcommand] == literal[string] keyword[or] identifier[subcommand] == literal[string] :
keyword[re... | def run_subcommand(netgear, args):
"""Runs the subcommand configured in args on the netgear session"""
subcommand = args.subcommand
if subcommand == 'block_device' or subcommand == 'allow_device':
return netgear.allow_block_device(args.mac_addr, BLOCK if subcommand == 'block_device' else ALLOW) # d... |
def get_axis_value_discrete(self, axis):
"""Return the axis value in discrete steps for a given axis event.
How a value translates into a discrete step depends on the source.
If the source is :attr:`~libinput.constant.PointerAxisSource.WHEEL`,
the discrete value correspond to the number of physical mouse wheel... | def function[get_axis_value_discrete, parameter[self, axis]]:
constant[Return the axis value in discrete steps for a given axis event.
How a value translates into a discrete step depends on the source.
If the source is :attr:`~libinput.constant.PointerAxisSource.WHEEL`,
the discrete value correspond to t... | keyword[def] identifier[get_axis_value_discrete] ( identifier[self] , identifier[axis] ):
literal[string]
keyword[if] identifier[self] . identifier[type] != identifier[EventType] . identifier[POINTER_AXIS] :
keyword[raise] identifier[AttributeError] ( identifier[_wrong_meth] . identifier[format] ( ident... | def get_axis_value_discrete(self, axis):
"""Return the axis value in discrete steps for a given axis event.
How a value translates into a discrete step depends on the source.
If the source is :attr:`~libinput.constant.PointerAxisSource.WHEEL`,
the discrete value correspond to the number of physical mouse whe... |
def spec_trace(traces, cmap=None, wlen=0.4, log=False, trc='k', tralpha=0.9,
size=(10, 13), fig=None, **kwargs):
"""
Plots seismic data with spectrogram behind.
Takes a stream or list of traces and plots the trace with the spectra
beneath it.
:type traces: list
:param traces: Tr... | def function[spec_trace, parameter[traces, cmap, wlen, log, trc, tralpha, size, fig]]:
constant[
Plots seismic data with spectrogram behind.
Takes a stream or list of traces and plots the trace with the spectra
beneath it.
:type traces: list
:param traces: Traces to be plotted, can be a si... | keyword[def] identifier[spec_trace] ( identifier[traces] , identifier[cmap] = keyword[None] , identifier[wlen] = literal[int] , identifier[log] = keyword[False] , identifier[trc] = literal[string] , identifier[tralpha] = literal[int] ,
identifier[size] =( literal[int] , literal[int] ), identifier[fig] = keyword[None... | def spec_trace(traces, cmap=None, wlen=0.4, log=False, trc='k', tralpha=0.9, size=(10, 13), fig=None, **kwargs):
"""
Plots seismic data with spectrogram behind.
Takes a stream or list of traces and plots the trace with the spectra
beneath it.
:type traces: list
:param traces: Traces to be plot... |
def _ParseExtensionsString(self, extensions_string):
"""Parses the extensions string.
Args:
extensions_string (str): comma separated extensions to filter.
"""
if not extensions_string:
return
extensions_string = extensions_string.lower()
extensions = [
extension.strip() for... | def function[_ParseExtensionsString, parameter[self, extensions_string]]:
constant[Parses the extensions string.
Args:
extensions_string (str): comma separated extensions to filter.
]
if <ast.UnaryOp object at 0x7da20c993940> begin[:]
return[None]
variable[extensions_strin... | keyword[def] identifier[_ParseExtensionsString] ( identifier[self] , identifier[extensions_string] ):
literal[string]
keyword[if] keyword[not] identifier[extensions_string] :
keyword[return]
identifier[extensions_string] = identifier[extensions_string] . identifier[lower] ()
identifier... | def _ParseExtensionsString(self, extensions_string):
"""Parses the extensions string.
Args:
extensions_string (str): comma separated extensions to filter.
"""
if not extensions_string:
return # depends on [control=['if'], data=[]]
extensions_string = extensions_string.lower()
ext... |
def element_should_not_exist(self, json_string, expr):
"""
Check that one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression, don't exist.
*DEPRECATED* JSON Select query language is outdated and not supported any more.
Use other keywords of this library to quer... | def function[element_should_not_exist, parameter[self, json_string, expr]]:
constant[
Check that one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression, don't exist.
*DEPRECATED* JSON Select query language is outdated and not supported any more.
Use other keywo... | keyword[def] identifier[element_should_not_exist] ( identifier[self] , identifier[json_string] , identifier[expr] ):
literal[string]
identifier[value] = identifier[self] . identifier[select_elements] ( identifier[json_string] , identifier[expr] )
keyword[if] identifier[value] keyword[is]... | def element_should_not_exist(self, json_string, expr):
"""
Check that one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression, don't exist.
*DEPRECATED* JSON Select query language is outdated and not supported any more.
Use other keywords of this library to query JS... |
def pid(kp=0., ki=0., kd=0., smooth=0.1):
r'''Create a callable that implements a PID controller.
A PID controller returns a control signal :math:`u(t)` given a history of
error measurements :math:`e(0) \dots e(t)`, using proportional (P), integral
(I), and derivative (D) terms, according to:
.. m... | def function[pid, parameter[kp, ki, kd, smooth]]:
constant[Create a callable that implements a PID controller.
A PID controller returns a control signal :math:`u(t)` given a history of
error measurements :math:`e(0) \dots e(t)`, using proportional (P), integral
(I), and derivative (D) terms, accord... | keyword[def] identifier[pid] ( identifier[kp] = literal[int] , identifier[ki] = literal[int] , identifier[kd] = literal[int] , identifier[smooth] = literal[int] ):
literal[string]
identifier[state] = identifier[dict] ( identifier[p] = literal[int] , identifier[i] = literal[int] , identifier[d] = literal[in... | def pid(kp=0.0, ki=0.0, kd=0.0, smooth=0.1):
"""Create a callable that implements a PID controller.
A PID controller returns a control signal :math:`u(t)` given a history of
error measurements :math:`e(0) \\dots e(t)`, using proportional (P), integral
(I), and derivative (D) terms, according to:
.... |
def VR(VR=None, description=None):
""" Value Representation (VR) <-> Description lookup.
:param VR: Takes the VR and returns its description
:param description: Take the description of a VR and returns the VR
"""
value_repr = {
"AE": "Application Entity",
"AS": "Age String",
... | def function[VR, parameter[VR, description]]:
constant[ Value Representation (VR) <-> Description lookup.
:param VR: Takes the VR and returns its description
:param description: Take the description of a VR and returns the VR
]
variable[value_repr] assign[=] dictionary[[<ast.Constant object... | keyword[def] identifier[VR] ( identifier[VR] = keyword[None] , identifier[description] = keyword[None] ):
literal[string]
identifier[value_repr] ={
literal[string] : literal[string] ,
literal[string] : literal[string] ,
literal[string] : literal[string] ,
literal[string] : literal[strin... | def VR(VR=None, description=None):
""" Value Representation (VR) <-> Description lookup.
:param VR: Takes the VR and returns its description
:param description: Take the description of a VR and returns the VR
"""
value_repr = {'AE': 'Application Entity', 'AS': 'Age String', 'AT': 'Attribute Tag', '... |
def _input_as_lines(self, data):
"""Write sequence of lines to temp file, return filename
data: a sequence to be written to a file, each element of the
sequence will compose a line in the file
* Note: '\n' will be stripped off the end of each sequence
element before wri... | def function[_input_as_lines, parameter[self, data]]:
constant[Write sequence of lines to temp file, return filename
data: a sequence to be written to a file, each element of the
sequence will compose a line in the file
* Note: '
' will be stripped off the end of each sequence
... | keyword[def] identifier[_input_as_lines] ( identifier[self] , identifier[data] ):
literal[string]
identifier[self] . identifier[_input_filename] = identifier[self] . identifier[getTmpFilename] (
identifier[self] . identifier[WorkingDir] , identifier[suffix] = literal[string] )
key... | def _input_as_lines(self, data):
"""Write sequence of lines to temp file, return filename
data: a sequence to be written to a file, each element of the
sequence will compose a line in the file
* Note: '
' will be stripped off the end of each sequence
element before writing ... |
def run_node(cls, node, inputs, device='CPU'): # pylint: disable=arguments-differ
"""Running individual node inference on mxnet engine and
return the result to onnx test infrastructure.
Parameters
----------
node : onnx node object
loaded onnx node (individual lay... | def function[run_node, parameter[cls, node, inputs, device]]:
constant[Running individual node inference on mxnet engine and
return the result to onnx test infrastructure.
Parameters
----------
node : onnx node object
loaded onnx node (individual layer)
inp... | keyword[def] identifier[run_node] ( identifier[cls] , identifier[node] , identifier[inputs] , identifier[device] = literal[string] ):
literal[string]
identifier[graph] = identifier[GraphProto] ()
identifier[sym] , identifier[_] = identifier[graph] . identifier[from_onnx] ( identifier[MXNet... | def run_node(cls, node, inputs, device='CPU'): # pylint: disable=arguments-differ
"Running individual node inference on mxnet engine and\n return the result to onnx test infrastructure.\n\n Parameters\n ----------\n node : onnx node object\n loaded onnx node (individual lay... |
def get_messages(self):
"""
Returns list of Message objects which represents messages being transported.
"""
cs = self.data["comments"]["data"]
res = []
for c in cs:
res.append(Message(c,self))
return res | def function[get_messages, parameter[self]]:
constant[
Returns list of Message objects which represents messages being transported.
]
variable[cs] assign[=] call[call[name[self].data][constant[comments]]][constant[data]]
variable[res] assign[=] list[[]]
for taget[name[c]]... | keyword[def] identifier[get_messages] ( identifier[self] ):
literal[string]
identifier[cs] = identifier[self] . identifier[data] [ literal[string] ][ literal[string] ]
identifier[res] =[]
keyword[for] identifier[c] keyword[in] identifier[cs] :
identifier[res] . ide... | def get_messages(self):
"""
Returns list of Message objects which represents messages being transported.
"""
cs = self.data['comments']['data']
res = []
for c in cs:
res.append(Message(c, self)) # depends on [control=['for'], data=['c']]
return res |
def len_gt(name, value):
'''
Only succeed if length of the given register location is greater than
the given value.
USAGE:
.. code-block:: yaml
foo:
check.len_gt:
- value: 42
run_remote_ex:
local.cmd:
- tgt: '*'
- func: test... | def function[len_gt, parameter[name, value]]:
constant[
Only succeed if length of the given register location is greater than
the given value.
USAGE:
.. code-block:: yaml
foo:
check.len_gt:
- value: 42
run_remote_ex:
local.cmd:
- tg... | keyword[def] identifier[len_gt] ( identifier[name] , identifier[value] ):
literal[string]
identifier[ret] ={ literal[string] : identifier[name] ,
literal[string] : keyword[False] ,
literal[string] : literal[string] ,
literal[string] :{}}
keyword[if] identifier[name] keyword[not] keyw... | def len_gt(name, value):
"""
Only succeed if length of the given register location is greater than
the given value.
USAGE:
.. code-block:: yaml
foo:
check.len_gt:
- value: 42
run_remote_ex:
local.cmd:
- tgt: '*'
- func: test... |
def create_cli(create_app=None):
"""Create CLI for ``inveniomanage`` command.
:param create_app: Flask application factory.
:returns: Click command group.
.. versionadded: 1.0.0
"""
def create_cli_app(info):
"""Application factory for CLI app.
Internal function for creating th... | def function[create_cli, parameter[create_app]]:
constant[Create CLI for ``inveniomanage`` command.
:param create_app: Flask application factory.
:returns: Click command group.
.. versionadded: 1.0.0
]
def function[create_cli_app, parameter[info]]:
constant[Application ... | keyword[def] identifier[create_cli] ( identifier[create_app] = keyword[None] ):
literal[string]
keyword[def] identifier[create_cli_app] ( identifier[info] ):
literal[string]
keyword[if] identifier[create_app] keyword[is] keyword[None] :
identifier[info] . identi... | def create_cli(create_app=None):
"""Create CLI for ``inveniomanage`` command.
:param create_app: Flask application factory.
:returns: Click command group.
.. versionadded: 1.0.0
"""
def create_cli_app(info):
"""Application factory for CLI app.
Internal function for creating t... |
def get_offset(self, x, y):
"""
Computes how far away and at what angle a coordinate is
located.
Distance is returned in feet, angle is returned in degrees
:returns: distance,angle offset of the given x,y coordinate
.... | def function[get_offset, parameter[self, x, y]]:
constant[
Computes how far away and at what angle a coordinate is
located.
Distance is returned in feet, angle is returned in degrees
:returns: distance,angle offset of the given x,y coordinate... | keyword[def] identifier[get_offset] ( identifier[self] , identifier[x] , identifier[y] ):
literal[string]
keyword[with] identifier[self] . identifier[_lock] :
identifier[dx] = identifier[self] . identifier[x] - identifier[x]
identifier[dy] = identifier[self] . identifier... | def get_offset(self, x, y):
"""
Computes how far away and at what angle a coordinate is
located.
Distance is returned in feet, angle is returned in degrees
:returns: distance,angle offset of the given x,y coordinate
.. ve... |
def _setup_logger(self, logging_level: int, log_to_console: bool):
"""Sets up the internal logger
Args:
logging_level: what logging level to use
log_to_console: whether or not to log to the console
"""
self.logger = logging.getLogger('discord')
self.logge... | def function[_setup_logger, parameter[self, logging_level, log_to_console]]:
constant[Sets up the internal logger
Args:
logging_level: what logging level to use
log_to_console: whether or not to log to the console
]
name[self].logger assign[=] call[name[logging].... | keyword[def] identifier[_setup_logger] ( identifier[self] , identifier[logging_level] : identifier[int] , identifier[log_to_console] : identifier[bool] ):
literal[string]
identifier[self] . identifier[logger] = identifier[logging] . identifier[getLogger] ( literal[string] )
identifier[self... | def _setup_logger(self, logging_level: int, log_to_console: bool):
"""Sets up the internal logger
Args:
logging_level: what logging level to use
log_to_console: whether or not to log to the console
"""
self.logger = logging.getLogger('discord')
self.logger.handlers =... |
def _validate_positional_arguments(args):
"""
To validate the positional argument feature - https://github.com/Azure/azure-cli/pull/6055.
Assuming that unknown commands are positional arguments immediately
led by words that only appear at the end of the commands
Slight modification of
https://g... | def function[_validate_positional_arguments, parameter[args]]:
constant[
To validate the positional argument feature - https://github.com/Azure/azure-cli/pull/6055.
Assuming that unknown commands are positional arguments immediately
led by words that only appear at the end of the commands
Sligh... | keyword[def] identifier[_validate_positional_arguments] ( identifier[args] ):
literal[string]
identifier[nouns] =[]
keyword[for] identifier[arg] keyword[in] identifier[args] :
keyword[if] keyword[not] identifier[arg] . identifier[startswith] ( literal[string] ) keyword[or] keyword[not] ... | def _validate_positional_arguments(args):
"""
To validate the positional argument feature - https://github.com/Azure/azure-cli/pull/6055.
Assuming that unknown commands are positional arguments immediately
led by words that only appear at the end of the commands
Slight modification of
https://g... |
def _load(abspath, serializer_type,
loader_func=None,
decompress=True,
verbose=False,
**kwargs):
"""load object from file.
:param abspath: The file path you want load from.
:type abspath: str
:param serializer_type: 'binary' or 'str'.
:type serializer_type: ... | def function[_load, parameter[abspath, serializer_type, loader_func, decompress, verbose]]:
constant[load object from file.
:param abspath: The file path you want load from.
:type abspath: str
:param serializer_type: 'binary' or 'str'.
:type serializer_type: str
:param loader_func: A load... | keyword[def] identifier[_load] ( identifier[abspath] , identifier[serializer_type] ,
identifier[loader_func] = keyword[None] ,
identifier[decompress] = keyword[True] ,
identifier[verbose] = keyword[False] ,
** identifier[kwargs] ):
literal[string]
identifier[_check_serializer_type] ( identifier[serializ... | def _load(abspath, serializer_type, loader_func=None, decompress=True, verbose=False, **kwargs):
"""load object from file.
:param abspath: The file path you want load from.
:type abspath: str
:param serializer_type: 'binary' or 'str'.
:type serializer_type: str
:param loader_func: A loader fu... |
def secret_write(backend,entry):
"""
Write a secret
"""
path,value=entry.split('=')
if value.startswith('@'):
with open(value[1:]) as vfile:
value = vfile.read()
click.echo(click.style('%s - Writing secret' % get_datetime(), fg='green'))
check_and_print(
DKCloud... | def function[secret_write, parameter[backend, entry]]:
constant[
Write a secret
]
<ast.Tuple object at 0x7da20c6c5ff0> assign[=] call[name[entry].split, parameter[constant[=]]]
if call[name[value].startswith, parameter[constant[@]]] begin[:]
with call[name[open], paramete... | keyword[def] identifier[secret_write] ( identifier[backend] , identifier[entry] ):
literal[string]
identifier[path] , identifier[value] = identifier[entry] . identifier[split] ( literal[string] )
keyword[if] identifier[value] . identifier[startswith] ( literal[string] ):
keyword[with] iden... | def secret_write(backend, entry):
"""
Write a secret
"""
(path, value) = entry.split('=')
if value.startswith('@'):
with open(value[1:]) as vfile:
value = vfile.read() # depends on [control=['with'], data=['vfile']] # depends on [control=['if'], data=[]]
click.echo(click.st... |
def trunc_str(s: str) -> str:
"""Truncate strings to maximum length."""
if len(s) > max_str_size:
i = max(0, (max_str_size - 3) // 2)
j = max(0, max_str_size - 3 - i)
s = s[:i] + "..." + s[-j:]
return s | def function[trunc_str, parameter[s]]:
constant[Truncate strings to maximum length.]
if compare[call[name[len], parameter[name[s]]] greater[>] name[max_str_size]] begin[:]
variable[i] assign[=] call[name[max], parameter[constant[0], binary_operation[binary_operation[name[max_str_size] - ... | keyword[def] identifier[trunc_str] ( identifier[s] : identifier[str] )-> identifier[str] :
literal[string]
keyword[if] identifier[len] ( identifier[s] )> identifier[max_str_size] :
identifier[i] = identifier[max] ( literal[int] ,( identifier[max_str_size] - literal[int] )// literal[int] )
... | def trunc_str(s: str) -> str:
"""Truncate strings to maximum length."""
if len(s) > max_str_size:
i = max(0, (max_str_size - 3) // 2)
j = max(0, max_str_size - 3 - i)
s = s[:i] + '...' + s[-j:] # depends on [control=['if'], data=['max_str_size']]
return s |
def add_alignment(self, ref_seq, annotation) -> Annotation:
"""
add_alignment - method for adding the alignment to an annotation
:param ref_seq: List of reference sequences
:type ref_seq: List
:param annotation: The complete annotation
:type annotation: Annotation
... | def function[add_alignment, parameter[self, ref_seq, annotation]]:
constant[
add_alignment - method for adding the alignment to an annotation
:param ref_seq: List of reference sequences
:type ref_seq: List
:param annotation: The complete annotation
:type annotation: Anno... | keyword[def] identifier[add_alignment] ( identifier[self] , identifier[ref_seq] , identifier[annotation] )-> identifier[Annotation] :
literal[string]
identifier[seq_features] = identifier[get_seqs] ( identifier[ref_seq] )
identifier[annoated_align] ={}
identifier[allele] = identif... | def add_alignment(self, ref_seq, annotation) -> Annotation:
"""
add_alignment - method for adding the alignment to an annotation
:param ref_seq: List of reference sequences
:type ref_seq: List
:param annotation: The complete annotation
:type annotation: Annotation
:... |
def _handle_properties(self, stmt: Statement, sctx: SchemaContext) -> None:
"""Handle type substatements."""
self._handle_restrictions(stmt, sctx) | def function[_handle_properties, parameter[self, stmt, sctx]]:
constant[Handle type substatements.]
call[name[self]._handle_restrictions, parameter[name[stmt], name[sctx]]] | keyword[def] identifier[_handle_properties] ( identifier[self] , identifier[stmt] : identifier[Statement] , identifier[sctx] : identifier[SchemaContext] )-> keyword[None] :
literal[string]
identifier[self] . identifier[_handle_restrictions] ( identifier[stmt] , identifier[sctx] ) | def _handle_properties(self, stmt: Statement, sctx: SchemaContext) -> None:
"""Handle type substatements."""
self._handle_restrictions(stmt, sctx) |
def iri_to_uri(iri, kwargs=None):
'''Convert an Internationalised Resource Identifier (IRI) portion
to a URI portion that is suitable for inclusion in a URL.
This is the algorithm from section 3.1 of RFC 3987.
Returns an ASCII native string containing the encoded result.
'''
if iri is None:
... | def function[iri_to_uri, parameter[iri, kwargs]]:
constant[Convert an Internationalised Resource Identifier (IRI) portion
to a URI portion that is suitable for inclusion in a URL.
This is the algorithm from section 3.1 of RFC 3987.
Returns an ASCII native string containing the encoded result.
]
... | keyword[def] identifier[iri_to_uri] ( identifier[iri] , identifier[kwargs] = keyword[None] ):
literal[string]
keyword[if] identifier[iri] keyword[is] keyword[None] :
keyword[return] identifier[iri]
keyword[if] identifier[kwargs] :
identifier[iri] = literal[string] %( identifier... | def iri_to_uri(iri, kwargs=None):
"""Convert an Internationalised Resource Identifier (IRI) portion
to a URI portion that is suitable for inclusion in a URL.
This is the algorithm from section 3.1 of RFC 3987.
Returns an ASCII native string containing the encoded result.
"""
if iri is None:
... |
def list_tables(self):
'''
Load existing tables and their descriptions.
:return:
'''
if not self._tables:
for table_name in os.listdir(self.db_path):
self._tables[table_name] = self._load_table(table_name)
return self._tables.keys() | def function[list_tables, parameter[self]]:
constant[
Load existing tables and their descriptions.
:return:
]
if <ast.UnaryOp object at 0x7da18f8129e0> begin[:]
for taget[name[table_name]] in starred[call[name[os].listdir, parameter[name[self].db_path]]] begin[:]... | keyword[def] identifier[list_tables] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_tables] :
keyword[for] identifier[table_name] keyword[in] identifier[os] . identifier[listdir] ( identifier[self] . identifier[db_path] ):
... | def list_tables(self):
"""
Load existing tables and their descriptions.
:return:
"""
if not self._tables:
for table_name in os.listdir(self.db_path):
self._tables[table_name] = self._load_table(table_name) # depends on [control=['for'], data=['table_name']] # depen... |
def id_and_revision_extractor(self,xml_elt):
"""
Function for determing an identifier (and, where applicable, timestamp/revision
information) for extracted embedded content;
to be used for DINGO's xml-import hook 'id_and_revision_extractor'.
This function is called
- fo... | def function[id_and_revision_extractor, parameter[self, xml_elt]]:
constant[
Function for determing an identifier (and, where applicable, timestamp/revision
information) for extracted embedded content;
to be used for DINGO's xml-import hook 'id_and_revision_extractor'.
This func... | keyword[def] identifier[id_and_revision_extractor] ( identifier[self] , identifier[xml_elt] ):
literal[string]
identifier[result] ={ literal[string] : keyword[None] ,
literal[string] : keyword[None] }
identifier[attributes] = identifier[extract_attributes] ( identifier[xml_elt] ... | def id_and_revision_extractor(self, xml_elt):
"""
Function for determing an identifier (and, where applicable, timestamp/revision
information) for extracted embedded content;
to be used for DINGO's xml-import hook 'id_and_revision_extractor'.
This function is called
- for t... |
def find_converting_reactions(model, pair):
"""
Find all reactions which convert a given metabolite pair.
Parameters
----------
model : cobra.Model
The metabolic model under investigation.
pair: tuple or list
A pair of metabolite identifiers without compartment suffix.
Retu... | def function[find_converting_reactions, parameter[model, pair]]:
constant[
Find all reactions which convert a given metabolite pair.
Parameters
----------
model : cobra.Model
The metabolic model under investigation.
pair: tuple or list
A pair of metabolite identifiers withou... | keyword[def] identifier[find_converting_reactions] ( identifier[model] , identifier[pair] ):
literal[string]
identifier[first] = identifier[set] ( identifier[find_met_in_model] ( identifier[model] , identifier[pair] [ literal[int] ]))
identifier[second] = identifier[set] ( identifier[find_met_in_model... | def find_converting_reactions(model, pair):
"""
Find all reactions which convert a given metabolite pair.
Parameters
----------
model : cobra.Model
The metabolic model under investigation.
pair: tuple or list
A pair of metabolite identifiers without compartment suffix.
Retu... |
def run_command(self, args):
"""
Parse command line arguments and run function registered for the appropriate command.
:param args: [str] command line arguments
"""
parsed_args = self.parser.parse_args(args)
if hasattr(parsed_args, 'func'):
parsed_args.func(pa... | def function[run_command, parameter[self, args]]:
constant[
Parse command line arguments and run function registered for the appropriate command.
:param args: [str] command line arguments
]
variable[parsed_args] assign[=] call[name[self].parser.parse_args, parameter[name[args]]]
... | keyword[def] identifier[run_command] ( identifier[self] , identifier[args] ):
literal[string]
identifier[parsed_args] = identifier[self] . identifier[parser] . identifier[parse_args] ( identifier[args] )
keyword[if] identifier[hasattr] ( identifier[parsed_args] , literal[string] ):
... | def run_command(self, args):
"""
Parse command line arguments and run function registered for the appropriate command.
:param args: [str] command line arguments
"""
parsed_args = self.parser.parse_args(args)
if hasattr(parsed_args, 'func'):
parsed_args.func(parsed_args) # de... |
def split_line(self, line):
""" Try to do pure shlex.split unless it can't parse the line. In that
case we trim the input line until shlex can split the args and tack the
unparsable portion on as the last argument. """
remainder = []
while True:
try:
a... | def function[split_line, parameter[self, line]]:
constant[ Try to do pure shlex.split unless it can't parse the line. In that
case we trim the input line until shlex can split the args and tack the
unparsable portion on as the last argument. ]
variable[remainder] assign[=] list[[]]
... | keyword[def] identifier[split_line] ( identifier[self] , identifier[line] ):
literal[string]
identifier[remainder] =[]
keyword[while] keyword[True] :
keyword[try] :
identifier[args] = identifier[shlex] . identifier[split] ( identifier[line] )
key... | def split_line(self, line):
""" Try to do pure shlex.split unless it can't parse the line. In that
case we trim the input line until shlex can split the args and tack the
unparsable portion on as the last argument. """
remainder = []
while True:
try:
args = shlex.split(li... |
def export_agg_losses_ebr(ekey, dstore):
"""
:param ekey: export key, i.e. a pair (datastore key, fmt)
:param dstore: datastore object
"""
if 'ruptures' not in dstore:
logging.warning('There are no ruptures in the datastore')
return []
name, ext = export.keyfunc(ekey)
agg_los... | def function[export_agg_losses_ebr, parameter[ekey, dstore]]:
constant[
:param ekey: export key, i.e. a pair (datastore key, fmt)
:param dstore: datastore object
]
if compare[constant[ruptures] <ast.NotIn object at 0x7da2590d7190> name[dstore]] begin[:]
call[name[logging].war... | keyword[def] identifier[export_agg_losses_ebr] ( identifier[ekey] , identifier[dstore] ):
literal[string]
keyword[if] literal[string] keyword[not] keyword[in] identifier[dstore] :
identifier[logging] . identifier[warning] ( literal[string] )
keyword[return] []
identifier[name] , ... | def export_agg_losses_ebr(ekey, dstore):
"""
:param ekey: export key, i.e. a pair (datastore key, fmt)
:param dstore: datastore object
"""
if 'ruptures' not in dstore:
logging.warning('There are no ruptures in the datastore')
return [] # depends on [control=['if'], data=[]]
(nam... |
def _get_result_constructor(self):
""" Returns a function that will be used to instantiate query results """
if not self._values_list: # we want models
return lambda rows: self.model._construct_instance(rows)
elif self._flat_values_list: # the user has requested flattened list (1 val... | def function[_get_result_constructor, parameter[self]]:
constant[ Returns a function that will be used to instantiate query results ]
if <ast.UnaryOp object at 0x7da20c6c7040> begin[:]
return[<ast.Lambda object at 0x7da18f723970>] | keyword[def] identifier[_get_result_constructor] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_values_list] :
keyword[return] keyword[lambda] identifier[rows] : identifier[self] . identifier[model] . identifier[_construct_instance] ( ... | def _get_result_constructor(self):
""" Returns a function that will be used to instantiate query results """
if not self._values_list: # we want models
return lambda rows: self.model._construct_instance(rows) # depends on [control=['if'], data=[]]
elif self._flat_values_list: # the user has reque... |
def listdir(store, path=None):
"""Obtain a directory listing for the given path. If `store` provides a `listdir`
method, this will be called, otherwise will fall back to implementation via the
`MutableMapping` interface."""
path = normalize_storage_path(path)
if hasattr(store, 'listdir'):
# ... | def function[listdir, parameter[store, path]]:
constant[Obtain a directory listing for the given path. If `store` provides a `listdir`
method, this will be called, otherwise will fall back to implementation via the
`MutableMapping` interface.]
variable[path] assign[=] call[name[normalize_storage... | keyword[def] identifier[listdir] ( identifier[store] , identifier[path] = keyword[None] ):
literal[string]
identifier[path] = identifier[normalize_storage_path] ( identifier[path] )
keyword[if] identifier[hasattr] ( identifier[store] , literal[string] ):
keyword[return] identifier[stor... | def listdir(store, path=None):
"""Obtain a directory listing for the given path. If `store` provides a `listdir`
method, this will be called, otherwise will fall back to implementation via the
`MutableMapping` interface."""
path = normalize_storage_path(path)
if hasattr(store, 'listdir'):
# ... |
def _delete_file(self, line=""):
""" Delete an ontology
2016-04-11: not a direct command anymore """
if not self.all_ontologies:
self._help_nofiles()
else:
out = []
for each in self.all_ontologies:
if line in each:
... | def function[_delete_file, parameter[self, line]]:
constant[ Delete an ontology
2016-04-11: not a direct command anymore ]
if <ast.UnaryOp object at 0x7da1b1115ab0> begin[:]
call[name[self]._help_nofiles, parameter[]]
return[None] | keyword[def] identifier[_delete_file] ( identifier[self] , identifier[line] = literal[string] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[all_ontologies] :
identifier[self] . identifier[_help_nofiles] ()
keyword[else] :
identifier... | def _delete_file(self, line=''):
""" Delete an ontology
2016-04-11: not a direct command anymore """
if not self.all_ontologies:
self._help_nofiles() # depends on [control=['if'], data=[]]
else:
out = []
for each in self.all_ontologies:
if line in each:
... |
def convergence_from_grid(self, grid):
"""Compute the summed convergence of the galaxy's mass profiles using a grid of Cartesian (y,x) \
coordinates.
If the galaxy has no mass profiles, a grid of zeros is returned.
See *profiles.mass_profiles* module for details of how this is ... | def function[convergence_from_grid, parameter[self, grid]]:
constant[Compute the summed convergence of the galaxy's mass profiles using a grid of Cartesian (y,x) coordinates.
If the galaxy has no mass profiles, a grid of zeros is returned.
See *profiles.mass_profiles* module fo... | keyword[def] identifier[convergence_from_grid] ( identifier[self] , identifier[grid] ):
literal[string]
keyword[if] identifier[self] . identifier[has_mass_profile] :
keyword[return] identifier[sum] ( identifier[map] ( keyword[lambda] identifier[p] : identifier[p] . identifier[conver... | def convergence_from_grid(self, grid):
"""Compute the summed convergence of the galaxy's mass profiles using a grid of Cartesian (y,x) coordinates.
If the galaxy has no mass profiles, a grid of zeros is returned.
See *profiles.mass_profiles* module for details of how this is perfor... |
def _init_metadata(self):
"""stub"""
super(EulerRotationAnswerFormRecord, self)._init_metadata()
self._euler_rotation_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'ang... | def function[_init_metadata, parameter[self]]:
constant[stub]
call[call[name[super], parameter[name[EulerRotationAnswerFormRecord], name[self]]]._init_metadata, parameter[]]
name[self]._euler_rotation_metadata assign[=] dictionary[[<ast.Constant object at 0x7da20c6ab310>, <ast.Constant object at... | keyword[def] identifier[_init_metadata] ( identifier[self] ):
literal[string]
identifier[super] ( identifier[EulerRotationAnswerFormRecord] , identifier[self] ). identifier[_init_metadata] ()
identifier[self] . identifier[_euler_rotation_metadata] ={
literal[string] : identifier[I... | def _init_metadata(self):
"""stub"""
super(EulerRotationAnswerFormRecord, self)._init_metadata()
self._euler_rotation_metadata = {'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'angle_values'), 'element_label': 'Euler Angle Values', 'instructions': 'Provide X, Y, ... |
def trace_job(self, jobId):
""" Get information about the specified remote job
:param jobId: the job identifier
:return: a dictionary with the information
"""
header = self.__check_authentication()
status_url = self.address + "/jobs/" + jobId + "/trace"
status_re... | def function[trace_job, parameter[self, jobId]]:
constant[ Get information about the specified remote job
:param jobId: the job identifier
:return: a dictionary with the information
]
variable[header] assign[=] call[name[self].__check_authentication, parameter[]]
variabl... | keyword[def] identifier[trace_job] ( identifier[self] , identifier[jobId] ):
literal[string]
identifier[header] = identifier[self] . identifier[__check_authentication] ()
identifier[status_url] = identifier[self] . identifier[address] + literal[string] + identifier[jobId] + literal[string]... | def trace_job(self, jobId):
""" Get information about the specified remote job
:param jobId: the job identifier
:return: a dictionary with the information
"""
header = self.__check_authentication()
status_url = self.address + '/jobs/' + jobId + '/trace'
status_resp = requests.ge... |
def get_process_pid(process_name):
""" check for process' pid file and returns pid from there """
try:
pid_filename = get_pid_filename(process_name)
with open(pid_filename, mode='r') as pid_file:
pid = int(pid_file.read().strip())
except IOError:
pid = None
return pid | def function[get_process_pid, parameter[process_name]]:
constant[ check for process' pid file and returns pid from there ]
<ast.Try object at 0x7da1b269a800>
return[name[pid]] | keyword[def] identifier[get_process_pid] ( identifier[process_name] ):
literal[string]
keyword[try] :
identifier[pid_filename] = identifier[get_pid_filename] ( identifier[process_name] )
keyword[with] identifier[open] ( identifier[pid_filename] , identifier[mode] = literal[string] ) keyw... | def get_process_pid(process_name):
""" check for process' pid file and returns pid from there """
try:
pid_filename = get_pid_filename(process_name)
with open(pid_filename, mode='r') as pid_file:
pid = int(pid_file.read().strip()) # depends on [control=['with'], data=['pid_file']] ... |
def visit(folder, provenance_id, step_name, previous_step_id=None, config=None, db_url=None, is_organised=True):
"""Record all files from a folder into the database.
Note:
If a file has been copied from a previous processing step without any transformation, it will be detected and
marked in the DB. The... | def function[visit, parameter[folder, provenance_id, step_name, previous_step_id, config, db_url, is_organised]]:
constant[Record all files from a folder into the database.
Note:
If a file has been copied from a previous processing step without any transformation, it will be detected and
marked in ... | keyword[def] identifier[visit] ( identifier[folder] , identifier[provenance_id] , identifier[step_name] , identifier[previous_step_id] = keyword[None] , identifier[config] = keyword[None] , identifier[db_url] = keyword[None] , identifier[is_organised] = keyword[True] ):
literal[string]
identifier[config] =... | def visit(folder, provenance_id, step_name, previous_step_id=None, config=None, db_url=None, is_organised=True):
"""Record all files from a folder into the database.
Note:
If a file has been copied from a previous processing step without any transformation, it will be detected and
marked in the DB. The... |
def state_type_changed(self, model, prop_name, info):
"""Reopen state editor when state type is changed
When the type of the observed state changes, a new model is created. The look of this controller's view
depends on the kind of model. Therefore, we have to destroy this editor and open a new ... | def function[state_type_changed, parameter[self, model, prop_name, info]]:
constant[Reopen state editor when state type is changed
When the type of the observed state changes, a new model is created. The look of this controller's view
depends on the kind of model. Therefore, we have to destroy ... | keyword[def] identifier[state_type_changed] ( identifier[self] , identifier[model] , identifier[prop_name] , identifier[info] ):
literal[string]
identifier[msg] = identifier[info] [ literal[string] ]
keyword[if] identifier[msg] . identifier[action] keyword[in] [ literal[string] ... | def state_type_changed(self, model, prop_name, info):
"""Reopen state editor when state type is changed
When the type of the observed state changes, a new model is created. The look of this controller's view
depends on the kind of model. Therefore, we have to destroy this editor and open a new one ... |
def is_disconnect(e, connection, cursor):
"""
Connection state check from SQLAlchemy:
https://bitbucket.org/sqlalchemy/sqlalchemy/src/tip/lib/sqlalchemy/dialects/postgresql/psycopg2.py
"""
if isinstance(e, OperationalError):
# these error messages from libpq: interfaces/libpq/fe-misc.c.
... | def function[is_disconnect, parameter[e, connection, cursor]]:
constant[
Connection state check from SQLAlchemy:
https://bitbucket.org/sqlalchemy/sqlalchemy/src/tip/lib/sqlalchemy/dialects/postgresql/psycopg2.py
]
if call[name[isinstance], parameter[name[e], name[OperationalError]]] begin[:]... | keyword[def] identifier[is_disconnect] ( identifier[e] , identifier[connection] , identifier[cursor] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[e] , identifier[OperationalError] ):
keyword[return] literal[string] keyword[in] identifier[str] ( identifier[e... | def is_disconnect(e, connection, cursor):
"""
Connection state check from SQLAlchemy:
https://bitbucket.org/sqlalchemy/sqlalchemy/src/tip/lib/sqlalchemy/dialects/postgresql/psycopg2.py
"""
if isinstance(e, OperationalError):
# these error messages from libpq: interfaces/libpq/fe-misc.c.
... |
def read_data(self, chan=None, begtime=None, endtime=None, begsam=None,
endsam=None, s_freq=None):
"""Read the data and creates a ChanTime instance
Parameters
----------
chan : list of strings
names of the channels to read
begtime : int or datedelta... | def function[read_data, parameter[self, chan, begtime, endtime, begsam, endsam, s_freq]]:
constant[Read the data and creates a ChanTime instance
Parameters
----------
chan : list of strings
names of the channels to read
begtime : int or datedelta or datetime or list
... | keyword[def] identifier[read_data] ( identifier[self] , identifier[chan] = keyword[None] , identifier[begtime] = keyword[None] , identifier[endtime] = keyword[None] , identifier[begsam] = keyword[None] ,
identifier[endsam] = keyword[None] , identifier[s_freq] = keyword[None] ):
literal[string]
ide... | def read_data(self, chan=None, begtime=None, endtime=None, begsam=None, endsam=None, s_freq=None):
"""Read the data and creates a ChanTime instance
Parameters
----------
chan : list of strings
names of the channels to read
begtime : int or datedelta or datetime or list
... |
def _parse_mtu(self, config):
"""Parses the config block and returns the configured IP MTU value
The provided configuration block is scanned and the configured value
for the IP MTU is returned as a dict object. The IP MTU value is
expected to always be present in the provided config bl... | def function[_parse_mtu, parameter[self, config]]:
constant[Parses the config block and returns the configured IP MTU value
The provided configuration block is scanned and the configured value
for the IP MTU is returned as a dict object. The IP MTU value is
expected to always be presen... | keyword[def] identifier[_parse_mtu] ( identifier[self] , identifier[config] ):
literal[string]
identifier[match] = identifier[re] . identifier[search] ( literal[string] , identifier[config] )
keyword[return] identifier[dict] ( identifier[mtu] = identifier[int] ( identifier[match] . identi... | def _parse_mtu(self, config):
"""Parses the config block and returns the configured IP MTU value
The provided configuration block is scanned and the configured value
for the IP MTU is returned as a dict object. The IP MTU value is
expected to always be present in the provided config block
... |
def update_user_password(client, userpass):
"""Will update the password for a userpass user"""
vault_path = ''
user = ''
user_path_bits = userpass.split('/')
if len(user_path_bits) == 1:
user = user_path_bits[0]
vault_path = "auth/userpass/users/%s/password" % user
LOG.debug(... | def function[update_user_password, parameter[client, userpass]]:
constant[Will update the password for a userpass user]
variable[vault_path] assign[=] constant[]
variable[user] assign[=] constant[]
variable[user_path_bits] assign[=] call[name[userpass].split, parameter[constant[/]]]
... | keyword[def] identifier[update_user_password] ( identifier[client] , identifier[userpass] ):
literal[string]
identifier[vault_path] = literal[string]
identifier[user] = literal[string]
identifier[user_path_bits] = identifier[userpass] . identifier[split] ( literal[string] )
keyword[if] id... | def update_user_password(client, userpass):
"""Will update the password for a userpass user"""
vault_path = ''
user = ''
user_path_bits = userpass.split('/')
if len(user_path_bits) == 1:
user = user_path_bits[0]
vault_path = 'auth/userpass/users/%s/password' % user
LOG.debug(... |
def _poly_eval_0(self, u, ids):
"""Evaluate internal polynomial."""
return u * (u * (self._a[ids] * u + self._b[ids]) + self._c[ids]) + self._d[ids] | def function[_poly_eval_0, parameter[self, u, ids]]:
constant[Evaluate internal polynomial.]
return[binary_operation[binary_operation[name[u] * binary_operation[binary_operation[name[u] * binary_operation[binary_operation[call[name[self]._a][name[ids]] * name[u]] + call[name[self]._b][name[ids]]]] + call[na... | keyword[def] identifier[_poly_eval_0] ( identifier[self] , identifier[u] , identifier[ids] ):
literal[string]
keyword[return] identifier[u] *( identifier[u] *( identifier[self] . identifier[_a] [ identifier[ids] ]* identifier[u] + identifier[self] . identifier[_b] [ identifier[ids] ])+ identifier[... | def _poly_eval_0(self, u, ids):
"""Evaluate internal polynomial."""
return u * (u * (self._a[ids] * u + self._b[ids]) + self._c[ids]) + self._d[ids] |
def read(self, *names): # type: ignore # noqa: F811
# type: (Any) -> Any
r"""Read results from FORM.
Wait for a response of FORM to obtain the results specified by
the given names and return a corresponding string or (nested) list of
strings. Objects to be read from FORM are e... | def function[read, parameter[self]]:
constant[Read results from FORM.
Wait for a response of FORM to obtain the results specified by
the given names and return a corresponding string or (nested) list of
strings. Objects to be read from FORM are expressions, $-variables and
prepr... | keyword[def] identifier[read] ( identifier[self] ,* identifier[names] ):
literal[string]
keyword[if] identifier[self] . identifier[_closed] :
keyword[raise] identifier[IOError] ( literal[string] )
keyword[if] identifier[len] ( identifier[names] )== literal[int] keyword[a... | def read(self, *names): # type: ignore # noqa: F811
# type: (Any) -> Any
'Read results from FORM.\n\n Wait for a response of FORM to obtain the results specified by\n the given names and return a corresponding string or (nested) list of\n strings. Objects to be read from FORM are expressi... |
def _lex(s):
"""
Lex the input string according to _tsql_lex_re.
Yields
(gid, token, line_number)
"""
s += '.' # make sure there's a terminator to know when to stop parsing
lines = enumerate(s.splitlines(), 1)
lineno = pos = 0
try:
for lineno, line in lines:
... | def function[_lex, parameter[s]]:
constant[
Lex the input string according to _tsql_lex_re.
Yields
(gid, token, line_number)
]
<ast.AugAssign object at 0x7da18f09d480>
variable[lines] assign[=] call[name[enumerate], parameter[call[name[s].splitlines, parameter[]], constant[1]]]
... | keyword[def] identifier[_lex] ( identifier[s] ):
literal[string]
identifier[s] += literal[string]
identifier[lines] = identifier[enumerate] ( identifier[s] . identifier[splitlines] (), literal[int] )
identifier[lineno] = identifier[pos] = literal[int]
keyword[try] :
keyword[for] ... | def _lex(s):
"""
Lex the input string according to _tsql_lex_re.
Yields
(gid, token, line_number)
"""
s += '.' # make sure there's a terminator to know when to stop parsing
lines = enumerate(s.splitlines(), 1)
lineno = pos = 0
try:
for (lineno, line) in lines:
... |
def get_sample_frame(self):
"""Return first available image in observation result"""
for frame in self.frames:
return frame.open()
for res in self.results.values():
return res.open()
return None | def function[get_sample_frame, parameter[self]]:
constant[Return first available image in observation result]
for taget[name[frame]] in starred[name[self].frames] begin[:]
return[call[name[frame].open, parameter[]]]
for taget[name[res]] in starred[call[name[self].results.values, paramete... | keyword[def] identifier[get_sample_frame] ( identifier[self] ):
literal[string]
keyword[for] identifier[frame] keyword[in] identifier[self] . identifier[frames] :
keyword[return] identifier[frame] . identifier[open] ()
keyword[for] identifier[res] keyword[in] identifie... | def get_sample_frame(self):
"""Return first available image in observation result"""
for frame in self.frames:
return frame.open() # depends on [control=['for'], data=['frame']]
for res in self.results.values():
return res.open() # depends on [control=['for'], data=['res']]
return None |
async def invites(self):
"""|coro|
Returns a list of all active instant invites from this channel.
You must have :attr:`~.Permissions.manage_guild` to get this information.
Raises
-------
Forbidden
You do not have proper permissions to get the information.
... | <ast.AsyncFunctionDef object at 0x7da1b20c8130> | keyword[async] keyword[def] identifier[invites] ( identifier[self] ):
literal[string]
identifier[state] = identifier[self] . identifier[_state]
identifier[data] = keyword[await] identifier[state] . identifier[http] . identifier[invites_from_channel] ( identifier[self] . identifier[id] ... | async def invites(self):
"""|coro|
Returns a list of all active instant invites from this channel.
You must have :attr:`~.Permissions.manage_guild` to get this information.
Raises
-------
Forbidden
You do not have proper permissions to get the information.
... |
async def jsk_show(self, ctx: commands.Context):
"""
Shows Jishaku in the help command.
"""
if not self.jsk.hidden:
return await ctx.send("Jishaku is already visible.")
self.jsk.hidden = False
await ctx.send("Jishaku is now visible.") | <ast.AsyncFunctionDef object at 0x7da1b1e69150> | keyword[async] keyword[def] identifier[jsk_show] ( identifier[self] , identifier[ctx] : identifier[commands] . identifier[Context] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[jsk] . identifier[hidden] :
keyword[return] keyword[await] identifier[ctx] ... | async def jsk_show(self, ctx: commands.Context):
"""
Shows Jishaku in the help command.
"""
if not self.jsk.hidden:
return await ctx.send('Jishaku is already visible.') # depends on [control=['if'], data=[]]
self.jsk.hidden = False
await ctx.send('Jishaku is now visible.') |
def fetch_exac_constraint():
"""Fetch the file with exac constraint scores
Returns:
exac_lines(iterable(str))
"""
file_name = 'fordist_cleaned_exac_r03_march16_z_pli_rec_null_data.txt'
url = ('ftp://ftp.broadinstitute.org/pub/ExAC_release/release0.3/functional_gene_constraint'
... | def function[fetch_exac_constraint, parameter[]]:
constant[Fetch the file with exac constraint scores
Returns:
exac_lines(iterable(str))
]
variable[file_name] assign[=] constant[fordist_cleaned_exac_r03_march16_z_pli_rec_null_data.txt]
variable[url] assign[=] call[constant[f... | keyword[def] identifier[fetch_exac_constraint] ():
literal[string]
identifier[file_name] = literal[string]
identifier[url] =( literal[string]
literal[string] ). identifier[format] ( identifier[file_name] )
identifier[LOG] . identifier[info] ( literal[string] )
keyword[try] :
... | def fetch_exac_constraint():
"""Fetch the file with exac constraint scores
Returns:
exac_lines(iterable(str))
"""
file_name = 'fordist_cleaned_exac_r03_march16_z_pli_rec_null_data.txt'
url = 'ftp://ftp.broadinstitute.org/pub/ExAC_release/release0.3/functional_gene_constraint/{0}'.format... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.