Go to the latest version of this document.

# ``twisted`.`logger`.`_flatten`.`KeyFlattener``

class documentation

`class KeyFlattener: (source)`

Constructor: `KeyFlattener()`

View In Hierarchy

A `KeyFlattener` computes keys for the things within curly braces in PEP-3101-style format strings as parsed by `string.Formatter.parse`.

Method | `__init__` | Initialize a `KeyFlattener`.
Method | `flatKey` | Compute a string key for a given field/format/conversion.
Instance Variable | `keys` | Undocumented

def __init__(self): (source)

Initialize a `KeyFlattener`.

def flatKey(self, fieldName: `str`, formatSpec: `str | None`, conversion: `str | None`) -> `str`: (source)

Compute a string key for a given field/format/conversion.

Parameters
fieldName:`str` | A format field name.
formatSpec:`str | None` | A format spec.
conversion:`str | None` | A format field conversion type.

Returns
`str` | A key specific to the given field, format and conversion, as well as the occurrence of that combination within this `KeyFlattener`'s lifetime.

keys: `dict[str, int]` = (source)

Undocumented