3 import FWCore.ParameterSet.Config
as cms
7 "Find all EDProducers in the Process that are instances of the given C++ type." 8 return (module
for module
in process._Process__producers.values()
if module._TypedParameterizable__type
in types)
11 "Find all EDFilters in the Process that are instances of the given C++ type." 12 return (filter
for filter
in process._Process__filters.values()
if filter._TypedParameterizable__type
in types)
15 "Find all EDAnalyzers in the Process that are instances of the given C++ type." 16 return (analyzer
for analyzer
in process._Process__analyzers.values()
if analyzer._TypedParameterizable__type
in types)
19 "Find all ESProducers in the Process that are instances of the given C++ type." 20 return (module
for module
in process._Process__esproducers.values()
if module._TypedParameterizable__type
in types)
24 "Add the `modules` before the `target` in any Sequence, Paths or EndPath that contains the latter." 25 for sequence
in itertools.chain(
26 six.itervalues(process._Process__sequences),
27 six.itervalues(process._Process__paths),
28 six.itervalues(process._Process__endpaths)
31 position = sequence.index(target)
35 for module
in reversed(modules):
36 sequence.insert(position, module)
40 "Add the `modules` after the `target` in any Sequence, Paths or EndPath that contains the latter." 41 for sequence
in itertools.chain(
42 six.itervalues(process._Process__sequences),
43 six.itervalues(process._Process__paths),
44 six.itervalues(process._Process__endpaths)
47 position = sequence.index(target)
51 for module
in reversed(modules):
52 sequence.insert(position+1, module)
57 """Replace one object with a different one of the same type. 59 This function replaces the contents of `fromObj` object with those of `toObj`, 60 so all references ot it remain valid. 63 if not isinstance(toObj, type(fromObj)):
64 raise TypeError(
'replaceWith requires both arguments to be the same type')
66 if isinstance(toObj, cms._ModuleSequenceType):
67 fromObj._seq = toObj._seq
69 elif isinstance(toObj, cms._Parameterizable):
71 for p
in fromObj.parameterNames_():
73 for p
in toObj.parameterNames_():
74 setattr(fromObj, p, getattr(toObj, p))
75 if isinstance(toObj, cms._TypedParameterizable):
76 fromObj._TypedParameterizable__type = toObj._TypedParameterizable__type
79 raise TypeError(
'replaceWith does not work with "%s" objects' %
str(type(fromObj)))
def replace_with(fromObj, toObj)
def filters_by_type(process, types)
def insert_modules_before(process, target, modules)
def producers_by_type(process, types)
def insert_modules_after(process, target, modules)
def analyzers_by_type(process, types)
def esproducers_by_type(process, types)