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 |
|---|---|---|---|---|---|---|---|---|---|---|
albahnsen/CostSensitiveClassification | costcla/models/regression.py | CostSensitiveLogisticRegression.fit | def fit(self, X, y, cost_mat):
""" Build a example-dependent cost-sensitive logistic regression from the training set (X, y, cost_mat)
Parameters
----------
X : array-like of shape = [n_samples, n_features]
The input samples.
y : array indicator matrix
G... | python | def fit(self, X, y, cost_mat):
""" Build a example-dependent cost-sensitive logistic regression from the training set (X, y, cost_mat)
Parameters
----------
X : array-like of shape = [n_samples, n_features]
The input samples.
y : array indicator matrix
G... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
",",
"cost_mat",
")",
":",
"#TODO: Check input",
"n_features",
"=",
"X",
".",
"shape",
"[",
"1",
"]",
"if",
"self",
".",
"fit_intercept",
":",
"w0",
"=",
"np",
".",
"zeros",
"(",
"n_features",
"+",
"1"... | Build a example-dependent cost-sensitive logistic regression from the training set (X, y, cost_mat)
Parameters
----------
X : array-like of shape = [n_samples, n_features]
The input samples.
y : array indicator matrix
Ground truth (correct) labels.
cost... | [
"Build",
"a",
"example",
"-",
"dependent",
"cost",
"-",
"sensitive",
"logistic",
"regression",
"from",
"the",
"training",
"set",
"(",
"X",
"y",
"cost_mat",
")"
] | train | https://github.com/albahnsen/CostSensitiveClassification/blob/75778ae32c70671c0cdde6c4651277b6a8b58871/costcla/models/regression.py#L194-L257 |
albahnsen/CostSensitiveClassification | costcla/models/regression.py | CostSensitiveLogisticRegression.predict_proba | def predict_proba(self, X):
"""Probability estimates.
The returned estimates.
Parameters
----------
X : array-like, shape = [n_samples, n_features]
Returns
-------
T : array-like, shape = [n_samples, 2]
Returns the probability of the sample ... | python | def predict_proba(self, X):
"""Probability estimates.
The returned estimates.
Parameters
----------
X : array-like, shape = [n_samples, n_features]
Returns
-------
T : array-like, shape = [n_samples, 2]
Returns the probability of the sample ... | [
"def",
"predict_proba",
"(",
"self",
",",
"X",
")",
":",
"y_prob",
"=",
"np",
".",
"zeros",
"(",
"(",
"X",
".",
"shape",
"[",
"0",
"]",
",",
"2",
")",
")",
"y_prob",
"[",
":",
",",
"1",
"]",
"=",
"_sigmoid",
"(",
"np",
".",
"dot",
"(",
"X",... | Probability estimates.
The returned estimates.
Parameters
----------
X : array-like, shape = [n_samples, n_features]
Returns
-------
T : array-like, shape = [n_samples, 2]
Returns the probability of the sample for each class in the model. | [
"Probability",
"estimates",
"."
] | train | https://github.com/albahnsen/CostSensitiveClassification/blob/75778ae32c70671c0cdde6c4651277b6a8b58871/costcla/models/regression.py#L259-L276 |
albahnsen/CostSensitiveClassification | costcla/models/regression.py | CostSensitiveLogisticRegression.predict | def predict(self, X, cut_point=0.5):
"""Predicted class.
Parameters
----------
X : array-like, shape = [n_samples, n_features]
Returns
-------
T : array-like, shape = [n_samples]
Returns the prediction of the sample..
"""
return np.fl... | python | def predict(self, X, cut_point=0.5):
"""Predicted class.
Parameters
----------
X : array-like, shape = [n_samples, n_features]
Returns
-------
T : array-like, shape = [n_samples]
Returns the prediction of the sample..
"""
return np.fl... | [
"def",
"predict",
"(",
"self",
",",
"X",
",",
"cut_point",
"=",
"0.5",
")",
":",
"return",
"np",
".",
"floor",
"(",
"self",
".",
"predict_proba",
"(",
"X",
")",
"[",
":",
",",
"1",
"]",
"+",
"(",
"1",
"-",
"cut_point",
")",
")"
] | Predicted class.
Parameters
----------
X : array-like, shape = [n_samples, n_features]
Returns
-------
T : array-like, shape = [n_samples]
Returns the prediction of the sample.. | [
"Predicted",
"class",
"."
] | train | https://github.com/albahnsen/CostSensitiveClassification/blob/75778ae32c70671c0cdde6c4651277b6a8b58871/costcla/models/regression.py#L278-L290 |
MozillaSecurity/laniakea | laniakea/core/userdata.py | UserData.list_tags | def list_tags(userdata):
"""List all used macros within a UserData script.
:param userdata: The UserData script.
:type userdata: str
"""
macros = re.findall('@(.*?)@', userdata)
logging.info('List of available macros:')
for macro in macros:
logging.in... | python | def list_tags(userdata):
"""List all used macros within a UserData script.
:param userdata: The UserData script.
:type userdata: str
"""
macros = re.findall('@(.*?)@', userdata)
logging.info('List of available macros:')
for macro in macros:
logging.in... | [
"def",
"list_tags",
"(",
"userdata",
")",
":",
"macros",
"=",
"re",
".",
"findall",
"(",
"'@(.*?)@'",
",",
"userdata",
")",
"logging",
".",
"info",
"(",
"'List of available macros:'",
")",
"for",
"macro",
"in",
"macros",
":",
"logging",
".",
"info",
"(",
... | List all used macros within a UserData script.
:param userdata: The UserData script.
:type userdata: str | [
"List",
"all",
"used",
"macros",
"within",
"a",
"UserData",
"script",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/userdata.py#L54-L63 |
MozillaSecurity/laniakea | laniakea/core/userdata.py | UserData.handle_tags | def handle_tags(userdata, macros):
"""Insert macro values or auto export variables in UserData scripts.
:param userdata: The UserData script.
:type userdata: str
:param macros: UserData macros as key value pair.
:type macros: dict
:return: UserData script with the macros... | python | def handle_tags(userdata, macros):
"""Insert macro values or auto export variables in UserData scripts.
:param userdata: The UserData script.
:type userdata: str
:param macros: UserData macros as key value pair.
:type macros: dict
:return: UserData script with the macros... | [
"def",
"handle_tags",
"(",
"userdata",
",",
"macros",
")",
":",
"macro_vars",
"=",
"re",
".",
"findall",
"(",
"'@(.*?)@'",
",",
"userdata",
")",
"for",
"macro_var",
"in",
"macro_vars",
":",
"if",
"macro_var",
"==",
"'!all_macros_export'",
":",
"macro_var_expor... | Insert macro values or auto export variables in UserData scripts.
:param userdata: The UserData script.
:type userdata: str
:param macros: UserData macros as key value pair.
:type macros: dict
:return: UserData script with the macros replaced with their values.
:rtype: s... | [
"Insert",
"macro",
"values",
"or",
"auto",
"export",
"variables",
"in",
"UserData",
"scripts",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/userdata.py#L66-L109 |
MozillaSecurity/laniakea | laniakea/core/userdata.py | UserData.handle_import_tags | def handle_import_tags(userdata, import_root):
"""Handle @import(filepath)@ tags in a UserData script.
:param import_root: Location for imports.
:type import_root: str
:param userdata: UserData script content.
:type userdata: str
:return: UserData script with the content... | python | def handle_import_tags(userdata, import_root):
"""Handle @import(filepath)@ tags in a UserData script.
:param import_root: Location for imports.
:type import_root: str
:param userdata: UserData script content.
:type userdata: str
:return: UserData script with the content... | [
"def",
"handle_import_tags",
"(",
"userdata",
",",
"import_root",
")",
":",
"imports",
"=",
"re",
".",
"findall",
"(",
"'@import\\((.*?)\\)@'",
",",
"userdata",
")",
"# pylint: disable=anomalous-backslash-in-string",
"if",
"not",
"imports",
":",
"return",
"userdata",
... | Handle @import(filepath)@ tags in a UserData script.
:param import_root: Location for imports.
:type import_root: str
:param userdata: UserData script content.
:type userdata: str
:return: UserData script with the contents of the imported files.
:rtype: str | [
"Handle",
"@import",
"(",
"filepath",
")",
"@",
"tags",
"in",
"a",
"UserData",
"script",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/userdata.py#L112-L136 |
MozillaSecurity/laniakea | laniakea/core/providers/ec2/manager.py | EC2Manager.retry_on_ec2_error | def retry_on_ec2_error(self, func, *args, **kwargs):
"""
Call the given method with the given arguments, retrying if the call
failed due to an EC2ResponseError. This method will wait at most 30
seconds and perform up to 6 retries. If the method still fails, it will
propagate the ... | python | def retry_on_ec2_error(self, func, *args, **kwargs):
"""
Call the given method with the given arguments, retrying if the call
failed due to an EC2ResponseError. This method will wait at most 30
seconds and perform up to 6 retries. If the method still fails, it will
propagate the ... | [
"def",
"retry_on_ec2_error",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"exception_retry_count",
"=",
"6",
"while",
"True",
":",
"try",
":",
"return",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"except... | Call the given method with the given arguments, retrying if the call
failed due to an EC2ResponseError. This method will wait at most 30
seconds and perform up to 6 retries. If the method still fails, it will
propagate the error.
:param func: Function to call
:type func: functio... | [
"Call",
"the",
"given",
"method",
"with",
"the",
"given",
"arguments",
"retrying",
"if",
"the",
"call",
"failed",
"due",
"to",
"an",
"EC2ResponseError",
".",
"This",
"method",
"will",
"wait",
"at",
"most",
"30",
"seconds",
"and",
"perform",
"up",
"to",
"6"... | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/ec2/manager.py#L36-L54 |
MozillaSecurity/laniakea | laniakea/core/providers/ec2/manager.py | EC2Manager.connect | def connect(self, region, **kw_params):
"""Connect to a EC2.
:param region: The name of the region to connect to.
:type region: str
:param kw_params:
:type kw_params: dict
"""
self.ec2 = boto.ec2.connect_to_region(region, **kw_params)
if not self.ec2:
... | python | def connect(self, region, **kw_params):
"""Connect to a EC2.
:param region: The name of the region to connect to.
:type region: str
:param kw_params:
:type kw_params: dict
"""
self.ec2 = boto.ec2.connect_to_region(region, **kw_params)
if not self.ec2:
... | [
"def",
"connect",
"(",
"self",
",",
"region",
",",
"*",
"*",
"kw_params",
")",
":",
"self",
".",
"ec2",
"=",
"boto",
".",
"ec2",
".",
"connect_to_region",
"(",
"region",
",",
"*",
"*",
"kw_params",
")",
"if",
"not",
"self",
".",
"ec2",
":",
"raise"... | Connect to a EC2.
:param region: The name of the region to connect to.
:type region: str
:param kw_params:
:type kw_params: dict | [
"Connect",
"to",
"a",
"EC2",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/ec2/manager.py#L56-L72 |
MozillaSecurity/laniakea | laniakea/core/providers/ec2/manager.py | EC2Manager.resolve_image_name | def resolve_image_name(self, image_name):
"""Look up an AMI for the connected region based on an image name.
:param image_name: The name of the image to resolve.
:type image_name: str
:return: The AMI for the given image.
:rtype: str
"""
# look at each scope in o... | python | def resolve_image_name(self, image_name):
"""Look up an AMI for the connected region based on an image name.
:param image_name: The name of the image to resolve.
:type image_name: str
:return: The AMI for the given image.
:rtype: str
"""
# look at each scope in o... | [
"def",
"resolve_image_name",
"(",
"self",
",",
"image_name",
")",
":",
"# look at each scope in order of size",
"scopes",
"=",
"[",
"'self'",
",",
"'amazon'",
",",
"'aws-marketplace'",
"]",
"if",
"image_name",
"in",
"self",
".",
"remote_images",
":",
"return",
"se... | Look up an AMI for the connected region based on an image name.
:param image_name: The name of the image to resolve.
:type image_name: str
:return: The AMI for the given image.
:rtype: str | [
"Look",
"up",
"an",
"AMI",
"for",
"the",
"connected",
"region",
"based",
"on",
"an",
"image",
"name",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/ec2/manager.py#L74-L92 |
MozillaSecurity/laniakea | laniakea/core/providers/ec2/manager.py | EC2Manager.create_on_demand | def create_on_demand(self,
instance_type='default',
tags=None,
root_device_type='ebs',
size='default',
vol_type='gp2',
delete_on_termination=False):
"""Create one... | python | def create_on_demand(self,
instance_type='default',
tags=None,
root_device_type='ebs',
size='default',
vol_type='gp2',
delete_on_termination=False):
"""Create one... | [
"def",
"create_on_demand",
"(",
"self",
",",
"instance_type",
"=",
"'default'",
",",
"tags",
"=",
"None",
",",
"root_device_type",
"=",
"'ebs'",
",",
"size",
"=",
"'default'",
",",
"vol_type",
"=",
"'gp2'",
",",
"delete_on_termination",
"=",
"False",
")",
":... | Create one or more EC2 on-demand instances.
:param size: Size of root device
:type size: int
:param delete_on_termination:
:type delete_on_termination: boolean
:param vol_type:
:type vol_type: str
:param root_device_type: The type of the root device.
:typ... | [
"Create",
"one",
"or",
"more",
"EC2",
"on",
"-",
"demand",
"instances",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/ec2/manager.py#L94-L144 |
MozillaSecurity/laniakea | laniakea/core/providers/ec2/manager.py | EC2Manager.create_spot_requests | def create_spot_requests(self,
price,
instance_type='default',
root_device_type='ebs',
size='default',
vol_type='gp2',
delete_on_termination=False... | python | def create_spot_requests(self,
price,
instance_type='default',
root_device_type='ebs',
size='default',
vol_type='gp2',
delete_on_termination=False... | [
"def",
"create_spot_requests",
"(",
"self",
",",
"price",
",",
"instance_type",
"=",
"'default'",
",",
"root_device_type",
"=",
"'ebs'",
",",
"size",
"=",
"'default'",
",",
"vol_type",
"=",
"'gp2'",
",",
"delete_on_termination",
"=",
"False",
",",
"timeout",
"... | Request creation of one or more EC2 spot instances.
:param size:
:param vol_type:
:param delete_on_termination:
:param root_device_type: The type of the root device.
:type root_device_type: str
:param price: Max price to pay for spot instance per hour.
:type pric... | [
"Request",
"creation",
"of",
"one",
"or",
"more",
"EC2",
"spot",
"instances",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/ec2/manager.py#L146-L181 |
MozillaSecurity/laniakea | laniakea/core/providers/ec2/manager.py | EC2Manager.check_spot_requests | def check_spot_requests(self, requests, tags=None):
"""Check status of one or more EC2 spot instance requests.
:param requests: List of EC2 spot instance request IDs.
:type requests: list
:param tags:
:type tags: dict
:return: List of boto.ec2.instance.Instance's created... | python | def check_spot_requests(self, requests, tags=None):
"""Check status of one or more EC2 spot instance requests.
:param requests: List of EC2 spot instance request IDs.
:type requests: list
:param tags:
:type tags: dict
:return: List of boto.ec2.instance.Instance's created... | [
"def",
"check_spot_requests",
"(",
"self",
",",
"requests",
",",
"tags",
"=",
"None",
")",
":",
"instances",
"=",
"[",
"None",
"]",
"*",
"len",
"(",
"requests",
")",
"ec2_requests",
"=",
"self",
".",
"retry_on_ec2_error",
"(",
"self",
".",
"ec2",
".",
... | Check status of one or more EC2 spot instance requests.
:param requests: List of EC2 spot instance request IDs.
:type requests: list
:param tags:
:type tags: dict
:return: List of boto.ec2.instance.Instance's created, order corresponding to requests param (None if request
... | [
"Check",
"status",
"of",
"one",
"or",
"more",
"EC2",
"spot",
"instance",
"requests",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/ec2/manager.py#L183-L221 |
MozillaSecurity/laniakea | laniakea/core/providers/ec2/manager.py | EC2Manager.cancel_spot_requests | def cancel_spot_requests(self, requests):
"""Cancel one or more EC2 spot instance requests.
:param requests: List of EC2 spot instance request IDs.
:type requests: list
"""
ec2_requests = self.retry_on_ec2_error(self.ec2.get_all_spot_instance_requests, request_ids=requests)
... | python | def cancel_spot_requests(self, requests):
"""Cancel one or more EC2 spot instance requests.
:param requests: List of EC2 spot instance request IDs.
:type requests: list
"""
ec2_requests = self.retry_on_ec2_error(self.ec2.get_all_spot_instance_requests, request_ids=requests)
... | [
"def",
"cancel_spot_requests",
"(",
"self",
",",
"requests",
")",
":",
"ec2_requests",
"=",
"self",
".",
"retry_on_ec2_error",
"(",
"self",
".",
"ec2",
".",
"get_all_spot_instance_requests",
",",
"request_ids",
"=",
"requests",
")",
"for",
"req",
"in",
"ec2_requ... | Cancel one or more EC2 spot instance requests.
:param requests: List of EC2 spot instance request IDs.
:type requests: list | [
"Cancel",
"one",
"or",
"more",
"EC2",
"spot",
"instance",
"requests",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/ec2/manager.py#L223-L232 |
MozillaSecurity/laniakea | laniakea/core/providers/ec2/manager.py | EC2Manager.create_spot | def create_spot(self,
price,
instance_type='default',
tags=None,
root_device_type='ebs',
size='default',
vol_type='gp2',
delete_on_termination=False,
timeout=No... | python | def create_spot(self,
price,
instance_type='default',
tags=None,
root_device_type='ebs',
size='default',
vol_type='gp2',
delete_on_termination=False,
timeout=No... | [
"def",
"create_spot",
"(",
"self",
",",
"price",
",",
"instance_type",
"=",
"'default'",
",",
"tags",
"=",
"None",
",",
"root_device_type",
"=",
"'ebs'",
",",
"size",
"=",
"'default'",
",",
"vol_type",
"=",
"'gp2'",
",",
"delete_on_termination",
"=",
"False"... | Create one or more EC2 spot instances.
:param root_device_type:
:param size:
:param vol_type:
:param delete_on_termination:
:param timeout:
:param price: Max price to pay for spot instance per hour.
:type price: float
:param instance_type: A section name ... | [
"Create",
"one",
"or",
"more",
"EC2",
"spot",
"instances",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/ec2/manager.py#L234-L294 |
MozillaSecurity/laniakea | laniakea/core/providers/ec2/manager.py | EC2Manager._scale_down | def _scale_down(self, instances, count):
"""Return a list of |count| last created instances by launch time.
:param instances: A list of instances.
:type instances: list
:param count: Number of instances to scale down.
:type count: integer
:return: List of instances to be... | python | def _scale_down(self, instances, count):
"""Return a list of |count| last created instances by launch time.
:param instances: A list of instances.
:type instances: list
:param count: Number of instances to scale down.
:type count: integer
:return: List of instances to be... | [
"def",
"_scale_down",
"(",
"self",
",",
"instances",
",",
"count",
")",
":",
"i",
"=",
"sorted",
"(",
"instances",
",",
"key",
"=",
"lambda",
"i",
":",
"i",
".",
"launch_time",
",",
"reverse",
"=",
"True",
")",
"if",
"not",
"i",
":",
"return",
"[",... | Return a list of |count| last created instances by launch time.
:param instances: A list of instances.
:type instances: list
:param count: Number of instances to scale down.
:type count: integer
:return: List of instances to be scaled down.
:rtype: list | [
"Return",
"a",
"list",
"of",
"|count|",
"last",
"created",
"instances",
"by",
"launch",
"time",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/ec2/manager.py#L296-L315 |
MozillaSecurity/laniakea | laniakea/core/providers/ec2/manager.py | EC2Manager._get_default_name_size | def _get_default_name_size(self, instance_type, size):
"""Checks if root device name/size were specified in the image definition.
:param instance_type: A section name in amazon.json.
:type instance_type: str
:param size:
:type size: int
:return: Root device name and size... | python | def _get_default_name_size(self, instance_type, size):
"""Checks if root device name/size were specified in the image definition.
:param instance_type: A section name in amazon.json.
:type instance_type: str
:param size:
:type size: int
:return: Root device name and size... | [
"def",
"_get_default_name_size",
"(",
"self",
",",
"instance_type",
",",
"size",
")",
":",
"if",
"'root_size'",
"in",
"self",
".",
"images",
"[",
"instance_type",
"]",
":",
"size",
"=",
"self",
".",
"images",
"[",
"instance_type",
"]",
".",
"pop",
"(",
"... | Checks if root device name/size were specified in the image definition.
:param instance_type: A section name in amazon.json.
:type instance_type: str
:param size:
:type size: int
:return: Root device name and size
:rtype: tuple(str, int) | [
"Checks",
"if",
"root",
"device",
"name",
"/",
"size",
"were",
"specified",
"in",
"the",
"image",
"definition",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/ec2/manager.py#L317-L335 |
MozillaSecurity/laniakea | laniakea/core/providers/ec2/manager.py | EC2Manager._configure_ebs_volume | def _configure_ebs_volume(self, vol_type, name, size, delete_on_termination):
"""Sets the desired root EBS size, otherwise the default EC2 value is used.
:param vol_type: Type of EBS storage - gp2 (SSD), io1 or standard (magnetic)
:type vol_type: str
:param size: Desired root EBS size.
... | python | def _configure_ebs_volume(self, vol_type, name, size, delete_on_termination):
"""Sets the desired root EBS size, otherwise the default EC2 value is used.
:param vol_type: Type of EBS storage - gp2 (SSD), io1 or standard (magnetic)
:type vol_type: str
:param size: Desired root EBS size.
... | [
"def",
"_configure_ebs_volume",
"(",
"self",
",",
"vol_type",
",",
"name",
",",
"size",
",",
"delete_on_termination",
")",
":",
"# From GitHub boto docs: http://git.io/veyDv",
"root_dev",
"=",
"boto",
".",
"ec2",
".",
"blockdevicemapping",
".",
"BlockDeviceType",
"(",... | Sets the desired root EBS size, otherwise the default EC2 value is used.
:param vol_type: Type of EBS storage - gp2 (SSD), io1 or standard (magnetic)
:type vol_type: str
:param size: Desired root EBS size.
:type size: int
:param delete_on_termination: Toggle this flag to delete ... | [
"Sets",
"the",
"desired",
"root",
"EBS",
"size",
"otherwise",
"the",
"default",
"EC2",
"value",
"is",
"used",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/ec2/manager.py#L337-L357 |
MozillaSecurity/laniakea | laniakea/core/providers/ec2/manager.py | EC2Manager.stop | def stop(self, instances, count=0):
"""Stop each provided running instance.
:param count:
:param instances: A list of instances.
:type instances: list
"""
if not instances:
return
if count > 0:
instances = self._scale_down(instances, count... | python | def stop(self, instances, count=0):
"""Stop each provided running instance.
:param count:
:param instances: A list of instances.
:type instances: list
"""
if not instances:
return
if count > 0:
instances = self._scale_down(instances, count... | [
"def",
"stop",
"(",
"self",
",",
"instances",
",",
"count",
"=",
"0",
")",
":",
"if",
"not",
"instances",
":",
"return",
"if",
"count",
">",
"0",
":",
"instances",
"=",
"self",
".",
"_scale_down",
"(",
"instances",
",",
"count",
")",
"self",
".",
"... | Stop each provided running instance.
:param count:
:param instances: A list of instances.
:type instances: list | [
"Stop",
"each",
"provided",
"running",
"instance",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/ec2/manager.py#L359-L370 |
MozillaSecurity/laniakea | laniakea/core/providers/ec2/manager.py | EC2Manager.terminate | def terminate(self, instances, count=0):
"""Terminate each provided running or stopped instance.
:param count:
:param instances: A list of instances.
:type instances: list
"""
if not instances:
return
if count > 0:
instances = self._scale_... | python | def terminate(self, instances, count=0):
"""Terminate each provided running or stopped instance.
:param count:
:param instances: A list of instances.
:type instances: list
"""
if not instances:
return
if count > 0:
instances = self._scale_... | [
"def",
"terminate",
"(",
"self",
",",
"instances",
",",
"count",
"=",
"0",
")",
":",
"if",
"not",
"instances",
":",
"return",
"if",
"count",
">",
"0",
":",
"instances",
"=",
"self",
".",
"_scale_down",
"(",
"instances",
",",
"count",
")",
"self",
"."... | Terminate each provided running or stopped instance.
:param count:
:param instances: A list of instances.
:type instances: list | [
"Terminate",
"each",
"provided",
"running",
"or",
"stopped",
"instance",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/ec2/manager.py#L372-L383 |
MozillaSecurity/laniakea | laniakea/core/providers/ec2/manager.py | EC2Manager.find | def find(self, instance_ids=None, filters=None):
"""Flatten list of reservations to a list of instances.
:param instance_ids: A list of instance ids to filter by
:type instance_ids: list
:param filters: A dict of Filter.N values defined in http://goo.gl/jYNej9
:type filters: dic... | python | def find(self, instance_ids=None, filters=None):
"""Flatten list of reservations to a list of instances.
:param instance_ids: A list of instance ids to filter by
:type instance_ids: list
:param filters: A dict of Filter.N values defined in http://goo.gl/jYNej9
:type filters: dic... | [
"def",
"find",
"(",
"self",
",",
"instance_ids",
"=",
"None",
",",
"filters",
"=",
"None",
")",
":",
"instances",
"=",
"[",
"]",
"reservations",
"=",
"self",
".",
"retry_on_ec2_error",
"(",
"self",
".",
"ec2",
".",
"get_all_instances",
",",
"instance_ids",... | Flatten list of reservations to a list of instances.
:param instance_ids: A list of instance ids to filter by
:type instance_ids: list
:param filters: A dict of Filter.N values defined in http://goo.gl/jYNej9
:type filters: dict
:return: A flattened list of filtered instances.
... | [
"Flatten",
"list",
"of",
"reservations",
"to",
"a",
"list",
"of",
"instances",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/ec2/manager.py#L385-L399 |
MozillaSecurity/laniakea | laniakea/core/common.py | ModuleLoader.load | def load(self, root, module_path, pkg_name):
"""Load modules dynamically.
"""
root = os.path.join(root, module_path)
import_name = os.path.join(pkg_name, module_path).replace(os.sep, '.')
for (_, name, _) in pkgutil.iter_modules([root]):
self.modules[name] = import_mo... | python | def load(self, root, module_path, pkg_name):
"""Load modules dynamically.
"""
root = os.path.join(root, module_path)
import_name = os.path.join(pkg_name, module_path).replace(os.sep, '.')
for (_, name, _) in pkgutil.iter_modules([root]):
self.modules[name] = import_mo... | [
"def",
"load",
"(",
"self",
",",
"root",
",",
"module_path",
",",
"pkg_name",
")",
":",
"root",
"=",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"module_path",
")",
"import_name",
"=",
"os",
".",
"path",
".",
"join",
"(",
"pkg_name",
",",
"mo... | Load modules dynamically. | [
"Load",
"modules",
"dynamically",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/common.py#L155-L162 |
MozillaSecurity/laniakea | laniakea/core/common.py | ModuleLoader.command_line_interfaces | def command_line_interfaces(self):
"""Return the CommandLine classes from each provider.
"""
interfaces = []
for _, module in self.modules.items():
for entry in dir(module):
if entry.endswith('CommandLine'):
interfaces.append((module, entry... | python | def command_line_interfaces(self):
"""Return the CommandLine classes from each provider.
"""
interfaces = []
for _, module in self.modules.items():
for entry in dir(module):
if entry.endswith('CommandLine'):
interfaces.append((module, entry... | [
"def",
"command_line_interfaces",
"(",
"self",
")",
":",
"interfaces",
"=",
"[",
"]",
"for",
"_",
",",
"module",
"in",
"self",
".",
"modules",
".",
"items",
"(",
")",
":",
"for",
"entry",
"in",
"dir",
"(",
"module",
")",
":",
"if",
"entry",
".",
"e... | Return the CommandLine classes from each provider. | [
"Return",
"the",
"CommandLine",
"classes",
"from",
"each",
"provider",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/common.py#L164-L172 |
MozillaSecurity/laniakea | laniakea/core/common.py | Common.pluralize | def pluralize(item):
"""Nothing to see here.
"""
assert isinstance(item, (int, list))
if isinstance(item, int):
return 's' if item > 1 else ''
if isinstance(item, list):
return 's' if len(item) > 1 else ''
return '' | python | def pluralize(item):
"""Nothing to see here.
"""
assert isinstance(item, (int, list))
if isinstance(item, int):
return 's' if item > 1 else ''
if isinstance(item, list):
return 's' if len(item) > 1 else ''
return '' | [
"def",
"pluralize",
"(",
"item",
")",
":",
"assert",
"isinstance",
"(",
"item",
",",
"(",
"int",
",",
"list",
")",
")",
"if",
"isinstance",
"(",
"item",
",",
"int",
")",
":",
"return",
"'s'",
"if",
"item",
">",
"1",
"else",
"''",
"if",
"isinstance"... | Nothing to see here. | [
"Nothing",
"to",
"see",
"here",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/common.py#L190-L198 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketConfiguration.validate | def validate(self):
"""Perform some basic configuration validation.
"""
if not self.conf.get('auth_token'):
raise PacketManagerException('The auth token for Packet is not defined but required.')
if not self.conf.get('projects'):
raise PacketManagerException('Requi... | python | def validate(self):
"""Perform some basic configuration validation.
"""
if not self.conf.get('auth_token'):
raise PacketManagerException('The auth token for Packet is not defined but required.')
if not self.conf.get('projects'):
raise PacketManagerException('Requi... | [
"def",
"validate",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"conf",
".",
"get",
"(",
"'auth_token'",
")",
":",
"raise",
"PacketManagerException",
"(",
"'The auth token for Packet is not defined but required.'",
")",
"if",
"not",
"self",
".",
"conf",
".",... | Perform some basic configuration validation. | [
"Perform",
"some",
"basic",
"configuration",
"validation",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L31-L49 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketManager.print_projects | def print_projects(self, projects):
"""Print method for projects.
"""
for project in projects:
print('{}: {}'.format(project.name, project.id)) | python | def print_projects(self, projects):
"""Print method for projects.
"""
for project in projects:
print('{}: {}'.format(project.name, project.id)) | [
"def",
"print_projects",
"(",
"self",
",",
"projects",
")",
":",
"for",
"project",
"in",
"projects",
":",
"print",
"(",
"'{}: {}'",
".",
"format",
"(",
"project",
".",
"name",
",",
"project",
".",
"id",
")",
")"
] | Print method for projects. | [
"Print",
"method",
"for",
"projects",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L76-L80 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketManager.print_operating_systems | def print_operating_systems(self, operating_systems):
"""Print method for operating systems.
"""
for _os in operating_systems:
print('{}: {}'.format(_os.name, _os.slug)) | python | def print_operating_systems(self, operating_systems):
"""Print method for operating systems.
"""
for _os in operating_systems:
print('{}: {}'.format(_os.name, _os.slug)) | [
"def",
"print_operating_systems",
"(",
"self",
",",
"operating_systems",
")",
":",
"for",
"_os",
"in",
"operating_systems",
":",
"print",
"(",
"'{}: {}'",
".",
"format",
"(",
"_os",
".",
"name",
",",
"_os",
".",
"slug",
")",
")"
] | Print method for operating systems. | [
"Print",
"method",
"for",
"operating",
"systems",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L89-L93 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketManager.print_plans | def print_plans(self, plans):
"""Print method for plans.
"""
for plan in plans:
print('Name: {} "{}" Price: {} USD'.format(plan.name, plan.slug, plan.pricing['hour']))
self.pprint(plan.specs)
print('\n') | python | def print_plans(self, plans):
"""Print method for plans.
"""
for plan in plans:
print('Name: {} "{}" Price: {} USD'.format(plan.name, plan.slug, plan.pricing['hour']))
self.pprint(plan.specs)
print('\n') | [
"def",
"print_plans",
"(",
"self",
",",
"plans",
")",
":",
"for",
"plan",
"in",
"plans",
":",
"print",
"(",
"'Name: {} \"{}\" Price: {} USD'",
".",
"format",
"(",
"plan",
".",
"name",
",",
"plan",
".",
"slug",
",",
"plan",
".",
"pricing",
"[",
"'hour'",
... | Print method for plans. | [
"Print",
"method",
"for",
"plans",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L102-L108 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketManager.print_facilities | def print_facilities(self, facilities):
"""Print method for facilities.
"""
for facility in facilities:
print('{} - ({}): {}'.format(facility.code, facility.name, ",".join(facility.features))) | python | def print_facilities(self, facilities):
"""Print method for facilities.
"""
for facility in facilities:
print('{} - ({}): {}'.format(facility.code, facility.name, ",".join(facility.features))) | [
"def",
"print_facilities",
"(",
"self",
",",
"facilities",
")",
":",
"for",
"facility",
"in",
"facilities",
":",
"print",
"(",
"'{} - ({}): {}'",
".",
"format",
"(",
"facility",
".",
"code",
",",
"facility",
".",
"name",
",",
"\",\"",
".",
"join",
"(",
"... | Print method for facilities. | [
"Print",
"method",
"for",
"facilities",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L117-L121 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketManager.list_devices | def list_devices(self, project_id, conditions=None, params=None):
"""Retrieve list of devices in a project by one of more conditions.
"""
default_params = {'per_page': 1000}
if params:
default_params.update(params)
data = self.api('projects/%s/devices' % project_id, p... | python | def list_devices(self, project_id, conditions=None, params=None):
"""Retrieve list of devices in a project by one of more conditions.
"""
default_params = {'per_page': 1000}
if params:
default_params.update(params)
data = self.api('projects/%s/devices' % project_id, p... | [
"def",
"list_devices",
"(",
"self",
",",
"project_id",
",",
"conditions",
"=",
"None",
",",
"params",
"=",
"None",
")",
":",
"default_params",
"=",
"{",
"'per_page'",
":",
"1000",
"}",
"if",
"params",
":",
"default_params",
".",
"update",
"(",
"params",
... | Retrieve list of devices in a project by one of more conditions. | [
"Retrieve",
"list",
"of",
"devices",
"in",
"a",
"project",
"by",
"one",
"of",
"more",
"conditions",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L134-L144 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketManager.print_devices | def print_devices(self, devices):
"""Print method for devices.
"""
for device in devices:
print('ID: {} OS: {} IP: {} State: {} ({}) Tags: {}'
.format(device.id,
device.operating_system.slug,
self.get_public_ip(dev... | python | def print_devices(self, devices):
"""Print method for devices.
"""
for device in devices:
print('ID: {} OS: {} IP: {} State: {} ({}) Tags: {}'
.format(device.id,
device.operating_system.slug,
self.get_public_ip(dev... | [
"def",
"print_devices",
"(",
"self",
",",
"devices",
")",
":",
"for",
"device",
"in",
"devices",
":",
"print",
"(",
"'ID: {} OS: {} IP: {} State: {} ({}) Tags: {}'",
".",
"format",
"(",
"device",
".",
"id",
",",
"device",
".",
"operating_system",
".",
"slug",
... | Print method for devices. | [
"Print",
"method",
"for",
"devices",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L146-L156 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketManager.filter | def filter(criterias, devices): # pylint: disable=too-many-branches
"""Filter a device by criterias on the root level of the dictionary.
"""
if not criterias:
return devices
result = []
for device in devices: # pylint: disable=too-many-nested-blocks
for ... | python | def filter(criterias, devices): # pylint: disable=too-many-branches
"""Filter a device by criterias on the root level of the dictionary.
"""
if not criterias:
return devices
result = []
for device in devices: # pylint: disable=too-many-nested-blocks
for ... | [
"def",
"filter",
"(",
"criterias",
",",
"devices",
")",
":",
"# pylint: disable=too-many-branches",
"if",
"not",
"criterias",
":",
"return",
"devices",
"result",
"=",
"[",
"]",
"for",
"device",
"in",
"devices",
":",
"# pylint: disable=too-many-nested-blocks",
"for",... | Filter a device by criterias on the root level of the dictionary. | [
"Filter",
"a",
"device",
"by",
"criterias",
"on",
"the",
"root",
"level",
"of",
"the",
"dictionary",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L159-L183 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketManager.get_public_ip | def get_public_ip(addresses, version=4):
"""Return either the devices public IPv4 or IPv6 address.
"""
for addr in addresses:
if addr['public'] and addr['address_family'] == version:
return addr.get('address')
return None | python | def get_public_ip(addresses, version=4):
"""Return either the devices public IPv4 or IPv6 address.
"""
for addr in addresses:
if addr['public'] and addr['address_family'] == version:
return addr.get('address')
return None | [
"def",
"get_public_ip",
"(",
"addresses",
",",
"version",
"=",
"4",
")",
":",
"for",
"addr",
"in",
"addresses",
":",
"if",
"addr",
"[",
"'public'",
"]",
"and",
"addr",
"[",
"'address_family'",
"]",
"==",
"version",
":",
"return",
"addr",
".",
"get",
"(... | Return either the devices public IPv4 or IPv6 address. | [
"Return",
"either",
"the",
"devices",
"public",
"IPv4",
"or",
"IPv6",
"address",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L192-L198 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketManager.validate_capacity | def validate_capacity(self, servers):
"""Validates if a deploy can be fulfilled.
"""
try:
return self.manager.validate_capacity(servers)
except packet.baseapi.Error as msg:
raise PacketManagerException(msg) | python | def validate_capacity(self, servers):
"""Validates if a deploy can be fulfilled.
"""
try:
return self.manager.validate_capacity(servers)
except packet.baseapi.Error as msg:
raise PacketManagerException(msg) | [
"def",
"validate_capacity",
"(",
"self",
",",
"servers",
")",
":",
"try",
":",
"return",
"self",
".",
"manager",
".",
"validate_capacity",
"(",
"servers",
")",
"except",
"packet",
".",
"baseapi",
".",
"Error",
"as",
"msg",
":",
"raise",
"PacketManagerExcepti... | Validates if a deploy can be fulfilled. | [
"Validates",
"if",
"a",
"deploy",
"can",
"be",
"fulfilled",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L200-L206 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketManager.create_volume | def create_volume(self, project_id, plan, size, facility, label=""):
"""Creates a new volume.
"""
try:
return self.manager.create_volume(project_id, label, plan, size, facility)
except packet.baseapi.Error as msg:
raise PacketManagerException(msg) | python | def create_volume(self, project_id, plan, size, facility, label=""):
"""Creates a new volume.
"""
try:
return self.manager.create_volume(project_id, label, plan, size, facility)
except packet.baseapi.Error as msg:
raise PacketManagerException(msg) | [
"def",
"create_volume",
"(",
"self",
",",
"project_id",
",",
"plan",
",",
"size",
",",
"facility",
",",
"label",
"=",
"\"\"",
")",
":",
"try",
":",
"return",
"self",
".",
"manager",
".",
"create_volume",
"(",
"project_id",
",",
"label",
",",
"plan",
",... | Creates a new volume. | [
"Creates",
"a",
"new",
"volume",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L208-L214 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketManager.attach_volume_to_device | def attach_volume_to_device(self, volume_id, device_id):
"""Attaches the created Volume to a Device.
"""
try:
volume = self.manager.get_volume(volume_id)
volume.attach(device_id)
except packet.baseapi.Error as msg:
raise PacketManagerException(msg)
... | python | def attach_volume_to_device(self, volume_id, device_id):
"""Attaches the created Volume to a Device.
"""
try:
volume = self.manager.get_volume(volume_id)
volume.attach(device_id)
except packet.baseapi.Error as msg:
raise PacketManagerException(msg)
... | [
"def",
"attach_volume_to_device",
"(",
"self",
",",
"volume_id",
",",
"device_id",
")",
":",
"try",
":",
"volume",
"=",
"self",
".",
"manager",
".",
"get_volume",
"(",
"volume_id",
")",
"volume",
".",
"attach",
"(",
"device_id",
")",
"except",
"packet",
".... | Attaches the created Volume to a Device. | [
"Attaches",
"the",
"created",
"Volume",
"to",
"a",
"Device",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L216-L224 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketManager.create_demand | def create_demand(self,
project_id,
facility,
plan,
operating_system,
tags=None,
userdata='',
hostname=None,
count=1):
"""Create a new o... | python | def create_demand(self,
project_id,
facility,
plan,
operating_system,
tags=None,
userdata='',
hostname=None,
count=1):
"""Create a new o... | [
"def",
"create_demand",
"(",
"self",
",",
"project_id",
",",
"facility",
",",
"plan",
",",
"operating_system",
",",
"tags",
"=",
"None",
",",
"userdata",
"=",
"''",
",",
"hostname",
"=",
"None",
",",
"count",
"=",
"1",
")",
":",
"tags",
"=",
"{",
"}"... | Create a new on demand device under the given project. | [
"Create",
"a",
"new",
"on",
"demand",
"device",
"under",
"the",
"given",
"project",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L226-L260 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketManager.stop | def stop(self, devices):
"""Power-Off one or more running devices.
"""
for device in devices:
self.logger.info('Stopping: %s', device.id)
try:
device.power_off()
except packet.baseapi.Error:
raise PacketManagerException('Unable ... | python | def stop(self, devices):
"""Power-Off one or more running devices.
"""
for device in devices:
self.logger.info('Stopping: %s', device.id)
try:
device.power_off()
except packet.baseapi.Error:
raise PacketManagerException('Unable ... | [
"def",
"stop",
"(",
"self",
",",
"devices",
")",
":",
"for",
"device",
"in",
"devices",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'Stopping: %s'",
",",
"device",
".",
"id",
")",
"try",
":",
"device",
".",
"power_off",
"(",
")",
"except",
"packet... | Power-Off one or more running devices. | [
"Power",
"-",
"Off",
"one",
"or",
"more",
"running",
"devices",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L302-L310 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketManager.reboot | def reboot(self, devices):
"""Reboot one or more devices.
"""
for device in devices:
self.logger.info('Rebooting: %s', device.id)
try:
device.reboot()
except packet.baseapi.Error:
raise PacketManagerException('Unable to reboot i... | python | def reboot(self, devices):
"""Reboot one or more devices.
"""
for device in devices:
self.logger.info('Rebooting: %s', device.id)
try:
device.reboot()
except packet.baseapi.Error:
raise PacketManagerException('Unable to reboot i... | [
"def",
"reboot",
"(",
"self",
",",
"devices",
")",
":",
"for",
"device",
"in",
"devices",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'Rebooting: %s'",
",",
"device",
".",
"id",
")",
"try",
":",
"device",
".",
"reboot",
"(",
")",
"except",
"packet... | Reboot one or more devices. | [
"Reboot",
"one",
"or",
"more",
"devices",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L312-L320 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/manager.py | PacketManager.terminate | def terminate(self, devices):
"""Terminate one or more running or stopped instances.
"""
for device in devices:
self.logger.info('Terminating: %s', device.id)
try:
device.delete()
except packet.baseapi.Error:
raise PacketManager... | python | def terminate(self, devices):
"""Terminate one or more running or stopped instances.
"""
for device in devices:
self.logger.info('Terminating: %s', device.id)
try:
device.delete()
except packet.baseapi.Error:
raise PacketManager... | [
"def",
"terminate",
"(",
"self",
",",
"devices",
")",
":",
"for",
"device",
"in",
"devices",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'Terminating: %s'",
",",
"device",
".",
"id",
")",
"try",
":",
"device",
".",
"delete",
"(",
")",
"except",
"p... | Terminate one or more running or stopped instances. | [
"Terminate",
"one",
"or",
"more",
"running",
"or",
"stopped",
"instances",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L322-L330 |
MozillaSecurity/laniakea | laniakea/__init__.py | LaniakeaCommandLine.parse_args | def parse_args(cls):
"""Main argument parser of Laniakea.
"""
# Initialize configuration and userdata directories.
dirs = appdirs.AppDirs(__title__, 'Mozilla Security')
if not os.path.isdir(dirs.user_config_dir):
shutil.copytree(os.path.join(cls.HOME, 'examples'), dir... | python | def parse_args(cls):
"""Main argument parser of Laniakea.
"""
# Initialize configuration and userdata directories.
dirs = appdirs.AppDirs(__title__, 'Mozilla Security')
if not os.path.isdir(dirs.user_config_dir):
shutil.copytree(os.path.join(cls.HOME, 'examples'), dir... | [
"def",
"parse_args",
"(",
"cls",
")",
":",
"# Initialize configuration and userdata directories.",
"dirs",
"=",
"appdirs",
".",
"AppDirs",
"(",
"__title__",
",",
"'Mozilla Security'",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"dirs",
".",
"user_con... | Main argument parser of Laniakea. | [
"Main",
"argument",
"parser",
"of",
"Laniakea",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/__init__.py#L31-L108 |
MozillaSecurity/laniakea | laniakea/__init__.py | LaniakeaCommandLine.main | def main(cls):
"""Main entry point of Laniakea.
"""
args = cls.parse_args()
if args.focus:
Focus.init()
else:
Focus.disable()
logging.basicConfig(format='[Laniakea] %(asctime)s %(levelname)s: %(message)s',
level=args.v... | python | def main(cls):
"""Main entry point of Laniakea.
"""
args = cls.parse_args()
if args.focus:
Focus.init()
else:
Focus.disable()
logging.basicConfig(format='[Laniakea] %(asctime)s %(levelname)s: %(message)s',
level=args.v... | [
"def",
"main",
"(",
"cls",
")",
":",
"args",
"=",
"cls",
".",
"parse_args",
"(",
")",
"if",
"args",
".",
"focus",
":",
"Focus",
".",
"init",
"(",
")",
"else",
":",
"Focus",
".",
"disable",
"(",
")",
"logging",
".",
"basicConfig",
"(",
"format",
"... | Main entry point of Laniakea. | [
"Main",
"entry",
"point",
"of",
"Laniakea",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/__init__.py#L111-L161 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | Filter.tags | def tags(self, tags=None):
"""Filter by tags.
:param tags: Tags to filter.
:type tags: ``list``
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node`
"""
if tags is None or not tags:
return self
nodes = []
for node in... | python | def tags(self, tags=None):
"""Filter by tags.
:param tags: Tags to filter.
:type tags: ``list``
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node`
"""
if tags is None or not tags:
return self
nodes = []
for node in... | [
"def",
"tags",
"(",
"self",
",",
"tags",
"=",
"None",
")",
":",
"if",
"tags",
"is",
"None",
"or",
"not",
"tags",
":",
"return",
"self",
"nodes",
"=",
"[",
"]",
"for",
"node",
"in",
"self",
".",
"nodes",
":",
"if",
"any",
"(",
"tag",
"in",
"node... | Filter by tags.
:param tags: Tags to filter.
:type tags: ``list``
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node` | [
"Filter",
"by",
"tags",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L31-L47 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | Filter.state | def state(self, states=None):
"""Filter by state.
:param tags: States to filter.
:type tags: ``list``
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node`
"""
if states is None or not states:
return self
nodes = []
f... | python | def state(self, states=None):
"""Filter by state.
:param tags: States to filter.
:type tags: ``list``
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node`
"""
if states is None or not states:
return self
nodes = []
f... | [
"def",
"state",
"(",
"self",
",",
"states",
"=",
"None",
")",
":",
"if",
"states",
"is",
"None",
"or",
"not",
"states",
":",
"return",
"self",
"nodes",
"=",
"[",
"]",
"for",
"node",
"in",
"self",
".",
"nodes",
":",
"if",
"any",
"(",
"state",
".",... | Filter by state.
:param tags: States to filter.
:type tags: ``list``
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node` | [
"Filter",
"by",
"state",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L49-L65 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | Filter.name | def name(self, names=None):
"""Filter by node name.
:param names: Node names to filter.
:type names: ``list``
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node`
"""
if names is None or not names:
return self
nodes = []
... | python | def name(self, names=None):
"""Filter by node name.
:param names: Node names to filter.
:type names: ``list``
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node`
"""
if names is None or not names:
return self
nodes = []
... | [
"def",
"name",
"(",
"self",
",",
"names",
"=",
"None",
")",
":",
"if",
"names",
"is",
"None",
"or",
"not",
"names",
":",
"return",
"self",
"nodes",
"=",
"[",
"]",
"for",
"node",
"in",
"self",
".",
"nodes",
":",
"if",
"any",
"(",
"name",
"==",
"... | Filter by node name.
:param names: Node names to filter.
:type names: ``list``
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node` | [
"Filter",
"by",
"node",
"name",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L67-L83 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | Filter.is_preemptible | def is_preemptible(self):
"""Filter by preemptible scheduling.
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node`
"""
nodes = []
for node in self.nodes:
if Kurz.is_preemtible(node):
nodes.append(node)
return self | python | def is_preemptible(self):
"""Filter by preemptible scheduling.
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node`
"""
nodes = []
for node in self.nodes:
if Kurz.is_preemtible(node):
nodes.append(node)
return self | [
"def",
"is_preemptible",
"(",
"self",
")",
":",
"nodes",
"=",
"[",
"]",
"for",
"node",
"in",
"self",
".",
"nodes",
":",
"if",
"Kurz",
".",
"is_preemtible",
"(",
"node",
")",
":",
"nodes",
".",
"append",
"(",
"node",
")",
"return",
"self"
] | Filter by preemptible scheduling.
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node` | [
"Filter",
"by",
"preemptible",
"scheduling",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L85-L95 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | Filter.expr | def expr(self, callback):
"""Filter by custom expression.
:param callback: Callback for custom expression.
:type name: ``function``
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node`
"""
nodes = []
for node in self.nodes:
... | python | def expr(self, callback):
"""Filter by custom expression.
:param callback: Callback for custom expression.
:type name: ``function``
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node`
"""
nodes = []
for node in self.nodes:
... | [
"def",
"expr",
"(",
"self",
",",
"callback",
")",
":",
"nodes",
"=",
"[",
"]",
"for",
"node",
"in",
"self",
".",
"nodes",
":",
"if",
"callback",
"(",
"node",
")",
":",
"nodes",
".",
"append",
"(",
"node",
")",
"self",
".",
"nodes",
"=",
"nodes",
... | Filter by custom expression.
:param callback: Callback for custom expression.
:type name: ``function``
:return: A list of Node objects.
:rtype: ``list`` of :class:`Node` | [
"Filter",
"by",
"custom",
"expression",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L97-L111 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | ComputeEngineManager.connect | def connect(self, **kwargs):
"""Connect to Google Compute Engine.
"""
try:
self.gce = get_driver(Provider.GCE)(
self.user_id,
self.key,
project=self.project,
**kwargs)
except:
raise ComputeEngineManag... | python | def connect(self, **kwargs):
"""Connect to Google Compute Engine.
"""
try:
self.gce = get_driver(Provider.GCE)(
self.user_id,
self.key,
project=self.project,
**kwargs)
except:
raise ComputeEngineManag... | [
"def",
"connect",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"self",
".",
"gce",
"=",
"get_driver",
"(",
"Provider",
".",
"GCE",
")",
"(",
"self",
".",
"user_id",
",",
"self",
".",
"key",
",",
"project",
"=",
"self",
".",
"projec... | Connect to Google Compute Engine. | [
"Connect",
"to",
"Google",
"Compute",
"Engine",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L160-L170 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | ComputeEngineManager.is_connected | def is_connected(self, attempts=3):
"""Try to reconnect if neccessary.
:param attempts: The amount of tries to reconnect if neccessary.
:type attempts: ``int``
"""
if self.gce is None:
while attempts > 0:
self.logger.info("Attempting to connect .... | python | def is_connected(self, attempts=3):
"""Try to reconnect if neccessary.
:param attempts: The amount of tries to reconnect if neccessary.
:type attempts: ``int``
"""
if self.gce is None:
while attempts > 0:
self.logger.info("Attempting to connect .... | [
"def",
"is_connected",
"(",
"self",
",",
"attempts",
"=",
"3",
")",
":",
"if",
"self",
".",
"gce",
"is",
"None",
":",
"while",
"attempts",
">",
"0",
":",
"self",
".",
"logger",
".",
"info",
"(",
"\"Attempting to connect ...\"",
")",
"try",
":",
"self",... | Try to reconnect if neccessary.
:param attempts: The amount of tries to reconnect if neccessary.
:type attempts: ``int`` | [
"Try",
"to",
"reconnect",
"if",
"neccessary",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L172-L191 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | ComputeEngineManager.create | def create(self, size, number, meta, name=None, image=None, attempts=3):
"""Create container VM nodes. Uses a container declaration which is undocumented.
:param size: The machine type to use.
:type size: ``str`` or :class:`GCENodeSize`
:param number: Amount of nodes to be spawn... | python | def create(self, size, number, meta, name=None, image=None, attempts=3):
"""Create container VM nodes. Uses a container declaration which is undocumented.
:param size: The machine type to use.
:type size: ``str`` or :class:`GCENodeSize`
:param number: Amount of nodes to be spawn... | [
"def",
"create",
"(",
"self",
",",
"size",
",",
"number",
",",
"meta",
",",
"name",
"=",
"None",
",",
"image",
"=",
"None",
",",
"attempts",
"=",
"3",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"Common",
".",
"get_random_hostname",
"("... | Create container VM nodes. Uses a container declaration which is undocumented.
:param size: The machine type to use.
:type size: ``str`` or :class:`GCENodeSize`
:param number: Amount of nodes to be spawned.
:type number: ``int``
:param meta: Metadata dictionary for... | [
"Create",
"container",
"VM",
"nodes",
".",
"Uses",
"a",
"container",
"declaration",
"which",
"is",
"undocumented",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L193-L247 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | ComputeEngineManager.stop | def stop(self, nodes=None):
"""Stop one or many nodes.
:param nodes: Nodes to be stopped.
:type nodes: ``list``
"""
if not self.is_connected():
return None
nodes = nodes or self.nodes
result = []
for node in nodes:
if node.s... | python | def stop(self, nodes=None):
"""Stop one or many nodes.
:param nodes: Nodes to be stopped.
:type nodes: ``list``
"""
if not self.is_connected():
return None
nodes = nodes or self.nodes
result = []
for node in nodes:
if node.s... | [
"def",
"stop",
"(",
"self",
",",
"nodes",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"is_connected",
"(",
")",
":",
"return",
"None",
"nodes",
"=",
"nodes",
"or",
"self",
".",
"nodes",
"result",
"=",
"[",
"]",
"for",
"node",
"in",
"nodes",
... | Stop one or many nodes.
:param nodes: Nodes to be stopped.
:type nodes: ``list`` | [
"Stop",
"one",
"or",
"many",
"nodes",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L249-L272 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | ComputeEngineManager.start | def start(self, nodes=None):
"""Start one or many nodes.
:param nodes: Nodes to be started.
:type nodes: ``list``
"""
if not self.is_connected():
return None
nodes = nodes or self.nodes
result = []
for node in nodes:
if node... | python | def start(self, nodes=None):
"""Start one or many nodes.
:param nodes: Nodes to be started.
:type nodes: ``list``
"""
if not self.is_connected():
return None
nodes = nodes or self.nodes
result = []
for node in nodes:
if node... | [
"def",
"start",
"(",
"self",
",",
"nodes",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"is_connected",
"(",
")",
":",
"return",
"None",
"nodes",
"=",
"nodes",
"or",
"self",
".",
"nodes",
"result",
"=",
"[",
"]",
"for",
"node",
"in",
"nodes",
... | Start one or many nodes.
:param nodes: Nodes to be started.
:type nodes: ``list`` | [
"Start",
"one",
"or",
"many",
"nodes",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L274-L297 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | ComputeEngineManager.reboot | def reboot(self, nodes=None):
"""Reboot one or many nodes.
:param nodes: Nodes to be rebooted.
:type nodes: ``list``
"""
if not self.is_connected():
return None
nodes = nodes or self.nodes
result = []
for node in nodes:
if n... | python | def reboot(self, nodes=None):
"""Reboot one or many nodes.
:param nodes: Nodes to be rebooted.
:type nodes: ``list``
"""
if not self.is_connected():
return None
nodes = nodes or self.nodes
result = []
for node in nodes:
if n... | [
"def",
"reboot",
"(",
"self",
",",
"nodes",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"is_connected",
"(",
")",
":",
"return",
"None",
"nodes",
"=",
"nodes",
"or",
"self",
".",
"nodes",
"result",
"=",
"[",
"]",
"for",
"node",
"in",
"nodes",
... | Reboot one or many nodes.
:param nodes: Nodes to be rebooted.
:type nodes: ``list`` | [
"Reboot",
"one",
"or",
"many",
"nodes",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L299-L322 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | ComputeEngineManager.terminate | def terminate(self, nodes=None):
"""Destroy one or many nodes.
:param nodes: Nodes to be destroyed.
:type nodes: ``list``
:return: List of nodes which failed to terminate.
:rtype: ``list``
"""
if not self.is_connected():
return None
no... | python | def terminate(self, nodes=None):
"""Destroy one or many nodes.
:param nodes: Nodes to be destroyed.
:type nodes: ``list``
:return: List of nodes which failed to terminate.
:rtype: ``list``
"""
if not self.is_connected():
return None
no... | [
"def",
"terminate",
"(",
"self",
",",
"nodes",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"is_connected",
"(",
")",
":",
"return",
"None",
"nodes",
"=",
"nodes",
"or",
"self",
".",
"nodes",
"failed_kill",
"=",
"[",
"]",
"result",
"=",
"self",
... | Destroy one or many nodes.
:param nodes: Nodes to be destroyed.
:type nodes: ``list``
:return: List of nodes which failed to terminate.
:rtype: ``list`` | [
"Destroy",
"one",
"or",
"many",
"nodes",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L324-L349 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | ComputeEngineManager.terminate_with_threads | def terminate_with_threads(self, nodes=None):
"""Destroy one or many nodes threaded.
:param nodes: Nodes to be destroyed.
:type nodes: ``list``
:return: List of nodes which failed to terminate.
:rtype: ``list``
"""
if not self.is_connected():
r... | python | def terminate_with_threads(self, nodes=None):
"""Destroy one or many nodes threaded.
:param nodes: Nodes to be destroyed.
:type nodes: ``list``
:return: List of nodes which failed to terminate.
:rtype: ``list``
"""
if not self.is_connected():
r... | [
"def",
"terminate_with_threads",
"(",
"self",
",",
"nodes",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"is_connected",
"(",
")",
":",
"return",
"None",
"nodes",
"=",
"nodes",
"or",
"self",
".",
"nodes",
"failed_kill",
"=",
"[",
"]",
"def",
"worke... | Destroy one or many nodes threaded.
:param nodes: Nodes to be destroyed.
:type nodes: ``list``
:return: List of nodes which failed to terminate.
:rtype: ``list`` | [
"Destroy",
"one",
"or",
"many",
"nodes",
"threaded",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L351-L382 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | ComputeEngineManager.terminate_ex | def terminate_ex(self, nodes, threads=False, attempts=3):
"""Wrapper method for terminate.
:param nodes: Nodes to be destroyed.
:type nodes: ``list``
:param attempts: The amount of attempts for retrying to terminate failed instances.
:type attempts: ``int``
:... | python | def terminate_ex(self, nodes, threads=False, attempts=3):
"""Wrapper method for terminate.
:param nodes: Nodes to be destroyed.
:type nodes: ``list``
:param attempts: The amount of attempts for retrying to terminate failed instances.
:type attempts: ``int``
:... | [
"def",
"terminate_ex",
"(",
"self",
",",
"nodes",
",",
"threads",
"=",
"False",
",",
"attempts",
"=",
"3",
")",
":",
"while",
"nodes",
"and",
"attempts",
">",
"0",
":",
"if",
"threads",
":",
"nodes",
"=",
"self",
".",
"terminate_with_threads",
"(",
"no... | Wrapper method for terminate.
:param nodes: Nodes to be destroyed.
:type nodes: ``list``
:param attempts: The amount of attempts for retrying to terminate failed instances.
:type attempts: ``int``
:param threads: Whether to use the threaded approach or not.
... | [
"Wrapper",
"method",
"for",
"terminate",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L384-L405 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | ComputeEngineManager.build_bootdisk | def build_bootdisk(self, image, size=10, auto_delete=True):
"""Buid a disk struct.
:param image: Base image name.
:type image: ``str``
:param size: Persistent disk size.
:type size: ``int``
:param auto_delete: Wether to auto delete disk on instance termination.
... | python | def build_bootdisk(self, image, size=10, auto_delete=True):
"""Buid a disk struct.
:param image: Base image name.
:type image: ``str``
:param size: Persistent disk size.
:type size: ``int``
:param auto_delete: Wether to auto delete disk on instance termination.
... | [
"def",
"build_bootdisk",
"(",
"self",
",",
"image",
",",
"size",
"=",
"10",
",",
"auto_delete",
"=",
"True",
")",
":",
"if",
"image",
"is",
"None",
":",
"raise",
"ComputeEngineManagerException",
"(",
"\"Image must not be None.\"",
")",
"return",
"{",
"'boot'",... | Buid a disk struct.
:param image: Base image name.
:type image: ``str``
:param size: Persistent disk size.
:type size: ``int``
:param auto_delete: Wether to auto delete disk on instance termination.
:type auto_delete: ``bool`` | [
"Buid",
"a",
"disk",
"struct",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L407-L428 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | ComputeEngineManager.build_container_vm | def build_container_vm(self, container, disk, zone="us-east1-b", tags=None, preemptible=True):
"""Build kwargs for a container VM.
:param container: Container declaration.
:type container: ``dict``
:param disk: Disk definition structure.
:type disk: ``dict``
... | python | def build_container_vm(self, container, disk, zone="us-east1-b", tags=None, preemptible=True):
"""Build kwargs for a container VM.
:param container: Container declaration.
:type container: ``dict``
:param disk: Disk definition structure.
:type disk: ``dict``
... | [
"def",
"build_container_vm",
"(",
"self",
",",
"container",
",",
"disk",
",",
"zone",
"=",
"\"us-east1-b\"",
",",
"tags",
"=",
"None",
",",
"preemptible",
"=",
"True",
")",
":",
"if",
"tags",
"is",
"None",
":",
"tags",
"=",
"[",
"]",
"if",
"container",... | Build kwargs for a container VM.
:param container: Container declaration.
:type container: ``dict``
:param disk: Disk definition structure.
:type disk: ``dict``
:param zone: The zone in which the instance should run.
:type zone: ``str``
:param ... | [
"Build",
"kwargs",
"for",
"a",
"container",
"VM",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L430-L463 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/manager.py | ComputeEngineManager.filter | def filter(self, zone='all'):
"""Filter nodes by their attributes.
:param zone: A zone containing nodes.
:type zone: ``str``
:return: A chainable filter object.
:rtype: ``object`` of :class:`Filter`
"""
if not self.is_connected():
return None
... | python | def filter(self, zone='all'):
"""Filter nodes by their attributes.
:param zone: A zone containing nodes.
:type zone: ``str``
:return: A chainable filter object.
:rtype: ``object`` of :class:`Filter`
"""
if not self.is_connected():
return None
... | [
"def",
"filter",
"(",
"self",
",",
"zone",
"=",
"'all'",
")",
":",
"if",
"not",
"self",
".",
"is_connected",
"(",
")",
":",
"return",
"None",
"nodes",
"=",
"self",
".",
"gce",
".",
"list_nodes",
"(",
"zone",
")",
"return",
"Filter",
"(",
"nodes",
"... | Filter nodes by their attributes.
:param zone: A zone containing nodes.
:type zone: ``str``
:return: A chainable filter object.
:rtype: ``object`` of :class:`Filter` | [
"Filter",
"nodes",
"by",
"their",
"attributes",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L465-L478 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/__init__.py | PacketCommandLine.add_arguments | def add_arguments(cls, subparsers, dirs):
"""Argument parser of this module.
"""
parser = subparsers.add_parser(
'packet',
help='Packet Bare Metal',
formatter_class=lambda prog: argparse.ArgumentDefaultsHelpFormatter(prog, max_help_position=40, width=120))
... | python | def add_arguments(cls, subparsers, dirs):
"""Argument parser of this module.
"""
parser = subparsers.add_parser(
'packet',
help='Packet Bare Metal',
formatter_class=lambda prog: argparse.ArgumentDefaultsHelpFormatter(prog, max_help_position=40, width=120))
... | [
"def",
"add_arguments",
"(",
"cls",
",",
"subparsers",
",",
"dirs",
")",
":",
"parser",
"=",
"subparsers",
".",
"add_parser",
"(",
"'packet'",
",",
"help",
"=",
"'Packet Bare Metal'",
",",
"formatter_class",
"=",
"lambda",
"prog",
":",
"argparse",
".",
"Argu... | Argument parser of this module. | [
"Argument",
"parser",
"of",
"this",
"module",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/__init__.py#L26-L143 |
MozillaSecurity/laniakea | laniakea/core/providers/packet/__init__.py | PacketCommandLine.main | def main(cls, args, settings=None, userdata=None): # pylint: disable=too-many-branches,too-many-statements
"""Main entry point of this module.
"""
# Packet Configuration
logger.info('Using Packet configuration from %s', Focus.info(args.conf.name))
try:
conf = json.loa... | python | def main(cls, args, settings=None, userdata=None): # pylint: disable=too-many-branches,too-many-statements
"""Main entry point of this module.
"""
# Packet Configuration
logger.info('Using Packet configuration from %s', Focus.info(args.conf.name))
try:
conf = json.loa... | [
"def",
"main",
"(",
"cls",
",",
"args",
",",
"settings",
"=",
"None",
",",
"userdata",
"=",
"None",
")",
":",
"# pylint: disable=too-many-branches,too-many-statements",
"# Packet Configuration",
"logger",
".",
"info",
"(",
"'Using Packet configuration from %s'",
",",
... | Main entry point of this module. | [
"Main",
"entry",
"point",
"of",
"this",
"module",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/__init__.py#L146-L280 |
MozillaSecurity/laniakea | laniakea/core/providers/gce/__init__.py | GceCommandLine.main | def main(cls, args, settings=None, userdata=None): # pylint: disable=too-many-branches,too-many-statements
"""Main entry point of this module.
"""
# The command-line client uses Service Account authentication.
logger.info('Using Compute Engine credentials from %s', Focus.info(args.conf.... | python | def main(cls, args, settings=None, userdata=None): # pylint: disable=too-many-branches,too-many-statements
"""Main entry point of this module.
"""
# The command-line client uses Service Account authentication.
logger.info('Using Compute Engine credentials from %s', Focus.info(args.conf.... | [
"def",
"main",
"(",
"cls",
",",
"args",
",",
"settings",
"=",
"None",
",",
"userdata",
"=",
"None",
")",
":",
"# pylint: disable=too-many-branches,too-many-statements",
"# The command-line client uses Service Account authentication.",
"logger",
".",
"info",
"(",
"'Using C... | Main entry point of this module. | [
"Main",
"entry",
"point",
"of",
"this",
"module",
"."
] | train | https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/__init__.py#L145-L242 |
scivision/pymap3d | pymap3d/haversine.py | anglesep_meeus | def anglesep_meeus(lon0: float, lat0: float,
lon1: float, lat1: float, deg: bool = True) -> float:
"""
Parameters
----------
lon0 : float or numpy.ndarray of float
longitude of first point
lat0 : float or numpy.ndarray of float
latitude of first point
lon1 : f... | python | def anglesep_meeus(lon0: float, lat0: float,
lon1: float, lat1: float, deg: bool = True) -> float:
"""
Parameters
----------
lon0 : float or numpy.ndarray of float
longitude of first point
lat0 : float or numpy.ndarray of float
latitude of first point
lon1 : f... | [
"def",
"anglesep_meeus",
"(",
"lon0",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon1",
":",
"float",
",",
"lat1",
":",
"float",
",",
"deg",
":",
"bool",
"=",
"True",
")",
"->",
"float",
":",
"if",
"deg",
":",
"lon0",
"=",
"radians",
"(",
"lo... | Parameters
----------
lon0 : float or numpy.ndarray of float
longitude of first point
lat0 : float or numpy.ndarray of float
latitude of first point
lon1 : float or numpy.ndarray of float
longitude of second point
lat1 : float or numpy.ndarray of float
latitude of se... | [
"Parameters",
"----------"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/haversine.py#L26-L73 |
scivision/pymap3d | pymap3d/haversine.py | anglesep | def anglesep(lon0: float, lat0: float,
lon1: float, lat1: float, deg: bool = True) -> float:
"""
Parameters
----------
lon0 : float
longitude of first point
lat0 : float
latitude of first point
lon1 : float
longitude of second point
lat1 : float
... | python | def anglesep(lon0: float, lat0: float,
lon1: float, lat1: float, deg: bool = True) -> float:
"""
Parameters
----------
lon0 : float
longitude of first point
lat0 : float
latitude of first point
lon1 : float
longitude of second point
lat1 : float
... | [
"def",
"anglesep",
"(",
"lon0",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon1",
":",
"float",
",",
"lat1",
":",
"float",
",",
"deg",
":",
"bool",
"=",
"True",
")",
"->",
"float",
":",
"if",
"angular_separation",
"is",
"None",
":",
"raise",
"I... | Parameters
----------
lon0 : float
longitude of first point
lat0 : float
latitude of first point
lon1 : float
longitude of second point
lat1 : float
latitude of second point
deg : bool, optional
degrees input/output (False: radians in/out)
Returns... | [
"Parameters",
"----------"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/haversine.py#L76-L116 |
scivision/pymap3d | pymap3d/azelradec.py | azel2radec | def azel2radec(az_deg: float, el_deg: float,
lat_deg: float, lon_deg: float,
time: datetime, usevallado: bool = False) -> Tuple[float, float]:
"""
viewing angle (az, el) to sky coordinates (ra, dec)
Parameters
----------
az_deg : float or numpy.ndarray of float
... | python | def azel2radec(az_deg: float, el_deg: float,
lat_deg: float, lon_deg: float,
time: datetime, usevallado: bool = False) -> Tuple[float, float]:
"""
viewing angle (az, el) to sky coordinates (ra, dec)
Parameters
----------
az_deg : float or numpy.ndarray of float
... | [
"def",
"azel2radec",
"(",
"az_deg",
":",
"float",
",",
"el_deg",
":",
"float",
",",
"lat_deg",
":",
"float",
",",
"lon_deg",
":",
"float",
",",
"time",
":",
"datetime",
",",
"usevallado",
":",
"bool",
"=",
"False",
")",
"->",
"Tuple",
"[",
"float",
"... | viewing angle (az, el) to sky coordinates (ra, dec)
Parameters
----------
az_deg : float or numpy.ndarray of float
azimuth [degrees clockwize from North]
el_deg : float or numpy.ndarray of float
elevation [degrees above horizon (neglecting aberration)]
lat_deg : float
... | [
"viewing",
"angle",
"(",
"az",
"el",
")",
"to",
"sky",
"coordinates",
"(",
"ra",
"dec",
")"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/azelradec.py#L17-L56 |
scivision/pymap3d | pymap3d/azelradec.py | radec2azel | def radec2azel(ra_deg: float, dec_deg: float,
lat_deg: float, lon_deg: float,
time: datetime, usevallado: bool = False) -> Tuple[float, float]:
"""
sky coordinates (ra, dec) to viewing angle (az, el)
Parameters
----------
ra_deg : float or numpy.ndarray of float
... | python | def radec2azel(ra_deg: float, dec_deg: float,
lat_deg: float, lon_deg: float,
time: datetime, usevallado: bool = False) -> Tuple[float, float]:
"""
sky coordinates (ra, dec) to viewing angle (az, el)
Parameters
----------
ra_deg : float or numpy.ndarray of float
... | [
"def",
"radec2azel",
"(",
"ra_deg",
":",
"float",
",",
"dec_deg",
":",
"float",
",",
"lat_deg",
":",
"float",
",",
"lon_deg",
":",
"float",
",",
"time",
":",
"datetime",
",",
"usevallado",
":",
"bool",
"=",
"False",
")",
"->",
"Tuple",
"[",
"float",
... | sky coordinates (ra, dec) to viewing angle (az, el)
Parameters
----------
ra_deg : float or numpy.ndarray of float
ecliptic right ascension (degress)
dec_deg : float or numpy.ndarray of float
ecliptic declination (degrees)
lat_deg : float
observer latitude [-90, 90]
... | [
"sky",
"coordinates",
"(",
"ra",
"dec",
")",
"to",
"viewing",
"angle",
"(",
"az",
"el",
")"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/azelradec.py#L59-L105 |
scivision/pymap3d | pymap3d/los.py | lookAtSpheroid | def lookAtSpheroid(lat0: float, lon0: float, h0: float, az: float, tilt: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
Calculates line-of-sight intersection with Earth (or other ellipsoid) surface from above surface / orbit
Parameters
----------
... | python | def lookAtSpheroid(lat0: float, lon0: float, h0: float, az: float, tilt: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
Calculates line-of-sight intersection with Earth (or other ellipsoid) surface from above surface / orbit
Parameters
----------
... | [
"def",
"lookAtSpheroid",
"(",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"h0",
":",
"float",
",",
"az",
":",
"float",
",",
"tilt",
":",
"float",
",",
"ell",
":",
"Ellipsoid",
"=",
"None",
",",
"deg",
":",
"bool",
"=",
"True",
")",
"->"... | Calculates line-of-sight intersection with Earth (or other ellipsoid) surface from above surface / orbit
Parameters
----------
lat0 : float
observer geodetic latitude
lon0 : float
observer geodetic longitude
h0 : float
observer altitude (meters) Must be non-negative ... | [
"Calculates",
"line",
"-",
"of",
"-",
"sight",
"intersection",
"with",
"Earth",
"(",
"or",
"other",
"ellipsoid",
")",
"surface",
"from",
"above",
"surface",
"/",
"orbit"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/los.py#L11-L83 |
scivision/pymap3d | pymap3d/enu.py | enu2aer | def enu2aer(e: np.ndarray, n: np.ndarray, u: np.ndarray, deg: bool = True) -> Tuple[float, float, float]:
"""
ENU to Azimuth, Elevation, Range
Parameters
----------
e : float or np.ndarray of float
ENU East coordinate (meters)
n : float or np.ndarray of float
ENU North coordina... | python | def enu2aer(e: np.ndarray, n: np.ndarray, u: np.ndarray, deg: bool = True) -> Tuple[float, float, float]:
"""
ENU to Azimuth, Elevation, Range
Parameters
----------
e : float or np.ndarray of float
ENU East coordinate (meters)
n : float or np.ndarray of float
ENU North coordina... | [
"def",
"enu2aer",
"(",
"e",
":",
"np",
".",
"ndarray",
",",
"n",
":",
"np",
".",
"ndarray",
",",
"u",
":",
"np",
".",
"ndarray",
",",
"deg",
":",
"bool",
"=",
"True",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"float",
"]",
":",
"# ... | ENU to Azimuth, Elevation, Range
Parameters
----------
e : float or np.ndarray of float
ENU East coordinate (meters)
n : float or np.ndarray of float
ENU North coordinate (meters)
u : float or np.ndarray of float
ENU Up coordinate (meters)
deg : bool, optional
d... | [
"ENU",
"to",
"Azimuth",
"Elevation",
"Range"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/enu.py#L16-L62 |
scivision/pymap3d | pymap3d/enu.py | aer2enu | def aer2enu(az: float, el: float, srange: float, deg: bool = True) -> Tuple[float, float, float]:
"""
Azimuth, Elevation, Slant range to target to East, north, Up
Parameters
----------
azimuth : float or np.ndarray of float
azimuth clockwise from north (degrees)
elevation : float or... | python | def aer2enu(az: float, el: float, srange: float, deg: bool = True) -> Tuple[float, float, float]:
"""
Azimuth, Elevation, Slant range to target to East, north, Up
Parameters
----------
azimuth : float or np.ndarray of float
azimuth clockwise from north (degrees)
elevation : float or... | [
"def",
"aer2enu",
"(",
"az",
":",
"float",
",",
"el",
":",
"float",
",",
"srange",
":",
"float",
",",
"deg",
":",
"bool",
"=",
"True",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"float",
"]",
":",
"if",
"deg",
":",
"el",
"=",
"radians... | Azimuth, Elevation, Slant range to target to East, north, Up
Parameters
----------
azimuth : float or np.ndarray of float
azimuth clockwise from north (degrees)
elevation : float or np.ndarray of float
elevation angle above horizon, neglecting aberattions (degrees)
srange : floa... | [
"Azimuth",
"Elevation",
"Slant",
"range",
"to",
"target",
"to",
"East",
"north",
"Up"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/enu.py#L65-L99 |
scivision/pymap3d | pymap3d/enu.py | enu2geodetic | def enu2geodetic(e: float, n: float, u: float,
lat0: float, lon0: float, h0: float,
ell=None, deg: bool = True) -> Tuple[float, float, float]:
"""
East, North, Up to target to geodetic coordinates
Parameters
----------
e : float or np.ndarray of float
East ... | python | def enu2geodetic(e: float, n: float, u: float,
lat0: float, lon0: float, h0: float,
ell=None, deg: bool = True) -> Tuple[float, float, float]:
"""
East, North, Up to target to geodetic coordinates
Parameters
----------
e : float or np.ndarray of float
East ... | [
"def",
"enu2geodetic",
"(",
"e",
":",
"float",
",",
"n",
":",
"float",
",",
"u",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"h0",
":",
"float",
",",
"ell",
"=",
"None",
",",
"deg",
":",
"bool",
"=",
"True",
")",
... | East, North, Up to target to geodetic coordinates
Parameters
----------
e : float or np.ndarray of float
East ENU coordinate (meters)
n : float or np.ndarray of float
North ENU coordinate (meters)
u : float or np.ndarray of float
Up ENU coordinate (meters)
lat0 : float
... | [
"East",
"North",
"Up",
"to",
"target",
"to",
"geodetic",
"coordinates"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/enu.py#L102-L140 |
scivision/pymap3d | pymap3d/enu.py | geodetic2enu | def geodetic2enu(lat: float, lon: float, h: float,
lat0: float, lon0: float, h0: float,
ell=None, deg: bool = True) -> Tuple[float, float, float]:
"""
Parameters
----------
lat : float or np.ndarray of float
target geodetic latitude
lon : float or np.ndarr... | python | def geodetic2enu(lat: float, lon: float, h: float,
lat0: float, lon0: float, h0: float,
ell=None, deg: bool = True) -> Tuple[float, float, float]:
"""
Parameters
----------
lat : float or np.ndarray of float
target geodetic latitude
lon : float or np.ndarr... | [
"def",
"geodetic2enu",
"(",
"lat",
":",
"float",
",",
"lon",
":",
"float",
",",
"h",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"h0",
":",
"float",
",",
"ell",
"=",
"None",
",",
"deg",
":",
"bool",
"=",
"True",
")"... | Parameters
----------
lat : float or np.ndarray of float
target geodetic latitude
lon : float or np.ndarray of float
target geodetic longitude
h : float or np.ndarray of float
target altitude above ellipsoid (meters)
lat0 : float
Observer geodetic latitude
... | [
"Parameters",
"----------",
"lat",
":",
"float",
"or",
"np",
".",
"ndarray",
"of",
"float",
"target",
"geodetic",
"latitude",
"lon",
":",
"float",
"or",
"np",
".",
"ndarray",
"of",
"float",
"target",
"geodetic",
"longitude",
"h",
":",
"float",
"or",
"np",
... | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/enu.py#L143-L182 |
scivision/pymap3d | pymap3d/vincenty.py | vdist | def vdist(Lat1: float, Lon1: float, Lat2: float, Lon2: float, ell: Ellipsoid = None) -> Tuple[float, float, float]:
"""
Using the reference ellipsoid, compute the distance between two points
within a few millimeters of accuracy, compute forward azimuth,
and compute backward azimuth, all using a vectoriz... | python | def vdist(Lat1: float, Lon1: float, Lat2: float, Lon2: float, ell: Ellipsoid = None) -> Tuple[float, float, float]:
"""
Using the reference ellipsoid, compute the distance between two points
within a few millimeters of accuracy, compute forward azimuth,
and compute backward azimuth, all using a vectoriz... | [
"def",
"vdist",
"(",
"Lat1",
":",
"float",
",",
"Lon1",
":",
"float",
",",
"Lat2",
":",
"float",
",",
"Lon2",
":",
"float",
",",
"ell",
":",
"Ellipsoid",
"=",
"None",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"float",
"]",
":",
"if",
... | Using the reference ellipsoid, compute the distance between two points
within a few millimeters of accuracy, compute forward azimuth,
and compute backward azimuth, all using a vectorized version of
Vincenty's algorithm:
```python
s,a12,a21 = vdist(lat1, lon1, lat2, lon2, ell)
```
Parameter... | [
"Using",
"the",
"reference",
"ellipsoid",
"compute",
"the",
"distance",
"between",
"two",
"points",
"within",
"a",
"few",
"millimeters",
"of",
"accuracy",
"compute",
"forward",
"azimuth",
"and",
"compute",
"backward",
"azimuth",
"all",
"using",
"a",
"vectorized",
... | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/vincenty.py#L14-L236 |
scivision/pymap3d | pymap3d/vincenty.py | vreckon | def vreckon(Lat1: float, Lon1: float, Rng: float, Azim: float,
ell: Ellipsoid = None) -> Tuple[float, float, float]:
"""
This is the Vincenty "forward" solution.
Computes points at a specified azimuth and range in an ellipsoidal earth.
Using the reference ellipsoid, travel a given distance ... | python | def vreckon(Lat1: float, Lon1: float, Rng: float, Azim: float,
ell: Ellipsoid = None) -> Tuple[float, float, float]:
"""
This is the Vincenty "forward" solution.
Computes points at a specified azimuth and range in an ellipsoidal earth.
Using the reference ellipsoid, travel a given distance ... | [
"def",
"vreckon",
"(",
"Lat1",
":",
"float",
",",
"Lon1",
":",
"float",
",",
"Rng",
":",
"float",
",",
"Azim",
":",
"float",
",",
"ell",
":",
"Ellipsoid",
"=",
"None",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"float",
"]",
":",
"lat1"... | This is the Vincenty "forward" solution.
Computes points at a specified azimuth and range in an ellipsoidal earth.
Using the reference ellipsoid, travel a given distance along a given azimuth starting at a given initial point,
and return the endpoint within a few millimeters of accuracy, using Vincenty's a... | [
"This",
"is",
"the",
"Vincenty",
"forward",
"solution",
"."
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/vincenty.py#L239-L413 |
scivision/pymap3d | pymap3d/vincenty.py | track2 | def track2(lat1: float, lon1: float, lat2: float, lon2: float,
ell: Ellipsoid = None, npts: int = 100, deg: bool = True):
"""
computes great circle tracks starting at the point lat1, lon1 and ending at lat2, lon2
Parameters
----------
Lat1 : float or numpy.ndarray of float
Geode... | python | def track2(lat1: float, lon1: float, lat2: float, lon2: float,
ell: Ellipsoid = None, npts: int = 100, deg: bool = True):
"""
computes great circle tracks starting at the point lat1, lon1 and ending at lat2, lon2
Parameters
----------
Lat1 : float or numpy.ndarray of float
Geode... | [
"def",
"track2",
"(",
"lat1",
":",
"float",
",",
"lon1",
":",
"float",
",",
"lat2",
":",
"float",
",",
"lon2",
":",
"float",
",",
"ell",
":",
"Ellipsoid",
"=",
"None",
",",
"npts",
":",
"int",
"=",
"100",
",",
"deg",
":",
"bool",
"=",
"True",
"... | computes great circle tracks starting at the point lat1, lon1 and ending at lat2, lon2
Parameters
----------
Lat1 : float or numpy.ndarray of float
Geodetic latitude of first point (degrees)
Lon1 : float or numpy.ndarray of float
Geodetic longitude of first point (degrees)
Lat2 : f... | [
"computes",
"great",
"circle",
"tracks",
"starting",
"at",
"the",
"point",
"lat1",
"lon1",
"and",
"ending",
"at",
"lat2",
"lon2"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/vincenty.py#L416-L491 |
scivision/pymap3d | pymap3d/sidereal.py | datetime2sidereal | def datetime2sidereal(time: datetime,
lon_radians: float,
usevallado: bool = True) -> float:
"""
Convert ``datetime`` to sidereal time
from D. Vallado "Fundamentals of Astrodynamics and Applications"
time : datetime.datetime
time to convert
lon_... | python | def datetime2sidereal(time: datetime,
lon_radians: float,
usevallado: bool = True) -> float:
"""
Convert ``datetime`` to sidereal time
from D. Vallado "Fundamentals of Astrodynamics and Applications"
time : datetime.datetime
time to convert
lon_... | [
"def",
"datetime2sidereal",
"(",
"time",
":",
"datetime",
",",
"lon_radians",
":",
"float",
",",
"usevallado",
":",
"bool",
"=",
"True",
")",
"->",
"float",
":",
"usevallado",
"=",
"usevallado",
"or",
"Time",
"is",
"None",
"if",
"usevallado",
":",
"jd",
... | Convert ``datetime`` to sidereal time
from D. Vallado "Fundamentals of Astrodynamics and Applications"
time : datetime.datetime
time to convert
lon_radians : float
longitude (radians)
usevallado : bool, optional
use vallado instead of AstroPy (default is Vallado)
Results
... | [
"Convert",
"datetime",
"to",
"sidereal",
"time"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/sidereal.py#L22-L55 |
scivision/pymap3d | pymap3d/sidereal.py | juliandate | def juliandate(time: datetime) -> float:
"""
Python datetime to Julian time
from D.Vallado Fundamentals of Astrodynamics and Applications p.187
and J. Meeus Astronomical Algorithms 1991 Eqn. 7.1 pg. 61
Parameters
----------
time : datetime.datetime
time to convert
Results
... | python | def juliandate(time: datetime) -> float:
"""
Python datetime to Julian time
from D.Vallado Fundamentals of Astrodynamics and Applications p.187
and J. Meeus Astronomical Algorithms 1991 Eqn. 7.1 pg. 61
Parameters
----------
time : datetime.datetime
time to convert
Results
... | [
"def",
"juliandate",
"(",
"time",
":",
"datetime",
")",
"->",
"float",
":",
"times",
"=",
"np",
".",
"atleast_1d",
"(",
"time",
")",
"assert",
"times",
".",
"ndim",
"==",
"1",
"jd",
"=",
"np",
".",
"empty",
"(",
"times",
".",
"size",
")",
"for",
... | Python datetime to Julian time
from D.Vallado Fundamentals of Astrodynamics and Applications p.187
and J. Meeus Astronomical Algorithms 1991 Eqn. 7.1 pg. 61
Parameters
----------
time : datetime.datetime
time to convert
Results
-------
jd : float
Julian date | [
"Python",
"datetime",
"to",
"Julian",
"time"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/sidereal.py#L58-L97 |
scivision/pymap3d | pymap3d/sidereal.py | julian2sidereal | def julian2sidereal(Jdate: float) -> float:
"""
Convert Julian time to sidereal time
D. Vallado Ed. 4
Parameters
----------
Jdate: float
Julian centuries from J2000.0
Results
-------
tsr : float
Sidereal time
"""
jdate = np.atleast_1d(Jdate)
assert ... | python | def julian2sidereal(Jdate: float) -> float:
"""
Convert Julian time to sidereal time
D. Vallado Ed. 4
Parameters
----------
Jdate: float
Julian centuries from J2000.0
Results
-------
tsr : float
Sidereal time
"""
jdate = np.atleast_1d(Jdate)
assert ... | [
"def",
"julian2sidereal",
"(",
"Jdate",
":",
"float",
")",
"->",
"float",
":",
"jdate",
"=",
"np",
".",
"atleast_1d",
"(",
"Jdate",
")",
"assert",
"jdate",
".",
"ndim",
"==",
"1",
"tsr",
"=",
"np",
".",
"empty",
"(",
"jdate",
".",
"size",
")",
"for... | Convert Julian time to sidereal time
D. Vallado Ed. 4
Parameters
----------
Jdate: float
Julian centuries from J2000.0
Results
-------
tsr : float
Sidereal time | [
"Convert",
"Julian",
"time",
"to",
"sidereal",
"time"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/sidereal.py#L100-L135 |
scivision/pymap3d | pymap3d/ecef.py | get_radius_normal | def get_radius_normal(lat_radians: float, ell: Ellipsoid = None) -> float:
"""
Compute normal radius of planetary body
Parameters
----------
lat_radians : float
latitude in radians
ell : Ellipsoid, optional
reference ellipsoid
Returns
-------
radius : float
... | python | def get_radius_normal(lat_radians: float, ell: Ellipsoid = None) -> float:
"""
Compute normal radius of planetary body
Parameters
----------
lat_radians : float
latitude in radians
ell : Ellipsoid, optional
reference ellipsoid
Returns
-------
radius : float
... | [
"def",
"get_radius_normal",
"(",
"lat_radians",
":",
"float",
",",
"ell",
":",
"Ellipsoid",
"=",
"None",
")",
"->",
"float",
":",
"if",
"ell",
"is",
"None",
":",
"ell",
"=",
"Ellipsoid",
"(",
")",
"a",
"=",
"ell",
".",
"a",
"b",
"=",
"ell",
".",
... | Compute normal radius of planetary body
Parameters
----------
lat_radians : float
latitude in radians
ell : Ellipsoid, optional
reference ellipsoid
Returns
-------
radius : float
normal radius (meters) | [
"Compute",
"normal",
"radius",
"of",
"planetary",
"body"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ecef.py#L70-L94 |
scivision/pymap3d | pymap3d/ecef.py | geodetic2ecef | def geodetic2ecef(lat: float, lon: float, alt: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
point transformation from Geodetic of specified ellipsoid (default WGS-84) to ECEF
Parameters
----------
lat : float or numpy.ndarray of float
... | python | def geodetic2ecef(lat: float, lon: float, alt: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
point transformation from Geodetic of specified ellipsoid (default WGS-84) to ECEF
Parameters
----------
lat : float or numpy.ndarray of float
... | [
"def",
"geodetic2ecef",
"(",
"lat",
":",
"float",
",",
"lon",
":",
"float",
",",
"alt",
":",
"float",
",",
"ell",
":",
"Ellipsoid",
"=",
"None",
",",
"deg",
":",
"bool",
"=",
"True",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"float",
"... | point transformation from Geodetic of specified ellipsoid (default WGS-84) to ECEF
Parameters
----------
lat : float or numpy.ndarray of float
target geodetic latitude
lon : float or numpy.ndarray of float
target geodetic longitude
h : float or numpy.ndarray of float
... | [
"point",
"transformation",
"from",
"Geodetic",
"of",
"specified",
"ellipsoid",
"(",
"default",
"WGS",
"-",
"84",
")",
"to",
"ECEF"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ecef.py#L97-L149 |
scivision/pymap3d | pymap3d/ecef.py | ecef2geodetic | def ecef2geodetic(x: float, y: float, z: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
convert ECEF (meters) to geodetic coordinates
Parameters
----------
x : float or numpy.ndarray of float
target x ECEF coordinate (meters)
y : flo... | python | def ecef2geodetic(x: float, y: float, z: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
convert ECEF (meters) to geodetic coordinates
Parameters
----------
x : float or numpy.ndarray of float
target x ECEF coordinate (meters)
y : flo... | [
"def",
"ecef2geodetic",
"(",
"x",
":",
"float",
",",
"y",
":",
"float",
",",
"z",
":",
"float",
",",
"ell",
":",
"Ellipsoid",
"=",
"None",
",",
"deg",
":",
"bool",
"=",
"True",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"float",
"]",
... | convert ECEF (meters) to geodetic coordinates
Parameters
----------
x : float or numpy.ndarray of float
target x ECEF coordinate (meters)
y : float or numpy.ndarray of float
target y ECEF coordinate (meters)
z : float or numpy.ndarray of float
target z ECEF coordinate (meter... | [
"convert",
"ECEF",
"(",
"meters",
")",
"to",
"geodetic",
"coordinates"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ecef.py#L152-L230 |
scivision/pymap3d | pymap3d/ecef.py | ecef2enuv | def ecef2enuv(u: float, v: float, w: float,
lat0: float, lon0: float, deg: bool = True) -> Tuple[float, float, float]:
"""
VECTOR from observer to target ECEF => ENU
Parameters
----------
u : float or numpy.ndarray of float
target x ECEF coordinate (meters)
v : float or n... | python | def ecef2enuv(u: float, v: float, w: float,
lat0: float, lon0: float, deg: bool = True) -> Tuple[float, float, float]:
"""
VECTOR from observer to target ECEF => ENU
Parameters
----------
u : float or numpy.ndarray of float
target x ECEF coordinate (meters)
v : float or n... | [
"def",
"ecef2enuv",
"(",
"u",
":",
"float",
",",
"v",
":",
"float",
",",
"w",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"deg",
":",
"bool",
"=",
"True",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"float"... | VECTOR from observer to target ECEF => ENU
Parameters
----------
u : float or numpy.ndarray of float
target x ECEF coordinate (meters)
v : float or numpy.ndarray of float
target y ECEF coordinate (meters)
w : float or numpy.ndarray of float
target z ECEF coordinate (meters)... | [
"VECTOR",
"from",
"observer",
"to",
"target",
"ECEF",
"=",
">",
"ENU"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ecef.py#L233-L274 |
scivision/pymap3d | pymap3d/ecef.py | ecef2enu | def ecef2enu(x: float, y: float, z: float,
lat0: float, lon0: float, h0: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
from observer to target, ECEF => ENU
Parameters
----------
x : float or numpy.ndarray of float
target x ECEF ... | python | def ecef2enu(x: float, y: float, z: float,
lat0: float, lon0: float, h0: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
from observer to target, ECEF => ENU
Parameters
----------
x : float or numpy.ndarray of float
target x ECEF ... | [
"def",
"ecef2enu",
"(",
"x",
":",
"float",
",",
"y",
":",
"float",
",",
"z",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"h0",
":",
"float",
",",
"ell",
":",
"Ellipsoid",
"=",
"None",
",",
"deg",
":",
"bool",
"=",
... | from observer to target, ECEF => ENU
Parameters
----------
x : float or numpy.ndarray of float
target x ECEF coordinate (meters)
y : float or numpy.ndarray of float
target y ECEF coordinate (meters)
z : float or numpy.ndarray of float
target z ECEF coordinate (meters)
la... | [
"from",
"observer",
"to",
"target",
"ECEF",
"=",
">",
"ENU"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ecef.py#L277-L314 |
scivision/pymap3d | pymap3d/ecef.py | enu2uvw | def enu2uvw(east: float, north: float, up: float,
lat0: float, lon0: float, deg: bool = True) -> Tuple[float, float, float]:
"""
Parameters
----------
e1 : float or numpy.ndarray of float
target east ENU coordinate (meters)
n1 : float or numpy.ndarray of float
target nor... | python | def enu2uvw(east: float, north: float, up: float,
lat0: float, lon0: float, deg: bool = True) -> Tuple[float, float, float]:
"""
Parameters
----------
e1 : float or numpy.ndarray of float
target east ENU coordinate (meters)
n1 : float or numpy.ndarray of float
target nor... | [
"def",
"enu2uvw",
"(",
"east",
":",
"float",
",",
"north",
":",
"float",
",",
"up",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"deg",
":",
"bool",
"=",
"True",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"... | Parameters
----------
e1 : float or numpy.ndarray of float
target east ENU coordinate (meters)
n1 : float or numpy.ndarray of float
target north ENU coordinate (meters)
u1 : float or numpy.ndarray of float
target up ENU coordinate (meters)
Results
-------
u : float... | [
"Parameters",
"----------"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ecef.py#L317-L348 |
scivision/pymap3d | pymap3d/ecef.py | uvw2enu | def uvw2enu(u: float, v: float, w: float,
lat0: float, lon0: float, deg: bool = True) -> Tuple[float, float, float]:
"""
Parameters
----------
u : float or numpy.ndarray of float
v : float or numpy.ndarray of float
w : float or numpy.ndarray of float
Results
-------
E... | python | def uvw2enu(u: float, v: float, w: float,
lat0: float, lon0: float, deg: bool = True) -> Tuple[float, float, float]:
"""
Parameters
----------
u : float or numpy.ndarray of float
v : float or numpy.ndarray of float
w : float or numpy.ndarray of float
Results
-------
E... | [
"def",
"uvw2enu",
"(",
"u",
":",
"float",
",",
"v",
":",
"float",
",",
"w",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"deg",
":",
"bool",
"=",
"True",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"float",
... | Parameters
----------
u : float or numpy.ndarray of float
v : float or numpy.ndarray of float
w : float or numpy.ndarray of float
Results
-------
East : float or numpy.ndarray of float
target east ENU coordinate (meters)
North : float or numpy.ndarray of float
target ... | [
"Parameters",
"----------"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ecef.py#L351-L381 |
scivision/pymap3d | pymap3d/ecef.py | eci2geodetic | def eci2geodetic(eci: np.ndarray, t: datetime,
useastropy: bool = True) -> Tuple[float, float, float]:
"""
convert ECI to geodetic coordinates
Parameters
----------
eci : tuple of float
[meters] Nx3 target ECI location (x,y,z)
t : datetime.datetime, float
le... | python | def eci2geodetic(eci: np.ndarray, t: datetime,
useastropy: bool = True) -> Tuple[float, float, float]:
"""
convert ECI to geodetic coordinates
Parameters
----------
eci : tuple of float
[meters] Nx3 target ECI location (x,y,z)
t : datetime.datetime, float
le... | [
"def",
"eci2geodetic",
"(",
"eci",
":",
"np",
".",
"ndarray",
",",
"t",
":",
"datetime",
",",
"useastropy",
":",
"bool",
"=",
"True",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"float",
"]",
":",
"ecef",
"=",
"np",
".",
"atleast_2d",
"(",... | convert ECI to geodetic coordinates
Parameters
----------
eci : tuple of float
[meters] Nx3 target ECI location (x,y,z)
t : datetime.datetime, float
length N vector of datetime OR greenwich sidereal time angle [radians].
Results
-------
lat : float
geodetic la... | [
"convert",
"ECI",
"to",
"geodetic",
"coordinates"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ecef.py#L384-L416 |
scivision/pymap3d | pymap3d/ecef.py | enu2ecef | def enu2ecef(e1: float, n1: float, u1: float,
lat0: float, lon0: float, h0: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
ENU to ECEF
Parameters
----------
e1 : float or numpy.ndarray of float
target east ENU coordinate (meters... | python | def enu2ecef(e1: float, n1: float, u1: float,
lat0: float, lon0: float, h0: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
ENU to ECEF
Parameters
----------
e1 : float or numpy.ndarray of float
target east ENU coordinate (meters... | [
"def",
"enu2ecef",
"(",
"e1",
":",
"float",
",",
"n1",
":",
"float",
",",
"u1",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"h0",
":",
"float",
",",
"ell",
":",
"Ellipsoid",
"=",
"None",
",",
"deg",
":",
"bool",
"="... | ENU to ECEF
Parameters
----------
e1 : float or numpy.ndarray of float
target east ENU coordinate (meters)
n1 : float or numpy.ndarray of float
target north ENU coordinate (meters)
u1 : float or numpy.ndarray of float
target up ENU coordinate (meters)
lat0 : float
... | [
"ENU",
"to",
"ECEF"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ecef.py#L419-L458 |
scivision/pymap3d | pymap3d/ned.py | aer2ned | def aer2ned(az: float, elev: float, slantRange: float,
deg: bool = True) -> Tuple[float, float, float]:
"""
converts azimuth, elevation, range to target from observer to North, East, Down
Parameters
-----------
az : float or numpy.ndarray of float
azimuth
elev : float or n... | python | def aer2ned(az: float, elev: float, slantRange: float,
deg: bool = True) -> Tuple[float, float, float]:
"""
converts azimuth, elevation, range to target from observer to North, East, Down
Parameters
-----------
az : float or numpy.ndarray of float
azimuth
elev : float or n... | [
"def",
"aer2ned",
"(",
"az",
":",
"float",
",",
"elev",
":",
"float",
",",
"slantRange",
":",
"float",
",",
"deg",
":",
"bool",
"=",
"True",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"float",
"]",
":",
"e",
",",
"n",
",",
"u",
"=",
... | converts azimuth, elevation, range to target from observer to North, East, Down
Parameters
-----------
az : float or numpy.ndarray of float
azimuth
elev : float or numpy.ndarray of float
elevation
slantRange : float or numpy.ndarray of float
slant range [meters]
deg ... | [
"converts",
"azimuth",
"elevation",
"range",
"to",
"target",
"from",
"observer",
"to",
"North",
"East",
"Down"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ned.py#L7-L35 |
scivision/pymap3d | pymap3d/ned.py | ned2aer | def ned2aer(n: float, e: float, d: float,
deg: bool = True) -> Tuple[float, float, float]:
"""
converts North, East, Down to azimuth, elevation, range
Parameters
----------
n : float or numpy.ndarray of float
North NED coordinate (meters)
e : float or numpy.ndarray of float... | python | def ned2aer(n: float, e: float, d: float,
deg: bool = True) -> Tuple[float, float, float]:
"""
converts North, East, Down to azimuth, elevation, range
Parameters
----------
n : float or numpy.ndarray of float
North NED coordinate (meters)
e : float or numpy.ndarray of float... | [
"def",
"ned2aer",
"(",
"n",
":",
"float",
",",
"e",
":",
"float",
",",
"d",
":",
"float",
",",
"deg",
":",
"bool",
"=",
"True",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"float",
"]",
":",
"return",
"enu2aer",
"(",
"e",
",",
"n",
"... | converts North, East, Down to azimuth, elevation, range
Parameters
----------
n : float or numpy.ndarray of float
North NED coordinate (meters)
e : float or numpy.ndarray of float
East NED coordinate (meters)
d : float or numpy.ndarray of float
Down NED coordinate (meters)
... | [
"converts",
"North",
"East",
"Down",
"to",
"azimuth",
"elevation",
"range"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ned.py#L38-L65 |
scivision/pymap3d | pymap3d/ned.py | ned2geodetic | def ned2geodetic(n: float, e: float, d: float,
lat0: float, lon0: float, h0: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
Converts North, East, Down to target latitude, longitude, altitude
Parameters
----------
n : float or nu... | python | def ned2geodetic(n: float, e: float, d: float,
lat0: float, lon0: float, h0: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
Converts North, East, Down to target latitude, longitude, altitude
Parameters
----------
n : float or nu... | [
"def",
"ned2geodetic",
"(",
"n",
":",
"float",
",",
"e",
":",
"float",
",",
"d",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"h0",
":",
"float",
",",
"ell",
":",
"Ellipsoid",
"=",
"None",
",",
"deg",
":",
"bool",
"=... | Converts North, East, Down to target latitude, longitude, altitude
Parameters
----------
n : float or numpy.ndarray of float
North NED coordinate (meters)
e : float or numpy.ndarray of float
East NED coordinate (meters)
d : float or numpy.ndarray of float
Down NED coordinat... | [
"Converts",
"North",
"East",
"Down",
"to",
"target",
"latitude",
"longitude",
"altitude"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ned.py#L68-L107 |
scivision/pymap3d | pymap3d/ned.py | ned2ecef | def ned2ecef(n: float, e: float, d: float,
lat0: float, lon0: float, h0: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
North, East, Down to target ECEF coordinates
Parameters
----------
n : float or numpy.ndarray of float
North... | python | def ned2ecef(n: float, e: float, d: float,
lat0: float, lon0: float, h0: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
North, East, Down to target ECEF coordinates
Parameters
----------
n : float or numpy.ndarray of float
North... | [
"def",
"ned2ecef",
"(",
"n",
":",
"float",
",",
"e",
":",
"float",
",",
"d",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"h0",
":",
"float",
",",
"ell",
":",
"Ellipsoid",
"=",
"None",
",",
"deg",
":",
"bool",
"=",
... | North, East, Down to target ECEF coordinates
Parameters
----------
n : float or numpy.ndarray of float
North NED coordinate (meters)
e : float or numpy.ndarray of float
East NED coordinate (meters)
d : float or numpy.ndarray of float
Down NED coordinate (meters)
lat0 : ... | [
"North",
"East",
"Down",
"to",
"target",
"ECEF",
"coordinates"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ned.py#L110-L146 |
scivision/pymap3d | pymap3d/ned.py | ecef2ned | def ecef2ned(x: float, y: float, z: float,
lat0: float, lon0: float, h0: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
Convert ECEF x,y,z to North, East, Down
Parameters
----------
x : float or numpy.ndarray of float
ECEF x coo... | python | def ecef2ned(x: float, y: float, z: float,
lat0: float, lon0: float, h0: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
Convert ECEF x,y,z to North, East, Down
Parameters
----------
x : float or numpy.ndarray of float
ECEF x coo... | [
"def",
"ecef2ned",
"(",
"x",
":",
"float",
",",
"y",
":",
"float",
",",
"z",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"h0",
":",
"float",
",",
"ell",
":",
"Ellipsoid",
"=",
"None",
",",
"deg",
":",
"bool",
"=",
... | Convert ECEF x,y,z to North, East, Down
Parameters
----------
x : float or numpy.ndarray of float
ECEF x coordinate (meters)
y : float or numpy.ndarray of float
ECEF y coordinate (meters)
z : float or numpy.ndarray of float
ECEF z coordinate (meters)
lat0 : float
... | [
"Convert",
"ECEF",
"x",
"y",
"z",
"to",
"North",
"East",
"Down"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ned.py#L149-L188 |
scivision/pymap3d | pymap3d/ned.py | ecef2nedv | def ecef2nedv(x: float, y: float, z: float,
lat0: float, lon0: float,
deg: bool = True) -> Tuple[float, float, float]:
"""
for VECTOR between two points
Parameters
----------
x : float or numpy.ndarray of float
ECEF x coordinate (meters)
y : float or numpy.nd... | python | def ecef2nedv(x: float, y: float, z: float,
lat0: float, lon0: float,
deg: bool = True) -> Tuple[float, float, float]:
"""
for VECTOR between two points
Parameters
----------
x : float or numpy.ndarray of float
ECEF x coordinate (meters)
y : float or numpy.nd... | [
"def",
"ecef2nedv",
"(",
"x",
":",
"float",
",",
"y",
":",
"float",
",",
"z",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"deg",
":",
"bool",
"=",
"True",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"float"... | for VECTOR between two points
Parameters
----------
x : float or numpy.ndarray of float
ECEF x coordinate (meters)
y : float or numpy.ndarray of float
ECEF y coordinate (meters)
z : float or numpy.ndarray of float
ECEF z coordinate (meters)
lat0 : float
Observer ... | [
"for",
"VECTOR",
"between",
"two",
"points"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ned.py#L233-L268 |
scivision/pymap3d | pymap3d/vallado.py | azel2radec | def azel2radec(az_deg: float, el_deg: float,
lat_deg: float, lon_deg: float,
time: datetime) -> Tuple[float, float]:
"""
converts azimuth, elevation to right ascension, declination
Parameters
----------
az_deg : float or numpy.ndarray of float
azimuth (clockwi... | python | def azel2radec(az_deg: float, el_deg: float,
lat_deg: float, lon_deg: float,
time: datetime) -> Tuple[float, float]:
"""
converts azimuth, elevation to right ascension, declination
Parameters
----------
az_deg : float or numpy.ndarray of float
azimuth (clockwi... | [
"def",
"azel2radec",
"(",
"az_deg",
":",
"float",
",",
"el_deg",
":",
"float",
",",
"lat_deg",
":",
"float",
",",
"lon_deg",
":",
"float",
",",
"time",
":",
"datetime",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
"]",
":",
"az",
"=",
"atleast_1d"... | converts azimuth, elevation to right ascension, declination
Parameters
----------
az_deg : float or numpy.ndarray of float
azimuth (clockwise) to point [degrees]
el_deg : float or numpy.ndarray of float
elevation above horizon to point [degrees]
lat_deg : float
observer W... | [
"converts",
"azimuth",
"elevation",
"to",
"right",
"ascension",
"declination"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/vallado.py#L19-L80 |
scivision/pymap3d | pymap3d/vallado.py | radec2azel | def radec2azel(ra_deg: float, dec_deg: float,
lat_deg: float, lon_deg: float,
time: datetime) -> Tuple[float, float]:
"""
converts right ascension, declination to azimuth, elevation
Parameters
----------
ra_deg : float or numpy.ndarray of float
right ascension... | python | def radec2azel(ra_deg: float, dec_deg: float,
lat_deg: float, lon_deg: float,
time: datetime) -> Tuple[float, float]:
"""
converts right ascension, declination to azimuth, elevation
Parameters
----------
ra_deg : float or numpy.ndarray of float
right ascension... | [
"def",
"radec2azel",
"(",
"ra_deg",
":",
"float",
",",
"dec_deg",
":",
"float",
",",
"lat_deg",
":",
"float",
",",
"lon_deg",
":",
"float",
",",
"time",
":",
"datetime",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
"]",
":",
"ra",
"=",
"atleast_1d... | converts right ascension, declination to azimuth, elevation
Parameters
----------
ra_deg : float or numpy.ndarray of float
right ascension to target [degrees]
dec_deg : float or numpy.ndarray of float
declination to target [degrees]
lat_deg : float
observer WGS84 latitude... | [
"converts",
"right",
"ascension",
"declination",
"to",
"azimuth",
"elevation"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/vallado.py#L83-L146 |
scivision/pymap3d | archive/ecef.py | ecef2geodetic_old | def ecef2geodetic_old(x: float, y: float, z: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
convert ECEF (meters) to geodetic coordinates
input
-----
x,y,z [meters] target ECEF location [0,Infinity)
ell re... | python | def ecef2geodetic_old(x: float, y: float, z: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
convert ECEF (meters) to geodetic coordinates
input
-----
x,y,z [meters] target ECEF location [0,Infinity)
ell re... | [
"def",
"ecef2geodetic_old",
"(",
"x",
":",
"float",
",",
"y",
":",
"float",
",",
"z",
":",
"float",
",",
"ell",
":",
"Ellipsoid",
"=",
"None",
",",
"deg",
":",
"bool",
"=",
"True",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"float",
"]"... | convert ECEF (meters) to geodetic coordinates
input
-----
x,y,z [meters] target ECEF location [0,Infinity)
ell reference ellipsoid
deg degrees input/output (False: radians in/out)
output
------
lat,lon (degrees/radians)
alt (meters)
Algor... | [
"convert",
"ECEF",
"(",
"meters",
")",
"to",
"geodetic",
"coordinates"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/archive/ecef.py#L44-L108 |
scivision/pymap3d | pymap3d/aer.py | ecef2aer | def ecef2aer(x: float, y: float, z: float,
lat0: float, lon0: float, h0: float,
ell=None, deg: bool = True) -> Tuple[float, float, float]:
"""
gives azimuth, elevation and slant range from an Observer to a Point with ECEF coordinates.
ECEF input location is with units of meters
... | python | def ecef2aer(x: float, y: float, z: float,
lat0: float, lon0: float, h0: float,
ell=None, deg: bool = True) -> Tuple[float, float, float]:
"""
gives azimuth, elevation and slant range from an Observer to a Point with ECEF coordinates.
ECEF input location is with units of meters
... | [
"def",
"ecef2aer",
"(",
"x",
":",
"float",
",",
"y",
":",
"float",
",",
"z",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"h0",
":",
"float",
",",
"ell",
"=",
"None",
",",
"deg",
":",
"bool",
"=",
"True",
")",
"->"... | gives azimuth, elevation and slant range from an Observer to a Point with ECEF coordinates.
ECEF input location is with units of meters
Parameters
----------
x : float or numpy.ndarray of float
ECEF x coordinate (meters)
y : float or numpy.ndarray of float
ECEF y coordinate (meter... | [
"gives",
"azimuth",
"elevation",
"and",
"slant",
"range",
"from",
"an",
"Observer",
"to",
"a",
"Point",
"with",
"ECEF",
"coordinates",
"."
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/aer.py#L10-L49 |
scivision/pymap3d | pymap3d/aer.py | geodetic2aer | def geodetic2aer(lat: float, lon: float, h: float,
lat0: float, lon0: float, h0: float,
ell=None, deg: bool = True) -> Tuple[float, float, float]:
"""
gives azimuth, elevation and slant range from an Observer to a Point with geodetic coordinates.
Parameters
----------... | python | def geodetic2aer(lat: float, lon: float, h: float,
lat0: float, lon0: float, h0: float,
ell=None, deg: bool = True) -> Tuple[float, float, float]:
"""
gives azimuth, elevation and slant range from an Observer to a Point with geodetic coordinates.
Parameters
----------... | [
"def",
"geodetic2aer",
"(",
"lat",
":",
"float",
",",
"lon",
":",
"float",
",",
"h",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"h0",
":",
"float",
",",
"ell",
"=",
"None",
",",
"deg",
":",
"bool",
"=",
"True",
")"... | gives azimuth, elevation and slant range from an Observer to a Point with geodetic coordinates.
Parameters
----------
lat : float or numpy.ndarray of float
target geodetic latitude
lon : float or numpy.ndarray of float
target geodetic longitude
h : float or numpy.ndarray of float
... | [
"gives",
"azimuth",
"elevation",
"and",
"slant",
"range",
"from",
"an",
"Observer",
"to",
"a",
"Point",
"with",
"geodetic",
"coordinates",
"."
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/aer.py#L52-L90 |
scivision/pymap3d | pymap3d/aer.py | aer2geodetic | def aer2geodetic(az: float, el: float, srange: float,
lat0: float, lon0: float, h0: float,
ell=None,
deg: bool = True) -> Tuple[float, float, float]:
"""
gives geodetic coordinates of a point with az, el, range
from an observer at lat0, lon0, h0
Parame... | python | def aer2geodetic(az: float, el: float, srange: float,
lat0: float, lon0: float, h0: float,
ell=None,
deg: bool = True) -> Tuple[float, float, float]:
"""
gives geodetic coordinates of a point with az, el, range
from an observer at lat0, lon0, h0
Parame... | [
"def",
"aer2geodetic",
"(",
"az",
":",
"float",
",",
"el",
":",
"float",
",",
"srange",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"h0",
":",
"float",
",",
"ell",
"=",
"None",
",",
"deg",
":",
"bool",
"=",
"True",
... | gives geodetic coordinates of a point with az, el, range
from an observer at lat0, lon0, h0
Parameters
----------
az : float or numpy.ndarray of float
azimuth to target
el : float or numpy.ndarray of float
elevation to target
srange : float or numpy.ndarray of float
s... | [
"gives",
"geodetic",
"coordinates",
"of",
"a",
"point",
"with",
"az",
"el",
"range",
"from",
"an",
"observer",
"at",
"lat0",
"lon0",
"h0"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/aer.py#L93-L134 |
scivision/pymap3d | pymap3d/aer.py | eci2aer | def eci2aer(eci: Tuple[float, float, float],
lat0: float, lon0: float, h0: float,
t: datetime,
useastropy: bool = True) -> Tuple[float, float, float]:
"""
takes ECI coordinates of point and gives az, el, slant range from Observer
Parameters
----------
eci : tupl... | python | def eci2aer(eci: Tuple[float, float, float],
lat0: float, lon0: float, h0: float,
t: datetime,
useastropy: bool = True) -> Tuple[float, float, float]:
"""
takes ECI coordinates of point and gives az, el, slant range from Observer
Parameters
----------
eci : tupl... | [
"def",
"eci2aer",
"(",
"eci",
":",
"Tuple",
"[",
"float",
",",
"float",
",",
"float",
"]",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"h0",
":",
"float",
",",
"t",
":",
"datetime",
",",
"useastropy",
":",
"bool",
"=",
"True",
")",... | takes ECI coordinates of point and gives az, el, slant range from Observer
Parameters
----------
eci : tuple
[meters] Nx3 target ECI location (x,y,z)
lat0 : float
Observer geodetic latitude
lon0 : float
Observer geodetic longitude
h0 : float
observer al... | [
"takes",
"ECI",
"coordinates",
"of",
"point",
"and",
"gives",
"az",
"el",
"slant",
"range",
"from",
"Observer"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/aer.py#L137-L170 |
scivision/pymap3d | pymap3d/aer.py | aer2eci | def aer2eci(az: float, el: float, srange: float,
lat0: float, lon0: float, h0: float, t: datetime,
ell=None, deg: bool = True,
useastropy: bool = True) -> np.ndarray:
"""
gives ECI of a point from an observer at az, el, slant range
Parameters
----------
az : floa... | python | def aer2eci(az: float, el: float, srange: float,
lat0: float, lon0: float, h0: float, t: datetime,
ell=None, deg: bool = True,
useastropy: bool = True) -> np.ndarray:
"""
gives ECI of a point from an observer at az, el, slant range
Parameters
----------
az : floa... | [
"def",
"aer2eci",
"(",
"az",
":",
"float",
",",
"el",
":",
"float",
",",
"srange",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"h0",
":",
"float",
",",
"t",
":",
"datetime",
",",
"ell",
"=",
"None",
",",
"deg",
":",... | gives ECI of a point from an observer at az, el, slant range
Parameters
----------
az : float or numpy.ndarray of float
azimuth to target
el : float or numpy.ndarray of float
elevation to target
srange : float or numpy.ndarray of float
slant range [meters]
lat0 : floa... | [
"gives",
"ECI",
"of",
"a",
"point",
"from",
"an",
"observer",
"at",
"az",
"el",
"slant",
"range"
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/aer.py#L173-L215 |
scivision/pymap3d | pymap3d/aer.py | aer2ecef | def aer2ecef(az: float, el: float, srange: float,
lat0: float, lon0: float, alt0: float,
ell=None, deg: bool = True) -> Tuple[float, float, float]:
"""
converts target azimuth, elevation, range from observer at lat0,lon0,alt0 to ECEF coordinates.
Parameters
----------
az :... | python | def aer2ecef(az: float, el: float, srange: float,
lat0: float, lon0: float, alt0: float,
ell=None, deg: bool = True) -> Tuple[float, float, float]:
"""
converts target azimuth, elevation, range from observer at lat0,lon0,alt0 to ECEF coordinates.
Parameters
----------
az :... | [
"def",
"aer2ecef",
"(",
"az",
":",
"float",
",",
"el",
":",
"float",
",",
"srange",
":",
"float",
",",
"lat0",
":",
"float",
",",
"lon0",
":",
"float",
",",
"alt0",
":",
"float",
",",
"ell",
"=",
"None",
",",
"deg",
":",
"bool",
"=",
"True",
")... | converts target azimuth, elevation, range from observer at lat0,lon0,alt0 to ECEF coordinates.
Parameters
----------
az : float or numpy.ndarray of float
azimuth to target
el : float or numpy.ndarray of float
elevation to target
srange : float or numpy.ndarray of float
sl... | [
"converts",
"target",
"azimuth",
"elevation",
"range",
"from",
"observer",
"at",
"lat0",
"lon0",
"alt0",
"to",
"ECEF",
"coordinates",
"."
] | train | https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/aer.py#L218-L267 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.