This is the first code drop for the project. Covers basis project structure and reading tosca profile into a memory model.
19 lines
419 B
Python
19 lines
419 B
Python
from yaml_loader import Loader
|
|
|
|
class Source(object):
|
|
def __init__(self, path):
|
|
self.profile = Loader(path).load()
|
|
|
|
def __contains__(self, key):
|
|
return key in self.profile
|
|
|
|
def __iter__(self):
|
|
return iter(self.profile)
|
|
|
|
def __len__(self):
|
|
return len(self.profile)
|
|
|
|
def __getitem__(self, key):
|
|
'''Get a section.'''
|
|
return self.profile[key]
|