The underlying problem is that we started to infer a confusing union type
of __init__.py modules found both in site-packages and python_stubs
for such imported packages, but I want it to be addressed separately in PY-39911.
GitOrigin-RevId: 053a4a092ce7fcc71d192dbaa6b1623b82472a17
* For cases when a TypedDict was defined in a separate file
* Fix race when typing near inherited TypedDict's field
GitOrigin-RevId: e19792592c744e9c5a7a7c00af847296efb11d0c
If a process was started with `-m` key (and converted to `--module` flag), this parameter will be passed to all its child processes. So we need to clear this flag in SetupHolder before patching arguments
GitOrigin-RevId: 00ae0b23fc6107bee75272a03a5bd15ca474fbc7
Unresolved reference need to be error highlighted because
module is something certain and unresolved import is error in most cases.
GitOrigin-RevId: b91e54e695b908db193a35378e663288dae90059
rather delegating to the spell checker of the injected language.
Otherwise, we either just report typos twice (PY-36912) or, worse, report
numerous false positives since we try to apply tokenization rules for Python
to a different language as we notoriously have been doing all this time for
injected regular expressions.
Implementations of spell checkers for other languages such as Java or
JavaScript have been using this policy for ages.
GitOrigin-RevId: d1a2a3d48b7a5efff0dbb32ec2847fba1482f3a8
We now access the `frame.f_locals` attribute only once. Multiple access leads to the loss of the changes we have made. We also alter the second argument of the `PyFrame_LocalsToFast()` to 1 to ensure that all the deleted variables will be wiped out from the frame locals.
(cherry picked from commit 28abff39b2c37f30651db220e8700032a629ce73)
GitOrigin-RevId: 8514da7ec187c1192ea9cdf851f89f008242fc30
PY-38422 Unify warning message for 'clear' and 'popitem' TypedDict methods
PY-38505 Infer proper type for TypedDict subscription expressions
PY-38439 Fix TypedDict consistency check
PY-38415 Fix TypedDict keys order in parameter info
PY-38413 Add * before all arguments in TypedDict parameter hint
PY-38873 Fix detection of TypedDict subscription expression type when value is a dict, Dict or TypedDict
GitOrigin-RevId: 25ff441042f2e2d7791e28632a5016fb367685df
When user wants to generate test for class ``SpamEggs`` that has no methods:
* For pytest generate "test_spam_eggs" function
* for UniTest "class TestSpamEggs"
``PyTestCreationModel`` also rewritten a little to make it slightly more readable.
GitOrigin-RevId: cc5d774ad684844f5fd9c86634dbcd0d2343437f
Previously it was done unconditionally for all Python versions in StarAnnotator.
I moved the corresponding checks from there to CompatibilityVisitor so that
it was clear in which particular versions it's mandatory.
GitOrigin-RevId: 205de8768431445baed98aecd5f9820efe28d281
Unless it's a "yield from" syntax, where parentheses remain mandatory in Python 3.8.
Additionally, properly suggest removing parentheses in yield statements with
ordinary parenthesized tuples -- previously we ignored them because of a too
broad exclusion.
GitOrigin-RevId: 0c695a9fb95f831625ce907ffb272cced0e9fb8b
Namely, it report parentheses in such return statements as redundant staring
from Python 3.8.
GitOrigin-RevId: 0603ddb784533b8824bd2266d1fac26d307931fc
- treat deletion by slice and subscription expressions as read access
- delete instruction in dataflow only inserted for PyReferenceExpression
GitOrigin-RevId: 72ae5e964a1e287e007dabb8f41433b284523a02
If the file already has relative imports, next one inserted via completion/auto-import has a chance to be relative. For that new import has to have the number of dots <= than the max of the file's relative import and a number provided by a registry value in 'python.relative.import.depth', that is 3 by default. It also has to be located in the same root package, since python doesn't allow relative imports to step outside of it. The file must not have "if __name__ == '__main__'" in it, since it suggests that it is intended to be runnable and relative imports will not work.
Relative import statements can also be updated with new import elements, if the user's codestyle allows it.
GitOrigin-RevId: 766a03e2252bb1f8193a2156831cc8fdf0a7aced
With testdir fixture, pytest runs test under separate pytest (which may be inline or separate process).
Previously we monkeypatched prepareconfig not to call it twice.
But this approach fails with testdir, because same config returned twice leading to double plugin registration.
See comment in YT
GitOrigin-RevId: bd9f11a2a10900fa3c059791d7c0183a20b1ed70