Exemplo n.º 1
0
def _get_path_to_labware(load_name: str,
                         namespace: str,
                         version: int,
                         base_path: Path = None) -> Path:
    if namespace == OPENTRONS_NAMESPACE:
        # all labware in OPENTRONS_NAMESPACE is stored in shared data
        return get_shared_data_root() / STANDARD_DEFS_PATH \
               / load_name / f'{version}.json'
    if not base_path:
        base_path = CONFIG['labware_user_definitions_dir_v2']
    def_path = base_path / namespace / load_name / f'{version}.json'
    return def_path
Exemplo n.º 2
0
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):
        with os.scandir(path) as top_path:
            for sub_dir in top_path:
                labware_list.append(sub_dir.name) if sub_dir.is_dir() else None

    # check for standard labware
    _check_for_subdirectories(get_shared_data_root() / STANDARD_DEFS_PATH)

    # check for custom labware
    for namespace in os.scandir(CONFIG['labware_user_definitions_dir_v2']):
        _check_for_subdirectories(namespace)

    return labware_list