From: Christian Heller Date: Fri, 15 Nov 2024 04:11:41 +0000 (+0100) Subject: Remove unused TypeVar. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Byoutube_prefix%7D%7D%7B%7Bresult.id%7D%7D?a=commitdiff_plain;h=89d8c8862b740d9597969d73f0bec695d0b2f4da;p=ytplom Remove unused TypeVar. --- diff --git a/ytplom.py b/ytplom.py index 22af684..692f26a 100755 --- a/ytplom.py +++ b/ytplom.py @@ -32,7 +32,6 @@ ProseText = NewType('ProseText', str) SqlText = NewType('SqlText', str) AmountDownloads = NewType('AmountDownloads', int) PlayerUpdateId = NewType('PlayerUpdateId', str) -QuotaLog: TypeAlias = dict[DatetimeStr, QuotaCost] DownloadsDb: TypeAlias = dict[VideoId, PathStr] TemplateContext: TypeAlias = dict[ str, None | bool | PlayerUpdateId | PathStr | VideoId | QueryText @@ -258,7 +257,7 @@ class VideoData(DbData): (query_id, self.id_)) -class DbQuotaCost(DbData): +class QuotaLog(DbData): """Collects API access quota costs.""" _table_name = 'quota_costs' _cols = ('id_', 'timestamp', 'cost') @@ -506,7 +505,7 @@ class TaskHandler(BaseHTTPRequestHandler): def collect_results(query_txt: QueryText) -> list[VideoData]: youtube = googleapiclient.discovery.build('youtube', 'v3', developerKey=API_KEY) - DbQuotaCost.update(conn, QUOTA_COST_YOUTUBE_SEARCH) + QuotaLog.update(conn, QUOTA_COST_YOUTUBE_SEARCH) search_request = youtube.search().list( q=query_txt, part='snippet', @@ -525,7 +524,7 @@ class TaskHandler(BaseHTTPRequestHandler): title=snippet['title'], description=snippet['description'], published_at=snippet['publishedAt'])] - DbQuotaCost.update(conn, QUOTA_COST_YOUTUBE_DETAILS) + QuotaLog.update(conn, QUOTA_COST_YOUTUBE_DETAILS) ids_for_details = ','.join([r.id_ for r in results]) videos_request = youtube.videos().list(id=ids_for_details, part='content_details') @@ -623,7 +622,7 @@ class TaskHandler(BaseHTTPRequestHandler): def _send_queries_index_and_search(self) -> None: conn = DatabaseConnection() - quota_count = DbQuotaCost.current(conn) + quota_count = QuotaLog.current(conn) queries_data = QueryData.get_all(conn) conn.commit_close() queries_data.sort(key=lambda q: q.retrieved_at, reverse=True)