diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 000000000..007b96c9e --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,10 @@ +version = 1 + +test_patterns = ["tests/**"] + +[[analyzers]] +name = "python" +enabled = true + + [analyzers.meta] + runtime_version = "3.x.x" \ No newline at end of file diff --git a/calibre-plugin/config.py b/calibre-plugin/config.py index d53415f6a..b8af79496 100644 --- a/calibre-plugin/config.py +++ b/calibre-plugin/config.py @@ -17,13 +17,13 @@ try: from PyQt5 import QtWidgets as QtGui - from PyQt5.Qt import (QWidget, QVBoxLayout, QHBoxLayout, QGridLayout, QLabel, + from PyQt5.Qt import (QVBoxLayout, QHBoxLayout, QGridLayout, QLabel, QLineEdit, QWidget, QComboBox, QCheckBox, QPushButton, QTabWidget, QScrollArea, QGroupBox, QButtonGroup, QRadioButton, Qt) except ImportError as e: from PyQt4 import QtGui - from PyQt4.Qt import (QWidget, QVBoxLayout, QHBoxLayout, QGridLayout, QLabel, + from PyQt4.Qt import (QVBoxLayout, QHBoxLayout, QGridLayout, QLabel, QLineEdit, QWidget, QComboBox, QCheckBox, QPushButton, QTabWidget, QScrollArea, QGroupBox, QButtonGroup, QRadioButton, Qt) diff --git a/fanficfare/adapters/base_adapter.py b/fanficfare/adapters/base_adapter.py index 89cff0014..8f2dc1bb2 100644 --- a/fanficfare/adapters/base_adapter.py +++ b/fanficfare/adapters/base_adapter.py @@ -40,7 +40,6 @@ from ..story import Story from ..requestable import Requestable -from ..htmlcleanup import stripHTML from ..exceptions import InvalidStoryURL, StoryDoesNotExist, HTTPErrorFFF # quick convenience class diff --git a/fanficfare/browsercache/basebrowsercache.py b/fanficfare/browsercache/basebrowsercache.py index 312ba4ed2..de8a1d87c 100644 --- a/fanficfare/browsercache/basebrowsercache.py +++ b/fanficfare/browsercache/basebrowsercache.py @@ -59,7 +59,7 @@ def profiled_func(*args, **kwargs): class BrowserCacheException(Exception): pass -from ..six import ensure_binary, ensure_text +from ..six import ensure_binary ## difference in seconds between Jan 1 1601 and Jan 1 1970. Chrome ## caches (so far) have kept time stamps as microseconds since diff --git a/fanficfare/configurable.py b/fanficfare/configurable.py index d80992157..6d2eff757 100644 --- a/fanficfare/configurable.py +++ b/fanficfare/configurable.py @@ -67,7 +67,6 @@ try: from . import adapters except ImportError: - import sys if "fanficfare.adapters" in sys.modules: adapters = sys.modules["fanficfare.adapters"] elif "calibre_plugins.fanficfare_plugin.fanficfare.adapters" in sys.modules: @@ -286,7 +285,6 @@ def get_valid_set_options(): 'fix_pseudo_html': (['webnovel.com'], None, boollist), 'fix_excess_space': (['novelonlinefull.com', 'novelall.com'], ['epub', 'html'], boollist), 'dedup_order_chapter_list': (['wuxiaworld.co', 'novelupdates.cc'], None, boollist), - 'show_nsfw_cover_images': (['fiction.live'], None, boollist), 'show_timestamps': (['fiction.live'], None, boollist), 'show_nsfw_cover_images': (['fiction.live'], None, boollist) } diff --git a/fanficfare/story.py b/fanficfare/story.py index fc91c724d..d52a15c4a 100644 --- a/fanficfare/story.py +++ b/fanficfare/story.py @@ -1172,7 +1172,7 @@ def get_filename_safe_metadata(self,pattern=None): pattern = re_compile(self.getConfig("output_filename_safepattern", r"(^\.|/\.|[^a-zA-Z0-9_\. \[\]\(\)&'-]+)"), "output_filename_safepattern") - for k in origvalues.keys(): + for k in origvalues: if k == 'formatext': # don't do file extension--we set it anyway. values[k]=self.getMetadata(k) else: diff --git a/included_dependencies/cloudscraper/__init__.py b/included_dependencies/cloudscraper/__init__.py index 6da11d979..cad19d9b3 100644 --- a/included_dependencies/cloudscraper/__init__.py +++ b/included_dependencies/cloudscraper/__init__.py @@ -130,7 +130,7 @@ def __init__(self, *args, **kwargs): self.allow_brotli = kwargs.pop( 'allow_brotli', - True if 'brotli' in sys.modules.keys() else False + 'brotli' in sys.modules.keys() ) self.user_agent = User_Agent( diff --git a/included_dependencies/html2text/utils.py b/included_dependencies/html2text/utils.py index d382e00f6..4182a01aa 100644 --- a/included_dependencies/html2text/utils.py +++ b/included_dependencies/html2text/utils.py @@ -12,7 +12,7 @@ def name2cp(k): unifiable_n = {} -for k in config.UNIFIABLE.keys(): +for k in config.UNIFIABLE: unifiable_n[name2cp(k)] = config.UNIFIABLE[k] diff --git a/included_dependencies/html5lib/filters/optionaltags.py b/included_dependencies/html5lib/filters/optionaltags.py index 4a865012c..36cd34ba0 100644 --- a/included_dependencies/html5lib/filters/optionaltags.py +++ b/included_dependencies/html5lib/filters/optionaltags.py @@ -29,7 +29,7 @@ def __iter__(self): yield token def is_optional_start(self, tagname, previous, next): - type = next and next["type"] or None + type = next["type"] if next else None if tagname in 'html': # An html element's start tag may be omitted if the first thing # inside the html element is not a space character or a comment. @@ -86,7 +86,7 @@ def is_optional_start(self, tagname, previous, next): return False def is_optional_end(self, tagname, next): - type = next and next["type"] or None + type = next["type"] if next else None if tagname in ('html', 'head', 'body'): # An html element's end tag may be omitted if the html element # is not immediately followed by a space character or a comment. diff --git a/included_dependencies/requests/sessions.py b/included_dependencies/requests/sessions.py index 45ab8a5d3..76c0669a2 100644 --- a/included_dependencies/requests/sessions.py +++ b/included_dependencies/requests/sessions.py @@ -674,7 +674,7 @@ def send(self, request, **kwargs): if allow_redirects: # Redirect resolving generator. gen = self.resolve_redirects(r, request, **kwargs) - history = [resp for resp in gen] + history = list(gen) else: history = [] diff --git a/included_dependencies/soupsieve/__init__.py b/included_dependencies/soupsieve/__init__.py index 49c478f7e..7dc0133cb 100644 --- a/included_dependencies/soupsieve/__init__.py +++ b/included_dependencies/soupsieve/__init__.py @@ -91,7 +91,7 @@ def filter(select, iterable, namespaces=None, flags=0, **kwargs): # noqa: A001 def comments(tag, limit=0, flags=0, **kwargs): """Get comments only.""" - return [comment for comment in cm.CommentsMatch(tag).get_comments(limit)] + return list(cm.CommentsMatch(tag).get_comments(limit)) @deprecated("'icomments' is not related to CSS selectors and will be removed in the future.") diff --git a/included_dependencies/soupsieve/css_match.py b/included_dependencies/soupsieve/css_match.py index 632e07f99..2c7532031 100644 --- a/included_dependencies/soupsieve/css_match.py +++ b/included_dependencies/soupsieve/css_match.py @@ -1396,7 +1396,7 @@ def filter(self, iterable): # noqa A001 def comments(self, tag, limit=0): """Get comments only.""" - return [comment for comment in CommentsMatch(tag).get_comments(limit)] + return list(CommentsMatch(tag).get_comments(limit)) @util.deprecated("'icomments' is not related to CSS selectors and will be removed in the future.") def icomments(self, tag, limit=0): diff --git a/included_dependencies/urllib3/contrib/securetransport.py b/included_dependencies/urllib3/contrib/securetransport.py index ab092de67..b994bb737 100644 --- a/included_dependencies/urllib3/contrib/securetransport.py +++ b/included_dependencies/urllib3/contrib/securetransport.py @@ -835,7 +835,7 @@ def verify_mode(self): @verify_mode.setter def verify_mode(self, value): - self._verify = True if value == ssl.CERT_REQUIRED else False + self._verify = value == ssl.CERT_REQUIRED def set_default_verify_paths(self): # So, this has to do something a bit weird. Specifically, what it does