Skip to content

Commit 1cbb488

Browse files
committed
More consistent if/else pattern in ast_to_id, reference_to_id
1 parent 9914930 commit 1cbb488

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fluent.runtime/fluent/runtime/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ def ast_to_id(ast):
1010
"""
1111
Returns a string reference for a Term or Message
1212
"""
13-
return (TERM_SIGIL if isinstance(ast, Term) else '') + ast.id.name
13+
if isinstance(ast, Term):
14+
return TERM_SIGIL + ast.id.name
15+
return ast.id.name
1416

1517

1618
def add_message_and_attrs_to_store(store, ref_id, item, is_parent=True):
@@ -49,7 +51,9 @@ def reference_to_id(ref):
4951
if isinstance(ref, AttributeExpression):
5052
return _make_attr_id(reference_to_id(ref.ref),
5153
ref.name.name)
52-
return (TERM_SIGIL if isinstance(ref, TermReference) else '') + ref.id.name
54+
if isinstance(ref, TermReference):
55+
return TERM_SIGIL + ref.id.name
56+
return ref.id.name
5357

5458

5559
def unknown_reference_error_obj(ref_id):

0 commit comments

Comments
 (0)