id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
4,100
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L159-L183
4,101
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L192-L198
4,102
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L200-L206
4,103
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L208-L214
4,104
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L216-L224
4,105
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L226-L260
4,106
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L302-L310
4,107
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L312-L320
4,108
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L322-L330
4,109
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/__init__.py#L31-L108
4,110
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/__init__.py#L111-L161
4,111
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L31-L47
4,112
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L49-L65
4,113
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L67-L83
4,114
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L85-L95
4,115
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L97-L111
4,116
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L160-L170
4,117
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L172-L191
4,118
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L193-L247
4,119
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L249-L272
4,120
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L274-L297
4,121
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L299-L322
4,122
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L324-L349
4,123
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L351-L382
4,124
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L384-L405
4,125
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L407-L428
4,126
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L430-L463
4,127
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", "." ]
7e80adc6ae92c6c1332d4c08473bb271fb3b6833
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L465-L478
4,128
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/enu.py#L16-L62
4,129
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/enu.py#L65-L99
4,130
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/enu.py#L102-L140
4,131
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/vincenty.py#L416-L491
4,132
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/sidereal.py#L22-L55
4,133
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/sidereal.py#L58-L97
4,134
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/sidereal.py#L100-L135
4,135
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ecef.py#L70-L94
4,136
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ecef.py#L233-L274
4,137
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ecef.py#L277-L314
4,138
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ecef.py#L384-L416
4,139
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ecef.py#L419-L458
4,140
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ned.py#L7-L35
4,141
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ned.py#L38-L65
4,142
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ned.py#L68-L107
4,143
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ned.py#L110-L146
4,144
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ned.py#L149-L188
4,145
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/ned.py#L233-L268
4,146
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/vallado.py#L19-L80
4,147
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/vallado.py#L83-L146
4,148
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", "." ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/aer.py#L10-L49
4,149
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", "." ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/aer.py#L52-L90
4,150
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/aer.py#L93-L134
4,151
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/aer.py#L137-L170
4,152
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" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/aer.py#L173-L215
4,153
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", "." ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/aer.py#L218-L267
4,154
scivision/pymap3d
pymap3d/lox.py
isometric
def isometric(lat: float, ell: Ellipsoid = None, deg: bool = True): """ computes isometric latitude of a point on an ellipsoid Parameters ---------- lat : float or numpy.ndarray of float geodetic latitude ell : Ellipsoid, optional reference ellipsoid (default WGS84) ...
python
def isometric(lat: float, ell: Ellipsoid = None, deg: bool = True): """ computes isometric latitude of a point on an ellipsoid Parameters ---------- lat : float or numpy.ndarray of float geodetic latitude ell : Ellipsoid, optional reference ellipsoid (default WGS84) ...
[ "def", "isometric", "(", "lat", ":", "float", ",", "ell", ":", "Ellipsoid", "=", "None", ",", "deg", ":", "bool", "=", "True", ")", ":", "if", "ell", "is", "None", ":", "ell", "=", "Ellipsoid", "(", ")", "f", "=", "ell", ".", "f", "# flattening o...
computes isometric latitude of a point on an ellipsoid Parameters ---------- lat : float or numpy.ndarray of float geodetic latitude ell : Ellipsoid, optional reference ellipsoid (default WGS84) deg : bool, optional degrees input/output (False: radians in/out) ...
[ "computes", "isometric", "latitude", "of", "a", "point", "on", "an", "ellipsoid" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/lox.py#L6-L58
4,155
scivision/pymap3d
pymap3d/lox.py
loxodrome_inverse
def loxodrome_inverse(lat1: float, lon1: float, lat2: float, lon2: float, ell: Ellipsoid = None, deg: bool = True): """ computes the arc length and azimuth of the loxodrome between two points on the surface of the reference ellipsoid Parameters ---------- lat1 : float or ...
python
def loxodrome_inverse(lat1: float, lon1: float, lat2: float, lon2: float, ell: Ellipsoid = None, deg: bool = True): """ computes the arc length and azimuth of the loxodrome between two points on the surface of the reference ellipsoid Parameters ---------- lat1 : float or ...
[ "def", "loxodrome_inverse", "(", "lat1", ":", "float", ",", "lon1", ":", "float", ",", "lat2", ":", "float", ",", "lon2", ":", "float", ",", "ell", ":", "Ellipsoid", "=", "None", ",", "deg", ":", "bool", "=", "True", ")", ":", "# set ellipsoid parame...
computes the arc length and azimuth of the loxodrome between two points on the surface of the reference ellipsoid Parameters ---------- lat1 : float or numpy.ndarray of float geodetic latitude of first point lon1 : float or numpy.ndarray of float geodetic longitude of first point ...
[ "computes", "the", "arc", "length", "and", "azimuth", "of", "the", "loxodrome", "between", "two", "points", "on", "the", "surface", "of", "the", "reference", "ellipsoid" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/lox.py#L130-L202
4,156
scivision/pymap3d
pymap3d/eci.py
eci2ecef
def eci2ecef(eci: np.ndarray, time: datetime, useastropy: bool = True) -> np.ndarray: """ Observer => Point ECI => ECEF Parameters ---------- eci : tuple of float Nx3 target ECI location (x,y,z) [meters] time : datetime.datetime time of obsevation (U...
python
def eci2ecef(eci: np.ndarray, time: datetime, useastropy: bool = True) -> np.ndarray: """ Observer => Point ECI => ECEF Parameters ---------- eci : tuple of float Nx3 target ECI location (x,y,z) [meters] time : datetime.datetime time of obsevation (U...
[ "def", "eci2ecef", "(", "eci", ":", "np", ".", "ndarray", ",", "time", ":", "datetime", ",", "useastropy", ":", "bool", "=", "True", ")", "->", "np", ".", "ndarray", ":", "useastropy", "=", "useastropy", "and", "Time", "if", "useastropy", ":", "gst", ...
Observer => Point ECI => ECEF Parameters ---------- eci : tuple of float Nx3 target ECI location (x,y,z) [meters] time : datetime.datetime time of obsevation (UTC) useastropy : bool, optional use AstroPy for conversion Results ------- x : float target...
[ "Observer", "=", ">", "Point", "ECI", "=", ">", "ECEF" ]
c9cf676594611cdb52ff7e0eca6388c80ed4f63f
https://github.com/scivision/pymap3d/blob/c9cf676594611cdb52ff7e0eca6388c80ed4f63f/pymap3d/eci.py#L12-L58
4,157
Netflix-Skunkworks/historical
historical/vpc/collector.py
describe_vpc
def describe_vpc(record): """Attempts to describe vpc ids.""" account_id = record['account'] vpc_name = cloudwatch.filter_request_parameters('vpcName', record) vpc_id = cloudwatch.filter_request_parameters('vpcId', record) try: if vpc_id and vpc_name: # pylint: disable=R1705 re...
python
def describe_vpc(record): """Attempts to describe vpc ids.""" account_id = record['account'] vpc_name = cloudwatch.filter_request_parameters('vpcName', record) vpc_id = cloudwatch.filter_request_parameters('vpcId', record) try: if vpc_id and vpc_name: # pylint: disable=R1705 re...
[ "def", "describe_vpc", "(", "record", ")", ":", "account_id", "=", "record", "[", "'account'", "]", "vpc_name", "=", "cloudwatch", ".", "filter_request_parameters", "(", "'vpcName'", ",", "record", ")", "vpc_id", "=", "cloudwatch", ".", "filter_request_parameters"...
Attempts to describe vpc ids.
[ "Attempts", "to", "describe", "vpc", "ids", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/vpc/collector.py#L44-L75
4,158
Netflix-Skunkworks/historical
historical/vpc/collector.py
create_delete_model
def create_delete_model(record): """Create a vpc model from a record.""" data = cloudwatch.get_historical_base_info(record) vpc_id = cloudwatch.filter_request_parameters('vpcId', record) arn = get_arn(vpc_id, cloudwatch.get_region(record), record['account']) LOG.debug(F'[-] Deleting Dynamodb Reco...
python
def create_delete_model(record): """Create a vpc model from a record.""" data = cloudwatch.get_historical_base_info(record) vpc_id = cloudwatch.filter_request_parameters('vpcId', record) arn = get_arn(vpc_id, cloudwatch.get_region(record), record['account']) LOG.debug(F'[-] Deleting Dynamodb Reco...
[ "def", "create_delete_model", "(", "record", ")", ":", "data", "=", "cloudwatch", ".", "get_historical_base_info", "(", "record", ")", "vpc_id", "=", "cloudwatch", ".", "filter_request_parameters", "(", "'vpcId'", ",", "record", ")", "arn", "=", "get_arn", "(", ...
Create a vpc model from a record.
[ "Create", "a", "vpc", "model", "from", "a", "record", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/vpc/collector.py#L78-L102
4,159
Netflix-Skunkworks/historical
historical/vpc/collector.py
handler
def handler(event, context): # pylint: disable=W0613 """ Historical vpc event collector. This collector is responsible for processing Cloudwatch events and polling events. """ records = deserialize_records(event['Records']) # Split records into two groups, update and delete. # We don't wan...
python
def handler(event, context): # pylint: disable=W0613 """ Historical vpc event collector. This collector is responsible for processing Cloudwatch events and polling events. """ records = deserialize_records(event['Records']) # Split records into two groups, update and delete. # We don't wan...
[ "def", "handler", "(", "event", ",", "context", ")", ":", "# pylint: disable=W0613", "records", "=", "deserialize_records", "(", "event", "[", "'Records'", "]", ")", "# Split records into two groups, update and delete.", "# We don't want to query for deleted records.", "updat...
Historical vpc event collector. This collector is responsible for processing Cloudwatch events and polling events.
[ "Historical", "vpc", "event", "collector", ".", "This", "collector", "is", "responsible", "for", "processing", "Cloudwatch", "events", "and", "polling", "events", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/vpc/collector.py#L165-L183
4,160
Netflix-Skunkworks/historical
historical/common/dynamodb.py
default_diff
def default_diff(latest_config, current_config): """Determine if two revisions have actually changed.""" # Pop off the fields we don't care about: pop_no_diff_fields(latest_config, current_config) diff = DeepDiff( latest_config, current_config, ignore_order=True ) return...
python
def default_diff(latest_config, current_config): """Determine if two revisions have actually changed.""" # Pop off the fields we don't care about: pop_no_diff_fields(latest_config, current_config) diff = DeepDiff( latest_config, current_config, ignore_order=True ) return...
[ "def", "default_diff", "(", "latest_config", ",", "current_config", ")", ":", "# Pop off the fields we don't care about:", "pop_no_diff_fields", "(", "latest_config", ",", "current_config", ")", "diff", "=", "DeepDiff", "(", "latest_config", ",", "current_config", ",", ...
Determine if two revisions have actually changed.
[ "Determine", "if", "two", "revisions", "have", "actually", "changed", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/dynamodb.py#L33-L43
4,161
Netflix-Skunkworks/historical
historical/common/dynamodb.py
pop_no_diff_fields
def pop_no_diff_fields(latest_config, current_config): """Pops off fields that should not be included in the diff.""" for field in ['userIdentity', 'principalId', 'userAgent', 'sourceIpAddress', 'requestParameters', 'eventName']: latest_config.pop(field, None) current_config.pop(field, None)
python
def pop_no_diff_fields(latest_config, current_config): """Pops off fields that should not be included in the diff.""" for field in ['userIdentity', 'principalId', 'userAgent', 'sourceIpAddress', 'requestParameters', 'eventName']: latest_config.pop(field, None) current_config.pop(field, None)
[ "def", "pop_no_diff_fields", "(", "latest_config", ",", "current_config", ")", ":", "for", "field", "in", "[", "'userIdentity'", ",", "'principalId'", ",", "'userAgent'", ",", "'sourceIpAddress'", ",", "'requestParameters'", ",", "'eventName'", "]", ":", "latest_con...
Pops off fields that should not be included in the diff.
[ "Pops", "off", "fields", "that", "should", "not", "be", "included", "in", "the", "diff", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/dynamodb.py#L46-L50
4,162
Netflix-Skunkworks/historical
historical/common/dynamodb.py
modify_record
def modify_record(durable_model, current_revision, arn, event_time, diff_func): """Handles a DynamoDB MODIFY event type.""" # We want the newest items first. # See: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html items = list(durable_model.query( arn, (durable_...
python
def modify_record(durable_model, current_revision, arn, event_time, diff_func): """Handles a DynamoDB MODIFY event type.""" # We want the newest items first. # See: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html items = list(durable_model.query( arn, (durable_...
[ "def", "modify_record", "(", "durable_model", ",", "current_revision", ",", "arn", ",", "event_time", ",", "diff_func", ")", ":", "# We want the newest items first.", "# See: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html", "items", "=", "list", "(",...
Handles a DynamoDB MODIFY event type.
[ "Handles", "a", "DynamoDB", "MODIFY", "event", "type", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/dynamodb.py#L82-L108
4,163
Netflix-Skunkworks/historical
historical/common/dynamodb.py
deserialize_current_record_to_durable_model
def deserialize_current_record_to_durable_model(record, current_model, durable_model): """ Utility function that will take a dynamo event record and turn it into the proper pynamo object. This will properly deserialize the ugly Dynamo datatypes away. :param record: :param current_model: :param ...
python
def deserialize_current_record_to_durable_model(record, current_model, durable_model): """ Utility function that will take a dynamo event record and turn it into the proper pynamo object. This will properly deserialize the ugly Dynamo datatypes away. :param record: :param current_model: :param ...
[ "def", "deserialize_current_record_to_durable_model", "(", "record", ",", "current_model", ",", "durable_model", ")", ":", "# Was the item in question too big for SNS? If so, then we need to fetch the item from the current Dynamo table:", "if", "record", ".", "get", "(", "EVENT_TOO_B...
Utility function that will take a dynamo event record and turn it into the proper pynamo object. This will properly deserialize the ugly Dynamo datatypes away. :param record: :param current_model: :param durable_model: :return:
[ "Utility", "function", "that", "will", "take", "a", "dynamo", "event", "record", "and", "turn", "it", "into", "the", "proper", "pynamo", "object", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/dynamodb.py#L168-L203
4,164
Netflix-Skunkworks/historical
historical/common/dynamodb.py
deserialize_current_record_to_current_model
def deserialize_current_record_to_current_model(record, current_model): """ Utility function that will take a Dynamo event record and turn it into the proper Current Dynamo object. This will remove the "current table" specific fields, and properly deserialize the ugly Dynamo datatypes away. :param reco...
python
def deserialize_current_record_to_current_model(record, current_model): """ Utility function that will take a Dynamo event record and turn it into the proper Current Dynamo object. This will remove the "current table" specific fields, and properly deserialize the ugly Dynamo datatypes away. :param reco...
[ "def", "deserialize_current_record_to_current_model", "(", "record", ",", "current_model", ")", ":", "# Was the item in question too big for SNS? If so, then we need to fetch the item from the current Dynamo table:", "if", "record", ".", "get", "(", "EVENT_TOO_BIG_FLAG", ")", ":", ...
Utility function that will take a Dynamo event record and turn it into the proper Current Dynamo object. This will remove the "current table" specific fields, and properly deserialize the ugly Dynamo datatypes away. :param record: :param current_model: :return:
[ "Utility", "function", "that", "will", "take", "a", "Dynamo", "event", "record", "and", "turn", "it", "into", "the", "proper", "Current", "Dynamo", "object", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/dynamodb.py#L206-L226
4,165
Netflix-Skunkworks/historical
historical/common/dynamodb.py
deserialize_durable_record_to_durable_model
def deserialize_durable_record_to_durable_model(record, durable_model): """ Utility function that will take a Dynamo event record and turn it into the proper Durable Dynamo object. This will properly deserialize the ugly Dynamo datatypes away. :param record: :param durable_model: :return: "...
python
def deserialize_durable_record_to_durable_model(record, durable_model): """ Utility function that will take a Dynamo event record and turn it into the proper Durable Dynamo object. This will properly deserialize the ugly Dynamo datatypes away. :param record: :param durable_model: :return: "...
[ "def", "deserialize_durable_record_to_durable_model", "(", "record", ",", "durable_model", ")", ":", "# Was the item in question too big for SNS? If so, then we need to fetch the item from the current Dynamo table:", "if", "record", ".", "get", "(", "EVENT_TOO_BIG_FLAG", ")", ":", ...
Utility function that will take a Dynamo event record and turn it into the proper Durable Dynamo object. This will properly deserialize the ugly Dynamo datatypes away. :param record: :param durable_model: :return:
[ "Utility", "function", "that", "will", "take", "a", "Dynamo", "event", "record", "and", "turn", "it", "into", "the", "proper", "Durable", "Dynamo", "object", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/dynamodb.py#L229-L251
4,166
Netflix-Skunkworks/historical
historical/common/dynamodb.py
deserialize_durable_record_to_current_model
def deserialize_durable_record_to_current_model(record, current_model): """ Utility function that will take a Durable Dynamo event record and turn it into the proper Current Dynamo object. This will properly deserialize the ugly Dynamo datatypes away. :param record: :param current_model: :retur...
python
def deserialize_durable_record_to_current_model(record, current_model): """ Utility function that will take a Durable Dynamo event record and turn it into the proper Current Dynamo object. This will properly deserialize the ugly Dynamo datatypes away. :param record: :param current_model: :retur...
[ "def", "deserialize_durable_record_to_current_model", "(", "record", ",", "current_model", ")", ":", "# Was the item in question too big for SNS? If so, then we need to fetch the item from the current Dynamo table:", "if", "record", ".", "get", "(", "EVENT_TOO_BIG_FLAG", ")", ":", ...
Utility function that will take a Durable Dynamo event record and turn it into the proper Current Dynamo object. This will properly deserialize the ugly Dynamo datatypes away. :param record: :param current_model: :return:
[ "Utility", "function", "that", "will", "take", "a", "Durable", "Dynamo", "event", "record", "and", "turn", "it", "into", "the", "proper", "Current", "Dynamo", "object", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/dynamodb.py#L254-L275
4,167
Netflix-Skunkworks/historical
historical/models.py
HistoricalPollerTaskEventModel.serialize_me
def serialize_me(self, account_id, region, next_token=None): """Dumps the proper JSON for the schema. :param account_id: :param region: :param next_token: :return: """ payload = { 'account_id': account_id, 'region': region } ...
python
def serialize_me(self, account_id, region, next_token=None): """Dumps the proper JSON for the schema. :param account_id: :param region: :param next_token: :return: """ payload = { 'account_id': account_id, 'region': region } ...
[ "def", "serialize_me", "(", "self", ",", "account_id", ",", "region", ",", "next_token", "=", "None", ")", ":", "payload", "=", "{", "'account_id'", ":", "account_id", ",", "'region'", ":", "region", "}", "if", "next_token", ":", "payload", "[", "'next_tok...
Dumps the proper JSON for the schema. :param account_id: :param region: :param next_token: :return:
[ "Dumps", "the", "proper", "JSON", "for", "the", "schema", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/models.py#L136-L152
4,168
Netflix-Skunkworks/historical
historical/models.py
SimpleDurableSchema.serialize_me
def serialize_me(self, arn, event_time, tech, item=None): """Dumps the proper JSON for the schema. If the event is too big, then don't include the item. :param arn: :param event_time: :param tech: :param item: :return: """ payload = { 'arn': a...
python
def serialize_me(self, arn, event_time, tech, item=None): """Dumps the proper JSON for the schema. If the event is too big, then don't include the item. :param arn: :param event_time: :param tech: :param item: :return: """ payload = { 'arn': a...
[ "def", "serialize_me", "(", "self", ",", "arn", ",", "event_time", ",", "tech", ",", "item", "=", "None", ")", ":", "payload", "=", "{", "'arn'", ":", "arn", ",", "'event_time'", ":", "event_time", ",", "'tech'", ":", "tech", "}", "if", "item", ":", ...
Dumps the proper JSON for the schema. If the event is too big, then don't include the item. :param arn: :param event_time: :param tech: :param item: :return:
[ "Dumps", "the", "proper", "JSON", "for", "the", "schema", ".", "If", "the", "event", "is", "too", "big", "then", "don", "t", "include", "the", "item", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/models.py#L169-L190
4,169
Netflix-Skunkworks/historical
historical/attributes.py
fix_decimals
def fix_decimals(obj): """Removes the stupid Decimals See: https://github.com/boto/boto3/issues/369#issuecomment-302137290 """ if isinstance(obj, list): for i in range(len(obj)): obj[i] = fix_decimals(obj[i]) return obj elif isinstance(obj, dict): for key, value...
python
def fix_decimals(obj): """Removes the stupid Decimals See: https://github.com/boto/boto3/issues/369#issuecomment-302137290 """ if isinstance(obj, list): for i in range(len(obj)): obj[i] = fix_decimals(obj[i]) return obj elif isinstance(obj, dict): for key, value...
[ "def", "fix_decimals", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "list", ")", ":", "for", "i", "in", "range", "(", "len", "(", "obj", ")", ")", ":", "obj", "[", "i", "]", "=", "fix_decimals", "(", "obj", "[", "i", "]", ")", "...
Removes the stupid Decimals See: https://github.com/boto/boto3/issues/369#issuecomment-302137290
[ "Removes", "the", "stupid", "Decimals" ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/attributes.py#L62-L84
4,170
Netflix-Skunkworks/historical
historical/attributes.py
EventTimeAttribute.serialize
def serialize(self, value): """Takes a datetime object and returns a string""" if isinstance(value, str): return value return value.strftime(DATETIME_FORMAT)
python
def serialize(self, value): """Takes a datetime object and returns a string""" if isinstance(value, str): return value return value.strftime(DATETIME_FORMAT)
[ "def", "serialize", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "str", ")", ":", "return", "value", "return", "value", ".", "strftime", "(", "DATETIME_FORMAT", ")" ]
Takes a datetime object and returns a string
[ "Takes", "a", "datetime", "object", "and", "returns", "a", "string" ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/attributes.py#L45-L49
4,171
Netflix-Skunkworks/historical
historical/common/util.py
pull_tag_dict
def pull_tag_dict(data): """This will pull out a list of Tag Name-Value objects, and return it as a dictionary. :param data: The dict collected from the collector. :returns dict: A dict of the tag names and their corresponding values. """ # If there are tags, set them to a normal dict, vs. a list o...
python
def pull_tag_dict(data): """This will pull out a list of Tag Name-Value objects, and return it as a dictionary. :param data: The dict collected from the collector. :returns dict: A dict of the tag names and their corresponding values. """ # If there are tags, set them to a normal dict, vs. a list o...
[ "def", "pull_tag_dict", "(", "data", ")", ":", "# If there are tags, set them to a normal dict, vs. a list of dicts:", "tags", "=", "data", ".", "pop", "(", "'Tags'", ",", "{", "}", ")", "or", "{", "}", "if", "tags", ":", "proper_tags", "=", "{", "}", "for", ...
This will pull out a list of Tag Name-Value objects, and return it as a dictionary. :param data: The dict collected from the collector. :returns dict: A dict of the tag names and their corresponding values.
[ "This", "will", "pull", "out", "a", "list", "of", "Tag", "Name", "-", "Value", "objects", "and", "return", "it", "as", "a", "dictionary", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/util.py#L39-L54
4,172
Netflix-Skunkworks/historical
historical/s3/collector.py
create_delete_model
def create_delete_model(record): """Create an S3 model from a record.""" arn = f"arn:aws:s3:::{cloudwatch.filter_request_parameters('bucketName', record)}" LOG.debug(f'[-] Deleting Dynamodb Records. Hash Key: {arn}') data = { 'arn': arn, 'principalId': cloudwatch.get_principal(record), ...
python
def create_delete_model(record): """Create an S3 model from a record.""" arn = f"arn:aws:s3:::{cloudwatch.filter_request_parameters('bucketName', record)}" LOG.debug(f'[-] Deleting Dynamodb Records. Hash Key: {arn}') data = { 'arn': arn, 'principalId': cloudwatch.get_principal(record), ...
[ "def", "create_delete_model", "(", "record", ")", ":", "arn", "=", "f\"arn:aws:s3:::{cloudwatch.filter_request_parameters('bucketName', record)}\"", "LOG", ".", "debug", "(", "f'[-] Deleting Dynamodb Records. Hash Key: {arn}'", ")", "data", "=", "{", "'arn'", ":", "arn", ",...
Create an S3 model from a record.
[ "Create", "an", "S3", "model", "from", "a", "record", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/s3/collector.py#L55-L74
4,173
Netflix-Skunkworks/historical
historical/s3/collector.py
process_delete_records
def process_delete_records(delete_records): """Process the requests for S3 bucket deletions""" for rec in delete_records: arn = f"arn:aws:s3:::{rec['detail']['requestParameters']['bucketName']}" # Need to check if the event is NEWER than the previous event in case # events are out of or...
python
def process_delete_records(delete_records): """Process the requests for S3 bucket deletions""" for rec in delete_records: arn = f"arn:aws:s3:::{rec['detail']['requestParameters']['bucketName']}" # Need to check if the event is NEWER than the previous event in case # events are out of or...
[ "def", "process_delete_records", "(", "delete_records", ")", ":", "for", "rec", "in", "delete_records", ":", "arn", "=", "f\"arn:aws:s3:::{rec['detail']['requestParameters']['bucketName']}\"", "# Need to check if the event is NEWER than the previous event in case", "# events are out of...
Process the requests for S3 bucket deletions
[ "Process", "the", "requests", "for", "S3", "bucket", "deletions" ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/s3/collector.py#L77-L96
4,174
Netflix-Skunkworks/historical
historical/s3/collector.py
process_update_records
def process_update_records(update_records): """Process the requests for S3 bucket update requests""" events = sorted(update_records, key=lambda x: x['account']) # Group records by account for more efficient processing for account_id, events in groupby(events, lambda x: x['account']): events = l...
python
def process_update_records(update_records): """Process the requests for S3 bucket update requests""" events = sorted(update_records, key=lambda x: x['account']) # Group records by account for more efficient processing for account_id, events in groupby(events, lambda x: x['account']): events = l...
[ "def", "process_update_records", "(", "update_records", ")", ":", "events", "=", "sorted", "(", "update_records", ",", "key", "=", "lambda", "x", ":", "x", "[", "'account'", "]", ")", "# Group records by account for more efficient processing", "for", "account_id", "...
Process the requests for S3 bucket update requests
[ "Process", "the", "requests", "for", "S3", "bucket", "update", "requests" ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/s3/collector.py#L99-L179
4,175
Netflix-Skunkworks/historical
historical/s3/collector.py
handler
def handler(event, context): # pylint: disable=W0613 """ Historical S3 event collector. This collector is responsible for processing CloudWatch events and polling events. """ records = deserialize_records(event['Records']) # Split records into two groups, update and delete. # We don't wan...
python
def handler(event, context): # pylint: disable=W0613 """ Historical S3 event collector. This collector is responsible for processing CloudWatch events and polling events. """ records = deserialize_records(event['Records']) # Split records into two groups, update and delete. # We don't wan...
[ "def", "handler", "(", "event", ",", "context", ")", ":", "# pylint: disable=W0613", "records", "=", "deserialize_records", "(", "event", "[", "'Records'", "]", ")", "# Split records into two groups, update and delete.", "# We don't want to query for deleted records.", "updat...
Historical S3 event collector. This collector is responsible for processing CloudWatch events and polling events.
[ "Historical", "S3", "event", "collector", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/s3/collector.py#L183-L203
4,176
Netflix-Skunkworks/historical
historical/common/accounts.py
get_historical_accounts
def get_historical_accounts(): """Fetches valid accounts from SWAG if enabled or a list accounts.""" if os.environ.get('SWAG_BUCKET', False): swag_opts = { 'swag.type': 's3', 'swag.bucket_name': os.environ['SWAG_BUCKET'], 'swag.data_file': os.environ.get('SWAG_DATA_FI...
python
def get_historical_accounts(): """Fetches valid accounts from SWAG if enabled or a list accounts.""" if os.environ.get('SWAG_BUCKET', False): swag_opts = { 'swag.type': 's3', 'swag.bucket_name': os.environ['SWAG_BUCKET'], 'swag.data_file': os.environ.get('SWAG_DATA_FI...
[ "def", "get_historical_accounts", "(", ")", ":", "if", "os", ".", "environ", ".", "get", "(", "'SWAG_BUCKET'", ",", "False", ")", ":", "swag_opts", "=", "{", "'swag.type'", ":", "'s3'", ",", "'swag.bucket_name'", ":", "os", ".", "environ", "[", "'SWAG_BUCK...
Fetches valid accounts from SWAG if enabled or a list accounts.
[ "Fetches", "valid", "accounts", "from", "SWAG", "if", "enabled", "or", "a", "list", "accounts", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/accounts.py#L26-L47
4,177
Netflix-Skunkworks/historical
historical/s3/poller.py
poller_processor_handler
def poller_processor_handler(event, context): # pylint: disable=W0613 """ Historical S3 Poller Processor. This will receive events from the Poller Tasker, and will list all objects of a given technology for an account/region pair. This will generate `polling events` which simulate changes. These polli...
python
def poller_processor_handler(event, context): # pylint: disable=W0613 """ Historical S3 Poller Processor. This will receive events from the Poller Tasker, and will list all objects of a given technology for an account/region pair. This will generate `polling events` which simulate changes. These polli...
[ "def", "poller_processor_handler", "(", "event", ",", "context", ")", ":", "# pylint: disable=W0613", "LOG", ".", "debug", "(", "'[@] Running Poller...'", ")", "queue_url", "=", "get_queue_url", "(", "os", ".", "environ", ".", "get", "(", "'POLLER_QUEUE_NAME'", ",...
Historical S3 Poller Processor. This will receive events from the Poller Tasker, and will list all objects of a given technology for an account/region pair. This will generate `polling events` which simulate changes. These polling events contain configuration data such as the account/region defining where ...
[ "Historical", "S3", "Poller", "Processor", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/s3/poller.py#L58-L87
4,178
Netflix-Skunkworks/historical
historical/common/proxy.py
detect_global_table_updates
def detect_global_table_updates(record): """This will detect DDB Global Table updates that are not relevant to application data updates. These need to be skipped over as they are pure noise. :param record: :return: """ # This only affects MODIFY events. if record['eventName'] == 'MODIFY'...
python
def detect_global_table_updates(record): """This will detect DDB Global Table updates that are not relevant to application data updates. These need to be skipped over as they are pure noise. :param record: :return: """ # This only affects MODIFY events. if record['eventName'] == 'MODIFY'...
[ "def", "detect_global_table_updates", "(", "record", ")", ":", "# This only affects MODIFY events.", "if", "record", "[", "'eventName'", "]", "==", "'MODIFY'", ":", "# Need to compare the old and new images to check for GT specific changes only (just pop off the GT fields)", "old_ima...
This will detect DDB Global Table updates that are not relevant to application data updates. These need to be skipped over as they are pure noise. :param record: :return:
[ "This", "will", "detect", "DDB", "Global", "Table", "updates", "that", "are", "not", "relevant", "to", "application", "data", "updates", ".", "These", "need", "to", "be", "skipped", "over", "as", "they", "are", "pure", "noise", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/proxy.py#L126-L142
4,179
Netflix-Skunkworks/historical
historical/s3/differ.py
handler
def handler(event, context): # pylint: disable=W0613 """ Historical S3 event differ. Listens to the Historical current table and determines if there are differences that need to be persisted in the historical record. """ # De-serialize the records: records = deserialize_records(event['Reco...
python
def handler(event, context): # pylint: disable=W0613 """ Historical S3 event differ. Listens to the Historical current table and determines if there are differences that need to be persisted in the historical record. """ # De-serialize the records: records = deserialize_records(event['Reco...
[ "def", "handler", "(", "event", ",", "context", ")", ":", "# pylint: disable=W0613", "# De-serialize the records:", "records", "=", "deserialize_records", "(", "event", "[", "'Records'", "]", ")", "for", "record", "in", "records", ":", "process_dynamodb_differ_record"...
Historical S3 event differ. Listens to the Historical current table and determines if there are differences that need to be persisted in the historical record.
[ "Historical", "S3", "event", "differ", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/s3/differ.py#L26-L37
4,180
Netflix-Skunkworks/historical
historical/cli.py
new
def new(): """Creates a new historical technology.""" dir_path = os.path.dirname(os.path.realpath(__file__)) cookiecutter(os.path.join(dir_path, 'historical-cookiecutter/'))
python
def new(): """Creates a new historical technology.""" dir_path = os.path.dirname(os.path.realpath(__file__)) cookiecutter(os.path.join(dir_path, 'historical-cookiecutter/'))
[ "def", "new", "(", ")", ":", "dir_path", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", "cookiecutter", "(", "os", ".", "path", ".", "join", "(", "dir_path", ",", "'historical-cookiecutter/'"...
Creates a new historical technology.
[ "Creates", "a", "new", "historical", "technology", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/cli.py#L30-L33
4,181
Netflix-Skunkworks/historical
historical/vpc/poller.py
poller_tasker_handler
def poller_tasker_handler(event, context): # pylint: disable=W0613 """ Historical VPC Poller Tasker. The Poller is run at a set interval in order to ensure that changes do not go undetected by Historical. Historical pollers generate `polling events` which simulate changes. These polling events contai...
python
def poller_tasker_handler(event, context): # pylint: disable=W0613 """ Historical VPC Poller Tasker. The Poller is run at a set interval in order to ensure that changes do not go undetected by Historical. Historical pollers generate `polling events` which simulate changes. These polling events contai...
[ "def", "poller_tasker_handler", "(", "event", ",", "context", ")", ":", "# pylint: disable=W0613", "LOG", ".", "debug", "(", "'[@] Running Poller Tasker...'", ")", "queue_url", "=", "get_queue_url", "(", "os", ".", "environ", ".", "get", "(", "'POLLER_TASKER_QUEUE_N...
Historical VPC Poller Tasker. The Poller is run at a set interval in order to ensure that changes do not go undetected by Historical. Historical pollers generate `polling events` which simulate changes. These polling events contain configuration data such as the account/region defining where the collector...
[ "Historical", "VPC", "Poller", "Tasker", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/vpc/poller.py#L30-L57
4,182
Netflix-Skunkworks/historical
historical/common/sqs.py
chunks
def chunks(event_list, chunk_size): """Yield successive n-sized chunks from the event list.""" for i in range(0, len(event_list), chunk_size): yield event_list[i:i + chunk_size]
python
def chunks(event_list, chunk_size): """Yield successive n-sized chunks from the event list.""" for i in range(0, len(event_list), chunk_size): yield event_list[i:i + chunk_size]
[ "def", "chunks", "(", "event_list", ",", "chunk_size", ")", ":", "for", "i", "in", "range", "(", "0", ",", "len", "(", "event_list", ")", ",", "chunk_size", ")", ":", "yield", "event_list", "[", "i", ":", "i", "+", "chunk_size", "]" ]
Yield successive n-sized chunks from the event list.
[ "Yield", "successive", "n", "-", "sized", "chunks", "from", "the", "event", "list", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/sqs.py#L21-L24
4,183
Netflix-Skunkworks/historical
historical/common/sqs.py
get_queue_url
def get_queue_url(queue_name): """Get the URL of the SQS queue to send events to.""" client = boto3.client("sqs", CURRENT_REGION) queue = client.get_queue_url(QueueName=queue_name) return queue["QueueUrl"]
python
def get_queue_url(queue_name): """Get the URL of the SQS queue to send events to.""" client = boto3.client("sqs", CURRENT_REGION) queue = client.get_queue_url(QueueName=queue_name) return queue["QueueUrl"]
[ "def", "get_queue_url", "(", "queue_name", ")", ":", "client", "=", "boto3", ".", "client", "(", "\"sqs\"", ",", "CURRENT_REGION", ")", "queue", "=", "client", ".", "get_queue_url", "(", "QueueName", "=", "queue_name", ")", "return", "queue", "[", "\"QueueUr...
Get the URL of the SQS queue to send events to.
[ "Get", "the", "URL", "of", "the", "SQS", "queue", "to", "send", "events", "to", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/sqs.py#L27-L32
4,184
Netflix-Skunkworks/historical
historical/common/sqs.py
produce_events
def produce_events(events, queue_url, batch_size=10, randomize_delay=0): """ Efficiently sends events to the SQS event queue. Note: SQS has a max size of 10 items. Please be aware that this can make the messages go past size -- even with shrinking messages! Events can get randomized delays, maxim...
python
def produce_events(events, queue_url, batch_size=10, randomize_delay=0): """ Efficiently sends events to the SQS event queue. Note: SQS has a max size of 10 items. Please be aware that this can make the messages go past size -- even with shrinking messages! Events can get randomized delays, maxim...
[ "def", "produce_events", "(", "events", ",", "queue_url", ",", "batch_size", "=", "10", ",", "randomize_delay", "=", "0", ")", ":", "client", "=", "boto3", ".", "client", "(", "'sqs'", ",", "region_name", "=", "CURRENT_REGION", ")", "for", "chunk", "in", ...
Efficiently sends events to the SQS event queue. Note: SQS has a max size of 10 items. Please be aware that this can make the messages go past size -- even with shrinking messages! Events can get randomized delays, maximum of 900 seconds. Set that in `randomize_delay` :param events: :param queue_...
[ "Efficiently", "sends", "events", "to", "the", "SQS", "event", "queue", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/sqs.py#L55-L73
4,185
Netflix-Skunkworks/historical
historical/security_group/collector.py
describe_group
def describe_group(record, region): """Attempts to describe group ids.""" account_id = record['account'] group_name = cloudwatch.filter_request_parameters('groupName', record) vpc_id = cloudwatch.filter_request_parameters('vpcId', record) group_id = cloudwatch.filter_request_parameters('groupId', r...
python
def describe_group(record, region): """Attempts to describe group ids.""" account_id = record['account'] group_name = cloudwatch.filter_request_parameters('groupName', record) vpc_id = cloudwatch.filter_request_parameters('vpcId', record) group_id = cloudwatch.filter_request_parameters('groupId', r...
[ "def", "describe_group", "(", "record", ",", "region", ")", ":", "account_id", "=", "record", "[", "'account'", "]", "group_name", "=", "cloudwatch", ".", "filter_request_parameters", "(", "'groupName'", ",", "record", ")", "vpc_id", "=", "cloudwatch", ".", "f...
Attempts to describe group ids.
[ "Attempts", "to", "describe", "group", "ids", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/security_group/collector.py#L47-L92
4,186
Netflix-Skunkworks/historical
historical/security_group/collector.py
create_delete_model
def create_delete_model(record): """Create a security group model from a record.""" data = cloudwatch.get_historical_base_info(record) group_id = cloudwatch.filter_request_parameters('groupId', record) # vpc_id = cloudwatch.filter_request_parameters('vpcId', record) # group_name = cloudwatch.filter...
python
def create_delete_model(record): """Create a security group model from a record.""" data = cloudwatch.get_historical_base_info(record) group_id = cloudwatch.filter_request_parameters('groupId', record) # vpc_id = cloudwatch.filter_request_parameters('vpcId', record) # group_name = cloudwatch.filter...
[ "def", "create_delete_model", "(", "record", ")", ":", "data", "=", "cloudwatch", ".", "get_historical_base_info", "(", "record", ")", "group_id", "=", "cloudwatch", ".", "filter_request_parameters", "(", "'groupId'", ",", "record", ")", "# vpc_id = cloudwatch.filter_...
Create a security group model from a record.
[ "Create", "a", "security", "group", "model", "from", "a", "record", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/security_group/collector.py#L95-L119
4,187
Netflix-Skunkworks/historical
historical/constants.py
extract_log_level_from_environment
def extract_log_level_from_environment(k, default): """Gets the log level from the environment variable.""" return LOG_LEVELS.get(os.environ.get(k)) or int(os.environ.get(k, default))
python
def extract_log_level_from_environment(k, default): """Gets the log level from the environment variable.""" return LOG_LEVELS.get(os.environ.get(k)) or int(os.environ.get(k, default))
[ "def", "extract_log_level_from_environment", "(", "k", ",", "default", ")", ":", "return", "LOG_LEVELS", ".", "get", "(", "os", ".", "environ", ".", "get", "(", "k", ")", ")", "or", "int", "(", "os", ".", "environ", ".", "get", "(", "k", ",", "defaul...
Gets the log level from the environment variable.
[ "Gets", "the", "log", "level", "from", "the", "environment", "variable", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/constants.py#L21-L23
4,188
Netflix-Skunkworks/historical
historical/common/cloudwatch.py
filter_request_parameters
def filter_request_parameters(field_name, msg, look_in_response=False): """ From an event, extract the field name from the message. Different API calls put this information in different places, so check a few places. """ val = msg['detail'].get(field_name, None) try: if not val: ...
python
def filter_request_parameters(field_name, msg, look_in_response=False): """ From an event, extract the field name from the message. Different API calls put this information in different places, so check a few places. """ val = msg['detail'].get(field_name, None) try: if not val: ...
[ "def", "filter_request_parameters", "(", "field_name", ",", "msg", ",", "look_in_response", "=", "False", ")", ":", "val", "=", "msg", "[", "'detail'", "]", ".", "get", "(", "field_name", ",", "None", ")", "try", ":", "if", "not", "val", ":", "val", "=...
From an event, extract the field name from the message. Different API calls put this information in different places, so check a few places.
[ "From", "an", "event", "extract", "the", "field", "name", "from", "the", "message", ".", "Different", "API", "calls", "put", "this", "information", "in", "different", "places", "so", "check", "a", "few", "places", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/cloudwatch.py#L14-L33
4,189
Netflix-Skunkworks/historical
historical/common/cloudwatch.py
get_historical_base_info
def get_historical_base_info(event): """Gets the base details from the CloudWatch Event.""" data = { 'principalId': get_principal(event), 'userIdentity': get_user_identity(event), 'accountId': event['account'], 'userAgent': event['detail'].get('userAgent'), 'sourceIpAddre...
python
def get_historical_base_info(event): """Gets the base details from the CloudWatch Event.""" data = { 'principalId': get_principal(event), 'userIdentity': get_user_identity(event), 'accountId': event['account'], 'userAgent': event['detail'].get('userAgent'), 'sourceIpAddre...
[ "def", "get_historical_base_info", "(", "event", ")", ":", "data", "=", "{", "'principalId'", ":", "get_principal", "(", "event", ")", ",", "'userIdentity'", ":", "get_user_identity", "(", "event", ")", ",", "'accountId'", ":", "event", "[", "'account'", "]", ...
Gets the base details from the CloudWatch Event.
[ "Gets", "the", "base", "details", "from", "the", "CloudWatch", "Event", "." ]
c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/cloudwatch.py#L67-L87
4,190
desbma/GoogleSpeech
google_speech/__init__.py
Speech.splitText
def splitText(text): """ Split text into sub segments of size not bigger than MAX_SEGMENT_SIZE. """ segments = [] remaining_text = __class__.cleanSpaces(text) while len(remaining_text) > __class__.MAX_SEGMENT_SIZE: cur_text = remaining_text[:__class__.MAX_SEGMENT_SIZE] # try to split at pu...
python
def splitText(text): """ Split text into sub segments of size not bigger than MAX_SEGMENT_SIZE. """ segments = [] remaining_text = __class__.cleanSpaces(text) while len(remaining_text) > __class__.MAX_SEGMENT_SIZE: cur_text = remaining_text[:__class__.MAX_SEGMENT_SIZE] # try to split at pu...
[ "def", "splitText", "(", "text", ")", ":", "segments", "=", "[", "]", "remaining_text", "=", "__class__", ".", "cleanSpaces", "(", "text", ")", "while", "len", "(", "remaining_text", ")", ">", "__class__", ".", "MAX_SEGMENT_SIZE", ":", "cur_text", "=", "re...
Split text into sub segments of size not bigger than MAX_SEGMENT_SIZE.
[ "Split", "text", "into", "sub", "segments", "of", "size", "not", "bigger", "than", "MAX_SEGMENT_SIZE", "." ]
6d3ec62dc26400ccb4f2e77b8ccd4cb416141233
https://github.com/desbma/GoogleSpeech/blob/6d3ec62dc26400ccb4f2e77b8ccd4cb416141233/google_speech/__init__.py#L99-L130
4,191
desbma/GoogleSpeech
google_speech/__init__.py
Speech.play
def play(self, sox_effects=()): """ Play a speech. """ # build the segments preloader_threads = [] if self.text != "-": segments = list(self) # start preloader thread(s) preloader_threads = [PreloaderThread(name="PreloaderThread-%u" % (i)) for i in range(PRELOADER_THREAD_COUNT)] ...
python
def play(self, sox_effects=()): """ Play a speech. """ # build the segments preloader_threads = [] if self.text != "-": segments = list(self) # start preloader thread(s) preloader_threads = [PreloaderThread(name="PreloaderThread-%u" % (i)) for i in range(PRELOADER_THREAD_COUNT)] ...
[ "def", "play", "(", "self", ",", "sox_effects", "=", "(", ")", ")", ":", "# build the segments", "preloader_threads", "=", "[", "]", "if", "self", ".", "text", "!=", "\"-\"", ":", "segments", "=", "list", "(", "self", ")", "# start preloader thread(s)", "p...
Play a speech.
[ "Play", "a", "speech", "." ]
6d3ec62dc26400ccb4f2e77b8ccd4cb416141233
https://github.com/desbma/GoogleSpeech/blob/6d3ec62dc26400ccb4f2e77b8ccd4cb416141233/google_speech/__init__.py#L138-L160
4,192
desbma/GoogleSpeech
google_speech/__init__.py
SpeechSegment.isInCache
def isInCache(self): """ Return True if audio data for this segment is present in cache, False otherwise. """ url = self.buildUrl(cache_friendly=True) return url in __class__.cache
python
def isInCache(self): """ Return True if audio data for this segment is present in cache, False otherwise. """ url = self.buildUrl(cache_friendly=True) return url in __class__.cache
[ "def", "isInCache", "(", "self", ")", ":", "url", "=", "self", ".", "buildUrl", "(", "cache_friendly", "=", "True", ")", "return", "url", "in", "__class__", ".", "cache" ]
Return True if audio data for this segment is present in cache, False otherwise.
[ "Return", "True", "if", "audio", "data", "for", "this", "segment", "is", "present", "in", "cache", "False", "otherwise", "." ]
6d3ec62dc26400ccb4f2e77b8ccd4cb416141233
https://github.com/desbma/GoogleSpeech/blob/6d3ec62dc26400ccb4f2e77b8ccd4cb416141233/google_speech/__init__.py#L207-L210
4,193
desbma/GoogleSpeech
google_speech/__init__.py
SpeechSegment.preLoad
def preLoad(self): """ Store audio data in cache for fast playback. """ logging.getLogger().debug("Preloading segment '%s'" % (self)) real_url = self.buildUrl() cache_url = self.buildUrl(cache_friendly=True) audio_data = self.download(real_url) assert(audio_data) __class__.cache[cache_url] =...
python
def preLoad(self): """ Store audio data in cache for fast playback. """ logging.getLogger().debug("Preloading segment '%s'" % (self)) real_url = self.buildUrl() cache_url = self.buildUrl(cache_friendly=True) audio_data = self.download(real_url) assert(audio_data) __class__.cache[cache_url] =...
[ "def", "preLoad", "(", "self", ")", ":", "logging", ".", "getLogger", "(", ")", ".", "debug", "(", "\"Preloading segment '%s'\"", "%", "(", "self", ")", ")", "real_url", "=", "self", ".", "buildUrl", "(", ")", "cache_url", "=", "self", ".", "buildUrl", ...
Store audio data in cache for fast playback.
[ "Store", "audio", "data", "in", "cache", "for", "fast", "playback", "." ]
6d3ec62dc26400ccb4f2e77b8ccd4cb416141233
https://github.com/desbma/GoogleSpeech/blob/6d3ec62dc26400ccb4f2e77b8ccd4cb416141233/google_speech/__init__.py#L212-L219
4,194
desbma/GoogleSpeech
google_speech/__init__.py
SpeechSegment.getAudioData
def getAudioData(self): """ Fetch the audio data. """ with self.preload_mutex: cache_url = self.buildUrl(cache_friendly=True) if cache_url in __class__.cache: logging.getLogger().debug("Got data for URL '%s' from cache" % (cache_url)) audio_data = __class__.cache[cache_url] a...
python
def getAudioData(self): """ Fetch the audio data. """ with self.preload_mutex: cache_url = self.buildUrl(cache_friendly=True) if cache_url in __class__.cache: logging.getLogger().debug("Got data for URL '%s' from cache" % (cache_url)) audio_data = __class__.cache[cache_url] a...
[ "def", "getAudioData", "(", "self", ")", ":", "with", "self", ".", "preload_mutex", ":", "cache_url", "=", "self", ".", "buildUrl", "(", "cache_friendly", "=", "True", ")", "if", "cache_url", "in", "__class__", ".", "cache", ":", "logging", ".", "getLogger...
Fetch the audio data.
[ "Fetch", "the", "audio", "data", "." ]
6d3ec62dc26400ccb4f2e77b8ccd4cb416141233
https://github.com/desbma/GoogleSpeech/blob/6d3ec62dc26400ccb4f2e77b8ccd4cb416141233/google_speech/__init__.py#L221-L234
4,195
desbma/GoogleSpeech
google_speech/__init__.py
SpeechSegment.play
def play(self, sox_effects=()): """ Play the segment. """ audio_data = self.getAudioData() logging.getLogger().info("Playing speech segment (%s): '%s'" % (self.lang, self)) cmd = ["sox", "-q", "-t", "mp3", "-"] if sys.platform.startswith("win32"): cmd.extend(("-t", "waveaudio")) cmd.extend...
python
def play(self, sox_effects=()): """ Play the segment. """ audio_data = self.getAudioData() logging.getLogger().info("Playing speech segment (%s): '%s'" % (self.lang, self)) cmd = ["sox", "-q", "-t", "mp3", "-"] if sys.platform.startswith("win32"): cmd.extend(("-t", "waveaudio")) cmd.extend...
[ "def", "play", "(", "self", ",", "sox_effects", "=", "(", ")", ")", ":", "audio_data", "=", "self", ".", "getAudioData", "(", ")", "logging", ".", "getLogger", "(", ")", ".", "info", "(", "\"Playing speech segment (%s): '%s'\"", "%", "(", "self", ".", "l...
Play the segment.
[ "Play", "the", "segment", "." ]
6d3ec62dc26400ccb4f2e77b8ccd4cb416141233
https://github.com/desbma/GoogleSpeech/blob/6d3ec62dc26400ccb4f2e77b8ccd4cb416141233/google_speech/__init__.py#L236-L252
4,196
desbma/GoogleSpeech
google_speech/__init__.py
SpeechSegment.buildUrl
def buildUrl(self, cache_friendly=False): """ Construct the URL to get the sound from Goggle API. If cache_friendly is True, remove token from URL to use as a cache key. """ params = collections.OrderedDict() params["client"] = "tw-ob" params["ie"] = "UTF-8" params["idx"] = str(self.seg...
python
def buildUrl(self, cache_friendly=False): """ Construct the URL to get the sound from Goggle API. If cache_friendly is True, remove token from URL to use as a cache key. """ params = collections.OrderedDict() params["client"] = "tw-ob" params["ie"] = "UTF-8" params["idx"] = str(self.seg...
[ "def", "buildUrl", "(", "self", ",", "cache_friendly", "=", "False", ")", ":", "params", "=", "collections", ".", "OrderedDict", "(", ")", "params", "[", "\"client\"", "]", "=", "\"tw-ob\"", "params", "[", "\"ie\"", "]", "=", "\"UTF-8\"", "params", "[", ...
Construct the URL to get the sound from Goggle API. If cache_friendly is True, remove token from URL to use as a cache key.
[ "Construct", "the", "URL", "to", "get", "the", "sound", "from", "Goggle", "API", "." ]
6d3ec62dc26400ccb4f2e77b8ccd4cb416141233
https://github.com/desbma/GoogleSpeech/blob/6d3ec62dc26400ccb4f2e77b8ccd4cb416141233/google_speech/__init__.py#L254-L270
4,197
desbma/GoogleSpeech
google_speech/__init__.py
SpeechSegment.download
def download(self, url): """ Download a sound file. """ logging.getLogger().debug("Downloading '%s'..." % (url)) response = __class__.session.get(url, headers={"User-Agent": "Mozilla/5.0"}, timeout=3.1) response.raise_for_status()...
python
def download(self, url): """ Download a sound file. """ logging.getLogger().debug("Downloading '%s'..." % (url)) response = __class__.session.get(url, headers={"User-Agent": "Mozilla/5.0"}, timeout=3.1) response.raise_for_status()...
[ "def", "download", "(", "self", ",", "url", ")", ":", "logging", ".", "getLogger", "(", ")", ".", "debug", "(", "\"Downloading '%s'...\"", "%", "(", "url", ")", ")", "response", "=", "__class__", ".", "session", ".", "get", "(", "url", ",", "headers", ...
Download a sound file.
[ "Download", "a", "sound", "file", "." ]
6d3ec62dc26400ccb4f2e77b8ccd4cb416141233
https://github.com/desbma/GoogleSpeech/blob/6d3ec62dc26400ccb4f2e77b8ccd4cb416141233/google_speech/__init__.py#L272-L279
4,198
gtalarico/airtable-python-wrapper
airtable/params.py
_BaseObjectArrayParam.to_param_dict
def to_param_dict(self): """ Sorts to ensure Order is consistent for Testing """ param_dict = {} for index, dictionary in enumerate(self.value): for key, value in dictionary.items(): param_name = '{param_name}[{index}][{key}]'.format( ...
python
def to_param_dict(self): """ Sorts to ensure Order is consistent for Testing """ param_dict = {} for index, dictionary in enumerate(self.value): for key, value in dictionary.items(): param_name = '{param_name}[{index}][{key}]'.format( ...
[ "def", "to_param_dict", "(", "self", ")", ":", "param_dict", "=", "{", "}", "for", "index", ",", "dictionary", "in", "enumerate", "(", "self", ".", "value", ")", ":", "for", "key", ",", "value", "in", "dictionary", ".", "items", "(", ")", ":", "param...
Sorts to ensure Order is consistent for Testing
[ "Sorts", "to", "ensure", "Order", "is", "consistent", "for", "Testing" ]
48b2d806178085b52a31817571e5a1fc3dce4045
https://github.com/gtalarico/airtable-python-wrapper/blob/48b2d806178085b52a31817571e5a1fc3dce4045/airtable/params.py#L68-L78
4,199
gtalarico/airtable-python-wrapper
airtable/params.py
AirtableParams._get
def _get(cls, kwarg_name): """ Returns a Param Class Instance, by its kwarg or param name """ param_classes = cls._discover_params() try: param_class = param_classes[kwarg_name] except KeyError: raise ValueError('invalid param keyword {}'.format(kwarg_name))...
python
def _get(cls, kwarg_name): """ Returns a Param Class Instance, by its kwarg or param name """ param_classes = cls._discover_params() try: param_class = param_classes[kwarg_name] except KeyError: raise ValueError('invalid param keyword {}'.format(kwarg_name))...
[ "def", "_get", "(", "cls", ",", "kwarg_name", ")", ":", "param_classes", "=", "cls", ".", "_discover_params", "(", ")", "try", ":", "param_class", "=", "param_classes", "[", "kwarg_name", "]", "except", "KeyError", ":", "raise", "ValueError", "(", "'invalid ...
Returns a Param Class Instance, by its kwarg or param name
[ "Returns", "a", "Param", "Class", "Instance", "by", "its", "kwarg", "or", "param", "name" ]
48b2d806178085b52a31817571e5a1fc3dce4045
https://github.com/gtalarico/airtable-python-wrapper/blob/48b2d806178085b52a31817571e5a1fc3dce4045/airtable/params.py#L362-L370