if type(config_pointer) is dict and key_model in config_pointer.keys():
yield path
else:
if type(config_pointer) is dict:
for key in list(config_pointer.keys()):
for path_ in self.find_model_path(config_pointer[key], key_model, path + [key]):
yield path_
elif type(config_pointer) is list:
for i in range(len(config_pointer)):
for path_ in self.find_model_path(config_pointer[i], key_model, path + [i]):
yield path_
After Change
Returns:
path in config -- list of keys (strings and integers)
config_pointer = config
if isinstance(config_pointer, dict) and key_model in config_pointer.keys():
yield path
else:
if isinstance(config_pointer, dict):
for key in list(config_pointer.keys()):
for path_ in self.find_model_path(config_pointer[key], key_model, path + [key]):
yield path_
elif isinstance(config_pointer, list):
for i in range(len(config_pointer)):
for path_ in self.find_model_path(config_pointer[i], key_model, path + [i]):
yield path_