repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator.delete_saved_sandbox | def delete_saved_sandbox(self, context, delete_saved_apps, cancellation_context):
"""
Delete a saved sandbox, along with any vms associated with it
:param ResourceCommandContext context:
:param list[DeleteSavedApp] delete_saved_apps:
:param CancellationContext cancellation_contex... | python | def delete_saved_sandbox(self, context, delete_saved_apps, cancellation_context):
"""
Delete a saved sandbox, along with any vms associated with it
:param ResourceCommandContext context:
:param list[DeleteSavedApp] delete_saved_apps:
:param CancellationContext cancellation_contex... | [
"def",
"delete_saved_sandbox",
"(",
"self",
",",
"context",
",",
"delete_saved_apps",
",",
"cancellation_context",
")",
":",
"connection",
"=",
"self",
".",
"command_wrapper",
".",
"execute_command_with_connection",
"(",
"context",
",",
"self",
".",
"delete_saved_sand... | Delete a saved sandbox, along with any vms associated with it
:param ResourceCommandContext context:
:param list[DeleteSavedApp] delete_saved_apps:
:param CancellationContext cancellation_context:
:return: list[SaveAppResult] save_app_results | [
"Delete",
"a",
"saved",
"sandbox",
"along",
"with",
"any",
"vms",
"associated",
"with",
"it",
":",
"param",
"ResourceCommandContext",
"context",
":",
":",
"param",
"list",
"[",
"DeleteSavedApp",
"]",
"delete_saved_apps",
":",
":",
"param",
"CancellationContext",
... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L204-L216 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator.deploy_from_template | def deploy_from_template(self, context, deploy_action, cancellation_context):
"""
Deploy From Template Command, will deploy vm from template
:param CancellationContext cancellation_context:
:param ResourceCommandContext context: the context of the command
:param DeployApp deploy... | python | def deploy_from_template(self, context, deploy_action, cancellation_context):
"""
Deploy From Template Command, will deploy vm from template
:param CancellationContext cancellation_context:
:param ResourceCommandContext context: the context of the command
:param DeployApp deploy... | [
"def",
"deploy_from_template",
"(",
"self",
",",
"context",
",",
"deploy_action",
",",
"cancellation_context",
")",
":",
"deploy_from_template_model",
"=",
"self",
".",
"resource_model_parser",
".",
"convert_to_resource_model",
"(",
"attributes",
"=",
"deploy_action",
"... | Deploy From Template Command, will deploy vm from template
:param CancellationContext cancellation_context:
:param ResourceCommandContext context: the context of the command
:param DeployApp deploy_action:
:return DeployAppResult deploy results | [
"Deploy",
"From",
"Template",
"Command",
"will",
"deploy",
"vm",
"from",
"template"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L218-L240 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator.deploy_clone_from_vm | def deploy_clone_from_vm(self, context, deploy_action, cancellation_context):
"""
Deploy Cloned VM From VM Command, will deploy vm from template
:param CancellationContext cancellation_context:
:param ResourceCommandContext context: the context of the command
:param DeployApp de... | python | def deploy_clone_from_vm(self, context, deploy_action, cancellation_context):
"""
Deploy Cloned VM From VM Command, will deploy vm from template
:param CancellationContext cancellation_context:
:param ResourceCommandContext context: the context of the command
:param DeployApp de... | [
"def",
"deploy_clone_from_vm",
"(",
"self",
",",
"context",
",",
"deploy_action",
",",
"cancellation_context",
")",
":",
"deploy_from_vm_model",
"=",
"self",
".",
"resource_model_parser",
".",
"convert_to_resource_model",
"(",
"attributes",
"=",
"deploy_action",
".",
... | Deploy Cloned VM From VM Command, will deploy vm from template
:param CancellationContext cancellation_context:
:param ResourceCommandContext context: the context of the command
:param DeployApp deploy_action:
:return DeployAppResult deploy results | [
"Deploy",
"Cloned",
"VM",
"From",
"VM",
"Command",
"will",
"deploy",
"vm",
"from",
"template"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L242-L264 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator.deploy_from_linked_clone | def deploy_from_linked_clone(self, context, deploy_action, cancellation_context):
"""
Deploy Cloned VM From VM Command, will deploy vm from template
:param CancellationContext cancellation_context:
:param ResourceCommandContext context: the context of the command
:param DeployAp... | python | def deploy_from_linked_clone(self, context, deploy_action, cancellation_context):
"""
Deploy Cloned VM From VM Command, will deploy vm from template
:param CancellationContext cancellation_context:
:param ResourceCommandContext context: the context of the command
:param DeployAp... | [
"def",
"deploy_from_linked_clone",
"(",
"self",
",",
"context",
",",
"deploy_action",
",",
"cancellation_context",
")",
":",
"linked_clone_from_vm_model",
"=",
"self",
".",
"resource_model_parser",
".",
"convert_to_resource_model",
"(",
"attributes",
"=",
"deploy_action",... | Deploy Cloned VM From VM Command, will deploy vm from template
:param CancellationContext cancellation_context:
:param ResourceCommandContext context: the context of the command
:param DeployApp deploy_action:
:return DeployAppResult deploy results | [
"Deploy",
"Cloned",
"VM",
"From",
"VM",
"Command",
"will",
"deploy",
"vm",
"from",
"template"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L266-L291 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator.deploy_from_image | def deploy_from_image(self, context, deploy_action, cancellation_context):
"""
Deploy From Image Command, will deploy vm from ovf image
:param CancellationContext cancellation_context:
:param ResourceCommandContext context: the context of the command
:param DeployApp deploy_acti... | python | def deploy_from_image(self, context, deploy_action, cancellation_context):
"""
Deploy From Image Command, will deploy vm from ovf image
:param CancellationContext cancellation_context:
:param ResourceCommandContext context: the context of the command
:param DeployApp deploy_acti... | [
"def",
"deploy_from_image",
"(",
"self",
",",
"context",
",",
"deploy_action",
",",
"cancellation_context",
")",
":",
"deploy_action",
".",
"actionParams",
".",
"deployment",
".",
"attributes",
"[",
"'vCenter Name'",
"]",
"=",
"context",
".",
"resource",
".",
"n... | Deploy From Image Command, will deploy vm from ovf image
:param CancellationContext cancellation_context:
:param ResourceCommandContext context: the context of the command
:param DeployApp deploy_action:
:return str deploy results | [
"Deploy",
"From",
"Image",
"Command",
"will",
"deploy",
"vm",
"from",
"ovf",
"image"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L293-L318 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator.disconnect_all | def disconnect_all(self, context, ports):
"""
Disconnect All Command, will the assign all the vnics on the vm to the default network,
which is sign to be disconnected
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param lis... | python | def disconnect_all(self, context, ports):
"""
Disconnect All Command, will the assign all the vnics on the vm to the default network,
which is sign to be disconnected
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param lis... | [
"def",
"disconnect_all",
"(",
"self",
",",
"context",
",",
"ports",
")",
":",
"resource_details",
"=",
"self",
".",
"_parse_remote_model",
"(",
"context",
")",
"# execute command",
"res",
"=",
"self",
".",
"command_wrapper",
".",
"execute_command_with_connection",
... | Disconnect All Command, will the assign all the vnics on the vm to the default network,
which is sign to be disconnected
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param list[string] ports: the ports of the connection between the remot... | [
"Disconnect",
"All",
"Command",
"will",
"the",
"assign",
"all",
"the",
"vnics",
"on",
"the",
"vm",
"to",
"the",
"default",
"network",
"which",
"is",
"sign",
"to",
"be",
"disconnected"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L321-L336 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator.DeleteInstance | def DeleteInstance(self, context, ports):
"""
Destroy Vm Command, will only destroy the vm and will not remove the resource
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param list[string] ports: the ports of the connection betwee... | python | def DeleteInstance(self, context, ports):
"""
Destroy Vm Command, will only destroy the vm and will not remove the resource
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param list[string] ports: the ports of the connection betwee... | [
"def",
"DeleteInstance",
"(",
"self",
",",
"context",
",",
"ports",
")",
":",
"resource_details",
"=",
"self",
".",
"_parse_remote_model",
"(",
"context",
")",
"# execute command",
"res",
"=",
"self",
".",
"command_wrapper",
".",
"execute_command_with_connection",
... | Destroy Vm Command, will only destroy the vm and will not remove the resource
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!! | [
"Destroy",
"Vm",
"Command",
"will",
"only",
"destroy",
"the",
"vm",
"and",
"will",
"not",
"remove",
"the",
"resource"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L358-L372 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator.refresh_ip | def refresh_ip(self, context, cancellation_context, ports):
"""
Refresh IP Command, will refresh the ip of the vm and will update it on the resource
:param ResourceRemoteCommandContext context: the context the command runs on
:param cancellation_context:
:param list[string] ports... | python | def refresh_ip(self, context, cancellation_context, ports):
"""
Refresh IP Command, will refresh the ip of the vm and will update it on the resource
:param ResourceRemoteCommandContext context: the context the command runs on
:param cancellation_context:
:param list[string] ports... | [
"def",
"refresh_ip",
"(",
"self",
",",
"context",
",",
"cancellation_context",
",",
"ports",
")",
":",
"resource_details",
"=",
"self",
".",
"_parse_remote_model",
"(",
"context",
")",
"# execute command",
"res",
"=",
"self",
".",
"command_wrapper",
".",
"execut... | Refresh IP Command, will refresh the ip of the vm and will update it on the resource
:param ResourceRemoteCommandContext context: the context the command runs on
:param cancellation_context:
:param list[string] ports: the ports of the connection between the remote resource and the local resource... | [
"Refresh",
"IP",
"Command",
"will",
"refresh",
"the",
"ip",
"of",
"the",
"vm",
"and",
"will",
"update",
"it",
"on",
"the",
"resource",
":",
"param",
"ResourceRemoteCommandContext",
"context",
":",
"the",
"context",
"the",
"command",
"runs",
"on",
":",
"param... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L375-L390 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator.power_off | def power_off(self, context, ports):
"""
Powers off the remote vm
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!!... | python | def power_off(self, context, ports):
"""
Powers off the remote vm
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!!... | [
"def",
"power_off",
"(",
"self",
",",
"context",
",",
"ports",
")",
":",
"return",
"self",
".",
"_power_command",
"(",
"context",
",",
"ports",
",",
"self",
".",
"vm_power_management_command",
".",
"power_off",
")"
] | Powers off the remote vm
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!! | [
"Powers",
"off",
"the",
"remote",
"vm",
":",
"param",
"models",
".",
"QualiDriverModels",
".",
"ResourceRemoteCommandContext",
"context",
":",
"the",
"context",
"the",
"command",
"runs",
"on",
":",
"param",
"list",
"[",
"string",
"]",
"ports",
":",
"the",
"p... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L393-L399 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator.power_on | def power_on(self, context, ports):
"""
Powers on the remote vm
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!!
... | python | def power_on(self, context, ports):
"""
Powers on the remote vm
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!!
... | [
"def",
"power_on",
"(",
"self",
",",
"context",
",",
"ports",
")",
":",
"return",
"self",
".",
"_power_command",
"(",
"context",
",",
"ports",
",",
"self",
".",
"vm_power_management_command",
".",
"power_on",
")"
] | Powers on the remote vm
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!! | [
"Powers",
"on",
"the",
"remote",
"vm",
":",
"param",
"models",
".",
"QualiDriverModels",
".",
"ResourceRemoteCommandContext",
"context",
":",
"the",
"context",
"the",
"command",
"runs",
"on",
":",
"param",
"list",
"[",
"string",
"]",
"ports",
":",
"the",
"po... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L402-L408 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator.power_cycle | def power_cycle(self, context, ports, delay):
"""
preforms a restart to the vm
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param list[string] ports: the ports of the connection between the remote resource and the local resource, ... | python | def power_cycle(self, context, ports, delay):
"""
preforms a restart to the vm
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param list[string] ports: the ports of the connection between the remote resource and the local resource, ... | [
"def",
"power_cycle",
"(",
"self",
",",
"context",
",",
"ports",
",",
"delay",
")",
":",
"self",
".",
"power_off",
"(",
"context",
",",
"ports",
")",
"time",
".",
"sleep",
"(",
"float",
"(",
"delay",
")",
")",
"return",
"self",
".",
"power_on",
"(",
... | preforms a restart to the vm
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!!
:param number delay: the time to wait betwee... | [
"preforms",
"a",
"restart",
"to",
"the",
"vm",
":",
"param",
"models",
".",
"QualiDriverModels",
".",
"ResourceRemoteCommandContext",
"context",
":",
"the",
"context",
"the",
"command",
"runs",
"on",
":",
"param",
"list",
"[",
"string",
"]",
"ports",
":",
"t... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L411-L420 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator._parse_remote_model | def _parse_remote_model(self, context):
"""
parse the remote resource model and adds its full name
:type context: models.QualiDriverModels.ResourceRemoteCommandContext
"""
if not context.remote_endpoints:
raise Exception('no remote resources found in context: {0}', j... | python | def _parse_remote_model(self, context):
"""
parse the remote resource model and adds its full name
:type context: models.QualiDriverModels.ResourceRemoteCommandContext
"""
if not context.remote_endpoints:
raise Exception('no remote resources found in context: {0}', j... | [
"def",
"_parse_remote_model",
"(",
"self",
",",
"context",
")",
":",
"if",
"not",
"context",
".",
"remote_endpoints",
":",
"raise",
"Exception",
"(",
"'no remote resources found in context: {0}'",
",",
"jsonpickle",
".",
"encode",
"(",
"context",
",",
"unpicklable",... | parse the remote resource model and adds its full name
:type context: models.QualiDriverModels.ResourceRemoteCommandContext | [
"parse",
"the",
"remote",
"resource",
"model",
"and",
"adds",
"its",
"full",
"name",
":",
"type",
"context",
":",
"models",
".",
"QualiDriverModels",
".",
"ResourceRemoteCommandContext"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L432-L450 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator.save_snapshot | def save_snapshot(self, context, snapshot_name, save_memory='No'):
"""
Saves virtual machine to a snapshot
:param context: resource context of the vCenterShell
:type context: models.QualiDriverModels.ResourceCommandContext
:param snapshot_name: snapshot name to save to
:t... | python | def save_snapshot(self, context, snapshot_name, save_memory='No'):
"""
Saves virtual machine to a snapshot
:param context: resource context of the vCenterShell
:type context: models.QualiDriverModels.ResourceCommandContext
:param snapshot_name: snapshot name to save to
:t... | [
"def",
"save_snapshot",
"(",
"self",
",",
"context",
",",
"snapshot_name",
",",
"save_memory",
"=",
"'No'",
")",
":",
"resource_details",
"=",
"self",
".",
"_parse_remote_model",
"(",
"context",
")",
"created_snapshot_path",
"=",
"self",
".",
"command_wrapper",
... | Saves virtual machine to a snapshot
:param context: resource context of the vCenterShell
:type context: models.QualiDriverModels.ResourceCommandContext
:param snapshot_name: snapshot name to save to
:type snapshot_name: str
:param save_memory: Snapshot the virtual machine's memor... | [
"Saves",
"virtual",
"machine",
"to",
"a",
"snapshot",
":",
"param",
"context",
":",
"resource",
"context",
"of",
"the",
"vCenterShell",
":",
"type",
"context",
":",
"models",
".",
"QualiDriverModels",
".",
"ResourceCommandContext",
":",
"param",
"snapshot_name",
... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L475-L492 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator.restore_snapshot | def restore_snapshot(self, context, snapshot_name):
"""
Restores virtual machine from a snapshot
:param context: resource context of the vCenterShell
:type context: models.QualiDriverModels.ResourceCommandContext
:param snapshot_name: snapshot name to save to
:type snapsh... | python | def restore_snapshot(self, context, snapshot_name):
"""
Restores virtual machine from a snapshot
:param context: resource context of the vCenterShell
:type context: models.QualiDriverModels.ResourceCommandContext
:param snapshot_name: snapshot name to save to
:type snapsh... | [
"def",
"restore_snapshot",
"(",
"self",
",",
"context",
",",
"snapshot_name",
")",
":",
"resource_details",
"=",
"self",
".",
"_parse_remote_model",
"(",
"context",
")",
"self",
".",
"command_wrapper",
".",
"execute_command_with_connection",
"(",
"context",
",",
"... | Restores virtual machine from a snapshot
:param context: resource context of the vCenterShell
:type context: models.QualiDriverModels.ResourceCommandContext
:param snapshot_name: snapshot name to save to
:type snapshot_name: str
:return: | [
"Restores",
"virtual",
"machine",
"from",
"a",
"snapshot",
":",
"param",
"context",
":",
"resource",
"context",
"of",
"the",
"vCenterShell",
":",
"type",
"context",
":",
"models",
".",
"QualiDriverModels",
".",
"ResourceCommandContext",
":",
"param",
"snapshot_nam... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L494-L508 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator.get_snapshots | def get_snapshots(self, context):
"""
Returns list of snapshots
:param context: resource context of the vCenterShell
:type context: models.QualiDriverModels.ResourceCommandContext
:return:
"""
resource_details = self._parse_remote_model(context)
res = self... | python | def get_snapshots(self, context):
"""
Returns list of snapshots
:param context: resource context of the vCenterShell
:type context: models.QualiDriverModels.ResourceCommandContext
:return:
"""
resource_details = self._parse_remote_model(context)
res = self... | [
"def",
"get_snapshots",
"(",
"self",
",",
"context",
")",
":",
"resource_details",
"=",
"self",
".",
"_parse_remote_model",
"(",
"context",
")",
"res",
"=",
"self",
".",
"command_wrapper",
".",
"execute_command_with_connection",
"(",
"context",
",",
"self",
".",... | Returns list of snapshots
:param context: resource context of the vCenterShell
:type context: models.QualiDriverModels.ResourceCommandContext
:return: | [
"Returns",
"list",
"of",
"snapshots",
":",
"param",
"context",
":",
"resource",
"context",
"of",
"the",
"vCenterShell",
":",
"type",
"context",
":",
"models",
".",
"QualiDriverModels",
".",
"ResourceCommandContext",
":",
"return",
":"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L510-L521 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/command_orchestrator.py | CommandOrchestrator.orchestration_save | def orchestration_save(self, context, mode="shallow", custom_params=None):
"""
Creates a snapshot with a unique name and returns SavedResults as JSON
:param context: resource context of the vCenterShell
:param mode: Snapshot save mode, default shallow. Currently not it use
:param... | python | def orchestration_save(self, context, mode="shallow", custom_params=None):
"""
Creates a snapshot with a unique name and returns SavedResults as JSON
:param context: resource context of the vCenterShell
:param mode: Snapshot save mode, default shallow. Currently not it use
:param... | [
"def",
"orchestration_save",
"(",
"self",
",",
"context",
",",
"mode",
"=",
"\"shallow\"",
",",
"custom_params",
"=",
"None",
")",
":",
"resource_details",
"=",
"self",
".",
"_parse_remote_model",
"(",
"context",
")",
"created_date",
"=",
"datetime",
".",
"now... | Creates a snapshot with a unique name and returns SavedResults as JSON
:param context: resource context of the vCenterShell
:param mode: Snapshot save mode, default shallow. Currently not it use
:param custom_params: Set of custom parameter to be supported in the future
:return: SavedRes... | [
"Creates",
"a",
"snapshot",
"with",
"a",
"unique",
"name",
"and",
"returns",
"SavedResults",
"as",
"JSON",
":",
"param",
"context",
":",
"resource",
"context",
"of",
"the",
"vCenterShell",
":",
"param",
"mode",
":",
"Snapshot",
"save",
"mode",
"default",
"sh... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L523-L551 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/common/vcenter/data_model_retriever.py | VCenterDataModelRetriever.get_vcenter_data_model | def get_vcenter_data_model(self, api, vcenter_name):
"""
:param api:
:param str vcenter_name:
:rtype: VMwarevCenterResourceModel
"""
if not vcenter_name:
raise ValueError('VMWare vCenter name is empty')
vcenter_instance = api.GetResourceDetails(vcente... | python | def get_vcenter_data_model(self, api, vcenter_name):
"""
:param api:
:param str vcenter_name:
:rtype: VMwarevCenterResourceModel
"""
if not vcenter_name:
raise ValueError('VMWare vCenter name is empty')
vcenter_instance = api.GetResourceDetails(vcente... | [
"def",
"get_vcenter_data_model",
"(",
"self",
",",
"api",
",",
"vcenter_name",
")",
":",
"if",
"not",
"vcenter_name",
":",
"raise",
"ValueError",
"(",
"'VMWare vCenter name is empty'",
")",
"vcenter_instance",
"=",
"api",
".",
"GetResourceDetails",
"(",
"vcenter_nam... | :param api:
:param str vcenter_name:
:rtype: VMwarevCenterResourceModel | [
":",
"param",
"api",
":",
":",
"param",
"str",
"vcenter_name",
":",
":",
"rtype",
":",
"VMwarevCenterResourceModel"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/vcenter/data_model_retriever.py#L12-L22 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/common/utilites/common_utils.py | back_slash_to_front_converter | def back_slash_to_front_converter(string):
"""
Replacing all \ in the str to /
:param string: single string to modify
:type string: str
"""
try:
if not string or not isinstance(string, str):
return string
return string.replace('\\', '/')
except Exception:
... | python | def back_slash_to_front_converter(string):
"""
Replacing all \ in the str to /
:param string: single string to modify
:type string: str
"""
try:
if not string or not isinstance(string, str):
return string
return string.replace('\\', '/')
except Exception:
... | [
"def",
"back_slash_to_front_converter",
"(",
"string",
")",
":",
"try",
":",
"if",
"not",
"string",
"or",
"not",
"isinstance",
"(",
"string",
",",
"str",
")",
":",
"return",
"string",
"return",
"string",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")",
"e... | Replacing all \ in the str to /
:param string: single string to modify
:type string: str | [
"Replacing",
"all",
"\\",
"in",
"the",
"str",
"to",
"/",
":",
"param",
"string",
":",
"single",
"string",
"to",
"modify",
":",
"type",
"string",
":",
"str"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/utilites/common_utils.py#L11-L22 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/common/utilites/common_utils.py | get_object_as_string | def get_object_as_string(obj):
"""
Converts any object to JSON-like readable format, ready to be printed for debugging purposes
:param obj: Any object
:return: string
"""
if isinstance(obj, str):
return obj
if isinstance(obj, list):
return '\r\n\;'.join([get_object_as_string(... | python | def get_object_as_string(obj):
"""
Converts any object to JSON-like readable format, ready to be printed for debugging purposes
:param obj: Any object
:return: string
"""
if isinstance(obj, str):
return obj
if isinstance(obj, list):
return '\r\n\;'.join([get_object_as_string(... | [
"def",
"get_object_as_string",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"str",
")",
":",
"return",
"obj",
"if",
"isinstance",
"(",
"obj",
",",
"list",
")",
":",
"return",
"'\\r\\n\\;'",
".",
"join",
"(",
"[",
"get_object_as_string",
"("... | Converts any object to JSON-like readable format, ready to be printed for debugging purposes
:param obj: Any object
:return: string | [
"Converts",
"any",
"object",
"to",
"JSON",
"-",
"like",
"readable",
"format",
"ready",
"to",
"be",
"printed",
"for",
"debugging",
"purposes",
":",
"param",
"obj",
":",
"Any",
"object",
":",
"return",
":",
"string"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/utilites/common_utils.py#L33-L45 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/common/utilites/io.py | get_path_and_name | def get_path_and_name(full_name):
"""
Split Whole Patch onto 'Patch' and 'Name'
:param full_name: <str> Full Resource Name - likes 'Root/Folder/Folder2/Name'
:return: tuple (Patch, Name)
"""
if full_name:
parts = full_name.split("/")
return ("/".join(parts[0:-1]), parts[-1]) if l... | python | def get_path_and_name(full_name):
"""
Split Whole Patch onto 'Patch' and 'Name'
:param full_name: <str> Full Resource Name - likes 'Root/Folder/Folder2/Name'
:return: tuple (Patch, Name)
"""
if full_name:
parts = full_name.split("/")
return ("/".join(parts[0:-1]), parts[-1]) if l... | [
"def",
"get_path_and_name",
"(",
"full_name",
")",
":",
"if",
"full_name",
":",
"parts",
"=",
"full_name",
".",
"split",
"(",
"\"/\"",
")",
"return",
"(",
"\"/\"",
".",
"join",
"(",
"parts",
"[",
"0",
":",
"-",
"1",
"]",
")",
",",
"parts",
"[",
"-"... | Split Whole Patch onto 'Patch' and 'Name'
:param full_name: <str> Full Resource Name - likes 'Root/Folder/Folder2/Name'
:return: tuple (Patch, Name) | [
"Split",
"Whole",
"Patch",
"onto",
"Patch",
"and",
"Name",
":",
"param",
"full_name",
":",
"<str",
">",
"Full",
"Resource",
"Name",
"-",
"likes",
"Root",
"/",
"Folder",
"/",
"Folder2",
"/",
"Name",
":",
"return",
":",
"tuple",
"(",
"Patch",
"Name",
")"... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/utilites/io.py#L25-L34 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/vm_details.py | DeploymentDetailsProviderFromAppJson.get_details | def get_details(self):
"""
:rtype list[VmDataField]
"""
data = []
if self.deployment == 'vCenter Clone VM From VM':
data.append(VmDetailsProperty(key='Cloned VM Name',value= self.dep_attributes.get('vCenter VM','')))
if self.deployment == 'VCenter De... | python | def get_details(self):
"""
:rtype list[VmDataField]
"""
data = []
if self.deployment == 'vCenter Clone VM From VM':
data.append(VmDetailsProperty(key='Cloned VM Name',value= self.dep_attributes.get('vCenter VM','')))
if self.deployment == 'VCenter De... | [
"def",
"get_details",
"(",
"self",
")",
":",
"data",
"=",
"[",
"]",
"if",
"self",
".",
"deployment",
"==",
"'vCenter Clone VM From VM'",
":",
"data",
".",
"append",
"(",
"VmDetailsProperty",
"(",
"key",
"=",
"'Cloned VM Name'",
",",
"value",
"=",
"self",
"... | :rtype list[VmDataField] | [
":",
"rtype",
"list",
"[",
"VmDataField",
"]"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/vm_details.py#L65-L85 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/vm/vcenter_details_factory.py | VCenterDetailsFactory.set_deplyment_vcenter_params | def set_deplyment_vcenter_params(vcenter_resource_model, deploy_params):
"""
Sets the vcenter parameters if not already set at the deployment option
:param deploy_params: vCenterVMFromTemplateResourceModel or vCenterVMFromImageResourceModel
:type vcenter_resource_model: VMwarevCenterRes... | python | def set_deplyment_vcenter_params(vcenter_resource_model, deploy_params):
"""
Sets the vcenter parameters if not already set at the deployment option
:param deploy_params: vCenterVMFromTemplateResourceModel or vCenterVMFromImageResourceModel
:type vcenter_resource_model: VMwarevCenterRes... | [
"def",
"set_deplyment_vcenter_params",
"(",
"vcenter_resource_model",
",",
"deploy_params",
")",
":",
"# Override attributes",
"deploy_params",
".",
"vm_cluster",
"=",
"deploy_params",
".",
"vm_cluster",
"or",
"vcenter_resource_model",
".",
"vm_cluster",
"deploy_params",
".... | Sets the vcenter parameters if not already set at the deployment option
:param deploy_params: vCenterVMFromTemplateResourceModel or vCenterVMFromImageResourceModel
:type vcenter_resource_model: VMwarevCenterResourceModel | [
"Sets",
"the",
"vcenter",
"parameters",
"if",
"not",
"already",
"set",
"at",
"the",
"deployment",
"option",
":",
"param",
"deploy_params",
":",
"vCenterVMFromTemplateResourceModel",
"or",
"vCenterVMFromImageResourceModel",
":",
"type",
"vcenter_resource_model",
":",
"VM... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/vm/vcenter_details_factory.py#L7-L29 |
QualiSystems/vCenterShell | vcentershell_driver/driver.py | VCenterShellDriver.remote_save_snapshot | def remote_save_snapshot(self, context, ports, snapshot_name, save_memory):
"""
Saves virtual machine to a snapshot
:param context: resource context of the vCenterShell
:type context: models.QualiDriverModels.ResourceCommandContext
:param ports:list[string] ports: the ports of th... | python | def remote_save_snapshot(self, context, ports, snapshot_name, save_memory):
"""
Saves virtual machine to a snapshot
:param context: resource context of the vCenterShell
:type context: models.QualiDriverModels.ResourceCommandContext
:param ports:list[string] ports: the ports of th... | [
"def",
"remote_save_snapshot",
"(",
"self",
",",
"context",
",",
"ports",
",",
"snapshot_name",
",",
"save_memory",
")",
":",
"return",
"self",
".",
"command_orchestrator",
".",
"save_snapshot",
"(",
"context",
",",
"snapshot_name",
",",
"save_memory",
")"
] | Saves virtual machine to a snapshot
:param context: resource context of the vCenterShell
:type context: models.QualiDriverModels.ResourceCommandContext
:param ports:list[string] ports: the ports of the connection between the remote resource and the local resource
:type ports: list[string... | [
"Saves",
"virtual",
"machine",
"to",
"a",
"snapshot",
":",
"param",
"context",
":",
"resource",
"context",
"of",
"the",
"vCenterShell",
":",
"type",
"context",
":",
"models",
".",
"QualiDriverModels",
".",
"ResourceCommandContext",
":",
"param",
"ports",
":",
... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/vcentershell_driver/driver.py#L108-L121 |
QualiSystems/vCenterShell | vcentershell_driver/driver.py | VCenterShellDriver.remote_restore_snapshot | def remote_restore_snapshot(self, context, ports, snapshot_name):
"""
Restores virtual machine from a snapshot
:param context: resource context of the vCenterShell
:type context: models.QualiDriverModels.ResourceCommandContext
:param ports:list[string] ports: the ports of the con... | python | def remote_restore_snapshot(self, context, ports, snapshot_name):
"""
Restores virtual machine from a snapshot
:param context: resource context of the vCenterShell
:type context: models.QualiDriverModels.ResourceCommandContext
:param ports:list[string] ports: the ports of the con... | [
"def",
"remote_restore_snapshot",
"(",
"self",
",",
"context",
",",
"ports",
",",
"snapshot_name",
")",
":",
"return",
"self",
".",
"command_orchestrator",
".",
"restore_snapshot",
"(",
"context",
",",
"snapshot_name",
")"
] | Restores virtual machine from a snapshot
:param context: resource context of the vCenterShell
:type context: models.QualiDriverModels.ResourceCommandContext
:param ports:list[string] ports: the ports of the connection between the remote resource and the local resource
:type ports: list[s... | [
"Restores",
"virtual",
"machine",
"from",
"a",
"snapshot",
":",
"param",
"context",
":",
"resource",
"context",
"of",
"the",
"vCenterShell",
":",
"type",
"context",
":",
"models",
".",
"QualiDriverModels",
".",
"ResourceCommandContext",
":",
"param",
"ports",
":... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/vcentershell_driver/driver.py#L123-L134 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/connect_orchestrator.py | ConnectionCommandOrchestrator.connect_bulk | def connect_bulk(self, si, logger, vcenter_data_model, request):
"""
:param si:
:param logger:
:param VMwarevCenterResourceModel vcenter_data_model:
:param request:
:return:
"""
self.logger = logger
self.logger.info('Apply connectivity changes has... | python | def connect_bulk(self, si, logger, vcenter_data_model, request):
"""
:param si:
:param logger:
:param VMwarevCenterResourceModel vcenter_data_model:
:param request:
:return:
"""
self.logger = logger
self.logger.info('Apply connectivity changes has... | [
"def",
"connect_bulk",
"(",
"self",
",",
"si",
",",
"logger",
",",
"vcenter_data_model",
",",
"request",
")",
":",
"self",
".",
"logger",
"=",
"logger",
"self",
".",
"logger",
".",
"info",
"(",
"'Apply connectivity changes has started'",
")",
"self",
".",
"l... | :param si:
:param logger:
:param VMwarevCenterResourceModel vcenter_data_model:
:param request:
:return: | [
":",
"param",
"si",
":",
":",
"param",
"logger",
":",
":",
"param",
"VMwarevCenterResourceModel",
"vcenter_data_model",
":",
":",
"param",
"request",
":",
":",
"return",
":"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/connect_orchestrator.py#L40-L79 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/DeleteInstance.py | DestroyVirtualMachineCommand.destroy | def destroy(self, si, logger, session, vcenter_data_model, vm_uuid, vm_name, reservation_id):
"""
:param si:
:param logger:
:param CloudShellAPISession session:
:param vcenter_data_model:
:param vm_uuid:
:param str vm_name: This is the resource name
:param... | python | def destroy(self, si, logger, session, vcenter_data_model, vm_uuid, vm_name, reservation_id):
"""
:param si:
:param logger:
:param CloudShellAPISession session:
:param vcenter_data_model:
:param vm_uuid:
:param str vm_name: This is the resource name
:param... | [
"def",
"destroy",
"(",
"self",
",",
"si",
",",
"logger",
",",
"session",
",",
"vcenter_data_model",
",",
"vm_uuid",
",",
"vm_name",
",",
"reservation_id",
")",
":",
"# disconnect",
"self",
".",
"_disconnect_all_my_connectors",
"(",
"session",
"=",
"session",
"... | :param si:
:param logger:
:param CloudShellAPISession session:
:param vcenter_data_model:
:param vm_uuid:
:param str vm_name: This is the resource name
:param reservation_id:
:return: | [
":",
"param",
"si",
":",
":",
"param",
"logger",
":",
":",
"param",
"CloudShellAPISession",
"session",
":",
":",
"param",
"vcenter_data_model",
":",
":",
"param",
"vm_uuid",
":",
":",
"param",
"str",
"vm_name",
":",
"This",
"is",
"the",
"resource",
"name",... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/DeleteInstance.py#L19-L45 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/DeleteInstance.py | DestroyVirtualMachineCommand.DeleteInstance | def DeleteInstance(self, si, logger, session, vcenter_data_model, vm_uuid, vm_name):
"""
:param logger:
:param CloudShellAPISession session:
:param str vm_name: This is the resource name
:return:
"""
# find vm
vm = self.pv_service.find_by_uuid(si, vm_uuid)... | python | def DeleteInstance(self, si, logger, session, vcenter_data_model, vm_uuid, vm_name):
"""
:param logger:
:param CloudShellAPISession session:
:param str vm_name: This is the resource name
:return:
"""
# find vm
vm = self.pv_service.find_by_uuid(si, vm_uuid)... | [
"def",
"DeleteInstance",
"(",
"self",
",",
"si",
",",
"logger",
",",
"session",
",",
"vcenter_data_model",
",",
"vm_uuid",
",",
"vm_name",
")",
":",
"# find vm",
"vm",
"=",
"self",
".",
"pv_service",
".",
"find_by_uuid",
"(",
"si",
",",
"vm_uuid",
")",
"... | :param logger:
:param CloudShellAPISession session:
:param str vm_name: This is the resource name
:return: | [
":",
"param",
"logger",
":",
":",
"param",
"CloudShellAPISession",
"session",
":",
":",
"param",
"str",
"vm_name",
":",
"This",
"is",
"the",
"resource",
"name",
":",
"return",
":"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/DeleteInstance.py#L47-L64 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/DeleteInstance.py | DestroyVirtualMachineCommand._disconnect_all_my_connectors | def _disconnect_all_my_connectors(session, resource_name, reservation_id, logger):
"""
:param CloudShellAPISession session:
:param str resource_name:
:param str reservation_id:
"""
reservation_details = session.GetReservationDetails(reservation_id)
connectors = re... | python | def _disconnect_all_my_connectors(session, resource_name, reservation_id, logger):
"""
:param CloudShellAPISession session:
:param str resource_name:
:param str reservation_id:
"""
reservation_details = session.GetReservationDetails(reservation_id)
connectors = re... | [
"def",
"_disconnect_all_my_connectors",
"(",
"session",
",",
"resource_name",
",",
"reservation_id",
",",
"logger",
")",
":",
"reservation_details",
"=",
"session",
".",
"GetReservationDetails",
"(",
"reservation_id",
")",
"connectors",
"=",
"reservation_details",
".",
... | :param CloudShellAPISession session:
:param str resource_name:
:param str reservation_id: | [
":",
"param",
"CloudShellAPISession",
"session",
":",
":",
"param",
"str",
"resource_name",
":",
":",
"param",
"str",
"reservation_id",
":"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/DeleteInstance.py#L67-L93 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/delete_saved_sandbox.py | DeleteSavedSandboxCommand.delete_sandbox | def delete_sandbox(self, si, logger, vcenter_data_model, delete_sandbox_actions, cancellation_context):
"""
Deletes a saved sandbox's artifacts
:param vcenter_data_model: VMwarevCenterResourceModel
:param vim.ServiceInstance si: py_vmomi service instance
:type si: vim.ServiceIns... | python | def delete_sandbox(self, si, logger, vcenter_data_model, delete_sandbox_actions, cancellation_context):
"""
Deletes a saved sandbox's artifacts
:param vcenter_data_model: VMwarevCenterResourceModel
:param vim.ServiceInstance si: py_vmomi service instance
:type si: vim.ServiceIns... | [
"def",
"delete_sandbox",
"(",
"self",
",",
"si",
",",
"logger",
",",
"vcenter_data_model",
",",
"delete_sandbox_actions",
",",
"cancellation_context",
")",
":",
"results",
"=",
"[",
"]",
"logger",
".",
"info",
"(",
"'Deleting saved sandbox command starting on '",
"+... | Deletes a saved sandbox's artifacts
:param vcenter_data_model: VMwarevCenterResourceModel
:param vim.ServiceInstance si: py_vmomi service instance
:type si: vim.ServiceInstance
:param logger: Logger
:type logger: cloudshell.core.logger.qs_logger.get_qs_logger
:param list... | [
"Deletes",
"a",
"saved",
"sandbox",
"s",
"artifacts"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/delete_saved_sandbox.py#L35-L79 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/deploy_vm.py | DeployCommand.execute_deploy_from_linked_clone | def execute_deploy_from_linked_clone(self, si, logger, vcenter_data_model, reservation_id, deployment_params, cancellation_context, folder_manager):
"""
Calls the deployer to deploy vm from snapshot
:param cancellation_context:
:param str reservation_id:
:param si:
:param... | python | def execute_deploy_from_linked_clone(self, si, logger, vcenter_data_model, reservation_id, deployment_params, cancellation_context, folder_manager):
"""
Calls the deployer to deploy vm from snapshot
:param cancellation_context:
:param str reservation_id:
:param si:
:param... | [
"def",
"execute_deploy_from_linked_clone",
"(",
"self",
",",
"si",
",",
"logger",
",",
"vcenter_data_model",
",",
"reservation_id",
",",
"deployment_params",
",",
"cancellation_context",
",",
"folder_manager",
")",
":",
"self",
".",
"_prepare_deployed_apps_folder",
"(",... | Calls the deployer to deploy vm from snapshot
:param cancellation_context:
:param str reservation_id:
:param si:
:param logger:
:type deployment_params: DeployFromLinkedClone
:param vcenter_data_model:
:return: | [
"Calls",
"the",
"deployer",
"to",
"deploy",
"vm",
"from",
"snapshot",
":",
"param",
"cancellation_context",
":",
":",
"param",
"str",
"reservation_id",
":",
":",
"param",
"si",
":",
":",
"param",
"logger",
":",
":",
"type",
"deployment_params",
":",
"DeployF... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/deploy_vm.py#L21-L36 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/deploy_vm.py | DeployCommand.execute_deploy_clone_from_vm | def execute_deploy_clone_from_vm(self, si, logger, vcenter_data_model, reservation_id, deployment_params, cancellation_context, folder_manager):
"""
Calls the deployer to deploy vm from another vm
:param cancellation_context:
:param str reservation_id:
:param si:
:param l... | python | def execute_deploy_clone_from_vm(self, si, logger, vcenter_data_model, reservation_id, deployment_params, cancellation_context, folder_manager):
"""
Calls the deployer to deploy vm from another vm
:param cancellation_context:
:param str reservation_id:
:param si:
:param l... | [
"def",
"execute_deploy_clone_from_vm",
"(",
"self",
",",
"si",
",",
"logger",
",",
"vcenter_data_model",
",",
"reservation_id",
",",
"deployment_params",
",",
"cancellation_context",
",",
"folder_manager",
")",
":",
"self",
".",
"_prepare_deployed_apps_folder",
"(",
"... | Calls the deployer to deploy vm from another vm
:param cancellation_context:
:param str reservation_id:
:param si:
:param logger:
:type deployment_params: DeployFromTemplateDetails
:param vcenter_data_model:
:return: | [
"Calls",
"the",
"deployer",
"to",
"deploy",
"vm",
"from",
"another",
"vm",
":",
"param",
"cancellation_context",
":",
":",
"param",
"str",
"reservation_id",
":",
":",
"param",
"si",
":",
":",
"param",
"logger",
":",
":",
"type",
"deployment_params",
":",
"... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/deploy_vm.py#L38-L52 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/save_snapshot.py | SaveSnapshotCommand.save_snapshot | def save_snapshot(self, si, logger, vm_uuid, snapshot_name, save_memory):
"""
Creates a snapshot of the current state of the virtual machine
:param vim.ServiceInstance si: py_vmomi service instance
:type si: vim.ServiceInstance
:param logger: Logger
:type logger: cloudsh... | python | def save_snapshot(self, si, logger, vm_uuid, snapshot_name, save_memory):
"""
Creates a snapshot of the current state of the virtual machine
:param vim.ServiceInstance si: py_vmomi service instance
:type si: vim.ServiceInstance
:param logger: Logger
:type logger: cloudsh... | [
"def",
"save_snapshot",
"(",
"self",
",",
"si",
",",
"logger",
",",
"vm_uuid",
",",
"snapshot_name",
",",
"save_memory",
")",
":",
"vm",
"=",
"self",
".",
"pyvmomi_service",
".",
"find_by_uuid",
"(",
"si",
",",
"vm_uuid",
")",
"snapshot_path_to_be_created",
... | Creates a snapshot of the current state of the virtual machine
:param vim.ServiceInstance si: py_vmomi service instance
:type si: vim.ServiceInstance
:param logger: Logger
:type logger: cloudshell.core.logger.qs_logger.get_qs_logger
:param vm_uuid: UUID of the virtual machine
... | [
"Creates",
"a",
"snapshot",
"of",
"the",
"current",
"state",
"of",
"the",
"virtual",
"machine"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/save_snapshot.py#L22-L48 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/save_snapshot.py | SaveSnapshotCommand._create_snapshot | def _create_snapshot(logger, snapshot_name, vm, save_vm_memory_to_snapshot):
"""
:type save_vm_memory_to_snapshot: bool
"""
logger.info("Create virtual machine snapshot")
dump_memory = save_vm_memory_to_snapshot
quiesce = True
task = vm.CreateSnapshot(snapshot_nam... | python | def _create_snapshot(logger, snapshot_name, vm, save_vm_memory_to_snapshot):
"""
:type save_vm_memory_to_snapshot: bool
"""
logger.info("Create virtual machine snapshot")
dump_memory = save_vm_memory_to_snapshot
quiesce = True
task = vm.CreateSnapshot(snapshot_nam... | [
"def",
"_create_snapshot",
"(",
"logger",
",",
"snapshot_name",
",",
"vm",
",",
"save_vm_memory_to_snapshot",
")",
":",
"logger",
".",
"info",
"(",
"\"Create virtual machine snapshot\"",
")",
"dump_memory",
"=",
"save_vm_memory_to_snapshot",
"quiesce",
"=",
"True",
"t... | :type save_vm_memory_to_snapshot: bool | [
":",
"type",
"save_vm_memory_to_snapshot",
":",
"bool"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/save_snapshot.py#L55-L63 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/common/utilites/common_name.py | generate_unique_name | def generate_unique_name(name_prefix, reservation_id=None):
"""
Generate a unique name.
Method generate a guid and adds the first 8 characteres of the new guid to 'name_prefix'.
If reservation id is provided than the first 4 chars of the generated guid are taken and the last 4
of the reservation id
... | python | def generate_unique_name(name_prefix, reservation_id=None):
"""
Generate a unique name.
Method generate a guid and adds the first 8 characteres of the new guid to 'name_prefix'.
If reservation id is provided than the first 4 chars of the generated guid are taken and the last 4
of the reservation id
... | [
"def",
"generate_unique_name",
"(",
"name_prefix",
",",
"reservation_id",
"=",
"None",
")",
":",
"if",
"reservation_id",
"and",
"isinstance",
"(",
"reservation_id",
",",
"str",
")",
"and",
"len",
"(",
"reservation_id",
")",
">=",
"4",
":",
"unique_id",
"=",
... | Generate a unique name.
Method generate a guid and adds the first 8 characteres of the new guid to 'name_prefix'.
If reservation id is provided than the first 4 chars of the generated guid are taken and the last 4
of the reservation id | [
"Generate",
"a",
"unique",
"name",
".",
"Method",
"generate",
"a",
"guid",
"and",
"adds",
"the",
"first",
"8",
"characteres",
"of",
"the",
"new",
"guid",
"to",
"name_prefix",
".",
"If",
"reservation",
"id",
"is",
"provided",
"than",
"the",
"first",
"4",
... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/utilites/common_name.py#L6-L17 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/disconnect_dvswitch.py | VirtualSwitchToMachineDisconnectCommand.disconnect | def disconnect(self, si, logger, vcenter_data_model, vm_uuid, network_name=None, vm=None):
"""
disconnect network adapter of the vm. If 'network_name' = None - disconnect ALL interfaces
:param <str> si:
:param logger:
:param VMwarevCenterResourceModel vcenter_data_model:
... | python | def disconnect(self, si, logger, vcenter_data_model, vm_uuid, network_name=None, vm=None):
"""
disconnect network adapter of the vm. If 'network_name' = None - disconnect ALL interfaces
:param <str> si:
:param logger:
:param VMwarevCenterResourceModel vcenter_data_model:
... | [
"def",
"disconnect",
"(",
"self",
",",
"si",
",",
"logger",
",",
"vcenter_data_model",
",",
"vm_uuid",
",",
"network_name",
"=",
"None",
",",
"vm",
"=",
"None",
")",
":",
"logger",
".",
"debug",
"(",
"\"Disconnect Interface VM: '{0}' Network: '{1}' ...\"",
".",
... | disconnect network adapter of the vm. If 'network_name' = None - disconnect ALL interfaces
:param <str> si:
:param logger:
:param VMwarevCenterResourceModel vcenter_data_model:
:param <str> vm_uuid: the uuid of the vm
:param <str | None> network_name: the name of the specific net... | [
"disconnect",
"network",
"adapter",
"of",
"the",
"vm",
".",
"If",
"network_name",
"=",
"None",
"-",
"disconnect",
"ALL",
"interfaces",
":",
"param",
"<str",
">",
"si",
":",
":",
"param",
"logger",
":",
":",
"param",
"VMwarevCenterResourceModel",
"vcenter_data_... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/disconnect_dvswitch.py#L64-L99 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/disconnect_dvswitch.py | VirtualSwitchToMachineDisconnectCommand.remove_interfaces_from_vm_task | def remove_interfaces_from_vm_task(self, virtual_machine, filter_function=None):
"""
Remove interface from VM
@see https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.VirtualMachine.html#reconfigure
:param virtual_machine: <vim.vm object>
:param filter_fu... | python | def remove_interfaces_from_vm_task(self, virtual_machine, filter_function=None):
"""
Remove interface from VM
@see https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.VirtualMachine.html#reconfigure
:param virtual_machine: <vim.vm object>
:param filter_fu... | [
"def",
"remove_interfaces_from_vm_task",
"(",
"self",
",",
"virtual_machine",
",",
"filter_function",
"=",
"None",
")",
":",
"device_change",
"=",
"[",
"]",
"for",
"device",
"in",
"virtual_machine",
".",
"config",
".",
"hardware",
".",
"device",
":",
"if",
"is... | Remove interface from VM
@see https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.VirtualMachine.html#reconfigure
:param virtual_machine: <vim.vm object>
:param filter_function: function that gets the device and decide if it should be deleted
:return: Task or Non... | [
"Remove",
"interface",
"from",
"VM"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/disconnect_dvswitch.py#L101-L120 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/vm/dvswitch_connector.py | VirtualSwitchToMachineConnector.connect_by_mapping | def connect_by_mapping(self, si, vm, mapping, default_network, reserved_networks, logger, promiscuous_mode):
"""
gets the mapping to the vnics and connects it to the vm
:param default_network:
:param si: ServiceInstance
:param vm: vim.VirtualMachine
:param mapping: [VmNet... | python | def connect_by_mapping(self, si, vm, mapping, default_network, reserved_networks, logger, promiscuous_mode):
"""
gets the mapping to the vnics and connects it to the vm
:param default_network:
:param si: ServiceInstance
:param vm: vim.VirtualMachine
:param mapping: [VmNet... | [
"def",
"connect_by_mapping",
"(",
"self",
",",
"si",
",",
"vm",
",",
"mapping",
",",
"default_network",
",",
"reserved_networks",
",",
"logger",
",",
"promiscuous_mode",
")",
":",
"request_mapping",
"=",
"[",
"]",
"logger",
".",
"debug",
"(",
"'about to map to... | gets the mapping to the vnics and connects it to the vm
:param default_network:
:param si: ServiceInstance
:param vm: vim.VirtualMachine
:param mapping: [VmNetworkMapping]
:param reserved_networks:
:param logger:
:param promiscuous_mode <str> 'True' or 'False' tur... | [
"gets",
"the",
"mapping",
"to",
"the",
"vnics",
"and",
"connects",
"it",
"to",
"the",
"vm",
":",
"param",
"default_network",
":",
":",
"param",
"si",
":",
"ServiceInstance",
":",
"param",
"vm",
":",
"vim",
".",
"VirtualMachine",
":",
"param",
"mapping",
... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/vm/dvswitch_connector.py#L42-L76 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/network/dvswitch/creator.py | DvPortGroupCreator.dv_port_group_create_task | def dv_port_group_create_task(dv_port_name, dv_switch, spec, vlan_id, logger, promiscuous_mode, num_ports=32):
"""
Create ' Distributed Virtual Portgroup' Task
:param dv_port_name: <str> Distributed Virtual Portgroup Name
:param dv_switch: <vim.dvs.VmwareDistributedVirtualSwitch> Switch... | python | def dv_port_group_create_task(dv_port_name, dv_switch, spec, vlan_id, logger, promiscuous_mode, num_ports=32):
"""
Create ' Distributed Virtual Portgroup' Task
:param dv_port_name: <str> Distributed Virtual Portgroup Name
:param dv_switch: <vim.dvs.VmwareDistributedVirtualSwitch> Switch... | [
"def",
"dv_port_group_create_task",
"(",
"dv_port_name",
",",
"dv_switch",
",",
"spec",
",",
"vlan_id",
",",
"logger",
",",
"promiscuous_mode",
",",
"num_ports",
"=",
"32",
")",
":",
"dv_pg_spec",
"=",
"vim",
".",
"dvs",
".",
"DistributedVirtualPortgroup",
".",
... | Create ' Distributed Virtual Portgroup' Task
:param dv_port_name: <str> Distributed Virtual Portgroup Name
:param dv_switch: <vim.dvs.VmwareDistributedVirtualSwitch> Switch this Portgroup will be belong to
:param spec:
:param vlan_id: <int>
:param logger:
:param num_port... | [
"Create",
"Distributed",
"Virtual",
"Portgroup",
"Task",
":",
"param",
"dv_port_name",
":",
"<str",
">",
"Distributed",
"Virtual",
"Portgroup",
"Name",
":",
"param",
"dv_switch",
":",
"<vim",
".",
"dvs",
".",
"VmwareDistributedVirtualSwitch",
">",
"Switch",
"this"... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/network/dvswitch/creator.py#L84-L119 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/common/vcenter/deployment_details_factory.py | DeploymentDetailsFactory.create_deployment_details | def create_deployment_details(vcenter_resource_model, vm_cluster, vm_storage, vm_resource_pool, vm_location):
"""
:type vcenter_resource_model: VMwarevCenterResourceModel
:type vm_cluster: str
:type vm_storage: str
:type vm_resource_pool: str
:type vm_location: str
... | python | def create_deployment_details(vcenter_resource_model, vm_cluster, vm_storage, vm_resource_pool, vm_location):
"""
:type vcenter_resource_model: VMwarevCenterResourceModel
:type vm_cluster: str
:type vm_storage: str
:type vm_resource_pool: str
:type vm_location: str
... | [
"def",
"create_deployment_details",
"(",
"vcenter_resource_model",
",",
"vm_cluster",
",",
"vm_storage",
",",
"vm_resource_pool",
",",
"vm_location",
")",
":",
"vm_cluster",
"=",
"vm_cluster",
"or",
"vcenter_resource_model",
".",
"vm_cluster",
"vm_storage",
"=",
"vm_sto... | :type vcenter_resource_model: VMwarevCenterResourceModel
:type vm_cluster: str
:type vm_storage: str
:type vm_resource_pool: str
:type vm_location: str
:rtype: DeploymentDetails | [
":",
"type",
"vcenter_resource_model",
":",
"VMwarevCenterResourceModel",
":",
"type",
"vm_cluster",
":",
"str",
":",
"type",
"vm_storage",
":",
"str",
":",
"type",
"vm_resource_pool",
":",
"str",
":",
"type",
"vm_location",
":",
"str",
":",
"rtype",
":",
"Dep... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/vcenter/deployment_details_factory.py#L6-L25 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/commands/refresh_ip.py | RefreshIpCommand.refresh_ip | def refresh_ip(self, si, logger, session, vcenter_data_model, resource_model, cancellation_context,
app_request_json):
"""
Refreshes IP address of virtual machine and updates Address property on the resource
:param vim.ServiceInstance si: py_vmomi service instance
:pa... | python | def refresh_ip(self, si, logger, session, vcenter_data_model, resource_model, cancellation_context,
app_request_json):
"""
Refreshes IP address of virtual machine and updates Address property on the resource
:param vim.ServiceInstance si: py_vmomi service instance
:pa... | [
"def",
"refresh_ip",
"(",
"self",
",",
"si",
",",
"logger",
",",
"session",
",",
"vcenter_data_model",
",",
"resource_model",
",",
"cancellation_context",
",",
"app_request_json",
")",
":",
"self",
".",
"_do_not_run_on_static_vm",
"(",
"app_request_json",
"=",
"ap... | Refreshes IP address of virtual machine and updates Address property on the resource
:param vim.ServiceInstance si: py_vmomi service instance
:param logger:
:param vCenterShell.driver.SecureCloudShellApiSession session: cloudshell session
:param GenericDeployedAppResourceModel resource_... | [
"Refreshes",
"IP",
"address",
"of",
"virtual",
"machine",
"and",
"updates",
"Address",
"property",
"on",
"the",
"resource"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/refresh_ip.py#L25-L60 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/common/cloud_shell/conn_details_retriever.py | ResourceConnectionDetailsRetriever.get_connection_details | def get_connection_details(session, vcenter_resource_model, resource_context):
"""
Methods retrieves the connection details from the vcenter resource model attributes.
:param CloudShellAPISession session:
:param VMwarevCenterResourceModel vcenter_resource_model: Instance of VMwarevCente... | python | def get_connection_details(session, vcenter_resource_model, resource_context):
"""
Methods retrieves the connection details from the vcenter resource model attributes.
:param CloudShellAPISession session:
:param VMwarevCenterResourceModel vcenter_resource_model: Instance of VMwarevCente... | [
"def",
"get_connection_details",
"(",
"session",
",",
"vcenter_resource_model",
",",
"resource_context",
")",
":",
"session",
"=",
"session",
"resource_context",
"=",
"resource_context",
"# get vCenter connection details from vCenter resource",
"user",
"=",
"vcenter_resource_mo... | Methods retrieves the connection details from the vcenter resource model attributes.
:param CloudShellAPISession session:
:param VMwarevCenterResourceModel vcenter_resource_model: Instance of VMwarevCenterResourceModel
:param ResourceContextDetails resource_context: the context of the command | [
"Methods",
"retrieves",
"the",
"connection",
"details",
"from",
"the",
"vcenter",
"resource",
"model",
"attributes",
"."
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/cloud_shell/conn_details_retriever.py#L7-L24 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/network/vnic/vnic_service.py | VNicService.vnic_add_to_vm_task | def vnic_add_to_vm_task(nicspec, virtual_machine, logger):
"""
Add new vNIC to VM
:param nicspec: <vim.vm.device.VirtualDeviceSpec>
:param virtual_machine:
:param logger:
:return:
"""
if issubclass(type(nicspec), vim.vm.device.VirtualDeviceSpec):
... | python | def vnic_add_to_vm_task(nicspec, virtual_machine, logger):
"""
Add new vNIC to VM
:param nicspec: <vim.vm.device.VirtualDeviceSpec>
:param virtual_machine:
:param logger:
:return:
"""
if issubclass(type(nicspec), vim.vm.device.VirtualDeviceSpec):
... | [
"def",
"vnic_add_to_vm_task",
"(",
"nicspec",
",",
"virtual_machine",
",",
"logger",
")",
":",
"if",
"issubclass",
"(",
"type",
"(",
"nicspec",
")",
",",
"vim",
".",
"vm",
".",
"device",
".",
"VirtualDeviceSpec",
")",
":",
"nicspec",
".",
"operation",
"=",... | Add new vNIC to VM
:param nicspec: <vim.vm.device.VirtualDeviceSpec>
:param virtual_machine:
:param logger:
:return: | [
"Add",
"new",
"vNIC",
"to",
"VM",
":",
"param",
"nicspec",
":",
"<vim",
".",
"vm",
".",
"device",
".",
"VirtualDeviceSpec",
">",
":",
"param",
"virtual_machine",
":",
":",
"param",
"logger",
":",
":",
"return",
":"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/network/vnic/vnic_service.py#L23-L39 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/network/vnic/vnic_service.py | VNicService.get_network_by_device | def get_network_by_device(vm, device, pyvmomi_service, logger):
"""
Get a Network connected to a particular Device (vNIC)
@see https://github.com/vmware/pyvmomi/blob/master/docs/vim/dvs/PortConnection.rst
:param vm:
:param device: <vim.vm.device.VirtualVmxnet3> instance of adapt... | python | def get_network_by_device(vm, device, pyvmomi_service, logger):
"""
Get a Network connected to a particular Device (vNIC)
@see https://github.com/vmware/pyvmomi/blob/master/docs/vim/dvs/PortConnection.rst
:param vm:
:param device: <vim.vm.device.VirtualVmxnet3> instance of adapt... | [
"def",
"get_network_by_device",
"(",
"vm",
",",
"device",
",",
"pyvmomi_service",
",",
"logger",
")",
":",
"try",
":",
"backing",
"=",
"device",
".",
"backing",
"if",
"hasattr",
"(",
"backing",
",",
"'network'",
")",
":",
"return",
"backing",
".",
"network... | Get a Network connected to a particular Device (vNIC)
@see https://github.com/vmware/pyvmomi/blob/master/docs/vim/dvs/PortConnection.rst
:param vm:
:param device: <vim.vm.device.VirtualVmxnet3> instance of adapter
:param pyvmomi_service:
:param logger:
:return: <vim Netw... | [
"Get",
"a",
"Network",
"connected",
"to",
"a",
"particular",
"Device",
"(",
"vNIC",
")",
"@see",
"https",
":",
"//",
"github",
".",
"com",
"/",
"vmware",
"/",
"pyvmomi",
"/",
"blob",
"/",
"master",
"/",
"docs",
"/",
"vim",
"/",
"dvs",
"/",
"PortConne... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/network/vnic/vnic_service.py#L68-L88 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/network/vnic/vnic_service.py | VNicService.device_is_attached_to_network | def device_is_attached_to_network(device, network_name):
"""
Checks if the device has a backing with of the right network name
:param <vim.vm.Device> device: instance of adapter
:param <str> network_name: network name
:return:
"""
try:
backing = device... | python | def device_is_attached_to_network(device, network_name):
"""
Checks if the device has a backing with of the right network name
:param <vim.vm.Device> device: instance of adapter
:param <str> network_name: network name
:return:
"""
try:
backing = device... | [
"def",
"device_is_attached_to_network",
"(",
"device",
",",
"network_name",
")",
":",
"try",
":",
"backing",
"=",
"device",
".",
"backing",
"except",
":",
"return",
"False",
"if",
"hasattr",
"(",
"backing",
",",
"'network'",
")",
"and",
"hasattr",
"(",
"back... | Checks if the device has a backing with of the right network name
:param <vim.vm.Device> device: instance of adapter
:param <str> network_name: network name
:return: | [
"Checks",
"if",
"the",
"device",
"has",
"a",
"backing",
"with",
"of",
"the",
"right",
"network",
"name",
":",
"param",
"<vim",
".",
"vm",
".",
"Device",
">",
"device",
":",
"instance",
"of",
"adapter",
":",
"param",
"<str",
">",
"network_name",
":",
"n... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/network/vnic/vnic_service.py#L91-L107 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/network/vnic/vnic_service.py | VNicService.vnic_compose_empty | def vnic_compose_empty(device=None):
"""
Compose empty vNIC for next attaching to a network
:param device: <vim.vm.device.VirtualVmxnet3 or None> Device for this this 'spec' will be composed.
If 'None' a new device will be composed.
'Operation' - edit/add' depends on if d... | python | def vnic_compose_empty(device=None):
"""
Compose empty vNIC for next attaching to a network
:param device: <vim.vm.device.VirtualVmxnet3 or None> Device for this this 'spec' will be composed.
If 'None' a new device will be composed.
'Operation' - edit/add' depends on if d... | [
"def",
"vnic_compose_empty",
"(",
"device",
"=",
"None",
")",
":",
"nicspec",
"=",
"vim",
".",
"vm",
".",
"device",
".",
"VirtualDeviceSpec",
"(",
")",
"if",
"device",
":",
"nicspec",
".",
"device",
"=",
"device",
"nicspec",
".",
"operation",
"=",
"vim",... | Compose empty vNIC for next attaching to a network
:param device: <vim.vm.device.VirtualVmxnet3 or None> Device for this this 'spec' will be composed.
If 'None' a new device will be composed.
'Operation' - edit/add' depends on if device existed
:return: <vim.vm.device.VirtualDevi... | [
"Compose",
"empty",
"vNIC",
"for",
"next",
"attaching",
"to",
"a",
"network",
":",
"param",
"device",
":",
"<vim",
".",
"vm",
".",
"device",
".",
"VirtualVmxnet3",
"or",
"None",
">",
"Device",
"for",
"this",
"this",
"spec",
"will",
"be",
"composed",
".",... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/network/vnic/vnic_service.py#L121-L144 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/network/vnic/vnic_service.py | VNicService.vnic_attach_to_network_standard | def vnic_attach_to_network_standard(nicspec, network, logger):
"""
Attach vNIC to a 'usual' network
:param nicspec: <vim.vm.device.VirtualDeviceSpec>
:param network: <vim.Network>
:param logger:
:return: updated 'nicspec'
"""
if nicspec and network_is_stan... | python | def vnic_attach_to_network_standard(nicspec, network, logger):
"""
Attach vNIC to a 'usual' network
:param nicspec: <vim.vm.device.VirtualDeviceSpec>
:param network: <vim.Network>
:param logger:
:return: updated 'nicspec'
"""
if nicspec and network_is_stan... | [
"def",
"vnic_attach_to_network_standard",
"(",
"nicspec",
",",
"network",
",",
"logger",
")",
":",
"if",
"nicspec",
"and",
"network_is_standard",
"(",
"network",
")",
":",
"network_name",
"=",
"network",
".",
"name",
"nicspec",
".",
"device",
".",
"backing",
"... | Attach vNIC to a 'usual' network
:param nicspec: <vim.vm.device.VirtualDeviceSpec>
:param network: <vim.Network>
:param logger:
:return: updated 'nicspec' | [
"Attach",
"vNIC",
"to",
"a",
"usual",
"network",
":",
"param",
"nicspec",
":",
"<vim",
".",
"vm",
".",
"device",
".",
"VirtualDeviceSpec",
">",
":",
"param",
"network",
":",
"<vim",
".",
"Network",
">",
":",
"param",
"logger",
":",
":",
"return",
":",
... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/network/vnic/vnic_service.py#L147-L173 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/network/vnic/vnic_service.py | VNicService.vnic_attach_to_network_distributed | def vnic_attach_to_network_distributed(nicspec, port_group, logger):
"""
Attach vNIC to a Distributed Port Group network
:param nicspec: <vim.vm.device.VirtualDeviceSpec>
:param port_group: <vim.dvs.DistributedVirtualPortgroup>
:param logger:
:return: updated 'nicspec'
... | python | def vnic_attach_to_network_distributed(nicspec, port_group, logger):
"""
Attach vNIC to a Distributed Port Group network
:param nicspec: <vim.vm.device.VirtualDeviceSpec>
:param port_group: <vim.dvs.DistributedVirtualPortgroup>
:param logger:
:return: updated 'nicspec'
... | [
"def",
"vnic_attach_to_network_distributed",
"(",
"nicspec",
",",
"port_group",
",",
"logger",
")",
":",
"if",
"nicspec",
"and",
"network_is_portgroup",
"(",
"port_group",
")",
":",
"network_name",
"=",
"port_group",
".",
"name",
"dvs_port_connection",
"=",
"vim",
... | Attach vNIC to a Distributed Port Group network
:param nicspec: <vim.vm.device.VirtualDeviceSpec>
:param port_group: <vim.dvs.DistributedVirtualPortgroup>
:param logger:
:return: updated 'nicspec' | [
"Attach",
"vNIC",
"to",
"a",
"Distributed",
"Port",
"Group",
"network",
":",
"param",
"nicspec",
":",
"<vim",
".",
"vm",
".",
"device",
".",
"VirtualDeviceSpec",
">",
":",
"param",
"port_group",
":",
"<vim",
".",
"dvs",
".",
"DistributedVirtualPortgroup",
">... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/network/vnic/vnic_service.py#L176-L197 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/network/vnic/vnic_service.py | VNicService.vnic_attached_to_network | def vnic_attached_to_network(nicspec, network, logger):
"""
Attach vNIC to Network.
:param nicspec: <vim.vm.device.VirtualDeviceSpec>
:param network: <vim network obj>
:return: updated 'nicspec'
"""
if nicspec:
if network_is_portgroup(network):
... | python | def vnic_attached_to_network(nicspec, network, logger):
"""
Attach vNIC to Network.
:param nicspec: <vim.vm.device.VirtualDeviceSpec>
:param network: <vim network obj>
:return: updated 'nicspec'
"""
if nicspec:
if network_is_portgroup(network):
... | [
"def",
"vnic_attached_to_network",
"(",
"nicspec",
",",
"network",
",",
"logger",
")",
":",
"if",
"nicspec",
":",
"if",
"network_is_portgroup",
"(",
"network",
")",
":",
"return",
"VNicService",
".",
"vnic_attach_to_network_distributed",
"(",
"nicspec",
",",
"netw... | Attach vNIC to Network.
:param nicspec: <vim.vm.device.VirtualDeviceSpec>
:param network: <vim network obj>
:return: updated 'nicspec' | [
"Attach",
"vNIC",
"to",
"Network",
".",
":",
"param",
"nicspec",
":",
"<vim",
".",
"vm",
".",
"device",
".",
"VirtualDeviceSpec",
">",
":",
"param",
"network",
":",
"<vim",
"network",
"obj",
">",
":",
"return",
":",
"updated",
"nicspec"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/network/vnic/vnic_service.py#L200-L215 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/network/vnic/vnic_service.py | VNicService.vnic_add_new_to_vm_task | def vnic_add_new_to_vm_task(vm, network, logger):
"""
Compose new vNIC and attach it to VM & connect to Network
:param nicspec: <vim.vm.VM>
:param network: <vim network obj>
:return: <Task>
"""
nicspes = VNicService.vnic_new_attached_to_network(network)
t... | python | def vnic_add_new_to_vm_task(vm, network, logger):
"""
Compose new vNIC and attach it to VM & connect to Network
:param nicspec: <vim.vm.VM>
:param network: <vim network obj>
:return: <Task>
"""
nicspes = VNicService.vnic_new_attached_to_network(network)
t... | [
"def",
"vnic_add_new_to_vm_task",
"(",
"vm",
",",
"network",
",",
"logger",
")",
":",
"nicspes",
"=",
"VNicService",
".",
"vnic_new_attached_to_network",
"(",
"network",
")",
"task",
"=",
"VNicService",
".",
"vnic_add_to_vm_task",
"(",
"nicspes",
",",
"vm",
",",... | Compose new vNIC and attach it to VM & connect to Network
:param nicspec: <vim.vm.VM>
:param network: <vim network obj>
:return: <Task> | [
"Compose",
"new",
"vNIC",
"and",
"attach",
"it",
"to",
"VM",
"&",
"connect",
"to",
"Network",
":",
"param",
"nicspec",
":",
"<vim",
".",
"vm",
".",
"VM",
">",
":",
"param",
"network",
":",
"<vim",
"network",
"obj",
">",
":",
"return",
":",
"<Task",
... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/network/vnic/vnic_service.py#L228-L238 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/network/vnic/vnic_service.py | VNicService.map_vnics | def map_vnics(vm):
"""
maps the vnic on the vm by name
:param vm: virtual machine
:return: dictionary: {'vnic_name': vnic}
"""
return {device.deviceInfo.label: device
for device in vm.config.hardware.device
if isinstance(device, vim.vm.devi... | python | def map_vnics(vm):
"""
maps the vnic on the vm by name
:param vm: virtual machine
:return: dictionary: {'vnic_name': vnic}
"""
return {device.deviceInfo.label: device
for device in vm.config.hardware.device
if isinstance(device, vim.vm.devi... | [
"def",
"map_vnics",
"(",
"vm",
")",
":",
"return",
"{",
"device",
".",
"deviceInfo",
".",
"label",
":",
"device",
"for",
"device",
"in",
"vm",
".",
"config",
".",
"hardware",
".",
"device",
"if",
"isinstance",
"(",
"device",
",",
"vim",
".",
"vm",
".... | maps the vnic on the vm by name
:param vm: virtual machine
:return: dictionary: {'vnic_name': vnic} | [
"maps",
"the",
"vnic",
"on",
"the",
"vm",
"by",
"name",
":",
"param",
"vm",
":",
"virtual",
"machine",
":",
"return",
":",
"dictionary",
":",
"{",
"vnic_name",
":",
"vnic",
"}"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/network/vnic/vnic_service.py#L270-L278 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/network/vnic/vnic_service.py | VNicService.get_device_spec | def get_device_spec(vnic, set_connected):
"""
this function creates the device change spec,
:param vnic: vnic
:param set_connected: bool, set as connected or not, default: True
:rtype: device_spec
"""
nic_spec = VNicService.create_vnic_spec(vnic)
VNicServi... | python | def get_device_spec(vnic, set_connected):
"""
this function creates the device change spec,
:param vnic: vnic
:param set_connected: bool, set as connected or not, default: True
:rtype: device_spec
"""
nic_spec = VNicService.create_vnic_spec(vnic)
VNicServi... | [
"def",
"get_device_spec",
"(",
"vnic",
",",
"set_connected",
")",
":",
"nic_spec",
"=",
"VNicService",
".",
"create_vnic_spec",
"(",
"vnic",
")",
"VNicService",
".",
"set_vnic_connectivity_status",
"(",
"nic_spec",
",",
"to_connect",
"=",
"set_connected",
")",
"re... | this function creates the device change spec,
:param vnic: vnic
:param set_connected: bool, set as connected or not, default: True
:rtype: device_spec | [
"this",
"function",
"creates",
"the",
"device",
"change",
"spec",
":",
"param",
"vnic",
":",
"vnic",
":",
"param",
"set_connected",
":",
"bool",
"set",
"as",
"connected",
"or",
"not",
"default",
":",
"True",
":",
"rtype",
":",
"device_spec"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/network/vnic/vnic_service.py#L281-L290 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/network/vnic/vnic_service.py | VNicService.create_vnic_spec | def create_vnic_spec(device):
"""
create device spec for existing device and the mode of edit for the vcenter to update
:param device:
:rtype: device spec
"""
nic_spec = vim.vm.device.VirtualDeviceSpec()
nic_spec.operation = vim.vm.device.VirtualDeviceSpec.Operati... | python | def create_vnic_spec(device):
"""
create device spec for existing device and the mode of edit for the vcenter to update
:param device:
:rtype: device spec
"""
nic_spec = vim.vm.device.VirtualDeviceSpec()
nic_spec.operation = vim.vm.device.VirtualDeviceSpec.Operati... | [
"def",
"create_vnic_spec",
"(",
"device",
")",
":",
"nic_spec",
"=",
"vim",
".",
"vm",
".",
"device",
".",
"VirtualDeviceSpec",
"(",
")",
"nic_spec",
".",
"operation",
"=",
"vim",
".",
"vm",
".",
"device",
".",
"VirtualDeviceSpec",
".",
"Operation",
".",
... | create device spec for existing device and the mode of edit for the vcenter to update
:param device:
:rtype: device spec | [
"create",
"device",
"spec",
"for",
"existing",
"device",
"and",
"the",
"mode",
"of",
"edit",
"for",
"the",
"vcenter",
"to",
"update",
":",
"param",
"device",
":",
":",
"rtype",
":",
"device",
"spec"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/network/vnic/vnic_service.py#L293-L302 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/network/vnic/vnic_service.py | VNicService.set_vnic_connectivity_status | def set_vnic_connectivity_status(nic_spec, to_connect):
"""
sets the device spec as connected or disconnected
:param nic_spec: the specification
:param to_connect: bool
"""
nic_spec.device.connectable = vim.vm.device.VirtualDevice.ConnectInfo()
nic... | python | def set_vnic_connectivity_status(nic_spec, to_connect):
"""
sets the device spec as connected or disconnected
:param nic_spec: the specification
:param to_connect: bool
"""
nic_spec.device.connectable = vim.vm.device.VirtualDevice.ConnectInfo()
nic... | [
"def",
"set_vnic_connectivity_status",
"(",
"nic_spec",
",",
"to_connect",
")",
":",
"nic_spec",
".",
"device",
".",
"connectable",
"=",
"vim",
".",
"vm",
".",
"device",
".",
"VirtualDevice",
".",
"ConnectInfo",
"(",
")",
"nic_spec",
".",
"device",
".",
"con... | sets the device spec as connected or disconnected
:param nic_spec: the specification
:param to_connect: bool | [
"sets",
"the",
"device",
"spec",
"as",
"connected",
"or",
"disconnected",
":",
"param",
"nic_spec",
":",
"the",
"specification",
":",
"param",
"to_connect",
":",
"bool"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/network/vnic/vnic_service.py#L305-L313 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/models/DeployDataHolder.py | DeployDataHolder.create_from_params | def create_from_params(cls, template_model, datastore_name, vm_cluster_model, ip_regex, refresh_ip_timeout,
auto_power_on, auto_power_off, wait_for_ip, auto_delete):
"""
:param VCenterTemplateModel template_model:
:param str datastore_name:
:param VMClusterMode... | python | def create_from_params(cls, template_model, datastore_name, vm_cluster_model, ip_regex, refresh_ip_timeout,
auto_power_on, auto_power_off, wait_for_ip, auto_delete):
"""
:param VCenterTemplateModel template_model:
:param str datastore_name:
:param VMClusterMode... | [
"def",
"create_from_params",
"(",
"cls",
",",
"template_model",
",",
"datastore_name",
",",
"vm_cluster_model",
",",
"ip_regex",
",",
"refresh_ip_timeout",
",",
"auto_power_on",
",",
"auto_power_off",
",",
"wait_for_ip",
",",
"auto_delete",
")",
":",
"dic",
"=",
"... | :param VCenterTemplateModel template_model:
:param str datastore_name:
:param VMClusterModel vm_cluster_model:
:param str ip_regex: Custom regex to filter IP addresses
:param refresh_ip_timeout:
:param bool auto_power_on:
:param bool auto_power_off:
:param bool wa... | [
":",
"param",
"VCenterTemplateModel",
"template_model",
":",
":",
"param",
"str",
"datastore_name",
":",
":",
"param",
"VMClusterModel",
"vm_cluster_model",
":",
":",
"param",
"str",
"ip_regex",
":",
"Custom",
"regex",
"to",
"filter",
"IP",
"addresses",
":",
"pa... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/models/DeployDataHolder.py#L29-L53 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/common/vcenter/vm_snapshots.py | SnapshotRetriever.get_current_snapshot_name | def get_current_snapshot_name(vm):
"""
Returns the name of the current snapshot
:param vm: Virtual machine to find current snapshot name
:return: Snapshot name
:rtype str
"""
all_snapshots = SnapshotRetriever.get_vm_snapshots(vm)
# noinspection PyProtected... | python | def get_current_snapshot_name(vm):
"""
Returns the name of the current snapshot
:param vm: Virtual machine to find current snapshot name
:return: Snapshot name
:rtype str
"""
all_snapshots = SnapshotRetriever.get_vm_snapshots(vm)
# noinspection PyProtected... | [
"def",
"get_current_snapshot_name",
"(",
"vm",
")",
":",
"all_snapshots",
"=",
"SnapshotRetriever",
".",
"get_vm_snapshots",
"(",
"vm",
")",
"# noinspection PyProtectedMember",
"if",
"not",
"vm",
".",
"snapshot",
":",
"return",
"None",
"current_snapshot_id",
"=",
"v... | Returns the name of the current snapshot
:param vm: Virtual machine to find current snapshot name
:return: Snapshot name
:rtype str | [
"Returns",
"the",
"name",
"of",
"the",
"current",
"snapshot",
":",
"param",
"vm",
":",
"Virtual",
"machine",
"to",
"find",
"current",
"snapshot",
"name",
":",
"return",
":",
"Snapshot",
"name",
":",
"rtype",
"str"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/vcenter/vm_snapshots.py#L11-L27 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/common/vcenter/vm_snapshots.py | SnapshotRetriever._get_snapshots_recursively | def _get_snapshots_recursively(snapshots, snapshot_location):
"""
Recursively traverses child snapshots and returns dictinary of snapshots
:param snapshots: list of snapshots to examine
:param snapshot_location: current path of snapshots
:return: dictinary of snapshot path and sn... | python | def _get_snapshots_recursively(snapshots, snapshot_location):
"""
Recursively traverses child snapshots and returns dictinary of snapshots
:param snapshots: list of snapshots to examine
:param snapshot_location: current path of snapshots
:return: dictinary of snapshot path and sn... | [
"def",
"_get_snapshots_recursively",
"(",
"snapshots",
",",
"snapshot_location",
")",
":",
"snapshot_paths",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"if",
"not",
"snapshots",
":",
"return",
"snapshot_paths",
"for",
"snapshot",
"in",
"snapshots",
":",
"if... | Recursively traverses child snapshots and returns dictinary of snapshots
:param snapshots: list of snapshots to examine
:param snapshot_location: current path of snapshots
:return: dictinary of snapshot path and snapshot instances
:rtype: dict(str,vim.vm.Snapshot) | [
"Recursively",
"traverses",
"child",
"snapshots",
"and",
"returns",
"dictinary",
"of",
"snapshots",
":",
"param",
"snapshots",
":",
"list",
"of",
"snapshots",
"to",
"examine",
":",
"param",
"snapshot_location",
":",
"current",
"path",
"of",
"snapshots",
":",
"re... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/vcenter/vm_snapshots.py#L44-L68 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/common/vcenter/task_waiter.py | SynchronousTaskWaiter.wait_for_task | def wait_for_task(self, task, logger, action_name='job', hide_result=False, cancellation_context=None):
"""
Waits and provides updates on a vSphere task
:param cancellation_context: package.cloudshell.cp.vcenter.models.QualiDriverModels.CancellationContext
:param task:
:param act... | python | def wait_for_task(self, task, logger, action_name='job', hide_result=False, cancellation_context=None):
"""
Waits and provides updates on a vSphere task
:param cancellation_context: package.cloudshell.cp.vcenter.models.QualiDriverModels.CancellationContext
:param task:
:param act... | [
"def",
"wait_for_task",
"(",
"self",
",",
"task",
",",
"logger",
",",
"action_name",
"=",
"'job'",
",",
"hide_result",
"=",
"False",
",",
"cancellation_context",
"=",
"None",
")",
":",
"while",
"task",
".",
"info",
".",
"state",
"in",
"[",
"vim",
".",
... | Waits and provides updates on a vSphere task
:param cancellation_context: package.cloudshell.cp.vcenter.models.QualiDriverModels.CancellationContext
:param task:
:param action_name:
:param hide_result:
:param logger: | [
"Waits",
"and",
"provides",
"updates",
"on",
"a",
"vSphere",
"task",
":",
"param",
"cancellation_context",
":",
"package",
".",
"cloudshell",
".",
"cp",
".",
"vcenter",
".",
"models",
".",
"QualiDriverModels",
".",
"CancellationContext",
":",
"param",
"task",
... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/vcenter/task_waiter.py#L13-L52 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/vm/deploy.py | VirtualMachineDeployer.deploy_from_linked_clone | def deploy_from_linked_clone(self, si, logger, data_holder, vcenter_data_model, reservation_id,
cancellation_context):
"""
deploy Cloned VM From VM Command, will deploy vm from a snapshot
:param cancellation_context:
:param si:
:param logger:
... | python | def deploy_from_linked_clone(self, si, logger, data_holder, vcenter_data_model, reservation_id,
cancellation_context):
"""
deploy Cloned VM From VM Command, will deploy vm from a snapshot
:param cancellation_context:
:param si:
:param logger:
... | [
"def",
"deploy_from_linked_clone",
"(",
"self",
",",
"si",
",",
"logger",
",",
"data_holder",
",",
"vcenter_data_model",
",",
"reservation_id",
",",
"cancellation_context",
")",
":",
"template_resource_model",
"=",
"data_holder",
".",
"template_resource_model",
"return"... | deploy Cloned VM From VM Command, will deploy vm from a snapshot
:param cancellation_context:
:param si:
:param logger:
:param data_holder:
:param vcenter_data_model:
:param str reservation_id:
:rtype DeployAppResult:
:return: | [
"deploy",
"Cloned",
"VM",
"From",
"VM",
"Command",
"will",
"deploy",
"vm",
"from",
"a",
"snapshot"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/vm/deploy.py#L38-L63 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/vm/deploy.py | VirtualMachineDeployer.deploy_clone_from_vm | def deploy_clone_from_vm(self, si, logger, data_holder, vcenter_data_model, reservation_id, cancellation_context):
"""
deploy Cloned VM From VM Command, will deploy vm from another vm
:param cancellation_context:
:param reservation_id:
:param si:
:param logger:
:... | python | def deploy_clone_from_vm(self, si, logger, data_holder, vcenter_data_model, reservation_id, cancellation_context):
"""
deploy Cloned VM From VM Command, will deploy vm from another vm
:param cancellation_context:
:param reservation_id:
:param si:
:param logger:
:... | [
"def",
"deploy_clone_from_vm",
"(",
"self",
",",
"si",
",",
"logger",
",",
"data_holder",
",",
"vcenter_data_model",
",",
"reservation_id",
",",
"cancellation_context",
")",
":",
"template_resource_model",
"=",
"data_holder",
".",
"template_resource_model",
"return",
... | deploy Cloned VM From VM Command, will deploy vm from another vm
:param cancellation_context:
:param reservation_id:
:param si:
:param logger:
:type data_holder:
:type vcenter_data_model:
:rtype DeployAppResult:
:return: | [
"deploy",
"Cloned",
"VM",
"From",
"VM",
"Command",
"will",
"deploy",
"vm",
"from",
"another",
"vm"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/vm/deploy.py#L65-L86 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/vm/deploy.py | VirtualMachineDeployer.deploy_from_template | def deploy_from_template(self, si, logger, data_holder, vcenter_data_model, reservation_id, cancellation_context):
"""
:param cancellation_context:
:param reservation_id:
:param si:
:param logger:
:type data_holder: DeployFromTemplateDetails
:type vcenter_data_mod... | python | def deploy_from_template(self, si, logger, data_holder, vcenter_data_model, reservation_id, cancellation_context):
"""
:param cancellation_context:
:param reservation_id:
:param si:
:param logger:
:type data_holder: DeployFromTemplateDetails
:type vcenter_data_mod... | [
"def",
"deploy_from_template",
"(",
"self",
",",
"si",
",",
"logger",
",",
"data_holder",
",",
"vcenter_data_model",
",",
"reservation_id",
",",
"cancellation_context",
")",
":",
"template_resource_model",
"=",
"data_holder",
".",
"template_resource_model",
"return",
... | :param cancellation_context:
:param reservation_id:
:param si:
:param logger:
:type data_holder: DeployFromTemplateDetails
:type vcenter_data_model
:rtype DeployAppResult:
:return: | [
":",
"param",
"cancellation_context",
":",
":",
"param",
"reservation_id",
":",
":",
"param",
"si",
":",
":",
"param",
"logger",
":",
":",
"type",
"data_holder",
":",
"DeployFromTemplateDetails",
":",
"type",
"vcenter_data_model",
":",
"rtype",
"DeployAppResult",
... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/vm/deploy.py#L88-L107 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/vm/deploy.py | VirtualMachineDeployer._deploy_a_clone | def _deploy_a_clone(self, si, logger, app_name, template_name, other_params, vcenter_data_model, reservation_id,
cancellation_context,
snapshot=''):
"""
:rtype DeployAppResult:
"""
# generate unique name
vm_name = self.name_generato... | python | def _deploy_a_clone(self, si, logger, app_name, template_name, other_params, vcenter_data_model, reservation_id,
cancellation_context,
snapshot=''):
"""
:rtype DeployAppResult:
"""
# generate unique name
vm_name = self.name_generato... | [
"def",
"_deploy_a_clone",
"(",
"self",
",",
"si",
",",
"logger",
",",
"app_name",
",",
"template_name",
",",
"other_params",
",",
"vcenter_data_model",
",",
"reservation_id",
",",
"cancellation_context",
",",
"snapshot",
"=",
"''",
")",
":",
"# generate unique nam... | :rtype DeployAppResult: | [
":",
"rtype",
"DeployAppResult",
":"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/vm/deploy.py#L109-L156 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/vm/deploy.py | VirtualMachineDeployer._get_deploy_image_params | def _get_deploy_image_params(data_holder, host_info, vm_name):
"""
:type data_holder: models.vCenterVMFromImageResourceModel.vCenterVMFromImageResourceModel
"""
image_params = OvfImageParams()
if hasattr(data_holder, 'vcenter_image_arguments') and data_holder.vcenter_image_argume... | python | def _get_deploy_image_params(data_holder, host_info, vm_name):
"""
:type data_holder: models.vCenterVMFromImageResourceModel.vCenterVMFromImageResourceModel
"""
image_params = OvfImageParams()
if hasattr(data_holder, 'vcenter_image_arguments') and data_holder.vcenter_image_argume... | [
"def",
"_get_deploy_image_params",
"(",
"data_holder",
",",
"host_info",
",",
"vm_name",
")",
":",
"image_params",
"=",
"OvfImageParams",
"(",
")",
"if",
"hasattr",
"(",
"data_holder",
",",
"'vcenter_image_arguments'",
")",
"and",
"data_holder",
".",
"vcenter_image_... | :type data_holder: models.vCenterVMFromImageResourceModel.vCenterVMFromImageResourceModel | [
":",
"type",
"data_holder",
":",
"models",
".",
"vCenterVMFromImageResourceModel",
".",
"vCenterVMFromImageResourceModel"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/vm/deploy.py#L216-L234 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/vm/deploy.py | DeploymentDetailsProviderFromTemplateModel.get_details | def get_details(self):
"""
:rtype list[VmDataField]
"""
data = []
if isinstance(self.model, vCenterCloneVMFromVMResourceModel):
data.append(VmDetailsProperty(key='Cloned VM Name', value=self.model.vcenter_vm))
if isinstance(self.model, VCenterDeployVMFromLink... | python | def get_details(self):
"""
:rtype list[VmDataField]
"""
data = []
if isinstance(self.model, vCenterCloneVMFromVMResourceModel):
data.append(VmDetailsProperty(key='Cloned VM Name', value=self.model.vcenter_vm))
if isinstance(self.model, VCenterDeployVMFromLink... | [
"def",
"get_details",
"(",
"self",
")",
":",
"data",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"self",
".",
"model",
",",
"vCenterCloneVMFromVMResourceModel",
")",
":",
"data",
".",
"append",
"(",
"VmDetailsProperty",
"(",
"key",
"=",
"'Cloned VM Name'",
",",
... | :rtype list[VmDataField] | [
":",
"rtype",
"list",
"[",
"VmDataField",
"]"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/vm/deploy.py#L241-L260 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/common/model_factory.py | ResourceModelParser.convert_to_resource_model | def convert_to_resource_model(self, attributes, resource_model_type):
"""
Converts an instance of resource with dictionary of attributes
to a class instance according to family and assigns its properties
:type attributes: dict
:param resource_model_type: Resource Model type to cr... | python | def convert_to_resource_model(self, attributes, resource_model_type):
"""
Converts an instance of resource with dictionary of attributes
to a class instance according to family and assigns its properties
:type attributes: dict
:param resource_model_type: Resource Model type to cr... | [
"def",
"convert_to_resource_model",
"(",
"self",
",",
"attributes",
",",
"resource_model_type",
")",
":",
"if",
"resource_model_type",
":",
"if",
"not",
"callable",
"(",
"resource_model_type",
")",
":",
"raise",
"ValueError",
"(",
"'resource_model_type {0} cannot be ins... | Converts an instance of resource with dictionary of attributes
to a class instance according to family and assigns its properties
:type attributes: dict
:param resource_model_type: Resource Model type to create
:return: | [
"Converts",
"an",
"instance",
"of",
"resource",
"with",
"dictionary",
"of",
"attributes",
"to",
"a",
"class",
"instance",
"according",
"to",
"family",
"and",
"assigns",
"its",
"properties",
":",
"type",
"attributes",
":",
"dict",
":",
"param",
"resource_model_ty... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/model_factory.py#L27-L65 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/common/model_factory.py | ResourceModelParser.create_resource_model_instance | def create_resource_model_instance(resource_instance):
"""
Create an instance of class named *ResourceModel
from models folder according to ResourceModelName of a resource
:param resource_instance: Resource with ResourceModelName property
:return: instance of ResourceModel class
... | python | def create_resource_model_instance(resource_instance):
"""
Create an instance of class named *ResourceModel
from models folder according to ResourceModelName of a resource
:param resource_instance: Resource with ResourceModelName property
:return: instance of ResourceModel class
... | [
"def",
"create_resource_model_instance",
"(",
"resource_instance",
")",
":",
"resource_model",
"=",
"ResourceModelParser",
".",
"get_resource_model",
"(",
"resource_instance",
")",
"resource_class_name",
"=",
"ResourceModelParser",
".",
"get_resource_model_class_name",
"(",
"... | Create an instance of class named *ResourceModel
from models folder according to ResourceModelName of a resource
:param resource_instance: Resource with ResourceModelName property
:return: instance of ResourceModel class | [
"Create",
"an",
"instance",
"of",
"class",
"named",
"*",
"ResourceModel",
"from",
"models",
"folder",
"according",
"to",
"ResourceModelName",
"of",
"a",
"resource",
":",
"param",
"resource_instance",
":",
"Resource",
"with",
"ResourceModelName",
"property",
":",
"... | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/model_factory.py#L109-L121 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/common/model_factory.py | ResourceModelParser.get_class | def get_class(class_path):
"""
Returns an instance of a class by its class_path.
:param class_path: contains modules and class name with dot delimited
:return: Any
"""
module_path, class_name = class_path.rsplit(".", 1)
try:
module = __import__(class_... | python | def get_class(class_path):
"""
Returns an instance of a class by its class_path.
:param class_path: contains modules and class name with dot delimited
:return: Any
"""
module_path, class_name = class_path.rsplit(".", 1)
try:
module = __import__(class_... | [
"def",
"get_class",
"(",
"class_path",
")",
":",
"module_path",
",",
"class_name",
"=",
"class_path",
".",
"rsplit",
"(",
"\".\"",
",",
"1",
")",
"try",
":",
"module",
"=",
"__import__",
"(",
"class_path",
",",
"fromlist",
"=",
"[",
"class_name",
"]",
")... | Returns an instance of a class by its class_path.
:param class_path: contains modules and class name with dot delimited
:return: Any | [
"Returns",
"an",
"instance",
"of",
"a",
"class",
"by",
"its",
"class_path",
".",
":",
"param",
"class_path",
":",
"contains",
"modules",
"and",
"class",
"name",
"with",
"dot",
"delimited",
":",
"return",
":",
"Any"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/model_factory.py#L140-L163 |
QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/common/model_factory.py | ResourceModelParser.get_property_name_from_attribute_name | def get_property_name_from_attribute_name(attribute):
"""
Returns property name from attribute name
:param attribute: Attribute name, may contain upper and lower case and spaces
:return: string
"""
if isinstance(attribute, str) or isinstance(attribute, unicode):
... | python | def get_property_name_from_attribute_name(attribute):
"""
Returns property name from attribute name
:param attribute: Attribute name, may contain upper and lower case and spaces
:return: string
"""
if isinstance(attribute, str) or isinstance(attribute, unicode):
... | [
"def",
"get_property_name_from_attribute_name",
"(",
"attribute",
")",
":",
"if",
"isinstance",
"(",
"attribute",
",",
"str",
")",
"or",
"isinstance",
"(",
"attribute",
",",
"unicode",
")",
":",
"attribute_name",
"=",
"attribute",
"elif",
"hasattr",
"(",
"attrib... | Returns property name from attribute name
:param attribute: Attribute name, may contain upper and lower case and spaces
:return: string | [
"Returns",
"property",
"name",
"from",
"attribute",
"name",
":",
"param",
"attribute",
":",
"Attribute",
"name",
"may",
"contain",
"upper",
"and",
"lower",
"case",
"and",
"spaces",
":",
"return",
":",
"string"
] | train | https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/model_factory.py#L166-L179 |
NASA-AMMOS/AIT-Core | ait/core/util.py | crc32File | def crc32File(filename, skip=0):
"""Computes the CRC-32 of the contents of filename, optionally
skipping a certain number of bytes at the beginning of the file.
"""
with open(filename, 'rb') as stream:
discard = stream.read(skip)
return zlib.crc32(stream.read()) & 0xffffffff | python | def crc32File(filename, skip=0):
"""Computes the CRC-32 of the contents of filename, optionally
skipping a certain number of bytes at the beginning of the file.
"""
with open(filename, 'rb') as stream:
discard = stream.read(skip)
return zlib.crc32(stream.read()) & 0xffffffff | [
"def",
"crc32File",
"(",
"filename",
",",
"skip",
"=",
"0",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'rb'",
")",
"as",
"stream",
":",
"discard",
"=",
"stream",
".",
"read",
"(",
"skip",
")",
"return",
"zlib",
".",
"crc32",
"(",
"stream",
".... | Computes the CRC-32 of the contents of filename, optionally
skipping a certain number of bytes at the beginning of the file. | [
"Computes",
"the",
"CRC",
"-",
"32",
"of",
"the",
"contents",
"of",
"filename",
"optionally",
"skipping",
"a",
"certain",
"number",
"of",
"bytes",
"at",
"the",
"beginning",
"of",
"the",
"file",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/util.py#L197-L203 |
NASA-AMMOS/AIT-Core | ait/core/util.py | endianSwapU16 | def endianSwapU16(bytes):
"""Swaps pairs of bytes (16-bit words) in the given bytearray."""
for b in range(0, len(bytes), 2):
bytes[b], bytes[b + 1] = bytes[b + 1], bytes[b]
return bytes | python | def endianSwapU16(bytes):
"""Swaps pairs of bytes (16-bit words) in the given bytearray."""
for b in range(0, len(bytes), 2):
bytes[b], bytes[b + 1] = bytes[b + 1], bytes[b]
return bytes | [
"def",
"endianSwapU16",
"(",
"bytes",
")",
":",
"for",
"b",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"bytes",
")",
",",
"2",
")",
":",
"bytes",
"[",
"b",
"]",
",",
"bytes",
"[",
"b",
"+",
"1",
"]",
"=",
"bytes",
"[",
"b",
"+",
"1",
"]",
... | Swaps pairs of bytes (16-bit words) in the given bytearray. | [
"Swaps",
"pairs",
"of",
"bytes",
"(",
"16",
"-",
"bit",
"words",
")",
"in",
"the",
"given",
"bytearray",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/util.py#L205-L209 |
NASA-AMMOS/AIT-Core | ait/core/util.py | setDictDefaults | def setDictDefaults (d, defaults):
"""Sets all defaults for the given dictionary to those contained in a
second defaults dictionary. This convenience method calls:
d.setdefault(key, value)
for each key and value in the given defaults dictionary.
"""
for key, val in defaults.items():
d.setdefault(ke... | python | def setDictDefaults (d, defaults):
"""Sets all defaults for the given dictionary to those contained in a
second defaults dictionary. This convenience method calls:
d.setdefault(key, value)
for each key and value in the given defaults dictionary.
"""
for key, val in defaults.items():
d.setdefault(ke... | [
"def",
"setDictDefaults",
"(",
"d",
",",
"defaults",
")",
":",
"for",
"key",
",",
"val",
"in",
"defaults",
".",
"items",
"(",
")",
":",
"d",
".",
"setdefault",
"(",
"key",
",",
"val",
")",
"return",
"d"
] | Sets all defaults for the given dictionary to those contained in a
second defaults dictionary. This convenience method calls:
d.setdefault(key, value)
for each key and value in the given defaults dictionary. | [
"Sets",
"all",
"defaults",
"for",
"the",
"given",
"dictionary",
"to",
"those",
"contained",
"in",
"a",
"second",
"defaults",
"dictionary",
".",
"This",
"convenience",
"method",
"calls",
":"
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/util.py#L212-L223 |
NASA-AMMOS/AIT-Core | ait/core/util.py | getDefaultDict | def getDefaultDict(modname, config_key, loader, reload=False, filename=None):
"""Returns default AIT dictonary for modname
This helper function encapulates the core logic necessary to
(re)load, cache (via util.ObjectCache), and return the default
dictionary. For example, in ait.core.cmd:
def getD... | python | def getDefaultDict(modname, config_key, loader, reload=False, filename=None):
"""Returns default AIT dictonary for modname
This helper function encapulates the core logic necessary to
(re)load, cache (via util.ObjectCache), and return the default
dictionary. For example, in ait.core.cmd:
def getD... | [
"def",
"getDefaultDict",
"(",
"modname",
",",
"config_key",
",",
"loader",
",",
"reload",
"=",
"False",
",",
"filename",
"=",
"None",
")",
":",
"module",
"=",
"sys",
".",
"modules",
"[",
"modname",
"]",
"default",
"=",
"getattr",
"(",
"module",
",",
"'... | Returns default AIT dictonary for modname
This helper function encapulates the core logic necessary to
(re)load, cache (via util.ObjectCache), and return the default
dictionary. For example, in ait.core.cmd:
def getDefaultDict(reload=False):
return ait.util.getDefaultDict(__name__, 'cmddict',... | [
"Returns",
"default",
"AIT",
"dictonary",
"for",
"modname"
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/util.py#L226-L250 |
NASA-AMMOS/AIT-Core | ait/core/util.py | toBCD | def toBCD (n):
"""Converts the number n into Binary Coded Decimal."""
bcd = 0
bits = 0
while True:
n, r = divmod(n, 10)
bcd |= (r << bits)
if n is 0:
break
bits += 4
return bcd | python | def toBCD (n):
"""Converts the number n into Binary Coded Decimal."""
bcd = 0
bits = 0
while True:
n, r = divmod(n, 10)
bcd |= (r << bits)
if n is 0:
break
bits += 4
return bcd | [
"def",
"toBCD",
"(",
"n",
")",
":",
"bcd",
"=",
"0",
"bits",
"=",
"0",
"while",
"True",
":",
"n",
",",
"r",
"=",
"divmod",
"(",
"n",
",",
"10",
")",
"bcd",
"|=",
"(",
"r",
"<<",
"bits",
")",
"if",
"n",
"is",
"0",
":",
"break",
"bits",
"+=... | Converts the number n into Binary Coded Decimal. | [
"Converts",
"the",
"number",
"n",
"into",
"Binary",
"Coded",
"Decimal",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/util.py#L258-L271 |
NASA-AMMOS/AIT-Core | ait/core/util.py | toFloat | def toFloat (str, default=None):
"""toFloat(str[, default]) -> float | default
Converts the given string to a floating-point value. If the
string could not be converted, default (None) is returned.
NOTE: This method is *significantly* more effecient than
toNumber() as it only attempts to parse fl... | python | def toFloat (str, default=None):
"""toFloat(str[, default]) -> float | default
Converts the given string to a floating-point value. If the
string could not be converted, default (None) is returned.
NOTE: This method is *significantly* more effecient than
toNumber() as it only attempts to parse fl... | [
"def",
"toFloat",
"(",
"str",
",",
"default",
"=",
"None",
")",
":",
"value",
"=",
"default",
"try",
":",
"value",
"=",
"float",
"(",
"str",
")",
"except",
"ValueError",
":",
"pass",
"return",
"value"
] | toFloat(str[, default]) -> float | default
Converts the given string to a floating-point value. If the
string could not be converted, default (None) is returned.
NOTE: This method is *significantly* more effecient than
toNumber() as it only attempts to parse floating-point numbers,
not integers o... | [
"toFloat",
"(",
"str",
"[",
"default",
"]",
")",
"-",
">",
"float",
"|",
"default"
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/util.py#L274-L302 |
NASA-AMMOS/AIT-Core | ait/core/util.py | toNumber | def toNumber (str, default=None):
"""toNumber(str[, default]) -> integer | float | default
Converts the given string to a numeric value. The string may be a
hexadecimal, integer, or floating number. If string could not be
converted, default (None) is returned.
Examples:
>>> n = toNumber("0x... | python | def toNumber (str, default=None):
"""toNumber(str[, default]) -> integer | float | default
Converts the given string to a numeric value. The string may be a
hexadecimal, integer, or floating number. If string could not be
converted, default (None) is returned.
Examples:
>>> n = toNumber("0x... | [
"def",
"toNumber",
"(",
"str",
",",
"default",
"=",
"None",
")",
":",
"value",
"=",
"default",
"try",
":",
"if",
"str",
".",
"startswith",
"(",
"\"0x\"",
")",
":",
"value",
"=",
"int",
"(",
"str",
",",
"16",
")",
"else",
":",
"try",
":",
"value",... | toNumber(str[, default]) -> integer | float | default
Converts the given string to a numeric value. The string may be a
hexadecimal, integer, or floating number. If string could not be
converted, default (None) is returned.
Examples:
>>> n = toNumber("0x2A")
>>> assert type(n) is int and n ... | [
"toNumber",
"(",
"str",
"[",
"default",
"]",
")",
"-",
">",
"integer",
"|",
"float",
"|",
"default"
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/util.py#L305-L342 |
NASA-AMMOS/AIT-Core | ait/core/util.py | toRepr | def toRepr (obj):
"""toRepr(obj) -> string
Converts the Python object to a string representation of the kind
often returned by a class __repr__() method.
"""
args = [ ]
names = [ ]
if hasattr(obj, "__dict__"):
names += getattr(obj, "__dict__").keys()
if hasattr(obj, "__slots__... | python | def toRepr (obj):
"""toRepr(obj) -> string
Converts the Python object to a string representation of the kind
often returned by a class __repr__() method.
"""
args = [ ]
names = [ ]
if hasattr(obj, "__dict__"):
names += getattr(obj, "__dict__").keys()
if hasattr(obj, "__slots__... | [
"def",
"toRepr",
"(",
"obj",
")",
":",
"args",
"=",
"[",
"]",
"names",
"=",
"[",
"]",
"if",
"hasattr",
"(",
"obj",
",",
"\"__dict__\"",
")",
":",
"names",
"+=",
"getattr",
"(",
"obj",
",",
"\"__dict__\"",
")",
".",
"keys",
"(",
")",
"if",
"hasatt... | toRepr(obj) -> string
Converts the Python object to a string representation of the kind
often returned by a class __repr__() method. | [
"toRepr",
"(",
"obj",
")",
"-",
">",
"string"
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/util.py#L352-L375 |
NASA-AMMOS/AIT-Core | ait/core/util.py | toStringDuration | def toStringDuration (duration):
"""Returns a description of the given duration in the most appropriate
units (e.g. seconds, ms, us, or ns).
"""
table = (
('%dms' , 1e-3, 1e3),
(u'%d\u03BCs', 1e-6, 1e6),
('%dns' , 1e-9, 1e9)
)
if duration > 1:
return '... | python | def toStringDuration (duration):
"""Returns a description of the given duration in the most appropriate
units (e.g. seconds, ms, us, or ns).
"""
table = (
('%dms' , 1e-3, 1e3),
(u'%d\u03BCs', 1e-6, 1e6),
('%dns' , 1e-9, 1e9)
)
if duration > 1:
return '... | [
"def",
"toStringDuration",
"(",
"duration",
")",
":",
"table",
"=",
"(",
"(",
"'%dms'",
",",
"1e-3",
",",
"1e3",
")",
",",
"(",
"u'%d\\u03BCs'",
",",
"1e-6",
",",
"1e6",
")",
",",
"(",
"'%dns'",
",",
"1e-9",
",",
"1e9",
")",
")",
"if",
"duration",
... | Returns a description of the given duration in the most appropriate
units (e.g. seconds, ms, us, or ns). | [
"Returns",
"a",
"description",
"of",
"the",
"given",
"duration",
"in",
"the",
"most",
"appropriate",
"units",
"(",
"e",
".",
"g",
".",
"seconds",
"ms",
"us",
"or",
"ns",
")",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/util.py#L378-L396 |
NASA-AMMOS/AIT-Core | ait/core/util.py | expandPath | def expandPath (pathname, prefix=None):
"""Return pathname as an absolute path, either expanded by the users
home directory ("~") or with prefix prepended.
"""
if prefix is None:
prefix = ''
expanded = pathname
if pathname[0] == '~':
expanded = os.path.expanduser(pathname)
... | python | def expandPath (pathname, prefix=None):
"""Return pathname as an absolute path, either expanded by the users
home directory ("~") or with prefix prepended.
"""
if prefix is None:
prefix = ''
expanded = pathname
if pathname[0] == '~':
expanded = os.path.expanduser(pathname)
... | [
"def",
"expandPath",
"(",
"pathname",
",",
"prefix",
"=",
"None",
")",
":",
"if",
"prefix",
"is",
"None",
":",
"prefix",
"=",
"''",
"expanded",
"=",
"pathname",
"if",
"pathname",
"[",
"0",
"]",
"==",
"'~'",
":",
"expanded",
"=",
"os",
".",
"path",
... | Return pathname as an absolute path, either expanded by the users
home directory ("~") or with prefix prepended. | [
"Return",
"pathname",
"as",
"an",
"absolute",
"path",
"either",
"expanded",
"by",
"the",
"users",
"home",
"directory",
"(",
"~",
")",
"or",
"with",
"prefix",
"prepended",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/util.py#L398-L412 |
NASA-AMMOS/AIT-Core | ait/core/util.py | listAllFiles | def listAllFiles (directory, suffix=None, abspath=False):
"""Returns the list of all files within the input directory and
all subdirectories.
"""
files = []
directory = expandPath(directory)
for dirpath, dirnames, filenames in os.walk(directory, followlinks=True):
if suffix:
... | python | def listAllFiles (directory, suffix=None, abspath=False):
"""Returns the list of all files within the input directory and
all subdirectories.
"""
files = []
directory = expandPath(directory)
for dirpath, dirnames, filenames in os.walk(directory, followlinks=True):
if suffix:
... | [
"def",
"listAllFiles",
"(",
"directory",
",",
"suffix",
"=",
"None",
",",
"abspath",
"=",
"False",
")",
":",
"files",
"=",
"[",
"]",
"directory",
"=",
"expandPath",
"(",
"directory",
")",
"for",
"dirpath",
",",
"dirnames",
",",
"filenames",
"in",
"os",
... | Returns the list of all files within the input directory and
all subdirectories. | [
"Returns",
"the",
"list",
"of",
"all",
"files",
"within",
"the",
"input",
"directory",
"and",
"all",
"subdirectories",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/util.py#L414-L435 |
NASA-AMMOS/AIT-Core | ait/core/util.py | ObjectCache.dirty | def dirty(self):
"""True if the cache needs to be updated, False otherwise"""
return not os.path.exists(self.cachename) or \
(os.path.getmtime(self.filename) >
os.path.getmtime(self.cachename)) | python | def dirty(self):
"""True if the cache needs to be updated, False otherwise"""
return not os.path.exists(self.cachename) or \
(os.path.getmtime(self.filename) >
os.path.getmtime(self.cachename)) | [
"def",
"dirty",
"(",
"self",
")",
":",
"return",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"cachename",
")",
"or",
"(",
"os",
".",
"path",
".",
"getmtime",
"(",
"self",
".",
"filename",
")",
">",
"os",
".",
"path",
".",
"getmtime... | True if the cache needs to be updated, False otherwise | [
"True",
"if",
"the",
"cache",
"needs",
"to",
"be",
"updated",
"False",
"otherwise"
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/util.py#L64-L68 |
NASA-AMMOS/AIT-Core | ait/core/util.py | ObjectCache.cache | def cache(self):
"""Caches the result of loader(filename) to cachename."""
msg = 'Saving updates from more recent "%s" to "%s"'
log.info(msg, self.filename, self.cachename)
with open(self.cachename, 'wb') as output:
cPickle.dump(self._dict, output, -1) | python | def cache(self):
"""Caches the result of loader(filename) to cachename."""
msg = 'Saving updates from more recent "%s" to "%s"'
log.info(msg, self.filename, self.cachename)
with open(self.cachename, 'wb') as output:
cPickle.dump(self._dict, output, -1) | [
"def",
"cache",
"(",
"self",
")",
":",
"msg",
"=",
"'Saving updates from more recent \"%s\" to \"%s\"'",
"log",
".",
"info",
"(",
"msg",
",",
"self",
".",
"filename",
",",
"self",
".",
"cachename",
")",
"with",
"open",
"(",
"self",
".",
"cachename",
",",
"... | Caches the result of loader(filename) to cachename. | [
"Caches",
"the",
"result",
"of",
"loader",
"(",
"filename",
")",
"to",
"cachename",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/util.py#L77-L82 |
NASA-AMMOS/AIT-Core | ait/core/util.py | ObjectCache.load | def load(self):
"""Loads the Python object
Loads the Python object, either via loader(filename) or the
pickled cache file, whichever was modified most recently.
"""
if self._dict is None:
if self.dirty:
self._dict = self._loader(self.filename)
... | python | def load(self):
"""Loads the Python object
Loads the Python object, either via loader(filename) or the
pickled cache file, whichever was modified most recently.
"""
if self._dict is None:
if self.dirty:
self._dict = self._loader(self.filename)
... | [
"def",
"load",
"(",
"self",
")",
":",
"if",
"self",
".",
"_dict",
"is",
"None",
":",
"if",
"self",
".",
"dirty",
":",
"self",
".",
"_dict",
"=",
"self",
".",
"_loader",
"(",
"self",
".",
"filename",
")",
"self",
".",
"cache",
"(",
")",
"else",
... | Loads the Python object
Loads the Python object, either via loader(filename) or the
pickled cache file, whichever was modified most recently. | [
"Loads",
"the",
"Python",
"object"
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/util.py#L85-L99 |
NASA-AMMOS/AIT-Core | ait/core/server/plugin.py | DataArchive.process | def process(self, input_data, topic=None, **kwargs):
"""
Splits tuple received from PacketHandler into packet UID and packet message.
Decodes packet and inserts into database backend.
Logs any exceptions raised.
Params:
input_data: message received from inbound stre... | python | def process(self, input_data, topic=None, **kwargs):
"""
Splits tuple received from PacketHandler into packet UID and packet message.
Decodes packet and inserts into database backend.
Logs any exceptions raised.
Params:
input_data: message received from inbound stre... | [
"def",
"process",
"(",
"self",
",",
"input_data",
",",
"topic",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"split",
"=",
"input_data",
"[",
"1",
":",
"-",
"1",
"]",
".",
"split",
"(",
"','",
",",
"1",
")",
"uid",
",",
"pkt",
... | Splits tuple received from PacketHandler into packet UID and packet message.
Decodes packet and inserts into database backend.
Logs any exceptions raised.
Params:
input_data: message received from inbound stream through PacketHandler
topic: name of inbound stream ... | [
"Splits",
"tuple",
"received",
"from",
"PacketHandler",
"into",
"packet",
"UID",
"and",
"packet",
"message",
".",
"Decodes",
"packet",
"and",
"inserts",
"into",
"database",
"backend",
".",
"Logs",
"any",
"exceptions",
"raised",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/server/plugin.py#L102-L120 |
NASA-AMMOS/AIT-Core | ait/core/dmc.py | getTimestampUTC | def getTimestampUTC():
"""getTimestampUTC() -> (ts_sec, ts_usec)
Returns the current UTC time in seconds and microseconds.
"""
utc = datetime.datetime.utcnow()
ts_sec = calendar.timegm( utc.timetuple() )
ts_usec = utc.microsecond
return ts_sec, ts_usec | python | def getTimestampUTC():
"""getTimestampUTC() -> (ts_sec, ts_usec)
Returns the current UTC time in seconds and microseconds.
"""
utc = datetime.datetime.utcnow()
ts_sec = calendar.timegm( utc.timetuple() )
ts_usec = utc.microsecond
return ts_sec, ts_usec | [
"def",
"getTimestampUTC",
"(",
")",
":",
"utc",
"=",
"datetime",
".",
"datetime",
".",
"utcnow",
"(",
")",
"ts_sec",
"=",
"calendar",
".",
"timegm",
"(",
"utc",
".",
"timetuple",
"(",
")",
")",
"ts_usec",
"=",
"utc",
".",
"microsecond",
"return",
"ts_s... | getTimestampUTC() -> (ts_sec, ts_usec)
Returns the current UTC time in seconds and microseconds. | [
"getTimestampUTC",
"()",
"-",
">",
"(",
"ts_sec",
"ts_usec",
")"
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/dmc.py#L48-L56 |
NASA-AMMOS/AIT-Core | ait/core/dmc.py | getUTCDatetimeDOY | def getUTCDatetimeDOY(days=0, hours=0, minutes=0, seconds=0):
"""getUTCDatetimeDOY -> datetime
Returns the UTC current datetime with the input timedelta arguments (days, hours, minutes, seconds)
added to current date. Returns ISO-8601 datetime format for day of year:
YYYY-DDDTHH:mm:ssZ
"""
... | python | def getUTCDatetimeDOY(days=0, hours=0, minutes=0, seconds=0):
"""getUTCDatetimeDOY -> datetime
Returns the UTC current datetime with the input timedelta arguments (days, hours, minutes, seconds)
added to current date. Returns ISO-8601 datetime format for day of year:
YYYY-DDDTHH:mm:ssZ
"""
... | [
"def",
"getUTCDatetimeDOY",
"(",
"days",
"=",
"0",
",",
"hours",
"=",
"0",
",",
"minutes",
"=",
"0",
",",
"seconds",
"=",
"0",
")",
":",
"return",
"(",
"datetime",
".",
"datetime",
".",
"utcnow",
"(",
")",
"+",
"datetime",
".",
"timedelta",
"(",
"d... | getUTCDatetimeDOY -> datetime
Returns the UTC current datetime with the input timedelta arguments (days, hours, minutes, seconds)
added to current date. Returns ISO-8601 datetime format for day of year:
YYYY-DDDTHH:mm:ssZ | [
"getUTCDatetimeDOY",
"-",
">",
"datetime"
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/dmc.py#L59-L69 |
NASA-AMMOS/AIT-Core | ait/core/dmc.py | toc | def toc():
"""toc() -> float | None
Returns the total elapsed seconds since the most recent tic(), or
None if tic() was not called.
Examples:
>>> import time
>>> tic()
>>> time.sleep(1.2)
>>> elapsed = toc()
>>> assert abs(elapsed - 1.2) <= 1e-2
.. note:: The tic() and toc(... | python | def toc():
"""toc() -> float | None
Returns the total elapsed seconds since the most recent tic(), or
None if tic() was not called.
Examples:
>>> import time
>>> tic()
>>> time.sleep(1.2)
>>> elapsed = toc()
>>> assert abs(elapsed - 1.2) <= 1e-2
.. note:: The tic() and toc(... | [
"def",
"toc",
"(",
")",
":",
"end",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"return",
"totalSeconds",
"(",
"end",
"-",
"TICs",
".",
"pop",
"(",
")",
")",
"if",
"len",
"(",
"TICs",
")",
"else",
"None"
] | toc() -> float | None
Returns the total elapsed seconds since the most recent tic(), or
None if tic() was not called.
Examples:
>>> import time
>>> tic()
>>> time.sleep(1.2)
>>> elapsed = toc()
>>> assert abs(elapsed - 1.2) <= 1e-2
.. note:: The tic() and toc() functions are si... | [
"toc",
"()",
"-",
">",
"float",
"|",
"None"
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/dmc.py#L82-L105 |
NASA-AMMOS/AIT-Core | ait/core/dmc.py | toGPSWeekAndSecs | def toGPSWeekAndSecs(timestamp=None):
"""Converts the given UTC timestamp (defaults to the current time) to
a two-tuple, (GPS week number, GPS seconds within the week).
"""
if timestamp is None:
timestamp = datetime.datetime.utcnow()
leap = LeapSeconds.get_GPS_offset_for_date(timestamp)
... | python | def toGPSWeekAndSecs(timestamp=None):
"""Converts the given UTC timestamp (defaults to the current time) to
a two-tuple, (GPS week number, GPS seconds within the week).
"""
if timestamp is None:
timestamp = datetime.datetime.utcnow()
leap = LeapSeconds.get_GPS_offset_for_date(timestamp)
... | [
"def",
"toGPSWeekAndSecs",
"(",
"timestamp",
"=",
"None",
")",
":",
"if",
"timestamp",
"is",
"None",
":",
"timestamp",
"=",
"datetime",
".",
"datetime",
".",
"utcnow",
"(",
")",
"leap",
"=",
"LeapSeconds",
".",
"get_GPS_offset_for_date",
"(",
"timestamp",
")... | Converts the given UTC timestamp (defaults to the current time) to
a two-tuple, (GPS week number, GPS seconds within the week). | [
"Converts",
"the",
"given",
"UTC",
"timestamp",
"(",
"defaults",
"to",
"the",
"current",
"time",
")",
"to",
"a",
"two",
"-",
"tuple",
"(",
"GPS",
"week",
"number",
"GPS",
"seconds",
"within",
"the",
"week",
")",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/dmc.py#L108-L122 |
NASA-AMMOS/AIT-Core | ait/core/dmc.py | toGMST | def toGMST(dt=None):
"""Converts the given Python datetime or Julian date (float) to
Greenwich Mean Sidereal Time (GMST) (in radians) using the formula
from D.A. Vallado (2004).
See:
D.A. Vallado, Fundamentals of Astrodynamics and Applications, p. 192
http://books.google.com/books?id=P... | python | def toGMST(dt=None):
"""Converts the given Python datetime or Julian date (float) to
Greenwich Mean Sidereal Time (GMST) (in radians) using the formula
from D.A. Vallado (2004).
See:
D.A. Vallado, Fundamentals of Astrodynamics and Applications, p. 192
http://books.google.com/books?id=P... | [
"def",
"toGMST",
"(",
"dt",
"=",
"None",
")",
":",
"if",
"dt",
"is",
"None",
"or",
"type",
"(",
"dt",
")",
"is",
"datetime",
".",
"datetime",
":",
"jd",
"=",
"toJulian",
"(",
"dt",
")",
"else",
":",
"jd",
"=",
"dt",
"tUT1",
"=",
"(",
"jd",
"-... | Converts the given Python datetime or Julian date (float) to
Greenwich Mean Sidereal Time (GMST) (in radians) using the formula
from D.A. Vallado (2004).
See:
D.A. Vallado, Fundamentals of Astrodynamics and Applications, p. 192
http://books.google.com/books?id=PJLlWzMBKjkC&lpg=PA956&vq=192... | [
"Converts",
"the",
"given",
"Python",
"datetime",
"or",
"Julian",
"date",
"(",
"float",
")",
"to",
"Greenwich",
"Mean",
"Sidereal",
"Time",
"(",
"GMST",
")",
"(",
"in",
"radians",
")",
"using",
"the",
"formula",
"from",
"D",
".",
"A",
".",
"Vallado",
"... | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/dmc.py#L145-L175 |
NASA-AMMOS/AIT-Core | ait/core/dmc.py | toJulian | def toJulian(dt=None):
"""Converts a Python datetime to a Julian date, using the formula from
Meesus (1991). This formula is reproduced in D.A. Vallado (2004).
See:
D.A. Vallado, Fundamentals of Astrodynamics and Applications, p. 187
http://books.google.com/books?id=PJLlWzMBKjkC&lpg=PA956... | python | def toJulian(dt=None):
"""Converts a Python datetime to a Julian date, using the formula from
Meesus (1991). This formula is reproduced in D.A. Vallado (2004).
See:
D.A. Vallado, Fundamentals of Astrodynamics and Applications, p. 187
http://books.google.com/books?id=PJLlWzMBKjkC&lpg=PA956... | [
"def",
"toJulian",
"(",
"dt",
"=",
"None",
")",
":",
"if",
"dt",
"is",
"None",
":",
"dt",
"=",
"datetime",
".",
"datetime",
".",
"utcnow",
"(",
")",
"if",
"dt",
".",
"month",
"<",
"3",
":",
"year",
"=",
"dt",
".",
"year",
"-",
"1",
"month",
"... | Converts a Python datetime to a Julian date, using the formula from
Meesus (1991). This formula is reproduced in D.A. Vallado (2004).
See:
D.A. Vallado, Fundamentals of Astrodynamics and Applications, p. 187
http://books.google.com/books?id=PJLlWzMBKjkC&lpg=PA956&vq=187&pg=PA187 | [
"Converts",
"a",
"Python",
"datetime",
"to",
"a",
"Julian",
"date",
"using",
"the",
"formula",
"from",
"Meesus",
"(",
"1991",
")",
".",
"This",
"formula",
"is",
"reproduced",
"in",
"D",
".",
"A",
".",
"Vallado",
"(",
"2004",
")",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/dmc.py#L178-L203 |
NASA-AMMOS/AIT-Core | ait/core/dmc.py | toLocalTime | def toLocalTime(seconds, microseconds=0):
"""toLocalTime(seconds, microseconds=0) -> datetime
Converts the given number of seconds since the GPS Epoch (midnight
on January 6th, 1980) to this computer's local time. Returns a
Python datetime object.
Examples:
>>> toLocalTime(0)
datetime.da... | python | def toLocalTime(seconds, microseconds=0):
"""toLocalTime(seconds, microseconds=0) -> datetime
Converts the given number of seconds since the GPS Epoch (midnight
on January 6th, 1980) to this computer's local time. Returns a
Python datetime object.
Examples:
>>> toLocalTime(0)
datetime.da... | [
"def",
"toLocalTime",
"(",
"seconds",
",",
"microseconds",
"=",
"0",
")",
":",
"delta",
"=",
"datetime",
".",
"timedelta",
"(",
"seconds",
"=",
"seconds",
",",
"microseconds",
"=",
"microseconds",
")",
"return",
"GPS_Epoch",
"+",
"delta"
] | toLocalTime(seconds, microseconds=0) -> datetime
Converts the given number of seconds since the GPS Epoch (midnight
on January 6th, 1980) to this computer's local time. Returns a
Python datetime object.
Examples:
>>> toLocalTime(0)
datetime.datetime(1980, 1, 6, 0, 0)
>>> toLocalTime(25 ... | [
"toLocalTime",
"(",
"seconds",
"microseconds",
"=",
"0",
")",
"-",
">",
"datetime"
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/dmc.py#L206-L222 |
NASA-AMMOS/AIT-Core | ait/core/dmc.py | totalSeconds | def totalSeconds(td):
"""totalSeconds(td) -> float
Return the total number of seconds contained in the given Python
datetime.timedelta object. Python 2.6 and earlier do not have
timedelta.total_seconds().
Examples:
>>> totalSeconds( toLocalTime(86400.123) - toLocalTime(0.003) )
86400.12
... | python | def totalSeconds(td):
"""totalSeconds(td) -> float
Return the total number of seconds contained in the given Python
datetime.timedelta object. Python 2.6 and earlier do not have
timedelta.total_seconds().
Examples:
>>> totalSeconds( toLocalTime(86400.123) - toLocalTime(0.003) )
86400.12
... | [
"def",
"totalSeconds",
"(",
"td",
")",
":",
"if",
"hasattr",
"(",
"td",
",",
"\"total_seconds\"",
")",
":",
"ts",
"=",
"td",
".",
"total_seconds",
"(",
")",
"else",
":",
"ts",
"=",
"(",
"td",
".",
"microseconds",
"+",
"(",
"td",
".",
"seconds",
"+"... | totalSeconds(td) -> float
Return the total number of seconds contained in the given Python
datetime.timedelta object. Python 2.6 and earlier do not have
timedelta.total_seconds().
Examples:
>>> totalSeconds( toLocalTime(86400.123) - toLocalTime(0.003) )
86400.12 | [
"totalSeconds",
"(",
"td",
")",
"-",
">",
"float"
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/dmc.py#L225-L242 |
NASA-AMMOS/AIT-Core | ait/core/dmc.py | UTCLeapSeconds._update_leap_second_data | def _update_leap_second_data(self):
""" Updates the systems leap second information
Pulls the latest leap second information from
https://www.ietf.org/timezones/data/leap-seconds.list
and updates the leapsecond config file.
Raises:
ValueError: If the connection to I... | python | def _update_leap_second_data(self):
""" Updates the systems leap second information
Pulls the latest leap second information from
https://www.ietf.org/timezones/data/leap-seconds.list
and updates the leapsecond config file.
Raises:
ValueError: If the connection to I... | [
"def",
"_update_leap_second_data",
"(",
"self",
")",
":",
"log",
".",
"info",
"(",
"'Attempting to acquire latest leapsecond data'",
")",
"ls_file",
"=",
"ait",
".",
"config",
".",
"get",
"(",
"'leapseconds.filename'",
",",
"os",
".",
"path",
".",
"join",
"(",
... | Updates the systems leap second information
Pulls the latest leap second information from
https://www.ietf.org/timezones/data/leap-seconds.list
and updates the leapsecond config file.
Raises:
ValueError: If the connection to IETF does not return 200
IOError: If ... | [
"Updates",
"the",
"systems",
"leap",
"second",
"information"
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/dmc.py#L307-L351 |
NASA-AMMOS/AIT-Core | ait/core/server/server.py | Server.wait | def wait(self):
"""
Starts all greenlets for concurrent processing.
Joins over all greenlets that are not servers.
"""
for greenlet in (self.greenlets + self.servers):
log.info("Starting {} greenlet...".format(greenlet))
greenlet.start()
gevent.jo... | python | def wait(self):
"""
Starts all greenlets for concurrent processing.
Joins over all greenlets that are not servers.
"""
for greenlet in (self.greenlets + self.servers):
log.info("Starting {} greenlet...".format(greenlet))
greenlet.start()
gevent.jo... | [
"def",
"wait",
"(",
"self",
")",
":",
"for",
"greenlet",
"in",
"(",
"self",
".",
"greenlets",
"+",
"self",
".",
"servers",
")",
":",
"log",
".",
"info",
"(",
"\"Starting {} greenlet...\"",
".",
"format",
"(",
"greenlet",
")",
")",
"greenlet",
".",
"sta... | Starts all greenlets for concurrent processing.
Joins over all greenlets that are not servers. | [
"Starts",
"all",
"greenlets",
"for",
"concurrent",
"processing",
".",
"Joins",
"over",
"all",
"greenlets",
"that",
"are",
"not",
"servers",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/server/server.py#L41-L50 |
NASA-AMMOS/AIT-Core | ait/core/server/server.py | Server._load_streams | def _load_streams(self):
"""
Reads, parses and creates streams specified in config.yaml.
"""
common_err_msg = 'No valid {} stream configurations found. '
specific_err_msg = {'inbound': 'No data will be received (or displayed).',
'outbound': 'No data wi... | python | def _load_streams(self):
"""
Reads, parses and creates streams specified in config.yaml.
"""
common_err_msg = 'No valid {} stream configurations found. '
specific_err_msg = {'inbound': 'No data will be received (or displayed).',
'outbound': 'No data wi... | [
"def",
"_load_streams",
"(",
"self",
")",
":",
"common_err_msg",
"=",
"'No valid {} stream configurations found. '",
"specific_err_msg",
"=",
"{",
"'inbound'",
":",
"'No data will be received (or displayed).'",
",",
"'outbound'",
":",
"'No data will be published.'",
"}",
"err... | Reads, parses and creates streams specified in config.yaml. | [
"Reads",
"parses",
"and",
"creates",
"streams",
"specified",
"in",
"config",
".",
"yaml",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/server/server.py#L52-L90 |
NASA-AMMOS/AIT-Core | ait/core/server/server.py | Server._create_inbound_stream | def _create_inbound_stream(self, config=None):
"""
Creates an inbound stream from its config.
Params:
config: stream configuration as read by ait.config
Returns:
stream: a Stream
Raises:
ValueError: if any of the required config ... | python | def _create_inbound_stream(self, config=None):
"""
Creates an inbound stream from its config.
Params:
config: stream configuration as read by ait.config
Returns:
stream: a Stream
Raises:
ValueError: if any of the required config ... | [
"def",
"_create_inbound_stream",
"(",
"self",
",",
"config",
"=",
"None",
")",
":",
"if",
"config",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'No stream config to create stream from.'",
")",
"name",
"=",
"self",
".",
"_get_stream_name",
"(",
"config",
")",... | Creates an inbound stream from its config.
Params:
config: stream configuration as read by ait.config
Returns:
stream: a Stream
Raises:
ValueError: if any of the required config values are missing | [
"Creates",
"an",
"inbound",
"stream",
"from",
"its",
"config",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/server/server.py#L119-L152 |
NASA-AMMOS/AIT-Core | ait/core/server/server.py | Server._create_outbound_stream | def _create_outbound_stream(self, config=None):
"""
Creates an outbound stream from its config.
Params:
config: stream configuration as read by ait.config
Returns:
stream: a Stream
Raises:
ValueError: if any of the required confi... | python | def _create_outbound_stream(self, config=None):
"""
Creates an outbound stream from its config.
Params:
config: stream configuration as read by ait.config
Returns:
stream: a Stream
Raises:
ValueError: if any of the required confi... | [
"def",
"_create_outbound_stream",
"(",
"self",
",",
"config",
"=",
"None",
")",
":",
"if",
"config",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'No stream config to create stream from.'",
")",
"name",
"=",
"self",
".",
"_get_stream_name",
"(",
"config",
")"... | Creates an outbound stream from its config.
Params:
config: stream configuration as read by ait.config
Returns:
stream: a Stream
Raises:
ValueError: if any of the required config values are missing | [
"Creates",
"an",
"outbound",
"stream",
"from",
"its",
"config",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/server/server.py#L154-L190 |
NASA-AMMOS/AIT-Core | ait/core/server/server.py | Server._create_handler | def _create_handler(self, config):
"""
Creates a handler from its config.
Params:
config: handler config
Returns:
handler instance
"""
if config is None:
raise ValueError('No handler config to create handler from.')
if 'n... | python | def _create_handler(self, config):
"""
Creates a handler from its config.
Params:
config: handler config
Returns:
handler instance
"""
if config is None:
raise ValueError('No handler config to create handler from.')
if 'n... | [
"def",
"_create_handler",
"(",
"self",
",",
"config",
")",
":",
"if",
"config",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'No handler config to create handler from.'",
")",
"if",
"'name'",
"not",
"in",
"config",
":",
"raise",
"ValueError",
"(",
"'Handler n... | Creates a handler from its config.
Params:
config: handler config
Returns:
handler instance | [
"Creates",
"a",
"handler",
"from",
"its",
"config",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/server/server.py#L192-L215 |
NASA-AMMOS/AIT-Core | ait/core/server/server.py | Server._load_plugins | def _load_plugins(self):
"""
Reads, parses and creates plugins specified in config.yaml.
"""
plugins = ait.config.get('server.plugins')
if plugins is None:
log.warn('No plugins specified in config.')
else:
for index, p in enumerate(plugins):
... | python | def _load_plugins(self):
"""
Reads, parses and creates plugins specified in config.yaml.
"""
plugins = ait.config.get('server.plugins')
if plugins is None:
log.warn('No plugins specified in config.')
else:
for index, p in enumerate(plugins):
... | [
"def",
"_load_plugins",
"(",
"self",
")",
":",
"plugins",
"=",
"ait",
".",
"config",
".",
"get",
"(",
"'server.plugins'",
")",
"if",
"plugins",
"is",
"None",
":",
"log",
".",
"warn",
"(",
"'No plugins specified in config.'",
")",
"else",
":",
"for",
"index... | Reads, parses and creates plugins specified in config.yaml. | [
"Reads",
"parses",
"and",
"creates",
"plugins",
"specified",
"in",
"config",
".",
"yaml",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/server/server.py#L217-L238 |
NASA-AMMOS/AIT-Core | ait/core/server/server.py | Server._create_plugin | def _create_plugin(self, config):
"""
Creates a plugin from its config.
Params:
config: plugin configuration as read by ait.config
Returns:
plugin: a Plugin
Raises:
ValueError: if any of the required config values are missing
... | python | def _create_plugin(self, config):
"""
Creates a plugin from its config.
Params:
config: plugin configuration as read by ait.config
Returns:
plugin: a Plugin
Raises:
ValueError: if any of the required config values are missing
... | [
"def",
"_create_plugin",
"(",
"self",
",",
"config",
")",
":",
"if",
"config",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'No plugin config to create plugin from.'",
")",
"name",
"=",
"config",
".",
"pop",
"(",
"'name'",
",",
"None",
")",
"if",
"name",
... | Creates a plugin from its config.
Params:
config: plugin configuration as read by ait.config
Returns:
plugin: a Plugin
Raises:
ValueError: if any of the required config values are missing | [
"Creates",
"a",
"plugin",
"from",
"its",
"config",
"."
] | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/server/server.py#L240-L292 |
NASA-AMMOS/AIT-Core | ait/core/json.py | slotsToJSON | def slotsToJSON(obj, slots=None):
"""Converts the given Python object to one suitable for Javascript
Object Notation (JSON) serialization via :func:`json.dump` or
:func:`json.dumps`. This function delegates to :func:`toJSON`.
Specifically only attributes in the list of *slots* are converted.
If *s... | python | def slotsToJSON(obj, slots=None):
"""Converts the given Python object to one suitable for Javascript
Object Notation (JSON) serialization via :func:`json.dump` or
:func:`json.dumps`. This function delegates to :func:`toJSON`.
Specifically only attributes in the list of *slots* are converted.
If *s... | [
"def",
"slotsToJSON",
"(",
"obj",
",",
"slots",
"=",
"None",
")",
":",
"if",
"slots",
"is",
"None",
":",
"slots",
"=",
"list",
"(",
"obj",
".",
"__slots__",
")",
"if",
"hasattr",
"(",
"obj",
",",
"'__slots__'",
")",
"else",
"[",
"]",
"for",
"base",... | Converts the given Python object to one suitable for Javascript
Object Notation (JSON) serialization via :func:`json.dump` or
:func:`json.dumps`. This function delegates to :func:`toJSON`.
Specifically only attributes in the list of *slots* are converted.
If *slots* is not provided, it defaults to the... | [
"Converts",
"the",
"given",
"Python",
"object",
"to",
"one",
"suitable",
"for",
"Javascript",
"Object",
"Notation",
"(",
"JSON",
")",
"serialization",
"via",
":",
"func",
":",
"json",
".",
"dump",
"or",
":",
"func",
":",
"json",
".",
"dumps",
".",
"This"... | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/json.py#L26-L56 |
NASA-AMMOS/AIT-Core | ait/core/json.py | toJSON | def toJSON (obj):
"""Converts the given Python object to one suitable for Javascript
Object Notation (JSON) serialization via :func:`json.dump` or
:func:`json.dumps`. If the Python object has a :meth:`toJSON`
method, it is always given preference and will be called to peform
the conversion.
Ot... | python | def toJSON (obj):
"""Converts the given Python object to one suitable for Javascript
Object Notation (JSON) serialization via :func:`json.dump` or
:func:`json.dumps`. If the Python object has a :meth:`toJSON`
method, it is always given preference and will be called to peform
the conversion.
Ot... | [
"def",
"toJSON",
"(",
"obj",
")",
":",
"if",
"hasattr",
"(",
"obj",
",",
"'toJSON'",
")",
"and",
"callable",
"(",
"obj",
".",
"toJSON",
")",
":",
"result",
"=",
"obj",
".",
"toJSON",
"(",
")",
"elif",
"isinstance",
"(",
"obj",
",",
"(",
"int",
",... | Converts the given Python object to one suitable for Javascript
Object Notation (JSON) serialization via :func:`json.dump` or
:func:`json.dumps`. If the Python object has a :meth:`toJSON`
method, it is always given preference and will be called to peform
the conversion.
Otherwise, plain mapping an... | [
"Converts",
"the",
"given",
"Python",
"object",
"to",
"one",
"suitable",
"for",
"Javascript",
"Object",
"Notation",
"(",
"JSON",
")",
"serialization",
"via",
":",
"func",
":",
"json",
".",
"dump",
"or",
":",
"func",
":",
"json",
".",
"dumps",
".",
"If",
... | train | https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/json.py#L59-L87 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.