Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
rosbag_pandas.flatdict.FlatDict Class Reference
Inheritance diagram for rosbag_pandas.flatdict.FlatDict:
Inheritance graph
[legend]

Public Member Functions

def __contains__ (self, key)
 
def __delitem__ (self, key)
 
def __eq__ (self, other)
 
def __getitem__ (self, key)
 
def __init__ (self, value=None, delimiter=':')
 
def __iter__ (self)
 
def __len__ (self)
 
def __ne__ (self, other)
 
def __reduce__ (self)
 
def __repr__ (self)
 
def __setitem__ (self, key, value)
 
def __str__ (self)
 
def as_dict (self)
 
def clear (self)
 
def copy (self)
 
def get (self, key, d=None)
 
def items (self)
 
def iteritems (self)
 
def iterkeys (self)
 
def itervalues (self)
 
def keys (self)
 
def pop (self, key, default=NO_DEFAULT)
 
def set_delimiter (self, delimiter)
 
def setdefault (self, key, default)
 
def update (self, other=None, kwargs)
 
def values (self)
 

Private Member Functions

def _has_delimiter (self, key)
 

Private Attributes

 _delimiter
 
 _values
 

Static Private Attributes

 _COERCE = dict
 

Detailed Description

:class:`~flatdict.FlatDict` is a dictionary object that allows for
single level, delimited key/value pair mapping of nested dictionaries.
The default delimiter value is ``:`` but can be changed in the constructor
or by calling :meth:`FlatDict.set_delimiter`.

Definition at line 18 of file flatdict.py.

Constructor & Destructor Documentation

◆ __init__()

def rosbag_pandas.flatdict.FlatDict.__init__ (   self,
  value = None,
  delimiter = ':' 
)

Definition at line 27 of file flatdict.py.

Member Function Documentation

◆ __contains__()

def rosbag_pandas.flatdict.FlatDict.__contains__ (   self,
  key 
)
Check to see if the key exists, checking for both delimited and
not delimited key values.

:param mixed key: The key to check for

Definition at line 33 of file flatdict.py.

◆ __delitem__()

def rosbag_pandas.flatdict.FlatDict.__delitem__ (   self,
  key 
)
Delete the item for the specified key, automatically dealing with
nested children.

:param mixed key: The key to use
:raises: KeyError

Definition at line 45 of file flatdict.py.

◆ __eq__()

def rosbag_pandas.flatdict.FlatDict.__eq__ (   self,
  other 
)
Check for equality against the other value

:param other: The value to compare
:type other: FlatDict
:rtype: bool
:raises: TypeError

Definition at line 63 of file flatdict.py.

◆ __getitem__()

def rosbag_pandas.flatdict.FlatDict.__getitem__ (   self,
  key 
)
Get an item for the specified key, automatically dealing with
nested children.

:param mixed key: The key to use
:rtype: mixed
:raises: KeyError

Definition at line 88 of file flatdict.py.

◆ __iter__()

def rosbag_pandas.flatdict.FlatDict.__iter__ (   self)
Iterate over the flat dictionary key and values

:rtype: Iterator
:raises: RuntimeError

Definition at line 102 of file flatdict.py.

◆ __len__()

def rosbag_pandas.flatdict.FlatDict.__len__ (   self)
Return the number of items.

:rtype: int

Definition at line 111 of file flatdict.py.

◆ __ne__()

def rosbag_pandas.flatdict.FlatDict.__ne__ (   self,
  other 
)
Check for inequality against the other value

:param other: The value to compare
:type other: dict or FlatDict
:rtype: bool

Definition at line 78 of file flatdict.py.

◆ __reduce__()

def rosbag_pandas.flatdict.FlatDict.__reduce__ (   self)
Return state information for pickling

:rtype: tuple

Definition at line 119 of file flatdict.py.

◆ __repr__()

def rosbag_pandas.flatdict.FlatDict.__repr__ (   self)
Return the string representation of the instance.

:rtype: str

Definition at line 127 of file flatdict.py.

◆ __setitem__()

def rosbag_pandas.flatdict.FlatDict.__setitem__ (   self,
  key,
  value 
)
Assign the value to the key, dynamically building nested
FlatDict items where appropriate.

:param mixed key: The key for the item
:param mixed value: The value for the item
:raises: TypeError

Definition at line 136 of file flatdict.py.

◆ __str__()

def rosbag_pandas.flatdict.FlatDict.__str__ (   self)
Return the string value of the instance.

:rtype: str

Definition at line 159 of file flatdict.py.

◆ _has_delimiter()

def rosbag_pandas.flatdict.FlatDict._has_delimiter (   self,
  key 
)
private
Checks to see if the key contains the delimiter.

:rtype: bool

Definition at line 364 of file flatdict.py.

◆ as_dict()

def rosbag_pandas.flatdict.FlatDict.as_dict (   self)
Return the :class:`~flatdict.FlatDict` as a :class:`dict`

:rtype: dict

Definition at line 168 of file flatdict.py.

◆ clear()

def rosbag_pandas.flatdict.FlatDict.clear (   self)
Remove all items from the flat dictionary.

Definition at line 190 of file flatdict.py.

◆ copy()

def rosbag_pandas.flatdict.FlatDict.copy (   self)
Return a shallow copy of the flat dictionary.

:rtype: flatdict.FlatDict

Definition at line 194 of file flatdict.py.

◆ get()

def rosbag_pandas.flatdict.FlatDict.get (   self,
  key,
  d = None 
)
Return the value for key if key is in the flat dictionary, else
default. If default is not given, it defaults to ``None``, so that this
method never raises :exc:`KeyError`.

:param mixed key: The key to get
:param mixed d: The default value
:rtype: mixed

Definition at line 202 of file flatdict.py.

◆ items()

def rosbag_pandas.flatdict.FlatDict.items (   self)
Return a copy of the flat dictionary's list of ``(key, value)``
pairs.

.. note:: CPython implementation detail: Keys and values are listed in
    an arbitrary order which is non-random, varies across Python
    implementations, and depends on the flat dictionary's history of
    insertions and deletions.

:rtype: list

Definition at line 217 of file flatdict.py.

◆ iteritems()

def rosbag_pandas.flatdict.FlatDict.iteritems (   self)
Return an iterator over the flat dictionary's (key, value) pairs.
See the note for :meth:`flatdict.FlatDict.items`.

Using ``iteritems()`` while adding or deleting entries in the flat
dictionary may raise :exc:`RuntimeError` or fail to iterate over all
entries.

:rtype: Iterator
:raises: RuntimeError

Definition at line 231 of file flatdict.py.

◆ iterkeys()

def rosbag_pandas.flatdict.FlatDict.iterkeys (   self)
Iterate over the flat dictionary's keys. See the note for
:meth:`flatdict.FlatDict.items`.

Using ``iterkeys()`` while adding or deleting entries in the flat
dictionary may raise :exc:`RuntimeError` or fail to iterate over all
entries.

:rtype: Iterator
:raises: RuntimeError

Definition at line 246 of file flatdict.py.

◆ itervalues()

def rosbag_pandas.flatdict.FlatDict.itervalues (   self)
Return an iterator over the flat dictionary's values. See the note
:meth:`flatdict.FlatDict.items`.

Using ``itervalues()`` while adding or deleting entries in the flat
dictionary may raise a :exc:`RuntimeError` or fail to iterate over all
entries.

:rtype: Iterator
:raises: RuntimeError

Definition at line 261 of file flatdict.py.

◆ keys()

def rosbag_pandas.flatdict.FlatDict.keys (   self)
Return a copy of the flat dictionary's list of keys.
See the note for :meth:`flatdict.FlatDict.items`.

:rtype: list

Definition at line 276 of file flatdict.py.

◆ pop()

def rosbag_pandas.flatdict.FlatDict.pop (   self,
  key,
  default = NO_DEFAULT 
)
If key is in the flat dictionary, remove it and return its value,
else return default. If default is not given and key is not in the
dictionary, :exc:`KeyError` is raised.

:param mixed key: The key name
:param mixed default: The default value
:rtype: mixed

Definition at line 292 of file flatdict.py.

◆ set_delimiter()

def rosbag_pandas.flatdict.FlatDict.set_delimiter (   self,
  delimiter 
)
Override the default or passed in delimiter with a new value. If
the requested delimiter already exists in a key, a :exc:`ValueError`
will be raised.

:param str delimiter: The delimiter to use
:raises: ValueError

Definition at line 322 of file flatdict.py.

◆ setdefault()

def rosbag_pandas.flatdict.FlatDict.setdefault (   self,
  key,
  default 
)
If key is in the flat dictionary, return its value. If not,
insert key with a value of default and return default.
default defaults to ``None``.

:param mixed key: The key name
:param mixed default: The default value
:rtype: mixed

Definition at line 308 of file flatdict.py.

◆ update()

def rosbag_pandas.flatdict.FlatDict.update (   self,
  other = None,
  kwargs 
)
Update the flat dictionary with the key/value pairs from other,
overwriting existing keys.

``update()`` accepts either another flat dictionary object or an
iterable of key/value pairs (as tuples or other iterables of length
two). If keyword arguments are specified, the flat dictionary is then
updated with those key/value pairs: ``d.update(red=1, blue=2)``.

:param iterable other: Iterable of key, value pairs
:rtype: None

Definition at line 340 of file flatdict.py.

◆ values()

def rosbag_pandas.flatdict.FlatDict.values (   self)
Return a copy of the flat dictionary's list of values. See the note
for :meth:`flatdict.FlatDict.items`.

:rtype: list

Definition at line 355 of file flatdict.py.

Member Data Documentation

◆ _COERCE

rosbag_pandas.flatdict.FlatDict._COERCE = dict
staticprivate

Definition at line 25 of file flatdict.py.

◆ _delimiter

rosbag_pandas.flatdict.FlatDict._delimiter
private

Definition at line 30 of file flatdict.py.

◆ _values

rosbag_pandas.flatdict.FlatDict._values
private

Definition at line 29 of file flatdict.py.


The documentation for this class was generated from the following file:


rosbag_pandas
Author(s): Adam Taylor
autogenerated on Mon Feb 28 2022 23:30:55