Switch to auto enumerating enums

This commit is contained in:
Joe Knapper 2026-02-19 16:38:29 +00:00 committed by Julian Stirling
parent a5b77cc2a3
commit fb40af915a

View file

@ -7,11 +7,11 @@ of images (a 'z-stack').
See repository root for licensing information. See repository root for licensing information.
""" """
import enum
import logging import logging
import os import os
import time import time
from dataclasses import dataclass from dataclasses import dataclass
from enum import Enum
from types import TracebackType from types import TracebackType
from typing import Literal, Mapping, Optional, Self, Sequence from typing import Literal, Mapping, Optional, Self, Sequence
@ -34,25 +34,25 @@ class NotStreamingError(RuntimeError):
"""No images captured from stream. The camera is almost certainly not streaming.""" """No images captured from stream. The camera is almost certainly not streaming."""
class SharpnessMethod(str, Enum): class SharpnessMethod(enum.Enum):
"""The possible SharpnessMethods for autofocus.""" """The possible SharpnessMethods for autofocus."""
jpeg = "jpeg" JPEG = enum.auto()
class AutofocusParams(BaseModel): class AutofocusParams(BaseModel):
"""A class for running autofocus routines.""" """A class for running autofocus routines."""
dz: int dz: int
sharpness_method: SharpnessMethod = SharpnessMethod.jpeg sharpness_method: SharpnessMethod = SharpnessMethod.JPEG
class StackOrigin(str, Enum): class StackOrigin(enum.Enum):
"""The position of the current location in the stack.""" """The position of the current location in the stack."""
START = "start" START = enum.auto()
CENTER = "center" CENTER = enum.auto()
END = "end" END = enum.auto()
class StackParams(BaseModel): class StackParams(BaseModel):