Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/fastcs/transports/epics/ca/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
from fastcs.exceptions import FastCSError
from fastcs.transports.epics.util import validate_epics_pv_id

_CA_ID_RE = re.compile(r"^[A-Za-z0-9_-]+$")
_CA_ID_RE = re.compile(r"^[A-Za-z0-9_:-]+$")


def validate_ca_id(controller_api: ControllerAPI) -> None:
"""Reject controller ids that wouldn't be safe in an EPICS CA PV name.

Rejects ids with characters outside ``[A-Za-z0-9_-]`` and rejects setups
Rejects ids with characters outside ``[A-Za-z0-9_:-]`` and rejects setups
where the longest derivable PV prefix already exceeds the 60-character
EPICS PV name limit.
"""
Expand Down
4 changes: 2 additions & 2 deletions src/fastcs/transports/epics/pva/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from fastcs.controllers import ControllerAPI
from fastcs.transports.epics.util import validate_epics_pv_id

_PVA_ID_RE = re.compile(r"^[A-Za-z0-9_-]+$")
_PVA_ID_RE = re.compile(r"^[A-Za-z0-9_:-]+$")


def validate_pva_id(controller_api: ControllerAPI) -> None:
"""Reject controller ids that wouldn't be safe in an EPICS PVA PV name.

Rejects ids with characters outside ``[A-Za-z0-9_-]`` and rejects setups
Rejects ids with characters outside ``[A-Za-z0-9_:-]`` and rejects setups
where the longest derivable PV prefix already exceeds the 60-character
EPICS PV name limit.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/fastcs/transports/epics/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def validate_epics_pv_id(
if not id_re.fullmatch(name):
raise ValueError(
f"Controller id {name!r} is not a valid {transport_label}; "
"only alphanumerics, '-' and '_' are allowed"
"only alphanumerics, '-', '_', and ':' are allowed"
)
longest_prefix = max(
len(pv_prefix_from_path(api.path)) for api in controller_api.walk_api()
Expand Down
2 changes: 1 addition & 1 deletion tests/transports/epics/ca/test_ca_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def test_validate_ca_id_accepts_valid(id):
validate_ca_id(ControllerAPI(path=[id]))


@pytest.mark.parametrize("id", ["bad/id", "with space", "colons:in:id", ""])
@pytest.mark.parametrize("id", ["bad/id", "with space", ""])
def test_validate_ca_id_rejects_illegal_characters(id):
with pytest.raises(ValueError, match="EPICS CA id"):
validate_ca_id(ControllerAPI(path=[id]))
Expand Down
2 changes: 1 addition & 1 deletion tests/transports/epics/pva/test_pva_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def test_validate_pva_id_accepts_valid(name):
validate_pva_id(ControllerAPI(path=[name]))


@pytest.mark.parametrize("name", ["bad/id", "with space", "colons:in:id", ""])
@pytest.mark.parametrize("name", ["bad/id", "with space", ""])
def test_validate_pva_id_rejects_illegal_characters(name):
with pytest.raises(ValueError, match="EPICS PVA id"):
validate_pva_id(ControllerAPI(path=[name]))
Expand Down
Loading