INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Takes a str into var filecontent which represents the entire content of a configuration segment or partial configuration file. Takes a str into var description which represents the description of the configuration segment: param filename: str containing the name of the configuration segment. | def create_cfg_segment(filename, filecontent, description, auth, url):
"""
Takes a str into var filecontent which represents the entire content of a configuration
segment, or partial configuration file. Takes a str into var description which represents the
description of the configuration segment
:p... |
Helper function takes str input of folder name and returns str numerical id of the folder.: param template_name: str name of the target template | def get_template_id(template_name, auth, url):
"""
Helper function takes str input of folder name and returns str numerical id of the folder.
:param template_name: str name of the target template
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base u... |
Helper function takes str input of folder name and returns str numerical id of the folder.: param folder_name: str name of the folder | def get_folder_id(folder_name, auth, url):
"""
Helper function takes str input of folder name and returns str numerical id of the folder.
:param folder_name: str name of the folder
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS in... |
Uses the get_template_id () funct to gather the template_id to craft a url which is sent to the IMC server using a Delete Method: param template_name: str containing the entire contents of the configuration segment | def delete_cfg_template(template_name, auth, url):
"""Uses the get_template_id() funct to gather the template_id
to craft a url which is sent to the IMC server using a Delete Method
:param template_name: str containing the entire contents of the configuration segment
:param auth: requests auth object #... |
Uses the get_template_id () funct to gather the template_id to craft a get_template_details_url which is sent to the IMC server using a get Method: param template_name: str containing the entire contents of the configuration segment | def get_template_details(template_name, auth, url):
"""Uses the get_template_id() funct to gather the template_id to craft a
get_template_details_url which is sent to the IMC server using
a get Method
:param template_name: str containing the entire contents of the configuration segment
:param auth:... |
Function takes input of devID to issue RESTUL call to HP IMC: param devid: requires devId as the only input parameter: return: dictionary of existing vlans on the devices. Device must be supported in HP IMC platform VLAN manager module | def get_dev_vlans(devid, auth, url):
"""Function takes input of devID to issue RESTUL call to HP IMC
:param devid: requires devId as the only input parameter
:return: dictionary of existing vlans on the devices. Device must be supported in HP IMC platform VLAN manager module
"""
# checks to see if ... |
Function takes devId as input to RESTFULL call to HP IMC platform: param devId: output of get_dev_details: return: list of dictionaries containing of interfaces configured as an 802. 1q trunk | def get_trunk_interfaces(devId, auth, url):
"""Function takes devId as input to RESTFULL call to HP IMC platform
:param devId: output of get_dev_details
:return: list of dictionaries containing of interfaces configured as an 802.1q trunk
Example:
auth = IMCAuth("http://", "10.101.0.203", "8080"... |
Function takes devId as input to RESTFUL call to HP IMC platform: param devId: requires deviceID as the only input parameter: return: list of dictionaries containing interfaces configured as access ports | def get_device_access_interfaces(devId, auth, url):
"""Function takes devId as input to RESTFUL call to HP IMC platform
:param devId: requires deviceID as the only input parameter
:return: list of dictionaries containing interfaces configured as access ports
"""
# checks to see if the imc credential... |
function takes devid and vlanid vlan_name of specific device and 802. 1q VLAN tag and issues a RESTFUL call to add the specified VLAN from the target device. VLAN Name MUST be valid on target device.: param devid: int or str value of the target device: param vlanid: int or str value of target 802. 1q VLAN: param vlan_n... | def create_dev_vlan(devid, vlanid, vlan_name, auth, url):
"""
function takes devid and vlanid vlan_name of specific device and 802.1q VLAN tag and issues a RESTFUL call to add the
specified VLAN from the target device. VLAN Name MUST be valid on target device.
:param devid: int or str value of the targe... |
function takes devid and vlanid of specific device and 802. 1q VLAN tag and issues a RESTFUL call to remove the specified VLAN from the target device.: param devid: int or str value of the target device: param vlanid:: return: HTTP Status code of 204 with no values. | def delete_dev_vlans(devid, vlanid, auth, url):
"""
function takes devid and vlanid of specific device and 802.1q VLAN tag and issues a RESTFUL call to remove the
specified VLAN from the target device.
:param devid: int or str value of the target device
:param vlanid:
:return:HTTP Status code of... |
Function takes input of dictionary operator with the following keys operator = { fullName: sessionTimeout: password: operatorGroupId: name: desc: defaultAcl: authType: } converts to json and issues a HTTP POST request to the HPE IMC Restful API | def create_operator(operator, auth, url):
"""
Function takes input of dictionary operator with the following keys
operator = { "fullName" : "" ,
"sessionTimeout" : "",
"password" : "",
"operatorGroupId" : "",
"name" : "",
"desc" : "",
... |
Function to set the password of an existing operator | def set_operator_password(operator, password, auth, url):
"""
Function to set the password of an existing operator
:param operator: str Name of the operator account
:param password: str New password
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param ur... |
Funtion takes no inputs and returns a list of dictionaties of all of the operators currently configured on the HPE IMC system | def get_plat_operator(auth, url):
"""
Funtion takes no inputs and returns a list of dictionaties of all of the operators currently
configured on the HPE IMC system
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually ... |
Function to set the password of an existing operator: param operator: str Name of the operator account | def delete_plat_operator(operator, auth, url):
"""
Function to set the password of an existing operator
:param operator: str Name of the operator account
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url f... |
Makes a request to the specified url endpoint with the specified http method params and post data. | def execute_request(self, url, http_method, query_params, post_data):
"""Makes a request to the specified url endpoint with the
specified http method, params and post data.
Args:
url (string): The url to the API without query params.
Example: "https://api.h... |
Makes a POST request to the specified url endpoint. | def post(self, url, post_data, query_params=None):
"""Makes a POST request to the specified url endpoint.
Args:
url (string): The url to the API without query params.
Example: "https://api.housecanary.com/v2/property/value"
post_data: Json post data to ... |
Function which takes in a csv files as input to the create_custom_views function from the pyhpeimc python module available at https:// github. com/ HPNetworking/ HP - Intelligent - Management - Center: param filename: user - defined filename which contains two column named name and upperview as input into the create_cu... | def import_custom_views(filename):
"""
Function which takes in a csv files as input to the create_custom_views function from the pyhpeimc python module
available at https://github.com/HPNetworking/HP-Intelligent-Management-Center
:param filename: user-defined filename which contains two column named "na... |
function takes the ipAddress of a specific host and issues a RESTFUL call to get the device and interface that the target host is currently connected to. Note: Although intended to return a single location Multiple locations may be returned for a single host due to a partially discovered network or misconfigured enviro... | def get_real_time_locate(host_ipaddress, auth, url):
"""
function takes the ipAddress of a specific host and issues a RESTFUL call to get the device and
interface that the target host is currently connected to. Note: Although intended to return a
single location, Multiple locations may be returned for a... |
function takes devid of specific device and issues a RESTFUL call to get the IP/ MAC/ ARP list from the target device. | def get_ip_mac_arp_list(auth, url, devid=None, devip=None):
"""
function takes devid of specific device and issues a RESTFUL call to get the IP/MAC/ARP list
from the target device.
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS in... |
function requires no inputs and returns all IP address scopes currently configured on the HPE IMC server. If the optional scopeid parameter is included this will automatically return only the desired scope id. | def get_ip_scope(auth, url, scopeid=None, ):
"""
function requires no inputs and returns all IP address scopes currently configured on the HPE
IMC server. If the optional scopeid parameter is included, this will automatically return
only the desired scope id.
:param scopeid: integer of the desired ... |
Function takes input of four strings Start Ip endIp name and description to add new Ip Scope to terminal access in the HPE IMC base platform | def add_ip_scope(name, description, auth, url, startip=None, endip=None, network_address=None):
"""
Function takes input of four strings Start Ip, endIp, name, and description to add new Ip Scope
to terminal access in the HPE IMC base platform
:param name: str Name of the owner of this IP scope ex. 'a... |
Function to delete an entire IP segment from the IMC IP Address management under terminal access: param network_address: param auth: param url | def delete_ip_scope(network_address, auth, url):
"""
Function to delete an entire IP segment from the IMC IP Address management under terminal access
:param network_address
:param auth
:param url
>>> from pyhpeimc.auth import *
>>> from pyhpeimc.plat.termaccess import *
>>> auth = IMC... |
Function to add new host IP address allocation to existing scope ID | def add_scope_ip(hostipaddress, name, description, auth, url, scopeid=None, network_address=None):
"""
Function to add new host IP address allocation to existing scope ID
:param hostipaddress: ipv4 address of the target host to be added to the target scope
:param name: name of the owner of this host
... |
Function to add remove IP address allocation | def remove_scope_ip(hostid, auth, url):
"""
Function to add remove IP address allocation
:param hostid: Host id of the host to be deleted
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.au... |
Function requires input of scope ID and returns list of allocated IP address for the specified scope | def get_ip_scope_hosts(auth, url, scopeid=None, network_address=None):
"""
Function requires input of scope ID and returns list of allocated IP address for the
specified scope
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interfa... |
: param hostipaddress: str ipv4 address of the target host to be deleted | def delete_host_from_segment(hostipaddress, networkaddress, auth, url):
"""
:param hostipaddress: str ipv4 address of the target host to be deleted
:param networkaddress: ipv4 network address + subnet bits of target scope
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.cl... |
This augmentation is to allow comments on class attributes for example: | def allow_attribute_comments(chain, node):
"""
This augmentation is to allow comments on class attributes, for example:
class SomeClass(object):
some_attribute = 5
''' This is a docstring for the above attribute '''
"""
# TODO: find the relevant citation for why this is the correct... |
Params: | def download(self, url, path, name_audio):
"""
Params:
::url = Comprises the url used to download the audio.
::path = Comprises the location where the file should be saved.
::name_audio = Is the name of the desired audio.
Def... |
Takes in ipaddress as input to fetch device assett details from HP IMC RESTFUL API | def get_dev_asset_details(ipaddress, auth, url):
"""Takes in ipaddress as input to fetch device assett details from HP IMC RESTFUL API
:param ipaddress: IP address of the device you wish to gather the asset details
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:p... |
Takes no input to fetch device assett details from HP IMC RESTFUL API | def get_dev_asset_details_all(auth, url):
"""Takes no input to fetch device assett details from HP IMC RESTFUL API
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list ... |
A built - in check to see if connecting to the configured default database backend succeeds. | def check_database_connected(db):
"""
A built-in check to see if connecting to the configured default
database backend succeeds.
It's automatically added to the list of Dockerflow checks if a
:class:`~flask_sqlalchemy.SQLAlchemy` object is passed
to the :class:`~dockerflow.flask.app.Dockerflow`... |
A built - in check to see if all migrations have been applied correctly. | def check_migrations_applied(migrate):
"""
A built-in check to see if all migrations have been applied correctly.
It's automatically added to the list of Dockerflow checks if a
`flask_migrate.Migrate <https://flask-migrate.readthedocs.io/>`_ object
is passed to the :class:`~dockerflow.flask.app.Doc... |
A built - in check to connect to Redis using the given client and see if it responds to the PING command. | def check_redis_connected(client):
"""
A built-in check to connect to Redis using the given client and see
if it responds to the ``PING`` command.
It's automatically added to the list of Dockerflow checks if a
:class:`~redis.StrictRedis` instances is passed
to the :class:`~dockerflow.flask.app.... |
function requires no input and returns a list of dictionaries of custom views from an HPE IMC. Optional name argument will return only the specified view.: param name: str containing the name of the desired custom view: return: list of dictionaties containing attributes of the custom views | def get_custom_views(auth, url,name=None,headers=HEADERS):
"""
function requires no input and returns a list of dictionaries of custom views from an HPE IMC. Optional name
argument will return only the specified view.
:param name: str containing the name of the desired custom view
:return: list of d... |
function takes no input and issues a RESTFUL call to get a list of custom views from HPE IMC. Optioanl Name input will return only the specified view.: param name: string containg the name of the desired custom view: return: list of dictionaries containing attributes of the custom views. | def create_custom_views(auth, url,name=None, upperview=None):
"""
function takes no input and issues a RESTFUL call to get a list of custom views from HPE IMC. Optioanl Name input
will return only the specified view.
:param name: string containg the name of the desired custom view
:return: list of d... |
function takes the devId of a specific device and issues a RESTFUL call to get the most current running config file as known by the HP IMC Base Platform ICC module for the target device.: param devid: int or str value of the target device: return: str which contains the entire content of the target device running confi... | def get_dev_run_config(devid, auth, url):
"""
function takes the devId of a specific device and issues a RESTFUL call to get the most current running config
file as known by the HP IMC Base Platform ICC module for the target device.
:param devid: int or str value of the target device
:return: str w... |
function takes the devId of a specific device and issues a RESTFUL call to get the most current startup config file as known by the HP IMC Base Platform ICC module for the target device.: param devId: int or str value of the target device: return: str which contains the entire content of the target device startup confi... | def get_dev_start_config(devId, auth, url):
"""
function takes the devId of a specific device and issues a RESTFUL call to get the most current startup config
file as known by the HP IMC Base Platform ICC module for the target device.
:param devId: int or str value of the target device
:return: str... |
function takest devid and ifindex of specific device and interface and issues a RESTFUL call to undo shut the spec ified interface on the target device.: param devid: int or str value of the target device: param ifindex: int or str value of the target interface: return: HTTP status code 204 with no values. | def set_inteface_up(devid, ifindex, auth, url):
"""
function takest devid and ifindex of specific device and interface and issues a RESTFUL call to "undo shut" the spec
ified interface on the target device.
:param devid: int or str value of the target device
:param ifindex: int or str value of the t... |
List and manage virtual folders. | def vfolders(access_key):
'''
List and manage virtual folders.
'''
fields = [
('Name', 'name'),
('Created At', 'created_at'),
('Last Used', 'last_used'),
('Max Files', 'max_files'),
('Max Size', 'max_size'),
]
if access_key is None:
q = 'query { vf... |
Shows the current configuration. | def config():
'''
Shows the current configuration.
'''
config = get_config()
print('Client version: {0}'.format(click.style(__version__, bold=True)))
print('API endpoint: {0}'.format(click.style(str(config.endpoint), bold=True)))
print('API version: {0}'.format(click.style(config.version, bo... |
Takes string no input to issue RESTUL call to HP IMC \ n | def get_system_vendors(auth, url):
"""Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of dictionaries ... |
Takes string no input to issue RESTUL call to HP IMC \ n | def get_system_category(auth, url):
"""Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of dictionaries... |
Takes string no input to issue RESTUL call to HP IMC \ n | def get_system_device_models(auth, url):
"""Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of diction... |
Takes string no input to issue RESTUL call to HP IMC \ n | def get_system_series(auth, url):
"""Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of dictionaries w... |
Takes string input of IP address to issue RESTUL call to HP IMC \ n | def get_all_devs(auth, url, network_address= None):
"""Takes string input of IP address to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:param n... |
Takes string input of IP address to issue RESTUL call to HP IMC \ n | def get_dev_details(ip_address, auth, url):
"""Takes string input of IP address to issue RESTUL call to HP IMC\n
:param ip_address: string object of dotted decimal notation of IPv4 address
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC ... |
Function takes devid as input to RESTFUL call to HP IMC platform and returns list of device interfaces | def get_dev_interface(devid, auth, url):
"""
Function takes devid as input to RESTFUL call to HP IMC platform and returns list of device interfaces
:param devid: requires devid as the only input
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base u... |
function takes devid of specific device and issues a RESTFUL call to gather the current IP - MAC learning entries on the target device. | def get_dev_mac_learn(devid, auth, url):
'''
function takes devid of specific device and issues a RESTFUL call to gather the current IP-MAC learning entries on
the target device.
:param devid: int value of the target device
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.a... |
Function takes devid of target device and a sequential list of strings which define the specific commands to be run on the target device and returns a str object containing the output of the commands.: param devid: int devid of the target device | def run_dev_cmd(devid, cmd_list, auth, url):
'''
Function takes devid of target device and a sequential list of strings which define the specific commands to be run
on the target device and returns a str object containing the output of the commands.
:param devid: int devid of the target device
:par... |
function takes the devId of a specific device and the ifindex value assigned to a specific interface and issues a RESTFUL call to get the interface details file as known by the HP IMC Base Platform ICC module for the target device. | def get_all_interface_details(devId, auth, url):
"""
function takes the devId of a specific device and the ifindex value assigned to a specific interface
and issues a RESTFUL call to get the interface details
file as known by the HP IMC Base Platform ICC module for the target device.
:param devId: ... |
function takes the devId of a specific device and the ifindex value assigned to a specific interface and issues a RESTFUL call to get the interface details file as known by the HP IMC Base Platform ICC module for the target device. | def get_interface_details(devId, ifIndex, auth, url):
"""
function takes the devId of a specific device and the ifindex value assigned to a specific interface
and issues a RESTFUL call to get the interface details
file as known by the HP IMC Base Platform ICC module for the target device.
:param de... |
function takest devid and ifindex of specific device and interface and issues a RESTFUL call to shut the specifie d interface on the target device.: param devid: int or str value of the target device | def set_interface_down(devid, ifindex, auth, url):
"""
function takest devid and ifindex of specific device and interface and issues a RESTFUL call to " shut" the specifie
d interface on the target device.
:param devid: int or str value of the target device
:param ifindex: int or str value of the t... |
Creates a new keypair resource policy with the given options. You need an admin privilege for this operation. | async def create(cls, name: str,
default_for_unspecified: int,
total_resource_slots: int,
max_concurrent_sessions: int,
max_containers_per_session: int,
max_vfolder_count: int,
max_vfolder_size:... |
Lists the keypair resource policies. You need an admin privilege for this operation. | async def list(cls, fields: Iterable[str] = None) -> Sequence[dict]:
'''
Lists the keypair resource policies.
You need an admin privilege for this operation.
'''
if fields is None:
fields = (
'name', 'created_at',
'total_resource_slots'... |
Show the server - side information of the currently configured access key. | def keypair():
'''
Show the server-side information of the currently configured access key.
'''
fields = [
('User ID', 'user_id'),
('Access Key', 'access_key'),
('Secret Key', 'secret_key'),
('Active?', 'is_active'),
('Admin?', 'is_admin'),
('Created At', ... |
List and manage keypairs. To show all keypairs or other user s your access key must have the admin privilege. ( admin privilege required ) | def keypairs(ctx, user_id, is_active):
'''
List and manage keypairs.
To show all keypairs or other user's, your access key must have the admin
privilege.
(admin privilege required)
'''
if ctx.invoked_subcommand is not None:
return
fields = [
('User ID', 'user_id'),
... |
Add a new keypair. | def add(user_id, resource_policy, admin, inactive, rate_limit):
'''
Add a new keypair.
USER_ID: User ID of a new key pair.
RESOURCE_POLICY: resource policy for new key pair.
'''
try:
user_id = int(user_id)
except ValueError:
pass # string-based user ID for Backend.AI v1.4+... |
Update an existing keypair. | def update(access_key, resource_policy, is_admin, is_active, rate_limit):
'''
Update an existing keypair.
ACCESS_KEY: Access key of an existing key pair.
'''
with Session() as session:
try:
data = session.KeyPair.update(
access_key,
is_active=is_... |
Delete an existing keypair. | def delete(access_key):
"""
Delete an existing keypair.
ACCESSKEY: ACCESSKEY for a keypair to delete.
"""
with Session() as session:
try:
data = session.KeyPair.delete(access_key)
except Exception as e:
print_error(e)
sys.exit(1)
if not da... |
perform API auth test returning user and team | def login(self):
""" perform API auth test returning user and team """
log.debug('performing auth test')
test = self._get(urls['test'])
user = User({ 'name': test['user'], 'id': test['user_id'] })
self._refresh()
return test['team'], user |
Return User object for a given Slack ID or name | def user(self, match):
""" Return User object for a given Slack ID or name """
if len(match) == 9 and match[0] == 'U':
return self._lookup(User, 'id', match)
return self._lookup(User, 'name', match) |
Return Channel object for a given Slack ID or name | def channel(self, match):
""" Return Channel object for a given Slack ID or name """
if len(match) == 9 and match[0] in ('C','G','D'):
return self._lookup(Channel, 'id', match)
return self._lookup(Channel, 'name', match) |
refresh internal directory cache | def _refresh(self):
""" refresh internal directory cache """
log.debug('refreshing directory cache')
self._users.update(list(self._user_gen()))
self._channels.update(list(self._channel_gen())) |
lookup object in directory with attribute matching value | def match(self, attr, val):
""" lookup object in directory with attribute matching value """
self._lock.acquire()
try:
for x in self:
if getattr(x, attr) == val:
return x
finally:
self._lock.release() |
Collect data into fixed - length chunks or blocks. | def _groups_of_size(iterable, n, fillvalue=None):
"""Collect data into fixed-length chunks or blocks."""
# _groups_of_size('ABCDEFG', 3, 'x') --> ABC DEF Gxx
args = [iter(iterable)] * n
return zip_longest(fillvalue=fillvalue, *args) |
Turn things like slice ( None 2 - 1 ) into: 2: - 1. | def slice_repr(slice_instance):
"""
Turn things like `slice(None, 2, -1)` into `:2:-1`.
"""
if not isinstance(slice_instance, slice):
raise TypeError('Unhandled type {}'.format(type(slice_instance)))
start = slice_instance.start or ''
stop = slice_instance.stop or ''
step = slice_in... |
A function that lazily evaluates a biggus. Chunk. This is useful for passing through as a dask task so that we don t have to compute the chunk in order to compute the graph. | def biggus_chunk(chunk_key, biggus_array, masked):
"""
A function that lazily evaluates a biggus.Chunk. This is useful for
passing through as a dask task so that we don't have to compute the
chunk in order to compute the graph.
"""
if masked:
array = biggus_a... |
Produce task graph entries for an array that comes from a biggus StreamsHandler. | def _make_stream_handler_nodes(self, dsk_graph, array, iteration_order,
masked):
"""
Produce task graph entries for an array that comes from a biggus
StreamsHandler.
This is essentially every type of array that isn't already a thing on
disk/in-... |
Create a lazy chunk creating function with a nice name that is suitable for representation in a dask graph. | def lazy_chunk_creator(name):
"""
Create a lazy chunk creating function with a nice name that is suitable
for representation in a dask graph.
"""
# TODO: Could this become a LazyChunk class?
def biggus_chunk(chunk_key, biggus_array, masked):
"""
A... |
Recursive function that returns the dask items for the given array. | def _make_nodes(self, dsk_graph, array, iteration_order, masked,
top=False):
"""
Recursive function that returns the dask items for the given array.
NOTE: Currently assuming that all tasks are a tuple, with the second
item being the keys used to index the source of t... |
Usecase: Two sets of chunks one spans the whole of a dimension the other chunked it up. We need to know that we need to collect together the chunked form so that we can work with both sets at the same time. | def group_keys(shape, *inputs_keys):
"""
Usecase: Two sets of chunks, one spans the whole of a dimension, the other
chunked it up. We need to know that we need to collect together the
chunked form, so that we can work with both sets at the same time.
Conceptually we have multiple source inputs, ea... |
<Purpose > Return the password entered by the user. If confirm is True the user is asked to enter the previously entered password once again. If they match the password is returned to the caller. | def get_password(prompt='Password: ', confirm=False):
"""
<Purpose>
Return the password entered by the user. If 'confirm' is True, the user is
asked to enter the previously entered password once again. If they match,
the password is returned to the caller.
<Arguments>
prompt:
The text of ... |
<Purpose > Generate an RSA key pair. The public portion of the generated RSA key is saved to < filepath >. pub whereas the private key portion is saved to < filepath >. If no password is given the user is prompted for one. If the password is an empty string the private key is saved unencrypted to < filepath >. If the f... | def generate_and_write_rsa_keypair(filepath=None, bits=DEFAULT_RSA_KEY_BITS,
password=None):
"""
<Purpose>
Generate an RSA key pair. The public portion of the generated RSA key is
saved to <'filepath'>.pub, whereas the private key portion is saved to
<'filepath'>. If no password is given, the user... |
<Purpose > Import the PEM file in filepath containing the private key. | def import_rsa_privatekey_from_file(filepath, password=None,
scheme='rsassa-pss-sha256', prompt=False):
"""
<Purpose>
Import the PEM file in 'filepath' containing the private key.
If password is passed use passed password for decryption.
If prompt is True use entered password for decryption.
If... |
<Purpose > Import the RSA key stored in filepath. The key object returned is in the format securesystemslib. formats. RSAKEY_SCHEMA. If the RSA PEM in filepath contains a private key it is discarded. | def import_rsa_publickey_from_file(filepath):
"""
<Purpose>
Import the RSA key stored in 'filepath'. The key object returned is in the
format 'securesystemslib.formats.RSAKEY_SCHEMA'. If the RSA PEM in
'filepath' contains a private key, it is discarded.
<Arguments>
filepath:
<filepath>.pu... |
<Purpose > Generate an Ed25519 keypair where the encrypted key ( using password as the passphrase ) is saved to < filepath >. The public key portion of the generated Ed25519 key is saved to < filepath >. pub. If the filepath is not given the KEYID is used as the filename and the keypair saved to the current working dir... | def generate_and_write_ed25519_keypair(filepath=None, password=None):
"""
<Purpose>
Generate an Ed25519 keypair, where the encrypted key (using 'password' as
the passphrase) is saved to <'filepath'>. The public key portion of the
generated Ed25519 key is saved to <'filepath'>.pub. If the filepath is n... |
<Purpose > Load the ED25519 public key object ( conformant to securesystemslib. formats. KEY_SCHEMA ) stored in filepath. Return filepath in securesystemslib. formats. ED25519KEY_SCHEMA format. | def import_ed25519_publickey_from_file(filepath):
"""
<Purpose>
Load the ED25519 public key object (conformant to
'securesystemslib.formats.KEY_SCHEMA') stored in 'filepath'. Return
'filepath' in securesystemslib.formats.ED25519KEY_SCHEMA format.
If the key object in 'filepath' contains a private ... |
<Purpose > Import the encrypted ed25519 key file in filepath decrypt it and return the key object in securesystemslib. formats. ED25519KEY_SCHEMA format. | def import_ed25519_privatekey_from_file(filepath, password=None, prompt=False):
"""
<Purpose>
Import the encrypted ed25519 key file in 'filepath', decrypt it, and return
the key object in 'securesystemslib.formats.ED25519KEY_SCHEMA' format.
The private key (may also contain the public part) is encrypte... |
<Purpose > Generate an ECDSA keypair where the encrypted key ( using password as the passphrase ) is saved to < filepath >. The public key portion of the generated ECDSA key is saved to < filepath >. pub. If the filepath is not given the KEYID is used as the filename and the keypair saved to the current working directo... | def generate_and_write_ecdsa_keypair(filepath=None, password=None):
"""
<Purpose>
Generate an ECDSA keypair, where the encrypted key (using 'password' as the
passphrase) is saved to <'filepath'>. The public key portion of the
generated ECDSA key is saved to <'filepath'>.pub. If the filepath is not
... |
<Purpose > Load the ECDSA public key object ( conformant to securesystemslib. formats. KEY_SCHEMA ) stored in filepath. Return filepath in securesystemslib. formats. ECDSAKEY_SCHEMA format. | def import_ecdsa_publickey_from_file(filepath):
"""
<Purpose>
Load the ECDSA public key object (conformant to
'securesystemslib.formats.KEY_SCHEMA') stored in 'filepath'. Return
'filepath' in securesystemslib.formats.ECDSAKEY_SCHEMA format.
If the key object in 'filepath' contains a private key, i... |
<Purpose > Import the encrypted ECDSA key file in filepath decrypt it and return the key object in securesystemslib. formats. ECDSAKEY_SCHEMA format. | def import_ecdsa_privatekey_from_file(filepath, password=None):
"""
<Purpose>
Import the encrypted ECDSA key file in 'filepath', decrypt it, and return
the key object in 'securesystemslib.formats.ECDSAKEY_SCHEMA' format.
The 'cryptography' library is currently supported and performs the actual
cryp... |
Waits until the element identified by locator has focus. You might rather want to use Element Focus Should Be Set | def wait_until_element_has_focus(self, locator, timeout=None):
"""Waits until the element identified by `locator` has focus.
You might rather want to use `Element Focus Should Be Set`
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| timeout | maximum time to wa... |
Waits until the element identified by locator doesn t have focus. You might rather want to use Element Focus Should Not Be Set | def wait_until_element_does_not_have_focus(self, locator, timeout=None):
"""Waits until the element identified by `locator` doesn't have focus.
You might rather want to use `Element Focus Should Not Be Set`
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| timeo... |
Waits until the element identified by locator value is exactly the expected value. You might want to use Element Value Should Be instead. | def wait_until_element_value_is(self, locator, expected, strip=False, timeout=None):
"""Waits until the element identified by `locator` value is exactly the
expected value. You might want to use `Element Value Should Be` instead.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator... |
Waits until the element identified by locator contains the expected value. You might want to use Element Value Should Contain instead. | def wait_until_element_value_contains(self, locator, expected, timeout=None):
"""Waits until the element identified by `locator` contains
the expected value. You might want to use `Element Value Should Contain` instead.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_i... |
Sets focus on the element identified by locator. Should be used with elements meant to have focus only such as text fields. This keywords also waits for the focus to be active by calling the Wait Until Element Has Focus keyword. | def set_element_focus(self, locator):
"""Sets focus on the element identified by `locator`. Should
be used with elements meant to have focus only, such as
text fields. This keywords also waits for the focus to be
active by calling the `Wait Until Element Has Focus` keyword.
| *Argument* | *Description* | *Ex... |
Clears the text field identified by locator | def clear_input_field(self, locator, method=0):
"""Clears the text field identified by `locator`
The element.clear() method doesn't seem to work properly on
all browsers, so this keyword was created to offer alternatives.
The `method` argument defines the method it should use in order
to clear the target fi... |
Verifies the element identified by locator has the expected text color ( it verifies the CSS attribute color ). Color should be in RGBA format. | def element_text_color_should_be(self, locator, expected):
"""Verifies the element identified by `locator` has the expected
text color (it verifies the CSS attribute color). Color should be in
RGBA format.
Example of rgba format: rgba(RED, GREEN, BLUE, ALPHA)
| *Argument* | *Description* | *Example* |
| l... |
Verifies the element identified by locator has the expected background color ( it verifies the CSS attribute background - color ). Color should be in RGBA format. | def element_background_color_should_be(self, locator, expected):
"""Verifies the element identified by `locator` has the expected
background color (it verifies the CSS attribute background-color). Color should
be in RGBA format.
Example of rgba format: rgba(RED, GREEN, BLUE, ALPHA)
| *Argument* | *Descripti... |
Verifies the element identified by locator has the expected width. Expected width should be in pixels. | def element_width_should_be(self, locator, expected):
"""Verifies the element identified by `locator` has the expected
width. Expected width should be in pixels.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| expected | expected width | 800 |"""
self._info... |
Verifies the element identified by locator has the expected height. Expected height should be in pixels. | def element_height_should_be(self, locator, expected):
"""Verifies the element identified by `locator` has the expected
height. Expected height should be in pixels.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| expected | expected height | 600 |"""
self._... |
Verifies the element identified by locator has the expected value. | def element_value_should_be(self, locator, expected, strip=False):
"""Verifies the element identified by `locator` has the expected value.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| expected | expected value | My Name Is Slim Shady |
| strip | Boolean, de... |
Verifies the element identified by locator is not the specified value. | def element_value_should_not_be(self, locator, value, strip=False):
"""Verifies the element identified by `locator` is not the specified value.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| value | value it should not be | My Name Is Slim Shady |
| strip | B... |
Verifies the element identified by locator contains the expected value. | def element_value_should_contain(self, locator, expected):
"""Verifies the element identified by `locator` contains the expected value.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| expected | expected value | Slim Shady |"""
self._info("Verifying element '... |
Verifies the element identified by locator does not contain the specified value. | def element_value_should_not_contain(self, locator, value):
"""Verifies the element identified by `locator` does not contain the specified value.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| value | value it should not contain | Slim Shady |"""
self._info(... |
Verifies the element identified by locator has focus. | def element_focus_should_be_set(self, locator):
"""Verifies the element identified by `locator` has focus.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |"""
self._info("Verifying element '%s' focus is set" % locator)
self._check_element_focus(True, locator) |
Verifies the element identified by locator does not have focus. | def element_focus_should_not_be_set(self, locator):
"""Verifies the element identified by `locator` does not have focus.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |"""
self._info("Verifying element '%s' focus is not set" % locator)
self._check_element_focus... |
Verifies the element identified by locator has the expected value for the targeted prop. | def element_css_attribute_should_be(self, locator, prop, expected):
"""Verifies the element identified by `locator` has the expected
value for the targeted `prop`.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| prop | targeted css attribute | background-color... |
This is a copy of Wait Until Page Contains Element but it allows multiple arguments in order to wait for more than one element. | * Argument * | * Description * | * Example * | | timeout | maximum time to wait if set to $ { None } it will use Selenium s default timeout | 5s | | * locators | Selenium 2 element locator (... | def wait_until_page_contains_elements(self, timeout, *locators):
"""This is a copy of `Wait Until Page Contains Element` but it allows
multiple arguments in order to wait for more than one element.
| *Argument* | *Description* | *Example* |
| timeout | maximum time to wait, if set to ${None} it will use Sele... |
Waits until at least one of the specified elements is found. | * Argument * | * Description * | * Example * | | timeout | maximum time to wait if set to $ { None } it will use Selenium s default timeout | 5s | | * locators | Selenium 2 element locator ( s ) | id = MyId | | def wait_until_page_contains_one_of_these_elements(self, timeout, *locators):
"""Waits until at least one of the specified elements is found.
| *Argument* | *Description* | *Example* |
| timeout | maximum time to wait, if set to ${None} it will use Selenium's default timeout | 5s |
| *locators | Selenium 2 e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.