<repo_name>meinert/pythonprojecttemplate<file_sep>/mypackage/mymodule.py
from datetime import datetime, timedelta


# Firebase guide
# https://morioh.com/p/a593f973aff0


class MyClass():
    def __init__(self, input):
        self.input = input
    # set	Write or replace data to a defined path, like messages/users/<username>
    # update	Update some of the keys for a defined path without replacing all of the data
    # push	Add to a list of data in the database. Every time you push a new node onto a list, your database generates a unique key, like messages/users/<unique-user-id>/<username>
    # transaction	Use transactions when working with complex data that could be corrupted by concurrent updates


class MySecondClass():

    def __init__(self, input):
        self.input = input<file_sep>/mypackage/dataModels/constants.py
class ValueTypes:
    FIRSTCONSTANT = 'first'
    SECONDCONSTANT = 'second'

<file_sep>/mypackage/__init__.py
from .core import hmm
from .mymodule import *
<file_sep>/mypackage/mysecondmodule.py
from mypackage.dataModels import datamodel, constants

import json


class OtherClass():

    def __init__(self, input):
        self.input = input
<file_sep>/module.py
from mypackage import mymodule
from mypackage.dataModels import datamodel, constants

type = constants.ProductTypes.LIGGEUNDERLAG

classInstance = mymodule.MyClass('xxx')<file_sep>/mypackage/dataModels/datamodel.py
from dataclasses import dataclass, asdict, astuple, fields
import datetime


@dataclass
class DefaultProduct:
    ean: int = None
    brand: str = None
    price: float = None
    priceScore: float = None
    productUrl: str = None
    productName: str = None
    stock: str = None
    freight: float = -1
    productId: str = None
    updated: datetime = None
    store: str = None
    category: str = None
    deliveryTime: str = None
    imageUrl: str = None
    eanValid: bool = None
    totalScore: int = None
    status: str = None
    key: str = None
    productLink: str = None


@dataclass
class DimensionProduct:
    height: float = None
    length: float = None
    width: float = None
    weight: float = None
    heightScore: float = None
    lengthScore: float = None
    widthScore: float = None
    weightScore: float = None


@dataclass
class DimensionPackedProduct:
    packHeight: float = None
    packWidth: float = None
    packLength: float = None
    packShape: str = None
    packVolume: float = None
    packHeightScore: float = None
    packWidthScore: float = None
    packVolumeScore: float = None

    def __init__(self, pack_height=None, pack_width=None, pack_shape=None, pack_length=None):
        self.packHeight = pack_height
        self.packWidth = pack_width
        self.packLength = pack_length
        self.packShape = pack_shape
        self.packVolume = self.calculate_pack_vol()

    def calculate_pack_vol(self):
        if self.packShape == 'Cylinder':
            return pi * self.packWidth/2 * self.packWidth/2 * self.packHeight / 1000  # pi * radius^2 * height converted to Liter
        elif self.packShape == 'Box':
            return self.packLength * self.packWidth * self.packHeight / 1000


@dataclass
class Liggeunderlag(DefaultProduct, DimensionProduct, DimensionPackedProduct):
    rvalue: float = None
    rvalueScore: float = None
    type: str = None  # TODO: rename to subclass

    def __iter__(self):
        return iter(astuple(self))


def to_dict(data):
    return asdict(data)


def dict_to_dataclass(dict_to_cast, data_class):
    if data_class == 'liggeunderlag':
        try:
            return Liggeunderlag(**dict_to_cast[1])
        except Exception:
            return Liggeunderlag(**dict_to_cast)
    else:
        print('Product type: {} not supported yet'.format(data_class))
        return None
<file_sep>/README.md
# pythonprojecttemplate
Template for a basic python project
