commit-0/commit0

Repos have syntax errors

srush opened this issue · 3 comments

srush commented

Several of the repos that I have played with start with a syntax error. Think we should avoid syntax errors when possible.

ImportError while loading conftest '/testbed/tests/conftest.py'.
tests/conftest.py:5: in <module>
    from jinja2 import loaders
src/jinja2/__init__.py:6: in <module>
    from .bccache import BytecodeCache as BytecodeCache
E     File "/testbed/src/jinja2/bccache.py", line 26
E       bc_version = 5
E   IndentationError: expected an indented block after class definition on line 25
srush commented
ImportError while loading conftest '/testbed/tests/conftest.py'.
tests/conftest.py:3: in <module>
    import simpy
src/simpy/__init__.py:16: in <module>
    from simpy.core import Environment
src/simpy/core.py:49: in <module>
    class Environment:
src/simpy/core.py:99: in Environment
    process = BoundClass(Process)
E   TypeError: BoundClass() takes no arguments

This one is hard to fully resolved. As we discussed, sometimes a function being imported in tests may be removed entirely. However, I did the following to remove a subset of the errors:

  1. don't touch special functions that start with __ and end with __, so functions like init would be untouched
  2. if all functions under a class are removed, add a pass statement to the class

The two specific errors you pointed out here are solved.

Changes are done in the build_dataset repo. I have updated the docker images on docker hub for the updated repos.

Later if we have further ideas on how to better handle errors, lmk.

srush commented

Failed imports are okay, think it's mostly errors of the first type (bad indents) that I think we can avoid.