Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #538 - Formatting and Linting #539

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ait/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
# laws and regulations. User has the responsibility to obtain export licenses,
# or other export authority as may be required before exporting such
# information to foreign countries or providing access to foreign persons.

import sys

from ait.core import cfg # noqa
from ait.core import log

# cfg isn't used but we want the AIT-level config attribute created
from ait.core import cfg, log # noqa


def deprecated(message):
Expand Down
9 changes: 6 additions & 3 deletions ait/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ def __str__(self):

@property
def msg(self):
s = 'FalseWaitError: "False" boolean passed as argument to wait. Ensure wait ' \
s = (
'FalseWaitError: "False" boolean passed as argument to wait. Ensure wait '
'condition args are surrounded by lambda or " "'
)

if self._msg:
s += ": " + self._msg
Expand All @@ -110,7 +112,6 @@ class CmdAPI:
"""

def __init__(self, udp_dest=None, cmddict=None, verbose=False, cmdtopic=None):

if cmddict is None:
cmddict = cmd.getDefaultCmdDict()

Expand Down Expand Up @@ -847,7 +848,9 @@ def _send_msg_box_request(self, data):
log.error("User prompt request failed due to too many redirects")
ret = None
except requests.exceptions.Timeout:
raise APITimeoutError(timeout=conn_timeout, msg="User confirm prompt timed out")
raise APITimeoutError(
timeout=conn_timeout, msg="User confirm prompt timed out"
)
except KeyError:
log.error("User prompt request received malformed response")
ret = None
Expand Down
8 changes: 2 additions & 6 deletions ait/core/bin/ait_bsc_create_handler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python

# Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT)
# Bespoke Link to Instruments and Small Satellites (BLISS)
#
Expand All @@ -13,7 +12,6 @@
# laws and regulations. User has the responsibility to obtain export licenses,
# or other export authority as may be required before exporting such
# information to foreign countries or providing access to foreign persons.

"""
Usage:
ait-bsc-create-handler [options] <name> <loc> <port> <conn_type>
Expand All @@ -35,8 +33,8 @@
include handler metadata values as well as strftime
format characters [default: %Y-%m-%d-%H-%M-%S-{name}.pcap]
"""

import argparse

import requests


Expand All @@ -63,9 +61,7 @@ def main():
default="day",
)
parser.add_argument("--rotate-log-delta", type=int, default=1)
parser.add_argument(
"--file-name-pattern", default="%Y-%m-%d-%H-%M-%S-{name}.pcap"
)
parser.add_argument("--file-name-pattern", default="%Y-%m-%d-%H-%M-%S-{name}.pcap")

# Get command line arguments
args = vars(parser.parse_args())
Expand Down
4 changes: 1 addition & 3 deletions ait/core/bin/ait_bsc_stop_handler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python

# Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT)
# Bespoke Link to Instruments and Small Satellites (BLISS)
#
Expand All @@ -13,7 +12,6 @@
# laws and regulations. User has the responsibility to obtain export licenses,
# or other export authority as may be required before exporting such
# information to foreign countries or providing access to foreign persons.

"""
Usage:
ait-bsc-stop-handler [options] <name>
Expand All @@ -23,9 +21,9 @@
--service-port=<port> The port for the BSC REST service connection
[default: 8080]
"""
import argparse

import requests
import argparse


def main():
Expand Down
2 changes: 1 addition & 1 deletion ait/core/bin/ait_ccsds_send_example.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python

import socket
import struct
import time

from ait.core import log

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
Expand Down
4 changes: 2 additions & 2 deletions ait/core/bin/ait_cmd_hist.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python

import argparse

from ait.core import log, pcap
from ait.core import log
from ait.core import pcap


"""Query all commands from a Command History PCAP"""
Expand Down
8 changes: 3 additions & 5 deletions ait/core/bin/ait_cmd_send.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python

# Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT)
# Bespoke Link to Instruments and Small Satellites (BLISS)
#
Expand All @@ -13,7 +12,6 @@
# laws and regulations. User has the responsibility to obtain export licenses,
# or other export authority as may be required before exporting such
# information to foreign countries or providing access to foreign persons.

#
#
# Sends the given command and its arguments to the ISS simulator via
Expand All @@ -23,7 +21,6 @@
# $ ait-cmd-send OCO3_CMD_START_SEQUENCE_NOW 1
#
#

"""
usage: ait-cmd-send [options] command [arguments]

Expand All @@ -40,12 +37,13 @@

$ ait-cmd-send OCO3_CMD_START_SEQUENCE_NOW 1
"""

import argparse
from collections import OrderedDict

import ait
from ait.core import api, log, util
from ait.core import api
from ait.core import log
from ait.core import util


def main():
Expand Down
12 changes: 5 additions & 7 deletions ait/core/bin/ait_create_dirs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python

# Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT)
# Bespoke Link to Instruments and Small Satellites (BLISS)
#
Expand All @@ -13,7 +12,6 @@
# laws and regulations. User has the responsibility to obtain export licenses,
# or other export authority as may be required before exporting such
# information to foreign countries or providing access to foreign persons.

"""
Usage:
ait-create-dirs [options]
Expand Down Expand Up @@ -114,15 +112,15 @@


"""

import os
import errno
import traceback
import argparse
import errno
import os
import time
import traceback

import ait
from ait.core import dmc, log
from ait.core import dmc
from ait.core import log


def create_dir_struct(paths, verbose=True):
Expand Down
8 changes: 3 additions & 5 deletions ait/core/bin/ait_dict_writer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python

# Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT)
# Bespoke Link to Instruments and Small Satellites (BLISS)
#
Expand All @@ -13,7 +12,6 @@
# laws and regulations. User has the responsibility to obtain export licenses,
# or other export authority as may be required before exporting such
# information to foreign countries or providing access to foreign persons.

"""
Usage:
ait-dict-writer [options] (--tlm | --cmd)
Expand All @@ -39,11 +37,11 @@
Copyright 2016 California Institute of Technology. ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
"""

import sys
import argparse
import sys

from ait.core import log, tlm
from ait.core import log
from ait.core import tlm


def main():
Expand Down
2 changes: 0 additions & 2 deletions ait/core/bin/ait_limits_find_dn.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# laws and regulations. User has the responsibility to obtain export licenses,
# or other export authority as may be required before exporting such
# information to foreign countries or providing access to foreign persons.

"""
ait-limits-find-dn

Expand All @@ -39,7 +38,6 @@
- TABLE_FOO
- TABLE_BAR
"""

from ait.core import limits
from ait.core import log
from ait.core import tlm
Expand Down
1 change: 0 additions & 1 deletion ait/core/bin/ait_mps_seq_convert.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python

import argparse
import datetime as dt
import os.path
Expand Down
8 changes: 4 additions & 4 deletions ait/core/bin/ait_pcap.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python

# Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT)
# Bespoke Link to Instruments and Small Satellites (BLISS)
#
Expand All @@ -13,16 +12,17 @@
# laws and regulations. User has the responsibility to obtain export licenses,
# or other export authority as may be required before exporting such
# information to foreign countries or providing access to foreign persons.

"""
Provides a command line script for running pcap library functions.
"""

import argparse
import datetime
import os

from ait.core import dmc, log, pcap, util
from ait.core import dmc
from ait.core import log
from ait.core import pcap
from ait.core import util


def main():
Expand Down
8 changes: 2 additions & 6 deletions ait/core/bin/ait_pcap_segment.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python

# Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT)
# Bespoke Link to Instruments and Small Satellites (BLISS)
#
Expand All @@ -13,8 +12,6 @@
# laws and regulations. User has the responsibility to obtain export licenses,
# or other export authority as may be required before exporting such
# information to foreign countries or providing access to foreign persons.


"""
Segments one or more pcap files into multiple pcap files, according to
a threshold number of bytes, packets, and/or seconds. New segment
Expand All @@ -37,11 +34,10 @@
And a new file will be started when a packet is written with a
timestamp that exceeds 2017-11-23 19:59:59.
"""


import argparse

from ait.core import log, pcap
from ait.core import log
from ait.core import pcap


def main():
Expand Down
8 changes: 3 additions & 5 deletions ait/core/bin/ait_seq_decode.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python

# Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT)
# Bespoke Link to Instruments and Small Satellites (BLISS)
#
Expand All @@ -13,7 +12,6 @@
# laws and regulations. User has the responsibility to obtain export licenses,
# or other export authority as may be required before exporting such
# information to foreign countries or providing access to foreign persons.

"""

usage: ait-seq-decode ait_seq_SSS_desc_NNN.bin
Expand All @@ -24,11 +22,11 @@

$ ait-seq-decode seq/ait_seq_gps_reset_001.bin
"""

import os
import argparse
import os

from ait.core import log, seq
from ait.core import log
from ait.core import seq


def main():
Expand Down
8 changes: 3 additions & 5 deletions ait/core/bin/ait_seq_encode.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python

# Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT)
# Bespoke Link to Instruments and Small Satellites (BLISS)
#
Expand All @@ -13,7 +12,6 @@
# laws and regulations. User has the responsibility to obtain export licenses,
# or other export authority as may be required before exporting such
# information to foreign countries or providing access to foreign persons.

"""
usage: ait-seq-encode mission_seq_SSS_desc_NNN.txt
where:
Expand All @@ -27,12 +25,12 @@

$ ait-seq-encode seq/ait_seq_gps_reset_001.txt
"""

import argparse
import os
import sys
import argparse

from ait.core import log, seq
from ait.core import log
from ait.core import seq


def main():
Expand Down
8 changes: 3 additions & 5 deletions ait/core/bin/ait_seq_print.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python

# Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT)
# Bespoke Link to Instruments and Small Satellites (BLISS)
#
Expand All @@ -13,7 +12,6 @@
# laws and regulations. User has the responsibility to obtain export licenses,
# or other export authority as may be required before exporting such
# information to foreign countries or providing access to foreign persons.

"""
usage: ait-seq-print ait_seq_SSS_NNN_desc.bin

Expand All @@ -24,11 +22,11 @@

$ ait-seq-print seq/ait_seq_gps_001_reset.bin
"""

import os
import argparse
import os

from ait.core import log, seq
from ait.core import log
from ait.core import seq


def main():
Expand Down
Loading
Loading