Commit Graph

3625 Commits

Author SHA1 Message Date
Semyon Proshev
c579994aec Quick fix to set abc.ABCMeta as metaclass (PY-30789) 2018-07-17 20:27:51 +03:00
Semyon Proshev
fff6955833 Move adding metaclass method (PY-30789) 2018-07-17 20:27:51 +03:00
Semyon Proshev
e2855325d1 Quick fix to add abc.ABC to superclasses (PY-30789) 2018-07-17 20:27:51 +03:00
Semyon Proshev
b8f5298ee3 Consider class inheriting abc.ABC as abstract (PY-30789) 2018-07-17 20:27:51 +03:00
Elizaveta Shashkova
717484f15a PY-29894 Fix Python quick fixes for PSI consistency 2018-07-17 14:58:31 +03:00
Ilya.Kazakevich
9328593cd2 PY-30762: Test added 2018-07-17 01:32:22 +03:00
Mikhail Golubev
6caccc8e4d PY-21493 Python regexp injector is aware of f-strings 2018-07-16 22:38:21 +03:00
Semyon Proshev
9f9608ae4b Provide resolve result for __builtins__ (PY-30512) 2018-07-16 21:04:59 +03:00
Semyon Proshev
17f543fdc9 Infer Any return type for abstract methods (PY-29704)
Sync overriding and implementing abstract methods.
Make `PyFunction.getReturnStatementType` accepting only non-null contexts.
2018-07-16 16:54:34 +03:00
Semyon Proshev
8b0dbf4e1b Ignore init=False attributes while inspecting fields order (PY-30880) 2018-07-16 15:44:23 +03:00
Anton Bragin
2b5e738a5a PY-30827 PyRenameElementQuickFix changed to avoid special handling of unit test cases
Test data and PyQuickFixTest are updated accordingly. Test for renaming in language injection added.
2018-07-13 10:46:32 +03:00
Semyon Proshev
c0b63fdc4c Add support for bool literals in Py3+ (PY-29731) 2018-07-02 17:39:28 +03:00
Semyon Proshev
6eeb3b25be Update overriding method with overloads (PY-30287)
* Select implementation as super method, not an overload
* Copy all its overloads
* Add imports for decorators (e.g. typing.overload)
2018-06-29 20:59:42 +03:00
Semyon Proshev
98582a7785 Check original parameter default value if stub one is ellipsis (PY-30335) 2018-06-29 20:59:12 +03:00
Semyon Proshev
a66b787eea Support appending requirement to string or tuple in setup.py (PY-29153, PY-30016) 2018-06-27 15:04:09 +03:00
Semyon Proshev
b9b8efa2b3 Support strings and tuple of strings in setup.py requirements (PY-29153, PY-30016) 2018-06-27 15:04:08 +03:00
Mikhail Golubev
a66fc1c678 PY-25488 Preserve formatting of extracted collection literals
as it's especially tedious to re-format them each time afterwards and
being surrounded with brackets they are safe to be moved to RHS of an
assignment.

Alternatively, we could leave such inlining only for binary expressions
since they can become syntactically illegal when moved out of the
context with implicit line joining (PY-2862).
2018-06-26 18:09:49 +03:00
Mikhail Golubev
e5226b9cf5 EA-121262 Don't include incomplete from imports in implicit package members 2018-06-25 18:24:57 +03:00
Semyon Proshev
48fd617336 Distinguish same number and string keys by quoting strings (PY-30423) 2018-06-18 20:03:36 +03:00
Semyon Proshev
5571702b32 Enable pathlib, io, itertools, ssl stubs (PY-30450, PY-29863, PY-27972, PY-28155, PY-15949, PY-22845) 2018-06-18 19:02:37 +03:00
Andrey Vlasovskikh
9c6480b7ec Moved former skeletons test for namedtuple() to regular tests 2018-06-18 15:14:02 +03:00
Mikhail Golubev
e27d677915 PY-30432 Remove explicit links to external documentation from Quick Doc
Because they are inserted automatically in DocumentationComponent, thus
otherwise we end up showing them twice.
2018-06-14 11:48:21 +03:00
Semyon Proshev
00c27e319e Highlight list literal passed as generic parameter to typing member (PY-20530) 2018-06-13 23:12:49 +03:00
Semyon Proshev
746a89b076 Highlight the case when type comment and annotation are both specified (PY-20530) 2018-06-13 23:12:48 +03:00
Semyon Proshev
f088deede3 Highlight illegal usages of self in annotations and type comments (PY-20530)
Update PyInspectionVisitor to init type eval context from context file for injected fragments.
Update TypeEvalContext to check if passed element is inside injected fragment in origin.
2018-06-13 23:12:47 +03:00
Semyon Proshev
4e69ba030f Check parameters passed to Callable and suggest quick fixes (PY-20530) 2018-06-13 23:12:46 +03:00
Semyon Proshev
0d9bf8ebff Enable highlighting error elements in type hints (PY-20530) 2018-06-13 23:12:46 +03:00
Semyon Proshev
adec865a52 Add quick fix to remove generic parameter(s) from instance and class checks (PY-28249) 2018-06-13 23:12:45 +03:00
Semyon Proshev
b7ec888a70 Add quick fix to sync typevar name with target name (PY-28243) 2018-06-13 23:12:45 +03:00
Semyon Proshev
32e16524aa Highlight the case when generic class is used with parentheses (PY-16853)
Make PyDocstringFile inheritor of PyExpressionCodeFragment so
PyResolveUtil.resolveImportedElementQNameLocally could resolve element used in type comment.

Create quick fix so call expression could be easily replaced with subscription.
2018-06-13 23:12:44 +03:00
Liana.Bakradze
7a036fcd41 fix tests after 28dae30 2018-06-09 18:28:13 +03:00
Mikhail Golubev
2ca474aa7d PY-29717 Restore accidentally broken order of parameters in Quick Doc 2018-06-09 17:18:58 +03:00
Liana.Bakradze
bdfc4cc7fb PY-8362 add env test 2018-06-09 17:16:51 +03:00
Mikhail Golubev
9550d6f44b PY-29717 Hide other overloads only for an overload definition itself
Otherwise, we end up not displaying overloads in cases when there is no
actual definition to resolve into. First of all, in case of builtin
declarations in typeshed.
2018-06-09 15:59:40 +03:00
Mikhail Golubev
0fea63201d PY-29717 Show types for explicitly annotated "self" and "cls" parameters 2018-06-09 15:59:40 +03:00
Mikhail Golubev
3d527c5382 PY-29717 Show types for *args and **kwargs in Quick Doc in PEP-484 format
Not as we see these variable types inside a function body, i.e.
just "**kwargs: Type" instead "kwargs: Dict[str, Type]" and
"*args: Type" instead of "args: Tuple[Type, ...]".
2018-06-09 15:59:40 +03:00
Mikhail Golubev
65ac1784dc PY-30359 PY-11425 Render information about keyword arguments in sections
Similarly to normal parameters we don't show those keyword arguments
that are not explicitly present in function signature and can't be
passed in because of absence of **kwargs parameter.

Additionally, I enforced the order in which sections appears, so that
information about parameters, return value and raised exceptions
was always first and also fixed the way we show single star parameter
in signatures.
2018-06-09 15:59:40 +03:00
Mikhail Golubev
87091da823 PY-30359 Render raised exceptions in Quick Documentation sections 2018-06-09 15:59:40 +03:00
Mikhail Golubev
7e884fad08 PY-29717 In Epydoc don't add a dot at the end of each param description
Otherwise, getParamDescription(), getReturnDescription() always return
non-empty string and we can't use it do determine whether a parameter
was actually mentioned in a docstring. Besides, it's inconsistent with
other docstring formats and really unnecessary since we no longer
display types and descriptions in the same place.

This change effectively reverts PY-7006.
2018-06-09 15:59:39 +03:00
Mikhail Golubev
29b02b42ca PY-29717 Use smaller threshold for return type wrapping
similar to that used in JavaScript documentation
(JSDocBuilderMethodInfo). Namely, insert line break if the line before
containing the last parameter is longer than 80 characters.
2018-06-09 15:59:39 +03:00
Mikhail Golubev
8074425e21 PY-29717 Don't render separate table with parameters for Epytext docstrings 2018-06-09 15:59:39 +03:00
Mikhail Golubev
e0d8445c69 PY-29717 Display description for parameters and return values in sections
docstring_formatter.py is no longer responsible for rendering this table
2018-06-09 15:59:39 +03:00
Mikhail Golubev
69d61a8316 PY-29717 Get rid of excess escaping of spaces in function signatures
It's not necessary as in Quick Documentation a definition is wrapped in
<pre/> tag according to new guide lines, and in tooltips line breaks are
preserved thanks to UIUtil.getHtmlBody() used in HintUtil.prepareHintText().
2018-06-09 15:59:39 +03:00
Mikhail Golubev
7afb41757c PY-29717 Don't render type for "self"/"cls" method parameters
These are mostly obvious at the call site.
2018-06-09 15:59:39 +03:00
Mikhail Golubev
a85cd24d85 PY-30103 Don't wrap methods with only one parameter apart from self
because in Python it would make all methods that expect an argument,
even as simple as property setters, to wrap.
2018-06-09 15:59:38 +03:00
Mikhail Golubev
9e118e01a9 PY-30103 Add wrapping for long function signatures
Similarly to how it's done for Java and other languages parameters are
wrapped and aligned always if there are more than one of them. Also, the
need to wrap the return type annotation is detected naively by checking
whether the length of the last line containing it exceeds 80 characters.
2018-06-09 15:59:38 +03:00
Mikhail Golubev
5988a48236 PY-29339 Display "async" function modifiers in documentation 2018-06-09 15:59:38 +03:00
Mikhail Golubev
b722a2aedc PY-29717 Distinguish packages from modules in documentation 2018-06-09 15:59:38 +03:00
Mikhail Golubev
b65b315dae PY-29717 Add missing tests on parameter formatting 2018-06-09 15:59:38 +03:00
Mikhail Golubev
67ebed5232 PY-29717 Add links to the containing function in the header for parameters
Also, display shorter function names in "Documentation is copied from"
section of the table.
2018-06-09 15:59:38 +03:00