166 Commits
Author SHA1 Message Date
Morgan Bartholomewandintellij-monorepo-bot cb03d603c8 PY-87568 PySuspiciousBooleanConditionInspection: fixes from review
GitOrigin-RevId: d8581d8f40a3b6e5d5865660aa9b7e39e3ac3fe5
2026-02-24 05:53:37 +00:00
Morgan Bartholomewandintellij-monorepo-bot 8870cfef3f PY-87568 python: add inspection for coroutine in boolean context
GitOrigin-RevId: a4225a2a8f2959947486a0bf927ff8ac388c5ccb
2026-02-16 13:18:27 +00:00
Vitaly Legchilkinandintellij-monorepo-bot 3b0c8ef38e PY-87576 Fix read access violation in InstallAndImportPackageQuickFix
onSuccess() was called from a coroutine on Dispatchers.Default but
accessed PSI elements without a read action. Use suspend
writeCommandAction to properly dispatch to EDT with write access.

Add InstallPackageQuickFixTest to verify that onSuccess correctly
adds import statements to the file.

Make InstallPackageQuickFix and InstallAndImportPackageQuickFix
non-internal (annotated with @ApiStatus.Internal instead) so they
are accessible from the test module.

GitOrigin-RevId: 4b8ef9194803cdd12192351ef357b18321ba482a
2026-02-13 13:27:58 +00:00
Ilia Zakoulovandintellij-monorepo-bot 05c34f389c PY-86985: Do not automatically mark source root if it resolves to a directory without __init__.py
Despite Python does not require __init__.py in the directory to import it,
it is better to avoid such directories for automatic source root detection.
It might cause false positives.
For example, the project might have folders like `sys`, `os` or `zlib` without any python code inside.

Space-RevId: 16539ee04d2255bc60ac0baa3d317856ca11839b

GitOrigin-RevId: 627ff4546ab4d9e5e386a6ffba6e4df38e8002a0
2026-01-21 18:03:25 +00:00
Aleksandr.Govenkoandintellij-monorepo-bot 764fbaf1ef PY-49165 PY-86123 PY-86124 Improve after review
GitOrigin-RevId: 581c80229ca4f9e3a1faab057d0a3c689e2ce96e
2025-12-22 22:36:14 +00:00
Aleksandr.Govenkoandintellij-monorepo-bot 152f63401c PY-49165 Add tests for PyPatternInspection and related quickfixes
GitOrigin-RevId: 0e35bd5d50e2d6b544cbd4467d184b6be21b7574
2025-12-22 22:36:14 +00:00
Pavel Karateevandintellij-monorepo-bot 6205262e4f [python] PY-83029 fix tests
(cherry picked from commit 64d9931ee762c8ac801114e22952f3086235467a)

IJ-MR-182362

GitOrigin-RevId: 12ab6cde41b9c855fbee843176df00d9daba8e39
2025-12-01 22:15:44 +00:00
Ilia Zakoulovandintellij-monorepo-bot 8c86e7801c PY-83395: Update PyMarkDirectoryAsSourceRootQuickFixTest
GitOrigin-RevId: 7680fd78c4a85acd6ac29caec598925e70ddda41
2025-11-26 18:31:24 +00:00
Ilia Zakoulovandintellij-monorepo-bot 1a6f412fac PY-83395: Test add source root quick fix
GitOrigin-RevId: df736f6a7d5fb838d5947e2e43ee6a4c96626858
2025-11-26 18:31:24 +00:00
Daniil Kalininandintellij-monorepo-bot 6bfbd40f78 PY-85080 Add quick-fix to remove unused Type Parameters
GitOrigin-RevId: cbb9b8136d07350075a9af8b4bc5aaa8891edd73
2025-10-23 22:48:43 +00:00
Marcus Mewsandintellij-monorepo-bot 992a8cdfb5 PY-83066 extract method doesn't add imports
- add imports for types of arguments and return values
- sort new imports by name

GitOrigin-RevId: 861c4733b47a4b056582b359c62c9f1360814178
2025-08-22 14:18:05 +00:00
Aleksandr.Govenkoandintellij-monorepo-bot 19d608d348 PY-76874 Conformance test failure: annotations_generators.py
- Refactored PyTypeCheckerInspection.visitPyYieldExpression() to handle delegating and regular yield expressions separately
- Added PyTypeCheckerInspection.visitDelegatingYieldExpression() to validate delegating yield expressions
- Refactored GeneratorTypeDescriptor.create() into .fromGenerator() and .fromGeneratorOrProtocol()
- Inline GeneratorTypeDescriptor.withAsync and GeneratorTypeDescriptor.toPyType

GitOrigin-RevId: e414dc35430290eae9d022f9d8a458966ac90836
2025-08-01 16:38:38 +00:00
Ilia Zakoulovandintellij-monorepo-bot 1c307c7934 PY-82168: Implement inspection and quick fixes for dataframe and series in the conditions
GitOrigin-RevId: 658f2d5609852b00b7e1011c3841c7266c202686
2025-07-09 17:45:22 +00:00
Petrandintellij-monorepo-bot 7135789b0f PY-81288 Incorrect type inferred for a function with positional only parameters
GitOrigin-RevId: 3bfea7064073b32743d58bbf5030769d1565a61e
2025-06-28 13:01:14 +00:00
Aleksandr.Govenkoandintellij-monorepo-bot a4b4cd8126 PY-80524 Explicit return statement expected false positive for an if inside try / except
GitOrigin-RevId: 6877fc7b34622d7ae884233af96e06ea92c918c1
2025-05-07 15:42:10 +00:00
Aleksandr.Govenkoandintellij-monorepo-bot 089e124ea1 PY-80493 Inconsistent return inspection adding "return None" after every line in context manager
Merge-request: IJ-MR-160763
Merged-by: Aleksandr Govenko <aleksandr.govenko@jetbrains.com>

GitOrigin-RevId: b576e30d433d39e426c8854d3ad485594ac9e958
2025-04-22 14:01:06 +00:00
Morgan Bartholomewandintellij-monorepo-bot d412ed3e87 [pycharm] PY-79331 render type as "type", not "Type"
IJ-MR-159663

GitOrigin-RevId: ef585e7409bc1d92f54d3fdac6beae8dca58cb1f
2025-04-16 04:59:39 +00:00
Pavel Karateevandintellij-monorepo-bot 2ddad0c3d8 PY-79802 Fix tests
(cherry picked from commit e423287ff840e04cea0548fcc589d7b7dc37b105)

IJ-MR-157680

GitOrigin-RevId: 63d0f67470f40c0291680faa61dd6e070c0e7610
2025-03-25 21:14:30 +00:00
Aleksandr.Govenkoandintellij-monorepo-bot e8f5b1c631 PY-52477 PY-78913 Add inspection for inconsistent returns
Merge-request: IJ-MR-154297
Merged-by: Aleksandr Govenko <aleksandr.govenko@jetbrains.com>

GitOrigin-RevId: e89225212cc981a5b256fca4ee23d77659b3ce5e
2025-02-14 17:21:51 +00:00
Alex Grönholmandintellij-monorepo-bot 02f5e3f522 PY-75291: Implemented auto-import for PEP 695 type aliases
GitOrigin-RevId: c15a6387785813688358e9695186a72dbdf35744
2025-01-23 15:46:39 +00:00
Aleksandr.Govenkoandintellij-monorepo-bot 80ea4e852c PY-20710 Support 'Generator' typing class
Check YieldType of yield expressions in PyTypeCheckerInspection
Check that (Async)Generator is used in (async) function
Check that in 'yield from' sync Generator is used
Convert PyMakeFunctionReturnTypeQuickFix into PsiUpdateModCommandAction
Infer Generator type for lambdas
When getting function type from annotation, do not convert Generator to AsyncGenerator
Introduce GeneratorTypeDescriptor to simplify working with generator annotations


Merge-request: IJ-MR-146521
Merged-by: Aleksandr Govenko <aleksandr.govenko@jetbrains.com>

GitOrigin-RevId: b3b8182168c5224f0e03f54d443171ccf6ca7b89
2024-12-04 15:22:15 +00:00
Aleksandr.Govenkoandintellij-monorepo-bot 31dd92576e PY-20611 Missing warning about functions implicitly returning None when return type is not Optional
Updated PyFunction to account for implicit 'return None' statements when inferring return statement types.

It affected return type inference of PyFunction.

Fixed a failing test related to formatted strings.

Added a quick fix to make all return statements explicit.

Updated the CFG to include PyPassStatements, enabling detection of exit points in empty functions.

Simplified PyMakeFunctionReturnTypeQuickFix to independently infer function types and handle required imports. Currently, it does not support specifying custom suggested types.



Merge-request: IJ-MR-148719
Merged-by: Aleksandr Govenko <aleksandr.govenko@jetbrains.com>

GitOrigin-RevId: 9f58961f9eb70e4f9dbba7359f5aafdfd392b7e2
2024-11-26 17:02:37 +00:00
Petrandintellij-monorepo-bot c8509ccc80 [python] Support TypeVarTuple from typing_extensions
GitOrigin-RevId: 02ed108a55d3feed54d95bfb5552f31cdf3e4880
2024-05-24 22:15:34 +00:00
Mikhail Golubevandintellij-monorepo-bot b55fd53258 PY-35627 Make Python formatter always add a line break after a decorator list
For regular non-async functions, it already worked thanks to PyTokenSeparatorGenerator.

GitOrigin-RevId: b60dba7b34710cad7dc46ad6f943b3944fc00c42
2024-02-07 17:34:28 +00:00
Petr Golubevandintellij-monorepo-bot 05484d8f97 PY-53120 "Add method" action does not create async def
GitOrigin-RevId: 8b2286a3f50d7b0d00ebbb0befc9811a80f7b304
2024-01-19 20:06:59 +00:00
lada.gaginaandintellij-monorepo-bot 75b1ecd244 [python] Cleanup supported/unsupported versions xmls
- Drop support for python 3.5 & 3.6 in compatibility inspection
- Fix and remove some outdated tests
- Remove xmls for long-unsupported python 2.6 & 3.5
- Regenerate versions.xml
- Remove mentions of OS-specific modules

GitOrigin-RevId: 3265dd1de8a4f7a41119e10c95bb705ca5845efe
2023-11-17 18:57:31 +00:00
lada.gaginaandintellij-monorepo-bot ad5b55918e Revert tests with over-inferring LiteralString
(cherry picked from commit 0c92e1c64362e2834b01b4e0bcbcedfefe4febe0)

IJ-MR-112631

GitOrigin-RevId: 233abfde16b19e96c5bc39c77eef1a240aa1b3e8
2023-11-07 22:10:23 +00:00
andrey.matveevandintellij-monorepo-bot a75c569022 PY-53105 Support TypeVarTuple
GitOrigin-RevId: f8160e9d802b09991daa710ed9a20f3e30d455da
2023-10-20 13:38:04 +00:00
lada.gaginaandintellij-monorepo-bot 47b89847e6 Add language level for Python 3.13 (PY-63375)
GitOrigin-RevId: beb405baf746c1992d51118d660cb8c718deda62
2023-10-12 20:25:28 +00:00
540f24faa4 PY-34498 Add an inspection for pytest fixture that is not passed to test parameters
Report warning if a fixture is used without being passed to test function parameters or to
`@pytest.mark.usefixtures` decorator.


Co-authored-by: Denis Mashutin <Denis.Mashutin@jetbrains.com>


Merge-request: IJ-MR-108713
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>

GitOrigin-RevId: 28d0711b99ab7ae180f672306dd4ab8a81f1feec
2023-09-04 09:53:07 +00:00
Andrey.Matveevandintellij-monorepo-bot f38d61eed6 PY-58464 Restore stdlib canonical path for Decimal
GitOrigin-RevId: 1c0df1d9c9e8ad22b464e54c4bc30dda4f903946
2023-08-26 09:33:54 +00:00
Lada Gaginaandintellij-monorepo-bot 454b1287ae PY-58857 Infer typing.LiteralString for string literals
GitOrigin-RevId: 27507deabd61faedf7937415016f0f8334e5a418
2023-06-21 16:32:22 +00:00
Natalia.Murychevaandintellij-monorepo-bot 0d53aa47df DS-4878 Pandas-specific-quick-fix-replace-listdf.col.values-to-df.col.tolist
Add new intention and a corresponding quick fix for the usage pd.Series.values property from pandas library.

^DS-4878 Fixed

Merge-request: IJ-MR-106089
Merged-by: Natalia Murycheva <natalia.murycheva@jetbrains.com>

GitOrigin-RevId: 0c8dc40b09ee2d95ecd8ded532f31f5ef4a7740f
2023-05-13 20:44:29 +00:00
KotlinIslandandintellij-monorepo-bot 45dd0bf0e8 Add language level for Python 3.12
GitOrigin-RevId: 10d24da89149754de63c87ec9edc0a1b7f131f17
2022-11-13 01:47:35 +00:00
andrey.matveevandintellij-monorepo-bot b7398bb63d PY-10719 Fix add import above import with noinspection comment
GitOrigin-RevId: 6dd79b10e56b9e9e2eee76c83d5974dee43446a1
2022-07-26 13:17:54 +00:00
Mikhail Golubevandintellij-monorepo-bot 3b6dea06a3 PY-21398 Wrap batch updates of existing usages in quickfixes with PotemkinProgress
It also fixes EA-425763 about using incorrect parent and anchor elements
to insert a function generated from a method of a nested class.

GitOrigin-RevId: f9b9da303396eb78c2c12b2750065dbdc0ba70ed
2022-02-17 09:28:34 +00:00
Lada Gaginaandintellij-monorepo-bot 315f1905fd PY-46344 Import abstract base classes from collections.abc, not collections
GitOrigin-RevId: d4b7165f09f47c7cca6c3eb47b1e254e5b855b40
2021-11-19 12:04:44 +00:00
KotlinIslandandintellij-monorepo-bot 119696be41 Add language level for Python 3.11 (PY-51300)
GitOrigin-RevId: bc2fd30744ca9c2a8023c718ade4689bfc9fef9b
2021-11-17 15:31:59 +00:00
andrey.matveevandintellij-monorepo-bot 1156723b14 PY-33055 Fix move attribute to __init__ method quickfix
(cherry picked from commit cd6abb8ad8a01b22066bed85639242b03a85d1d0)

IJ-MR-8050

GitOrigin-RevId: f8a350835ce303c96b7f404263d8367242f4eaa6
2021-10-12 06:16:05 +00:00
andrey.matveevandintellij-monorepo-bot 903f6e11ca PY-27128 PY-48466 Fix problem with imports in PyMakeFunctionReturnTypeQuickFix
(cherry picked from commit 9320c2e708afa2ddd025f60b0c122132387493b7)

IJ-MR-10124

GitOrigin-RevId: 219e646482999e8b81b77aaf52eb24574381af3d
2021-09-20 11:56:03 +00:00
andrey.matveevandintellij-monorepo-bot 1fe7e5443c PY-49283 Add quick fix for from future import annotations
(cherry picked from commit 7d26e211c67f2574078e1f0e8951f744889d82d6)

IJ-CR-10316

GitOrigin-RevId: 34d4bc72b11613c0603587c1c0a9e640b0add023
2021-08-30 20:48:41 +00:00
andrey.matveevandintellij-monorepo-bot 781d56deec PY-49935 Fix test after fix internationalization for type hints illegal first parameter
GitOrigin-RevId: 75e9239648869c264b242841fdd53486377a0e71
2021-08-25 09:57:49 +00:00
andrey.matveevandintellij-monorepo-bot 997b58df49 PY-49935 Impl type inference and type checking for PEP 612
Support type hints and type checking for typing.ParamSpec and typing.Concatenate

(cherry picked from commit 7854b3386ccdffc0091664e0923622cd8c093fc9)

IJ-MR-12970

GitOrigin-RevId: 4578cb463b6ab8fc244766bfaccb122d0e2b7479
2021-08-23 17:52:45 +00:00
andrey.matveevandintellij-monorepo-bot ebe8f93812 PY-44974 PEP 604: Support Python3.10 unions
Support | syntax for python unions.
Also support type | None as a new style for Optional.
Fix highlighting unresolved reference issues with | syntax.
Type inference from isinstance and issubclass.
Add quick fix to switch to old-style syntax in earlier python versions (<3.10)
Fix quick documentation to render new syntax.

(cherry picked from commit 6a64ee12c2d8503a0ef102e8b67cb0b95ce77999)

IJ-MR-8400

GitOrigin-RevId: c26b868fc61f26936a3316ec06f78b66d75f6857
2021-06-14 14:38:25 +00:00
Semyon Proshevandintellij-monorepo-bot 1f898d43af Remove PyStringExceptionInspection and PyWrapInExceptionQuickFix as no longer relevant for supported python versions
GitOrigin-RevId: 9718219e670d2fe0a8e7c710f9c789c9b8f25dd9
2021-04-30 10:35:10 +00:00
Semyon Proshevandintellij-monorepo-bot fbadbbc40d Sync with typeshed @ 2c8cb605961bf76a88f9c21624893e4368ac3638
Temporarily exclude https://github.com/python/typeshed/pull/4987
Temporarily exclude https://github.com/python/typeshed/pull/5206 from `collections/__init__.pyi`

GitOrigin-RevId: 78775cc6c09fd8d867d8f46bf9908bd5cdbb05f6
2021-04-28 00:06:58 +00:00
Semyon Proshevandintellij-monorepo-bot 56a1c00c2a Make python-latest project descriptor default in tests
Update test data and reduce manual language level setup

GitOrigin-RevId: d6ddec1b2b29a2b7f1a34cfb5982fd975de78d65
2021-03-15 17:33:04 +00:00
Semyon Proshevandintellij-monorepo-bot 2465b8a67d Enable pyi stubs for several modules (PY-41509, PY-46229)
_ast, _dummy_thread, datetimerange, dummy_thread, dummy_threading, formatter, jwt, platform, string, thread

GitOrigin-RevId: a8010a0bd2381712599be0f96b35ce74e3e0c7d2
2021-03-03 22:46:06 +00:00
Mikhail Golubevandintellij-monorepo-bot 55e52c42b6 PY-46361 Don't suggest stubs from legacy python-skeletons for auto import
GitOrigin-RevId: ec56e579d0240cb03b2f16bb468b7a1be6a95762
2021-01-08 16:51:06 +00:00
Mikhail Golubevandintellij-monorepo-bot 4ca188384d PY-46358 Add the actual "as" part to local imports for common package aliases
GitOrigin-RevId: ad1061472e98c66ce3abc0e6d5e633ab271c2b41
2021-01-07 17:25:43 +00:00