generate_changelog.utilities.resolve_name

resolve_name#

generate_changelog.utilities.resolve_name(obj, name, default=None)[source]#

Get a key or attr name from obj or default value.

Copied and modified from Django Template variable resolutions

Resolution methods:

  • Mapping key lookup

  • Attribute lookup

  • Sequence index

Parameters:
  • obj (Any) – The object to access

  • name (str) – A dotted name to the value, such as mykey.0.name

  • default (Any) – If the name cannot be resolved from the object, return this value

Return type:

Any

Returns:

The value at the resolved name or the default value.

Raises:

TypeError, AttributeError – If accessing the property raises one of these exceptions.