summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2015-10-16 15:44:55 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2015-10-16 15:44:55 +0300
commit52e739b0bcccc391b292e35d8e5e449d6154388a (patch)
treed96601f53a657e42179a6adcb67db7e17f9fec09
parentb289a9e4ff07dd8ca081c12635d8d4fec62a8be6 (diff)
downloadpylint-52e739b0bcccc391b292e35d8e5e449d6154388a.tar.gz
Move VNode into ureports.nodes.
-rw-r--r--pylint/reporters/ureports/nodes.py41
-rw-r--r--pylint/reporters/ureports/tree.py57
2 files changed, 40 insertions, 58 deletions
diff --git a/pylint/reporters/ureports/nodes.py b/pylint/reporters/ureports/nodes.py
index 7a0dba4..1c0dc7d 100644
--- a/pylint/reporters/ureports/nodes.py
+++ b/pylint/reporters/ureports/nodes.py
@@ -22,7 +22,46 @@ A micro report is a tree of layout and content objects.
from six import string_types
-from pylint.reporters.ureports.tree import VNode
+
+class VNode(object):
+
+ def __init__(self, nid=None):
+ self.id = nid
+ # navigation
+ self.parent = None
+ self.children = []
+
+ def __iter__(self):
+ return iter(self.children)
+
+ def append(self, child):
+ """add a node to children"""
+ self.children.append(child)
+ child.parent = self
+
+ def insert(self, index, child):
+ """insert a child node"""
+ self.children.insert(index, child)
+ child.parent = self
+
+ def _get_visit_name(self):
+ """
+ return the visit name for the mixed class. When calling 'accept', the
+ method <'visit_' + name returned by this method> will be called on the
+ visitor
+ """
+ try:
+ return self.TYPE.replace('-', '_')
+ except Exception:
+ return self.__class__.__name__.lower()
+
+ def accept(self, visitor, *args, **kwargs):
+ func = getattr(visitor, 'visit_%s' % self._get_visit_name())
+ return func(self, *args, **kwargs)
+
+ def leave(self, visitor, *args, **kwargs):
+ func = getattr(visitor, 'leave_%s' % self._get_visit_name())
+ return func(self, *args, **kwargs)
class BaseComponent(VNode):
diff --git a/pylint/reporters/ureports/tree.py b/pylint/reporters/ureports/tree.py
deleted file mode 100644
index 0e69772..0000000
--- a/pylint/reporters/ureports/tree.py
+++ /dev/null
@@ -1,57 +0,0 @@
-# copyright 2003-2015 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of pylint.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# pylint is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with pylint. If not, see <http://www.gnu.org/licenses/>.
-
-class VNode(object):
-
- def __init__(self, nid=None):
- self.id = nid
- # navigation
- self.parent = None
- self.children = []
-
- def __iter__(self):
- return iter(self.children)
-
- def append(self, child):
- """add a node to children"""
- self.children.append(child)
- child.parent = self
-
- def insert(self, index, child):
- """insert a child node"""
- self.children.insert(index, child)
- child.parent = self
-
- def _get_visit_name(self):
- """
- return the visit name for the mixed class. When calling 'accept', the
- method <'visit_' + name returned by this method> will be called on the
- visitor
- """
- try:
- return self.TYPE.replace('-', '_')
- except Exception:
- return self.__class__.__name__.lower()
-
- def accept(self, visitor, *args, **kwargs):
- func = getattr(visitor, 'visit_%s' % self._get_visit_name())
- return func(self, *args, **kwargs)
-
- def leave(self, visitor, *args, **kwargs):
- func = getattr(visitor, 'leave_%s' % self._get_visit_name())
- return func(self, *args, **kwargs)