Skip to content

Commit 50e3d85

Browse files
committed
Use f-strings instead of format functions
1 parent 46dc8b6 commit 50e3d85

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tinycss2/color3.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ def _parse_comma_separated(tokens):
142142

143143

144144
_HASH_REGEXPS = (
145-
(2, re.compile('^{}$'.format(4 * '([\\da-f])'), re.I).match),
146-
(1, re.compile('^{}$'.format(4 * '([\\da-f]{2})'), re.I).match),
147-
(2, re.compile('^{}$'.format(3 * '([\\da-f])'), re.I).match),
148-
(1, re.compile('^{}$'.format(3 * '([\\da-f]{2})'), re.I).match),
145+
(2, re.compile(f'^{4 * "([\\da-f])"}$', re.I).match),
146+
(1, re.compile(f'^{4 * "([\\da-f]{2})"}$', re.I).match),
147+
(2, re.compile(f'^{3 * "([\\da-f])"}$', re.I).match),
148+
(1, re.compile(f'^{3 * "([\\da-f]{2})"}$', re.I).match),
149149
)
150150

151151

tinycss2/tokenizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def parse_component_value_list(css, skip_comments=False):
7777
if url_pos >= length or css[url_pos] not in ('"', "'"):
7878
value, pos, error = _consume_url(css, pos)
7979
if value is not None:
80-
repr = 'url({})'.format(serialize_url(value))
80+
repr = f'url({serialize_url(value)})'
8181
if error is not None:
8282
error_key = error[0]
8383
if error_key == 'eof-in-string':
@@ -163,7 +163,7 @@ def parse_component_value_list(css, skip_comments=False):
163163
elif c in ('"', "'"):
164164
value, pos, error = _consume_quoted_string(css, pos)
165165
if value is not None:
166-
repr = '"{}"'.format(serialize_string_value(value))
166+
repr = f'"{serialize_string_value(value)}"'
167167
if error is not None:
168168
repr = repr[:-1]
169169
tokens.append(StringToken(line, column, value, repr))

0 commit comments

Comments
 (0)