From 264380a37f76064c10ba8c633c70502bc9b2b570 Mon Sep 17 00:00:00 2001 From: Jake Herbst Date: Wed, 11 May 2022 08:52:01 -0400 Subject: [PATCH] Fixing flake8 errors in script/server.py F401 'argparse' imported but unused F821 undefined name 'os' F821 undefined name 'socket' F821 undefined name 'threading' E712 comparison to True should be 'if cond is True:' or 'if cond:' --- scripts/server.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/server.py b/scripts/server.py index f383b13..42c7868 100755 --- a/scripts/server.py +++ b/scripts/server.py @@ -1,16 +1,15 @@ -import argparse +import os +import socket +import threading import operator import librosa import numpy as np import math import time -from decimal import Decimal import json import requests import sqlite3 import datetime -from time import sleep -import pytz from tzlocal import get_localzone from pathlib import Path import apprise @@ -216,7 +215,7 @@ def analyzeAudioData(chunks, lat, lon, week, sensitivity, overlap,): pred_end = pred_start + 3.0 # If human detected set all detections to human to make sure voices are not saved - if HUMAN_DETECTED == True: + if HUMAN_DETECTED is True: p = [('Human_Human', 0.0)] * 10 detections[str(pred_start) + ';' + str(pred_end)] = p @@ -237,7 +236,7 @@ def sendAppriseNotifications(species, confidence): body = str(str(str([i for i in this_run if i.startswith('APPRISE_NOTIFICATION_BODY')] ).split('=')[1]).split('\\')[0]).replace('"', '') - if str(str(str([i for i in this_run if i.startswith('APPRISE_NOTIFY_EACH_DETECTION')]).split('=')[1]).split('\\')[0]) == "1": + if str(str(str([i for i in this_run if i.startswith('APPRISE_NOTIFY_EACH_DETECTION')]).split('=')[1]).split('\\')[0]) == "1": # noqa E501 apobj = apprise.Apprise() config = apprise.AppriseConfig()