Commit Graph

90 Commits

Author SHA1 Message Date
lada.gagina
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.gagina
47b89847e6 Add language level for Python 3.13 (PY-63375)
GitOrigin-RevId: beb405baf746c1992d51118d660cb8c718deda62
2023-10-12 20:25:28 +00:00
Daniil Kalinin
9249e0a15c PY-61856 PEP 695 Type Parameter Syntax: Code compatibility inspection and unsupported features annotator
GitOrigin-RevId: 164a07daff1059ac1a421e1a883168924f82559e
2023-09-28 15:05:34 +00:00
KotlinIsland
45dd0bf0e8 Add language level for Python 3.12
GitOrigin-RevId: 10d24da89149754de63c87ec9edc0a1b7f131f17
2022-11-13 01:47:35 +00:00
Elizaveta Shashkova
6e383650ca PY-53776 Support the syntax changes of PEP 646 Variadic Generics
GitOrigin-RevId: 6ee5939eff1c0503132b013c6469de00b50b2d86
2022-05-30 09:40:36 +00:00
Mikhail Golubev
97b22aaa13 PY-42200 Support parenthesized context managers in Python 3.9+
In case of syntactic ambiguity with previous versions of the grammar, such as
"with (expr)" or "with (expr1, expr2)", PyWithStatement is still parsed as
having its own parentheses, not a parenthesized expression or a tuple as
a single context expression. The latter case, even though syntactically legal,
is still reported by the compatibility inspection in Python <3.9.

These changes also include proper formatter and editing support (e.g. not
inserting backslashes on line breaks inside parentheses), as well as
Complete Current Statement, which now takes possible parentheses into account
while inserting a missing colon.

The changes in the formatter are somewhat ad-hoc, intended to minimize the effect
on other constructs. "With" statement is somewhat special in the sense that it's
the first compound statement (having a statement list) with its own list-like
part in parentheses.

Existing tests on with statement processing were expanded and uniformly named.

Co-authored-by: Semyon Proshev <semyon.proshev@jetbrains.com>

GitOrigin-RevId: 15c33e97f177e81b5ed23891063555df016feb05
2022-05-04 12:31:37 +00:00
KotlinIsland
119696be41 Add language level for Python 3.11 (PY-51300)
GitOrigin-RevId: bc2fd30744ca9c2a8023c718ade4689bfc9fef9b
2021-11-17 15:31:59 +00:00
Mikhail Golubev
de08c2a947 Fix Python tests after the proofreading
GitOrigin-RevId: 2f6eb873d6321ef00d293377ec2c97195f72da21
2020-11-30 22:17:55 +00:00
Semyon Proshev
00eb505497 Python 2.6 is no more supported in compatibility inspection
Because 2.6 is not supported since 2019.1 in IDE.

GitOrigin-RevId: 3dee3e941c921ad3a5dc6d72cca840eb5d811691
2020-10-16 12:24:45 +00:00
Semyon Proshev
d30fc4f7bc Inline language level flags that are constants in supported python versions
GitOrigin-RevId: 5e381b72505c1d896028da83b7044be51e408f0b
2020-10-16 12:24:31 +00:00
Semyon Proshev
860672992e Add language level for Python 3.10 (PY-44857)
Additionally several mandatory python versions have been aligned in FutureFeature.

GitOrigin-RevId: bfeba8d465c593c1000ed0f5226a4ab2a918a2bf
2020-10-16 12:24:27 +00:00
Semyon Proshev
b9281dd55f Mark python 3.5 as unsupported and update 3.9 modules list (PY-41512, PY-44853)
Modules list has been updated using python on Windows, seems it should be done on all OSes and merged.

GitOrigin-RevId: 621172608fffddc3e830f1133fba89a05d092eba
2020-10-08 14:37:43 +00:00
Mikhail Golubev
912e1e87b3 i18n: Extract remaining warnings from the Python compatibility inspection
GitOrigin-RevId: 86ab9ea4b7b612889cef31609a640a6e6da904fa
2020-08-20 11:49:35 +00:00
Mikhail Golubev
0adac7f9ea i18n: Add initial support in PyCompatibilityInspection
All its warnings are extracted into the bundle, but they are still poorly
adapted for translation. Each of them in constructed from two separate
messages, a common prefix and an individual feature description, with negation
of the main verb being split. Only the first message can vary depending on
the affected versions number, but both parts of the verb need to agree in many
languages other than English. It's not clear how to address it without
overhauling inspection internals, thus it will be revised later.

I also slightly updated the warnings format. Namely, put "version" in plural,
if a warning applies to multiple Python versions, and removed trailing periods
from single-sentence messages.

GitOrigin-RevId: 51e577201b11fb4e8b6967e1f5ad27143ba9f82e
2020-08-19 14:22:06 +00:00
Lada Gagina
2e617b803c IDEA-CR-63687: PY-41305 Add PEP 614 support
Allows to use any expression as a decorator

GitOrigin-RevId: e92af1ebd2c4d7024971fd4542bfe52640faaa26
2020-06-17 00:30:49 +03:00
Semyon Proshev
48a4a4a8bc Add Python 3.9 language level (PY-37458)
Additionally, I did the following:

* re-generated lists of supported/unsupported interpreter modules
* updated test data wherever Python versions appear in warnings

GitOrigin-RevId: 66fd298e6051bf91fb894e037a877d0b382da337
2020-03-26 13:31:44 +00:00
Mikhail Khorkov
eae34dc336 PY-14844 Add integer suffix support for Cython
Cython supports C-style integer suffix (u, l, ll). I added them to Python lexer and annotator checker to highlight them in Python language.

More information:

- https://cython.readthedocs.io/en/latest/src/userguide/language_basics.html#differences-between-c-and-cython-expressions

- https://en.cppreference.com/w/cpp/language/integer_literal

GitOrigin-RevId: 97d7bcb19239f931d9ed5e5746aaed84ac09cbc8
2020-02-05 08:01:18 +00:00
Mikhail Golubev
5c9ec47997 PY-35961 Report missing parentheses in return/yield depending on language version
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
2019-10-14 17:02:52 +00:00
Semyon Proshev
ccc2156cf9 Add parsing for assignment expressions (PEP 572) (PY-33886)
Highlight expressions that are invalid by grammar or unacceptable in runtime
Highlight expressions in pythons < 3.8

GitOrigin-RevId: 89acec9db5b3a931da31c33778185e147240ec01
2019-07-02 06:52:16 +03:00
Lada Gagina
3b991b20ca PY-36009 Add support of '=' for debugging in f-strings
GitOrigin-RevId: 79314512860158a4c535103ee2ac9fee43d30d0d
2019-07-02 06:52:16 +03:00
Semyon Proshev
8966e016d5 Add Python 3.8 language level (PY-33884)
Additionally, I did the following:

* re-generated lists of supported/unsupported interpreter modules
* updated test data wherever Python versions appear in warnings

Still need to figure out, though, why _bz2/bz2 modules were not found
for some old versions of Python, hence information about their presense
should be updated by hand in versions.xml.
2019-03-19 13:38:12 +03:00
aleksei.kniazev
cc5503197e treat 'six' lib as a trusted compatibility lib for inspection 2019-02-28 18:10:15 +03:00
Semyon Proshev
1e07ba1cfa Avoid duplicate messages in compatibility inspection and unsupported features annotator (PY-33516)
Inspection does not register `CompatibilityVisitor` problems for its opened file language because in such a case
`UnsupportedFeatures` will annotate them.
Also `registerOnFirstMatchingVersion` methods were removed because
they could lead to duplication even if languages to register were different.
2019-01-14 17:27:39 +03:00
Semyon Proshev
9eb9d94a9b Fix test data (PY-32321) 2018-11-06 21:21:16 +03:00
Semyon Proshev
7a0b54426e Highlight bytes and non-bytes literals in Python 3+ (PY-32321) 2018-11-06 17:15:10 +03:00
Semyon Proshev
50bf50fa0e Mark raise with no args under finally as an error because it leads to an exception in runtime on Python 2.7 (PY-29763) 2018-11-01 17:55:26 +03:00
Elizaveta Shashkova
773115f8a0 Tests: reformat test data (PY-15360) 2018-03-14 16:45:28 +03:00
fitermay
9e70a41a7e PY-15360 Error on trailing comma after star args for Py<3.5 2018-03-14 12:51:02 +03:00
Semyon Proshev
a476f44ce7 Correctly calculate qualified name for imported elements (PY-28295) 2018-02-06 19:11:51 +03:00
Semyon Proshev
408d0b8314 Deprecate Python 3.3 language level. Remove its usages (PY-27705) 2018-02-01 19:53:39 +03:00
Semyon Proshev
3053152d80 Deprecate Python 3.2 language level. Remove its usages (PY-27705) 2018-02-01 19:53:39 +03:00
Semyon Proshev
3756ddea59 Deprecate Python 3.1 language level. Remove its usages (PY-27705) 2018-02-01 19:53:38 +03:00
Semyon Proshev
c57210dc3e Deprecate Python 3.0 language level. Remove its usages (PY-27705) 2018-02-01 19:53:38 +03:00
Semyon Proshev
c471398267 Parse and highlight async and await as keywords in Python 3.7+ (PY-28247)
Update compatibility inspection to raise warning only if Python 3.7+ is marked
2018-02-01 15:21:50 +03:00
Mikhail Golubev
c995f833fe Python 3.7 does support f-strings in compatibility inspection test data 2018-01-09 23:26:56 +03:00
Semyon Proshev
21e4de949c Add Python 3.7 language level
Additionally, I did the following:

* re-generated lists of supported/unsupported interpreter modules
* updated test data wherever Python versions appear in warnings

Still need to figure out, though, why _bz2/bz2 modules were not found
for some old versions of Python, hence information about their presense
should be updated by hand in versions.xml.
2017-12-13 19:44:29 +03:00
Semyon Proshev
96e41895d3 Deprecate Python 2.5 language level. Remove its usages. 2017-12-13 19:44:28 +03:00
Semyon Proshev
556cb4fd3d Deprecate Python 2.4 language level. Remove its usages. 2017-12-13 19:44:28 +03:00
Semyon Proshev
55949b3eb4 Fix highlighting for empty raises (PY-26510) 2017-10-23 19:42:13 +03:00
Semyon Proshev
c4c6294e1d Update PyCompatibilityInspection to correctly process long in Python 2.
The reason of update is that `long` is described as `long = int` in pyi-stubs.
2017-06-20 11:36:46 +03:00
Mikhail Golubev
336dc0b210 PY-22302 PY-23355 Don't warn about ellipsis and star expressions in function type comments
Also, UnsupportedFeatures annotator properly detects the language
level for the analyzed element. Previously, it used Python version of
the containing file for some injected fragments.
2017-04-24 15:07:35 +03:00
Mikhail Golubev
10ac9a4b38 Don't wrap return type of explicitly annotated async generator in Coroutine
So that something like "async def f() -> AsyncIterable[int]" doesn't
return "Coroutine[AsyncIterable[int]]".

Also more reliably detect async generators to warn about non-empty
returns inside them.
2017-02-03 17:06:23 +03:00
Semyon Proshev
42fc094e4e PY-16098 Fixed: Warn that async and await will become keywords in Python 3.7
Warn about variables, classes and functions called "await" or "async" in Pythons 3.5 and 3.6. Suggest quick fix to rename such nodes
2016-10-07 12:21:53 +03:00
Semyon Proshev
bd19e02dd5 PY-20770 Fixed: Support Python 3.6 asynchronous generators and comprehensions
Update CompatibilityVisitor to highlight "await" inside comprehensions in Python 3.5
2016-09-30 18:09:37 +03:00
Semyon Proshev
464ade6789 PY-20770 Fixed: Support Python 3.6 asynchronous generators and comprehensions
Update CompatibilityVisitor to highlight "async" inside comprehensions and generator expressions in Pythons < 3.6
2016-09-30 18:06:02 +03:00
Semyon Proshev
0e61667352 PY-20770 Fixed: Support Python 3.6 asynchronous generators and comprehensions
Update highlighting and compatibility visitor to correctly process async generators described in PEP 525
2016-09-30 17:59:50 +03:00
Semyon Proshev
137c3cbd80 Introduce registerForAllMatchingVersions and registerOnFirstMatchingVersion util methods in CompatibilityVisitor 2016-09-26 15:32:20 +03:00
Mikhail Golubev
b16311ef60 PY-18972 Initial support of f-string literals
Namely, Python lexer, compatibility inspection and unsupported
features annotator are aware of them now.
2016-09-16 08:16:26 +03:00
Mikhail Golubev
409aad3f71 PY-20744 Compatibility inspection and annotator warn about variable annotations 2016-09-16 08:16:26 +03:00
Semyon Proshev
0dd39f3f80 Update CompatibilityVisitor to highlight and suggest quick fix for underscores in numeric literals in Pythons < 3.6
As a result compatibility inspection warns about underscores for Pythons < 3.6
2016-09-13 15:35:31 +03:00