repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
NuGrid/NuGridPy
nugridpy/mesa.py
history_data.calc_DUP_parameter
def calc_DUP_parameter(self, modeln, label, fig=10, color='r', marker_type='*', h_core_mass=False): """ Method to calculate the DUP parameter evolution for different TPs specified specified by their model number. Parameters ---------- fig : int...
python
def calc_DUP_parameter(self, modeln, label, fig=10, color='r', marker_type='*', h_core_mass=False): """ Method to calculate the DUP parameter evolution for different TPs specified specified by their model number. Parameters ---------- fig : int...
[ "def", "calc_DUP_parameter", "(", "self", ",", "modeln", ",", "label", ",", "fig", "=", "10", ",", "color", "=", "'r'", ",", "marker_type", "=", "'*'", ",", "h_core_mass", "=", "False", ")", ":", "number_DUP", "=", "(", "old_div", "(", "len", "(", "m...
Method to calculate the DUP parameter evolution for different TPs specified specified by their model number. Parameters ---------- fig : integer Figure number to plot. modeln : list Array containing pairs of models each corresponding to a TP. ...
[ "Method", "to", "calculate", "the", "DUP", "parameter", "evolution", "for", "different", "TPs", "specified", "specified", "by", "their", "model", "number", "." ]
train
https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/mesa.py#L3641-L3709
openstack/proliantutils
proliantutils/ilo/snmp/snmp_cpqdisk_sizes.py
_create_usm_user_obj
def _create_usm_user_obj(snmp_cred): """Creates the UsmUserData obj for the given credentials. This method creates an instance for the method hlapi.UsmUserData. The UsmUserData() allows the 'auth_protocol' and 'priv_protocol' to be undefined by user if their pass phrases are provided. :param snmp_...
python
def _create_usm_user_obj(snmp_cred): """Creates the UsmUserData obj for the given credentials. This method creates an instance for the method hlapi.UsmUserData. The UsmUserData() allows the 'auth_protocol' and 'priv_protocol' to be undefined by user if their pass phrases are provided. :param snmp_...
[ "def", "_create_usm_user_obj", "(", "snmp_cred", ")", ":", "auth_protocol", "=", "snmp_cred", ".", "get", "(", "'auth_protocol'", ")", "priv_protocol", "=", "snmp_cred", ".", "get", "(", "'priv_protocol'", ")", "auth_user", "=", "snmp_cred", ".", "get", "(", "...
Creates the UsmUserData obj for the given credentials. This method creates an instance for the method hlapi.UsmUserData. The UsmUserData() allows the 'auth_protocol' and 'priv_protocol' to be undefined by user if their pass phrases are provided. :param snmp_cred: Dictionary of SNMP credentials. ...
[ "Creates", "the", "UsmUserData", "obj", "for", "the", "given", "credentials", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/snmp/snmp_cpqdisk_sizes.py#L55-L100
openstack/proliantutils
proliantutils/ilo/snmp/snmp_cpqdisk_sizes.py
_parse_mibs
def _parse_mibs(iLOIP, snmp_credentials): """Parses the MIBs. :param iLOIP: IP address of the server on which SNMP discovery has to be executed. :param snmp_credentials: a Dictionary of SNMP credentials. auth_user: SNMP user auth_protocol: Auth Protocol au...
python
def _parse_mibs(iLOIP, snmp_credentials): """Parses the MIBs. :param iLOIP: IP address of the server on which SNMP discovery has to be executed. :param snmp_credentials: a Dictionary of SNMP credentials. auth_user: SNMP user auth_protocol: Auth Protocol au...
[ "def", "_parse_mibs", "(", "iLOIP", ",", "snmp_credentials", ")", ":", "result", "=", "{", "}", "usm_user_obj", "=", "_create_usm_user_obj", "(", "snmp_credentials", ")", "try", ":", "for", "(", "errorIndication", ",", "errorStatus", ",", "errorIndex", ",", "v...
Parses the MIBs. :param iLOIP: IP address of the server on which SNMP discovery has to be executed. :param snmp_credentials: a Dictionary of SNMP credentials. auth_user: SNMP user auth_protocol: Auth Protocol auth_prot_pp: Pass phrase value for AuthProtocol. ...
[ "Parses", "the", "MIBs", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/snmp/snmp_cpqdisk_sizes.py#L103-L175
openstack/proliantutils
proliantutils/ilo/snmp/snmp_cpqdisk_sizes.py
_get_disksize_MiB
def _get_disksize_MiB(iLOIP, cred): """Reads the dictionary of parsed MIBs and gets the disk size. :param iLOIP: IP address of the server on which SNMP discovery has to be executed. :param snmp_credentials in a dictionary having following mandatory keys. auth_user: S...
python
def _get_disksize_MiB(iLOIP, cred): """Reads the dictionary of parsed MIBs and gets the disk size. :param iLOIP: IP address of the server on which SNMP discovery has to be executed. :param snmp_credentials in a dictionary having following mandatory keys. auth_user: S...
[ "def", "_get_disksize_MiB", "(", "iLOIP", ",", "cred", ")", ":", "# '1.3.6.1.4.1.232.5.5.1.1', # cpqscsi SAS HBA Table", "# '1.3.6.1.4.1.232.3.2.3.1', # cpqida Drive Array Logical Drive Table", "result", "=", "_parse_mibs", "(", "iLOIP", ",", "cred", ")", "disksize", "=", "...
Reads the dictionary of parsed MIBs and gets the disk size. :param iLOIP: IP address of the server on which SNMP discovery has to be executed. :param snmp_credentials in a dictionary having following mandatory keys. auth_user: SNMP user auth_protocol: Auth Pro...
[ "Reads", "the", "dictionary", "of", "parsed", "MIBs", "and", "gets", "the", "disk", "size", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/snmp/snmp_cpqdisk_sizes.py#L178-L205
openstack/proliantutils
proliantutils/ilo/snmp/snmp_cpqdisk_sizes.py
get_local_gb
def get_local_gb(iLOIP, snmp_credentials): """Gets the maximum disk size among all disks. :param iLOIP: IP address of the server on which SNMP discovery has to be executed. :param snmp_credentials in a dictionary having following mandatory keys. auth_user: SNMP user ...
python
def get_local_gb(iLOIP, snmp_credentials): """Gets the maximum disk size among all disks. :param iLOIP: IP address of the server on which SNMP discovery has to be executed. :param snmp_credentials in a dictionary having following mandatory keys. auth_user: SNMP user ...
[ "def", "get_local_gb", "(", "iLOIP", ",", "snmp_credentials", ")", ":", "disk_sizes", "=", "_get_disksize_MiB", "(", "iLOIP", ",", "snmp_credentials", ")", "max_size", "=", "0", "for", "uuid", "in", "disk_sizes", ":", "for", "key", "in", "disk_sizes", "[", "...
Gets the maximum disk size among all disks. :param iLOIP: IP address of the server on which SNMP discovery has to be executed. :param snmp_credentials in a dictionary having following mandatory keys. auth_user: SNMP user auth_protocol: Auth Protocol ...
[ "Gets", "the", "maximum", "disk", "size", "among", "all", "disks", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/snmp/snmp_cpqdisk_sizes.py#L208-L228
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2017_04_17/common/_error.py
_http_error_handler
def _http_error_handler(http_error): ''' Simple error handler for azure.''' message = str(http_error) if http_error.respbody is not None: message += '\n' + http_error.respbody.decode('utf-8-sig') raise AzureHttpError(message, http_error.status)
python
def _http_error_handler(http_error): ''' Simple error handler for azure.''' message = str(http_error) if http_error.respbody is not None: message += '\n' + http_error.respbody.decode('utf-8-sig') raise AzureHttpError(message, http_error.status)
[ "def", "_http_error_handler", "(", "http_error", ")", ":", "message", "=", "str", "(", "http_error", ")", "if", "http_error", ".", "respbody", "is", "not", "None", ":", "message", "+=", "'\\n'", "+", "http_error", ".", "respbody", ".", "decode", "(", "'utf...
Simple error handler for azure.
[ "Simple", "error", "handler", "for", "azure", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2017_04_17/common/_error.py#L113-L118
openstack/proliantutils
proliantutils/redfish/resources/system/ethernet_interface.py
EthernetInterfaceCollection.summary
def summary(self): """property to return the summary MAC addresses and state This filters the MACs whose health is OK, and in 'Enabled' State would be returned. The returned format will be {<port_id>: <mac_address>}. This is because RIBCL returns the data in format {'Por...
python
def summary(self): """property to return the summary MAC addresses and state This filters the MACs whose health is OK, and in 'Enabled' State would be returned. The returned format will be {<port_id>: <mac_address>}. This is because RIBCL returns the data in format {'Por...
[ "def", "summary", "(", "self", ")", ":", "mac_dict", "=", "{", "}", "for", "eth", "in", "self", ".", "get_members", "(", ")", ":", "if", "eth", ".", "mac_address", "is", "not", "None", ":", "if", "(", "eth", ".", "status", "is", "not", "None", "a...
property to return the summary MAC addresses and state This filters the MACs whose health is OK, and in 'Enabled' State would be returned. The returned format will be {<port_id>: <mac_address>}. This is because RIBCL returns the data in format {'Port 1': 'aa:bb:cc:dd:ee:ff'} and...
[ "property", "to", "return", "the", "summary", "MAC", "addresses", "and", "state" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/ethernet_interface.py#L36-L56
openstack/proliantutils
proliantutils/hpssa/manager.py
_update_physical_disk_details
def _update_physical_disk_details(raid_config, server): """Adds the physical disk details to the RAID configuration passed.""" raid_config['physical_disks'] = [] physical_drives = server.get_physical_drives() for physical_drive in physical_drives: physical_drive_dict = physical_drive.get_physica...
python
def _update_physical_disk_details(raid_config, server): """Adds the physical disk details to the RAID configuration passed.""" raid_config['physical_disks'] = [] physical_drives = server.get_physical_drives() for physical_drive in physical_drives: physical_drive_dict = physical_drive.get_physica...
[ "def", "_update_physical_disk_details", "(", "raid_config", ",", "server", ")", ":", "raid_config", "[", "'physical_disks'", "]", "=", "[", "]", "physical_drives", "=", "server", ".", "get_physical_drives", "(", ")", "for", "physical_drive", "in", "physical_drives",...
Adds the physical disk details to the RAID configuration passed.
[ "Adds", "the", "physical", "disk", "details", "to", "the", "RAID", "configuration", "passed", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/manager.py#L31-L37
openstack/proliantutils
proliantutils/hpssa/manager.py
validate
def validate(raid_config): """Validates the RAID configuration provided. This method validates the RAID configuration provided against a JSON schema. :param raid_config: The RAID configuration to be validated. :raises: InvalidInputError, if validation of the input fails. """ raid_schema_fo...
python
def validate(raid_config): """Validates the RAID configuration provided. This method validates the RAID configuration provided against a JSON schema. :param raid_config: The RAID configuration to be validated. :raises: InvalidInputError, if validation of the input fails. """ raid_schema_fo...
[ "def", "validate", "(", "raid_config", ")", ":", "raid_schema_fobj", "=", "open", "(", "RAID_CONFIG_SCHEMA", ",", "'r'", ")", "raid_config_schema", "=", "json", ".", "load", "(", "raid_schema_fobj", ")", "try", ":", "jsonschema", ".", "validate", "(", "raid_co...
Validates the RAID configuration provided. This method validates the RAID configuration provided against a JSON schema. :param raid_config: The RAID configuration to be validated. :raises: InvalidInputError, if validation of the input fails.
[ "Validates", "the", "RAID", "configuration", "provided", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/manager.py#L40-L75
openstack/proliantutils
proliantutils/hpssa/manager.py
_select_controllers_by
def _select_controllers_by(server, select_condition, msg): """Filters out the hpssa controllers based on the condition. This method updates the server with only the controller which satisfies the condition. The controllers which doesn't satisfies the selection condition will be removed from the list. ...
python
def _select_controllers_by(server, select_condition, msg): """Filters out the hpssa controllers based on the condition. This method updates the server with only the controller which satisfies the condition. The controllers which doesn't satisfies the selection condition will be removed from the list. ...
[ "def", "_select_controllers_by", "(", "server", ",", "select_condition", ",", "msg", ")", ":", "all_controllers", "=", "server", ".", "controllers", "supported_controllers", "=", "[", "c", "for", "c", "in", "all_controllers", "if", "select_condition", "(", "c", ...
Filters out the hpssa controllers based on the condition. This method updates the server with only the controller which satisfies the condition. The controllers which doesn't satisfies the selection condition will be removed from the list. :param server: The object containing all the supported hpssa c...
[ "Filters", "out", "the", "hpssa", "controllers", "based", "on", "the", "condition", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/manager.py#L78-L103
openstack/proliantutils
proliantutils/hpssa/manager.py
create_configuration
def create_configuration(raid_config): """Create a RAID configuration on this server. This method creates the given RAID configuration on the server based on the input passed. :param raid_config: The dictionary containing the requested RAID configuration. This data structure should be as follow...
python
def create_configuration(raid_config): """Create a RAID configuration on this server. This method creates the given RAID configuration on the server based on the input passed. :param raid_config: The dictionary containing the requested RAID configuration. This data structure should be as follow...
[ "def", "create_configuration", "(", "raid_config", ")", ":", "server", "=", "objects", ".", "Server", "(", ")", "select_controllers", "=", "lambda", "x", ":", "not", "x", ".", "properties", ".", "get", "(", "'HBA Mode Enabled'", ",", "False", ")", "_select_c...
Create a RAID configuration on this server. This method creates the given RAID configuration on the server based on the input passed. :param raid_config: The dictionary containing the requested RAID configuration. This data structure should be as follows: raid_config = {'logical_disks': [{'...
[ "Create", "a", "RAID", "configuration", "on", "this", "server", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/manager.py#L106-L212
openstack/proliantutils
proliantutils/hpssa/manager.py
_sort_shared_logical_disks
def _sort_shared_logical_disks(logical_disks): """Sort the logical disks based on the following conditions. When the share_physical_disks is True make sure we create the volume which needs more disks first. This avoids the situation of insufficient disks for some logical volume request. For exampl...
python
def _sort_shared_logical_disks(logical_disks): """Sort the logical disks based on the following conditions. When the share_physical_disks is True make sure we create the volume which needs more disks first. This avoids the situation of insufficient disks for some logical volume request. For exampl...
[ "def", "_sort_shared_logical_disks", "(", "logical_disks", ")", ":", "is_shared", "=", "(", "lambda", "x", ":", "True", "if", "(", "'share_physical_disks'", "in", "x", "and", "x", "[", "'share_physical_disks'", "]", ")", "else", "False", ")", "num_of_disks", "...
Sort the logical disks based on the following conditions. When the share_physical_disks is True make sure we create the volume which needs more disks first. This avoids the situation of insufficient disks for some logical volume request. For example, - two logical disk with number of disks - LD1...
[ "Sort", "the", "logical", "disks", "based", "on", "the", "following", "conditions", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/manager.py#L215-L297
openstack/proliantutils
proliantutils/hpssa/manager.py
delete_configuration
def delete_configuration(): """Delete a RAID configuration on this server. :returns: the current RAID configuration after deleting all the logical disks. """ server = objects.Server() select_controllers = lambda x: not x.properties.get('HBA Mode Enabled', ...
python
def delete_configuration(): """Delete a RAID configuration on this server. :returns: the current RAID configuration after deleting all the logical disks. """ server = objects.Server() select_controllers = lambda x: not x.properties.get('HBA Mode Enabled', ...
[ "def", "delete_configuration", "(", ")", ":", "server", "=", "objects", ".", "Server", "(", ")", "select_controllers", "=", "lambda", "x", ":", "not", "x", ".", "properties", ".", "get", "(", "'HBA Mode Enabled'", ",", "False", ")", "_select_controllers_by", ...
Delete a RAID configuration on this server. :returns: the current RAID configuration after deleting all the logical disks.
[ "Delete", "a", "RAID", "configuration", "on", "this", "server", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/manager.py#L300-L317
openstack/proliantutils
proliantutils/hpssa/manager.py
get_configuration
def get_configuration(): """Get the current RAID configuration. Get the RAID configuration from the server and return it as a dictionary. :returns: A dictionary of the below format. raid_config = { 'logical_disks': [{ 'size_gb': 100, 'raid_level': 1,...
python
def get_configuration(): """Get the current RAID configuration. Get the RAID configuration from the server and return it as a dictionary. :returns: A dictionary of the below format. raid_config = { 'logical_disks': [{ 'size_gb': 100, 'raid_level': 1,...
[ "def", "get_configuration", "(", ")", ":", "server", "=", "objects", ".", "Server", "(", ")", "logical_drives", "=", "server", ".", "get_logical_drives", "(", ")", "raid_config", "=", "{", "}", "raid_config", "[", "'logical_disks'", "]", "=", "[", "]", "fo...
Get the current RAID configuration. Get the RAID configuration from the server and return it as a dictionary. :returns: A dictionary of the below format. raid_config = { 'logical_disks': [{ 'size_gb': 100, 'raid_level': 1, 'physical_disks...
[ "Get", "the", "current", "RAID", "configuration", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/manager.py#L320-L349
openstack/proliantutils
proliantutils/hpssa/manager.py
erase_devices
def erase_devices(): """Erase all the drives on this server. This method performs sanitize erase on all the supported physical drives in this server. This erase cannot be performed on logical drives. :returns: a dictionary of controllers with drives and the erase status. :raises exception.HPSSAExc...
python
def erase_devices(): """Erase all the drives on this server. This method performs sanitize erase on all the supported physical drives in this server. This erase cannot be performed on logical drives. :returns: a dictionary of controllers with drives and the erase status. :raises exception.HPSSAExc...
[ "def", "erase_devices", "(", ")", ":", "server", "=", "objects", ".", "Server", "(", ")", "for", "controller", "in", "server", ".", "controllers", ":", "drives", "=", "[", "x", "for", "x", "in", "controller", ".", "unassigned_physical_drives", "if", "(", ...
Erase all the drives on this server. This method performs sanitize erase on all the supported physical drives in this server. This erase cannot be performed on logical drives. :returns: a dictionary of controllers with drives and the erase status. :raises exception.HPSSAException, if none of the drive...
[ "Erase", "all", "the", "drives", "on", "this", "server", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/manager.py#L362-L402
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/queue/_deserialization.py
_parse_metadata_and_message_count
def _parse_metadata_and_message_count(response): ''' Extracts approximate messages count header. ''' metadata = _parse_metadata(response) headers = _parse_response_for_dict(response) metadata.approximate_message_count = _int_to_str(headers.get('x-ms-approximate-messages-count')) return met...
python
def _parse_metadata_and_message_count(response): ''' Extracts approximate messages count header. ''' metadata = _parse_metadata(response) headers = _parse_response_for_dict(response) metadata.approximate_message_count = _int_to_str(headers.get('x-ms-approximate-messages-count')) return met...
[ "def", "_parse_metadata_and_message_count", "(", "response", ")", ":", "metadata", "=", "_parse_metadata", "(", "response", ")", "headers", "=", "_parse_response_for_dict", "(", "response", ")", "metadata", ".", "approximate_message_count", "=", "_int_to_str", "(", "h...
Extracts approximate messages count header.
[ "Extracts", "approximate", "messages", "count", "header", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/queue/_deserialization.py#L34-L43
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/queue/_deserialization.py
_parse_queue_message_from_headers
def _parse_queue_message_from_headers(response): ''' Extracts pop receipt and time next visible from headers. ''' headers = _parse_response_for_dict(response) message = QueueMessage() message.pop_receipt = headers.get('x-ms-popreceipt') message.time_next_visible = parser.parse(headers.get('...
python
def _parse_queue_message_from_headers(response): ''' Extracts pop receipt and time next visible from headers. ''' headers = _parse_response_for_dict(response) message = QueueMessage() message.pop_receipt = headers.get('x-ms-popreceipt') message.time_next_visible = parser.parse(headers.get('...
[ "def", "_parse_queue_message_from_headers", "(", "response", ")", ":", "headers", "=", "_parse_response_for_dict", "(", "response", ")", "message", "=", "QueueMessage", "(", ")", "message", ".", "pop_receipt", "=", "headers", ".", "get", "(", "'x-ms-popreceipt'", ...
Extracts pop receipt and time next visible from headers.
[ "Extracts", "pop", "receipt", "and", "time", "next", "visible", "from", "headers", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/queue/_deserialization.py#L45-L55
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/queue/_deserialization.py
_convert_xml_to_queue_messages
def _convert_xml_to_queue_messages(response, decode_function): ''' <?xml version="1.0" encoding="utf-8"?> <QueueMessagesList> <QueueMessage> <MessageId>string-message-id</MessageId> <InsertionTime>insertion-time</InsertionTime> <ExpirationTime>expiration-time</Expiratio...
python
def _convert_xml_to_queue_messages(response, decode_function): ''' <?xml version="1.0" encoding="utf-8"?> <QueueMessagesList> <QueueMessage> <MessageId>string-message-id</MessageId> <InsertionTime>insertion-time</InsertionTime> <ExpirationTime>expiration-time</Expiratio...
[ "def", "_convert_xml_to_queue_messages", "(", "response", ",", "decode_function", ")", ":", "if", "response", "is", "None", "or", "response", ".", "body", "is", "None", ":", "return", "response", "messages", "=", "list", "(", ")", "list_element", "=", "ETree",...
<?xml version="1.0" encoding="utf-8"?> <QueueMessagesList> <QueueMessage> <MessageId>string-message-id</MessageId> <InsertionTime>insertion-time</InsertionTime> <ExpirationTime>expiration-time</ExpirationTime> <PopReceipt>opaque-string-receipt-data</PopReceipt> ...
[ "<?xml", "version", "=", "1", ".", "0", "encoding", "=", "utf", "-", "8", "?", ">", "<QueueMessagesList", ">", "<QueueMessage", ">", "<MessageId", ">", "string", "-", "message", "-", "id<", "/", "MessageId", ">", "<InsertionTime", ">", "insertion", "-", ...
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/queue/_deserialization.py#L103-L144
openstack/proliantutils
proliantutils/redfish/resources/system/storage/storage.py
Storage.volumes
def volumes(self): """This property prepares the list of volumes :return a list of volumes. """ return sys_volumes.VolumeCollection( self._conn, utils.get_subresource_path_by(self, 'Volumes'), redfish_version=self.redfish_version)
python
def volumes(self): """This property prepares the list of volumes :return a list of volumes. """ return sys_volumes.VolumeCollection( self._conn, utils.get_subresource_path_by(self, 'Volumes'), redfish_version=self.redfish_version)
[ "def", "volumes", "(", "self", ")", ":", "return", "sys_volumes", ".", "VolumeCollection", "(", "self", ".", "_conn", ",", "utils", ".", "get_subresource_path_by", "(", "self", ",", "'Volumes'", ")", ",", "redfish_version", "=", "self", ".", "redfish_version",...
This property prepares the list of volumes :return a list of volumes.
[ "This", "property", "prepares", "the", "list", "of", "volumes" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/storage/storage.py#L46-L53
openstack/proliantutils
proliantutils/redfish/resources/system/storage/storage.py
Storage._drives_list
def _drives_list(self): """Gets the list of drives :return a list of drives. """ drives_list = [] for member in self.drives: drives_list.append(sys_drives.Drive( self._conn, member.get('@odata.id'), self.redfish_version)) return drives_list
python
def _drives_list(self): """Gets the list of drives :return a list of drives. """ drives_list = [] for member in self.drives: drives_list.append(sys_drives.Drive( self._conn, member.get('@odata.id'), self.redfish_version)) return drives_list
[ "def", "_drives_list", "(", "self", ")", ":", "drives_list", "=", "[", "]", "for", "member", "in", "self", ".", "drives", ":", "drives_list", ".", "append", "(", "sys_drives", ".", "Drive", "(", "self", ".", "_conn", ",", "member", ".", "get", "(", "...
Gets the list of drives :return a list of drives.
[ "Gets", "the", "list", "of", "drives" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/storage/storage.py#L55-L64
openstack/proliantutils
proliantutils/redfish/resources/system/storage/storage.py
Storage.has_ssd
def has_ssd(self): """Return true if any of the drive is ssd""" for member in self._drives_list(): if member.media_type == constants.MEDIA_TYPE_SSD: return True return False
python
def has_ssd(self): """Return true if any of the drive is ssd""" for member in self._drives_list(): if member.media_type == constants.MEDIA_TYPE_SSD: return True return False
[ "def", "has_ssd", "(", "self", ")", ":", "for", "member", "in", "self", ".", "_drives_list", "(", ")", ":", "if", "member", ".", "media_type", "==", "constants", ".", "MEDIA_TYPE_SSD", ":", "return", "True", "return", "False" ]
Return true if any of the drive is ssd
[ "Return", "true", "if", "any", "of", "the", "drive", "is", "ssd" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/storage/storage.py#L78-L83
openstack/proliantutils
proliantutils/redfish/resources/system/storage/storage.py
Storage.has_rotational
def has_rotational(self): """Return true if any of the drive is HDD""" for member in self._drives_list(): if member.media_type == constants.MEDIA_TYPE_HDD: return True return False
python
def has_rotational(self): """Return true if any of the drive is HDD""" for member in self._drives_list(): if member.media_type == constants.MEDIA_TYPE_HDD: return True return False
[ "def", "has_rotational", "(", "self", ")", ":", "for", "member", "in", "self", ".", "_drives_list", "(", ")", ":", "if", "member", ".", "media_type", "==", "constants", ".", "MEDIA_TYPE_HDD", ":", "return", "True", "return", "False" ]
Return true if any of the drive is HDD
[ "Return", "true", "if", "any", "of", "the", "drive", "is", "HDD" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/storage/storage.py#L87-L92
openstack/proliantutils
proliantutils/redfish/resources/system/storage/storage.py
Storage.has_nvme_ssd
def has_nvme_ssd(self): """Return True if the drive is SSD and protocol is NVMe""" for member in self._drives_list(): if (member.media_type == constants.MEDIA_TYPE_SSD and member.protocol == constants.PROTOCOL_NVMe): return True return False
python
def has_nvme_ssd(self): """Return True if the drive is SSD and protocol is NVMe""" for member in self._drives_list(): if (member.media_type == constants.MEDIA_TYPE_SSD and member.protocol == constants.PROTOCOL_NVMe): return True return False
[ "def", "has_nvme_ssd", "(", "self", ")", ":", "for", "member", "in", "self", ".", "_drives_list", "(", ")", ":", "if", "(", "member", ".", "media_type", "==", "constants", ".", "MEDIA_TYPE_SSD", "and", "member", ".", "protocol", "==", "constants", ".", "...
Return True if the drive is SSD and protocol is NVMe
[ "Return", "True", "if", "the", "drive", "is", "SSD", "and", "protocol", "is", "NVMe" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/storage/storage.py#L96-L102
openstack/proliantutils
proliantutils/redfish/resources/system/storage/storage.py
Storage.drive_rotational_speed_rpm
def drive_rotational_speed_rpm(self): """Gets set of rotational speed of the disks""" drv_rot_speed_rpm = set() for member in self._drives_list(): if member.rotation_speed_rpm is not None: drv_rot_speed_rpm.add(member.rotation_speed_rpm) return drv_rot_speed_...
python
def drive_rotational_speed_rpm(self): """Gets set of rotational speed of the disks""" drv_rot_speed_rpm = set() for member in self._drives_list(): if member.rotation_speed_rpm is not None: drv_rot_speed_rpm.add(member.rotation_speed_rpm) return drv_rot_speed_...
[ "def", "drive_rotational_speed_rpm", "(", "self", ")", ":", "drv_rot_speed_rpm", "=", "set", "(", ")", "for", "member", "in", "self", ".", "_drives_list", "(", ")", ":", "if", "member", ".", "rotation_speed_rpm", "is", "not", "None", ":", "drv_rot_speed_rpm", ...
Gets set of rotational speed of the disks
[ "Gets", "set", "of", "rotational", "speed", "of", "the", "disks" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/storage/storage.py#L106-L113
openstack/proliantutils
proliantutils/redfish/resources/system/storage/storage.py
StorageCollection.volumes_maximum_size_bytes
def volumes_maximum_size_bytes(self): """Gets the biggest logical drive :returns the size in MiB. """ return utils.max_safe([member.volumes.maximum_size_bytes for member in self.get_members()])
python
def volumes_maximum_size_bytes(self): """Gets the biggest logical drive :returns the size in MiB. """ return utils.max_safe([member.volumes.maximum_size_bytes for member in self.get_members()])
[ "def", "volumes_maximum_size_bytes", "(", "self", ")", ":", "return", "utils", ".", "max_safe", "(", "[", "member", ".", "volumes", ".", "maximum_size_bytes", "for", "member", "in", "self", ".", "get_members", "(", ")", "]", ")" ]
Gets the biggest logical drive :returns the size in MiB.
[ "Gets", "the", "biggest", "logical", "drive" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/storage/storage.py#L125-L131
openstack/proliantutils
proliantutils/redfish/resources/system/storage/storage.py
StorageCollection.drive_rotational_speed_rpm
def drive_rotational_speed_rpm(self): """Gets set of rotational speed of the disks""" drv_rot_speed_rpm = set() for member in self.get_members(): drv_rot_speed_rpm.update(member.drive_rotational_speed_rpm) return drv_rot_speed_rpm
python
def drive_rotational_speed_rpm(self): """Gets set of rotational speed of the disks""" drv_rot_speed_rpm = set() for member in self.get_members(): drv_rot_speed_rpm.update(member.drive_rotational_speed_rpm) return drv_rot_speed_rpm
[ "def", "drive_rotational_speed_rpm", "(", "self", ")", ":", "drv_rot_speed_rpm", "=", "set", "(", ")", "for", "member", "in", "self", ".", "get_members", "(", ")", ":", "drv_rot_speed_rpm", ".", "update", "(", "member", ".", "drive_rotational_speed_rpm", ")", ...
Gets set of rotational speed of the disks
[ "Gets", "set", "of", "rotational", "speed", "of", "the", "disks" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/storage/storage.py#L172-L177
Azure/azure-multiapi-storage-python
azure/multiapi/cosmosdb/v2017_04_17/common/cloudstorageaccount.py
CloudStorageAccount.create_table_service
def create_table_service(self): ''' Creates a TableService object with the settings specified in the CloudStorageAccount. :return: A service object. :rtype: :class:`~azure.storage.table.tableservice.TableService` ''' try: from ..table.tableservice im...
python
def create_table_service(self): ''' Creates a TableService object with the settings specified in the CloudStorageAccount. :return: A service object. :rtype: :class:`~azure.storage.table.tableservice.TableService` ''' try: from ..table.tableservice im...
[ "def", "create_table_service", "(", "self", ")", ":", "try", ":", "from", ".", ".", "table", ".", "tableservice", "import", "TableService", "return", "TableService", "(", "self", ".", "account_name", ",", "self", ".", "account_key", ",", "sas_token", "=", "s...
Creates a TableService object with the settings specified in the CloudStorageAccount. :return: A service object. :rtype: :class:`~azure.storage.table.tableservice.TableService`
[ "Creates", "a", "TableService", "object", "with", "the", "settings", "specified", "in", "the", "CloudStorageAccount", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/cosmosdb/v2017_04_17/common/cloudstorageaccount.py#L60-L75
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/queue/queueservice.py
QueueService.get_queue_service_properties
def get_queue_service_properties(self, timeout=None): ''' Gets the properties of a storage account's Queue service, including logging, analytics and CORS rules. :param int timeout: The server timeout, expressed in seconds. :return: The queue service properties. ...
python
def get_queue_service_properties(self, timeout=None): ''' Gets the properties of a storage account's Queue service, including logging, analytics and CORS rules. :param int timeout: The server timeout, expressed in seconds. :return: The queue service properties. ...
[ "def", "get_queue_service_properties", "(", "self", ",", "timeout", "=", "None", ")", ":", "request", "=", "HTTPRequest", "(", ")", "request", ".", "method", "=", "'GET'", "request", ".", "host", "=", "self", ".", "_get_host", "(", ")", "request", ".", "...
Gets the properties of a storage account's Queue service, including logging, analytics and CORS rules. :param int timeout: The server timeout, expressed in seconds. :return: The queue service properties. :rtype: :class:`~azure.storage.models.ServiceProperties`
[ "Gets", "the", "properties", "of", "a", "storage", "account", "s", "Queue", "service", "including", "logging", "analytics", "and", "CORS", "rules", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/queue/queueservice.py#L276-L297
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/queue/queueservice.py
QueueService.list_queues
def list_queues(self, prefix=None, num_results=None, include_metadata=False, marker=None, timeout=None): ''' Returns a generator to list the queues. The generator will lazily follow the continuation tokens returned by the service and stop when all queues have been ...
python
def list_queues(self, prefix=None, num_results=None, include_metadata=False, marker=None, timeout=None): ''' Returns a generator to list the queues. The generator will lazily follow the continuation tokens returned by the service and stop when all queues have been ...
[ "def", "list_queues", "(", "self", ",", "prefix", "=", "None", ",", "num_results", "=", "None", ",", "include_metadata", "=", "False", ",", "marker", "=", "None", ",", "timeout", "=", "None", ")", ":", "include", "=", "'metadata'", "if", "include_metadata"...
Returns a generator to list the queues. The generator will lazily follow the continuation tokens returned by the service and stop when all queues have been returned or num_results is reached. If num_results is specified and the account has more than that number of queues, the generat...
[ "Returns", "a", "generator", "to", "list", "the", "queues", ".", "The", "generator", "will", "lazily", "follow", "the", "continuation", "tokens", "returned", "by", "the", "service", "and", "stop", "when", "all", "queues", "have", "been", "returned", "or", "n...
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/queue/queueservice.py#L339-L374
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/queue/queueservice.py
QueueService._list_queues
def _list_queues(self, prefix=None, marker=None, max_results=None, include=None, timeout=None): ''' Returns a list of queues under the specified account. Makes a single list request to the service. Used internally by the list_queues method. :param str prefix: ...
python
def _list_queues(self, prefix=None, marker=None, max_results=None, include=None, timeout=None): ''' Returns a list of queues under the specified account. Makes a single list request to the service. Used internally by the list_queues method. :param str prefix: ...
[ "def", "_list_queues", "(", "self", ",", "prefix", "=", "None", ",", "marker", "=", "None", ",", "max_results", "=", "None", ",", "include", "=", "None", ",", "timeout", "=", "None", ")", ":", "request", "=", "HTTPRequest", "(", ")", "request", ".", ...
Returns a list of queues under the specified account. Makes a single list request to the service. Used internally by the list_queues method. :param str prefix: Filters the results to return only queues with names that begin with the specified prefix. :param str marker: ...
[ "Returns", "a", "list", "of", "queues", "under", "the", "specified", "account", ".", "Makes", "a", "single", "list", "request", "to", "the", "service", ".", "Used", "internally", "by", "the", "list_queues", "method", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/queue/queueservice.py#L376-L416
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/queue/queueservice.py
QueueService.create_queue
def create_queue(self, queue_name, metadata=None, fail_on_exist=False, timeout=None): ''' Creates a queue under the given account. :param str queue_name: The name of the queue to create. A queue name must be from 3 through 63 characters long and may only contain lowerca...
python
def create_queue(self, queue_name, metadata=None, fail_on_exist=False, timeout=None): ''' Creates a queue under the given account. :param str queue_name: The name of the queue to create. A queue name must be from 3 through 63 characters long and may only contain lowerca...
[ "def", "create_queue", "(", "self", ",", "queue_name", ",", "metadata", "=", "None", ",", "fail_on_exist", "=", "False", ",", "timeout", "=", "None", ")", ":", "_validate_not_none", "(", "'queue_name'", ",", "queue_name", ")", "request", "=", "HTTPRequest", ...
Creates a queue under the given account. :param str queue_name: The name of the queue to create. A queue name must be from 3 through 63 characters long and may only contain lowercase letters, numbers, and the dash (-) character. The first and last letters in the queue ...
[ "Creates", "a", "queue", "under", "the", "given", "account", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/queue/queueservice.py#L418-L464
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/queue/queueservice.py
QueueService.get_queue_metadata
def get_queue_metadata(self, queue_name, timeout=None): ''' Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the queue as name-value pairs. :param str queue_name: The name of an existing queue. :param int timeou...
python
def get_queue_metadata(self, queue_name, timeout=None): ''' Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the queue as name-value pairs. :param str queue_name: The name of an existing queue. :param int timeou...
[ "def", "get_queue_metadata", "(", "self", ",", "queue_name", ",", "timeout", "=", "None", ")", ":", "_validate_not_none", "(", "'queue_name'", ",", "queue_name", ")", "request", "=", "HTTPRequest", "(", ")", "request", ".", "method", "=", "'GET'", "request", ...
Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the queue as name-value pairs. :param str queue_name: The name of an existing queue. :param int timeout: The server timeout, expressed in seconds. :return: ...
[ "Retrieves", "user", "-", "defined", "metadata", "and", "queue", "properties", "on", "the", "specified", "queue", ".", "Metadata", "is", "associated", "with", "the", "queue", "as", "name", "-", "value", "pairs", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/queue/queueservice.py#L506-L532
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/queue/queueservice.py
QueueService.set_queue_metadata
def set_queue_metadata(self, queue_name, metadata=None, timeout=None): ''' Sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. :param str queue_name: The name of an existing queue. :param dict metadata: ...
python
def set_queue_metadata(self, queue_name, metadata=None, timeout=None): ''' Sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. :param str queue_name: The name of an existing queue. :param dict metadata: ...
[ "def", "set_queue_metadata", "(", "self", ",", "queue_name", ",", "metadata", "=", "None", ",", "timeout", "=", "None", ")", ":", "_validate_not_none", "(", "'queue_name'", ",", "queue_name", ")", "request", "=", "HTTPRequest", "(", ")", "request", ".", "met...
Sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. :param str queue_name: The name of an existing queue. :param dict metadata: A dict containing name-value pairs to associate with the queue as metadat...
[ "Sets", "user", "-", "defined", "metadata", "on", "the", "specified", "queue", ".", "Metadata", "is", "associated", "with", "the", "queue", "as", "name", "-", "value", "pairs", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/queue/queueservice.py#L534-L557
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/queue/queueservice.py
QueueService.get_queue_acl
def get_queue_acl(self, queue_name, timeout=None): ''' Returns details about any stored access policies specified on the queue that may be used with Shared Access Signatures. :param str queue_name: The name of an existing queue. :param int timeout: The se...
python
def get_queue_acl(self, queue_name, timeout=None): ''' Returns details about any stored access policies specified on the queue that may be used with Shared Access Signatures. :param str queue_name: The name of an existing queue. :param int timeout: The se...
[ "def", "get_queue_acl", "(", "self", ",", "queue_name", ",", "timeout", "=", "None", ")", ":", "_validate_not_none", "(", "'queue_name'", ",", "queue_name", ")", "request", "=", "HTTPRequest", "(", ")", "request", ".", "method", "=", "'GET'", "request", ".",...
Returns details about any stored access policies specified on the queue that may be used with Shared Access Signatures. :param str queue_name: The name of an existing queue. :param int timeout: The server timeout, expressed in seconds. :return: A dictionary of ac...
[ "Returns", "details", "about", "any", "stored", "access", "policies", "specified", "on", "the", "queue", "that", "may", "be", "used", "with", "Shared", "Access", "Signatures", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/queue/queueservice.py#L577-L600
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/queue/queueservice.py
QueueService.set_queue_acl
def set_queue_acl(self, queue_name, signed_identifiers=None, timeout=None): ''' Sets stored access policies for the queue that may be used with Shared Access Signatures. When you set permissions for a queue, the existing permissions are replaced. To update the queue’s...
python
def set_queue_acl(self, queue_name, signed_identifiers=None, timeout=None): ''' Sets stored access policies for the queue that may be used with Shared Access Signatures. When you set permissions for a queue, the existing permissions are replaced. To update the queue’s...
[ "def", "set_queue_acl", "(", "self", ",", "queue_name", ",", "signed_identifiers", "=", "None", ",", "timeout", "=", "None", ")", ":", "_validate_not_none", "(", "'queue_name'", ",", "queue_name", ")", "request", "=", "HTTPRequest", "(", ")", "request", ".", ...
Sets stored access policies for the queue that may be used with Shared Access Signatures. When you set permissions for a queue, the existing permissions are replaced. To update the queue’s permissions, call :func:`~get_queue_acl` to fetch all access policies associated with ...
[ "Sets", "stored", "access", "policies", "for", "the", "queue", "that", "may", "be", "used", "with", "Shared", "Access", "Signatures", ".", "When", "you", "set", "permissions", "for", "a", "queue", "the", "existing", "permissions", "are", "replaced", ".", "To...
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/queue/queueservice.py#L602-L639
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/queue/queueservice.py
QueueService.put_message
def put_message(self, queue_name, content, visibility_timeout=None, time_to_live=None, timeout=None): ''' Adds a new message to the back of the message queue. The visibility timeout specifies the time that the message will be invisible. After the timeout expires, t...
python
def put_message(self, queue_name, content, visibility_timeout=None, time_to_live=None, timeout=None): ''' Adds a new message to the back of the message queue. The visibility timeout specifies the time that the message will be invisible. After the timeout expires, t...
[ "def", "put_message", "(", "self", ",", "queue_name", ",", "content", ",", "visibility_timeout", "=", "None", ",", "time_to_live", "=", "None", ",", "timeout", "=", "None", ")", ":", "_validate_not_none", "(", "'queue_name'", ",", "queue_name", ")", "_validate...
Adds a new message to the back of the message queue. The visibility timeout specifies the time that the message will be invisible. After the timeout expires, the message will become visible. If a visibility timeout is not specified, the default value of 0 is used. The message time-t...
[ "Adds", "a", "new", "message", "to", "the", "back", "of", "the", "message", "queue", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/queue/queueservice.py#L641-L686
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/queue/queueservice.py
QueueService.get_messages
def get_messages(self, queue_name, num_messages=None, visibility_timeout=None, timeout=None): ''' Retrieves one or more messages from the front of the queue. When a message is retrieved from the queue, the response includes the message content and a pop_receipt val...
python
def get_messages(self, queue_name, num_messages=None, visibility_timeout=None, timeout=None): ''' Retrieves one or more messages from the front of the queue. When a message is retrieved from the queue, the response includes the message content and a pop_receipt val...
[ "def", "get_messages", "(", "self", ",", "queue_name", ",", "num_messages", "=", "None", ",", "visibility_timeout", "=", "None", ",", "timeout", "=", "None", ")", ":", "_validate_not_none", "(", "'queue_name'", ",", "queue_name", ")", "request", "=", "HTTPRequ...
Retrieves one or more messages from the front of the queue. When a message is retrieved from the queue, the response includes the message content and a pop_receipt value, which is required to delete the message. The message is not automatically deleted from the queue, but after it has ...
[ "Retrieves", "one", "or", "more", "messages", "from", "the", "front", "of", "the", "queue", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/queue/queueservice.py#L688-L728
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/queue/queueservice.py
QueueService.clear_messages
def clear_messages(self, queue_name, timeout=None): ''' Deletes all messages from the specified queue. :param str queue_name: The name of the queue whose messages to clear. :param int timeout: The server timeout, expressed in seconds. ''' _validat...
python
def clear_messages(self, queue_name, timeout=None): ''' Deletes all messages from the specified queue. :param str queue_name: The name of the queue whose messages to clear. :param int timeout: The server timeout, expressed in seconds. ''' _validat...
[ "def", "clear_messages", "(", "self", ",", "queue_name", ",", "timeout", "=", "None", ")", ":", "_validate_not_none", "(", "'queue_name'", ",", "queue_name", ")", "request", "=", "HTTPRequest", "(", ")", "request", ".", "method", "=", "'DELETE'", "request", ...
Deletes all messages from the specified queue. :param str queue_name: The name of the queue whose messages to clear. :param int timeout: The server timeout, expressed in seconds.
[ "Deletes", "all", "messages", "from", "the", "specified", "queue", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/queue/queueservice.py#L806-L821
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/queue/queueservice.py
QueueService.update_message
def update_message(self, queue_name, message_id, pop_receipt, visibility_timeout, content=None, timeout=None): ''' Updates the visibility timeout of a message. You can also use this operation to update the contents of a message. This operation can be used to cont...
python
def update_message(self, queue_name, message_id, pop_receipt, visibility_timeout, content=None, timeout=None): ''' Updates the visibility timeout of a message. You can also use this operation to update the contents of a message. This operation can be used to cont...
[ "def", "update_message", "(", "self", ",", "queue_name", ",", "message_id", ",", "pop_receipt", ",", "visibility_timeout", ",", "content", "=", "None", ",", "timeout", "=", "None", ")", ":", "_validate_not_none", "(", "'queue_name'", ",", "queue_name", ")", "_...
Updates the visibility timeout of a message. You can also use this operation to update the contents of a message. This operation can be used to continually extend the invisibility of a queue message. This functionality can be useful if you want a worker role to “lease” a queue message...
[ "Updates", "the", "visibility", "timeout", "of", "a", "message", ".", "You", "can", "also", "use", "this", "operation", "to", "update", "the", "contents", "of", "a", "message", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/queue/queueservice.py#L823-L878
openstack/proliantutils
proliantutils/redfish/resources/system/secure_boot.py
SecureBoot.enable_secure_boot
def enable_secure_boot(self, secure_boot_enable): """Enable/Disable secure boot on the server. Caller needs to reset the server after issuing this command to bring this into effect. :param secure_boot_enable: True, if secure boot needs to be enabled for next boot, else Fa...
python
def enable_secure_boot(self, secure_boot_enable): """Enable/Disable secure boot on the server. Caller needs to reset the server after issuing this command to bring this into effect. :param secure_boot_enable: True, if secure boot needs to be enabled for next boot, else Fa...
[ "def", "enable_secure_boot", "(", "self", ",", "secure_boot_enable", ")", ":", "if", "not", "isinstance", "(", "secure_boot_enable", ",", "bool", ")", ":", "msg", "=", "(", "'The parameter \"%(parameter)s\" value \"%(value)s\" is '", "'invalid. Valid values are: True/False....
Enable/Disable secure boot on the server. Caller needs to reset the server after issuing this command to bring this into effect. :param secure_boot_enable: True, if secure boot needs to be enabled for next boot, else False. :raises: InvalidInputError, if the validation of...
[ "Enable", "/", "Disable", "secure", "boot", "on", "the", "server", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/secure_boot.py#L56-L74
openstack/proliantutils
proliantutils/redfish/resources/system/secure_boot.py
SecureBoot.get_allowed_reset_keys_values
def get_allowed_reset_keys_values(self): """Get the allowed values for resetting the system. :returns: A set with the allowed values. """ reset_keys_action = self._get_reset_keys_action_element() if not reset_keys_action.allowed_values: LOG.warning('Could not figure...
python
def get_allowed_reset_keys_values(self): """Get the allowed values for resetting the system. :returns: A set with the allowed values. """ reset_keys_action = self._get_reset_keys_action_element() if not reset_keys_action.allowed_values: LOG.warning('Could not figure...
[ "def", "get_allowed_reset_keys_values", "(", "self", ")", ":", "reset_keys_action", "=", "self", ".", "_get_reset_keys_action_element", "(", ")", "if", "not", "reset_keys_action", ".", "allowed_values", ":", "LOG", ".", "warning", "(", "'Could not figure out the allowed...
Get the allowed values for resetting the system. :returns: A set with the allowed values.
[ "Get", "the", "allowed", "values", "for", "resetting", "the", "system", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/secure_boot.py#L84-L98
openstack/proliantutils
proliantutils/redfish/resources/system/secure_boot.py
SecureBoot.reset_keys
def reset_keys(self, target_value): """Resets the secure boot keys. :param target_value: The target value to be set. :raises: InvalidInputError, if the target value is not allowed. :raises: SushyError, on an error from iLO. """ valid_keys_resets = self.get_al...
python
def reset_keys(self, target_value): """Resets the secure boot keys. :param target_value: The target value to be set. :raises: InvalidInputError, if the target value is not allowed. :raises: SushyError, on an error from iLO. """ valid_keys_resets = self.get_al...
[ "def", "reset_keys", "(", "self", ",", "target_value", ")", ":", "valid_keys_resets", "=", "self", ".", "get_allowed_reset_keys_values", "(", ")", "if", "target_value", "not", "in", "valid_keys_resets", ":", "msg", "=", "(", "'The parameter \"%(parameter)s\" value \"%...
Resets the secure boot keys. :param target_value: The target value to be set. :raises: InvalidInputError, if the target value is not allowed. :raises: SushyError, on an error from iLO.
[ "Resets", "the", "secure", "boot", "keys", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/secure_boot.py#L100-L120
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/_deserialization.py
_parse_properties
def _parse_properties(response, result_class): ''' Extracts out resource properties and metadata information. Ignores the standard http headers. ''' if response is None or response.headers is None: return None props = result_class() for key, value in response.headers: info ...
python
def _parse_properties(response, result_class): ''' Extracts out resource properties and metadata information. Ignores the standard http headers. ''' if response is None or response.headers is None: return None props = result_class() for key, value in response.headers: info ...
[ "def", "_parse_properties", "(", "response", ",", "result_class", ")", ":", "if", "response", "is", "None", "or", "response", ".", "headers", "is", "None", ":", "return", "None", "props", "=", "result_class", "(", ")", "for", "key", ",", "value", "in", "...
Extracts out resource properties and metadata information. Ignores the standard http headers.
[ "Extracts", "out", "resource", "properties", "and", "metadata", "information", ".", "Ignores", "the", "standard", "http", "headers", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/_deserialization.py#L85-L104
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/_deserialization.py
_parse_response_for_dict
def _parse_response_for_dict(response): ''' Extracts name-values from response header. Filter out the standard http headers.''' if response is None: return None http_headers = ['server', 'date', 'location', 'host', 'via', 'proxy-connection', 'connection'] return_dict = _...
python
def _parse_response_for_dict(response): ''' Extracts name-values from response header. Filter out the standard http headers.''' if response is None: return None http_headers = ['server', 'date', 'location', 'host', 'via', 'proxy-connection', 'connection'] return_dict = _...
[ "def", "_parse_response_for_dict", "(", "response", ")", ":", "if", "response", "is", "None", ":", "return", "None", "http_headers", "=", "[", "'server'", ",", "'date'", ",", "'location'", ",", "'host'", ",", "'via'", ",", "'proxy-connection'", ",", "'connecti...
Extracts name-values from response header. Filter out the standard http headers.
[ "Extracts", "name", "-", "values", "from", "response", "header", ".", "Filter", "out", "the", "standard", "http", "headers", "." ]
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/_deserialization.py#L106-L120
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/_deserialization.py
_convert_xml_to_service_properties
def _convert_xml_to_service_properties(xml): ''' <?xml version="1.0" encoding="utf-8"?> <StorageServiceProperties> <Logging> <Version>version-number</Version> <Delete>true|false</Delete> <Read>true|false</Read> <Write>true|false</Write> <Re...
python
def _convert_xml_to_service_properties(xml): ''' <?xml version="1.0" encoding="utf-8"?> <StorageServiceProperties> <Logging> <Version>version-number</Version> <Delete>true|false</Delete> <Read>true|false</Read> <Write>true|false</Write> <Re...
[ "def", "_convert_xml_to_service_properties", "(", "xml", ")", ":", "service_properties_element", "=", "ETree", ".", "fromstring", "(", "xml", ")", "service_properties", "=", "ServiceProperties", "(", ")", "# Logging", "logging", "=", "service_properties_element", ".", ...
<?xml version="1.0" encoding="utf-8"?> <StorageServiceProperties> <Logging> <Version>version-number</Version> <Delete>true|false</Delete> <Read>true|false</Read> <Write>true|false</Write> <RetentionPolicy> <Enabled>true|false</Enabl...
[ "<?xml", "version", "=", "1", ".", "0", "encoding", "=", "utf", "-", "8", "?", ">", "<StorageServiceProperties", ">", "<Logging", ">", "<Version", ">", "version", "-", "number<", "/", "Version", ">", "<Delete", ">", "true|false<", "/", "Delete", ">", "<R...
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/_deserialization.py#L148-L245
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/table/tablebatch.py
TableBatch.insert_entity
def insert_entity(self, entity): ''' Adds an insert entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.insert_entity` for more information on inserts. The operation will not be executed until the batch is committed. :param...
python
def insert_entity(self, entity): ''' Adds an insert entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.insert_entity` for more information on inserts. The operation will not be executed until the batch is committed. :param...
[ "def", "insert_entity", "(", "self", ",", "entity", ")", ":", "request", "=", "_insert_entity", "(", "entity", ")", "self", ".", "_add_to_batch", "(", "entity", "[", "'PartitionKey'", "]", ",", "entity", "[", "'RowKey'", "]", ",", "request", ")" ]
Adds an insert entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.insert_entity` for more information on inserts. The operation will not be executed until the batch is committed. :param entity: The entity to insert. Could be a...
[ "Adds", "an", "insert", "entity", "operation", "to", "the", "batch", ".", "See", ":", "func", ":", "~azure", ".", "storage", ".", "table", ".", "tableservice", ".", "TableService", ".", "insert_entity", "for", "more", "information", "on", "inserts", ".", "...
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/table/tablebatch.py#L48-L62
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/table/tablebatch.py
TableBatch.update_entity
def update_entity(self, entity, if_match='*'): ''' Adds an update entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.update_entity` for more information on updates. The operation will not be executed until the batch is committed. ...
python
def update_entity(self, entity, if_match='*'): ''' Adds an update entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.update_entity` for more information on updates. The operation will not be executed until the batch is committed. ...
[ "def", "update_entity", "(", "self", ",", "entity", ",", "if_match", "=", "'*'", ")", ":", "request", "=", "_update_entity", "(", "entity", ",", "if_match", ")", "self", ".", "_add_to_batch", "(", "entity", "[", "'PartitionKey'", "]", ",", "entity", "[", ...
Adds an update entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.update_entity` for more information on updates. The operation will not be executed until the batch is committed. :param entity: The entity to update. Could be a...
[ "Adds", "an", "update", "entity", "operation", "to", "the", "batch", ".", "See", ":", "func", ":", "~azure", ".", "storage", ".", "table", ".", "tableservice", ".", "TableService", ".", "update_entity", "for", "more", "information", "on", "updates", ".", "...
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/table/tablebatch.py#L64-L86
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/table/tablebatch.py
TableBatch.merge_entity
def merge_entity(self, entity, if_match='*'): ''' Adds a merge entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.merge_entity` for more information on merges. The operation will not be executed until the batch is committed. ...
python
def merge_entity(self, entity, if_match='*'): ''' Adds a merge entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.merge_entity` for more information on merges. The operation will not be executed until the batch is committed. ...
[ "def", "merge_entity", "(", "self", ",", "entity", ",", "if_match", "=", "'*'", ")", ":", "request", "=", "_merge_entity", "(", "entity", ",", "if_match", ")", "self", ".", "_add_to_batch", "(", "entity", "[", "'PartitionKey'", "]", ",", "entity", "[", "...
Adds a merge entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.merge_entity` for more information on merges. The operation will not be executed until the batch is committed. :param entity: The entity to merge. Could be a dict...
[ "Adds", "a", "merge", "entity", "operation", "to", "the", "batch", ".", "See", ":", "func", ":", "~azure", ".", "storage", ".", "table", ".", "tableservice", ".", "TableService", ".", "merge_entity", "for", "more", "information", "on", "merges", ".", "The"...
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/table/tablebatch.py#L88-L110
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/table/tablebatch.py
TableBatch.insert_or_replace_entity
def insert_or_replace_entity(self, entity): ''' Adds an insert or replace entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.insert_or_replace_entity` for more information on insert or replace operations. The operation will not be executed...
python
def insert_or_replace_entity(self, entity): ''' Adds an insert or replace entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.insert_or_replace_entity` for more information on insert or replace operations. The operation will not be executed...
[ "def", "insert_or_replace_entity", "(", "self", ",", "entity", ")", ":", "request", "=", "_insert_or_replace_entity", "(", "entity", ")", "self", ".", "_add_to_batch", "(", "entity", "[", "'PartitionKey'", "]", ",", "entity", "[", "'RowKey'", "]", ",", "reques...
Adds an insert or replace entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.insert_or_replace_entity` for more information on insert or replace operations. The operation will not be executed until the batch is committed. :param entity: ...
[ "Adds", "an", "insert", "or", "replace", "entity", "operation", "to", "the", "batch", ".", "See", ":", "func", ":", "~azure", ".", "storage", ".", "table", ".", "tableservice", ".", "TableService", ".", "insert_or_replace_entity", "for", "more", "information",...
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/table/tablebatch.py#L137-L151
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/table/tablebatch.py
TableBatch.insert_or_merge_entity
def insert_or_merge_entity(self, entity): ''' Adds an insert or merge entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.insert_or_merge_entity` for more information on insert or merge operations. The operation will not be executed until t...
python
def insert_or_merge_entity(self, entity): ''' Adds an insert or merge entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.insert_or_merge_entity` for more information on insert or merge operations. The operation will not be executed until t...
[ "def", "insert_or_merge_entity", "(", "self", ",", "entity", ")", ":", "request", "=", "_insert_or_merge_entity", "(", "entity", ")", "self", ".", "_add_to_batch", "(", "entity", "[", "'PartitionKey'", "]", ",", "entity", "[", "'RowKey'", "]", ",", "request", ...
Adds an insert or merge entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.insert_or_merge_entity` for more information on insert or merge operations. The operation will not be executed until the batch is committed. :param entity: The...
[ "Adds", "an", "insert", "or", "merge", "entity", "operation", "to", "the", "batch", ".", "See", ":", "func", ":", "~azure", ".", "storage", ".", "table", ".", "tableservice", ".", "TableService", ".", "insert_or_merge_entity", "for", "more", "information", "...
train
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/table/tablebatch.py#L153-L167
openstack/proliantutils
proliantutils/redfish/resources/system/iscsi.py
ISCSIResource.iscsi_settings
def iscsi_settings(self): """Property to provide reference to iSCSI settings instance It is calculated once when the first time it is queried. On refresh, this property gets reset. """ return ISCSISettings( self._conn, utils.get_subresource_path_by( s...
python
def iscsi_settings(self): """Property to provide reference to iSCSI settings instance It is calculated once when the first time it is queried. On refresh, this property gets reset. """ return ISCSISettings( self._conn, utils.get_subresource_path_by( s...
[ "def", "iscsi_settings", "(", "self", ")", ":", "return", "ISCSISettings", "(", "self", ".", "_conn", ",", "utils", ".", "get_subresource_path_by", "(", "self", ",", "[", "\"@Redfish.Settings\"", ",", "\"SettingsObject\"", "]", ")", ",", "redfish_version", "=", ...
Property to provide reference to iSCSI settings instance It is calculated once when the first time it is queried. On refresh, this property gets reset.
[ "Property", "to", "provide", "reference", "to", "iSCSI", "settings", "instance" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/iscsi.py#L42-L51
openstack/proliantutils
proliantutils/redfish/resources/system/iscsi.py
ISCSISettings.update_iscsi_settings
def update_iscsi_settings(self, iscsi_data): """Update iscsi data :param data: default iscsi config data """ self._conn.patch(self.path, data=iscsi_data)
python
def update_iscsi_settings(self, iscsi_data): """Update iscsi data :param data: default iscsi config data """ self._conn.patch(self.path, data=iscsi_data)
[ "def", "update_iscsi_settings", "(", "self", ",", "iscsi_data", ")", ":", "self", ".", "_conn", ".", "patch", "(", "self", ".", "path", ",", "data", "=", "iscsi_data", ")" ]
Update iscsi data :param data: default iscsi config data
[ "Update", "iscsi", "data" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/iscsi.py#L61-L66
openstack/proliantutils
proliantutils/redfish/resources/system/storage/smart_storage.py
HPESmartStorage.array_controllers
def array_controllers(self): """This property gets the list of instances for array controllers This property gets the list of instances for array controllers :returns: a list of instances of array controllers. """ return array_controller.HPEArrayControllerCollection( ...
python
def array_controllers(self): """This property gets the list of instances for array controllers This property gets the list of instances for array controllers :returns: a list of instances of array controllers. """ return array_controller.HPEArrayControllerCollection( ...
[ "def", "array_controllers", "(", "self", ")", ":", "return", "array_controller", ".", "HPEArrayControllerCollection", "(", "self", ".", "_conn", ",", "utils", ".", "get_subresource_path_by", "(", "self", ",", "[", "'Links'", ",", "'ArrayControllers'", "]", ")", ...
This property gets the list of instances for array controllers This property gets the list of instances for array controllers :returns: a list of instances of array controllers.
[ "This", "property", "gets", "the", "list", "of", "instances", "for", "array", "controllers" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/storage/smart_storage.py#L37-L46
openstack/proliantutils
proliantutils/ilo/common.py
wait_for_operation_to_complete
def wait_for_operation_to_complete( has_operation_completed, retries=10, delay_bw_retries=5, delay_before_attempts=10, failover_exc=exception.IloError, failover_msg=("Operation did not complete even after multiple " "attempts."), is_silent_loop_exit=False): """Attempts ...
python
def wait_for_operation_to_complete( has_operation_completed, retries=10, delay_bw_retries=5, delay_before_attempts=10, failover_exc=exception.IloError, failover_msg=("Operation did not complete even after multiple " "attempts."), is_silent_loop_exit=False): """Attempts ...
[ "def", "wait_for_operation_to_complete", "(", "has_operation_completed", ",", "retries", "=", "10", ",", "delay_bw_retries", "=", "5", ",", "delay_before_attempts", "=", "10", ",", "failover_exc", "=", "exception", ".", "IloError", ",", "failover_msg", "=", "(", "...
Attempts the provided operation for a specified number of times. If it runs out of attempts, then it raises an exception. On success, it breaks out of the loop. :param has_operation_completed: the method to retry and it needs to return a boolean to indicate success or fa...
[ "Attempts", "the", "provided", "operation", "for", "a", "specified", "number", "of", "times", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/common.py#L37-L81
openstack/proliantutils
proliantutils/ilo/common.py
wait_for_ilo_after_reset
def wait_for_ilo_after_reset(ilo_object): """Continuously polls for iLO to come up after reset.""" is_ilo_up_after_reset = lambda: ilo_object.get_product_name() is not None is_ilo_up_after_reset.__name__ = 'is_ilo_up_after_reset' wait_for_operation_to_complete( is_ilo_up_after_reset, f...
python
def wait_for_ilo_after_reset(ilo_object): """Continuously polls for iLO to come up after reset.""" is_ilo_up_after_reset = lambda: ilo_object.get_product_name() is not None is_ilo_up_after_reset.__name__ = 'is_ilo_up_after_reset' wait_for_operation_to_complete( is_ilo_up_after_reset, f...
[ "def", "wait_for_ilo_after_reset", "(", "ilo_object", ")", ":", "is_ilo_up_after_reset", "=", "lambda", ":", "ilo_object", ".", "get_product_name", "(", ")", "is", "not", "None", "is_ilo_up_after_reset", ".", "__name__", "=", "'is_ilo_up_after_reset'", "wait_for_operati...
Continuously polls for iLO to come up after reset.
[ "Continuously", "polls", "for", "iLO", "to", "come", "up", "after", "reset", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/common.py#L84-L94
openstack/proliantutils
proliantutils/ilo/common.py
wait_for_ris_firmware_update_to_complete
def wait_for_ris_firmware_update_to_complete(ris_object): """Continuously polls for iLO firmware update to complete.""" p_state = ['IDLE'] c_state = ['IDLE'] def has_firmware_flash_completed(): """Checks for completion status of firmware update operation The below table shows the cond...
python
def wait_for_ris_firmware_update_to_complete(ris_object): """Continuously polls for iLO firmware update to complete.""" p_state = ['IDLE'] c_state = ['IDLE'] def has_firmware_flash_completed(): """Checks for completion status of firmware update operation The below table shows the cond...
[ "def", "wait_for_ris_firmware_update_to_complete", "(", "ris_object", ")", ":", "p_state", "=", "[", "'IDLE'", "]", "c_state", "=", "[", "'IDLE'", "]", "def", "has_firmware_flash_completed", "(", ")", ":", "\"\"\"Checks for completion status of firmware update operation\n\n...
Continuously polls for iLO firmware update to complete.
[ "Continuously", "polls", "for", "iLO", "firmware", "update", "to", "complete", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/common.py#L97-L141
openstack/proliantutils
proliantutils/ilo/common.py
wait_for_ribcl_firmware_update_to_complete
def wait_for_ribcl_firmware_update_to_complete(ribcl_object): """Continuously checks for iLO firmware update to complete.""" def is_ilo_reset_initiated(): """Checks for initiation of iLO reset Invokes the ``get_product_name`` api and returns i) True, if exception gets raised as tha...
python
def wait_for_ribcl_firmware_update_to_complete(ribcl_object): """Continuously checks for iLO firmware update to complete.""" def is_ilo_reset_initiated(): """Checks for initiation of iLO reset Invokes the ``get_product_name`` api and returns i) True, if exception gets raised as tha...
[ "def", "wait_for_ribcl_firmware_update_to_complete", "(", "ribcl_object", ")", ":", "def", "is_ilo_reset_initiated", "(", ")", ":", "\"\"\"Checks for initiation of iLO reset\n\n Invokes the ``get_product_name`` api and returns\n i) True, if exception gets raised as that marks...
Continuously checks for iLO firmware update to complete.
[ "Continuously", "checks", "for", "iLO", "firmware", "update", "to", "complete", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/common.py#L144-L174
openstack/proliantutils
proliantutils/ilo/common.py
get_filename_and_extension_of
def get_filename_and_extension_of(target_file): """Gets the base filename and extension of the target file. :param target_file: the complete path of the target file :returns: base filename and extension """ base_target_filename = os.path.basename(target_file) file_name, file_ext_with_dot = os.p...
python
def get_filename_and_extension_of(target_file): """Gets the base filename and extension of the target file. :param target_file: the complete path of the target file :returns: base filename and extension """ base_target_filename = os.path.basename(target_file) file_name, file_ext_with_dot = os.p...
[ "def", "get_filename_and_extension_of", "(", "target_file", ")", ":", "base_target_filename", "=", "os", ".", "path", ".", "basename", "(", "target_file", ")", "file_name", ",", "file_ext_with_dot", "=", "os", ".", "path", ".", "splitext", "(", "base_target_filena...
Gets the base filename and extension of the target file. :param target_file: the complete path of the target file :returns: base filename and extension
[ "Gets", "the", "base", "filename", "and", "extension", "of", "the", "target", "file", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/common.py#L184-L192
openstack/proliantutils
proliantutils/ilo/common.py
add_exec_permission_to
def add_exec_permission_to(target_file): """Add executable permissions to the file :param target_file: the target file whose permission to be changed """ mode = os.stat(target_file).st_mode os.chmod(target_file, mode | stat.S_IXUSR)
python
def add_exec_permission_to(target_file): """Add executable permissions to the file :param target_file: the target file whose permission to be changed """ mode = os.stat(target_file).st_mode os.chmod(target_file, mode | stat.S_IXUSR)
[ "def", "add_exec_permission_to", "(", "target_file", ")", ":", "mode", "=", "os", ".", "stat", "(", "target_file", ")", ".", "st_mode", "os", ".", "chmod", "(", "target_file", ",", "mode", "|", "stat", ".", "S_IXUSR", ")" ]
Add executable permissions to the file :param target_file: the target file whose permission to be changed
[ "Add", "executable", "permissions", "to", "the", "file" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/common.py#L195-L201
openstack/proliantutils
proliantutils/ilo/common.py
get_major_minor
def get_major_minor(ilo_ver_str): """Extract the major and minor number from the passed string :param ilo_ver_str: the string that contains the version information :returns: String of the form "<major>.<minor>" or None """ if not ilo_ver_str: return None try: # Note(vmud213):Thi...
python
def get_major_minor(ilo_ver_str): """Extract the major and minor number from the passed string :param ilo_ver_str: the string that contains the version information :returns: String of the form "<major>.<minor>" or None """ if not ilo_ver_str: return None try: # Note(vmud213):Thi...
[ "def", "get_major_minor", "(", "ilo_ver_str", ")", ":", "if", "not", "ilo_ver_str", ":", "return", "None", "try", ":", "# Note(vmud213):This logic works for all strings", "# that contain the version info as <major>.<minor>", "# Formats of the strings:", "# Release version -> \"...
Extract the major and minor number from the passed string :param ilo_ver_str: the string that contains the version information :returns: String of the form "<major>.<minor>" or None
[ "Extract", "the", "major", "and", "minor", "number", "from", "the", "passed", "string" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/common.py#L204-L226
openstack/proliantutils
proliantutils/ilo/common.py
get_supported_boot_modes
def get_supported_boot_modes(supported_boot_mode_constant): """Retrieves the server supported boot modes It retrieves the server supported boot modes as a namedtuple containing 'boot_mode_bios' as 'true'/'false' (in string format) and 'boot_mode_uefi' again as true'/'false'. :param supported_boot_m...
python
def get_supported_boot_modes(supported_boot_mode_constant): """Retrieves the server supported boot modes It retrieves the server supported boot modes as a namedtuple containing 'boot_mode_bios' as 'true'/'false' (in string format) and 'boot_mode_uefi' again as true'/'false'. :param supported_boot_m...
[ "def", "get_supported_boot_modes", "(", "supported_boot_mode_constant", ")", ":", "boot_mode_bios", "=", "'false'", "boot_mode_uefi", "=", "'false'", "if", "(", "supported_boot_mode_constant", "==", "constants", ".", "SUPPORTED_BOOT_MODE_LEGACY_BIOS_ONLY", ")", ":", "boot_m...
Retrieves the server supported boot modes It retrieves the server supported boot modes as a namedtuple containing 'boot_mode_bios' as 'true'/'false' (in string format) and 'boot_mode_uefi' again as true'/'false'. :param supported_boot_mode_constant: supported boot_mode constant :returns: A namedtup...
[ "Retrieves", "the", "server", "supported", "boot", "modes" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/common.py#L229-L254
openstack/proliantutils
proliantutils/hpssa/objects.py
_get_key_value
def _get_key_value(string): """Return the (key, value) as a tuple from a string.""" # Normally all properties look like this: # Unique Identifier: 600508B1001CE4ACF473EE9C826230FF # Disk Name: /dev/sda # Mount Points: None key = '' value = '' try: key, value = string.split(...
python
def _get_key_value(string): """Return the (key, value) as a tuple from a string.""" # Normally all properties look like this: # Unique Identifier: 600508B1001CE4ACF473EE9C826230FF # Disk Name: /dev/sda # Mount Points: None key = '' value = '' try: key, value = string.split(...
[ "def", "_get_key_value", "(", "string", ")", ":", "# Normally all properties look like this:", "# Unique Identifier: 600508B1001CE4ACF473EE9C826230FF", "# Disk Name: /dev/sda", "# Mount Points: None", "key", "=", "''", "value", "=", "''", "try", ":", "key", ",", "value"...
Return the (key, value) as a tuple from a string.
[ "Return", "the", "(", "key", "value", ")", "as", "a", "tuple", "from", "a", "string", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L35-L62
openstack/proliantutils
proliantutils/hpssa/objects.py
_get_dict
def _get_dict(lines, start_index, indentation, deep): """Recursive function for parsing hpssacli/ssacli output.""" info = {} current_item = None i = start_index while i < len(lines): current_line = lines[i] current_line_indentation = _get_indentation(current_line) # Check...
python
def _get_dict(lines, start_index, indentation, deep): """Recursive function for parsing hpssacli/ssacli output.""" info = {} current_item = None i = start_index while i < len(lines): current_line = lines[i] current_line_indentation = _get_indentation(current_line) # Check...
[ "def", "_get_dict", "(", "lines", ",", "start_index", ",", "indentation", ",", "deep", ")", ":", "info", "=", "{", "}", "current_item", "=", "None", "i", "=", "start_index", "while", "i", "<", "len", "(", "lines", ")", ":", "current_line", "=", "lines"...
Recursive function for parsing hpssacli/ssacli output.
[ "Recursive", "function", "for", "parsing", "hpssacli", "/", "ssacli", "output", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L65-L110
openstack/proliantutils
proliantutils/hpssa/objects.py
_convert_to_dict
def _convert_to_dict(stdout): """Wrapper function for parsing hpssacli/ssacli command. This function gets the output from hpssacli/ssacli command and calls the recursive function _get_dict to return the complete dictionary containing the RAID information. """ lines = stdout.split("\n") lin...
python
def _convert_to_dict(stdout): """Wrapper function for parsing hpssacli/ssacli command. This function gets the output from hpssacli/ssacli command and calls the recursive function _get_dict to return the complete dictionary containing the RAID information. """ lines = stdout.split("\n") lin...
[ "def", "_convert_to_dict", "(", "stdout", ")", ":", "lines", "=", "stdout", ".", "split", "(", "\"\\n\"", ")", "lines", "=", "list", "(", "filter", "(", "None", ",", "lines", ")", ")", "info_dict", ",", "j", "=", "_get_dict", "(", "lines", ",", "0", ...
Wrapper function for parsing hpssacli/ssacli command. This function gets the output from hpssacli/ssacli command and calls the recursive function _get_dict to return the complete dictionary containing the RAID information.
[ "Wrapper", "function", "for", "parsing", "hpssacli", "/", "ssacli", "command", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L113-L124
openstack/proliantutils
proliantutils/hpssa/objects.py
_ssacli
def _ssacli(*args, **kwargs): """Wrapper function for executing hpssacli/ssacli command. This function executes ssacli command if it exists, else it falls back to hpssacli. :param args: args to be provided to hpssacli/ssacli command :param kwargs: kwargs to be sent to processutils except the ...
python
def _ssacli(*args, **kwargs): """Wrapper function for executing hpssacli/ssacli command. This function executes ssacli command if it exists, else it falls back to hpssacli. :param args: args to be provided to hpssacli/ssacli command :param kwargs: kwargs to be sent to processutils except the ...
[ "def", "_ssacli", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "dont_transform_to_hpssa_exception", "=", "kwargs", ".", "get", "(", "'dont_transform_to_hpssa_exception'", ",", "False", ")", "kwargs", ".", "pop", "(", "'dont_transform_to_hpssa_exception'", ...
Wrapper function for executing hpssacli/ssacli command. This function executes ssacli command if it exists, else it falls back to hpssacli. :param args: args to be provided to hpssacli/ssacli command :param kwargs: kwargs to be sent to processutils except the following: - dont_transform...
[ "Wrapper", "function", "for", "executing", "hpssacli", "/", "ssacli", "command", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L127-L169
openstack/proliantutils
proliantutils/hpssa/objects.py
Server.refresh
def refresh(self): """Refresh the server and it's child objects. This method removes all the cache information in the server and it's child objects, and fetches the information again from the server using hpssacli/ssacli command. :raises: HPSSAOperationError, if hpssacli/ssacli...
python
def refresh(self): """Refresh the server and it's child objects. This method removes all the cache information in the server and it's child objects, and fetches the information again from the server using hpssacli/ssacli command. :raises: HPSSAOperationError, if hpssacli/ssacli...
[ "def", "refresh", "(", "self", ")", ":", "config", "=", "self", ".", "_get_all_details", "(", ")", "raid_info", "=", "_convert_to_dict", "(", "config", ")", "self", ".", "controllers", "=", "[", "]", "for", "key", ",", "value", "in", "raid_info", ".", ...
Refresh the server and it's child objects. This method removes all the cache information in the server and it's child objects, and fetches the information again from the server using hpssacli/ssacli command. :raises: HPSSAOperationError, if hpssacli/ssacli operation failed.
[ "Refresh", "the", "server", "and", "it", "s", "child", "objects", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L239-L256
openstack/proliantutils
proliantutils/hpssa/objects.py
Server.get_controller_by_id
def get_controller_by_id(self, id): """Get the controller object given the id. This method returns the controller object for given id. :param id: id of the controller, for example 'Smart Array P822 in Slot 2' :returns: Controller object which has the id or None if the ...
python
def get_controller_by_id(self, id): """Get the controller object given the id. This method returns the controller object for given id. :param id: id of the controller, for example 'Smart Array P822 in Slot 2' :returns: Controller object which has the id or None if the ...
[ "def", "get_controller_by_id", "(", "self", ",", "id", ")", ":", "for", "controller", "in", "self", ".", "controllers", ":", "if", "controller", ".", "id", "==", "id", ":", "return", "controller", "return", "None" ]
Get the controller object given the id. This method returns the controller object for given id. :param id: id of the controller, for example 'Smart Array P822 in Slot 2' :returns: Controller object which has the id or None if the controller is not found.
[ "Get", "the", "controller", "object", "given", "the", "id", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L258-L271
openstack/proliantutils
proliantutils/hpssa/objects.py
Server.get_logical_drives
def get_logical_drives(self): """Get all the RAID logical drives in the Server. This method returns all the RAID logical drives on the server by examining all the controllers. :returns: a list of LogicalDrive objects. """ logical_drives = [] for controller in se...
python
def get_logical_drives(self): """Get all the RAID logical drives in the Server. This method returns all the RAID logical drives on the server by examining all the controllers. :returns: a list of LogicalDrive objects. """ logical_drives = [] for controller in se...
[ "def", "get_logical_drives", "(", "self", ")", ":", "logical_drives", "=", "[", "]", "for", "controller", "in", "self", ".", "controllers", ":", "for", "array", "in", "controller", ".", "raid_arrays", ":", "for", "logical_drive", "in", "array", ".", "logical...
Get all the RAID logical drives in the Server. This method returns all the RAID logical drives on the server by examining all the controllers. :returns: a list of LogicalDrive objects.
[ "Get", "all", "the", "RAID", "logical", "drives", "in", "the", "Server", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L273-L286
openstack/proliantutils
proliantutils/hpssa/objects.py
Server.get_physical_drives
def get_physical_drives(self): """Get all the RAID physical drives on the Server. This method returns all the physical drives on the server by examining all the controllers. :returns: a list of PhysicalDrive objects. """ physical_drives = [] for controller in se...
python
def get_physical_drives(self): """Get all the RAID physical drives on the Server. This method returns all the physical drives on the server by examining all the controllers. :returns: a list of PhysicalDrive objects. """ physical_drives = [] for controller in se...
[ "def", "get_physical_drives", "(", "self", ")", ":", "physical_drives", "=", "[", "]", "for", "controller", "in", "self", ".", "controllers", ":", "# First add unassigned physical drives.", "for", "physical_drive", "in", "controller", ".", "unassigned_physical_drives", ...
Get all the RAID physical drives on the Server. This method returns all the physical drives on the server by examining all the controllers. :returns: a list of PhysicalDrive objects.
[ "Get", "all", "the", "RAID", "physical", "drives", "on", "the", "Server", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L288-L306
openstack/proliantutils
proliantutils/hpssa/objects.py
Server.get_logical_drive_by_wwn
def get_logical_drive_by_wwn(self, wwn): """Get the logical drive object given the wwn. This method returns the logical drive object with the given wwn. :param wwn: wwn of the logical drive :returns: LogicalDrive object which has the wwn or None if logical drive is not foun...
python
def get_logical_drive_by_wwn(self, wwn): """Get the logical drive object given the wwn. This method returns the logical drive object with the given wwn. :param wwn: wwn of the logical drive :returns: LogicalDrive object which has the wwn or None if logical drive is not foun...
[ "def", "get_logical_drive_by_wwn", "(", "self", ",", "wwn", ")", ":", "disk", "=", "[", "x", "for", "x", "in", "self", ".", "get_logical_drives", "(", ")", "if", "x", ".", "wwn", "==", "wwn", "]", "if", "disk", ":", "return", "disk", "[", "0", "]",...
Get the logical drive object given the wwn. This method returns the logical drive object with the given wwn. :param wwn: wwn of the logical drive :returns: LogicalDrive object which has the wwn or None if logical drive is not found.
[ "Get", "the", "logical", "drive", "object", "given", "the", "wwn", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L308-L320
openstack/proliantutils
proliantutils/hpssa/objects.py
Controller.get_physical_drive_by_id
def get_physical_drive_by_id(self, id): """Get a PhysicalDrive object for given id. This method examines both assigned and unassigned physical drives of the controller and returns the physical drive. :param id: id of physical drive, for example '5I:1:1'. :returns: PhysicalDrive...
python
def get_physical_drive_by_id(self, id): """Get a PhysicalDrive object for given id. This method examines both assigned and unassigned physical drives of the controller and returns the physical drive. :param id: id of physical drive, for example '5I:1:1'. :returns: PhysicalDrive...
[ "def", "get_physical_drive_by_id", "(", "self", ",", "id", ")", ":", "for", "phy_drive", "in", "self", ".", "unassigned_physical_drives", ":", "if", "phy_drive", ".", "id", "==", "id", ":", "return", "phy_drive", "for", "array", "in", "self", ".", "raid_arra...
Get a PhysicalDrive object for given id. This method examines both assigned and unassigned physical drives of the controller and returns the physical drive. :param id: id of physical drive, for example '5I:1:1'. :returns: PhysicalDrive object having the id, or None if physi...
[ "Get", "a", "PhysicalDrive", "object", "for", "given", "id", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L350-L367
openstack/proliantutils
proliantutils/hpssa/objects.py
Controller.execute_cmd
def execute_cmd(self, *args, **kwargs): """Execute a given hpssacli/ssacli command on the controller. This method executes a given command on the controller. :params args: a tuple consisting of sub-commands to be appended after specifying the controller in hpssacli/ssacli command. ...
python
def execute_cmd(self, *args, **kwargs): """Execute a given hpssacli/ssacli command on the controller. This method executes a given command on the controller. :params args: a tuple consisting of sub-commands to be appended after specifying the controller in hpssacli/ssacli command. ...
[ "def", "execute_cmd", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "slot", "=", "self", ".", "properties", "[", "'Slot'", "]", "base_cmd", "=", "(", "\"controller\"", ",", "\"slot=%s\"", "%", "slot", ")", "cmd", "=", "base_cmd", ...
Execute a given hpssacli/ssacli command on the controller. This method executes a given command on the controller. :params args: a tuple consisting of sub-commands to be appended after specifying the controller in hpssacli/ssacli command. :param kwargs: kwargs to be passed to execu...
[ "Execute", "a", "given", "hpssacli", "/", "ssacli", "command", "on", "the", "controller", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L369-L382
openstack/proliantutils
proliantutils/hpssa/objects.py
Controller.create_logical_drive
def create_logical_drive(self, logical_drive_info): """Create a logical drive on the controller. This method creates a logical drive on the controller when the logical drive details and physical drive ids are passed to it. :param logical_drive_info: a dictionary containing the details ...
python
def create_logical_drive(self, logical_drive_info): """Create a logical drive on the controller. This method creates a logical drive on the controller when the logical drive details and physical drive ids are passed to it. :param logical_drive_info: a dictionary containing the details ...
[ "def", "create_logical_drive", "(", "self", ",", "logical_drive_info", ")", ":", "cmd_args", "=", "[", "]", "if", "'array'", "in", "logical_drive_info", ":", "cmd_args", ".", "extend", "(", "[", "'array'", ",", "logical_drive_info", "[", "'array'", "]", "]", ...
Create a logical drive on the controller. This method creates a logical drive on the controller when the logical drive details and physical drive ids are passed to it. :param logical_drive_info: a dictionary containing the details of the logical drive as specified in raid config. ...
[ "Create", "a", "logical", "drive", "on", "the", "controller", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L384-L418
openstack/proliantutils
proliantutils/hpssa/objects.py
Controller._get_erase_command
def _get_erase_command(self, drive, pattern): """Return the command arguments based on the pattern. Erase command examples: 1) Sanitize: "ssacli ctrl slot=0 pd 1I:1:1 modify erase erasepattern=overwrite unrestricted=off forced" 2) Zeros: "ssacli ctrl slot=0 pd 1I:1...
python
def _get_erase_command(self, drive, pattern): """Return the command arguments based on the pattern. Erase command examples: 1) Sanitize: "ssacli ctrl slot=0 pd 1I:1:1 modify erase erasepattern=overwrite unrestricted=off forced" 2) Zeros: "ssacli ctrl slot=0 pd 1I:1...
[ "def", "_get_erase_command", "(", "self", ",", "drive", ",", "pattern", ")", ":", "cmd_args", "=", "[", "]", "cmd_args", ".", "append", "(", "\"pd %s\"", "%", "drive", ")", "cmd_args", ".", "extend", "(", "[", "'modify'", ",", "'erase'", ",", "pattern", ...
Return the command arguments based on the pattern. Erase command examples: 1) Sanitize: "ssacli ctrl slot=0 pd 1I:1:1 modify erase erasepattern=overwrite unrestricted=off forced" 2) Zeros: "ssacli ctrl slot=0 pd 1I:1:1 modify erase erasepattern=zero forc...
[ "Return", "the", "command", "arguments", "based", "on", "the", "pattern", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L428-L449
openstack/proliantutils
proliantutils/hpssa/objects.py
Controller.erase_devices
def erase_devices(self, drives): """Perform Erase on all the drives in the controller. This method erases all the hdd and ssd drives in the controller by overwriting the drives with patterns for hdd and erasing storage blocks for ssd drives. The drives would be unavailable until ...
python
def erase_devices(self, drives): """Perform Erase on all the drives in the controller. This method erases all the hdd and ssd drives in the controller by overwriting the drives with patterns for hdd and erasing storage blocks for ssd drives. The drives would be unavailable until ...
[ "def", "erase_devices", "(", "self", ",", "drives", ")", ":", "for", "drive", "in", "drives", ":", "pattern", "=", "'overwrite'", "if", "(", "drive", ".", "disk_type", "==", "constants", ".", "DISK_TYPE_HDD", ")", "else", "'block'", "cmd_args", "=", "self"...
Perform Erase on all the drives in the controller. This method erases all the hdd and ssd drives in the controller by overwriting the drives with patterns for hdd and erasing storage blocks for ssd drives. The drives would be unavailable until successful completion or failure of erase o...
[ "Perform", "Erase", "on", "all", "the", "drives", "in", "the", "controller", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L451-L485
openstack/proliantutils
proliantutils/hpssa/objects.py
RaidArray.can_accomodate
def can_accomodate(self, logical_disk): """Check if this RAID array can accomodate the logical disk. This method uses hpssacli/ssacli command's option to check if the logical disk with desired size and RAID level can be created on this RAID array. :param logical_disk: Dictionar...
python
def can_accomodate(self, logical_disk): """Check if this RAID array can accomodate the logical disk. This method uses hpssacli/ssacli command's option to check if the logical disk with desired size and RAID level can be created on this RAID array. :param logical_disk: Dictionar...
[ "def", "can_accomodate", "(", "self", ",", "logical_disk", ")", ":", "raid_level", "=", "constants", ".", "RAID_LEVEL_INPUT_TO_HPSSA_MAPPING", ".", "get", "(", "logical_disk", "[", "'raid_level'", "]", ",", "logical_disk", "[", "'raid_level'", "]", ")", "args", ...
Check if this RAID array can accomodate the logical disk. This method uses hpssacli/ssacli command's option to check if the logical disk with desired size and RAID level can be created on this RAID array. :param logical_disk: Dictionary of logical disk to be created. :returns: ...
[ "Check", "if", "this", "RAID", "array", "can", "accomodate", "the", "logical", "disk", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L517-L562
openstack/proliantutils
proliantutils/hpssa/objects.py
PhysicalDrive.get_physical_drive_dict
def get_physical_drive_dict(self): """Returns a dictionary of with the details of the physical drive.""" if isinstance(self.parent, RaidArray): controller = self.parent.parent.id status = 'active' else: controller = self.parent.id status = 'ready'...
python
def get_physical_drive_dict(self): """Returns a dictionary of with the details of the physical drive.""" if isinstance(self.parent, RaidArray): controller = self.parent.parent.id status = 'active' else: controller = self.parent.id status = 'ready'...
[ "def", "get_physical_drive_dict", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "parent", ",", "RaidArray", ")", ":", "controller", "=", "self", ".", "parent", ".", "parent", ".", "id", "status", "=", "'active'", "else", ":", "controller", ...
Returns a dictionary of with the details of the physical drive.
[ "Returns", "a", "dictionary", "of", "with", "the", "details", "of", "the", "physical", "drive", "." ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/hpssa/objects.py#L686-L704
openstack/proliantutils
proliantutils/redfish/resources/system/storage/logical_drive.py
HPELogicalDriveCollection.logical_raid_levels
def logical_raid_levels(self): """Gets the raid level for each logical volume :returns the set of list of raid levels configured. """ lg_raid_lvls = set() for member in self.get_members(): lg_raid_lvls.add(mappings.RAID_LEVEL_MAP_REV.get(member.raid)) return ...
python
def logical_raid_levels(self): """Gets the raid level for each logical volume :returns the set of list of raid levels configured. """ lg_raid_lvls = set() for member in self.get_members(): lg_raid_lvls.add(mappings.RAID_LEVEL_MAP_REV.get(member.raid)) return ...
[ "def", "logical_raid_levels", "(", "self", ")", ":", "lg_raid_lvls", "=", "set", "(", ")", "for", "member", "in", "self", ".", "get_members", "(", ")", ":", "lg_raid_lvls", ".", "add", "(", "mappings", ".", "RAID_LEVEL_MAP_REV", ".", "get", "(", "member", ...
Gets the raid level for each logical volume :returns the set of list of raid levels configured.
[ "Gets", "the", "raid", "level", "for", "each", "logical", "volume" ]
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/storage/logical_drive.py#L56-L64
inveniosoftware/invenio-files-rest
invenio_files_rest/helpers.py
send_stream
def send_stream(stream, filename, size, mtime, mimetype=None, restricted=True, as_attachment=False, etag=None, content_md5=None, chunk_size=None, conditional=True, trusted=False): """Send the contents of a file to the client. .. warning:: It is very easy to be exposed t...
python
def send_stream(stream, filename, size, mtime, mimetype=None, restricted=True, as_attachment=False, etag=None, content_md5=None, chunk_size=None, conditional=True, trusted=False): """Send the contents of a file to the client. .. warning:: It is very easy to be exposed t...
[ "def", "send_stream", "(", "stream", ",", "filename", ",", "size", ",", "mtime", ",", "mimetype", "=", "None", ",", "restricted", "=", "True", ",", "as_attachment", "=", "False", ",", "etag", "=", "None", ",", "content_md5", "=", "None", ",", "chunk_size...
Send the contents of a file to the client. .. warning:: It is very easy to be exposed to Cross-Site Scripting (XSS) attacks if you serve user uploaded files. Here are some recommendations: 1. Serve user uploaded files from a separate domain (not a subdomain). This way a...
[ "Send", "the", "contents", "of", "a", "file", "to", "the", "client", "." ]
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/helpers.py#L64-L177
inveniosoftware/invenio-files-rest
invenio_files_rest/helpers.py
sanitize_mimetype
def sanitize_mimetype(mimetype, filename=None): """Sanitize a MIME type so the browser does not render the file.""" # Allow some few mime type like plain text, images and audio. if mimetype in MIMETYPE_WHITELIST: return mimetype # Rewrite HTML, JavaScript, CSS etc to text/plain. if mimetype ...
python
def sanitize_mimetype(mimetype, filename=None): """Sanitize a MIME type so the browser does not render the file.""" # Allow some few mime type like plain text, images and audio. if mimetype in MIMETYPE_WHITELIST: return mimetype # Rewrite HTML, JavaScript, CSS etc to text/plain. if mimetype ...
[ "def", "sanitize_mimetype", "(", "mimetype", ",", "filename", "=", "None", ")", ":", "# Allow some few mime type like plain text, images and audio.", "if", "mimetype", "in", "MIMETYPE_WHITELIST", ":", "return", "mimetype", "# Rewrite HTML, JavaScript, CSS etc to text/plain.", "...
Sanitize a MIME type so the browser does not render the file.
[ "Sanitize", "a", "MIME", "type", "so", "the", "browser", "does", "not", "render", "the", "file", "." ]
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/helpers.py#L180-L190
inveniosoftware/invenio-files-rest
invenio_files_rest/helpers.py
make_path
def make_path(base_uri, path, filename, path_dimensions, split_length): """Generate a path as base location for file instance. :param base_uri: The base URI. :param path: The relative path. :param path_dimensions: Number of chunks the path should be split into. :param split_length: The length of an...
python
def make_path(base_uri, path, filename, path_dimensions, split_length): """Generate a path as base location for file instance. :param base_uri: The base URI. :param path: The relative path. :param path_dimensions: Number of chunks the path should be split into. :param split_length: The length of an...
[ "def", "make_path", "(", "base_uri", ",", "path", ",", "filename", ",", "path_dimensions", ",", "split_length", ")", ":", "assert", "len", "(", "path", ")", ">", "path_dimensions", "*", "split_length", "uri_parts", "=", "[", "]", "for", "i", "in", "range",...
Generate a path as base location for file instance. :param base_uri: The base URI. :param path: The relative path. :param path_dimensions: Number of chunks the path should be split into. :param split_length: The length of any chunk. :returns: A string representing the full path.
[ "Generate", "a", "path", "as", "base", "location", "for", "file", "instance", "." ]
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/helpers.py#L193-L211
inveniosoftware/invenio-files-rest
invenio_files_rest/helpers.py
compute_checksum
def compute_checksum(stream, algo, message_digest, chunk_size=None, progress_callback=None): """Get helper method to compute checksum from a stream. :param stream: File-like object. :param algo: Identifier for checksum algorithm. :param messsage_digest: A message digest instance. ...
python
def compute_checksum(stream, algo, message_digest, chunk_size=None, progress_callback=None): """Get helper method to compute checksum from a stream. :param stream: File-like object. :param algo: Identifier for checksum algorithm. :param messsage_digest: A message digest instance. ...
[ "def", "compute_checksum", "(", "stream", ",", "algo", ",", "message_digest", ",", "chunk_size", "=", "None", ",", "progress_callback", "=", "None", ")", ":", "chunk_size", "=", "chunk_size_or_default", "(", "chunk_size", ")", "bytes_read", "=", "0", "while", ...
Get helper method to compute checksum from a stream. :param stream: File-like object. :param algo: Identifier for checksum algorithm. :param messsage_digest: A message digest instance. :param chunk_size: Read at most size bytes from the file at a time. :param progress_callback: Function accepting o...
[ "Get", "helper", "method", "to", "compute", "checksum", "from", "a", "stream", "." ]
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/helpers.py#L223-L248
inveniosoftware/invenio-files-rest
invenio_files_rest/helpers.py
populate_from_path
def populate_from_path(bucket, source, checksum=True, key_prefix='', chunk_size=None): """Populate a ``bucket`` from all files in path. :param bucket: The bucket (instance or id) to create the object in. :param source: The file or directory path. :param checksum: If ``True`` then...
python
def populate_from_path(bucket, source, checksum=True, key_prefix='', chunk_size=None): """Populate a ``bucket`` from all files in path. :param bucket: The bucket (instance or id) to create the object in. :param source: The file or directory path. :param checksum: If ``True`` then...
[ "def", "populate_from_path", "(", "bucket", ",", "source", ",", "checksum", "=", "True", ",", "key_prefix", "=", "''", ",", "chunk_size", "=", "None", ")", ":", "from", ".", "models", "import", "FileInstance", ",", "ObjectVersion", "def", "create_file", "(",...
Populate a ``bucket`` from all files in path. :param bucket: The bucket (instance or id) to create the object in. :param source: The file or directory path. :param checksum: If ``True`` then a MD5 checksum will be computed for each file. (Default: ``True``) :param key_prefix: The key prefix for...
[ "Populate", "a", "bucket", "from", "all", "files", "in", "path", "." ]
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/helpers.py#L251-L293
django-cumulus/django-cumulus
cumulus/management/commands/syncfiles.py
Command.set_options
def set_options(self, options): """ Sets instance variables based on an options dict """ # COMMAND LINE OPTIONS self.wipe = options.get("wipe") self.test_run = options.get("test_run") self.quiet = options.get("test_run") self.container_name = options.get("...
python
def set_options(self, options): """ Sets instance variables based on an options dict """ # COMMAND LINE OPTIONS self.wipe = options.get("wipe") self.test_run = options.get("test_run") self.quiet = options.get("test_run") self.container_name = options.get("...
[ "def", "set_options", "(", "self", ",", "options", ")", ":", "# COMMAND LINE OPTIONS", "self", ".", "wipe", "=", "options", ".", "get", "(", "\"wipe\"", ")", "self", ".", "test_run", "=", "options", ".", "get", "(", "\"test_run\"", ")", "self", ".", "qui...
Sets instance variables based on an options dict
[ "Sets", "instance", "variables", "based", "on", "an", "options", "dict" ]
train
https://github.com/django-cumulus/django-cumulus/blob/64feb07b857af28f226be4899e875c29405e261d/cumulus/management/commands/syncfiles.py#L45-L97
django-cumulus/django-cumulus
cumulus/management/commands/syncfiles.py
Command.match_cloud
def match_cloud(self, includes, excludes): """ Returns the cloud objects that match the include and exclude patterns. """ cloud_objs = [cloud_obj.name for cloud_obj in self.container.get_objects()] includes_pattern = r"|".join([fnmatch.translate(x) for x in includes]) exc...
python
def match_cloud(self, includes, excludes): """ Returns the cloud objects that match the include and exclude patterns. """ cloud_objs = [cloud_obj.name for cloud_obj in self.container.get_objects()] includes_pattern = r"|".join([fnmatch.translate(x) for x in includes]) exc...
[ "def", "match_cloud", "(", "self", ",", "includes", ",", "excludes", ")", ":", "cloud_objs", "=", "[", "cloud_obj", ".", "name", "for", "cloud_obj", "in", "self", ".", "container", ".", "get_objects", "(", ")", "]", "includes_pattern", "=", "r\"|\"", ".", ...
Returns the cloud objects that match the include and exclude patterns.
[ "Returns", "the", "cloud", "objects", "that", "match", "the", "include", "and", "exclude", "patterns", "." ]
train
https://github.com/django-cumulus/django-cumulus/blob/64feb07b857af28f226be4899e875c29405e261d/cumulus/management/commands/syncfiles.py#L143-L152
django-cumulus/django-cumulus
cumulus/management/commands/syncfiles.py
Command.match_local
def match_local(self, prefix, includes, excludes): """ Filters os.walk() with include and exclude patterns. See: http://stackoverflow.com/a/5141829/93559 """ includes_pattern = r"|".join([fnmatch.translate(x) for x in includes]) excludes_pattern = r"|".join([fnmatch.trans...
python
def match_local(self, prefix, includes, excludes): """ Filters os.walk() with include and exclude patterns. See: http://stackoverflow.com/a/5141829/93559 """ includes_pattern = r"|".join([fnmatch.translate(x) for x in includes]) excludes_pattern = r"|".join([fnmatch.trans...
[ "def", "match_local", "(", "self", ",", "prefix", ",", "includes", ",", "excludes", ")", ":", "includes_pattern", "=", "r\"|\"", ".", "join", "(", "[", "fnmatch", ".", "translate", "(", "x", ")", "for", "x", "in", "includes", "]", ")", "excludes_pattern"...
Filters os.walk() with include and exclude patterns. See: http://stackoverflow.com/a/5141829/93559
[ "Filters", "os", ".", "walk", "()", "with", "include", "and", "exclude", "patterns", ".", "See", ":", "http", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "5141829", "/", "93559" ]
train
https://github.com/django-cumulus/django-cumulus/blob/64feb07b857af28f226be4899e875c29405e261d/cumulus/management/commands/syncfiles.py#L154-L175
django-cumulus/django-cumulus
cumulus/management/commands/syncfiles.py
Command.upload_files
def upload_files(self, abspaths, relpaths, remote_objects): """ Determines files to be uploaded and call ``upload_file`` on each. """ for relpath in relpaths: abspath = [p for p in abspaths if p[len(self.file_root):] == relpath][0] cloud_datetime = remote_objects[...
python
def upload_files(self, abspaths, relpaths, remote_objects): """ Determines files to be uploaded and call ``upload_file`` on each. """ for relpath in relpaths: abspath = [p for p in abspaths if p[len(self.file_root):] == relpath][0] cloud_datetime = remote_objects[...
[ "def", "upload_files", "(", "self", ",", "abspaths", ",", "relpaths", ",", "remote_objects", ")", ":", "for", "relpath", "in", "relpaths", ":", "abspath", "=", "[", "p", "for", "p", "in", "abspaths", "if", "p", "[", "len", "(", "self", ".", "file_root"...
Determines files to be uploaded and call ``upload_file`` on each.
[ "Determines", "files", "to", "be", "uploaded", "and", "call", "upload_file", "on", "each", "." ]
train
https://github.com/django-cumulus/django-cumulus/blob/64feb07b857af28f226be4899e875c29405e261d/cumulus/management/commands/syncfiles.py#L177-L195
django-cumulus/django-cumulus
cumulus/management/commands/syncfiles.py
Command.upload_file
def upload_file(self, abspath, cloud_filename): """ Uploads a file to the container. """ if not self.test_run: content = open(abspath, "rb") content_type = get_content_type(cloud_filename, content) headers = get_headers(cloud_filename, content_type) ...
python
def upload_file(self, abspath, cloud_filename): """ Uploads a file to the container. """ if not self.test_run: content = open(abspath, "rb") content_type = get_content_type(cloud_filename, content) headers = get_headers(cloud_filename, content_type) ...
[ "def", "upload_file", "(", "self", ",", "abspath", ",", "cloud_filename", ")", ":", "if", "not", "self", ".", "test_run", ":", "content", "=", "open", "(", "abspath", ",", "\"rb\"", ")", "content_type", "=", "get_content_type", "(", "cloud_filename", ",", ...
Uploads a file to the container.
[ "Uploads", "a", "file", "to", "the", "container", "." ]
train
https://github.com/django-cumulus/django-cumulus/blob/64feb07b857af28f226be4899e875c29405e261d/cumulus/management/commands/syncfiles.py#L197-L224
django-cumulus/django-cumulus
cumulus/management/commands/syncfiles.py
Command.delete_extra_files
def delete_extra_files(self, relpaths, cloud_objs): """ Deletes any objects from the container that do not exist locally. """ for cloud_obj in cloud_objs: if cloud_obj not in relpaths: if not self.test_run: self.delete_cloud_obj(cloud_obj) ...
python
def delete_extra_files(self, relpaths, cloud_objs): """ Deletes any objects from the container that do not exist locally. """ for cloud_obj in cloud_objs: if cloud_obj not in relpaths: if not self.test_run: self.delete_cloud_obj(cloud_obj) ...
[ "def", "delete_extra_files", "(", "self", ",", "relpaths", ",", "cloud_objs", ")", ":", "for", "cloud_obj", "in", "cloud_objs", ":", "if", "cloud_obj", "not", "in", "relpaths", ":", "if", "not", "self", ".", "test_run", ":", "self", ".", "delete_cloud_obj", ...
Deletes any objects from the container that do not exist locally.
[ "Deletes", "any", "objects", "from", "the", "container", "that", "do", "not", "exist", "locally", "." ]
train
https://github.com/django-cumulus/django-cumulus/blob/64feb07b857af28f226be4899e875c29405e261d/cumulus/management/commands/syncfiles.py#L226-L236
django-cumulus/django-cumulus
cumulus/management/commands/syncfiles.py
Command.delete_cloud_obj
def delete_cloud_obj(self, cloud_obj): """ Deletes an object from the container. """ self._connection.delete_object( container=self.container_name, obj=cloud_obj, )
python
def delete_cloud_obj(self, cloud_obj): """ Deletes an object from the container. """ self._connection.delete_object( container=self.container_name, obj=cloud_obj, )
[ "def", "delete_cloud_obj", "(", "self", ",", "cloud_obj", ")", ":", "self", ".", "_connection", ".", "delete_object", "(", "container", "=", "self", ".", "container_name", ",", "obj", "=", "cloud_obj", ",", ")" ]
Deletes an object from the container.
[ "Deletes", "an", "object", "from", "the", "container", "." ]
train
https://github.com/django-cumulus/django-cumulus/blob/64feb07b857af28f226be4899e875c29405e261d/cumulus/management/commands/syncfiles.py#L238-L245
django-cumulus/django-cumulus
cumulus/management/commands/syncfiles.py
Command.wipe_container
def wipe_container(self): """ Completely wipes out the contents of the container. """ if self.test_run: print("Wipe would delete {0} objects.".format(len(self.container.object_count))) else: if not self.quiet or self.verbosity > 1: print("D...
python
def wipe_container(self): """ Completely wipes out the contents of the container. """ if self.test_run: print("Wipe would delete {0} objects.".format(len(self.container.object_count))) else: if not self.quiet or self.verbosity > 1: print("D...
[ "def", "wipe_container", "(", "self", ")", ":", "if", "self", ".", "test_run", ":", "print", "(", "\"Wipe would delete {0} objects.\"", ".", "format", "(", "len", "(", "self", ".", "container", ".", "object_count", ")", ")", ")", "else", ":", "if", "not", ...
Completely wipes out the contents of the container.
[ "Completely", "wipes", "out", "the", "contents", "of", "the", "container", "." ]
train
https://github.com/django-cumulus/django-cumulus/blob/64feb07b857af28f226be4899e875c29405e261d/cumulus/management/commands/syncfiles.py#L247-L256
django-cumulus/django-cumulus
cumulus/management/commands/syncfiles.py
Command.print_tally
def print_tally(self): """ Prints the final tally to stdout. """ self.update_count = self.upload_count - self.create_count if self.test_run: print("Test run complete with the following results:") print("Skipped {0}. Created {1}. Updated {2}. Deleted {3}.".form...
python
def print_tally(self): """ Prints the final tally to stdout. """ self.update_count = self.upload_count - self.create_count if self.test_run: print("Test run complete with the following results:") print("Skipped {0}. Created {1}. Updated {2}. Deleted {3}.".form...
[ "def", "print_tally", "(", "self", ")", ":", "self", ".", "update_count", "=", "self", ".", "upload_count", "-", "self", ".", "create_count", "if", "self", ".", "test_run", ":", "print", "(", "\"Test run complete with the following results:\"", ")", "print", "("...
Prints the final tally to stdout.
[ "Prints", "the", "final", "tally", "to", "stdout", "." ]
train
https://github.com/django-cumulus/django-cumulus/blob/64feb07b857af28f226be4899e875c29405e261d/cumulus/management/commands/syncfiles.py#L258-L266
django-cumulus/django-cumulus
cumulus/management/commands/container_list.py
Command.handle
def handle(self, *args, **options): """ Lists all the items in a container to stdout. """ self._connection = Auth()._get_connection() if len(args) == 0: containers = self._connection.list_containers() if not containers: print("No container...
python
def handle(self, *args, **options): """ Lists all the items in a container to stdout. """ self._connection = Auth()._get_connection() if len(args) == 0: containers = self._connection.list_containers() if not containers: print("No container...
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "self", ".", "_connection", "=", "Auth", "(", ")", ".", "_get_connection", "(", ")", "if", "len", "(", "args", ")", "==", "0", ":", "containers", "=", "self", "."...
Lists all the items in a container to stdout.
[ "Lists", "all", "the", "items", "in", "a", "container", "to", "stdout", "." ]
train
https://github.com/django-cumulus/django-cumulus/blob/64feb07b857af28f226be4899e875c29405e261d/cumulus/management/commands/container_list.py#L13-L31
inveniosoftware/invenio-files-rest
invenio_files_rest/tasks.py
progress_updater
def progress_updater(size, total): """Progress reporter for checksum verification.""" current_task.update_state( state=state('PROGRESS'), meta=dict(size=size, total=total) )
python
def progress_updater(size, total): """Progress reporter for checksum verification.""" current_task.update_state( state=state('PROGRESS'), meta=dict(size=size, total=total) )
[ "def", "progress_updater", "(", "size", ",", "total", ")", ":", "current_task", ".", "update_state", "(", "state", "=", "state", "(", "'PROGRESS'", ")", ",", "meta", "=", "dict", "(", "size", "=", "size", ",", "total", "=", "total", ")", ")" ]
Progress reporter for checksum verification.
[ "Progress", "reporter", "for", "checksum", "verification", "." ]
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/tasks.py#L32-L37
inveniosoftware/invenio-files-rest
invenio_files_rest/tasks.py
verify_checksum
def verify_checksum(file_id, pessimistic=False, chunk_size=None, throws=True, checksum_kwargs=None): """Verify checksum of a file instance. :param file_id: The file ID. """ f = FileInstance.query.get(uuid.UUID(file_id)) # Anything might happen during the task, so being pessimis...
python
def verify_checksum(file_id, pessimistic=False, chunk_size=None, throws=True, checksum_kwargs=None): """Verify checksum of a file instance. :param file_id: The file ID. """ f = FileInstance.query.get(uuid.UUID(file_id)) # Anything might happen during the task, so being pessimis...
[ "def", "verify_checksum", "(", "file_id", ",", "pessimistic", "=", "False", ",", "chunk_size", "=", "None", ",", "throws", "=", "True", ",", "checksum_kwargs", "=", "None", ")", ":", "f", "=", "FileInstance", ".", "query", ".", "get", "(", "uuid", ".", ...
Verify checksum of a file instance. :param file_id: The file ID.
[ "Verify", "checksum", "of", "a", "file", "instance", "." ]
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/tasks.py#L41-L57
inveniosoftware/invenio-files-rest
invenio_files_rest/tasks.py
schedule_checksum_verification
def schedule_checksum_verification(frequency=None, batch_interval=None, max_count=None, max_size=None, files_query=None, checksum_kwargs=None): """Schedule a batch of files for checksum verification. The pu...
python
def schedule_checksum_verification(frequency=None, batch_interval=None, max_count=None, max_size=None, files_query=None, checksum_kwargs=None): """Schedule a batch of files for checksum verification. The pu...
[ "def", "schedule_checksum_verification", "(", "frequency", "=", "None", ",", "batch_interval", "=", "None", ",", "max_count", "=", "None", ",", "max_size", "=", "None", ",", "files_query", "=", "None", ",", "checksum_kwargs", "=", "None", ")", ":", "assert", ...
Schedule a batch of files for checksum verification. The purpose of this task is to be periodically called through `celerybeat`, in order achieve a repeated verification cycle of all file checksums, while following a set of constraints in order to throttle the execution rate of the checks. :param ...
[ "Schedule", "a", "batch", "of", "files", "for", "checksum", "verification", "." ]
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/tasks.py#L66-L154
inveniosoftware/invenio-files-rest
invenio_files_rest/tasks.py
migrate_file
def migrate_file(src_id, location_name, post_fixity_check=False): """Task to migrate a file instance to a new location. .. note:: If something goes wrong during the content copy, the destination file instance is removed. :param src_id: The :class:`invenio_files_rest.models.FileInstance` ID. :p...
python
def migrate_file(src_id, location_name, post_fixity_check=False): """Task to migrate a file instance to a new location. .. note:: If something goes wrong during the content copy, the destination file instance is removed. :param src_id: The :class:`invenio_files_rest.models.FileInstance` ID. :p...
[ "def", "migrate_file", "(", "src_id", ",", "location_name", ",", "post_fixity_check", "=", "False", ")", ":", "location", "=", "Location", ".", "get_by_name", "(", "location_name", ")", "f_src", "=", "FileInstance", ".", "get", "(", "src_id", ")", "# Create de...
Task to migrate a file instance to a new location. .. note:: If something goes wrong during the content copy, the destination file instance is removed. :param src_id: The :class:`invenio_files_rest.models.FileInstance` ID. :param location_name: Where to migrate the file. :param post_fixity_che...
[ "Task", "to", "migrate", "a", "file", "instance", "to", "a", "new", "location", "." ]
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/tasks.py#L158-L196
inveniosoftware/invenio-files-rest
invenio_files_rest/tasks.py
remove_file_data
def remove_file_data(file_id, silent=True): """Remove file instance and associated data. :param file_id: The :class:`invenio_files_rest.models.FileInstance` ID. :param silent: It stops propagation of a possible arised IntegrityError exception. (Default: ``True``) :raises sqlalchemy.exc.Integrit...
python
def remove_file_data(file_id, silent=True): """Remove file instance and associated data. :param file_id: The :class:`invenio_files_rest.models.FileInstance` ID. :param silent: It stops propagation of a possible arised IntegrityError exception. (Default: ``True``) :raises sqlalchemy.exc.Integrit...
[ "def", "remove_file_data", "(", "file_id", ",", "silent", "=", "True", ")", ":", "try", ":", "# First remove FileInstance from database and commit transaction to", "# ensure integrity constraints are checked and enforced.", "f", "=", "FileInstance", ".", "get", "(", "file_id"...
Remove file instance and associated data. :param file_id: The :class:`invenio_files_rest.models.FileInstance` ID. :param silent: It stops propagation of a possible arised IntegrityError exception. (Default: ``True``) :raises sqlalchemy.exc.IntegrityError: Raised if the database removal goes ...
[ "Remove", "file", "instance", "and", "associated", "data", "." ]
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/tasks.py#L200-L223
inveniosoftware/invenio-files-rest
invenio_files_rest/tasks.py
merge_multipartobject
def merge_multipartobject(upload_id, version_id=None): """Merge multipart object. :param upload_id: The :class:`invenio_files_rest.models.MultipartObject` upload ID. :param version_id: Optionally you can define which file version. (Default: ``None``) :returns: The :class:`invenio_files_...
python
def merge_multipartobject(upload_id, version_id=None): """Merge multipart object. :param upload_id: The :class:`invenio_files_rest.models.MultipartObject` upload ID. :param version_id: Optionally you can define which file version. (Default: ``None``) :returns: The :class:`invenio_files_...
[ "def", "merge_multipartobject", "(", "upload_id", ",", "version_id", "=", "None", ")", ":", "mp", "=", "MultipartObject", ".", "query", ".", "filter_by", "(", "upload_id", "=", "upload_id", ")", ".", "one_or_none", "(", ")", "if", "not", "mp", ":", "raise"...
Merge multipart object. :param upload_id: The :class:`invenio_files_rest.models.MultipartObject` upload ID. :param version_id: Optionally you can define which file version. (Default: ``None``) :returns: The :class:`invenio_files_rest.models.ObjectVersion` version ID.
[ "Merge", "multipart", "object", "." ]
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/tasks.py#L227-L252
inveniosoftware/invenio-files-rest
invenio_files_rest/tasks.py
remove_expired_multipartobjects
def remove_expired_multipartobjects(): """Remove expired multipart objects.""" delta = current_app.config['FILES_REST_MULTIPART_EXPIRES'] expired_dt = datetime.utcnow() - delta file_ids = [] for mp in MultipartObject.query_expired(expired_dt): file_ids.append(str(mp.file_id)) mp.del...
python
def remove_expired_multipartobjects(): """Remove expired multipart objects.""" delta = current_app.config['FILES_REST_MULTIPART_EXPIRES'] expired_dt = datetime.utcnow() - delta file_ids = [] for mp in MultipartObject.query_expired(expired_dt): file_ids.append(str(mp.file_id)) mp.del...
[ "def", "remove_expired_multipartobjects", "(", ")", ":", "delta", "=", "current_app", ".", "config", "[", "'FILES_REST_MULTIPART_EXPIRES'", "]", "expired_dt", "=", "datetime", ".", "utcnow", "(", ")", "-", "delta", "file_ids", "=", "[", "]", "for", "mp", "in",...
Remove expired multipart objects.
[ "Remove", "expired", "multipart", "objects", "." ]
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/tasks.py#L256-L267