From be5c5301648cbdad8bed02a259a6eae0423d841b Mon Sep 17 00:00:00 2001 From: Jeppe Fihl-Pearson Date: Sat, 9 Dec 2023 20:04:45 +0000 Subject: [PATCH] Drop Python 2.7 support As far as I can tell, it hasn't worked the last four years following the changes in commit 0c4ad73. This means the check for which Python version that is used can be removed since `inspect.getfullargspec` has been available since Python 3.0. This also updates the classifiers for the package to the currently maintained Python versions. --- LGTV/__init__.py | 17 +++-------------- README.md | 1 - setup.py | 7 +++++-- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/LGTV/__init__.py b/LGTV/__init__.py index 2a8b46b..98acf19 100644 --- a/LGTV/__init__.py +++ b/LGTV/__init__.py @@ -1,11 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import print_function -import platform -isPython311AndAbove = (int(platform.python_version_tuple()[0]) == 3 and int(platform.python_version_tuple()[1]) >= 11) or int(platform.python_version_tuple()[0]) > 3 -if isPython311AndAbove: - from inspect import getfullargspec -else: - from inspect import getargspec +from inspect import getfullargspec import json import os @@ -29,10 +24,7 @@ def get_commands(): text = 'commands\n' commands = LGTVRemote.getCommands() for c in commands: - if isPython311AndAbove: - args = getfullargspec(LGTVRemote.__dict__[c]) - else: - args = getargspec(LGTVRemote.__dict__[c]) + args = getfullargspec(LGTVRemote.__dict__[c]) line = ' ' + c if len(args.args) > 2: a = ' <' + '> <'.join(args.args[1:-1]) + '>' @@ -42,10 +34,7 @@ def get_commands(): def parseargs(command, argv): - if isPython311AndAbove: - args = getfullargspec(LGTVRemote.__dict__[command]) - else: - args = getargspec(LGTVRemote.__dict__[command]) + args = getfullargspec(LGTVRemote.__dict__[command]) args = args.args[1:-1] if len(args) != len(argv): diff --git a/README.md b/README.md index 119a321..e5cd21e 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ Command line webOS remote for LGTVs. This tool uses a connection via websockets * UJ701V * [please add more!] -Tested with python 2.7 on mac/linux and works fine, your mileage may vary with windows, patches welcome. Tested with python 3.9 on Debian Unstable. Tested with python 3.10 on Windows 10/11 Tested with 3.10 on WSL (Ubuntu 20.04) diff --git a/setup.py b/setup.py index aea82b4..6a581f7 100755 --- a/setup.py +++ b/setup.py @@ -37,8 +37,11 @@ classifiers=[ 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Natural Language :: English', ], )