codeplain 0.4.2.dev53__py3-none-any.whl → 0.4.2.dev55__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.4.2.dev53.dist-info → codeplain-0.4.2.dev55.dist-info}/METADATA +1 -1
- {codeplain-0.4.2.dev53.dist-info → codeplain-0.4.2.dev55.dist-info}/RECORD +9 -9
- partial_rendering.py +17 -4
- plain2code.py +4 -3
- plain2code_arguments.py +2 -1
- tests/test_partial_rendering.py +44 -0
- {codeplain-0.4.2.dev53.dist-info → codeplain-0.4.2.dev55.dist-info}/WHEEL +0 -0
- {codeplain-0.4.2.dev53.dist-info → codeplain-0.4.2.dev55.dist-info}/entry_points.txt +0 -0
- {codeplain-0.4.2.dev53.dist-info → codeplain-0.4.2.dev55.dist-info}/licenses/LICENSE +0 -0
|
@@ -10,10 +10,10 @@ git_utils.py,sha256=gCUA6_9zg19f6k_0aVcRnIVlAJSBD0Vt6takx-0pKME,16547
|
|
|
10
10
|
memory_management.py,sha256=CwIOQqF7Xo1sNfvP69zQRK_CpjinQD9dbolhRPl6lTk,2446
|
|
11
11
|
metadata_utils.py,sha256=YO17o7IAma5TT1ZN0pTwrLVr_KxFQ8APv02KqKPpI5k,1641
|
|
12
12
|
module_renderer.py,sha256=OvIgAorSxGwrdTZcKy4hdmNgkdJGh6z6-VzzqrTlRHs,6966
|
|
13
|
-
partial_rendering.py,sha256=
|
|
13
|
+
partial_rendering.py,sha256=7rQu0EE1H8JND-uePovdKfiQHGfdQncDyepwup7QBSY,15742
|
|
14
14
|
path_resolution.py,sha256=0tMqU0a1g4DYhTOp7QjLVSEkv_cgasb4NI1mK809dUM,2233
|
|
15
|
-
plain2code.py,sha256=
|
|
16
|
-
plain2code_arguments.py,sha256=
|
|
15
|
+
plain2code.py,sha256=_xlTyJ-6k03kwPLtYFvyjBctoFsdbIN1btwVnXiaVK0,23944
|
|
16
|
+
plain2code_arguments.py,sha256=2Rgj-FquefqUjLQ4Kld7rc6fwW9SEW7wbb3aKo5H188,20624
|
|
17
17
|
plain2code_console.py,sha256=YGBONkQtwZUkrjxTKhqcBoRzW0EmSfYHPH8P4_FM60I,6040
|
|
18
18
|
plain2code_events.py,sha256=QnugBgO1baTe4kj2V3LUnkMDzhmksKwPDFuOKfH9g5o,1738
|
|
19
19
|
plain2code_exceptions.py,sha256=zlszHIhaPWPN4fvYQibMIDM7f1xsW5J8sEWTOosIUGc,2068
|
|
@@ -94,7 +94,7 @@ tests/test_git_utils.py,sha256=hvNzIYNSFXF4nWpN6HIo4h21zLDCUx8ZmrFp1GR_S70,15721
|
|
|
94
94
|
tests/test_headless_logging.py,sha256=soNESeotKQaU-SQyxtjpq35l-dLVsauZ_lJ-wk9i2mI,6419
|
|
95
95
|
tests/test_log_file_name_resolution.py,sha256=99g9NgPF-BZ98CvNyqDcltBAx4sLBE8gpQPAAieKiPc,3619
|
|
96
96
|
tests/test_logging_config_path_resolution.py,sha256=avz_ehRd18INwIXvAy1AwVzNNUz0vS8eu1nRe0bra8g,2650
|
|
97
|
-
tests/test_partial_rendering.py,sha256=
|
|
97
|
+
tests/test_partial_rendering.py,sha256=54rCzqRJqHgv6PtSS2C_yVebYurXyuJ7sVurNIIAKZ4,25630
|
|
98
98
|
tests/test_path_resolution.py,sha256=yQpd-Unq1lwNv0wkRPwVs5pDT8JmyyDgbpiTQsyt--Y,2615
|
|
99
99
|
tests/test_plain2code.py,sha256=BKLIBOc3tON2fODm1ETdPZZkZMbSrvbIG54EWJcKcmE,3411
|
|
100
100
|
tests/test_plain2code_state.py,sha256=O-sDt4F_lF6XtanWKWfh5IsNmDdfuJP_JoGagujzdfM,1440
|
|
@@ -127,8 +127,8 @@ tui/spinner.py,sha256=Ro6Gd9Przf-whuHqPRY6HwI0T57yJjyNPbhDbigZKZE,2471
|
|
|
127
127
|
tui/state_handlers.py,sha256=5FkF13mCLYAOgpYnzR932U3tYxSnMkCu5jybMFEBVe4,16264
|
|
128
128
|
tui/styles.css,sha256=kiC7Og_2G1E7owoiZgV95-3_dSeQnsNj3qzaY04xkDg,6727
|
|
129
129
|
tui/widget_helpers.py,sha256=jitm2WHiKj-NVFL-hULxWzckPreRbUTl9OIZLN31-ek,6997
|
|
130
|
-
codeplain-0.4.2.
|
|
131
|
-
codeplain-0.4.2.
|
|
132
|
-
codeplain-0.4.2.
|
|
133
|
-
codeplain-0.4.2.
|
|
134
|
-
codeplain-0.4.2.
|
|
130
|
+
codeplain-0.4.2.dev55.dist-info/METADATA,sha256=gPt3JPBUjG9z8ls8esd1nvxLHv9dEOOVSr9VlyeQ9ic,7260
|
|
131
|
+
codeplain-0.4.2.dev55.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
132
|
+
codeplain-0.4.2.dev55.dist-info/entry_points.txt,sha256=oDZkBqu9WhtZApb_K6ia8-fn9aojwmAsgnKELceX5T4,46
|
|
133
|
+
codeplain-0.4.2.dev55.dist-info/licenses/LICENSE,sha256=pCeKgQ1mXE5OmNUuKOfOZh1T1vqkeCUxghE7N8qgnzc,11345
|
|
134
|
+
codeplain-0.4.2.dev55.dist-info/RECORD,,
|
partial_rendering.py
CHANGED
|
@@ -237,7 +237,6 @@ def change_is_only_future_work(
|
|
|
237
237
|
def _resume_render_choice(
|
|
238
238
|
plain_module: PlainModule,
|
|
239
239
|
plain_module_render_state: PlainModuleRenderState,
|
|
240
|
-
force_render: bool,
|
|
241
240
|
) -> RenderChoice:
|
|
242
241
|
"""The natural next step from the last-rendered position when no decision is needed:
|
|
243
242
|
start an unrendered module, continue a partially-rendered one, or advance to the next.
|
|
@@ -261,8 +260,7 @@ def _resume_render_choice(
|
|
|
261
260
|
render_range = plain_spec.get_render_range_from(next_frid, next_module.plain_source)
|
|
262
261
|
return RenderChoice(
|
|
263
262
|
module=next_module,
|
|
264
|
-
render_range=
|
|
265
|
-
wipe_later_modules=force_render,
|
|
263
|
+
render_range=render_range,
|
|
266
264
|
choice_type="continue_from_frid",
|
|
267
265
|
)
|
|
268
266
|
|
|
@@ -280,6 +278,21 @@ def get_render_choices(
|
|
|
280
278
|
plain_module_render_state: PlainModuleRenderState,
|
|
281
279
|
force_render: bool = False,
|
|
282
280
|
) -> dict[str, RenderChoice]:
|
|
281
|
+
if force_render:
|
|
282
|
+
# --force-render re-renders the whole chain from the first module, whatever changed and
|
|
283
|
+
# wherever the last render stopped. There is nothing to decide, so a single choice is
|
|
284
|
+
# returned and the user is not asked.
|
|
285
|
+
first_module = plain_module.all_required_modules[0] if plain_module.all_required_modules else plain_module
|
|
286
|
+
return {
|
|
287
|
+
"1": RenderChoice(
|
|
288
|
+
module=first_module,
|
|
289
|
+
render_range=None,
|
|
290
|
+
choice_type="rerender_from_first",
|
|
291
|
+
wipe_later_modules=True,
|
|
292
|
+
is_destructive=True,
|
|
293
|
+
)
|
|
294
|
+
}
|
|
295
|
+
|
|
283
296
|
render_choices = list[RenderChoice]()
|
|
284
297
|
module_start_points = list[str]()
|
|
285
298
|
|
|
@@ -298,7 +311,7 @@ def get_render_choices(
|
|
|
298
311
|
# Continue / resume from the last-rendered position. The change-driven blocks below decide
|
|
299
312
|
# the start otherwise — once a change touches already-rendered work, resuming from the old
|
|
300
313
|
# position would build on stale code.
|
|
301
|
-
render_choices.append(_resume_render_choice(plain_module, plain_module_render_state
|
|
314
|
+
render_choices.append(_resume_render_choice(plain_module, plain_module_render_state))
|
|
302
315
|
|
|
303
316
|
else:
|
|
304
317
|
# change is set here (otherwise treat_as_continue would be True), so change_type is always
|
plain2code.py
CHANGED
|
@@ -375,10 +375,11 @@ def render( # noqa: C901
|
|
|
375
375
|
render_choices = get_render_choices(plain_module, plain_module_render_state, args.force_render)
|
|
376
376
|
ask_user = True
|
|
377
377
|
render_choice = None
|
|
378
|
-
if len(render_choices) <= 2:
|
|
379
|
-
#
|
|
378
|
+
if args.force_render or len(render_choices) <= 2:
|
|
379
|
+
# With --force-render there is a single choice. Otherwise the last choice is Quit,
|
|
380
|
+
# so the first choice is the only other actionable one.
|
|
380
381
|
render_choice = render_choices[list(render_choices.keys())[0]]
|
|
381
|
-
ask_user = render_choice.is_destructive
|
|
382
|
+
ask_user = render_choice.is_destructive and not args.force_render
|
|
382
383
|
|
|
383
384
|
if ask_user and not args.headless:
|
|
384
385
|
app = PlainModuleRenderChoiceTUI(
|
plain2code_arguments.py
CHANGED
|
@@ -352,7 +352,8 @@ def create_parser():
|
|
|
352
352
|
"--force-render",
|
|
353
353
|
action="store_true",
|
|
354
354
|
default=False,
|
|
355
|
-
help="
|
|
355
|
+
help="Render every module of the project again, from the first one. "
|
|
356
|
+
"The client does not ask where to start and the code rendered before is replaced.",
|
|
356
357
|
)
|
|
357
358
|
|
|
358
359
|
_add_arg(
|
tests/test_partial_rendering.py
CHANGED
|
@@ -569,6 +569,50 @@ def test_render_choices_always_ends_with_quit():
|
|
|
569
569
|
assert choices[last_key].module is None
|
|
570
570
|
|
|
571
571
|
|
|
572
|
+
# --- Block 3: --force-render leaves nothing to choose ---
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
def test_render_choices_force_render_rerenders_whole_chain_without_a_choice():
|
|
576
|
+
"""--force-render renders the whole chain again from the first module, so a single,
|
|
577
|
+
non-interactive choice is returned (no Quit, because the user is never asked)."""
|
|
578
|
+
root, _, leaf = _build_choices_tree(fully_rendered=True)
|
|
579
|
+
pr = PlainModuleRenderState(last_render_module=root, last_render_frid="fr-e")
|
|
580
|
+
|
|
581
|
+
choices = get_render_choices(root, pr, force_render=True)
|
|
582
|
+
|
|
583
|
+
assert _choice_types(choices) == ["rerender_from_first"]
|
|
584
|
+
assert choices["1"].module is leaf
|
|
585
|
+
assert choices["1"].render_range is None
|
|
586
|
+
assert choices["1"].wipe_later_modules is True
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
def test_render_choices_force_render_ignores_a_detected_change(monkeypatch):
|
|
590
|
+
"""A change that would otherwise be offered as a partial render is ignored: the chain is
|
|
591
|
+
rendered again from the first module."""
|
|
592
|
+
root, middle, leaf = _build_choices_tree(fully_rendered=True)
|
|
593
|
+
monkeypatch.setattr(
|
|
594
|
+
partial_rendering, "determine_partial_render_start", lambda pm: PartialRenderStart(module=middle, frid="fr-c")
|
|
595
|
+
)
|
|
596
|
+
pr = PlainModuleRenderState(
|
|
597
|
+
last_render_module=root, last_render_frid="fr-e", change=middle, change_type="spec_change"
|
|
598
|
+
)
|
|
599
|
+
|
|
600
|
+
choices = get_render_choices(root, pr, force_render=True)
|
|
601
|
+
|
|
602
|
+
assert _choice_types(choices) == ["rerender_from_first"]
|
|
603
|
+
assert choices["1"].module is leaf
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
def test_render_choices_force_render_on_a_module_without_required_modules():
|
|
607
|
+
root = FakeModule("root", fully_rendered=True)
|
|
608
|
+
pr = PlainModuleRenderState(last_render_module=root, last_render_frid="fr-e")
|
|
609
|
+
|
|
610
|
+
choices = get_render_choices(root, pr, force_render=True)
|
|
611
|
+
|
|
612
|
+
assert _choice_types(choices) == ["rerender_from_first"]
|
|
613
|
+
assert choices["1"].module is root
|
|
614
|
+
|
|
615
|
+
|
|
572
616
|
# -------------------------
|
|
573
617
|
# change_is_only_future_work
|
|
574
618
|
# -------------------------
|
|
File without changes
|
|
File without changes
|
|
File without changes
|