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
Google sync #1040
Google sync #1040
Commits on Nov 2, 2021
-
Add test base support for multi-file tests.
Allows setting up a dependency tree before checking a file. Python files in the dependency tree are analysed in order, and the corresponding pyi files generated. The pythonpath for all files is set to the root of the dependency tree. Also converts one test file as a more extended test of the new functionality. PiperOrigin-RevId: 406256121
Configuration menu - View commit details
-
Copy full SHA for 9bc3b77 - Browse repository at this point
Copy the full SHA 9bc3b77View commit details -
Fix a bug where Errorlog.copy_from() duplicated error details.
Error.message contains Error._message, _details, and _traceback combined. So copy_from() passing in one error's message attribute as another's _message attribute caused a lot of information to be duplicated. PiperOrigin-RevId: 406272568
Configuration menu - View commit details
-
Copy full SHA for 1907505 - Browse repository at this point
Copy the full SHA 1907505View commit details -
Remove a couple of
# pytype: skip-file
directives.The skip in overlays/typing_overlay.py was only needed until the typed_ast-based pyi parser went live, which happened months ago. Once a type annotation is added to the long list in pytd/slots.py, pytype analysis completes in a negligible amount of time. PiperOrigin-RevId: 406371373
Configuration menu - View commit details
-
Copy full SHA for 6d19c17 - Browse repository at this point
Copy the full SHA 6d19c17View commit details -
Fix some issues with handling module aliases.
Such aliases aren't currently common enough for this to be a problem, but an upcoming bug fix that adds a bunch of aliases exposes these issues: * In LateType resolution, we need to first check if the entire late type is a module name before assuming it's a module attribute. * convert._create_module needs to strip only the module prefix; taking off everything before the last dotted part is wrong for nested classes. * The pyi parser shouldn't allow imports like 'from x import typing' to change the meaning of 'from typing import ...'. * The pyi parser was rewriting __builtin__ to builtins too aggressively; we only want to get rid of imports like "import __builtin__"; lines like "import builtins as __builtin__" should not be changed. * The pytd printer needs to handle the case when it is passed a partially resolved ast in which modules are still represented as NamedType, not Module. * Also in the pytd printer, we were accidentally outputting "from x import y as y" when we meant to just output "from x import y". * serialize_ast needs to undo the pytd printer's application of module aliases. (It would be better if serialize_ast could just use the existing ast rather than printing and reparsing it, but fixing that is a much bigger endeavor.) PiperOrigin-RevId: 406413484
Configuration menu - View commit details
-
Copy full SHA for 147e3f2 - Browse repository at this point
Copy the full SHA 147e3f2View commit details -
Support a [not-supported-yet] case in a generic class TypeVar renamin…
…g check. We have some logic that checks whether a TypeVar rename is ok, but it would emit [not-supported-yet] when trying to compare two bounded/constrained TypeVars against each other. The matcher is able to handle this case now, so do the comparison instead of complaining. PiperOrigin-RevId: 406424691
Configuration menu - View commit details
-
Copy full SHA for 55772ea - Browse repository at this point
Copy the full SHA 55772eaView commit details -
Try again to fix Coverage timeout.
pytype/pyi:parser_test is still timing out. It seems to be a single test in particular that's very slow, so pulling that test out into its own file to ensure that nothing else gets put into the same shard as it seems to work. PiperOrigin-RevId: 406433991
Configuration menu - View commit details
-
Copy full SHA for 1978155 - Browse repository at this point
Copy the full SHA 1978155View commit details -
Update comments about overwritten methods.
The vm subclass now lives in tracer_vm.py, not analyze.py. PiperOrigin-RevId: 406867564
Configuration menu - View commit details
-
Copy full SHA for 4849e94 - Browse repository at this point
Copy the full SHA 4849e94View commit details -
Add
__init__
attributes to canonical enum members.This kicks in whenever an enum class has its own `__init__` or `__new__` that adds attributes to members, and that enum is used in an annotation or other context that causes a canonical member to be created. PiperOrigin-RevId: 406868258
Configuration menu - View commit details
-
Copy full SHA for dff7917 - Browse repository at this point
Copy the full SHA dff7917View commit details -
Fix a couple more pyi import bugs.
* Recognize LateTypes as modules in the pytd printer. Otherwise, it's inconsistent whether an aliased import gets printed as an import or an alias. * Also in the pytd printer, add a heuristic for figuring out which prefix of a dotted NamedType is the module name. If we don't do this, we generate illegal imports containing class names for pb2 nested classes. * Fix a bug where pytype crashed on an empty Awaitable type. Improving pyi output exposes this bug by precisely typing code in which types were previously all Any. PiperOrigin-RevId: 406869267
Configuration menu - View commit details
-
Copy full SHA for 758e242 - Browse repository at this point
Copy the full SHA 758e242View commit details -
Add a feature flag, --gen-stub-imports, to improve pyi import handling.
Currently, pytype adds "x: module" constants to pyi files, and all attributes on builtins.module are typed as Any, so accessing whatever_module.x.attribute always produces Any. This is fixed by instead adding "import x" statements and changing the pyi parser to always generate aliases for import statements. This is a very large change because of all the changes to test output and the places we need to plumb through --gen-stub-imports so that the pyi parser sees it. The actually interesting changes are in: * pytype/output.py * pytype/pyi/modules.py * pytype/pytd/printer.py * pytype/pytd/pytd_visitors.py PiperOrigin-RevId: 406940492
Configuration menu - View commit details
-
Copy full SHA for d97641f - Browse repository at this point
Copy the full SHA d97641fView commit details -
Fix a crash caused by EnumInstance.instantiate() calling itself.
PiperOrigin-RevId: 407145181
Configuration menu - View commit details
-
Copy full SHA for c0ab8a9 - Browse repository at this point
Copy the full SHA c0ab8a9View commit details -
Add a bit more support for PEP 612 in stubs.
This is to unblock python/typeshed#6221. Also see #786. PiperOrigin-RevId: 407168815
Configuration menu - View commit details
-
Copy full SHA for 6e33205 - Browse repository at this point
Copy the full SHA 6e33205View commit details -
Add test for circular types in enum instance attributes.
PiperOrigin-RevId: 407173206
Configuration menu - View commit details
-
Copy full SHA for 03df5c3 - Browse repository at this point
Copy the full SHA 03df5c3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1cb0647 - Browse repository at this point
Copy the full SHA 1cb0647View commit details