Utilities#
- Tensile.Utilities.Profile.profile(func: Callable) Callable #
Profiling decorator.
Add
@profile
to mark a function for profiling; set the environment variable TENSILE_PROFILE=ON to enable profiling decorated functions.
- Tensile.Utilities.String.splitDelimitedString(input: str, delimiters: Set[str]) Set[str] #
Given the delimiters, split string into a set.
- Parameters:
input – String to be split.
delimiters – In order of decreasing priority, delimiters to split the string by.
- Returns:
Input separated by delimiters as a set.
- Tensile.Utilities.toFile.toFile(outputFile: Path | TextIOWrapper, contents: List[str], delimiter: str = '\n') None #
Generates a user specified delimited file.
Writes the elements of a List of strings with a given delimiter. The state of the file is inspected to determine if it should be opened. If the file is already opened, the file is not closed after writing.
- Parameters:
outputFile – Path to file for writing manifest.
contents – List of items to write manifest.
delimiter – Symbol used to delimit elements when writing file.
- Raises:
AssertionError – If contents is not a List[str]
Notes
If outputFile is a TextIOWrapper, the file must not be closed.
Providing an open file is useful for writing multiple calls to the same file.