diff --git a/gamutrf/compress_dirs.py b/gamutrf/compress_dirs.py index 8a8131ad..18adc015 100644 --- a/gamutrf/compress_dirs.py +++ b/gamutrf/compress_dirs.py @@ -1,11 +1,8 @@ import argparse -import logging import os import sys import time import tarfile -import gzip -import subprocess import sysrsync @@ -25,8 +22,8 @@ def check_tld(top_dir, args): f"Folders inside '{top_dir}' that are more than {args.threshold_seconds} seconds old:" ) - for dir in os.listdir(top_dir): - dir_path = os.path.join(top_dir, dir) + for sdir in os.listdir(top_dir): + dir_path = os.path.join(top_dir, sdir) if os.path.isdir(dir_path): folder_mtime = os.path.getmtime(dir_path) if current_time - folder_mtime > args.threshold_seconds: @@ -54,7 +51,7 @@ def tar_directories(dir_paths, args): with tarfile.open(tar_filename, file_mode) as tar_file: # Add all files in the directory to the tar file - for root, dirs, files in os.walk(dir_path): + for root, _dirs, files in os.walk(dir_path): for file in files: file_path = os.path.join(root, file) tar_file.add(file_path) @@ -66,7 +63,7 @@ def tar_directories(dir_paths, args): # Delete if --delete if args.delete: - for root, dirs, files in os.walk(dir_path): + for root, _dirs, files in os.walk(dir_path): for file in files: file_path = os.path.join(root, file) os.remove(file_path) @@ -186,9 +183,9 @@ def main(): for filename in tarred_filenames: print(filename) print("...finished processing files") - if args.export_path != None: + if args.export_path is not None: print(f"Exporting tar files to {args.export_path}") - exported_filepath = export_to_path(args.dir, args.export_path, args) + export_to_path(args.dir, args.export_path, args) print(f"...done exporting to {args.export_path}") else: print("No valid folders found.") diff --git a/gamutrf/grsource.py b/gamutrf/grsource.py index f1dd4eb2..8d59527b 100644 --- a/gamutrf/grsource.py +++ b/gamutrf/grsource.py @@ -1,6 +1,5 @@ import logging import os -import random import sys import time from urllib.parse import urlparse diff --git a/gamutrf/offline.py b/gamutrf/offline.py index 1197da28..f8f643c8 100644 --- a/gamutrf/offline.py +++ b/gamutrf/offline.py @@ -1,9 +1,7 @@ #!/usr/bin/python3 -from argparse import ArgumentParser, BooleanOptionalAction import glob import os import logging -import tempfile import time from gnuradio import iqtlabs @@ -17,7 +15,6 @@ def main(): parser = argument_parser() parser.add_argument("filename", type=str, help="Recording filename (or glob)") options = parser.parse_args() - filename = options.filename for filename in glob.glob(options.filename): out_dir = os.path.dirname(filename) if out_dir == "": diff --git a/gamutrf/scan.py b/gamutrf/scan.py index f6f1e367..2fbda7ab 100644 --- a/gamutrf/scan.py +++ b/gamutrf/scan.py @@ -1,5 +1,4 @@ import logging -import os import signal import time import sys @@ -272,7 +271,7 @@ def argument_parser(): dest="scaling", type=str, default="spectrum", - help="""Same as --scaling parameter in scipy.signal.spectrogram(). + help="""Same as --scaling parameter in scipy.signal.spectrogram(). Selects between computing the power spectral density ('density') where `Sxx` has units of V**2/Hz and computing the power spectrum ('spectrum') where `Sxx` has units of V**2, if `x` diff --git a/gamutrf/utils.py b/gamutrf/utils.py index d80d3449..4a3613c7 100644 --- a/gamutrf/utils.py +++ b/gamutrf/utils.py @@ -5,7 +5,6 @@ import sys from pathlib import Path -import numpy as np import requests MTU = 8962 diff --git a/tests/test_birdseye_rssi.py b/tests/test_birdseye_rssi.py index 5a47aa73..0f0531c7 100644 --- a/tests/test_birdseye_rssi.py +++ b/tests/test_birdseye_rssi.py @@ -2,6 +2,7 @@ import glob import json import os +import subprocess import tempfile import time import unittest @@ -9,7 +10,6 @@ import docker import numpy as np import requests -import subprocess from gamutrf.birdseye_rssi import BirdsEyeRSSI diff --git a/tests/test_sigwindows.py b/tests/test_sigwindows.py index 0474cbe0..05d01a00 100644 --- a/tests/test_sigwindows.py +++ b/tests/test_sigwindows.py @@ -1,13 +1,11 @@ #!/usr/bin/python3 import os -import tempfile import unittest from gamutrf.sigwindows import choose_record_signal from gamutrf.sigwindows import choose_recorders from gamutrf.sigwindows import freq_excluded from gamutrf.sigwindows import parse_freq_excluded -from gamutrf.sigwindows import ROLLOVERHZ, ROLLING_FACTOR TESTDIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data")