Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Commit

Permalink
Removing f-string usage
Browse files Browse the repository at this point in the history
  • Loading branch information
lycantropos committed Sep 13, 2017
1 parent bc1fea6 commit 2e06f77
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 3 additions & 1 deletion asynctmdb/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

DATE_FORMAT = '%Y-%m-%d'
TIME_FORMAT = '%H:%M:%S'
DATE_TIME_FORMAT = f'{DATE_FORMAT} {TIME_FORMAT} %Z'
DATE_TIME_FORMAT = ('{date_format} {time_format} %Z'
.format(date_format=DATE_FORMAT,
time_format=TIME_FORMAT))


class StatusCode(IntEnum):
Expand Down
9 changes: 6 additions & 3 deletions asynctmdb/imdb/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,14 @@ async def movie(imdb_id: str,
record, = records
except ValueError as err:
if records:
err_msg = (f'Movie imdb id "{imdb_id}" is ambiguous: '
f'found {len(records)} records.')
err_msg = ('Movie imdb id "{imdb_id}" is ambiguous: '
'found {records_count} records.'
.format(imdb_id=imdb_id,
records_count=len(records)))
else:
err_msg = ('No record found for movie with '
f'IMDb id "{imdb_id}".')
'IMDb id "{imdb_id}".'
.format(imdb_id=imdb_id))
raise ValueError(err_msg) from err
else:
normalize_movie(record)
Expand Down
3 changes: 2 additions & 1 deletion asynctmdb/imdb/title_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ def from_int(int_id: int,
*,
length: int = LENGTH) -> str:
"""Convert integer IMDb id to string representation."""
return f'tt{int_id:0>{length}}'
return 'tt{int_id:0>{length}}'.format(int_id=int_id,
length=length)
7 changes: 5 additions & 2 deletions asynctmdb/methods/movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
from asynctmdb.utils import urljoin

MAX_TIME_RANGE_LENGTH = timedelta(days=14)
RELEASE_DATE_TIME_FORMAT = f'{DATE_FORMAT}T{TIME_FORMAT}.%fZ'
RELEASE_DATE_TIME_FORMAT = ('{date_format}T{time_format}.%fZ'
.format(date_format=DATE_FORMAT,
time_format=TIME_FORMAT))
NOW_PLAYING_DATES_KEYS = ['minimum', 'maximum']


Expand Down Expand Up @@ -126,7 +128,8 @@ async def changes(movie_id: int,
if end_date - start_date > MAX_TIME_RANGE_LENGTH:
err_msg = ('Invalid date range: '
'should be a range no longer '
f'than {MAX_TIME_RANGE_LENGTH.days} days.')
'than {days_count} days.'
.format(days_count=MAX_TIME_RANGE_LENGTH.days))
raise ValueError(err_msg)

params = {}
Expand Down

0 comments on commit 2e06f77

Please sign in to comment.