MCPcopy Index your code
hub / github.com/ipython/ipython / __dict_invert

Method __dict_invert

IPython/utils/ipstruct.py:210–222  ·  view source on GitHub ↗

Helper function for merge. Takes a dictionary whose values are lists and returns a dict with the elements of each list as keys and the original keys as values.

(self, data)

Source from the content-addressed store, hash-verified

208 return self
209
210 def __dict_invert(self, data):
211 """Helper function for merge.
212
213 Takes a dictionary whose values are lists and returns a dict with
214 the elements of each list as keys and the original keys as values.
215 """
216 outdict = {}
217 for k,lst in data.items():
218 if isinstance(lst, str):
219 lst = lst.split()
220 for entry in lst:
221 outdict[entry] = k
222 return outdict
223
224 def dict(self):
225 return self

Callers 1

mergeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected