repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
housecanary/hc-api-python
housecanary/excel/utilities.py
normalize_cell_value
def normalize_cell_value(value): """Process value for writing into a cell. Args: value: any type of variable Returns: json serialized value if value is list or dict, else value """ if isinstance(value, dict) or isinstance(value, list): return json.dumps(value) return va...
python
def normalize_cell_value(value): """Process value for writing into a cell. Args: value: any type of variable Returns: json serialized value if value is list or dict, else value """ if isinstance(value, dict) or isinstance(value, list): return json.dumps(value) return va...
[ "def", "normalize_cell_value", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "dict", ")", "or", "isinstance", "(", "value", ",", "list", ")", ":", "return", "json", ".", "dumps", "(", "value", ")", "return", "value" ]
Process value for writing into a cell. Args: value: any type of variable Returns: json serialized value if value is list or dict, else value
[ "Process", "value", "for", "writing", "into", "a", "cell", "." ]
2bb9e2208b34e8617575de45934357ee33b8531c
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/utilities.py#L11-L22
train
housecanary/hc-api-python
housecanary/excel/utilities.py
get_addresses_from_input_file
def get_addresses_from_input_file(input_file_name): """Read addresses from input file into list of tuples. This only supports address and zipcode headers """ mode = 'r' if sys.version_info[0] < 3: mode = 'rb' with io.open(input_file_name, mode) as input_file: reader = csv.read...
python
def get_addresses_from_input_file(input_file_name): """Read addresses from input file into list of tuples. This only supports address and zipcode headers """ mode = 'r' if sys.version_info[0] < 3: mode = 'rb' with io.open(input_file_name, mode) as input_file: reader = csv.read...
[ "def", "get_addresses_from_input_file", "(", "input_file_name", ")", ":", "mode", "=", "'r'", "if", "sys", ".", "version_info", "[", "0", "]", "<", "3", ":", "mode", "=", "'rb'", "with", "io", ".", "open", "(", "input_file_name", ",", "mode", ")", "as", ...
Read addresses from input file into list of tuples. This only supports address and zipcode headers
[ "Read", "addresses", "from", "input", "file", "into", "list", "of", "tuples", ".", "This", "only", "supports", "address", "and", "zipcode", "headers" ]
2bb9e2208b34e8617575de45934357ee33b8531c
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/utilities.py#L35-L59
train
housecanary/hc-api-python
housecanary/excel/utilities.py
get_identifiers_from_input_file
def get_identifiers_from_input_file(input_file_name): """Read identifiers from input file into list of dicts with the header row values as keys, and the rest of the rows as values. """ valid_identifiers = ['address', 'zipcode', 'unit', 'city', 'state', 'slug', 'block_id', 'msa', ...
python
def get_identifiers_from_input_file(input_file_name): """Read identifiers from input file into list of dicts with the header row values as keys, and the rest of the rows as values. """ valid_identifiers = ['address', 'zipcode', 'unit', 'city', 'state', 'slug', 'block_id', 'msa', ...
[ "def", "get_identifiers_from_input_file", "(", "input_file_name", ")", ":", "valid_identifiers", "=", "[", "'address'", ",", "'zipcode'", ",", "'unit'", ",", "'city'", ",", "'state'", ",", "'slug'", ",", "'block_id'", ",", "'msa'", ",", "'num_bins'", ",", "'prop...
Read identifiers from input file into list of dicts with the header row values as keys, and the rest of the rows as values.
[ "Read", "identifiers", "from", "input", "file", "into", "list", "of", "dicts", "with", "the", "header", "row", "values", "as", "keys", "and", "the", "rest", "of", "the", "rows", "as", "values", "." ]
2bb9e2208b34e8617575de45934357ee33b8531c
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/utilities.py#L62-L75
train
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/termaccess.py
get_real_time_locate
def get_real_time_locate(ipAddress, auth, url): """ function takes the ipAddress of a specific host and issues a RESTFUL call to get the device and interface that the target host is currently connected to. Note: Although intended to return a single location, Multiple locations may be returned for a sing...
python
def get_real_time_locate(ipAddress, auth, url): """ function takes the ipAddress of a specific host and issues a RESTFUL call to get the device and interface that the target host is currently connected to. Note: Although intended to return a single location, Multiple locations may be returned for a sing...
[ "def", "get_real_time_locate", "(", "ipAddress", ",", "auth", ",", "url", ")", ":", "real_time_locate_url", "=", "\"/imcrs/res/access/realtimeLocate?type=2&value=\"", "+", "str", "(", "ipAddress", ")", "+", "\"&total=false\"", "f_url", "=", "url", "+", "real_time_loca...
function takes the ipAddress of a specific host and issues a RESTFUL call to get the device and interface that the target host is currently connected to. Note: Although intended to return a single location, Multiple locations may be returned for a single host due to a partially discovered network or misconfigur...
[ "function", "takes", "the", "ipAddress", "of", "a", "specific", "host", "and", "issues", "a", "RESTFUL", "call", "to", "get", "the", "device", "and", "interface", "that", "the", "target", "host", "is", "currently", "connected", "to", ".", "Note", ":", "Alt...
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L19-L77
train
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/termaccess.py
get_ip_mac_arp_list
def get_ip_mac_arp_list(devId, auth,url): """ function takes devid of specific device and issues a RESTFUL call to get the IP/MAC/ARP list from the target device. :param devId: int or str value of the target device. :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class ...
python
def get_ip_mac_arp_list(devId, auth,url): """ function takes devid of specific device and issues a RESTFUL call to get the IP/MAC/ARP list from the target device. :param devId: int or str value of the target device. :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class ...
[ "def", "get_ip_mac_arp_list", "(", "devId", ",", "auth", ",", "url", ")", ":", "if", "auth", "is", "None", "or", "url", "is", "None", ":", "# checks to see if the imc credentials are already available", "set_imc_creds", "(", ")", "ip_mac_arp_list_url", "=", "\"/imcr...
function takes devid of specific device and issues a RESTFUL call to get the IP/MAC/ARP list from the target device. :param devId: int or str value of the target device. :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually a...
[ "function", "takes", "devid", "of", "specific", "device", "and", "issues", "a", "RESTFUL", "call", "to", "get", "the", "IP", "/", "MAC", "/", "ARP", "list", "from", "the", "target", "device", "." ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L80-L121
train
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/termaccess.py
get_ip_scope_detail
def get_ip_scope_detail(scopeId, auth, url ): """ function requires no inputs and returns all IP address scopes currently configured on the HPE IMC server. If the optional scopeId parameter is included, this will automatically return only the desired scope id. :param scopeId: integer of the desired scop...
python
def get_ip_scope_detail(scopeId, auth, url ): """ function requires no inputs and returns all IP address scopes currently configured on the HPE IMC server. If the optional scopeId parameter is included, this will automatically return only the desired scope id. :param scopeId: integer of the desired scop...
[ "def", "get_ip_scope_detail", "(", "scopeId", ",", "auth", ",", "url", ")", ":", "get_ip_scope_url", "=", "\"/imcrs/res/access/assignedIpScope/\"", "+", "str", "(", "scopeId", ")", "f_url", "=", "url", "+", "get_ip_scope_url", "r", "=", "requests", ".", "get", ...
function requires no inputs and returns all IP address scopes currently configured on the HPE IMC server. If the optional scopeId parameter is included, this will automatically return only the desired scope id. :param scopeId: integer of the desired scope id ( optional ) :param auth: requests auth object #...
[ "function", "requires", "no", "inputs", "and", "returns", "all", "IP", "address", "scopes", "currently", "configured", "on", "the", "HPE", "IMC", "server", ".", "If", "the", "optional", "scopeId", "parameter", "is", "included", "this", "will", "automatically", ...
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L170-L206
train
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/termaccess.py
delete_ip_scope
def delete_ip_scope(network_address, auth, url): '''Function to delete an entire IP segment from the IMC IP Address management under terminal access :param network_address :param auth :param url >>> from pyhpeimc.auth import * >>> from pyhpeimc.plat.termaccess import * >>> auth = IMCAuth(...
python
def delete_ip_scope(network_address, auth, url): '''Function to delete an entire IP segment from the IMC IP Address management under terminal access :param network_address :param auth :param url >>> from pyhpeimc.auth import * >>> from pyhpeimc.plat.termaccess import * >>> auth = IMCAuth(...
[ "def", "delete_ip_scope", "(", "network_address", ",", "auth", ",", "url", ")", ":", "scope_id", "=", "get_scope_id", "(", "network_address", ",", "auth", ",", "url", ")", "delete_ip_address_url", "=", "'''/imcrs/res/access/assignedIpScope/'''", "+", "str", "(", "...
Function to delete an entire IP segment from the IMC IP Address management under terminal access :param network_address :param auth :param url >>> from pyhpeimc.auth import * >>> from pyhpeimc.plat.termaccess import * >>> auth = IMCAuth("http://", "10.101.0.203", "8080", "admin", "admin") ...
[ "Function", "to", "delete", "an", "entire", "IP", "segment", "from", "the", "IMC", "IP", "Address", "management", "under", "terminal", "access", ":", "param", "network_address", ":", "param", "auth", ":", "param", "url" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L320-L348
train
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/termaccess.py
add_scope_ip
def add_scope_ip(ipaddress, name, description, scopeid, auth, url): """ Function to add new host IP address allocation to existing scope ID :param ipaddress: :param name: name of the owner of this host :param description: Description of the host :param auth: requests auth object #usually aut...
python
def add_scope_ip(ipaddress, name, description, scopeid, auth, url): """ Function to add new host IP address allocation to existing scope ID :param ipaddress: :param name: name of the owner of this host :param description: Description of the host :param auth: requests auth object #usually aut...
[ "def", "add_scope_ip", "(", "ipaddress", ",", "name", ",", "description", ",", "scopeid", ",", "auth", ",", "url", ")", ":", "new_ip", "=", "{", "\"ip\"", ":", "ipaddress", ",", "\"name\"", ":", "name", ",", "\"description\"", ":", "description", "}", "a...
Function to add new host IP address allocation to existing scope ID :param ipaddress: :param name: name of the owner of this host :param description: Description of the host :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interf...
[ "Function", "to", "add", "new", "host", "IP", "address", "allocation", "to", "existing", "scope", "ID" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L352-L395
train
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/termaccess.py
remove_scope_ip
def remove_scope_ip(hostid, auth, url): """ Function to add remove IP address allocation :param hostid: Host id of the host to be deleted :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.au...
python
def remove_scope_ip(hostid, auth, url): """ Function to add remove IP address allocation :param hostid: Host id of the host to be deleted :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.au...
[ "def", "remove_scope_ip", "(", "hostid", ",", "auth", ",", "url", ")", ":", "add_scope_ip_url", "=", "'/imcrs/res/access/assignedIpScope/ip/'", "+", "str", "(", "hostid", ")", "f_url", "=", "url", "+", "add_scope_ip_url", "r", "=", "requests", ".", "delete", "...
Function to add remove IP address allocation :param hostid: Host id of the host to be deleted :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :return: String of HTTP response c...
[ "Function", "to", "add", "remove", "IP", "address", "allocation" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L397-L443
train
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/termaccess.py
get_ip_scope_hosts
def get_ip_scope_hosts( scopeId, auth, url): """ Function requires input of scope ID and returns list of allocated IP address for the specified scope :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhp...
python
def get_ip_scope_hosts( scopeId, auth, url): """ Function requires input of scope ID and returns list of allocated IP address for the specified scope :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhp...
[ "def", "get_ip_scope_hosts", "(", "scopeId", ",", "auth", ",", "url", ")", ":", "get_ip_scope_url", "=", "\"/imcrs/res/access/assignedIpScope/ip?size=10000&ipScopeId=\"", "+", "str", "(", "scopeId", ")", "f_url", "=", "url", "+", "get_ip_scope_url", "r", "=", "reque...
Function requires input of scope ID and returns list of allocated IP address for the specified scope :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :param scopeId: Interger of teh ...
[ "Function", "requires", "input", "of", "scope", "ID", "and", "returns", "list", "of", "allocated", "IP", "address", "for", "the", "specified", "scope" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L447-L497
train
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/termaccess.py
add_host_to_segment
def add_host_to_segment(ipaddress, name, description, network_address, auth, url): ''' Function to abstract existing add_scope_ip_function. Allows for use of network address rather than forcing human to learn the scope_id :param ipaddress: :param name: name of the owner of this host :param descrip...
python
def add_host_to_segment(ipaddress, name, description, network_address, auth, url): ''' Function to abstract existing add_scope_ip_function. Allows for use of network address rather than forcing human to learn the scope_id :param ipaddress: :param name: name of the owner of this host :param descrip...
[ "def", "add_host_to_segment", "(", "ipaddress", ",", "name", ",", "description", ",", "network_address", ",", "auth", ",", "url", ")", ":", "scope_id", "=", "get_scope_id", "(", "network_address", ",", "auth", ",", "url", ")", "add_scope_ip", "(", "ipaddress",...
Function to abstract existing add_scope_ip_function. Allows for use of network address rather than forcing human to learn the scope_id :param ipaddress: :param name: name of the owner of this host :param description: Description of the host :param: network_address: network address of the target s...
[ "Function", "to", "abstract", "existing", "add_scope_ip_function", ".", "Allows", "for", "use", "of", "network", "address", "rather", "than", "forcing", "human", "to", "learn", "the", "scope_id", ":", "param", "ipaddress", ":" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L544-L569
train
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/termaccess.py
delete_host_from_segment
def delete_host_from_segment(ipaddress, networkaddress, auth, url): '''Function to abstract ''' host_id = get_host_id(ipaddress, networkaddress, auth, url) remove_scope_ip(host_id, auth.creds, auth.url)
python
def delete_host_from_segment(ipaddress, networkaddress, auth, url): '''Function to abstract ''' host_id = get_host_id(ipaddress, networkaddress, auth, url) remove_scope_ip(host_id, auth.creds, auth.url)
[ "def", "delete_host_from_segment", "(", "ipaddress", ",", "networkaddress", ",", "auth", ",", "url", ")", ":", "host_id", "=", "get_host_id", "(", "ipaddress", ",", "networkaddress", ",", "auth", ",", "url", ")", "remove_scope_ip", "(", "host_id", ",", "auth",...
Function to abstract
[ "Function", "to", "abstract" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L572-L577
train
lablup/backend.ai-client-py
src/ai/backend/client/auth.py
generate_signature
def generate_signature(method, version, endpoint, date, rel_url, content_type, content, access_key, secret_key, hash_type): ''' Generates the API request signature from the given parameters. ''' hash_type = hash_type hostname = endpoint._val.netloc # FI...
python
def generate_signature(method, version, endpoint, date, rel_url, content_type, content, access_key, secret_key, hash_type): ''' Generates the API request signature from the given parameters. ''' hash_type = hash_type hostname = endpoint._val.netloc # FI...
[ "def", "generate_signature", "(", "method", ",", "version", ",", "endpoint", ",", "date", ",", "rel_url", ",", "content_type", ",", "content", ",", "access_key", ",", "secret_key", ",", "hash_type", ")", ":", "hash_type", "=", "hash_type", "hostname", "=", "...
Generates the API request signature from the given parameters.
[ "Generates", "the", "API", "request", "signature", "from", "the", "given", "parameters", "." ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/auth.py#L5-L43
train
lablup/backend.ai-client-py
src/ai/backend/client/agent.py
Agent.list_with_limit
async def list_with_limit(cls, limit, offset, status: str = 'ALIVE', fields: Iterable[str] = None) -> Sequence[dict]: ''' Fetches the list of agents with the given status with limit an...
python
async def list_with_limit(cls, limit, offset, status: str = 'ALIVE', fields: Iterable[str] = None) -> Sequence[dict]: ''' Fetches the list of agents with the given status with limit an...
[ "async", "def", "list_with_limit", "(", "cls", ",", "limit", ",", "offset", ",", "status", ":", "str", "=", "'ALIVE'", ",", "fields", ":", "Iterable", "[", "str", "]", "=", "None", ")", "->", "Sequence", "[", "dict", "]", ":", "if", "fields", "is", ...
Fetches the list of agents with the given status with limit and offset for pagination. :param limit: number of agents to get :param offset: offset index of agents to get :param status: An upper-cased string constant representing agent status (one of ``'ALIVE'``, ``'TERMINATE...
[ "Fetches", "the", "list", "of", "agents", "with", "the", "given", "status", "with", "limit", "and", "offset", "for", "pagination", "." ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/agent.py#L28-L73
train
lablup/backend.ai-client-py
src/ai/backend/client/request.py
Request.set_content
def set_content(self, value: RequestContent, *, content_type: str = None): ''' Sets the content of the request. ''' assert self._attached_files is None, \ 'cannot set content because you already attached files.' guessed_content_type = 'applicati...
python
def set_content(self, value: RequestContent, *, content_type: str = None): ''' Sets the content of the request. ''' assert self._attached_files is None, \ 'cannot set content because you already attached files.' guessed_content_type = 'applicati...
[ "def", "set_content", "(", "self", ",", "value", ":", "RequestContent", ",", "*", ",", "content_type", ":", "str", "=", "None", ")", ":", "assert", "self", ".", "_attached_files", "is", "None", ",", "'cannot set content because you already attached files.'", "gues...
Sets the content of the request.
[ "Sets", "the", "content", "of", "the", "request", "." ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/request.py#L130-L148
train
lablup/backend.ai-client-py
src/ai/backend/client/request.py
Request.set_json
def set_json(self, value: object): ''' A shortcut for set_content() with JSON objects. ''' self.set_content(modjson.dumps(value, cls=ExtendedJSONEncoder), content_type='application/json')
python
def set_json(self, value: object): ''' A shortcut for set_content() with JSON objects. ''' self.set_content(modjson.dumps(value, cls=ExtendedJSONEncoder), content_type='application/json')
[ "def", "set_json", "(", "self", ",", "value", ":", "object", ")", ":", "self", ".", "set_content", "(", "modjson", ".", "dumps", "(", "value", ",", "cls", "=", "ExtendedJSONEncoder", ")", ",", "content_type", "=", "'application/json'", ")" ]
A shortcut for set_content() with JSON objects.
[ "A", "shortcut", "for", "set_content", "()", "with", "JSON", "objects", "." ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/request.py#L150-L155
train
lablup/backend.ai-client-py
src/ai/backend/client/request.py
Request.attach_files
def attach_files(self, files: Sequence[AttachedFile]): ''' Attach a list of files represented as AttachedFile. ''' assert not self._content, 'content must be empty to attach files.' self.content_type = 'multipart/form-data' self._attached_files = files
python
def attach_files(self, files: Sequence[AttachedFile]): ''' Attach a list of files represented as AttachedFile. ''' assert not self._content, 'content must be empty to attach files.' self.content_type = 'multipart/form-data' self._attached_files = files
[ "def", "attach_files", "(", "self", ",", "files", ":", "Sequence", "[", "AttachedFile", "]", ")", ":", "assert", "not", "self", ".", "_content", ",", "'content must be empty to attach files.'", "self", ".", "content_type", "=", "'multipart/form-data'", "self", "."...
Attach a list of files represented as AttachedFile.
[ "Attach", "a", "list", "of", "files", "represented", "as", "AttachedFile", "." ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/request.py#L157-L163
train
lablup/backend.ai-client-py
src/ai/backend/client/request.py
Request._sign
def _sign(self, rel_url, access_key=None, secret_key=None, hash_type=None): ''' Calculates the signature of the given request and adds the Authorization HTTP header. It should be called at the very end of request preparation and before sending the request to the server. '...
python
def _sign(self, rel_url, access_key=None, secret_key=None, hash_type=None): ''' Calculates the signature of the given request and adds the Authorization HTTP header. It should be called at the very end of request preparation and before sending the request to the server. '...
[ "def", "_sign", "(", "self", ",", "rel_url", ",", "access_key", "=", "None", ",", "secret_key", "=", "None", ",", "hash_type", "=", "None", ")", ":", "if", "access_key", "is", "None", ":", "access_key", "=", "self", ".", "config", ".", "access_key", "i...
Calculates the signature of the given request and adds the Authorization HTTP header. It should be called at the very end of request preparation and before sending the request to the server.
[ "Calculates", "the", "signature", "of", "the", "given", "request", "and", "adds", "the", "Authorization", "HTTP", "header", ".", "It", "should", "be", "called", "at", "the", "very", "end", "of", "request", "preparation", "and", "before", "sending", "the", "r...
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/request.py#L165-L182
train
lablup/backend.ai-client-py
src/ai/backend/client/request.py
Request.fetch
def fetch(self, **kwargs) -> 'FetchContextManager': ''' Sends the request to the server and reads the response. You may use this method either with plain synchronous Session or AsyncSession. Both the followings patterns are valid: .. code-block:: python3 from ai.bac...
python
def fetch(self, **kwargs) -> 'FetchContextManager': ''' Sends the request to the server and reads the response. You may use this method either with plain synchronous Session or AsyncSession. Both the followings patterns are valid: .. code-block:: python3 from ai.bac...
[ "def", "fetch", "(", "self", ",", "*", "*", "kwargs", ")", "->", "'FetchContextManager'", ":", "assert", "self", ".", "method", "in", "self", ".", "_allowed_methods", ",", "'Disallowed HTTP method: {}'", ".", "format", "(", "self", ".", "method", ")", "self"...
Sends the request to the server and reads the response. You may use this method either with plain synchronous Session or AsyncSession. Both the followings patterns are valid: .. code-block:: python3 from ai.backend.client.request import Request from ai.backend.client.sess...
[ "Sends", "the", "request", "to", "the", "server", "and", "reads", "the", "response", "." ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/request.py#L211-L252
train
lablup/backend.ai-client-py
src/ai/backend/client/request.py
Request.connect_websocket
def connect_websocket(self, **kwargs) -> 'WebSocketContextManager': ''' Creates a WebSocket connection. .. warning:: This method only works with :class:`~ai.backend.client.session.AsyncSession`. ''' assert isinstance(self.session, AsyncSession), \ ...
python
def connect_websocket(self, **kwargs) -> 'WebSocketContextManager': ''' Creates a WebSocket connection. .. warning:: This method only works with :class:`~ai.backend.client.session.AsyncSession`. ''' assert isinstance(self.session, AsyncSession), \ ...
[ "def", "connect_websocket", "(", "self", ",", "*", "*", "kwargs", ")", "->", "'WebSocketContextManager'", ":", "assert", "isinstance", "(", "self", ".", "session", ",", "AsyncSession", ")", ",", "'Cannot use websockets with sessions in the synchronous mode'", "assert", ...
Creates a WebSocket connection. .. warning:: This method only works with :class:`~ai.backend.client.session.AsyncSession`.
[ "Creates", "a", "WebSocket", "connection", "." ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/request.py#L254-L276
train
AoiKuiyuyou/AoikLiveReload
src/aoiklivereload/demo/tornado_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", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/demo/tornado_demo.py#L16-L123
train
HPENetworking/PYHPEIMC
pyhpeimc/plat/perf.py
add_perf_task
def add_perf_task(task, auth, url): """ function takes the a python dict containing all necessary fields for a performance tasks, transforms the dict into JSON and issues a RESTFUL call to create the performance task. device. :param task: dictionary containing all required fields for performance tasks ...
python
def add_perf_task(task, auth, url): """ function takes the a python dict containing all necessary fields for a performance tasks, transforms the dict into JSON and issues a RESTFUL call to create the performance task. device. :param task: dictionary containing all required fields for performance tasks ...
[ "def", "add_perf_task", "(", "task", ",", "auth", ",", "url", ")", ":", "add_perf_task_url", "=", "\"/imcrs/perf/task\"", "f_url", "=", "url", "+", "add_perf_task_url", "payload", "=", "json", ".", "dumps", "(", "task", ")", "response", "=", "requests", ".",...
function takes the a python dict containing all necessary fields for a performance tasks, transforms the dict into JSON and issues a RESTFUL call to create the performance task. device. :param task: dictionary containing all required fields for performance tasks :param auth: requests auth object #usually ...
[ "function", "takes", "the", "a", "python", "dict", "containing", "all", "necessary", "fields", "for", "a", "performance", "tasks", "transforms", "the", "dict", "into", "JSON", "and", "issues", "a", "RESTFUL", "call", "to", "create", "the", "performance", "task...
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/perf.py#L19-L56
train
HPENetworking/PYHPEIMC
pyhpeimc/plat/perf.py
get_perf_task
def get_perf_task(task_name, auth, url): """ function takes the a str object containing the name of an existing performance tasks and issues a RESTFUL call to the IMC REST service. It will return a list :param task_name: str containing the name of the performance task :param auth: ...
python
def get_perf_task(task_name, auth, url): """ function takes the a str object containing the name of an existing performance tasks and issues a RESTFUL call to the IMC REST service. It will return a list :param task_name: str containing the name of the performance task :param auth: ...
[ "def", "get_perf_task", "(", "task_name", ",", "auth", ",", "url", ")", ":", "get_perf_task_url", "=", "\"/imcrs/perf/task?name=\"", "+", "task_name", "+", "\"&orderBy=taskId&desc=false\"", "f_url", "=", "url", "+", "get_perf_task_url", "response", "=", "requests", ...
function takes the a str object containing the name of an existing performance tasks and issues a RESTFUL call to the IMC REST service. It will return a list :param task_name: str containing the name of the performance task :param auth: requests auth object #usually auth.creds from auth pyhpei...
[ "function", "takes", "the", "a", "str", "object", "containing", "the", "name", "of", "an", "existing", "performance", "tasks", "and", "issues", "a", "RESTFUL", "call", "to", "the", "IMC", "REST", "service", ".", "It", "will", "return", "a", "list" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/perf.py#L59-L98
train
HPENetworking/PYHPEIMC
pyhpeimc/plat/perf.py
delete_perf_task
def delete_perf_task(task_name, auth, url): """ Function takes a str of the target task_name to be deleted and retrieves task_id using the get_perf_task function. Once the task_id has been successfully retrieved it is populated into the task_id variable and an DELETE call is made against the HPE IMC RES...
python
def delete_perf_task(task_name, auth, url): """ Function takes a str of the target task_name to be deleted and retrieves task_id using the get_perf_task function. Once the task_id has been successfully retrieved it is populated into the task_id variable and an DELETE call is made against the HPE IMC RES...
[ "def", "delete_perf_task", "(", "task_name", ",", "auth", ",", "url", ")", ":", "task_id", "=", "get_perf_task", "(", "task_name", ",", "auth", ",", "url", ")", "if", "isinstance", "(", "task_id", ",", "str", ")", ":", "print", "(", "\"Perf task doesn't ex...
Function takes a str of the target task_name to be deleted and retrieves task_id using the get_perf_task function. Once the task_id has been successfully retrieved it is populated into the task_id variable and an DELETE call is made against the HPE IMC REST interface to delete the target task. :param ta...
[ "Function", "takes", "a", "str", "of", "the", "target", "task_name", "to", "be", "deleted", "and", "retrieves", "task_id", "using", "the", "get_perf_task", "function", ".", "Once", "the", "task_id", "has", "been", "successfully", "retrieved", "it", "is", "popu...
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/perf.py#L101-L130
train
housecanary/hc-api-python
housecanary/output.py
ResponseOutputGenerator.process_json_response
def process_json_response(self, response): """For a json response, check if there was any error and throw exception. Otherwise, create a housecanary.response.Response.""" response_json = response.json() # handle errors code_key = "code" if code_key in response_json and ...
python
def process_json_response(self, response): """For a json response, check if there was any error and throw exception. Otherwise, create a housecanary.response.Response.""" response_json = response.json() # handle errors code_key = "code" if code_key in response_json and ...
[ "def", "process_json_response", "(", "self", ",", "response", ")", ":", "response_json", "=", "response", ".", "json", "(", ")", "# handle errors", "code_key", "=", "\"code\"", "if", "code_key", "in", "response_json", "and", "response_json", "[", "code_key", "]"...
For a json response, check if there was any error and throw exception. Otherwise, create a housecanary.response.Response.
[ "For", "a", "json", "response", "check", "if", "there", "was", "any", "error", "and", "throw", "exception", ".", "Otherwise", "create", "a", "housecanary", ".", "response", ".", "Response", "." ]
2bb9e2208b34e8617575de45934357ee33b8531c
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/output.py#L61-L89
train
AoiKuiyuyou/AoikLiveReload
src/aoiklivereload/aoiklivereload.py
LiveReloader.start_watcher_thread
def start_watcher_thread(self): """ Start watcher thread. :return: Watcher thread object. """ # Create watcher thread watcher_thread = threading.Thread(target=self.run_watcher) # If the reload mode is `spawn_wait` if self._reload_mode == self...
python
def start_watcher_thread(self): """ Start watcher thread. :return: Watcher thread object. """ # Create watcher thread watcher_thread = threading.Thread(target=self.run_watcher) # If the reload mode is `spawn_wait` if self._reload_mode == self...
[ "def", "start_watcher_thread", "(", "self", ")", ":", "# Create watcher thread", "watcher_thread", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "run_watcher", ")", "# If the reload mode is `spawn_wait`", "if", "self", ".", "_reload_mode", "==", ...
Start watcher thread. :return: Watcher thread object.
[ "Start", "watcher", "thread", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L129-L156
train
AoiKuiyuyou/AoikLiveReload
src/aoiklivereload/aoiklivereload.py
LiveReloader.run_watcher
def run_watcher(self): """ Watcher thread's function. :return: None. """ # Create observer observer = Observer() # Start observer observer.start() # Dict that maps file path to `watch object` watche_obj_map = {} # Ru...
python
def run_watcher(self): """ Watcher thread's function. :return: None. """ # Create observer observer = Observer() # Start observer observer.start() # Dict that maps file path to `watch object` watche_obj_map = {} # Ru...
[ "def", "run_watcher", "(", "self", ")", ":", "# Create observer", "observer", "=", "Observer", "(", ")", "# Start observer", "observer", ".", "start", "(", ")", "# Dict that maps file path to `watch object`", "watche_obj_map", "=", "{", "}", "# Run change check in a loo...
Watcher thread's function. :return: None.
[ "Watcher", "thread", "s", "function", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L158-L223
train
AoiKuiyuyou/AoikLiveReload
src/aoiklivereload/aoiklivereload.py
LiveReloader._find_watch_paths
def _find_watch_paths(self): """ Find paths to watch. :return: Paths to watch. """ # Add directory paths in `sys.path` to watch paths watch_path_s = set(os.path.abspath(x) for x in sys.path) # For each extra path for extra_path in self._extra...
python
def _find_watch_paths(self): """ Find paths to watch. :return: Paths to watch. """ # Add directory paths in `sys.path` to watch paths watch_path_s = set(os.path.abspath(x) for x in sys.path) # For each extra path for extra_path in self._extra...
[ "def", "_find_watch_paths", "(", "self", ")", ":", "# Add directory paths in `sys.path` to watch paths", "watch_path_s", "=", "set", "(", "os", ".", "path", ".", "abspath", "(", "x", ")", "for", "x", "in", "sys", ".", "path", ")", "# For each extra path", "for",...
Find paths to watch. :return: Paths to watch.
[ "Find", "paths", "to", "watch", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L225-L261
train
AoiKuiyuyou/AoikLiveReload
src/aoiklivereload/aoiklivereload.py
LiveReloader._find_short_paths
def _find_short_paths(self, paths): """ Find short paths of given paths. E.g. if both `/home` and `/home/aoik` exist, only keep `/home`. :param paths: Paths. :return: Set of short paths. """ # Split each path to parts. # E.g. '/h...
python
def _find_short_paths(self, paths): """ Find short paths of given paths. E.g. if both `/home` and `/home/aoik` exist, only keep `/home`. :param paths: Paths. :return: Set of short paths. """ # Split each path to parts. # E.g. '/h...
[ "def", "_find_short_paths", "(", "self", ",", "paths", ")", ":", "# Split each path to parts.", "# E.g. '/home/aoik' to ['', 'home', 'aoik']", "path_parts_s", "=", "[", "path", ".", "split", "(", "os", ".", "path", ".", "sep", ")", "for", "path", "in", "paths", ...
Find short paths of given paths. E.g. if both `/home` and `/home/aoik` exist, only keep `/home`. :param paths: Paths. :return: Set of short paths.
[ "Find", "short", "paths", "of", "given", "paths", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L263-L315
train
AoiKuiyuyou/AoikLiveReload
src/aoiklivereload/aoiklivereload.py
LiveReloader._collect_leaf_paths
def _collect_leaf_paths(self, node, path_parts, leaf_paths): """ Collect paths of leaf nodes. :param node: Starting node. Type is dict. Key is child node's path part. Value is child node. :param path_parts: The starting node's path parts. Type is tu...
python
def _collect_leaf_paths(self, node, path_parts, leaf_paths): """ Collect paths of leaf nodes. :param node: Starting node. Type is dict. Key is child node's path part. Value is child node. :param path_parts: The starting node's path parts. Type is tu...
[ "def", "_collect_leaf_paths", "(", "self", ",", "node", ",", "path_parts", ",", "leaf_paths", ")", ":", "# If the node is leaf node", "if", "not", "node", ":", "# Get node path", "node_path", "=", "'/'", ".", "join", "(", "path_parts", ")", "# Add to list", "lea...
Collect paths of leaf nodes. :param node: Starting node. Type is dict. Key is child node's path part. Value is child node. :param path_parts: The starting node's path parts. Type is tuple. :param leaf_paths: Leaf path list. :return: ...
[ "Collect", "paths", "of", "leaf", "nodes", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L317-L355
train
AoiKuiyuyou/AoikLiveReload
src/aoiklivereload/aoiklivereload.py
LiveReloader.dispatch
def dispatch(self, event): """ Dispatch file system event. Callback called when there is a file system event. Hooked at 2KGRW. This function overrides `FileSystemEventHandler.dispatch`. :param event: File system event object. :return: None. ...
python
def dispatch(self, event): """ Dispatch file system event. Callback called when there is a file system event. Hooked at 2KGRW. This function overrides `FileSystemEventHandler.dispatch`. :param event: File system event object. :return: None. ...
[ "def", "dispatch", "(", "self", ",", "event", ")", ":", "# Get file path", "file_path", "=", "event", ".", "src_path", "# If the file path is in extra paths", "if", "file_path", "in", "self", ".", "_extra_paths", ":", "# Call `reload`", "self", ".", "reload", "(",...
Dispatch file system event. Callback called when there is a file system event. Hooked at 2KGRW. This function overrides `FileSystemEventHandler.dispatch`. :param event: File system event object. :return: None.
[ "Dispatch", "file", "system", "event", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L357-L392
train
AoiKuiyuyou/AoikLiveReload
src/aoiklivereload/aoiklivereload.py
LiveReloader.reload
def reload(self): """ Reload the program. :return: None. """ # Get reload mode reload_mode = self._reload_mode # If reload mode is `exec` if self._reload_mode == self.RELOAD_MODE_V_EXEC: # Call `reload_using_exec` self...
python
def reload(self): """ Reload the program. :return: None. """ # Get reload mode reload_mode = self._reload_mode # If reload mode is `exec` if self._reload_mode == self.RELOAD_MODE_V_EXEC: # Call `reload_using_exec` self...
[ "def", "reload", "(", "self", ")", ":", "# Get reload mode", "reload_mode", "=", "self", ".", "_reload_mode", "# If reload mode is `exec`", "if", "self", ".", "_reload_mode", "==", "self", ".", "RELOAD_MODE_V_EXEC", ":", "# Call `reload_using_exec`", "self", ".", "r...
Reload the program. :return: None.
[ "Reload", "the", "program", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L394-L425
train
AoiKuiyuyou/AoikLiveReload
src/aoiklivereload/aoiklivereload.py
LiveReloader.reload_using_exec
def reload_using_exec(self): """ Reload the program process. :return: None. """ # Create command parts cmd_parts = [sys.executable] + sys.argv # Get env dict copy env_copy = os.environ.copy() # Reload the program process os.e...
python
def reload_using_exec(self): """ Reload the program process. :return: None. """ # Create command parts cmd_parts = [sys.executable] + sys.argv # Get env dict copy env_copy = os.environ.copy() # Reload the program process os.e...
[ "def", "reload_using_exec", "(", "self", ")", ":", "# Create command parts", "cmd_parts", "=", "[", "sys", ".", "executable", "]", "+", "sys", ".", "argv", "# Get env dict copy", "env_copy", "=", "os", ".", "environ", ".", "copy", "(", ")", "# Reload the progr...
Reload the program process. :return: None.
[ "Reload", "the", "program", "process", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L427-L448
train
AoiKuiyuyou/AoikLiveReload
src/aoiklivereload/aoiklivereload.py
LiveReloader.reload_using_spawn_exit
def reload_using_spawn_exit(self): """ Spawn a subprocess and exit the current process. :return: None. """ # Create command parts cmd_parts = [sys.executable] + sys.argv # Get env dict copy env_copy = os.environ.copy() # Spawn subpro...
python
def reload_using_spawn_exit(self): """ Spawn a subprocess and exit the current process. :return: None. """ # Create command parts cmd_parts = [sys.executable] + sys.argv # Get env dict copy env_copy = os.environ.copy() # Spawn subpro...
[ "def", "reload_using_spawn_exit", "(", "self", ")", ":", "# Create command parts", "cmd_parts", "=", "[", "sys", ".", "executable", "]", "+", "sys", ".", "argv", "# Get env dict copy", "env_copy", "=", "os", ".", "environ", ".", "copy", "(", ")", "# Spawn subp...
Spawn a subprocess and exit the current process. :return: None.
[ "Spawn", "a", "subprocess", "and", "exit", "the", "current", "process", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L450-L480
train
AoiKuiyuyou/AoikLiveReload
src/aoiklivereload/aoiklivereload.py
LiveReloader.reload_using_spawn_wait
def reload_using_spawn_wait(self): """ Spawn a subprocess and wait until it finishes. :return: None. """ # Create command parts cmd_parts = [sys.executable] + sys.argv # Get env dict copy env_copy = os.environ.copy() # Send interrupt...
python
def reload_using_spawn_wait(self): """ Spawn a subprocess and wait until it finishes. :return: None. """ # Create command parts cmd_parts = [sys.executable] + sys.argv # Get env dict copy env_copy = os.environ.copy() # Send interrupt...
[ "def", "reload_using_spawn_wait", "(", "self", ")", ":", "# Create command parts", "cmd_parts", "=", "[", "sys", ".", "executable", "]", "+", "sys", ".", "argv", "# Get env dict copy", "env_copy", "=", "os", ".", "environ", ".", "copy", "(", ")", "# Send inter...
Spawn a subprocess and wait until it finishes. :return: None.
[ "Spawn", "a", "subprocess", "and", "wait", "until", "it", "finishes", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L482-L502
train
lablup/backend.ai-client-py
src/ai/backend/client/cli/admin/agents.py
agent
def agent(agent_id): ''' Show the information about the given agent. ''' fields = [ ('ID', 'id'), ('Status', 'status'), ('Region', 'region'), ('First Contact', 'first_contact'), ('CPU Usage (%)', 'cpu_cur_pct'), ('Used Memory (MiB)', 'mem_cur_bytes'), ...
python
def agent(agent_id): ''' Show the information about the given agent. ''' fields = [ ('ID', 'id'), ('Status', 'status'), ('Region', 'region'), ('First Contact', 'first_contact'), ('CPU Usage (%)', 'cpu_cur_pct'), ('Used Memory (MiB)', 'mem_cur_bytes'), ...
[ "def", "agent", "(", "agent_id", ")", ":", "fields", "=", "[", "(", "'ID'", ",", "'id'", ")", ",", "(", "'Status'", ",", "'status'", ")", ",", "(", "'Region'", ",", "'region'", ")", ",", "(", "'First Contact'", ",", "'first_contact'", ")", ",", "(", ...
Show the information about the given agent.
[ "Show", "the", "information", "about", "the", "given", "agent", "." ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/agents.py#L14-L49
train
lablup/backend.ai-client-py
src/ai/backend/client/cli/admin/agents.py
agents
def agents(status, all): ''' List and manage agents. (admin privilege required) ''' fields = [ ('ID', 'id'), ('Status', 'status'), ('Region', 'region'), ('First Contact', 'first_contact'), ('CPU Usage (%)', 'cpu_cur_pct'), ('Used Memory (MiB)', 'mem_cu...
python
def agents(status, all): ''' List and manage agents. (admin privilege required) ''' fields = [ ('ID', 'id'), ('Status', 'status'), ('Region', 'region'), ('First Contact', 'first_contact'), ('CPU Usage (%)', 'cpu_cur_pct'), ('Used Memory (MiB)', 'mem_cu...
[ "def", "agents", "(", "status", ",", "all", ")", ":", "fields", "=", "[", "(", "'ID'", ",", "'id'", ")", ",", "(", "'Status'", ",", "'status'", ")", ",", "(", "'Region'", ",", "'region'", ")", ",", "(", "'First Contact'", ",", "'first_contact'", ")",...
List and manage agents. (admin privilege required)
[ "List", "and", "manage", "agents", ".", "(", "admin", "privilege", "required", ")" ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/agents.py#L56-L134
train
lablup/backend.ai-client-py
src/ai/backend/client/cli/admin/resource_policies.py
resource_policy
def resource_policy(name): """ Show details about a keypair resource policy. When `name` option is omitted, the resource policy for the current access_key will be returned. """ fields = [ ('Name', 'name'), ('Created At', 'created_at'), ('Default for Unspecified', 'default_for...
python
def resource_policy(name): """ Show details about a keypair resource policy. When `name` option is omitted, the resource policy for the current access_key will be returned. """ fields = [ ('Name', 'name'), ('Created At', 'created_at'), ('Default for Unspecified', 'default_for...
[ "def", "resource_policy", "(", "name", ")", ":", "fields", "=", "[", "(", "'Name'", ",", "'name'", ")", ",", "(", "'Created At'", ",", "'created_at'", ")", ",", "(", "'Default for Unspecified'", ",", "'default_for_unspecified'", ")", ",", "(", "'Total Resource...
Show details about a keypair resource policy. When `name` option is omitted, the resource policy for the current access_key will be returned.
[ "Show", "details", "about", "a", "keypair", "resource", "policy", ".", "When", "name", "option", "is", "omitted", "the", "resource", "policy", "for", "the", "current", "access_key", "will", "be", "returned", "." ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/resource_policies.py#L14-L44
train
lablup/backend.ai-client-py
src/ai/backend/client/cli/admin/resource_policies.py
resource_policies
def resource_policies(ctx): ''' List and manage resource policies. (admin privilege required) ''' if ctx.invoked_subcommand is not None: return fields = [ ('Name', 'name'), ('Created At', 'created_at'), ('Default for Unspecified', 'default_for_unspecified'), ...
python
def resource_policies(ctx): ''' List and manage resource policies. (admin privilege required) ''' if ctx.invoked_subcommand is not None: return fields = [ ('Name', 'name'), ('Created At', 'created_at'), ('Default for Unspecified', 'default_for_unspecified'), ...
[ "def", "resource_policies", "(", "ctx", ")", ":", "if", "ctx", ".", "invoked_subcommand", "is", "not", "None", ":", "return", "fields", "=", "[", "(", "'Name'", ",", "'name'", ")", ",", "(", "'Created At'", ",", "'created_at'", ")", ",", "(", "'Default f...
List and manage resource policies. (admin privilege required)
[ "List", "and", "manage", "resource", "policies", ".", "(", "admin", "privilege", "required", ")" ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/resource_policies.py#L49-L78
train
lablup/backend.ai-client-py
src/ai/backend/client/cli/admin/resource_policies.py
add
def add(name, default_for_unspecified, total_resource_slots, max_concurrent_sessions, max_containers_per_session, max_vfolder_count, max_vfolder_size, idle_timeout, allowed_vfolder_hosts): ''' Add a new keypair resource policy. NAME: NAME of a new keypair resource policy. ''' with S...
python
def add(name, default_for_unspecified, total_resource_slots, max_concurrent_sessions, max_containers_per_session, max_vfolder_count, max_vfolder_size, idle_timeout, allowed_vfolder_hosts): ''' Add a new keypair resource policy. NAME: NAME of a new keypair resource policy. ''' with S...
[ "def", "add", "(", "name", ",", "default_for_unspecified", ",", "total_resource_slots", ",", "max_concurrent_sessions", ",", "max_containers_per_session", ",", "max_vfolder_count", ",", "max_vfolder_size", ",", "idle_timeout", ",", "allowed_vfolder_hosts", ")", ":", "with...
Add a new keypair resource policy. NAME: NAME of a new keypair resource policy.
[ "Add", "a", "new", "keypair", "resource", "policy", "." ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/resource_policies.py#L103-L132
train
lablup/backend.ai-client-py
src/ai/backend/client/cli/admin/resource_policies.py
delete
def delete(name): """ Delete a keypair resource policy. NAME: NAME of a keypair resource policy to delete. """ with Session() as session: if input('Are you sure? (y/n): ').lower().strip()[:1] != 'y': print('Canceled.') sys.exit(1) try: data = sess...
python
def delete(name): """ Delete a keypair resource policy. NAME: NAME of a keypair resource policy to delete. """ with Session() as session: if input('Are you sure? (y/n): ').lower().strip()[:1] != 'y': print('Canceled.') sys.exit(1) try: data = sess...
[ "def", "delete", "(", "name", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "if", "input", "(", "'Are you sure? (y/n): '", ")", ".", "lower", "(", ")", ".", "strip", "(", ")", "[", ":", "1", "]", "!=", "'y'", ":", "print", "(", "'C...
Delete a keypair resource policy. NAME: NAME of a keypair resource policy to delete.
[ "Delete", "a", "keypair", "resource", "policy", "." ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/resource_policies.py#L187-L206
train
lablup/backend.ai-client-py
src/ai/backend/client/cli/app.py
app
def app(session_id, app, bind, port): """ Run a local proxy to a service provided by Backend.AI compute sessions. The type of proxy depends on the app definition: plain TCP or HTTP. \b SESSID: The compute session ID. APP: The name of service provided by the given session. """ api_sessi...
python
def app(session_id, app, bind, port): """ Run a local proxy to a service provided by Backend.AI compute sessions. The type of proxy depends on the app definition: plain TCP or HTTP. \b SESSID: The compute session ID. APP: The name of service provided by the given session. """ api_sessi...
[ "def", "app", "(", "session_id", ",", "app", ",", "bind", ",", "port", ")", ":", "api_session", "=", "None", "runner", "=", "None", "async", "def", "app_setup", "(", ")", ":", "nonlocal", "api_session", ",", "runner", "loop", "=", "current_loop", "(", ...
Run a local proxy to a service provided by Backend.AI compute sessions. The type of proxy depends on the app definition: plain TCP or HTTP. \b SESSID: The compute session ID. APP: The name of service provided by the given session.
[ "Run", "a", "local", "proxy", "to", "a", "service", "provided", "by", "Backend", ".", "AI", "compute", "sessions", "." ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/app.py#L137-L176
train
lablup/backend.ai-client-py
src/ai/backend/client/config.py
get_env
def get_env(key: str, default: Any = None, clean: Callable[[str], Any] = lambda v: v): ''' Retrieves a configuration value from the environment variables. The given *key* is uppercased and prefixed by ``"BACKEND_"`` and then ``"SORNA_"`` if the former does not exist. :param ...
python
def get_env(key: str, default: Any = None, clean: Callable[[str], Any] = lambda v: v): ''' Retrieves a configuration value from the environment variables. The given *key* is uppercased and prefixed by ``"BACKEND_"`` and then ``"SORNA_"`` if the former does not exist. :param ...
[ "def", "get_env", "(", "key", ":", "str", ",", "default", ":", "Any", "=", "None", ",", "clean", ":", "Callable", "[", "[", "str", "]", ",", "Any", "]", "=", "lambda", "v", ":", "v", ")", ":", "key", "=", "key", ".", "upper", "(", ")", "v", ...
Retrieves a configuration value from the environment variables. The given *key* is uppercased and prefixed by ``"BACKEND_"`` and then ``"SORNA_"`` if the former does not exist. :param key: The key name. :param default: The default value returned when there is no corresponding environment variab...
[ "Retrieves", "a", "configuration", "value", "from", "the", "environment", "variables", ".", "The", "given", "*", "key", "*", "is", "uppercased", "and", "prefixed", "by", "BACKEND_", "and", "then", "SORNA_", "if", "the", "former", "does", "not", "exist", "." ...
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/config.py#L14-L39
train
lablup/backend.ai-client-py
src/ai/backend/client/cli/logs.py
logs
def logs(sess_id_or_alias): ''' Shows the output logs of a running container. \b SESSID: Session ID or its alias given when creating the session. ''' with Session() as session: try: print_wait('Retrieving container logs...') kernel = session.Kernel(sess_id_or_ali...
python
def logs(sess_id_or_alias): ''' Shows the output logs of a running container. \b SESSID: Session ID or its alias given when creating the session. ''' with Session() as session: try: print_wait('Retrieving container logs...') kernel = session.Kernel(sess_id_or_ali...
[ "def", "logs", "(", "sess_id_or_alias", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "print_wait", "(", "'Retrieving container logs...'", ")", "kernel", "=", "session", ".", "Kernel", "(", "sess_id_or_alias", ")", "result", "=", "...
Shows the output logs of a running container. \b SESSID: Session ID or its alias given when creating the session.
[ "Shows", "the", "output", "logs", "of", "a", "running", "container", "." ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/logs.py#L12-L29
train
hustcc/wrapcache
wrapcache/__init__.py
_wrap_key
def _wrap_key(function, args, kws): ''' get the key from the function input. ''' return hashlib.md5(pickle.dumps((_from_file(function) + function.__name__, args, kws))).hexdigest()
python
def _wrap_key(function, args, kws): ''' get the key from the function input. ''' return hashlib.md5(pickle.dumps((_from_file(function) + function.__name__, args, kws))).hexdigest()
[ "def", "_wrap_key", "(", "function", ",", "args", ",", "kws", ")", ":", "return", "hashlib", ".", "md5", "(", "pickle", ".", "dumps", "(", "(", "_from_file", "(", "function", ")", "+", "function", ".", "__name__", ",", "args", ",", "kws", ")", ")", ...
get the key from the function input.
[ "get", "the", "key", "from", "the", "function", "input", "." ]
3c6f52bb81a278e1dd60c27abe87d169cb4395aa
https://github.com/hustcc/wrapcache/blob/3c6f52bb81a278e1dd60c27abe87d169cb4395aa/wrapcache/__init__.py#L29-L33
train
hustcc/wrapcache
wrapcache/__init__.py
get
def get(key, adapter = MemoryAdapter): ''' get the cache value ''' try: return pickle.loads(adapter().get(key)) except CacheExpiredException: return None
python
def get(key, adapter = MemoryAdapter): ''' get the cache value ''' try: return pickle.loads(adapter().get(key)) except CacheExpiredException: return None
[ "def", "get", "(", "key", ",", "adapter", "=", "MemoryAdapter", ")", ":", "try", ":", "return", "pickle", ".", "loads", "(", "adapter", "(", ")", ".", "get", "(", "key", ")", ")", "except", "CacheExpiredException", ":", "return", "None" ]
get the cache value
[ "get", "the", "cache", "value" ]
3c6f52bb81a278e1dd60c27abe87d169cb4395aa
https://github.com/hustcc/wrapcache/blob/3c6f52bb81a278e1dd60c27abe87d169cb4395aa/wrapcache/__init__.py#L41-L48
train
hustcc/wrapcache
wrapcache/__init__.py
set
def set(key, value, timeout = -1, adapter = MemoryAdapter): ''' set cache by code, must set timeout length ''' if adapter(timeout = timeout).set(key, pickle.dumps(value)): return value else: return None
python
def set(key, value, timeout = -1, adapter = MemoryAdapter): ''' set cache by code, must set timeout length ''' if adapter(timeout = timeout).set(key, pickle.dumps(value)): return value else: return None
[ "def", "set", "(", "key", ",", "value", ",", "timeout", "=", "-", "1", ",", "adapter", "=", "MemoryAdapter", ")", ":", "if", "adapter", "(", "timeout", "=", "timeout", ")", ".", "set", "(", "key", ",", "pickle", ".", "dumps", "(", "value", ")", "...
set cache by code, must set timeout length
[ "set", "cache", "by", "code", "must", "set", "timeout", "length" ]
3c6f52bb81a278e1dd60c27abe87d169cb4395aa
https://github.com/hustcc/wrapcache/blob/3c6f52bb81a278e1dd60c27abe87d169cb4395aa/wrapcache/__init__.py#L56-L63
train
hustcc/wrapcache
wrapcache/__init__.py
wrapcache
def wrapcache(timeout = -1, adapter = MemoryAdapter): ''' the Decorator to cache Function. ''' def _wrapcache(function): @wraps(function) def __wrapcache(*args, **kws): hash_key = _wrap_key(function, args, kws) try: adapter_instance = adapter() return pickle.loads(adapter_instance.get(hash_key)) ...
python
def wrapcache(timeout = -1, adapter = MemoryAdapter): ''' the Decorator to cache Function. ''' def _wrapcache(function): @wraps(function) def __wrapcache(*args, **kws): hash_key = _wrap_key(function, args, kws) try: adapter_instance = adapter() return pickle.loads(adapter_instance.get(hash_key)) ...
[ "def", "wrapcache", "(", "timeout", "=", "-", "1", ",", "adapter", "=", "MemoryAdapter", ")", ":", "def", "_wrapcache", "(", "function", ")", ":", "@", "wraps", "(", "function", ")", "def", "__wrapcache", "(", "*", "args", ",", "*", "*", "kws", ")", ...
the Decorator to cache Function.
[ "the", "Decorator", "to", "cache", "Function", "." ]
3c6f52bb81a278e1dd60c27abe87d169cb4395aa
https://github.com/hustcc/wrapcache/blob/3c6f52bb81a278e1dd60c27abe87d169cb4395aa/wrapcache/__init__.py#L72-L89
train
housecanary/hc-api-python
housecanary/excel/__init__.py
export_analytics_data_to_excel
def export_analytics_data_to_excel(data, output_file_name, result_info_key, identifier_keys): """Creates an Excel file containing data returned by the Analytics API Args: data: Analytics API data as a list of dicts output_file_name: File name for output Excel file (use .xlsx extension). ""...
python
def export_analytics_data_to_excel(data, output_file_name, result_info_key, identifier_keys): """Creates an Excel file containing data returned by the Analytics API Args: data: Analytics API data as a list of dicts output_file_name: File name for output Excel file (use .xlsx extension). ""...
[ "def", "export_analytics_data_to_excel", "(", "data", ",", "output_file_name", ",", "result_info_key", ",", "identifier_keys", ")", ":", "workbook", "=", "create_excel_workbook", "(", "data", ",", "result_info_key", ",", "identifier_keys", ")", "workbook", ".", "save"...
Creates an Excel file containing data returned by the Analytics API Args: data: Analytics API data as a list of dicts output_file_name: File name for output Excel file (use .xlsx extension).
[ "Creates", "an", "Excel", "file", "containing", "data", "returned", "by", "the", "Analytics", "API" ]
2bb9e2208b34e8617575de45934357ee33b8531c
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/__init__.py#L18-L28
train
housecanary/hc-api-python
housecanary/excel/__init__.py
export_analytics_data_to_csv
def export_analytics_data_to_csv(data, output_folder, result_info_key, identifier_keys): """Creates CSV files containing data returned by the Analytics API. Creates one file per requested endpoint and saves it into the specified output_folder Args: data: Analytics API data as a list of di...
python
def export_analytics_data_to_csv(data, output_folder, result_info_key, identifier_keys): """Creates CSV files containing data returned by the Analytics API. Creates one file per requested endpoint and saves it into the specified output_folder Args: data: Analytics API data as a list of di...
[ "def", "export_analytics_data_to_csv", "(", "data", ",", "output_folder", ",", "result_info_key", ",", "identifier_keys", ")", ":", "workbook", "=", "create_excel_workbook", "(", "data", ",", "result_info_key", ",", "identifier_keys", ")", "suffix", "=", "'.csv'", "...
Creates CSV files containing data returned by the Analytics API. Creates one file per requested endpoint and saves it into the specified output_folder Args: data: Analytics API data as a list of dicts output_folder: Path to a folder to save the CSV files into
[ "Creates", "CSV", "files", "containing", "data", "returned", "by", "the", "Analytics", "API", ".", "Creates", "one", "file", "per", "requested", "endpoint", "and", "saves", "it", "into", "the", "specified", "output_folder" ]
2bb9e2208b34e8617575de45934357ee33b8531c
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/__init__.py#L31-L60
train
housecanary/hc-api-python
housecanary/excel/__init__.py
concat_excel_reports
def concat_excel_reports(addresses, output_file_name, endpoint, report_type, retry, api_key, api_secret, files_path): """Creates an Excel file made up of combining the Value Report or Rental Report Excel output for the provided addresses. Args: addresses: A list of (addr...
python
def concat_excel_reports(addresses, output_file_name, endpoint, report_type, retry, api_key, api_secret, files_path): """Creates an Excel file made up of combining the Value Report or Rental Report Excel output for the provided addresses. Args: addresses: A list of (addr...
[ "def", "concat_excel_reports", "(", "addresses", ",", "output_file_name", ",", "endpoint", ",", "report_type", ",", "retry", ",", "api_key", ",", "api_secret", ",", "files_path", ")", ":", "# create the master workbook to output", "master_workbook", "=", "openpyxl", "...
Creates an Excel file made up of combining the Value Report or Rental Report Excel output for the provided addresses. Args: addresses: A list of (address, zipcode) tuples output_file_name: A file name for the Excel output endpoint: One of 'value_report' or 'rental_report' rep...
[ "Creates", "an", "Excel", "file", "made", "up", "of", "combining", "the", "Value", "Report", "or", "Rental", "Report", "Excel", "output", "for", "the", "provided", "addresses", "." ]
2bb9e2208b34e8617575de45934357ee33b8531c
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/__init__.py#L63-L135
train
housecanary/hc-api-python
housecanary/excel/__init__.py
create_excel_workbook
def create_excel_workbook(data, result_info_key, identifier_keys): """Calls the analytics_data_excel module to create the Workbook""" workbook = analytics_data_excel.get_excel_workbook(data, result_info_key, identifier_keys) adjust_column_width_workbook(workbook) return workbook
python
def create_excel_workbook(data, result_info_key, identifier_keys): """Calls the analytics_data_excel module to create the Workbook""" workbook = analytics_data_excel.get_excel_workbook(data, result_info_key, identifier_keys) adjust_column_width_workbook(workbook) return workbook
[ "def", "create_excel_workbook", "(", "data", ",", "result_info_key", ",", "identifier_keys", ")", ":", "workbook", "=", "analytics_data_excel", ".", "get_excel_workbook", "(", "data", ",", "result_info_key", ",", "identifier_keys", ")", "adjust_column_width_workbook", "...
Calls the analytics_data_excel module to create the Workbook
[ "Calls", "the", "analytics_data_excel", "module", "to", "create", "the", "Workbook" ]
2bb9e2208b34e8617575de45934357ee33b8531c
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/__init__.py#L237-L241
train
housecanary/hc-api-python
housecanary/excel/__init__.py
adjust_column_width
def adjust_column_width(worksheet): """Adjust column width in worksheet. Args: worksheet: worksheet to be adjusted """ dims = {} padding = 1 for row in worksheet.rows: for cell in row: if not cell.value: continue dims[cell.column] = max( ...
python
def adjust_column_width(worksheet): """Adjust column width in worksheet. Args: worksheet: worksheet to be adjusted """ dims = {} padding = 1 for row in worksheet.rows: for cell in row: if not cell.value: continue dims[cell.column] = max( ...
[ "def", "adjust_column_width", "(", "worksheet", ")", ":", "dims", "=", "{", "}", "padding", "=", "1", "for", "row", "in", "worksheet", ".", "rows", ":", "for", "cell", "in", "row", ":", "if", "not", "cell", ".", "value", ":", "continue", "dims", "[",...
Adjust column width in worksheet. Args: worksheet: worksheet to be adjusted
[ "Adjust", "column", "width", "in", "worksheet", "." ]
2bb9e2208b34e8617575de45934357ee33b8531c
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/__init__.py#L250-L267
train
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/wsm/apinfo.py
get_ap_info
def get_ap_info(ipaddress, auth, url): """ function takes input of ipaddress to RESTFUL call to HP IMC :param ipaddress: The current IP address of the Access Point at time of query. :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS ...
python
def get_ap_info(ipaddress, auth, url): """ function takes input of ipaddress to RESTFUL call to HP IMC :param ipaddress: The current IP address of the Access Point at time of query. :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS ...
[ "def", "get_ap_info", "(", "ipaddress", ",", "auth", ",", "url", ")", ":", "get_ap_info_url", "=", "\"/imcrs/wlan/apInfo/queryApBasicInfoByCondition?ipAddress=\"", "+", "str", "(", "ipaddress", ")", "f_url", "=", "url", "+", "get_ap_info_url", "payload", "=", "None"...
function takes input of ipaddress to RESTFUL call to HP IMC :param ipaddress: The current IP address of the Access Point at time of query. :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.auth...
[ "function", "takes", "input", "of", "ipaddress", "to", "RESTFUL", "call", "to", "HP", "IMC" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/wsm/apinfo.py#L91-L167
train
lablup/backend.ai-client-py
src/ai/backend/client/cli/admin/sessions.py
sessions
def sessions(status, access_key, id_only, all): ''' List and manage compute sessions. ''' fields = [ ('Session ID', 'sess_id'), ] with Session() as session: if is_admin(session): fields.append(('Owner', 'access_key')) if not id_only: fields.extend([ ...
python
def sessions(status, access_key, id_only, all): ''' List and manage compute sessions. ''' fields = [ ('Session ID', 'sess_id'), ] with Session() as session: if is_admin(session): fields.append(('Owner', 'access_key')) if not id_only: fields.extend([ ...
[ "def", "sessions", "(", "status", ",", "access_key", ",", "id_only", ",", "all", ")", ":", "fields", "=", "[", "(", "'Session ID'", ",", "'sess_id'", ")", ",", "]", "with", "Session", "(", ")", "as", "session", ":", "if", "is_admin", "(", "session", ...
List and manage compute sessions.
[ "List", "and", "manage", "compute", "sessions", "." ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/sessions.py#L24-L133
train
lablup/backend.ai-client-py
src/ai/backend/client/cli/admin/sessions.py
session
def session(sess_id_or_alias): ''' Show detailed information for a running compute session. SESSID: Session id or its alias. ''' fields = [ ('Session ID', 'sess_id'), ('Role', 'role'), ('Image', 'image'), ('Tag', 'tag'), ('Created At', 'created_at'), ...
python
def session(sess_id_or_alias): ''' Show detailed information for a running compute session. SESSID: Session id or its alias. ''' fields = [ ('Session ID', 'sess_id'), ('Role', 'role'), ('Image', 'image'), ('Tag', 'tag'), ('Created At', 'created_at'), ...
[ "def", "session", "(", "sess_id_or_alias", ")", ":", "fields", "=", "[", "(", "'Session ID'", ",", "'sess_id'", ")", ",", "(", "'Role'", ",", "'role'", ")", ",", "(", "'Image'", ",", "'image'", ")", ",", "(", "'Tag'", ",", "'tag'", ")", ",", "(", "...
Show detailed information for a running compute session. SESSID: Session id or its alias.
[ "Show", "detailed", "information", "for", "a", "running", "compute", "session", "." ]
a063d774fea6f4350b89498c40d3c837ec3029a7
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/sessions.py#L140-L189
train
housecanary/hc-api-python
housecanary/response.py
Response.create
def create(cls, endpoint_name, json_body, original_response): """Factory for creating the correct type of Response based on the data. Args: endpoint_name (str) - The endpoint of the request, such as "property/value" json_body - The response body in json format. origin...
python
def create(cls, endpoint_name, json_body, original_response): """Factory for creating the correct type of Response based on the data. Args: endpoint_name (str) - The endpoint of the request, such as "property/value" json_body - The response body in json format. origin...
[ "def", "create", "(", "cls", ",", "endpoint_name", ",", "json_body", ",", "original_response", ")", ":", "if", "endpoint_name", "==", "\"property/value_report\"", ":", "return", "ValueReportResponse", "(", "endpoint_name", ",", "json_body", ",", "original_response", ...
Factory for creating the correct type of Response based on the data. Args: endpoint_name (str) - The endpoint of the request, such as "property/value" json_body - The response body in json format. original_response (response object) - server response returned from an http req...
[ "Factory", "for", "creating", "the", "correct", "type", "of", "Response", "based", "on", "the", "data", ".", "Args", ":", "endpoint_name", "(", "str", ")", "-", "The", "endpoint", "of", "the", "request", "such", "as", "property", "/", "value", "json_body",...
2bb9e2208b34e8617575de45934357ee33b8531c
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/response.py#L34-L59
train
housecanary/hc-api-python
housecanary/response.py
Response.get_object_errors
def get_object_errors(self): """Gets a list of business error message strings for each of the requested objects that had a business error. If there was no error, returns an empty list Returns: List of strings """ if self._object_errors is None: se...
python
def get_object_errors(self): """Gets a list of business error message strings for each of the requested objects that had a business error. If there was no error, returns an empty list Returns: List of strings """ if self._object_errors is None: se...
[ "def", "get_object_errors", "(", "self", ")", ":", "if", "self", ".", "_object_errors", "is", "None", ":", "self", ".", "_object_errors", "=", "[", "{", "str", "(", "o", ")", ":", "o", ".", "get_errors", "(", ")", "}", "for", "o", "in", "self", "."...
Gets a list of business error message strings for each of the requested objects that had a business error. If there was no error, returns an empty list Returns: List of strings
[ "Gets", "a", "list", "of", "business", "error", "message", "strings", "for", "each", "of", "the", "requested", "objects", "that", "had", "a", "business", "error", ".", "If", "there", "was", "no", "error", "returns", "an", "empty", "list" ]
2bb9e2208b34e8617575de45934357ee33b8531c
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/response.py#L87-L100
train
housecanary/hc-api-python
housecanary/response.py
Response.has_object_error
def has_object_error(self): """Returns true if any requested object had a business logic error, otherwise returns false Returns: boolean """ if self._has_object_error is None: # scan the objects for any business error codes self._has_object_er...
python
def has_object_error(self): """Returns true if any requested object had a business logic error, otherwise returns false Returns: boolean """ if self._has_object_error is None: # scan the objects for any business error codes self._has_object_er...
[ "def", "has_object_error", "(", "self", ")", ":", "if", "self", ".", "_has_object_error", "is", "None", ":", "# scan the objects for any business error codes", "self", ".", "_has_object_error", "=", "next", "(", "(", "True", "for", "o", "in", "self", ".", "objec...
Returns true if any requested object had a business logic error, otherwise returns false Returns: boolean
[ "Returns", "true", "if", "any", "requested", "object", "had", "a", "business", "logic", "error", "otherwise", "returns", "false" ]
2bb9e2208b34e8617575de45934357ee33b8531c
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/response.py#L102-L115
train
housecanary/hc-api-python
housecanary/response.py
Response.rate_limits
def rate_limits(self): """Returns a list of rate limit details.""" if not self._rate_limits: self._rate_limits = utilities.get_rate_limits(self.response) return self._rate_limits
python
def rate_limits(self): """Returns a list of rate limit details.""" if not self._rate_limits: self._rate_limits = utilities.get_rate_limits(self.response) return self._rate_limits
[ "def", "rate_limits", "(", "self", ")", ":", "if", "not", "self", ".", "_rate_limits", ":", "self", ".", "_rate_limits", "=", "utilities", ".", "get_rate_limits", "(", "self", ".", "response", ")", "return", "self", ".", "_rate_limits" ]
Returns a list of rate limit details.
[ "Returns", "a", "list", "of", "rate", "limit", "details", "." ]
2bb9e2208b34e8617575de45934357ee33b8531c
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/response.py#L139-L144
train
HPENetworking/PYHPEIMC
pyhpeimc/auth.py
check_imc_creds
def check_imc_creds(auth, url): """Function takes input of auth class object auth object and URL and returns a BOOL of TRUE if the authentication was successful. >>> auth = IMCAuth("http://", "10.101.0.203", "8080", "admin", "admin") >>> check_imc_creds(auth.creds, auth.url) True """ tes...
python
def check_imc_creds(auth, url): """Function takes input of auth class object auth object and URL and returns a BOOL of TRUE if the authentication was successful. >>> auth = IMCAuth("http://", "10.101.0.203", "8080", "admin", "admin") >>> check_imc_creds(auth.creds, auth.url) True """ tes...
[ "def", "check_imc_creds", "(", "auth", ",", "url", ")", ":", "test_url", "=", "'/imcrs'", "f_url", "=", "url", "+", "test_url", "try", ":", "response", "=", "requests", ".", "get", "(", "f_url", ",", "auth", "=", "auth", ",", "headers", "=", "HEADERS",...
Function takes input of auth class object auth object and URL and returns a BOOL of TRUE if the authentication was successful. >>> auth = IMCAuth("http://", "10.101.0.203", "8080", "admin", "admin") >>> check_imc_creds(auth.creds, auth.url) True
[ "Function", "takes", "input", "of", "auth", "class", "object", "auth", "object", "and", "URL", "and", "returns", "a", "BOOL", "of", "TRUE", "if", "the", "authentication", "was", "successful", "." ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/auth.py#L73-L89
train
HPENetworking/PYHPEIMC
pyhpeimc/auth.py
print_to_file
def print_to_file(object_name): """ Function takes in object of type str, list, or dict and prints out to current working directory as pyoutput.txt :param: Object: object of type str, list, or dict :return: No return. Just prints out to file handler and save to current working directory as pyou...
python
def print_to_file(object_name): """ Function takes in object of type str, list, or dict and prints out to current working directory as pyoutput.txt :param: Object: object of type str, list, or dict :return: No return. Just prints out to file handler and save to current working directory as pyou...
[ "def", "print_to_file", "(", "object_name", ")", ":", "with", "open", "(", "'pyoutput.txt'", ",", "'w'", ")", "as", "filehandler", ":", "output", "=", "None", "if", "isinstance", "(", "object_name", ",", "list", ")", ":", "output", "=", "json", ".", "dum...
Function takes in object of type str, list, or dict and prints out to current working directory as pyoutput.txt :param: Object: object of type str, list, or dict :return: No return. Just prints out to file handler and save to current working directory as pyoutput.txt
[ "Function", "takes", "in", "object", "of", "type", "str", "list", "or", "dict", "and", "prints", "out", "to", "current", "working", "directory", "as", "pyoutput", ".", "txt", ":", "param", ":", "Object", ":", "object", "of", "type", "str", "list", "or", ...
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/auth.py#L128-L144
train
HPENetworking/PYHPEIMC
pyhpeimc/auth.py
IMCAuth.get_auth
def get_auth(self): """ This method requests an authentication object from the HPE IMC NMS and returns an HTTPDigest Auth Object :return: """ url = self.h_url + self.server + ":" + self.port auth = requests.auth.HTTPDigestAuth(self.username, self.password) ...
python
def get_auth(self): """ This method requests an authentication object from the HPE IMC NMS and returns an HTTPDigest Auth Object :return: """ url = self.h_url + self.server + ":" + self.port auth = requests.auth.HTTPDigestAuth(self.username, self.password) ...
[ "def", "get_auth", "(", "self", ")", ":", "url", "=", "self", ".", "h_url", "+", "self", ".", "server", "+", "\":\"", "+", "self", ".", "port", "auth", "=", "requests", ".", "auth", ".", "HTTPDigestAuth", "(", "self", ".", "username", ",", "self", ...
This method requests an authentication object from the HPE IMC NMS and returns an HTTPDigest Auth Object :return:
[ "This", "method", "requests", "an", "authentication", "object", "from", "the", "HPE", "IMC", "NMS", "and", "returns", "an", "HTTPDigest", "Auth", "Object", ":", "return", ":" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/auth.py#L54-L70
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
print_title
def print_title(title, is_end=False): """ Print title like ``----- {title} -----`` or ``===== {title} =====``. :param title: Title. :param is_end: Whether is end title. End title use ``=`` instead of ``-``. :return: None. """ # If is end title if is_end: # Use `=` sep ...
python
def print_title(title, is_end=False): """ Print title like ``----- {title} -----`` or ``===== {title} =====``. :param title: Title. :param is_end: Whether is end title. End title use ``=`` instead of ``-``. :return: None. """ # If is end title if is_end: # Use `=` sep ...
[ "def", "print_title", "(", "title", ",", "is_end", "=", "False", ")", ":", "# If is end title", "if", "is_end", ":", "# Use `=`", "sep", "=", "'====='", "# If is not end title", "else", ":", "# Use `-`", "sep", "=", "'-----'", "# If is not end title", "if", "not...
Print title like ``----- {title} -----`` or ``===== {title} =====``. :param title: Title. :param is_end: Whether is end title. End title use ``=`` instead of ``-``. :return: None.
[ "Print", "title", "like", "-----", "{", "title", "}", "-----", "or", "=====", "{", "title", "}", "=====", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L69-L95
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
get_full_python_version
def get_full_python_version(): """ Get full Python version. E.g. - `2.7.11.final.0.32bit` - `3.5.1.final.0.64bit` :return: Full Python version. """ # Get version part, e.g. `3.5.1.final.0` version_part = '.'.join(str(x) for x in sys.version_info) # Get integer width, e...
python
def get_full_python_version(): """ Get full Python version. E.g. - `2.7.11.final.0.32bit` - `3.5.1.final.0.64bit` :return: Full Python version. """ # Get version part, e.g. `3.5.1.final.0` version_part = '.'.join(str(x) for x in sys.version_info) # Get integer width, e...
[ "def", "get_full_python_version", "(", ")", ":", "# Get version part, e.g. `3.5.1.final.0`", "version_part", "=", "'.'", ".", "join", "(", "str", "(", "x", ")", "for", "x", "in", "sys", ".", "version_info", ")", "# Get integer width, e.g. 32 or 64", "int_width", "="...
Get full Python version. E.g. - `2.7.11.final.0.32bit` - `3.5.1.final.0.64bit` :return: Full Python version.
[ "Get", "full", "Python", "version", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L98-L118
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
get_python_path
def get_python_path(venv_path): """ Get given virtual environment's `python` program path. :param venv_path: Virtual environment directory path. :return: `python` program path. """ # Get `bin` directory path bin_path = get_bin_path(venv_path) # Get `python` program path program_pa...
python
def get_python_path(venv_path): """ Get given virtual environment's `python` program path. :param venv_path: Virtual environment directory path. :return: `python` program path. """ # Get `bin` directory path bin_path = get_bin_path(venv_path) # Get `python` program path program_pa...
[ "def", "get_python_path", "(", "venv_path", ")", ":", "# Get `bin` directory path", "bin_path", "=", "get_bin_path", "(", "venv_path", ")", "# Get `python` program path", "program_path", "=", "os", ".", "path", ".", "join", "(", "bin_path", ",", "'python'", ")", "...
Get given virtual environment's `python` program path. :param venv_path: Virtual environment directory path. :return: `python` program path.
[ "Get", "given", "virtual", "environment", "s", "python", "program", "path", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L140-L160
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
add_options
def add_options(ctx): """ Add command line options. :return: None. """ # Add option ctx.add_option( '--always', action='store_true', default=False, dest='always', help='whether always run tasks.', ) # Add option ctx.add_option( '--che...
python
def add_options(ctx): """ Add command line options. :return: None. """ # Add option ctx.add_option( '--always', action='store_true', default=False, dest='always', help='whether always run tasks.', ) # Add option ctx.add_option( '--che...
[ "def", "add_options", "(", "ctx", ")", ":", "# Add option", "ctx", ".", "add_option", "(", "'--always'", ",", "action", "=", "'store_true'", ",", "default", "=", "False", ",", "dest", "=", "'always'", ",", "help", "=", "'whether always run tasks.'", ",", ")"...
Add command line options. :return: None.
[ "Add", "command", "line", "options", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L186-L240
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
add_pythonpath
def add_pythonpath(path): """ Prepend given path to environment variable PYTHONPATH. :param path: Path to add to PYTHONPATH. :return: New PYTHONPATH value. """ # Get PYTHONPATH value. Default is empty string. pythonpath = os.environ.setdefault('PYTHONPATH', '') # If given path is not ...
python
def add_pythonpath(path): """ Prepend given path to environment variable PYTHONPATH. :param path: Path to add to PYTHONPATH. :return: New PYTHONPATH value. """ # Get PYTHONPATH value. Default is empty string. pythonpath = os.environ.setdefault('PYTHONPATH', '') # If given path is not ...
[ "def", "add_pythonpath", "(", "path", ")", ":", "# Get PYTHONPATH value. Default is empty string.", "pythonpath", "=", "os", ".", "environ", ".", "setdefault", "(", "'PYTHONPATH'", ",", "''", ")", "# If given path is not in PYTHONPATH", "if", "path", "not", "in", "pyt...
Prepend given path to environment variable PYTHONPATH. :param path: Path to add to PYTHONPATH. :return: New PYTHONPATH value.
[ "Prepend", "given", "path", "to", "environment", "variable", "PYTHONPATH", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L243-L261
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
mark_path
def mark_path(path): """ Wrap given path as relative path relative to top directory. Wrapper object will be handled specially in \ :paramref:`create_cmd_task.parts`. :param path: Relative path relative to top directory. :return: Wrapper object. """ # If given path is not string, #...
python
def mark_path(path): """ Wrap given path as relative path relative to top directory. Wrapper object will be handled specially in \ :paramref:`create_cmd_task.parts`. :param path: Relative path relative to top directory. :return: Wrapper object. """ # If given path is not string, #...
[ "def", "mark_path", "(", "path", ")", ":", "# If given path is not string,", "# or given path is absolute path.", "if", "not", "isinstance", "(", "path", ",", "str", ")", "or", "os", ".", "path", ".", "isabs", "(", "path", ")", ":", "# Get error message", "msg",...
Wrap given path as relative path relative to top directory. Wrapper object will be handled specially in \ :paramref:`create_cmd_task.parts`. :param path: Relative path relative to top directory. :return: Wrapper object.
[ "Wrap", "given", "path", "as", "relative", "path", "relative", "to", "top", "directory", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L323-L349
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
_mark_target
def _mark_target(type, item): """ Wrap given item as input or output target that should be added to task. Wrapper object will be handled specially in \ :paramref:`create_cmd_task.parts`. :param type: Target type. Allowed values: - 'input' - 'output' :param ite...
python
def _mark_target(type, item): """ Wrap given item as input or output target that should be added to task. Wrapper object will be handled specially in \ :paramref:`create_cmd_task.parts`. :param type: Target type. Allowed values: - 'input' - 'output' :param ite...
[ "def", "_mark_target", "(", "type", ",", "item", ")", ":", "# If given type is not valid", "if", "type", "not", "in", "(", "'input'", ",", "'output'", ")", ":", "# Get error message", "msg", "=", "'Error (7D74X): Type is not valid: {0}'", ".", "format", "(", "type...
Wrap given item as input or output target that should be added to task. Wrapper object will be handled specially in \ :paramref:`create_cmd_task.parts`. :param type: Target type. Allowed values: - 'input' - 'output' :param item: Item to mark as input or output target....
[ "Wrap", "given", "item", "as", "input", "or", "output", "target", "that", "should", "be", "added", "to", "task", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L352-L411
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
create_node
def create_node(ctx, path): """ Create node for given relative path. :param ctx: BuildContext object. :param path: Relative path relative to top directory. :return: Created Node. """ # Ensure given context object is BuildContext object _ensure_build_context(ctx) # Get top directo...
python
def create_node(ctx, path): """ Create node for given relative path. :param ctx: BuildContext object. :param path: Relative path relative to top directory. :return: Created Node. """ # Ensure given context object is BuildContext object _ensure_build_context(ctx) # Get top directo...
[ "def", "create_node", "(", "ctx", ",", "path", ")", ":", "# Ensure given context object is BuildContext object", "_ensure_build_context", "(", "ctx", ")", "# Get top directory's relative path relative to `wscript` directory", "top_dir_relpath", "=", "os", ".", "path", ".", "r...
Create node for given relative path. :param ctx: BuildContext object. :param path: Relative path relative to top directory. :return: Created Node.
[ "Create", "node", "for", "given", "relative", "path", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L470-L498
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
_normalize_items
def _normalize_items( ctx, items, str_to_node=False, node_to_str=False, allow_task=False, ): """ Normalize given items. Do several things: - Ignore None. - Flatten list. - Unwrap wrapped item in `_ItemWrapper`. :param ctx: BuildContext object. :param it...
python
def _normalize_items( ctx, items, str_to_node=False, node_to_str=False, allow_task=False, ): """ Normalize given items. Do several things: - Ignore None. - Flatten list. - Unwrap wrapped item in `_ItemWrapper`. :param ctx: BuildContext object. :param it...
[ "def", "_normalize_items", "(", "ctx", ",", "items", ",", "str_to_node", "=", "False", ",", "node_to_str", "=", "False", ",", "allow_task", "=", "False", ",", ")", ":", "# Ensure given context object is BuildContext object", "_ensure_build_context", "(", "ctx", ")",...
Normalize given items. Do several things: - Ignore None. - Flatten list. - Unwrap wrapped item in `_ItemWrapper`. :param ctx: BuildContext object. :param items: Items list to normalize. :param str_to_node: Convert string to node. :param node_to_str: Convert node to absol...
[ "Normalize", "given", "items", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L501-L666
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
update_touch_file
def update_touch_file( ctx, path, check_import=False, check_import_module=None, check_import_python=None, always=False, ): """ Update touch file at given path. Do two things: - Create touch file if it not exists. - Update touch file if import checking fails. The...
python
def update_touch_file( ctx, path, check_import=False, check_import_module=None, check_import_python=None, always=False, ): """ Update touch file at given path. Do two things: - Create touch file if it not exists. - Update touch file if import checking fails. The...
[ "def", "update_touch_file", "(", "ctx", ",", "path", ",", "check_import", "=", "False", ",", "check_import_module", "=", "None", ",", "check_import_python", "=", "None", ",", "always", "=", "False", ",", ")", ":", "# Ensure given context object is BuildContext objec...
Update touch file at given path. Do two things: - Create touch file if it not exists. - Update touch file if import checking fails. The returned touch file node is used as task's output target for dirty checking. Task will run if the touch file changes. :param ctx: BuildContext instan...
[ "Update", "touch", "file", "at", "given", "path", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L685-L855
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
chain_tasks
def chain_tasks(tasks): """ Chain given tasks. Set each task to run after its previous task. :param tasks: Tasks list. :return: Given tasks list. """ # If given tasks list is not empty if tasks: # Previous task previous_task = None # For given tasks list's each tas...
python
def chain_tasks(tasks): """ Chain given tasks. Set each task to run after its previous task. :param tasks: Tasks list. :return: Given tasks list. """ # If given tasks list is not empty if tasks: # Previous task previous_task = None # For given tasks list's each tas...
[ "def", "chain_tasks", "(", "tasks", ")", ":", "# If given tasks list is not empty", "if", "tasks", ":", "# Previous task", "previous_task", "=", "None", "# For given tasks list's each task", "for", "task", "in", "tasks", ":", "# If the task is not None.", "# Task can be Non...
Chain given tasks. Set each task to run after its previous task. :param tasks: Tasks list. :return: Given tasks list.
[ "Chain", "given", "tasks", ".", "Set", "each", "task", "to", "run", "after", "its", "previous", "task", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1030-L1057
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
create_cmd_task
def create_cmd_task( ctx, parts, inputs=None, outputs=None, env=None, cwd=None, task_name=None, cache_key=None, always=False, add_to_group=True, ): """ Create task that runs given command. :param ctx: BuildContext object. :param parts: Command parts list. ...
python
def create_cmd_task( ctx, parts, inputs=None, outputs=None, env=None, cwd=None, task_name=None, cache_key=None, always=False, add_to_group=True, ): """ Create task that runs given command. :param ctx: BuildContext object. :param parts: Command parts list. ...
[ "def", "create_cmd_task", "(", "ctx", ",", "parts", ",", "inputs", "=", "None", ",", "outputs", "=", "None", ",", "env", "=", "None", ",", "cwd", "=", "None", ",", "task_name", "=", "None", ",", "cache_key", "=", "None", ",", "always", "=", "False", ...
Create task that runs given command. :param ctx: BuildContext object. :param parts: Command parts list. Each part can be: - **None**: Will be ignored. - **String**: Will be used as-is. - **Node object**: Will be converted to absolute path. - **List of t...
[ "Create", "task", "that", "runs", "given", "command", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1066-L1370
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
build_ctx
def build_ctx(pythonpath=None): """ Decorator that makes decorated function use BuildContext instead of \ Context instance. BuildContext instance has more methods. :param pythonpath: Path or list of paths to add to environment variable PYTHONPATH. Each path can be absolute path, or relative pat...
python
def build_ctx(pythonpath=None): """ Decorator that makes decorated function use BuildContext instead of \ Context instance. BuildContext instance has more methods. :param pythonpath: Path or list of paths to add to environment variable PYTHONPATH. Each path can be absolute path, or relative pat...
[ "def", "build_ctx", "(", "pythonpath", "=", "None", ")", ":", "# If argument `pythonpath` is string", "if", "isinstance", "(", "pythonpath", ",", "str", ")", ":", "# Create paths list containing the string", "path_s", "=", "[", "pythonpath", "]", "# If argument `pythonp...
Decorator that makes decorated function use BuildContext instead of \ Context instance. BuildContext instance has more methods. :param pythonpath: Path or list of paths to add to environment variable PYTHONPATH. Each path can be absolute path, or relative path relative to top directory. ...
[ "Decorator", "that", "makes", "decorated", "function", "use", "BuildContext", "instead", "of", "\\", "Context", "instance", ".", "BuildContext", "instance", "has", "more", "methods", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1373-L1485
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
config_ctx
def config_ctx(func): """ Decorator that makes decorated function use ConfigurationContext instead \ of Context instance. :param func: Decorated function. :return: Decorated function. """ # Create ConfigurationContext subclass class _ConfigurationContext(ConfigurationContext): ...
python
def config_ctx(func): """ Decorator that makes decorated function use ConfigurationContext instead \ of Context instance. :param func: Decorated function. :return: Decorated function. """ # Create ConfigurationContext subclass class _ConfigurationContext(ConfigurationContext): ...
[ "def", "config_ctx", "(", "func", ")", ":", "# Create ConfigurationContext subclass", "class", "_ConfigurationContext", "(", "ConfigurationContext", ")", ":", "# Set command name for the context class", "cmd", "=", "func", ".", "__name__", "# Set function name for the context c...
Decorator that makes decorated function use ConfigurationContext instead \ of Context instance. :param func: Decorated function. :return: Decorated function.
[ "Decorator", "that", "makes", "decorated", "function", "use", "ConfigurationContext", "instead", "\\", "of", "Context", "instance", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1488-L1509
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
print_ctx
def print_ctx(ctx): """ Print given context's info. :param ctx: Context object. :return: None. """ # Print title print_title('ctx attributes') # Print context object's attributes print_text(dir(ctx)) # Print end title print_title('ctx attributes', is_end=True) # Prin...
python
def print_ctx(ctx): """ Print given context's info. :param ctx: Context object. :return: None. """ # Print title print_title('ctx attributes') # Print context object's attributes print_text(dir(ctx)) # Print end title print_title('ctx attributes', is_end=True) # Prin...
[ "def", "print_ctx", "(", "ctx", ")", ":", "# Print title", "print_title", "(", "'ctx attributes'", ")", "# Print context object's attributes", "print_text", "(", "dir", "(", "ctx", ")", ")", "# Print end title", "print_title", "(", "'ctx attributes'", ",", "is_end", ...
Print given context's info. :param ctx: Context object. :return: None.
[ "Print", "given", "context", "s", "info", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1512-L1548
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
virtualenv_setup
def virtualenv_setup( ctx, python, inputs=None, outputs=None, touch=None, check_import=False, pip_setup_file=None, pip_setup_touch=None, cache_key=None, always=False, ): """ Create task that sets up `virtualenv` package. :param ctx: BuildContext object. :param p...
python
def virtualenv_setup( ctx, python, inputs=None, outputs=None, touch=None, check_import=False, pip_setup_file=None, pip_setup_touch=None, cache_key=None, always=False, ): """ Create task that sets up `virtualenv` package. :param ctx: BuildContext object. :param p...
[ "def", "virtualenv_setup", "(", "ctx", ",", "python", ",", "inputs", "=", "None", ",", "outputs", "=", "None", ",", "touch", "=", "None", ",", "check_import", "=", "False", ",", "pip_setup_file", "=", "None", ",", "pip_setup_touch", "=", "None", ",", "ca...
Create task that sets up `virtualenv` package. :param ctx: BuildContext object. :param python: Python program path. :param inputs: Input items list to add to created task. See :paramref:`create_cmd_task.inputs` for allowed item types. :param outputs: Output items list to add to created task...
[ "Create", "task", "that", "sets", "up", "virtualenv", "package", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1658-L1805
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
create_venv
def create_venv( ctx, python, venv_path, inputs=None, outputs=None, pip_setup_file=None, pip_setup_touch=None, virtualenv_setup_touch=None, task_name=None, cache_key=None, always=False, ): """ Create task that sets up virtual environment. :param ctx: BuildContext...
python
def create_venv( ctx, python, venv_path, inputs=None, outputs=None, pip_setup_file=None, pip_setup_touch=None, virtualenv_setup_touch=None, task_name=None, cache_key=None, always=False, ): """ Create task that sets up virtual environment. :param ctx: BuildContext...
[ "def", "create_venv", "(", "ctx", ",", "python", ",", "venv_path", ",", "inputs", "=", "None", ",", "outputs", "=", "None", ",", "pip_setup_file", "=", "None", ",", "pip_setup_touch", "=", "None", ",", "virtualenv_setup_touch", "=", "None", ",", "task_name",...
Create task that sets up virtual environment. :param ctx: BuildContext object. :param python: Python program path. :param venv_path: Virtual environment directory relative path relative to top directory. :param inputs: Input items list to add to created task. See :paramref:`create_c...
[ "Create", "task", "that", "sets", "up", "virtual", "environment", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1808-L1936
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
pip_ins_req
def pip_ins_req( ctx, python, req_path, venv_path=None, inputs=None, outputs=None, touch=None, check_import=False, check_import_module=None, pip_setup_file=None, pip_setup_touch=None, virtualenv_setup_touch=None, always=False, ): """ Create task that uses give...
python
def pip_ins_req( ctx, python, req_path, venv_path=None, inputs=None, outputs=None, touch=None, check_import=False, check_import_module=None, pip_setup_file=None, pip_setup_touch=None, virtualenv_setup_touch=None, always=False, ): """ Create task that uses give...
[ "def", "pip_ins_req", "(", "ctx", ",", "python", ",", "req_path", ",", "venv_path", "=", "None", ",", "inputs", "=", "None", ",", "outputs", "=", "None", ",", "touch", "=", "None", ",", "check_import", "=", "False", ",", "check_import_module", "=", "None...
Create task that uses given virtual environment's `pip` to sets up \ packages listed in given requirements file. :param ctx: BuildContext object. :param python: Python program path used to set up `pip` and `virtualenv`. :param req_path: Requirements file relative path relative to top directory. ...
[ "Create", "task", "that", "uses", "given", "virtual", "environment", "s", "pip", "to", "sets", "up", "\\", "packages", "listed", "in", "given", "requirements", "file", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1939-L2159
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
git_clean
def git_clean(ctx): """ Delete all files untracked by git. :param ctx: Context object. :return: None. """ # Get command parts cmd_part_s = [ # Program path 'git', # Clean untracked files 'clean', # Remove all untracked files '-x', ...
python
def git_clean(ctx): """ Delete all files untracked by git. :param ctx: Context object. :return: None. """ # Get command parts cmd_part_s = [ # Program path 'git', # Clean untracked files 'clean', # Remove all untracked files '-x', ...
[ "def", "git_clean", "(", "ctx", ")", ":", "# Get command parts", "cmd_part_s", "=", "[", "# Program path", "'git'", ",", "# Clean untracked files", "'clean'", ",", "# Remove all untracked files", "'-x'", ",", "# Remove untracked directories too", "'-d'", ",", "# Force to ...
Delete all files untracked by git. :param ctx: Context object. :return: None.
[ "Delete", "all", "files", "untracked", "by", "git", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L2162-L2204
train
AoiKuiyuyou/AoikLiveReload
tools/waf/aoikwafutil.py
CmdTask.run
def run(self): """ Run command. :return: Command exit code. """ # Print task title print_title(self._task_name_title) # Get context object ctx = self._ctx # Get command parts cmd_part_s = self._parts # Print title print_...
python
def run(self): """ Run command. :return: Command exit code. """ # Print task title print_title(self._task_name_title) # Get context object ctx = self._ctx # Get command parts cmd_part_s = self._parts # Print title print_...
[ "def", "run", "(", "self", ")", ":", "# Print task title", "print_title", "(", "self", ".", "_task_name_title", ")", "# Get context object", "ctx", "=", "self", ".", "_ctx", "# Get command parts", "cmd_part_s", "=", "self", ".", "_parts", "# Print title", "print_t...
Run command. :return: Command exit code.
[ "Run", "command", "." ]
0d5adb12118a33749e6690a8165fdb769cff7d5c
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L909-L1027
train
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/wsm/acinfo.py
get_ac_info_all
def get_ac_info_all(auth, url): """ function takes no input as input to RESTFUL 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 :return: list of dictionaries ...
python
def get_ac_info_all(auth, url): """ function takes no input as input to RESTFUL 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 :return: list of dictionaries ...
[ "def", "get_ac_info_all", "(", "auth", ",", "url", ")", ":", "get_ac_info_all_url", "=", "\"/imcrs/wlan/acInfo/queryAcBasicInfo\"", "f_url", "=", "url", "+", "get_ac_info_all_url", "payload", "=", "None", "r", "=", "requests", ".", "get", "(", "f_url", ",", "aut...
function takes no input as input to RESTFUL 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 :return: list of dictionaries where each element of the list represents a ...
[ "function", "takes", "no", "input", "as", "input", "to", "RESTFUL", "call", "to", "HP", "IMC" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/wsm/acinfo.py#L15-L76
train
HPENetworking/PYHPEIMC
pyhpeimc/objects.py
IMCDev.addvlan
def addvlan(self, vlanid, vlan_name): """ Function operates on the IMCDev object. Takes input of vlanid (1-4094), str of vlan_name, auth and url to execute the create_dev_vlan method on the IMCDev object. Device must be supported in the HPE IMC Platform VLAN Manager module. :para...
python
def addvlan(self, vlanid, vlan_name): """ Function operates on the IMCDev object. Takes input of vlanid (1-4094), str of vlan_name, auth and url to execute the create_dev_vlan method on the IMCDev object. Device must be supported in the HPE IMC Platform VLAN Manager module. :para...
[ "def", "addvlan", "(", "self", ",", "vlanid", ",", "vlan_name", ")", ":", "create_dev_vlan", "(", "vlanid", ",", "vlan_name", ",", "self", ".", "auth", ",", "self", ".", "url", ",", "devid", "=", "self", ".", "devid", ")" ]
Function operates on the IMCDev object. Takes input of vlanid (1-4094), str of vlan_name, auth and url to execute the create_dev_vlan method on the IMCDev object. Device must be supported in the HPE IMC Platform VLAN Manager module. :param vlanid: str of VLANId ( valid 1-4094 ) :param vl...
[ "Function", "operates", "on", "the", "IMCDev", "object", ".", "Takes", "input", "of", "vlanid", "(", "1", "-", "4094", ")", "str", "of", "vlan_name", "auth", "and", "url", "to", "execute", "the", "create_dev_vlan", "method", "on", "the", "IMCDev", "object"...
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L118-L127
train
HPENetworking/PYHPEIMC
pyhpeimc/objects.py
IMCDev.delvlan
def delvlan(self, vlanid): """ Function operates on the IMCDev object. Takes input of vlanid (1-4094), auth and url to execute the delete_dev_vlans method on the IMCDev object. Device must be supported in the HPE IMC Platform VLAN Manager module. :param vlanid: str of VLANId ( va...
python
def delvlan(self, vlanid): """ Function operates on the IMCDev object. Takes input of vlanid (1-4094), auth and url to execute the delete_dev_vlans method on the IMCDev object. Device must be supported in the HPE IMC Platform VLAN Manager module. :param vlanid: str of VLANId ( va...
[ "def", "delvlan", "(", "self", ",", "vlanid", ")", ":", "delete_dev_vlans", "(", "vlanid", ",", "self", ".", "auth", ",", "self", ".", "url", ",", "devid", "=", "self", ".", "devid", ")" ]
Function operates on the IMCDev object. Takes input of vlanid (1-4094), auth and url to execute the delete_dev_vlans method on the IMCDev object. Device must be supported in the HPE IMC Platform VLAN Manager module. :param vlanid: str of VLANId ( valid 1-4094 ) :return:
[ "Function", "operates", "on", "the", "IMCDev", "object", ".", "Takes", "input", "of", "vlanid", "(", "1", "-", "4094", ")", "auth", "and", "url", "to", "execute", "the", "delete_dev_vlans", "method", "on", "the", "IMCDev", "object", ".", "Device", "must", ...
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L129-L137
train
HPENetworking/PYHPEIMC
pyhpeimc/objects.py
IMCDev.getipmacarp
def getipmacarp(self): """ Function operates on the IMCDev object and updates the ipmacarp attribute :return: """ self.ipmacarp = get_ip_mac_arp_list(self.auth, self.url, devid = self.devid)
python
def getipmacarp(self): """ Function operates on the IMCDev object and updates the ipmacarp attribute :return: """ self.ipmacarp = get_ip_mac_arp_list(self.auth, self.url, devid = self.devid)
[ "def", "getipmacarp", "(", "self", ")", ":", "self", ".", "ipmacarp", "=", "get_ip_mac_arp_list", "(", "self", ".", "auth", ",", "self", ".", "url", ",", "devid", "=", "self", ".", "devid", ")" ]
Function operates on the IMCDev object and updates the ipmacarp attribute :return:
[ "Function", "operates", "on", "the", "IMCDev", "object", "and", "updates", "the", "ipmacarp", "attribute", ":", "return", ":" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L139-L144
train
HPENetworking/PYHPEIMC
pyhpeimc/objects.py
IMCInterface.down
def down(self): """ Function operates on the IMCInterface object and configures the interface into an administratively down state and refreshes contents of self.adminstatus :return: """ set_interface_down(self.ifIndex, self.auth, self.url, devip=self.ip) self.admi...
python
def down(self): """ Function operates on the IMCInterface object and configures the interface into an administratively down state and refreshes contents of self.adminstatus :return: """ set_interface_down(self.ifIndex, self.auth, self.url, devip=self.ip) self.admi...
[ "def", "down", "(", "self", ")", ":", "set_interface_down", "(", "self", ".", "ifIndex", ",", "self", ".", "auth", ",", "self", ".", "url", ",", "devip", "=", "self", ".", "ip", ")", "self", ".", "adminstatus", "=", "get_interface_details", "(", "self"...
Function operates on the IMCInterface object and configures the interface into an administratively down state and refreshes contents of self.adminstatus :return:
[ "Function", "operates", "on", "the", "IMCInterface", "object", "and", "configures", "the", "interface", "into", "an", "administratively", "down", "state", "and", "refreshes", "contents", "of", "self", ".", "adminstatus", ":", "return", ":" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L181-L189
train
HPENetworking/PYHPEIMC
pyhpeimc/objects.py
IMCInterface.up
def up(self): """ Function operates on the IMCInterface object and configures the interface into an administratively up state and refreshes contents of self.adminstatus :return: """ set_interface_up(self.ifIndex, self.auth, self.url, devip=...
python
def up(self): """ Function operates on the IMCInterface object and configures the interface into an administratively up state and refreshes contents of self.adminstatus :return: """ set_interface_up(self.ifIndex, self.auth, self.url, devip=...
[ "def", "up", "(", "self", ")", ":", "set_interface_up", "(", "self", ".", "ifIndex", ",", "self", ".", "auth", ",", "self", ".", "url", ",", "devip", "=", "self", ".", "ip", ")", "self", ".", "adminstatus", "=", "get_interface_details", "(", "self", ...
Function operates on the IMCInterface object and configures the interface into an administratively up state and refreshes contents of self.adminstatus :return:
[ "Function", "operates", "on", "the", "IMCInterface", "object", "and", "configures", "the", "interface", "into", "an", "administratively", "up", "state", "and", "refreshes", "contents", "of", "self", ".", "adminstatus", ":", "return", ":" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L191-L199
train
HPENetworking/PYHPEIMC
pyhpeimc/objects.py
IPScope.allocate_ip
def allocate_ip(self, hostipaddress, name, description): """ Object method takes in input of hostipaddress, name and description and adds them to the parent ip scope. :param hostipaddress: str of ipv4 address of the target host ip record :param name: str of the name of the owner ...
python
def allocate_ip(self, hostipaddress, name, description): """ Object method takes in input of hostipaddress, name and description and adds them to the parent ip scope. :param hostipaddress: str of ipv4 address of the target host ip record :param name: str of the name of the owner ...
[ "def", "allocate_ip", "(", "self", ",", "hostipaddress", ",", "name", ",", "description", ")", ":", "add_scope_ip", "(", "hostipaddress", ",", "name", ",", "description", ",", "self", ".", "auth", ",", "self", ".", "url", ",", "scopeid", "=", "self", "."...
Object method takes in input of hostipaddress, name and description and adds them to the parent ip scope. :param hostipaddress: str of ipv4 address of the target host ip record :param name: str of the name of the owner of the target host ip record :param description: str of a description...
[ "Object", "method", "takes", "in", "input", "of", "hostipaddress", "name", "and", "description", "and", "adds", "them", "to", "the", "parent", "ip", "scope", ".", ":", "param", "hostipaddress", ":", "str", "of", "ipv4", "address", "of", "the", "target", "h...
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L223-L232
train
HPENetworking/PYHPEIMC
pyhpeimc/objects.py
IPScope.deallocate_ip
def deallocate_ip(self, hostipaddress): """ Object method takes in input of hostip address,removes them from the parent ip scope. :param hostid: str of the hostid of the target host ip record :return: """ delete_host_from_segment(hostipaddress, self.netaddr, self.auth, ...
python
def deallocate_ip(self, hostipaddress): """ Object method takes in input of hostip address,removes them from the parent ip scope. :param hostid: str of the hostid of the target host ip record :return: """ delete_host_from_segment(hostipaddress, self.netaddr, self.auth, ...
[ "def", "deallocate_ip", "(", "self", ",", "hostipaddress", ")", ":", "delete_host_from_segment", "(", "hostipaddress", ",", "self", ".", "netaddr", ",", "self", ".", "auth", ",", "self", ".", "url", ")" ]
Object method takes in input of hostip address,removes them from the parent ip scope. :param hostid: str of the hostid of the target host ip record :return:
[ "Object", "method", "takes", "in", "input", "of", "hostip", "address", "removes", "them", "from", "the", "parent", "ip", "scope", ".", ":", "param", "hostid", ":", "str", "of", "the", "hostid", "of", "the", "target", "host", "ip", "record" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L234-L241
train
HPENetworking/PYHPEIMC
pyhpeimc/objects.py
IPScope.gethosts
def gethosts(self): """ Method gets all hosts currently allocated to the target scope and refreashes the self.hosts attributes of the object :return: """ self.hosts = get_ip_scope_hosts(self.auth, self.url, self.id)
python
def gethosts(self): """ Method gets all hosts currently allocated to the target scope and refreashes the self.hosts attributes of the object :return: """ self.hosts = get_ip_scope_hosts(self.auth, self.url, self.id)
[ "def", "gethosts", "(", "self", ")", ":", "self", ".", "hosts", "=", "get_ip_scope_hosts", "(", "self", ".", "auth", ",", "self", ".", "url", ",", "self", ".", "id", ")" ]
Method gets all hosts currently allocated to the target scope and refreashes the self.hosts attributes of the object :return:
[ "Method", "gets", "all", "hosts", "currently", "allocated", "to", "the", "target", "scope", "and", "refreashes", "the", "self", ".", "hosts", "attributes", "of", "the", "object", ":", "return", ":" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L243-L249
train
HPENetworking/PYHPEIMC
pyhpeimc/objects.py
IPScope.nextfreeip
def nextfreeip(self): """ Method searches for the next free ip address in the scope object and returns it as a str value. :return: """ allocated_ips = [ipaddress.ip_address(host['ip']) for host in self.hosts] for ip in self.netaddr: if str(ip).split('....
python
def nextfreeip(self): """ Method searches for the next free ip address in the scope object and returns it as a str value. :return: """ allocated_ips = [ipaddress.ip_address(host['ip']) for host in self.hosts] for ip in self.netaddr: if str(ip).split('....
[ "def", "nextfreeip", "(", "self", ")", ":", "allocated_ips", "=", "[", "ipaddress", ".", "ip_address", "(", "host", "[", "'ip'", "]", ")", "for", "host", "in", "self", ".", "hosts", "]", "for", "ip", "in", "self", ".", "netaddr", ":", "if", "str", ...
Method searches for the next free ip address in the scope object and returns it as a str value. :return:
[ "Method", "searches", "for", "the", "next", "free", "ip", "address", "in", "the", "scope", "object", "and", "returns", "it", "as", "a", "str", "value", ".", ":", "return", ":" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L251-L262
train
HPENetworking/PYHPEIMC
pyhpeimc/objects.py
IPScope.addchild
def addchild(self, startip, endip, name, description): """ Method takes inpur of str startip, str endip, name, and description and adds a child scope. The startip and endip MUST be in the IP address range of the parent scope. :param startip: str of ipv4 address of the first address in th...
python
def addchild(self, startip, endip, name, description): """ Method takes inpur of str startip, str endip, name, and description and adds a child scope. The startip and endip MUST be in the IP address range of the parent scope. :param startip: str of ipv4 address of the first address in th...
[ "def", "addchild", "(", "self", ",", "startip", ",", "endip", ",", "name", ",", "description", ")", ":", "add_child_ip_scope", "(", "self", ".", "auth", ",", "self", ".", "url", ",", "startip", ",", "endip", ",", "name", ",", "description", ",", "self"...
Method takes inpur of str startip, str endip, name, and description and adds a child scope. The startip and endip MUST be in the IP address range of the parent scope. :param startip: str of ipv4 address of the first address in the child scope :param endip: str of ipv4 address of the last address...
[ "Method", "takes", "inpur", "of", "str", "startip", "str", "endip", "name", "and", "description", "and", "adds", "a", "child", "scope", ".", "The", "startip", "and", "endip", "MUST", "be", "in", "the", "IP", "address", "range", "of", "the", "parent", "sc...
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L264-L274
train
HPENetworking/PYHPEIMC
pyhpeimc/plat/system.py
get_telnet_template
def get_telnet_template(auth, url, template_name=None): """ Takes no input, or template_name as input 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.authcla...
python
def get_telnet_template(auth, url, template_name=None): """ Takes no input, or template_name as input 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.authcla...
[ "def", "get_telnet_template", "(", "auth", ",", "url", ",", "template_name", "=", "None", ")", ":", "f_url", "=", "url", "+", "\"/imcrs/plat/res/telnet?start=0&size=10000&desc=false&total=false\"", "response", "=", "requests", ".", "get", "(", "f_url", ",", "auth", ...
Takes no input, or template_name as input 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 template_name: str value of template name :retur...
[ "Takes", "no", "input", "or", "template_name", "as", "input", "to", "issue", "RESTUL", "call", "to", "HP", "IMC" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L201-L239
train
HPENetworking/PYHPEIMC
pyhpeimc/plat/system.py
modify_telnet_template
def modify_telnet_template(auth, url, telnet_template, template_name= None, template_id = None): """ Function takes input of a dictionry containing the required key/value pair for the modification of a telnet template. :param auth: :param url: :param telnet_template: Human readable label which ...
python
def modify_telnet_template(auth, url, telnet_template, template_name= None, template_id = None): """ Function takes input of a dictionry containing the required key/value pair for the modification of a telnet template. :param auth: :param url: :param telnet_template: Human readable label which ...
[ "def", "modify_telnet_template", "(", "auth", ",", "url", ",", "telnet_template", ",", "template_name", "=", "None", ",", "template_id", "=", "None", ")", ":", "if", "template_name", "is", "None", ":", "template_name", "=", "telnet_template", "[", "'name'", "]...
Function takes input of a dictionry containing the required key/value pair for the modification of a telnet template. :param auth: :param url: :param telnet_template: Human readable label which is the name of the specific telnet template :param template_id Internal IMC number which designates the s...
[ "Function", "takes", "input", "of", "a", "dictionry", "containing", "the", "required", "key", "/", "value", "pair", "for", "the", "modification", "of", "a", "telnet", "template", "." ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L242-L284
train
HPENetworking/PYHPEIMC
pyhpeimc/plat/system.py
delete_telnet_template
def delete_telnet_template(auth, url, template_name= None, template_id= None): """ Takes template_name as input to issue RESTUL call to HP IMC which will delete the specific telnet template from the IMC system :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :par...
python
def delete_telnet_template(auth, url, template_name= None, template_id= None): """ Takes template_name as input to issue RESTUL call to HP IMC which will delete the specific telnet template from the IMC system :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :par...
[ "def", "delete_telnet_template", "(", "auth", ",", "url", ",", "template_name", "=", "None", ",", "template_id", "=", "None", ")", ":", "try", ":", "if", "template_id", "is", "None", ":", "telnet_templates", "=", "get_telnet_template", "(", "auth", ",", "url...
Takes template_name as input to issue RESTUL call to HP IMC which will delete the specific telnet template from the IMC system :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 :p...
[ "Takes", "template_name", "as", "input", "to", "issue", "RESTUL", "call", "to", "HP", "IMC", "which", "will", "delete", "the", "specific", "telnet", "template", "from", "the", "IMC", "system" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L287-L317
train
HPENetworking/PYHPEIMC
pyhpeimc/plat/system.py
create_ssh_template
def create_ssh_template(auth, url, ssh_template ): """ Function takes input of a dictionry containing the required key/value pair for the creation of a ssh template. :param auth: :param url: :param ssh: dictionary of valid JSON which complains to API schema :return: int value of HTTP respon...
python
def create_ssh_template(auth, url, ssh_template ): """ Function takes input of a dictionry containing the required key/value pair for the creation of a ssh template. :param auth: :param url: :param ssh: dictionary of valid JSON which complains to API schema :return: int value of HTTP respon...
[ "def", "create_ssh_template", "(", "auth", ",", "url", ",", "ssh_template", ")", ":", "f_url", "=", "url", "+", "\"/imcrs/plat/res/ssh/add\"", "response", "=", "requests", ".", "post", "(", "f_url", ",", "data", "=", "json", ".", "dumps", "(", "ssh_template"...
Function takes input of a dictionry containing the required key/value pair for the creation of a ssh template. :param auth: :param url: :param ssh: dictionary of valid JSON which complains to API schema :return: int value of HTTP response code 201 for proper creation or 404 for failed creation ...
[ "Function", "takes", "input", "of", "a", "dictionry", "containing", "the", "required", "key", "/", "value", "pair", "for", "the", "creation", "of", "a", "ssh", "template", "." ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L322-L355
train
HPENetworking/PYHPEIMC
pyhpeimc/plat/system.py
get_ssh_template
def get_ssh_template(auth, url, template_name=None): """ Takes no input, or template_name as input 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 ...
python
def get_ssh_template(auth, url, template_name=None): """ Takes no input, or template_name as input 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 ...
[ "def", "get_ssh_template", "(", "auth", ",", "url", ",", "template_name", "=", "None", ")", ":", "f_url", "=", "url", "+", "\"/imcrs/plat/res/ssh?start=0&size=10000&desc=false&total=false\"", "response", "=", "requests", ".", "get", "(", "f_url", ",", "auth", "=",...
Takes no input, or template_name as input 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 template_name: str value of template name :retur...
[ "Takes", "no", "input", "or", "template_name", "as", "input", "to", "issue", "RESTUL", "call", "to", "HP", "IMC" ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L357-L394
train
HPENetworking/PYHPEIMC
pyhpeimc/plat/system.py
modify_ssh_template
def modify_ssh_template(auth, url, ssh_template, template_name= None, template_id = None): """ Function takes input of a dictionry containing the required key/value pair for the modification of a ssh template. :param auth: :param url: :param ssh_template: Human readable label which is the name ...
python
def modify_ssh_template(auth, url, ssh_template, template_name= None, template_id = None): """ Function takes input of a dictionry containing the required key/value pair for the modification of a ssh template. :param auth: :param url: :param ssh_template: Human readable label which is the name ...
[ "def", "modify_ssh_template", "(", "auth", ",", "url", ",", "ssh_template", ",", "template_name", "=", "None", ",", "template_id", "=", "None", ")", ":", "if", "template_name", "is", "None", ":", "template_name", "=", "ssh_template", "[", "'name'", "]", "if"...
Function takes input of a dictionry containing the required key/value pair for the modification of a ssh template. :param auth: :param url: :param ssh_template: Human readable label which is the name of the specific ssh template :param template_id Internal IMC number which designates the specific s...
[ "Function", "takes", "input", "of", "a", "dictionry", "containing", "the", "required", "key", "/", "value", "pair", "for", "the", "modification", "of", "a", "ssh", "template", "." ]
4fba31827573587e03a6233c7db60f188038c8e5
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L397-L439
train