Skip to content

Commit

Permalink
Use f-strings instead of format functions
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Jan 15, 2025
1 parent 46dc8b6 commit 50e3d85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions tinycss2/color3.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ def _parse_comma_separated(tokens):


_HASH_REGEXPS = (
(2, re.compile('^{}$'.format(4 * '([\\da-f])'), re.I).match),
(1, re.compile('^{}$'.format(4 * '([\\da-f]{2})'), re.I).match),
(2, re.compile('^{}$'.format(3 * '([\\da-f])'), re.I).match),
(1, re.compile('^{}$'.format(3 * '([\\da-f]{2})'), re.I).match),
(2, re.compile(f'^{4 * "([\\da-f])"}$', re.I).match),
(1, re.compile(f'^{4 * "([\\da-f]{2})"}$', re.I).match),
(2, re.compile(f'^{3 * "([\\da-f])"}$', re.I).match),
(1, re.compile(f'^{3 * "([\\da-f]{2})"}$', re.I).match),
)


Expand Down
4 changes: 2 additions & 2 deletions tinycss2/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def parse_component_value_list(css, skip_comments=False):
if url_pos >= length or css[url_pos] not in ('"', "'"):
value, pos, error = _consume_url(css, pos)
if value is not None:
repr = 'url({})'.format(serialize_url(value))
repr = f'url({serialize_url(value)})'
if error is not None:
error_key = error[0]
if error_key == 'eof-in-string':
Expand Down Expand Up @@ -163,7 +163,7 @@ def parse_component_value_list(css, skip_comments=False):
elif c in ('"', "'"):
value, pos, error = _consume_quoted_string(css, pos)
if value is not None:
repr = '"{}"'.format(serialize_string_value(value))
repr = f'"{serialize_string_value(value)}"'
if error is not None:
repr = repr[:-1]
tokens.append(StringToken(line, column, value, repr))
Expand Down

0 comments on commit 50e3d85

Please sign in to comment.