Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Dec 17, 2024
1 parent 1218834 commit bcddea4
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/builder2ibek/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def main(
def xml2yaml(
xml: Path = typer.Argument(..., help="Filename of the builder XML file"),
yaml: Optional[Path] = typer.Option(..., help="Output file"),
schema: Optional[str] = typer.Option(
schema: str = typer.Option(
"/epics/ibek-defs/ioc.schema.json",
help="Generic IOC schema (added to top of the yaml output)",
),
Expand Down
2 changes: 1 addition & 1 deletion src/builder2ibek/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from builder2ibek.types import Entity, Generic_IOC


def convert_file(xml: Path, yaml: Path, schema: str) -> str:
def convert_file(xml: Path, yaml: Path, schema: str):
def tidy_up(yaml):
# add blank lines between major fields
for field in [
Expand Down
4 changes: 2 additions & 2 deletions src/builder2ibek/db2autosave.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def parse_templates(out_folder: Path, db_list: list[Path]):
for db in db_list:
text = db.read_text()

positions = set()
settings = set()
positions: set[str] = set()
settings: set[str] = set()
for n in range(3):
match n:
case 0:
Expand Down
16 changes: 8 additions & 8 deletions src/builder2ibek/dbcompare.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ def compare_dbs(
old_text = original.read_text()
new_text = new.read_text()

old_set = set()
old_set: set[str] = set()
for record in regex_record.finditer(old_text):
old_set.add(f"{record.group(1)} {record.group(2)}")
new_set = set()
new_set: set[str] = set()
for record in regex_record.finditer(new_text):
new_set.add(f"{record.group(1)} {record.group(2)}")

Expand All @@ -28,14 +28,14 @@ def compare_dbs(

old_only_filtered = old_only.copy()
new_only_filtered = new_only.copy()
for record in old_only:
for rec in old_only:
for s in ignore:
if s in record:
old_only_filtered.remove(record)
for record in new_only:
if s in rec:
old_only_filtered.remove(rec)
for rec in new_only:
for s in ignore:
if s in record:
new_only_filtered.remove(record)
if s in rec:
new_only_filtered.remove(rec)

result = (
"Records in original but not in new:\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ for x in *.xml; do
echo converting $x to $y
builder2ibek xml2yaml $x --yaml $y
done

builder2ibek db-compare ./SR03C-VA-IOC-01_expanded.db ./sr03c-va-ioc-01.db --output ./compare.diff
7 changes: 5 additions & 2 deletions tests/samples/sr03c-va-ioc-01.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ entities:
name: EPICS_CAS_BEACON_ADDR_LIST
value: 172.23.194.105

- type: autosave.Autosave
P: 'SR03C-VA-IOC-01:'

- type: asyn.AsynIP
name: GCTLR_A_01_PORT
port: 192.168.3.11:7002
Expand Down Expand Up @@ -1059,14 +1062,14 @@ entities:
master: FV.MASTER
name: FV.G8

- type: terminalServer.Moxa
- type: terminalServer.Moxa16
HOST: 192.168.3.11
NCHANS: 16
P: SR03C-VA-TSERV-01
R: ''
name: TSERV1

- type: terminalServer.Moxa
- type: terminalServer.Moxa16
HOST: 192.168.3.12
NCHANS: 16
P: SR03C-VA-TSERV-02
Expand Down
4 changes: 2 additions & 2 deletions tests/test_file_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@


def test_convert(samples: Path):
samples = samples.glob("*.xml")
for sample_xml in samples:
all_samples = samples.glob("*.xml")
for sample_xml in all_samples:
sample_yaml = Path(str(sample_xml.with_suffix(".yaml")).lower())
out_yaml = Path("/tmp") / sample_yaml.name

Expand Down

0 comments on commit bcddea4

Please sign in to comment.