From b459dbc9b7287c29406a3f012ef9fc99af3e4487 Mon Sep 17 00:00:00 2001 From: Midgard Date: Sat, 25 Jan 2020 01:33:23 +0100 Subject: [PATCH] Start models --- app/hlds/__init__.py | 1 + app/hlds/models.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 app/hlds/models.py diff --git a/app/hlds/__init__.py b/app/hlds/__init__.py index 08d9e21..af6145e 100755 --- a/app/hlds/__init__.py +++ b/app/hlds/__init__.py @@ -4,6 +4,7 @@ from glob import glob from os import path, walk from tatsu import parse as tatsu_parse import itertools +from .models import Location # TODO Use proper way to get resources, see https://stackoverflow.com/a/10935674 diff --git a/app/hlds/models.py b/app/hlds/models.py new file mode 100644 index 0000000..b8638d0 --- /dev/null +++ b/app/hlds/models.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +from typing import List + + +class Option: + def __init__(self, id_, name, description): + self.id = id_ + self.name = name + self.description = description + + +class Choice: + def __init__(self, id_, name, description, options): + self.id = id_ + self.name = name + self.description = description + + self.options: List[Option] = options + + +class Location: + def __init__(self, id_, name, properties, choices, bases): + self.id = id_ + self.name = name + self.properties = properties + + self.choices: List[Choice] = choices + self.bases = bases