{"task": {"agent_timeout": 3000, "task": "python__mypy-15624", "verifier_timeout": 6000, "instruction": "stubgen: wrong import statements for base module when importing submodule\nThere's a bug with the import statements generated in .pyi files.\n\nConsider the folder structure:\n```\nsomefolder/\n    test.py\n    foo_mod/\n        __init__.py\n        bar_mod.py\n```\nwith file contents:\n```python\n# test.py\nimport foo_mod\nimport foo_mod.bar_mod as bar_mod\n\nclass baz(foo_mod.foo, bar_mod.bar):\n    pass\n```\n```python\n# foo_mod/__init__.py\nclass foo:\n    pass\n```\n```python\n# foo_mod/bar_mod.py\nclass bar:\n    pass\n```\nThen running `stubgen test.py` whilst in `somefolder` generates an `out/test.pyi` file with contents:\n```python\n# out/test.pyi\n# Stubs for test (Python 3)\n#\n# NOTE: This dynamically typed stub was automatically generated by stubgen.\n\nimport foo_mod.bar_mod as bar_mod\nimport foo_mod.bar_mod\n\nclass baz(foo_mod.foo, bar_mod.bar): ...\n```\nNote how it says `foo_mod.bar_mod`, rather than just `foo_mod` as expected.\n\nThis issue generalises to subsubpackages as well (and presumably further). That is,\n```python\n# test.py\nimport foo_mod\nimport foo_mod.bar_mod as bar_mod\nimport foo_mod.bar_mod.quux_mod as quux_mod\n...\n```\ngenerates\n```python\n# out/test.pyi\nimport foo_mod.bar_mod.quux_mod as bar_mod\nimport foo_mod.bar_mod.quux_mod\nimport foo_mod.bar_mod.quux_mod as quux_mod\n...\n```\n\nTested on Windows and Unix, with both mypy version 0.701 and the latest on the GitHub master branch, with Python 3.6.6. (At least, that's the version of Python which is bound to `python` on the command line, so presumably that's what stubgen is using?)\n\nPossibly related? https://github.com/python/mypy/issues/6831\n", "memory": "8192m", "runnable": false, "difficulty": "hard", "language": "", "cpus": 1, "instruction_truncated": false, "category": "debugging", "compose": false, "has_solution": true, "oracle": null, "docker_image": "", "taskset": "swegym", "tags": ["debugging", "swe-bench"]}, "runs": []}