| OLD | NEW |
| 1 # Copyright (c) 2002-2013 LOGILAB S.A. (Paris, FRANCE). | 1 # Copyright (c) 2002-2013 LOGILAB S.A. (Paris, FRANCE). |
| 2 # http://www.logilab.fr/ -- mailto:contact@logilab.fr | 2 # http://www.logilab.fr/ -- mailto:contact@logilab.fr |
| 3 # | 3 # |
| 4 # This program is free software; you can redistribute it and/or modify it under | 4 # This program is free software; you can redistribute it and/or modify it under |
| 5 # the terms of the GNU General Public License as published by the Free Software | 5 # the terms of the GNU General Public License as published by the Free Software |
| 6 # Foundation; either version 2 of the License, or (at your option) any later | 6 # Foundation; either version 2 of the License, or (at your option) any later |
| 7 # version. | 7 # version. |
| 8 # | 8 # |
| 9 # This program is distributed in the hope that it will be useful, but WITHOUT | 9 # This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 11 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | 11 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 12 # | 12 # |
| 13 # You should have received a copy of the GNU General Public License along with | 13 # You should have received a copy of the GNU General Public License along with |
| 14 # this program; if not, write to the Free Software Foundation, Inc., | 14 # this program; if not, write to the Free Software Foundation, Inc., |
| 15 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 15 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 16 """ | 16 """ |
| 17 generic classes/functions for pyreverse core/extensions | 17 generic classes/functions for pyreverse core/extensions |
| 18 """ | 18 """ |
| 19 from __future__ import print_function |
| 19 | 20 |
| 20 import sys | 21 import sys |
| 21 import re | 22 import re |
| 22 import os | 23 import os |
| 23 | 24 |
| 24 ########### pyreverse option utils ############################## | 25 ########### pyreverse option utils ############################## |
| 25 | 26 |
| 26 | 27 |
| 27 RCFILE = '.pyreverserc' | 28 RCFILE = '.pyreverserc' |
| 28 | 29 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 112 |
| 112 class FilterMixIn(object): | 113 class FilterMixIn(object): |
| 113 """filter nodes according to a mode and nodes' visibility | 114 """filter nodes according to a mode and nodes' visibility |
| 114 """ | 115 """ |
| 115 def __init__(self, mode): | 116 def __init__(self, mode): |
| 116 "init filter modes" | 117 "init filter modes" |
| 117 __mode = 0 | 118 __mode = 0 |
| 118 for nummod in mode.split('+'): | 119 for nummod in mode.split('+'): |
| 119 try: | 120 try: |
| 120 __mode += MODES[nummod] | 121 __mode += MODES[nummod] |
| 121 except KeyError, ex: | 122 except KeyError as ex: |
| 122 print >> sys.stderr, 'Unknown filter mode %s' % ex | 123 print('Unknown filter mode %s' % ex, file=sys.stderr) |
| 123 self.__mode = __mode | 124 self.__mode = __mode |
| 124 | 125 |
| 125 | 126 |
| 126 def show_attr(self, node): | 127 def show_attr(self, node): |
| 127 """return true if the node should be treated | 128 """return true if the node should be treated |
| 128 """ | 129 """ |
| 129 visibility = get_visibility(getattr(node, 'name', node)) | 130 visibility = get_visibility(getattr(node, 'name', node)) |
| 130 return not (self.__mode & VIS_MOD[visibility]) | 131 return not self.__mode & VIS_MOD[visibility] |
| 131 | 132 |
| OLD | NEW |