Skip to content

Commit

Permalink
Remove unused imports, pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
mdrxy committed Dec 9, 2024
1 parent 3c8cff2 commit 9f81615
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions OpenEndecV2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
Options allow for forwarding of decoded messages to a webhook URL or a GroupMe group.
"""
import os

import json
import sys
import argparse
import logging
import time
import requests
import serial
from serial import Serial
from serial.serialutil import SerialException

Expand Down Expand Up @@ -59,8 +57,9 @@
dest="trim",
action="store_true",
default=False,
help=('Trim the EAS message from the body before sending, destroying it.'
'"message" will contain the human readable text ONLY.'
help=(
"Trim the EAS message from the body before sending, destroying it."
'"message" will contain the human readable text ONLY.'
),
)
group.add_argument(
Expand All @@ -80,8 +79,9 @@
dest="quiet",
action="store_true",
default=False,
help=('Trim the human readable text from the message before sending. destroying it.'
'ONLY the EAS message will be sent (as "message").'
help=(
"Trim the human readable text from the message before sending. destroying it."
'ONLY the EAS message will be sent (as "message").'
),
)

Expand All @@ -90,7 +90,9 @@

if not any(getattr(args, arg) for arg in requiredArgs.values()):
ARG_LIST = ", ".join([f"--{arg}" for arg in requiredArgs.keys()])
parser.error(f"At least one of the following arguments must be provided: {ARG_LIST}")
parser.error(
f"At least one of the following arguments must be provided: {ARG_LIST}"
)

if args.debug:
logging.basicConfig(level=logging.DEBUG)
Expand All @@ -100,6 +102,7 @@ class Webhook:
"""
Generic class for sending messages to a webhook URL.
"""

def __init__(self, url=None, eas=None):
self.headers = {"Content-Type": "application/json"}
self.url = url
Expand Down Expand Up @@ -130,15 +133,17 @@ class GroupMe(Webhook):
"""
Operations for sending messages to a GroupMe group via a Bot.
"""

def post(self, message_content):
"""
Post message to a GroupMe group via a Bot.
"""

self.url = "https://api.groupme.com/v3/bots/post"

footer = ("\n\nThis message was sent using OpenENDEC V2.1"
"[github/WBOR-91-1-FM/wbor-endec]\n----------"
footer = (
"\n\nThis message was sent using OpenENDEC V2.1"
"[github/WBOR-91-1-FM/wbor-endec]\n----------"
)
body = f"{message_content}{footer}"

Expand Down Expand Up @@ -201,7 +206,7 @@ def newsfeed():

while True:
try:
ser = serial.Serial(args.port, baudrate=9600, bytesize=8, stopbits=1)
ser = Serial(args.port, baudrate=9600, bytesize=8, stopbits=1)
logging.info("Connected to serial port %s", args.port)
if ser.isOpen():
while True:
Expand All @@ -228,7 +233,7 @@ def newsfeed():
data_list.append(serial_text)
logging.debug("Line #%d: %s", i, serial_text)
i += 1
except (serial.SerialException, requests.exceptions.RequestException) as e:
except (SerialException, requests.exceptions.RequestException) as e:
logging.error("Handled error: %s", e)
finally:
if ser.isOpen():
Expand Down

0 comments on commit 9f81615

Please sign in to comment.