From 94733731e02dca0f7d88ab3c44e2fcc49bf03ff0 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 16 Jan 2026 12:18:31 +0100 Subject: [PATCH] chore: Tear out Python 2 remnants --- docs/conf.py | 1 - plexapi/__init__.py | 1 - plexapi/alert.py | 1 - plexapi/audio.py | 1 - plexapi/base.py | 1 - plexapi/client.py | 1 - plexapi/collection.py | 1 - plexapi/config.py | 1 - plexapi/const.py | 1 - plexapi/exceptions.py | 3 --- plexapi/library.py | 1 - plexapi/media.py | 1 - plexapi/mixins.py | 1 - plexapi/myplex.py | 1 - plexapi/photo.py | 1 - plexapi/playlist.py | 1 - plexapi/playqueue.py | 1 - plexapi/server.py | 1 - plexapi/settings.py | 1 - plexapi/sonos.py | 1 - plexapi/sync.py | 1 - plexapi/utils.py | 1 - plexapi/video.py | 1 - tests/__init__.py | 1 - tests/conftest.py | 1 - tests/test__prepare.py | 1 - tests/test_actions.py | 3 --- tests/test_audio.py | 1 - tests/test_client.py | 1 - tests/test_collection.py | 1 - tests/test_history.py | 2 -- tests/test_library.py | 1 - tests/test_media.py | 2 -- tests/test_misc.py | 1 - tests/test_mixins.py | 1 - tests/test_myplex.py | 1 - tests/test_navigation.py | 3 --- tests/test_photo.py | 1 - tests/test_playlist.py | 1 - tests/test_playqueue.py | 1 - tests/test_search.py | 1 - tests/test_server.py | 1 - tests/test_sonos.py | 1 - tests/test_utils.py | 1 - tests/test_video.py | 1 - tools/plex-alertlistener.py | 1 - tools/plex-autodelete.py | 1 - tools/plex-backupwatched.py | 1 - tools/plex-bootstraptest.py | 1 - tools/plex-download.py | 1 - tools/plex-dummyfiles.py | 1 - tools/plex-gettoken.py | 1 - tools/plex-listattrs.py | 1 - tools/plex-listdocattrs.py | 1 - tools/plex-listsettings.py | 1 - tools/plex-listtokens.py | 1 - tools/plex-markwatched.py | 1 - tools/plex-refreshtoken.py | 1 - tools/plex-teardowntest.py | 1 - tools/version_bump.py | 1 - 60 files changed, 68 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index aa82cf32b..e6945fbff 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- # # Python PlexAPI documentation build configuration file, created by # sphinx-quickstart on Sun Jan 8 23:50:18 2017. diff --git a/plexapi/__init__.py b/plexapi/__init__.py index 1d4fb471e..af856aa88 100644 --- a/plexapi/__init__.py +++ b/plexapi/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import logging import os from logging.handlers import RotatingFileHandler diff --git a/plexapi/alert.py b/plexapi/alert.py index 2d6a18e8a..e11473222 100644 --- a/plexapi/alert.py +++ b/plexapi/alert.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import json import socket from typing import Callable diff --git a/plexapi/audio.py b/plexapi/audio.py index 7686a37e4..310d1c4f6 100644 --- a/plexapi/audio.py +++ b/plexapi/audio.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import annotations import os diff --git a/plexapi/base.py b/plexapi/base.py index fc519bb1b..65da20c4d 100644 --- a/plexapi/base.py +++ b/plexapi/base.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import re from typing import TYPE_CHECKING, Generic, Iterable, List, Optional, TypeVar, Union import weakref diff --git a/plexapi/client.py b/plexapi/client.py index 9a904b404..4aa7d8755 100644 --- a/plexapi/client.py +++ b/plexapi/client.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import time import weakref from xml.etree import ElementTree diff --git a/plexapi/collection.py b/plexapi/collection.py index 75d76445d..6659d934f 100644 --- a/plexapi/collection.py +++ b/plexapi/collection.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from pathlib import Path from urllib.parse import quote_plus diff --git a/plexapi/config.py b/plexapi/config.py index 5cfa74c8e..6d6838466 100644 --- a/plexapi/config.py +++ b/plexapi/config.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import os from collections import defaultdict from configparser import ConfigParser diff --git a/plexapi/const.py b/plexapi/const.py index 6075f8cc8..118148294 100644 --- a/plexapi/const.py +++ b/plexapi/const.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Constants used by plexapi.""" # Library version diff --git a/plexapi/exceptions.py b/plexapi/exceptions.py index 182feb13d..1d209de9c 100644 --- a/plexapi/exceptions.py +++ b/plexapi/exceptions.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - class PlexApiException(Exception): """ Base class for all PlexAPI exceptions. """ pass diff --git a/plexapi/library.py b/plexapi/library.py index 5d54b6a8b..45100bf36 100644 --- a/plexapi/library.py +++ b/plexapi/library.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import annotations import re diff --git a/plexapi/media.py b/plexapi/media.py index ad8ab45b5..d07873c46 100644 --- a/plexapi/media.py +++ b/plexapi/media.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from pathlib import Path from urllib.parse import quote_plus from xml.etree import ElementTree diff --git a/plexapi/mixins.py b/plexapi/mixins.py index f27ab71ec..3d348714c 100644 --- a/plexapi/mixins.py +++ b/plexapi/mixins.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union diff --git a/plexapi/myplex.py b/plexapi/myplex.py index 5785e6175..b58e15831 100644 --- a/plexapi/myplex.py +++ b/plexapi/myplex.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import copy import hashlib import html diff --git a/plexapi/photo.py b/plexapi/photo.py index adb44d5eb..ca6c54c0a 100644 --- a/plexapi/photo.py +++ b/plexapi/photo.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import os from pathlib import Path from urllib.parse import quote_plus diff --git a/plexapi/playlist.py b/plexapi/playlist.py index 8fe0625c6..53b1b844e 100644 --- a/plexapi/playlist.py +++ b/plexapi/playlist.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import re from itertools import groupby from pathlib import Path diff --git a/plexapi/playqueue.py b/plexapi/playqueue.py index 8875ef076..ede8ccb0f 100644 --- a/plexapi/playqueue.py +++ b/plexapi/playqueue.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from urllib.parse import quote_plus from plexapi import utils diff --git a/plexapi/server.py b/plexapi/server.py index 239036c41..377b02726 100644 --- a/plexapi/server.py +++ b/plexapi/server.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import os from urllib.parse import urlencode diff --git a/plexapi/settings.py b/plexapi/settings.py index 4e016e32f..80b836be7 100644 --- a/plexapi/settings.py +++ b/plexapi/settings.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from collections import defaultdict from urllib.parse import quote diff --git a/plexapi/sonos.py b/plexapi/sonos.py index b661f6c50..47d44b1a0 100644 --- a/plexapi/sonos.py +++ b/plexapi/sonos.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import requests from plexapi import CONFIG, X_PLEX_IDENTIFIER, TIMEOUT diff --git a/plexapi/sync.py b/plexapi/sync.py index 3b00653d2..49612588b 100644 --- a/plexapi/sync.py +++ b/plexapi/sync.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ You can work with Mobile Sync on other devices straight away, but if you'd like to use your app as a `sync-target` (when you can set items to be synced to your app) you need to init some variables. diff --git a/plexapi/utils.py b/plexapi/utils.py index e2ac5d30b..4c14a0f9e 100644 --- a/plexapi/utils.py +++ b/plexapi/utils.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import base64 import functools import json diff --git a/plexapi/video.py b/plexapi/video.py index 7f23912fd..f79b1c783 100644 --- a/plexapi/video.py +++ b/plexapi/video.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import os from pathlib import Path from urllib.parse import quote_plus diff --git a/tests/__init__.py b/tests/__init__.py index 648313225..ad377b7af 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import sys from os.path import dirname, abspath diff --git a/tests/conftest.py b/tests/conftest.py index db574ccd3..9dfde0b29 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import math import os import time diff --git a/tests/test__prepare.py b/tests/test__prepare.py index 500b9a498..2ae24f136 100644 --- a/tests/test__prepare.py +++ b/tests/test__prepare.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import time import pytest diff --git a/tests/test_actions.py b/tests/test_actions.py index 50dc95d2b..943c17c7a 100644 --- a/tests/test_actions.py +++ b/tests/test_actions.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - def test_refresh_section(tvshows): tvshows.refresh() diff --git a/tests/test_audio.py b/tests/test_audio.py index 60510d31b..1235f51ef 100644 --- a/tests/test_audio.py +++ b/tests/test_audio.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from urllib.parse import quote_plus import pytest diff --git a/tests/test_client.py b/tests/test_client.py index 4e8eca7b7..21974530e 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import time import pytest diff --git a/tests/test_collection.py b/tests/test_collection.py index 0b18179a1..a1064832b 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from urllib.parse import quote_plus import pytest diff --git a/tests/test_history.py b/tests/test_history.py index 299dd7d27..a66e2249d 100644 --- a/tests/test_history.py +++ b/tests/test_history.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - def test_history_Movie(movie): movie.markPlayed() history = movie.history() diff --git a/tests/test_library.py b/tests/test_library.py index 18bc864f4..2cae6b3cb 100644 --- a/tests/test_library.py +++ b/tests/test_library.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from collections import namedtuple from datetime import datetime, timedelta from urllib.parse import quote_plus diff --git a/tests/test_media.py b/tests/test_media.py index 53cf7b1d0..b7ef07dbd 100644 --- a/tests/test_media.py +++ b/tests/test_media.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - def _test_media_tag(obj, attr): tags = getattr(obj, attr) if tags: diff --git a/tests/test_misc.py b/tests/test_misc.py index 55798c31a..b941b7e81 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import shlex import subprocess from os.path import abspath, dirname, join diff --git a/tests/test_mixins.py b/tests/test_mixins.py index 2aceff56f..83589b200 100644 --- a/tests/test_mixins.py +++ b/tests/test_mixins.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from datetime import datetime import pytest diff --git a/tests/test_myplex.py b/tests/test_myplex.py index 613b6efa5..27c4b1903 100644 --- a/tests/test_myplex.py +++ b/tests/test_myplex.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import pytest from plexapi.exceptions import BadRequest, NotFound, Unauthorized from plexapi.myplex import MyPlexInvite diff --git a/tests/test_navigation.py b/tests/test_navigation.py index 151a2b53a..bf1bb1b10 100644 --- a/tests/test_navigation.py +++ b/tests/test_navigation.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - def test_navigate_around_show(account, plex): show = plex.library.section("TV Shows").get("The 100") seasons = show.seasons() diff --git a/tests/test_photo.py b/tests/test_photo.py index 487c3f91a..be640921f 100644 --- a/tests/test_photo.py +++ b/tests/test_photo.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from urllib.parse import quote_plus import pytest diff --git a/tests/test_playlist.py b/tests/test_playlist.py index 6e608d022..7c2b1be5a 100644 --- a/tests/test_playlist.py +++ b/tests/test_playlist.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import time from urllib.parse import quote_plus diff --git a/tests/test_playqueue.py b/tests/test_playqueue.py index dd6b50012..261be1d3d 100644 --- a/tests/test_playqueue.py +++ b/tests/test_playqueue.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from plexapi.exceptions import BadRequest from plexapi.playqueue import PlayQueue import pytest diff --git a/tests/test_search.py b/tests/test_search.py index 4b16fee8a..bb0036c06 100644 --- a/tests/test_search.py +++ b/tests/test_search.py @@ -1,2 +1 @@ -# -*- coding: utf-8 -*- # TODO: Many more tests is for search later. diff --git a/tests/test_server.py b/tests/test_server.py index 890215d38..6d726190c 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import re import time from urllib.parse import quote_plus diff --git a/tests/test_sonos.py b/tests/test_sonos.py index ebd4b1d82..869064c82 100644 --- a/tests/test_sonos.py +++ b/tests/test_sonos.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from .payloads import SONOS_RESOURCES diff --git a/tests/test_utils.py b/tests/test_utils.py index 4d7ad4b84..bdb7fc091 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import time import plexapi.utils as utils diff --git a/tests/test_video.py b/tests/test_video.py index 539d4d5f9..286cc7c14 100644 --- a/tests/test_video.py +++ b/tests/test_video.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import os from datetime import datetime from time import sleep diff --git a/tools/plex-alertlistener.py b/tools/plex-alertlistener.py index 0b5698c00..77921b1c1 100755 --- a/tools/plex-alertlistener.py +++ b/tools/plex-alertlistener.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """ Listen to plex alerts and print them to the console. Because we're using print as a function, example only works in Python3. diff --git a/tools/plex-autodelete.py b/tools/plex-autodelete.py index 495e9f6c5..3b4cf87ee 100755 --- a/tools/plex-autodelete.py +++ b/tools/plex-autodelete.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """ Plex-AutoDelete is a useful to delete all but the last X episodes of a show. This comes in handy when you have a show you keep downloaded, but do not diff --git a/tools/plex-backupwatched.py b/tools/plex-backupwatched.py index becedaeb8..ece70263c 100755 --- a/tools/plex-backupwatched.py +++ b/tools/plex-backupwatched.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """ Backup and restore the watched status of Plex libraries to a json file. """ diff --git a/tools/plex-bootstraptest.py b/tools/plex-bootstraptest.py index ce068e684..bdb1f8bb9 100755 --- a/tools/plex-bootstraptest.py +++ b/tools/plex-bootstraptest.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """ The script is used to bootstrap a the test environment for plexapi with all the libraries required for testing. diff --git a/tools/plex-download.py b/tools/plex-download.py index 2ce876fd5..dabd76c2d 100755 --- a/tools/plex-download.py +++ b/tools/plex-download.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """ Allows downloading a Plex media item from a local or shared library. You may specify the item by the PlexWeb url (everything after !) or by diff --git a/tools/plex-dummyfiles.py b/tools/plex-dummyfiles.py index 11cb25eb3..a401f106a 100644 --- a/tools/plex-dummyfiles.py +++ b/tools/plex-dummyfiles.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """ Plex-DummyFiles creates dummy files for testing with the proper Plex folder and file naming structure. diff --git a/tools/plex-gettoken.py b/tools/plex-gettoken.py index 03c32ae14..9a899bffb 100755 --- a/tools/plex-gettoken.py +++ b/tools/plex-gettoken.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """ Plex-GetToken is a simple method to retrieve a Plex account token. """ diff --git a/tools/plex-listattrs.py b/tools/plex-listattrs.py index 8e858c670..8968677f1 100755 --- a/tools/plex-listattrs.py +++ b/tools/plex-listattrs.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """ Plex-ListAttrs is used during development of PlexAPI and loops through all media items to build a collection of attributes on each media type. The resulting list diff --git a/tools/plex-listdocattrs.py b/tools/plex-listdocattrs.py index a300ac3e6..c2ff353be 100755 --- a/tools/plex-listdocattrs.py +++ b/tools/plex-listdocattrs.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """ Plex-ListDocAttrs is used during development of PlexAPI. Example usage: AttDS(dict or object).write() diff --git a/tools/plex-listsettings.py b/tools/plex-listsettings.py index cc50a727f..7208f9c85 100755 --- a/tools/plex-listsettings.py +++ b/tools/plex-listsettings.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """ Plex-ListSettings is used during development of PlexAPI and loops through available setting items and separates them by group as well as display the variable type. The diff --git a/tools/plex-listtokens.py b/tools/plex-listtokens.py index 027d5092b..4d05e356e 100755 --- a/tools/plex-listtokens.py +++ b/tools/plex-listtokens.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """ Plex-ListTokens is a simple utility to fetch and list all known Plex Server tokens your plex.tv account has access to. Because this information diff --git a/tools/plex-markwatched.py b/tools/plex-markwatched.py index 09eb903a4..0a7b75141 100755 --- a/tools/plex-markwatched.py +++ b/tools/plex-markwatched.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """ Plex-MarkWatched is a useful to always mark a show as watched. This comes in handy when you have a show you keep downloaded, but do not religiously watch diff --git a/tools/plex-refreshtoken.py b/tools/plex-refreshtoken.py index 939bb68fc..c6cd782e4 100644 --- a/tools/plex-refreshtoken.py +++ b/tools/plex-refreshtoken.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """ Plex-RefreshToken is a simple method to refresh a Plex account token by pinging Plex.tv. """ diff --git a/tools/plex-teardowntest.py b/tools/plex-teardowntest.py index f852ec859..ba07915cf 100755 --- a/tools/plex-teardowntest.py +++ b/tools/plex-teardowntest.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """ Remove current Plex Server and a Client from MyPlex account. Useful when running tests in CI. """ diff --git a/tools/version_bump.py b/tools/version_bump.py index 2eae02cf6..0771e9362 100755 --- a/tools/version_bump.py +++ b/tools/version_bump.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- """Helper script to bump the current version.""" import argparse import re