Debian Codegraph @

Tools/clinic/libclinic/__init__.py

raw
1 from typing import Final
2
3 from .errors import (
4 ClinicError,
5 warn,
6 fail,
7 )
8 from .formatting import (
9 SIG_END_MARKER,
10 c_repr,
11 docstring_for_c_string,
12 format_escape,
13 indent_all_lines,
14 linear_format,
15 normalize_snippet,
16 pprint_words,
17 suffix_all_lines,
18 wrap_declarations,
19 wrapped_c_string_literal,
20 )
21 from .identifiers import (
22 ensure_legal_c_identifier,
23 is_legal_c_identifier,
24 is_legal_py_identifier,
25 )
26 from .utils import (
27 FileChange,
28 FileWriter,
29 FormatCounterFormatter,
30 NULL,
31 Null,
32 Sentinels,
33 VersionTuple,
34 compute_checksum,
35 create_regex,
36 read_file,
37 unknown,
38 unspecified,
39 write_file,
40 )
41
42
43 __all__ = [
44 # Error handling
45 "ClinicError",
46 "warn",
47 "fail",
48
49 # Formatting helpers
50 "SIG_END_MARKER",
51 "c_repr",
52 "docstring_for_c_string",
53 "format_escape",
54 "indent_all_lines",
55 "linear_format",
56 "normalize_snippet",
57 "pprint_words",
58 "suffix_all_lines",
59 "wrap_declarations",
60 "wrapped_c_string_literal",
61
62 # Identifier helpers
63 "ensure_legal_c_identifier",
64 "is_legal_c_identifier",
65 "is_legal_py_identifier",
66
67 # Utility functions
68 "FileChange",
69 "FileWriter",
70 "FormatCounterFormatter",
71 "NULL",
72 "Null",
73 "Sentinels",
74 "VersionTuple",
75 "compute_checksum",
76 "create_regex",
77 "read_file",
78 "unknown",
79 "unspecified",
80 "write_file",
81 ]
82
83
84 CLINIC_PREFIX: Final = "__clinic_"
85 CLINIC_PREFIXED_ARGS: Final = frozenset(
86 {
87 "_keywords",
88 "_parser",
89 "args",
90 "argsbuf",
91 "fastargs",
92 "kwargs",
93 "kwnames",
94 "nargs",
95 "noptargs",
96 "return_value",
97 }
98 )