Skip to content

Commit

Permalink
added backwards compatible names
Browse files Browse the repository at this point in the history
  • Loading branch information
evalott100 committed Oct 15, 2024
1 parent dec9033 commit 7626f2a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/pandablocks_ioc/_pvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,26 @@ def q_group_formatter(
panda_field: str | None,
access: str,
channel: Literal["VAL", "NAME"],
pvi_field: Literal["value", "pvi"] = "value",
other_fields: dict[str, str] | None = None,
) -> dict:
other_fields = other_fields or {}
panda_field_with_seperator = (
f".{panda_field.lower().replace(':', '_')}." if panda_field else "."
)
block_name_suffixed = f"{pvi_field}{panda_field_with_seperator}{access}"
# We want to swap to using `.value` but we'll keep backwards compatibility
# for a while.
backwards_compatible_block_names = (
f"{pvi_field}{panda_field_with_seperator}{access}"
for pvi_field in ("value", "pvi")
)
return {
block_name_suffixed: {
"+channel": channel,
"+type": "plain",
"+trigger": block_name_suffixed,
**other_fields,
}
for block_name_suffixed in backwards_compatible_block_names
}


Expand Down

0 comments on commit 7626f2a

Please sign in to comment.