From 40ba22526804448f2da099a497801b3a800eb2e0 Mon Sep 17 00:00:00 2001
From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
Date: Thu, 9 May 2024 22:16:00 -0700
Subject: [PATCH] Clean up imports and blank lines
---
plexpy/__init__.py | 1 -
plexpy/activity_handler.py | 1 -
plexpy/activity_pinger.py | 2 -
plexpy/activity_processor.py | 1 -
plexpy/api2.py | 2 -
plexpy/classes.py | 71 ----------------------------------
plexpy/common.py | 2 -
plexpy/config.py | 1 -
plexpy/database.py | 1 -
plexpy/datafactory.py | 2 -
plexpy/datatables.py | 1 -
plexpy/exceptions.py | 1 -
plexpy/exporter.py | 1 -
plexpy/graphs.py | 3 +-
plexpy/helpers.py | 2 -
plexpy/http_handler.py | 1 -
plexpy/libraries.py | 2 -
plexpy/lock.py | 1 -
plexpy/logger.py | 1 -
plexpy/mobile_app.py | 2 -
plexpy/newsletter_handler.py | 1 -
plexpy/newsletters.py | 8 ++--
plexpy/notification_handler.py | 6 +--
plexpy/notifiers.py | 14 +++----
plexpy/plex.py | 3 --
plexpy/plexivity_import.py | 5 +--
plexpy/plextv.py | 3 +-
plexpy/plexwatch_import.py | 2 -
plexpy/pmsconnect.py | 1 -
plexpy/request.py | 5 +--
plexpy/session.py | 1 -
plexpy/users.py | 1 -
plexpy/version.py | 1 -
plexpy/versioncheck.py | 1 -
plexpy/web_socket.py | 1 -
plexpy/webauth.py | 1 -
plexpy/webserve.py | 7 ++--
plexpy/windows.py | 1 +
38 files changed, 24 insertions(+), 137 deletions(-)
delete mode 100644 plexpy/classes.py
diff --git a/plexpy/__init__.py b/plexpy/__init__.py
index 91c84657..0366fcde 100644
--- a/plexpy/__init__.py
+++ b/plexpy/__init__.py
@@ -13,7 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import ctypes
import datetime
import os
diff --git a/plexpy/activity_handler.py b/plexpy/activity_handler.py
index 79a95951..2758133b 100644
--- a/plexpy/activity_handler.py
+++ b/plexpy/activity_handler.py
@@ -13,7 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import datetime
import os
import time
diff --git a/plexpy/activity_pinger.py b/plexpy/activity_pinger.py
index 4f34c168..9e8487fb 100644
--- a/plexpy/activity_pinger.py
+++ b/plexpy/activity_pinger.py
@@ -13,7 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import threading
import plexpy
@@ -21,7 +20,6 @@ from plexpy import activity_handler
from plexpy import activity_processor
from plexpy import database
from plexpy import helpers
-from plexpy import libraries
from plexpy import logger
from plexpy import notification_handler
from plexpy import plextv
diff --git a/plexpy/activity_processor.py b/plexpy/activity_processor.py
index f1f418e1..952d8e59 100644
--- a/plexpy/activity_processor.py
+++ b/plexpy/activity_processor.py
@@ -13,7 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
from collections import defaultdict
import json
diff --git a/plexpy/api2.py b/plexpy/api2.py
index 9e44ca4f..9cc36b49 100644
--- a/plexpy/api2.py
+++ b/plexpy/api2.py
@@ -15,8 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
-
from hashing_passwords import check_hash
from io import open
diff --git a/plexpy/classes.py b/plexpy/classes.py
deleted file mode 100644
index 7cd39f53..00000000
--- a/plexpy/classes.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# This file is part of Tautulli.
-#
-# Tautulli is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Tautulli is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Tautulli. If not, see .
-
-#########################################
-## Stolen from Sick-Beard's classes.py ##
-#########################################
-
-
-
-from urllib.request import FancyURLopener
-
-import plexpy
-from plexpy.common import USER_AGENT
-
-
-class PlexPyURLopener(FancyURLopener):
- version = USER_AGENT
-
-
-class AuthURLOpener(PlexPyURLopener):
- """
- URLOpener class that supports http auth without needing interactive password entry.
- If the provided username/password don't work it simply fails.
-
- user: username to use for HTTP auth
- pw: password to use for HTTP auth
- """
-
- def __init__(self, user, pw):
- self.username = user
- self.password = pw
-
- # remember if we've tried the username/password before
- self.numTries = 0
-
- # call the base class
- FancyURLopener.__init__(self)
-
- def prompt_user_passwd(self, host, realm):
- """
- Override this function and instead of prompting just give the
- username/password that were provided when the class was instantiated.
- """
-
- # if this is the first try then provide a username/password
- if self.numTries == 0:
- self.numTries = 1
- return (self.username, self.password)
-
- # if we've tried before then return blank which cancels the request
- else:
- return ('', '')
-
- # this is pretty much just a hack for convenience
- def openit(self, url):
- self.numTries = 0
- return PlexPyURLopener.open(self, url)
diff --git a/plexpy/common.py b/plexpy/common.py
index fb9663ea..ae6f6c98 100644
--- a/plexpy/common.py
+++ b/plexpy/common.py
@@ -15,12 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import distro
import platform
from collections import OrderedDict
-import plexpy
from plexpy import version
diff --git a/plexpy/config.py b/plexpy/config.py
index 4c14742d..c41e3b59 100644
--- a/plexpy/config.py
+++ b/plexpy/config.py
@@ -13,7 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import os
import re
import shutil
diff --git a/plexpy/database.py b/plexpy/database.py
index 657aaf96..4762805f 100644
--- a/plexpy/database.py
+++ b/plexpy/database.py
@@ -13,7 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import os
import sqlite3
import shutil
diff --git a/plexpy/datafactory.py b/plexpy/datafactory.py
index aeb25da6..d48d3ea8 100644
--- a/plexpy/datafactory.py
+++ b/plexpy/datafactory.py
@@ -15,11 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import json
import plexpy
-from plexpy import libraries
from plexpy import common
from plexpy import database
from plexpy import datatables
diff --git a/plexpy/datatables.py b/plexpy/datatables.py
index c820bf1e..68c76c57 100644
--- a/plexpy/datatables.py
+++ b/plexpy/datatables.py
@@ -13,7 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import re
import plexpy
diff --git a/plexpy/exceptions.py b/plexpy/exceptions.py
index 4d4f2e88..cbbb0b2a 100644
--- a/plexpy/exceptions.py
+++ b/plexpy/exceptions.py
@@ -14,7 +14,6 @@
# along with Tautulli. If not, see .
-
class PlexPyException(Exception):
"""
Generic Tautulli Exception - should never be thrown, only subclassed
diff --git a/plexpy/exporter.py b/plexpy/exporter.py
index 4d33efa1..ef6e0da7 100644
--- a/plexpy/exporter.py
+++ b/plexpy/exporter.py
@@ -16,7 +16,6 @@
# along with Tautulli. If not, see .
import csv
-
import json
import os
import requests
diff --git a/plexpy/graphs.py b/plexpy/graphs.py
index 6352859e..70122aee 100644
--- a/plexpy/graphs.py
+++ b/plexpy/graphs.py
@@ -15,9 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
+import datetime
import arrow
-import datetime
+
import plexpy
from plexpy import common
from plexpy import database
diff --git a/plexpy/helpers.py b/plexpy/helpers.py
index 648f76f8..70119e5c 100644
--- a/plexpy/helpers.py
+++ b/plexpy/helpers.py
@@ -15,8 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
-
import arrow
import base64
import cloudinary
diff --git a/plexpy/http_handler.py b/plexpy/http_handler.py
index 54ec5c19..3ba32a6e 100644
--- a/plexpy/http_handler.py
+++ b/plexpy/http_handler.py
@@ -15,7 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see .
-
from multiprocessing.dummy import Pool as ThreadPool
from urllib.parse import urljoin
diff --git a/plexpy/libraries.py b/plexpy/libraries.py
index 2e342644..454f6128 100644
--- a/plexpy/libraries.py
+++ b/plexpy/libraries.py
@@ -15,10 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import json
import os
-from datetime import datetime, timedelta
import plexpy
from plexpy import common
diff --git a/plexpy/lock.py b/plexpy/lock.py
index e0cbc632..570803bc 100644
--- a/plexpy/lock.py
+++ b/plexpy/lock.py
@@ -15,7 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import queue
import time
import threading
diff --git a/plexpy/logger.py b/plexpy/logger.py
index b37eeaf0..b4f0f3f3 100644
--- a/plexpy/logger.py
+++ b/plexpy/logger.py
@@ -15,7 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
from logging import handlers
import cherrypy
diff --git a/plexpy/mobile_app.py b/plexpy/mobile_app.py
index 16d59deb..4d1267a1 100644
--- a/plexpy/mobile_app.py
+++ b/plexpy/mobile_app.py
@@ -15,11 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import requests
import threading
-import plexpy
from plexpy import database
from plexpy import helpers
from plexpy import logger
diff --git a/plexpy/newsletter_handler.py b/plexpy/newsletter_handler.py
index e1dcebfd..69d646d9 100644
--- a/plexpy/newsletter_handler.py
+++ b/plexpy/newsletter_handler.py
@@ -15,7 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
from io import open
import os
diff --git a/plexpy/newsletters.py b/plexpy/newsletters.py
index d74f81ef..7641decf 100644
--- a/plexpy/newsletters.py
+++ b/plexpy/newsletters.py
@@ -15,16 +15,16 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
-import arrow
from collections import OrderedDict
import json
from itertools import groupby
-from mako.lookup import TemplateLookup
-from mako import exceptions
import os
import re
+import arrow
+from mako.lookup import TemplateLookup
+from mako import exceptions
+
import plexpy
from plexpy import common
from plexpy import database
diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py
index c97fc211..e981b17b 100644
--- a/plexpy/notification_handler.py
+++ b/plexpy/notification_handler.py
@@ -15,10 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
-from typing import Optional
-
-import arrow
import bleach
from collections import Counter, defaultdict
from functools import partial
@@ -30,7 +26,9 @@ import os
import re
from string import Formatter
import threading
+from typing import Optional
+import arrow
import musicbrainzngs
import plexpy
diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py
index b722dcf0..5305ffa2 100644
--- a/plexpy/notifiers.py
+++ b/plexpy/notifiers.py
@@ -15,20 +15,14 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import base64
-import bleach
from collections import defaultdict
-import json
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import email.utils
-import paho.mqtt.client
-import paho.mqtt.publish
+import json
import os
import re
-import requests
-from requests.auth import HTTPBasicAuth
import smtplib
import subprocess
import sys
@@ -37,6 +31,12 @@ import time
from urllib.parse import urlencode
from urllib.parse import urlparse
+import bleach
+import paho.mqtt.client
+import paho.mqtt.publish
+import requests
+from requests.auth import HTTPBasicAuth
+
try:
from Cryptodome.Protocol.KDF import PBKDF2
from Cryptodome.Cipher import AES
diff --git a/plexpy/plex.py b/plexpy/plex.py
index ef4c8736..05a1bbb8 100644
--- a/plexpy/plex.py
+++ b/plexpy/plex.py
@@ -15,10 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import plexpy
-from plexpy import logger
-
class DummyObject(object):
def __init__(self, *args, **kwargs):
diff --git a/plexpy/plexivity_import.py b/plexpy/plexivity_import.py
index 38933847..291abf19 100644
--- a/plexpy/plexivity_import.py
+++ b/plexpy/plexivity_import.py
@@ -15,12 +15,11 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
-import arrow
import sqlite3
from xml.dom import minidom
-import plexpy
+import arrow
+
from plexpy import activity_processor
from plexpy import database
from plexpy import helpers
diff --git a/plexpy/plextv.py b/plexpy/plextv.py
index 44a1ac30..d45ce785 100644
--- a/plexpy/plextv.py
+++ b/plexpy/plextv.py
@@ -15,9 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-from urllib.parse import unquote
-
import json
+from urllib.parse import unquote
import plexpy
from plexpy import common
diff --git a/plexpy/plexwatch_import.py b/plexpy/plexwatch_import.py
index ae356447..ac4ffdbe 100644
--- a/plexpy/plexwatch_import.py
+++ b/plexpy/plexwatch_import.py
@@ -15,11 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import sqlite3
from xml.dom import minidom
-import plexpy
from plexpy import activity_processor
from plexpy import database
from plexpy import helpers
diff --git a/plexpy/pmsconnect.py b/plexpy/pmsconnect.py
index ca5d6067..fa36219f 100644
--- a/plexpy/pmsconnect.py
+++ b/plexpy/pmsconnect.py
@@ -15,7 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import json
import os
import time
diff --git a/plexpy/request.py b/plexpy/request.py
index c8f68c3b..c2f0967f 100644
--- a/plexpy/request.py
+++ b/plexpy/request.py
@@ -15,11 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
-from bs4 import BeautifulSoup
+import collections
from xml.dom import minidom
-import collections
+from bs4 import BeautifulSoup
import requests
from requests.packages import urllib3
diff --git a/plexpy/session.py b/plexpy/session.py
index 2a548d6b..368e5da7 100644
--- a/plexpy/session.py
+++ b/plexpy/session.py
@@ -15,7 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import cherrypy
import plexpy
diff --git a/plexpy/users.py b/plexpy/users.py
index 408ea502..447f20a1 100644
--- a/plexpy/users.py
+++ b/plexpy/users.py
@@ -19,7 +19,6 @@ from urllib.parse import parse_qsl
import arrow
import httpagentparser
-from datetime import datetime, timedelta
import plexpy
from plexpy import common
diff --git a/plexpy/version.py b/plexpy/version.py
index e7403c64..46b4390e 100644
--- a/plexpy/version.py
+++ b/plexpy/version.py
@@ -15,6 +15,5 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
PLEXPY_BRANCH = "beta"
PLEXPY_RELEASE_VERSION = "v2.14.0-beta"
\ No newline at end of file
diff --git a/plexpy/versioncheck.py b/plexpy/versioncheck.py
index 8c316e4d..442dcc23 100644
--- a/plexpy/versioncheck.py
+++ b/plexpy/versioncheck.py
@@ -15,7 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-
import json
import os
import platform
diff --git a/plexpy/web_socket.py b/plexpy/web_socket.py
index 2d0b105c..1737c02d 100644
--- a/plexpy/web_socket.py
+++ b/plexpy/web_socket.py
@@ -17,7 +17,6 @@
# Mostly borrowed from https://github.com/trakt/Plex-Trakt-Scrobbler
-
import json
import ssl
import threading
diff --git a/plexpy/webauth.py b/plexpy/webauth.py
index ed176060..05c81a81 100644
--- a/plexpy/webauth.py
+++ b/plexpy/webauth.py
@@ -20,7 +20,6 @@
# Form based authentication for CherryPy. Requires the
# Session tool to be loaded.
-
from datetime import datetime, timedelta, timezone
from urllib.parse import quote, unquote
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index 14e7f730..444d5a68 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -15,15 +15,14 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see .
-import csv
-
-from io import open, BytesIO
import base64
+import csv
+from io import open, BytesIO
import json
-import ssl as _ssl
import linecache
import os
import shutil
+import ssl as _ssl
import sys
import threading
import zipfile
diff --git a/plexpy/windows.py b/plexpy/windows.py
index 766e344a..857e8a0e 100644
--- a/plexpy/windows.py
+++ b/plexpy/windows.py
@@ -17,6 +17,7 @@
import os
import sys
+
from infi.systray import SysTrayIcon
try: