partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | ResponseOutputGenerator.process_json_response | For a json response, check if there was any error and throw exception.
Otherwise, create a housecanary.response.Response. | housecanary/output.py | def process_json_response(self, response):
"""For a json response, check if there was any error and throw exception.
Otherwise, create a housecanary.response.Response."""
response_json = response.json()
# handle errors
code_key = "code"
if code_key in response_json and ... | def process_json_response(self, response):
"""For a json response, check if there was any error and throw exception.
Otherwise, create a housecanary.response.Response."""
response_json = response.json()
# handle errors
code_key = "code"
if code_key in response_json and ... | [
"For",
"a",
"json",
"response",
"check",
"if",
"there",
"was",
"any",
"error",
"and",
"throw",
"exception",
".",
"Otherwise",
"create",
"a",
"housecanary",
".",
"response",
".",
"Response",
"."
] | housecanary/hc-api-python | python | https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/output.py#L61-L89 | [
"def",
"process_json_response",
"(",
"self",
",",
"response",
")",
":",
"response_json",
"=",
"response",
".",
"json",
"(",
")",
"# handle errors",
"code_key",
"=",
"\"code\"",
"if",
"code_key",
"in",
"response_json",
"and",
"response_json",
"[",
"code_key",
"]"... | 2bb9e2208b34e8617575de45934357ee33b8531c |
train | LiveReloader.start_watcher_thread | Start watcher thread.
:return:
Watcher thread object. | src/aoiklivereload/aoiklivereload.py | def start_watcher_thread(self):
"""
Start watcher thread.
:return:
Watcher thread object.
"""
# Create watcher thread
watcher_thread = threading.Thread(target=self.run_watcher)
# If the reload mode is `spawn_wait`
if self._reload_mode == self... | def start_watcher_thread(self):
"""
Start watcher thread.
:return:
Watcher thread object.
"""
# Create watcher thread
watcher_thread = threading.Thread(target=self.run_watcher)
# If the reload mode is `spawn_wait`
if self._reload_mode == self... | [
"Start",
"watcher",
"thread",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L129-L156 | [
"def",
"start_watcher_thread",
"(",
"self",
")",
":",
"# Create watcher thread",
"watcher_thread",
"=",
"threading",
".",
"Thread",
"(",
"target",
"=",
"self",
".",
"run_watcher",
")",
"# If the reload mode is `spawn_wait`",
"if",
"self",
".",
"_reload_mode",
"==",
... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | LiveReloader.run_watcher | Watcher thread's function.
:return:
None. | src/aoiklivereload/aoiklivereload.py | def run_watcher(self):
"""
Watcher thread's function.
:return:
None.
"""
# Create observer
observer = Observer()
# Start observer
observer.start()
# Dict that maps file path to `watch object`
watche_obj_map = {}
# Ru... | def run_watcher(self):
"""
Watcher thread's function.
:return:
None.
"""
# Create observer
observer = Observer()
# Start observer
observer.start()
# Dict that maps file path to `watch object`
watche_obj_map = {}
# Ru... | [
"Watcher",
"thread",
"s",
"function",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L158-L223 | [
"def",
"run_watcher",
"(",
"self",
")",
":",
"# Create observer",
"observer",
"=",
"Observer",
"(",
")",
"# Start observer",
"observer",
".",
"start",
"(",
")",
"# Dict that maps file path to `watch object`",
"watche_obj_map",
"=",
"{",
"}",
"# Run change check in a loo... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | LiveReloader._find_watch_paths | Find paths to watch.
:return:
Paths to watch. | src/aoiklivereload/aoiklivereload.py | def _find_watch_paths(self):
"""
Find paths to watch.
:return:
Paths to watch.
"""
# Add directory paths in `sys.path` to watch paths
watch_path_s = set(os.path.abspath(x) for x in sys.path)
# For each extra path
for extra_path in self._extra... | def _find_watch_paths(self):
"""
Find paths to watch.
:return:
Paths to watch.
"""
# Add directory paths in `sys.path` to watch paths
watch_path_s = set(os.path.abspath(x) for x in sys.path)
# For each extra path
for extra_path in self._extra... | [
"Find",
"paths",
"to",
"watch",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L225-L261 | [
"def",
"_find_watch_paths",
"(",
"self",
")",
":",
"# Add directory paths in `sys.path` to watch paths",
"watch_path_s",
"=",
"set",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"x",
")",
"for",
"x",
"in",
"sys",
".",
"path",
")",
"# For each extra path",
"for",... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | LiveReloader._find_short_paths | Find short paths of given paths.
E.g. if both `/home` and `/home/aoik` exist, only keep `/home`.
:param paths:
Paths.
:return:
Set of short paths. | src/aoiklivereload/aoiklivereload.py | def _find_short_paths(self, paths):
"""
Find short paths of given paths.
E.g. if both `/home` and `/home/aoik` exist, only keep `/home`.
:param paths:
Paths.
:return:
Set of short paths.
"""
# Split each path to parts.
# E.g. '/h... | def _find_short_paths(self, paths):
"""
Find short paths of given paths.
E.g. if both `/home` and `/home/aoik` exist, only keep `/home`.
:param paths:
Paths.
:return:
Set of short paths.
"""
# Split each path to parts.
# E.g. '/h... | [
"Find",
"short",
"paths",
"of",
"given",
"paths",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L263-L315 | [
"def",
"_find_short_paths",
"(",
"self",
",",
"paths",
")",
":",
"# Split each path to parts.",
"# E.g. '/home/aoik' to ['', 'home', 'aoik']",
"path_parts_s",
"=",
"[",
"path",
".",
"split",
"(",
"os",
".",
"path",
".",
"sep",
")",
"for",
"path",
"in",
"paths",
... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | LiveReloader._collect_leaf_paths | Collect paths of leaf nodes.
:param node:
Starting node. Type is dict.
Key is child node's path part. Value is child node.
:param path_parts:
The starting node's path parts. Type is tuple.
:param leaf_paths:
Leaf path list.
:return:
... | src/aoiklivereload/aoiklivereload.py | def _collect_leaf_paths(self, node, path_parts, leaf_paths):
"""
Collect paths of leaf nodes.
:param node:
Starting node. Type is dict.
Key is child node's path part. Value is child node.
:param path_parts:
The starting node's path parts. Type is tu... | def _collect_leaf_paths(self, node, path_parts, leaf_paths):
"""
Collect paths of leaf nodes.
:param node:
Starting node. Type is dict.
Key is child node's path part. Value is child node.
:param path_parts:
The starting node's path parts. Type is tu... | [
"Collect",
"paths",
"of",
"leaf",
"nodes",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L317-L355 | [
"def",
"_collect_leaf_paths",
"(",
"self",
",",
"node",
",",
"path_parts",
",",
"leaf_paths",
")",
":",
"# If the node is leaf node",
"if",
"not",
"node",
":",
"# Get node path",
"node_path",
"=",
"'/'",
".",
"join",
"(",
"path_parts",
")",
"# Add to list",
"lea... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | LiveReloader.dispatch | Dispatch file system event.
Callback called when there is a file system event. Hooked at 2KGRW.
This function overrides `FileSystemEventHandler.dispatch`.
:param event:
File system event object.
:return:
None. | src/aoiklivereload/aoiklivereload.py | def dispatch(self, event):
"""
Dispatch file system event.
Callback called when there is a file system event. Hooked at 2KGRW.
This function overrides `FileSystemEventHandler.dispatch`.
:param event:
File system event object.
:return:
None.
... | def dispatch(self, event):
"""
Dispatch file system event.
Callback called when there is a file system event. Hooked at 2KGRW.
This function overrides `FileSystemEventHandler.dispatch`.
:param event:
File system event object.
:return:
None.
... | [
"Dispatch",
"file",
"system",
"event",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L357-L392 | [
"def",
"dispatch",
"(",
"self",
",",
"event",
")",
":",
"# Get file path",
"file_path",
"=",
"event",
".",
"src_path",
"# If the file path is in extra paths",
"if",
"file_path",
"in",
"self",
".",
"_extra_paths",
":",
"# Call `reload`",
"self",
".",
"reload",
"(",... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | LiveReloader.reload | Reload the program.
:return:
None. | src/aoiklivereload/aoiklivereload.py | def reload(self):
"""
Reload the program.
:return:
None.
"""
# Get reload mode
reload_mode = self._reload_mode
# If reload mode is `exec`
if self._reload_mode == self.RELOAD_MODE_V_EXEC:
# Call `reload_using_exec`
self... | def reload(self):
"""
Reload the program.
:return:
None.
"""
# Get reload mode
reload_mode = self._reload_mode
# If reload mode is `exec`
if self._reload_mode == self.RELOAD_MODE_V_EXEC:
# Call `reload_using_exec`
self... | [
"Reload",
"the",
"program",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L394-L425 | [
"def",
"reload",
"(",
"self",
")",
":",
"# Get reload mode",
"reload_mode",
"=",
"self",
".",
"_reload_mode",
"# If reload mode is `exec`",
"if",
"self",
".",
"_reload_mode",
"==",
"self",
".",
"RELOAD_MODE_V_EXEC",
":",
"# Call `reload_using_exec`",
"self",
".",
"r... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | LiveReloader.reload_using_exec | Reload the program process.
:return:
None. | src/aoiklivereload/aoiklivereload.py | def reload_using_exec(self):
"""
Reload the program process.
:return:
None.
"""
# Create command parts
cmd_parts = [sys.executable] + sys.argv
# Get env dict copy
env_copy = os.environ.copy()
# Reload the program process
os.e... | def reload_using_exec(self):
"""
Reload the program process.
:return:
None.
"""
# Create command parts
cmd_parts = [sys.executable] + sys.argv
# Get env dict copy
env_copy = os.environ.copy()
# Reload the program process
os.e... | [
"Reload",
"the",
"program",
"process",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L427-L448 | [
"def",
"reload_using_exec",
"(",
"self",
")",
":",
"# Create command parts",
"cmd_parts",
"=",
"[",
"sys",
".",
"executable",
"]",
"+",
"sys",
".",
"argv",
"# Get env dict copy",
"env_copy",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"# Reload the progr... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | LiveReloader.reload_using_spawn_exit | Spawn a subprocess and exit the current process.
:return:
None. | src/aoiklivereload/aoiklivereload.py | def reload_using_spawn_exit(self):
"""
Spawn a subprocess and exit the current process.
:return:
None.
"""
# Create command parts
cmd_parts = [sys.executable] + sys.argv
# Get env dict copy
env_copy = os.environ.copy()
# Spawn subpro... | def reload_using_spawn_exit(self):
"""
Spawn a subprocess and exit the current process.
:return:
None.
"""
# Create command parts
cmd_parts = [sys.executable] + sys.argv
# Get env dict copy
env_copy = os.environ.copy()
# Spawn subpro... | [
"Spawn",
"a",
"subprocess",
"and",
"exit",
"the",
"current",
"process",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L450-L480 | [
"def",
"reload_using_spawn_exit",
"(",
"self",
")",
":",
"# Create command parts",
"cmd_parts",
"=",
"[",
"sys",
".",
"executable",
"]",
"+",
"sys",
".",
"argv",
"# Get env dict copy",
"env_copy",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"# Spawn subp... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | LiveReloader.reload_using_spawn_wait | Spawn a subprocess and wait until it finishes.
:return:
None. | src/aoiklivereload/aoiklivereload.py | def reload_using_spawn_wait(self):
"""
Spawn a subprocess and wait until it finishes.
:return:
None.
"""
# Create command parts
cmd_parts = [sys.executable] + sys.argv
# Get env dict copy
env_copy = os.environ.copy()
# Send interrupt... | def reload_using_spawn_wait(self):
"""
Spawn a subprocess and wait until it finishes.
:return:
None.
"""
# Create command parts
cmd_parts = [sys.executable] + sys.argv
# Get env dict copy
env_copy = os.environ.copy()
# Send interrupt... | [
"Spawn",
"a",
"subprocess",
"and",
"wait",
"until",
"it",
"finishes",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/aoiklivereload.py#L482-L502 | [
"def",
"reload_using_spawn_wait",
"(",
"self",
")",
":",
"# Create command parts",
"cmd_parts",
"=",
"[",
"sys",
".",
"executable",
"]",
"+",
"sys",
".",
"argv",
"# Get env dict copy",
"env_copy",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"# Send inter... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | agent | Show the information about the given agent. | src/ai/backend/client/cli/admin/agents.py | def agent(agent_id):
'''
Show the information about the given agent.
'''
fields = [
('ID', 'id'),
('Status', 'status'),
('Region', 'region'),
('First Contact', 'first_contact'),
('CPU Usage (%)', 'cpu_cur_pct'),
('Used Memory (MiB)', 'mem_cur_bytes'),
... | def agent(agent_id):
'''
Show the information about the given agent.
'''
fields = [
('ID', 'id'),
('Status', 'status'),
('Region', 'region'),
('First Contact', 'first_contact'),
('CPU Usage (%)', 'cpu_cur_pct'),
('Used Memory (MiB)', 'mem_cur_bytes'),
... | [
"Show",
"the",
"information",
"about",
"the",
"given",
"agent",
"."
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/agents.py#L14-L49 | [
"def",
"agent",
"(",
"agent_id",
")",
":",
"fields",
"=",
"[",
"(",
"'ID'",
",",
"'id'",
")",
",",
"(",
"'Status'",
",",
"'status'",
")",
",",
"(",
"'Region'",
",",
"'region'",
")",
",",
"(",
"'First Contact'",
",",
"'first_contact'",
")",
",",
"(",
... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | agents | List and manage agents.
(admin privilege required) | src/ai/backend/client/cli/admin/agents.py | def agents(status, all):
'''
List and manage agents.
(admin privilege required)
'''
fields = [
('ID', 'id'),
('Status', 'status'),
('Region', 'region'),
('First Contact', 'first_contact'),
('CPU Usage (%)', 'cpu_cur_pct'),
('Used Memory (MiB)', 'mem_cu... | def agents(status, all):
'''
List and manage agents.
(admin privilege required)
'''
fields = [
('ID', 'id'),
('Status', 'status'),
('Region', 'region'),
('First Contact', 'first_contact'),
('CPU Usage (%)', 'cpu_cur_pct'),
('Used Memory (MiB)', 'mem_cu... | [
"List",
"and",
"manage",
"agents",
".",
"(",
"admin",
"privilege",
"required",
")"
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/agents.py#L56-L134 | [
"def",
"agents",
"(",
"status",
",",
"all",
")",
":",
"fields",
"=",
"[",
"(",
"'ID'",
",",
"'id'",
")",
",",
"(",
"'Status'",
",",
"'status'",
")",
",",
"(",
"'Region'",
",",
"'region'",
")",
",",
"(",
"'First Contact'",
",",
"'first_contact'",
")",... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | resource_policy | Show details about a keypair resource policy. When `name` option is omitted, the
resource policy for the current access_key will be returned. | src/ai/backend/client/cli/admin/resource_policies.py | def resource_policy(name):
"""
Show details about a keypair resource policy. When `name` option is omitted, the
resource policy for the current access_key will be returned.
"""
fields = [
('Name', 'name'),
('Created At', 'created_at'),
('Default for Unspecified', 'default_for... | def resource_policy(name):
"""
Show details about a keypair resource policy. When `name` option is omitted, the
resource policy for the current access_key will be returned.
"""
fields = [
('Name', 'name'),
('Created At', 'created_at'),
('Default for Unspecified', 'default_for... | [
"Show",
"details",
"about",
"a",
"keypair",
"resource",
"policy",
".",
"When",
"name",
"option",
"is",
"omitted",
"the",
"resource",
"policy",
"for",
"the",
"current",
"access_key",
"will",
"be",
"returned",
"."
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/resource_policies.py#L14-L44 | [
"def",
"resource_policy",
"(",
"name",
")",
":",
"fields",
"=",
"[",
"(",
"'Name'",
",",
"'name'",
")",
",",
"(",
"'Created At'",
",",
"'created_at'",
")",
",",
"(",
"'Default for Unspecified'",
",",
"'default_for_unspecified'",
")",
",",
"(",
"'Total Resource... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | resource_policies | List and manage resource policies.
(admin privilege required) | src/ai/backend/client/cli/admin/resource_policies.py | def resource_policies(ctx):
'''
List and manage resource policies.
(admin privilege required)
'''
if ctx.invoked_subcommand is not None:
return
fields = [
('Name', 'name'),
('Created At', 'created_at'),
('Default for Unspecified', 'default_for_unspecified'),
... | def resource_policies(ctx):
'''
List and manage resource policies.
(admin privilege required)
'''
if ctx.invoked_subcommand is not None:
return
fields = [
('Name', 'name'),
('Created At', 'created_at'),
('Default for Unspecified', 'default_for_unspecified'),
... | [
"List",
"and",
"manage",
"resource",
"policies",
".",
"(",
"admin",
"privilege",
"required",
")"
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/resource_policies.py#L49-L78 | [
"def",
"resource_policies",
"(",
"ctx",
")",
":",
"if",
"ctx",
".",
"invoked_subcommand",
"is",
"not",
"None",
":",
"return",
"fields",
"=",
"[",
"(",
"'Name'",
",",
"'name'",
")",
",",
"(",
"'Created At'",
",",
"'created_at'",
")",
",",
"(",
"'Default f... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | add | Add a new keypair resource policy.
NAME: NAME of a new keypair resource policy. | src/ai/backend/client/cli/admin/resource_policies.py | def add(name, default_for_unspecified, total_resource_slots, max_concurrent_sessions,
max_containers_per_session, max_vfolder_count, max_vfolder_size,
idle_timeout, allowed_vfolder_hosts):
'''
Add a new keypair resource policy.
NAME: NAME of a new keypair resource policy.
'''
with S... | def add(name, default_for_unspecified, total_resource_slots, max_concurrent_sessions,
max_containers_per_session, max_vfolder_count, max_vfolder_size,
idle_timeout, allowed_vfolder_hosts):
'''
Add a new keypair resource policy.
NAME: NAME of a new keypair resource policy.
'''
with S... | [
"Add",
"a",
"new",
"keypair",
"resource",
"policy",
"."
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/resource_policies.py#L103-L132 | [
"def",
"add",
"(",
"name",
",",
"default_for_unspecified",
",",
"total_resource_slots",
",",
"max_concurrent_sessions",
",",
"max_containers_per_session",
",",
"max_vfolder_count",
",",
"max_vfolder_size",
",",
"idle_timeout",
",",
"allowed_vfolder_hosts",
")",
":",
"with... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | delete | Delete a keypair resource policy.
NAME: NAME of a keypair resource policy to delete. | src/ai/backend/client/cli/admin/resource_policies.py | def delete(name):
"""
Delete a keypair resource policy.
NAME: NAME of a keypair resource policy to delete.
"""
with Session() as session:
if input('Are you sure? (y/n): ').lower().strip()[:1] != 'y':
print('Canceled.')
sys.exit(1)
try:
data = sess... | def delete(name):
"""
Delete a keypair resource policy.
NAME: NAME of a keypair resource policy to delete.
"""
with Session() as session:
if input('Are you sure? (y/n): ').lower().strip()[:1] != 'y':
print('Canceled.')
sys.exit(1)
try:
data = sess... | [
"Delete",
"a",
"keypair",
"resource",
"policy",
"."
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/resource_policies.py#L187-L206 | [
"def",
"delete",
"(",
"name",
")",
":",
"with",
"Session",
"(",
")",
"as",
"session",
":",
"if",
"input",
"(",
"'Are you sure? (y/n): '",
")",
".",
"lower",
"(",
")",
".",
"strip",
"(",
")",
"[",
":",
"1",
"]",
"!=",
"'y'",
":",
"print",
"(",
"'C... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | app | Run a local proxy to a service provided by Backend.AI compute sessions.
The type of proxy depends on the app definition: plain TCP or HTTP.
\b
SESSID: The compute session ID.
APP: The name of service provided by the given session. | src/ai/backend/client/cli/app.py | def app(session_id, app, bind, port):
"""
Run a local proxy to a service provided by Backend.AI compute sessions.
The type of proxy depends on the app definition: plain TCP or HTTP.
\b
SESSID: The compute session ID.
APP: The name of service provided by the given session.
"""
api_sessi... | def app(session_id, app, bind, port):
"""
Run a local proxy to a service provided by Backend.AI compute sessions.
The type of proxy depends on the app definition: plain TCP or HTTP.
\b
SESSID: The compute session ID.
APP: The name of service provided by the given session.
"""
api_sessi... | [
"Run",
"a",
"local",
"proxy",
"to",
"a",
"service",
"provided",
"by",
"Backend",
".",
"AI",
"compute",
"sessions",
"."
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/app.py#L137-L176 | [
"def",
"app",
"(",
"session_id",
",",
"app",
",",
"bind",
",",
"port",
")",
":",
"api_session",
"=",
"None",
"runner",
"=",
"None",
"async",
"def",
"app_setup",
"(",
")",
":",
"nonlocal",
"api_session",
",",
"runner",
"loop",
"=",
"current_loop",
"(",
... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | get_env | Retrieves a configuration value from the environment variables.
The given *key* is uppercased and prefixed by ``"BACKEND_"`` and then
``"SORNA_"`` if the former does not exist.
:param key: The key name.
:param default: The default value returned when there is no corresponding
environment variab... | src/ai/backend/client/config.py | def get_env(key: str,
default: Any = None,
clean: Callable[[str], Any] = lambda v: v):
'''
Retrieves a configuration value from the environment variables.
The given *key* is uppercased and prefixed by ``"BACKEND_"`` and then
``"SORNA_"`` if the former does not exist.
:param ... | def get_env(key: str,
default: Any = None,
clean: Callable[[str], Any] = lambda v: v):
'''
Retrieves a configuration value from the environment variables.
The given *key* is uppercased and prefixed by ``"BACKEND_"`` and then
``"SORNA_"`` if the former does not exist.
:param ... | [
"Retrieves",
"a",
"configuration",
"value",
"from",
"the",
"environment",
"variables",
".",
"The",
"given",
"*",
"key",
"*",
"is",
"uppercased",
"and",
"prefixed",
"by",
"BACKEND_",
"and",
"then",
"SORNA_",
"if",
"the",
"former",
"does",
"not",
"exist",
"."
... | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/config.py#L14-L39 | [
"def",
"get_env",
"(",
"key",
":",
"str",
",",
"default",
":",
"Any",
"=",
"None",
",",
"clean",
":",
"Callable",
"[",
"[",
"str",
"]",
",",
"Any",
"]",
"=",
"lambda",
"v",
":",
"v",
")",
":",
"key",
"=",
"key",
".",
"upper",
"(",
")",
"v",
... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | logs | Shows the output logs of a running container.
\b
SESSID: Session ID or its alias given when creating the session. | src/ai/backend/client/cli/logs.py | def logs(sess_id_or_alias):
'''
Shows the output logs of a running container.
\b
SESSID: Session ID or its alias given when creating the session.
'''
with Session() as session:
try:
print_wait('Retrieving container logs...')
kernel = session.Kernel(sess_id_or_ali... | def logs(sess_id_or_alias):
'''
Shows the output logs of a running container.
\b
SESSID: Session ID or its alias given when creating the session.
'''
with Session() as session:
try:
print_wait('Retrieving container logs...')
kernel = session.Kernel(sess_id_or_ali... | [
"Shows",
"the",
"output",
"logs",
"of",
"a",
"running",
"container",
"."
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/logs.py#L12-L29 | [
"def",
"logs",
"(",
"sess_id_or_alias",
")",
":",
"with",
"Session",
"(",
")",
"as",
"session",
":",
"try",
":",
"print_wait",
"(",
"'Retrieving container logs...'",
")",
"kernel",
"=",
"session",
".",
"Kernel",
"(",
"sess_id_or_alias",
")",
"result",
"=",
"... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | _wrap_key | get the key from the function input. | wrapcache/__init__.py | def _wrap_key(function, args, kws):
'''
get the key from the function input.
'''
return hashlib.md5(pickle.dumps((_from_file(function) + function.__name__, args, kws))).hexdigest() | def _wrap_key(function, args, kws):
'''
get the key from the function input.
'''
return hashlib.md5(pickle.dumps((_from_file(function) + function.__name__, args, kws))).hexdigest() | [
"get",
"the",
"key",
"from",
"the",
"function",
"input",
"."
] | hustcc/wrapcache | python | https://github.com/hustcc/wrapcache/blob/3c6f52bb81a278e1dd60c27abe87d169cb4395aa/wrapcache/__init__.py#L29-L33 | [
"def",
"_wrap_key",
"(",
"function",
",",
"args",
",",
"kws",
")",
":",
"return",
"hashlib",
".",
"md5",
"(",
"pickle",
".",
"dumps",
"(",
"(",
"_from_file",
"(",
"function",
")",
"+",
"function",
".",
"__name__",
",",
"args",
",",
"kws",
")",
")",
... | 3c6f52bb81a278e1dd60c27abe87d169cb4395aa |
train | get | get the cache value | wrapcache/__init__.py | def get(key, adapter = MemoryAdapter):
'''
get the cache value
'''
try:
return pickle.loads(adapter().get(key))
except CacheExpiredException:
return None | def get(key, adapter = MemoryAdapter):
'''
get the cache value
'''
try:
return pickle.loads(adapter().get(key))
except CacheExpiredException:
return None | [
"get",
"the",
"cache",
"value"
] | hustcc/wrapcache | python | https://github.com/hustcc/wrapcache/blob/3c6f52bb81a278e1dd60c27abe87d169cb4395aa/wrapcache/__init__.py#L41-L48 | [
"def",
"get",
"(",
"key",
",",
"adapter",
"=",
"MemoryAdapter",
")",
":",
"try",
":",
"return",
"pickle",
".",
"loads",
"(",
"adapter",
"(",
")",
".",
"get",
"(",
"key",
")",
")",
"except",
"CacheExpiredException",
":",
"return",
"None"
] | 3c6f52bb81a278e1dd60c27abe87d169cb4395aa |
train | set | set cache by code, must set timeout length | wrapcache/__init__.py | def set(key, value, timeout = -1, adapter = MemoryAdapter):
'''
set cache by code, must set timeout length
'''
if adapter(timeout = timeout).set(key, pickle.dumps(value)):
return value
else:
return None | def set(key, value, timeout = -1, adapter = MemoryAdapter):
'''
set cache by code, must set timeout length
'''
if adapter(timeout = timeout).set(key, pickle.dumps(value)):
return value
else:
return None | [
"set",
"cache",
"by",
"code",
"must",
"set",
"timeout",
"length"
] | hustcc/wrapcache | python | https://github.com/hustcc/wrapcache/blob/3c6f52bb81a278e1dd60c27abe87d169cb4395aa/wrapcache/__init__.py#L56-L63 | [
"def",
"set",
"(",
"key",
",",
"value",
",",
"timeout",
"=",
"-",
"1",
",",
"adapter",
"=",
"MemoryAdapter",
")",
":",
"if",
"adapter",
"(",
"timeout",
"=",
"timeout",
")",
".",
"set",
"(",
"key",
",",
"pickle",
".",
"dumps",
"(",
"value",
")",
"... | 3c6f52bb81a278e1dd60c27abe87d169cb4395aa |
train | wrapcache | the Decorator to cache Function. | wrapcache/__init__.py | def wrapcache(timeout = -1, adapter = MemoryAdapter):
'''
the Decorator to cache Function.
'''
def _wrapcache(function):
@wraps(function)
def __wrapcache(*args, **kws):
hash_key = _wrap_key(function, args, kws)
try:
adapter_instance = adapter()
return pickle.loads(adapter_instance.get(hash_key))
... | def wrapcache(timeout = -1, adapter = MemoryAdapter):
'''
the Decorator to cache Function.
'''
def _wrapcache(function):
@wraps(function)
def __wrapcache(*args, **kws):
hash_key = _wrap_key(function, args, kws)
try:
adapter_instance = adapter()
return pickle.loads(adapter_instance.get(hash_key))
... | [
"the",
"Decorator",
"to",
"cache",
"Function",
"."
] | hustcc/wrapcache | python | https://github.com/hustcc/wrapcache/blob/3c6f52bb81a278e1dd60c27abe87d169cb4395aa/wrapcache/__init__.py#L72-L89 | [
"def",
"wrapcache",
"(",
"timeout",
"=",
"-",
"1",
",",
"adapter",
"=",
"MemoryAdapter",
")",
":",
"def",
"_wrapcache",
"(",
"function",
")",
":",
"@",
"wraps",
"(",
"function",
")",
"def",
"__wrapcache",
"(",
"*",
"args",
",",
"*",
"*",
"kws",
")",
... | 3c6f52bb81a278e1dd60c27abe87d169cb4395aa |
train | export_analytics_data_to_excel | Creates an Excel file containing data returned by the Analytics API
Args:
data: Analytics API data as a list of dicts
output_file_name: File name for output Excel file (use .xlsx extension). | housecanary/excel/__init__.py | def export_analytics_data_to_excel(data, output_file_name, result_info_key, identifier_keys):
"""Creates an Excel file containing data returned by the Analytics API
Args:
data: Analytics API data as a list of dicts
output_file_name: File name for output Excel file (use .xlsx extension).
""... | def export_analytics_data_to_excel(data, output_file_name, result_info_key, identifier_keys):
"""Creates an Excel file containing data returned by the Analytics API
Args:
data: Analytics API data as a list of dicts
output_file_name: File name for output Excel file (use .xlsx extension).
""... | [
"Creates",
"an",
"Excel",
"file",
"containing",
"data",
"returned",
"by",
"the",
"Analytics",
"API"
] | housecanary/hc-api-python | python | https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/__init__.py#L18-L28 | [
"def",
"export_analytics_data_to_excel",
"(",
"data",
",",
"output_file_name",
",",
"result_info_key",
",",
"identifier_keys",
")",
":",
"workbook",
"=",
"create_excel_workbook",
"(",
"data",
",",
"result_info_key",
",",
"identifier_keys",
")",
"workbook",
".",
"save"... | 2bb9e2208b34e8617575de45934357ee33b8531c |
train | export_analytics_data_to_csv | Creates CSV files containing data returned by the Analytics API.
Creates one file per requested endpoint and saves it into the
specified output_folder
Args:
data: Analytics API data as a list of dicts
output_folder: Path to a folder to save the CSV files into | housecanary/excel/__init__.py | def export_analytics_data_to_csv(data, output_folder, result_info_key, identifier_keys):
"""Creates CSV files containing data returned by the Analytics API.
Creates one file per requested endpoint and saves it into the
specified output_folder
Args:
data: Analytics API data as a list of di... | def export_analytics_data_to_csv(data, output_folder, result_info_key, identifier_keys):
"""Creates CSV files containing data returned by the Analytics API.
Creates one file per requested endpoint and saves it into the
specified output_folder
Args:
data: Analytics API data as a list of di... | [
"Creates",
"CSV",
"files",
"containing",
"data",
"returned",
"by",
"the",
"Analytics",
"API",
".",
"Creates",
"one",
"file",
"per",
"requested",
"endpoint",
"and",
"saves",
"it",
"into",
"the",
"specified",
"output_folder"
] | housecanary/hc-api-python | python | https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/__init__.py#L31-L60 | [
"def",
"export_analytics_data_to_csv",
"(",
"data",
",",
"output_folder",
",",
"result_info_key",
",",
"identifier_keys",
")",
":",
"workbook",
"=",
"create_excel_workbook",
"(",
"data",
",",
"result_info_key",
",",
"identifier_keys",
")",
"suffix",
"=",
"'.csv'",
"... | 2bb9e2208b34e8617575de45934357ee33b8531c |
train | concat_excel_reports | Creates an Excel file made up of combining the Value Report or Rental Report Excel
output for the provided addresses.
Args:
addresses: A list of (address, zipcode) tuples
output_file_name: A file name for the Excel output
endpoint: One of 'value_report' or 'rental_report'
rep... | housecanary/excel/__init__.py | def concat_excel_reports(addresses, output_file_name, endpoint, report_type,
retry, api_key, api_secret, files_path):
"""Creates an Excel file made up of combining the Value Report or Rental Report Excel
output for the provided addresses.
Args:
addresses: A list of (addr... | def concat_excel_reports(addresses, output_file_name, endpoint, report_type,
retry, api_key, api_secret, files_path):
"""Creates an Excel file made up of combining the Value Report or Rental Report Excel
output for the provided addresses.
Args:
addresses: A list of (addr... | [
"Creates",
"an",
"Excel",
"file",
"made",
"up",
"of",
"combining",
"the",
"Value",
"Report",
"or",
"Rental",
"Report",
"Excel",
"output",
"for",
"the",
"provided",
"addresses",
"."
] | housecanary/hc-api-python | python | https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/__init__.py#L63-L135 | [
"def",
"concat_excel_reports",
"(",
"addresses",
",",
"output_file_name",
",",
"endpoint",
",",
"report_type",
",",
"retry",
",",
"api_key",
",",
"api_secret",
",",
"files_path",
")",
":",
"# create the master workbook to output",
"master_workbook",
"=",
"openpyxl",
"... | 2bb9e2208b34e8617575de45934357ee33b8531c |
train | create_excel_workbook | Calls the analytics_data_excel module to create the Workbook | housecanary/excel/__init__.py | def create_excel_workbook(data, result_info_key, identifier_keys):
"""Calls the analytics_data_excel module to create the Workbook"""
workbook = analytics_data_excel.get_excel_workbook(data, result_info_key, identifier_keys)
adjust_column_width_workbook(workbook)
return workbook | def create_excel_workbook(data, result_info_key, identifier_keys):
"""Calls the analytics_data_excel module to create the Workbook"""
workbook = analytics_data_excel.get_excel_workbook(data, result_info_key, identifier_keys)
adjust_column_width_workbook(workbook)
return workbook | [
"Calls",
"the",
"analytics_data_excel",
"module",
"to",
"create",
"the",
"Workbook"
] | housecanary/hc-api-python | python | https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/__init__.py#L237-L241 | [
"def",
"create_excel_workbook",
"(",
"data",
",",
"result_info_key",
",",
"identifier_keys",
")",
":",
"workbook",
"=",
"analytics_data_excel",
".",
"get_excel_workbook",
"(",
"data",
",",
"result_info_key",
",",
"identifier_keys",
")",
"adjust_column_width_workbook",
"... | 2bb9e2208b34e8617575de45934357ee33b8531c |
train | adjust_column_width | Adjust column width in worksheet.
Args:
worksheet: worksheet to be adjusted | housecanary/excel/__init__.py | def adjust_column_width(worksheet):
"""Adjust column width in worksheet.
Args:
worksheet: worksheet to be adjusted
"""
dims = {}
padding = 1
for row in worksheet.rows:
for cell in row:
if not cell.value:
continue
dims[cell.column] = max(
... | def adjust_column_width(worksheet):
"""Adjust column width in worksheet.
Args:
worksheet: worksheet to be adjusted
"""
dims = {}
padding = 1
for row in worksheet.rows:
for cell in row:
if not cell.value:
continue
dims[cell.column] = max(
... | [
"Adjust",
"column",
"width",
"in",
"worksheet",
"."
] | housecanary/hc-api-python | python | https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/__init__.py#L250-L267 | [
"def",
"adjust_column_width",
"(",
"worksheet",
")",
":",
"dims",
"=",
"{",
"}",
"padding",
"=",
"1",
"for",
"row",
"in",
"worksheet",
".",
"rows",
":",
"for",
"cell",
"in",
"row",
":",
"if",
"not",
"cell",
".",
"value",
":",
"continue",
"dims",
"[",... | 2bb9e2208b34e8617575de45934357ee33b8531c |
train | get_ap_info | function takes input of ipaddress to RESTFUL call to HP IMC
:param ipaddress: The current IP address of the Access Point at time of query.
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.auth... | build/lib/pyhpeimc/wsm/apinfo.py | def get_ap_info(ipaddress, auth, url):
"""
function takes input of ipaddress to RESTFUL call to HP IMC
:param ipaddress: The current IP address of the Access Point at time of query.
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS ... | def get_ap_info(ipaddress, auth, url):
"""
function takes input of ipaddress to RESTFUL call to HP IMC
:param ipaddress: The current IP address of the Access Point at time of query.
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS ... | [
"function",
"takes",
"input",
"of",
"ipaddress",
"to",
"RESTFUL",
"call",
"to",
"HP",
"IMC"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/wsm/apinfo.py#L91-L167 | [
"def",
"get_ap_info",
"(",
"ipaddress",
",",
"auth",
",",
"url",
")",
":",
"get_ap_info_url",
"=",
"\"/imcrs/wlan/apInfo/queryApBasicInfoByCondition?ipAddress=\"",
"+",
"str",
"(",
"ipaddress",
")",
"f_url",
"=",
"url",
"+",
"get_ap_info_url",
"payload",
"=",
"None"... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | sessions | List and manage compute sessions. | src/ai/backend/client/cli/admin/sessions.py | def sessions(status, access_key, id_only, all):
'''
List and manage compute sessions.
'''
fields = [
('Session ID', 'sess_id'),
]
with Session() as session:
if is_admin(session):
fields.append(('Owner', 'access_key'))
if not id_only:
fields.extend([
... | def sessions(status, access_key, id_only, all):
'''
List and manage compute sessions.
'''
fields = [
('Session ID', 'sess_id'),
]
with Session() as session:
if is_admin(session):
fields.append(('Owner', 'access_key'))
if not id_only:
fields.extend([
... | [
"List",
"and",
"manage",
"compute",
"sessions",
"."
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/sessions.py#L24-L133 | [
"def",
"sessions",
"(",
"status",
",",
"access_key",
",",
"id_only",
",",
"all",
")",
":",
"fields",
"=",
"[",
"(",
"'Session ID'",
",",
"'sess_id'",
")",
",",
"]",
"with",
"Session",
"(",
")",
"as",
"session",
":",
"if",
"is_admin",
"(",
"session",
... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | session | Show detailed information for a running compute session.
SESSID: Session id or its alias. | src/ai/backend/client/cli/admin/sessions.py | def session(sess_id_or_alias):
'''
Show detailed information for a running compute session.
SESSID: Session id or its alias.
'''
fields = [
('Session ID', 'sess_id'),
('Role', 'role'),
('Image', 'image'),
('Tag', 'tag'),
('Created At', 'created_at'),
... | def session(sess_id_or_alias):
'''
Show detailed information for a running compute session.
SESSID: Session id or its alias.
'''
fields = [
('Session ID', 'sess_id'),
('Role', 'role'),
('Image', 'image'),
('Tag', 'tag'),
('Created At', 'created_at'),
... | [
"Show",
"detailed",
"information",
"for",
"a",
"running",
"compute",
"session",
"."
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/sessions.py#L140-L189 | [
"def",
"session",
"(",
"sess_id_or_alias",
")",
":",
"fields",
"=",
"[",
"(",
"'Session ID'",
",",
"'sess_id'",
")",
",",
"(",
"'Role'",
",",
"'role'",
")",
",",
"(",
"'Image'",
",",
"'image'",
")",
",",
"(",
"'Tag'",
",",
"'tag'",
")",
",",
"(",
"... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | Response.create | Factory for creating the correct type of Response based on the data.
Args:
endpoint_name (str) - The endpoint of the request, such as "property/value"
json_body - The response body in json format.
original_response (response object) - server response returned from an http req... | housecanary/response.py | def create(cls, endpoint_name, json_body, original_response):
"""Factory for creating the correct type of Response based on the data.
Args:
endpoint_name (str) - The endpoint of the request, such as "property/value"
json_body - The response body in json format.
origin... | def create(cls, endpoint_name, json_body, original_response):
"""Factory for creating the correct type of Response based on the data.
Args:
endpoint_name (str) - The endpoint of the request, such as "property/value"
json_body - The response body in json format.
origin... | [
"Factory",
"for",
"creating",
"the",
"correct",
"type",
"of",
"Response",
"based",
"on",
"the",
"data",
".",
"Args",
":",
"endpoint_name",
"(",
"str",
")",
"-",
"The",
"endpoint",
"of",
"the",
"request",
"such",
"as",
"property",
"/",
"value",
"json_body",... | housecanary/hc-api-python | python | https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/response.py#L34-L59 | [
"def",
"create",
"(",
"cls",
",",
"endpoint_name",
",",
"json_body",
",",
"original_response",
")",
":",
"if",
"endpoint_name",
"==",
"\"property/value_report\"",
":",
"return",
"ValueReportResponse",
"(",
"endpoint_name",
",",
"json_body",
",",
"original_response",
... | 2bb9e2208b34e8617575de45934357ee33b8531c |
train | Response.get_object_errors | Gets a list of business error message strings
for each of the requested objects that had a business error.
If there was no error, returns an empty list
Returns:
List of strings | housecanary/response.py | def get_object_errors(self):
"""Gets a list of business error message strings
for each of the requested objects that had a business error.
If there was no error, returns an empty list
Returns:
List of strings
"""
if self._object_errors is None:
se... | def get_object_errors(self):
"""Gets a list of business error message strings
for each of the requested objects that had a business error.
If there was no error, returns an empty list
Returns:
List of strings
"""
if self._object_errors is None:
se... | [
"Gets",
"a",
"list",
"of",
"business",
"error",
"message",
"strings",
"for",
"each",
"of",
"the",
"requested",
"objects",
"that",
"had",
"a",
"business",
"error",
".",
"If",
"there",
"was",
"no",
"error",
"returns",
"an",
"empty",
"list"
] | housecanary/hc-api-python | python | https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/response.py#L87-L100 | [
"def",
"get_object_errors",
"(",
"self",
")",
":",
"if",
"self",
".",
"_object_errors",
"is",
"None",
":",
"self",
".",
"_object_errors",
"=",
"[",
"{",
"str",
"(",
"o",
")",
":",
"o",
".",
"get_errors",
"(",
")",
"}",
"for",
"o",
"in",
"self",
"."... | 2bb9e2208b34e8617575de45934357ee33b8531c |
train | Response.has_object_error | Returns true if any requested object had a business logic error,
otherwise returns false
Returns:
boolean | housecanary/response.py | def has_object_error(self):
"""Returns true if any requested object had a business logic error,
otherwise returns false
Returns:
boolean
"""
if self._has_object_error is None:
# scan the objects for any business error codes
self._has_object_er... | def has_object_error(self):
"""Returns true if any requested object had a business logic error,
otherwise returns false
Returns:
boolean
"""
if self._has_object_error is None:
# scan the objects for any business error codes
self._has_object_er... | [
"Returns",
"true",
"if",
"any",
"requested",
"object",
"had",
"a",
"business",
"logic",
"error",
"otherwise",
"returns",
"false"
] | housecanary/hc-api-python | python | https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/response.py#L102-L115 | [
"def",
"has_object_error",
"(",
"self",
")",
":",
"if",
"self",
".",
"_has_object_error",
"is",
"None",
":",
"# scan the objects for any business error codes",
"self",
".",
"_has_object_error",
"=",
"next",
"(",
"(",
"True",
"for",
"o",
"in",
"self",
".",
"objec... | 2bb9e2208b34e8617575de45934357ee33b8531c |
train | Response.rate_limits | Returns a list of rate limit details. | housecanary/response.py | def rate_limits(self):
"""Returns a list of rate limit details."""
if not self._rate_limits:
self._rate_limits = utilities.get_rate_limits(self.response)
return self._rate_limits | def rate_limits(self):
"""Returns a list of rate limit details."""
if not self._rate_limits:
self._rate_limits = utilities.get_rate_limits(self.response)
return self._rate_limits | [
"Returns",
"a",
"list",
"of",
"rate",
"limit",
"details",
"."
] | housecanary/hc-api-python | python | https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/response.py#L139-L144 | [
"def",
"rate_limits",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_rate_limits",
":",
"self",
".",
"_rate_limits",
"=",
"utilities",
".",
"get_rate_limits",
"(",
"self",
".",
"response",
")",
"return",
"self",
".",
"_rate_limits"
] | 2bb9e2208b34e8617575de45934357ee33b8531c |
train | check_imc_creds | Function takes input of auth class object auth object and URL and returns a BOOL of TRUE
if the authentication was successful.
>>> auth = IMCAuth("http://", "10.101.0.203", "8080", "admin", "admin")
>>> check_imc_creds(auth.creds, auth.url)
True | pyhpeimc/auth.py | def check_imc_creds(auth, url):
"""Function takes input of auth class object auth object and URL and returns a BOOL of TRUE
if the authentication was successful.
>>> auth = IMCAuth("http://", "10.101.0.203", "8080", "admin", "admin")
>>> check_imc_creds(auth.creds, auth.url)
True
"""
tes... | def check_imc_creds(auth, url):
"""Function takes input of auth class object auth object and URL and returns a BOOL of TRUE
if the authentication was successful.
>>> auth = IMCAuth("http://", "10.101.0.203", "8080", "admin", "admin")
>>> check_imc_creds(auth.creds, auth.url)
True
"""
tes... | [
"Function",
"takes",
"input",
"of",
"auth",
"class",
"object",
"auth",
"object",
"and",
"URL",
"and",
"returns",
"a",
"BOOL",
"of",
"TRUE",
"if",
"the",
"authentication",
"was",
"successful",
"."
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/auth.py#L73-L89 | [
"def",
"check_imc_creds",
"(",
"auth",
",",
"url",
")",
":",
"test_url",
"=",
"'/imcrs'",
"f_url",
"=",
"url",
"+",
"test_url",
"try",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"f_url",
",",
"auth",
"=",
"auth",
",",
"headers",
"=",
"HEADERS",... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | print_to_file | 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 | pyhpeimc/auth.py | def print_to_file(object_name):
"""
Function takes in object of type str, list, or dict and prints out to current working
directory as pyoutput.txt
:param: Object: object of type str, list, or dict
:return: No return. Just prints out to file handler and save to current working directory as
pyou... | def print_to_file(object_name):
"""
Function takes in object of type str, list, or dict and prints out to current working
directory as pyoutput.txt
:param: Object: object of type str, list, or dict
:return: No return. Just prints out to file handler and save to current working directory as
pyou... | [
"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",
... | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/auth.py#L128-L144 | [
"def",
"print_to_file",
"(",
"object_name",
")",
":",
"with",
"open",
"(",
"'pyoutput.txt'",
",",
"'w'",
")",
"as",
"filehandler",
":",
"output",
"=",
"None",
"if",
"isinstance",
"(",
"object_name",
",",
"list",
")",
":",
"output",
"=",
"json",
".",
"dum... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | IMCAuth.get_auth | This method requests an authentication object from the HPE IMC NMS and returns an
HTTPDigest Auth Object
:return: | pyhpeimc/auth.py | def get_auth(self):
"""
This method requests an authentication object from the HPE IMC NMS and returns an
HTTPDigest Auth Object
:return:
"""
url = self.h_url + self.server + ":" + self.port
auth = requests.auth.HTTPDigestAuth(self.username, self.password)
... | def get_auth(self):
"""
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)
... | [
"This",
"method",
"requests",
"an",
"authentication",
"object",
"from",
"the",
"HPE",
"IMC",
"NMS",
"and",
"returns",
"an",
"HTTPDigest",
"Auth",
"Object",
":",
"return",
":"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/auth.py#L54-L70 | [
"def",
"get_auth",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"h_url",
"+",
"self",
".",
"server",
"+",
"\":\"",
"+",
"self",
".",
"port",
"auth",
"=",
"requests",
".",
"auth",
".",
"HTTPDigestAuth",
"(",
"self",
".",
"username",
",",
"self",
... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | print_title | Print title like ``----- {title} -----`` or ``===== {title} =====``.
:param title: Title.
:param is_end: Whether is end title. End title use ``=`` instead of ``-``.
:return: None. | tools/waf/aoikwafutil.py | def print_title(title, is_end=False):
"""
Print title like ``----- {title} -----`` or ``===== {title} =====``.
:param title: Title.
:param is_end: Whether is end title. End title use ``=`` instead of ``-``.
:return: None.
"""
# If is end title
if is_end:
# Use `=`
sep ... | def print_title(title, is_end=False):
"""
Print title like ``----- {title} -----`` or ``===== {title} =====``.
:param title: Title.
:param is_end: Whether is end title. End title use ``=`` instead of ``-``.
:return: None.
"""
# If is end title
if is_end:
# Use `=`
sep ... | [
"Print",
"title",
"like",
"-----",
"{",
"title",
"}",
"-----",
"or",
"=====",
"{",
"title",
"}",
"=====",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L69-L95 | [
"def",
"print_title",
"(",
"title",
",",
"is_end",
"=",
"False",
")",
":",
"# If is end title",
"if",
"is_end",
":",
"# Use `=`",
"sep",
"=",
"'====='",
"# If is not end title",
"else",
":",
"# Use `-`",
"sep",
"=",
"'-----'",
"# If is not end title",
"if",
"not... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | get_full_python_version | Get full Python version.
E.g.
- `2.7.11.final.0.32bit`
- `3.5.1.final.0.64bit`
:return: Full Python version. | tools/waf/aoikwafutil.py | def get_full_python_version():
"""
Get full Python version.
E.g.
- `2.7.11.final.0.32bit`
- `3.5.1.final.0.64bit`
:return: Full Python version.
"""
# Get version part, e.g. `3.5.1.final.0`
version_part = '.'.join(str(x) for x in sys.version_info)
# Get integer width, e... | def get_full_python_version():
"""
Get full Python version.
E.g.
- `2.7.11.final.0.32bit`
- `3.5.1.final.0.64bit`
:return: Full Python version.
"""
# Get version part, e.g. `3.5.1.final.0`
version_part = '.'.join(str(x) for x in sys.version_info)
# Get integer width, e... | [
"Get",
"full",
"Python",
"version",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L98-L118 | [
"def",
"get_full_python_version",
"(",
")",
":",
"# Get version part, e.g. `3.5.1.final.0`",
"version_part",
"=",
"'.'",
".",
"join",
"(",
"str",
"(",
"x",
")",
"for",
"x",
"in",
"sys",
".",
"version_info",
")",
"# Get integer width, e.g. 32 or 64",
"int_width",
"="... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | get_python_path | Get given virtual environment's `python` program path.
:param venv_path: Virtual environment directory path.
:return: `python` program path. | tools/waf/aoikwafutil.py | def get_python_path(venv_path):
"""
Get given virtual environment's `python` program path.
:param venv_path: Virtual environment directory path.
:return: `python` program path.
"""
# Get `bin` directory path
bin_path = get_bin_path(venv_path)
# Get `python` program path
program_pa... | def get_python_path(venv_path):
"""
Get given virtual environment's `python` program path.
:param venv_path: Virtual environment directory path.
:return: `python` program path.
"""
# Get `bin` directory path
bin_path = get_bin_path(venv_path)
# Get `python` program path
program_pa... | [
"Get",
"given",
"virtual",
"environment",
"s",
"python",
"program",
"path",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L140-L160 | [
"def",
"get_python_path",
"(",
"venv_path",
")",
":",
"# Get `bin` directory path",
"bin_path",
"=",
"get_bin_path",
"(",
"venv_path",
")",
"# Get `python` program path",
"program_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"bin_path",
",",
"'python'",
")",
"... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | add_options | Add command line options.
:return: None. | tools/waf/aoikwafutil.py | def add_options(ctx):
"""
Add command line options.
:return: None.
"""
# Add option
ctx.add_option(
'--always',
action='store_true',
default=False,
dest='always',
help='whether always run tasks.',
)
# Add option
ctx.add_option(
'--che... | def add_options(ctx):
"""
Add command line options.
:return: None.
"""
# Add option
ctx.add_option(
'--always',
action='store_true',
default=False,
dest='always',
help='whether always run tasks.',
)
# Add option
ctx.add_option(
'--che... | [
"Add",
"command",
"line",
"options",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L186-L240 | [
"def",
"add_options",
"(",
"ctx",
")",
":",
"# Add option",
"ctx",
".",
"add_option",
"(",
"'--always'",
",",
"action",
"=",
"'store_true'",
",",
"default",
"=",
"False",
",",
"dest",
"=",
"'always'",
",",
"help",
"=",
"'whether always run tasks.'",
",",
")"... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | add_pythonpath | Prepend given path to environment variable PYTHONPATH.
:param path: Path to add to PYTHONPATH.
:return: New PYTHONPATH value. | tools/waf/aoikwafutil.py | def add_pythonpath(path):
"""
Prepend given path to environment variable PYTHONPATH.
:param path: Path to add to PYTHONPATH.
:return: New PYTHONPATH value.
"""
# Get PYTHONPATH value. Default is empty string.
pythonpath = os.environ.setdefault('PYTHONPATH', '')
# If given path is not ... | def add_pythonpath(path):
"""
Prepend given path to environment variable PYTHONPATH.
:param path: Path to add to PYTHONPATH.
:return: New PYTHONPATH value.
"""
# Get PYTHONPATH value. Default is empty string.
pythonpath = os.environ.setdefault('PYTHONPATH', '')
# If given path is not ... | [
"Prepend",
"given",
"path",
"to",
"environment",
"variable",
"PYTHONPATH",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L243-L261 | [
"def",
"add_pythonpath",
"(",
"path",
")",
":",
"# Get PYTHONPATH value. Default is empty string.",
"pythonpath",
"=",
"os",
".",
"environ",
".",
"setdefault",
"(",
"'PYTHONPATH'",
",",
"''",
")",
"# If given path is not in PYTHONPATH",
"if",
"path",
"not",
"in",
"pyt... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | mark_path | Wrap given path as relative path relative to top directory.
Wrapper object will be handled specially in \
:paramref:`create_cmd_task.parts`.
:param path: Relative path relative to top directory.
:return: Wrapper object. | tools/waf/aoikwafutil.py | def mark_path(path):
"""
Wrap given path as relative path relative to top directory.
Wrapper object will be handled specially in \
:paramref:`create_cmd_task.parts`.
:param path: Relative path relative to top directory.
:return: Wrapper object.
"""
# If given path is not string,
#... | def mark_path(path):
"""
Wrap given path as relative path relative to top directory.
Wrapper object will be handled specially in \
:paramref:`create_cmd_task.parts`.
:param path: Relative path relative to top directory.
:return: Wrapper object.
"""
# If given path is not string,
#... | [
"Wrap",
"given",
"path",
"as",
"relative",
"path",
"relative",
"to",
"top",
"directory",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L323-L349 | [
"def",
"mark_path",
"(",
"path",
")",
":",
"# If given path is not string,",
"# or given path is absolute path.",
"if",
"not",
"isinstance",
"(",
"path",
",",
"str",
")",
"or",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"# Get error message",
"msg",... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | _mark_target | Wrap given item as input or output target that should be added to task.
Wrapper object will be handled specially in \
:paramref:`create_cmd_task.parts`.
:param type: Target type.
Allowed values:
- 'input'
- 'output'
:param item: Item to mark as input or output target.... | tools/waf/aoikwafutil.py | def _mark_target(type, item):
"""
Wrap given item as input or output target that should be added to task.
Wrapper object will be handled specially in \
:paramref:`create_cmd_task.parts`.
:param type: Target type.
Allowed values:
- 'input'
- 'output'
:param ite... | def _mark_target(type, item):
"""
Wrap given item as input or output target that should be added to task.
Wrapper object will be handled specially in \
:paramref:`create_cmd_task.parts`.
:param type: Target type.
Allowed values:
- 'input'
- 'output'
:param ite... | [
"Wrap",
"given",
"item",
"as",
"input",
"or",
"output",
"target",
"that",
"should",
"be",
"added",
"to",
"task",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L352-L411 | [
"def",
"_mark_target",
"(",
"type",
",",
"item",
")",
":",
"# If given type is not valid",
"if",
"type",
"not",
"in",
"(",
"'input'",
",",
"'output'",
")",
":",
"# Get error message",
"msg",
"=",
"'Error (7D74X): Type is not valid: {0}'",
".",
"format",
"(",
"type... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | create_node | Create node for given relative path.
:param ctx: BuildContext object.
:param path: Relative path relative to top directory.
:return: Created Node. | tools/waf/aoikwafutil.py | def create_node(ctx, path):
"""
Create node for given relative path.
:param ctx: BuildContext object.
:param path: Relative path relative to top directory.
:return: Created Node.
"""
# Ensure given context object is BuildContext object
_ensure_build_context(ctx)
# Get top directo... | def create_node(ctx, path):
"""
Create node for given relative path.
:param ctx: BuildContext object.
:param path: Relative path relative to top directory.
:return: Created Node.
"""
# Ensure given context object is BuildContext object
_ensure_build_context(ctx)
# Get top directo... | [
"Create",
"node",
"for",
"given",
"relative",
"path",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L470-L498 | [
"def",
"create_node",
"(",
"ctx",
",",
"path",
")",
":",
"# Ensure given context object is BuildContext object",
"_ensure_build_context",
"(",
"ctx",
")",
"# Get top directory's relative path relative to `wscript` directory",
"top_dir_relpath",
"=",
"os",
".",
"path",
".",
"r... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | _normalize_items | Normalize given items.
Do several things:
- Ignore None.
- Flatten list.
- Unwrap wrapped item in `_ItemWrapper`.
:param ctx: BuildContext object.
:param items: Items list to normalize.
:param str_to_node: Convert string to node.
:param node_to_str: Convert node to absol... | tools/waf/aoikwafutil.py | def _normalize_items(
ctx,
items,
str_to_node=False,
node_to_str=False,
allow_task=False,
):
"""
Normalize given items.
Do several things:
- Ignore None.
- Flatten list.
- Unwrap wrapped item in `_ItemWrapper`.
:param ctx: BuildContext object.
:param it... | def _normalize_items(
ctx,
items,
str_to_node=False,
node_to_str=False,
allow_task=False,
):
"""
Normalize given items.
Do several things:
- Ignore None.
- Flatten list.
- Unwrap wrapped item in `_ItemWrapper`.
:param ctx: BuildContext object.
:param it... | [
"Normalize",
"given",
"items",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L501-L666 | [
"def",
"_normalize_items",
"(",
"ctx",
",",
"items",
",",
"str_to_node",
"=",
"False",
",",
"node_to_str",
"=",
"False",
",",
"allow_task",
"=",
"False",
",",
")",
":",
"# Ensure given context object is BuildContext object",
"_ensure_build_context",
"(",
"ctx",
")",... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | update_touch_file | Update touch file at given path.
Do two things:
- Create touch file if it not exists.
- Update touch file if import checking fails.
The returned touch file node is used as task's output target for dirty
checking. Task will run if the touch file changes.
:param ctx: BuildContext instan... | tools/waf/aoikwafutil.py | def update_touch_file(
ctx,
path,
check_import=False,
check_import_module=None,
check_import_python=None,
always=False,
):
"""
Update touch file at given path.
Do two things:
- Create touch file if it not exists.
- Update touch file if import checking fails.
The... | def update_touch_file(
ctx,
path,
check_import=False,
check_import_module=None,
check_import_python=None,
always=False,
):
"""
Update touch file at given path.
Do two things:
- Create touch file if it not exists.
- Update touch file if import checking fails.
The... | [
"Update",
"touch",
"file",
"at",
"given",
"path",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L685-L855 | [
"def",
"update_touch_file",
"(",
"ctx",
",",
"path",
",",
"check_import",
"=",
"False",
",",
"check_import_module",
"=",
"None",
",",
"check_import_python",
"=",
"None",
",",
"always",
"=",
"False",
",",
")",
":",
"# Ensure given context object is BuildContext objec... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | chain_tasks | Chain given tasks. Set each task to run after its previous task.
:param tasks: Tasks list.
:return: Given tasks list. | tools/waf/aoikwafutil.py | def chain_tasks(tasks):
"""
Chain given tasks. Set each task to run after its previous task.
:param tasks: Tasks list.
:return: Given tasks list.
"""
# If given tasks list is not empty
if tasks:
# Previous task
previous_task = None
# For given tasks list's each tas... | def chain_tasks(tasks):
"""
Chain given tasks. Set each task to run after its previous task.
:param tasks: Tasks list.
:return: Given tasks list.
"""
# If given tasks list is not empty
if tasks:
# Previous task
previous_task = None
# For given tasks list's each tas... | [
"Chain",
"given",
"tasks",
".",
"Set",
"each",
"task",
"to",
"run",
"after",
"its",
"previous",
"task",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1030-L1057 | [
"def",
"chain_tasks",
"(",
"tasks",
")",
":",
"# If given tasks list is not empty",
"if",
"tasks",
":",
"# Previous task",
"previous_task",
"=",
"None",
"# For given tasks list's each task",
"for",
"task",
"in",
"tasks",
":",
"# If the task is not None.",
"# Task can be Non... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | create_cmd_task | Create task that runs given command.
:param ctx: BuildContext object.
:param parts: Command parts list.
Each part can be:
- **None**: Will be ignored.
- **String**: Will be used as-is.
- **Node object**: Will be converted to absolute path.
- **List of t... | tools/waf/aoikwafutil.py | def create_cmd_task(
ctx,
parts,
inputs=None,
outputs=None,
env=None,
cwd=None,
task_name=None,
cache_key=None,
always=False,
add_to_group=True,
):
"""
Create task that runs given command.
:param ctx: BuildContext object.
:param parts: Command parts list.
... | def create_cmd_task(
ctx,
parts,
inputs=None,
outputs=None,
env=None,
cwd=None,
task_name=None,
cache_key=None,
always=False,
add_to_group=True,
):
"""
Create task that runs given command.
:param ctx: BuildContext object.
:param parts: Command parts list.
... | [
"Create",
"task",
"that",
"runs",
"given",
"command",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1066-L1370 | [
"def",
"create_cmd_task",
"(",
"ctx",
",",
"parts",
",",
"inputs",
"=",
"None",
",",
"outputs",
"=",
"None",
",",
"env",
"=",
"None",
",",
"cwd",
"=",
"None",
",",
"task_name",
"=",
"None",
",",
"cache_key",
"=",
"None",
",",
"always",
"=",
"False",
... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | build_ctx | Decorator that makes decorated function use BuildContext instead of \
Context instance. BuildContext instance has more methods.
:param pythonpath: Path or list of paths to add to environment variable
PYTHONPATH. Each path can be absolute path, or relative path relative
to top directory.
... | tools/waf/aoikwafutil.py | def build_ctx(pythonpath=None):
"""
Decorator that makes decorated function use BuildContext instead of \
Context instance. BuildContext instance has more methods.
:param pythonpath: Path or list of paths to add to environment variable
PYTHONPATH. Each path can be absolute path, or relative pat... | def build_ctx(pythonpath=None):
"""
Decorator that makes decorated function use BuildContext instead of \
Context instance. BuildContext instance has more methods.
:param pythonpath: Path or list of paths to add to environment variable
PYTHONPATH. Each path can be absolute path, or relative pat... | [
"Decorator",
"that",
"makes",
"decorated",
"function",
"use",
"BuildContext",
"instead",
"of",
"\\",
"Context",
"instance",
".",
"BuildContext",
"instance",
"has",
"more",
"methods",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1373-L1485 | [
"def",
"build_ctx",
"(",
"pythonpath",
"=",
"None",
")",
":",
"# If argument `pythonpath` is string",
"if",
"isinstance",
"(",
"pythonpath",
",",
"str",
")",
":",
"# Create paths list containing the string",
"path_s",
"=",
"[",
"pythonpath",
"]",
"# If argument `pythonp... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | config_ctx | Decorator that makes decorated function use ConfigurationContext instead \
of Context instance.
:param func: Decorated function.
:return: Decorated function. | tools/waf/aoikwafutil.py | def config_ctx(func):
"""
Decorator that makes decorated function use ConfigurationContext instead \
of Context instance.
:param func: Decorated function.
:return: Decorated function.
"""
# Create ConfigurationContext subclass
class _ConfigurationContext(ConfigurationContext):
... | def config_ctx(func):
"""
Decorator that makes decorated function use ConfigurationContext instead \
of Context instance.
:param func: Decorated function.
:return: Decorated function.
"""
# Create ConfigurationContext subclass
class _ConfigurationContext(ConfigurationContext):
... | [
"Decorator",
"that",
"makes",
"decorated",
"function",
"use",
"ConfigurationContext",
"instead",
"\\",
"of",
"Context",
"instance",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1488-L1509 | [
"def",
"config_ctx",
"(",
"func",
")",
":",
"# Create ConfigurationContext subclass",
"class",
"_ConfigurationContext",
"(",
"ConfigurationContext",
")",
":",
"# Set command name for the context class",
"cmd",
"=",
"func",
".",
"__name__",
"# Set function name for the context c... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | print_ctx | Print given context's info.
:param ctx: Context object.
:return: None. | tools/waf/aoikwafutil.py | def print_ctx(ctx):
"""
Print given context's info.
:param ctx: Context object.
:return: None.
"""
# Print title
print_title('ctx attributes')
# Print context object's attributes
print_text(dir(ctx))
# Print end title
print_title('ctx attributes', is_end=True)
# Prin... | def print_ctx(ctx):
"""
Print given context's info.
:param ctx: Context object.
:return: None.
"""
# Print title
print_title('ctx attributes')
# Print context object's attributes
print_text(dir(ctx))
# Print end title
print_title('ctx attributes', is_end=True)
# Prin... | [
"Print",
"given",
"context",
"s",
"info",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1512-L1548 | [
"def",
"print_ctx",
"(",
"ctx",
")",
":",
"# Print title",
"print_title",
"(",
"'ctx attributes'",
")",
"# Print context object's attributes",
"print_text",
"(",
"dir",
"(",
"ctx",
")",
")",
"# Print end title",
"print_title",
"(",
"'ctx attributes'",
",",
"is_end",
... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | virtualenv_setup | 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... | tools/waf/aoikwafutil.py | 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,
cache_key=None,
always=False,
):
"""
Create task that sets up `virtualenv` package.
:param ctx: BuildContext object.
:param p... | [
"Create",
"task",
"that",
"sets",
"up",
"virtualenv",
"package",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1658-L1805 | [
"def",
"virtualenv_setup",
"(",
"ctx",
",",
"python",
",",
"inputs",
"=",
"None",
",",
"outputs",
"=",
"None",
",",
"touch",
"=",
"None",
",",
"check_import",
"=",
"False",
",",
"pip_setup_file",
"=",
"None",
",",
"pip_setup_touch",
"=",
"None",
",",
"ca... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | create_venv | 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... | tools/waf/aoikwafutil.py | 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=None,
cache_key=None,
always=False,
):
"""
Create task that sets up virtual environment.
:param ctx: BuildContext... | [
"Create",
"task",
"that",
"sets",
"up",
"virtual",
"environment",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1808-L1936 | [
"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",... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | pip_ins_req | 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.
... | tools/waf/aoikwafutil.py | 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,
pip_setup_file=None,
pip_setup_touch=None,
virtualenv_setup_touch=None,
always=False,
):
"""
Create task that uses give... | [
"Create",
"task",
"that",
"uses",
"given",
"virtual",
"environment",
"s",
"pip",
"to",
"sets",
"up",
"\\",
"packages",
"listed",
"in",
"given",
"requirements",
"file",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L1939-L2159 | [
"def",
"pip_ins_req",
"(",
"ctx",
",",
"python",
",",
"req_path",
",",
"venv_path",
"=",
"None",
",",
"inputs",
"=",
"None",
",",
"outputs",
"=",
"None",
",",
"touch",
"=",
"None",
",",
"check_import",
"=",
"False",
",",
"check_import_module",
"=",
"None... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | git_clean | Delete all files untracked by git.
:param ctx: Context object.
:return: None. | tools/waf/aoikwafutil.py | 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):
"""
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',
... | [
"Delete",
"all",
"files",
"untracked",
"by",
"git",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L2162-L2204 | [
"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 ... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | CmdTask.run | Run command.
:return: Command exit code. | tools/waf/aoikwafutil.py | 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):
"""
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_... | [
"Run",
"command",
"."
] | AoiKuiyuyou/AoikLiveReload | python | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/tools/waf/aoikwafutil.py#L909-L1027 | [
"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... | 0d5adb12118a33749e6690a8165fdb769cff7d5c |
train | get_ac_info_all | 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 ... | build/lib/pyhpeimc/wsm/acinfo.py | 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):
"""
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 ... | [
"function",
"takes",
"no",
"input",
"as",
"input",
"to",
"RESTFUL",
"call",
"to",
"HP",
"IMC"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/wsm/acinfo.py#L15-L76 | [
"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... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | IMCDev.addvlan | 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... | pyhpeimc/objects.py | 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):
"""
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... | [
"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"... | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L118-L127 | [
"def",
"addvlan",
"(",
"self",
",",
"vlanid",
",",
"vlan_name",
")",
":",
"create_dev_vlan",
"(",
"vlanid",
",",
"vlan_name",
",",
"self",
".",
"auth",
",",
"self",
".",
"url",
",",
"devid",
"=",
"self",
".",
"devid",
")"
] | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | IMCDev.delvlan | 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: | pyhpeimc/objects.py | 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):
"""
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... | [
"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",
... | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L129-L137 | [
"def",
"delvlan",
"(",
"self",
",",
"vlanid",
")",
":",
"delete_dev_vlans",
"(",
"vlanid",
",",
"self",
".",
"auth",
",",
"self",
".",
"url",
",",
"devid",
"=",
"self",
".",
"devid",
")"
] | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | IMCDev.getipmacarp | Function operates on the IMCDev object and updates the ipmacarp attribute
:return: | pyhpeimc/objects.py | 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):
"""
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) | [
"Function",
"operates",
"on",
"the",
"IMCDev",
"object",
"and",
"updates",
"the",
"ipmacarp",
"attribute",
":",
"return",
":"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L139-L144 | [
"def",
"getipmacarp",
"(",
"self",
")",
":",
"self",
".",
"ipmacarp",
"=",
"get_ip_mac_arp_list",
"(",
"self",
".",
"auth",
",",
"self",
".",
"url",
",",
"devid",
"=",
"self",
".",
"devid",
")"
] | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | IMCInterface.down | Function operates on the IMCInterface object and configures the interface into an
administratively down state and refreshes contents of self.adminstatus
:return: | pyhpeimc/objects.py | 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):
"""
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... | [
"Function",
"operates",
"on",
"the",
"IMCInterface",
"object",
"and",
"configures",
"the",
"interface",
"into",
"an",
"administratively",
"down",
"state",
"and",
"refreshes",
"contents",
"of",
"self",
".",
"adminstatus",
":",
"return",
":"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L181-L189 | [
"def",
"down",
"(",
"self",
")",
":",
"set_interface_down",
"(",
"self",
".",
"ifIndex",
",",
"self",
".",
"auth",
",",
"self",
".",
"url",
",",
"devip",
"=",
"self",
".",
"ip",
")",
"self",
".",
"adminstatus",
"=",
"get_interface_details",
"(",
"self"... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | IMCInterface.up | Function operates on the IMCInterface object and configures the interface into an
administratively up state and refreshes contents of self.adminstatus
:return: | pyhpeimc/objects.py | 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):
"""
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=... | [
"Function",
"operates",
"on",
"the",
"IMCInterface",
"object",
"and",
"configures",
"the",
"interface",
"into",
"an",
"administratively",
"up",
"state",
"and",
"refreshes",
"contents",
"of",
"self",
".",
"adminstatus",
":",
"return",
":"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L191-L199 | [
"def",
"up",
"(",
"self",
")",
":",
"set_interface_up",
"(",
"self",
".",
"ifIndex",
",",
"self",
".",
"auth",
",",
"self",
".",
"url",
",",
"devip",
"=",
"self",
".",
"ip",
")",
"self",
".",
"adminstatus",
"=",
"get_interface_details",
"(",
"self",
... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | IPScope.allocate_ip | 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... | pyhpeimc/objects.py | 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):
"""
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 ... | [
"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... | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L223-L232 | [
"def",
"allocate_ip",
"(",
"self",
",",
"hostipaddress",
",",
"name",
",",
"description",
")",
":",
"add_scope_ip",
"(",
"hostipaddress",
",",
"name",
",",
"description",
",",
"self",
".",
"auth",
",",
"self",
".",
"url",
",",
"scopeid",
"=",
"self",
"."... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | IPScope.deallocate_ip | 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: | pyhpeimc/objects.py | 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):
"""
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, ... | [
"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"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L234-L241 | [
"def",
"deallocate_ip",
"(",
"self",
",",
"hostipaddress",
")",
":",
"delete_host_from_segment",
"(",
"hostipaddress",
",",
"self",
".",
"netaddr",
",",
"self",
".",
"auth",
",",
"self",
".",
"url",
")"
] | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | IPScope.gethosts | Method gets all hosts currently allocated to the target scope and refreashes the self.hosts
attributes of the object
:return: | pyhpeimc/objects.py | 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):
"""
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) | [
"Method",
"gets",
"all",
"hosts",
"currently",
"allocated",
"to",
"the",
"target",
"scope",
"and",
"refreashes",
"the",
"self",
".",
"hosts",
"attributes",
"of",
"the",
"object",
":",
"return",
":"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L243-L249 | [
"def",
"gethosts",
"(",
"self",
")",
":",
"self",
".",
"hosts",
"=",
"get_ip_scope_hosts",
"(",
"self",
".",
"auth",
",",
"self",
".",
"url",
",",
"self",
".",
"id",
")"
] | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | IPScope.nextfreeip | Method searches for the next free ip address in the scope object and returns it as a str
value.
:return: | pyhpeimc/objects.py | 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):
"""
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('.... | [
"Method",
"searches",
"for",
"the",
"next",
"free",
"ip",
"address",
"in",
"the",
"scope",
"object",
"and",
"returns",
"it",
"as",
"a",
"str",
"value",
".",
":",
"return",
":"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L251-L262 | [
"def",
"nextfreeip",
"(",
"self",
")",
":",
"allocated_ips",
"=",
"[",
"ipaddress",
".",
"ip_address",
"(",
"host",
"[",
"'ip'",
"]",
")",
"for",
"host",
"in",
"self",
".",
"hosts",
"]",
"for",
"ip",
"in",
"self",
".",
"netaddr",
":",
"if",
"str",
... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | IPScope.addchild | 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... | pyhpeimc/objects.py | 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):
"""
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... | [
"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... | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/objects.py#L264-L274 | [
"def",
"addchild",
"(",
"self",
",",
"startip",
",",
"endip",
",",
"name",
",",
"description",
")",
":",
"add_child_ip_scope",
"(",
"self",
".",
"auth",
",",
"self",
".",
"url",
",",
"startip",
",",
"endip",
",",
"name",
",",
"description",
",",
"self"... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | get_telnet_template | 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... | pyhpeimc/plat/system.py | 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):
"""
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... | [
"Takes",
"no",
"input",
"or",
"template_name",
"as",
"input",
"to",
"issue",
"RESTUL",
"call",
"to",
"HP",
"IMC"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L201-L239 | [
"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",
... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | modify_telnet_template | 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... | pyhpeimc/plat/system.py | 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):
"""
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 ... | [
"Function",
"takes",
"input",
"of",
"a",
"dictionry",
"containing",
"the",
"required",
"key",
"/",
"value",
"pair",
"for",
"the",
"modification",
"of",
"a",
"telnet",
"template",
"."
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L242-L284 | [
"def",
"modify_telnet_template",
"(",
"auth",
",",
"url",
",",
"telnet_template",
",",
"template_name",
"=",
"None",
",",
"template_id",
"=",
"None",
")",
":",
"if",
"template_name",
"is",
"None",
":",
"template_name",
"=",
"telnet_template",
"[",
"'name'",
"]... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | delete_telnet_template | 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... | pyhpeimc/plat/system.py | 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):
"""
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... | [
"Takes",
"template_name",
"as",
"input",
"to",
"issue",
"RESTUL",
"call",
"to",
"HP",
"IMC",
"which",
"will",
"delete",
"the",
"specific",
"telnet",
"template",
"from",
"the",
"IMC",
"system"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L287-L317 | [
"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... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | create_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
... | pyhpeimc/plat/system.py | 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 ):
"""
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... | [
"Function",
"takes",
"input",
"of",
"a",
"dictionry",
"containing",
"the",
"required",
"key",
"/",
"value",
"pair",
"for",
"the",
"creation",
"of",
"a",
"ssh",
"template",
"."
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L322-L355 | [
"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"... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | get_ssh_template | 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... | pyhpeimc/plat/system.py | 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):
"""
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
... | [
"Takes",
"no",
"input",
"or",
"template_name",
"as",
"input",
"to",
"issue",
"RESTUL",
"call",
"to",
"HP",
"IMC"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L357-L394 | [
"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",
"=",... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | modify_ssh_template | 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... | pyhpeimc/plat/system.py | 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):
"""
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 ... | [
"Function",
"takes",
"input",
"of",
"a",
"dictionry",
"containing",
"the",
"required",
"key",
"/",
"value",
"pair",
"for",
"the",
"modification",
"of",
"a",
"ssh",
"template",
"."
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L397-L439 | [
"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"... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | delete_ssh_template | 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... | pyhpeimc/plat/system.py | 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):
"""
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... | [
"Takes",
"template_name",
"as",
"input",
"to",
"issue",
"RESTUL",
"call",
"to",
"HP",
"IMC",
"which",
"will",
"delete",
"the",
"specific",
"ssh",
"template",
"from",
"the",
"IMC",
"system"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L442-L472 | [
"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",
")",... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | get_snmp_templates | 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... | pyhpeimc/plat/system.py | 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):
"""
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... | [
"Takes",
"no",
"input",
"or",
"template_name",
"as",
"input",
"to",
"issue",
"RESTUL",
"call",
"to",
"HP",
"IMC"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L530-L566 | [
"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",
"... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | modify_snmp_template | 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 ... | pyhpeimc/plat/system.py | 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):
"""
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... | [
"Function",
"takes",
"input",
"of",
"a",
"dictionry",
"containing",
"the",
"required",
"key",
"/",
"value",
"pair",
"for",
"the",
"modification",
"of",
"a",
"snmp",
"template",
"."
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L569-L619 | [
"def",
"modify_snmp_template",
"(",
"auth",
",",
"url",
",",
"snmp_template",
",",
"template_name",
"=",
"None",
",",
"template_id",
"=",
"None",
")",
":",
"if",
"template_name",
"is",
"None",
":",
"template_name",
"=",
"snmp_template",
"[",
"'name'",
"]",
"... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | delete_snmp_template | 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... | pyhpeimc/plat/system.py | 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):
"""
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... | [
"Takes",
"template_name",
"as",
"input",
"to",
"issue",
"RESTUL",
"call",
"to",
"HP",
"IMC",
"which",
"will",
"delete",
"the",
"specific",
"snmp",
"template",
"from",
"the",
"IMC",
"system"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L622-L652 | [
"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",
... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | get_dev_asset_details | Takes in ipaddress as input to fetch device assett details from HP IMC RESTFUL API
:param ipaddress: IP address of the device you wish to gather the asset details
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url... | pyhpeimc/plat/netassets.py | 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):
"""Takes in ipaddress as input to fetch device assett details from HP IMC RESTFUL API
:param ipaddress: IP address of the device you wish to gather the asset details
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:p... | [
"Takes",
"in",
"ipaddress",
"as",
"input",
"to",
"fetch",
"device",
"assett",
"details",
"from",
"HP",
"IMC",
"RESTFUL",
"API"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/netassets.py#L21-L68 | [
"def",
"get_dev_asset_details",
"(",
"ipaddress",
",",
"auth",
",",
"url",
")",
":",
"ipaddress",
"=",
"get_dev_details",
"(",
"ipaddress",
",",
"auth",
",",
"url",
")",
"if",
"isinstance",
"(",
"ipaddress",
",",
"dict",
")",
":",
"ipaddress",
"=",
"ipaddr... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | get_dev_asset_details_all | 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... | pyhpeimc/plat/netassets.py | 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):
"""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 ... | [
"Takes",
"no",
"input",
"to",
"fetch",
"device",
"assett",
"details",
"from",
"HP",
"IMC",
"RESTFUL",
"API"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/netassets.py#L71-L102 | [
"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",
")... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | proxy | Run a non-encrypted non-authorized API proxy server.
Use this only for development and testing! | src/ai/backend/client/cli/proxy.py | 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):
"""
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... | [
"Run",
"a",
"non",
"-",
"encrypted",
"non",
"-",
"authorized",
"API",
"proxy",
"server",
".",
"Use",
"this",
"only",
"for",
"development",
"and",
"testing!"
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/proxy.py#L194-L208 | [
"def",
"proxy",
"(",
"ctx",
",",
"bind",
",",
"port",
")",
":",
"app",
"=",
"web",
".",
"Application",
"(",
")",
"app",
".",
"on_startup",
".",
"append",
"(",
"startup_proxy",
")",
"app",
".",
"on_cleanup",
".",
"append",
"(",
"cleanup_proxy",
")",
"... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | get_all_devs | 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:... | pyhpeimc/plat/device.py | 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):
"""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... | [
"Takes",
"string",
"input",
"of",
"IP",
"address",
"to",
"issue",
"RESTUL",
"call",
"to",
"HP",
"IMC",
"\\",
"n"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L174-L225 | [
"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... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | get_dev_details | 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... | pyhpeimc/plat/device.py | 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):
"""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... | [
"Takes",
"string",
"input",
"of",
"IP",
"address",
"to",
"issue",
"RESTUL",
"call",
"to",
"HP",
"IMC"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L228-L277 | [
"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",... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | get_dev_interface | 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: ... | pyhpeimc/plat/device.py | 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):
"""
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... | [
"Function",
"takes",
"devid",
"as",
"input",
"to",
"RESTFUL",
"call",
"to",
"HP",
"IMC",
"platform",
"and",
"returns",
"list",
"of",
"device",
"interfaces"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L280-L327 | [
"def",
"get_dev_interface",
"(",
"auth",
",",
"url",
",",
"devid",
"=",
"None",
",",
"devip",
"=",
"None",
")",
":",
"if",
"devip",
"is",
"not",
"None",
":",
"devid",
"=",
"get_dev_details",
"(",
"devip",
",",
"auth",
",",
"url",
")",
"[",
"'id'",
... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | get_dev_mac_learn | 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.... | pyhpeimc/plat/device.py | 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):
"""
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... | [
"function",
"takes",
"devid",
"of",
"specific",
"device",
"and",
"issues",
"a",
"RESTFUL",
"call",
"to",
"gather",
"the",
"current",
"IP",
"-",
"MAC",
"learning",
"entries",
"on",
"the",
"target",
"device",
"."
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L518-L565 | [
"def",
"get_dev_mac_learn",
"(",
"auth",
",",
"url",
",",
"devid",
"=",
"None",
",",
"devip",
"=",
"None",
")",
":",
"if",
"devip",
"is",
"not",
"None",
":",
"devid",
"=",
"get_dev_details",
"(",
"devip",
",",
"auth",
",",
"url",
")",
"[",
"'id'",
... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | run_dev_cmd | 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... | pyhpeimc/plat/device.py | 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):
"""
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... | [
"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... | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L568-L623 | [
"def",
"run_dev_cmd",
"(",
"cmd_list",
",",
"auth",
",",
"url",
",",
"devid",
"=",
"None",
",",
"devip",
"=",
"None",
")",
":",
"if",
"devip",
"is",
"not",
"None",
":",
"devid",
"=",
"get_dev_details",
"(",
"devip",
",",
"auth",
",",
"url",
")",
"[... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | get_all_interface_details | 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... | pyhpeimc/plat/device.py | 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):
"""
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.
... | [
"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"... | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L629-L674 | [
"def",
"get_all_interface_details",
"(",
"auth",
",",
"url",
",",
"devid",
"=",
"None",
",",
"devip",
"=",
"None",
")",
":",
"if",
"devip",
"is",
"not",
"None",
":",
"devid",
"=",
"get_dev_details",
"(",
"devip",
",",
"auth",
",",
"url",
")",
"[",
"'... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | set_interface_down | 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... | pyhpeimc/plat/device.py | 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):
"""
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... | [
"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",
... | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L726-L777 | [
"def",
"set_interface_down",
"(",
"ifindex",
",",
"auth",
",",
"url",
",",
"devid",
"=",
"None",
",",
"devip",
"=",
"None",
")",
":",
"if",
"devip",
"is",
"not",
"None",
":",
"devid",
"=",
"get_dev_details",
"(",
"devip",
",",
"auth",
",",
"url",
")"... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | set_inteface_up | 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... | pyhpeimc/plat/device.py | 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):
"""
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... | [
"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",
"."
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L780-L829 | [
"def",
"set_inteface_up",
"(",
"ifindex",
",",
"auth",
",",
"url",
",",
"devid",
"=",
"None",
",",
"devip",
"=",
"None",
")",
":",
"if",
"devip",
"is",
"not",
"None",
":",
"devid",
"=",
"get_dev_details",
"(",
"devip",
",",
"auth",
",",
"url",
")",
... | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | _make_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 | pyhpeimc/plat/device.py | 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):
"""
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 | [
"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"
] | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/device.py#L884-L894 | [
"def",
"_make_cmd_list",
"(",
"cmd_list",
")",
":",
"cmd",
"=",
"''",
"for",
"i",
"in",
"cmd_list",
":",
"cmd",
"=",
"cmd",
"+",
"'\"'",
"+",
"i",
"+",
"'\",'",
"cmd",
"=",
"cmd",
"[",
":",
"-",
"1",
"]",
"return",
"cmd"
] | 4fba31827573587e03a6233c7db60f188038c8e5 |
train | KeyPair.create | Creates a new keypair with the given options.
You need an admin privilege for this operation. | src/ai/backend/client/keypair.py | 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: int = None,
fields: Iterable[str] = None) -> dict:
'''
Creates... | [
"Creates",
"a",
"new",
"keypair",
"with",
"the",
"given",
"options",
".",
"You",
"need",
"an",
"admin",
"privilege",
"for",
"this",
"operation",
"."
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/keypair.py#L24-L59 | [
"async",
"def",
"create",
"(",
"cls",
",",
"user_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"is_active",
":",
"bool",
"=",
"True",
",",
"is_admin",
":",
"bool",
"=",
"False",
",",
"resource_policy",
":",
"str",
"=",
"None",
",",
"rate_limit... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | KeyPair.update | Creates a new keypair with the given options.
You need an admin privilege for this operation. | src/ai/backend/client/keypair.py | 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) -> dict:
"""
Creates a new keypair with the given options.
You need an ad... | [
"Creates",
"a",
"new",
"keypair",
"with",
"the",
"given",
"options",
".",
"You",
"need",
"an",
"admin",
"privilege",
"for",
"this",
"operation",
"."
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/keypair.py#L63-L93 | [
"async",
"def",
"update",
"(",
"cls",
",",
"access_key",
":",
"str",
",",
"is_active",
":",
"bool",
"=",
"None",
",",
"is_admin",
":",
"bool",
"=",
"None",
",",
"resource_policy",
":",
"str",
"=",
"None",
",",
"rate_limit",
":",
"int",
"=",
"None",
"... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | KeyPair.delete | Deletes an existing keypair with given ACCESSKEY. | src/ai/backend/client/keypair.py | 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):
"""
Deletes an existing keypair with given ACCESSKEY.
"""
q = 'mutation($access_key: String!) {' \
' delete_keypair(access_key: $access_key) {' \
' ok msg' \
' }' \
'}'
variables = {
... | [
"Deletes",
"an",
"existing",
"keypair",
"with",
"given",
"ACCESSKEY",
"."
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/keypair.py#L97-L116 | [
"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",
",... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | KeyPair.list | Lists the keypairs.
You need an admin privilege for this operation. | src/ai/backend/client/keypair.py | 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[dict]:
'''
Lists the keypairs.
You need an admin privilege for this operation.
'''
if fields is None:
fields = ... | [
"Lists",
"the",
"keypairs",
".",
"You",
"need",
"an",
"admin",
"privilege",
"for",
"this",
"operation",
"."
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/keypair.py#L120-L158 | [
"async",
"def",
"list",
"(",
"cls",
",",
"user_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
"=",
"None",
",",
"is_active",
":",
"bool",
"=",
"None",
",",
"fields",
":",
"Iterable",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"Sequence",
"[",
"dic... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | KeyPair.info | Returns the keypair's information such as resource limits.
:param fields: Additional per-agent query fields to fetch.
.. versionadded:: 18.12 | src/ai/backend/client/keypair.py | 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:
'''
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... | [
"Returns",
"the",
"keypair",
"s",
"information",
"such",
"as",
"resource",
"limits",
"."
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/keypair.py#L161-L186 | [
"async",
"def",
"info",
"(",
"self",
",",
"fields",
":",
"Iterable",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"dict",
":",
"if",
"fields",
"is",
"None",
":",
"fields",
"=",
"(",
"'access_key'",
",",
"'secret_key'",
",",
"'is_active'",
",",
"'is_admin'"... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | KeyPair.activate | Activates this keypair.
You need an admin privilege for this operation. | src/ai/backend/client/keypair.py | 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:
'''
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) {' \
... | [
"Activates",
"this",
"keypair",
".",
"You",
"need",
"an",
"admin",
"privilege",
"for",
"this",
"operation",
"."
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/keypair.py#L190-L216 | [
"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'",
"' }'",
"'}'",
"... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | KeyPair.deactivate | Deactivates this keypair.
Deactivated keypairs cannot make any API requests
unless activated again by an administrator.
You need an admin privilege for this operation. | src/ai/backend/client/keypair.py | 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:
'''
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!, ... | [
"Deactivates",
"this",
"keypair",
".",
"Deactivated",
"keypairs",
"cannot",
"make",
"any",
"API",
"requests",
"unless",
"activated",
"again",
"by",
"an",
"administrator",
".",
"You",
"need",
"an",
"admin",
"privilege",
"for",
"this",
"operation",
"."
] | lablup/backend.ai-client-py | python | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/keypair.py#L220-L248 | [
"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'",
"' }'",
"'}'",
... | a063d774fea6f4350b89498c40d3c837ec3029a7 |
train | add_ip_scope | 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... | build/lib/pyhpimc/plat/termaccess.py | 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):
"""
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... | [
"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",
... | HPENetworking/PYHPEIMC | python | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/termaccess.py#L106-L142 | [
"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",
... | 4fba31827573587e03a6233c7db60f188038c8e5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.