grocy-cli/grocy/meta.py

26 lines
799 B
Python
Raw Normal View History

from grocy.entity import Entity
from grocy.schema import get_schema
from grocy.recipe import Recipe
from fontawesome import icons as fa_icons
class Meta(object):
def __init__(self, include_fa_icons=True):
self.meta = {}
if include_fa_icons:
self.meta['fa_icons'] = fa_icons
def add(self, type, name=None, ids=[], valid_values=None):
if type not in self.meta:
self.meta[type] = {}
if name and name not in self.meta[type]:
self.meta[type][name] = {}
#if name:
# schema = get_schema(name)
#if type == 'entities':
#self.meta[type][name]['properties'] = schema['properties']
self.meta[type][name]['valid_values'] = valid_values
def generate(self):
return self.meta