2023-12-22 20:37:39 -04:00
|
|
|
from typing import Final
|
|
|
|
|
2023-12-27 17:43:19 -04:00
|
|
|
from .errors import (
|
|
|
|
ClinicError,
|
2024-03-14 05:07:01 -03:00
|
|
|
warn,
|
|
|
|
fail,
|
2023-12-27 17:43:19 -04:00
|
|
|
)
|
2023-12-22 20:37:39 -04:00
|
|
|
from .formatting import (
|
2023-12-23 13:08:10 -04:00
|
|
|
SIG_END_MARKER,
|
2023-12-22 20:37:39 -04:00
|
|
|
c_repr,
|
|
|
|
docstring_for_c_string,
|
2023-12-23 13:08:10 -04:00
|
|
|
format_escape,
|
2023-12-22 20:37:39 -04:00
|
|
|
indent_all_lines,
|
2024-02-15 18:52:20 -04:00
|
|
|
linear_format,
|
2023-12-23 13:08:10 -04:00
|
|
|
normalize_snippet,
|
2023-12-22 20:37:39 -04:00
|
|
|
pprint_words,
|
|
|
|
suffix_all_lines,
|
2023-12-23 13:08:10 -04:00
|
|
|
wrap_declarations,
|
2023-12-22 20:37:39 -04:00
|
|
|
wrapped_c_string_literal,
|
|
|
|
)
|
2024-02-16 02:42:15 -04:00
|
|
|
from .identifiers import (
|
|
|
|
ensure_legal_c_identifier,
|
|
|
|
is_legal_c_identifier,
|
|
|
|
is_legal_py_identifier,
|
|
|
|
)
|
2024-01-14 14:26:09 -04:00
|
|
|
from .utils import (
|
2024-01-14 19:09:26 -04:00
|
|
|
FormatCounterFormatter,
|
2024-04-02 07:09:53 -03:00
|
|
|
NULL,
|
|
|
|
Null,
|
|
|
|
Sentinels,
|
|
|
|
VersionTuple,
|
2024-01-14 14:26:09 -04:00
|
|
|
compute_checksum,
|
2024-01-14 19:09:26 -04:00
|
|
|
create_regex,
|
2024-03-14 11:37:22 -03:00
|
|
|
unknown,
|
2024-04-02 07:09:53 -03:00
|
|
|
unspecified,
|
|
|
|
write_file,
|
2024-01-14 14:26:09 -04:00
|
|
|
)
|
2023-12-22 20:37:39 -04:00
|
|
|
|
|
|
|
|
|
|
|
__all__ = [
|
2023-12-27 17:43:19 -04:00
|
|
|
# Error handling
|
|
|
|
"ClinicError",
|
2024-03-14 05:07:01 -03:00
|
|
|
"warn",
|
|
|
|
"fail",
|
2023-12-27 17:43:19 -04:00
|
|
|
|
2023-12-22 20:37:39 -04:00
|
|
|
# Formatting helpers
|
2023-12-23 13:08:10 -04:00
|
|
|
"SIG_END_MARKER",
|
2023-12-22 20:37:39 -04:00
|
|
|
"c_repr",
|
|
|
|
"docstring_for_c_string",
|
2023-12-23 13:08:10 -04:00
|
|
|
"format_escape",
|
2023-12-22 20:37:39 -04:00
|
|
|
"indent_all_lines",
|
2024-02-15 18:52:20 -04:00
|
|
|
"linear_format",
|
2023-12-23 13:08:10 -04:00
|
|
|
"normalize_snippet",
|
2023-12-22 20:37:39 -04:00
|
|
|
"pprint_words",
|
|
|
|
"suffix_all_lines",
|
2023-12-23 13:08:10 -04:00
|
|
|
"wrap_declarations",
|
2023-12-22 20:37:39 -04:00
|
|
|
"wrapped_c_string_literal",
|
2024-01-14 14:26:09 -04:00
|
|
|
|
2024-02-16 02:42:15 -04:00
|
|
|
# Identifier helpers
|
|
|
|
"ensure_legal_c_identifier",
|
|
|
|
"is_legal_c_identifier",
|
|
|
|
"is_legal_py_identifier",
|
|
|
|
|
2024-01-14 14:26:09 -04:00
|
|
|
# Utility functions
|
2024-01-14 19:09:26 -04:00
|
|
|
"FormatCounterFormatter",
|
2024-04-02 07:09:53 -03:00
|
|
|
"NULL",
|
|
|
|
"Null",
|
|
|
|
"Sentinels",
|
|
|
|
"VersionTuple",
|
2024-01-14 14:26:09 -04:00
|
|
|
"compute_checksum",
|
2024-01-14 19:09:26 -04:00
|
|
|
"create_regex",
|
2024-03-14 11:37:22 -03:00
|
|
|
"unknown",
|
2024-04-02 07:09:53 -03:00
|
|
|
"unspecified",
|
|
|
|
"write_file",
|
2023-12-22 20:37:39 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
CLINIC_PREFIX: Final = "__clinic_"
|
|
|
|
CLINIC_PREFIXED_ARGS: Final = frozenset(
|
|
|
|
{
|
|
|
|
"_keywords",
|
|
|
|
"_parser",
|
|
|
|
"args",
|
|
|
|
"argsbuf",
|
|
|
|
"fastargs",
|
|
|
|
"kwargs",
|
|
|
|
"kwnames",
|
|
|
|
"nargs",
|
|
|
|
"noptargs",
|
|
|
|
"return_value",
|
|
|
|
}
|
|
|
|
)
|