Coverage for appr/formats/appr/manifest.py: 70%

# Coverage for appr/formats/appr/manifest.py : 70%

## 30 statements 21 run 9 missing 0 excluded

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | class ManifestBase(dict): def __init__(self, name=None, version=None): self.name = name self.version = version super(ManifestBase, self).__init__() @property def resources(self): return self.get("resources", []) @property def deploy(self): return self.get("deploy", []) @property def dependencies(self): return [x['name'] for x in self.deploy if x['name'] != "$self"] @property def variables(self): return self.get("variables", {}) @property def package(self): return self.get("package", { 'version': self.version, 'name': self.name, 'description': '', 'author': ''}) @property def shards(self): return self.get("shards", []) def kubname(self): spl = self.package['name'].split('/') name = "%s_%s" % (spl[0], spl[1]) return name def package_name(self): package = ("%s_%s" % (self.kubname(), self.package['version'])) return package def to_dict(self): return ({ "package": self.package, "variables": self.variables, "resources": self.resources, "shards": self.shards, "deploy": self.deploy}) def metadata(self): return { 'variables': self.variables, 'resources': self.resources, "shards": self.shards, 'dependencies': self.dependencies} class Manifest(ManifestBase): pass