Skip to content

Commit

Permalink
Revert "fix(protocols): re-add get_all_labware_definitions (#17077)"
Browse files Browse the repository at this point in the history
This reverts commit 059380b.
  • Loading branch information
caila-marashaj authored Dec 10, 2024
1 parent 059380b commit a961133
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 34 deletions.
10 changes: 0 additions & 10 deletions api/src/opentrons/protocols/api_support/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,3 @@ def _check_version_wrapper(*args: Any, **kwargs: Any) -> Any:
return cast(FuncT, _check_version_wrapper)

return _set_version


class ModifiedList(list[str]):
def __contains__(self, item: object) -> bool:
if not isinstance(item, str):
return False
for name in self:
if name == item.replace("-", "_").lower():
return True
return False
25 changes: 1 addition & 24 deletions api/src/opentrons/protocols/labware.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

import logging
import json
import os

from pathlib import Path
from typing import Any, AnyStr, Dict, Optional, Union, List
from typing import Any, AnyStr, Dict, Optional, Union

import jsonschema # type: ignore

from opentrons_shared_data import load_shared_data, get_shared_data_root
from opentrons.protocols.api_support.util import ModifiedList
from opentrons.protocols.api_support.constants import (
OPENTRONS_NAMESPACE,
CUSTOM_NAMESPACE,
Expand Down Expand Up @@ -63,27 +61,6 @@ def get_labware_definition(
return _get_standard_labware_definition(load_name, namespace, version)


def get_all_labware_definitions() -> List[str]:
"""
Return a list of standard and custom labware definitions with load_name +
name_space + version existing on the robot
"""
labware_list = ModifiedList()

def _check_for_subdirectories(path: Union[str, Path, os.DirEntry[str]]) -> None:
with os.scandir(path) as top_path:
for sub_dir in top_path:
if sub_dir.is_dir():
labware_list.append(sub_dir.name)

# check for standard labware
_check_for_subdirectories(get_shared_data_root() / STANDARD_DEFS_PATH)
# check for custom labware
for namespace in os.scandir(USER_DEFS_PATH):
_check_for_subdirectories(namespace)
return labware_list


def save_definition(
labware_def: LabwareDefinition, force: bool = False, location: Optional[Path] = None
) -> None:
Expand Down

0 comments on commit a961133

Please sign in to comment.