utils#

Copyright 2025 Apple Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

parameterized_transforms.utils.components_to_string(components: List[str], connector: str = ',\n') str#

Concatenate given components into a string using given connector.

Parameters:
  • components – The components of a string.

  • connector – The string used to concatenate given components.

Returns:

The concatenated string made from the given components using

the given connector string.

parameterized_transforms.utils.get_total_params_count(transforms: Any) int#

Returns the total number of processed parameters for the given collection of core transformations.

Parameters:

transforms – The collection of core transforms.

Returns:

The total number of processed parameters.

parameterized_transforms.utils.indent(data: str, indentor: str = '  ', connector: str = '\n') str#

Indents the given string data with given indentor.

param data:

The data to indent.

param indentor:

The indenting character. DEFAULT: “ “ (two spaces).

param connector:

The string used to concatenate given components. DEFAULT: `

`.

return:

The indented data.

Careful not to have new-line characters in the indentor. This is currently allowed but NOT tested, use at your own risk.

parameterized_transforms.utils.indent_line(line: str, indentor: str = '  ') str#

Indents the given string using the given indentor.

Parameters:
  • line – The string to be indented.

  • indentor – The indenting string.

Returns:

The indented string.

parameterized_transforms.utils.indent_lines(lines: List[str], indentor: str = '  ') List[str]#

Adds as prefix the indentor string to each of the given lines.

Parameters:
  • lines – The lines of the content.

  • indentor – The indenting character. DEFAULT: “ “ (two spaces).

Returns:

The indented lines.

Careful not to have new-line characters in the indentor. This is currently allowed but NOT tested, use at your own risk.

parameterized_transforms.utils.string_to_components(string: str, separator: str = '\n') List[str]#

Split a given string into componenets based on given separator.

Parameters:
  • string – The input string.

  • separator – The string to split the given string into components.

Returns:

The components extracted from this string.