Add type hints for profiling calls

This commit is contained in:
Keith Edmunds 2024-12-11 22:35:11 +00:00
parent 4860c9f188
commit 07d8ce9c41
3 changed files with 13 additions and 6 deletions

View File

@ -567,7 +567,7 @@ class PlaylistRows(dbtables.PlaylistRowsTable):
session: Session,
playlist_id: int,
sqla_map: List[dict[str, int]],
dummy_for_profiling=None,
dummy_for_profiling: Optional[int] = None,
) -> None:
"""
Take a {plrid: row_number} dictionary and update the row numbers accordingly

View File

@ -1066,7 +1066,7 @@ class Window(QMainWindow, Ui_MainWindow):
webbrowser.get("browser").open_new_tab(url)
@line_profiler.profile
def paste_rows(self, dummy_for_profiling=None) -> None:
def paste_rows(self, dummy_for_profiling: Optional[int] = None) -> None:
"""
Paste earlier cut rows.
"""

View File

@ -747,7 +747,10 @@ class PlaylistModel(QAbstractTableModel):
@line_profiler.profile
def move_rows(
self, from_rows: list[int], to_row_number: int, dummy_for_profiling=None
self,
from_rows: list[int],
to_row_number: int,
dummy_for_profiling: Optional[int] = None,
) -> None:
"""
Move the playlist rows given to to_row and below.
@ -819,7 +822,7 @@ class PlaylistModel(QAbstractTableModel):
from_rows: list[int],
to_row_number: int,
to_playlist_id: int,
dummy_for_profiling=None,
dummy_for_profiling: Optional[int] = None,
) -> None:
"""
Move the playlist rows given to to_row and below of to_playlist.
@ -992,7 +995,9 @@ class PlaylistModel(QAbstractTableModel):
self.invalidate_row(track_sequence.previous.row_number)
@line_profiler.profile
def refresh_data(self, session: db.session, dummy_for_profiling=None) -> None:
def refresh_data(
self, session: db.session, dummy_for_profiling: Optional[int] = None
) -> None:
"""Populate self.playlist_rows with playlist data"""
# We used to clear self.playlist_rows each time but that's
@ -1019,7 +1024,9 @@ class PlaylistModel(QAbstractTableModel):
# Same as refresh data, but only used when creating playslit.
# Distinguishes profile time between initial load and other
# refreshes.
def load_data(self, session: db.session, dummy_for_profiling=None) -> None:
def load_data(
self, session: db.session, dummy_for_profiling: Optional[int] = None
) -> None:
"""Populate self.playlist_rows with playlist data"""
# We used to clear self.playlist_rows each time but that's