utils¶
analysis_helpers.utils
¶
run_command(command, input_text=None)
¶
Execute a shell command and return the completed subprocess result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
the shell command to execute |
required |
input_text
|
str
|
the input text to the command. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
|
subprocess.CompletedProcess: completed subprocess result with captured output. |
Raises:
| Type | Description |
|---|---|
CalledProcessError
|
if the command exits with a non-zero status. |
Source code in src/analysis_helpers/utils.py
get_temporary_file_name()
¶
Creates a temporary file name
Returns:
| Name | Type | Description |
|---|---|---|
str |
the temporary file name |
get_matching_files(directory, pattern)
¶
Get all files in the directory matching the given pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str
|
The directory to search. |
required |
pattern
|
str
|
The pattern to match files. |
required |
Returns: list: List of matching file paths.