Skip to content

Commit

Permalink
fix: feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
syu-w committed Apr 4, 2024
1 parent 1a98c0b commit 1253db5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions craft_grammar/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class GrammarBool(_GrammarBase):
@classmethod
@overrides
def validate(cls, entry):
# GrammarInt entry can be a list if it contains clauses
# GrammarBool entry can be a list if it contains clauses
if isinstance(entry, list):
new_entry = []
for item in entry:
Expand Down Expand Up @@ -206,14 +206,12 @@ class GrammarDict(_GrammarBase):
@classmethod
@overrides
def validate(cls, entry):
# GrammarSingleEntryDictList will always be a list
# GrammarDict entry can be a list if it contains clauses
if isinstance(entry, list):
new_entry = []
for item in entry:
if _is_grammar_clause(item):
cls._grammar_append(new_entry, item)
elif isinstance(item, dict):
new_entry.append(item)
else:
raise TypeError(f"value must be a list of dictionaries: {entry!r}")
return new_entry
Expand All @@ -232,7 +230,7 @@ class GrammarDictList(_GrammarBase):
@classmethod
@overrides
def validate(cls, entry):
# GrammarSingleEntryDictList will always be a list
# GrammarDictList will always be a list
if isinstance(entry, list):
new_entry = []
for item in entry:
Expand Down

0 comments on commit 1253db5

Please sign in to comment.