repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
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", "." ]
train
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1658-L1805
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", "." ]
train
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1808-L1936
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", "." ]
train
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1939-L2159
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", "." ]
train
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L2162-L2204
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", "." ]
train
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L909-L1027
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" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/wsm/acinfo.py#L15-L76
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"...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L118-L127
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", ...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L129-L137
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", ":" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L139-L144
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", ":" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L181-L189
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", ":" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L191-L199
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...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L223-L232
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" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L234-L241
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", ":" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L243-L249
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", ":" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L251-L262
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...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L264-L274
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" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L201-L239
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", "." ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L242-L284
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" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L287-L317
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", "." ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L322-L355
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" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L357-L394
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", "." ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L397-L439
HPENetworking/PYHPEIMC
pyhpeimc/plat/system.py
delete_ssh_template
def delete_ssh_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 ssh template from the IMC system :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url...
python
def delete_ssh_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 ssh template from the IMC system :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url...
[ "def", "delete_ssh_template", "(", "auth", ",", "url", ",", "template_name", "=", "None", ",", "template_id", "=", "None", ")", ":", "try", ":", "if", "template_id", "is", "None", ":", "ssh_templates", "=", "get_ssh_template", "(", "auth", ",", "url", ")",...
Takes template_name as input to issue RESTUL call to HP IMC which will delete the specific ssh 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 :para...
[ "Takes", "template_name", "as", "input", "to", "issue", "RESTUL", "call", "to", "HP", "IMC", "which", "will", "delete", "the", "specific", "ssh", "template", "from", "the", "IMC", "system" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L442-L472
HPENetworking/PYHPEIMC
pyhpeimc/plat/system.py
get_snmp_templates
def get_snmp_templates(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.authclas...
python
def get_snmp_templates(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.authclas...
[ "def", "get_snmp_templates", "(", "auth", ",", "url", ",", "template_name", "=", "None", ")", ":", "f_url", "=", "url", "+", "\"/imcrs/plat/res/snmp?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" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L530-L566
HPENetworking/PYHPEIMC
pyhpeimc/plat/system.py
modify_snmp_template
def modify_snmp_template(auth, url, snmp_template, template_name= None, template_id = None): """ Function takes input of a dictionry containing the required key/value pair for the modification of a snmp template. :param auth: :param url: :param ssh_template: Human readable label which is the na...
python
def modify_snmp_template(auth, url, snmp_template, template_name= None, template_id = None): """ Function takes input of a dictionry containing the required key/value pair for the modification of a snmp template. :param auth: :param url: :param ssh_template: Human readable label which is the na...
[ "def", "modify_snmp_template", "(", "auth", ",", "url", ",", "snmp_template", ",", "template_name", "=", "None", ",", "template_id", "=", "None", ")", ":", "if", "template_name", "is", "None", ":", "template_name", "=", "snmp_template", "[", "'name'", "]", "...
Function takes input of a dictionry containing the required key/value pair for the modification of a snmp 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 ...
[ "Function", "takes", "input", "of", "a", "dictionry", "containing", "the", "required", "key", "/", "value", "pair", "for", "the", "modification", "of", "a", "snmp", "template", "." ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L569-L619
HPENetworking/PYHPEIMC
pyhpeimc/plat/system.py
delete_snmp_template
def delete_snmp_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 snmp template from the IMC system :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param u...
python
def delete_snmp_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 snmp template from the IMC system :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param u...
[ "def", "delete_snmp_template", "(", "auth", ",", "url", ",", "template_name", "=", "None", ",", "template_id", "=", "None", ")", ":", "try", ":", "if", "template_id", "is", "None", ":", "snmp_templates", "=", "get_snmp_templates", "(", "auth", ",", "url", ...
Takes template_name as input to issue RESTUL call to HP IMC which will delete the specific snmp 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 :par...
[ "Takes", "template_name", "as", "input", "to", "issue", "RESTUL", "call", "to", "HP", "IMC", "which", "will", "delete", "the", "specific", "snmp", "template", "from", "the", "IMC", "system" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L622-L652
HPENetworking/PYHPEIMC
pyhpeimc/plat/netassets.py
get_dev_asset_details
def get_dev_asset_details(ipaddress, auth, url): """Takes in ipaddress as input to fetch device assett details from HP IMC RESTFUL API :param ipaddress: IP address of the device you wish to gather the asset details :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :p...
python
def get_dev_asset_details(ipaddress, auth, url): """Takes in ipaddress as input to fetch device assett details from HP IMC RESTFUL API :param ipaddress: IP address of the device you wish to gather the asset details :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :p...
[ "def", "get_dev_asset_details", "(", "ipaddress", ",", "auth", ",", "url", ")", ":", "ipaddress", "=", "get_dev_details", "(", "ipaddress", ",", "auth", ",", "url", ")", "if", "isinstance", "(", "ipaddress", ",", "dict", ")", ":", "ipaddress", "=", "ipaddr...
Takes in ipaddress as input to fetch device assett details from HP IMC RESTFUL API :param ipaddress: IP address of the device you wish to gather the asset details :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url...
[ "Takes", "in", "ipaddress", "as", "input", "to", "fetch", "device", "assett", "details", "from", "HP", "IMC", "RESTFUL", "API" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/netassets.py#L21-L68
HPENetworking/PYHPEIMC
pyhpeimc/plat/netassets.py
get_dev_asset_details_all
def get_dev_asset_details_all(auth, url): """Takes no input to fetch device assett details from HP IMC RESTFUL API :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :return: list ...
python
def get_dev_asset_details_all(auth, url): """Takes no input to fetch device assett details from HP IMC RESTFUL API :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :return: list ...
[ "def", "get_dev_asset_details_all", "(", "auth", ",", "url", ")", ":", "f_url", "=", "url", "+", "\"/imcrs/netasset/asset?start=0&size=15000\"", "response", "=", "requests", ".", "get", "(", "f_url", ",", "auth", "=", "auth", ",", "headers", "=", "HEADERS", ")...
Takes no input to fetch device assett details from HP IMC RESTFUL API :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :return: list of dictionatires containing the device asset deta...
[ "Takes", "no", "input", "to", "fetch", "device", "assett", "details", "from", "HP", "IMC", "RESTFUL", "API" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/netassets.py#L71-L102
lablup/backend.ai-client-py
src/ai/backend/client/cli/proxy.py
proxy
def proxy(ctx, bind, port): """ Run a non-encrypted non-authorized API proxy server. Use this only for development and testing! """ app = web.Application() app.on_startup.append(startup_proxy) app.on_cleanup.append(cleanup_proxy) app.router.add_route("GET", r'/stream/{path:.*$}', websoc...
python
def proxy(ctx, bind, port): """ Run a non-encrypted non-authorized API proxy server. Use this only for development and testing! """ app = web.Application() app.on_startup.append(startup_proxy) app.on_cleanup.append(cleanup_proxy) app.router.add_route("GET", r'/stream/{path:.*$}', websoc...
[ "def", "proxy", "(", "ctx", ",", "bind", ",", "port", ")", ":", "app", "=", "web", ".", "Application", "(", ")", "app", ".", "on_startup", ".", "append", "(", "startup_proxy", ")", "app", ".", "on_cleanup", ".", "append", "(", "cleanup_proxy", ")", "...
Run a non-encrypted non-authorized API proxy server. Use this only for development and testing!
[ "Run", "a", "non", "-", "encrypted", "non", "-", "authorized", "API", "proxy", "server", ".", "Use", "this", "only", "for", "development", "and", "testing!" ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/proxy.py#L194-L208
HPENetworking/PYHPEIMC
pyhpeimc/plat/device.py
get_all_devs
def get_all_devs(auth, url, network_address=None, category=None, label=None): """Takes string input of IP address to issue RESTUL call to HP IMC\n :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.aut...
python
def get_all_devs(auth, url, network_address=None, category=None, label=None): """Takes string input of IP address to issue RESTUL call to HP IMC\n :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.aut...
[ "def", "get_all_devs", "(", "auth", ",", "url", ",", "network_address", "=", "None", ",", "category", "=", "None", ",", "label", "=", "None", ")", ":", "base_url", "=", "\"/imcrs/plat/res/device?resPrivilegeFilter=false\"", "end_url", "=", "\"&start=0&size=1000&orde...
Takes string input of IP address to issue RESTUL call to HP IMC\n :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :param network_address: str IPv4 Network Address :param category:...
[ "Takes", "string", "input", "of", "IP", "address", "to", "issue", "RESTUL", "call", "to", "HP", "IMC", "\\", "n" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L174-L225
HPENetworking/PYHPEIMC
pyhpeimc/plat/device.py
get_dev_details
def get_dev_details(ip_address, auth, url): """Takes string input of IP address to issue RESTUL call to HP IMC :param ip_address: string object of dotted decimal notation of IPv4 address :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS...
python
def get_dev_details(ip_address, auth, url): """Takes string input of IP address to issue RESTUL call to HP IMC :param ip_address: string object of dotted decimal notation of IPv4 address :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS...
[ "def", "get_dev_details", "(", "ip_address", ",", "auth", ",", "url", ")", ":", "get_dev_details_url", "=", "\"/imcrs/plat/res/device?resPrivilegeFilter=false&ip=\"", "+", "str", "(", "ip_address", ")", "+", "\"&start=0&size=1000&orderBy=id&desc=false&total=false\"", "f_url",...
Takes string input of IP address to issue RESTUL call to HP IMC :param ip_address: string object of dotted decimal notation of IPv4 address :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.aut...
[ "Takes", "string", "input", "of", "IP", "address", "to", "issue", "RESTUL", "call", "to", "HP", "IMC" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L228-L277
HPENetworking/PYHPEIMC
pyhpeimc/plat/device.py
get_dev_interface
def get_dev_interface(auth, url, devid=None, devip=None): """ Function takes devid as input to RESTFUL call to HP IMC platform and returns list of device interfaces :param devid: optional devid as the input :param devip: str of ipv4 address of the target device :param auth: requests auth obje...
python
def get_dev_interface(auth, url, devid=None, devip=None): """ Function takes devid as input to RESTFUL call to HP IMC platform and returns list of device interfaces :param devid: optional devid as the input :param devip: str of ipv4 address of the target device :param auth: requests auth obje...
[ "def", "get_dev_interface", "(", "auth", ",", "url", ",", "devid", "=", "None", ",", "devip", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devip", ",", "auth", ",", "url", ")", "[", "'id'", ...
Function takes devid as input to RESTFUL call to HP IMC platform and returns list of device interfaces :param devid: optional devid as the input :param devip: str of ipv4 address of the target device :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: ...
[ "Function", "takes", "devid", "as", "input", "to", "RESTFUL", "call", "to", "HP", "IMC", "platform", "and", "returns", "list", "of", "device", "interfaces" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L280-L327
HPENetworking/PYHPEIMC
pyhpeimc/plat/device.py
get_dev_mac_learn
def get_dev_mac_learn(auth, url, devid=None, devip=None): """ function takes devid of specific device and issues a RESTFUL call to gather the current IP-MAC learning entries on the target device. :param devid: int value of the target device :param devip: ipv4 address of the target device :pa...
python
def get_dev_mac_learn(auth, url, devid=None, devip=None): """ function takes devid of specific device and issues a RESTFUL call to gather the current IP-MAC learning entries on the target device. :param devid: int value of the target device :param devip: ipv4 address of the target device :pa...
[ "def", "get_dev_mac_learn", "(", "auth", ",", "url", ",", "devid", "=", "None", ",", "devip", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devip", ",", "auth", ",", "url", ")", "[", "'id'", ...
function takes devid of specific device and issues a RESTFUL call to gather the current IP-MAC learning entries on the target device. :param devid: int value of the target device :param devip: ipv4 address of the target device :param auth: requests auth object #usually auth.creds from auth pyhpeimc....
[ "function", "takes", "devid", "of", "specific", "device", "and", "issues", "a", "RESTFUL", "call", "to", "gather", "the", "current", "IP", "-", "MAC", "learning", "entries", "on", "the", "target", "device", "." ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L518-L565
HPENetworking/PYHPEIMC
pyhpeimc/plat/device.py
run_dev_cmd
def run_dev_cmd(cmd_list, auth, url, devid=None, devip=None): """ Function takes devid of target device and a sequential list of strings which define the specific commands to be run on the target device and returns a str object containing the output of the commands. :param devid: int devid of the t...
python
def run_dev_cmd(cmd_list, auth, url, devid=None, devip=None): """ Function takes devid of target device and a sequential list of strings which define the specific commands to be run on the target device and returns a str object containing the output of the commands. :param devid: int devid of the t...
[ "def", "run_dev_cmd", "(", "cmd_list", ",", "auth", ",", "url", ",", "devid", "=", "None", ",", "devip", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devip", ",", "auth", ",", "url", ")", "[...
Function takes devid of target device and a sequential list of strings which define the specific commands to be run on the target device and returns a str object containing the output of the commands. :param devid: int devid of the target device :param cmd_list: list of strings :param auth: reque...
[ "Function", "takes", "devid", "of", "target", "device", "and", "a", "sequential", "list", "of", "strings", "which", "define", "the", "specific", "commands", "to", "be", "run", "on", "the", "target", "device", "and", "returns", "a", "str", "object", "containi...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L568-L623
HPENetworking/PYHPEIMC
pyhpeimc/plat/device.py
get_all_interface_details
def get_all_interface_details(auth, url, devid=None, devip=None): """ function takes the devId of a specific device and the ifindex value assigned to a specific interface and issues a RESTFUL call to get the interface details file as known by the HP IMC Base Platform ICC module for the target device. ...
python
def get_all_interface_details(auth, url, devid=None, devip=None): """ function takes the devId of a specific device and the ifindex value assigned to a specific interface and issues a RESTFUL call to get the interface details file as known by the HP IMC Base Platform ICC module for the target device. ...
[ "def", "get_all_interface_details", "(", "auth", ",", "url", ",", "devid", "=", "None", ",", "devip", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devip", ",", "auth", ",", "url", ")", "[", "'...
function takes the devId of a specific device and the ifindex value assigned to a specific interface and issues a RESTFUL call to get the interface details file as known by the HP IMC Base Platform ICC module for the target device. :param auth: requests auth object #usually auth.creds from auth pyhpeimc.au...
[ "function", "takes", "the", "devId", "of", "a", "specific", "device", "and", "the", "ifindex", "value", "assigned", "to", "a", "specific", "interface", "and", "issues", "a", "RESTFUL", "call", "to", "get", "the", "interface", "details", "file", "as", "known"...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L629-L674
HPENetworking/PYHPEIMC
pyhpeimc/plat/device.py
set_interface_down
def set_interface_down(ifindex, auth, url, devid=None, devip=None): """ function takest devid and ifindex of specific device and interface and issues a RESTFUL call to " shut" the specified interface on the target device. :param devid: int or str value of the target device :param devip: ipv4 addres...
python
def set_interface_down(ifindex, auth, url, devid=None, devip=None): """ function takest devid and ifindex of specific device and interface and issues a RESTFUL call to " shut" the specified interface on the target device. :param devid: int or str value of the target device :param devip: ipv4 addres...
[ "def", "set_interface_down", "(", "ifindex", ",", "auth", ",", "url", ",", "devid", "=", "None", ",", "devip", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devip", ",", "auth", ",", "url", ")"...
function takest devid and ifindex of specific device and interface and issues a RESTFUL call to " shut" the specified interface on the target device. :param devid: int or str value of the target device :param devip: ipv4 address of the target devices :param ifindex: int or str value of the target inte...
[ "function", "takest", "devid", "and", "ifindex", "of", "specific", "device", "and", "interface", "and", "issues", "a", "RESTFUL", "call", "to", "shut", "the", "specified", "interface", "on", "the", "target", "device", ".", ":", "param", "devid", ":", "int", ...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L726-L777
HPENetworking/PYHPEIMC
pyhpeimc/plat/device.py
set_inteface_up
def set_inteface_up(ifindex, auth, url, devid=None, devip=None): """ function takest devid and ifindex of specific device and interface and issues a RESTFUL call to "undo shut" the specified interface on the target device. :param devid: int or str value of the target device :param devip: ipv4 addr...
python
def set_inteface_up(ifindex, auth, url, devid=None, devip=None): """ function takest devid and ifindex of specific device and interface and issues a RESTFUL call to "undo shut" the specified interface on the target device. :param devid: int or str value of the target device :param devip: ipv4 addr...
[ "def", "set_inteface_up", "(", "ifindex", ",", "auth", ",", "url", ",", "devid", "=", "None", ",", "devip", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devip", ",", "auth", ",", "url", ")", ...
function takest devid and ifindex of specific device and interface and issues a RESTFUL call to "undo shut" the specified interface on the target device. :param devid: int or str value of the target device :param devip: ipv4 address of the target devices :param ifindex: int or str value of the target...
[ "function", "takest", "devid", "and", "ifindex", "of", "specific", "device", "and", "interface", "and", "issues", "a", "RESTFUL", "call", "to", "undo", "shut", "the", "specified", "interface", "on", "the", "target", "device", "." ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L780-L829
HPENetworking/PYHPEIMC
pyhpeimc/plat/device.py
_make_cmd_list
def _make_cmd_list(cmd_list): """ Helper function to easily create the proper json formated string from a list of strs :param cmd_list: list of strings :return: str json formatted """ cmd = '' for i in cmd_list: cmd = cmd + '"' + i + '",' cmd = cmd[:-1] return cmd
python
def _make_cmd_list(cmd_list): """ Helper function to easily create the proper json formated string from a list of strs :param cmd_list: list of strings :return: str json formatted """ cmd = '' for i in cmd_list: cmd = cmd + '"' + i + '",' cmd = cmd[:-1] return cmd
[ "def", "_make_cmd_list", "(", "cmd_list", ")", ":", "cmd", "=", "''", "for", "i", "in", "cmd_list", ":", "cmd", "=", "cmd", "+", "'\"'", "+", "i", "+", "'\",'", "cmd", "=", "cmd", "[", ":", "-", "1", "]", "return", "cmd" ]
Helper function to easily create the proper json formated string from a list of strs :param cmd_list: list of strings :return: str json formatted
[ "Helper", "function", "to", "easily", "create", "the", "proper", "json", "formated", "string", "from", "a", "list", "of", "strs", ":", "param", "cmd_list", ":", "list", "of", "strings", ":", "return", ":", "str", "json", "formatted" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L884-L894
lablup/backend.ai-client-py
src/ai/backend/client/keypair.py
KeyPair.create
async def create(cls, user_id: Union[int, str], is_active: bool = True, is_admin: bool = False, resource_policy: str = None, rate_limit: int = None, fields: Iterable[str] = None) -> dict: ''' Creates...
python
async def create(cls, user_id: Union[int, str], is_active: bool = True, is_admin: bool = False, resource_policy: str = None, rate_limit: int = None, fields: Iterable[str] = None) -> dict: ''' Creates...
[ "async", "def", "create", "(", "cls", ",", "user_id", ":", "Union", "[", "int", ",", "str", "]", ",", "is_active", ":", "bool", "=", "True", ",", "is_admin", ":", "bool", "=", "False", ",", "resource_policy", ":", "str", "=", "None", ",", "rate_limit...
Creates a new keypair with the given options. You need an admin privilege for this operation.
[ "Creates", "a", "new", "keypair", "with", "the", "given", "options", ".", "You", "need", "an", "admin", "privilege", "for", "this", "operation", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/keypair.py#L24-L59
lablup/backend.ai-client-py
src/ai/backend/client/keypair.py
KeyPair.update
async def update(cls, access_key: str, is_active: bool = None, is_admin: bool = None, resource_policy: str = None, rate_limit: int = None) -> dict: """ Creates a new keypair with the given options. You need an ad...
python
async def update(cls, access_key: str, is_active: bool = None, is_admin: bool = None, resource_policy: str = None, rate_limit: int = None) -> dict: """ Creates a new keypair with the given options. You need an ad...
[ "async", "def", "update", "(", "cls", ",", "access_key", ":", "str", ",", "is_active", ":", "bool", "=", "None", ",", "is_admin", ":", "bool", "=", "None", ",", "resource_policy", ":", "str", "=", "None", ",", "rate_limit", ":", "int", "=", "None", "...
Creates a new keypair with the given options. You need an admin privilege for this operation.
[ "Creates", "a", "new", "keypair", "with", "the", "given", "options", ".", "You", "need", "an", "admin", "privilege", "for", "this", "operation", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/keypair.py#L63-L93
lablup/backend.ai-client-py
src/ai/backend/client/keypair.py
KeyPair.delete
async def delete(cls, access_key: str): """ Deletes an existing keypair with given ACCESSKEY. """ q = 'mutation($access_key: String!) {' \ ' delete_keypair(access_key: $access_key) {' \ ' ok msg' \ ' }' \ '}' variables = { ...
python
async def delete(cls, access_key: str): """ Deletes an existing keypair with given ACCESSKEY. """ q = 'mutation($access_key: String!) {' \ ' delete_keypair(access_key: $access_key) {' \ ' ok msg' \ ' }' \ '}' variables = { ...
[ "async", "def", "delete", "(", "cls", ",", "access_key", ":", "str", ")", ":", "q", "=", "'mutation($access_key: String!) {'", "' delete_keypair(access_key: $access_key) {'", "' ok msg'", "' }'", "'}'", "variables", "=", "{", "'access_key'", ":", "access_key", ",...
Deletes an existing keypair with given ACCESSKEY.
[ "Deletes", "an", "existing", "keypair", "with", "given", "ACCESSKEY", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/keypair.py#L97-L116
lablup/backend.ai-client-py
src/ai/backend/client/keypair.py
KeyPair.list
async def list(cls, user_id: Union[int, str] = None, is_active: bool = None, fields: Iterable[str] = None) -> Sequence[dict]: ''' Lists the keypairs. You need an admin privilege for this operation. ''' if fields is None: fields = ...
python
async def list(cls, user_id: Union[int, str] = None, is_active: bool = None, fields: Iterable[str] = None) -> Sequence[dict]: ''' Lists the keypairs. You need an admin privilege for this operation. ''' if fields is None: fields = ...
[ "async", "def", "list", "(", "cls", ",", "user_id", ":", "Union", "[", "int", ",", "str", "]", "=", "None", ",", "is_active", ":", "bool", "=", "None", ",", "fields", ":", "Iterable", "[", "str", "]", "=", "None", ")", "->", "Sequence", "[", "dic...
Lists the keypairs. You need an admin privilege for this operation.
[ "Lists", "the", "keypairs", ".", "You", "need", "an", "admin", "privilege", "for", "this", "operation", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/keypair.py#L120-L158
lablup/backend.ai-client-py
src/ai/backend/client/keypair.py
KeyPair.info
async def info(self, fields: Iterable[str] = None) -> dict: ''' Returns the keypair's information such as resource limits. :param fields: Additional per-agent query fields to fetch. .. versionadded:: 18.12 ''' if fields is None: fields = ( 'a...
python
async def info(self, fields: Iterable[str] = None) -> dict: ''' Returns the keypair's information such as resource limits. :param fields: Additional per-agent query fields to fetch. .. versionadded:: 18.12 ''' if fields is None: fields = ( 'a...
[ "async", "def", "info", "(", "self", ",", "fields", ":", "Iterable", "[", "str", "]", "=", "None", ")", "->", "dict", ":", "if", "fields", "is", "None", ":", "fields", "=", "(", "'access_key'", ",", "'secret_key'", ",", "'is_active'", ",", "'is_admin'"...
Returns the keypair's information such as resource limits. :param fields: Additional per-agent query fields to fetch. .. versionadded:: 18.12
[ "Returns", "the", "keypair", "s", "information", "such", "as", "resource", "limits", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/keypair.py#L161-L186
lablup/backend.ai-client-py
src/ai/backend/client/keypair.py
KeyPair.activate
async def activate(cls, access_key: str) -> dict: ''' Activates this keypair. You need an admin privilege for this operation. ''' q = 'mutation($access_key: String!, $input: ModifyKeyPairInput!) {' + \ ' modify_keypair(access_key: $access_key, props: $input) {' \ ...
python
async def activate(cls, access_key: str) -> dict: ''' Activates this keypair. You need an admin privilege for this operation. ''' q = 'mutation($access_key: String!, $input: ModifyKeyPairInput!) {' + \ ' modify_keypair(access_key: $access_key, props: $input) {' \ ...
[ "async", "def", "activate", "(", "cls", ",", "access_key", ":", "str", ")", "->", "dict", ":", "q", "=", "'mutation($access_key: String!, $input: ModifyKeyPairInput!) {'", "+", "' modify_keypair(access_key: $access_key, props: $input) {'", "' ok msg'", "' }'", "'}'", "...
Activates this keypair. You need an admin privilege for this operation.
[ "Activates", "this", "keypair", ".", "You", "need", "an", "admin", "privilege", "for", "this", "operation", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/keypair.py#L190-L216
lablup/backend.ai-client-py
src/ai/backend/client/keypair.py
KeyPair.deactivate
async def deactivate(cls, access_key: str) -> dict: ''' Deactivates this keypair. Deactivated keypairs cannot make any API requests unless activated again by an administrator. You need an admin privilege for this operation. ''' q = 'mutation($access_key: String!, ...
python
async def deactivate(cls, access_key: str) -> dict: ''' Deactivates this keypair. Deactivated keypairs cannot make any API requests unless activated again by an administrator. You need an admin privilege for this operation. ''' q = 'mutation($access_key: String!, ...
[ "async", "def", "deactivate", "(", "cls", ",", "access_key", ":", "str", ")", "->", "dict", ":", "q", "=", "'mutation($access_key: String!, $input: ModifyKeyPairInput!) {'", "+", "' modify_keypair(access_key: $access_key, props: $input) {'", "' ok msg'", "' }'", "'}'", ...
Deactivates this keypair. Deactivated keypairs cannot make any API requests unless activated again by an administrator. You need an admin privilege for this operation.
[ "Deactivates", "this", "keypair", ".", "Deactivated", "keypairs", "cannot", "make", "any", "API", "requests", "unless", "activated", "again", "by", "an", "administrator", ".", "You", "need", "an", "admin", "privilege", "for", "this", "operation", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/keypair.py#L220-L248
HPENetworking/PYHPEIMC
build/lib/pyhpimc/plat/termaccess.py
add_ip_scope
def add_ip_scope(auth, url,startIp, endIp, name, description): """ Function takes input of four strings Start Ip, endIp, name, and description to add new Ip Scope to terminal access in the HPE IMC base platform :param startIp: str Start of IP address scope ex. '10.101.0.1' :param endIp: str End of I...
python
def add_ip_scope(auth, url,startIp, endIp, name, description): """ Function takes input of four strings Start Ip, endIp, name, and description to add new Ip Scope to terminal access in the HPE IMC base platform :param startIp: str Start of IP address scope ex. '10.101.0.1' :param endIp: str End of I...
[ "def", "add_ip_scope", "(", "auth", ",", "url", ",", "startIp", ",", "endIp", ",", "name", ",", "description", ")", ":", "if", "auth", "is", "None", "or", "url", "is", "None", ":", "# checks to see if the imc credentials are already available", "set_imc_creds", ...
Function takes input of four strings Start Ip, endIp, name, and description to add new Ip Scope to terminal access in the HPE IMC base platform :param startIp: str Start of IP address scope ex. '10.101.0.1' :param endIp: str End of IP address scope ex. '10.101.0.254' :param name: str Name of the owner o...
[ "Function", "takes", "input", "of", "four", "strings", "Start", "Ip", "endIp", "name", "and", "description", "to", "add", "new", "Ip", "Scope", "to", "terminal", "access", "in", "the", "HPE", "IMC", "base", "platform", ":", "param", "startIp", ":", "str", ...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/termaccess.py#L106-L142
lablup/backend.ai-client-py
src/ai/backend/client/resource.py
Resource.check_presets
async def check_presets(cls): ''' Lists all resource presets in the current scaling group with additiona information. ''' rqst = Request(cls.session, 'POST', '/resource/check-presets') async with rqst.fetch() as resp: return await resp.json()
python
async def check_presets(cls): ''' Lists all resource presets in the current scaling group with additiona information. ''' rqst = Request(cls.session, 'POST', '/resource/check-presets') async with rqst.fetch() as resp: return await resp.json()
[ "async", "def", "check_presets", "(", "cls", ")", ":", "rqst", "=", "Request", "(", "cls", ".", "session", ",", "'POST'", ",", "'/resource/check-presets'", ")", "async", "with", "rqst", ".", "fetch", "(", ")", "as", "resp", ":", "return", "await", "resp"...
Lists all resource presets in the current scaling group with additiona information.
[ "Lists", "all", "resource", "presets", "in", "the", "current", "scaling", "group", "with", "additiona", "information", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/resource.py#L31-L38
HPENetworking/PYHPEIMC
build/lib/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 f...
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 f...
[ "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", ")", "# creates the URL using the payload va...
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 ...
[ "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...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/perf.py#L19-L54
HPENetworking/PYHPEIMC
build/lib/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", "# creates the URL using the payloa...
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" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/perf.py#L56-L92
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/vrm.py
get_vm_host_info
def get_vm_host_info(hostip, auth, url): """ function takes hostId as input to RESTFUL call to HP IMC :param hostip: int or string of hostip of Hypervisor host :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually aut...
python
def get_vm_host_info(hostip, auth, url): """ function takes hostId as input to RESTFUL call to HP IMC :param hostip: int or string of hostip of Hypervisor host :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually aut...
[ "def", "get_vm_host_info", "(", "hostip", ",", "auth", ",", "url", ")", ":", "hostId", "=", "get_dev_details", "(", "hostip", ",", "auth", ",", "url", ")", "[", "'id'", "]", "get_vm_host_info_url", "=", "\"/imcrs/vrm/host?hostId=\"", "+", "str", "(", "hostId...
function takes hostId as input to RESTFUL call to HP IMC :param hostip: int or string of hostip of Hypervisor host :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: Dict...
[ "function", "takes", "hostId", "as", "input", "to", "RESTFUL", "call", "to", "HP", "IMC" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/vrm.py#L18-L80
HPENetworking/PYHPEIMC
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", ")", ":", "f_url", "=", "url", "+", "\"/imcrs/wlan/acInfo/queryAcBasicInfo\"", "response", "=", "requests", ".", "get", "(", "f_url", ",", "auth", "=", "auth", ",", "headers", "=", "HEADERS", ")", "try", "...
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" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/wsm/acinfo.py#L18-L50
HPENetworking/PYHPEIMC
build/lib/pyhpimc/auth.py
set_imc_creds
def set_imc_creds(h_url=None, imc_server=None, imc_port=None, imc_user=None,imc_pw=None): """ This function prompts user for IMC server information and credentuials and stores values in url and auth global variables""" global auth, url if h_url is None: imc_protocol = input( "What protoc...
python
def set_imc_creds(h_url=None, imc_server=None, imc_port=None, imc_user=None,imc_pw=None): """ This function prompts user for IMC server information and credentuials and stores values in url and auth global variables""" global auth, url if h_url is None: imc_protocol = input( "What protoc...
[ "def", "set_imc_creds", "(", "h_url", "=", "None", ",", "imc_server", "=", "None", ",", "imc_port", "=", "None", ",", "imc_user", "=", "None", ",", "imc_pw", "=", "None", ")", ":", "global", "auth", ",", "url", "if", "h_url", "is", "None", ":", "imc_...
This function prompts user for IMC server information and credentuials and stores values in url and auth global variables
[ "This", "function", "prompts", "user", "for", "IMC", "server", "information", "and", "credentuials", "and", "stores", "values", "in", "url", "and", "auth", "global", "variables" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/auth.py#L78-L110
HPENetworking/PYHPEIMC
build/lib/pyhpimc/auth.py
print_to_file
def print_to_file(object): """ 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 ...
python
def print_to_file(object): """ 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 ...
[ "def", "print_to_file", "(", "object", ")", ":", "with", "open", "(", "'pyoutput.txt'", ",", "'w'", ")", "as", "fh", ":", "x", "=", "None", "if", "type", "(", "object", ")", "is", "list", ":", "x", "=", "json", ".", "dumps", "(", "object", ",", "...
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", ...
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/auth.py#L119-L133
HPENetworking/PYHPEIMC
build/lib/pyhpimc/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) auth_url...
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) auth_url...
[ "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", ":" ]
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/auth.py#L55-L73
mozilla-services/python-dockerflow
src/dockerflow/version.py
get_version
def get_version(root): """ Load and return the contents of version.json. :param root: The root path that the ``version.json`` file will be opened :type root: str :returns: Content of ``version.json`` or None :rtype: dict or None """ version_json = os.path.join(root, 'version.json') ...
python
def get_version(root): """ Load and return the contents of version.json. :param root: The root path that the ``version.json`` file will be opened :type root: str :returns: Content of ``version.json`` or None :rtype: dict or None """ version_json = os.path.join(root, 'version.json') ...
[ "def", "get_version", "(", "root", ")", ":", "version_json", "=", "os", ".", "path", ".", "join", "(", "root", ",", "'version.json'", ")", "if", "os", ".", "path", ".", "exists", "(", "version_json", ")", ":", "with", "open", "(", "version_json", ",", ...
Load and return the contents of version.json. :param root: The root path that the ``version.json`` file will be opened :type root: str :returns: Content of ``version.json`` or None :rtype: dict or None
[ "Load", "and", "return", "the", "contents", "of", "version", ".", "json", "." ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/version.py#L10-L23
housecanary/hc-api-python
housecanary/apiclient.py
ApiClient.fetch
def fetch(self, endpoint_name, identifier_input, query_params=None): """Calls this instance's request_client's post method with the specified component endpoint Args: - endpoint_name (str) - The endpoint to call like "property/value". - identifier_input - One or more ide...
python
def fetch(self, endpoint_name, identifier_input, query_params=None): """Calls this instance's request_client's post method with the specified component endpoint Args: - endpoint_name (str) - The endpoint to call like "property/value". - identifier_input - One or more ide...
[ "def", "fetch", "(", "self", ",", "endpoint_name", ",", "identifier_input", ",", "query_params", "=", "None", ")", ":", "endpoint_url", "=", "constants", ".", "URL_PREFIX", "+", "\"/\"", "+", "self", ".", "_version", "+", "\"/\"", "+", "endpoint_name", "if",...
Calls this instance's request_client's post method with the specified component endpoint Args: - endpoint_name (str) - The endpoint to call like "property/value". - identifier_input - One or more identifiers to request data for. An identifier can be in one of the...
[ "Calls", "this", "instance", "s", "request_client", "s", "post", "method", "with", "the", "specified", "component", "endpoint" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/apiclient.py#L61-L117
housecanary/hc-api-python
housecanary/apiclient.py
ApiClient.fetch_synchronous
def fetch_synchronous(self, endpoint_name, query_params=None): """Calls this instance's request_client's get method with the specified component endpoint""" endpoint_url = constants.URL_PREFIX + "/" + self._version + "/" + endpoint_name if query_params is None: query_params...
python
def fetch_synchronous(self, endpoint_name, query_params=None): """Calls this instance's request_client's get method with the specified component endpoint""" endpoint_url = constants.URL_PREFIX + "/" + self._version + "/" + endpoint_name if query_params is None: query_params...
[ "def", "fetch_synchronous", "(", "self", ",", "endpoint_name", ",", "query_params", "=", "None", ")", ":", "endpoint_url", "=", "constants", ".", "URL_PREFIX", "+", "\"/\"", "+", "self", ".", "_version", "+", "\"/\"", "+", "endpoint_name", "if", "query_params"...
Calls this instance's request_client's get method with the specified component endpoint
[ "Calls", "this", "instance", "s", "request_client", "s", "get", "method", "with", "the", "specified", "component", "endpoint" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/apiclient.py#L119-L128
housecanary/hc-api-python
housecanary/apiclient.py
ComponentWrapper.get_identifier_input
def get_identifier_input(self, identifier_data): """Convert the various formats of input identifier_data into the proper json format expected by the ApiClient fetch method, which is a list of dicts.""" identifier_input = [] if isinstance(identifier_data, list) and len(identifie...
python
def get_identifier_input(self, identifier_data): """Convert the various formats of input identifier_data into the proper json format expected by the ApiClient fetch method, which is a list of dicts.""" identifier_input = [] if isinstance(identifier_data, list) and len(identifie...
[ "def", "get_identifier_input", "(", "self", ",", "identifier_data", ")", ":", "identifier_input", "=", "[", "]", "if", "isinstance", "(", "identifier_data", ",", "list", ")", "and", "len", "(", "identifier_data", ")", ">", "0", ":", "# if list, convert each item...
Convert the various formats of input identifier_data into the proper json format expected by the ApiClient fetch method, which is a list of dicts.
[ "Convert", "the", "various", "formats", "of", "input", "identifier_data", "into", "the", "proper", "json", "format", "expected", "by", "the", "ApiClient", "fetch", "method", "which", "is", "a", "list", "of", "dicts", "." ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/apiclient.py#L143-L157
housecanary/hc-api-python
housecanary/apiclient.py
ComponentWrapper.fetch_identifier_component
def fetch_identifier_component(self, endpoint_name, identifier_data, query_params=None): """Common method for handling parameters before passing to api_client""" if query_params is None: query_params = {} identifier_input = self.get_identifier_input(identifier_data) return...
python
def fetch_identifier_component(self, endpoint_name, identifier_data, query_params=None): """Common method for handling parameters before passing to api_client""" if query_params is None: query_params = {} identifier_input = self.get_identifier_input(identifier_data) return...
[ "def", "fetch_identifier_component", "(", "self", ",", "endpoint_name", ",", "identifier_data", ",", "query_params", "=", "None", ")", ":", "if", "query_params", "is", "None", ":", "query_params", "=", "{", "}", "identifier_input", "=", "self", ".", "get_identif...
Common method for handling parameters before passing to api_client
[ "Common", "method", "for", "handling", "parameters", "before", "passing", "to", "api_client" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/apiclient.py#L159-L167
housecanary/hc-api-python
housecanary/apiclient.py
PropertyComponentWrapper._convert_to_identifier_json
def _convert_to_identifier_json(self, address_data): """Convert input address data into json format""" if isinstance(address_data, str): # allow just passing a slug string. return {"slug": address_data} if isinstance(address_data, tuple) and len(address_data) > 0: ...
python
def _convert_to_identifier_json(self, address_data): """Convert input address data into json format""" if isinstance(address_data, str): # allow just passing a slug string. return {"slug": address_data} if isinstance(address_data, tuple) and len(address_data) > 0: ...
[ "def", "_convert_to_identifier_json", "(", "self", ",", "address_data", ")", ":", "if", "isinstance", "(", "address_data", ",", "str", ")", ":", "# allow just passing a slug string.", "return", "{", "\"slug\"", ":", "address_data", "}", "if", "isinstance", "(", "a...
Convert input address data into json format
[ "Convert", "input", "address", "data", "into", "json", "format" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/apiclient.py#L218-L250
housecanary/hc-api-python
housecanary/apiclient.py
PropertyComponentWrapper.value_report
def value_report(self, address, zipcode, report_type="full", format_type="json"): """Call the value_report component Value Report only supports a single address. Args: - address - zipcode Kwargs: - report_type - "full" or "summary". Default is "full...
python
def value_report(self, address, zipcode, report_type="full", format_type="json"): """Call the value_report component Value Report only supports a single address. Args: - address - zipcode Kwargs: - report_type - "full" or "summary". Default is "full...
[ "def", "value_report", "(", "self", ",", "address", ",", "zipcode", ",", "report_type", "=", "\"full\"", ",", "format_type", "=", "\"json\"", ")", ":", "query_params", "=", "{", "\"report_type\"", ":", "report_type", ",", "\"format\"", ":", "format_type", ",",...
Call the value_report component Value Report only supports a single address. Args: - address - zipcode Kwargs: - report_type - "full" or "summary". Default is "full". - format_type - "json", "pdf", "xlsx" or "all". Default is "json".
[ "Call", "the", "value_report", "component" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/apiclient.py#L413-L433
housecanary/hc-api-python
housecanary/apiclient.py
PropertyComponentWrapper.rental_report
def rental_report(self, address, zipcode, format_type="json"): """Call the rental_report component Rental Report only supports a single address. Args: - address - zipcode Kwargs: - format_type - "json", "xlsx" or "all". Default is "json". ""...
python
def rental_report(self, address, zipcode, format_type="json"): """Call the rental_report component Rental Report only supports a single address. Args: - address - zipcode Kwargs: - format_type - "json", "xlsx" or "all". Default is "json". ""...
[ "def", "rental_report", "(", "self", ",", "address", ",", "zipcode", ",", "format_type", "=", "\"json\"", ")", ":", "# only json is supported by rental report.", "query_params", "=", "{", "\"format\"", ":", "format_type", ",", "\"address\"", ":", "address", ",", "...
Call the rental_report component Rental Report only supports a single address. Args: - address - zipcode Kwargs: - format_type - "json", "xlsx" or "all". Default is "json".
[ "Call", "the", "rental_report", "component" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/apiclient.py#L435-L455
housecanary/hc-api-python
housecanary/apiclient.py
ZipComponentWrapper.component_mget
def component_mget(self, zip_data, components): """Call the zip component_mget endpoint Args: - zip_data - As described in the class docstring. - components - A list of strings for each component to include in the request. Example: ["zip/details", "zip/volatility...
python
def component_mget(self, zip_data, components): """Call the zip component_mget endpoint Args: - zip_data - As described in the class docstring. - components - A list of strings for each component to include in the request. Example: ["zip/details", "zip/volatility...
[ "def", "component_mget", "(", "self", ",", "zip_data", ",", "components", ")", ":", "if", "not", "isinstance", "(", "components", ",", "list", ")", ":", "print", "(", "\"Components param must be a list\"", ")", "return", "query_params", "=", "{", "\"components\"...
Call the zip component_mget endpoint Args: - zip_data - As described in the class docstring. - components - A list of strings for each component to include in the request. Example: ["zip/details", "zip/volatility"]
[ "Call", "the", "zip", "component_mget", "endpoint" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/apiclient.py#L645-L660
mozilla-services/python-dockerflow
src/dockerflow/django/views.py
version
def version(request): """ Returns the contents of version.json or a 404. """ version_json = import_string(version_callback)(settings.BASE_DIR) if version_json is None: return HttpResponseNotFound('version.json not found') else: return JsonResponse(version_json)
python
def version(request): """ Returns the contents of version.json or a 404. """ version_json = import_string(version_callback)(settings.BASE_DIR) if version_json is None: return HttpResponseNotFound('version.json not found') else: return JsonResponse(version_json)
[ "def", "version", "(", "request", ")", ":", "version_json", "=", "import_string", "(", "version_callback", ")", "(", "settings", ".", "BASE_DIR", ")", "if", "version_json", "is", "None", ":", "return", "HttpResponseNotFound", "(", "'version.json not found'", ")", ...
Returns the contents of version.json or a 404.
[ "Returns", "the", "contents", "of", "version", ".", "json", "or", "a", "404", "." ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/django/views.py#L20-L28
mozilla-services/python-dockerflow
src/dockerflow/django/views.py
heartbeat
def heartbeat(request): """ Runs all the Django checks and returns a JsonResponse with either a status code of 200 or 500 depending on the results of the checks. Any check that returns a warning or worse (error, critical) will return a 500 response. """ all_checks = checks.registry.registry...
python
def heartbeat(request): """ Runs all the Django checks and returns a JsonResponse with either a status code of 200 or 500 depending on the results of the checks. Any check that returns a warning or worse (error, critical) will return a 500 response. """ all_checks = checks.registry.registry...
[ "def", "heartbeat", "(", "request", ")", ":", "all_checks", "=", "checks", ".", "registry", ".", "registry", ".", "get_checks", "(", "include_deployment_checks", "=", "not", "settings", ".", "DEBUG", ",", ")", "details", "=", "{", "}", "statuses", "=", "{"...
Runs all the Django checks and returns a JsonResponse with either a status code of 200 or 500 depending on the results of the checks. Any check that returns a warning or worse (error, critical) will return a 500 response.
[ "Runs", "all", "the", "Django", "checks", "and", "returns", "a", "JsonResponse", "with", "either", "a", "status", "code", "of", "200", "or", "500", "depending", "on", "the", "results", "of", "the", "checks", "." ]
train
https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/django/views.py#L40-L75
housecanary/hc-api-python
housecanary/object.py
_create_component_results
def _create_component_results(json_data, result_key): """ Returns a list of ComponentResult from the json_data""" component_results = [] for key, value in list(json_data.items()): if key not in [result_key, "meta"]: component_result = ComponentResult( key, ...
python
def _create_component_results(json_data, result_key): """ Returns a list of ComponentResult from the json_data""" component_results = [] for key, value in list(json_data.items()): if key not in [result_key, "meta"]: component_result = ComponentResult( key, ...
[ "def", "_create_component_results", "(", "json_data", ",", "result_key", ")", ":", "component_results", "=", "[", "]", "for", "key", ",", "value", "in", "list", "(", "json_data", ".", "items", "(", ")", ")", ":", "if", "key", "not", "in", "[", "result_ke...
Returns a list of ComponentResult from the json_data
[ "Returns", "a", "list", "of", "ComponentResult", "from", "the", "json_data" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/object.py#L13-L27
housecanary/hc-api-python
housecanary/object.py
HouseCanaryObject.has_error
def has_error(self): """Returns whether there was a business logic error when fetching data for any components for this property. Returns: boolean """ return next( (True for cr in self.component_results if cr.has_error()), False ...
python
def has_error(self): """Returns whether there was a business logic error when fetching data for any components for this property. Returns: boolean """ return next( (True for cr in self.component_results if cr.has_error()), False ...
[ "def", "has_error", "(", "self", ")", ":", "return", "next", "(", "(", "True", "for", "cr", "in", "self", ".", "component_results", "if", "cr", ".", "has_error", "(", ")", ")", ",", "False", ")" ]
Returns whether there was a business logic error when fetching data for any components for this property. Returns: boolean
[ "Returns", "whether", "there", "was", "a", "business", "logic", "error", "when", "fetching", "data", "for", "any", "components", "for", "this", "property", "." ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/object.py#L42-L53
housecanary/hc-api-python
housecanary/object.py
HouseCanaryObject.get_errors
def get_errors(self): """If there were any business errors fetching data for this property, returns the error messages. Returns: string - the error message, or None if there was no error. """ return [{cr.component_name: cr.get_error()} for cr in self...
python
def get_errors(self): """If there were any business errors fetching data for this property, returns the error messages. Returns: string - the error message, or None if there was no error. """ return [{cr.component_name: cr.get_error()} for cr in self...
[ "def", "get_errors", "(", "self", ")", ":", "return", "[", "{", "cr", ".", "component_name", ":", "cr", ".", "get_error", "(", ")", "}", "for", "cr", "in", "self", ".", "component_results", "if", "cr", ".", "has_error", "(", ")", "]" ]
If there were any business errors fetching data for this property, returns the error messages. Returns: string - the error message, or None if there was no error.
[ "If", "there", "were", "any", "business", "errors", "fetching", "data", "for", "this", "property", "returns", "the", "error", "messages", "." ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/object.py#L55-L64
housecanary/hc-api-python
housecanary/object.py
Property.create_from_json
def create_from_json(cls, json_data): """Deserialize property json data into a Property object Args: json_data (dict): The json data for this property Returns: Property object """ prop = Property() address_info = json_data["address_info"] ...
python
def create_from_json(cls, json_data): """Deserialize property json data into a Property object Args: json_data (dict): The json data for this property Returns: Property object """ prop = Property() address_info = json_data["address_info"] ...
[ "def", "create_from_json", "(", "cls", ",", "json_data", ")", ":", "prop", "=", "Property", "(", ")", "address_info", "=", "json_data", "[", "\"address_info\"", "]", "prop", ".", "address", "=", "address_info", "[", "\"address\"", "]", "prop", ".", "block_id...
Deserialize property json data into a Property object Args: json_data (dict): The json data for this property Returns: Property object
[ "Deserialize", "property", "json", "data", "into", "a", "Property", "object" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/object.py#L102-L134
housecanary/hc-api-python
housecanary/object.py
Block.create_from_json
def create_from_json(cls, json_data): """Deserialize block json data into a Block object Args: json_data (dict): The json data for this block Returns: Block object """ block = Block() block_info = json_data["block_info"] block.block_id =...
python
def create_from_json(cls, json_data): """Deserialize block json data into a Block object Args: json_data (dict): The json data for this block Returns: Block object """ block = Block() block_info = json_data["block_info"] block.block_id =...
[ "def", "create_from_json", "(", "cls", ",", "json_data", ")", ":", "block", "=", "Block", "(", ")", "block_info", "=", "json_data", "[", "\"block_info\"", "]", "block", ".", "block_id", "=", "block_info", "[", "\"block_id\"", "]", "block", ".", "num_bins", ...
Deserialize block json data into a Block object Args: json_data (dict): The json data for this block Returns: Block object
[ "Deserialize", "block", "json", "data", "into", "a", "Block", "object" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/object.py#L160-L179
housecanary/hc-api-python
housecanary/object.py
ZipCode.create_from_json
def create_from_json(cls, json_data): """Deserialize zipcode json data into a ZipCode object Args: json_data (dict): The json data for this zipcode Returns: Zip object """ zipcode = ZipCode() zipcode.zipcode = json_data["zipcode_info"]["zipcode"...
python
def create_from_json(cls, json_data): """Deserialize zipcode json data into a ZipCode object Args: json_data (dict): The json data for this zipcode Returns: Zip object """ zipcode = ZipCode() zipcode.zipcode = json_data["zipcode_info"]["zipcode"...
[ "def", "create_from_json", "(", "cls", ",", "json_data", ")", ":", "zipcode", "=", "ZipCode", "(", ")", "zipcode", ".", "zipcode", "=", "json_data", "[", "\"zipcode_info\"", "]", "[", "\"zipcode\"", "]", "zipcode", ".", "meta", "=", "json_data", "[", "\"me...
Deserialize zipcode json data into a ZipCode object Args: json_data (dict): The json data for this zipcode Returns: Zip object
[ "Deserialize", "zipcode", "json", "data", "into", "a", "ZipCode", "object" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/object.py#L203-L219
housecanary/hc-api-python
housecanary/object.py
Msa.create_from_json
def create_from_json(cls, json_data): """Deserialize msa json data into a Msa object Args: json_data (dict): The json data for this msa Returns: Msa object """ msa = Msa() msa.msa = json_data["msa_info"]["msa"] msa.meta = json_data["meta...
python
def create_from_json(cls, json_data): """Deserialize msa json data into a Msa object Args: json_data (dict): The json data for this msa Returns: Msa object """ msa = Msa() msa.msa = json_data["msa_info"]["msa"] msa.meta = json_data["meta...
[ "def", "create_from_json", "(", "cls", ",", "json_data", ")", ":", "msa", "=", "Msa", "(", ")", "msa", ".", "msa", "=", "json_data", "[", "\"msa_info\"", "]", "[", "\"msa\"", "]", "msa", ".", "meta", "=", "json_data", "[", "\"meta\"", "]", "if", "\"m...
Deserialize msa json data into a Msa object Args: json_data (dict): The json data for this msa Returns: Msa object
[ "Deserialize", "msa", "json", "data", "into", "a", "Msa", "object" ]
train
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/object.py#L243-L259
Tygs/ww
src/ww/tools/iterables.py
starts_when
def starts_when(iterable, condition): # type: (Iterable, Union[Callable, Any]) -> Iterable """Start yielding items when a condition arise. Args: iterable: the iterable to filter. condition: if the callable returns True once, start yielding items. If it's not a callable, i...
python
def starts_when(iterable, condition): # type: (Iterable, Union[Callable, Any]) -> Iterable """Start yielding items when a condition arise. Args: iterable: the iterable to filter. condition: if the callable returns True once, start yielding items. If it's not a callable, i...
[ "def", "starts_when", "(", "iterable", ",", "condition", ")", ":", "# type: (Iterable, Union[Callable, Any]) -> Iterable", "if", "not", "callable", "(", "condition", ")", ":", "cond_value", "=", "condition", "def", "condition", "(", "x", ")", ":", "return", "x", ...
Start yielding items when a condition arise. Args: iterable: the iterable to filter. condition: if the callable returns True once, start yielding items. If it's not a callable, it will be converted to one as `lambda condition: condition == item`. Example: ...
[ "Start", "yielding", "items", "when", "a", "condition", "arise", "." ]
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/tools/iterables.py#L49-L71
Tygs/ww
src/ww/tools/iterables.py
stops_when
def stops_when(iterable, condition): # type: (Iterable, Union[Callable, Any]) -> Iterable """Stop yielding items when a condition arise. Args: iterable: the iterable to filter. condition: if the callable returns True once, stop yielding items. If it's not a callable, it w...
python
def stops_when(iterable, condition): # type: (Iterable, Union[Callable, Any]) -> Iterable """Stop yielding items when a condition arise. Args: iterable: the iterable to filter. condition: if the callable returns True once, stop yielding items. If it's not a callable, it w...
[ "def", "stops_when", "(", "iterable", ",", "condition", ")", ":", "# type: (Iterable, Union[Callable, Any]) -> Iterable", "if", "not", "callable", "(", "condition", ")", ":", "cond_value", "=", "condition", "def", "condition", "(", "x", ")", ":", "return", "x", ...
Stop yielding items when a condition arise. Args: iterable: the iterable to filter. condition: if the callable returns True once, stop yielding items. If it's not a callable, it will be converted to one as `lambda condition: condition == item`. Example: ...
[ "Stop", "yielding", "items", "when", "a", "condition", "arise", "." ]
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/tools/iterables.py#L74-L96
Tygs/ww
src/ww/tools/iterables.py
skip_duplicates
def skip_duplicates(iterable, key=None, fingerprints=()): # type: (Iterable, Callable, Any) -> Iterable """ Returns a generator that will yield all objects from iterable, skipping duplicates. Duplicates are identified using the `key` function to calculate a unique fingerprint. T...
python
def skip_duplicates(iterable, key=None, fingerprints=()): # type: (Iterable, Callable, Any) -> Iterable """ Returns a generator that will yield all objects from iterable, skipping duplicates. Duplicates are identified using the `key` function to calculate a unique fingerprint. T...
[ "def", "skip_duplicates", "(", "iterable", ",", "key", "=", "None", ",", "fingerprints", "=", "(", ")", ")", ":", "# type: (Iterable, Callable, Any) -> Iterable", "fingerprints", "=", "fingerprints", "or", "set", "(", ")", "fingerprint", "=", "None", "# needed on ...
Returns a generator that will yield all objects from iterable, skipping duplicates. Duplicates are identified using the `key` function to calculate a unique fingerprint. This does not use natural equality, but the result use a set() to remove duplicates, so defining __eq__ on yo...
[ "Returns", "a", "generator", "that", "will", "yield", "all", "objects", "from", "iterable", "skipping", "duplicates", "." ]
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/tools/iterables.py#L99-L179
Tygs/ww
src/ww/tools/iterables.py
chunks
def chunks(iterable, chunksize, cast=tuple): # type: (Iterable, int, Callable) -> Iterable """ Yields items from an iterator in iterable chunks. """ it = iter(iterable) while True: yield cast(itertools.chain([next(it)], itertools.islice(it, chunksize - 1)))
python
def chunks(iterable, chunksize, cast=tuple): # type: (Iterable, int, Callable) -> Iterable """ Yields items from an iterator in iterable chunks. """ it = iter(iterable) while True: yield cast(itertools.chain([next(it)], itertools.islice(it, chunksize - 1)))
[ "def", "chunks", "(", "iterable", ",", "chunksize", ",", "cast", "=", "tuple", ")", ":", "# type: (Iterable, int, Callable) -> Iterable", "it", "=", "iter", "(", "iterable", ")", "while", "True", ":", "yield", "cast", "(", "itertools", ".", "chain", "(", "["...
Yields items from an iterator in iterable chunks.
[ "Yields", "items", "from", "an", "iterator", "in", "iterable", "chunks", "." ]
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/tools/iterables.py#L183-L191
Tygs/ww
src/ww/tools/iterables.py
window
def window(iterable, size=2, cast=tuple): # type: (Iterable, int, Callable) -> Iterable """ Yields iterms by bunch of a given size, but rolling only one item in and out at a time when iterating. >>> list(window([1, 2, 3])) [(1, 2), (2, 3)] By default, this will cast the...
python
def window(iterable, size=2, cast=tuple): # type: (Iterable, int, Callable) -> Iterable """ Yields iterms by bunch of a given size, but rolling only one item in and out at a time when iterating. >>> list(window([1, 2, 3])) [(1, 2), (2, 3)] By default, this will cast the...
[ "def", "window", "(", "iterable", ",", "size", "=", "2", ",", "cast", "=", "tuple", ")", ":", "# type: (Iterable, int, Callable) -> Iterable", "iterable", "=", "iter", "(", "iterable", ")", "d", "=", "deque", "(", "itertools", ".", "islice", "(", "iterable",...
Yields iterms by bunch of a given size, but rolling only one item in and out at a time when iterating. >>> list(window([1, 2, 3])) [(1, 2), (2, 3)] By default, this will cast the window to a tuple before yielding it; however, any function that will accept an iterable as its arg...
[ "Yields", "iterms", "by", "bunch", "of", "a", "given", "size", "but", "rolling", "only", "one", "item", "in", "and", "out", "at", "a", "time", "when", "iterating", "." ]
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/tools/iterables.py#L194-L228
Tygs/ww
src/ww/tools/iterables.py
at_index
def at_index(iterable, index): # type: (Iterable[T], int) -> T """" Return the item at the index of this iterable or raises IndexError. WARNING: this will consume generators. Negative indices are allowed but be aware they will cause n items to be held in memory, where n = abs(index) ...
python
def at_index(iterable, index): # type: (Iterable[T], int) -> T """" Return the item at the index of this iterable or raises IndexError. WARNING: this will consume generators. Negative indices are allowed but be aware they will cause n items to be held in memory, where n = abs(index) ...
[ "def", "at_index", "(", "iterable", ",", "index", ")", ":", "# type: (Iterable[T], int) -> T", "try", ":", "if", "index", "<", "0", ":", "return", "deque", "(", "iterable", ",", "maxlen", "=", "abs", "(", "index", ")", ")", ".", "popleft", "(", ")", "r...
Return the item at the index of this iterable or raises IndexError. WARNING: this will consume generators. Negative indices are allowed but be aware they will cause n items to be held in memory, where n = abs(index)
[ "Return", "the", "item", "at", "the", "index", "of", "this", "iterable", "or", "raises", "IndexError", "." ]
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/tools/iterables.py#L231-L246
Tygs/ww
src/ww/tools/iterables.py
first_true
def first_true(iterable, func): # type: (Iterable[T], Callable) -> T """" Return the first item of the iterable for which func(item) == True. Or raises IndexError. WARNING: this will consume generators. """ try: return next((x for x in iterable if func(x))) except StopItera...
python
def first_true(iterable, func): # type: (Iterable[T], Callable) -> T """" Return the first item of the iterable for which func(item) == True. Or raises IndexError. WARNING: this will consume generators. """ try: return next((x for x in iterable if func(x))) except StopItera...
[ "def", "first_true", "(", "iterable", ",", "func", ")", ":", "# type: (Iterable[T], Callable) -> T", "try", ":", "return", "next", "(", "(", "x", "for", "x", "in", "iterable", "if", "func", "(", "x", ")", ")", ")", "except", "StopIteration", "as", "e", "...
Return the first item of the iterable for which func(item) == True. Or raises IndexError. WARNING: this will consume generators.
[ "Return", "the", "first", "item", "of", "the", "iterable", "for", "which", "func", "(", "item", ")", "==", "True", "." ]
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/tools/iterables.py#L250-L262
Tygs/ww
src/ww/tools/iterables.py
iterslice
def iterslice(iterable, start=0, stop=None, step=1): # type: (Iterable[T], int, int, int) -> Iterable[T] """ Like itertools.islice, but accept int and callables. If `start` is a callable, start the slice after the first time start(item) == True. If `stop` is a callable, stop the slice ...
python
def iterslice(iterable, start=0, stop=None, step=1): # type: (Iterable[T], int, int, int) -> Iterable[T] """ Like itertools.islice, but accept int and callables. If `start` is a callable, start the slice after the first time start(item) == True. If `stop` is a callable, stop the slice ...
[ "def", "iterslice", "(", "iterable", ",", "start", "=", "0", ",", "stop", "=", "None", ",", "step", "=", "1", ")", ":", "# type: (Iterable[T], int, int, int) -> Iterable[T]", "if", "step", "<", "0", ":", "raise", "ValueError", "(", "\"The step can not be negativ...
Like itertools.islice, but accept int and callables. If `start` is a callable, start the slice after the first time start(item) == True. If `stop` is a callable, stop the slice after the first time stop(item) == True.
[ "Like", "itertools", ".", "islice", "but", "accept", "int", "and", "callables", "." ]
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/tools/iterables.py#L265-L293
Tygs/ww
src/ww/tools/iterables.py
firsts
def firsts(iterable, items=1, default=None): # type: (Iterable[T], int, T) -> Iterable[T] """ Lazily return the first x items from this iterable or default. """ try: items = int(items) except (ValueError, TypeError): raise ValueError("items should be usable as an int but is currently " ...
python
def firsts(iterable, items=1, default=None): # type: (Iterable[T], int, T) -> Iterable[T] """ Lazily return the first x items from this iterable or default. """ try: items = int(items) except (ValueError, TypeError): raise ValueError("items should be usable as an int but is currently " ...
[ "def", "firsts", "(", "iterable", ",", "items", "=", "1", ",", "default", "=", "None", ")", ":", "# type: (Iterable[T], int, T) -> Iterable[T]", "try", ":", "items", "=", "int", "(", "items", ")", "except", "(", "ValueError", ",", "TypeError", ")", ":", "r...
Lazily return the first x items from this iterable or default.
[ "Lazily", "return", "the", "first", "x", "items", "from", "this", "iterable", "or", "default", "." ]
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/tools/iterables.py#L309-L330
Tygs/ww
src/ww/tools/iterables.py
lasts
def lasts(iterable, items=1, default=None): # type: (Iterable[T], int, T) -> Iterable[T] """ Lazily return the last x items from this iterable or default. """ last_items = deque(iterable, maxlen=items) for _ in range(items - len(last_items)): yield default for y in last_items: yie...
python
def lasts(iterable, items=1, default=None): # type: (Iterable[T], int, T) -> Iterable[T] """ Lazily return the last x items from this iterable or default. """ last_items = deque(iterable, maxlen=items) for _ in range(items - len(last_items)): yield default for y in last_items: yie...
[ "def", "lasts", "(", "iterable", ",", "items", "=", "1", ",", "default", "=", "None", ")", ":", "# type: (Iterable[T], int, T) -> Iterable[T]", "last_items", "=", "deque", "(", "iterable", ",", "maxlen", "=", "items", ")", "for", "_", "in", "range", "(", "...
Lazily return the last x items from this iterable or default.
[ "Lazily", "return", "the", "last", "x", "items", "from", "this", "iterable", "or", "default", "." ]
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/tools/iterables.py#L333-L343
lablup/backend.ai-client-py
src/ai/backend/client/session.py
is_legacy_server
def is_legacy_server(): '''Determine execution mode. Legacy mode: <= v4.20181215 ''' with Session() as session: ret = session.Kernel.hello() bai_version = ret['version'] legacy = True if bai_version <= 'v4.20181215' else False return legacy
python
def is_legacy_server(): '''Determine execution mode. Legacy mode: <= v4.20181215 ''' with Session() as session: ret = session.Kernel.hello() bai_version = ret['version'] legacy = True if bai_version <= 'v4.20181215' else False return legacy
[ "def", "is_legacy_server", "(", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "ret", "=", "session", ".", "Kernel", ".", "hello", "(", ")", "bai_version", "=", "ret", "[", "'version'", "]", "legacy", "=", "True", "if", "bai_version", "<=...
Determine execution mode. Legacy mode: <= v4.20181215
[ "Determine", "execution", "mode", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/session.py#L18-L27
lablup/backend.ai-client-py
src/ai/backend/client/session.py
Session.close
def close(self): ''' Terminates the session. It schedules the ``close()`` coroutine of the underlying aiohttp session and then enqueues a sentinel object to indicate termination. Then it waits until the worker thread to self-terminate by joining. ''' if self._cl...
python
def close(self): ''' Terminates the session. It schedules the ``close()`` coroutine of the underlying aiohttp session and then enqueues a sentinel object to indicate termination. Then it waits until the worker thread to self-terminate by joining. ''' if self._cl...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_closed", ":", "return", "self", ".", "_closed", "=", "True", "self", ".", "_worker_thread", ".", "work_queue", ".", "put", "(", "self", ".", "aiohttp_session", ".", "close", "(", ")", ")", "...
Terminates the session. It schedules the ``close()`` coroutine of the underlying aiohttp session and then enqueues a sentinel object to indicate termination. Then it waits until the worker thread to self-terminate by joining.
[ "Terminates", "the", "session", ".", "It", "schedules", "the", "close", "()", "coroutine", "of", "the", "underlying", "aiohttp", "session", "and", "then", "enqueues", "a", "sentinel", "object", "to", "indicate", "termination", ".", "Then", "it", "waits", "unti...
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/session.py#L214-L226
lablup/backend.ai-client-py
src/ai/backend/client/compat.py
asyncio_run_forever
def asyncio_run_forever(setup_coro, shutdown_coro, *, stop_signals={signal.SIGINT}, debug=False): ''' A proposed-but-not-implemented asyncio.run_forever() API based on @vxgmichel's idea. See discussions on https://github.com/python/asyncio/pull/465 ''' async def wait_for_...
python
def asyncio_run_forever(setup_coro, shutdown_coro, *, stop_signals={signal.SIGINT}, debug=False): ''' A proposed-but-not-implemented asyncio.run_forever() API based on @vxgmichel's idea. See discussions on https://github.com/python/asyncio/pull/465 ''' async def wait_for_...
[ "def", "asyncio_run_forever", "(", "setup_coro", ",", "shutdown_coro", ",", "*", ",", "stop_signals", "=", "{", "signal", ".", "SIGINT", "}", ",", "debug", "=", "False", ")", ":", "async", "def", "wait_for_stop", "(", ")", ":", "loop", "=", "current_loop",...
A proposed-but-not-implemented asyncio.run_forever() API based on @vxgmichel's idea. See discussions on https://github.com/python/asyncio/pull/465
[ "A", "proposed", "-", "but", "-", "not", "-", "implemented", "asyncio", ".", "run_forever", "()", "API", "based", "on" ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/compat.py#L80-L111
hustcc/wrapcache
wrapcache/database/__init__.py
LruCacheDB.clear
def clear(self): ''' claar all the cache, and release memory ''' for node in self.dli(): node.empty = True node.key = None node.value = None self.head = _dlnode() self.head.next = self.head self.head.prev = self.head self.listSize = 1 self.table.clear() # status var self.hit_cnt ...
python
def clear(self): ''' claar all the cache, and release memory ''' for node in self.dli(): node.empty = True node.key = None node.value = None self.head = _dlnode() self.head.next = self.head self.head.prev = self.head self.listSize = 1 self.table.clear() # status var self.hit_cnt ...
[ "def", "clear", "(", "self", ")", ":", "for", "node", "in", "self", ".", "dli", "(", ")", ":", "node", ".", "empty", "=", "True", "node", ".", "key", "=", "None", "node", ".", "value", "=", "None", "self", ".", "head", "=", "_dlnode", "(", ")",...
claar all the cache, and release memory
[ "claar", "all", "the", "cache", "and", "release", "memory" ]
train
https://github.com/hustcc/wrapcache/blob/3c6f52bb81a278e1dd60c27abe87d169cb4395aa/wrapcache/database/__init__.py#L56-L75
hustcc/wrapcache
wrapcache/database/__init__.py
LruCacheDB.pop
def pop(self, key, default = None): """Delete the item""" node = self.get(key, None) if node == None: value = default else: value = node try: del self[key] except: return value return value
python
def pop(self, key, default = None): """Delete the item""" node = self.get(key, None) if node == None: value = default else: value = node try: del self[key] except: return value return value
[ "def", "pop", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "node", "=", "self", ".", "get", "(", "key", ",", "None", ")", "if", "node", "==", "None", ":", "value", "=", "default", "else", ":", "value", "=", "node", "try", ":"...
Delete the item
[ "Delete", "the", "item" ]
train
https://github.com/hustcc/wrapcache/blob/3c6f52bb81a278e1dd60c27abe87d169cb4395aa/wrapcache/database/__init__.py#L195-L207
AoiKuiyuyou/AoikLiveReload
src/aoiklivereload/demo/bottle_demo.py
main
def main(): """ Main function. :return: None. """ try: # Get the `src` directory's absolute path src_path = os.path.dirname( # `aoiklivereload` directory's absolute path os.path.dirname( # `demo` directory's absolute path ...
python
def main(): """ Main function. :return: None. """ try: # Get the `src` directory's absolute path src_path = os.path.dirname( # `aoiklivereload` directory's absolute path os.path.dirname( # `demo` directory's absolute path ...
[ "def", "main", "(", ")", ":", "try", ":", "# Get the `src` directory's absolute path", "src_path", "=", "os", ".", "path", ".", "dirname", "(", "# `aoiklivereload` directory's absolute path", "os", ".", "path", ".", "dirname", "(", "# `demo` directory's absolute path", ...
Main function. :return: None.
[ "Main", "function", "." ]
train
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/demo/bottle_demo.py#L15-L84
lablup/backend.ai-client-py
src/ai/backend/client/kernel.py
Kernel.get_or_create
async def get_or_create(cls, lang: str, *, client_token: str = None, mounts: Iterable[str] = None, envs: Mapping[str, str] = None, resources: Mapping[str, int] = None, cluster_size...
python
async def get_or_create(cls, lang: str, *, client_token: str = None, mounts: Iterable[str] = None, envs: Mapping[str, str] = None, resources: Mapping[str, int] = None, cluster_size...
[ "async", "def", "get_or_create", "(", "cls", ",", "lang", ":", "str", ",", "*", ",", "client_token", ":", "str", "=", "None", ",", "mounts", ":", "Iterable", "[", "str", "]", "=", "None", ",", "envs", ":", "Mapping", "[", "str", ",", "str", "]", ...
Get-or-creates a compute session. If *client_token* is ``None``, it creates a new compute session as long as the server has enough resources and your API key has remaining quota. If *client_token* is a valid string and there is an existing compute session with the same token and the same...
[ "Get", "-", "or", "-", "creates", "a", "compute", "session", ".", "If", "*", "client_token", "*", "is", "None", "it", "creates", "a", "new", "compute", "session", "as", "long", "as", "the", "server", "has", "enough", "resources", "and", "your", "API", ...
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/kernel.py#L51-L112
lablup/backend.ai-client-py
src/ai/backend/client/kernel.py
Kernel.destroy
async def destroy(self): ''' Destroys the compute session. Since the server literally kills the container(s), all ongoing executions are forcibly interrupted. ''' params = {} if self.owner_access_key: params['owner_access_key'] = self.owner_access_key ...
python
async def destroy(self): ''' Destroys the compute session. Since the server literally kills the container(s), all ongoing executions are forcibly interrupted. ''' params = {} if self.owner_access_key: params['owner_access_key'] = self.owner_access_key ...
[ "async", "def", "destroy", "(", "self", ")", ":", "params", "=", "{", "}", "if", "self", ".", "owner_access_key", ":", "params", "[", "'owner_access_key'", "]", "=", "self", ".", "owner_access_key", "rqst", "=", "Request", "(", "self", ".", "session", ",...
Destroys the compute session. Since the server literally kills the container(s), all ongoing executions are forcibly interrupted.
[ "Destroys", "the", "compute", "session", ".", "Since", "the", "server", "literally", "kills", "the", "container", "(", "s", ")", "all", "ongoing", "executions", "are", "forcibly", "interrupted", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/kernel.py#L119-L133
lablup/backend.ai-client-py
src/ai/backend/client/kernel.py
Kernel.restart
async def restart(self): ''' Restarts the compute session. The server force-destroys the current running container(s), but keeps their temporary scratch directories intact. ''' params = {} if self.owner_access_key: params['owner_access_key'] = self.own...
python
async def restart(self): ''' Restarts the compute session. The server force-destroys the current running container(s), but keeps their temporary scratch directories intact. ''' params = {} if self.owner_access_key: params['owner_access_key'] = self.own...
[ "async", "def", "restart", "(", "self", ")", ":", "params", "=", "{", "}", "if", "self", ".", "owner_access_key", ":", "params", "[", "'owner_access_key'", "]", "=", "self", ".", "owner_access_key", "rqst", "=", "Request", "(", "self", ".", "session", ",...
Restarts the compute session. The server force-destroys the current running container(s), but keeps their temporary scratch directories intact.
[ "Restarts", "the", "compute", "session", ".", "The", "server", "force", "-", "destroys", "the", "current", "running", "container", "(", "s", ")", "but", "keeps", "their", "temporary", "scratch", "directories", "intact", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/kernel.py#L136-L149
lablup/backend.ai-client-py
src/ai/backend/client/kernel.py
Kernel.complete
async def complete(self, code: str, opts: dict = None) -> Iterable[str]: ''' Gets the auto-completion candidates from the given code string, as if a user has pressed the tab key just after the code in IDEs. Depending on the language of the compute session, this feature m...
python
async def complete(self, code: str, opts: dict = None) -> Iterable[str]: ''' Gets the auto-completion candidates from the given code string, as if a user has pressed the tab key just after the code in IDEs. Depending on the language of the compute session, this feature m...
[ "async", "def", "complete", "(", "self", ",", "code", ":", "str", ",", "opts", ":", "dict", "=", "None", ")", "->", "Iterable", "[", "str", "]", ":", "opts", "=", "{", "}", "if", "opts", "is", "None", "else", "opts", "params", "=", "{", "}", "i...
Gets the auto-completion candidates from the given code string, as if a user has pressed the tab key just after the code in IDEs. Depending on the language of the compute session, this feature may not be supported. Unsupported sessions returns an empty list. :param code: An (i...
[ "Gets", "the", "auto", "-", "completion", "candidates", "from", "the", "given", "code", "string", "as", "if", "a", "user", "has", "pressed", "the", "tab", "key", "just", "after", "the", "code", "in", "IDEs", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/kernel.py#L168-L200
lablup/backend.ai-client-py
src/ai/backend/client/kernel.py
Kernel.get_info
async def get_info(self): ''' Retrieves a brief information about the compute session. ''' params = {} if self.owner_access_key: params['owner_access_key'] = self.owner_access_key rqst = Request(self.session, 'GET', '/kernel/{}'.format(s...
python
async def get_info(self): ''' Retrieves a brief information about the compute session. ''' params = {} if self.owner_access_key: params['owner_access_key'] = self.owner_access_key rqst = Request(self.session, 'GET', '/kernel/{}'.format(s...
[ "async", "def", "get_info", "(", "self", ")", ":", "params", "=", "{", "}", "if", "self", ".", "owner_access_key", ":", "params", "[", "'owner_access_key'", "]", "=", "self", ".", "owner_access_key", "rqst", "=", "Request", "(", "self", ".", "session", "...
Retrieves a brief information about the compute session.
[ "Retrieves", "a", "brief", "information", "about", "the", "compute", "session", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/kernel.py#L203-L214
lablup/backend.ai-client-py
src/ai/backend/client/kernel.py
Kernel.execute
async def execute(self, run_id: str = None, code: str = None, mode: str = 'query', opts: dict = None): ''' Executes a code snippet directly in the compute session or sends a set of build/clean/execute commands to the compute sessi...
python
async def execute(self, run_id: str = None, code: str = None, mode: str = 'query', opts: dict = None): ''' Executes a code snippet directly in the compute session or sends a set of build/clean/execute commands to the compute sessi...
[ "async", "def", "execute", "(", "self", ",", "run_id", ":", "str", "=", "None", ",", "code", ":", "str", "=", "None", ",", "mode", ":", "str", "=", "'query'", ",", "opts", ":", "dict", "=", "None", ")", ":", "opts", "=", "opts", "if", "opts", "...
Executes a code snippet directly in the compute session or sends a set of build/clean/execute commands to the compute session. For more details about using this API, please refer :doc:`the official API documentation <user-api/intro>`. :param run_id: A unique identifier for a particular...
[ "Executes", "a", "code", "snippet", "directly", "in", "the", "compute", "session", "or", "sends", "a", "set", "of", "build", "/", "clean", "/", "execute", "commands", "to", "the", "compute", "session", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/kernel.py#L231-L304
lablup/backend.ai-client-py
src/ai/backend/client/kernel.py
Kernel.upload
async def upload(self, files: Sequence[Union[str, Path]], basedir: Union[str, Path] = None, show_progress: bool = False): ''' Uploads the given list of files to the compute session. You may refer them in the batch-mode execution or from the code ...
python
async def upload(self, files: Sequence[Union[str, Path]], basedir: Union[str, Path] = None, show_progress: bool = False): ''' Uploads the given list of files to the compute session. You may refer them in the batch-mode execution or from the code ...
[ "async", "def", "upload", "(", "self", ",", "files", ":", "Sequence", "[", "Union", "[", "str", ",", "Path", "]", "]", ",", "basedir", ":", "Union", "[", "str", ",", "Path", "]", "=", "None", ",", "show_progress", ":", "bool", "=", "False", ")", ...
Uploads the given list of files to the compute session. You may refer them in the batch-mode execution or from the code executed in the server afterwards. :param files: The list of file paths in the client-side. If the paths include directories, the location of them in the compute ...
[ "Uploads", "the", "given", "list", "of", "files", "to", "the", "compute", "session", ".", "You", "may", "refer", "them", "in", "the", "batch", "-", "mode", "execution", "or", "from", "the", "code", "executed", "in", "the", "server", "afterwards", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/kernel.py#L307-L361
lablup/backend.ai-client-py
src/ai/backend/client/kernel.py
Kernel.download
async def download(self, files: Sequence[Union[str, Path]], dest: Union[str, Path] = '.', show_progress: bool = False): ''' Downloads the given list of files from the compute session. :param files: The list of file paths in the compute session. ...
python
async def download(self, files: Sequence[Union[str, Path]], dest: Union[str, Path] = '.', show_progress: bool = False): ''' Downloads the given list of files from the compute session. :param files: The list of file paths in the compute session. ...
[ "async", "def", "download", "(", "self", ",", "files", ":", "Sequence", "[", "Union", "[", "str", ",", "Path", "]", "]", ",", "dest", ":", "Union", "[", "str", ",", "Path", "]", "=", "'.'", ",", "show_progress", ":", "bool", "=", "False", ")", ":...
Downloads the given list of files from the compute session. :param files: The list of file paths in the compute session. If they are relative paths, the path is calculated from ``/home/work`` in the compute session container. :param dest: The destination directory in the client-...
[ "Downloads", "the", "given", "list", "of", "files", "from", "the", "compute", "session", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/kernel.py#L364-L418
lablup/backend.ai-client-py
src/ai/backend/client/kernel.py
Kernel.list_files
async def list_files(self, path: Union[str, Path] = '.'): ''' Gets the list of files in the given path inside the compute session container. :param path: The directory path in the compute session. ''' params = {} if self.owner_access_key: params['owne...
python
async def list_files(self, path: Union[str, Path] = '.'): ''' Gets the list of files in the given path inside the compute session container. :param path: The directory path in the compute session. ''' params = {} if self.owner_access_key: params['owne...
[ "async", "def", "list_files", "(", "self", ",", "path", ":", "Union", "[", "str", ",", "Path", "]", "=", "'.'", ")", ":", "params", "=", "{", "}", "if", "self", ".", "owner_access_key", ":", "params", "[", "'owner_access_key'", "]", "=", "self", ".",...
Gets the list of files in the given path inside the compute session container. :param path: The directory path in the compute session.
[ "Gets", "the", "list", "of", "files", "in", "the", "given", "path", "inside", "the", "compute", "session", "container", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/kernel.py#L421-L438
lablup/backend.ai-client-py
src/ai/backend/client/kernel.py
Kernel.stream_pty
def stream_pty(self) -> 'StreamPty': ''' Opens a pseudo-terminal of the kernel (if supported) streamed via websockets. :returns: a :class:`StreamPty` object. ''' params = {} if self.owner_access_key: params['owner_access_key'] = self.owner_access_key ...
python
def stream_pty(self) -> 'StreamPty': ''' Opens a pseudo-terminal of the kernel (if supported) streamed via websockets. :returns: a :class:`StreamPty` object. ''' params = {} if self.owner_access_key: params['owner_access_key'] = self.owner_access_key ...
[ "def", "stream_pty", "(", "self", ")", "->", "'StreamPty'", ":", "params", "=", "{", "}", "if", "self", ".", "owner_access_key", ":", "params", "[", "'owner_access_key'", "]", "=", "self", ".", "owner_access_key", "request", "=", "Request", "(", "self", "....
Opens a pseudo-terminal of the kernel (if supported) streamed via websockets. :returns: a :class:`StreamPty` object.
[ "Opens", "a", "pseudo", "-", "terminal", "of", "the", "kernel", "(", "if", "supported", ")", "streamed", "via", "websockets", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/kernel.py#L441-L454
lablup/backend.ai-client-py
src/ai/backend/client/kernel.py
Kernel.stream_execute
def stream_execute(self, code: str = '', *, mode: str = 'query', opts: dict = None) -> WebSocketResponse: ''' Executes a code snippet in the streaming mode. Since the returned websocket represents a run loop, there is no need to specify *run_...
python
def stream_execute(self, code: str = '', *, mode: str = 'query', opts: dict = None) -> WebSocketResponse: ''' Executes a code snippet in the streaming mode. Since the returned websocket represents a run loop, there is no need to specify *run_...
[ "def", "stream_execute", "(", "self", ",", "code", ":", "str", "=", "''", ",", "*", ",", "mode", ":", "str", "=", "'query'", ",", "opts", ":", "dict", "=", "None", ")", "->", "WebSocketResponse", ":", "params", "=", "{", "}", "if", "self", ".", "...
Executes a code snippet in the streaming mode. Since the returned websocket represents a run loop, there is no need to specify *run_id* explicitly.
[ "Executes", "a", "code", "snippet", "in", "the", "streaming", "mode", ".", "Since", "the", "returned", "websocket", "represents", "a", "run", "loop", "there", "is", "no", "need", "to", "specify", "*", "run_id", "*", "explicitly", "." ]
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/kernel.py#L457-L492
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
init_interface
def init_interface(): sys.stdout = LoggerWriter(LOGGER.debug) sys.stderr = LoggerWriter(LOGGER.error) """ Grab the ~/.polyglot/.env file for variables If you are running Polyglot v2 on this same machine then it should already exist. If not create it. """ warnings.simplefilter('error', U...
python
def init_interface(): sys.stdout = LoggerWriter(LOGGER.debug) sys.stderr = LoggerWriter(LOGGER.error) """ Grab the ~/.polyglot/.env file for variables If you are running Polyglot v2 on this same machine then it should already exist. If not create it. """ warnings.simplefilter('error', U...
[ "def", "init_interface", "(", ")", ":", "sys", ".", "stdout", "=", "LoggerWriter", "(", "LOGGER", ".", "debug", ")", "sys", ".", "stderr", "=", "LoggerWriter", "(", "LOGGER", ".", "error", ")", "warnings", ".", "simplefilter", "(", "'error'", ",", "UserW...
Grab the ~/.polyglot/.env file for variables If you are running Polyglot v2 on this same machine then it should already exist. If not create it.
[ "Grab", "the", "~", "/", ".", "polyglot", "/", ".", "env", "file", "for", "variables", "If", "you", "are", "running", "Polyglot", "v2", "on", "this", "same", "machine", "then", "it", "should", "already", "exist", ".", "If", "not", "create", "it", "." ]
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L76-L112