summaryrefslogtreecommitdiff
path: root/pyreverse/utils.py
diff options
context:
space:
mode:
authorEmile Anclin <emile.anclin@logilab.fr>2008-07-30 10:42:46 +0200
committerEmile Anclin <emile.anclin@logilab.fr>2008-07-30 10:42:46 +0200
commitbf04f4cc50ef60d56a7b3574e69114a4e59b68e6 (patch)
treeac4f5d35019948babc11e6bac186a9b256eee917 /pyreverse/utils.py
parent0fed5dd51148cfbe98f7cd3dbb3a6ad3253eaac4 (diff)
downloadpylint-bf04f4cc50ef60d56a7b3574e69114a4e59b68e6.tar.gz
clean up and simplify
Diffstat (limited to 'pyreverse/utils.py')
-rw-r--r--pyreverse/utils.py20
1 files changed, 6 insertions, 14 deletions
diff --git a/pyreverse/utils.py b/pyreverse/utils.py
index 166b842..4cbc4f6 100644
--- a/pyreverse/utils.py
+++ b/pyreverse/utils.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2002-2004 LOGILAB S.A. (Paris, FRANCE).
+# Copyright (c) 2002-2008 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This program is free software; you can redistribute it and/or modify it under
@@ -20,11 +20,7 @@ generic classes/functions for pyreverse core/extensions
import sys
import re
-# why import IgnoreChild, Project ?
-#from logilab.astng import ASTNGManager #, IgnoreChild, Project
-#from logilab.astng.manager import astng_wrapper
from logilab.astng.manager import astng_wrapper, ASTNGManager
-
from logilab.common.configuration import ConfigurationMixIn
from pyreverse.__pkginfo__ import version
@@ -102,6 +98,7 @@ MODES = {
'SPECIAL' : _SPECIAL,
'OTHER' : _PROTECTED + _PRIVATE,
}
+VIS_MOD = {'special':_SPECIAL, 'protected': _PROTECTED, 'private': _PRIVATE, 'public': 0 }
class FilterMixIn:
"""filter nodes according to a mode and nodes' visibility
@@ -146,11 +143,7 @@ class FilterMixIn:
mode = self.get_mode()
visibility = get_visibility(getattr(node, 'name', node))
- if mode & _SPECIAL and visibility == 'special':
- return 0
- if mode & _PROTECTED and visibility == 'protected':
- return 0
- if mode & _PRIVATE and visibility == 'private':
+ if mode & VIS_MOD[visibility]:
return 0
return 1
@@ -177,16 +170,15 @@ USAGE: %%prog [options] <file or module>...
self.register_options_provider(manager)
for provider in option_providers:
self.register_options_provider(provider)
- #self.load_file_configuration()
- args = self.load_command_line_configuration()
+ files = self.load_command_line_configuration()
- if not args:
+ if not files:
print self.help()
else:
global LOG
LOG = self.log
# extract project representation
- project = manager.project_from_files(args, astng_wrapper)
+ project = manager.project_from_files(files, astng_wrapper)
self.do_run(project)