diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-03-10 22:17:31 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-03-10 22:17:31 +0100 |
commit | 188e43f3fa9579f9ac5fb6d4d2e56e11cbd2b940 (patch) | |
tree | 8e90913fc9606efd79cd161129082319cb1f2581 | |
parent | Added SQLite configuration file. (diff) | |
download | newspipe-188e43f3fa9579f9ac5fb6d4d2e56e11cbd2b940.tar.gz newspipe-188e43f3fa9579f9ac5fb6d4d2e56e11cbd2b940.tar.bz2 newspipe-188e43f3fa9579f9ac5fb6d4d2e56e11cbd2b940.zip |
removed unused variable
-rw-r--r-- | migrations/env.py | 1 | ||||
-rw-r--r-- | newspipe/bootstrap.py | 1 | ||||
-rw-r--r-- | newspipe/controllers/abstract.py | 2 | ||||
-rw-r--r-- | newspipe/controllers/article.py | 1 | ||||
-rw-r--r-- | newspipe/controllers/bookmark.py | 1 | ||||
-rw-r--r-- | newspipe/controllers/tag.py | 1 | ||||
-rw-r--r-- | newspipe/crawler/default_crawler.py | 4 | ||||
-rw-r--r-- | newspipe/lib/article_utils.py | 2 | ||||
-rw-r--r-- | newspipe/lib/data.py | 4 | ||||
-rwxr-xr-x | newspipe/lib/misc_utils.py | 1 | ||||
-rw-r--r-- | newspipe/models/__init__.py | 1 | ||||
-rw-r--r-- | newspipe/models/user.py | 2 | ||||
-rw-r--r-- | newspipe/web/views/api/v2/common.py | 1 | ||||
-rw-r--r-- | newspipe/web/views/article.py | 2 | ||||
-rw-r--r-- | newspipe/web/views/bookmark.py | 3 | ||||
-rw-r--r-- | newspipe/web/views/feed.py | 3 | ||||
-rw-r--r-- | newspipe/web/views/session_mgmt.py | 1 | ||||
-rw-r--r-- | newspipe/web/views/user.py | 3 |
18 files changed, 9 insertions, 25 deletions
diff --git a/migrations/env.py b/migrations/env.py index 4f31b751..88c71290 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -1,7 +1,6 @@ from __future__ import with_statement from alembic import context from sqlalchemy import engine_from_config, pool -from logging.config import fileConfig # this is the Alembic Config object, which provides # access to the values within the .ini file in use. diff --git a/newspipe/bootstrap.py b/newspipe/bootstrap.py index 2aa39895..293a7362 100644 --- a/newspipe/bootstrap.py +++ b/newspipe/bootstrap.py @@ -5,7 +5,6 @@ import os import logging -from urllib.parse import urlsplit from flask import request from flask_babel import Babel, format_datetime diff --git a/newspipe/controllers/abstract.py b/newspipe/controllers/abstract.py index a699afd0..32d07170 100644 --- a/newspipe/controllers/abstract.py +++ b/newspipe/controllers/abstract.py @@ -125,7 +125,7 @@ class AbstractController: db.session.delete(obj) try: db.session.commit() - except Exception as e: + except Exception: db.session.rollback() return obj diff --git a/newspipe/controllers/article.py b/newspipe/controllers/article.py index d4adf99d..5a017bfa 100644 --- a/newspipe/controllers/article.py +++ b/newspipe/controllers/article.py @@ -1,4 +1,3 @@ -import re import logging import sqlalchemy from sqlalchemy import func diff --git a/newspipe/controllers/bookmark.py b/newspipe/controllers/bookmark.py index 3c9dcce9..d708491a 100644 --- a/newspipe/controllers/bookmark.py +++ b/newspipe/controllers/bookmark.py @@ -1,6 +1,5 @@ import logging import itertools -from datetime import datetime, timedelta from newspipe.bootstrap import db from newspipe.models import Bookmark diff --git a/newspipe/controllers/tag.py b/newspipe/controllers/tag.py index c97ce20e..4f6fabbe 100644 --- a/newspipe/controllers/tag.py +++ b/newspipe/controllers/tag.py @@ -1,6 +1,5 @@ import logging import itertools -from datetime import datetime, timedelta from newspipe.bootstrap import db from .abstract import AbstractController diff --git a/newspipe/crawler/default_crawler.py b/newspipe/crawler/default_crawler.py index 00db49b2..ccdef274 100644 --- a/newspipe/crawler/default_crawler.py +++ b/newspipe/crawler/default_crawler.py @@ -31,7 +31,7 @@ import asyncio import logging import feedparser import dateutil.parser -from datetime import datetime, timezone, timedelta +from datetime import datetime, timedelta from sqlalchemy import or_ from newspipe.bootstrap import application @@ -64,7 +64,7 @@ async def parse_feed(user, feed): try: logger.info("Retrieving feed {}".format(feed.link)) resp = await newspipe_get(feed.link, timeout=5) - except Exception as e: + except Exception: logger.info("Problem when reading feed {}".format(feed.link)) return finally: diff --git a/newspipe/lib/article_utils.py b/newspipe/lib/article_utils.py index 5152f008..3f6ee2ba 100644 --- a/newspipe/lib/article_utils.py +++ b/newspipe/lib/article_utils.py @@ -92,7 +92,7 @@ async def get_article_details(entry, fetch=True): new_link = urlunsplit(SplitResult(scheme, *split[1:])) try: response = await newspipe_get(new_link, timeout=5) - except Exception as error: + except Exception: failed = True continue failed = False diff --git a/newspipe/lib/data.py b/newspipe/lib/data.py index 89f6bca6..61c481d1 100644 --- a/newspipe/lib/data.py +++ b/newspipe/lib/data.py @@ -200,7 +200,7 @@ def import_pinboard_json(user, json_content): """Import bookmarks from a pinboard JSON export. """ bookmark_contr = BookmarkController(user.id) - tag_contr = BookmarkTagController(user.id) + BookmarkTagController(user.id) bookmarks = json.loads(json_content.decode("utf-8")) nb_bookmarks = 0 for bookmark in bookmarks: @@ -224,7 +224,7 @@ def import_pinboard_json(user, json_content): "time": time, "tags": tags, } - new_bookmark = bookmark_contr.create(**bookmark_attr) + bookmark_contr.create(**bookmark_attr) nb_bookmarks += 1 return nb_bookmarks diff --git a/newspipe/lib/misc_utils.py b/newspipe/lib/misc_utils.py index a5814aa3..1a423466 100755 --- a/newspipe/lib/misc_utils.py +++ b/newspipe/lib/misc_utils.py @@ -30,7 +30,6 @@ import re import os import sys import glob -import json import logging import operator import urllib diff --git a/newspipe/models/__init__.py b/newspipe/models/__init__.py index 3fd7569c..6b64b4cc 100644 --- a/newspipe/models/__init__.py +++ b/newspipe/models/__init__.py @@ -48,7 +48,6 @@ __all__ = [ "BookmarkTag", ] -import os from sqlalchemy.engine import reflection from sqlalchemy.schema import ( diff --git a/newspipe/models/user.py b/newspipe/models/user.py index ffd320db..f880d3fe 100644 --- a/newspipe/models/user.py +++ b/newspipe/models/user.py @@ -27,8 +27,6 @@ __copyright__ = "Copyright (c) Cedric Bonhomme" __license__ = "GPLv3" import re -import random -import hashlib from datetime import datetime from werkzeug.security import check_password_hash from flask_login import UserMixin diff --git a/newspipe/web/views/api/v2/common.py b/newspipe/web/views/api/v2/common.py index 3d90bf91..c38da8d8 100644 --- a/newspipe/web/views/api/v2/common.py +++ b/newspipe/web/views/api/v2/common.py @@ -18,7 +18,6 @@ routes : DELETE resources -> to delete several """ -import ast import logging from functools import wraps from werkzeug.exceptions import Unauthorized, BadRequest, Forbidden, NotFound diff --git a/newspipe/web/views/article.py b/newspipe/web/views/article.py index a49859ca..033ff039 100644 --- a/newspipe/web/views/article.py +++ b/newspipe/web/views/article.py @@ -157,7 +157,7 @@ def export(): user = UserController(current_user.id).get(id=current_user.id) try: json_result = export_json(user) - except Exception as e: + except Exception: flash(gettext("Error when exporting articles."), "danger") return redirect(redirect_url()) response = make_response(json_result) diff --git a/newspipe/web/views/bookmark.py b/newspipe/web/views/bookmark.py index 6d143875..8252dc2f 100644 --- a/newspipe/web/views/bookmark.py +++ b/newspipe/web/views/bookmark.py @@ -27,7 +27,6 @@ __copyright__ = "Copyright (c) Cedric Bonhomme" __license__ = "AGPLv3" import logging -import datetime from werkzeug.exceptions import BadRequest from flask import ( @@ -219,7 +218,7 @@ def delete(bookmark_id=None): @login_required def delete_all(): "Delete all bookmarks." - bookmark = BookmarkController(current_user.id).read().delete() + BookmarkController(current_user.id).read().delete() db.session.commit() flash(gettext("Bookmarks successfully deleted."), "success") return redirect(redirect_url()) diff --git a/newspipe/web/views/feed.py b/newspipe/web/views/feed.py index fc68c23c..16f44c86 100644 --- a/newspipe/web/views/feed.py +++ b/newspipe/web/views/feed.py @@ -50,7 +50,6 @@ def feeds(): def feed_view(feed_id=None, user_id=None): feed = FeedController(user_id).get(id=feed_id) - word_size = 6 category = None if feed.category_id: category = CategoryController(user_id).get(id=feed.category_id) @@ -75,7 +74,7 @@ def feed_view(feed_id=None, user_id=None): first_article = articles[-1].date delta = last_article - first_article average = round(float(articles.count()) / abs(delta.days), 2) - except Exception as e: + except Exception: last_article = datetime.fromtimestamp(0) first_article = datetime.fromtimestamp(0) delta = last_article - first_article diff --git a/newspipe/web/views/session_mgmt.py b/newspipe/web/views/session_mgmt.py index 80f505c6..9588e98e 100644 --- a/newspipe/web/views/session_mgmt.py +++ b/newspipe/web/views/session_mgmt.py @@ -1,4 +1,3 @@ -import json import logging from datetime import datetime diff --git a/newspipe/web/views/user.py b/newspipe/web/views/user.py index 78002660..b4900559 100644 --- a/newspipe/web/views/user.py +++ b/newspipe/web/views/user.py @@ -1,6 +1,3 @@ -import string -import random -from datetime import datetime, timedelta from flask import Blueprint, g, render_template, redirect, flash, url_for, request from flask_babel import gettext from flask_login import login_required, current_user |