diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2018-10-02 09:43:56 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2018-10-02 09:43:56 +0200 |
commit | add5f7b8eba427de9d39caae864bbc6dc37ef980 (patch) | |
tree | 86bb7df77f389062879365e97df0c3d53d38a8a6 /astroid/mixins.py | |
parent | bb46cd198b93f3715da94089d42f39fc910892ff (diff) | |
download | astroid-git-add5f7b8eba427de9d39caae864bbc6dc37ef980.tar.gz |
Initial formatting of astroid
Diffstat (limited to 'astroid/mixins.py')
-rw-r--r-- | astroid/mixins.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/astroid/mixins.py b/astroid/mixins.py index c199f61a..cec4b4bc 100644 --- a/astroid/mixins.py +++ b/astroid/mixins.py @@ -53,7 +53,6 @@ class FilterStmtsMixin: class AssignTypeMixin: - def assign_type(self): return self @@ -69,7 +68,6 @@ class AssignTypeMixin: class ParentAssignTypeMixin(AssignTypeMixin): - def assign_type(self): return self.parent.assign_type() @@ -88,7 +86,7 @@ class ImportFromMixin(FilterStmtsMixin): # on relative imports # XXX: no more needed ? mymodule = self.root() - level = getattr(self, 'level', None) # Import as no level + level = getattr(self, "level", None) # Import as no level if modname is None: modname = self.modname # XXX we should investigate deeper if we really want to check @@ -97,22 +95,25 @@ class ImportFromMixin(FilterStmtsMixin): # FIXME: we used to raise InferenceError here, but why ? return mymodule - return mymodule.import_module(modname, level=level, - relative_only=level and level >= 1) + return mymodule.import_module( + modname, level=level, relative_only=level and level >= 1 + ) def real_name(self, asname): """get name from 'as' name""" for name, _asname in self.names: - if name == '*': + if name == "*": return asname if not _asname: - name = name.split('.', 1)[0] + name = name.split(".", 1)[0] _asname = name if asname == _asname: return name raise exceptions.AttributeInferenceError( - 'Could not find original name for {attribute} in {target!r}', - target=self, attribute=asname) + "Could not find original name for {attribute} in {target!r}", + target=self, + attribute=asname, + ) class MultiLineBlockMixin: @@ -125,10 +126,7 @@ class MultiLineBlockMixin: @decorators.cachedproperty def _multi_line_blocks(self): - return tuple( - getattr(self, field) - for field in self._multi_line_block_fields - ) + return tuple(getattr(self, field) for field in self._multi_line_block_fields) def _get_return_nodes_skip_functions(self): for block in self._multi_line_blocks: @@ -152,5 +150,6 @@ class MultiLineBlockMixin: class NoChildrenMixin: """Mixin for nodes with no children, e.g. Pass.""" + def get_children(self): yield from () |