From d7294bd79062a4f47db8a761d79e6c1dd166bc72 Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Wed, 12 Aug 2015 23:19:16 +0300 Subject: Big cleanup across the entire project The cleanup consisted in a couple of changes: * import only modules, not objects, in order to not clutter the module namespace and to not leak accidentally objects which aren't public API for the said modules. * use two spaces between module level functions * move some mixins from astroid.node_classes in the proper order, starting at the left, not being last in the MRO. --- astroid/mixins.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'astroid/mixins.py') diff --git a/astroid/mixins.py b/astroid/mixins.py index ba36fbb9..cc6ead28 100644 --- a/astroid/mixins.py +++ b/astroid/mixins.py @@ -18,15 +18,14 @@ """This module contains some mixins for the different nodes. """ -from astroid.exceptions import (AstroidBuildingException, InferenceError, - NotFoundError) -from astroid.decorators import cachedproperty +from astroid import decorators +from astroid import exceptions class BlockRangeMixIn(object): """override block range """ - @cachedproperty + @decorators.cachedproperty def blockstart_tolineno(self): return self.lineno @@ -105,12 +104,12 @@ class FromImportMixIn(FilterStmtsMixin): try: return mymodule.import_module(modname, level=level, relative_only=level and level >= 1) - except AstroidBuildingException as ex: + except exceptions.AstroidBuildingException as ex: if isinstance(ex.args[0], SyntaxError): - raise InferenceError(str(ex)) - raise InferenceError(modname) + raise exceptions.InferenceError(str(ex)) + raise exceptions.InferenceError(modname) except SyntaxError as ex: - raise InferenceError(str(ex)) + raise exceptions.InferenceError(str(ex)) def real_name(self, asname): """get name from 'as' name""" @@ -122,5 +121,4 @@ class FromImportMixIn(FilterStmtsMixin): _asname = name if asname == _asname: return name - raise NotFoundError(asname) - + raise exceptions.NotFoundError(asname) -- cgit v1.2.1