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

Class Source

app/objects/c_source.py:74–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72
73
74class Source(FirstClassObjectInterface, BaseObject):
75
76 schema = SourceSchema()
77 display_schema = SourceSchema(exclude=('adjustments',))
78
79 @property
80 def unique(self):
81 return self.hash('%s' % self.id)
82
83 def __init__(self, name='', id='', facts=(), relationships=(), rules=(), adjustments=(), plugin=''):
84 super().__init__()
85 self.id = id if id else str(uuid.uuid4())
86 self.name = name
87 self.facts = facts
88 self.rules = rules
89 self.adjustments = adjustments
90 self.relationships = relationships
91 self.plugin = plugin
92
93 def store(self, ram):
94 existing = self.retrieve(ram['sources'], self.unique)
95 if not existing:
96 ram['sources'].append(self)
97 return self.retrieve(ram['sources'], self.unique)
98 existing.update('name', self.name)
99 existing.update('facts', self.facts)
100 existing.update('rules', self.rules)
101 existing.update('relationships', self.relationships)
102 existing.update('plugin', self.plugin)
103 return existing

Callers 9

test_sourceFunction · 0.90
setup_rest_svc_testFunction · 0.90
setup_planning_testFunction · 0.90
test_sourceFunction · 0.90
build_sourceMethod · 0.85

Calls 1

SourceSchemaClass · 0.85

Tested by 8

test_sourceFunction · 0.72
setup_rest_svc_testFunction · 0.72
setup_planning_testFunction · 0.72
test_sourceFunction · 0.72