Commit Graph
2737 Commits
Author SHA1 Message Date
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 83771208a3 PY-20744 Consider variable annotations only in current file to prevent unstabbing everywhere
It will be fixed eventually when we start storing annotations
for parameter, functions and target expressions in stub files and
process them using PyTypeParser only.
2016-09-16 08:16:26 +03:00
Mikhail Golubev a48947ab01 PY-20744 Warn about illegal targets for variable annotations 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
Mikhail Golubev eb64521ae2 PY-20744 Python formatter is aware of variable annotations 2016-09-16 08:16:26 +03:00
Mikhail Golubev 3266460142 PY-20744 Parse PEP-526 variable annotations
Annotation is preserved at the level of assignment nodes similar to
where CPython keeps them in its AST (in special "augassign" nodes).
For type annotations in form "x: int" without variable initialization
special statement PyTypeDefinitionStatement was introduced.
2016-09-16 08:16:26 +03:00
Semyon Proshev 90a381b2f1 PY-20662 Fixed: Making any magic method async displays an error, even though it is sometimes legal
Mark __call__ builtin as allowed to be async
2016-09-15 19:20:12 +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
Semyon Proshev 389902961b Update CompatibilityVisitor to correctly handle Implicit oct (without o or O) long integers 2016-09-13 15:35:31 +03:00
Mikhail Golubev c11850fa34 Add Python 3.6 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.
2016-09-09 11:48:29 +03:00
Semyon Proshev a8fcaed8ff EA-87708 Fixed: NPE: PyFunctionImpl.getWrappersFromStub
PY-19412 Fixed: Class method support becomes broken if method attribute is used

Check all next siblings stubs of PyTargetExpressionStub type in function modifier calculating and honour all nullable values
2016-09-07 19:44:57 +03:00
Lada Gagina 08fc28f682 PY-20610 Fix function annotation highlighting
Fix PyTypeCheckerInspection so it doesn't highlight arrow in python 3 type annotations.
2016-09-04 21:29:46 +03:00
Elizaveta Shashkova 3aea92aeab Add test for argument parsing for subprocess (PY-20476 ) 2016-09-02 15:34:58 +03:00
Lada Gagina c9a96f59ff PY-16055 Add quickfix and tests for functions with incorrect return annotation
Add quickfix for functions whose return type doesn't match their annotated type.
2016-08-30 17:12:55 +03:00
Lada Gagina dd95592ff4 PY-16055 Add warnings for functions with no return and empty return
Add warnings for functions with return type annotation but empty return or no return at all.
2016-08-30 17:12:55 +03:00
Ilya.Kazakevich edeb96c21d PY-20553: Store checked elements to prevent loop
* Loop "someElement -> getReference -> resolve -> someElement" is broken
2016-08-26 18:43:28 +03:00
Mikhail Golubev 6b08a94f89 EA-87349 Fix NPE in the "Convert from variadic to normal parameter(s)" intention 2016-08-26 14:24:59 +03:00
Mikhail Golubev 10abeaea46 PY-20392 Handle ambiguous settings for space after trailing comma in collection literals
If one has chosen to omit a space after comma in settings but still
wants a space within braces or brackets in collection literals.
2016-08-25 15:07:14 +03:00
Mikhail Golubev 2d8fe72a93 PY-20392 Put space after trailing comma in dict literals if SPACE_AFTER_COMMA is enabled 2016-08-25 15:07:13 +03:00
Elizaveta Shashkova c92d58d54f Add test (PY-20526) 2016-08-23 21:01:39 +03:00
Mikhail Golubev ccbe06603c PY-20026 Add test for the scenario provided by the user
The problem itself has been already remedied by the previous fix,
nonetheless, the example given by the user provides an interesting
case where we can encounter duplicate base classes in practice,
since we are not able to find out result of type(SomeClass) expression
yet.
2016-08-19 16:52:42 +03:00
Andrey Vlasovskikh 1d7969e765 Fixed resolve when regular and namespace packages with same name are in Python path (PY-19691)
According to PEP 420, if any non-namespace package is found in the
Python paths, then it is used as the import result. If several
namespace packages are found, then the import result is a namespace
package that contains every module within them.
2016-08-12 22:05:00 +03:00
Elizaveta Shashkova 955e2ee174 Fix threads resume test: do not suspend main thread until all threads are created 2016-08-12 14:08:37 +03:00
Semyon Proshev 3251485499 PY-20280 Fixed: Warn if class variable listed in __slots__
Introduce PyDunderSlotsInspection which detects invalid definition of __slots__ in a class
2016-08-10 17:29:49 +03:00
Semyon Proshev 788889adae PY-18965 Fixed: Python version 2.7 does not have method exec - regression
Ignore call 'exec' expressions in PyCompatibilityInspection
2016-08-10 17:15:52 +03:00
Lada Gagina eb8fbb2d80 PY-16055 Add type checking for function return type
Checking function return type is the same with function type annotation.
2016-08-10 16:23:58 +03:00
Lada Gagina b101e0815f PY-16055 Fix incorrect return type in MutableMapping test 2016-08-10 16:08:41 +03:00
Lada Gagina 49caa2b777 PY-19927 Add highlighting to __setstate__ and __sizeof__ magic methods 2016-08-10 15:32:04 +03:00
Semyon Proshev aacd5e6781 Fix Py3UnresolvedReferencesInspectionTest.testAsyncInitMethod and PythonHighlightingTest.testAsyncBuiltinMethods 2016-08-02 21:15:05 +03:00
Lada Gagina 4e0f092dea Add missing magic methods to PyNames and fix __rpow__ completion test 2016-08-02 20:15:37 +03:00
Semyon Proshev 95e7a3913d Rewrite PyPropertyDefinitionInspection tests as highlighting tests 2016-08-02 19:04:12 +03:00
Semyon Proshev 2955a4f8f5 PY-19701 Fixed: False positive "setter should not return a value" with local function definition
In PyPropertyDefinitionInspection use control flow to check if there is raise, return or yield expression in function
2016-08-02 19:04:12 +03:00
Elizaveta Shashkova 6c3373cf0d Remove obsolete test for pycharm egg 2016-08-02 18:55:11 +03:00
Semyon Proshev 893cea67b1 PY-20017 Fixed: Unresolved attributes for child class if __new__ is implemented in parent class
For 'self' and 'cls' parameters return containing class as a type
2016-08-02 16:29:59 +03:00
Semyon Proshev c022ac4f03 PY-19492 Fixed: Magic method parameter value is flagged as unused but cannot be removed because it's required by Python
Update PyUnusedLocalInspectionVisitor to ignore builtin method parameters (except __init__)
2016-08-01 21:28:25 +03:00
Semyon Proshev 08ce043366 PY-19775 Fixed: Unresolved attribute reference on attribute defined inside async def __init__
Don't create coroutine type as return type for methods which are not allowed to be async
2016-08-01 21:28:25 +03:00
Semyon Proshev 30381b3b10 PY-19775 Fixed: Unresolved attribute reference on attribute defined inside async def __init__
Highlight builtin methods (except __aiter__, __aenter__, __aexit__, __anext__) which are not allowed to be async
2016-08-01 21:28:24 +03:00
Lada Gagina 1877923863 PY-12944 Add type checking for coroutines
Add type inference for 'yield from' return values.
2016-08-01 14:22:13 +03:00
Elizaveta Shashkova 79b865d6df Debugger stopping in all threads after resuming from a breakpoint (PY-20158)
Sometimes it isn't possible to suspend thread, which is sleeping or waiting on lock. This thread is trying to suspend, but it's not suspended yet. When user is sending "Resume" command, we don't resume this thread, because it isn't suspended. After that, when this thread stops waiting, it doesn't know anything about Resume command and it's trying to suspend.
So, we need to send Run command to all threads (suspended and non-suspended) and we should do it without using internal command.
2016-07-30 19:33:37 +03:00
Andrey Vlasovskikh 21d99ffab5 Disabled compatiblity inspection for backported 'typing' (PY-18880) 2016-07-29 19:09:05 +03:00
Andrey Vlasovskikh fbb2b5a0fa Disabled compatiblity inspection for backported 'enum' (PY-19486)
We still have false negative for not mentioning 'enum34' in
requrements.txt.
2016-07-29 19:09:05 +03:00
Semyon Proshev 4d218b15cd PY-19858 Fixed: type checker: wrong type for List[List] elements
Improve type inference for list.__getitem__ call by analyzing passed arguments
2016-07-29 14:30:54 +03:00
Elizaveta Shashkova b467de758d Fix some Python debugger tests 2016-07-29 12:48:32 +03:00
Ilya.Kazakevich b44bf60f0a PY-20194: Use module root or test parent directory as working dir if not set explicitly.
Default workdir for PyCharm is its installation folder. Always never should it be used as working dir for script it runs. If user does not provide working dir, we must guess it. #getWorkingDirSafe() does this guess. It takes directory for script, directory for test or simply first module root. See its javadoc and usage for details.
2016-07-28 23:54:42 +03:00
Semyon Proshev e313e5151b PY-20038 Fixed: "Call to __init__ of super class is missed" inspection if super is used with __class__
Update PyMissingConstructorInspection to honour __class__ as a first arg of super(...).__init__ call
2016-07-26 20:14:37 +03:00
Ilya.Kazakevich 7f9d87b280 Flaky test fixed
--version is reported to stderr on some anaconda interpreters, but we parse stdout
2016-07-21 21:03:46 +03:00
Ilya.Kazakevich afc171d39c Flaky test fixed
Due to precision sleep(1000) may actually take 998 and lead to test error.
2016-07-21 17:58:32 +03:00
Semyon Proshev b1326d769d PY-19461 Fixed: Inspection does not recognize all subclasses
PY-19530 Fixed: from MODULE import SUBMODULE as NAME not find inheritance

If superclass is imported via 'as', save its imported and original names in stubs.
Use original name in PySuperClassIndex building and imported name in superclasses calculating
2016-07-20 21:16:54 +03:00
Ilya.Kazakevich 5045164a0d PY-18839: Adding test 2016-07-19 17:35:10 +03:00
Ilya.Kazakevich f46f147552 PY-20091: Report "import" and other "summary" errors.
* terminalreporter hasn't been used. It should be registered as last plugin to overwrite built-in
2016-07-18 19:39:31 +03:00