Skip to content

Commit

Permalink
bump to 3.12, use strenum for models
Browse files Browse the repository at this point in the history
  • Loading branch information
zweckj committed Dec 9, 2023
1 parent 9707b91 commit a7d4c69
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
17 changes: 11 additions & 6 deletions lmcloud/const.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
"""Constants for La Marzocco Cloud."""
from typing import Final
from enum import StrEnum


class LaMarzoccoModel(StrEnum):
"""La Marzocco Machine Models."""

GS3_AV = "GS3 AV"
GS3_MP = "GS3 MP"
LINEA_MINI = "Linea Mini"
LINEA_MICRA = "Micra"


# Base URL for La Marzocco Cloud
TOKEN_URL: Final = "https://cms.lamarzocco.io/oauth/v2/token"
Expand All @@ -17,12 +28,6 @@
POLLING_DELAY_STATISTICS_S: Final = 60
WEBSOCKET_RETRY_DELAY: Final = 20

MODEL_GS3_AV: Final = "GS3 AV"
MODEL_GS3_MP: Final = "GS3 MP"
MODEL_LM: Final = "Linea Mini"
MODEL_LMU: Final = "Micra"
MODELS: Final = [MODEL_GS3_AV, MODEL_GS3_MP, MODEL_LM, MODEL_LMU]

# Key Names for Dictionaries

BACKFLUSH_ENABLED: Final = "isBackFlushEnabled"
Expand Down
9 changes: 4 additions & 5 deletions lmcloud/lmcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
KEY,
MACHINE_MODE,
MACHINE_NAME,
MODELS,
MODEL_LMU,
MODEL_NAME,
LaMarzoccoModel,
PLUMBED_IN,
POLLING_DELAY_S,
POLLING_DELAY_STATISTICS_S,
Expand Down Expand Up @@ -119,9 +118,9 @@ def model_name(self) -> str:
def true_model_name(self) -> str:
"""Return the model name from the cloud, even if it's not one we know about.
Used for display only."""
if self.model_name == MODEL_LMU:
return f"Linea {MODEL_LMU}"
if self.model_name in MODELS:
if self.model_name == LaMarzoccoModel.LINEA_MICRA:
return "Linea Micra"
if self.model_name in LaMarzoccoModel:
return self.model_name
return f"Unsupported Model ({self.model_name})"

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="lmcloud",
version="0.4.14",
version="0.4.15",
description="A Python implementation of the new La Marzocco API",
long_description=readme,
long_description_content_type="text/markdown",
Expand All @@ -19,7 +19,7 @@
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
],
packages=setuptools.find_packages(),
Expand Down

0 comments on commit a7d4c69

Please sign in to comment.