mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
Run black on express/
This commit is contained in:
@@ -163,7 +163,18 @@ statements = []
|
||||
terminals = reduce(lambda x, y: x | y, (find_bytype(e, Terminal) for id, e in express))
|
||||
keywords = list(filter(operator.attrgetter("is_keyword"), terminals))
|
||||
negated_keywords = map(lambda s: "~%s" % s, keywords)
|
||||
no_action = {"letter", "digit", "digits", "real_literal", "integer_literal", "string_literal", "simple_string_literal", "letter", "not_quote", "not_paren_star_quote_special"}
|
||||
no_action = {
|
||||
"letter",
|
||||
"digit",
|
||||
"digits",
|
||||
"real_literal",
|
||||
"integer_literal",
|
||||
"string_literal",
|
||||
"simple_string_literal",
|
||||
"letter",
|
||||
"not_quote",
|
||||
"not_paren_star_quote_special",
|
||||
}
|
||||
|
||||
while True:
|
||||
emitted_in_loop = set()
|
||||
@@ -194,7 +205,9 @@ for id in to_emit:
|
||||
if id in to_combine:
|
||||
stmt = "Suppress%s" % stmt
|
||||
if id not in no_action and not isinstance(expr.contents, Keyword):
|
||||
children = list(map(operator.attrgetter('contents'), reduce(lambda x, y: x | y, (find_bytype(e, Keyword) for e in [expr]))))
|
||||
children = list(
|
||||
map(operator.attrgetter("contents"), reduce(lambda x, y: x | y, (find_bytype(e, Keyword) for e in [expr])))
|
||||
)
|
||||
has_duplicates = len(children) > len(set(children))
|
||||
node_type = "ListNode" if ("ZeroOrMore" in stmt or has_duplicates) else "Node"
|
||||
action = ".setParseAction(%s)" % (
|
||||
@@ -243,5 +256,4 @@ if __name__ == "__main__":
|
||||
mdl = importlib.import_module(output)
|
||||
mdl.Generator(m).emit()
|
||||
sys.stdout.write(m.schema.name)
|
||||
""" % ("\n ".join(statements))
|
||||
)
|
||||
""" % ("\n ".join(statements)))
|
||||
|
||||
Reference in New Issue
Block a user