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
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface._connect
def _connect(self, mqttc, userdata, flags, rc): """ The callback for when the client receives a CONNACK response from the server. Subscribing in on_connect() means that if we lose the connection and reconnect then subscriptions will be renewed. :param mqttc: The client instance ...
python
def _connect(self, mqttc, userdata, flags, rc): """ The callback for when the client receives a CONNACK response from the server. Subscribing in on_connect() means that if we lose the connection and reconnect then subscriptions will be renewed. :param mqttc: The client instance ...
[ "def", "_connect", "(", "self", ",", "mqttc", ",", "userdata", ",", "flags", ",", "rc", ")", ":", "if", "rc", "==", "0", ":", "self", ".", "connected", "=", "True", "results", "=", "[", "]", "LOGGER", ".", "info", "(", "\"MQTT Connected with result cod...
The callback for when the client receives a CONNACK response from the server. Subscribing in on_connect() means that if we lose the connection and reconnect then subscriptions will be renewed. :param mqttc: The client instance for this callback :param userdata: The private userdata for ...
[ "The", "callback", "for", "when", "the", "client", "receives", "a", "CONNACK", "response", "from", "the", "server", ".", "Subscribing", "in", "on_connect", "()", "means", "that", "if", "we", "lose", "the", "connection", "and", "reconnect", "then", "subscriptio...
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L207-L239
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface._message
def _message(self, mqttc, userdata, msg): """ The callback for when a PUBLISH message is received from the server. :param mqttc: The client instance for this callback :param userdata: The private userdata for the mqtt client. Not used in Polyglot :param flags: The flags set on t...
python
def _message(self, mqttc, userdata, msg): """ The callback for when a PUBLISH message is received from the server. :param mqttc: The client instance for this callback :param userdata: The private userdata for the mqtt client. Not used in Polyglot :param flags: The flags set on t...
[ "def", "_message", "(", "self", ",", "mqttc", ",", "userdata", ",", "msg", ")", ":", "try", ":", "inputCmds", "=", "[", "'query'", ",", "'command'", ",", "'result'", ",", "'status'", ",", "'shortPoll'", ",", "'longPoll'", ",", "'delete'", "]", "parsed_ms...
The callback for when a PUBLISH message is received from the server. :param mqttc: The client instance for this callback :param userdata: The private userdata for the mqtt client. Not used in Polyglot :param flags: The flags set on the connection. :param msg: Dictionary of MQTT received...
[ "The", "callback", "for", "when", "a", "PUBLISH", "message", "is", "received", "from", "the", "server", "." ]
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L241-L272
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface._disconnect
def _disconnect(self, mqttc, userdata, rc): """ The callback for when a DISCONNECT occurs. :param mqttc: The client instance for this callback :param userdata: The private userdata for the mqtt client. Not used in Polyglot :param rc: Result code of connection, 0 = Graceful, anyt...
python
def _disconnect(self, mqttc, userdata, rc): """ The callback for when a DISCONNECT occurs. :param mqttc: The client instance for this callback :param userdata: The private userdata for the mqtt client. Not used in Polyglot :param rc: Result code of connection, 0 = Graceful, anyt...
[ "def", "_disconnect", "(", "self", ",", "mqttc", ",", "userdata", ",", "rc", ")", ":", "self", ".", "connected", "=", "False", "if", "rc", "!=", "0", ":", "LOGGER", ".", "info", "(", "\"MQTT Unexpected disconnection. Trying reconnect.\"", ")", "try", ":", ...
The callback for when a DISCONNECT occurs. :param mqttc: The client instance for this callback :param userdata: The private userdata for the mqtt client. Not used in Polyglot :param rc: Result code of connection, 0 = Graceful, anything else is unclean
[ "The", "callback", "for", "when", "a", "DISCONNECT", "occurs", "." ]
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L274-L292
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface._startMqtt
def _startMqtt(self): """ The client start method. Starts the thread for the MQTT Client and publishes the connected message. """ LOGGER.info('Connecting to MQTT... {}:{}'.format(self._server, self._port)) try: # self._mqttc.connect_async(str(self._server), in...
python
def _startMqtt(self): """ The client start method. Starts the thread for the MQTT Client and publishes the connected message. """ LOGGER.info('Connecting to MQTT... {}:{}'.format(self._server, self._port)) try: # self._mqttc.connect_async(str(self._server), in...
[ "def", "_startMqtt", "(", "self", ")", ":", "LOGGER", ".", "info", "(", "'Connecting to MQTT... {}:{}'", ".", "format", "(", "self", ".", "_server", ",", "self", ".", "_port", ")", ")", "try", ":", "# self._mqttc.connect_async(str(self._server), int(self._port), 10)...
The client start method. Starts the thread for the MQTT Client and publishes the connected message.
[ "The", "client", "start", "method", ".", "Starts", "the", "thread", "for", "the", "MQTT", "Client", "and", "publishes", "the", "connected", "message", "." ]
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L313-L326
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface.stop
def stop(self): """ The client stop method. If the client is currently connected stop the thread and disconnect. Publish the disconnected message if clean shutdown. """ # self.loop.call_soon_threadsafe(self.loop.stop) # self.loop.stop() # self._longPoll.ca...
python
def stop(self): """ The client stop method. If the client is currently connected stop the thread and disconnect. Publish the disconnected message if clean shutdown. """ # self.loop.call_soon_threadsafe(self.loop.stop) # self.loop.stop() # self._longPoll.ca...
[ "def", "stop", "(", "self", ")", ":", "# self.loop.call_soon_threadsafe(self.loop.stop)", "# self.loop.stop()", "# self._longPoll.cancel()", "# self._shortPoll.cancel()", "if", "self", ".", "connected", ":", "LOGGER", ".", "info", "(", "'Disconnecting from MQTT... {}:{}'", "....
The client stop method. If the client is currently connected stop the thread and disconnect. Publish the disconnected message if clean shutdown.
[ "The", "client", "stop", "method", ".", "If", "the", "client", "is", "currently", "connected", "stop", "the", "thread", "and", "disconnect", ".", "Publish", "the", "disconnected", "message", "if", "clean", "shutdown", "." ]
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L328-L347
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface.send
def send(self, message): """ Formatted Message to send to Polyglot. Connection messages are sent automatically from this module so this method is used to send commands to/from Polyglot and formats it for consumption """ if not isinstance(message, dict) and self.connected: ...
python
def send(self, message): """ Formatted Message to send to Polyglot. Connection messages are sent automatically from this module so this method is used to send commands to/from Polyglot and formats it for consumption """ if not isinstance(message, dict) and self.connected: ...
[ "def", "send", "(", "self", ",", "message", ")", ":", "if", "not", "isinstance", "(", "message", ",", "dict", ")", "and", "self", ".", "connected", ":", "warnings", ".", "warn", "(", "'payload not a dictionary'", ")", "return", "False", "try", ":", "mess...
Formatted Message to send to Polyglot. Connection messages are sent automatically from this module so this method is used to send commands to/from Polyglot and formats it for consumption
[ "Formatted", "Message", "to", "send", "to", "Polyglot", ".", "Connection", "messages", "are", "sent", "automatically", "from", "this", "module", "so", "this", "method", "is", "used", "to", "send", "commands", "to", "/", "from", "Polyglot", "and", "formats", ...
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L349-L361
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface.addNode
def addNode(self, node): """ Add a node to the NodeServer :param node: Dictionary of node settings. Keys: address, name, node_def_id, primary, and drivers are required. """ LOGGER.info('Adding node {}({})'.format(node.name, node.address)) message = { 'addnode...
python
def addNode(self, node): """ Add a node to the NodeServer :param node: Dictionary of node settings. Keys: address, name, node_def_id, primary, and drivers are required. """ LOGGER.info('Adding node {}({})'.format(node.name, node.address)) message = { 'addnode...
[ "def", "addNode", "(", "self", ",", "node", ")", ":", "LOGGER", ".", "info", "(", "'Adding node {}({})'", ".", "format", "(", "node", ".", "name", ",", "node", ".", "address", ")", ")", "message", "=", "{", "'addnode'", ":", "{", "'nodes'", ":", "[",...
Add a node to the NodeServer :param node: Dictionary of node settings. Keys: address, name, node_def_id, primary, and drivers are required.
[ "Add", "a", "node", "to", "the", "NodeServer" ]
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L363-L382
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface.saveCustomData
def saveCustomData(self, data): """ Send custom dictionary to Polyglot to save and be retrieved on startup. :param data: Dictionary of key value pairs to store in Polyglot database. """ LOGGER.info('Sending customData to Polyglot.') message = { 'customdata': data } ...
python
def saveCustomData(self, data): """ Send custom dictionary to Polyglot to save and be retrieved on startup. :param data: Dictionary of key value pairs to store in Polyglot database. """ LOGGER.info('Sending customData to Polyglot.') message = { 'customdata': data } ...
[ "def", "saveCustomData", "(", "self", ",", "data", ")", ":", "LOGGER", ".", "info", "(", "'Sending customData to Polyglot.'", ")", "message", "=", "{", "'customdata'", ":", "data", "}", "self", ".", "send", "(", "message", ")" ]
Send custom dictionary to Polyglot to save and be retrieved on startup. :param data: Dictionary of key value pairs to store in Polyglot database.
[ "Send", "custom", "dictionary", "to", "Polyglot", "to", "save", "and", "be", "retrieved", "on", "startup", "." ]
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L384-L392
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface.saveCustomParams
def saveCustomParams(self, data): """ Send custom dictionary to Polyglot to save and be retrieved on startup. :param data: Dictionary of key value pairs to store in Polyglot database. """ LOGGER.info('Sending customParams to Polyglot.') message = { 'customparams': data }...
python
def saveCustomParams(self, data): """ Send custom dictionary to Polyglot to save and be retrieved on startup. :param data: Dictionary of key value pairs to store in Polyglot database. """ LOGGER.info('Sending customParams to Polyglot.') message = { 'customparams': data }...
[ "def", "saveCustomParams", "(", "self", ",", "data", ")", ":", "LOGGER", ".", "info", "(", "'Sending customParams to Polyglot.'", ")", "message", "=", "{", "'customparams'", ":", "data", "}", "self", ".", "send", "(", "message", ")" ]
Send custom dictionary to Polyglot to save and be retrieved on startup. :param data: Dictionary of key value pairs to store in Polyglot database.
[ "Send", "custom", "dictionary", "to", "Polyglot", "to", "save", "and", "be", "retrieved", "on", "startup", "." ]
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L394-L402
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface.addNotice
def addNotice(self, data): """ Add custom notice to front-end for this NodeServers :param data: String of characters to add as a notification in the front-end. """ LOGGER.info('Sending addnotice to Polyglot: {}'.format(data)) message = { 'addnotice': data } self....
python
def addNotice(self, data): """ Add custom notice to front-end for this NodeServers :param data: String of characters to add as a notification in the front-end. """ LOGGER.info('Sending addnotice to Polyglot: {}'.format(data)) message = { 'addnotice': data } self....
[ "def", "addNotice", "(", "self", ",", "data", ")", ":", "LOGGER", ".", "info", "(", "'Sending addnotice to Polyglot: {}'", ".", "format", "(", "data", ")", ")", "message", "=", "{", "'addnotice'", ":", "data", "}", "self", ".", "send", "(", "message", ")...
Add custom notice to front-end for this NodeServers :param data: String of characters to add as a notification in the front-end.
[ "Add", "custom", "notice", "to", "front", "-", "end", "for", "this", "NodeServers" ]
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L404-L412
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface.removeNotice
def removeNotice(self, data): """ Add custom notice to front-end for this NodeServers :param data: Index of notices list to remove. """ LOGGER.info('Sending removenotice to Polyglot for index {}'.format(data)) message = { 'removenotice': data } self.send(message)
python
def removeNotice(self, data): """ Add custom notice to front-end for this NodeServers :param data: Index of notices list to remove. """ LOGGER.info('Sending removenotice to Polyglot for index {}'.format(data)) message = { 'removenotice': data } self.send(message)
[ "def", "removeNotice", "(", "self", ",", "data", ")", ":", "LOGGER", ".", "info", "(", "'Sending removenotice to Polyglot for index {}'", ".", "format", "(", "data", ")", ")", "message", "=", "{", "'removenotice'", ":", "data", "}", "self", ".", "send", "(",...
Add custom notice to front-end for this NodeServers :param data: Index of notices list to remove.
[ "Add", "custom", "notice", "to", "front", "-", "end", "for", "this", "NodeServers" ]
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L414-L422
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface.delNode
def delNode(self, address): """ Delete a node from the NodeServer :param node: Dictionary of node settings. Keys: address, name, node_def_id, primary, and drivers are required. """ LOGGER.info('Removing node {}'.format(address)) message = { 'removenode': { ...
python
def delNode(self, address): """ Delete a node from the NodeServer :param node: Dictionary of node settings. Keys: address, name, node_def_id, primary, and drivers are required. """ LOGGER.info('Removing node {}'.format(address)) message = { 'removenode': { ...
[ "def", "delNode", "(", "self", ",", "address", ")", ":", "LOGGER", ".", "info", "(", "'Removing node {}'", ".", "format", "(", "address", ")", ")", "message", "=", "{", "'removenode'", ":", "{", "'address'", ":", "address", "}", "}", "self", ".", "send...
Delete a node from the NodeServer :param node: Dictionary of node settings. Keys: address, name, node_def_id, primary, and drivers are required.
[ "Delete", "a", "node", "from", "the", "NodeServer" ]
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L439-L451
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface.getNode
def getNode(self, address): """ Get Node by Address of existing nodes. """ try: for node in self.config['nodes']: if node['address'] == address: return node return False except KeyError: LOGGER.error('Usually...
python
def getNode(self, address): """ Get Node by Address of existing nodes. """ try: for node in self.config['nodes']: if node['address'] == address: return node return False except KeyError: LOGGER.error('Usually...
[ "def", "getNode", "(", "self", ",", "address", ")", ":", "try", ":", "for", "node", "in", "self", ".", "config", "[", "'nodes'", "]", ":", "if", "node", "[", "'address'", "]", "==", "address", ":", "return", "node", "return", "False", "except", "KeyE...
Get Node by Address of existing nodes.
[ "Get", "Node", "by", "Address", "of", "existing", "nodes", "." ]
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L453-L464
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface.inConfig
def inConfig(self, config): """ Save incoming config received from Polyglot to Interface.config and then do any functions that are waiting on the config to be received. """ self.config = config self.isyVersion = config['isyVersion'] try: for watcher in...
python
def inConfig(self, config): """ Save incoming config received from Polyglot to Interface.config and then do any functions that are waiting on the config to be received. """ self.config = config self.isyVersion = config['isyVersion'] try: for watcher in...
[ "def", "inConfig", "(", "self", ",", "config", ")", ":", "self", ".", "config", "=", "config", "self", ".", "isyVersion", "=", "config", "[", "'isyVersion'", "]", "try", ":", "for", "watcher", "in", "self", ".", "__configObservers", ":", "watcher", "(", ...
Save incoming config received from Polyglot to Interface.config and then do any functions that are waiting on the config to be received.
[ "Save", "incoming", "config", "received", "from", "Polyglot", "to", "Interface", ".", "config", "and", "then", "do", "any", "functions", "that", "are", "waiting", "on", "the", "config", "to", "be", "received", "." ]
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L466-L480
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface.save_typed_params
def save_typed_params(self, data): """ Send custom parameters descriptions to Polyglot to be used in front end UI configuration screen Accepts list of objects with the followin properties name - used as a key when data is sent from UI title - displayed in UI ...
python
def save_typed_params(self, data): """ Send custom parameters descriptions to Polyglot to be used in front end UI configuration screen Accepts list of objects with the followin properties name - used as a key when data is sent from UI title - displayed in UI ...
[ "def", "save_typed_params", "(", "self", ",", "data", ")", ":", "LOGGER", ".", "info", "(", "'Sending typed parameters to Polyglot.'", ")", "if", "type", "(", "data", ")", "is", "not", "list", ":", "data", "=", "[", "data", "]", "message", "=", "{", "'ty...
Send custom parameters descriptions to Polyglot to be used in front end UI configuration screen Accepts list of objects with the followin properties name - used as a key when data is sent from UI title - displayed in UI defaultValue - optionanl type - opti...
[ "Send", "custom", "parameters", "descriptions", "to", "Polyglot", "to", "be", "used", "in", "front", "end", "UI", "configuration", "screen", "Accepts", "list", "of", "objects", "with", "the", "followin", "properties", "name", "-", "used", "as", "a", "key", "...
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L519-L542
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Controller.delNode
def delNode(self, address): """ Just send it along if requested, should be able to delete the node even if it isn't in our config anywhere. Usually used for normalization. """ if address in self.nodes: del self.nodes[address] self.poly.delNode(address)
python
def delNode(self, address): """ Just send it along if requested, should be able to delete the node even if it isn't in our config anywhere. Usually used for normalization. """ if address in self.nodes: del self.nodes[address] self.poly.delNode(address)
[ "def", "delNode", "(", "self", ",", "address", ")", ":", "if", "address", "in", "self", ".", "nodes", ":", "del", "self", ".", "nodes", "[", "address", "]", "self", ".", "poly", ".", "delNode", "(", "address", ")" ]
Just send it along if requested, should be able to delete the node even if it isn't in our config anywhere. Usually used for normalization.
[ "Just", "send", "it", "along", "if", "requested", "should", "be", "able", "to", "delete", "the", "node", "even", "if", "it", "isn", "t", "in", "our", "config", "anywhere", ".", "Usually", "used", "for", "normalization", "." ]
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L844-L851
lablup/backend.ai-client-py
src/ai/backend/client/admin.py
Admin.query
async def query(cls, query: str, variables: Optional[Mapping[str, Any]] = None, ) -> Any: ''' Sends the GraphQL query and returns the response. :param query: The GraphQL query string. :param variables: An optional key-value dictionary ...
python
async def query(cls, query: str, variables: Optional[Mapping[str, Any]] = None, ) -> Any: ''' Sends the GraphQL query and returns the response. :param query: The GraphQL query string. :param variables: An optional key-value dictionary ...
[ "async", "def", "query", "(", "cls", ",", "query", ":", "str", ",", "variables", ":", "Optional", "[", "Mapping", "[", "str", ",", "Any", "]", "]", "=", "None", ",", ")", "->", "Any", ":", "gql_query", "=", "{", "'query'", ":", "query", ",", "'va...
Sends the GraphQL query and returns the response. :param query: The GraphQL query string. :param variables: An optional key-value dictionary to fill the interpolated template variables in the query. :returns: The object parsed from the response JSON string.
[ "Sends", "the", "GraphQL", "query", "and", "returns", "the", "response", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/admin.py#L27-L47
housecanary/hc-api-python
housecanary/utilities.py
get_readable_time_string
def get_readable_time_string(seconds): """Returns human readable string from number of seconds""" seconds = int(seconds) minutes = seconds // 60 seconds = seconds % 60 hours = minutes // 60 minutes = minutes % 60 days = hours // 24 hours = hours % 24 result = "" if days > 0: ...
python
def get_readable_time_string(seconds): """Returns human readable string from number of seconds""" seconds = int(seconds) minutes = seconds // 60 seconds = seconds % 60 hours = minutes // 60 minutes = minutes % 60 days = hours // 24 hours = hours % 24 result = "" if days > 0: ...
[ "def", "get_readable_time_string", "(", "seconds", ")", ":", "seconds", "=", "int", "(", "seconds", ")", "minutes", "=", "seconds", "//", "60", "seconds", "=", "seconds", "%", "60", "hours", "=", "minutes", "//", "60", "minutes", "=", "minutes", "%", "60...
Returns human readable string from number of seconds
[ "Returns", "human", "readable", "string", "from", "number", "of", "seconds" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/utilities.py#L6-L26
housecanary/hc-api-python
housecanary/utilities.py
get_rate_limits
def get_rate_limits(response): """Returns a list of rate limit information from a given response's headers.""" periods = response.headers['X-RateLimit-Period'] if not periods: return [] rate_limits = [] periods = periods.split(',') limits = response.headers['X-RateLimit-Limit'].split('...
python
def get_rate_limits(response): """Returns a list of rate limit information from a given response's headers.""" periods = response.headers['X-RateLimit-Period'] if not periods: return [] rate_limits = [] periods = periods.split(',') limits = response.headers['X-RateLimit-Limit'].split('...
[ "def", "get_rate_limits", "(", "response", ")", ":", "periods", "=", "response", ".", "headers", "[", "'X-RateLimit-Period'", "]", "if", "not", "periods", ":", "return", "[", "]", "rate_limits", "=", "[", "]", "periods", "=", "periods", ".", "split", "(", ...
Returns a list of rate limit information from a given response's headers.
[ "Returns", "a", "list", "of", "rate", "limit", "information", "from", "a", "given", "response", "s", "headers", "." ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/utilities.py#L37-L73
Tygs/ww
src/ww/wrappers/dicts.py
DictWrapper.isubset
def isubset(self, *keys): # type: (*Hashable) -> ww.g """Return key, self[key] as generator for key in keys. Raise KeyError if a key does not exist Args: keys: Iterable containing keys Example: >>> from ww import d >>> list(d({1: 1, 2: 2, 3...
python
def isubset(self, *keys): # type: (*Hashable) -> ww.g """Return key, self[key] as generator for key in keys. Raise KeyError if a key does not exist Args: keys: Iterable containing keys Example: >>> from ww import d >>> list(d({1: 1, 2: 2, 3...
[ "def", "isubset", "(", "self", ",", "*", "keys", ")", ":", "# type: (*Hashable) -> ww.g", "return", "ww", ".", "g", "(", "(", "key", ",", "self", "[", "key", "]", ")", "for", "key", "in", "keys", ")" ]
Return key, self[key] as generator for key in keys. Raise KeyError if a key does not exist Args: keys: Iterable containing keys Example: >>> from ww import d >>> list(d({1: 1, 2: 2, 3: 3}).isubset(1, 3)) [(1, 1), (3, 3)]
[ "Return", "key", "self", "[", "key", "]", "as", "generator", "for", "key", "in", "keys", "." ]
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/wrappers/dicts.py#L18-L33
Tygs/ww
src/ww/wrappers/dicts.py
DictWrapper.swap
def swap(self): # type: () -> DictWrapper """Swap key and value /!\ Be carreful, if there are duplicate values, only one will survive /!\ Example: >>> from ww import d >>> d({1: 2, 2: 2, 3: 3}).swap() {2: 2, 3: 3} """ return ...
python
def swap(self): # type: () -> DictWrapper """Swap key and value /!\ Be carreful, if there are duplicate values, only one will survive /!\ Example: >>> from ww import d >>> d({1: 2, 2: 2, 3: 3}).swap() {2: 2, 3: 3} """ return ...
[ "def", "swap", "(", "self", ")", ":", "# type: () -> DictWrapper", "return", "self", ".", "__class__", "(", "(", "v", ",", "k", ")", "for", "k", ",", "v", "in", "self", ".", "items", "(", ")", ")" ]
Swap key and value /!\ Be carreful, if there are duplicate values, only one will survive /!\ Example: >>> from ww import d >>> d({1: 2, 2: 2, 3: 3}).swap() {2: 2, 3: 3}
[ "Swap", "key", "and", "value" ]
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/wrappers/dicts.py#L52-L65
Tygs/ww
src/ww/wrappers/dicts.py
DictWrapper.fromkeys
def fromkeys(cls, iterable, value=None): # TODO : type: (Iterable, Union[Any, Callable]) -> DictWrapper # https://github.com/python/mypy/issues/2254 """Create a new d from Args: iterable: Iterable containing keys value: value to associate with each key. ...
python
def fromkeys(cls, iterable, value=None): # TODO : type: (Iterable, Union[Any, Callable]) -> DictWrapper # https://github.com/python/mypy/issues/2254 """Create a new d from Args: iterable: Iterable containing keys value: value to associate with each key. ...
[ "def", "fromkeys", "(", "cls", ",", "iterable", ",", "value", "=", "None", ")", ":", "# TODO : type: (Iterable, Union[Any, Callable]) -> DictWrapper", "# https://github.com/python/mypy/issues/2254", "if", "not", "callable", "(", "value", ")", ":", "return", "cls", "(", ...
Create a new d from Args: iterable: Iterable containing keys value: value to associate with each key. If callable, will be value[key] Returns: new DictWrapper Example: >>> from ww import d >>> sorted(d.fromkeys('123', value=4).items...
[ "Create", "a", "new", "d", "from" ]
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/wrappers/dicts.py#L94-L117
AoiKuiyuyou/AoikLiveReload
src/aoiklivereload/demo/flask_demo.py
main
def main(): """ Main function. :return: None. """ try: # Get the `src` directory's absolute path src_path = os.path.dirname( # `aoiklivereload` directory's absolute path os.path.dirname( # `demo` directory's absolute path ...
python
def main(): """ Main function. :return: None. """ try: # Get the `src` directory's absolute path src_path = os.path.dirname( # `aoiklivereload` directory's absolute path os.path.dirname( # `demo` directory's absolute path ...
[ "def", "main", "(", ")", ":", "try", ":", "# Get the `src` directory's absolute path", "src_path", "=", "os", ".", "path", ".", "dirname", "(", "# `aoiklivereload` directory's absolute path", "os", ".", "path", ".", "dirname", "(", "# `demo` directory's absolute path", ...
Main function. :return: None.
[ "Main", "function", "." ]
train
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/demo/flask_demo.py#L15-L92
housecanary/hc-api-python
housecanary/excel/analytics_data_excel.py
get_excel_workbook
def get_excel_workbook(api_data, result_info_key, identifier_keys): """Generates an Excel workbook object given api_data returned by the Analytics API Args: api_data: Analytics API data as a list of dicts (one per identifier) result_info_key: the key in api_data dicts that contains the data res...
python
def get_excel_workbook(api_data, result_info_key, identifier_keys): """Generates an Excel workbook object given api_data returned by the Analytics API Args: api_data: Analytics API data as a list of dicts (one per identifier) result_info_key: the key in api_data dicts that contains the data res...
[ "def", "get_excel_workbook", "(", "api_data", ",", "result_info_key", ",", "identifier_keys", ")", ":", "cleaned_data", "=", "[", "]", "for", "item_data", "in", "api_data", ":", "result_info", "=", "item_data", ".", "pop", "(", "result_info_key", ",", "{", "}"...
Generates an Excel workbook object given api_data returned by the Analytics API Args: api_data: Analytics API data as a list of dicts (one per identifier) result_info_key: the key in api_data dicts that contains the data results identifier_keys: the list of keys used as requested identifier...
[ "Generates", "an", "Excel", "workbook", "object", "given", "api_data", "returned", "by", "the", "Analytics", "API" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/analytics_data_excel.py#L30-L67
housecanary/hc-api-python
housecanary/excel/analytics_data_excel.py
write_worksheets
def write_worksheets(workbook, data_list, result_info_key, identifier_keys): """Writes rest of the worksheets to workbook. Args: workbook: workbook to write into data_list: Analytics API data as a list of dicts result_info_key: the key in api_data dicts that contains the data results ...
python
def write_worksheets(workbook, data_list, result_info_key, identifier_keys): """Writes rest of the worksheets to workbook. Args: workbook: workbook to write into data_list: Analytics API data as a list of dicts result_info_key: the key in api_data dicts that contains the data results ...
[ "def", "write_worksheets", "(", "workbook", ",", "data_list", ",", "result_info_key", ",", "identifier_keys", ")", ":", "# we can use the first item to figure out the worksheet keys", "worksheet_keys", "=", "get_worksheet_keys", "(", "data_list", "[", "0", "]", ",", "resu...
Writes rest of the worksheets to workbook. Args: workbook: workbook to write into data_list: Analytics API data as a list of dicts result_info_key: the key in api_data dicts that contains the data results identifier_keys: the list of keys used as requested identifiers ...
[ "Writes", "rest", "of", "the", "worksheets", "to", "workbook", "." ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/analytics_data_excel.py#L70-L106
housecanary/hc-api-python
housecanary/excel/analytics_data_excel.py
create_property_nod_worksheets
def create_property_nod_worksheets(workbook, data_list, result_info_key, identifier_keys): """Creates two worksheets out of the property/nod data because the data doesn't come flat enough to make sense on one sheet. Args: workbook: the main workbook to add the sheets to data_l...
python
def create_property_nod_worksheets(workbook, data_list, result_info_key, identifier_keys): """Creates two worksheets out of the property/nod data because the data doesn't come flat enough to make sense on one sheet. Args: workbook: the main workbook to add the sheets to data_l...
[ "def", "create_property_nod_worksheets", "(", "workbook", ",", "data_list", ",", "result_info_key", ",", "identifier_keys", ")", ":", "nod_details_list", "=", "[", "]", "nod_default_history_list", "=", "[", "]", "for", "prop_data", "in", "data_list", ":", "nod_data"...
Creates two worksheets out of the property/nod data because the data doesn't come flat enough to make sense on one sheet. Args: workbook: the main workbook to add the sheets to data_list: the main list of data result_info_key: the key in api_data dicts that contains th...
[ "Creates", "two", "worksheets", "out", "of", "the", "property", "/", "nod", "data", "because", "the", "data", "doesn", "t", "come", "flat", "enough", "to", "make", "sense", "on", "one", "sheet", "." ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/analytics_data_excel.py#L109-L144
housecanary/hc-api-python
housecanary/excel/analytics_data_excel.py
get_worksheet_keys
def get_worksheet_keys(data_dict, result_info_key): """Gets sorted keys from the dict, ignoring result_info_key and 'meta' key Args: data_dict: dict to pull keys from Returns: list of keys in the dict other than the result_info_key """ keys = set(data_dict.keys()) keys.remove(re...
python
def get_worksheet_keys(data_dict, result_info_key): """Gets sorted keys from the dict, ignoring result_info_key and 'meta' key Args: data_dict: dict to pull keys from Returns: list of keys in the dict other than the result_info_key """ keys = set(data_dict.keys()) keys.remove(re...
[ "def", "get_worksheet_keys", "(", "data_dict", ",", "result_info_key", ")", ":", "keys", "=", "set", "(", "data_dict", ".", "keys", "(", ")", ")", "keys", ".", "remove", "(", "result_info_key", ")", "if", "'meta'", "in", "keys", ":", "keys", ".", "remove...
Gets sorted keys from the dict, ignoring result_info_key and 'meta' key Args: data_dict: dict to pull keys from Returns: list of keys in the dict other than the result_info_key
[ "Gets", "sorted", "keys", "from", "the", "dict", "ignoring", "result_info_key", "and", "meta", "key", "Args", ":", "data_dict", ":", "dict", "to", "pull", "keys", "from" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/analytics_data_excel.py#L147-L159
housecanary/hc-api-python
housecanary/excel/analytics_data_excel.py
get_keys
def get_keys(data_list, leading_columns=LEADING_COLUMNS): """Gets all possible keys from a list of dicts, sorting by leading_columns first Args: data_list: list of dicts to pull keys from leading_columns: list of keys to put first in the result Returns: list of keys to be included ...
python
def get_keys(data_list, leading_columns=LEADING_COLUMNS): """Gets all possible keys from a list of dicts, sorting by leading_columns first Args: data_list: list of dicts to pull keys from leading_columns: list of keys to put first in the result Returns: list of keys to be included ...
[ "def", "get_keys", "(", "data_list", ",", "leading_columns", "=", "LEADING_COLUMNS", ")", ":", "all_keys", "=", "set", "(", ")", ".", "union", "(", "*", "(", "list", "(", "d", ".", "keys", "(", ")", ")", "for", "d", "in", "data_list", ")", ")", "le...
Gets all possible keys from a list of dicts, sorting by leading_columns first Args: data_list: list of dicts to pull keys from leading_columns: list of keys to put first in the result Returns: list of keys to be included as columns in excel worksheet
[ "Gets", "all", "possible", "keys", "from", "a", "list", "of", "dicts", "sorting", "by", "leading_columns", "first" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/analytics_data_excel.py#L162-L182
housecanary/hc-api-python
housecanary/excel/analytics_data_excel.py
write_data
def write_data(worksheet, data): """Writes data into worksheet. Args: worksheet: worksheet to write into data: data to be written """ if not data: return if isinstance(data, list): rows = data else: rows = [data] if isinstance(rows[0], dict): ...
python
def write_data(worksheet, data): """Writes data into worksheet. Args: worksheet: worksheet to write into data: data to be written """ if not data: return if isinstance(data, list): rows = data else: rows = [data] if isinstance(rows[0], dict): ...
[ "def", "write_data", "(", "worksheet", ",", "data", ")", ":", "if", "not", "data", ":", "return", "if", "isinstance", "(", "data", ",", "list", ")", ":", "rows", "=", "data", "else", ":", "rows", "=", "[", "data", "]", "if", "isinstance", "(", "row...
Writes data into worksheet. Args: worksheet: worksheet to write into data: data to be written
[ "Writes", "data", "into", "worksheet", "." ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/analytics_data_excel.py#L185-L212
housecanary/hc-api-python
housecanary/excel/analytics_data_excel.py
process_data
def process_data(key, data_list, result_info_key, identifier_keys): """ Given a key as the endpoint name, pulls the data for that endpoint out of the data_list for each address, processes the data into a more excel-friendly format and returns that data. Args: key: the endpoint n...
python
def process_data(key, data_list, result_info_key, identifier_keys): """ Given a key as the endpoint name, pulls the data for that endpoint out of the data_list for each address, processes the data into a more excel-friendly format and returns that data. Args: key: the endpoint n...
[ "def", "process_data", "(", "key", ",", "data_list", ",", "result_info_key", ",", "identifier_keys", ")", ":", "master_data", "=", "[", "]", "for", "item_data", "in", "data_list", ":", "data", "=", "item_data", "[", "key", "]", "if", "data", "is", "None", ...
Given a key as the endpoint name, pulls the data for that endpoint out of the data_list for each address, processes the data into a more excel-friendly format and returns that data. Args: key: the endpoint name of the data to process data_list: the main data list to take...
[ "Given", "a", "key", "as", "the", "endpoint", "name", "pulls", "the", "data", "for", "that", "endpoint", "out", "of", "the", "data_list", "for", "each", "address", "processes", "the", "data", "into", "a", "more", "excel", "-", "friendly", "format", "and", ...
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/analytics_data_excel.py#L222-L297
housecanary/hc-api-python
housecanary/excel/analytics_data_excel.py
flatten_top_level_keys
def flatten_top_level_keys(data, top_level_keys): """ Helper method to flatten a nested dict of dicts (one level) Example: {'a': {'b': 'bbb'}} becomes {'a_-_b': 'bbb'} The separator '_-_' gets formatted later for the column headers Args: data: the dict to flatt...
python
def flatten_top_level_keys(data, top_level_keys): """ Helper method to flatten a nested dict of dicts (one level) Example: {'a': {'b': 'bbb'}} becomes {'a_-_b': 'bbb'} The separator '_-_' gets formatted later for the column headers Args: data: the dict to flatt...
[ "def", "flatten_top_level_keys", "(", "data", ",", "top_level_keys", ")", ":", "flattened_data", "=", "{", "}", "for", "top_level_key", "in", "top_level_keys", ":", "if", "data", "[", "top_level_key", "]", "is", "None", ":", "flattened_data", "[", "top_level_key...
Helper method to flatten a nested dict of dicts (one level) Example: {'a': {'b': 'bbb'}} becomes {'a_-_b': 'bbb'} The separator '_-_' gets formatted later for the column headers Args: data: the dict to flatten top_level_keys: a list of the top level key...
[ "Helper", "method", "to", "flatten", "a", "nested", "dict", "of", "dicts", "(", "one", "level", ")" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/analytics_data_excel.py#L311-L332
mozilla-services/python-dockerflow
src/dockerflow/django/checks.py
check_database_connected
def check_database_connected(app_configs, **kwargs): """ A Django check to see if connecting to the configured default database backend succeeds. """ errors = [] try: connection.ensure_connection() except OperationalError as e: msg = 'Could not connect to database: {!s}'.for...
python
def check_database_connected(app_configs, **kwargs): """ A Django check to see if connecting to the configured default database backend succeeds. """ errors = [] try: connection.ensure_connection() except OperationalError as e: msg = 'Could not connect to database: {!s}'.for...
[ "def", "check_database_connected", "(", "app_configs", ",", "*", "*", "kwargs", ")", ":", "errors", "=", "[", "]", "try", ":", "connection", ".", "ensure_connection", "(", ")", "except", "OperationalError", "as", "e", ":", "msg", "=", "'Could not connect to da...
A Django check to see if connecting to the configured default database backend succeeds.
[ "A", "Django", "check", "to", "see", "if", "connecting", "to", "the", "configured", "default", "database", "backend", "succeeds", "." ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/django/checks.py#L26-L48
mozilla-services/python-dockerflow
src/dockerflow/django/checks.py
check_migrations_applied
def check_migrations_applied(app_configs, **kwargs): """ A Django check to see if all migrations have been applied correctly. """ from django.db.migrations.loader import MigrationLoader errors = [] # Load migrations from disk/DB try: loader = MigrationLoader(connection, ignore_no_mi...
python
def check_migrations_applied(app_configs, **kwargs): """ A Django check to see if all migrations have been applied correctly. """ from django.db.migrations.loader import MigrationLoader errors = [] # Load migrations from disk/DB try: loader = MigrationLoader(connection, ignore_no_mi...
[ "def", "check_migrations_applied", "(", "app_configs", ",", "*", "*", "kwargs", ")", ":", "from", "django", ".", "db", ".", "migrations", ".", "loader", "import", "MigrationLoader", "errors", "=", "[", "]", "# Load migrations from disk/DB", "try", ":", "loader",...
A Django check to see if all migrations have been applied correctly.
[ "A", "Django", "check", "to", "see", "if", "all", "migrations", "have", "been", "applied", "correctly", "." ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/django/checks.py#L51-L80
mozilla-services/python-dockerflow
src/dockerflow/django/checks.py
check_redis_connected
def check_redis_connected(app_configs, **kwargs): """ A Django check to connect to the default redis connection using ``django_redis.get_redis_connection`` and see if Redis responds to a ``PING`` command. """ import redis from django_redis import get_redis_connection errors = [] try...
python
def check_redis_connected(app_configs, **kwargs): """ A Django check to connect to the default redis connection using ``django_redis.get_redis_connection`` and see if Redis responds to a ``PING`` command. """ import redis from django_redis import get_redis_connection errors = [] try...
[ "def", "check_redis_connected", "(", "app_configs", ",", "*", "*", "kwargs", ")", ":", "import", "redis", "from", "django_redis", "import", "get_redis_connection", "errors", "=", "[", "]", "try", ":", "connection", "=", "get_redis_connection", "(", "'default'", ...
A Django check to connect to the default redis connection using ``django_redis.get_redis_connection`` and see if Redis responds to a ``PING`` command.
[ "A", "Django", "check", "to", "connect", "to", "the", "default", "redis", "connection", "using", "django_redis", ".", "get_redis_connection", "and", "see", "if", "Redis", "responds", "to", "a", "PING", "command", "." ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/django/checks.py#L83-L109
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/alarms.py
get_realtime_alarm
def get_realtime_alarm(username, auth, url): """Takes in no param as input to fetch RealTime Alarms from HP IMC RESTFUL API :param username OpeatorName, String type. Required. Default Value "admin". Checks the operator has the privileges to view the Real-Time Alarms. :param devId: int or str value of...
python
def get_realtime_alarm(username, auth, url): """Takes in no param as input to fetch RealTime Alarms from HP IMC RESTFUL API :param username OpeatorName, String type. Required. Default Value "admin". Checks the operator has the privileges to view the Real-Time Alarms. :param devId: int or str value of...
[ "def", "get_realtime_alarm", "(", "username", ",", "auth", ",", "url", ")", ":", "get_realtime_alarm_url", "=", "\"/imcrs/fault/faultRealTime?operatorName=\"", "+", "username", "f_url", "=", "url", "+", "get_realtime_alarm_url", "r", "=", "requests", ".", "get", "("...
Takes in no param as input to fetch RealTime Alarms from HP IMC RESTFUL API :param username OpeatorName, String type. Required. Default Value "admin". Checks the operator has the privileges to view the Real-Time Alarms. :param devId: int or str value of the target device :param auth: requests auth o...
[ "Takes", "in", "no", "param", "as", "input", "to", "fetch", "RealTime", "Alarms", "from", "HP", "IMC", "RESTFUL", "API" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/alarms.py#L63-L100
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/alarms.py
get_alarms
def get_alarms(username, auth, url): """Takes in no param as input to fetch RealTime Alarms from HP IMC RESTFUL API :param username OpeatorName, String type. Required. Default Value "admin". Checks the operator has the privileges to view the Real-Time Alarms. :param devId: int or str value of the tar...
python
def get_alarms(username, auth, url): """Takes in no param as input to fetch RealTime Alarms from HP IMC RESTFUL API :param username OpeatorName, String type. Required. Default Value "admin". Checks the operator has the privileges to view the Real-Time Alarms. :param devId: int or str value of the tar...
[ "def", "get_alarms", "(", "username", ",", "auth", ",", "url", ")", ":", "get_alarms_url", "=", "\"/imcrs/fault/alarm?operatorName=\"", "+", "username", "+", "\"&recStatus=0&ackStatus=0&timeRange=0&size=50&desc=true\"", "f_url", "=", "url", "+", "get_alarms_url", "r", "...
Takes in no param as input to fetch RealTime Alarms from HP IMC RESTFUL API :param username OpeatorName, String type. Required. Default Value "admin". Checks the operator has the privileges to view the Real-Time Alarms. :param devId: int or str value of the target device :param auth: requests auth o...
[ "Takes", "in", "no", "param", "as", "input", "to", "fetch", "RealTime", "Alarms", "from", "HP", "IMC", "RESTFUL", "API" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/alarms.py#L103-L349
HPENetworking/PYHPEIMC
pyhpeimc/plat/alarms.py
get_dev_alarms
def get_dev_alarms(auth, url, devid=None, devip=None): """ function takes the devId of a specific device and issues a RESTFUL call to get the current alarms for the target device. :param devid: int or str value of the target device :param devip: str of ipv4 address of the target device :param...
python
def get_dev_alarms(auth, url, devid=None, devip=None): """ function takes the devId of a specific device and issues a RESTFUL call to get the current alarms for the target device. :param devid: int or str value of the target device :param devip: str of ipv4 address of the target device :param...
[ "def", "get_dev_alarms", "(", "auth", ",", "url", ",", "devid", "=", "None", ",", "devip", "=", "None", ")", ":", "# checks to see if the imc credentials are already available", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devi...
function takes the devId of a specific device and issues a RESTFUL call to get the current alarms for the target device. :param devid: int or str value of the target device :param devip: str of ipv4 address of the target device :param auth: requests auth object #usually auth.creds from auth pyhpeimc....
[ "function", "takes", "the", "devId", "of", "a", "specific", "device", "and", "issues", "a", "RESTFUL", "call", "to", "get", "the", "current", "alarms", "for", "the", "target", "device", "." ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/alarms.py#L20-L62
HPENetworking/PYHPEIMC
pyhpeimc/plat/alarms.py
get_realtime_alarm
def get_realtime_alarm(username, auth, url): """Takes in no param as input to fetch RealTime Alarms from HP IMC RESTFUL API :param username OpeatorName, String type. Required. Default Value "admin". Checks the operator has the privileges to view the Real-Time Alarms. :param auth: requests auth object...
python
def get_realtime_alarm(username, auth, url): """Takes in no param as input to fetch RealTime Alarms from HP IMC RESTFUL API :param username OpeatorName, String type. Required. Default Value "admin". Checks the operator has the privileges to view the Real-Time Alarms. :param auth: requests auth object...
[ "def", "get_realtime_alarm", "(", "username", ",", "auth", ",", "url", ")", ":", "f_url", "=", "url", "+", "\"/imcrs/fault/faultRealTime?operatorName=\"", "+", "username", "response", "=", "requests", ".", "get", "(", "f_url", ",", "auth", "=", "auth", ",", ...
Takes in no param as input to fetch RealTime Alarms from HP IMC RESTFUL API :param username OpeatorName, String type. Required. Default Value "admin". Checks the operator has the privileges to view the Real-Time Alarms. :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class ...
[ "Takes", "in", "no", "param", "as", "input", "to", "fetch", "RealTime", "Alarms", "from", "HP", "IMC", "RESTFUL", "API" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/alarms.py#L65-L99
HPENetworking/PYHPEIMC
pyhpeimc/plat/alarms.py
get_alarms
def get_alarms(username, auth, url): """Takes in no param as input to fetch RealTime Alarms from HP IMC RESTFUL API :param username OpeatorName, String type. Required. Default Value "admin". Checks the operator has the privileges to view the Real-Time Alarms. :param auth: requests auth object #usuall...
python
def get_alarms(username, auth, url): """Takes in no param as input to fetch RealTime Alarms from HP IMC RESTFUL API :param username OpeatorName, String type. Required. Default Value "admin". Checks the operator has the privileges to view the Real-Time Alarms. :param auth: requests auth object #usuall...
[ "def", "get_alarms", "(", "username", ",", "auth", ",", "url", ")", ":", "f_url", "=", "url", "+", "\"/imcrs/fault/alarm?operatorName=\"", "+", "username", "+", "\"&recStatus=0&ackStatus=0&timeRange=0&size=50&desc=true\"", "response", "=", "requests", ".", "get", "(",...
Takes in no param as input to fetch RealTime Alarms from HP IMC RESTFUL API :param username OpeatorName, String type. Required. Default Value "admin". Checks the operator has the privileges to view the Real-Time Alarms. :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class ...
[ "Takes", "in", "no", "param", "as", "input", "to", "fetch", "RealTime", "Alarms", "from", "HP", "IMC", "RESTFUL", "API" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/alarms.py#L102-L138
HPENetworking/PYHPEIMC
pyhpeimc/plat/alarms.py
get_alarm_details
def get_alarm_details(alarm_id, auth, url): """ function to take str input of alarm_id, issues a REST call to the IMC REST interface and returns a dictionary object which contains the details of a specific alarm. :param alarm_id: str number which represents the internal ID of a specific alarm :para...
python
def get_alarm_details(alarm_id, auth, url): """ function to take str input of alarm_id, issues a REST call to the IMC REST interface and returns a dictionary object which contains the details of a specific alarm. :param alarm_id: str number which represents the internal ID of a specific alarm :para...
[ "def", "get_alarm_details", "(", "alarm_id", ",", "auth", ",", "url", ")", ":", "f_url", "=", "url", "+", "\"/imcrs/fault/alarm/\"", "+", "str", "(", "alarm_id", ")", "response", "=", "requests", ".", "get", "(", "f_url", ",", "auth", "=", "auth", ",", ...
function to take str input of alarm_id, issues a REST call to the IMC REST interface and returns a dictionary object which contains the details of a specific alarm. :param alarm_id: str number which represents the internal ID of a specific alarm :param auth: :param url: :return:
[ "function", "to", "take", "str", "input", "of", "alarm_id", "issues", "a", "REST", "call", "to", "the", "IMC", "REST", "interface", "and", "returns", "a", "dictionary", "object", "which", "contains", "the", "details", "of", "a", "specific", "alarm", ".", "...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/alarms.py#L140-L155
HPENetworking/PYHPEIMC
pyhpeimc/plat/alarms.py
acknowledge_alarm
def acknowledge_alarm(alarm_id, auth, url): """ Function tasks input of str of alarm ID and sends to REST API. Function will acknowledge designated alarm in the IMC alarm database. :param alarm_id: str of alarm ID param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class ...
python
def acknowledge_alarm(alarm_id, auth, url): """ Function tasks input of str of alarm ID and sends to REST API. Function will acknowledge designated alarm in the IMC alarm database. :param alarm_id: str of alarm ID param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class ...
[ "def", "acknowledge_alarm", "(", "alarm_id", ",", "auth", ",", "url", ")", ":", "f_url", "=", "url", "+", "\"/imcrs/fault/alarm/acknowledge/\"", "+", "str", "(", "alarm_id", ")", "response", "=", "requests", ".", "put", "(", "f_url", ",", "auth", "=", "aut...
Function tasks input of str of alarm ID and sends to REST API. Function will acknowledge designated alarm in the IMC alarm database. :param alarm_id: str of alarm ID param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth...
[ "Function", "tasks", "input", "of", "str", "of", "alarm", "ID", "and", "sends", "to", "REST", "API", ".", "Function", "will", "acknowledge", "designated", "alarm", "in", "the", "IMC", "alarm", "database", ".", ":", "param", "alarm_id", ":", "str", "of", ...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/alarms.py#L158-L175
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/operator.py
create_operator
def create_operator(operator, auth, url,headers=HEADERS): """ Function takes input of dictionary operator with the following keys operator = { "fullName" : "" , "sessionTimeout" : "", "password" : "", "operatorGroupId" : "", "name" : "", "d...
python
def create_operator(operator, auth, url,headers=HEADERS): """ Function takes input of dictionary operator with the following keys operator = { "fullName" : "" , "sessionTimeout" : "", "password" : "", "operatorGroupId" : "", "name" : "", "d...
[ "def", "create_operator", "(", "operator", ",", "auth", ",", "url", ",", "headers", "=", "HEADERS", ")", ":", "create_operator_url", "=", "'/imcrs/plat/operator'", "f_url", "=", "url", "+", "create_operator_url", "payload", "=", "json", ".", "dumps", "(", "ope...
Function takes input of dictionary operator with the following keys operator = { "fullName" : "" , "sessionTimeout" : "", "password" : "", "operatorGroupId" : "", "name" : "", "desc" : "", "defaultAcl" : "", "authType" : ...
[ "Function", "takes", "input", "of", "dictionary", "operator", "with", "the", "following", "keys", "operator", "=", "{", "fullName", ":", "sessionTimeout", ":", "password", ":", "operatorGroupId", ":", "name", ":", "desc", ":", "defaultAcl", ":", "authType", ":...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/operator.py#L18-L83
lablup/backend.ai-client-py
src/ai/backend/client/cli/vfolder.py
list
def list(): '''List virtual folders that belongs to the current user.''' fields = [ ('Name', 'name'), ('ID', 'id'), ('Owner', 'is_owner'), ('Permission', 'permission'), ] with Session() as session: try: resp = session.VFolder.list() if not ...
python
def list(): '''List virtual folders that belongs to the current user.''' fields = [ ('Name', 'name'), ('ID', 'id'), ('Owner', 'is_owner'), ('Permission', 'permission'), ] with Session() as session: try: resp = session.VFolder.list() if not ...
[ "def", "list", "(", ")", ":", "fields", "=", "[", "(", "'Name'", ",", "'name'", ")", ",", "(", "'ID'", ",", "'id'", ")", ",", "(", "'Owner'", ",", "'is_owner'", ")", ",", "(", "'Permission'", ",", "'permission'", ")", ",", "]", "with", "Session", ...
List virtual folders that belongs to the current user.
[ "List", "virtual", "folders", "that", "belongs", "to", "the", "current", "user", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/vfolder.py#L21-L40
lablup/backend.ai-client-py
src/ai/backend/client/cli/vfolder.py
list_hosts
def list_hosts(): '''List the hosts of virtual folders that is accessible to the current user.''' with Session() as session: try: resp = session.VFolder.list_hosts() print(f"Default vfolder host: {resp['default']}") print(f"Usable hosts: {', '.join(resp['allowed'])}")...
python
def list_hosts(): '''List the hosts of virtual folders that is accessible to the current user.''' with Session() as session: try: resp = session.VFolder.list_hosts() print(f"Default vfolder host: {resp['default']}") print(f"Usable hosts: {', '.join(resp['allowed'])}")...
[ "def", "list_hosts", "(", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "resp", "=", "session", ".", "VFolder", ".", "list_hosts", "(", ")", "print", "(", "f\"Default vfolder host: {resp['default']}\"", ")", "print", "(", "f\"Usabl...
List the hosts of virtual folders that is accessible to the current user.
[ "List", "the", "hosts", "of", "virtual", "folders", "that", "is", "accessible", "to", "the", "current", "user", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/vfolder.py#L44-L53
lablup/backend.ai-client-py
src/ai/backend/client/cli/vfolder.py
create
def create(name, host): '''Create a new virtual folder. \b NAME: Name of a virtual folder. HOST: Name of a virtual folder host in which the virtual folder will be created. ''' with Session() as session: try: result = session.VFolder.create(name, host) print('Virt...
python
def create(name, host): '''Create a new virtual folder. \b NAME: Name of a virtual folder. HOST: Name of a virtual folder host in which the virtual folder will be created. ''' with Session() as session: try: result = session.VFolder.create(name, host) print('Virt...
[ "def", "create", "(", "name", ",", "host", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "result", "=", "session", ".", "VFolder", ".", "create", "(", "name", ",", "host", ")", "print", "(", "'Virtual folder \"{0}\" is created....
Create a new virtual folder. \b NAME: Name of a virtual folder. HOST: Name of a virtual folder host in which the virtual folder will be created.
[ "Create", "a", "new", "virtual", "folder", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/vfolder.py#L59-L72
lablup/backend.ai-client-py
src/ai/backend/client/cli/vfolder.py
delete
def delete(name): '''Delete the given virtual folder. This operation is irreversible! NAME: Name of a virtual folder. ''' with Session() as session: try: session.VFolder(name).delete() print_done('Deleted.') except Exception as e: print_error(e) ...
python
def delete(name): '''Delete the given virtual folder. This operation is irreversible! NAME: Name of a virtual folder. ''' with Session() as session: try: session.VFolder(name).delete() print_done('Deleted.') except Exception as e: print_error(e) ...
[ "def", "delete", "(", "name", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "session", ".", "VFolder", "(", "name", ")", ".", "delete", "(", ")", "print_done", "(", "'Deleted.'", ")", "except", "Exception", "as", "e", ":", ...
Delete the given virtual folder. This operation is irreversible! NAME: Name of a virtual folder.
[ "Delete", "the", "given", "virtual", "folder", ".", "This", "operation", "is", "irreversible!" ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/vfolder.py#L77-L88
lablup/backend.ai-client-py
src/ai/backend/client/cli/vfolder.py
rename
def rename(old_name, new_name): '''Rename the given virtual folder. This operation is irreversible! You cannot change the vfolders that are shared by other users, and the new name must be unique among all your accessible vfolders including the shared ones. OLD_NAME: The current name of a virtual fo...
python
def rename(old_name, new_name): '''Rename the given virtual folder. This operation is irreversible! You cannot change the vfolders that are shared by other users, and the new name must be unique among all your accessible vfolders including the shared ones. OLD_NAME: The current name of a virtual fo...
[ "def", "rename", "(", "old_name", ",", "new_name", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "session", ".", "VFolder", "(", "old_name", ")", ".", "rename", "(", "new_name", ")", "print_done", "(", "'Renamed.'", ")", "exc...
Rename the given virtual folder. This operation is irreversible! You cannot change the vfolders that are shared by other users, and the new name must be unique among all your accessible vfolders including the shared ones. OLD_NAME: The current name of a virtual folder. NEW_NAME: The new name of a v...
[ "Rename", "the", "given", "virtual", "folder", ".", "This", "operation", "is", "irreversible!", "You", "cannot", "change", "the", "vfolders", "that", "are", "shared", "by", "other", "users", "and", "the", "new", "name", "must", "be", "unique", "among", "all"...
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/vfolder.py#L94-L109
lablup/backend.ai-client-py
src/ai/backend/client/cli/vfolder.py
info
def info(name): '''Show the information of the given virtual folder. NAME: Name of a virtual folder. ''' with Session() as session: try: result = session.VFolder(name).info() print('Virtual folder "{0}" (ID: {1})' .format(result['name'], result['id'])) ...
python
def info(name): '''Show the information of the given virtual folder. NAME: Name of a virtual folder. ''' with Session() as session: try: result = session.VFolder(name).info() print('Virtual folder "{0}" (ID: {1})' .format(result['name'], result['id'])) ...
[ "def", "info", "(", "name", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "result", "=", "session", ".", "VFolder", "(", "name", ")", ".", "info", "(", ")", "print", "(", "'Virtual folder \"{0}\" (ID: {1})'", ".", "format", "...
Show the information of the given virtual folder. NAME: Name of a virtual folder.
[ "Show", "the", "information", "of", "the", "given", "virtual", "folder", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/vfolder.py#L114-L129
lablup/backend.ai-client-py
src/ai/backend/client/cli/vfolder.py
download
def download(name, filenames): ''' Download a file from the virtual folder to the current working directory. The files with the same names will be overwirtten. \b NAME: Name of a virtual folder. FILENAMES: Paths of the files to be uploaded. ''' with Session() as session: try: ...
python
def download(name, filenames): ''' Download a file from the virtual folder to the current working directory. The files with the same names will be overwirtten. \b NAME: Name of a virtual folder. FILENAMES: Paths of the files to be uploaded. ''' with Session() as session: try: ...
[ "def", "download", "(", "name", ",", "filenames", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "session", ".", "VFolder", "(", "name", ")", ".", "download", "(", "filenames", ",", "show_progress", "=", "True", ")", "print_do...
Download a file from the virtual folder to the current working directory. The files with the same names will be overwirtten. \b NAME: Name of a virtual folder. FILENAMES: Paths of the files to be uploaded.
[ "Download", "a", "file", "from", "the", "virtual", "folder", "to", "the", "current", "working", "directory", ".", "The", "files", "with", "the", "same", "names", "will", "be", "overwirtten", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/vfolder.py#L156-L171
lablup/backend.ai-client-py
src/ai/backend/client/cli/vfolder.py
mkdir
def mkdir(name, path): '''Create an empty directory in the virtual folder. \b NAME: Name of a virtual folder. PATH: The name or path of directory. Parent directories are created automatically if they do not exist. ''' with Session() as session: try: session.VFolder...
python
def mkdir(name, path): '''Create an empty directory in the virtual folder. \b NAME: Name of a virtual folder. PATH: The name or path of directory. Parent directories are created automatically if they do not exist. ''' with Session() as session: try: session.VFolder...
[ "def", "mkdir", "(", "name", ",", "path", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "session", ".", "VFolder", "(", "name", ")", ".", "mkdir", "(", "path", ")", "print_done", "(", "'Done.'", ")", "except", "Exception", ...
Create an empty directory in the virtual folder. \b NAME: Name of a virtual folder. PATH: The name or path of directory. Parent directories are created automatically if they do not exist.
[ "Create", "an", "empty", "directory", "in", "the", "virtual", "folder", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/vfolder.py#L190-L204
lablup/backend.ai-client-py
src/ai/backend/client/cli/vfolder.py
rm
def rm(name, filenames, recursive): ''' Delete files in a virtual folder. If one of the given paths is a directory and the recursive option is enabled, all its content and the directory itself are recursively deleted. This operation is irreversible! \b NAME: Name of a virtual folder. F...
python
def rm(name, filenames, recursive): ''' Delete files in a virtual folder. If one of the given paths is a directory and the recursive option is enabled, all its content and the directory itself are recursively deleted. This operation is irreversible! \b NAME: Name of a virtual folder. F...
[ "def", "rm", "(", "name", ",", "filenames", ",", "recursive", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "if", "input", "(", "\"> Are you sure? (y/n): \"", ")", ".", "lower", "(", ")", ".", "strip", "(", ")", "[", ":", ...
Delete files in a virtual folder. If one of the given paths is a directory and the recursive option is enabled, all its content and the directory itself are recursively deleted. This operation is irreversible! \b NAME: Name of a virtual folder. FILENAMES: Paths of the files to delete.
[ "Delete", "files", "in", "a", "virtual", "folder", ".", "If", "one", "of", "the", "given", "paths", "is", "a", "directory", "and", "the", "recursive", "option", "is", "enabled", "all", "its", "content", "and", "the", "directory", "itself", "are", "recursiv...
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/vfolder.py#L212-L233
lablup/backend.ai-client-py
src/ai/backend/client/cli/vfolder.py
ls
def ls(name, path): """ List files in a path of a virtual folder. \b NAME: Name of a virtual folder. PATH: Path inside vfolder. """ with Session() as session: try: print_wait('Retrieving list of files in "{}"...'.format(path)) result = session.VFolder(name).l...
python
def ls(name, path): """ List files in a path of a virtual folder. \b NAME: Name of a virtual folder. PATH: Path inside vfolder. """ with Session() as session: try: print_wait('Retrieving list of files in "{}"...'.format(path)) result = session.VFolder(name).l...
[ "def", "ls", "(", "name", ",", "path", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "print_wait", "(", "'Retrieving list of files in \"{}\"...'", ".", "format", "(", "path", ")", ")", "result", "=", "session", ".", "VFolder", ...
List files in a path of a virtual folder. \b NAME: Name of a virtual folder. PATH: Path inside vfolder.
[ "List", "files", "in", "a", "path", "of", "a", "virtual", "folder", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/vfolder.py#L239-L265
lablup/backend.ai-client-py
src/ai/backend/client/cli/vfolder.py
invite
def invite(name, emails, perm): """Invite other users to access the virtual folder. \b NAME: Name of a virtual folder. EMAIL: Emails to invite. """ with Session() as session: try: assert perm in ['rw', 'ro'], \ 'Invalid permission: {}'.format(perm) ...
python
def invite(name, emails, perm): """Invite other users to access the virtual folder. \b NAME: Name of a virtual folder. EMAIL: Emails to invite. """ with Session() as session: try: assert perm in ['rw', 'ro'], \ 'Invalid permission: {}'.format(perm) ...
[ "def", "invite", "(", "name", ",", "emails", ",", "perm", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "assert", "perm", "in", "[", "'rw'", ",", "'ro'", "]", ",", "'Invalid permission: {}'", ".", "format", "(", "perm", ")"...
Invite other users to access the virtual folder. \b NAME: Name of a virtual folder. EMAIL: Emails to invite.
[ "Invite", "other", "users", "to", "access", "the", "virtual", "folder", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/vfolder.py#L273-L294
lablup/backend.ai-client-py
src/ai/backend/client/cli/vfolder.py
invitations
def invitations(): """List and manage received invitations. """ with Session() as session: try: result = session.VFolder.invitations() invitations = result.get('invitations', []) if len(invitations) < 1: print('No invitations.') ret...
python
def invitations(): """List and manage received invitations. """ with Session() as session: try: result = session.VFolder.invitations() invitations = result.get('invitations', []) if len(invitations) < 1: print('No invitations.') ret...
[ "def", "invitations", "(", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "result", "=", "session", ".", "VFolder", ".", "invitations", "(", ")", "invitations", "=", "result", ".", "get", "(", "'invitations'", ",", "[", "]", ...
List and manage received invitations.
[ "List", "and", "manage", "received", "invitations", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/vfolder.py#L298-L344
mozilla-services/python-dockerflow
src/dockerflow/flask/app.py
Dockerflow.init_check
def init_check(self, check, obj): """ Adds a given check callback with the provided object to the list of checks. Useful for built-ins but also advanced custom checks. """ self.logger.info('Adding extension check %s' % check.__name__) check = functools.wraps(check)(functo...
python
def init_check(self, check, obj): """ Adds a given check callback with the provided object to the list of checks. Useful for built-ins but also advanced custom checks. """ self.logger.info('Adding extension check %s' % check.__name__) check = functools.wraps(check)(functo...
[ "def", "init_check", "(", "self", ",", "check", ",", "obj", ")", ":", "self", ".", "logger", ".", "info", "(", "'Adding extension check %s'", "%", "check", ".", "__name__", ")", "check", "=", "functools", ".", "wraps", "(", "check", ")", "(", "functools"...
Adds a given check callback with the provided object to the list of checks. Useful for built-ins but also advanced custom checks.
[ "Adds", "a", "given", "check", "callback", "with", "the", "provided", "object", "to", "the", "list", "of", "checks", ".", "Useful", "for", "built", "-", "ins", "but", "also", "advanced", "custom", "checks", "." ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/flask/app.py#L135-L142
mozilla-services/python-dockerflow
src/dockerflow/flask/app.py
Dockerflow.init_app
def init_app(self, app): """ Initializes the extension with the given app, registers the built-in views with an own blueprint and hooks up our signal callbacks. """ # If no version path was provided in the init of the Dockerflow # class we'll use the parent direct...
python
def init_app(self, app): """ Initializes the extension with the given app, registers the built-in views with an own blueprint and hooks up our signal callbacks. """ # If no version path was provided in the init of the Dockerflow # class we'll use the parent direct...
[ "def", "init_app", "(", "self", ",", "app", ")", ":", "# If no version path was provided in the init of the Dockerflow", "# class we'll use the parent directory of the app root path.", "if", "self", ".", "version_path", "is", "None", ":", "self", ".", "version_path", "=", "...
Initializes the extension with the given app, registers the built-in views with an own blueprint and hooks up our signal callbacks.
[ "Initializes", "the", "extension", "with", "the", "given", "app", "registers", "the", "built", "-", "in", "views", "with", "an", "own", "blueprint", "and", "hooks", "up", "our", "signal", "callbacks", "." ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/flask/app.py#L144-L169
mozilla-services/python-dockerflow
src/dockerflow/flask/app.py
Dockerflow._before_request
def _before_request(self): """ The before_request callback. """ g._request_id = str(uuid.uuid4()) g._start_timestamp = time.time()
python
def _before_request(self): """ The before_request callback. """ g._request_id = str(uuid.uuid4()) g._start_timestamp = time.time()
[ "def", "_before_request", "(", "self", ")", ":", "g", ".", "_request_id", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "g", ".", "_start_timestamp", "=", "time", ".", "time", "(", ")" ]
The before_request callback.
[ "The", "before_request", "callback", "." ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/flask/app.py#L178-L183
mozilla-services/python-dockerflow
src/dockerflow/flask/app.py
Dockerflow._after_request
def _after_request(self, response): """ The signal handler for the request_finished signal. """ if not getattr(g, '_has_exception', False): extra = self.summary_extra() self.summary_logger.info('', extra=extra) return response
python
def _after_request(self, response): """ The signal handler for the request_finished signal. """ if not getattr(g, '_has_exception', False): extra = self.summary_extra() self.summary_logger.info('', extra=extra) return response
[ "def", "_after_request", "(", "self", ",", "response", ")", ":", "if", "not", "getattr", "(", "g", ",", "'_has_exception'", ",", "False", ")", ":", "extra", "=", "self", ".", "summary_extra", "(", ")", "self", ".", "summary_logger", ".", "info", "(", "...
The signal handler for the request_finished signal.
[ "The", "signal", "handler", "for", "the", "request_finished", "signal", "." ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/flask/app.py#L185-L192
mozilla-services/python-dockerflow
src/dockerflow/flask/app.py
Dockerflow._got_request_exception
def _got_request_exception(self, sender, exception, **extra): """ The signal handler for the got_request_exception signal. """ extra = self.summary_extra() extra['errno'] = 500 self.summary_logger.error(str(exception), extra=extra) g._has_exception = True
python
def _got_request_exception(self, sender, exception, **extra): """ The signal handler for the got_request_exception signal. """ extra = self.summary_extra() extra['errno'] = 500 self.summary_logger.error(str(exception), extra=extra) g._has_exception = True
[ "def", "_got_request_exception", "(", "self", ",", "sender", ",", "exception", ",", "*", "*", "extra", ")", ":", "extra", "=", "self", ".", "summary_extra", "(", ")", "extra", "[", "'errno'", "]", "=", "500", "self", ".", "summary_logger", ".", "error", ...
The signal handler for the got_request_exception signal.
[ "The", "signal", "handler", "for", "the", "got_request_exception", "signal", "." ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/flask/app.py#L194-L201
mozilla-services/python-dockerflow
src/dockerflow/flask/app.py
Dockerflow.user_id
def user_id(self): """ Return the ID of the current request's user """ # This needs flask-login to be installed if not has_flask_login: return # and the actual login manager installed if not hasattr(current_app, 'login_manager'): return ...
python
def user_id(self): """ Return the ID of the current request's user """ # This needs flask-login to be installed if not has_flask_login: return # and the actual login manager installed if not hasattr(current_app, 'login_manager'): return ...
[ "def", "user_id", "(", "self", ")", ":", "# This needs flask-login to be installed", "if", "not", "has_flask_login", ":", "return", "# and the actual login manager installed", "if", "not", "hasattr", "(", "current_app", ",", "'login_manager'", ")", ":", "return", "# fai...
Return the ID of the current request's user
[ "Return", "the", "ID", "of", "the", "current", "request", "s", "user" ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/flask/app.py#L203-L230
mozilla-services/python-dockerflow
src/dockerflow/flask/app.py
Dockerflow.summary_extra
def summary_extra(self): """ Build the extra data for the summary logger. """ out = { 'errno': 0, 'agent': request.headers.get('User-Agent', ''), 'lang': request.headers.get('Accept-Language', ''), 'method': request.method, 'pat...
python
def summary_extra(self): """ Build the extra data for the summary logger. """ out = { 'errno': 0, 'agent': request.headers.get('User-Agent', ''), 'lang': request.headers.get('Accept-Language', ''), 'method': request.method, 'pat...
[ "def", "summary_extra", "(", "self", ")", ":", "out", "=", "{", "'errno'", ":", "0", ",", "'agent'", ":", "request", ".", "headers", ".", "get", "(", "'User-Agent'", ",", "''", ")", ",", "'lang'", ":", "request", ".", "headers", ".", "get", "(", "'...
Build the extra data for the summary logger.
[ "Build", "the", "extra", "data", "for", "the", "summary", "logger", "." ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/flask/app.py#L232-L261
mozilla-services/python-dockerflow
src/dockerflow/flask/app.py
Dockerflow._version_view
def _version_view(self): """ View that returns the contents of version.json or a 404. """ version_json = self._version_callback(self.version_path) if version_json is None: return 'version.json not found', 404 else: return jsonify(version_json)
python
def _version_view(self): """ View that returns the contents of version.json or a 404. """ version_json = self._version_callback(self.version_path) if version_json is None: return 'version.json not found', 404 else: return jsonify(version_json)
[ "def", "_version_view", "(", "self", ")", ":", "version_json", "=", "self", ".", "_version_callback", "(", "self", ".", "version_path", ")", "if", "version_json", "is", "None", ":", "return", "'version.json not found'", ",", "404", "else", ":", "return", "json...
View that returns the contents of version.json or a 404.
[ "View", "that", "returns", "the", "contents", "of", "version", ".", "json", "or", "a", "404", "." ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/flask/app.py#L263-L271
mozilla-services/python-dockerflow
src/dockerflow/flask/app.py
Dockerflow._heartbeat_view
def _heartbeat_view(self): """ Runs all the registered checks and returns a JSON response with either a status code of 200 or 500 depending on the results of the checks. Any check that returns a warning or worse (error, critical) will return a 500 response. """ d...
python
def _heartbeat_view(self): """ Runs all the registered checks and returns a JSON response with either a status code of 200 or 500 depending on the results of the checks. Any check that returns a warning or worse (error, critical) will return a 500 response. """ d...
[ "def", "_heartbeat_view", "(", "self", ")", ":", "details", "=", "{", "}", "statuses", "=", "{", "}", "level", "=", "0", "for", "name", ",", "check", "in", "self", ".", "checks", ".", "items", "(", ")", ":", "detail", "=", "self", ".", "_heartbeat_...
Runs all the registered checks and returns a JSON response with either a status code of 200 or 500 depending on the results of the checks. Any check that returns a warning or worse (error, critical) will return a 500 response.
[ "Runs", "all", "the", "registered", "checks", "and", "returns", "a", "JSON", "response", "with", "either", "a", "status", "code", "of", "200", "or", "500", "depending", "on", "the", "results", "of", "the", "checks", "." ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/flask/app.py#L291-L326
mozilla-services/python-dockerflow
src/dockerflow/flask/app.py
Dockerflow.check
def check(self, func=None, name=None): """ A decorator to register a new Dockerflow check to be run when the /__heartbeat__ endpoint is called., e.g.:: from dockerflow.flask import checks @dockerflow.check def storage_reachable(): try: ...
python
def check(self, func=None, name=None): """ A decorator to register a new Dockerflow check to be run when the /__heartbeat__ endpoint is called., e.g.:: from dockerflow.flask import checks @dockerflow.check def storage_reachable(): try: ...
[ "def", "check", "(", "self", ",", "func", "=", "None", ",", "name", "=", "None", ")", ":", "if", "func", "is", "None", ":", "return", "functools", ".", "partial", "(", "self", ".", "check", ",", "name", "=", "name", ")", "if", "name", "is", "None...
A decorator to register a new Dockerflow check to be run when the /__heartbeat__ endpoint is called., e.g.:: from dockerflow.flask import checks @dockerflow.check def storage_reachable(): try: acme.storage.ping() except Sl...
[ "A", "decorator", "to", "register", "a", "new", "Dockerflow", "check", "to", "be", "run", "when", "the", "/", "__heartbeat__", "endpoint", "is", "called", ".", "e", ".", "g", ".", "::" ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/flask/app.py#L354-L391
lablup/backend.ai-client-py
src/ai/backend/client/cli/run.py
drange
def drange(start: Decimal, stop: Decimal, num: int): ''' A simplified version of numpy.linspace with default options ''' delta = stop - start step = delta / (num - 1) yield from (start + step * Decimal(tick) for tick in range(0, num))
python
def drange(start: Decimal, stop: Decimal, num: int): ''' A simplified version of numpy.linspace with default options ''' delta = stop - start step = delta / (num - 1) yield from (start + step * Decimal(tick) for tick in range(0, num))
[ "def", "drange", "(", "start", ":", "Decimal", ",", "stop", ":", "Decimal", ",", "num", ":", "int", ")", ":", "delta", "=", "stop", "-", "start", "step", "=", "delta", "/", "(", "num", "-", "1", ")", "yield", "from", "(", "start", "+", "step", ...
A simplified version of numpy.linspace with default options
[ "A", "simplified", "version", "of", "numpy", ".", "linspace", "with", "default", "options" ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/run.py#L32-L38
lablup/backend.ai-client-py
src/ai/backend/client/cli/run.py
range_expr
def range_expr(arg): ''' Accepts a range expression which generates a range of values for a variable. Linear space range: "linspace:1,2,10" (start, stop, num) as in numpy.linspace Pythonic range: "range:1,10,2" (start, stop[, step]) as in Python's range Case range: "case:a,b,c" (comma-separated str...
python
def range_expr(arg): ''' Accepts a range expression which generates a range of values for a variable. Linear space range: "linspace:1,2,10" (start, stop, num) as in numpy.linspace Pythonic range: "range:1,10,2" (start, stop[, step]) as in Python's range Case range: "case:a,b,c" (comma-separated str...
[ "def", "range_expr", "(", "arg", ")", ":", "key", ",", "value", "=", "arg", ".", "split", "(", "'='", ",", "maxsplit", "=", "1", ")", "assert", "_rx_range_key", ".", "match", "(", "key", ")", ",", "'The key must be a valid slug string.'", "try", ":", "if...
Accepts a range expression which generates a range of values for a variable. Linear space range: "linspace:1,2,10" (start, stop, num) as in numpy.linspace Pythonic range: "range:1,10,2" (start, stop[, step]) as in Python's range Case range: "case:a,b,c" (comma-separated strings)
[ "Accepts", "a", "range", "expression", "which", "generates", "a", "range", "of", "values", "for", "a", "variable", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/run.py#L41-L63
lablup/backend.ai-client-py
src/ai/backend/client/cli/run.py
exec_loop
async def exec_loop(stdout, stderr, kernel, mode, code, *, opts=None, vprint_done=print_done, is_multi=False): ''' Fully streamed asynchronous version of the execute loop. ''' async with kernel.stream_execute(code, mode=mode, opts=opts) as stream: async for result in stream: ...
python
async def exec_loop(stdout, stderr, kernel, mode, code, *, opts=None, vprint_done=print_done, is_multi=False): ''' Fully streamed asynchronous version of the execute loop. ''' async with kernel.stream_execute(code, mode=mode, opts=opts) as stream: async for result in stream: ...
[ "async", "def", "exec_loop", "(", "stdout", ",", "stderr", ",", "kernel", ",", "mode", ",", "code", ",", "*", ",", "opts", "=", "None", ",", "vprint_done", "=", "print_done", ",", "is_multi", "=", "False", ")", ":", "async", "with", "kernel", ".", "s...
Fully streamed asynchronous version of the execute loop.
[ "Fully", "streamed", "asynchronous", "version", "of", "the", "execute", "loop", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/run.py#L66-L121
lablup/backend.ai-client-py
src/ai/backend/client/cli/run.py
exec_loop_sync
def exec_loop_sync(stdout, stderr, kernel, mode, code, *, opts=None, vprint_done=print_done): ''' Old synchronous polling version of the execute loop. ''' opts = opts if opts else {} run_id = None # use server-assigned run ID while True: result = kernel.execute(run_id...
python
def exec_loop_sync(stdout, stderr, kernel, mode, code, *, opts=None, vprint_done=print_done): ''' Old synchronous polling version of the execute loop. ''' opts = opts if opts else {} run_id = None # use server-assigned run ID while True: result = kernel.execute(run_id...
[ "def", "exec_loop_sync", "(", "stdout", ",", "stderr", ",", "kernel", ",", "mode", ",", "code", ",", "*", ",", "opts", "=", "None", ",", "vprint_done", "=", "print_done", ")", ":", "opts", "=", "opts", "if", "opts", "else", "{", "}", "run_id", "=", ...
Old synchronous polling version of the execute loop.
[ "Old", "synchronous", "polling", "version", "of", "the", "execute", "loop", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/run.py#L124-L177
lablup/backend.ai-client-py
src/ai/backend/client/cli/run.py
run
def run(lang, files, session_id, cluster_size, code, clean, build, exec, terminal, basedir, rm, env, env_range, build_range, exec_range, max_parallel, mount, stats, tag, resources, quiet): ''' Run the given code snippet or files in a session. Depending on the session ID you give (default is ...
python
def run(lang, files, session_id, cluster_size, code, clean, build, exec, terminal, basedir, rm, env, env_range, build_range, exec_range, max_parallel, mount, stats, tag, resources, quiet): ''' Run the given code snippet or files in a session. Depending on the session ID you give (default is ...
[ "def", "run", "(", "lang", ",", "files", ",", "session_id", ",", "cluster_size", ",", "code", ",", "clean", ",", "build", ",", "exec", ",", "terminal", ",", "basedir", ",", "rm", ",", "env", ",", "env_range", ",", "build_range", ",", "exec_range", ",",...
Run the given code snippet or files in a session. Depending on the session ID you give (default is random), it may reuse an existing session or create a new one. \b LANG: The name (and version/platform tags appended after a colon) of session runtime or programming language.') FILES: The c...
[ "Run", "the", "given", "code", "snippet", "or", "files", "in", "a", "session", ".", "Depending", "on", "the", "session", "ID", "you", "give", "(", "default", "is", "random", ")", "it", "may", "reuse", "an", "existing", "session", "or", "create", "a", "...
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/run.py#L273-L584
lablup/backend.ai-client-py
src/ai/backend/client/cli/run.py
start
def start(lang, session_id, owner, env, mount, tag, resources, cluster_size): ''' Prepare and start a single compute session without executing codes. You may use the created session to execute codes using the "run" command or connect to an application service provided by the session using the "app" ...
python
def start(lang, session_id, owner, env, mount, tag, resources, cluster_size): ''' Prepare and start a single compute session without executing codes. You may use the created session to execute codes using the "run" command or connect to an application service provided by the session using the "app" ...
[ "def", "start", "(", "lang", ",", "session_id", ",", "owner", ",", "env", ",", "mount", ",", "tag", ",", "resources", ",", "cluster_size", ")", ":", "if", "session_id", "is", "None", ":", "session_id", "=", "token_hex", "(", "5", ")", "else", ":", "s...
Prepare and start a single compute session without executing codes. You may use the created session to execute codes using the "run" command or connect to an application service provided by the session using the "app" command. \b LANG: The name (and version/platform tags appended after a colon) of...
[ "Prepare", "and", "start", "a", "single", "compute", "session", "without", "executing", "codes", ".", "You", "may", "use", "the", "created", "session", "to", "execute", "codes", "using", "the", "run", "command", "or", "connect", "to", "an", "application", "s...
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/run.py#L607-L652
lablup/backend.ai-client-py
src/ai/backend/client/cli/run.py
terminate
def terminate(sess_id_or_alias, owner, stats): ''' Terminate the given session. SESSID: session ID or its alias given when creating the session. ''' print_wait('Terminating the session(s)...') with Session() as session: has_failure = False for sess in sess_id_or_alias: ...
python
def terminate(sess_id_or_alias, owner, stats): ''' Terminate the given session. SESSID: session ID or its alias given when creating the session. ''' print_wait('Terminating the session(s)...') with Session() as session: has_failure = False for sess in sess_id_or_alias: ...
[ "def", "terminate", "(", "sess_id_or_alias", ",", "owner", ",", "stats", ")", ":", "print_wait", "(", "'Terminating the session(s)...'", ")", "with", "Session", "(", ")", "as", "session", ":", "has_failure", "=", "False", "for", "sess", "in", "sess_id_or_alias",...
Terminate the given session. SESSID: session ID or its alias given when creating the session.
[ "Terminate", "the", "given", "session", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/run.py#L661-L693
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/groups.py
get_custom_view_details
def get_custom_view_details(name, auth, url): """ function requires no input and returns a list of dictionaries of custom views from an HPE IMC. Optional name argument will return only the specified view. :param name: str containing the name of the desired custom view :param auth: requests auth obj...
python
def get_custom_view_details(name, auth, url): """ function requires no input and returns a list of dictionaries of custom views from an HPE IMC. Optional name argument will return only the specified view. :param name: str containing the name of the desired custom view :param auth: requests auth obj...
[ "def", "get_custom_view_details", "(", "name", ",", "auth", ",", "url", ")", ":", "view_id", "=", "get_custom_views", "(", "auth", ",", "url", ",", "name", "=", "name", ")", "[", "0", "]", "[", "'symbolId'", "]", "get_custom_view_details_url", "=", "'/imcr...
function requires no input and returns a list of dictionaries of custom views from an HPE IMC. Optional name argument will return only the specified view. :param name: str containing the name of the desired custom view :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class ...
[ "function", "requires", "no", "input", "and", "returns", "a", "list", "of", "dictionaries", "of", "custom", "views", "from", "an", "HPE", "IMC", ".", "Optional", "name", "argument", "will", "return", "only", "the", "specified", "view", ".", ":", "param", "...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/groups.py#L72-L114
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/groups.py
add_devs_custom_views
def add_devs_custom_views(custom_view_name, dev_list, auth, url): """ function takes a list of devIDs from devices discovered in the HPE IMC platform and and issues a RESTFUL call to add the list of devices to a specific custom views from HPE IMC. :param dev_list: list containing the devID of all devi...
python
def add_devs_custom_views(custom_view_name, dev_list, auth, url): """ function takes a list of devIDs from devices discovered in the HPE IMC platform and and issues a RESTFUL call to add the list of devices to a specific custom views from HPE IMC. :param dev_list: list containing the devID of all devi...
[ "def", "add_devs_custom_views", "(", "custom_view_name", ",", "dev_list", ",", "auth", ",", "url", ")", ":", "view_id", "=", "get_custom_views", "(", "auth", ",", "url", ",", "name", "=", "custom_view_name", ")", "[", "0", "]", "[", "'symbolId'", "]", "add...
function takes a list of devIDs from devices discovered in the HPE IMC platform and and issues a RESTFUL call to add the list of devices to a specific custom views from HPE IMC. :param dev_list: list containing the devID of all devices to be contained in this custom view. :param auth: requests auth objec...
[ "function", "takes", "a", "list", "of", "devIDs", "from", "devices", "discovered", "in", "the", "HPE", "IMC", "platform", "and", "and", "issues", "a", "RESTFUL", "call", "to", "add", "the", "list", "of", "devices", "to", "a", "specific", "custom", "views",...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/groups.py#L181-L213
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/groups.py
delete_custom_view
def delete_custom_view(auth, url, name): """ function takes input of auth, url, and name and issues a RESTFUL call to delete a specific of custom views from HPE IMC. :param name: string containg the name of the desired custom view :param auth: requests auth object #usually auth.creds from auth pyhp...
python
def delete_custom_view(auth, url, name): """ function takes input of auth, url, and name and issues a RESTFUL call to delete a specific of custom views from HPE IMC. :param name: string containg the name of the desired custom view :param auth: requests auth object #usually auth.creds from auth pyhp...
[ "def", "delete_custom_view", "(", "auth", ",", "url", ",", "name", ")", ":", "view_id", "=", "get_custom_views", "(", "auth", ",", "url", ",", "name", ")", "[", "0", "]", "[", "'symbolId'", "]", "delete_custom_view_url", "=", "'/imcrs/plat/res/view/custom/'", ...
function takes input of auth, url, and name and issues a RESTFUL call to delete a specific of custom views from HPE IMC. :param name: string containg the name of the desired custom view :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS i...
[ "function", "takes", "input", "of", "auth", "url", "and", "name", "and", "issues", "a", "RESTFUL", "call", "to", "delete", "a", "specific", "of", "custom", "views", "from", "HPE", "IMC", ".", ":", "param", "name", ":", "string", "containg", "the", "name"...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/groups.py#L217-L260
Tygs/ww
src/ww/tools/strings.py
multisplit
def multisplit(string, # type: unicode *separators, # type: unicode **kwargs # type: Union[unicode, C[..., I[unicode]]] ): # type: (...) -> I """ Like unicode.split, but accept several separators and regexes Args: string: the string to split. ...
python
def multisplit(string, # type: unicode *separators, # type: unicode **kwargs # type: Union[unicode, C[..., I[unicode]]] ): # type: (...) -> I """ Like unicode.split, but accept several separators and regexes Args: string: the string to split. ...
[ "def", "multisplit", "(", "string", ",", "# type: unicode", "*", "separators", ",", "# type: unicode", "*", "*", "kwargs", "# type: Union[unicode, C[..., I[unicode]]]", ")", ":", "# type: (...) -> I", "cast", "=", "kwargs", ".", "pop", "(", "'cast'", ",", "list", ...
Like unicode.split, but accept several separators and regexes Args: string: the string to split. separators: strings you can split on. Each string can be a regex. maxsplit: max number of time you wish to split. default is 0, whic...
[ "Like", "unicode", ".", "split", "but", "accept", "several", "separators", "and", "regexes" ]
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/tools/strings.py#L77-L163
Tygs/ww
src/ww/tools/strings.py
multireplace
def multireplace(string, # type: unicode patterns, # type: str_or_str_iterable substitutions, # type: str_istr_icallable maxreplace=0, # type: int flags=0 # type: unicode ): # type: (...) -> bool """ Like unicode.replace() bu...
python
def multireplace(string, # type: unicode patterns, # type: str_or_str_iterable substitutions, # type: str_istr_icallable maxreplace=0, # type: int flags=0 # type: unicode ): # type: (...) -> bool """ Like unicode.replace() bu...
[ "def", "multireplace", "(", "string", ",", "# type: unicode", "patterns", ",", "# type: str_or_str_iterable", "substitutions", ",", "# type: str_istr_icallable", "maxreplace", "=", "0", ",", "# type: int", "flags", "=", "0", "# type: unicode", ")", ":", "# type: (...) -...
Like unicode.replace() but accept several substitutions and regexes Args: string: the string to split on. patterns: a string, or an iterable of strings to be replaced. substitutions: a string or an iterable of string to use as a replacement. You ca...
[ "Like", "unicode", ".", "replace", "()", "but", "accept", "several", "substitutions", "and", "regexes" ]
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/tools/strings.py#L214-L300
lablup/backend.ai-client-py
src/ai/backend/client/cli/manager.py
status
def status(): '''Show the manager's current status.''' with Session() as session: resp = session.Manager.status() print(tabulate([('Status', 'Active Sessions'), (resp['status'], resp['active_sessions'])], headers='firstrow'))
python
def status(): '''Show the manager's current status.''' with Session() as session: resp = session.Manager.status() print(tabulate([('Status', 'Active Sessions'), (resp['status'], resp['active_sessions'])], headers='firstrow'))
[ "def", "status", "(", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "resp", "=", "session", ".", "Manager", ".", "status", "(", ")", "print", "(", "tabulate", "(", "[", "(", "'Status'", ",", "'Active Sessions'", ")", ",", "(", "resp", ...
Show the manager's current status.
[ "Show", "the", "manager", "s", "current", "status", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/manager.py#L19-L25
lablup/backend.ai-client-py
src/ai/backend/client/cli/manager.py
freeze
def freeze(wait, force_kill): '''Freeze manager.''' if wait and force_kill: print('You cannot use both --wait and --force-kill options ' 'at the same time.', file=sys.stderr) return with Session() as session: if wait: while True: resp = sess...
python
def freeze(wait, force_kill): '''Freeze manager.''' if wait and force_kill: print('You cannot use both --wait and --force-kill options ' 'at the same time.', file=sys.stderr) return with Session() as session: if wait: while True: resp = sess...
[ "def", "freeze", "(", "wait", ",", "force_kill", ")", ":", "if", "wait", "and", "force_kill", ":", "print", "(", "'You cannot use both --wait and --force-kill options '", "'at the same time.'", ",", "file", "=", "sys", ".", "stderr", ")", "return", "with", "Sessio...
Freeze manager.
[ "Freeze", "manager", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/manager.py#L34-L61
HPENetworking/PYHPEIMC
pyhpeimc/plat/vlanm.py
get_dev_vlans
def get_dev_vlans(auth, url, devid=None, devip=None): """Function takes input of devID to issue RESTUL call to HP IMC :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :param devi...
python
def get_dev_vlans(auth, url, devid=None, devip=None): """Function takes input of devID to issue RESTUL call to HP IMC :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :param devi...
[ "def", "get_dev_vlans", "(", "auth", ",", "url", ",", "devid", "=", "None", ",", "devip", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devip", ",", "auth", ",", "url", ")", "[", "'id'", "]",...
Function takes input of devID to issue RESTUL call to HP IMC :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :param devid: str requires devId as the only input parameter :param...
[ "Function", "takes", "input", "of", "devID", "to", "issue", "RESTUL", "call", "to", "HP", "IMC" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/vlanm.py#L23-L64
HPENetworking/PYHPEIMC
pyhpeimc/plat/vlanm.py
get_trunk_interfaces
def get_trunk_interfaces(auth, url, devid=None, devip=None): """Function takes devId as input to RESTFULL call to HP IMC platform :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass ...
python
def get_trunk_interfaces(auth, url, devid=None, devip=None): """Function takes devId as input to RESTFULL call to HP IMC platform :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass ...
[ "def", "get_trunk_interfaces", "(", "auth", ",", "url", ",", "devid", "=", "None", ",", "devip", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devip", ",", "auth", ",", "url", ")", "[", "'id'",...
Function takes devId as input to RESTFULL call to HP IMC platform :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :param devid: str requires devid of the target device :param d...
[ "Function", "takes", "devId", "as", "input", "to", "RESTFULL", "call", "to", "HP", "IMC", "platform" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/vlanm.py#L67-L123
HPENetworking/PYHPEIMC
pyhpeimc/plat/vlanm.py
get_device_access_interfaces
def get_device_access_interfaces(auth, url, devid=None, devip=None): """ Function takes devid pr devip as input to RESTFUL call to HP IMC platform :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeim...
python
def get_device_access_interfaces(auth, url, devid=None, devip=None): """ Function takes devid pr devip as input to RESTFUL call to HP IMC platform :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeim...
[ "def", "get_device_access_interfaces", "(", "auth", ",", "url", ",", "devid", "=", "None", ",", "devip", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devip", ",", "auth", ",", "url", ")", "[", ...
Function takes devid pr devip as input to RESTFUL call to HP IMC platform :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :param devid: str requires devid of the target device ...
[ "Function", "takes", "devid", "pr", "devip", "as", "input", "to", "RESTFUL", "call", "to", "HP", "IMC", "platform" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/vlanm.py#L126-L178
HPENetworking/PYHPEIMC
pyhpeimc/plat/vlanm.py
get_device_hybrid_interfaces
def get_device_hybrid_interfaces(auth, url, devid=None, devip=None): """ Function takes devId as input to RESTFUL call to HP IMC platform :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.au...
python
def get_device_hybrid_interfaces(auth, url, devid=None, devip=None): """ Function takes devId as input to RESTFUL call to HP IMC platform :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.au...
[ "def", "get_device_hybrid_interfaces", "(", "auth", ",", "url", ",", "devid", "=", "None", ",", "devip", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devip", ",", "auth", ",", "url", ")", "[", ...
Function takes devId as input to RESTFUL call to HP IMC platform :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :param devid: str requires devid of the target device :param de...
[ "Function", "takes", "devId", "as", "input", "to", "RESTFUL", "call", "to", "HP", "IMC", "platform" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/vlanm.py#L184-L237
HPENetworking/PYHPEIMC
pyhpeimc/plat/vlanm.py
add_hybrid_interface
def add_hybrid_interface(ifindex, pvid, taggedvlans, untaggedvlans, auth, url, devip=None, devid=None): """ Function takes ifindex, pvid, tagged vlans untagged vlans as input values to add a hybrid port to a HPE Comware based switch. These functions only apply to HPE Comware based d...
python
def add_hybrid_interface(ifindex, pvid, taggedvlans, untaggedvlans, auth, url, devip=None, devid=None): """ Function takes ifindex, pvid, tagged vlans untagged vlans as input values to add a hybrid port to a HPE Comware based switch. These functions only apply to HPE Comware based d...
[ "def", "add_hybrid_interface", "(", "ifindex", ",", "pvid", ",", "taggedvlans", ",", "untaggedvlans", ",", "auth", ",", "url", ",", "devip", "=", "None", ",", "devid", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_d...
Function takes ifindex, pvid, tagged vlans untagged vlans as input values to add a hybrid port to a HPE Comware based switch. These functions only apply to HPE Comware based devices. :param ifindex: str ifIndex value of target interface :param pvid: str 802.1q value (1-4094) of target VLAN :param tagged...
[ "Function", "takes", "ifindex", "pvid", "tagged", "vlans", "untagged", "vlans", "as", "input", "values", "to", "add", "a", "hybrid", "port", "to", "a", "HPE", "Comware", "based", "switch", ".", "These", "functions", "only", "apply", "to", "HPE", "Comware", ...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/vlanm.py#L240-L274
HPENetworking/PYHPEIMC
pyhpeimc/plat/vlanm.py
delete_hybrid_interface
def delete_hybrid_interface(ifindex, auth, url, devip=None, devid=None): """ Function takes devip ( ipv4 address ), ifIndex and pvid (vlanid) of specific device and 802.1q VLAN tag and issues a RESTFUL call to remove the specified VLAN from the target device. :param ifindex: str value of ifIndex for ...
python
def delete_hybrid_interface(ifindex, auth, url, devip=None, devid=None): """ Function takes devip ( ipv4 address ), ifIndex and pvid (vlanid) of specific device and 802.1q VLAN tag and issues a RESTFUL call to remove the specified VLAN from the target device. :param ifindex: str value of ifIndex for ...
[ "def", "delete_hybrid_interface", "(", "ifindex", ",", "auth", ",", "url", ",", "devip", "=", "None", ",", "devid", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devip", ",", "auth", ",", "url", ...
Function takes devip ( ipv4 address ), ifIndex and pvid (vlanid) of specific device and 802.1q VLAN tag and issues a RESTFUL call to remove the specified VLAN from the target device. :param ifindex: str value of ifIndex for a specific interface on the device :param auth: requests auth object #usually aut...
[ "Function", "takes", "devip", "(", "ipv4", "address", ")", "ifIndex", "and", "pvid", "(", "vlanid", ")", "of", "specific", "device", "and", "802", ".", "1q", "VLAN", "tag", "and", "issues", "a", "RESTFUL", "call", "to", "remove", "the", "specified", "VLA...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/vlanm.py#L313-L360
HPENetworking/PYHPEIMC
pyhpeimc/plat/vlanm.py
set_access_interface_pvid
def set_access_interface_pvid(ifindex, pvid, auth, url, devip=None, devid=None): """ Function takes devip ( ipv4 address ), ifIndex and pvid (vlanid) of specific device and 802.1q VLAN tag and issues a RESTFUL call to remove the specified VLAN from the target device. :param ifindex: str value of ifInde...
python
def set_access_interface_pvid(ifindex, pvid, auth, url, devip=None, devid=None): """ Function takes devip ( ipv4 address ), ifIndex and pvid (vlanid) of specific device and 802.1q VLAN tag and issues a RESTFUL call to remove the specified VLAN from the target device. :param ifindex: str value of ifInde...
[ "def", "set_access_interface_pvid", "(", "ifindex", ",", "pvid", ",", "auth", ",", "url", ",", "devip", "=", "None", ",", "devid", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devip", ",", "auth...
Function takes devip ( ipv4 address ), ifIndex and pvid (vlanid) of specific device and 802.1q VLAN tag and issues a RESTFUL call to remove the specified VLAN from the target device. :param ifindex: str value of ifIndex for a specific interface on the device :param pvid: str value of dot1q VLAN desired t...
[ "Function", "takes", "devip", "(", "ipv4", "address", ")", "ifIndex", "and", "pvid", "(", "vlanid", ")", "of", "specific", "device", "and", "802", ".", "1q", "VLAN", "tag", "and", "issues", "a", "RESTFUL", "call", "to", "remove", "the", "specified", "VLA...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/vlanm.py#L365-L418
HPENetworking/PYHPEIMC
pyhpeimc/plat/vlanm.py
create_dev_vlan
def create_dev_vlan(vlanid, vlan_name, auth, url, devid=None, devip=None): """ function takes devid and vlanid vlan_name of specific device and 802.1q VLAN tag and issues a RESTFUL call to add the specified VLAN from the target device. VLAN Name MUST be valid on target device. :param vlanid:int or ...
python
def create_dev_vlan(vlanid, vlan_name, auth, url, devid=None, devip=None): """ function takes devid and vlanid vlan_name of specific device and 802.1q VLAN tag and issues a RESTFUL call to add the specified VLAN from the target device. VLAN Name MUST be valid on target device. :param vlanid:int or ...
[ "def", "create_dev_vlan", "(", "vlanid", ",", "vlan_name", ",", "auth", ",", "url", ",", "devid", "=", "None", ",", "devip", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devip", ",", "auth", "...
function takes devid and vlanid vlan_name of specific device and 802.1q VLAN tag and issues a RESTFUL call to add the specified VLAN from the target device. VLAN Name MUST be valid on target device. :param vlanid:int or str value of target 802.1q VLAN :param vlan_name: str value of the target 802.1q V...
[ "function", "takes", "devid", "and", "vlanid", "vlan_name", "of", "specific", "device", "and", "802", ".", "1q", "VLAN", "tag", "and", "issues", "a", "RESTFUL", "call", "to", "add", "the", "specified", "VLAN", "from", "the", "target", "device", ".", "VLAN"...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/vlanm.py#L455-L502
HPENetworking/PYHPEIMC
pyhpeimc/plat/vlanm.py
delete_dev_vlans
def delete_dev_vlans(vlanid, auth, url, devid=None, devip=None): """ function takes devid and vlanid of specific device and 802.1q VLAN tag and issues a RESTFUL call to remove the specified VLAN from the target device. :param vlanid:int or str value of target 802.1q VLAN :param auth: requests auth ...
python
def delete_dev_vlans(vlanid, auth, url, devid=None, devip=None): """ function takes devid and vlanid of specific device and 802.1q VLAN tag and issues a RESTFUL call to remove the specified VLAN from the target device. :param vlanid:int or str value of target 802.1q VLAN :param auth: requests auth ...
[ "def", "delete_dev_vlans", "(", "vlanid", ",", "auth", ",", "url", ",", "devid", "=", "None", ",", "devip", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devip", ",", "auth", ",", "url", ")", ...
function takes devid and vlanid of specific device and 802.1q VLAN tag and issues a RESTFUL call to remove the specified VLAN from the target device. :param vlanid:int or str value of target 802.1q VLAN :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: bas...
[ "function", "takes", "devid", "and", "vlanid", "of", "specific", "device", "and", "802", ".", "1q", "VLAN", "tag", "and", "issues", "a", "RESTFUL", "call", "to", "remove", "the", "specified", "VLAN", "from", "the", "target", "device", ".", ":", "param", ...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/vlanm.py#L505-L545
housecanary/hc-api-python
housecanary/hc_api_export/hc_api_export.py
_get_results_from_api
def _get_results_from_api(identifiers, endpoints, api_key, api_secret): """Use the HouseCanary API Python Client to access the API""" if api_key is not None and api_secret is not None: client = housecanary.ApiClient(api_key, api_secret) else: client = housecanary.ApiClient() wrapper = ...
python
def _get_results_from_api(identifiers, endpoints, api_key, api_secret): """Use the HouseCanary API Python Client to access the API""" if api_key is not None and api_secret is not None: client = housecanary.ApiClient(api_key, api_secret) else: client = housecanary.ApiClient() wrapper = ...
[ "def", "_get_results_from_api", "(", "identifiers", ",", "endpoints", ",", "api_key", ",", "api_secret", ")", ":", "if", "api_key", "is", "not", "None", "and", "api_secret", "is", "not", "None", ":", "client", "=", "housecanary", ".", "ApiClient", "(", "api_...
Use the HouseCanary API Python Client to access the API
[ "Use", "the", "HouseCanary", "API", "Python", "Client", "to", "access", "the", "API" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/hc_api_export/hc_api_export.py#L154-L168
lablup/backend.ai-client-py
src/ai/backend/client/cli/admin/images.py
images
def images(): ''' Show the list of registered images in this cluster. ''' fields = [ ('Name', 'name'), ('Registry', 'registry'), ('Tag', 'tag'), ('Digest', 'digest'), ('Size', 'size_bytes'), ('Aliases', 'aliases'), ] with Session() as session: ...
python
def images(): ''' Show the list of registered images in this cluster. ''' fields = [ ('Name', 'name'), ('Registry', 'registry'), ('Tag', 'tag'), ('Digest', 'digest'), ('Size', 'size_bytes'), ('Aliases', 'aliases'), ] with Session() as session: ...
[ "def", "images", "(", ")", ":", "fields", "=", "[", "(", "'Name'", ",", "'name'", ")", ",", "(", "'Registry'", ",", "'registry'", ")", ",", "(", "'Tag'", ",", "'tag'", ")", ",", "(", "'Digest'", ",", "'digest'", ")", ",", "(", "'Size'", ",", "'si...
Show the list of registered images in this cluster.
[ "Show", "the", "list", "of", "registered", "images", "in", "this", "cluster", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/images.py#L11-L34
lablup/backend.ai-client-py
src/ai/backend/client/cli/admin/images.py
rescan_images
def rescan_images(registry): '''Update the kernel image metadata from all configured docker registries.''' with Session() as session: try: result = session.Image.rescanImages(registry) except Exception as e: print_error(e) sys.exit(1) if result['ok']: ...
python
def rescan_images(registry): '''Update the kernel image metadata from all configured docker registries.''' with Session() as session: try: result = session.Image.rescanImages(registry) except Exception as e: print_error(e) sys.exit(1) if result['ok']: ...
[ "def", "rescan_images", "(", "registry", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "result", "=", "session", ".", "Image", ".", "rescanImages", "(", "registry", ")", "except", "Exception", "as", "e", ":", "print_error", "("...
Update the kernel image metadata from all configured docker registries.
[ "Update", "the", "kernel", "image", "metadata", "from", "all", "configured", "docker", "registries", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/images.py#L40-L51
lablup/backend.ai-client-py
src/ai/backend/client/cli/admin/images.py
alias_image
def alias_image(alias, target): '''Add an image alias.''' with Session() as session: try: result = session.Image.aliasImage(alias, target) except Exception as e: print_error(e) sys.exit(1) if result['ok']: print("alias {0} created for targe...
python
def alias_image(alias, target): '''Add an image alias.''' with Session() as session: try: result = session.Image.aliasImage(alias, target) except Exception as e: print_error(e) sys.exit(1) if result['ok']: print("alias {0} created for targe...
[ "def", "alias_image", "(", "alias", ",", "target", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "result", "=", "session", ".", "Image", ".", "aliasImage", "(", "alias", ",", "target", ")", "except", "Exception", "as", "e", ...
Add an image alias.
[ "Add", "an", "image", "alias", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/images.py#L56-L67
lablup/backend.ai-client-py
src/ai/backend/client/cli/admin/images.py
dealias_image
def dealias_image(alias): '''Remove an image alias.''' with Session() as session: try: result = session.Image.dealiasImage(alias) except Exception as e: print_error(e) sys.exit(1) if result['ok']: print("alias {0} removed.".format(alias)) ...
python
def dealias_image(alias): '''Remove an image alias.''' with Session() as session: try: result = session.Image.dealiasImage(alias) except Exception as e: print_error(e) sys.exit(1) if result['ok']: print("alias {0} removed.".format(alias)) ...
[ "def", "dealias_image", "(", "alias", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "result", "=", "session", ".", "Image", ".", "dealiasImage", "(", "alias", ")", "except", "Exception", "as", "e", ":", "print_error", "(", "e...
Remove an image alias.
[ "Remove", "an", "image", "alias", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/images.py#L72-L83
lablup/backend.ai-client-py
src/ai/backend/client/cli/__init__.py
run_alias
def run_alias(): """ Quick aliases for run command. """ mode = Path(sys.argv[0]).stem help = True if len(sys.argv) <= 1 else False if mode == 'lcc': sys.argv.insert(1, 'c') elif mode == 'lpython': sys.argv.insert(1, 'python') sys.argv.insert(1, 'run') if help: ...
python
def run_alias(): """ Quick aliases for run command. """ mode = Path(sys.argv[0]).stem help = True if len(sys.argv) <= 1 else False if mode == 'lcc': sys.argv.insert(1, 'c') elif mode == 'lpython': sys.argv.insert(1, 'python') sys.argv.insert(1, 'run') if help: ...
[ "def", "run_alias", "(", ")", ":", "mode", "=", "Path", "(", "sys", ".", "argv", "[", "0", "]", ")", ".", "stem", "help", "=", "True", "if", "len", "(", "sys", ".", "argv", ")", "<=", "1", "else", "False", "if", "mode", "==", "'lcc'", ":", "s...
Quick aliases for run command.
[ "Quick", "aliases", "for", "run", "command", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/__init__.py#L99-L112
HPENetworking/PYHPEIMC
archived/pyhpimc.py
get_dev_asset_details
def get_dev_asset_details(ipaddress): """Takes in ipaddress as input to fetch device assett details from HP IMC RESTFUL API :param ipaddress: IP address of the device you wish to gather the asset details :return: object of type list containing the device asset details """ # checks to see if the imc ...
python
def get_dev_asset_details(ipaddress): """Takes in ipaddress as input to fetch device assett details from HP IMC RESTFUL API :param ipaddress: IP address of the device you wish to gather the asset details :return: object of type list containing the device asset details """ # checks to see if the imc ...
[ "def", "get_dev_asset_details", "(", "ipaddress", ")", ":", "# checks to see if the imc credentials are already available", "if", "auth", "is", "None", "or", "url", "is", "None", ":", "set_imc_creds", "(", ")", "global", "r", "get_dev_asset_url", "=", "\"/imcrs/netasset...
Takes in ipaddress as input to fetch device assett details from HP IMC RESTFUL API :param ipaddress: IP address of the device you wish to gather the asset details :return: object of type list containing the device asset details
[ "Takes", "in", "ipaddress", "as", "input", "to", "fetch", "device", "assett", "details", "from", "HP", "IMC", "RESTFUL", "API", ":", "param", "ipaddress", ":", "IP", "address", "of", "the", "device", "you", "wish", "to", "gather", "the", "asset", "details"...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/archived/pyhpimc.py#L150-L175
HPENetworking/PYHPEIMC
archived/pyhpimc.py
get_serial_numbers
def get_serial_numbers(assetList): """ Helper function: Uses return of get_dev_asset_details function to evaluate to evaluate for multipe serial objects. :param assetList: output of get_dev_asset_details function :return: the serial_list object of list type which contains one or more dictionaries of the...
python
def get_serial_numbers(assetList): """ Helper function: Uses return of get_dev_asset_details function to evaluate to evaluate for multipe serial objects. :param assetList: output of get_dev_asset_details function :return: the serial_list object of list type which contains one or more dictionaries of the...
[ "def", "get_serial_numbers", "(", "assetList", ")", ":", "serial_list", "=", "[", "]", "if", "type", "(", "assetList", ")", "==", "list", ":", "for", "i", "in", "assetList", ":", "if", "len", "(", "i", "[", "'serialNum'", "]", ")", ">", "0", ":", "...
Helper function: Uses return of get_dev_asset_details function to evaluate to evaluate for multipe serial objects. :param assetList: output of get_dev_asset_details function :return: the serial_list object of list type which contains one or more dictionaries of the asset details
[ "Helper", "function", ":", "Uses", "return", "of", "get_dev_asset_details", "function", "to", "evaluate", "to", "evaluate", "for", "multipe", "serial", "objects", ".", ":", "param", "assetList", ":", "output", "of", "get_dev_asset_details", "function", ":", "retur...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/archived/pyhpimc.py#L178-L189
HPENetworking/PYHPEIMC
archived/pyhpimc.py
get_trunk_interfaces
def get_trunk_interfaces(devId): """Function takes devId as input to RESTFULL call to HP IMC platform :param devId: output of get_dev_details :return: list of dictionaries containing of interfaces configured as an 802.1q trunk """ # checks to see if the imc credentials are already available if ...
python
def get_trunk_interfaces(devId): """Function takes devId as input to RESTFULL call to HP IMC platform :param devId: output of get_dev_details :return: list of dictionaries containing of interfaces configured as an 802.1q trunk """ # checks to see if the imc credentials are already available if ...
[ "def", "get_trunk_interfaces", "(", "devId", ")", ":", "# checks to see if the imc credentials are already available", "if", "auth", "is", "None", "or", "url", "is", "None", ":", "set_imc_creds", "(", ")", "global", "r", "get_trunk_interfaces_url", "=", "\"/imcrs/vlan/t...
Function takes devId as input to RESTFULL call to HP IMC platform :param devId: output of get_dev_details :return: list of dictionaries containing of interfaces configured as an 802.1q trunk
[ "Function", "takes", "devId", "as", "input", "to", "RESTFULL", "call", "to", "HP", "IMC", "platform", ":", "param", "devId", ":", "output", "of", "get_dev_details", ":", "return", ":", "list", "of", "dictionaries", "containing", "of", "interfaces", "configured...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/archived/pyhpimc.py#L192-L214
HPENetworking/PYHPEIMC
archived/pyhpimc.py
get_device_access_interfaces
def get_device_access_interfaces(devId): """Function takes devId as input to RESTFUL call to HP IMC platform :param devId: requires deviceID as the only input parameter :return: list of dictionaries containing interfaces configured as access ports """ # checks to see if the imc credentials are alrea...
python
def get_device_access_interfaces(devId): """Function takes devId as input to RESTFUL call to HP IMC platform :param devId: requires deviceID as the only input parameter :return: list of dictionaries containing interfaces configured as access ports """ # checks to see if the imc credentials are alrea...
[ "def", "get_device_access_interfaces", "(", "devId", ")", ":", "# checks to see if the imc credentials are already available", "if", "auth", "is", "None", "or", "url", "is", "None", ":", "set_imc_creds", "(", ")", "global", "r", "get_access_interface_vlan_url", "=", "\"...
Function takes devId as input to RESTFUL call to HP IMC platform :param devId: requires deviceID as the only input parameter :return: list of dictionaries containing interfaces configured as access ports
[ "Function", "takes", "devId", "as", "input", "to", "RESTFUL", "call", "to", "HP", "IMC", "platform", ":", "param", "devId", ":", "requires", "deviceID", "as", "the", "only", "input", "parameter", ":", "return", ":", "list", "of", "dictionaries", "containing"...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/archived/pyhpimc.py#L217-L240
HPENetworking/PYHPEIMC
archived/pyhpimc.py
get_dev_details
def get_dev_details(ip_address): """Takes string input of IP address to issue RESTUL call to HP IMC :param ip_address: string object of dotted decimal notation of IPv4 address :return: dictionary of device details >>> get_dev_details('10.101.0.1') {'symbolLevel': '2', 'typeName': 'Cisco 2811', 'loc...
python
def get_dev_details(ip_address): """Takes string input of IP address to issue RESTUL call to HP IMC :param ip_address: string object of dotted decimal notation of IPv4 address :return: dictionary of device details >>> get_dev_details('10.101.0.1') {'symbolLevel': '2', 'typeName': 'Cisco 2811', 'loc...
[ "def", "get_dev_details", "(", "ip_address", ")", ":", "# checks to see if the imc credentials are already available", "if", "auth", "is", "None", "or", "url", "is", "None", ":", "set_imc_creds", "(", ")", "global", "r", "get_dev_details_url", "=", "\"/imcrs/plat/res/de...
Takes string input of IP address to issue RESTUL call to HP IMC :param ip_address: string object of dotted decimal notation of IPv4 address :return: dictionary of device details >>> get_dev_details('10.101.0.1') {'symbolLevel': '2', 'typeName': 'Cisco 2811', 'location': 'changed this too', 'status': '1...
[ "Takes", "string", "input", "of", "IP", "address", "to", "issue", "RESTUL", "call", "to", "HP", "IMC", ":", "param", "ip_address", ":", "string", "object", "of", "dotted", "decimal", "notation", "of", "IPv4", "address", ":", "return", ":", "dictionary", "o...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/archived/pyhpimc.py#L269-L305
HPENetworking/PYHPEIMC
archived/pyhpimc.py
get_dev_vlans
def get_dev_vlans(devId): """Function takes input of devID to issue RESTUL call to HP IMC :param devId: requires devId as the only input parameter :return: list dictionaries of existing vlans on the devices. Device must be supported in HP IMC platform VLAN manager module """ # checks to see if the ...
python
def get_dev_vlans(devId): """Function takes input of devID to issue RESTUL call to HP IMC :param devId: requires devId as the only input parameter :return: list dictionaries of existing vlans on the devices. Device must be supported in HP IMC platform VLAN manager module """ # checks to see if the ...
[ "def", "get_dev_vlans", "(", "devId", ")", ":", "# checks to see if the imc credentials are already available", "if", "auth", "is", "None", "or", "url", "is", "None", ":", "set_imc_creds", "(", ")", "global", "r", "get_dev_vlans_url", "=", "\"/imcrs/vlan?devId=\"", "+...
Function takes input of devID to issue RESTUL call to HP IMC :param devId: requires devId as the only input parameter :return: list dictionaries of existing vlans on the devices. Device must be supported in HP IMC platform VLAN manager module
[ "Function", "takes", "input", "of", "devID", "to", "issue", "RESTUL", "call", "to", "HP", "IMC", ":", "param", "devId", ":", "requires", "devId", "as", "the", "only", "input", "parameter", ":", "return", ":", "list", "dictionaries", "of", "existing", "vlan...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/archived/pyhpimc.py#L308-L330
HPENetworking/PYHPEIMC
archived/pyhpimc.py
get_dev_interface
def get_dev_interface(devid): """ Function takes devid as input to RESTFUL call to HP IMC platform :param devid: requires devid as the only input :return: list object which contains a dictionary per interface """ # checks to see if the imc credentials are already available if auth is None or...
python
def get_dev_interface(devid): """ Function takes devid as input to RESTFUL call to HP IMC platform :param devid: requires devid as the only input :return: list object which contains a dictionary per interface """ # checks to see if the imc credentials are already available if auth is None or...
[ "def", "get_dev_interface", "(", "devid", ")", ":", "# checks to see if the imc credentials are already available", "if", "auth", "is", "None", "or", "url", "is", "None", ":", "set_imc_creds", "(", ")", "global", "r", "get_dev_interface_url", "=", "\"/imcrs/plat/res/dev...
Function takes devid as input to RESTFUL call to HP IMC platform :param devid: requires devid as the only input :return: list object which contains a dictionary per interface
[ "Function", "takes", "devid", "as", "input", "to", "RESTFUL", "call", "to", "HP", "IMC", "platform", ":", "param", "devid", ":", "requires", "devid", "as", "the", "only", "input", ":", "return", ":", "list", "object", "which", "contains", "a", "dictionary"...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/archived/pyhpimc.py#L333-L354