From 0c38fc2ef45cb53e4fcd518422d9ba76add13c89 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Tue, 7 Feb 2023 21:58:08 +0000 Subject: [PATCH] Fix all bar one typing errors --- app/models.py | 11 +++-- app/musicmuster.py | 2 +- app/playlists.py | 6 +-- poetry.lock | 114 ++++++++++++++++++++++++--------------------- 4 files changed, 72 insertions(+), 61 deletions(-) diff --git a/app/models.py b/app/models.py index 768f792..6a02ae9 100644 --- a/app/models.py +++ b/app/models.py @@ -7,7 +7,7 @@ import stackprinter # type: ignore from dbconfig import Session, scoped_session from datetime import datetime -from typing import Iterable, List, Optional +from typing import Iterable, List, Optional, Union, ValuesView from sqlalchemy.ext.associationproxy import association_proxy @@ -411,8 +411,9 @@ class PlaylistRows(Base): plr.note) @staticmethod - def delete_plrids_not_in_list(session: scoped_session, playlist_id: int, - plrids: List[int]) -> None: + def delete_plrids_not_in_list( + session: scoped_session, playlist_id: int, + plr_ids: Union[Iterable[int], ValuesView]) -> None: """ Delete rows in given playlist that have a higher row number than 'maxrow' @@ -422,7 +423,7 @@ class PlaylistRows(Base): delete(PlaylistRows) .where( PlaylistRows.playlist_id == playlist_id, - PlaylistRows.id.not_in(plrids) + PlaylistRows.id.not_in(plr_ids) ) ) # Delete won't take effect until commit() @@ -530,7 +531,7 @@ class PlaylistRows(Base): @staticmethod def indexed_by_id(session: scoped_session, - plr_ids: Iterable[int]) -> dict: + plr_ids: Union[Iterable[int], ValuesView]) -> dict: """ Return a dictionary of playlist_rows indexed by their plr id from the passed plr_id list. diff --git a/app/musicmuster.py b/app/musicmuster.py index 6992ef5..89384d1 100755 --- a/app/musicmuster.py +++ b/app/musicmuster.py @@ -127,7 +127,7 @@ class CartButton(QPushButton): if event.type() == QEvent.MouseButtonRelease: mouse_event = cast(QMouseEvent, event) if mouse_event.button() == Qt.RightButton: - self.musicmuster.cart_edit(self, event) # type: ignore # FIXME + self.musicmuster.cart_edit(self, event) return True return super().event(event) diff --git a/app/playlists.py b/app/playlists.py index 4ecfa50..5ec5f7f 100644 --- a/app/playlists.py +++ b/app/playlists.py @@ -485,7 +485,7 @@ class PlaylistTab(QTableWidget): super(PlaylistTab, self).closeEditor(editor, hint) - def edit(self, index: QModelIndex, # type: ignore # FIXME + def edit(self, index: QModelIndex, # type: ignore # FIXME trigger: QAbstractItemView.EditTrigger, event: QEvent) -> bool: """ @@ -839,7 +839,7 @@ class PlaylistTab(QTableWidget): # Now build a dictionary of # {display_row_number: display_row_plr} plr_dict_by_id = PlaylistRows.indexed_by_id( - session, iter(display_plr_ids.values())) # type: ignore # FIXME + session, display_plr_ids.values()) # Finally a dictionary of # {display_row_number: plr} @@ -858,7 +858,7 @@ class PlaylistTab(QTableWidget): session.flush() PlaylistRows.delete_plrids_not_in_list( session, self.playlist_id, - iter(display_plr_ids.values())) # type: ignore # FIXME + display_plr_ids.values()) def scroll_current_to_top(self) -> None: """Scroll currently-playing row to top""" diff --git a/poetry.lock b/poetry.lock index 50653b3..22d4eff 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,6 +1,6 @@ [[package]] name = "alembic" -version = "1.9.1" +version = "1.9.3" description = "A database migration tool for SQLAlchemy." category = "main" optional = false @@ -67,17 +67,6 @@ category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" -[[package]] -name = "commonmark" -version = "0.9.1" -description = "Python parser for the CommonMark Markdown spec" -category = "main" -optional = false -python-versions = "*" - -[package.extras] -test = ["hypothesis (==3.55.3)", "flake8 (==3.7.8)"] - [[package]] name = "decorator" version = "5.1.1" @@ -151,7 +140,7 @@ dev = ["dlint", "flake8-2020", "flake8-aaa", "flake8-absolute-import", "flake8-a [[package]] name = "greenlet" -version = "2.0.1" +version = "2.0.2" description = "Lightweight in-process concurrent programming" category = "main" optional = false @@ -159,15 +148,15 @@ python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" [package.extras] docs = ["sphinx", "docutils (<0.18)"] -test = ["objgraph", "psutil", "faulthandler"] +test = ["objgraph", "psutil"] [[package]] name = "iniconfig" -version = "1.1.1" -description = "iniconfig: brain-dead simple config-ini parsing" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" category = "dev" optional = false -python-versions = "*" +python-versions = ">=3.7" [[package]] name = "ipdb" @@ -184,7 +173,7 @@ tomli = {version = "*", markers = "python_version > \"3.6\" and python_version < [[package]] name = "ipython" -version = "8.7.0" +version = "8.9.0" description = "IPython: Productive Interactive Computing" category = "dev" optional = false @@ -199,7 +188,7 @@ jedi = ">=0.16" matplotlib-inline = "*" pexpect = {version = ">4.3", markers = "sys_platform != \"win32\""} pickleshare = "*" -prompt-toolkit = ">=3.0.11,<3.1.0" +prompt-toolkit = ">=3.0.30,<3.1.0" pygments = ">=2.4.0" stack-data = "*" traitlets = ">=5" @@ -267,9 +256,30 @@ babel = ["babel"] lingua = ["lingua"] testing = ["pytest"] +[[package]] +name = "markdown-it-py" +version = "2.1.0" +description = "Python port of markdown-it. Markdown parsing, done right!" +category = "main" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +mdurl = ">=0.1,<1.0" + +[package.extras] +benchmarking = ["psutil", "pytest", "pytest-benchmark (>=3.2,<4.0)"] +code_style = ["pre-commit (==2.6)"] +compare = ["commonmark (>=0.9.1,<0.10.0)", "markdown (>=3.3.6,<3.4.0)", "mistletoe (>=0.8.1,<0.9.0)", "mistune (>=2.0.2,<2.1.0)", "panflute (>=2.1.3,<2.2.0)"] +linkify = ["linkify-it-py (>=1.0,<2.0)"] +plugins = ["mdit-py-plugins"] +profiling = ["gprof2dot"] +rtd = ["attrs", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx-book-theme"] +testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] + [[package]] name = "markupsafe" -version = "2.1.1" +version = "2.1.2" description = "Safely add untrusted strings to HTML/XML markup." category = "main" optional = false @@ -294,6 +304,14 @@ category = "dev" optional = false python-versions = ">=3.6" +[[package]] +name = "mdurl" +version = "0.1.2" +description = "Markdown URL utilities" +category = "main" +optional = false +python-versions = ">=3.7" + [[package]] name = "mutagen" version = "1.46.0" @@ -323,11 +341,11 @@ reports = ["lxml"] [[package]] name = "mypy-extensions" -version = "0.4.3" -description = "Experimental type system extensions for programs checked with the mypy typechecker." +version = "1.0.0" +description = "Type system extensions for programs checked with the mypy type checker." category = "dev" optional = false -python-versions = "*" +python-versions = ">=3.5" [[package]] name = "mysqlclient" @@ -339,7 +357,7 @@ python-versions = ">=3.5" [[package]] name = "packaging" -version = "22.0" +version = "23.0" description = "Core utilities for Python packages" category = "dev" optional = false @@ -482,7 +500,7 @@ python-versions = "*" [[package]] name = "pygments" -version = "2.13.0" +version = "2.14.0" description = "Pygments is a syntax highlighting package written in Python." category = "main" optional = false @@ -493,14 +511,14 @@ plugins = ["importlib-metadata"] [[package]] name = "pyqt5" -version = "5.15.7" +version = "5.15.9" description = "Python bindings for the Qt cross platform application toolkit" category = "main" optional = false python-versions = ">=3.7" [package.dependencies] -PyQt5-Qt5 = ">=5.15.0" +PyQt5-Qt5 = ">=5.15.2" PyQt5-sip = ">=12.11,<13" [[package]] @@ -513,7 +531,7 @@ python-versions = "*" [[package]] name = "pyqt5-sip" -version = "12.11.0" +version = "12.11.1" description = "The sip module support for PyQt5" category = "main" optional = false @@ -553,7 +571,7 @@ python-versions = "*" [[package]] name = "pytest" -version = "7.2.0" +version = "7.2.1" description = "pytest: simple powerful testing with Python" category = "dev" optional = false @@ -618,18 +636,18 @@ python-versions = "*" [[package]] name = "rich" -version = "12.6.0" +version = "13.3.1" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" category = "main" optional = false -python-versions = ">=3.6.3,<4.0.0" +python-versions = ">=3.7.0" [package.dependencies] -commonmark = ">=0.9.0,<0.10.0" -pygments = ">=2.6.0,<3.0.0" +markdown-it-py = ">=2.1.0,<3.0.0" +pygments = ">=2.14.0,<3.0.0" [package.extras] -jupyter = ["ipywidgets (>=7.5.1,<8.0.0)"] +jupyter = ["ipywidgets (>=7.5.1,<9)"] [[package]] name = "six" @@ -641,7 +659,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" [[package]] name = "sqlalchemy" -version = "1.4.45" +version = "1.4.46" description = "Database Abstraction Library" category = "main" optional = false @@ -754,7 +772,7 @@ python-versions = ">=3.7" [[package]] name = "traitlets" -version = "5.8.0" +version = "5.9.0" description = "Traitlets Python configuration system" category = "dev" optional = false @@ -766,7 +784,7 @@ test = ["argcomplete (>=2.0)", "pre-commit", "pytest", "pytest-mock"] [[package]] name = "types-psutil" -version = "5.9.5.5" +version = "5.9.5.6" description = "Typing stubs for psutil" category = "main" optional = false @@ -782,7 +800,7 @@ python-versions = ">=3.7" [[package]] name = "urllib3" -version = "1.26.13" +version = "1.26.14" description = "HTTP library with thread-safe connection pooling, file post, and more." category = "dev" optional = false @@ -795,7 +813,7 @@ socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] [[package]] name = "wcwidth" -version = "0.2.5" +version = "0.2.6" description = "Measures the displayed width of unicode strings in a terminal" category = "dev" optional = false @@ -816,7 +834,6 @@ backcall = [ {file = "backcall-0.2.0.tar.gz", hash = "sha256:5cbdbf27be5e7cfadb448baf0aa95508f91f2bbc6c6437cd9cd06e2a4c215e1e"}, ] colorama = [] -commonmark = [] decorator = [ {file = "decorator-5.1.1-py3-none-any.whl", hash = "sha256:b8c3f85900b9dc423225913c5aace94729fe1fa9763b38939a95226f02d37186"}, {file = "decorator-5.1.1.tar.gz", hash = "sha256:637996211036b6385ef91435e4fae22989472f9d571faba8927ba8253acbc330"}, @@ -827,24 +844,20 @@ executing = [] flake8 = [] flakehell = [] greenlet = [] -iniconfig = [ - {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, - {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, -] +iniconfig = [] ipdb = [] ipython = [] jedi = [] line-profiler = [] mako = [] +markdown-it-py = [] markupsafe = [] matplotlib-inline = [] mccabe = [] +mdurl = [] mutagen = [] mypy = [] -mypy-extensions = [ - {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, - {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, -] +mypy-extensions = [] mysqlclient = [] packaging = [] parso = [ @@ -930,7 +943,4 @@ traitlets = [] types-psutil = [] typing-extensions = [] urllib3 = [] -wcwidth = [ - {file = "wcwidth-0.2.5-py2.py3-none-any.whl", hash = "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784"}, - {file = "wcwidth-0.2.5.tar.gz", hash = "sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"}, -] +wcwidth = []