diff options
| author | brendanator <brendan.maginnis@gmail.com> | 2018-06-22 13:46:05 +0100 |
|---|---|---|
| committer | Claudiu Popa <pcmanticore@gmail.com> | 2018-07-05 09:26:23 +0200 |
| commit | 66ecfa8a01e3eae02e54c19c301eca4d3f7193de (patch) | |
| tree | aff826fff88e1860c9c058488580acf8b2bae907 /astroid/node_classes.py | |
| parent | 2d063a7c031664b6a02a3c021792291b5feb2996 (diff) | |
| download | astroid-git-66ecfa8a01e3eae02e54c19c301eca4d3f7193de.tar.gz | |
Improve as_string output of operators, elif, with, return & docs
The precedence and associativity rules of operators are respected
and parens are only wrapped around child nodes when needed
A single If node inside the else block is output as `elif`
Unneccesary parens in with statements are removed
Unneccesary parens in tuple returns are removed
Doc strings in classes and functions no longer get additional indenting
Diffstat (limited to 'astroid/node_classes.py')
| -rw-r--r-- | astroid/node_classes.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/astroid/node_classes.py b/astroid/node_classes.py index c5a469fd..bc934f40 100644 --- a/astroid/node_classes.py +++ b/astroid/node_classes.py @@ -18,7 +18,6 @@ import pprint from functools import lru_cache from functools import singledispatch as _singledispatch -from astroid import as_string from astroid import bases from astroid import context as contextmod from astroid import decorators @@ -711,6 +710,7 @@ class NodeNG: :returns: The source code. :rtype: str """ + from astroid import as_string # Avoid cyclic imports return as_string.to_code(self) def repr_tree(self, ids=False, include_linenos=False, |
