code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def get(method, hmc, uri, uri_parms, logon_required):
"""Operation: List Load Activation Profiles (requires classic mode)."""
cpc_oid = uri_parms[0]
query_str = uri_parms[1]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid)
except KeyError:
raise InvalidResourceE... | def function[get, parameter[method, hmc, uri, uri_parms, logon_required]]:
constant[Operation: List Load Activation Profiles (requires classic mode).]
variable[cpc_oid] assign[=] call[name[uri_parms]][constant[0]]
variable[query_str] assign[=] call[name[uri_parms]][constant[1]]
<ast.Try obje... | keyword[def] identifier[get] ( identifier[method] , identifier[hmc] , identifier[uri] , identifier[uri_parms] , identifier[logon_required] ):
literal[string]
identifier[cpc_oid] = identifier[uri_parms] [ literal[int] ]
identifier[query_str] = identifier[uri_parms] [ literal[int] ]
... | def get(method, hmc, uri, uri_parms, logon_required):
"""Operation: List Load Activation Profiles (requires classic mode)."""
cpc_oid = uri_parms[0]
query_str = uri_parms[1]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid) # depends on [control=['try'], data=[]]
except KeyError:
raise Inv... |
def __collect_fields(self):
""" Use field values from config.json and collect from request """
form = FormData()
form.add_field(self.__username_field, required=True,
error=self.__username_error)
form.add_field(self.__password_field, required=True,
... | def function[__collect_fields, parameter[self]]:
constant[ Use field values from config.json and collect from request ]
variable[form] assign[=] call[name[FormData], parameter[]]
call[name[form].add_field, parameter[name[self].__username_field]]
call[name[form].add_field, parameter[name[... | keyword[def] identifier[__collect_fields] ( identifier[self] ):
literal[string]
identifier[form] = identifier[FormData] ()
identifier[form] . identifier[add_field] ( identifier[self] . identifier[__username_field] , identifier[required] = keyword[True] ,
identifier[error] = id... | def __collect_fields(self):
""" Use field values from config.json and collect from request """
form = FormData()
form.add_field(self.__username_field, required=True, error=self.__username_error)
form.add_field(self.__password_field, required=True, error=self.__password_error)
form.parse()
self.u... |
def is_archive(self):
""" Given a parsed feed, returns True if this is an archive feed """
ns_prefix = self.archive_namespace
if ns_prefix:
if ns_prefix + '_archive' in self.feed.feed:
# This is declared to be an archive view
return True
i... | def function[is_archive, parameter[self]]:
constant[ Given a parsed feed, returns True if this is an archive feed ]
variable[ns_prefix] assign[=] name[self].archive_namespace
if name[ns_prefix] begin[:]
if compare[binary_operation[name[ns_prefix] + constant[_archive]] in name[sel... | keyword[def] identifier[is_archive] ( identifier[self] ):
literal[string]
identifier[ns_prefix] = identifier[self] . identifier[archive_namespace]
keyword[if] identifier[ns_prefix] :
keyword[if] identifier[ns_prefix] + literal[string] keyword[in] identifier[self] . ident... | def is_archive(self):
""" Given a parsed feed, returns True if this is an archive feed """
ns_prefix = self.archive_namespace
if ns_prefix:
if ns_prefix + '_archive' in self.feed.feed:
# This is declared to be an archive view
return True # depends on [control=['if'], data=[]... |
def draw_help(self, surf):
"""Draw the help dialog."""
if not self._help:
return
def write(loc, text):
surf.write_screen(self._font_large, colors.black, loc, text)
surf.surf.fill(colors.white * 0.8)
write((1, 1), "Shortcuts:")
max_len = max(len(s) for s, _ in self.shortcuts)
f... | def function[draw_help, parameter[self, surf]]:
constant[Draw the help dialog.]
if <ast.UnaryOp object at 0x7da2047eb3d0> begin[:]
return[None]
def function[write, parameter[loc, text]]:
call[name[surf].write_screen, parameter[name[self]._font_large, name[colors].black, n... | keyword[def] identifier[draw_help] ( identifier[self] , identifier[surf] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_help] :
keyword[return]
keyword[def] identifier[write] ( identifier[loc] , identifier[text] ):
identifier[surf] . identifier[write_scre... | def draw_help(self, surf):
"""Draw the help dialog."""
if not self._help:
return # depends on [control=['if'], data=[]]
def write(loc, text):
surf.write_screen(self._font_large, colors.black, loc, text)
surf.surf.fill(colors.white * 0.8)
write((1, 1), 'Shortcuts:')
max_len = ma... |
def _set_link_error_disable(self, v, load=False):
"""
Setter method for link_error_disable, mapped from YANG variable /interface/ethernet/link_error_disable (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_link_error_disable is considered as a private
meth... | def function[_set_link_error_disable, parameter[self, v, load]]:
constant[
Setter method for link_error_disable, mapped from YANG variable /interface/ethernet/link_error_disable (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_link_error_disable is conside... | keyword[def] identifier[_set_link_error_disable] ( identifier[self] , identifier[v] , identifier[load] = keyword[False] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[v] , literal[string] ):
identifier[v] = identifier[v] . identifier[_utype] ( identifier[v] )
keyword[try] :
... | def _set_link_error_disable(self, v, load=False):
"""
Setter method for link_error_disable, mapped from YANG variable /interface/ethernet/link_error_disable (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_link_error_disable is considered as a private
meth... |
def create_monitor(hostname, username, password, monitor_type, name, **kwargs):
'''
A function to connect to a bigip device and create a monitor.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
monitor... | def function[create_monitor, parameter[hostname, username, password, monitor_type, name]]:
constant[
A function to connect to a bigip device and create a monitor.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST... | keyword[def] identifier[create_monitor] ( identifier[hostname] , identifier[username] , identifier[password] , identifier[monitor_type] , identifier[name] ,** identifier[kwargs] ):
literal[string]
identifier[ret] ={ literal[string] : identifier[name] , literal[string] :{}, literal[string] : keyword[False]... | def create_monitor(hostname, username, password, monitor_type, name, **kwargs):
"""
A function to connect to a bigip device and create a monitor.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
monitor... |
def p_field_expr(p):
"""
expr : expr FIELD
"""
p[0] = node.expr(
op=".",
args=node.expr_list([
p[1], node.ident(
name=p[2], lineno=p.lineno(2), lexpos=p.lexpos(2))
])) | def function[p_field_expr, parameter[p]]:
constant[
expr : expr FIELD
]
call[name[p]][constant[0]] assign[=] call[name[node].expr, parameter[]] | keyword[def] identifier[p_field_expr] ( identifier[p] ):
literal[string]
identifier[p] [ literal[int] ]= identifier[node] . identifier[expr] (
identifier[op] = literal[string] ,
identifier[args] = identifier[node] . identifier[expr_list] ([
identifier[p] [ literal[int] ], identifier[node] . ... | def p_field_expr(p):
"""
expr : expr FIELD
"""
p[0] = node.expr(op='.', args=node.expr_list([p[1], node.ident(name=p[2], lineno=p.lineno(2), lexpos=p.lexpos(2))])) |
def datasets_list(self, project_id=None, max_results=0, page_token=None):
"""Issues a request to list the datasets in the project.
Args:
project_id: the project id to use to fetch the results; use None for the default project.
max_results: an optional maximum number of tables to retrieve.
pag... | def function[datasets_list, parameter[self, project_id, max_results, page_token]]:
constant[Issues a request to list the datasets in the project.
Args:
project_id: the project id to use to fetch the results; use None for the default project.
max_results: an optional maximum number of tables to ... | keyword[def] identifier[datasets_list] ( identifier[self] , identifier[project_id] = keyword[None] , identifier[max_results] = literal[int] , identifier[page_token] = keyword[None] ):
literal[string]
keyword[if] identifier[project_id] keyword[is] keyword[None] :
identifier[project_id] = identifie... | def datasets_list(self, project_id=None, max_results=0, page_token=None):
"""Issues a request to list the datasets in the project.
Args:
project_id: the project id to use to fetch the results; use None for the default project.
max_results: an optional maximum number of tables to retrieve.
pag... |
def get_relationship_form_for_update(self, relationship_id=None):
"""Gets the relationship form for updating an existing relationship.
A new relationship form should be requested for each update
transaction.
arg: relationship_id (osid.id.Id): the ``Id`` of the
``Rela... | def function[get_relationship_form_for_update, parameter[self, relationship_id]]:
constant[Gets the relationship form for updating an existing relationship.
A new relationship form should be requested for each update
transaction.
arg: relationship_id (osid.id.Id): the ``Id`` of the
... | keyword[def] identifier[get_relationship_form_for_update] ( identifier[self] , identifier[relationship_id] = keyword[None] ):
literal[string]
keyword[if] identifier[relationship_id] keyword[is] keyword[None] :
keyword[raise] identifier[NullArgument] ()
keyword[try] :
... | def get_relationship_form_for_update(self, relationship_id=None):
"""Gets the relationship form for updating an existing relationship.
A new relationship form should be requested for each update
transaction.
arg: relationship_id (osid.id.Id): the ``Id`` of the
``Relation... |
def landm(self, val):
'''
Sets landmarks given any of:
- ppfile
- ldmk file
- dict of {name:inds} (i.e. mesh.landm)
- dict of {name:xyz} (i.e. mesh.landm_xyz)
- Nx1 array or list of ints (treated as landm, given sequential integers as names)
- Nx3 ar... | def function[landm, parameter[self, val]]:
constant[
Sets landmarks given any of:
- ppfile
- ldmk file
- dict of {name:inds} (i.e. mesh.landm)
- dict of {name:xyz} (i.e. mesh.landm_xyz)
- Nx1 array or list of ints (treated as landm, given sequential integers ... | keyword[def] identifier[landm] ( identifier[self] , identifier[val] ):
literal[string]
keyword[import] identifier[numpy] keyword[as] identifier[np]
keyword[if] identifier[val] keyword[is] keyword[None] :
identifier[self] . identifier[_landm] = keyword[None]
... | def landm(self, val):
"""
Sets landmarks given any of:
- ppfile
- ldmk file
- dict of {name:inds} (i.e. mesh.landm)
- dict of {name:xyz} (i.e. mesh.landm_xyz)
- Nx1 array or list of ints (treated as landm, given sequential integers as names)
- Nx3 array ... |
def search_next(self):
"""
Searchs the next search pattern in the document.
:return: Method success.
:rtype: bool
"""
pattern = self.get_selected_text() or self.__search_pattern
if not pattern:
return False
return self.search(pattern, **{"ca... | def function[search_next, parameter[self]]:
constant[
Searchs the next search pattern in the document.
:return: Method success.
:rtype: bool
]
variable[pattern] assign[=] <ast.BoolOp object at 0x7da1b086c160>
if <ast.UnaryOp object at 0x7da1b086f8b0> begin[:]
... | keyword[def] identifier[search_next] ( identifier[self] ):
literal[string]
identifier[pattern] = identifier[self] . identifier[get_selected_text] () keyword[or] identifier[self] . identifier[__search_pattern]
keyword[if] keyword[not] identifier[pattern] :
keyword[return] ... | def search_next(self):
"""
Searchs the next search pattern in the document.
:return: Method success.
:rtype: bool
"""
pattern = self.get_selected_text() or self.__search_pattern
if not pattern:
return False # depends on [control=['if'], data=[]]
return self.sear... |
def match(self, name):
"""
Returns True if name matches one of the patterns.
"""
for pat in self.pats:
if fnmatch.fnmatch(name, pat):
return True
return False | def function[match, parameter[self, name]]:
constant[
Returns True if name matches one of the patterns.
]
for taget[name[pat]] in starred[name[self].pats] begin[:]
if call[name[fnmatch].fnmatch, parameter[name[name], name[pat]]] begin[:]
return[constant[True]]... | keyword[def] identifier[match] ( identifier[self] , identifier[name] ):
literal[string]
keyword[for] identifier[pat] keyword[in] identifier[self] . identifier[pats] :
keyword[if] identifier[fnmatch] . identifier[fnmatch] ( identifier[name] , identifier[pat] ):
keyw... | def match(self, name):
"""
Returns True if name matches one of the patterns.
"""
for pat in self.pats:
if fnmatch.fnmatch(name, pat):
return True # depends on [control=['if'], data=[]] # depends on [control=['for'], data=['pat']]
return False |
def _compute_all_files(self):
"""Handles lazy evaluation of self.all_files"""
self._all_files = any(pat.all_files() for pat in self.patterns) | def function[_compute_all_files, parameter[self]]:
constant[Handles lazy evaluation of self.all_files]
name[self]._all_files assign[=] call[name[any], parameter[<ast.GeneratorExp object at 0x7da1b0a40070>]] | keyword[def] identifier[_compute_all_files] ( identifier[self] ):
literal[string]
identifier[self] . identifier[_all_files] = identifier[any] ( identifier[pat] . identifier[all_files] () keyword[for] identifier[pat] keyword[in] identifier[self] . identifier[patterns] ) | def _compute_all_files(self):
"""Handles lazy evaluation of self.all_files"""
self._all_files = any((pat.all_files() for pat in self.patterns)) |
async def reboot(self):
"""Reboot the device."""
endpoint = '/setup/reboot'
url = API.format(ip=self._ipaddress, endpoint=endpoint)
data = {'params': 'now'}
returnvalue = False
try:
async with async_timeout.timeout(5, loop=self._loop):
result =... | <ast.AsyncFunctionDef object at 0x7da20e955750> | keyword[async] keyword[def] identifier[reboot] ( identifier[self] ):
literal[string]
identifier[endpoint] = literal[string]
identifier[url] = identifier[API] . identifier[format] ( identifier[ip] = identifier[self] . identifier[_ipaddress] , identifier[endpoint] = identifier[endpoint] )
... | async def reboot(self):
"""Reboot the device."""
endpoint = '/setup/reboot'
url = API.format(ip=self._ipaddress, endpoint=endpoint)
data = {'params': 'now'}
returnvalue = False
try:
async with async_timeout.timeout(5, loop=self._loop):
result = await self._session.post(url, j... |
def parse(self, configManager, config):
"""
Parse configuration options out of a YAML configuration file.
Inputs: configManager - Our parent ConfigManager instance which is constructing the Config object.
config - The _Config object containing configuration options popula... | def function[parse, parameter[self, configManager, config]]:
constant[
Parse configuration options out of a YAML configuration file.
Inputs: configManager - Our parent ConfigManager instance which is constructing the Config object.
config - The _Config object containing c... | keyword[def] identifier[parse] ( identifier[self] , identifier[configManager] , identifier[config] ):
literal[string]
identifier[configFile] = identifier[self] . identifier[_getConfigFile] ( identifier[config] )
keyword[if] keyword[not] identifier[configFile] :
keyword[ret... | def parse(self, configManager, config):
"""
Parse configuration options out of a YAML configuration file.
Inputs: configManager - Our parent ConfigManager instance which is constructing the Config object.
config - The _Config object containing configuration options populated ... |
def lookup(self, short_url):
'''
Lookup an URL shortened with `is.gd - v.gd url service <http://is.gd/developers.php>`_ and return the real url
:param short_url: the url shortened with .gd service
:type short_url: str.
:returns: str. -- T... | def function[lookup, parameter[self, short_url]]:
constant[
Lookup an URL shortened with `is.gd - v.gd url service <http://is.gd/developers.php>`_ and return the real url
:param short_url: the url shortened with .gd service
:type short_url: str.
... | keyword[def] identifier[lookup] ( identifier[self] , identifier[short_url] ):
literal[string]
keyword[if] identifier[short_url] keyword[is] keyword[None] keyword[or] keyword[not] identifier[isinstance] ( identifier[short_url] , identifier[basestring] ) keyword[or] identifier[len] ( identifie... | def lookup(self, short_url):
"""
Lookup an URL shortened with `is.gd - v.gd url service <http://is.gd/developers.php>`_ and return the real url
:param short_url: the url shortened with .gd service
:type short_url: str.
:returns: str. -- The o... |
def consume_service(service_agreement_id, service_endpoint, account, files,
destination_folder, index=None):
"""
Call the brizo endpoint to get access to the different files that form the asset.
:param service_agreement_id: Service Agreement Id, str
:param servic... | def function[consume_service, parameter[service_agreement_id, service_endpoint, account, files, destination_folder, index]]:
constant[
Call the brizo endpoint to get access to the different files that form the asset.
:param service_agreement_id: Service Agreement Id, str
:param service_... | keyword[def] identifier[consume_service] ( identifier[service_agreement_id] , identifier[service_endpoint] , identifier[account] , identifier[files] ,
identifier[destination_folder] , identifier[index] = keyword[None] ):
literal[string]
identifier[signature] = identifier[Keeper] . identifier[get_i... | def consume_service(service_agreement_id, service_endpoint, account, files, destination_folder, index=None):
"""
Call the brizo endpoint to get access to the different files that form the asset.
:param service_agreement_id: Service Agreement Id, str
:param service_endpoint: Url to consume, ... |
def running(name,
image=None,
skip_translate=None,
ignore_collisions=False,
validate_ip_addrs=True,
force=False,
watch_action='force',
start=True,
shutdown_timeout=None,
client_timeout=salt.utils.docker.CLIENT_TI... | def function[running, parameter[name, image, skip_translate, ignore_collisions, validate_ip_addrs, force, watch_action, start, shutdown_timeout, client_timeout, networks]]:
constant[
Ensure that a container with a specific configuration is present and
running
name
Name of the container
... | keyword[def] identifier[running] ( identifier[name] ,
identifier[image] = keyword[None] ,
identifier[skip_translate] = keyword[None] ,
identifier[ignore_collisions] = keyword[False] ,
identifier[validate_ip_addrs] = keyword[True] ,
identifier[force] = keyword[False] ,
identifier[watch_action] = literal[string] ... | def running(name, image=None, skip_translate=None, ignore_collisions=False, validate_ip_addrs=True, force=False, watch_action='force', start=True, shutdown_timeout=None, client_timeout=salt.utils.docker.CLIENT_TIMEOUT, networks=None, **kwargs):
"""
Ensure that a container with a specific configuration is presen... |
def unweighed(self):
"""
This method creates a *plain* (unweighted) copy of the internal
formula. As a result, an object of class :class:`CNF` is returned.
Every clause (both hard or soft) of the WCNF formula is copied to
the ``clauses`` variable of the resulting ... | def function[unweighed, parameter[self]]:
constant[
This method creates a *plain* (unweighted) copy of the internal
formula. As a result, an object of class :class:`CNF` is returned.
Every clause (both hard or soft) of the WCNF formula is copied to
the ``clauses``... | keyword[def] identifier[unweighed] ( identifier[self] ):
literal[string]
identifier[cnf] = identifier[CNF] ()
identifier[cnf] . identifier[nv] = identifier[self] . identifier[nv]
identifier[cnf] . identifier[clauses] = identifier[copy] . identifier[deepcopy] ( identifier[self] ... | def unweighed(self):
"""
This method creates a *plain* (unweighted) copy of the internal
formula. As a result, an object of class :class:`CNF` is returned.
Every clause (both hard or soft) of the WCNF formula is copied to
the ``clauses`` variable of the resulting plai... |
def generate_server(raml_root, config):
""" Handle server generation process.
:param raml_root: Instance of ramlfications.raml.RootNode.
:param config: Pyramid Configurator instance.
"""
log.info('Server generation started')
if not raml_root.resources:
return
root_resource = confi... | def function[generate_server, parameter[raml_root, config]]:
constant[ Handle server generation process.
:param raml_root: Instance of ramlfications.raml.RootNode.
:param config: Pyramid Configurator instance.
]
call[name[log].info, parameter[constant[Server generation started]]]
if... | keyword[def] identifier[generate_server] ( identifier[raml_root] , identifier[config] ):
literal[string]
identifier[log] . identifier[info] ( literal[string] )
keyword[if] keyword[not] identifier[raml_root] . identifier[resources] :
keyword[return]
identifier[root_resource] = identi... | def generate_server(raml_root, config):
""" Handle server generation process.
:param raml_root: Instance of ramlfications.raml.RootNode.
:param config: Pyramid Configurator instance.
"""
log.info('Server generation started')
if not raml_root.resources:
return # depends on [control=['if... |
def edit_process(self, update_request, process_type_id):
"""EditProcess.
[Preview API] Edit a process of a specific ID.
:param :class:`<UpdateProcessModel> <azure.devops.v5_0.work_item_tracking_process.models.UpdateProcessModel>` update_request:
:param str process_type_id:
:rtype... | def function[edit_process, parameter[self, update_request, process_type_id]]:
constant[EditProcess.
[Preview API] Edit a process of a specific ID.
:param :class:`<UpdateProcessModel> <azure.devops.v5_0.work_item_tracking_process.models.UpdateProcessModel>` update_request:
:param str proc... | keyword[def] identifier[edit_process] ( identifier[self] , identifier[update_request] , identifier[process_type_id] ):
literal[string]
identifier[route_values] ={}
keyword[if] identifier[process_type_id] keyword[is] keyword[not] keyword[None] :
identifier[route_values] [ l... | def edit_process(self, update_request, process_type_id):
"""EditProcess.
[Preview API] Edit a process of a specific ID.
:param :class:`<UpdateProcessModel> <azure.devops.v5_0.work_item_tracking_process.models.UpdateProcessModel>` update_request:
:param str process_type_id:
:rtype: :c... |
def __create_none_connections(self):
"""!
@brief Creates network without connections.
"""
if (self._conn_represent == conn_represent.MATRIX):
for _ in range(0, self._num_osc, 1):
self._osc_conn.append([False] * self._num_osc);
elif (se... | def function[__create_none_connections, parameter[self]]:
constant[!
@brief Creates network without connections.
]
if compare[name[self]._conn_represent equal[==] name[conn_represent].MATRIX] begin[:]
for taget[name[_]] in starred[call[name[range], parameter[cons... | keyword[def] identifier[__create_none_connections] ( identifier[self] ):
literal[string]
keyword[if] ( identifier[self] . identifier[_conn_represent] == identifier[conn_represent] . identifier[MATRIX] ):
keyword[for] identifier[_] keyword[in] identifier[range] ( literal[int] , id... | def __create_none_connections(self):
"""!
@brief Creates network without connections.
"""
if self._conn_represent == conn_represent.MATRIX:
for _ in range(0, self._num_osc, 1):
self._osc_conn.append([False] * self._num_osc) # depends on [control=['for'], data=[]] #... |
def search_dashboard_for_facets(self, **kwargs): # noqa: E501
"""Lists the values of one or more facets over the customer's non-deleted dashboards # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asy... | def function[search_dashboard_for_facets, parameter[self]]:
constant[Lists the values of one or more facets over the customer's non-deleted dashboards # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass ... | keyword[def] identifier[search_dashboard_for_facets] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] [ literal[string] ]= keyword[True]
keyword[if] identifier[kwargs] . identifier[get] ( literal[string] ):
keyword[return] identifier[self] . i... | def search_dashboard_for_facets(self, **kwargs): # noqa: E501
"Lists the values of one or more facets over the customer's non-deleted dashboards # noqa: E501\n\n # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async... |
def total_sky_cover(self, value=99.0):
"""Corresponds to IDD Field `total_sky_cover` This is the value for
total sky cover (tenths of coverage). (i.e. 1 is 1/10 covered. 10 is
total coverage). (Amount of sky dome in tenths covered by clouds or
obscuring phenomena at the hour indicated a... | def function[total_sky_cover, parameter[self, value]]:
constant[Corresponds to IDD Field `total_sky_cover` This is the value for
total sky cover (tenths of coverage). (i.e. 1 is 1/10 covered. 10 is
total coverage). (Amount of sky dome in tenths covered by clouds or
obscuring phenomena at... | keyword[def] identifier[total_sky_cover] ( identifier[self] , identifier[value] = literal[int] ):
literal[string]
keyword[if] identifier[value] keyword[is] keyword[not] keyword[None] :
keyword[try] :
identifier[value] = identifier[float] ( identifier[value] )
... | def total_sky_cover(self, value=99.0):
"""Corresponds to IDD Field `total_sky_cover` This is the value for
total sky cover (tenths of coverage). (i.e. 1 is 1/10 covered. 10 is
total coverage). (Amount of sky dome in tenths covered by clouds or
obscuring phenomena at the hour indicated at th... |
def _process_response(self, response, marker_elems=None):
"""
Helper to process the xml response from AWS
"""
body = response.read()
#print body
if '<Errors>' not in body:
rs = ResultSet(marker_elems)
h = handler.XmlHandler(rs, self)
xm... | def function[_process_response, parameter[self, response, marker_elems]]:
constant[
Helper to process the xml response from AWS
]
variable[body] assign[=] call[name[response].read, parameter[]]
if compare[constant[<Errors>] <ast.NotIn object at 0x7da2590d7190> name[body]] begin[:... | keyword[def] identifier[_process_response] ( identifier[self] , identifier[response] , identifier[marker_elems] = keyword[None] ):
literal[string]
identifier[body] = identifier[response] . identifier[read] ()
keyword[if] literal[string] keyword[not] keyword[in] identifier[body... | def _process_response(self, response, marker_elems=None):
"""
Helper to process the xml response from AWS
"""
body = response.read()
#print body
if '<Errors>' not in body:
rs = ResultSet(marker_elems)
h = handler.XmlHandler(rs, self)
xml.sax.parseString(body, h)
... |
def make_op_return_outputs(data, inputs, change_address, fee=OP_RETURN_FEE,
send_amount=0, format='bin'):
""" Builds the outputs for an OP_RETURN transaction.
"""
return [
# main output
{ "script_hex": make_op_return_script(data, format=format), "value": send_amoun... | def function[make_op_return_outputs, parameter[data, inputs, change_address, fee, send_amount, format]]:
constant[ Builds the outputs for an OP_RETURN transaction.
]
return[list[[<ast.Dict object at 0x7da1b101a560>, <ast.Dict object at 0x7da1b106cc10>]]] | keyword[def] identifier[make_op_return_outputs] ( identifier[data] , identifier[inputs] , identifier[change_address] , identifier[fee] = identifier[OP_RETURN_FEE] ,
identifier[send_amount] = literal[int] , identifier[format] = literal[string] ):
literal[string]
keyword[return] [
{ literal[string]... | def make_op_return_outputs(data, inputs, change_address, fee=OP_RETURN_FEE, send_amount=0, format='bin'):
""" Builds the outputs for an OP_RETURN transaction.
"""
# main output
# change output
return [{'script_hex': make_op_return_script(data, format=format), 'value': send_amount}, {'script_hex': ma... |
def commit(self, commit):
"""Get data for a given commit
Raises KeyError if a commit is not found or not parsed.
:param commit: repository commit
:type commit: string
"""
try:
return self._commitData(self.repo.commit(commit))
except (ValueError, KeyError, BadObject):
if self._repo_info:
raise... | def function[commit, parameter[self, commit]]:
constant[Get data for a given commit
Raises KeyError if a commit is not found or not parsed.
:param commit: repository commit
:type commit: string
]
<ast.Try object at 0x7da2044c2ec0> | keyword[def] identifier[commit] ( identifier[self] , identifier[commit] ):
literal[string]
keyword[try] :
keyword[return] identifier[self] . identifier[_commitData] ( identifier[self] . identifier[repo] . identifier[commit] ( identifier[commit] ))
keyword[except] ( identifier[ValueError] , identifier[K... | def commit(self, commit):
"""Get data for a given commit
Raises KeyError if a commit is not found or not parsed.
:param commit: repository commit
:type commit: string
"""
try:
return self._commitData(self.repo.commit(commit)) # depends on [control=['try'], data=[]]
except (ValueError, Ke... |
def context(self, mapping_class=DotDictWithAcquisition):
"""return a config as a context that calls close on every item when
it goes out of scope"""
config = None
try:
config = self.get_config(mapping_class=mapping_class)
yield config
finally:
... | def function[context, parameter[self, mapping_class]]:
constant[return a config as a context that calls close on every item when
it goes out of scope]
variable[config] assign[=] constant[None]
<ast.Try object at 0x7da2054a4d90> | keyword[def] identifier[context] ( identifier[self] , identifier[mapping_class] = identifier[DotDictWithAcquisition] ):
literal[string]
identifier[config] = keyword[None]
keyword[try] :
identifier[config] = identifier[self] . identifier[get_config] ( identifier[mapping_class]... | def context(self, mapping_class=DotDictWithAcquisition):
"""return a config as a context that calls close on every item when
it goes out of scope"""
config = None
try:
config = self.get_config(mapping_class=mapping_class)
yield config # depends on [control=['try'], data=[]]
fina... |
def close(self):
"""close(self)"""
if self.isClosed:
raise ValueError("operation illegal for closed doc")
if hasattr(self, '_outline') and self._outline:
self._dropOutline(self._outline)
self._outline = None
self._reset_page_refs()
self.metada... | def function[close, parameter[self]]:
constant[close(self)]
if name[self].isClosed begin[:]
<ast.Raise object at 0x7da18bcc9bd0>
if <ast.BoolOp object at 0x7da18bcca110> begin[:]
call[name[self]._dropOutline, parameter[name[self]._outline]]
name[self]._out... | keyword[def] identifier[close] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[isClosed] :
keyword[raise] identifier[ValueError] ( literal[string] )
keyword[if] identifier[hasattr] ( identifier[self] , literal[string] ) keyword[and] identif... | def close(self):
"""close(self)"""
if self.isClosed:
raise ValueError('operation illegal for closed doc') # depends on [control=['if'], data=[]]
if hasattr(self, '_outline') and self._outline:
self._dropOutline(self._outline)
self._outline = None # depends on [control=['if'], data=... |
def entity_types(args):
""" List entity types in a workspace """
r = fapi.list_entity_types(args.project, args.workspace)
fapi._check_response_code(r, 200)
return r.json().keys() | def function[entity_types, parameter[args]]:
constant[ List entity types in a workspace ]
variable[r] assign[=] call[name[fapi].list_entity_types, parameter[name[args].project, name[args].workspace]]
call[name[fapi]._check_response_code, parameter[name[r], constant[200]]]
return[call[call[na... | keyword[def] identifier[entity_types] ( identifier[args] ):
literal[string]
identifier[r] = identifier[fapi] . identifier[list_entity_types] ( identifier[args] . identifier[project] , identifier[args] . identifier[workspace] )
identifier[fapi] . identifier[_check_response_code] ( identifier[r] , liter... | def entity_types(args):
""" List entity types in a workspace """
r = fapi.list_entity_types(args.project, args.workspace)
fapi._check_response_code(r, 200)
return r.json().keys() |
def _get_bug_attr(bug, attr):
"""Default longdescs/flags case to [] since they may not be present."""
if attr in ("longdescs", "flags"):
return getattr(bug, attr, [])
return getattr(bug, attr) | def function[_get_bug_attr, parameter[bug, attr]]:
constant[Default longdescs/flags case to [] since they may not be present.]
if compare[name[attr] in tuple[[<ast.Constant object at 0x7da1b025ffd0>, <ast.Constant object at 0x7da1b025f040>]]] begin[:]
return[call[name[getattr], parameter[name[bu... | keyword[def] identifier[_get_bug_attr] ( identifier[bug] , identifier[attr] ):
literal[string]
keyword[if] identifier[attr] keyword[in] ( literal[string] , literal[string] ):
keyword[return] identifier[getattr] ( identifier[bug] , identifier[attr] ,[])
keyword[return] identifier[getattr] ... | def _get_bug_attr(bug, attr):
"""Default longdescs/flags case to [] since they may not be present."""
if attr in ('longdescs', 'flags'):
return getattr(bug, attr, []) # depends on [control=['if'], data=['attr']]
return getattr(bug, attr) |
async def message_field(self, msg, field, fvalue=None, obj=None):
"""
Dumps/Loads message field
:param msg:
:param field:
:param fvalue: explicit value for dump
:param obj:
:return:
"""
fname, ftype, params = field[0], field[1], field[2:]
t... | <ast.AsyncFunctionDef object at 0x7da1b244f310> | keyword[async] keyword[def] identifier[message_field] ( identifier[self] , identifier[msg] , identifier[field] , identifier[fvalue] = keyword[None] , identifier[obj] = keyword[None] ):
literal[string]
identifier[fname] , identifier[ftype] , identifier[params] = identifier[field] [ literal[int] ], ... | async def message_field(self, msg, field, fvalue=None, obj=None):
"""
Dumps/Loads message field
:param msg:
:param field:
:param fvalue: explicit value for dump
:param obj:
:return:
"""
(fname, ftype, params) = (field[0], field[1], field[2:])
try:
... |
def _unverified_decode(token):
"""Decodes a token and does no verification.
Args:
token (Union[str, bytes]): The encoded JWT.
Returns:
Tuple[str, str, str, str]: header, payload, signed_section, and
signature.
Raises:
ValueError: if there are an incorrect amount of... | def function[_unverified_decode, parameter[token]]:
constant[Decodes a token and does no verification.
Args:
token (Union[str, bytes]): The encoded JWT.
Returns:
Tuple[str, str, str, str]: header, payload, signed_section, and
signature.
Raises:
ValueError: if t... | keyword[def] identifier[_unverified_decode] ( identifier[token] ):
literal[string]
identifier[token] = identifier[_helpers] . identifier[to_bytes] ( identifier[token] )
keyword[if] identifier[token] . identifier[count] ( literal[string] )!= literal[int] :
keyword[raise] identifier[ValueErr... | def _unverified_decode(token):
"""Decodes a token and does no verification.
Args:
token (Union[str, bytes]): The encoded JWT.
Returns:
Tuple[str, str, str, str]: header, payload, signed_section, and
signature.
Raises:
ValueError: if there are an incorrect amount of... |
def get_install_paths(name):
"""
Return the (distutils) install paths for the named dist.
A dict with ('purelib', 'platlib', 'headers', 'scripts', 'data') keys.
"""
paths = {}
i = get_install_command(name)
for key in install.SCHEME_KEYS:
paths[key] = getattr(i, 'install_' + key)
... | def function[get_install_paths, parameter[name]]:
constant[
Return the (distutils) install paths for the named dist.
A dict with ('purelib', 'platlib', 'headers', 'scripts', 'data') keys.
]
variable[paths] assign[=] dictionary[[], []]
variable[i] assign[=] call[name[get_install_comm... | keyword[def] identifier[get_install_paths] ( identifier[name] ):
literal[string]
identifier[paths] ={}
identifier[i] = identifier[get_install_command] ( identifier[name] )
keyword[for] identifier[key] keyword[in] identifier[install] . identifier[SCHEME_KEYS] :
identifier[paths] [ id... | def get_install_paths(name):
"""
Return the (distutils) install paths for the named dist.
A dict with ('purelib', 'platlib', 'headers', 'scripts', 'data') keys.
"""
paths = {}
i = get_install_command(name)
for key in install.SCHEME_KEYS:
paths[key] = getattr(i, 'install_' + key) # ... |
def show_firmware_version_output_show_firmware_version_build_time(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
show_firmware_version = ET.Element("show_firmware_version")
config = show_firmware_version
output = ET.SubElement(show_firmware_vers... | def function[show_firmware_version_output_show_firmware_version_build_time, parameter[self]]:
constant[Auto Generated Code
]
variable[config] assign[=] call[name[ET].Element, parameter[constant[config]]]
variable[show_firmware_version] assign[=] call[name[ET].Element, parameter[constant[... | keyword[def] identifier[show_firmware_version_output_show_firmware_version_build_time] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[config] = identifier[ET] . identifier[Element] ( literal[string] )
identifier[show_firmware_version] = identifier[ET] . identifier[... | def show_firmware_version_output_show_firmware_version_build_time(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element('config')
show_firmware_version = ET.Element('show_firmware_version')
config = show_firmware_version
output = ET.SubElement(show_firmware_version, 'output')
s... |
def create_project(self, name, description):
"""
Create a new project with the specified name and description
:param name: str: name of the project to create
:param description: str: description of the project to create
:return: Project
"""
return self._create_ite... | def function[create_project, parameter[self, name, description]]:
constant[
Create a new project with the specified name and description
:param name: str: name of the project to create
:param description: str: description of the project to create
:return: Project
]
re... | keyword[def] identifier[create_project] ( identifier[self] , identifier[name] , identifier[description] ):
literal[string]
keyword[return] identifier[self] . identifier[_create_item_response] (
identifier[self] . identifier[data_service] . identifier[create_project] ( identifier[name] , i... | def create_project(self, name, description):
"""
Create a new project with the specified name and description
:param name: str: name of the project to create
:param description: str: description of the project to create
:return: Project
"""
return self._create_item_respon... |
def _generate_url_root(protocol, host, port):
"""
Generate API root URL without resources
:param protocol: Web protocol [HTTP | HTTPS] (string)
:param host: Hostname or IP (string)
:param port: Service port (string)
:return: ROOT url
"""
return URL_ROOT_PA... | def function[_generate_url_root, parameter[protocol, host, port]]:
constant[
Generate API root URL without resources
:param protocol: Web protocol [HTTP | HTTPS] (string)
:param host: Hostname or IP (string)
:param port: Service port (string)
:return: ROOT url
]
... | keyword[def] identifier[_generate_url_root] ( identifier[protocol] , identifier[host] , identifier[port] ):
literal[string]
keyword[return] identifier[URL_ROOT_PATTERN] . identifier[format] ( identifier[protocol] = identifier[protocol] , identifier[host] = identifier[host] , identifier[port] = ide... | def _generate_url_root(protocol, host, port):
"""
Generate API root URL without resources
:param protocol: Web protocol [HTTP | HTTPS] (string)
:param host: Hostname or IP (string)
:param port: Service port (string)
:return: ROOT url
"""
return URL_ROOT_PATTERN.fo... |
def get_default_user_groups(self, **kwargs): # noqa: E501
"""Get default user groups customer preferences # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_... | def function[get_default_user_groups, parameter[self]]:
constant[Get default user groups customer preferences # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.g... | keyword[def] identifier[get_default_user_groups] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] [ literal[string] ]= keyword[True]
keyword[if] identifier[kwargs] . identifier[get] ( literal[string] ):
keyword[return] identifier[self] . ident... | def get_default_user_groups(self, **kwargs): # noqa: E501
'Get default user groups customer preferences # noqa: E501\n\n # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.get_d... |
def parse_market(self, market, split_char='_'):
"""
In comes the market identifier directly from the service. Returned is
the crypto and fiat identifier in moneywagon format.
"""
crypto, fiat = market.lower().split(split_char)
return (
self.fix_symbol(crypto, ... | def function[parse_market, parameter[self, market, split_char]]:
constant[
In comes the market identifier directly from the service. Returned is
the crypto and fiat identifier in moneywagon format.
]
<ast.Tuple object at 0x7da1b11bd030> assign[=] call[call[name[market].lower, par... | keyword[def] identifier[parse_market] ( identifier[self] , identifier[market] , identifier[split_char] = literal[string] ):
literal[string]
identifier[crypto] , identifier[fiat] = identifier[market] . identifier[lower] (). identifier[split] ( identifier[split_char] )
keyword[return] (
... | def parse_market(self, market, split_char='_'):
"""
In comes the market identifier directly from the service. Returned is
the crypto and fiat identifier in moneywagon format.
"""
(crypto, fiat) = market.lower().split(split_char)
return (self.fix_symbol(crypto, reverse=True), self.fix... |
def discombobulate(self, filehash):
""" prepare napiprojekt scrambled hash """
idx = [0xe, 0x3, 0x6, 0x8, 0x2]
mul = [2, 2, 5, 4, 3]
add = [0, 0xd, 0x10, 0xb, 0x5]
b = []
for i in xrange(len(idx)):
a = add[i]
m = mul[i]
i = idx[i]
... | def function[discombobulate, parameter[self, filehash]]:
constant[ prepare napiprojekt scrambled hash ]
variable[idx] assign[=] list[[<ast.Constant object at 0x7da2047e9d20>, <ast.Constant object at 0x7da2047ea1d0>, <ast.Constant object at 0x7da2047e8070>, <ast.Constant object at 0x7da2047e8b80>, <ast.C... | keyword[def] identifier[discombobulate] ( identifier[self] , identifier[filehash] ):
literal[string]
identifier[idx] =[ literal[int] , literal[int] , literal[int] , literal[int] , literal[int] ]
identifier[mul] =[ literal[int] , literal[int] , literal[int] , literal[int] , literal[int] ]
... | def discombobulate(self, filehash):
""" prepare napiprojekt scrambled hash """
idx = [14, 3, 6, 8, 2]
mul = [2, 2, 5, 4, 3]
add = [0, 13, 16, 11, 5]
b = []
for i in xrange(len(idx)):
a = add[i]
m = mul[i]
i = idx[i]
t = a + int(filehash[i], 16)
v = int(fil... |
def op_at_code_loc(code, loc, opc):
"""Return the instruction name at code[loc] using
opc to look up instruction names. Returns 'got IndexError'
if code[loc] is invalid.
`code` is instruction bytecode, `loc` is an offset (integer) and
`opc` is an opcode module from `xdis`.
"""
try:
... | def function[op_at_code_loc, parameter[code, loc, opc]]:
constant[Return the instruction name at code[loc] using
opc to look up instruction names. Returns 'got IndexError'
if code[loc] is invalid.
`code` is instruction bytecode, `loc` is an offset (integer) and
`opc` is an opcode module from `x... | keyword[def] identifier[op_at_code_loc] ( identifier[code] , identifier[loc] , identifier[opc] ):
literal[string]
keyword[try] :
identifier[op] = identifier[code] [ identifier[loc] ]
keyword[except] identifier[IndexError] :
keyword[return] literal[string]
keyword[return] ide... | def op_at_code_loc(code, loc, opc):
"""Return the instruction name at code[loc] using
opc to look up instruction names. Returns 'got IndexError'
if code[loc] is invalid.
`code` is instruction bytecode, `loc` is an offset (integer) and
`opc` is an opcode module from `xdis`.
"""
try:
... |
def get_mfd(self, slip, area, shear_modulus=30.0):
'''
Calculates activity rate on the fault
:param float slip:
Slip rate in mm/yr
:param fault_width:
Width of the fault (km)
:param float disp_length_ratio:
Displacement to length ratio (dime... | def function[get_mfd, parameter[self, slip, area, shear_modulus]]:
constant[
Calculates activity rate on the fault
:param float slip:
Slip rate in mm/yr
:param fault_width:
Width of the fault (km)
:param float disp_length_ratio:
Displacement... | keyword[def] identifier[get_mfd] ( identifier[self] , identifier[slip] , identifier[area] , identifier[shear_modulus] = literal[int] ):
literal[string]
identifier[moment_rate] =( identifier[shear_modulus] * literal[int] )*( identifier[area] * literal[int] )*( identifier[s... | def get_mfd(self, slip, area, shear_modulus=30.0):
"""
Calculates activity rate on the fault
:param float slip:
Slip rate in mm/yr
:param fault_width:
Width of the fault (km)
:param float disp_length_ratio:
Displacement to length ratio (dimensio... |
def _render_cmd(cmd, cwd, template, saltenv='base', pillarenv=None, pillar_override=None):
'''
If template is a valid template engine, process the cmd and cwd through
that engine.
'''
if not template:
return (cmd, cwd)
# render the path as a template using path_template_engine as the en... | def function[_render_cmd, parameter[cmd, cwd, template, saltenv, pillarenv, pillar_override]]:
constant[
If template is a valid template engine, process the cmd and cwd through
that engine.
]
if <ast.UnaryOp object at 0x7da1b21874c0> begin[:]
return[tuple[[<ast.Name object at 0x7da1b... | keyword[def] identifier[_render_cmd] ( identifier[cmd] , identifier[cwd] , identifier[template] , identifier[saltenv] = literal[string] , identifier[pillarenv] = keyword[None] , identifier[pillar_override] = keyword[None] ):
literal[string]
keyword[if] keyword[not] identifier[template] :
keyword... | def _render_cmd(cmd, cwd, template, saltenv='base', pillarenv=None, pillar_override=None):
"""
If template is a valid template engine, process the cmd and cwd through
that engine.
"""
if not template:
return (cmd, cwd) # depends on [control=['if'], data=[]]
# render the path as a templa... |
def file_exists(self, fid):
"""Checks if file with provided fid exists
Args:
**fid**: File identifier <volume_id>,<file_name_hash>
Returns:
True if file exists. False if not.
"""
res = self.get_file_size(fid)
if res is not None:
retur... | def function[file_exists, parameter[self, fid]]:
constant[Checks if file with provided fid exists
Args:
**fid**: File identifier <volume_id>,<file_name_hash>
Returns:
True if file exists. False if not.
]
variable[res] assign[=] call[name[self].get_file_s... | keyword[def] identifier[file_exists] ( identifier[self] , identifier[fid] ):
literal[string]
identifier[res] = identifier[self] . identifier[get_file_size] ( identifier[fid] )
keyword[if] identifier[res] keyword[is] keyword[not] keyword[None] :
keyword[return] keyword[Tru... | def file_exists(self, fid):
"""Checks if file with provided fid exists
Args:
**fid**: File identifier <volume_id>,<file_name_hash>
Returns:
True if file exists. False if not.
"""
res = self.get_file_size(fid)
if res is not None:
return True # depend... |
def prefix_indent(prefix, textblock, later_prefix=' '):
"""
Prefix and indent all lines in *textblock*.
*prefix* is a prefix string
*later_prefix* is used on all but the first line, if it is a single character
it will be repeated to match length of *prefix*
"""
textblock = te... | def function[prefix_indent, parameter[prefix, textblock, later_prefix]]:
constant[
Prefix and indent all lines in *textblock*.
*prefix* is a prefix string
*later_prefix* is used on all but the first line, if it is a single character
it will be repeated to match length of *prefix*... | keyword[def] identifier[prefix_indent] ( identifier[prefix] , identifier[textblock] , identifier[later_prefix] = literal[string] ):
literal[string]
identifier[textblock] = identifier[textblock] . identifier[split] ( literal[string] )
identifier[line] = identifier[prefix] + identifier[textblock] [ lite... | def prefix_indent(prefix, textblock, later_prefix=' '):
"""
Prefix and indent all lines in *textblock*.
*prefix* is a prefix string
*later_prefix* is used on all but the first line, if it is a single character
it will be repeated to match length of *prefix*
"""
textblock = te... |
def _get_row_amplitudes(self):
"""
Perform a real Discrete Fourier Transform (DFT; implemented
using a Fast Fourier Transform algorithm, FFT) of the current
sample from the signal multiplied by the smoothing window.
See numpy.rfft for information about the Fourier transform.
... | def function[_get_row_amplitudes, parameter[self]]:
constant[
Perform a real Discrete Fourier Transform (DFT; implemented
using a Fast Fourier Transform algorithm, FFT) of the current
sample from the signal multiplied by the smoothing window.
See numpy.rfft for information about... | keyword[def] identifier[_get_row_amplitudes] ( identifier[self] ):
literal[string]
identifier[sample_rate] = identifier[self] . identifier[signal] . identifier[sample_rate]
identifier[signal_window] = identifier[tile] ( identifier[self] . identifier[signal] (), identifier[ceil]... | def _get_row_amplitudes(self):
"""
Perform a real Discrete Fourier Transform (DFT; implemented
using a Fast Fourier Transform algorithm, FFT) of the current
sample from the signal multiplied by the smoothing window.
See numpy.rfft for information about the Fourier transform.
... |
def pca(onarray, offarray, n=10, exchs=None, pc=False, mode='mean'):
"""Apply Principal Component Analysis (PCA) method to estimate baselines at each time.
Args:
onarray (decode.array): Decode array of on-point observations.
offarray (decode.array): Decode array of off-point observations.
... | def function[pca, parameter[onarray, offarray, n, exchs, pc, mode]]:
constant[Apply Principal Component Analysis (PCA) method to estimate baselines at each time.
Args:
onarray (decode.array): Decode array of on-point observations.
offarray (decode.array): Decode array of off-point observati... | keyword[def] identifier[pca] ( identifier[onarray] , identifier[offarray] , identifier[n] = literal[int] , identifier[exchs] = keyword[None] , identifier[pc] = keyword[False] , identifier[mode] = literal[string] ):
literal[string]
identifier[logger] = identifier[getLogger] ( literal[string] )
identifi... | def pca(onarray, offarray, n=10, exchs=None, pc=False, mode='mean'):
"""Apply Principal Component Analysis (PCA) method to estimate baselines at each time.
Args:
onarray (decode.array): Decode array of on-point observations.
offarray (decode.array): Decode array of off-point observations.
... |
def _buildStartOpts(self, streamUrl, playList=False):
""" Builds the options to pass to subprocess."""
#opts = [self.PLAYER_CMD, "-Irc", "--quiet", streamUrl]
opts = [self.PLAYER_CMD, "-Irc", "-vv", streamUrl]
return opts | def function[_buildStartOpts, parameter[self, streamUrl, playList]]:
constant[ Builds the options to pass to subprocess.]
variable[opts] assign[=] list[[<ast.Attribute object at 0x7da1b1116470>, <ast.Constant object at 0x7da1b1117a90>, <ast.Constant object at 0x7da1b11179a0>, <ast.Name object at 0x7da1b... | keyword[def] identifier[_buildStartOpts] ( identifier[self] , identifier[streamUrl] , identifier[playList] = keyword[False] ):
literal[string]
identifier[opts] =[ identifier[self] . identifier[PLAYER_CMD] , literal[string] , literal[string] , identifier[streamUrl] ]
keyword[return... | def _buildStartOpts(self, streamUrl, playList=False):
""" Builds the options to pass to subprocess."""
#opts = [self.PLAYER_CMD, "-Irc", "--quiet", streamUrl]
opts = [self.PLAYER_CMD, '-Irc', '-vv', streamUrl]
return opts |
def _proxy(self):
"""
Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context
:returns: SyncStreamContext for this SyncStreamInstance
:rtype: twilio.rest.sync.v1.service.sync_stream.Syn... | def function[_proxy, parameter[self]]:
constant[
Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context
:returns: SyncStreamContext for this SyncStreamInstance
:rtype: twilio.rest.sync... | keyword[def] identifier[_proxy] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_context] keyword[is] keyword[None] :
identifier[self] . identifier[_context] = identifier[SyncStreamContext] (
identifier[self] . identifier[_version] ,
... | def _proxy(self):
"""
Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context
:returns: SyncStreamContext for this SyncStreamInstance
:rtype: twilio.rest.sync.v1.service.sync_stream.SyncStr... |
def standard_suggestions(self):
"""Standard generic suggestions.
:return: List of standard suggestions for users who encounter errors.
:rtype: BulletedList
"""
suggestions = BulletedList()
suggestions.add(
'Check that you have the latest version of InaSAFE in... | def function[standard_suggestions, parameter[self]]:
constant[Standard generic suggestions.
:return: List of standard suggestions for users who encounter errors.
:rtype: BulletedList
]
variable[suggestions] assign[=] call[name[BulletedList], parameter[]]
call[name[sugges... | keyword[def] identifier[standard_suggestions] ( identifier[self] ):
literal[string]
identifier[suggestions] = identifier[BulletedList] ()
identifier[suggestions] . identifier[add] (
literal[string]
literal[string]
literal[string] )
identifier[suggestio... | def standard_suggestions(self):
"""Standard generic suggestions.
:return: List of standard suggestions for users who encounter errors.
:rtype: BulletedList
"""
suggestions = BulletedList()
suggestions.add('Check that you have the latest version of InaSAFE installed - you may have en... |
def write_vars(self,fh):
"""
Write the variable (macro) options and arguments to the DAG file
descriptor.
@param fh: descriptor of open DAG file.
"""
if self.__macros.keys() or self.__opts.keys() or self.__args:
fh.write( 'VARS ' + self.__name )
for k in self.__macros.keys():
fh.... | def function[write_vars, parameter[self, fh]]:
constant[
Write the variable (macro) options and arguments to the DAG file
descriptor.
@param fh: descriptor of open DAG file.
]
if <ast.BoolOp object at 0x7da1b0a32800> begin[:]
call[name[fh].write, parameter[binary_operatio... | keyword[def] identifier[write_vars] ( identifier[self] , identifier[fh] ):
literal[string]
keyword[if] identifier[self] . identifier[__macros] . identifier[keys] () keyword[or] identifier[self] . identifier[__opts] . identifier[keys] () keyword[or] identifier[self] . identifier[__args] :
identifi... | def write_vars(self, fh):
"""
Write the variable (macro) options and arguments to the DAG file
descriptor.
@param fh: descriptor of open DAG file.
"""
if self.__macros.keys() or self.__opts.keys() or self.__args:
fh.write('VARS ' + self.__name) # depends on [control=['if'], data=[]]
... |
def search(self, query: Optional[dict] = None,
offset: int = 0,
limit: Optional[int] = None,
order_by: Optional[tuple] = None,
secure: bool = False) -> List[IModel]:
"""Search for models
Filtering is done through ``rulez`` based JSON/dict quer... | def function[search, parameter[self, query, offset, limit, order_by, secure]]:
constant[Search for models
Filtering is done through ``rulez`` based JSON/dict query, which
defines boolean statements in JSON/dict structure.
: param query: Rulez based query
: param offset: Result ... | keyword[def] identifier[search] ( identifier[self] , identifier[query] : identifier[Optional] [ identifier[dict] ]= keyword[None] ,
identifier[offset] : identifier[int] = literal[int] ,
identifier[limit] : identifier[Optional] [ identifier[int] ]= keyword[None] ,
identifier[order_by] : identifier[Optional] [ ident... | def search(self, query: Optional[dict]=None, offset: int=0, limit: Optional[int]=None, order_by: Optional[tuple]=None, secure: bool=False) -> List[IModel]:
"""Search for models
Filtering is done through ``rulez`` based JSON/dict query, which
defines boolean statements in JSON/dict structure.
... |
def evalRanges(self, datetimeString, sourceTime=None):
"""
Evaluate the C{datetimeString} text and determine if
it represents a date or time range.
@type datetimeString: string
@param datetimeString: datetime text to evaluate
@type sourceTime: struct_time
@... | def function[evalRanges, parameter[self, datetimeString, sourceTime]]:
constant[
Evaluate the C{datetimeString} text and determine if
it represents a date or time range.
@type datetimeString: string
@param datetimeString: datetime text to evaluate
@type sourceTime: ... | keyword[def] identifier[evalRanges] ( identifier[self] , identifier[datetimeString] , identifier[sourceTime] = keyword[None] ):
literal[string]
identifier[rangeFlag] = identifier[retFlag] = literal[int]
identifier[startStr] = identifier[endStr] = literal[string]
identifier[s] =... | def evalRanges(self, datetimeString, sourceTime=None):
"""
Evaluate the C{datetimeString} text and determine if
it represents a date or time range.
@type datetimeString: string
@param datetimeString: datetime text to evaluate
@type sourceTime: struct_time
@para... |
async def refresh_token(self, refresh_token):
"""
:param refresh_token: an openid refresh-token from a previous token request
"""
async with self._client_session() as client:
well_known = await self._get_well_known(client)
try:
return await self._... | <ast.AsyncFunctionDef object at 0x7da20c6c45b0> | keyword[async] keyword[def] identifier[refresh_token] ( identifier[self] , identifier[refresh_token] ):
literal[string]
keyword[async] keyword[with] identifier[self] . identifier[_client_session] () keyword[as] identifier[client] :
identifier[well_known] = keyword[await] identifie... | async def refresh_token(self, refresh_token):
"""
:param refresh_token: an openid refresh-token from a previous token request
"""
async with self._client_session() as client:
well_known = await self._get_well_known(client)
try:
return await self._post(client, well_kno... |
def b(field: str, kwargs: Dict[str, Any],
present: Optional[Any] = None, missing: Any = '') -> str:
"""
Return `present` value (default to `field`) if `field` in `kwargs` and
Truthy, otherwise return `missing` value
"""
if kwargs.get(field):
return field if present is None else str(pre... | def function[b, parameter[field, kwargs, present, missing]]:
constant[
Return `present` value (default to `field`) if `field` in `kwargs` and
Truthy, otherwise return `missing` value
]
if call[name[kwargs].get, parameter[name[field]]] begin[:]
return[<ast.IfExp object at 0x7da1b0fc62... | keyword[def] identifier[b] ( identifier[field] : identifier[str] , identifier[kwargs] : identifier[Dict] [ identifier[str] , identifier[Any] ],
identifier[present] : identifier[Optional] [ identifier[Any] ]= keyword[None] , identifier[missing] : identifier[Any] = literal[string] )-> identifier[str] :
literal[st... | def b(field: str, kwargs: Dict[str, Any], present: Optional[Any]=None, missing: Any='') -> str:
"""
Return `present` value (default to `field`) if `field` in `kwargs` and
Truthy, otherwise return `missing` value
"""
if kwargs.get(field):
return field if present is None else str(present) # d... |
def send_respawn(self):
"""
Respawns the player.
"""
nick = self.player.nick
self.send_struct('<B%iH' % len(nick), 0, *map(ord, nick)) | def function[send_respawn, parameter[self]]:
constant[
Respawns the player.
]
variable[nick] assign[=] name[self].player.nick
call[name[self].send_struct, parameter[binary_operation[constant[<B%iH] <ast.Mod object at 0x7da2590d6920> call[name[len], parameter[name[nick]]]], consta... | keyword[def] identifier[send_respawn] ( identifier[self] ):
literal[string]
identifier[nick] = identifier[self] . identifier[player] . identifier[nick]
identifier[self] . identifier[send_struct] ( literal[string] % identifier[len] ( identifier[nick] ), literal[int] ,* identifier[map] ( id... | def send_respawn(self):
"""
Respawns the player.
"""
nick = self.player.nick
self.send_struct('<B%iH' % len(nick), 0, *map(ord, nick)) |
def create_tasks_dict(self, ast):
'''
Parse each "Task" in the AST. This will create self.tasks_dictionary,
where each task name is a key.
:return: Creates the self.tasks_dictionary necessary for much of the
parser. Returning it is only necessary for unittests.
'''
... | def function[create_tasks_dict, parameter[self, ast]]:
constant[
Parse each "Task" in the AST. This will create self.tasks_dictionary,
where each task name is a key.
:return: Creates the self.tasks_dictionary necessary for much of the
parser. Returning it is only necessary for... | keyword[def] identifier[create_tasks_dict] ( identifier[self] , identifier[ast] ):
literal[string]
identifier[tasks] = identifier[self] . identifier[find_asts] ( identifier[ast] , literal[string] )
keyword[for] identifier[task] keyword[in] identifier[tasks] :
identifier[sel... | def create_tasks_dict(self, ast):
"""
Parse each "Task" in the AST. This will create self.tasks_dictionary,
where each task name is a key.
:return: Creates the self.tasks_dictionary necessary for much of the
parser. Returning it is only necessary for unittests.
"""
tas... |
def remove_all(gset, elem):
"""Removes every occurrence of ``elem`` from ``gset``.
Returns the number of times ``elem`` was removed.
"""
n = 0
while True:
try:
remove_once(gset, elem)
n = n + 1
except RemoveError:
return n | def function[remove_all, parameter[gset, elem]]:
constant[Removes every occurrence of ``elem`` from ``gset``.
Returns the number of times ``elem`` was removed.
]
variable[n] assign[=] constant[0]
while constant[True] begin[:]
<ast.Try object at 0x7da18c4cf010> | keyword[def] identifier[remove_all] ( identifier[gset] , identifier[elem] ):
literal[string]
identifier[n] = literal[int]
keyword[while] keyword[True] :
keyword[try] :
identifier[remove_once] ( identifier[gset] , identifier[elem] )
identifier[n] = identifier[n] + l... | def remove_all(gset, elem):
"""Removes every occurrence of ``elem`` from ``gset``.
Returns the number of times ``elem`` was removed.
"""
n = 0
while True:
try:
remove_once(gset, elem)
n = n + 1 # depends on [control=['try'], data=[]]
except RemoveError:
... |
def _transform_delta(f:Formula, formula2AtomicFormula):
"""From a Propositional Formula to a Propositional Formula
with non-propositional subformulas replaced with a "freezed" atomic formula."""
t = type(f)
if t == PLNot:
return PLNot(_transform_delta(f, formula2AtomicFormula))
# elif isinst... | def function[_transform_delta, parameter[f, formula2AtomicFormula]]:
constant[From a Propositional Formula to a Propositional Formula
with non-propositional subformulas replaced with a "freezed" atomic formula.]
variable[t] assign[=] call[name[type], parameter[name[f]]]
if compare[name[t] eq... | keyword[def] identifier[_transform_delta] ( identifier[f] : identifier[Formula] , identifier[formula2AtomicFormula] ):
literal[string]
identifier[t] = identifier[type] ( identifier[f] )
keyword[if] identifier[t] == identifier[PLNot] :
keyword[return] identifier[PLNot] ( identifier[_transfor... | def _transform_delta(f: Formula, formula2AtomicFormula):
"""From a Propositional Formula to a Propositional Formula
with non-propositional subformulas replaced with a "freezed" atomic formula."""
t = type(f)
if t == PLNot:
return PLNot(_transform_delta(f, formula2AtomicFormula)) # depends on [c... |
async def listCronJobs(self):
'''
Get information about all the cron jobs accessible to the current user
'''
crons = []
for iden, cron in self.cell.agenda.list():
useriden = cron['useriden']
if not (self.user.admin or useriden == self.user.iden):
... | <ast.AsyncFunctionDef object at 0x7da1b23d02e0> | keyword[async] keyword[def] identifier[listCronJobs] ( identifier[self] ):
literal[string]
identifier[crons] =[]
keyword[for] identifier[iden] , identifier[cron] keyword[in] identifier[self] . identifier[cell] . identifier[agenda] . identifier[list] ():
identifier[useriden... | async def listCronJobs(self):
"""
Get information about all the cron jobs accessible to the current user
"""
crons = []
for (iden, cron) in self.cell.agenda.list():
useriden = cron['useriden']
if not (self.user.admin or useriden == self.user.iden):
continue # dep... |
def decrypt(crypt_text) -> str:
""" Use config.json key to decrypt """
cipher = Fernet(current_app.config['KEY'])
if not isinstance(crypt_text, bytes):
crypt_text = str.encode(crypt_text)
return cipher.decrypt(crypt_text).decode("utf-8") | def function[decrypt, parameter[crypt_text]]:
constant[ Use config.json key to decrypt ]
variable[cipher] assign[=] call[name[Fernet], parameter[call[name[current_app].config][constant[KEY]]]]
if <ast.UnaryOp object at 0x7da1b287c340> begin[:]
variable[crypt_text] assign[=] call[... | keyword[def] identifier[decrypt] ( identifier[crypt_text] )-> identifier[str] :
literal[string]
identifier[cipher] = identifier[Fernet] ( identifier[current_app] . identifier[config] [ literal[string] ])
keyword[if] keyword[not] identifier[isinstance] ( identifier[crypt_text] , identi... | def decrypt(crypt_text) -> str:
""" Use config.json key to decrypt """
cipher = Fernet(current_app.config['KEY'])
if not isinstance(crypt_text, bytes):
crypt_text = str.encode(crypt_text) # depends on [control=['if'], data=[]]
return cipher.decrypt(crypt_text).decode('utf-8') |
def applications(self):
"""
Access the applications
:returns: twilio.rest.api.v2010.account.application.ApplicationList
:rtype: twilio.rest.api.v2010.account.application.ApplicationList
"""
if self._applications is None:
self._applications = ApplicationList(s... | def function[applications, parameter[self]]:
constant[
Access the applications
:returns: twilio.rest.api.v2010.account.application.ApplicationList
:rtype: twilio.rest.api.v2010.account.application.ApplicationList
]
if compare[name[self]._applications is constant[None]] b... | keyword[def] identifier[applications] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_applications] keyword[is] keyword[None] :
identifier[self] . identifier[_applications] = identifier[ApplicationList] ( identifier[self] . identifier[_version] , ide... | def applications(self):
"""
Access the applications
:returns: twilio.rest.api.v2010.account.application.ApplicationList
:rtype: twilio.rest.api.v2010.account.application.ApplicationList
"""
if self._applications is None:
self._applications = ApplicationList(self._version... |
def emit_containers(self, containers, verbose=True):
"""
Emits the applications and sorts containers by name
:param containers: List of the container definitions
:type containers: list of dict
:param verbose: Print out newlines and indented JSON
:type verbose: bool
... | def function[emit_containers, parameter[self, containers, verbose]]:
constant[
Emits the applications and sorts containers by name
:param containers: List of the container definitions
:type containers: list of dict
:param verbose: Print out newlines and indented JSON
:t... | keyword[def] identifier[emit_containers] ( identifier[self] , identifier[containers] , identifier[verbose] = keyword[True] ):
literal[string]
identifier[containers] = identifier[sorted] ( identifier[containers] , identifier[key] = keyword[lambda] identifier[c] : identifier[c] . identifier[get] ( l... | def emit_containers(self, containers, verbose=True):
"""
Emits the applications and sorts containers by name
:param containers: List of the container definitions
:type containers: list of dict
:param verbose: Print out newlines and indented JSON
:type verbose: bool
... |
def _superclasses_for_subject(self, graph, typeof):
"""helper, returns a list of all superclasses of a given class"""
# TODO - this might be replacing a fairly simple graph API query where
# it doesn't need to
classes = []
superclass = typeof
while True:
found... | def function[_superclasses_for_subject, parameter[self, graph, typeof]]:
constant[helper, returns a list of all superclasses of a given class]
variable[classes] assign[=] list[[]]
variable[superclass] assign[=] name[typeof]
while constant[True] begin[:]
variable[found] as... | keyword[def] identifier[_superclasses_for_subject] ( identifier[self] , identifier[graph] , identifier[typeof] ):
literal[string]
identifier[classes] =[]
identifier[superclass] = identifier[typeof]
keyword[while] keyword[True] :
identifier[found] =... | def _superclasses_for_subject(self, graph, typeof):
"""helper, returns a list of all superclasses of a given class"""
# TODO - this might be replacing a fairly simple graph API query where
# it doesn't need to
classes = []
superclass = typeof
while True:
found = False
for (p, o) ... |
def get_bibtex(isbn_identifier):
"""
Get a BibTeX string for the given ISBN.
:param isbn_identifier: ISBN to fetch BibTeX entry for.
:returns: A BibTeX string or ``None`` if could not fetch it.
>>> get_bibtex('9783161484100')
'@book{9783161484100,\\n title = {Berkeley, Oakland: Albany, Eme... | def function[get_bibtex, parameter[isbn_identifier]]:
constant[
Get a BibTeX string for the given ISBN.
:param isbn_identifier: ISBN to fetch BibTeX entry for.
:returns: A BibTeX string or ``None`` if could not fetch it.
>>> get_bibtex('9783161484100')
'@book{9783161484100,\n title = {... | keyword[def] identifier[get_bibtex] ( identifier[isbn_identifier] ):
literal[string]
identifier[bibtex] = identifier[doi] . identifier[get_bibtex] ( identifier[to_doi] ( identifier[isbn_identifier] ))
keyword[if] identifier[bibtex] keyword[is] keyword[None] :
identifier... | def get_bibtex(isbn_identifier):
"""
Get a BibTeX string for the given ISBN.
:param isbn_identifier: ISBN to fetch BibTeX entry for.
:returns: A BibTeX string or ``None`` if could not fetch it.
>>> get_bibtex('9783161484100')
'@book{9783161484100,\\n title = {Berkeley, Oakland: Albany, Eme... |
def solve(self):
"""Run the ACE calculational loop."""
self._initialize()
while self._outer_error_is_decreasing() and self._outer_iters < MAX_OUTERS:
print('* Starting outer iteration {0:03d}. Current err = {1:12.5E}'
''.format(self._outer_iters, self._last_outer_er... | def function[solve, parameter[self]]:
constant[Run the ACE calculational loop.]
call[name[self]._initialize, parameter[]]
while <ast.BoolOp object at 0x7da1b19b59c0> begin[:]
call[name[print], parameter[call[constant[* Starting outer iteration {0:03d}. Current err = {1:12.5E}].fo... | keyword[def] identifier[solve] ( identifier[self] ):
literal[string]
identifier[self] . identifier[_initialize] ()
keyword[while] identifier[self] . identifier[_outer_error_is_decreasing] () keyword[and] identifier[self] . identifier[_outer_iters] < identifier[MAX_OUTERS] :
... | def solve(self):
"""Run the ACE calculational loop."""
self._initialize()
while self._outer_error_is_decreasing() and self._outer_iters < MAX_OUTERS:
print('* Starting outer iteration {0:03d}. Current err = {1:12.5E}'.format(self._outer_iters, self._last_outer_error))
self._iterate_to_update... |
def wrap_arguments(args=None):
"""Wrap a list of tuples in xml ready to pass into a SOAP request.
Args:
args (list): a list of (name, value) tuples specifying the
name of each argument and its value, eg
``[('InstanceID', 0), ('Speed', 1)]``. The value
... | def function[wrap_arguments, parameter[args]]:
constant[Wrap a list of tuples in xml ready to pass into a SOAP request.
Args:
args (list): a list of (name, value) tuples specifying the
name of each argument and its value, eg
``[('InstanceID', 0), ('Speed', 1... | keyword[def] identifier[wrap_arguments] ( identifier[args] = keyword[None] ):
literal[string]
keyword[if] identifier[args] keyword[is] keyword[None] :
identifier[args] =[]
identifier[tags] =[]
keyword[for] identifier[name] , identifier[value] keyword[in] identi... | def wrap_arguments(args=None):
"""Wrap a list of tuples in xml ready to pass into a SOAP request.
Args:
args (list): a list of (name, value) tuples specifying the
name of each argument and its value, eg
``[('InstanceID', 0), ('Speed', 1)]``. The value
... |
def get(args):
"""
invoke wptools and assemble selected output
"""
html = args.H
lang = args.l
nowrap = args.n
query = args.q
silent = args.s
title = args.t
verbose = args.v
wiki = args.w
if query:
qobj = WPToolsQuery(lang=lang, wiki=wiki)
if title:
... | def function[get, parameter[args]]:
constant[
invoke wptools and assemble selected output
]
variable[html] assign[=] name[args].H
variable[lang] assign[=] name[args].l
variable[nowrap] assign[=] name[args].n
variable[query] assign[=] name[args].q
variable[silent] ... | keyword[def] identifier[get] ( identifier[args] ):
literal[string]
identifier[html] = identifier[args] . identifier[H]
identifier[lang] = identifier[args] . identifier[l]
identifier[nowrap] = identifier[args] . identifier[n]
identifier[query] = identifier[args] . identifier[q]
iden... | def get(args):
"""
invoke wptools and assemble selected output
"""
html = args.H
lang = args.l
nowrap = args.n
query = args.q
silent = args.s
title = args.t
verbose = args.v
wiki = args.w
if query:
qobj = WPToolsQuery(lang=lang, wiki=wiki)
if title:
... |
def get_sub_area(area, xslice, yslice):
"""Apply slices to the area_extent and size of the area."""
new_area_extent = ((area.pixel_upper_left[0] +
(xslice.start - 0.5) * area.pixel_size_x),
(area.pixel_upper_left[1] -
(yslice.stop - 0.5) * a... | def function[get_sub_area, parameter[area, xslice, yslice]]:
constant[Apply slices to the area_extent and size of the area.]
variable[new_area_extent] assign[=] tuple[[<ast.BinOp object at 0x7da1b1d6f070>, <ast.BinOp object at 0x7da1b22a4160>, <ast.BinOp object at 0x7da1b22a58a0>, <ast.BinOp object at 0... | keyword[def] identifier[get_sub_area] ( identifier[area] , identifier[xslice] , identifier[yslice] ):
literal[string]
identifier[new_area_extent] =(( identifier[area] . identifier[pixel_upper_left] [ literal[int] ]+
( identifier[xslice] . identifier[start] - literal[int] )* identifier[area] . identifie... | def get_sub_area(area, xslice, yslice):
"""Apply slices to the area_extent and size of the area."""
new_area_extent = (area.pixel_upper_left[0] + (xslice.start - 0.5) * area.pixel_size_x, area.pixel_upper_left[1] - (yslice.stop - 0.5) * area.pixel_size_y, area.pixel_upper_left[0] + (xslice.stop - 0.5) * area.pi... |
def render(cls, obj):
"""
Using any display hooks that have been registered, render the
object to a dictionary of MIME types and metadata information.
"""
class_hierarchy = inspect.getmro(type(obj))
hooks = []
for _, type_hooks in cls._display_hooks.items():
... | def function[render, parameter[cls, obj]]:
constant[
Using any display hooks that have been registered, render the
object to a dictionary of MIME types and metadata information.
]
variable[class_hierarchy] assign[=] call[name[inspect].getmro, parameter[call[name[type], parameter[... | keyword[def] identifier[render] ( identifier[cls] , identifier[obj] ):
literal[string]
identifier[class_hierarchy] = identifier[inspect] . identifier[getmro] ( identifier[type] ( identifier[obj] ))
identifier[hooks] =[]
keyword[for] identifier[_] , identifier[type_hooks] keyword... | def render(cls, obj):
"""
Using any display hooks that have been registered, render the
object to a dictionary of MIME types and metadata information.
"""
class_hierarchy = inspect.getmro(type(obj))
hooks = []
for (_, type_hooks) in cls._display_hooks.items():
for cls in ... |
def get_verbose(obj, field_name=""):
"""
Returns the verbose name of an object's field.
:param obj: A model instance.
:param field_name: The requested field value in string format.
"""
if hasattr(obj, "_meta") and hasattr(obj._meta, "get_field_by_name"):
try:
return obj._me... | def function[get_verbose, parameter[obj, field_name]]:
constant[
Returns the verbose name of an object's field.
:param obj: A model instance.
:param field_name: The requested field value in string format.
]
if <ast.BoolOp object at 0x7da1b255a7a0> begin[:]
<ast.Try object at 0x... | keyword[def] identifier[get_verbose] ( identifier[obj] , identifier[field_name] = literal[string] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[obj] , literal[string] ) keyword[and] identifier[hasattr] ( identifier[obj] . identifier[_meta] , literal[string] ):
keyword[try] :
... | def get_verbose(obj, field_name=''):
"""
Returns the verbose name of an object's field.
:param obj: A model instance.
:param field_name: The requested field value in string format.
"""
if hasattr(obj, '_meta') and hasattr(obj._meta, 'get_field_by_name'):
try:
return obj._me... |
def gather_info_hdu(self, hdulist):
"""Obtain a summary of information about the image."""
values = {}
values['n_ext'] = len(hdulist)
extnames = [hdu.header.get('extname', '') for hdu in hdulist[1:]]
values['name_ext'] = ['PRIMARY'] + extnames
fits_extractor = self.extra... | def function[gather_info_hdu, parameter[self, hdulist]]:
constant[Obtain a summary of information about the image.]
variable[values] assign[=] dictionary[[], []]
call[name[values]][constant[n_ext]] assign[=] call[name[len], parameter[name[hdulist]]]
variable[extnames] assign[=] <ast.List... | keyword[def] identifier[gather_info_hdu] ( identifier[self] , identifier[hdulist] ):
literal[string]
identifier[values] ={}
identifier[values] [ literal[string] ]= identifier[len] ( identifier[hdulist] )
identifier[extnames] =[ identifier[hdu] . identifier[header] . identifier[get... | def gather_info_hdu(self, hdulist):
"""Obtain a summary of information about the image."""
values = {}
values['n_ext'] = len(hdulist)
extnames = [hdu.header.get('extname', '') for hdu in hdulist[1:]]
values['name_ext'] = ['PRIMARY'] + extnames
fits_extractor = self.extractor_map['fits']
for ... |
def update(self, data, offset, is_last, buffer_index=0):
"""
Update the buffer at the given index.
Args:
data (np.ndarray): The frames.
offset (int): The index of the first frame in `data` within the sequence.
is_last (bool): Whether this is the last block of... | def function[update, parameter[self, data, offset, is_last, buffer_index]]:
constant[
Update the buffer at the given index.
Args:
data (np.ndarray): The frames.
offset (int): The index of the first frame in `data` within the sequence.
is_last (bool): Whether ... | keyword[def] identifier[update] ( identifier[self] , identifier[data] , identifier[offset] , identifier[is_last] , identifier[buffer_index] = literal[int] ):
literal[string]
keyword[if] identifier[buffer_index] >= identifier[self] . identifier[num_buffers] :
keyword[raise] identifier... | def update(self, data, offset, is_last, buffer_index=0):
"""
Update the buffer at the given index.
Args:
data (np.ndarray): The frames.
offset (int): The index of the first frame in `data` within the sequence.
is_last (bool): Whether this is the last block of fra... |
def _phiforce(self,R,phi=0.,t=0.):
"""
NAME:
_phiforce
PURPOSE:
evaluate the azimuthal force for this potential
INPUT:
R - Galactocentric cylindrical radius
phi - azimuth
t - time
OUTPUT:
the azimuthal force
... | def function[_phiforce, parameter[self, R, phi, t]]:
constant[
NAME:
_phiforce
PURPOSE:
evaluate the azimuthal force for this potential
INPUT:
R - Galactocentric cylindrical radius
phi - azimuth
t - time
OUTPUT:
th... | keyword[def] identifier[_phiforce] ( identifier[self] , identifier[R] , identifier[phi] = literal[int] , identifier[t] = literal[int] ):
literal[string]
keyword[if] identifier[R] < identifier[self] . identifier[_rb] :
keyword[return] identifier[self] . identifier[_mphio] * identifier... | def _phiforce(self, R, phi=0.0, t=0.0):
"""
NAME:
_phiforce
PURPOSE:
evaluate the azimuthal force for this potential
INPUT:
R - Galactocentric cylindrical radius
phi - azimuth
t - time
OUTPUT:
the azimuthal force
... |
def stop_trial(self, trial):
"""Stops trial.
Trials may be stopped at any time. If trial is in state PENDING
or PAUSED, calls `on_trial_remove` for scheduler and
`on_trial_complete(..., early_terminated=True) for search_alg.
Otherwise waits for result for the trial and calls
... | def function[stop_trial, parameter[self, trial]]:
constant[Stops trial.
Trials may be stopped at any time. If trial is in state PENDING
or PAUSED, calls `on_trial_remove` for scheduler and
`on_trial_complete(..., early_terminated=True) for search_alg.
Otherwise waits for result... | keyword[def] identifier[stop_trial] ( identifier[self] , identifier[trial] ):
literal[string]
identifier[error] = keyword[False]
identifier[error_msg] = keyword[None]
keyword[if] identifier[trial] . identifier[status] keyword[in] [ identifier[Trial] . identifier[ERROR] , iden... | def stop_trial(self, trial):
"""Stops trial.
Trials may be stopped at any time. If trial is in state PENDING
or PAUSED, calls `on_trial_remove` for scheduler and
`on_trial_complete(..., early_terminated=True) for search_alg.
Otherwise waits for result for the trial and calls
... |
def remove_children(self, reset_parent=True):
"""
Remove all the children of this node.
:param bool reset_parent: if ``True``, set to ``None`` the parent attribute
of the children
"""
if reset_parent:
for child in self.children:
... | def function[remove_children, parameter[self, reset_parent]]:
constant[
Remove all the children of this node.
:param bool reset_parent: if ``True``, set to ``None`` the parent attribute
of the children
]
if name[reset_parent] begin[:]
... | keyword[def] identifier[remove_children] ( identifier[self] , identifier[reset_parent] = keyword[True] ):
literal[string]
keyword[if] identifier[reset_parent] :
keyword[for] identifier[child] keyword[in] identifier[self] . identifier[children] :
identifier[child] .... | def remove_children(self, reset_parent=True):
"""
Remove all the children of this node.
:param bool reset_parent: if ``True``, set to ``None`` the parent attribute
of the children
"""
if reset_parent:
for child in self.children:
chil... |
def metadata(sceneid, pmin=2, pmax=98, **kwargs):
"""
Return band bounds and statistics.
Attributes
----------
sceneid : str
CBERS sceneid.
pmin : int, optional, (default: 2)
Histogram minimum cut.
pmax : int, optional, (default: 98)
Histogram maximum cut.
kwargs... | def function[metadata, parameter[sceneid, pmin, pmax]]:
constant[
Return band bounds and statistics.
Attributes
----------
sceneid : str
CBERS sceneid.
pmin : int, optional, (default: 2)
Histogram minimum cut.
pmax : int, optional, (default: 98)
Histogram maximum... | keyword[def] identifier[metadata] ( identifier[sceneid] , identifier[pmin] = literal[int] , identifier[pmax] = literal[int] ,** identifier[kwargs] ):
literal[string]
identifier[scene_params] = identifier[_cbers_parse_scene_id] ( identifier[sceneid] )
identifier[cbers_address] = literal[string] . ident... | def metadata(sceneid, pmin=2, pmax=98, **kwargs):
"""
Return band bounds and statistics.
Attributes
----------
sceneid : str
CBERS sceneid.
pmin : int, optional, (default: 2)
Histogram minimum cut.
pmax : int, optional, (default: 98)
Histogram maximum cut.
kwargs... |
def verify(self):
"""Ensure all expected calls were called,
raise AssertionError otherwise.
You do not need to use this directly. Use fudge.verify()
"""
try:
for exp in self.get_expected_calls():
exp.assert_called()
exp.assert_times_c... | def function[verify, parameter[self]]:
constant[Ensure all expected calls were called,
raise AssertionError otherwise.
You do not need to use this directly. Use fudge.verify()
]
<ast.Try object at 0x7da18bccb160> | keyword[def] identifier[verify] ( identifier[self] ):
literal[string]
keyword[try] :
keyword[for] identifier[exp] keyword[in] identifier[self] . identifier[get_expected_calls] ():
identifier[exp] . identifier[assert_called] ()
identifier[exp] . iden... | def verify(self):
"""Ensure all expected calls were called,
raise AssertionError otherwise.
You do not need to use this directly. Use fudge.verify()
"""
try:
for exp in self.get_expected_calls():
exp.assert_called()
exp.assert_times_called() # depends o... |
def _get_encrypted_masterpassword(self):
""" Obtain the encrypted masterkey
.. note:: The encrypted masterkey is checksummed, so that we can
figure out that a provided password is correct or not. The
checksum is only 4 bytes long!
"""
if not self.unlo... | def function[_get_encrypted_masterpassword, parameter[self]]:
constant[ Obtain the encrypted masterkey
.. note:: The encrypted masterkey is checksummed, so that we can
figure out that a provided password is correct or not. The
checksum is only 4 bytes long!
]... | keyword[def] identifier[_get_encrypted_masterpassword] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[unlocked] ():
keyword[raise] identifier[WalletLocked]
identifier[aes] = identifier[AESCipher] ( identifier[self] . identifier... | def _get_encrypted_masterpassword(self):
""" Obtain the encrypted masterkey
.. note:: The encrypted masterkey is checksummed, so that we can
figure out that a provided password is correct or not. The
checksum is only 4 bytes long!
"""
if not self.unlocked():
... |
def urls(self):
"""
A dictionary of the urls to be mocked with this service and the handlers
that should be called in their place
"""
url_bases = self._url_module.url_bases
unformatted_paths = self._url_module.url_paths
urls = {}
for url_base in url_bases... | def function[urls, parameter[self]]:
constant[
A dictionary of the urls to be mocked with this service and the handlers
that should be called in their place
]
variable[url_bases] assign[=] name[self]._url_module.url_bases
variable[unformatted_paths] assign[=] name[self]._... | keyword[def] identifier[urls] ( identifier[self] ):
literal[string]
identifier[url_bases] = identifier[self] . identifier[_url_module] . identifier[url_bases]
identifier[unformatted_paths] = identifier[self] . identifier[_url_module] . identifier[url_paths]
identifier[urls] ={}... | def urls(self):
"""
A dictionary of the urls to be mocked with this service and the handlers
that should be called in their place
"""
url_bases = self._url_module.url_bases
unformatted_paths = self._url_module.url_paths
urls = {}
for url_base in url_bases:
for (url_pa... |
def jdbc(self, url, table, mode=None, properties=None):
"""Saves the content of the :class:`DataFrame` to an external database table via JDBC.
.. note:: Don't create too many partitions in parallel on a large cluster;
otherwise Spark might crash your external database systems.
:par... | def function[jdbc, parameter[self, url, table, mode, properties]]:
constant[Saves the content of the :class:`DataFrame` to an external database table via JDBC.
.. note:: Don't create too many partitions in parallel on a large cluster;
otherwise Spark might crash your external database syste... | keyword[def] identifier[jdbc] ( identifier[self] , identifier[url] , identifier[table] , identifier[mode] = keyword[None] , identifier[properties] = keyword[None] ):
literal[string]
keyword[if] identifier[properties] keyword[is] keyword[None] :
identifier[properties] = identifier[di... | def jdbc(self, url, table, mode=None, properties=None):
"""Saves the content of the :class:`DataFrame` to an external database table via JDBC.
.. note:: Don't create too many partitions in parallel on a large cluster;
otherwise Spark might crash your external database systems.
:param u... |
def on_key_release(self, symbol, modifiers):
"""
Pyglet specific key release callback.
Forwards and translates the events to :py:func:`keyboard_event`
"""
self.keyboard_event(symbol, self.keys.ACTION_RELEASE, modifiers) | def function[on_key_release, parameter[self, symbol, modifiers]]:
constant[
Pyglet specific key release callback.
Forwards and translates the events to :py:func:`keyboard_event`
]
call[name[self].keyboard_event, parameter[name[symbol], name[self].keys.ACTION_RELEASE, name[modifie... | keyword[def] identifier[on_key_release] ( identifier[self] , identifier[symbol] , identifier[modifiers] ):
literal[string]
identifier[self] . identifier[keyboard_event] ( identifier[symbol] , identifier[self] . identifier[keys] . identifier[ACTION_RELEASE] , identifier[modifiers] ) | def on_key_release(self, symbol, modifiers):
"""
Pyglet specific key release callback.
Forwards and translates the events to :py:func:`keyboard_event`
"""
self.keyboard_event(symbol, self.keys.ACTION_RELEASE, modifiers) |
def get_zeropoint(expnum, ccd, prefix=None, version='p'):
"""Get the zeropoint for this exposure using the zeropoint.used file created during source planting..
This command expects that there is a file called #######p##.zeropoint.used which contains the zeropoint.
@param expnum: exposure to get zeropoint ... | def function[get_zeropoint, parameter[expnum, ccd, prefix, version]]:
constant[Get the zeropoint for this exposure using the zeropoint.used file created during source planting..
This command expects that there is a file called #######p##.zeropoint.used which contains the zeropoint.
@param expnum: expo... | keyword[def] identifier[get_zeropoint] ( identifier[expnum] , identifier[ccd] , identifier[prefix] = keyword[None] , identifier[version] = literal[string] ):
literal[string]
identifier[uri] = identifier[get_uri] ( identifier[expnum] , identifier[ccd] , identifier[version] , identifier[ext] = literal[string... | def get_zeropoint(expnum, ccd, prefix=None, version='p'):
"""Get the zeropoint for this exposure using the zeropoint.used file created during source planting..
This command expects that there is a file called #######p##.zeropoint.used which contains the zeropoint.
@param expnum: exposure to get zeropoint ... |
def transform_sources(self, sources, with_string=False):
"""Get the defintions of needed strings and functions
after replacement.
"""
modules = {}
updater = partial(
self.replace_source, modules=modules, prefix='string_')
for filename in sources:
u... | def function[transform_sources, parameter[self, sources, with_string]]:
constant[Get the defintions of needed strings and functions
after replacement.
]
variable[modules] assign[=] dictionary[[], []]
variable[updater] assign[=] call[name[partial], parameter[name[self].replace_sou... | keyword[def] identifier[transform_sources] ( identifier[self] , identifier[sources] , identifier[with_string] = keyword[False] ):
literal[string]
identifier[modules] ={}
identifier[updater] = identifier[partial] (
identifier[self] . identifier[replace_source] , identifier[modules]... | def transform_sources(self, sources, with_string=False):
"""Get the defintions of needed strings and functions
after replacement.
"""
modules = {}
updater = partial(self.replace_source, modules=modules, prefix='string_')
for filename in sources:
updated = update_func_body(sources... |
def timezone(zone):
r''' Return a datetime.tzinfo implementation for the given timezone
>>> from datetime import datetime, timedelta
>>> utc = timezone('UTC')
>>> eastern = timezone('US/Eastern')
>>> eastern.zone
'US/Eastern'
>>> timezone(u'US/Eastern') is eastern
True
>>> utc_dt = ... | def function[timezone, parameter[zone]]:
constant[ Return a datetime.tzinfo implementation for the given timezone
>>> from datetime import datetime, timedelta
>>> utc = timezone('UTC')
>>> eastern = timezone('US/Eastern')
>>> eastern.zone
'US/Eastern'
>>> timezone(u'US/Eastern') is east... | keyword[def] identifier[timezone] ( identifier[zone] ):
literal[string]
keyword[if] identifier[zone] . identifier[upper] ()== literal[string] :
keyword[return] identifier[utc]
keyword[try] :
identifier[zone] = identifier[zone] . identifier[encode] ( literal[string] )
keyword... | def timezone(zone):
""" Return a datetime.tzinfo implementation for the given timezone
>>> from datetime import datetime, timedelta
>>> utc = timezone('UTC')
>>> eastern = timezone('US/Eastern')
>>> eastern.zone
'US/Eastern'
>>> timezone(u'US/Eastern') is eastern
True
>>> utc_dt = d... |
def react(self, **kwargs):
"""
The time of recation is ignored hereTime is ignored here
and should be handled by whatever called this function.
"""
react_type = kwargs.get("type", self._type)
if react_type == 'hover':
return self.__hover(**kwargs)
... | def function[react, parameter[self]]:
constant[
The time of recation is ignored hereTime is ignored here
and should be handled by whatever called this function.
]
variable[react_type] assign[=] call[name[kwargs].get, parameter[constant[type], name[self]._type]]
if... | keyword[def] identifier[react] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[react_type] = identifier[kwargs] . identifier[get] ( literal[string] , identifier[self] . identifier[_type] )
keyword[if] identifier[react_type] == literal[string] :
keywor... | def react(self, **kwargs):
"""
The time of recation is ignored hereTime is ignored here
and should be handled by whatever called this function.
"""
react_type = kwargs.get('type', self._type)
if react_type == 'hover':
return self.__hover(**kwargs) # depends on [contr... |
def lines_from_points(points):
"""
Generates line from points. Assumes points are ordered as line segments.
Parameters
----------
points : np.ndarray
Points representing line segments. For example, two line segments
would be represented as:
np.array([[0, 0, 0], [1, 0, 0],... | def function[lines_from_points, parameter[points]]:
constant[
Generates line from points. Assumes points are ordered as line segments.
Parameters
----------
points : np.ndarray
Points representing line segments. For example, two line segments
would be represented as:
... | keyword[def] identifier[lines_from_points] ( identifier[points] ):
literal[string]
identifier[npoints] = identifier[points] . identifier[shape] [ literal[int] ]- literal[int]
identifier[lines] = identifier[np] . identifier[vstack] (( literal[int] * identifier[np] . identifier[ones] ( identifier[... | def lines_from_points(points):
"""
Generates line from points. Assumes points are ordered as line segments.
Parameters
----------
points : np.ndarray
Points representing line segments. For example, two line segments
would be represented as:
np.array([[0, 0, 0], [1, 0, 0],... |
def point(cls): # No range because it's unknown at this time.
"""Create an ArgumentType that is represented by a point.Point."""
def factory(i, name):
return cls(i, name, (0, 0), lambda a: point.Point(*a).floor(), None)
return factory | def function[point, parameter[cls]]:
constant[Create an ArgumentType that is represented by a point.Point.]
def function[factory, parameter[i, name]]:
return[call[name[cls], parameter[name[i], name[name], tuple[[<ast.Constant object at 0x7da18f813430>, <ast.Constant object at 0x7da18f813cd0>]], ... | keyword[def] identifier[point] ( identifier[cls] ):
literal[string]
keyword[def] identifier[factory] ( identifier[i] , identifier[name] ):
keyword[return] identifier[cls] ( identifier[i] , identifier[name] ,( literal[int] , literal[int] ), keyword[lambda] identifier[a] : identifier[point] . ident... | def point(cls): # No range because it's unknown at this time.
'Create an ArgumentType that is represented by a point.Point.'
def factory(i, name):
return cls(i, name, (0, 0), lambda a: point.Point(*a).floor(), None)
return factory |
def set_mute(self, enable):
"""Mute or unmute the TV."""
data = '1' if enable else '0'
params = ('<InstanceID>0</InstanceID><Channel>Master</Channel>'
'<DesiredMute>{}</DesiredMute>').format(data)
self.soap_request(URL_CONTROL_DMR, URN_RENDERING_CONTROL,
... | def function[set_mute, parameter[self, enable]]:
constant[Mute or unmute the TV.]
variable[data] assign[=] <ast.IfExp object at 0x7da204621300>
variable[params] assign[=] call[constant[<InstanceID>0</InstanceID><Channel>Master</Channel><DesiredMute>{}</DesiredMute>].format, parameter[name[data]]... | keyword[def] identifier[set_mute] ( identifier[self] , identifier[enable] ):
literal[string]
identifier[data] = literal[string] keyword[if] identifier[enable] keyword[else] literal[string]
identifier[params] =( literal[string]
literal[string] ). identifier[format] ( identifi... | def set_mute(self, enable):
"""Mute or unmute the TV."""
data = '1' if enable else '0'
params = '<InstanceID>0</InstanceID><Channel>Master</Channel><DesiredMute>{}</DesiredMute>'.format(data)
self.soap_request(URL_CONTROL_DMR, URN_RENDERING_CONTROL, 'SetMute', params) |
def _preprocess_yml(path):
"""Dynamically create PY3 version of the file by re-writing 'unicode' to 'str'."""
with open(path) as f:
tmp_yaml = f.read()
return re.sub(r"unicode", "str", tmp_yaml) | def function[_preprocess_yml, parameter[path]]:
constant[Dynamically create PY3 version of the file by re-writing 'unicode' to 'str'.]
with call[name[open], parameter[name[path]]] begin[:]
variable[tmp_yaml] assign[=] call[name[f].read, parameter[]]
return[call[name[re].sub, paramete... | keyword[def] identifier[_preprocess_yml] ( identifier[path] ):
literal[string]
keyword[with] identifier[open] ( identifier[path] ) keyword[as] identifier[f] :
identifier[tmp_yaml] = identifier[f] . identifier[read] ()
keyword[return] identifier[re] . identifier[sub] ( literal[string] , lit... | def _preprocess_yml(path):
"""Dynamically create PY3 version of the file by re-writing 'unicode' to 'str'."""
with open(path) as f:
tmp_yaml = f.read() # depends on [control=['with'], data=['f']]
return re.sub('unicode', 'str', tmp_yaml) |
def addresses(self):
"""
Return a new raw REST interface to address resources
:rtype: :py:class:`ns1.rest.ipam.Adresses`
"""
import ns1.rest.ipam
return ns1.rest.ipam.Addresses(self.config) | def function[addresses, parameter[self]]:
constant[
Return a new raw REST interface to address resources
:rtype: :py:class:`ns1.rest.ipam.Adresses`
]
import module[ns1.rest.ipam]
return[call[name[ns1].rest.ipam.Addresses, parameter[name[self].config]]] | keyword[def] identifier[addresses] ( identifier[self] ):
literal[string]
keyword[import] identifier[ns1] . identifier[rest] . identifier[ipam]
keyword[return] identifier[ns1] . identifier[rest] . identifier[ipam] . identifier[Addresses] ( identifier[self] . identifier[config] ) | def addresses(self):
"""
Return a new raw REST interface to address resources
:rtype: :py:class:`ns1.rest.ipam.Adresses`
"""
import ns1.rest.ipam
return ns1.rest.ipam.Addresses(self.config) |
def _compile_pattern(self, rule):
''' Return a regular expression with named groups for each wildcard. '''
out = ''
for i, part in enumerate(self.syntax.split(rule)):
if i%3 == 0: out += re.escape(part.replace('\\:',':'))
elif i%3 == 1: out += '(?P<%s>' % part if part e... | def function[_compile_pattern, parameter[self, rule]]:
constant[ Return a regular expression with named groups for each wildcard. ]
variable[out] assign[=] constant[]
for taget[tuple[[<ast.Name object at 0x7da1b170e200>, <ast.Name object at 0x7da1b170f400>]]] in starred[call[name[enumerate], par... | keyword[def] identifier[_compile_pattern] ( identifier[self] , identifier[rule] ):
literal[string]
identifier[out] = literal[string]
keyword[for] identifier[i] , identifier[part] keyword[in] identifier[enumerate] ( identifier[self] . identifier[syntax] . identifier[split] ( identifier[... | def _compile_pattern(self, rule):
""" Return a regular expression with named groups for each wildcard. """
out = ''
for (i, part) in enumerate(self.syntax.split(rule)):
if i % 3 == 0:
out += re.escape(part.replace('\\:', ':')) # depends on [control=['if'], data=[]]
elif i % 3 ==... |
def switch_on(self):
"""Turn the switch on."""
success = self.set_status(CONST.STATUS_ON_INT)
if success:
self._json_state['status'] = CONST.STATUS_ON
return success | def function[switch_on, parameter[self]]:
constant[Turn the switch on.]
variable[success] assign[=] call[name[self].set_status, parameter[name[CONST].STATUS_ON_INT]]
if name[success] begin[:]
call[name[self]._json_state][constant[status]] assign[=] name[CONST].STATUS_ON
retur... | keyword[def] identifier[switch_on] ( identifier[self] ):
literal[string]
identifier[success] = identifier[self] . identifier[set_status] ( identifier[CONST] . identifier[STATUS_ON_INT] )
keyword[if] identifier[success] :
identifier[self] . identifier[_json_state] [ literal[s... | def switch_on(self):
"""Turn the switch on."""
success = self.set_status(CONST.STATUS_ON_INT)
if success:
self._json_state['status'] = CONST.STATUS_ON # depends on [control=['if'], data=[]]
return success |
def get_status(self):
"""
Gets the Status
:return: The Status
:rtype: string
"""
entries = self.__query('/samlp:LogoutResponse/samlp:Status/samlp:StatusCode')
if len(entries) == 0:
return None
status = entries[0].attrib['Value']
return ... | def function[get_status, parameter[self]]:
constant[
Gets the Status
:return: The Status
:rtype: string
]
variable[entries] assign[=] call[name[self].__query, parameter[constant[/samlp:LogoutResponse/samlp:Status/samlp:StatusCode]]]
if compare[call[name[len], para... | keyword[def] identifier[get_status] ( identifier[self] ):
literal[string]
identifier[entries] = identifier[self] . identifier[__query] ( literal[string] )
keyword[if] identifier[len] ( identifier[entries] )== literal[int] :
keyword[return] keyword[None]
identifier[... | def get_status(self):
"""
Gets the Status
:return: The Status
:rtype: string
"""
entries = self.__query('/samlp:LogoutResponse/samlp:Status/samlp:StatusCode')
if len(entries) == 0:
return None # depends on [control=['if'], data=[]]
status = entries[0].attrib['Val... |
def __get_empty_config(self):
"""
Returns the config file contents as a string. The config file is generated and then deleted.
"""
self._generate_config()
path = self._get_config_path()
with open(path, 'r') as readable:
contents = readable.read()
os.re... | def function[__get_empty_config, parameter[self]]:
constant[
Returns the config file contents as a string. The config file is generated and then deleted.
]
call[name[self]._generate_config, parameter[]]
variable[path] assign[=] call[name[self]._get_config_path, parameter[]]
... | keyword[def] identifier[__get_empty_config] ( identifier[self] ):
literal[string]
identifier[self] . identifier[_generate_config] ()
identifier[path] = identifier[self] . identifier[_get_config_path] ()
keyword[with] identifier[open] ( identifier[path] , literal[string] ) keyword... | def __get_empty_config(self):
"""
Returns the config file contents as a string. The config file is generated and then deleted.
"""
self._generate_config()
path = self._get_config_path()
with open(path, 'r') as readable:
contents = readable.read() # depends on [control=['with'], ... |
def coarsen(self, dim: Optional[Mapping[Hashable, int]] = None,
boundary: str = 'exact',
side: Union[str, Mapping[Hashable, str]] = 'left',
coord_func: str = 'mean',
**dim_kwargs: int):
"""
Coarsen object.
Parameters
------... | def function[coarsen, parameter[self, dim, boundary, side, coord_func]]:
constant[
Coarsen object.
Parameters
----------
dim: dict, optional
Mapping from the dimension name to the window size.
dim : str
Name of the dimension to create the ... | keyword[def] identifier[coarsen] ( identifier[self] , identifier[dim] : identifier[Optional] [ identifier[Mapping] [ identifier[Hashable] , identifier[int] ]]= keyword[None] ,
identifier[boundary] : identifier[str] = literal[string] ,
identifier[side] : identifier[Union] [ identifier[str] , identifier[Mapping] [ id... | def coarsen(self, dim: Optional[Mapping[Hashable, int]]=None, boundary: str='exact', side: Union[str, Mapping[Hashable, str]]='left', coord_func: str='mean', **dim_kwargs: int):
"""
Coarsen object.
Parameters
----------
dim: dict, optional
Mapping from the dimension name... |
async def ListFilesystems(self, filters):
'''
filters : typing.Sequence[~FilesystemFilter]
Returns -> typing.Sequence[~FilesystemDetailsListResult]
'''
# map input types to rpc msg
_params = dict()
msg = dict(type='Storage',
request='ListFilesys... | <ast.AsyncFunctionDef object at 0x7da1b0d0fdc0> | keyword[async] keyword[def] identifier[ListFilesystems] ( identifier[self] , identifier[filters] ):
literal[string]
identifier[_params] = identifier[dict] ()
identifier[msg] = identifier[dict] ( identifier[type] = literal[string] ,
identifier[request] = literal[string] ,... | async def ListFilesystems(self, filters):
"""
filters : typing.Sequence[~FilesystemFilter]
Returns -> typing.Sequence[~FilesystemDetailsListResult]
"""
# map input types to rpc msg
_params = dict()
msg = dict(type='Storage', request='ListFilesystems', version=4, params=_params)
... |
def connect(self, **kwargs):
"""Connect to Google Compute Engine.
"""
try:
self.gce = get_driver(Provider.GCE)(
self.user_id,
self.key,
project=self.project,
**kwargs)
except:
raise ComputeEngineManag... | def function[connect, parameter[self]]:
constant[Connect to Google Compute Engine.
]
<ast.Try object at 0x7da1b1233df0> | keyword[def] identifier[connect] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
keyword[try] :
identifier[self] . identifier[gce] = identifier[get_driver] ( identifier[Provider] . identifier[GCE] )(
identifier[self] . identifier[user_id] ,
identi... | def connect(self, **kwargs):
"""Connect to Google Compute Engine.
"""
try:
self.gce = get_driver(Provider.GCE)(self.user_id, self.key, project=self.project, **kwargs) # depends on [control=['try'], data=[]]
except:
raise ComputeEngineManagerException('Unable to connect to Google Com... |
def load_excel(self, filepath, **kwargs):
"""Set the main dataframe with the content of an Excel file
:param filepath: url of the csv file to load,
can be absolute if it starts with ``/``
or relative if it starts with ``./``
:type filepath: str
... | def function[load_excel, parameter[self, filepath]]:
constant[Set the main dataframe with the content of an Excel file
:param filepath: url of the csv file to load,
can be absolute if it starts with ``/``
or relative if it starts with ``./``
:type... | keyword[def] identifier[load_excel] ( identifier[self] , identifier[filepath] ,** identifier[kwargs] ):
literal[string]
keyword[try] :
identifier[df] = identifier[pd] . identifier[read_excel] ( identifier[filepath] ,** identifier[kwargs] )
keyword[if] identifier[len] ( id... | def load_excel(self, filepath, **kwargs):
"""Set the main dataframe with the content of an Excel file
:param filepath: url of the csv file to load,
can be absolute if it starts with ``/``
or relative if it starts with ``./``
:type filepath: str
... |
def alerts(self, alert_level='High'):
"""Get a filtered list of alerts at the given alert level, and sorted by alert level."""
alerts = self.zap.core.alerts()
alert_level_value = self.alert_levels[alert_level]
alerts = sorted((a for a in alerts if self.alert_levels[a['risk']] >= alert_l... | def function[alerts, parameter[self, alert_level]]:
constant[Get a filtered list of alerts at the given alert level, and sorted by alert level.]
variable[alerts] assign[=] call[name[self].zap.core.alerts, parameter[]]
variable[alert_level_value] assign[=] call[name[self].alert_levels][name[alert... | keyword[def] identifier[alerts] ( identifier[self] , identifier[alert_level] = literal[string] ):
literal[string]
identifier[alerts] = identifier[self] . identifier[zap] . identifier[core] . identifier[alerts] ()
identifier[alert_level_value] = identifier[self] . identifier[alert_levels] [... | def alerts(self, alert_level='High'):
"""Get a filtered list of alerts at the given alert level, and sorted by alert level."""
alerts = self.zap.core.alerts()
alert_level_value = self.alert_levels[alert_level]
alerts = sorted((a for a in alerts if self.alert_levels[a['risk']] >= alert_level_value), key=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.