`getMemberTypes` should be used for members which have no PSI which can be used to resolve to. For example, `__init__` method in dataclasses are sometimes not present in the source code. Yet its parameters are always useful for the code analysis. In this case, `getMemberTypes` should be used.
(cherry picked from commit 2455ed05099842fc50e1fa2a196c4952b6444795)
IJ-CR-172940
GitOrigin-RevId: 1da7d966c9752b16afc6ec1c55e6606d8ff7b244
It should be activated only for the simplest cases when the caret is either
inside an immediate string literal or its prefix is an unqualified reference
expression. It makes little sense trying to detect if something like
the literal string `"y.foobar"` is a possible value for `x`.
It's a relatively heavy completion contributor. It starts evaluating the type of
`x` flow-sensitively, analyzing all preceding function calls to take into
account `NoReturn`. It affects common workflows like typing out
`df = pd.` to create a new Pandas dataframe.
(cherry picked from commit f17fe2ce86ee100a3480a574c7f57a1bd67ec2d8)
IJ-CR-172165
GitOrigin-RevId: 4434488b1d2dae3ab7efd72e775b0c730268e51c
- fix missing return type when last statement is a return statement
- add/adjust tests
- add missing null annotations
GitOrigin-RevId: 8fed189d0130c3b41a5f17a3324684a29b39c0ef
- customize extract method refactoring for Python using prefix Py
- option to enable/disable type annotations
- persist value of checkbox.isSelected
- run all extract method tests using types
- add specific typed test
- adjust api-dump.txt since some members of AbstractExtractMethodDialog were raised from private to protected
- small adjustment in test expectation of the inferred type
GitOrigin-RevId: be6e70dcb61c451debb98c10c0a001234188cb7d
- check all overloads of each decorator to retrieve type annotations
(cherry picked from commit 916e4f796e3295c413f93e3adebf64f4692c8c11)
IJ-MR-166976
GitOrigin-RevId: e11c82034e016c0ff21a4a95e71edf1c496b8116
- special case for awaiting a call to an imported, untyped, non-async function
(cherry picked from commit 8eec47ca4560ae0577e8c6157ef533952436b3b4)
IJ-MR-168288
GitOrigin-RevId: 5ae73b7b663e94996116706a775b9fed683f331e
Previously, we parameterized it in PyReferenceExpressionImpl#getTypeFromTarget
and PyFunctionImpl#analyzeCallType, but this substitution disregarded default types
and substituted free type parameters only with their bounds if those were present,
additionally diluting them with `Any` through a "weak type".
So if we had something like the following:
```
class Ref[T : str = str]:
def get_self(self) -> Self: ...
def get_type_param(self) -> T: ...
x: Ref = ...
x.get_self() # Ref[str | Any]
x.get_type_param() # str | Any
```
it worked somewhat correctly only if the omitted type parameter had a bound
in addition to the default.
One notable example from the standard library is the `open()` builtin
returning `TextIOWrapper` that has a default type parameter `_WrappedBuffer`.
This type parameter ended up either substituted with a "weak type" `_WrappedBuffer | Any`
or completely erased.
This change allowed removing special-casing for Self in PyFunctionImpl#analyzeCallType.
GitOrigin-RevId: 6408d24186bf607a08006f15b380e1eb158e63eb
PY-55691: `Expected type 'Type[AttrsInstance]'` warning passing `attrs` class to `attrs.fields()`
- add member __attrs_attrs__ to classes decorated with attrs.define or similar
Merge-request: IJ-MR-165647
Merged-by: Marcus Mews <marcus.mews@jetbrains.com>
(cherry picked from commit 979f894e595d903c55f33c8bd4c5c3d06cb2fe6d)
IJ-MR-165647
GitOrigin-RevId: d668282db59d6a6fcea1d40bb36aa4ee48585dea
Disable sys.monitoring from PyDB.stoptrace.
Disconnect DebuggerProcess if ServerSocket is closed.
Kill DebugProcessHandler if it is KillableProcessHandler.
Merge-request: IJ-MR-167442
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>
(cherry picked from commit f1a42ad9014d9e172bc994085f53e2123f9870c2)
GitOrigin-RevId: 7a7335ed4f83764e18390490999c06db9a35feb3
This bug was introduced during a refactoring of fixture support.
While the correct order of resolution was maintained, it relied on the assumption that pytest_plugins could be statically analyzed.
Consider the following example:
```python
import os
from glob import iglob
DIR_PATH = os.path.dirname(os.path.abspath(__file__))
def create_pytest_plugins():
# Dynamically resolves fixture plugin names by scanning the fixtures directory
fixture_names = _make_fixture_names("tests/utils/fixtures/**/*.py")
return fixture_names
def _make_fixture_names(fixture_path_pattern: str):
os.chdir(f"{DIR_PATH}/../../")
return [
_make_fixture_name(fixture_path)
for fixture_path in iglob(fixture_path_pattern, recursive=True)
if "__" not in fixture_path
]
def _make_fixture_name(fixture_path: str) -> str:
return fixture_path.replace("/", ".").replace(".py", "")
pytest_plugins = create_pytest_plugins()
```
In such cases, where pytest_plugins is resolved dynamically and cannot be parsed statically, it is preferable to fall back to resolving any other suitable fixture found in the project, rather than skipping resolution altogether.
(cherry picked from commit 2d9a5dd6bd34d1c06d47b3587cd365696642ccd7)
IJ-MR-167570
GitOrigin-RevId: 709f080d6c23d1f76ad397cb6363e74623758cfd
In particular, for uv, retain the information about workspace membership.
Make discovery of nested workspace members more robust.
GitOrigin-RevId: 9af260bbb47baac9d5fec7e2b605931ceb0ce3c4
Use `ExecService` `api.kt` to exec any binary and extensions from `execService.python/api.kt` for python-specific things (i.e helpers)
GitOrigin-RevId: bb217798a9d1ee886c4b12220ec1f66a5ef08336