From bfb817a0d53542120c04e69692087ee13d0c1c55 Mon Sep 17 00:00:00 2001 From: Benjamin Labrecque Date: Wed, 15 Jul 2026 15:32:10 +0200 Subject: [PATCH] fix: agebd --- packages/agebd/src/agebd/pv.py | 58 +++++++++++++++++----------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/agebd/src/agebd/pv.py b/packages/agebd/src/agebd/pv.py index 16d2f22..76a39a8 100644 --- a/packages/agebd/src/agebd/pv.py +++ b/packages/agebd/src/agebd/pv.py @@ -8,35 +8,6 @@ from agebd.enums import AGEBD_ENV from agebd.utils import get_env -def get_pv_class() -> Type[PVLink]: - """ - PV Factory for LOCAL, DEV, and PROD modes - """ - env = get_env() - - if env == AGEBD_ENV.PROD: - return PVLink - elif env == AGEBD_ENV.DEV: - return DevPVLink - else: - return LocalPVLink - - -# TODO: naming (external?) -def get_pv_external_class() -> Type[PVLink]: - """ - TODO: PV Factory for PV that is read from other services/... - TODO: do we never write to these? maybe name it readonly... - - Always read from prod, unless local. - """ - env = get_env() - - if env == AGEBD_ENV.LOCAL: - return LocalPVLink - return PVLink - - class PVLink: def __init__(self, pvname, **kwargs): self.link = self.connect(pvname, **kwargs) @@ -175,3 +146,32 @@ class LocalPVLink: def put(self, val, **kwargs): self.value = val self.timestamp = time() + + +def get_pv_class() -> Type[PVLink]: + """ + PV Factory for LOCAL, DEV, and PROD modes + """ + env = get_env() + + if env == AGEBD_ENV.PROD: + return PVLink + elif env == AGEBD_ENV.DEV: + return DevPVLink + else: + return LocalPVLink + + +# TODO: naming (external?) +def get_pv_external_class() -> Type[PVLink]: + """ + TODO: PV Factory for PV that is read from other services/... + TODO: do we never write to these? maybe name it readonly... + + Always read from prod, unless local. + """ + env = get_env() + + if env == AGEBD_ENV.LOCAL: + return LocalPVLink + return PVLink