-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ParseError: Duplicate top-level identifier #1057
Comments
is the pyi file somewhere we can take a look at it? the error message is saying that there are two top-level symbols in the module that clash with each other, e.g.
we would welcome any suggestions to make it clearer. |
its a private repo, here's the top of it with some redaction
here are the original imports in that file
|
Yeah, I'm seeing the same issue on Definitely the
Also, |
confirmed, thanks for the report! this is caused by the new |
This seems to have caused quite a few breakages. As far as I can tell, it's because we now handle the 'bidict.bidict' class properly, which is a good thing, but this has also exposed some sort of weird bug involving overloads and __init__. I'd like to get a PyPI release out today, so I'm going to stick this behind a flag for now and dig into it more next week. For #1057. PiperOrigin-RevId: 412129190
I've committed a fix for this, but I had to put it behind a feature flag because it was causing some weird internal test failures. I also just discovered that the feature flag isn't working properly because it isn't getting passed to the type inference step =/ The second issue should be pretty easy to fix, so starting with next week's release, you should be able to pass |
Awesome, thanks for looking at it @rchen152 👍 Would it be worth re-opening this issue until the tests are fixed (or at least until the |
Previously, feature flags were passed only to CHECK, so flags that modify inference behavior didn't work. Also bumps __version__ and CHANGELOG so I can release this immediately. (No point in waiting for nightly testing, since we don't use analyze_project internally anyway.) For #1057. PiperOrigin-RevId: 412996772
Ah, yeah, I should have reopened the issue when I realized the flag wasn't working - sorry about that! But the flag issue should be fixed with today's release (2021.11.29), so you can now pass |
After upgrading mypy and pytype from pip, we see 2 new errors when running ./tools/testing/kunit/run_checks.py. Error #1: mypy and pytype They now deduce that importlib.util.spec_from_file_location() can return None and note that we're not checking for this. We validate that the arch is valid (i.e. the file exists) beforehand. Add in an `asssert spec is not None` to appease the checkers. Error #2: pytype bug google/pytype#1057 It doesn't like `from datetime import datetime`, specifically that a type shares a name with a module. We can workaround this by either * renaming the import or just using `import datetime` * passing the new `--fix-module-collisions` flag to pytype. We pick the first option for now because * the flag is quite new, only in the 2021.11.29 release. * I'd prefer if people can just run `pytype <file>` Signed-off-by: Daniel Latypov <dlatypov@google.com>
After upgrading mypy and pytype from pip, we see 2 new errors when running ./tools/testing/kunit/run_checks.py. Error #1: mypy and pytype They now deduce that importlib.util.spec_from_file_location() can return None and note that we're not checking for this. We validate that the arch is valid (i.e. the file exists) beforehand. Add in an `asssert spec is not None` to appease the checkers. Error #2: pytype bug google/pytype#1057 It doesn't like `from datetime import datetime`, specifically that a type shares a name with a module. We can workaround this by either * renaming the import or just using `import datetime` * passing the new `--fix-module-collisions` flag to pytype. We pick the first option for now because * the flag is quite new, only in the 2021.11.29 release. * I'd prefer if people can just run `pytype <file>` Signed-off-by: Daniel Latypov <dlatypov@google.com> Reviewed-by: Brendan Higgins <brendanhiggins@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
upgraded from 2021.11.2 to pytype-2021.11.18,
getting this difficult to understand error:
The text was updated successfully, but these errors were encountered: