Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions dataset_builder/base_language_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ def gen_dict(self, keys: List[TargetExp], values: List[TargetExp]) -> TargetExp:
"""
pass

@abstractmethod
def gen_set(self, s: List[TargetExp]) -> TargetExp:
"""
Translate a set with elements s
"""
pass

@abstractmethod
def gen_call(self, func: TargetExp, args: List[TargetExp]) -> TargetExp:
"""
Expand Down
2 changes: 2 additions & 0 deletions dataset_builder/generic_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def translate_expr(translator, py_expr: ast.AST):
return translator.gen_list([translate_expr(translator, e) for e in elts])
case ast.Tuple(elts=elts):
return translator.gen_tuple([translate_expr(translator, e) for e in elts])
case ast.Set(elts=elts):
return translator.gen_set([translate_expr(translator, e) for e in elts])
case ast.Dict(keys=keys, values=values):
return translator.gen_dict(
[translate_expr(translator, e) for e in keys],
Expand Down
Loading