CMS 3D CMS Logo

Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions

hltFindDuplicates::Module Class Reference

List of all members.

Public Member Functions

def __init__
def apply_rename
def key

Public Attributes

 hash
 label
 params
 type

Static Public Attributes

int hash = 0
string label = ''
tuple params = frozendict()
string type = ''

Private Member Functions

def __check
def __rehash
def __sub

Detailed Description

Definition at line 54 of file hltFindDuplicates.py.


Constructor & Destructor Documentation

def hltFindDuplicates::Module::__init__ (   self,
  module 
)

Definition at line 60 of file hltFindDuplicates.py.

00061                             :
00062     self.label  = module.label_()
00063     self.type   = module.type_()
00064     self.params = pythonize(module.parameters_())
00065     self.__rehash()
00066 


Member Function Documentation

def hltFindDuplicates::Module::__check (   self,
  value,
  group 
) [private]

Definition at line 73 of file hltFindDuplicates.py.

00074                                  :
00075     return type(value) is str and bool(group.match(value))

def hltFindDuplicates::Module::__rehash (   self) [private]

Definition at line 70 of file hltFindDuplicates.py.

00071                     :
00072     self.hash = (hash(self.type) << 4) + hash(self.params)

def hltFindDuplicates::Module::__sub (   self,
  value,
  group,
  label 
) [private]

Definition at line 76 of file hltFindDuplicates.py.

00077                                       :
00078     if type(value) is str:
00079       return group.sub(r'%s\2' % label, value)
00080     else:
00081       return value

def hltFindDuplicates::Module::apply_rename (   self,
  groups 
)

Definition at line 82 of file hltFindDuplicates.py.

00083                                 :
00084     modified = False
00085     newparams = unfreeze(self.params)
00086     for label, (group, check) in groups.iteritems():
00087       for k, p in newparams.iteritems():
00088         if '__iter__' in dir(p):
00089           if any(self.__check(v, check) for v in p):
00090             newparams[k] = tuple(self.__sub(v, check, label) for v in p)
00091             modified = True
00092         else:
00093           if self.__check(p, check):
00094             newparams[k] = self.__sub(p, check, label)
00095             modified = True
00096 
00097     if modified:
00098       self.params = frozendict(newparams)
00099       self.__rehash()
00100 
00101 
00102 

def hltFindDuplicates::Module::key (   self)

Definition at line 67 of file hltFindDuplicates.py.

00068                :
00069     return self.hash


Member Data Documentation

Definition at line 58 of file hltFindDuplicates.py.

Definition at line 70 of file hltFindDuplicates.py.

string hltFindDuplicates::Module::label = '' [static]

Definition at line 56 of file hltFindDuplicates.py.

Definition at line 60 of file hltFindDuplicates.py.

Definition at line 60 of file hltFindDuplicates.py.

tuple hltFindDuplicates::Module::params = frozendict() [static]

Definition at line 57 of file hltFindDuplicates.py.

string hltFindDuplicates::Module::type = '' [static]

Definition at line 55 of file hltFindDuplicates.py.

Definition at line 60 of file hltFindDuplicates.py.