HPInc / HP-Digital-Microfluidics

HP Digital Microfluidics Software Platform and Libraries
MIT License
2 stars 0 forks source link

Add infinite values for dimensions #233

Closed EvanKirshenbaum closed 5 months ago

EvanKirshenbaum commented 5 months ago

Currently, given a dimension like Time, you can ask about Time.ZERO to get the zero value. It would be useful (and easy to support), to also be able to ask about Time.INFINITY (or Time.INF).

All that would be required would be to add the equivalent of ZERO support:

class NamedDimMeta(type, DimLike):
    @property
    def ZERO(self: Type[T]) -> T:
        val: T = getattr(self, "_zero")
        return val

    def __init__(self, name: str, base: tuple[Type, ...], dct: Mapping) -> None:  # @UnusedVariable 
        self._zero = self(0.0)
        self._restriction_classes: dict[Any, type[BaseDim]] = {}
Migrated from internal repository. Originally created by @EvanKirshenbaum on Feb 04, 2023 at 3:08 PM PST. Closed on Oct 06, 2023 at 10:18 AM PDT.
EvanKirshenbaum commented 5 months ago

This issue was referenced by the following commit before migration: