Skip to content

Instantly share code, notes, and snippets.

@mohammadali66
Created September 13, 2022 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohammadali66/11847f8ae2683f4fc55735334d56e39f to your computer and use it in GitHub Desktop.
Save mohammadali66/11847f8ae2683f4fc55735334d56e39f to your computer and use it in GitHub Desktop.
from dataclasses import dataclass
from typing import NewType
Quantity = NewType("Quantity", int)
Sku = NewType("Sku", str)
Reference = NewType("Reference", str)
...
class Batch:
def __init__(self, ref: Reference, sku: Sku, qty: Quantity):
self.sku = sku
self.reference = ref
self._purchased_quantity = qty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment