erc7730.convert.resolved.constants module

class erc7730.convert.resolved.constants.ConstantProvider[source]View on GitHub

Bases: ABC

Resolver for constants values referenced by descriptor paths.

abstract get(path: DescriptorPath, out: OutputAdder) Any[source]View on GitHub

Get the constant for the given path.

Parameters:
  • path – descriptor path

  • out – error handler

Returns:

constant value, or None if not found

resolve(value: _T | DescriptorPath, out: OutputAdder) _T[source]View on GitHub

Resolve the value if it is a descriptor path.

Parameters:
  • value – descriptor path or actual value

  • out – error handler

Returns:

constant value, or the value itself if not a descriptor path

resolve_or_none(value: _T | DescriptorPath | None, out: OutputAdder) _T | None[source]View on GitHub

Resolve the optional value if it is a descriptor path.

Parameters:
  • value – descriptor path, actual value or None

  • out – error handler

Returns:

None, constant value, or the value itself if not a descriptor path

resolve_path(value: DataPath | ContainerPath | DescriptorPath, out: OutputAdder) DataPath | ContainerPath | None[source]View on GitHub

Resolve the value as a data/container path.

Parameters:
  • value – descriptor path or actual data/container path

  • out – error handler

Returns:

resolved data/container path

resolve_path_or_none(value: DataPath | ContainerPath | DescriptorPath | None, out: OutputAdder) DataPath | ContainerPath | None[source]View on GitHub

Resolve the value as a data/container path.

Parameters:
  • value – descriptor path or actual data/container path

  • out – error handler

Returns:

resolved data/container path

class erc7730.convert.resolved.constants.DefaultConstantProvider(descriptor: InputERC7730Descriptor)[source]View on GitHub

Bases: ConstantProvider

Resolver for constants values from a provided dictionary.

get(path: DescriptorPath, out: OutputAdder) Any[source]View on GitHub

Get the constant for the given path.

Parameters:
  • path – descriptor path

  • out – error handler

Returns:

constant value, or None if not found