From 3a5e472b362062ccc3ff518176380f83c5f102cc Mon Sep 17 00:00:00 2001 From: Taka Date: Sat, 11 Jun 2022 16:40:46 +1000 Subject: [PATCH] Updated dependencies. --- .pylintrc | 86 +------------------ Dockerfile | 8 +- docker/config/site.cfg | 2 +- freeze.py | 4 +- requirements-dev.txt | 10 +-- requirements.txt | 12 +-- vasl_templates/about.py | 2 +- vasl_templates/main_window.py | 6 +- vasl_templates/server_settings.py | 4 +- vasl_templates/web_channel.py | 2 +- vasl_templates/webapp/lfa.py | 2 +- vasl_templates/webapp/snippets.py | 2 +- vasl_templates/webapp/tests/control_tests.py | 2 +- .../webapp/tests/control_tests_servicer.py | 2 +- vasl_templates/webapp/tests/test_counters.py | 2 +- vasl_templates/webapp/utils.py | 2 +- vasl_templates/webapp/vassal.py | 2 +- vasl_templates/webapp/vo.py | 2 +- 18 files changed, 36 insertions(+), 116 deletions(-) diff --git a/.pylintrc b/.pylintrc index 9553c03..f176a41 100644 --- a/.pylintrc +++ b/.pylintrc @@ -54,88 +54,14 @@ confidence= # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" -disable=print-statement, - parameter-unpacking, - unpacking-in-except, - old-raise-syntax, - backtick, - long-suffix, - old-ne-operator, - old-octal-literal, - import-star-module-level, - non-ascii-bytes-literal, - invalid-unicode-literal, +disable= raw-checker-failed, bad-inline-option, locally-disabled, - locally-enabled, file-ignored, suppressed-message, useless-suppression, deprecated-pragma, - apply-builtin, - basestring-builtin, - buffer-builtin, - cmp-builtin, - coerce-builtin, - execfile-builtin, - file-builtin, - long-builtin, - raw_input-builtin, - reduce-builtin, - standarderror-builtin, - unicode-builtin, - xrange-builtin, - coerce-method, - delslice-method, - getslice-method, - setslice-method, - no-absolute-import, - old-division, - dict-iter-method, - dict-view-method, - next-method-called, - metaclass-assignment, - indexing-exception, - raising-string, - reload-builtin, - oct-method, - hex-method, - nonzero-method, - cmp-method, - input-builtin, - round-builtin, - intern-builtin, - unichr-builtin, - map-builtin-not-iterating, - zip-builtin-not-iterating, - range-builtin-not-iterating, - filter-builtin-not-iterating, - using-cmp-argument, - eq-without-hash, - div-method, - idiv-method, - rdiv-method, - exception-message-attribute, - invalid-str-codec, - sys-max-int, - bad-python3-import, - deprecated-string-function, - deprecated-str-translate-call, - deprecated-itertools-function, - deprecated-types-field, - next-method-defined, - dict-items-not-iterating, - dict-keys-not-iterating, - dict-values-not-iterating, - deprecated-operator-function, - deprecated-urllib-function, - xreadlines-attribute, - deprecated-sys-function, - exception-escape, - comprehension-escape, - bad-whitespace, - bad-continuation, invalid-name, wrong-import-position, global-statement, @@ -149,7 +75,8 @@ disable=print-statement, isinstance-second-argument-not-valid-type, consider-using-f-string, consider-using-max-builtin, - use-implicit-booleaness-not-comparison + use-implicit-booleaness-not-comparison, + unnecessary-lambda-assignment, # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option @@ -294,13 +221,6 @@ max-line-length=120 # Maximum number of lines in a module max-module-lines=1000 -# List of optional constructs for which whitespace checking is disabled. `dict- -# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. -# `trailing-comma` allows a space between comma and closing bracket: (a, ). -# `empty-line` allows space-only lines. -no-space-check=trailing-comma, - dict-separator - # Allow the body of a class to be on the same line as the declaration if body # contains single statement. single-line-class-stmt=no diff --git a/Dockerfile b/Dockerfile index 4350e0f..c6e2457 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,17 @@ # NOTE: Use the run-container.sh script to build and launch this container. # NOTE: Multi-stage builds require Docker >= 17.05. -FROM rockylinux:8 AS base +FROM rockylinux:8.5 AS base # update packages and install requirements RUN dnf -y upgrade-minimal && \ - dnf install -y python38 + dnf install -y python39 # NOTE: We don't need the following stuff for the build step, but it's nice to not have to re-install # it all every time we change the requirements :-/ # install Java -ARG JAVA_URL=https://download.java.net/java/GA/jdk15.0.1/51f4f36ad4ef43e39d0dfdbaf6549e32/9/GPL/openjdk-15.0.1_linux-x64_bin.tar.gz +ARG JAVA_URL=https://download.oracle.com/java/17/archive/jdk-17.0.2_linux-x64_bin.tar.gz RUN curl -s "$JAVA_URL" | tar -xz -C /usr/bin/ # install Firefox @@ -22,7 +22,7 @@ RUN dnf install -y bzip2 xorg-x11-server-Xvfb gtk3 dbus-glib && \ echo "exclude=firefox" >>/etc/dnf/dnf.conf # install geckodriver -ARG GECKODRIVER_URL=https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz +ARG GECKODRIVER_URL=https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-linux64.tar.gz RUN curl -sL "$GECKODRIVER_URL" | tar -xz -C /usr/bin/ # clean up diff --git a/docker/config/site.cfg b/docker/config/site.cfg index 2893e35..55017b2 100644 --- a/docker/config/site.cfg +++ b/docker/config/site.cfg @@ -2,5 +2,5 @@ IS_CONTAINER = 1 -JAVA_PATH = /usr/bin/jdk-15.0.1/bin/java +JAVA_PATH = /usr/bin/jdk-17.0.2/bin/java WEBDRIVER_PATH = /usr/bin/geckodriver diff --git a/freeze.py b/freeze.py index 15ff9b1..6f65434 100755 --- a/freeze.py +++ b/freeze.py @@ -95,8 +95,8 @@ def main( args ): #pylint: disable=too-many-locals args.append( "--noconsole" ) args.extend( [ "--icon", APP_ICON ] ) # NOTE: These files are not always required but it's probably safer to always include them. - import distutils.sysconfig #pylint: disable=import-error - dname = os.path.join( distutils.sysconfig.get_python_lib() , "PyQt5/Qt5/bin" ) + import sysconfig + dname = os.path.join( sysconfig.get_path("platlib") , "PyQt5/Qt5/bin" ) args.extend( [ "--add-binary", os.path.join(dname,"libEGL.dll") + os.pathsep + "PyQt5/Qt/bin" ] ) args.extend( [ "--add-binary", os.path.join(dname,"libGLESv2.dll") + os.pathsep + "PyQt5/Qt/bin" ] ) args.append( MAIN_SCRIPT ) diff --git a/requirements-dev.txt b/requirements-dev.txt index a88efd3..1a9e3fb 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,7 @@ -pytest==6.2.5 -grpcio-tools==1.44.0 +pytest==7.1.2 +grpcio-tools==1.46.3 tabulate==0.8.9 -lxml==4.8.0 -pylint==2.12.2 +lxml==4.9.0 +pylint==2.14.1 pytest-pylint==0.18.0 -pyinstaller==4.9 +pyinstaller==5.1 diff --git a/requirements.txt b/requirements.txt index 8b35cf7..399f321 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -# python 3.8.7 +# python 3.10.4 -flask==2.0.3 +flask==2.1.2 pyyaml==6.0 -pillow==9.0.1 -selenium==4.1.0 -waitress==2.0.0 -click==8.0.4 +pillow==9.1.1 +selenium==4.2.0 +waitress==2.1.2 +click==8.1.3 diff --git a/vasl_templates/about.py b/vasl_templates/about.py index cffcf9f..2cc25c3 100644 --- a/vasl_templates/about.py +++ b/vasl_templates/about.py @@ -61,7 +61,7 @@ class AboutDialog( QDialog ): APP_HOME_URL, mo.group(1) if mo else APP_HOME_URL ) ) - def on_app_icon_clicked( self, event ): #pylint: disable=no-self-use,unused-argument + def on_app_icon_clicked( self, event ): #pylint: disable=unused-argument """Click handler.""" QDesktopServices.openUrl( QUrl( APP_HOME_URL ) ) diff --git a/vasl_templates/main_window.py b/vasl_templates/main_window.py index 5cb4e68..d3fba29 100644 --- a/vasl_templates/main_window.py +++ b/vasl_templates/main_window.py @@ -25,7 +25,7 @@ _CONSOLE_SOURCE_REGEX = re.compile( r"^http://.+?/static/(.*)$" ) class AppWebPage( QWebEnginePage ): """Application web page.""" - def acceptNavigationRequest( self, url, nav_type, is_mainframe ): #pylint: disable=no-self-use,unused-argument + def acceptNavigationRequest( self, url, nav_type, is_mainframe ): #pylint: disable=unused-argument """Called when a link is clicked.""" if url.host() in ("localhost","127.0.0.1"): if "/asl-rulebook2/" not in url.url(): # nb: asl-rulebook2 links are routed through our webapp @@ -39,7 +39,7 @@ class AppWebPage( QWebEnginePage ): QDesktopServices.openUrl( url ) return False - def javaScriptConsoleMessage( self, level, msg, line_no, source_id ): #pylint: disable=unused-argument,no-self-use + def javaScriptConsoleMessage( self, level, msg, line_no, source_id ): #pylint: disable=unused-argument """Log a Javascript console message.""" mo = _CONSOLE_SOURCE_REGEX.search( source_id ) source = mo.group(1) if mo else source_id @@ -308,7 +308,7 @@ class MainWindow( QWidget ): @pyqtSlot( str ) @catch_exceptions( caption="SLOT EXCEPTION" ) - def on_user_settings_change( self, user_settings ): #pylint: disable=no-self-use + def on_user_settings_change( self, user_settings ): """Called when the user changes the user settings.""" # delete all existing keys for key in app_settings.allKeys(): diff --git a/vasl_templates/server_settings.py b/vasl_templates/server_settings.py index 272db5d..1591ab7 100644 --- a/vasl_templates/server_settings.py +++ b/vasl_templates/server_settings.py @@ -155,9 +155,9 @@ class ServerSettingsDialog( QDialog ): app_settings.setValue( "ServerSettings/"+key, val ) try: install_server_settings( False ) - except Exception as ex: #pylint: disable=broad-except + except Exception as ex2: #pylint: disable=broad-except logging.error( traceback.format_exc() ) - MainWindow.showErrorMsg( "Couldn't rollback the server settings:\n\n{}".format( ex ) ) + MainWindow.showErrorMsg( "Couldn't rollback the server settings:\n\n{}".format( ex2 ) ) return self.close() diff --git a/vasl_templates/web_channel.py b/vasl_templates/web_channel.py index dc46f6b..b60216a 100644 --- a/vasl_templates/web_channel.py +++ b/vasl_templates/web_channel.py @@ -68,7 +68,7 @@ class WebChannelHandler: title += " (*)" self.parent.setWindowTitle( title ) - def on_snippet_image( self, img_data ): #pylint: disable=no-self-use + def on_snippet_image( self, img_data ): """Called when a snippet image has been generated.""" # NOTE: We could maybe add an HTML object to the clipboard as well, but having two formats on the clipboard # simultaneously might confuse some programs, causing problems for no real benefit :shrug: diff --git a/vasl_templates/webapp/lfa.py b/vasl_templates/webapp/lfa.py index 4f8eea0..7717605 100644 --- a/vasl_templates/webapp/lfa.py +++ b/vasl_templates/webapp/lfa.py @@ -4,7 +4,7 @@ import os import time import base64 import logging -import xml.etree.cElementTree as ET +import xml.etree.ElementTree as ET from flask import request, jsonify diff --git a/vasl_templates/webapp/snippets.py b/vasl_templates/webapp/snippets.py index 6948cfb..b4a42fd 100644 --- a/vasl_templates/webapp/snippets.py +++ b/vasl_templates/webapp/snippets.py @@ -247,7 +247,7 @@ def _get_small_image( fp, key, default_height ): if height > 0: width = img.size[0] / ( float(img.size[1]) / height ) width = int( width + 0.5 ) - img = img.resize( (width,height), Image.ANTIALIAS ) + img = img.resize( (width,height), Image.Resampling.LANCZOS ) # add the image to the cache buf = io.BytesIO() img.save( buf, format="PNG" ) diff --git a/vasl_templates/webapp/tests/control_tests.py b/vasl_templates/webapp/tests/control_tests.py index 3256685..f14e15c 100644 --- a/vasl_templates/webapp/tests/control_tests.py +++ b/vasl_templates/webapp/tests/control_tests.py @@ -4,7 +4,7 @@ import json import base64 import grpc -from google.protobuf.empty_pb2 import Empty +from google.protobuf.empty_pb2 import Empty #pylint: disable=no-name-in-module from vasl_templates.webapp.tests.proto.generated.control_tests_pb2_grpc import ControlTestsStub from vasl_templates.webapp.tests.proto.utils import enum_from_string diff --git a/vasl_templates/webapp/tests/control_tests_servicer.py b/vasl_templates/webapp/tests/control_tests_servicer.py index 14b4646..547f7d5 100644 --- a/vasl_templates/webapp/tests/control_tests_servicer.py +++ b/vasl_templates/webapp/tests/control_tests_servicer.py @@ -13,7 +13,7 @@ import inspect import random import tabulate -from google.protobuf.empty_pb2 import Empty +from google.protobuf.empty_pb2 import Empty #pylint: disable=no-name-in-module from vasl_templates.webapp.config.constants import DATA_DIR from vasl_templates.webapp.vassal import VassalShim diff --git a/vasl_templates/webapp/tests/test_counters.py b/vasl_templates/webapp/tests/test_counters.py index bc5a397..5e3272a 100644 --- a/vasl_templates/webapp/tests/test_counters.py +++ b/vasl_templates/webapp/tests/test_counters.py @@ -198,7 +198,7 @@ def test_compare_version_strings(): for i,vassal_version in enumerate( vassal_versions ): if i > 0: assert compare_version_strings( vassal_versions[i-1], vassal_version ) < 0 - assert compare_version_strings( vassal_versions[i], vassal_version ) == 0 + assert compare_version_strings( vassal_version, vassal_version ) == 0 if i < len(vassal_versions)-1: assert compare_version_strings( vassal_version, vassal_versions[i+1] ) < 0 diff --git a/vasl_templates/webapp/utils.py b/vasl_templates/webapp/utils.py index a22df40..119f31f 100644 --- a/vasl_templates/webapp/utils.py +++ b/vasl_templates/webapp/utils.py @@ -178,7 +178,7 @@ def resize_image_response( resp, default_width=None, default_height=None, defaul if width or height: assert width and height # yup - make it so - img = img.resize( (int(width),int(height)), Image.ANTIALIAS ) + img = img.resize( (int(width),int(height)), Image.Resampling.LANCZOS ) buf = io.BytesIO() img.save( buf, format="PNG" ) buf.seek( 0 ) diff --git a/vasl_templates/webapp/vassal.py b/vasl_templates/webapp/vassal.py index a032669..3c1399d 100644 --- a/vasl_templates/webapp/vassal.py +++ b/vasl_templates/webapp/vassal.py @@ -14,7 +14,7 @@ import base64 import time import io import zipfile -import xml.etree.cElementTree as ET +import xml.etree.ElementTree as ET from flask import request, jsonify diff --git a/vasl_templates/webapp/vo.py b/vasl_templates/webapp/vo.py index 4bb0a2b..50a2314 100644 --- a/vasl_templates/webapp/vo.py +++ b/vasl_templates/webapp/vo.py @@ -124,7 +124,7 @@ def _do_load_vo_listings( vasl_mod, vo_type, merge_common, real_data_dir, msg_st vo_entries[i] = copy_vo_entry( vo_entry, vo_index[vo_id], nat, vo_type, msg_store ) # update nationality variants with the listings from their base nationality - for nat in listings: + for nat in list( listings.keys() ): if "~" not in nat: continue base_nat = nat.split( "~" )[0]