Skip to content

Commit 27d21ca

Browse files
committed
Optimize a statement in values.Formatter
The optimized version is terser while being at least as readable, arguably.
1 parent b930beb commit 27d21ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/csspring/values.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def _(self, production: RepetitionProduction) -> Iterable[str]:
175175
@format.register
176176
def _(self, production: TokenProduction) -> Iterable[str]:
177177
if production.attributes:
178-
if 'value' not in production.attributes or len(production.attributes) > 1:
178+
if production.attributes.keys() != { 'value' }:
179179
raise NotImplementedError # the "Values and Units" specification doesn't feature token productions with matching of attributes other than `value`
180180
yield repr(production.attributes['value'])
181181
else:

0 commit comments

Comments
 (0)