Back to index

python3.2  3.2.2
Public Member Functions | Private Attributes
trace._Ignore Class Reference
Inheritance diagram for trace._Ignore:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def names

Private Attributes

 _mods
 _dirs
 _ignore

Detailed Description

Definition at line 131 of file trace.py.


Constructor & Destructor Documentation

def trace._Ignore.__init__ (   self,
  modules = None,
  dirs = None 
)

Reimplemented in trace.Ignore.

Definition at line 132 of file trace.py.

00132 
00133     def __init__(self, modules=None, dirs=None):
00134         self._mods = set() if not modules else set(modules)
00135         self._dirs = [] if not dirs else [os.path.normpath(d)
00136                                           for d in dirs]
00137         self._ignore = { '<string>': 1 }

Here is the caller graph for this function:


Member Function Documentation

def trace._Ignore.names (   self,
  filename,
  modulename 
)

Definition at line 138 of file trace.py.

00138 
00139     def names(self, filename, modulename):
00140         if modulename in self._ignore:
00141             return self._ignore[modulename]
00142 
00143         # haven't seen this one before, so see if the module name is
00144         # on the ignore list.
00145         if modulename in self._mods:  # Identical names, so ignore
00146             self._ignore[modulename] = 1
00147             return 1
00148 
00149         # check if the module is a proper submodule of something on
00150         # the ignore list
00151         for mod in self._mods:
00152             # Need to take some care since ignoring
00153             # "cmp" mustn't mean ignoring "cmpcache" but ignoring
00154             # "Spam" must also mean ignoring "Spam.Eggs".
00155             if modulename.startswith(mod + '.'):
00156                 self._ignore[modulename] = 1
00157                 return 1
00158 
00159         # Now check that filename isn't in one of the directories
00160         if filename is None:
00161             # must be a built-in, so we must ignore
00162             self._ignore[modulename] = 1
00163             return 1
00164 
00165         # Ignore a file when it contains one of the ignorable paths
00166         for d in self._dirs:
00167             # The '+ os.sep' is to ensure that d is a parent directory,
00168             # as compared to cases like:
00169             #  d = "/usr/local"
00170             #  filename = "/usr/local.py"
00171             # or
00172             #  d = "/usr/local.py"
00173             #  filename = "/usr/local.py"
00174             if filename.startswith(d + os.sep):
00175                 self._ignore[modulename] = 1
00176                 return 1
00177 
00178         # Tried the different ways, so we don't ignore this module
00179         self._ignore[modulename] = 0
00180         return 0


Member Data Documentation

Definition at line 134 of file trace.py.

Definition at line 136 of file trace.py.

Definition at line 133 of file trace.py.


The documentation for this class was generated from the following file: