-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from epics-containers/autosave
Improvements for ioc-dlslinuxvac
- Loading branch information
Showing
26 changed files
with
219,066 additions
and
413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Changes here will be overwritten by Copier | ||
_commit: 2.5.0 | ||
_commit: 2.6.0 | ||
_src_path: gh:diamondlightsource/python-copier-template | ||
author_email: [email protected] | ||
author_name: Giles Knap | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,7 @@ | |
"[python]": { | ||
"editor.defaultFormatter": "charliermarsh.ruff", | ||
}, | ||
"python.testing.pytestArgs": [ | ||
"tests" | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from builder2ibek.converters.globalHandler import globalHandler | ||
from builder2ibek.types import Entity, Generic_IOC | ||
|
||
xml_component = "terminalServer" | ||
|
||
|
||
@globalHandler | ||
def handler(entity: Entity, entity_type: str, ioc: Generic_IOC): | ||
""" | ||
XML to YAML specialist convertor function for the terminalServer module | ||
""" | ||
|
||
if entity_type == "Moxa": | ||
if entity.NCHANS > 16: | ||
entity.type = "terminalServer.Moxa32" | ||
else: | ||
entity.type = "terminalServer.Moxa16" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import re | ||
from pathlib import Path | ||
|
||
regex_autosave = [ | ||
re.compile(rf'# *% *autosave *{n} *(.*)[\s\S]*?record *\(.*, *"?([^"]*)"?\)') | ||
for n in range(3) | ||
] | ||
|
||
|
||
def parse_templates(out_folder: Path, db_list: list[Path]): | ||
""" | ||
DLS has 3 autosave levels | ||
0 = save on pass 0 | ||
1 = save on pass 0 and 1 | ||
2 = save on pass 1 only | ||
Areadetector and other support modules use: | ||
template_name_positions.req for save on pass 0 | ||
template_name_settings.req for save on pass 0 and pass 1 | ||
the autosave docs seem to back the idea that pass 1 only is never used | ||
So this translation will make | ||
0 => template_name_positions.req | ||
1 => template_name_settings.req | ||
""" | ||
for db in db_list: | ||
text = db.read_text() | ||
|
||
positions: set[str] = set() | ||
settings: set[str] = set() | ||
for n in range(3): | ||
match n: | ||
case 0: | ||
this_set = positions | ||
case 1 | 2: | ||
this_set = settings | ||
for result in regex_autosave[n].finditer(text): | ||
this_set.add(f"{result.group(2)} {result.group(1)}") | ||
|
||
req_file = out_folder / f"{db.stem}_positions.req" | ||
req_file.write_text("\n".join(positions) + "\n") | ||
req_file = out_folder / f"{db.stem}_settings.req" | ||
req_file.write_text("\n".join(settings) + "\n") |
Oops, something went wrong.