| | |
Methods defined here:
- __init__(self)
- Initializes the index dictionary for the class instance.
- __str__(self)
- Returns a string representation of the index.
Returns:
str: A string representation of the index.
- add(self, key, record)
- Adds a record to the index under the specified key.
If the key does not exist in the index, it will be created.
Args:
key (str): The key under which the record will be added.
record (Any): The record to be added to the index.
- find(self, key)
- Find the value associated with the given key in the index.
Args:
key: The key to search for in the index.
Returns:
The value associated with the key if found, otherwise an empty list.
- remove(self, key, record)
- Remove a record from the index for a given key.
Args:
key (str): The key from which the record should be removed.
record (Any): The record to be removed from the index.
- to_dict(self)
- Returns a dictionary representation of the index.
Returns:
dict: A dictionary representation of the index.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|