Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unshadow dict #335

Merged
merged 3 commits into from
May 18, 2024
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
20 changes: 10 additions & 10 deletions src/roiextractors/extraction_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,15 +593,15 @@ def animate_func(i, imaging, im, ax):
return anim


def check_keys(dict):
def check_keys(dict_: dict) -> dict:
"""Check keys of dictionary for mat-objects.

Checks if entries in dictionary are mat-objects. If yes
todict is called to change them to nested dictionaries.

Parameters
----------
dict: dict
dict_: dict
Dictionary to check.

Returns
Expand All @@ -616,10 +616,10 @@ def check_keys(dict):
"""
from scipy.io.matlab.mio5_params import mat_struct

for key in dict:
if isinstance(dict[key], mat_struct):
dict[key] = todict(dict[key])
return dict
for key in dict_:
if isinstance(dict_[key], mat_struct):
dict_[key] = todict(dict_[key])
return dict_


def todict(matobj):
Expand All @@ -637,16 +637,16 @@ def todict(matobj):
"""
from scipy.io.matlab.mio5_params import mat_struct

dict = {}
dict_ = {}
from scipy.io.matlab.mio5_params import mat_struct

for strg in matobj._fieldnames:
elem = matobj.__dict__[strg]
if isinstance(elem, mat_struct):
dict[strg] = todict(elem)
dict_[strg] = todict(elem)
else:
dict[strg] = elem
return dict
dict_[strg] = elem
return dict_


def get_package(
Expand Down
Loading