Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#3951)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.2.2 → v0.3.2](astral-sh/ruff-pre-commit@v0.2.2...v0.3.2)
- [github.com/python-poetry/poetry: 1.7.0 → 1.8.0](python-poetry/poetry@1.7.0...1.8.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] committed Mar 13, 2024
1 parent 74c3b07 commit 284a494
Show file tree
Hide file tree
Showing 28 changed files with 65 additions and 254 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.2.2'
rev: 'v0.3.2'
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
Expand All @@ -11,7 +11,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/python-poetry/poetry
rev: '1.7.0'
rev: '1.8.0'
hooks:
- id: poetry-check
- id: poetry-check
Expand Down
32 changes: 4 additions & 28 deletions flexget/components/managed_lists/lists/couchpotato_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,49 +17,25 @@ class CouchPotatoBase:
def movie_list_request(base_url, port, api_key):
parsedurl = urlparse(base_url)
logger.debug('Received movie list request')
return '{}://{}:{}{}/api/{}/movie.list?status=active'.format(
parsedurl.scheme,
parsedurl.netloc,
port,
parsedurl.path,
api_key,
)
return f'{parsedurl.scheme}://{parsedurl.netloc}:{port}{parsedurl.path}/api/{api_key}/movie.list?status=active'

@staticmethod
def profile_list_request(base_url, port, api_key):
parsedurl = urlparse(base_url)
logger.debug('Received profile list request')
return '{}://{}:{}{}/api/{}/profile.list'.format(
parsedurl.scheme,
parsedurl.netloc,
port,
parsedurl.path,
api_key,
)
return f'{parsedurl.scheme}://{parsedurl.netloc}:{port}{parsedurl.path}/api/{api_key}/profile.list'

@staticmethod
def movie_add_request(base_url, port, api_key):
parsedurl = urlparse(base_url)
logger.debug('Received movie add request')
return '{}://{}:{}{}/api/{}/movie.add'.format(
parsedurl.scheme,
parsedurl.netloc,
port,
parsedurl.path,
api_key,
)
return f'{parsedurl.scheme}://{parsedurl.netloc}:{port}{parsedurl.path}/api/{api_key}/movie.add'

@staticmethod
def movie_delete_request(base_url, port, api_key):
parsedurl = urlparse(base_url)
logger.debug('Received movie delete request')
return '{}://{}:{}{}/api/{}/movie.delete?delete_from=wanted'.format(
parsedurl.scheme,
parsedurl.netloc,
port,
parsedurl.path,
api_key,
)
return f'{parsedurl.scheme}://{parsedurl.netloc}:{port}{parsedurl.path}/api/{api_key}/movie.delete?delete_from=wanted'

@staticmethod
def build_url(base_url, request_type, port, api_key):
Expand Down
20 changes: 5 additions & 15 deletions flexget/components/managed_lists/lists/entry_list/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,14 @@ def entry_list_show(options):
entry = db.get_entry_by_id(entry_list.id, int(options.entry), session=session)
except NoResultFound:
console(
'Could not find matching entry with ID {} in list `{}`'.format(
int(options.entry), options.list_name
)
f'Could not find matching entry with ID {int(options.entry)} in list `{options.list_name}`'
)
return
except ValueError:
entry = db.get_entry_by_title(entry_list.id, options.entry, session=session)
if not entry:
console(
'Could not find matching entry with title `{}` in list `{}`'.format(
options.entry, options.list_name
)
f'Could not find matching entry with title `{options.entry}` in list `{options.list_name}`'
)
return
table = TerminalTable('Field name', 'Value', table_type=options.table_type)
Expand All @@ -121,9 +117,7 @@ def entry_list_add(options):
db_entry = db.get_entry_by_title(list_id=entry_list.id, title=title, session=session)
if db_entry:
console(
"Entry with the title `{}` already exist with list `{}`. Will replace identifiers if given".format(
title, entry_list.name
)
f"Entry with the title `{title}` already exist with list `{entry_list.name}`. Will replace identifiers if given"
)
output = f'Successfully updated entry `{title}` to entry list `{entry_list.name}` '
else:
Expand Down Expand Up @@ -151,18 +145,14 @@ def entry_list_del(options):
db_entry = db.get_entry_by_id(entry_list.id, int(options.entry), session=session)
except NoResultFound:
console(
'Could not find matching entry with ID {} in list `{}`'.format(
int(options.entry), options.list_name
)
f'Could not find matching entry with ID {int(options.entry)} in list `{options.list_name}`'
)
return
except ValueError:
db_entry = db.get_entry_by_title(entry_list.id, options.entry, session=session)
if not db_entry:
console(
'Could not find matching entry with title `{}` in list `{}`'.format(
options.entry, options.list_name
)
f'Could not find matching entry with title `{options.entry}` in list `{options.list_name}`'
)
return
console(f'Removing entry `{db_entry.title}` from list {options.list_name}')
Expand Down
28 changes: 7 additions & 21 deletions flexget/components/managed_lists/lists/pending_list/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,14 @@ def pending_list_show(options):
entry = db.get_entry_by_id(pending_list.id, int(options.entry), session=session)
except NoResultFound:
console(
'Could not find matching pending entry with ID {} in list `{}`'.format(
int(options.entry), options.list_name
)
f'Could not find matching pending entry with ID {int(options.entry)} in list `{options.list_name}`'
)
return
except ValueError:
entry = db.get_entry_by_title(pending_list.id, options.entry, session=session)
if not entry:
console(
'Could not find matching pending entry with title `{}` in list `{}`'.format(
options.entry, options.list_name
)
f'Could not find matching pending entry with title `{options.entry}` in list `{options.list_name}`'
)
return
header = ['Field name', 'Value']
Expand All @@ -120,9 +116,7 @@ def pending_list_add(options):
db_entry = db.get_entry_by_title(list_id=pending_list.id, title=title, session=session)
if db_entry:
console(
"Entry with the title `{}` already exist with list `{}`. Will replace identifiers if given".format(
title, pending_list.name
)
f"Entry with the title `{title}` already exist with list `{pending_list.name}`. Will replace identifiers if given"
)
operation = 'updated'
else:
Expand Down Expand Up @@ -153,18 +147,14 @@ def pending_list_approve(options, approve=None):
db_entry = db.get_entry_by_id(entry_list.id, int(options.entry), session=session)
except NoResultFound:
console(
'Could not find matching entry with ID {} in list `{}`'.format(
int(options.entry), options.list_name
)
f'Could not find matching entry with ID {int(options.entry)} in list `{options.list_name}`'
)
return
except ValueError:
db_entry = db.get_entry_by_title(entry_list.id, options.entry, session=session)
if not db_entry:
console(
'Could not find matching entry with title `{}` in list `{}`'.format(
options.entry, options.list_name
)
f'Could not find matching entry with title `{options.entry}` in list `{options.list_name}`'
)
return
approve_text = 'approved' if approve else 'rejected'
Expand All @@ -188,18 +178,14 @@ def pending_list_del(options):
db_entry = db.get_entry_by_id(entry_list.id, int(options.entry), session=session)
except NoResultFound:
console(
'Could not find matching entry with ID {} in list `{}`'.format(
int(options.entry), options.list_name
)
f'Could not find matching entry with ID {int(options.entry)} in list `{options.list_name}`'
)
return
except ValueError:
db_entry = db.get_entry_by_title(entry_list.id, options.entry, session=session)
if not db_entry:
console(
'Could not find matching entry with title `{}` in list `{}`'.format(
options.entry, options.list_name
)
f'Could not find matching entry with title `{options.entry}` in list `{options.list_name}`'
)
return
console(f'Removing entry `{db_entry.title}` from list {options.list_name}')
Expand Down
6 changes: 1 addition & 5 deletions flexget/components/managed_lists/lists/pending_list/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ def __init__(self, entry, pending_list_id):
self.approved = False

def __repr__(self):
return '<PendingListEntry,title={},original_url={},approved={}>'.format(
self.title,
self.original_url,
self.approved,
)
return f'<PendingListEntry,title={self.title},original_url={self.original_url},approved={self.approved}>'

def to_dict(self):
return {
Expand Down
7 changes: 1 addition & 6 deletions flexget/components/managed_lists/lists/radarr_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,7 @@ def __init__(self, api_key, base_url, port=None):
if parsed_base_url.port:
port = int(parsed_base_url.port)

self.api_url = "{}://{}:{}{}/api/v3/".format(
parsed_base_url.scheme,
parsed_base_url.netloc,
port,
parsed_base_url.path,
)
self.api_url = f"{parsed_base_url.scheme}://{parsed_base_url.netloc}:{port}{parsed_base_url.path}/api/v3/"

def get_profiles(self):
"""Gets all profiles"""
Expand Down
6 changes: 1 addition & 5 deletions flexget/components/managed_lists/lists/subtitle_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,7 @@ class SubtitleListFile(Base):
remove_after = Column(Unicode)

def __repr__(self):
return '<SubtitleListFile title={},path={},list_name={}>'.format(
self.title,
self.location,
self.list.name,
)
return f'<SubtitleListFile title={self.title},path={self.location},list_name={self.list.name}>'

def to_entry(self):
entry = Entry()
Expand Down
26 changes: 3 additions & 23 deletions flexget/components/parsing/parsers/parser_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,7 @@ def fields(self) -> dict:

def __str__(self) -> str:
valid = 'OK' if self.valid else 'INVALID'
return '<MovieParseResult(data={},name={},year={},id={},quality={},proper={},release_group={},status={})>'.format(
self.data,
self.name,
self.year,
self.identifier,
self.quality,
self.proper_count,
self.release_group,
valid,
)
return f'<MovieParseResult(data={self.data},name={self.name},year={self.year},id={self.identifier},quality={self.quality},proper={self.proper_count},release_group={self.release_group},status={valid})>'


class SeriesParseResult:
Expand Down Expand Up @@ -206,17 +197,6 @@ def pack_identifier(self) -> str:
def __str__(self) -> str:
valid = 'OK' if self.valid else 'INVALID'
return (
'<SeriesParseResult(data={},name={},id={},season={},season_pack={},episode={},quality={},proper={},'
'special={},status={})>'.format(
self.data,
self.name,
str(self.id),
self.season,
self.season_pack,
self.episode,
self.quality,
self.proper_count,
self.special,
valid,
)
f'<SeriesParseResult(data={self.data},name={self.name},id={self.id!s},season={self.season},season_pack={self.season_pack},episode={self.episode},quality={self.quality},proper={self.proper_count},'
f'special={self.special},status={valid})>'
)
4 changes: 1 addition & 3 deletions flexget/components/parsing/parsers/parser_guessit.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ def _quality(self, guessit_result):
else:
raise ParseWarning(
self,
'Guessit quality returned type {}: {}. Expected str or list.'.format(
type(component), component
),
f'Guessit quality returned type {type(component)}: {component}. Expected str or list.',
)

return qualities.Quality(' '.join(flattened_qualities))
Expand Down
4 changes: 1 addition & 3 deletions flexget/components/pending_approval/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ def __init__(self, task_name, entry):
self.entry = entry

def __repr__(self):
return '<PendingEntry(task_name={},title={},url={},approved={})>'.format(
self.task_name, self.title, self.url, self.approved
)
return f'<PendingEntry(task_name={self.task_name},title={self.title},url={self.url},approved={self.approved})>'

def to_dict(self):
return {
Expand Down
7 changes: 1 addition & 6 deletions flexget/components/seen/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,7 @@ def __init__(self, title, task, reason=None, local=None):
self.local = local

def __str__(self):
return '<SeenEntry(title={},reason={},task={},added={})>'.format(
self.title,
self.reason,
self.task,
self.added,
)
return f'<SeenEntry(title={self.title},reason={self.reason},task={self.task},added={self.added})>'

def to_dict(self):
fields = []
Expand Down
5 changes: 1 addition & 4 deletions flexget/components/series/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,7 @@ def display_details(options):
' during this time.'
)
else:
footer += '\n `{}` uses `{}` mode to identify episode numbering.'.format(
series.name,
series.identified_by,
)
footer += f'\n `{series.name}` uses `{series.identified_by}` mode to identify episode numbering.'
begin_text = 'option'
if series.begin:
footer += f' \n Begin for `{series.name}` is set to `{series.begin.identifier}`.'
Expand Down
Loading

0 comments on commit 284a494

Please sign in to comment.