utils¶
Utility functions for turtle-canon
CLI.
Cache
¶
Small cache.
Source code in turtle_canon/cli/utils.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
errors: list[str | Exception]
property
¶
Get errors
attribute.
files: list[str | Path]
property
¶
Get files
attribute.
warnings: list[str | Exception]
property
¶
Get warnings
attribute.
add_error(error)
¶
Add an error to the cache.
Source code in turtle_canon/cli/utils.py
37 38 39 40 41 |
|
add_file(file)
¶
Add a file to the cache.
Source code in turtle_canon/cli/utils.py
49 50 51 52 53 |
|
add_warning(warning)
¶
Add a warning to the cache.
Source code in turtle_canon/cli/utils.py
43 44 45 46 47 |
|
print_changed_files(files, exit_after=False)
¶
Print list of changed files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
files | Sequence[str | Path] | List of files with changes. | required |
exit_after | bool | Whether or not to call | False |
Source code in turtle_canon/cli/utils.py
146 147 148 149 150 151 152 153 154 155 156 157 |
|
print_error(message, exit_after=True)
¶
Print an error message to the console.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message | str | Exception | The error message to print. | required |
exit_after | bool | Whether or not to call | True |
Source code in turtle_canon/cli/utils.py
79 80 81 82 83 84 85 86 87 88 89 90 |
|
print_summary(errors=None, warnings=None, exit_after=False)
¶
Print a summary, including of error and/or warning messages.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
errors | Sequence[str | Exception] | None | List of error messages. | None |
warnings | Sequence[str | Exception] | None | List of warning messages. | None |
exit_after | bool | Whether or not to call | False |
Source code in turtle_canon/cli/utils.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
print_warning(message, exit_after=False)
¶
Print a warnings message to the console.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message | str | Exception | The warning message to print. | required |
exit_after | bool | Whether or not to call | False |
Source code in turtle_canon/cli/utils.py
93 94 95 96 97 98 99 100 101 102 103 104 |
|