Fixed Pylint and black errors

This commit is contained in:
Peter Taylor 2023-03-23 20:35:32 +00:00
parent 6b2113a64e
commit bafd2b2a7d
3 changed files with 9 additions and 7 deletions

View file

@ -23,8 +23,8 @@ def main():
type=bool,
default=False,
const=True,
nargs='?',
help="Download Folders are named based on the full text version of the title instead of the trimmed URL title"
nargs="?",
help="Download Folders are named based on the full text version of the title instead of the trimmed URL title",
)
parser.add_argument(

View file

@ -3,8 +3,8 @@ import json
import urllib
import datetime
from pathlib import Path
import requests
from sys import argv
import requests
from itchiodl import utils
@ -14,7 +14,7 @@ class Game:
def __init__(self, data):
self.args = argv[1:]
if '--human-folders' in self.args:
if "--human-folders" in self.args:
self.humanFolders = True
else:
self.humanFolders = False
@ -35,7 +35,8 @@ class Game:
if self.humanFolders:
self.game_slug = utils.clean_path(self.data["title"])
self.publisher_slug = self.data.get("user").get("display_name")
# This Branch covers the case that the user has not set a display name, and defaults to their username
# This Branch covers the case that the user has
# not set a display name, and defaults to their username
if not self.publisher_slug:
self.publisher_slug = self.data.get("user").get("username")
else:

View file

@ -41,8 +41,9 @@ def clean_path(path):
"""Cleans a path on windows"""
if sys.platform in ["win32", "cygwin", "msys"]:
path_clean = re.sub(r"[<>:|?*\"\/\\]", "-", path)
# This checks for strings that end in ... or similar, weird corner case that affects fewer than 0.1% of titles
path_clean = re.sub(r'(.)[.]\1+$', "-", path_clean)
# This checks for strings that end in ... or similar,
# weird corner case that affects fewer than 0.1% of titles
path_clean = re.sub(r"(.)[.]\1+$", "-", path_clean)
return path_clean
return path