mt_metadata.common.list_dict ============================ .. py:module:: mt_metadata.common.list_dict .. autoapi-nested-parse:: Created on Wed Nov 16 11:08:25 2022 @author: jpeacock Classes ------- .. autoapisummary:: mt_metadata.common.list_dict.ListDict Module Contents --------------- .. py:class:: ListDict(values={}) Hack together an object that acts like a dictionary and list such that a user can get an item by index or key. This is the first attempt, seems to work, might think about inheriting an OrderedDict and overloading. .. py:method:: copy() Copy object .. py:method:: keys() .. py:method:: values() .. py:method:: items() .. py:method:: append(obj) Append an object :param obj: DESCRIPTION :type obj: TYPE :return: DESCRIPTION :rtype: TYPE .. py:method:: remove(key) remove an item based on key or index :param key: DESCRIPTION :type key: TYPE :return: DESCRIPTION :rtype: TYPE .. py:method:: extend(other, skip_keys=[]) extend the dictionary from another ListDict object :param other: DESCRIPTION :type other: TYPE :return: DESCRIPTION :rtype: TYPE .. py:method:: sort(inplace=True) sort the dictionary keys into alphabetical order .. py:method:: update(other) Update from another ListDict .. py:method:: pop(key) pop item off of dictionary. The key must be verbatim :param key: key of item to be popped off of dictionary :type key: string :return: item popped .. py:method:: update_keys() Update all keys in the ListDict based on the current state of the objects. This is useful when object IDs have been changed after being added to the ListDict. The method will re-key all objects using their current ID values. :returns: A dictionary mapping old keys to new keys for objects that were re-keyed. :rtype: dict .. py:method:: to_dict(single=False, nested=False, required=False) need to implement this method .. py:method:: clear() Clear all items from the ListDict.