utils.py

View code on Github

Utility functions for ts-backend-check.

ts_backend_check.utils.get_config_file_path() Path[source]

Get the path to the ts-backend-check configuration file.

Checks for both .yaml and .yml extensions, preferring .yaml if both exist.

Returns:
Path

The path to the configuration file (.yaml or .yml).

ts_backend_check.utils.snake_to_camel(input_str: str) str[source]

Convert snake_case to camelCase while preserving existing camelCase components.

Parameters:
input_strstr

The snake_case string to convert.

Returns:
str

The camelCase version of the input string.

Examples

hello_world -> helloWorld alreadyCamelCase -> alreadyCamelCase

ts_backend_check.utils.is_ordered_subset(reference_list: list[Any], candidate_sub_list: list[Any]) bool[source]

Return True if candidate elements appear in the same relative order as they do in the reference.

Parameters:
reference_listlist

The original list to reference.

candidate_sub_listlist

A potential list that has elements that are in the same relative order to the reference.

Returns:
bool

Whether the candidate elements appear in the same relative order as they do in the reference.