diff --git a/SickChill.py b/SickChill.py
index 97efec47f7..b397339f70 100755
--- a/SickChill.py
+++ b/SickChill.py
@@ -190,7 +190,7 @@ def start(self):
sys.exit(int(not result)) # Ok -> 0 , Error -> 1
else:
- self.log(f"Cannot process this upgrade directory, you have files that don't belong in it. Continuing with startup", 1)
+ self.log(f"Cannot process this upgrade directory, you have files that don't belong in {upgrade_dir}. Continuing with startup", 1)
sys.exit(1) # Ok -> 0 , Error -> 1
# Load the config and publish it to the oldbeard package
diff --git a/pyproject.toml b/pyproject.toml
index 775814779e..8d41f6caf0 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -181,6 +181,7 @@ exclude = 'contrib/scmaintools|\.venv|venv|\.git|\.hg|\.mypy_cache|\.tox|_build|
[tool.ruff]
line-length = 160
builtins = ["_"]
+target-version = 'py310'
[tool.poe.tasks]
pytest = "pytest"
diff --git a/sickchill/gui/slick/views/editShow.mako b/sickchill/gui/slick/views/editShow.mako
index d0e9481f9b..249596ec76 100644
--- a/sickchill/gui/slick/views/editShow.mako
+++ b/sickchill/gui/slick/views/editShow.mako
@@ -314,8 +314,8 @@
-
-
+
@@ -341,8 +341,8 @@
-
-
+
@@ -369,8 +369,8 @@
-
-
+
diff --git a/sickchill/oldbeard/providers/morethantv.py b/sickchill/oldbeard/providers/morethantv.py
index 22782f6696..7c7bde9916 100644
--- a/sickchill/oldbeard/providers/morethantv.py
+++ b/sickchill/oldbeard/providers/morethantv.py
@@ -9,7 +9,7 @@
from sickchill.helper.exceptions import AuthException
from sickchill.oldbeard import tvcache
from sickchill.oldbeard.bs4_parser import BS4Parser
-from sickchill.oldbeard.show_name_helpers import allPossibleShowNames
+from sickchill.oldbeard.show_name_helpers import all_possible_show_names
from sickchill.providers.torrent.TorrentProvider import TorrentProvider
if TYPE_CHECKING:
@@ -97,9 +97,9 @@ def process_column_header(td):
if mode != "RSS":
logger.debug(_("Search String: {search_string}").format(search_string=search_string))
- searchedSeason = "0"
+ searched_season = "0"
if mode == "Season":
- searchedSeason = re.match(r".*\s(Season\s\d+|S\d+)", search_string).group(1)
+ searched_season = re.match(r".*\s(Season\s\d+|S\d+)", search_string).group(1)
search_params["searchstr"] = search_string
data = self.get_url(self.urls["search"], params=search_params, returns="text")
@@ -131,7 +131,7 @@ def process_column_header(td):
if mode == "Season":
# Skip if torrent isn't the right season, we can't search
# for an exact season on MTV, it returns all of them
- if searchedSeason not in title:
+ if searched_season not in title:
continue
# If torrent is grouped, we need a folder name for title
@@ -142,10 +142,10 @@ def process_column_header(td):
group_params = {"torrentid": torrentid}
# Obtain folder name to use as title
- torrentInfo = self.get_url(self.urls["search"], params=group_params, returns="text").replace("\n", "")
+ torrent_info = self.get_url(self.urls["search"], params=group_params, returns="text").replace("\n", "")
releaseregex = '.*files_{0}.*?;">/(.+?(?=/))'.format(re.escape(torrentid))
- releasename = re.search(releaseregex, torrentInfo).group(1)
+ releasename = re.search(releaseregex, torrent_info).group(1)
title = releasename
download_url = urljoin(self.url, result.find("span", title="Download").parent["href"])
@@ -185,7 +185,7 @@ def process_column_header(td):
def get_season_search_strings(self, episode: "TVEpisode") -> List[Dict]:
search_string = {"Season": set()}
- for show_name in allPossibleShowNames(episode.show, season=episode.scene_season):
+ for show_name in all_possible_show_names(episode.show, season=episode.scene_season):
season_string = show_name + " "
if episode.show.air_by_date or episode.show.sports:
diff --git a/sickchill/oldbeard/search.py b/sickchill/oldbeard/search.py
index 639713c85e..cb0d114bf8 100644
--- a/sickchill/oldbeard/search.py
+++ b/sickchill/oldbeard/search.py
@@ -178,7 +178,7 @@ def pick_best_result(results, show):
picked_result = None
# order the list so that preferred releases are at the top
- results.sort(key=lambda ep: show_name_helpers.hasPreferredWords(ep.name, ep.show), reverse=True)
+ results.sort(key=lambda ep: show_name_helpers.has_preferred_words(ep.name, ep.show), reverse=True)
# find the best result for the current episode
for result in results:
diff --git a/sickchill/oldbeard/show_name_helpers.py b/sickchill/oldbeard/show_name_helpers.py
index af94e82ca3..abc11b6187 100644
--- a/sickchill/oldbeard/show_name_helpers.py
+++ b/sickchill/oldbeard/show_name_helpers.py
@@ -13,7 +13,7 @@
resultFilters.add("(" + settings.IGNORED_SUBS_LIST.replace(",", "|") + ")sub(bed|ed|s)?")
-def containsAtLeastOneWord(name, words):
+def contains_at_least_one_word(name, words):
"""
Filters out results based on filter_words
@@ -65,12 +65,12 @@ def clean_set(words):
ignore_words = ignore_words.union(clean_set(show and show.rls_ignore_words or "")) # Show specific ignored words
ignore_words = ignore_words.union(clean_set(settings.IGNORE_WORDS)) # Plus Global ignored words
ignore_words = ignore_words.difference(clean_set(show and show.rls_require_words or "")) # Minus show specific required words
- if settings.REQUIRE_WORDS and not (show and show.rls_ignore_words): # Only remove global require words from the list if we arent using show ignore words
+ if settings.REQUIRE_WORDS and not (show and show.rls_ignore_words): # Only remove global require words from the list if we aren't using show ignore words
ignore_words = ignore_words.difference(clean_set(settings.REQUIRE_WORDS))
- word = containsAtLeastOneWord(name, ignore_words)
+ word = contains_at_least_one_word(name, ignore_words)
if word:
- logger.info("Release: {} contains {}, ignoring it".format(name, word))
+ logger.info(f"Release: {name} contains {word}, ignoring it")
return False
# if any of the good strings aren't in the name then say no
@@ -81,14 +81,14 @@ def clean_set(words):
if settings.IGNORE_WORDS and not (show and show.rls_require_words): # Only remove global ignore words from the list if we arent using show require words
require_words = require_words.difference(clean_set(settings.IGNORE_WORDS))
- if require_words and not containsAtLeastOneWord(name, require_words):
- logger.info("Release: " + name + " doesn't contain any of " + ", ".join(set(require_words)) + ", ignoring it")
+ if require_words and not contains_at_least_one_word(name, require_words):
+ logger.info(f"Release: {name} doesn't contain a required word {require_words}, ignoring it")
return False
return True
-def allPossibleShowNames(show, season=-1):
+def all_possible_show_names(show, season=-1):
"""
Figures out every possible variation of the name for a particular show. Includes TVDB name, TVRage name,
country codes on the end, eg. "Show Name (AU)", and any scene exception names.
@@ -98,36 +98,36 @@ def allPossibleShowNames(show, season=-1):
Returns: a list of all the possible show names
"""
- showNames = get_scene_exceptions(show.indexerid, season=season)
- if not showNames: # if we don't have any season specific exceptions fallback to generic exceptions
+ show_names = get_scene_exceptions(show.indexerid, season=season)
+ if not show_names: # if we don't have any season specific exceptions fallback to generic exceptions
season = -1
- showNames = get_scene_exceptions(show.indexerid, season=season)
+ show_names = get_scene_exceptions(show.indexerid, season=season)
- showNames.append(show.name)
+ show_names.append(show.name)
if not show.is_anime:
- newShowNames = []
+ new_show_names = []
country_list = common.countryList
country_list.update({common.countryList[k]: k for k in common.countryList})
- for curName in set(showNames):
- if not curName:
+ for current_name in set(show_names):
+ if not current_name:
continue
# if we have "Show Name Australia" or "Show Name (Australia)" this will add "Show Name (AU)" for
# any countries defined in common.countryList
# (and vice versa)
- for curCountry in country_list:
- if curName.endswith(" " + curCountry):
- newShowNames.append(curName.replace(" " + curCountry, " (" + country_list[curCountry] + ")"))
- elif curName.endswith(" (" + curCountry + ")"):
- newShowNames.append(curName.replace(" (" + curCountry + ")", " (" + country_list[curCountry] + ")"))
+ for current_country in country_list:
+ if current_name.endswith(" " + current_country):
+ new_show_names.append(current_name.replace(" " + current_country, " (" + country_list[current_country] + ")"))
+ elif current_name.endswith(" (" + current_country + ")"):
+ new_show_names.append(current_name.replace(" (" + current_country + ")", " (" + country_list[current_country] + ")"))
# # if we have "Show Name (2013)" this will strip the (2013) show year from the show name
- # newShowNames.append(re.sub('\(\d{4}\)', '', curName))
+ # new_show_names.append(re.sub('\(\d{4}\)', '', current_name))
- showNames += newShowNames
+ show_names += new_show_names
- return set(showNames)
+ return set(show_names)
def determine_release_name(directory=None, release_name=None):
@@ -168,8 +168,8 @@ def determine_release_name(directory=None, release_name=None):
return None
-def hasPreferredWords(name, show=None):
- """Determine based on the full episode (file)name combined with the preferred words what the weight its preference should be"""
+def has_preferred_words(name, show=None):
+ """Determine based on the full episode (file) name combined with the preferred words what the weight its preference should be"""
name = name.lower()
@@ -187,7 +187,7 @@ def clean_set(words):
prefer_words = []
- # Because we weigh values, we can not union global and show based values, so we don't do that
+ # Because we weigh values, we cannot union global and show based values, so we don't do that
if settings.PREFER_WORDS:
prefer_words = clean_set(settings.PREFER_WORDS)
if show and show.rls_prefer_words:
diff --git a/sickchill/providers/GenericProvider.py b/sickchill/providers/GenericProvider.py
index 64c5206154..085b66003d 100644
--- a/sickchill/providers/GenericProvider.py
+++ b/sickchill/providers/GenericProvider.py
@@ -19,7 +19,7 @@
from sickchill.oldbeard.db import DBConnection
from sickchill.oldbeard.helpers import download_file, getURL, make_session, remove_file_failed
from sickchill.oldbeard.name_parser.parser import InvalidNameException, InvalidShowException, NameParser
-from sickchill.oldbeard.show_name_helpers import allPossibleShowNames
+from sickchill.oldbeard.show_name_helpers import all_possible_show_names
from sickchill.oldbeard.tvcache import TVCache
from sickchill.providers.result_classes import Proper, SearchResult
@@ -417,7 +417,7 @@ def get_episode_search_strings(self, episode: "TVEpisode", add_string: str = "")
search_string = {"Episode": set()}
- for show_name in allPossibleShowNames(episode.show, season=episode.scene_season):
+ for show_name in all_possible_show_names(episode.show, season=episode.scene_season):
episode_string = show_name + " "
episode_string_fallback = None
@@ -450,7 +450,7 @@ def get_episode_search_strings(self, episode: "TVEpisode", add_string: str = "")
def get_season_search_strings(self, episode: "TVEpisode") -> List[Dict]:
search_string = {"Season": set()}
- for show_name in allPossibleShowNames(episode.show, season=episode.scene_season):
+ for show_name in all_possible_show_names(episode.show, season=episode.scene_season):
season_string = show_name + " "
if episode.show.air_by_date or episode.show.sports:
diff --git a/sickchill/providers/torrent/FrenchProvider.py b/sickchill/providers/torrent/FrenchProvider.py
index 2a5f086f6a..305a44af13 100644
--- a/sickchill/providers/torrent/FrenchProvider.py
+++ b/sickchill/providers/torrent/FrenchProvider.py
@@ -6,7 +6,7 @@
from sickchill.helper.common import valid_url
from sickchill.oldbeard import tvcache
from sickchill.oldbeard.bs4_parser import BS4Parser
-from sickchill.oldbeard.show_name_helpers import allPossibleShowNames
+from sickchill.oldbeard.show_name_helpers import all_possible_show_names
from sickchill.providers.torrent.TorrentProvider import TorrentProvider
if TYPE_CHECKING:
@@ -91,7 +91,7 @@ def url(self, url):
def get_season_search_strings(self, episode: "TVEpisode") -> List[Dict]:
search_string = {"Season": set()}
- for show_name in allPossibleShowNames(episode.show, season=episode.scene_season):
+ for show_name in all_possible_show_names(episode.show, season=episode.scene_season):
season = int(episode.scene_season)
if episode.show.air_by_date or episode.show.sports:
year = str(episode.airdate).split("-")[0]
diff --git a/sickchill/views/index.py b/sickchill/views/index.py
index 129fb0aebb..1b9b9a2049 100644
--- a/sickchill/views/index.py
+++ b/sickchill/views/index.py
@@ -64,17 +64,17 @@ def write_error(self, status_code, **kwargs):
self.set_header("Content-Type", "text/html")
return self.finish(
"""
- {0}
-
-