Skip to content

Commit

Permalink
mild fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
sfoster1 committed Jul 31, 2024
1 parent febeeea commit bff1784
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions shared-data/python/opentrons_shared_data/pipette/load_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import os
from pathlib import Path
from logging import getLogger

Expand Down Expand Up @@ -30,6 +29,7 @@

LOG = getLogger(__name__)


def _get_configuration_dictionary(
config_type: Literal["general", "geometry", "liquid"],
channels: PipetteChannelType,
Expand Down Expand Up @@ -98,6 +98,7 @@ def _physical(
) -> LoadedConfiguration:
return _get_configuration_dictionary("general", channels, model, version)


def _dirs_in(path: Path) -> Iterator[Path]:
for child in path.iterdir():
if child.is_dir():
Expand All @@ -123,17 +124,17 @@ def load_serial_lookup_table() -> Dict[str, str]:
for channel_dir in _dirs_in(config_path):
for model_dir in _dirs_in(channel_dir):
for version_file in model_dir.iterdir():
if version_file.suffix != '.json':
if version_file.suffix != ".json":
continue
try:
version_list = version_file.stem.split("_")
built_model = f"{model_dir.stem}_{_channel_model_str[channel_dir.stem]}_v{version_list[0]}.{version_list[1]}"
except IndexError:
LOG.warning(f'Pipette def with bad name {version_file} ignored')
LOG.warning(f"Pipette def with bad name {version_file} ignored")
continue
model_shorthand = _model_shorthand.get(model_dir.stem, model_dir.stem)
if (
model_dir == "p300"
model_dir.stem == "p300"
and int(version_list[0]) == 1
and int(version_list[1]) == 0
):
Expand Down
1 change: 1 addition & 0 deletions shared-data/python/tests/pipette/test_validate_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def test_pick_up_configs_configuration_by_nozzle_map_keys() -> None:
for channel_dir in os.listdir(paths_to_validate):
for model_dir in os.listdir(paths_to_validate / channel_dir):
for version_file in os.listdir(paths_to_validate / channel_dir / model_dir):
print(version_file)
version_list = version_file.split(".json")[0].split("_")
built_model: PipetteModel = PipetteModel(
f"{model_dir}_{_channel_model_str[channel_dir]}_v{version_list[0]}.{version_list[1]}"
Expand Down

0 comments on commit bff1784

Please sign in to comment.