Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 28 additions & 12 deletions src/pymodaq_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,26 @@ def find_dict_if_matched_key_val(dict_tmp, key, value):
return False


def find_dicts_in_list_from_key_val(dicts, key, value):
""" lookup within a list of dicts. Look for the dicts within the list which have the correct key, value pair

Parameters
----------
dicts: (list) list of dictionnaries
key: (str) specific key to look for in each dict
value: value to match

Returns
-------
dict: if found otherwise returns None
"""
selection = []
for ind, dict_tmp in enumerate(dicts):
if find_dict_if_matched_key_val(dict_tmp, key, value):
selection.append(dict_tmp)
return selection


def find_dict_in_list_from_key_val(dicts, key, value, return_index=False):
""" lookup within a list of dicts. Look for the dict within the list which has the correct key, value pair

Expand Down Expand Up @@ -646,11 +666,7 @@ def get_new_file_name(base_path=Path(config('data_saving', 'h5file', 'save_path'


if __name__ == '__main__':
#paths = recursive_find_expr_in_files('C:\\Users\\weber\\Labo\\Programmes Python\\PyMoDAQ_Git', 'visa')
# for p in paths:
# print(str(p))
# v = get_version()
# pass

#plugins = get_plugins() # pragma: no cover
#extensions = get_extension()
#models = get_models()
Expand All @@ -661,13 +677,13 @@ def get_new_file_name(base_path=Path(config('data_saving', 'h5file', 'save_path'
# mit = license.find('MIT')
#

# paths = recursive_find_expr_in_files(r'C:\Users\weber\Labo\Programmes Python\PyMoDAQ_Git',
# exp="cfunc",
# paths=[],
# filters=['.git', '.idea', '__pycache__', 'build', 'egg', 'documentation',
# '.tox',],
# replace=False,
# replace_str="pymodaq.utils")
paths = recursive_find_expr_in_files(r'C:\Users\weber\Labo\ProgrammesPython\PyMoDAQ_Git',
exp="'multiaxes'",
paths=[],
filters=['.git', '.idea', '__pycache__', 'build', 'egg', 'documentation',
'.tox',],
replace=False,
replace_str="pymodaq.utils")

#get_version()
pass
Expand Down