MCPcopy
hub / github.com/apache/caldera / Obfuscator

Class Obfuscator

app/objects/c_obfuscator.py:21–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19
20
21class Obfuscator(FirstClassObjectInterface, BaseObject):
22 schema = ObfuscatorSchema()
23 display_schema = ObfuscatorSchema(exclude=['module'])
24
25 @property
26 def unique(self):
27 return self.hash('%s' % self.name)
28
29 def __init__(self, name, description, module):
30 super().__init__()
31 self.name = name
32 self.description = description
33 self.module = module
34
35 def store(self, ram):
36 existing = self.retrieve(ram['obfuscators'], self.unique)
37 if not existing:
38 ram['obfuscators'].append(self)
39 return self.retrieve(ram['obfuscators'], self.unique)
40 return existing
41
42 def load(self, agent):
43 try:
44 mod = import_module(self.module)
45 return mod.Obfuscation(agent)
46 except Exception as e:
47 logging.error('Error importing obfuscator=%s, %s' % (self.name, e))

Callers 5

obfuscatorFunction · 0.90
setup_rest_svc_testFunction · 0.90
setup_planning_testFunction · 0.90
test_obfuscatorFunction · 0.90
build_obfuscatorMethod · 0.85

Calls 1

ObfuscatorSchemaClass · 0.85

Tested by 4

obfuscatorFunction · 0.72
setup_rest_svc_testFunction · 0.72
setup_planning_testFunction · 0.72
test_obfuscatorFunction · 0.72