repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
NASA-AMMOS/AIT-Core
ait/core/bin/ait_create_dirs.py
createDirStruct
def createDirStruct(paths, verbose=True): '''Loops ait.config._datapaths from AIT_CONFIG and creates a directory. Replaces year and doy with the respective year and day-of-year. If neither are given as arguments, current UTC day and year are used. Args: paths: [optional] list of di...
python
def createDirStruct(paths, verbose=True): '''Loops ait.config._datapaths from AIT_CONFIG and creates a directory. Replaces year and doy with the respective year and day-of-year. If neither are given as arguments, current UTC day and year are used. Args: paths: [optional] list of di...
[ "def", "createDirStruct", "(", "paths", ",", "verbose", "=", "True", ")", ":", "for", "k", ",", "path", "in", "paths", ".", "items", "(", ")", ":", "p", "=", "None", "try", ":", "pathlist", "=", "path", "if", "type", "(", "path", ")", "is", "list...
Loops ait.config._datapaths from AIT_CONFIG and creates a directory. Replaces year and doy with the respective year and day-of-year. If neither are given as arguments, current UTC day and year are used. Args: paths: [optional] list of directory paths you would like to create. ...
[ "Loops", "ait", ".", "config", ".", "_datapaths", "from", "AIT_CONFIG", "and", "creates", "a", "directory", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bin/ait_create_dirs.py#L129-L159
NASA-AMMOS/AIT-Core
ait/core/bsc.py
SocketStreamCapturer.capture_packet
def capture_packet(self): ''' Write packet data to the logger's log file. ''' data = self.socket.recv(self._buffer_size) for h in self.capture_handlers: h['reads'] += 1 h['data_read'] += len(data) d = data if 'pre_write_transforms' in h: ...
python
def capture_packet(self): ''' Write packet data to the logger's log file. ''' data = self.socket.recv(self._buffer_size) for h in self.capture_handlers: h['reads'] += 1 h['data_read'] += len(data) d = data if 'pre_write_transforms' in h: ...
[ "def", "capture_packet", "(", "self", ")", ":", "data", "=", "self", ".", "socket", ".", "recv", "(", "self", ".", "_buffer_size", ")", "for", "h", "in", "self", ".", "capture_handlers", ":", "h", "[", "'reads'", "]", "+=", "1", "h", "[", "'data_read...
Write packet data to the logger's log file.
[ "Write", "packet", "data", "to", "the", "logger", "s", "log", "file", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L209-L221
NASA-AMMOS/AIT-Core
ait/core/bsc.py
SocketStreamCapturer.clean_up
def clean_up(self): ''' Clean up the socket and log file handles. ''' self.socket.close() for h in self.capture_handlers: h['logger'].close()
python
def clean_up(self): ''' Clean up the socket and log file handles. ''' self.socket.close() for h in self.capture_handlers: h['logger'].close()
[ "def", "clean_up", "(", "self", ")", ":", "self", ".", "socket", ".", "close", "(", ")", "for", "h", "in", "self", ".", "capture_handlers", ":", "h", "[", "'logger'", "]", ".", "close", "(", ")" ]
Clean up the socket and log file handles.
[ "Clean", "up", "the", "socket", "and", "log", "file", "handles", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L223-L227
NASA-AMMOS/AIT-Core
ait/core/bsc.py
SocketStreamCapturer.socket_monitor_loop
def socket_monitor_loop(self): ''' Monitor the socket and log captured data. ''' try: while True: gevent.socket.wait_read(self.socket.fileno()) self._handle_log_rotations() self.capture_packet() finally: self.clean_up()
python
def socket_monitor_loop(self): ''' Monitor the socket and log captured data. ''' try: while True: gevent.socket.wait_read(self.socket.fileno()) self._handle_log_rotations() self.capture_packet() finally: self.clean_up()
[ "def", "socket_monitor_loop", "(", "self", ")", ":", "try", ":", "while", "True", ":", "gevent", ".", "socket", ".", "wait_read", "(", "self", ".", "socket", ".", "fileno", "(", ")", ")", "self", ".", "_handle_log_rotations", "(", ")", "self", ".", "ca...
Monitor the socket and log captured data.
[ "Monitor", "the", "socket", "and", "log", "captured", "data", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L229-L238
NASA-AMMOS/AIT-Core
ait/core/bsc.py
SocketStreamCapturer.add_handler
def add_handler(self, handler): ''' Add an additional handler Args: handler: A dictionary of handler configuration for the handler that should be added. See :func:`__init__` for details on valid parameters. ''' handler['logger'...
python
def add_handler(self, handler): ''' Add an additional handler Args: handler: A dictionary of handler configuration for the handler that should be added. See :func:`__init__` for details on valid parameters. ''' handler['logger'...
[ "def", "add_handler", "(", "self", ",", "handler", ")", ":", "handler", "[", "'logger'", "]", "=", "self", ".", "_get_logger", "(", "handler", ")", "handler", "[", "'reads'", "]", "=", "0", "handler", "[", "'data_read'", "]", "=", "0", "self", ".", "...
Add an additional handler Args: handler: A dictionary of handler configuration for the handler that should be added. See :func:`__init__` for details on valid parameters.
[ "Add", "an", "additional", "handler" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L240-L253
NASA-AMMOS/AIT-Core
ait/core/bsc.py
SocketStreamCapturer.remove_handler
def remove_handler(self, name): ''' Remove a handler given a name Note, if multiple handlers have the same name the last matching instance in the handler list will be removed. Args: name: The name of the handler to remove ''' index = None ...
python
def remove_handler(self, name): ''' Remove a handler given a name Note, if multiple handlers have the same name the last matching instance in the handler list will be removed. Args: name: The name of the handler to remove ''' index = None ...
[ "def", "remove_handler", "(", "self", ",", "name", ")", ":", "index", "=", "None", "for", "i", ",", "h", "in", "enumerate", "(", "self", ".", "capture_handlers", ")", ":", "if", "h", "[", "'name'", "]", "==", "name", ":", "index", "=", "i", "if", ...
Remove a handler given a name Note, if multiple handlers have the same name the last matching instance in the handler list will be removed. Args: name: The name of the handler to remove
[ "Remove", "a", "handler", "given", "a", "name" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L255-L272
NASA-AMMOS/AIT-Core
ait/core/bsc.py
SocketStreamCapturer.dump_handler_config_data
def dump_handler_config_data(self): ''' Return capture handler configuration data. Return a dictionary of capture handler configuration data of the form: .. code-block:: none [{ 'handler': <handler configuration dictionary>, 'log_file_path': <Path ...
python
def dump_handler_config_data(self): ''' Return capture handler configuration data. Return a dictionary of capture handler configuration data of the form: .. code-block:: none [{ 'handler': <handler configuration dictionary>, 'log_file_path': <Path ...
[ "def", "dump_handler_config_data", "(", "self", ")", ":", "ignored_keys", "=", "[", "'logger'", ",", "'log_rot_time'", ",", "'reads'", ",", "'data_read'", "]", "config_data", "=", "[", "]", "for", "h", "in", "self", ".", "capture_handlers", ":", "config_data",...
Return capture handler configuration data. Return a dictionary of capture handler configuration data of the form: .. code-block:: none [{ 'handler': <handler configuration dictionary>, 'log_file_path': <Path to the current log file that the logger ...
[ "Return", "capture", "handler", "configuration", "data", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L274-L308
NASA-AMMOS/AIT-Core
ait/core/bsc.py
SocketStreamCapturer.dump_all_handler_stats
def dump_all_handler_stats(self): ''' Return handler capture statistics Return a dictionary of capture handler statistics of the form: .. code-block:: none [{ 'name': The handler's name, 'reads': The number of packet reads this handler has received...
python
def dump_all_handler_stats(self): ''' Return handler capture statistics Return a dictionary of capture handler statistics of the form: .. code-block:: none [{ 'name': The handler's name, 'reads': The number of packet reads this handler has received...
[ "def", "dump_all_handler_stats", "(", "self", ")", ":", "stats", "=", "[", "]", "for", "h", "in", "self", ".", "capture_handlers", ":", "now", "=", "calendar", ".", "timegm", "(", "time", ".", "gmtime", "(", ")", ")", "rot_time", "=", "calendar", ".", ...
Return handler capture statistics Return a dictionary of capture handler statistics of the form: .. code-block:: none [{ 'name': The handler's name, 'reads': The number of packet reads this handler has received 'data_read_length': The tota...
[ "Return", "handler", "capture", "statistics" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L310-L342
NASA-AMMOS/AIT-Core
ait/core/bsc.py
SocketStreamCapturer._handle_log_rotations
def _handle_log_rotations(self): ''' Rotate each handler's log file if necessary ''' for h in self.capture_handlers: if self._should_rotate_log(h): self._rotate_log(h)
python
def _handle_log_rotations(self): ''' Rotate each handler's log file if necessary ''' for h in self.capture_handlers: if self._should_rotate_log(h): self._rotate_log(h)
[ "def", "_handle_log_rotations", "(", "self", ")", ":", "for", "h", "in", "self", ".", "capture_handlers", ":", "if", "self", ".", "_should_rotate_log", "(", "h", ")", ":", "self", ".", "_rotate_log", "(", "h", ")" ]
Rotate each handler's log file if necessary
[ "Rotate", "each", "handler", "s", "log", "file", "if", "necessary" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L344-L348
NASA-AMMOS/AIT-Core
ait/core/bsc.py
SocketStreamCapturer._should_rotate_log
def _should_rotate_log(self, handler): ''' Determine if a log file rotation is necessary ''' if handler['rotate_log']: rotate_time_index = handler.get('rotate_log_index', 'day') try: rotate_time_index = self._decode_time_rotation_index(rotate_time_index) ...
python
def _should_rotate_log(self, handler): ''' Determine if a log file rotation is necessary ''' if handler['rotate_log']: rotate_time_index = handler.get('rotate_log_index', 'day') try: rotate_time_index = self._decode_time_rotation_index(rotate_time_index) ...
[ "def", "_should_rotate_log", "(", "self", ",", "handler", ")", ":", "if", "handler", "[", "'rotate_log'", "]", ":", "rotate_time_index", "=", "handler", ".", "get", "(", "'rotate_log_index'", ",", "'day'", ")", "try", ":", "rotate_time_index", "=", "self", "...
Determine if a log file rotation is necessary
[ "Determine", "if", "a", "log", "file", "rotation", "is", "necessary" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L350-L377
NASA-AMMOS/AIT-Core
ait/core/bsc.py
SocketStreamCapturer._decode_time_rotation_index
def _decode_time_rotation_index(self, time_rot_index): ''' Return the time struct index to use for log rotation checks ''' time_index_decode_table = { 'year': 0, 'years': 0, 'tm_year': 0, 'month': 1, 'months': 1, 'tm_mon': 1, 'day': 2, 'days': 2, 'tm...
python
def _decode_time_rotation_index(self, time_rot_index): ''' Return the time struct index to use for log rotation checks ''' time_index_decode_table = { 'year': 0, 'years': 0, 'tm_year': 0, 'month': 1, 'months': 1, 'tm_mon': 1, 'day': 2, 'days': 2, 'tm...
[ "def", "_decode_time_rotation_index", "(", "self", ",", "time_rot_index", ")", ":", "time_index_decode_table", "=", "{", "'year'", ":", "0", ",", "'years'", ":", "0", ",", "'tm_year'", ":", "0", ",", "'month'", ":", "1", ",", "'months'", ":", "1", ",", "...
Return the time struct index to use for log rotation checks
[ "Return", "the", "time", "struct", "index", "to", "use", "for", "log", "rotation", "checks" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L379-L393
NASA-AMMOS/AIT-Core
ait/core/bsc.py
SocketStreamCapturer._get_log_file
def _get_log_file(self, handler): ''' Generate log file path for a given handler Args: handler: The handler configuration dictionary for which a log file path should be generated. ''' if 'file_name_pattern' not in handler: filename...
python
def _get_log_file(self, handler): ''' Generate log file path for a given handler Args: handler: The handler configuration dictionary for which a log file path should be generated. ''' if 'file_name_pattern' not in handler: filename...
[ "def", "_get_log_file", "(", "self", ",", "handler", ")", ":", "if", "'file_name_pattern'", "not", "in", "handler", ":", "filename", "=", "'%Y-%m-%d-%H-%M-%S-{name}.pcap'", "else", ":", "filename", "=", "handler", "[", "'file_name_pattern'", "]", "log_file", "=", ...
Generate log file path for a given handler Args: handler: The handler configuration dictionary for which a log file path should be generated.
[ "Generate", "log", "file", "path", "for", "a", "given", "handler" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L400-L422
NASA-AMMOS/AIT-Core
ait/core/bsc.py
SocketStreamCapturer._get_logger
def _get_logger(self, handler): ''' Initialize a PCAP stream for logging data ''' log_file = self._get_log_file(handler) if not os.path.isdir(os.path.dirname(log_file)): os.makedirs(os.path.dirname(log_file)) handler['log_rot_time'] = time.gmtime() return pcap.open(...
python
def _get_logger(self, handler): ''' Initialize a PCAP stream for logging data ''' log_file = self._get_log_file(handler) if not os.path.isdir(os.path.dirname(log_file)): os.makedirs(os.path.dirname(log_file)) handler['log_rot_time'] = time.gmtime() return pcap.open(...
[ "def", "_get_logger", "(", "self", ",", "handler", ")", ":", "log_file", "=", "self", ".", "_get_log_file", "(", "handler", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "dirname", "(", "log_file", ")", ")", ":", "...
Initialize a PCAP stream for logging data
[ "Initialize", "a", "PCAP", "stream", "for", "logging", "data" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L424-L432
NASA-AMMOS/AIT-Core
ait/core/bsc.py
StreamCaptureManager.add_logger
def add_logger(self, name, address, conn_type, log_dir_path=None, **kwargs): ''' Add a new stream capturer to the manager. Add a new stream capturer to the manager with the provided configuration details. If an existing capturer is monitoring the same address the new handler will be add...
python
def add_logger(self, name, address, conn_type, log_dir_path=None, **kwargs): ''' Add a new stream capturer to the manager. Add a new stream capturer to the manager with the provided configuration details. If an existing capturer is monitoring the same address the new handler will be add...
[ "def", "add_logger", "(", "self", ",", "name", ",", "address", ",", "conn_type", ",", "log_dir_path", "=", "None", ",", "*", "*", "kwargs", ")", ":", "capture_handler_conf", "=", "kwargs", "if", "not", "log_dir_path", ":", "log_dir_path", "=", "self", ".",...
Add a new stream capturer to the manager. Add a new stream capturer to the manager with the provided configuration details. If an existing capturer is monitoring the same address the new handler will be added to it. Args: name: A string defining the new capt...
[ "Add", "a", "new", "stream", "capturer", "to", "the", "manager", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L480-L558
NASA-AMMOS/AIT-Core
ait/core/bsc.py
StreamCaptureManager.stop_capture_handler
def stop_capture_handler(self, name): ''' Remove all handlers with a given name Args: name: The name of the handler(s) to remove. ''' empty_capturers_indeces = [] for k, sc in self._stream_capturers.iteritems(): stream_capturer = sc[0] ...
python
def stop_capture_handler(self, name): ''' Remove all handlers with a given name Args: name: The name of the handler(s) to remove. ''' empty_capturers_indeces = [] for k, sc in self._stream_capturers.iteritems(): stream_capturer = sc[0] ...
[ "def", "stop_capture_handler", "(", "self", ",", "name", ")", ":", "empty_capturers_indeces", "=", "[", "]", "for", "k", ",", "sc", "in", "self", ".", "_stream_capturers", ".", "iteritems", "(", ")", ":", "stream_capturer", "=", "sc", "[", "0", "]", "str...
Remove all handlers with a given name Args: name: The name of the handler(s) to remove.
[ "Remove", "all", "handlers", "with", "a", "given", "name" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L560-L577
NASA-AMMOS/AIT-Core
ait/core/bsc.py
StreamCaptureManager.stop_stream_capturer
def stop_stream_capturer(self, address): ''' Stop a capturer that the manager controls. Args: address: An address array of the form ['host', 'port'] or similar depending on the connection type of the stream capturer being terminated. The captu...
python
def stop_stream_capturer(self, address): ''' Stop a capturer that the manager controls. Args: address: An address array of the form ['host', 'port'] or similar depending on the connection type of the stream capturer being terminated. The captu...
[ "def", "stop_stream_capturer", "(", "self", ",", "address", ")", ":", "address", "=", "str", "(", "address", ")", "if", "address", "not", "in", "self", ".", "_stream_capturers", ":", "raise", "ValueError", "(", "'Capturer address does not match a managed capturer'",...
Stop a capturer that the manager controls. Args: address: An address array of the form ['host', 'port'] or similar depending on the connection type of the stream capturer being terminated. The capturer for the address will be terminated ...
[ "Stop", "a", "capturer", "that", "the", "manager", "controls", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L579-L601
NASA-AMMOS/AIT-Core
ait/core/bsc.py
StreamCaptureManager.rotate_capture_handler_log
def rotate_capture_handler_log(self, name): ''' Force a rotation of a handler's log file Args: name: The name of the handler who's log file should be rotated. ''' for sc_key, sc in self._stream_capturers.iteritems(): for h in sc[0].capture_handler...
python
def rotate_capture_handler_log(self, name): ''' Force a rotation of a handler's log file Args: name: The name of the handler who's log file should be rotated. ''' for sc_key, sc in self._stream_capturers.iteritems(): for h in sc[0].capture_handler...
[ "def", "rotate_capture_handler_log", "(", "self", ",", "name", ")", ":", "for", "sc_key", ",", "sc", "in", "self", ".", "_stream_capturers", ".", "iteritems", "(", ")", ":", "for", "h", "in", "sc", "[", "0", "]", ".", "capture_handlers", ":", "if", "h"...
Force a rotation of a handler's log file Args: name: The name of the handler who's log file should be rotated.
[ "Force", "a", "rotation", "of", "a", "handler", "s", "log", "file" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L603-L613
NASA-AMMOS/AIT-Core
ait/core/bsc.py
StreamCaptureManager.get_logger_data
def get_logger_data(self): ''' Return data on managed loggers. Returns a dictionary of managed logger configuration data. The format is primarily controlled by the :func:`SocketStreamCapturer.dump_handler_config_data` function:: { <capture address>: <list of...
python
def get_logger_data(self): ''' Return data on managed loggers. Returns a dictionary of managed logger configuration data. The format is primarily controlled by the :func:`SocketStreamCapturer.dump_handler_config_data` function:: { <capture address>: <list of...
[ "def", "get_logger_data", "(", "self", ")", ":", "return", "{", "address", ":", "stream_capturer", "[", "0", "]", ".", "dump_handler_config_data", "(", ")", "for", "address", ",", "stream_capturer", "in", "self", ".", "_stream_capturers", ".", "iteritems", "("...
Return data on managed loggers. Returns a dictionary of managed logger configuration data. The format is primarily controlled by the :func:`SocketStreamCapturer.dump_handler_config_data` function:: { <capture address>: <list of handler config for data capturers> ...
[ "Return", "data", "on", "managed", "loggers", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L615-L630
NASA-AMMOS/AIT-Core
ait/core/bsc.py
StreamCaptureManager.get_handler_stats
def get_handler_stats(self): ''' Return handler read statistics Returns a dictionary of managed handler data read statistics. The format is primarily controlled by the :func:`SocketStreamCapturer.dump_all_handler_stats` function:: { <capture address>: <list ...
python
def get_handler_stats(self): ''' Return handler read statistics Returns a dictionary of managed handler data read statistics. The format is primarily controlled by the :func:`SocketStreamCapturer.dump_all_handler_stats` function:: { <capture address>: <list ...
[ "def", "get_handler_stats", "(", "self", ")", ":", "return", "{", "address", ":", "stream_capturer", "[", "0", "]", ".", "dump_all_handler_stats", "(", ")", "for", "address", ",", "stream_capturer", "in", "self", ".", "_stream_capturers", ".", "iteritems", "("...
Return handler read statistics Returns a dictionary of managed handler data read statistics. The format is primarily controlled by the :func:`SocketStreamCapturer.dump_all_handler_stats` function:: { <capture address>: <list of handler capture statistics> ...
[ "Return", "handler", "read", "statistics" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L632-L647
NASA-AMMOS/AIT-Core
ait/core/bsc.py
StreamCaptureManager.get_capture_handler_config_by_name
def get_capture_handler_config_by_name(self, name): ''' Return data for handlers of a given name. Args: name: Name of the capture handler(s) to return config data for. Returns: Dictionary dump from the named capture handler as given by the :f...
python
def get_capture_handler_config_by_name(self, name): ''' Return data for handlers of a given name. Args: name: Name of the capture handler(s) to return config data for. Returns: Dictionary dump from the named capture handler as given by the :f...
[ "def", "get_capture_handler_config_by_name", "(", "self", ",", "name", ")", ":", "handler_confs", "=", "[", "]", "for", "address", ",", "stream_capturer", "in", "self", ".", "_stream_capturers", ".", "iteritems", "(", ")", ":", "handler_data", "=", "stream_captu...
Return data for handlers of a given name. Args: name: Name of the capture handler(s) to return config data for. Returns: Dictionary dump from the named capture handler as given by the :func:`SocketStreamCapturer.dump_handler_config_data` method.
[ "Return", "data", "for", "handlers", "of", "a", "given", "name", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L649-L667
NASA-AMMOS/AIT-Core
ait/core/bsc.py
StreamCaptureManager.run_socket_event_loop
def run_socket_event_loop(self): ''' Start monitoring managed loggers. ''' try: while True: self._pool.join() # If we have no loggers we'll sleep briefly to ensure that we # allow other processes (I.e., the webserver) to do their work. ...
python
def run_socket_event_loop(self): ''' Start monitoring managed loggers. ''' try: while True: self._pool.join() # If we have no loggers we'll sleep briefly to ensure that we # allow other processes (I.e., the webserver) to do their work. ...
[ "def", "run_socket_event_loop", "(", "self", ")", ":", "try", ":", "while", "True", ":", "self", ".", "_pool", ".", "join", "(", ")", "# If we have no loggers we'll sleep briefly to ensure that we", "# allow other processes (I.e., the webserver) to do their work.", "if", "l...
Start monitoring managed loggers.
[ "Start", "monitoring", "managed", "loggers", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L669-L683
NASA-AMMOS/AIT-Core
ait/core/bsc.py
StreamCaptureManagerServer.start
def start(self): ''' Starts the server. ''' self._app.run(host=self._host, port=self._port)
python
def start(self): ''' Starts the server. ''' self._app.run(host=self._host, port=self._port)
[ "def", "start", "(", "self", ")", ":", "self", ".", "_app", ".", "run", "(", "host", "=", "self", ".", "_host", ",", "port", "=", "self", ".", "_port", ")" ]
Starts the server.
[ "Starts", "the", "server", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L708-L710
NASA-AMMOS/AIT-Core
ait/core/bsc.py
StreamCaptureManagerServer._route
def _route(self): ''' Handles server route instantiation. ''' self._app.route('/', method='GET', callback=self._get_logger_list) self._app.route('/stats', method='GET', callback=self._fetch_handler_st...
python
def _route(self): ''' Handles server route instantiation. ''' self._app.route('/', method='GET', callback=self._get_logger_list) self._app.route('/stats', method='GET', callback=self._fetch_handler_st...
[ "def", "_route", "(", "self", ")", ":", "self", ".", "_app", ".", "route", "(", "'/'", ",", "method", "=", "'GET'", ",", "callback", "=", "self", ".", "_get_logger_list", ")", "self", ".", "_app", ".", "route", "(", "'/stats'", ",", "method", "=", ...
Handles server route instantiation.
[ "Handles", "server", "route", "instantiation", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L712-L731
NASA-AMMOS/AIT-Core
ait/core/bsc.py
StreamCaptureManagerServer._add_logger_by_name
def _add_logger_by_name(self, name): ''' Handles POST requests for adding a new logger. Expects logger configuration to be passed in the request's query string. The logger name is included in the URL and the address components and connection type should be included as well. The loc attr...
python
def _add_logger_by_name(self, name): ''' Handles POST requests for adding a new logger. Expects logger configuration to be passed in the request's query string. The logger name is included in the URL and the address components and connection type should be included as well. The loc attr...
[ "def", "_add_logger_by_name", "(", "self", ",", "name", ")", ":", "data", "=", "dict", "(", "request", ".", "forms", ")", "loc", "=", "data", ".", "pop", "(", "'loc'", ",", "''", ")", "port", "=", "data", ".", "pop", "(", "'port'", ",", "None", "...
Handles POST requests for adding a new logger. Expects logger configuration to be passed in the request's query string. The logger name is included in the URL and the address components and connection type should be included as well. The loc attribute is defaulted to "localhost" when ma...
[ "Handles", "POST", "requests", "for", "adding", "a", "new", "logger", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L733-L766
NASA-AMMOS/AIT-Core
ait/core/tlm.py
handle_includes
def handle_includes(defns): '''Recursive handling of includes for any input list of defns. The assumption here is that when an include is handled by the pyyaml reader, it adds them as a list, which is stands apart from the rest of the expected YAML definitions. ''' newdefns = [] for d in def...
python
def handle_includes(defns): '''Recursive handling of includes for any input list of defns. The assumption here is that when an include is handled by the pyyaml reader, it adds them as a list, which is stands apart from the rest of the expected YAML definitions. ''' newdefns = [] for d in def...
[ "def", "handle_includes", "(", "defns", ")", ":", "newdefns", "=", "[", "]", "for", "d", "in", "defns", ":", "if", "isinstance", "(", "d", ",", "list", ")", ":", "newdefns", ".", "extend", "(", "handle_includes", "(", "d", ")", ")", "else", ":", "n...
Recursive handling of includes for any input list of defns. The assumption here is that when an include is handled by the pyyaml reader, it adds them as a list, which is stands apart from the rest of the expected YAML definitions.
[ "Recursive", "handling", "of", "includes", "for", "any", "input", "list", "of", "defns", ".", "The", "assumption", "here", "is", "that", "when", "an", "include", "is", "handled", "by", "the", "pyyaml", "reader", "it", "adds", "them", "as", "a", "list", "...
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L1124-L1137
NASA-AMMOS/AIT-Core
ait/core/tlm.py
DNToEUConversion.eval
def eval(self, packet): """Returns the result of evaluating this DNToEUConversion in the context of the given Packet. """ result = None terms = None if self._when is None or self._when.eval(packet): result = self._equation.eval(packet) return result
python
def eval(self, packet): """Returns the result of evaluating this DNToEUConversion in the context of the given Packet. """ result = None terms = None if self._when is None or self._when.eval(packet): result = self._equation.eval(packet) return result
[ "def", "eval", "(", "self", ",", "packet", ")", ":", "result", "=", "None", "terms", "=", "None", "if", "self", ".", "_when", "is", "None", "or", "self", ".", "_when", ".", "eval", "(", "packet", ")", ":", "result", "=", "self", ".", "_equation", ...
Returns the result of evaluating this DNToEUConversion in the context of the given Packet.
[ "Returns", "the", "result", "of", "evaluating", "this", "DNToEUConversion", "in", "the", "context", "of", "the", "given", "Packet", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L95-L105
NASA-AMMOS/AIT-Core
ait/core/tlm.py
DerivationDefinition.validate
def validate(self, value, messages=None): """Returns True if the given field value is valid, False otherwise. Validation error messages are appended to an optional messages array. """ valid = True primitive = value def log(msg): if messages is not...
python
def validate(self, value, messages=None): """Returns True if the given field value is valid, False otherwise. Validation error messages are appended to an optional messages array. """ valid = True primitive = value def log(msg): if messages is not...
[ "def", "validate", "(", "self", ",", "value", ",", "messages", "=", "None", ")", ":", "valid", "=", "True", "primitive", "=", "value", "def", "log", "(", "msg", ")", ":", "if", "messages", "is", "not", "None", ":", "messages", ".", "append", "(", "...
Returns True if the given field value is valid, False otherwise. Validation error messages are appended to an optional messages array.
[ "Returns", "True", "if", "the", "given", "field", "value", "is", "valid", "False", "otherwise", ".", "Validation", "error", "messages", "are", "appended", "to", "an", "optional", "messages", "array", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L190-L214
NASA-AMMOS/AIT-Core
ait/core/tlm.py
FieldDefinition.decode
def decode(self, bytes, raw=False, index=None): """Decodes the given bytes according to this Field Definition. If raw is True, no enumeration substitutions will be applied to the data returned. If index is an integer or slice (and the type of this FieldDefinition is an ArrayTyp...
python
def decode(self, bytes, raw=False, index=None): """Decodes the given bytes according to this Field Definition. If raw is True, no enumeration substitutions will be applied to the data returned. If index is an integer or slice (and the type of this FieldDefinition is an ArrayTyp...
[ "def", "decode", "(", "self", ",", "bytes", ",", "raw", "=", "False", ",", "index", "=", "None", ")", ":", "if", "index", "is", "not", "None", "and", "isinstance", "(", "self", ".", "type", ",", "dtype", ".", "ArrayType", ")", ":", "value", "=", ...
Decodes the given bytes according to this Field Definition. If raw is True, no enumeration substitutions will be applied to the data returned. If index is an integer or slice (and the type of this FieldDefinition is an ArrayType), then only the element(s) at the specified posit...
[ "Decodes", "the", "given", "bytes", "according", "to", "this", "Field", "Definition", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L313-L339
NASA-AMMOS/AIT-Core
ait/core/tlm.py
FieldDefinition.encode
def encode(self, value): """Encodes the given value according to this FieldDefinition.""" if type(value) == str and self.enum and value in self.enum: value = self.enum[value] if type(value) == int: if self.shift > 0: value <<= self.shift if se...
python
def encode(self, value): """Encodes the given value according to this FieldDefinition.""" if type(value) == str and self.enum and value in self.enum: value = self.enum[value] if type(value) == int: if self.shift > 0: value <<= self.shift if se...
[ "def", "encode", "(", "self", ",", "value", ")", ":", "if", "type", "(", "value", ")", "==", "str", "and", "self", ".", "enum", "and", "value", "in", "self", ".", "enum", ":", "value", "=", "self", ".", "enum", "[", "value", "]", "if", "type", ...
Encodes the given value according to this FieldDefinition.
[ "Encodes", "the", "given", "value", "according", "to", "this", "FieldDefinition", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L342-L353
NASA-AMMOS/AIT-Core
ait/core/tlm.py
FieldDefinition.slice
def slice(self, offset=0): """Returns a Python slice object (e.g. for array indexing) indicating the start and stop byte position of this Telemetry field. The start and stop positions may be translated by the optional byte offset. """ if self.bytes is None: s...
python
def slice(self, offset=0): """Returns a Python slice object (e.g. for array indexing) indicating the start and stop byte position of this Telemetry field. The start and stop positions may be translated by the optional byte offset. """ if self.bytes is None: s...
[ "def", "slice", "(", "self", ",", "offset", "=", "0", ")", ":", "if", "self", ".", "bytes", "is", "None", ":", "start", "=", "0", "stop", "=", "start", "+", "self", ".", "nbytes", "elif", "type", "(", "self", ".", "bytes", ")", "is", "int", ":"...
Returns a Python slice object (e.g. for array indexing) indicating the start and stop byte position of this Telemetry field. The start and stop positions may be translated by the optional byte offset.
[ "Returns", "a", "Python", "slice", "object", "(", "e", ".", "g", ".", "for", "array", "indexing", ")", "indicating", "the", "start", "and", "stop", "byte", "position", "of", "this", "Telemetry", "field", ".", "The", "start", "and", "stop", "positions", "...
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L356-L372
NASA-AMMOS/AIT-Core
ait/core/tlm.py
Packet._assertField
def _assertField(self, fieldname): """Raise AttributeError when Packet has no field with the given name.""" if not self._hasattr(fieldname): values = self._defn.name, fieldname raise AttributeError("Packet '%s' has no field '%s'" % values)
python
def _assertField(self, fieldname): """Raise AttributeError when Packet has no field with the given name.""" if not self._hasattr(fieldname): values = self._defn.name, fieldname raise AttributeError("Packet '%s' has no field '%s'" % values)
[ "def", "_assertField", "(", "self", ",", "fieldname", ")", ":", "if", "not", "self", ".", "_hasattr", "(", "fieldname", ")", ":", "values", "=", "self", ".", "_defn", ".", "name", ",", "fieldname", "raise", "AttributeError", "(", "\"Packet '%s' has no field ...
Raise AttributeError when Packet has no field with the given name.
[ "Raise", "AttributeError", "when", "Packet", "has", "no", "field", "with", "the", "given", "name", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L465-L470
NASA-AMMOS/AIT-Core
ait/core/tlm.py
Packet._getattr
def _getattr (self, fieldname, raw=False, index=None): """Returns the value of the given packet field name. If raw is True, the field value is only decoded. That is no enumeration substituions or DN to EU conversions are applied. """ self._assertField(fieldname) value =...
python
def _getattr (self, fieldname, raw=False, index=None): """Returns the value of the given packet field name. If raw is True, the field value is only decoded. That is no enumeration substituions or DN to EU conversions are applied. """ self._assertField(fieldname) value =...
[ "def", "_getattr", "(", "self", ",", "fieldname", ",", "raw", "=", "False", ",", "index", "=", "None", ")", ":", "self", ".", "_assertField", "(", "fieldname", ")", "value", "=", "None", "if", "fieldname", "==", "'raw'", ":", "value", "=", "createRawPa...
Returns the value of the given packet field name. If raw is True, the field value is only decoded. That is no enumeration substituions or DN to EU conversions are applied.
[ "Returns", "the", "value", "of", "the", "given", "packet", "field", "name", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L473-L505
NASA-AMMOS/AIT-Core
ait/core/tlm.py
Packet._hasattr
def _hasattr(self, fieldname): """Returns True if this packet contains fieldname, False otherwise.""" special = 'history', 'raw' return (fieldname in special or fieldname in self._defn.fieldmap or fieldname in self._defn.derivationmap)
python
def _hasattr(self, fieldname): """Returns True if this packet contains fieldname, False otherwise.""" special = 'history', 'raw' return (fieldname in special or fieldname in self._defn.fieldmap or fieldname in self._defn.derivationmap)
[ "def", "_hasattr", "(", "self", ",", "fieldname", ")", ":", "special", "=", "'history'", ",", "'raw'", "return", "(", "fieldname", "in", "special", "or", "fieldname", "in", "self", ".", "_defn", ".", "fieldmap", "or", "fieldname", "in", "self", ".", "_de...
Returns True if this packet contains fieldname, False otherwise.
[ "Returns", "True", "if", "this", "packet", "contains", "fieldname", "False", "otherwise", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L508-L513
NASA-AMMOS/AIT-Core
ait/core/tlm.py
PacketDefinition._update_bytes
def _update_bytes(self, defns, start=0): """Updates the 'bytes' field in all FieldDefinition. Any FieldDefinition.bytes which is undefined (None) or '@prev' will have its bytes field computed based on its data type size and where the previous FieldDefinition ended (or the start ...
python
def _update_bytes(self, defns, start=0): """Updates the 'bytes' field in all FieldDefinition. Any FieldDefinition.bytes which is undefined (None) or '@prev' will have its bytes field computed based on its data type size and where the previous FieldDefinition ended (or the start ...
[ "def", "_update_bytes", "(", "self", ",", "defns", ",", "start", "=", "0", ")", ":", "pos", "=", "slice", "(", "start", ",", "start", ")", "for", "fd", "in", "defns", ":", "if", "fd", ".", "bytes", "==", "'@prev'", "or", "fd", ".", "bytes", "is",...
Updates the 'bytes' field in all FieldDefinition. Any FieldDefinition.bytes which is undefined (None) or '@prev' will have its bytes field computed based on its data type size and where the previous FieldDefinition ended (or the start parameter in the case of very first FieldDefinition)...
[ "Updates", "the", "bytes", "field", "in", "all", "FieldDefinition", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L640-L671
NASA-AMMOS/AIT-Core
ait/core/tlm.py
PacketDefinition.nbytes
def nbytes(self): """The number of bytes for this telemetry packet""" max_byte = -1 for defn in self.fields: byte = defn.bytes if type(defn.bytes) is int else max(defn.bytes) max_byte = max(max_byte, byte) return max_byte + 1
python
def nbytes(self): """The number of bytes for this telemetry packet""" max_byte = -1 for defn in self.fields: byte = defn.bytes if type(defn.bytes) is int else max(defn.bytes) max_byte = max(max_byte, byte) return max_byte + 1
[ "def", "nbytes", "(", "self", ")", ":", "max_byte", "=", "-", "1", "for", "defn", "in", "self", ".", "fields", ":", "byte", "=", "defn", ".", "bytes", "if", "type", "(", "defn", ".", "bytes", ")", "is", "int", "else", "max", "(", "defn", ".", "...
The number of bytes for this telemetry packet
[ "The", "number", "of", "bytes", "for", "this", "telemetry", "packet" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L693-L701
NASA-AMMOS/AIT-Core
ait/core/tlm.py
PacketDefinition.validate
def validate(self, pkt, messages=None): """Returns True if the given Packet is valid, False otherwise. Validation error messages are appended to an optional messages array. """ valid = True for f in self.fields: try: value = getattr(pkt, f.nam...
python
def validate(self, pkt, messages=None): """Returns True if the given Packet is valid, False otherwise. Validation error messages are appended to an optional messages array. """ valid = True for f in self.fields: try: value = getattr(pkt, f.nam...
[ "def", "validate", "(", "self", ",", "pkt", ",", "messages", "=", "None", ")", ":", "valid", "=", "True", "for", "f", "in", "self", ".", "fields", ":", "try", ":", "value", "=", "getattr", "(", "pkt", ",", "f", ".", "name", ")", "except", "Attrib...
Returns True if the given Packet is valid, False otherwise. Validation error messages are appended to an optional messages array.
[ "Returns", "True", "if", "the", "given", "Packet", "is", "valid", "False", "otherwise", ".", "Validation", "error", "messages", "are", "appended", "to", "an", "optional", "messages", "array", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L704-L726
NASA-AMMOS/AIT-Core
ait/core/tlm.py
PacketExpression.eval
def eval(self, packet): """Returns the result of evaluating this PacketExpression in the context of the given Packet. """ try: context = createPacketContext(packet) result = eval(self._code, packet._defn.globals, context) except ZeroDivisionError: ...
python
def eval(self, packet): """Returns the result of evaluating this PacketExpression in the context of the given Packet. """ try: context = createPacketContext(packet) result = eval(self._code, packet._defn.globals, context) except ZeroDivisionError: ...
[ "def", "eval", "(", "self", ",", "packet", ")", ":", "try", ":", "context", "=", "createPacketContext", "(", "packet", ")", "result", "=", "eval", "(", "self", ".", "_code", ",", "packet", ".", "_defn", ".", "globals", ",", "context", ")", "except", ...
Returns the result of evaluating this PacketExpression in the context of the given Packet.
[ "Returns", "the", "result", "of", "evaluating", "this", "PacketExpression", "in", "the", "context", "of", "the", "given", "Packet", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L793-L803
NASA-AMMOS/AIT-Core
ait/core/tlm.py
PacketHistory._assertField
def _assertField(self, name): """Raise AttributeError when PacketHistory has no field with the given name. """ if name not in self._names: msg = 'PacketHistory "%s" has no field "%s"' values = self._defn.name, name raise AttributeError(msg % values)
python
def _assertField(self, name): """Raise AttributeError when PacketHistory has no field with the given name. """ if name not in self._names: msg = 'PacketHistory "%s" has no field "%s"' values = self._defn.name, name raise AttributeError(msg % values)
[ "def", "_assertField", "(", "self", ",", "name", ")", ":", "if", "name", "not", "in", "self", ".", "_names", ":", "msg", "=", "'PacketHistory \"%s\" has no field \"%s\"'", "values", "=", "self", ".", "_defn", ".", "name", ",", "name", "raise", "AttributeErro...
Raise AttributeError when PacketHistory has no field with the given name.
[ "Raise", "AttributeError", "when", "PacketHistory", "has", "no", "field", "with", "the", "given", "name", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L960-L967
NASA-AMMOS/AIT-Core
ait/core/tlm.py
PacketHistory.add
def add(self, packet): """Add the given Packet to this PacketHistory.""" for name in self._names: value = getattr(packet, name) if value is not None: self._dict[name] = value
python
def add(self, packet): """Add the given Packet to this PacketHistory.""" for name in self._names: value = getattr(packet, name) if value is not None: self._dict[name] = value
[ "def", "add", "(", "self", ",", "packet", ")", ":", "for", "name", "in", "self", ".", "_names", ":", "value", "=", "getattr", "(", "packet", ",", "name", ")", "if", "value", "is", "not", "None", ":", "self", ".", "_dict", "[", "name", "]", "=", ...
Add the given Packet to this PacketHistory.
[ "Add", "the", "given", "Packet", "to", "this", "PacketHistory", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L969-L974
NASA-AMMOS/AIT-Core
ait/core/tlm.py
TlmDict.add
def add(self, defn): """Adds the given Packet Definition to this Telemetry Dictionary.""" if defn.name not in self: self[defn.name] = defn else: msg = "Duplicate packet name '%s'" % defn.name log.error(msg) raise util.YAMLError(msg)
python
def add(self, defn): """Adds the given Packet Definition to this Telemetry Dictionary.""" if defn.name not in self: self[defn.name] = defn else: msg = "Duplicate packet name '%s'" % defn.name log.error(msg) raise util.YAMLError(msg)
[ "def", "add", "(", "self", ",", "defn", ")", ":", "if", "defn", ".", "name", "not", "in", "self", ":", "self", "[", "defn", ".", "name", "]", "=", "defn", "else", ":", "msg", "=", "\"Duplicate packet name '%s'\"", "%", "defn", ".", "name", "log", "...
Adds the given Packet Definition to this Telemetry Dictionary.
[ "Adds", "the", "given", "Packet", "Definition", "to", "this", "Telemetry", "Dictionary", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L1026-L1033
NASA-AMMOS/AIT-Core
ait/core/tlm.py
TlmDict.create
def create(self, name, data=None): """Creates a new packet with the given definition and raw data. """ return createPacket(self[name], data) if name in self else None
python
def create(self, name, data=None): """Creates a new packet with the given definition and raw data. """ return createPacket(self[name], data) if name in self else None
[ "def", "create", "(", "self", ",", "name", ",", "data", "=", "None", ")", ":", "return", "createPacket", "(", "self", "[", "name", "]", ",", "data", ")", "if", "name", "in", "self", "else", "None" ]
Creates a new packet with the given definition and raw data.
[ "Creates", "a", "new", "packet", "with", "the", "given", "definition", "and", "raw", "data", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L1035-L1038
NASA-AMMOS/AIT-Core
ait/core/tlm.py
TlmDict.load
def load(self, content): """Loads Packet Definitions from the given YAML content into this Telemetry Dictionary. Content may be either a filename containing YAML content or a YAML string. Load has no effect if this Command Dictionary was already instantiated with a filename or ...
python
def load(self, content): """Loads Packet Definitions from the given YAML content into this Telemetry Dictionary. Content may be either a filename containing YAML content or a YAML string. Load has no effect if this Command Dictionary was already instantiated with a filename or ...
[ "def", "load", "(", "self", ",", "content", ")", ":", "if", "self", ".", "filename", "is", "None", ":", "if", "os", ".", "path", ".", "isfile", "(", "content", ")", ":", "self", ".", "filename", "=", "content", "stream", "=", "open", "(", "self", ...
Loads Packet Definitions from the given YAML content into this Telemetry Dictionary. Content may be either a filename containing YAML content or a YAML string. Load has no effect if this Command Dictionary was already instantiated with a filename or YAML content.
[ "Loads", "Packet", "Definitions", "from", "the", "given", "YAML", "content", "into", "this", "Telemetry", "Dictionary", ".", "Content", "may", "be", "either", "a", "filename", "containing", "YAML", "content", "or", "a", "YAML", "string", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L1040-L1061
NASA-AMMOS/AIT-Core
ait/core/tlm.py
TlmDictWriter.writeToCSV
def writeToCSV(self, output_path=None): '''writeToCSV - write the telemetry dictionary to csv ''' header = ['Name', 'First Byte', 'Last Byte', 'Bit Mask', 'Endian', 'Type', 'Description', 'Values'] if output_path is None: output_path = ait.config._directory...
python
def writeToCSV(self, output_path=None): '''writeToCSV - write the telemetry dictionary to csv ''' header = ['Name', 'First Byte', 'Last Byte', 'Bit Mask', 'Endian', 'Type', 'Description', 'Values'] if output_path is None: output_path = ait.config._directory...
[ "def", "writeToCSV", "(", "self", ",", "output_path", "=", "None", ")", ":", "header", "=", "[", "'Name'", ",", "'First Byte'", ",", "'Last Byte'", ",", "'Bit Mask'", ",", "'Endian'", ",", "'Type'", ",", "'Description'", ",", "'Values'", "]", "if", "output...
writeToCSV - write the telemetry dictionary to csv
[ "writeToCSV", "-", "write", "the", "telemetry", "dictionary", "to", "csv" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L1076-L1109
NASA-AMMOS/AIT-Core
ait/core/cmd.py
ArgDefn.decode
def decode(self, bytes): """Decodes the given bytes according to this AIT Argument Definition. """ value = self.type.decode(bytes) if self._enum is not None: for name, val in self._enum.items(): if value == val: value = name ...
python
def decode(self, bytes): """Decodes the given bytes according to this AIT Argument Definition. """ value = self.type.decode(bytes) if self._enum is not None: for name, val in self._enum.items(): if value == val: value = name ...
[ "def", "decode", "(", "self", ",", "bytes", ")", ":", "value", "=", "self", ".", "type", ".", "decode", "(", "bytes", ")", "if", "self", ".", "_enum", "is", "not", "None", ":", "for", "name", ",", "val", "in", "self", ".", "_enum", ".", "items", ...
Decodes the given bytes according to this AIT Argument Definition.
[ "Decodes", "the", "given", "bytes", "according", "to", "this", "AIT", "Argument", "Definition", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/cmd.py#L97-L107
NASA-AMMOS/AIT-Core
ait/core/cmd.py
ArgDefn.encode
def encode(self, value): """Encodes the given value according to this AIT Argument Definition. """ if type(value) == str and self.enum and value in self.enum: value = self.enum[value] return self.type.encode(value) if self.type else bytearray()
python
def encode(self, value): """Encodes the given value according to this AIT Argument Definition. """ if type(value) == str and self.enum and value in self.enum: value = self.enum[value] return self.type.encode(value) if self.type else bytearray()
[ "def", "encode", "(", "self", ",", "value", ")", ":", "if", "type", "(", "value", ")", "==", "str", "and", "self", ".", "enum", "and", "value", "in", "self", ".", "enum", ":", "value", "=", "self", ".", "enum", "[", "value", "]", "return", "self"...
Encodes the given value according to this AIT Argument Definition.
[ "Encodes", "the", "given", "value", "according", "to", "this", "AIT", "Argument", "Definition", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/cmd.py#L109-L115
NASA-AMMOS/AIT-Core
ait/core/cmd.py
ArgDefn.validate
def validate(self, value, messages=None): """Returns True if the given Argument value is valid, False otherwise. Validation error messages are appended to an optional messages array. """ valid = True primitive = value def log(msg): if messages is ...
python
def validate(self, value, messages=None): """Returns True if the given Argument value is valid, False otherwise. Validation error messages are appended to an optional messages array. """ valid = True primitive = value def log(msg): if messages is ...
[ "def", "validate", "(", "self", ",", "value", ",", "messages", "=", "None", ")", ":", "valid", "=", "True", "primitive", "=", "value", "def", "log", "(", "msg", ")", ":", "if", "messages", "is", "not", "None", ":", "messages", ".", "append", "(", "...
Returns True if the given Argument value is valid, False otherwise. Validation error messages are appended to an optional messages array.
[ "Returns", "True", "if", "the", "given", "Argument", "value", "is", "valid", "False", "otherwise", ".", "Validation", "error", "messages", "are", "appended", "to", "an", "optional", "messages", "array", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/cmd.py#L132-L162
NASA-AMMOS/AIT-Core
ait/core/cmd.py
Cmd.encode
def encode(self, pad=106): """Encodes this AIT command to binary. If pad is specified, it indicates the maximum size of the encoded command in bytes. If the encoded command is less than pad, the remaining bytes are set to zero. Commands sent to ISS payloads over 1553 are limit...
python
def encode(self, pad=106): """Encodes this AIT command to binary. If pad is specified, it indicates the maximum size of the encoded command in bytes. If the encoded command is less than pad, the remaining bytes are set to zero. Commands sent to ISS payloads over 1553 are limit...
[ "def", "encode", "(", "self", ",", "pad", "=", "106", ")", ":", "opcode", "=", "struct", ".", "pack", "(", "'>H'", ",", "self", ".", "defn", ".", "opcode", ")", "offset", "=", "len", "(", "opcode", ")", "size", "=", "max", "(", "offset", "+", "...
Encodes this AIT command to binary. If pad is specified, it indicates the maximum size of the encoded command in bytes. If the encoded command is less than pad, the remaining bytes are set to zero. Commands sent to ISS payloads over 1553 are limited to 64 words (128 bytes) wit...
[ "Encodes", "this", "AIT", "command", "to", "binary", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/cmd.py#L224-L254
NASA-AMMOS/AIT-Core
ait/core/cmd.py
CmdDefn.nbytes
def nbytes(self): """The number of bytes required to encode this command. Encoded commands are comprised of a two byte opcode, followed by a one byte size, and then the command argument bytes. The size indicates the number of bytes required to represent command arguments. ...
python
def nbytes(self): """The number of bytes required to encode this command. Encoded commands are comprised of a two byte opcode, followed by a one byte size, and then the command argument bytes. The size indicates the number of bytes required to represent command arguments. ...
[ "def", "nbytes", "(", "self", ")", ":", "return", "len", "(", "self", ".", "opcode", ")", "+", "1", "+", "sum", "(", "arg", ".", "nbytes", "for", "arg", "in", "self", ".", "argdefns", ")" ]
The number of bytes required to encode this command. Encoded commands are comprised of a two byte opcode, followed by a one byte size, and then the command argument bytes. The size indicates the number of bytes required to represent command arguments.
[ "The", "number", "of", "bytes", "required", "to", "encode", "this", "command", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/cmd.py#L308-L316
NASA-AMMOS/AIT-Core
ait/core/cmd.py
CmdDefn.argsize
def argsize(self): """The total size in bytes of all the command arguments.""" argsize = sum(arg.nbytes for arg in self.argdefns) return argsize if len(self.argdefns) > 0 else 0
python
def argsize(self): """The total size in bytes of all the command arguments.""" argsize = sum(arg.nbytes for arg in self.argdefns) return argsize if len(self.argdefns) > 0 else 0
[ "def", "argsize", "(", "self", ")", ":", "argsize", "=", "sum", "(", "arg", ".", "nbytes", "for", "arg", "in", "self", ".", "argdefns", ")", "return", "argsize", "if", "len", "(", "self", ".", "argdefns", ")", ">", "0", "else", "0" ]
The total size in bytes of all the command arguments.
[ "The", "total", "size", "in", "bytes", "of", "all", "the", "command", "arguments", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/cmd.py#L324-L327
NASA-AMMOS/AIT-Core
ait/core/cmd.py
CmdDefn.validate
def validate(self, cmd, messages=None): """Returns True if the given Command is valid, False otherwise. Validation error messages are appended to an optional messages array. """ valid = True args = [ arg for arg in cmd.args if arg is not None ] if self.nargs != ...
python
def validate(self, cmd, messages=None): """Returns True if the given Command is valid, False otherwise. Validation error messages are appended to an optional messages array. """ valid = True args = [ arg for arg in cmd.args if arg is not None ] if self.nargs != ...
[ "def", "validate", "(", "self", ",", "cmd", ",", "messages", "=", "None", ")", ":", "valid", "=", "True", "args", "=", "[", "arg", "for", "arg", "in", "cmd", ".", "args", "if", "arg", "is", "not", "None", "]", "if", "self", ".", "nargs", "!=", ...
Returns True if the given Command is valid, False otherwise. Validation error messages are appended to an optional messages array.
[ "Returns", "True", "if", "the", "given", "Command", "is", "valid", "False", "otherwise", ".", "Validation", "error", "messages", "are", "appended", "to", "an", "optional", "messages", "array", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/cmd.py#L347-L375
NASA-AMMOS/AIT-Core
ait/core/cmd.py
CmdDict.add
def add(self, defn): """Adds the given Command Definition to this Command Dictionary.""" self[defn.name] = defn self.opcodes[defn._opcode] = defn
python
def add(self, defn): """Adds the given Command Definition to this Command Dictionary.""" self[defn.name] = defn self.opcodes[defn._opcode] = defn
[ "def", "add", "(", "self", ",", "defn", ")", ":", "self", "[", "defn", ".", "name", "]", "=", "defn", "self", ".", "opcodes", "[", "defn", ".", "_opcode", "]", "=", "defn" ]
Adds the given Command Definition to this Command Dictionary.
[ "Adds", "the", "given", "Command", "Definition", "to", "this", "Command", "Dictionary", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/cmd.py#L398-L401
NASA-AMMOS/AIT-Core
ait/core/cmd.py
CmdDict.create
def create(self, name, *args, **kwargs): """Creates a new AIT command with the given arguments.""" tokens = name.split() if len(tokens) > 1 and (len(args) > 0 or len(kwargs) > 0): msg = 'A Cmd may be created with either positional arguments ' msg += '(passed as a string...
python
def create(self, name, *args, **kwargs): """Creates a new AIT command with the given arguments.""" tokens = name.split() if len(tokens) > 1 and (len(args) > 0 or len(kwargs) > 0): msg = 'A Cmd may be created with either positional arguments ' msg += '(passed as a string...
[ "def", "create", "(", "self", ",", "name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "tokens", "=", "name", ".", "split", "(", ")", "if", "len", "(", "tokens", ")", ">", "1", "and", "(", "len", "(", "args", ")", ">", "0", "or", "...
Creates a new AIT command with the given arguments.
[ "Creates", "a", "new", "AIT", "command", "with", "the", "given", "arguments", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/cmd.py#L404-L423
NASA-AMMOS/AIT-Core
ait/core/cmd.py
CmdDict.decode
def decode(self, bytes): """Decodes the given bytes according to this AIT Command Definition. """ opcode = struct.unpack(">H", bytes[0:2])[0] nbytes = struct.unpack("B", bytes[2:3])[0] name = None args = [] if opcode in self.opcodes: de...
python
def decode(self, bytes): """Decodes the given bytes according to this AIT Command Definition. """ opcode = struct.unpack(">H", bytes[0:2])[0] nbytes = struct.unpack("B", bytes[2:3])[0] name = None args = [] if opcode in self.opcodes: de...
[ "def", "decode", "(", "self", ",", "bytes", ")", ":", "opcode", "=", "struct", ".", "unpack", "(", "\">H\"", ",", "bytes", "[", "0", ":", "2", "]", ")", "[", "0", "]", "nbytes", "=", "struct", ".", "unpack", "(", "\"B\"", ",", "bytes", "[", "2"...
Decodes the given bytes according to this AIT Command Definition.
[ "Decodes", "the", "given", "bytes", "according", "to", "this", "AIT", "Command", "Definition", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/cmd.py#L426-L448
NASA-AMMOS/AIT-Core
ait/core/cmd.py
CmdDict.load
def load(self, content): """Loads Command Definitions from the given YAML content into into this Command Dictionary. Content may be either a filename containing YAML content or a YAML string. Load has no effect if this Command Dictionary was already instantiated with a filename...
python
def load(self, content): """Loads Command Definitions from the given YAML content into into this Command Dictionary. Content may be either a filename containing YAML content or a YAML string. Load has no effect if this Command Dictionary was already instantiated with a filename...
[ "def", "load", "(", "self", ",", "content", ")", ":", "if", "self", ".", "filename", "is", "None", ":", "if", "os", ".", "path", ".", "isfile", "(", "content", ")", ":", "self", ".", "filename", "=", "content", "stream", "=", "open", "(", "self", ...
Loads Command Definitions from the given YAML content into into this Command Dictionary. Content may be either a filename containing YAML content or a YAML string. Load has no effect if this Command Dictionary was already instantiated with a filename or YAML content.
[ "Loads", "Command", "Definitions", "from", "the", "given", "YAML", "content", "into", "into", "this", "Command", "Dictionary", ".", "Content", "may", "be", "either", "a", "filename", "containing", "YAML", "content", "or", "a", "YAML", "string", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/cmd.py#L450-L469
NASA-AMMOS/AIT-Core
ait/core/coord.py
cbrt
def cbrt (x): """Returns the cube root of x.""" if x >= 0: return math.pow(x , 1.0 / 3.0) else: return - math.pow(abs(x), 1.0 / 3.0)
python
def cbrt (x): """Returns the cube root of x.""" if x >= 0: return math.pow(x , 1.0 / 3.0) else: return - math.pow(abs(x), 1.0 / 3.0)
[ "def", "cbrt", "(", "x", ")", ":", "if", "x", ">=", "0", ":", "return", "math", ".", "pow", "(", "x", ",", "1.0", "/", "3.0", ")", "else", ":", "return", "-", "math", ".", "pow", "(", "abs", "(", "x", ")", ",", "1.0", "/", "3.0", ")" ]
Returns the cube root of x.
[ "Returns", "the", "cube", "root", "of", "x", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/coord.py#L49-L54
NASA-AMMOS/AIT-Core
ait/core/coord.py
eci2ecef
def eci2ecef (x, y, z, gmst=None): """Converts the given ECI coordinates to ECEF at the given Greenwich Mean Sidereal Time (GMST) (defaults to now). This code was adapted from `shashwatak/satellite-js <https://github.com/shashwatak/satellite-js/blob/master/src/coordinate-transforms.js>`_ and http://ccar.co...
python
def eci2ecef (x, y, z, gmst=None): """Converts the given ECI coordinates to ECEF at the given Greenwich Mean Sidereal Time (GMST) (defaults to now). This code was adapted from `shashwatak/satellite-js <https://github.com/shashwatak/satellite-js/blob/master/src/coordinate-transforms.js>`_ and http://ccar.co...
[ "def", "eci2ecef", "(", "x", ",", "y", ",", "z", ",", "gmst", "=", "None", ")", ":", "if", "gmst", "is", "None", ":", "gmst", "=", "dmc", ".", "toGMST", "(", ")", "X", "=", "(", "x", "*", "math", ".", "cos", "(", "gmst", ")", ")", "+", "(...
Converts the given ECI coordinates to ECEF at the given Greenwich Mean Sidereal Time (GMST) (defaults to now). This code was adapted from `shashwatak/satellite-js <https://github.com/shashwatak/satellite-js/blob/master/src/coordinate-transforms.js>`_ and http://ccar.colorado.edu/ASEN5070/handouts/coordsys.do...
[ "Converts", "the", "given", "ECI", "coordinates", "to", "ECEF", "at", "the", "given", "Greenwich", "Mean", "Sidereal", "Time", "(", "GMST", ")", "(", "defaults", "to", "now", ")", ".", "This", "code", "was", "adapted", "from", "shashwatak", "/", "satellite...
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/coord.py#L57-L73
NASA-AMMOS/AIT-Core
ait/core/coord.py
eci2geodetic
def eci2geodetic (x, y, z, gmst=None, ellipsoid=None): """Converts the given ECI coordinates to Geodetic coordinates at the given Greenwich Mean Sidereal Time (GMST) (defaults to now) and with the given ellipsoid (defaults to WGS84). This code was adapted from `shashwatak/satellite-js <https://github.com/sha...
python
def eci2geodetic (x, y, z, gmst=None, ellipsoid=None): """Converts the given ECI coordinates to Geodetic coordinates at the given Greenwich Mean Sidereal Time (GMST) (defaults to now) and with the given ellipsoid (defaults to WGS84). This code was adapted from `shashwatak/satellite-js <https://github.com/sha...
[ "def", "eci2geodetic", "(", "x", ",", "y", ",", "z", ",", "gmst", "=", "None", ",", "ellipsoid", "=", "None", ")", ":", "if", "gmst", "is", "None", ":", "gmst", "=", "dmc", ".", "toGMST", "(", ")", "if", "ellipsoid", "is", "None", ":", "ellipsoid...
Converts the given ECI coordinates to Geodetic coordinates at the given Greenwich Mean Sidereal Time (GMST) (defaults to now) and with the given ellipsoid (defaults to WGS84). This code was adapted from `shashwatak/satellite-js <https://github.com/shashwatak/satellite-js/blob/master/src/coordinate-transforms.j...
[ "Converts", "the", "given", "ECI", "coordinates", "to", "Geodetic", "coordinates", "at", "the", "given", "Greenwich", "Mean", "Sidereal", "Time", "(", "GMST", ")", "(", "defaults", "to", "now", ")", "and", "with", "the", "given", "ellipsoid", "(", "defaults"...
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/coord.py#L76-L110
NASA-AMMOS/AIT-Core
ait/core/server/stream.py
Stream.process
def process(self, input_data, topic=None): """ Invokes each handler in sequence. Publishes final output data. Params: input_data: message received by stream topic: name of plugin or stream message received from, if applicable ...
python
def process(self, input_data, topic=None): """ Invokes each handler in sequence. Publishes final output data. Params: input_data: message received by stream topic: name of plugin or stream message received from, if applicable ...
[ "def", "process", "(", "self", ",", "input_data", ",", "topic", "=", "None", ")", ":", "for", "handler", "in", "self", ".", "handlers", ":", "output", "=", "handler", ".", "handle", "(", "input_data", ")", "input_data", "=", "output", "self", ".", "pub...
Invokes each handler in sequence. Publishes final output data. Params: input_data: message received by stream topic: name of plugin or stream message received from, if applicable
[ "Invokes", "each", "handler", "in", "sequence", ".", "Publishes", "final", "output", "data", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/server/stream.py#L54-L68
NASA-AMMOS/AIT-Core
ait/core/server/stream.py
Stream.valid_workflow
def valid_workflow(self): """ Return true if each handler's output type is the same as the next handler's input type. Return False if not. Returns: boolean - True if workflow is valid, False if not """ for ix, handler in enumerate(self.handlers[:-1]): next...
python
def valid_workflow(self): """ Return true if each handler's output type is the same as the next handler's input type. Return False if not. Returns: boolean - True if workflow is valid, False if not """ for ix, handler in enumerate(self.handlers[:-1]): next...
[ "def", "valid_workflow", "(", "self", ")", ":", "for", "ix", ",", "handler", "in", "enumerate", "(", "self", ".", "handlers", "[", ":", "-", "1", "]", ")", ":", "next_input_type", "=", "self", ".", "handlers", "[", "ix", "+", "1", "]", ".", "input_...
Return true if each handler's output type is the same as the next handler's input type. Return False if not. Returns: boolean - True if workflow is valid, False if not
[ "Return", "true", "if", "each", "handler", "s", "output", "type", "is", "the", "same", "as", "the", "next", "handler", "s", "input", "type", ".", "Return", "False", "if", "not", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/server/stream.py#L70-L85
NASA-AMMOS/AIT-Core
ait/core/gds.py
compress
def compress (input_filename, output_filename=None, verbose=False): """compress(input_filename, output_filename=None, verbose=False) -> integer Uses zlib to compress input_filename and store the result in output_filename. The size of output_filename is returned on success; zero is returned on failure. The ...
python
def compress (input_filename, output_filename=None, verbose=False): """compress(input_filename, output_filename=None, verbose=False) -> integer Uses zlib to compress input_filename and store the result in output_filename. The size of output_filename is returned on success; zero is returned on failure. The ...
[ "def", "compress", "(", "input_filename", ",", "output_filename", "=", "None", ",", "verbose", "=", "False", ")", ":", "input_size", "=", "0", "output_size", "=", "0", "if", "output_filename", "is", "None", ":", "output_filename", "=", "input_fillename", "+", ...
compress(input_filename, output_filename=None, verbose=False) -> integer Uses zlib to compress input_filename and store the result in output_filename. The size of output_filename is returned on success; zero is returned on failure. The input file is compressed in one fell swoop. The output_filename defaul...
[ "compress", "(", "input_filename", "output_filename", "=", "None", "verbose", "=", "False", ")", "-", ">", "integer" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/gds.py#L32-L76
NASA-AMMOS/AIT-Core
ait/core/gds.py
hexdump
def hexdump (bytes, addr=None, preamble=None, printfunc=None, stepsize=16): """hexdump(bytes[, addr[, preamble[, printfunc[, stepsize=16]]]]) Outputs bytes in hexdump format lines similar to the following (here preamble='Bank1', stepsize=8, and len(bytes) == 15):: Bank1: 0xFD020000: 7f45 4c46 0102 0100 ...
python
def hexdump (bytes, addr=None, preamble=None, printfunc=None, stepsize=16): """hexdump(bytes[, addr[, preamble[, printfunc[, stepsize=16]]]]) Outputs bytes in hexdump format lines similar to the following (here preamble='Bank1', stepsize=8, and len(bytes) == 15):: Bank1: 0xFD020000: 7f45 4c46 0102 0100 ...
[ "def", "hexdump", "(", "bytes", ",", "addr", "=", "None", ",", "preamble", "=", "None", ",", "printfunc", "=", "None", ",", "stepsize", "=", "16", ")", ":", "if", "preamble", "is", "None", ":", "preamble", "=", "\"\"", "bytes", "=", "bytearray", "(",...
hexdump(bytes[, addr[, preamble[, printfunc[, stepsize=16]]]]) Outputs bytes in hexdump format lines similar to the following (here preamble='Bank1', stepsize=8, and len(bytes) == 15):: Bank1: 0xFD020000: 7f45 4c46 0102 0100 *.ELF....* Bank1: 0xFD020008: 0000 0000 0000 00 *....... * Where ste...
[ "hexdump", "(", "bytes", "[", "addr", "[", "preamble", "[", "printfunc", "[", "stepsize", "=", "16", "]]]]", ")" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/gds.py#L94-L128
NASA-AMMOS/AIT-Core
ait/core/gds.py
hexdumpLine
def hexdumpLine (bytes, length=None): """hexdumpLine(bytes[, length]) Returns a single hexdump formatted line for bytes. If length is greater than len(bytes), the line will be padded with ASCII space characters to indicate no byte data is present. Used by hexdump(). """ line = "" if length is None: ...
python
def hexdumpLine (bytes, length=None): """hexdumpLine(bytes[, length]) Returns a single hexdump formatted line for bytes. If length is greater than len(bytes), the line will be padded with ASCII space characters to indicate no byte data is present. Used by hexdump(). """ line = "" if length is None: ...
[ "def", "hexdumpLine", "(", "bytes", ",", "length", "=", "None", ")", ":", "line", "=", "\"\"", "if", "length", "is", "None", ":", "length", "=", "len", "(", "bytes", ")", "for", "n", "in", "xrange", "(", "0", ",", "length", ",", "2", ")", ":", ...
hexdumpLine(bytes[, length]) Returns a single hexdump formatted line for bytes. If length is greater than len(bytes), the line will be padded with ASCII space characters to indicate no byte data is present. Used by hexdump().
[ "hexdumpLine", "(", "bytes", "[", "length", "]", ")" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/gds.py#L131-L165
NASA-AMMOS/AIT-Core
ait/core/gds.py
parseArgs
def parseArgs (argv, defaults): """parseArgs(argv, defaults) -> (dict, list) Parses command-line arguments according to the given defaults. For every key in defaults, an argument of the form --key=value will be parsed. Numeric arguments are converted from strings with errors reported via ait.core.log.error...
python
def parseArgs (argv, defaults): """parseArgs(argv, defaults) -> (dict, list) Parses command-line arguments according to the given defaults. For every key in defaults, an argument of the form --key=value will be parsed. Numeric arguments are converted from strings with errors reported via ait.core.log.error...
[ "def", "parseArgs", "(", "argv", ",", "defaults", ")", ":", "options", "=", "dict", "(", "defaults", ")", "numeric", "=", "[", "k", "for", "k", ",", "v", "in", "options", ".", "items", "(", ")", "if", "type", "(", "v", ")", "is", "float", "or", ...
parseArgs(argv, defaults) -> (dict, list) Parses command-line arguments according to the given defaults. For every key in defaults, an argument of the form --key=value will be parsed. Numeric arguments are converted from strings with errors reported via ait.core.log.error() and default values used instead. ...
[ "parseArgs", "(", "argv", "defaults", ")", "-", ">", "(", "dict", "list", ")" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/gds.py#L169-L206
NASA-AMMOS/AIT-Core
ait/core/gds.py
usage
def usage (exit=False): """usage([exit]) Prints the usage statement at the top of a Python program. A usage statement is any comment at the start of a line that begins with a double hash marks (##). The double hash marks are removed before the usage statement is printed. If exit is True, the program is ...
python
def usage (exit=False): """usage([exit]) Prints the usage statement at the top of a Python program. A usage statement is any comment at the start of a line that begins with a double hash marks (##). The double hash marks are removed before the usage statement is printed. If exit is True, the program is ...
[ "def", "usage", "(", "exit", "=", "False", ")", ":", "stream", "=", "open", "(", "sys", ".", "argv", "[", "0", "]", ")", "for", "line", "in", "stream", ".", "readlines", "(", ")", ":", "if", "line", ".", "startswith", "(", "\"##\"", ")", ":", "...
usage([exit]) Prints the usage statement at the top of a Python program. A usage statement is any comment at the start of a line that begins with a double hash marks (##). The double hash marks are removed before the usage statement is printed. If exit is True, the program is terminated with a return code...
[ "usage", "(", "[", "exit", "]", ")" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/gds.py#L209-L225
NASA-AMMOS/AIT-Core
ait/core/gds.py
getip
def getip(): """ getip() Returns the IP address of the computer. Helpful for those hosts that might sit behind gateways and report a hostname that is a little strange (I'm looking at you oco3-sim1). """ return [(s.connect(('8.8.8.8', 80)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_...
python
def getip(): """ getip() Returns the IP address of the computer. Helpful for those hosts that might sit behind gateways and report a hostname that is a little strange (I'm looking at you oco3-sim1). """ return [(s.connect(('8.8.8.8', 80)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_...
[ "def", "getip", "(", ")", ":", "return", "[", "(", "s", ".", "connect", "(", "(", "'8.8.8.8'", ",", "80", ")", ")", ",", "s", ".", "getsockname", "(", ")", "[", "0", "]", ",", "s", ".", "close", "(", ")", ")", "for", "s", "in", "[", "socket...
getip() Returns the IP address of the computer. Helpful for those hosts that might sit behind gateways and report a hostname that is a little strange (I'm looking at you oco3-sim1).
[ "getip", "()" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/gds.py#L228-L236
NASA-AMMOS/AIT-Core
ait/core/gds.py
arg_parse
def arg_parse(arguments, description=None): """ arg_parse() Parses the arguments using argparse. Returns a Namespace object. The arguments dictionary should match the argparse expected data structure: .. code-block::python arguments = { '--port': { 'type' : int, 'default' : 307...
python
def arg_parse(arguments, description=None): """ arg_parse() Parses the arguments using argparse. Returns a Namespace object. The arguments dictionary should match the argparse expected data structure: .. code-block::python arguments = { '--port': { 'type' : int, 'default' : 307...
[ "def", "arg_parse", "(", "arguments", ",", "description", "=", "None", ")", ":", "if", "not", "description", ":", "description", "=", "\"\"", "ap", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "description", ",", "formatter_class", "=", "...
arg_parse() Parses the arguments using argparse. Returns a Namespace object. The arguments dictionary should match the argparse expected data structure: .. code-block::python arguments = { '--port': { 'type' : int, 'default' : 3075, 'help' : 'Port on which to send data' ...
[ "arg_parse", "()" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/gds.py#L239-L303
NASA-AMMOS/AIT-Core
ait/core/gds.py
extant_file
def extant_file(file): """ 'Type' for argparse - checks that file exists but does not open. """ if not os.path.exists(file): # Argparse uses the ArgumentTypeError to give a rejection message like: # error: argument input: file does not exist raise argparse.ArgumentTypeError("{0} ...
python
def extant_file(file): """ 'Type' for argparse - checks that file exists but does not open. """ if not os.path.exists(file): # Argparse uses the ArgumentTypeError to give a rejection message like: # error: argument input: file does not exist raise argparse.ArgumentTypeError("{0} ...
[ "def", "extant_file", "(", "file", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "file", ")", ":", "# Argparse uses the ArgumentTypeError to give a rejection message like:", "# error: argument input: file does not exist", "raise", "argparse", ".", "Argumen...
'Type' for argparse - checks that file exists but does not open.
[ "Type", "for", "argparse", "-", "checks", "that", "file", "exists", "but", "does", "not", "open", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/gds.py#L306-L314
NASA-AMMOS/AIT-Core
ait/core/geom.py
Point.dot
def dot (self, other): """dot (self, other) -> number Returns the dot product of this Point with another. """ if self.z: return (self.x * other.x) + (self.y * other.y) + (self.z * other.z) else: return (self.x * other.x) + (self.y * other.y)
python
def dot (self, other): """dot (self, other) -> number Returns the dot product of this Point with another. """ if self.z: return (self.x * other.x) + (self.y * other.y) + (self.z * other.z) else: return (self.x * other.x) + (self.y * other.y)
[ "def", "dot", "(", "self", ",", "other", ")", ":", "if", "self", ".", "z", ":", "return", "(", "self", ".", "x", "*", "other", ".", "x", ")", "+", "(", "self", ".", "y", "*", "other", ".", "y", ")", "+", "(", "self", ".", "z", "*", "other...
dot (self, other) -> number Returns the dot product of this Point with another.
[ "dot", "(", "self", "other", ")", "-", ">", "number" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/geom.py#L375-L383
NASA-AMMOS/AIT-Core
ait/core/geom.py
Line.slope
def slope (self): """slope () -> float """ return (self.p.y - self.q.y) / (self.p.x - self.q.x)
python
def slope (self): """slope () -> float """ return (self.p.y - self.q.y) / (self.p.x - self.q.x)
[ "def", "slope", "(", "self", ")", ":", "return", "(", "self", ".", "p", ".", "y", "-", "self", ".", "q", ".", "y", ")", "/", "(", "self", ".", "p", ".", "x", "-", "self", ".", "q", ".", "x", ")" ]
slope () -> float
[ "slope", "()", "-", ">", "float" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/geom.py#L407-L410
NASA-AMMOS/AIT-Core
ait/core/geom.py
Line.intersect
def intersect (self, line): """intersect (line) -> Point | None Returns the intersection point of this line segment with another. If this line segment and the other line segment are conincident, the first point on this line segment is returned. If the line segments do not intersect, None is return...
python
def intersect (self, line): """intersect (line) -> Point | None Returns the intersection point of this line segment with another. If this line segment and the other line segment are conincident, the first point on this line segment is returned. If the line segments do not intersect, None is return...
[ "def", "intersect", "(", "self", ",", "line", ")", ":", "(", "x1", ",", "y1", ")", "=", "(", "self", ".", "p", ".", "x", ",", "self", ".", "p", ".", "y", ")", "(", "x2", ",", "y2", ")", "=", "(", "self", ".", "q", ".", "x", ",", "self",...
intersect (line) -> Point | None Returns the intersection point of this line segment with another. If this line segment and the other line segment are conincident, the first point on this line segment is returned. If the line segments do not intersect, None is returned. See http://local.wasp.uwa....
[ "intersect", "(", "line", ")", "-", ">", "Point", "|", "None" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/geom.py#L413-L475
NASA-AMMOS/AIT-Core
ait/core/geom.py
Plane.intersect
def intersect (self, line): """intersect(line) -> Point | None Returns the point at which the line segment and Plane intersect or None if they do not intersect. """ eps = 1e-8 d = (line.q - line.p) dn = d.dot(self.n) point = None if abs(dn) >= eps: mu = sel...
python
def intersect (self, line): """intersect(line) -> Point | None Returns the point at which the line segment and Plane intersect or None if they do not intersect. """ eps = 1e-8 d = (line.q - line.p) dn = d.dot(self.n) point = None if abs(dn) >= eps: mu = sel...
[ "def", "intersect", "(", "self", ",", "line", ")", ":", "eps", "=", "1e-8", "d", "=", "(", "line", ".", "q", "-", "line", ".", "p", ")", "dn", "=", "d", ".", "dot", "(", "self", ".", "n", ")", "point", "=", "None", "if", "abs", "(", "dn", ...
intersect(line) -> Point | None Returns the point at which the line segment and Plane intersect or None if they do not intersect.
[ "intersect", "(", "line", ")", "-", ">", "Point", "|", "None" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/geom.py#L508-L524
NASA-AMMOS/AIT-Core
ait/core/geom.py
Polygon.area
def area (self): """area() -> number Returns the area of this Polygon. """ area = 0.0 for segment in self.segments(): area += ((segment.p.x * segment.q.y) - (segment.q.x * segment.p.y))/2 return area
python
def area (self): """area() -> number Returns the area of this Polygon. """ area = 0.0 for segment in self.segments(): area += ((segment.p.x * segment.q.y) - (segment.q.x * segment.p.y))/2 return area
[ "def", "area", "(", "self", ")", ":", "area", "=", "0.0", "for", "segment", "in", "self", ".", "segments", "(", ")", ":", "area", "+=", "(", "(", "segment", ".", "p", ".", "x", "*", "segment", ".", "q", ".", "y", ")", "-", "(", "segment", "."...
area() -> number Returns the area of this Polygon.
[ "area", "()", "-", ">", "number" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/geom.py#L607-L617
NASA-AMMOS/AIT-Core
ait/core/geom.py
Polygon.bounds
def bounds (self): """bounds() -> Rect Returns the bounding Rectangle for this Polygon. """ if self._dirty: min = self.vertices[0].copy() max = self.vertices[0].copy() for point in self.vertices[1:]: if point.x < min.x: min.x = point.x if point.y < min.y: min.y = point...
python
def bounds (self): """bounds() -> Rect Returns the bounding Rectangle for this Polygon. """ if self._dirty: min = self.vertices[0].copy() max = self.vertices[0].copy() for point in self.vertices[1:]: if point.x < min.x: min.x = point.x if point.y < min.y: min.y = point...
[ "def", "bounds", "(", "self", ")", ":", "if", "self", ".", "_dirty", ":", "min", "=", "self", ".", "vertices", "[", "0", "]", ".", "copy", "(", ")", "max", "=", "self", ".", "vertices", "[", "0", "]", ".", "copy", "(", ")", "for", "point", "i...
bounds() -> Rect Returns the bounding Rectangle for this Polygon.
[ "bounds", "()", "-", ">", "Rect" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/geom.py#L620-L637
NASA-AMMOS/AIT-Core
ait/core/geom.py
Polygon.center
def center (self): """center() -> (x, y) Returns the center (of mass) point of this Polygon. See http://en.wikipedia.org/wiki/Polygon Examples: >>> p = Polygon() >>> p.vertices = [ Point(3, 8), Point(6, 4), Point(0, 3) ] >>> p.center() Point(2.89285714286, 4.82142857143) """ ...
python
def center (self): """center() -> (x, y) Returns the center (of mass) point of this Polygon. See http://en.wikipedia.org/wiki/Polygon Examples: >>> p = Polygon() >>> p.vertices = [ Point(3, 8), Point(6, 4), Point(0, 3) ] >>> p.center() Point(2.89285714286, 4.82142857143) """ ...
[ "def", "center", "(", "self", ")", ":", "Cx", "=", "0.0", "Cy", "=", "0.0", "denom", "=", "6.0", "*", "self", ".", "area", "(", ")", "for", "segment", "in", "self", ".", "segments", "(", ")", ":", "x", "=", "(", "segment", ".", "p", ".", "x",...
center() -> (x, y) Returns the center (of mass) point of this Polygon. See http://en.wikipedia.org/wiki/Polygon Examples: >>> p = Polygon() >>> p.vertices = [ Point(3, 8), Point(6, 4), Point(0, 3) ] >>> p.center() Point(2.89285714286, 4.82142857143)
[ "center", "()", "-", ">", "(", "x", "y", ")" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/geom.py#L640-L668
NASA-AMMOS/AIT-Core
ait/core/geom.py
Polygon.contains
def contains (self, p): """Returns True if point is contained inside this Polygon, False otherwise. This method uses the Ray Casting algorithm. Examples: >>> p = Polygon() >>> p.vertices = [Point(1, 1), Point(1, -1), Point(-1, -1), Point(-1, 1)] >>> p.contains( Point(0, 0) ) True...
python
def contains (self, p): """Returns True if point is contained inside this Polygon, False otherwise. This method uses the Ray Casting algorithm. Examples: >>> p = Polygon() >>> p.vertices = [Point(1, 1), Point(1, -1), Point(-1, -1), Point(-1, 1)] >>> p.contains( Point(0, 0) ) True...
[ "def", "contains", "(", "self", ",", "p", ")", ":", "inside", "=", "False", "if", "p", "in", "self", ".", "bounds", "(", ")", ":", "for", "s", "in", "self", ".", "segments", "(", ")", ":", "if", "(", "(", "s", ".", "p", ".", "y", ">", "p", ...
Returns True if point is contained inside this Polygon, False otherwise. This method uses the Ray Casting algorithm. Examples: >>> p = Polygon() >>> p.vertices = [Point(1, 1), Point(1, -1), Point(-1, -1), Point(-1, 1)] >>> p.contains( Point(0, 0) ) True >>> p.contains( Point(2, ...
[ "Returns", "True", "if", "point", "is", "contained", "inside", "this", "Polygon", "False", "otherwise", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/geom.py#L671-L697
NASA-AMMOS/AIT-Core
ait/core/geom.py
Polygon.segments
def segments (self): """Return the Line segments that comprise this Polygon.""" for n in xrange(len(self.vertices) - 1): yield Line(self.vertices[n], self.vertices[n + 1]) yield Line(self.vertices[-1], self.vertices[0])
python
def segments (self): """Return the Line segments that comprise this Polygon.""" for n in xrange(len(self.vertices) - 1): yield Line(self.vertices[n], self.vertices[n + 1]) yield Line(self.vertices[-1], self.vertices[0])
[ "def", "segments", "(", "self", ")", ":", "for", "n", "in", "xrange", "(", "len", "(", "self", ".", "vertices", ")", "-", "1", ")", ":", "yield", "Line", "(", "self", ".", "vertices", "[", "n", "]", ",", "self", ".", "vertices", "[", "n", "+", ...
Return the Line segments that comprise this Polygon.
[ "Return", "the", "Line", "segments", "that", "comprise", "this", "Polygon", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/geom.py#L700-L705
NASA-AMMOS/AIT-Core
ait/core/geom.py
Rect.contains
def contains (self, point): """contains(point) -> True | False Returns True if point is contained inside this Rectangle, False otherwise. Examples: >>> r = Rect( Point(-1, -1), Point(1, 1) ) >>> r.contains( Point(0, 0) ) True >>> r.contains( Point(2, 3) ) False """ return...
python
def contains (self, point): """contains(point) -> True | False Returns True if point is contained inside this Rectangle, False otherwise. Examples: >>> r = Rect( Point(-1, -1), Point(1, 1) ) >>> r.contains( Point(0, 0) ) True >>> r.contains( Point(2, 3) ) False """ return...
[ "def", "contains", "(", "self", ",", "point", ")", ":", "return", "(", "point", ".", "x", ">=", "self", ".", "ul", ".", "x", "and", "point", ".", "x", "<=", "self", ".", "lr", ".", "x", ")", "and", "(", "point", ".", "y", ">=", "self", ".", ...
contains(point) -> True | False Returns True if point is contained inside this Rectangle, False otherwise. Examples: >>> r = Rect( Point(-1, -1), Point(1, 1) ) >>> r.contains( Point(0, 0) ) True >>> r.contains( Point(2, 3) ) False
[ "contains", "(", "point", ")", "-", ">", "True", "|", "False" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/geom.py#L769-L784
NASA-AMMOS/AIT-Core
ait/core/geom.py
Rect.segments
def segments (self): """segments () -> [ Line, Line, Line, Line ] Return a list of Line segments that comprise this Rectangle. """ ul = self.ul lr = self.lr ur = Point(lr.x, ul.y) ll = Point(ul.x, lr.y) return [ Line(ul, ur), Line(ur, lr), Line(lr, ll), Line(ll, ul) ]
python
def segments (self): """segments () -> [ Line, Line, Line, Line ] Return a list of Line segments that comprise this Rectangle. """ ul = self.ul lr = self.lr ur = Point(lr.x, ul.y) ll = Point(ul.x, lr.y) return [ Line(ul, ur), Line(ur, lr), Line(lr, ll), Line(ll, ul) ]
[ "def", "segments", "(", "self", ")", ":", "ul", "=", "self", ".", "ul", "lr", "=", "self", ".", "lr", "ur", "=", "Point", "(", "lr", ".", "x", ",", "ul", ".", "y", ")", "ll", "=", "Point", "(", "ul", ".", "x", ",", "lr", ".", "y", ")", ...
segments () -> [ Line, Line, Line, Line ] Return a list of Line segments that comprise this Rectangle.
[ "segments", "()", "-", ">", "[", "Line", "Line", "Line", "Line", "]" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/geom.py#L795-L804
NASA-AMMOS/AIT-Core
ait/core/evr.py
EVRDefn.format_message
def format_message(self, evr_hist_data): ''' Format EVR message with EVR data Given a byte array of EVR data, format the EVR's message attribute printf format strings and split the byte array into appropriately sized chunks. Supports most format strings containing length and type ...
python
def format_message(self, evr_hist_data): ''' Format EVR message with EVR data Given a byte array of EVR data, format the EVR's message attribute printf format strings and split the byte array into appropriately sized chunks. Supports most format strings containing length and type ...
[ "def", "format_message", "(", "self", ",", "evr_hist_data", ")", ":", "size_formatter_info", "=", "{", "'s'", ":", "-", "1", ",", "'c'", ":", "1", ",", "'i'", ":", "4", ",", "'d'", ":", "4", ",", "'u'", ":", "4", ",", "'x'", ":", "4", ",", "'hh...
Format EVR message with EVR data Given a byte array of EVR data, format the EVR's message attribute printf format strings and split the byte array into appropriately sized chunks. Supports most format strings containing length and type fields. Args: evr_hist_data: A...
[ "Format", "EVR", "message", "with", "EVR", "data" ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/evr.py#L104-L221
NASA-AMMOS/AIT-Core
ait/core/seq.py
Seq._parseHeader
def _parseHeader (self, line, lineno, log): """Parses a sequence header line containing 'name: value' pairs.""" if line.startswith('#') and line.find(':') > 0: tokens = [ t.strip().lower() for t in line[1:].split(":", 1) ] name = tokens[0] pos = SeqPos(line, lineno) if name in self...
python
def _parseHeader (self, line, lineno, log): """Parses a sequence header line containing 'name: value' pairs.""" if line.startswith('#') and line.find(':') > 0: tokens = [ t.strip().lower() for t in line[1:].split(":", 1) ] name = tokens[0] pos = SeqPos(line, lineno) if name in self...
[ "def", "_parseHeader", "(", "self", ",", "line", ",", "lineno", ",", "log", ")", ":", "if", "line", ".", "startswith", "(", "'#'", ")", "and", "line", ".", "find", "(", "':'", ")", ">", "0", ":", "tokens", "=", "[", "t", ".", "strip", "(", ")",...
Parses a sequence header line containing 'name: value' pairs.
[ "Parses", "a", "sequence", "header", "line", "containing", "name", ":", "value", "pairs", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L69-L87
NASA-AMMOS/AIT-Core
ait/core/seq.py
Seq.append
def append (self, cmd, delay=0.000, attrs=None): """Adds a new command with a relative time delay to this sequence.""" self.lines.append( SeqCmd(cmd, delay, attrs) )
python
def append (self, cmd, delay=0.000, attrs=None): """Adds a new command with a relative time delay to this sequence.""" self.lines.append( SeqCmd(cmd, delay, attrs) )
[ "def", "append", "(", "self", ",", "cmd", ",", "delay", "=", "0.000", ",", "attrs", "=", "None", ")", ":", "self", ".", "lines", ".", "append", "(", "SeqCmd", "(", "cmd", ",", "delay", ",", "attrs", ")", ")" ]
Adds a new command with a relative time delay to this sequence.
[ "Adds", "a", "new", "command", "with", "a", "relative", "time", "delay", "to", "this", "sequence", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L145-L147
NASA-AMMOS/AIT-Core
ait/core/seq.py
Seq.printText
def printText (self, stream=None): """Prints a text representation of this sequence to the given stream or standard output. """ if stream is None: stream = sys.stdout stream.write('# seqid : %u\n' % self.seqid ) stream.write('# version : %u\n' % self.version ) ...
python
def printText (self, stream=None): """Prints a text representation of this sequence to the given stream or standard output. """ if stream is None: stream = sys.stdout stream.write('# seqid : %u\n' % self.seqid ) stream.write('# version : %u\n' % self.version ) ...
[ "def", "printText", "(", "self", ",", "stream", "=", "None", ")", ":", "if", "stream", "is", "None", ":", "stream", "=", "sys", ".", "stdout", "stream", ".", "write", "(", "'# seqid : %u\\n'", "%", "self", ".", "seqid", ")", "stream", ".", "write", ...
Prints a text representation of this sequence to the given stream or standard output.
[ "Prints", "a", "text", "representation", "of", "this", "sequence", "to", "the", "given", "stream", "or", "standard", "output", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L150-L166
NASA-AMMOS/AIT-Core
ait/core/seq.py
Seq.read
def read (self, filename=None): """Reads a command sequence from the given filename (defaults to self.pathname). """ if filename is None: filename = self.pathname stream = open(filename, 'rb') magic = struct.unpack('>H', stream.read(2))[0] stream.close() if magic == Seq.Magic: ...
python
def read (self, filename=None): """Reads a command sequence from the given filename (defaults to self.pathname). """ if filename is None: filename = self.pathname stream = open(filename, 'rb') magic = struct.unpack('>H', stream.read(2))[0] stream.close() if magic == Seq.Magic: ...
[ "def", "read", "(", "self", ",", "filename", "=", "None", ")", ":", "if", "filename", "is", "None", ":", "filename", "=", "self", ".", "pathname", "stream", "=", "open", "(", "filename", ",", "'rb'", ")", "magic", "=", "struct", ".", "unpack", "(", ...
Reads a command sequence from the given filename (defaults to self.pathname).
[ "Reads", "a", "command", "sequence", "from", "the", "given", "filename", "(", "defaults", "to", "self", ".", "pathname", ")", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L169-L183
NASA-AMMOS/AIT-Core
ait/core/seq.py
Seq.readBinary
def readBinary (self, filename=None): """Reads a binary command sequence from the given filename (defaults to self.pathname). """ if filename is None: filename = self.pathname stream = open(filename, 'rb') magic = struct.unpack('>H', stream.read(2))[0] self.crc32 = stru...
python
def readBinary (self, filename=None): """Reads a binary command sequence from the given filename (defaults to self.pathname). """ if filename is None: filename = self.pathname stream = open(filename, 'rb') magic = struct.unpack('>H', stream.read(2))[0] self.crc32 = stru...
[ "def", "readBinary", "(", "self", ",", "filename", "=", "None", ")", ":", "if", "filename", "is", "None", ":", "filename", "=", "self", ".", "pathname", "stream", "=", "open", "(", "filename", ",", "'rb'", ")", "magic", "=", "struct", ".", "unpack", ...
Reads a binary command sequence from the given filename (defaults to self.pathname).
[ "Reads", "a", "binary", "command", "sequence", "from", "the", "given", "filename", "(", "defaults", "to", "self", ".", "pathname", ")", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L186-L203
NASA-AMMOS/AIT-Core
ait/core/seq.py
Seq.readText
def readText (self, filename=None): """Reads a text command sequence from the given filename (defaults to self.pathname). """ if filename is None: filename = self.pathname self.header = { } inBody = False with open(filename, 'rt') as stream: for (lineno, line) in enumerate...
python
def readText (self, filename=None): """Reads a text command sequence from the given filename (defaults to self.pathname). """ if filename is None: filename = self.pathname self.header = { } inBody = False with open(filename, 'rt') as stream: for (lineno, line) in enumerate...
[ "def", "readText", "(", "self", ",", "filename", "=", "None", ")", ":", "if", "filename", "is", "None", ":", "filename", "=", "self", ".", "pathname", "self", ".", "header", "=", "{", "}", "inBody", "=", "False", "with", "open", "(", "filename", ",",...
Reads a text command sequence from the given filename (defaults to self.pathname).
[ "Reads", "a", "text", "command", "sequence", "from", "the", "given", "filename", "(", "defaults", "to", "self", ".", "pathname", ")", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L206-L237
NASA-AMMOS/AIT-Core
ait/core/seq.py
Seq.validate
def validate (self): """Returns True if this Sequence is valid, False otherwise. Validation error messages are stored in self.messages. """ if not os.path.isfile(self.pathname): self.message.append('Filename "%s" does not exist.') else: try: with open(self.pathname, 'r') as strea...
python
def validate (self): """Returns True if this Sequence is valid, False otherwise. Validation error messages are stored in self.messages. """ if not os.path.isfile(self.pathname): self.message.append('Filename "%s" does not exist.') else: try: with open(self.pathname, 'r') as strea...
[ "def", "validate", "(", "self", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "self", ".", "pathname", ")", ":", "self", ".", "message", ".", "append", "(", "'Filename \"%s\" does not exist.'", ")", "else", ":", "try", ":", "with", "ope...
Returns True if this Sequence is valid, False otherwise. Validation error messages are stored in self.messages.
[ "Returns", "True", "if", "this", "Sequence", "is", "valid", "False", "otherwise", ".", "Validation", "error", "messages", "are", "stored", "in", "self", ".", "messages", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L240-L259
NASA-AMMOS/AIT-Core
ait/core/seq.py
Seq.writeBinary
def writeBinary (self, filename=None): """Writes a binary representation of this sequence to the given filename (defaults to self.binpath). """ if filename is None: filename = self.binpath with open(filename, 'wb') as output: # Magic Number output.write( struct.pack('>H', Seq.Magi...
python
def writeBinary (self, filename=None): """Writes a binary representation of this sequence to the given filename (defaults to self.binpath). """ if filename is None: filename = self.binpath with open(filename, 'wb') as output: # Magic Number output.write( struct.pack('>H', Seq.Magi...
[ "def", "writeBinary", "(", "self", ",", "filename", "=", "None", ")", ":", "if", "filename", "is", "None", ":", "filename", "=", "self", ".", "binpath", "with", "open", "(", "filename", ",", "'wb'", ")", "as", "output", ":", "# Magic Number", "output", ...
Writes a binary representation of this sequence to the given filename (defaults to self.binpath).
[ "Writes", "a", "binary", "representation", "of", "this", "sequence", "to", "the", "given", "filename", "(", "defaults", "to", "self", ".", "binpath", ")", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L262-L294
NASA-AMMOS/AIT-Core
ait/core/seq.py
Seq.writeText
def writeText (self, filename=None): """Writes a text representation of this sequence to the given filename (defaults to self.txtpath). """ if filename is None: filename = self.txtpath with open(filename, 'wt') as output: self.printText(output)
python
def writeText (self, filename=None): """Writes a text representation of this sequence to the given filename (defaults to self.txtpath). """ if filename is None: filename = self.txtpath with open(filename, 'wt') as output: self.printText(output)
[ "def", "writeText", "(", "self", ",", "filename", "=", "None", ")", ":", "if", "filename", "is", "None", ":", "filename", "=", "self", ".", "txtpath", "with", "open", "(", "filename", ",", "'wt'", ")", "as", "output", ":", "self", ".", "printText", "...
Writes a text representation of this sequence to the given filename (defaults to self.txtpath).
[ "Writes", "a", "text", "representation", "of", "this", "sequence", "to", "the", "given", "filename", "(", "defaults", "to", "self", ".", "txtpath", ")", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L297-L305
NASA-AMMOS/AIT-Core
ait/core/seq.py
SeqCmd.decode
def decode (cls, bytes, cmddict): """Decodes a sequence command from an array of bytes, according to the given command dictionary, and returns a new SeqCmd. """ attrs = SeqCmdAttrs.decode(bytes[0:1]) delay = SeqDelay .decode(bytes[1:4]) cmd = cmddict .decode(bytes[4:] ) return cls(cmd...
python
def decode (cls, bytes, cmddict): """Decodes a sequence command from an array of bytes, according to the given command dictionary, and returns a new SeqCmd. """ attrs = SeqCmdAttrs.decode(bytes[0:1]) delay = SeqDelay .decode(bytes[1:4]) cmd = cmddict .decode(bytes[4:] ) return cls(cmd...
[ "def", "decode", "(", "cls", ",", "bytes", ",", "cmddict", ")", ":", "attrs", "=", "SeqCmdAttrs", ".", "decode", "(", "bytes", "[", "0", ":", "1", "]", ")", "delay", "=", "SeqDelay", ".", "decode", "(", "bytes", "[", "1", ":", "4", "]", ")", "c...
Decodes a sequence command from an array of bytes, according to the given command dictionary, and returns a new SeqCmd.
[ "Decodes", "a", "sequence", "command", "from", "an", "array", "of", "bytes", "according", "to", "the", "given", "command", "dictionary", "and", "returns", "a", "new", "SeqCmd", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L418-L425
NASA-AMMOS/AIT-Core
ait/core/seq.py
SeqCmd.encode
def encode (self): """Encodes this SeqCmd to binary and returns a bytearray.""" return self.attrs.encode() + self.delay.encode() + self.cmd.encode()
python
def encode (self): """Encodes this SeqCmd to binary and returns a bytearray.""" return self.attrs.encode() + self.delay.encode() + self.cmd.encode()
[ "def", "encode", "(", "self", ")", ":", "return", "self", ".", "attrs", ".", "encode", "(", ")", "+", "self", ".", "delay", ".", "encode", "(", ")", "+", "self", ".", "cmd", ".", "encode", "(", ")" ]
Encodes this SeqCmd to binary and returns a bytearray.
[ "Encodes", "this", "SeqCmd", "to", "binary", "and", "returns", "a", "bytearray", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L428-L430
NASA-AMMOS/AIT-Core
ait/core/seq.py
SeqCmd.parse
def parse (cls, line, lineno, log, cmddict): """Parses the sequence command from a line of text, according to the given command dictionary, and returns a new SeqCmd. """ delay = SeqDelay .parse(line, lineno, log, cmddict) attrs = SeqCmdAttrs.parse(line, lineno, log, cmddict) comment = SeqC...
python
def parse (cls, line, lineno, log, cmddict): """Parses the sequence command from a line of text, according to the given command dictionary, and returns a new SeqCmd. """ delay = SeqDelay .parse(line, lineno, log, cmddict) attrs = SeqCmdAttrs.parse(line, lineno, log, cmddict) comment = SeqC...
[ "def", "parse", "(", "cls", ",", "line", ",", "lineno", ",", "log", ",", "cmddict", ")", ":", "delay", "=", "SeqDelay", ".", "parse", "(", "line", ",", "lineno", ",", "log", ",", "cmddict", ")", "attrs", "=", "SeqCmdAttrs", ".", "parse", "(", "line...
Parses the sequence command from a line of text, according to the given command dictionary, and returns a new SeqCmd.
[ "Parses", "the", "sequence", "command", "from", "a", "line", "of", "text", "according", "to", "the", "given", "command", "dictionary", "and", "returns", "a", "new", "SeqCmd", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L434-L464
NASA-AMMOS/AIT-Core
ait/core/seq.py
SeqCmdAttrs.default
def default (self): """The default sequence command attributes (as an integer).""" byte = 0 for bit, name, value0, value1, default in SeqCmdAttrs.Table: if default == value1: byte = setBit(byte, bit, 1) return byte
python
def default (self): """The default sequence command attributes (as an integer).""" byte = 0 for bit, name, value0, value1, default in SeqCmdAttrs.Table: if default == value1: byte = setBit(byte, bit, 1) return byte
[ "def", "default", "(", "self", ")", ":", "byte", "=", "0", "for", "bit", ",", "name", ",", "value0", ",", "value1", ",", "default", "in", "SeqCmdAttrs", ".", "Table", ":", "if", "default", "==", "value1", ":", "byte", "=", "setBit", "(", "byte", ",...
The default sequence command attributes (as an integer).
[ "The", "default", "sequence", "command", "attributes", "(", "as", "an", "integer", ")", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L507-L513
NASA-AMMOS/AIT-Core
ait/core/seq.py
SeqCmdAttrs.decode
def decode (cls, bytes, cmddict=None): """Decodes sequence command attributes from an array of bytes and returns a new SeqCmdAttrs. """ byte = struct.unpack('B', bytes)[0] self = cls() defval = self.default for bit, name, value0, value1, default in SeqCmdAttrs.Table: mask = 1 <<...
python
def decode (cls, bytes, cmddict=None): """Decodes sequence command attributes from an array of bytes and returns a new SeqCmdAttrs. """ byte = struct.unpack('B', bytes)[0] self = cls() defval = self.default for bit, name, value0, value1, default in SeqCmdAttrs.Table: mask = 1 <<...
[ "def", "decode", "(", "cls", ",", "bytes", ",", "cmddict", "=", "None", ")", ":", "byte", "=", "struct", ".", "unpack", "(", "'B'", ",", "bytes", ")", "[", "0", "]", "self", "=", "cls", "(", ")", "defval", "=", "self", ".", "default", "for", "b...
Decodes sequence command attributes from an array of bytes and returns a new SeqCmdAttrs.
[ "Decodes", "sequence", "command", "attributes", "from", "an", "array", "of", "bytes", "and", "returns", "a", "new", "SeqCmdAttrs", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L517-L535
NASA-AMMOS/AIT-Core
ait/core/seq.py
SeqCmdAttrs.encode
def encode (self): """Encodes this SeqCmdAttrs to binary and returns a bytearray.""" byte = self.default for bit, name, value0, value1, default in SeqCmdAttrs.Table: if name in self.attrs: value = self.attrs[name] byte = setBit(byte, bit, value == value1) return struct.pack('B',...
python
def encode (self): """Encodes this SeqCmdAttrs to binary and returns a bytearray.""" byte = self.default for bit, name, value0, value1, default in SeqCmdAttrs.Table: if name in self.attrs: value = self.attrs[name] byte = setBit(byte, bit, value == value1) return struct.pack('B',...
[ "def", "encode", "(", "self", ")", ":", "byte", "=", "self", ".", "default", "for", "bit", ",", "name", ",", "value0", ",", "value1", ",", "default", "in", "SeqCmdAttrs", ".", "Table", ":", "if", "name", "in", "self", ".", "attrs", ":", "value", "=...
Encodes this SeqCmdAttrs to binary and returns a bytearray.
[ "Encodes", "this", "SeqCmdAttrs", "to", "binary", "and", "returns", "a", "bytearray", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L538-L547
NASA-AMMOS/AIT-Core
ait/core/seq.py
SeqCmdAttrs.parse
def parse (cls, line, lineno, log, cmddict=None): """Parses a SeqCmdAttrs from a line of text and returns it or None. Warning and error messages are logged via the SeqMsgLog log. """ start = line.find('{') stop = line.find('}') pos = SeqPos(line, lineno, start + 1, stop) result = cls(N...
python
def parse (cls, line, lineno, log, cmddict=None): """Parses a SeqCmdAttrs from a line of text and returns it or None. Warning and error messages are logged via the SeqMsgLog log. """ start = line.find('{') stop = line.find('}') pos = SeqPos(line, lineno, start + 1, stop) result = cls(N...
[ "def", "parse", "(", "cls", ",", "line", ",", "lineno", ",", "log", ",", "cmddict", "=", "None", ")", ":", "start", "=", "line", ".", "find", "(", "'{'", ")", "stop", "=", "line", ".", "find", "(", "'}'", ")", "pos", "=", "SeqPos", "(", "line",...
Parses a SeqCmdAttrs from a line of text and returns it or None. Warning and error messages are logged via the SeqMsgLog log.
[ "Parses", "a", "SeqCmdAttrs", "from", "a", "line", "of", "text", "and", "returns", "it", "or", "None", ".", "Warning", "and", "error", "messages", "are", "logged", "via", "the", "SeqMsgLog", "log", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L551-L579
NASA-AMMOS/AIT-Core
ait/core/seq.py
SeqDelay.decode
def decode (cls, bytes, cmddict=None): """Decodes a sequence delay from an array of bytes, according to the given command dictionary, and returns a new SeqDelay. """ delay_s = struct.unpack('>H', bytes[0:2])[0] delay_ms = struct.unpack('B' , bytes[2:3])[0] return cls(delay_s + (delay_ms / 255.0...
python
def decode (cls, bytes, cmddict=None): """Decodes a sequence delay from an array of bytes, according to the given command dictionary, and returns a new SeqDelay. """ delay_s = struct.unpack('>H', bytes[0:2])[0] delay_ms = struct.unpack('B' , bytes[2:3])[0] return cls(delay_s + (delay_ms / 255.0...
[ "def", "decode", "(", "cls", ",", "bytes", ",", "cmddict", "=", "None", ")", ":", "delay_s", "=", "struct", ".", "unpack", "(", "'>H'", ",", "bytes", "[", "0", ":", "2", "]", ")", "[", "0", "]", "delay_ms", "=", "struct", ".", "unpack", "(", "'...
Decodes a sequence delay from an array of bytes, according to the given command dictionary, and returns a new SeqDelay.
[ "Decodes", "a", "sequence", "delay", "from", "an", "array", "of", "bytes", "according", "to", "the", "given", "command", "dictionary", "and", "returns", "a", "new", "SeqDelay", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L630-L636
NASA-AMMOS/AIT-Core
ait/core/seq.py
SeqDelay.encode
def encode (self): """Encodes this SeqDelay to a binary bytearray.""" delay_s = int( math.floor(self.delay) ) delay_ms = int( (self.delay - delay_s) * 255.0 ) return struct.pack('>H', delay_s) + struct.pack('B', delay_ms)
python
def encode (self): """Encodes this SeqDelay to a binary bytearray.""" delay_s = int( math.floor(self.delay) ) delay_ms = int( (self.delay - delay_s) * 255.0 ) return struct.pack('>H', delay_s) + struct.pack('B', delay_ms)
[ "def", "encode", "(", "self", ")", ":", "delay_s", "=", "int", "(", "math", ".", "floor", "(", "self", ".", "delay", ")", ")", "delay_ms", "=", "int", "(", "(", "self", ".", "delay", "-", "delay_s", ")", "*", "255.0", ")", "return", "struct", "."...
Encodes this SeqDelay to a binary bytearray.
[ "Encodes", "this", "SeqDelay", "to", "a", "binary", "bytearray", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L639-L643
NASA-AMMOS/AIT-Core
ait/core/seq.py
SeqDelay.parse
def parse (cls, line, lineno, log, cmddict=None): """Parses the SeqDelay from a line of text. Warning and error messages are logged via the SeqMsgLog log. """ delay = -1 token = line.split()[0] start = line.find(token) pos = SeqPos(line, lineno, start + 1, start + len(token)) try: ...
python
def parse (cls, line, lineno, log, cmddict=None): """Parses the SeqDelay from a line of text. Warning and error messages are logged via the SeqMsgLog log. """ delay = -1 token = line.split()[0] start = line.find(token) pos = SeqPos(line, lineno, start + 1, start + len(token)) try: ...
[ "def", "parse", "(", "cls", ",", "line", ",", "lineno", ",", "log", ",", "cmddict", "=", "None", ")", ":", "delay", "=", "-", "1", "token", "=", "line", ".", "split", "(", ")", "[", "0", "]", "start", "=", "line", ".", "find", "(", "token", "...
Parses the SeqDelay from a line of text. Warning and error messages are logged via the SeqMsgLog log.
[ "Parses", "the", "SeqDelay", "from", "a", "line", "of", "text", ".", "Warning", "and", "error", "messages", "are", "logged", "via", "the", "SeqMsgLog", "log", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L647-L662
NASA-AMMOS/AIT-Core
ait/core/seq.py
SeqMetaCmd.parse
def parse (cls, line, lineno, log, cmddict=None): """Parses the SeqMetaCmd from a line of text. Warning and error messages are logged via the SeqMsgLog log. """ start = line.find('%') pos = SeqPos(line, lineno, start + 1, len(line)) result = None if start >= 0: result = cls(line[...
python
def parse (cls, line, lineno, log, cmddict=None): """Parses the SeqMetaCmd from a line of text. Warning and error messages are logged via the SeqMsgLog log. """ start = line.find('%') pos = SeqPos(line, lineno, start + 1, len(line)) result = None if start >= 0: result = cls(line[...
[ "def", "parse", "(", "cls", ",", "line", ",", "lineno", ",", "log", ",", "cmddict", "=", "None", ")", ":", "start", "=", "line", ".", "find", "(", "'%'", ")", "pos", "=", "SeqPos", "(", "line", ",", "lineno", ",", "start", "+", "1", ",", "len",...
Parses the SeqMetaCmd from a line of text. Warning and error messages are logged via the SeqMsgLog log.
[ "Parses", "the", "SeqMetaCmd", "from", "a", "line", "of", "text", ".", "Warning", "and", "error", "messages", "are", "logged", "via", "the", "SeqMsgLog", "log", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L687-L698
NASA-AMMOS/AIT-Core
ait/core/seq.py
SeqMsgLog.error
def error (self, msg, pos=None): """Logs an error message pertaining to the given SeqPos.""" self.log(msg, 'error: ' + self.location(pos))
python
def error (self, msg, pos=None): """Logs an error message pertaining to the given SeqPos.""" self.log(msg, 'error: ' + self.location(pos))
[ "def", "error", "(", "self", ",", "msg", ",", "pos", "=", "None", ")", ":", "self", ".", "log", "(", "msg", ",", "'error: '", "+", "self", ".", "location", "(", "pos", ")", ")" ]
Logs an error message pertaining to the given SeqPos.
[ "Logs", "an", "error", "message", "pertaining", "to", "the", "given", "SeqPos", "." ]
train
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/seq.py#L715-L717