Skip to content

Commit

Permalink
Merge pull request #1048 from anarkiwi/pyl
Browse files Browse the repository at this point in the history
pylint cleanup
  • Loading branch information
anarkiwi authored Dec 18, 2023
2 parents bf91d00 + 59d63d8 commit b05dcbc
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 19 deletions.
15 changes: 6 additions & 9 deletions gamutrf/compress_dirs.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import argparse
import logging
import os
import sys
import time
import tarfile
import gzip
import subprocess
import sysrsync


Expand All @@ -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:
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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.")
Expand Down
1 change: 0 additions & 1 deletion gamutrf/grsource.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging
import os
import random
import sys
import time
from urllib.parse import urlparse
Expand Down
3 changes: 0 additions & 3 deletions gamutrf/offline.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 == "":
Expand Down
3 changes: 1 addition & 2 deletions gamutrf/scan.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import os
import signal
import time
import sys
Expand Down Expand Up @@ -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`
Expand Down
1 change: 0 additions & 1 deletion gamutrf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import sys
from pathlib import Path

import numpy as np
import requests

MTU = 8962
Expand Down
2 changes: 1 addition & 1 deletion tests/test_birdseye_rssi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import glob
import json
import os
import subprocess
import tempfile
import time
import unittest

import docker
import numpy as np
import requests
import subprocess

from gamutrf.birdseye_rssi import BirdsEyeRSSI

Expand Down
2 changes: 0 additions & 2 deletions tests/test_sigwindows.py
Original file line number Diff line number Diff line change
@@ -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")
Expand Down

0 comments on commit b05dcbc

Please sign in to comment.