summaryrefslogtreecommitdiff
path: root/astroid/mixins.py
diff options
context:
space:
mode:
authorClaudiu Popa <cpopa@cloudbasesolutions.com>2015-08-12 23:19:16 +0300
committerClaudiu Popa <cpopa@cloudbasesolutions.com>2015-08-12 23:19:16 +0300
commitd7294bd79062a4f47db8a761d79e6c1dd166bc72 (patch)
tree61d9caf433340b9cb51932d673598f1a34323353 /astroid/mixins.py
parent96d83666d3b4b04587fc6803ae38ba5b72607de9 (diff)
downloadastroid-git-d7294bd79062a4f47db8a761d79e6c1dd166bc72.tar.gz
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.
Diffstat (limited to 'astroid/mixins.py')
-rw-r--r--astroid/mixins.py18
1 files changed, 8 insertions, 10 deletions
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)