erc7730.model.paths.path_ops module

erc7730.model.paths.path_ops.data_or_container_path_concat(parent: DataPath | None, child: DataPath | ContainerPath) DataPath | ContainerPath[source]View on GitHub

Concatenate a data path with either another data path, or a container path.

Parameters:
  • parent – parent path

  • child – child path

Returns:

concatenated path

erc7730.model.paths.path_ops.data_path_append(parent: DataPath, child: Annotated[Field | ArrayElement | ArraySlice | Array, FieldInfo(annotation=NoneType, required=True, title='Data Path Element', description='An element of a data path, applying to the structured data schema (ABI path for contracts, pathin the message types itself for EIP-712)', discriminator='type')]) DataPath[source]View on GitHub

Append an element to a data path.

Parameters:
  • parent – parent path

  • child – element to append

Returns:

concatenated path

erc7730.model.paths.path_ops.data_path_concat(parent: DataPath | None, child: DataPath) DataPath[source]View on GitHub

Concatenate two data paths.

Parameters:
  • parent – parent path

  • child – child path

Returns:

concatenated path

erc7730.model.paths.path_ops.data_path_ends_with(path: DataPath, suffix: Annotated[Field | ArrayElement | ArraySlice | Array, FieldInfo(annotation=NoneType, required=True, title='Data Path Element', description='An element of a data path, applying to the structured data schema (ABI path for contracts, pathin the message types itself for EIP-712)', discriminator='type')]) bool[source]View on GitHub

Check if data path ends with a given element.

Parameters:
  • path – path to inspect

  • suffix – suffix to check

Returns:

True if path ends with suffix

erc7730.model.paths.path_ops.data_path_starts_with(path: DataPath, prefix: DataPath) bool[source]View on GitHub

Check if data path starts with a given prefix.

Parameters:
  • path – path to inspect

  • prefix – prefix to check

Returns:

True if path starts with prefix

erc7730.model.paths.path_ops.data_path_strip_prefix(path: DataPath, prefix: DataPath) DataPath[source]View on GitHub

Strip expected prefix from a data path, raising an error if the prefix is not matching.

Parameters:
  • path – path to strip

  • prefix – prefix to strip

Returns:

path without prefix

Raises:

ValueError – if the path does not start with the prefix

erc7730.model.paths.path_ops.descriptor_path_append(parent: DescriptorPath, child: Annotated[Field | ArrayElement, FieldInfo(annotation=NoneType, required=True, title='Descriptor Path Element', description='An element of a descriptor path, applying to the current file describing the structured dataformatting, after merging with includes.', discriminator='type')]) DescriptorPath[source]View on GitHub

Append an element to a descriptor path.

Parameters:
  • parent – parent path

  • child – element to append

Returns:

concatenated path

erc7730.model.paths.path_ops.descriptor_path_ends_with(path: DescriptorPath, suffix: Annotated[Field | ArrayElement, FieldInfo(annotation=NoneType, required=True, title='Descriptor Path Element', description='An element of a descriptor path, applying to the current file describing the structured dataformatting, after merging with includes.', discriminator='type')]) bool[source]View on GitHub

Check if descriptor path ends with a given element.

Parameters:
  • path – path to inspect

  • suffix – suffix to check

Returns:

True if path ends with suffix

erc7730.model.paths.path_ops.descriptor_path_starts_with(path: DescriptorPath, prefix: DescriptorPath) bool[source]View on GitHub

Check if descriptor path starts with a given prefix.

Parameters:
  • path – path to inspect

  • prefix – prefix to check

Returns:

True if path starts with prefix

erc7730.model.paths.path_ops.descriptor_path_strip_prefix(path: DescriptorPath, prefix: DescriptorPath) DescriptorPath[source]View on GitHub

Strip expected prefix from a descriptor path, raising an error if the prefix is not matching.

Parameters:
  • path – path to strip

  • prefix – prefix to strip

Returns:

path without prefix

Raises:

ValueError – if the path does not start with the prefix

erc7730.model.paths.path_ops.path_starts_with(path: DataPath | ContainerPath | DescriptorPath, prefix: DataPath | ContainerPath | DescriptorPath) bool[source]View on GitHub

Check if path starts with a given prefix.

Parameters:
  • path – path to inspect

  • prefix – prefix to check

Returns:

True if path starts with prefix

erc7730.model.paths.path_ops.to_absolute(path: DataPath | ContainerPath) DataPath | ContainerPath[source]View on GitHub

Convert a path to an absolute path.

Parameters:

path – data path

Returns:

absolute path

erc7730.model.paths.path_ops.to_relative(path: DataPath | ContainerPath) DataPath | ContainerPath[source]View on GitHub

Convert a path to a relative path.

Parameters:

path – data path

Returns:

absolute path