flake8: F541 f-string is missing placeholders
MODIFY
plex_trakt_sync/commands/cache.py
plex_trakt_sync/commands/cache.py
def get_sorted_cache(session: CachedSession, sorting: str, reverse: bool):
get_responses = getattr(session.cache, "values", None)
if not callable(get_responses):
- raise RuntimeError(f"This command requires requests_cache 0.7.x")
+ raise RuntimeError("This command requires requests_cache 0.7.x")
sorters = {
"size": lambda r: r.size,
@@ -59,7 +59,7 @@ def cache(sort: str, limit: int, reverse: bool):
session = CachedSession(cache_name=trakt_cache, backend='sqlite')
click.echo(f"Cache status:\n{session.cache}\n")
- click.echo(f"URLs:")
+ click.echo("URLs:")
sorted = get_sorted_cache(session, sort, reverse)
for i, r in limit_iterator(sorted, limit):
click.echo(f"- {i + 1:3d}. {r}")

MODIFY
plex_trakt_sync/commands/inspect.py
plex_trakt_sync/commands/inspect.py
@@ -36,7 +36,7 @@ def inspect(input):
video = media.media[0].parts[0].videoStreams()[0]
print(f"Video: '{video.codec}'")
- print(f"Guids:")
+ print("Guids:")
for guid in m.guids:
print(f" Guid: {guid}, Id: {guid.id}, Provider: {guid.provider}")

MODIFY
plex_trakt_sync/commands/plex_login.py
plex_trakt_sync/commands/plex_login.py
@@ -126,7 +126,7 @@ def choose_server(account: MyPlexAccount):
server = pick_server(account)
# Connect to obtain baseUrl
click.echo(title(f"Attempting to connect to {server.name}. This may take time and print some errors."))
- click.echo(title(f"Server connections:"))
+ click.echo(title("Server connections:"))
for c in server.connections:
click.echo(f" {c.uri}")
plex = server.connect()

MODIFY
plex_trakt_sync/commands/webhook.py
plex_trakt_sync/commands/webhook.py
@@ -21,7 +21,7 @@ def __init__(self, plex: PlexApi, mf: MediaFactory):
def handle(self, payload):
logger.debug(f"Handle: {payload}")
if "rating_key" not in payload:
- logger.debug(f"Skip, no ratingKey in payload")
+ logger.debug("Skip, no ratingKey in payload")
return
rating_key = int(payload["rating_key"])
@@ -66,11 +66,11 @@ def do_PUT(self):
def get_payload(self):
content_length = int(self.headers['Content-Length'] or 0)
if not content_length:
- return self.error(f"No Content-Length header")
+ return self.error("No Content-Length header")
post_data = self.rfile.read(content_length)
if not post_data:
- return self.error(f"No POST data provided")
+ return self.error("No POST data provided")
try:
payload = json.loads(post_data)
except json.decoder.JSONDecodeError as e:

MODIFY
plex_trakt_sync/decorators/rate_limit.py
plex_trakt_sync/decorators/rate_limit.py
@@ -23,7 +23,7 @@ def wrapper(*args, **kwargs):
except (RateLimitException, RequestException, TraktInternalException) as e:
if retry == retries:
logger.error(f"Error: {e}")
- logger.error(f"API didn't respond properly, script will abort now. Please try again later.")
+ logger.error("API didn't respond properly, script will abort now. Please try again later.")
exit(1)
if isinstance(e, RateLimitException):

flake8: F541 f-string is missing placeholders