Skip to content

feature: gui and docs can be None in a transport #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@

def create_docs(self) -> None:
for transport in self._transports:
if hasattr(transport.options, "docs"):
if getattr(transport.options, "docs", None) is not None:

Check warning on line 86 in src/fastcs/launch.py

View check run for this annotation

Codecov / codecov/patch

src/fastcs/launch.py#L86

Added line #L86 was not covered by tests
transport.create_docs()

def create_gui(self) -> None:
for transport in self._transports:
if hasattr(transport.options, "gui"):
if getattr(transport.options, "gui", None) is not None:

Check warning on line 91 in src/fastcs/launch.py

View check run for this annotation

Codecov / codecov/patch

src/fastcs/launch.py#L91

Added line #L91 was not covered by tests
transport.create_gui()

def run(self):
Expand Down
4 changes: 2 additions & 2 deletions src/fastcs/transport/epics/ca/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
class EpicsCAOptions:
"""Options for the EPICS CA transport."""

docs: EpicsDocsOptions = field(default_factory=EpicsDocsOptions)
gui: EpicsGUIOptions = field(default_factory=EpicsGUIOptions)
docs: EpicsDocsOptions | None = None
gui: EpicsGUIOptions | None = None
ioc: EpicsIOCOptions = field(default_factory=EpicsIOCOptions)
6 changes: 5 additions & 1 deletion src/fastcs/transport/epics/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from fastcs.attributes import Attribute, AttrR, AttrRW, AttrW
from fastcs.controller_api import ControllerAPI
from fastcs.cs_methods import Command
from fastcs.datatypes import Bool, Enum, Float, Int, String, Waveform
from fastcs.datatypes import Bool, Enum, Float, Int, String, Table, Waveform
from fastcs.exceptions import FastCSException
from fastcs.util import snake_to_pascal

Expand Down Expand Up @@ -56,6 +56,8 @@
return TextRead(format=TextFormat.string)
case Waveform():
return None
case Table():
return None

Check warning on line 60 in src/fastcs/transport/epics/gui.py

View check run for this annotation

Codecov / codecov/patch

src/fastcs/transport/epics/gui.py#L59-L60

Added lines #L59 - L60 were not covered by tests
case datatype:
raise FastCSException(f"Unsupported type {type(datatype)}: {datatype}")

Expand All @@ -74,6 +76,8 @@
)
case Waveform():
return None
case Table():
return None

Check warning on line 80 in src/fastcs/transport/epics/gui.py

View check run for this annotation

Codecov / codecov/patch

src/fastcs/transport/epics/gui.py#L79-L80

Added lines #L79 - L80 were not covered by tests
case datatype:
raise FastCSException(f"Unsupported type {type(datatype)}: {datatype}")

Expand Down
4 changes: 2 additions & 2 deletions src/fastcs/transport/epics/pva/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
class EpicsPVAOptions:
"""Options for the EPICS PVA transport."""

docs: EpicsDocsOptions = field(default_factory=EpicsDocsOptions)
gui: EpicsGUIOptions = field(default_factory=EpicsGUIOptions)
docs: EpicsDocsOptions | None = None
gui: EpicsGUIOptions | None = None
ioc: EpicsIOCOptions = field(default_factory=EpicsIOCOptions)
40 changes: 36 additions & 4 deletions tests/data/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,26 @@
"EpicsCAOptions": {
"properties": {
"docs": {
"$ref": "#/$defs/EpicsDocsOptions"
"anyOf": [
{
"$ref": "#/$defs/EpicsDocsOptions"
},
{
"type": "null"
}
],
"default": null
},
"gui": {
"$ref": "#/$defs/EpicsGUIOptions"
"anyOf": [
{
"$ref": "#/$defs/EpicsGUIOptions"
},
{
"type": "null"
}
],
"default": null
},
"ioc": {
"$ref": "#/$defs/EpicsIOCOptions"
Expand Down Expand Up @@ -83,10 +99,26 @@
"EpicsPVAOptions": {
"properties": {
"docs": {
"$ref": "#/$defs/EpicsDocsOptions"
"anyOf": [
{
"$ref": "#/$defs/EpicsDocsOptions"
},
{
"type": "null"
}
],
"default": null
},
"gui": {
"$ref": "#/$defs/EpicsGUIOptions"
"anyOf": [
{
"$ref": "#/$defs/EpicsGUIOptions"
},
{
"type": "null"
}
],
"default": null
},
"ioc": {
"$ref": "#/$defs/EpicsIOCOptions"
Expand Down
Loading