codeplain 0.3.11.dev6__py3-none-any.whl → 0.3.11.dev7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codeplain-0.3.11.dev6.dist-info → codeplain-0.3.11.dev7.dist-info}/METADATA +1 -1
- {codeplain-0.3.11.dev6.dist-info → codeplain-0.3.11.dev7.dist-info}/RECORD +7 -7
- plain2code_console.py +5 -4
- tests/test_console_log_styles.py +61 -5
- {codeplain-0.3.11.dev6.dist-info → codeplain-0.3.11.dev7.dist-info}/WHEEL +0 -0
- {codeplain-0.3.11.dev6.dist-info → codeplain-0.3.11.dev7.dist-info}/entry_points.txt +0 -0
- {codeplain-0.3.11.dev6.dist-info → codeplain-0.3.11.dev7.dist-info}/licenses/LICENSE +0 -0
|
@@ -13,7 +13,7 @@ partial_rendering.py,sha256=uzZc2j4d3pAXzfiHw_y1TK4yLRsLOb1Mm21570AGxJ8,13837
|
|
|
13
13
|
path_resolution.py,sha256=0tMqU0a1g4DYhTOp7QjLVSEkv_cgasb4NI1mK809dUM,2233
|
|
14
14
|
plain2code.py,sha256=v8xBTv3mQjntpBTBJUvl5naGnSPFAzhEQTqpeRr40ow,18072
|
|
15
15
|
plain2code_arguments.py,sha256=xMK-R13Vu005bHz3MUDY8F0Cf3ED9hCPqNsC6jGZmkk,17620
|
|
16
|
-
plain2code_console.py,sha256=
|
|
16
|
+
plain2code_console.py,sha256=YGBONkQtwZUkrjxTKhqcBoRzW0EmSfYHPH8P4_FM60I,6040
|
|
17
17
|
plain2code_events.py,sha256=rgDF5PDtNr_lEPvJmd1tIQXZrzwgzZW5b-_pykugqe4,1587
|
|
18
18
|
plain2code_exceptions.py,sha256=rtFEQbs1ruzSlGXIGJZoZry9sjYzmhPKHiUQIECcbL0,2567
|
|
19
19
|
plain2code_logger.py,sha256=YQ-ENYBHKXROVv6Q52xh7eXrFkj_3Lex__N9zfxlw9Y,5729
|
|
@@ -73,7 +73,7 @@ tests/test_arg_provenance.py,sha256=d_J7aCeHMXBpctBWTt60WU-I8pEKN7XRXRTJZZGCdo0,
|
|
|
73
73
|
tests/test_change_detection.py,sha256=jH8SEhndX400DNqIKmcYLzxHqq9WFdgmuvY3XPq-ZFc,13534
|
|
74
74
|
tests/test_cli_output.py,sha256=ZV2F1NNW4EiZvMNkhF9XUZH6bFJbddfkZof5qAFxe3Y,18885
|
|
75
75
|
tests/test_conformance_fix_journal.py,sha256=olTeAuxXgFwQ8LSQyt0FqtBy9_XY_gK-Ei_pUuJ0C3M,10389
|
|
76
|
-
tests/test_console_log_styles.py,sha256=
|
|
76
|
+
tests/test_console_log_styles.py,sha256=sxlhynMAP-kmqhBn1-pKvZXdCnlKSyCGJqwYKrh6sQ0,6468
|
|
77
77
|
tests/test_distill_conformance_test_memory.py,sha256=Tftw9l-gLVwIU6QttY03h2VedvuFxpIsCmZIzvWfxMA,5481
|
|
78
78
|
tests/test_dry_run_link_validation.py,sha256=ivvYXQPqUkQ8glbFyUrdCninCxF2mg-rAsDcfjcB7MM,2140
|
|
79
79
|
tests/test_file_utils.py,sha256=R_ZIhrTtwlhHxgmbBtA8PFEU5-QB4Fi5skJ7PS2KzdU,3614
|
|
@@ -112,8 +112,8 @@ tui/spinner.py,sha256=Ro6Gd9Przf-whuHqPRY6HwI0T57yJjyNPbhDbigZKZE,2471
|
|
|
112
112
|
tui/state_handlers.py,sha256=zbUS_D9eU8qIwVpaxPEp9zL9bpg8gXsWNoUaqg9TLrQ,16664
|
|
113
113
|
tui/styles.css,sha256=kiC7Og_2G1E7owoiZgV95-3_dSeQnsNj3qzaY04xkDg,6727
|
|
114
114
|
tui/widget_helpers.py,sha256=ToO9MV2bF2Rp-XMNcjIYclnB_qmgO5sLw4UtQ2CyTMg,6652
|
|
115
|
-
codeplain-0.3.11.
|
|
116
|
-
codeplain-0.3.11.
|
|
117
|
-
codeplain-0.3.11.
|
|
118
|
-
codeplain-0.3.11.
|
|
119
|
-
codeplain-0.3.11.
|
|
115
|
+
codeplain-0.3.11.dev7.dist-info/METADATA,sha256=cyrR7snbiTlm3GwkuZsy9kCiuL_K1rYNKHQBQPX_s7E,7256
|
|
116
|
+
codeplain-0.3.11.dev7.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
117
|
+
codeplain-0.3.11.dev7.dist-info/entry_points.txt,sha256=oDZkBqu9WhtZApb_K6ia8-fn9aojwmAsgnKELceX5T4,46
|
|
118
|
+
codeplain-0.3.11.dev7.dist-info/licenses/LICENSE,sha256=pCeKgQ1mXE5OmNUuKOfOZh1T1vqkeCUxghE7N8qgnzc,11345
|
|
119
|
+
codeplain-0.3.11.dev7.dist-info/RECORD,,
|
plain2code_console.py
CHANGED
|
@@ -27,7 +27,7 @@ class Plain2CodeConsole(Console):
|
|
|
27
27
|
DEBUG_STYLE = Style(color="purple")
|
|
28
28
|
|
|
29
29
|
def __init__(self):
|
|
30
|
-
super().__init__()
|
|
30
|
+
super().__init__(emoji=False)
|
|
31
31
|
try:
|
|
32
32
|
import tiktoken
|
|
33
33
|
|
|
@@ -66,9 +66,10 @@ class Plain2CodeConsole(Console):
|
|
|
66
66
|
"""
|
|
67
67
|
logger.log(level, " ".join(map(str, args)), extra={"log_color": color})
|
|
68
68
|
style = base_style + Style(color=color) if color else base_style
|
|
69
|
-
#
|
|
70
|
-
# in interpolated content (error texts, file names)
|
|
71
|
-
#
|
|
69
|
+
# Messages must render exactly as logged and not pick its own styling:
|
|
70
|
+
# -- no Rich markup (via square brackets) in interpolated content (error texts, file names)
|
|
71
|
+
# -- no repr highlighter restyling brackets and numbers inside them.
|
|
72
|
+
# -- no emoji substitution, but it's set False in __init__, otherwise it won't reach renderables like Trees
|
|
72
73
|
kwargs.setdefault("markup", False)
|
|
73
74
|
kwargs.setdefault("highlight", False)
|
|
74
75
|
super().print(*args, **kwargs, style=style)
|
tests/test_console_log_styles.py
CHANGED
|
@@ -70,14 +70,70 @@ class TestConsoleColorParam:
|
|
|
70
70
|
|
|
71
71
|
assert handler.records[0].log_color is None
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
|
|
74
|
+
class TestTerminalTextRendersVerbatim:
|
|
75
|
+
"""
|
|
76
|
+
Message text must reach the terminal unchanged, and must not influence its own
|
|
77
|
+
styling. Colors are still applied but they are chosen by the call, never parsed
|
|
78
|
+
out of the text:
|
|
79
|
+
- Rich markup tags must not be interpreted
|
|
80
|
+
- the repr highlighter must not restyle brackets and numbers
|
|
81
|
+
- emoji shortcodes must not be substituted by glyphs
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
def test_markup_closing_tag_prints_verbatim(self):
|
|
85
|
+
console = Plain2CodeConsole()
|
|
76
86
|
with console.capture() as capture:
|
|
77
|
-
console.
|
|
78
|
-
|
|
87
|
+
console.error("Error: [/closing] tag")
|
|
88
|
+
# markup=True raises MarkupError on an unmatched closing tag
|
|
79
89
|
assert "[/closing]" in capture.get()
|
|
80
90
|
|
|
91
|
+
def test_markup_style_tag_prints_verbatim(self):
|
|
92
|
+
console = Plain2CodeConsole()
|
|
93
|
+
with console.capture() as capture:
|
|
94
|
+
console.error("Error: [bold]important text")
|
|
95
|
+
# markup=True silently consumes the tag and styles the rest
|
|
96
|
+
assert "[bold]" in capture.get()
|
|
97
|
+
|
|
98
|
+
def test_bracketed_number_prints_verbatim(self, monkeypatch):
|
|
99
|
+
# Rich emits no ANSI unless it believes it is writing to a colored terminal
|
|
100
|
+
# (FORCE_COLOR alone is not enough: TERM=dumb still resolves to no colors)
|
|
101
|
+
monkeypatch.setenv("FORCE_COLOR", "1")
|
|
102
|
+
monkeypatch.setenv("TERM", "xterm-256color")
|
|
103
|
+
console = Plain2CodeConsole()
|
|
104
|
+
assert console.color_system is not None # should fail test immediately if no colors
|
|
105
|
+
|
|
106
|
+
with console.capture() as capture:
|
|
107
|
+
console.error("Error: [Errno 8] failed")
|
|
108
|
+
# highlight=True breaks this up with colour codes
|
|
109
|
+
assert "[Errno 8]" in capture.get()
|
|
110
|
+
|
|
111
|
+
def test_concept_name_matching_emoji_prints_verbatim(self):
|
|
112
|
+
console = Plain2CodeConsole()
|
|
113
|
+
with console.capture() as capture:
|
|
114
|
+
console.error("Syntax error: Invalid concept: :Package:")
|
|
115
|
+
assert ":Package:" in capture.get()
|
|
116
|
+
assert "📦" not in capture.get()
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class TestPrintHelpersDoNotSubstituteEmoji:
|
|
120
|
+
"""
|
|
121
|
+
Same rule as TestTerminalTextRendersVerbatim, for the two helpers that bypass _log_and_print.
|
|
122
|
+
Only emoji is covered here, markup and highlighting still apply to them.
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
def test_print_list_does_not_substitute_emoji(self):
|
|
126
|
+
console = Plain2CodeConsole()
|
|
127
|
+
with console.capture() as capture:
|
|
128
|
+
console.print_list(["The :Package: is a concept"])
|
|
129
|
+
assert ":Package:" in capture.get()
|
|
130
|
+
|
|
131
|
+
def test_print_files_does_not_substitute_emoji_in_tree_labels(self):
|
|
132
|
+
console = Plain2CodeConsole()
|
|
133
|
+
with console.capture() as capture:
|
|
134
|
+
console.print_files("Files added:", "build", {":Package:.py": "x"})
|
|
135
|
+
assert ":Package:" in capture.get()
|
|
136
|
+
|
|
81
137
|
|
|
82
138
|
class TestLoggingHandlerForwardsColor:
|
|
83
139
|
"""LoggingHandler must forward the log_color record attribute into LogMessageEmitted."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|