Add initial support for Ada by rowan-walshe · Pull Request #162 · nuprl/MultiPL-E

Yes, other translators would need to be updated if they want to support these two problems. While I have defined a get_set method for translators that extend the LanguageTranslator class, I didn't complete any of the implementations. If you want, I can have a go at doing this, though I have little to no experience with many of the languages supported by MultiPL-E.

Just to confirm though, the Set related changes do not negatively impact the translation ratios for any of the existing translators. The only difference is the exception that is raised for those two problems.

Previously the exceptions raised looked like:

...
 File ".../projects/ai/MultiPL-E/dataset_builder/generic_translator.py", line 44, in translate_expr
 raise Exception(f"Unhandled expression: {py_expr}")
Exception: Unhandled expression: <ast.Set object at 0x1054e5750>

Now the exceptions will look like:

...
 File ".../MultiPL-E/dataset_builder/generic_translator.py", line 31, in translate_expr
 return translator.gen_set([translate_expr(translator, e) for e in elts])
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File ".../MultiPL-E/dataset_builder/humaneval_to_py.py", line 103, in gen_set
    raise NotImplementedError("This translator does not currently support translating sets")
NotImplementedError: This translator does not currently support translating sets

or

...
 File ".../MultiPL-E/dataset_builder/generic_translator.py", line 31, in translate_expr
 return translator.gen_set([translate_expr(translator, e) for e in elts])
 ^^^^^^^^^^^^^^^^^^
AttributeError: 'Translator' object has no attribute 'gen_set'. Did you mean: 'gen_dict'?

Note also that while MBPP 473 is a well-formed problem, MBPP 582 needs a couple of minor changes. Its current signature is:

def my_dict(dict1: Set[int]) -> bool:
    """
    Write a function to check if a dictionary is empty
    """
    ...

So the function name and docstring suggest that it takes a dictionary, but it's currently typed to take a set. Then two test cases pass a set, while the third is a dictionary. I'm not entirely sure which combination of typehint, testcase, and docstring changes should be made, but I am confident that it probably should be updated.