Skip to content

Commit

Permalink
Optimize a statement in values.Formatter
Browse files Browse the repository at this point in the history
The optimized version is terser while being at least as readable, arguably.
  • Loading branch information
amn committed Sep 29, 2024
1 parent b930beb commit 27d21ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/csspring/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def _(self, production: RepetitionProduction) -> Iterable[str]:
@format.register
def _(self, production: TokenProduction) -> Iterable[str]:
if production.attributes:
if 'value' not in production.attributes or len(production.attributes) > 1:
if production.attributes.keys() != { 'value' }:
raise NotImplementedError # the "Values and Units" specification doesn't feature token productions with matching of attributes other than `value`
yield repr(production.attributes['value'])
else:
Expand Down

0 comments on commit 27d21ca

Please sign in to comment.