From 491992b606d73019deb7ab1d8a28dff0b78ecfc4 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Fri, 20 Aug 2021 22:59:17 -0700 Subject: [PATCH] Some linting. --- frontends/ycdl_flask/backend/__init__.py | 6 ++++++ frontends/ycdl_flask/backend/endpoints/__init__.py | 6 ++++++ .../ycdl_flask/backend/endpoints/channel_endpoints.py | 1 - frontends/ycdl_flask/backend/endpoints/video_endpoints.py | 1 - utilities/database_upgrader.py | 2 -- utilities/merge_db.py | 1 - ycdl/__init__.py | 7 +++++++ ycdl/ycdldb.py | 2 -- ycdl/ytapi.py | 5 ++--- 9 files changed, 21 insertions(+), 10 deletions(-) diff --git a/frontends/ycdl_flask/backend/__init__.py b/frontends/ycdl_flask/backend/__init__.py index 1507165..7357fab 100644 --- a/frontends/ycdl_flask/backend/__init__.py +++ b/frontends/ycdl_flask/backend/__init__.py @@ -2,3 +2,9 @@ from . import common from . import endpoints site = common.site + +__all__ = [ + 'common', + 'endpoints', + 'site', +] diff --git a/frontends/ycdl_flask/backend/endpoints/__init__.py b/frontends/ycdl_flask/backend/endpoints/__init__.py index 5613135..97b5646 100644 --- a/frontends/ycdl_flask/backend/endpoints/__init__.py +++ b/frontends/ycdl_flask/backend/endpoints/__init__.py @@ -1,3 +1,9 @@ from . import basic_endpoints from . import channel_endpoints from . import video_endpoints + +__all__ = [ + 'basic_endpoints', + 'channel_endpoints', + 'video_endpoints', +] diff --git a/frontends/ycdl_flask/backend/endpoints/channel_endpoints.py b/frontends/ycdl_flask/backend/endpoints/channel_endpoints.py index d71f392..8731f09 100644 --- a/frontends/ycdl_flask/backend/endpoints/channel_endpoints.py +++ b/frontends/ycdl_flask/backend/endpoints/channel_endpoints.py @@ -1,6 +1,5 @@ import flask; from flask import request import itertools -import traceback from voussoirkit import flasktools diff --git a/frontends/ycdl_flask/backend/endpoints/video_endpoints.py b/frontends/ycdl_flask/backend/endpoints/video_endpoints.py index e61fafe..577cd91 100644 --- a/frontends/ycdl_flask/backend/endpoints/video_endpoints.py +++ b/frontends/ycdl_flask/backend/endpoints/video_endpoints.py @@ -1,5 +1,4 @@ import flask; from flask import request -import traceback from voussoirkit import flasktools diff --git a/utilities/database_upgrader.py b/utilities/database_upgrader.py index 54295b6..a90d861 100644 --- a/utilities/database_upgrader.py +++ b/utilities/database_upgrader.py @@ -1,6 +1,4 @@ import argparse -import os -import sqlite3 import sys import ycdl diff --git a/utilities/merge_db.py b/utilities/merge_db.py index 3c9a429..4f687c0 100644 --- a/utilities/merge_db.py +++ b/utilities/merge_db.py @@ -1,5 +1,4 @@ import argparse -import os import sqlite3 import sys diff --git a/ycdl/__init__.py b/ycdl/__init__.py index 4bbe3b5..c9b72c3 100644 --- a/ycdl/__init__.py +++ b/ycdl/__init__.py @@ -2,3 +2,10 @@ from . import exceptions from . import helpers from . import ycdldb from . import ytapi + +__all__ = [ + 'exceptions', + 'helpers', + 'ycdldb', + 'ytapi', +] diff --git a/ycdl/ycdldb.py b/ycdl/ycdldb.py index b25ee8b..014d089 100644 --- a/ycdl/ycdldb.py +++ b/ycdl/ycdldb.py @@ -1,7 +1,5 @@ import json -import os import sqlite3 -import traceback from . import constants from . import exceptions diff --git a/ycdl/ytapi.py b/ycdl/ytapi.py index 9318eb2..43175c2 100644 --- a/ycdl/ytapi.py +++ b/ycdl/ytapi.py @@ -4,8 +4,6 @@ import isodate from voussoirkit import gentools from voussoirkit import vlogging -from . import helpers - def int_none(x): if x is None: return None @@ -46,7 +44,8 @@ class Video: self.comment_count = int_none(statistics.get('commentCount')) thumbnails = snippet['thumbnails'] - best_thumbnail = max(thumbnails, key=lambda x: thumbnails[x]['width'] * thumbnails[x]['height']) + ranker = lambda key: thumbnails[key]['width'] * thumbnails[key]['height'] + best_thumbnail = max(thumbnails, key=ranker) self.thumbnail = thumbnails[best_thumbnail] def __str__(self):