code-node-graph 0.3.0__py3-none-any.whl → 0.5.0__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.
- code_node/__init__.py +1 -1
- code_node/analysis/graph.py +151 -8
- code_node/analysis/model.py +45 -0
- code_node/analysis/reader.py +20 -3
- code_node/cli.py +9 -1
- code_node/history.py +151 -0
- code_node/pages.py +6 -2
- code_node/report/build.py +5 -3
- code_node/report/changes.py +42 -0
- code_node/report/graph.py +336 -53
- code_node/report/style.py +40 -4
- code_node/report/walk.py +20 -5
- code_node/serve.py +2 -2
- {code_node_graph-0.3.0.dist-info → code_node_graph-0.5.0.dist-info}/METADATA +2 -1
- {code_node_graph-0.3.0.dist-info → code_node_graph-0.5.0.dist-info}/RECORD +18 -16
- {code_node_graph-0.3.0.dist-info → code_node_graph-0.5.0.dist-info}/WHEEL +0 -0
- {code_node_graph-0.3.0.dist-info → code_node_graph-0.5.0.dist-info}/entry_points.txt +0 -0
- {code_node_graph-0.3.0.dist-info → code_node_graph-0.5.0.dist-info}/licenses/LICENSE +0 -0
code_node/report/walk.py
CHANGED
|
@@ -27,6 +27,7 @@ from ..kit.text import _esc
|
|
|
27
27
|
from ..analysis.findings import _short_name
|
|
28
28
|
from ..analysis.model import CodeFunction, CodeStep
|
|
29
29
|
from ..analysis.syntax import _a
|
|
30
|
+
from .changes import history_html
|
|
30
31
|
from .editor import editor_name, open_at
|
|
31
32
|
from .outline import _NOTE_TIPS, _Outline, _chips_html, _outline_lines
|
|
32
33
|
from .style import _ROOT
|
|
@@ -320,9 +321,12 @@ def _headline(stop: _Stop) -> tuple[str, str]:
|
|
|
320
321
|
return f"Runs {_code(step.code)}", ""
|
|
321
322
|
|
|
322
323
|
|
|
323
|
-
def _says(
|
|
324
|
+
def _says(
|
|
325
|
+
stops: list[_Stop], i: int, first: dict[str, int], docs: dict[str, str], over: bool, changes: dict[str, str]
|
|
326
|
+
) -> str:
|
|
324
327
|
"""
|
|
325
|
-
What the stop's line does, in a sentence or two (HTML), under its headline. over: it has a Skip call button
|
|
328
|
+
What the stop's line does, in a sentence or two (HTML), under its headline. over: it has a Skip call button;
|
|
329
|
+
changes: what git says about each function, as HTML.
|
|
326
330
|
"""
|
|
327
331
|
stop = stops[i]
|
|
328
332
|
step = stop.step
|
|
@@ -335,6 +339,7 @@ def _says(stops: list[_Stop], i: int, first: dict[str, int], docs: dict[str, str
|
|
|
335
339
|
said.append(f"Called from {_code(stop.stack[-2][0])}, line {stops[stop.caller].step.line}{when}.")
|
|
336
340
|
doc = docs.get(step.name, "")
|
|
337
341
|
out = "".join(f"<p>{line}</p>" for line in said) + (f'<p class="wdoc">{_esc(doc)}</p>' if doc else "")
|
|
342
|
+
out += changes.get(step.name, "")
|
|
338
343
|
if step.seen and step.name in first:
|
|
339
344
|
out += (
|
|
340
345
|
f'<p>Its steps are shown where it\'s first called: <label class="wjump" for="cw{first[step.name]}">'
|
|
@@ -414,7 +419,14 @@ def _button(target: int | None, text: str, css: str = "", tip: str = "") -> str:
|
|
|
414
419
|
return f'<label class="{css}" for="cw{target}"{title}>{text}</label>'
|
|
415
420
|
|
|
416
421
|
|
|
417
|
-
def _card_html(
|
|
422
|
+
def _card_html(
|
|
423
|
+
stops: list[_Stop],
|
|
424
|
+
i: int,
|
|
425
|
+
first: dict[str, int],
|
|
426
|
+
docs: dict[str, str],
|
|
427
|
+
editor: str = "",
|
|
428
|
+
changes: dict[str, str] | None = None,
|
|
429
|
+
) -> str:
|
|
418
430
|
"""
|
|
419
431
|
The current stop's card: Back and Next (and Skip call and Finish, past what a line calls), what the line does in
|
|
420
432
|
plain words, the calls it's inside (each a link back to its start), and what it touches.
|
|
@@ -471,7 +483,7 @@ def _card_html(stops: list[_Stop], i: int, first: dict[str, int], docs: dict[str
|
|
|
471
483
|
f'<div class="wc"><div class="wnav">{"".join(nav)}</div>'
|
|
472
484
|
f'<div class="whead">{headline}</div>'
|
|
473
485
|
f'<div class="wstk"><span class="win">In</span>{where}{line}</div>'
|
|
474
|
-
f'<div class="wsay">{_says(stops, i, first, docs, over is not None)}{_facts_html(stop.step, said)}</div>'
|
|
486
|
+
f'<div class="wsay">{_says(stops, i, first, docs, over is not None, changes or {})}{_facts_html(stop.step, said)}</div>'
|
|
475
487
|
+ (f'<div class="wthen">{_esc(then)}</div>' if then else "")
|
|
476
488
|
+ "</div>"
|
|
477
489
|
)
|
|
@@ -600,6 +612,7 @@ def _walk_html(block: _Walk, report: _Report) -> str:
|
|
|
600
612
|
if stop.step.kind == "def" and not stop.step.seen:
|
|
601
613
|
first.setdefault(stop.step.name, i)
|
|
602
614
|
docs = {f.name: f.doc for f in block.functions if f.doc}
|
|
615
|
+
changes = {f.name: history_html(f.history) for f in block.functions if f.history}
|
|
603
616
|
drawn, rows_of = [], []
|
|
604
617
|
for k, frame in enumerate(frames):
|
|
605
618
|
if frame.file in block.sources and frame.file not in highlighted:
|
|
@@ -625,7 +638,9 @@ def _walk_html(block: _Walk, report: _Report) -> str:
|
|
|
625
638
|
if not opened or opened[-1] != stop.frame: # into a call
|
|
626
639
|
out.append('<div class="wfn">')
|
|
627
640
|
opened.append(stop.frame)
|
|
628
|
-
out.append(
|
|
641
|
+
out.append(
|
|
642
|
+
_item_html(stops, i, _card_html(stops, i, first, docs, block.editor, changes), under[i], tuple(above[i]))
|
|
643
|
+
)
|
|
629
644
|
if under[i]: # its fold hides the steps under it, beside it or in the boxes of what it calls
|
|
630
645
|
report.rules.add(f".{root} #cx{i}:checked~.wu{i},.{root} #cx{i}:checked~* .wu{i}{{display:none}}")
|
|
631
646
|
at = rows_of[stop.frame].get(stop.lit)
|
code_node/serve.py
CHANGED
|
@@ -3,8 +3,8 @@ code-node --serve: the page on a local server, made again whenever a .py file (o
|
|
|
3
3
|
under the folder changes, and the browser told to reload (keeping its scroll position, and the tab and step that were
|
|
4
4
|
open). Standard library only: a polling watcher thread, a threaded HTTP server, and Server-Sent Events for the reload.
|
|
5
5
|
|
|
6
|
-
The
|
|
7
|
-
|
|
6
|
+
The served page gets a few lines more than a saved one (_LIVE_SCRIPT), to reload and to say when the server has
|
|
7
|
+
stopped.
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
from __future__ import annotations
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: code-node-graph
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: See how Python code works without running it: a graph of who calls whom from an entry point, and what each path reaches.
|
|
5
5
|
Project-URL: Homepage, https://github.com/utkarsh5026/code-node
|
|
6
6
|
Project-URL: Documentation, https://utkarsh5026.github.io/code-node/
|
|
@@ -117,6 +117,7 @@ string is flagged.
|
|
|
117
117
|
| `-o`, `--out`, `--no-open` | Where to save (default `~/.cache/code-node/`), and whether to open it |
|
|
118
118
|
| `--platform NAME`, `--lambda` | Run a platform's checks on any entry point |
|
|
119
119
|
| `--editor vscode\|cursor\|none` | Editor the line links open (default `vscode`, WSL-aware) |
|
|
120
|
+
| `--no-git` | Leave out what git says about each function (who changed it last, when, in which commit) |
|
|
120
121
|
|
|
121
122
|
</details>
|
|
122
123
|
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
code_node/__init__.py,sha256=
|
|
1
|
+
code_node/__init__.py,sha256=7ui6Nf9ScMur9W6AvjtcDMAfTIpD3IzfEQxWXajMxBE,1106
|
|
2
2
|
code_node/__main__.py,sha256=0W2bmerF1S96rjlTNJZKVzO4FvVhN6ENzAl451A08sQ,101
|
|
3
|
-
code_node/cli.py,sha256=
|
|
4
|
-
code_node/
|
|
3
|
+
code_node/cli.py,sha256=QaieNNhj6_mQTK653jeAxnraZ4hn6CiKa5ju2gVRGfY,12510
|
|
4
|
+
code_node/history.py,sha256=r8VWn5mU2JlUf98ooxcvzuvR0kahbquR4S7klcGSBqg,5948
|
|
5
|
+
code_node/pages.py,sha256=BweJffESNV-cIKET5pGVp_9edFkGyqhePKIObz0zgi4,3484
|
|
5
6
|
code_node/project.py,sha256=1s6pBwQ-hiEf9v0YzE8b6TETT9E0XBnzQPWGjYDJsnw,16361
|
|
6
|
-
code_node/serve.py,sha256=
|
|
7
|
+
code_node/serve.py,sha256=4yvzDaaL1XpsVinLmvlm1W2bM6WJRGe5GI8wG3XuHic,11456
|
|
7
8
|
code_node/analysis/__init__.py,sha256=-KM77rYv9pPutUG29DsU8ZkAUtr2AU9RsqrDPFAjLoQ,103
|
|
8
9
|
code_node/analysis/aws_model.py,sha256=R2sHppdu9PmlsOGDXf6_6JHumbA5PqbiJ0JgnyB9Xcs,6648
|
|
9
10
|
code_node/analysis/findings.py,sha256=S1-VQ1iNi1PkC-2eigNzbJrULa_2Y46avmtwAlV9iqU,19010
|
|
10
|
-
code_node/analysis/graph.py,sha256=
|
|
11
|
+
code_node/analysis/graph.py,sha256=loAGXJI0bTMr8s5q6yCm613XOQd1MvE8gHOsIg-NVuo,39503
|
|
11
12
|
code_node/analysis/mapping.py,sha256=6wYkUqaQdM-Vio8XGf_Lw8N9dP_90YtbUxauH4IQ8Tg,5102
|
|
12
|
-
code_node/analysis/model.py,sha256=
|
|
13
|
-
code_node/analysis/reader.py,sha256=
|
|
13
|
+
code_node/analysis/model.py,sha256=seGMKyJ-r24QubK6iHQUIfMEUQ9ADzw70uFaIRj70Gc,15269
|
|
14
|
+
code_node/analysis/reader.py,sha256=QIqVN2RV477ON69_5YVLXhfnfL3seS8kvP7krpmZPNI,89304
|
|
14
15
|
code_node/analysis/syntax.py,sha256=wyeUr68IDjGp3i9HYYYzcjw8-CvL6a6mmZdWz5LY8j8,7952
|
|
15
16
|
code_node/analysis/terms.py,sha256=ec0f51DkfDRixJSRX1hnyq9Hr5aLRhXuBRHlNJBlZD8,13782
|
|
16
17
|
code_node/deploys/__init__.py,sha256=QEH2oQNPACPekg6QSBpfSbqkuhrdNDpelhn_VaY0RNs,11572
|
|
@@ -32,13 +33,14 @@ code_node/platforms/aws_lambda.py,sha256=IoYxJ2IPNkuxXMWSRK5mxaaDtmKQsyq7Q1EkXCp
|
|
|
32
33
|
code_node/platforms/web.py,sha256=lNjwkz3D0zJkFcJhqD_ShcfTj4uF8miLNqKMtXu-t1U,11762
|
|
33
34
|
code_node/report/__init__.py,sha256=l3dfZFbLEo-7Fl7O_Rk2lvyAElQnyugSZPI_PzHrG_Q,76
|
|
34
35
|
code_node/report/brands.py,sha256=n32BfFz2d02ZVUHvy8L4wPHBtiD_1FCTKzdR4NyvU88,8372
|
|
35
|
-
code_node/report/build.py,sha256=
|
|
36
|
+
code_node/report/build.py,sha256=xnPK_6FMTSV2nyS-N6KcApdq3ZNBA_0Hy8AUZDVIea0,4884
|
|
37
|
+
code_node/report/changes.py,sha256=y5defOCfaAv9kMvd8sNGuGznwVG5zfXKn_c58_B-hEo,1942
|
|
36
38
|
code_node/report/editor.py,sha256=TRUX6BTB-oe-m5Vf3xM9PppnC99sCLL4PObXkYAGKoU,1466
|
|
37
|
-
code_node/report/graph.py,sha256=
|
|
39
|
+
code_node/report/graph.py,sha256=7vv-2F6AOi5cM3dBGwm1GLT3aAt5Dc8g3MS0mwrtgLA,80605
|
|
38
40
|
code_node/report/outline.py,sha256=3RRxU4FMUZKBVjFDsscKZkvDlj_W4ZeW4DwUztg4wd0,8539
|
|
39
|
-
code_node/report/style.py,sha256=
|
|
41
|
+
code_node/report/style.py,sha256=8Z0D60s0Vd7MomL4uWV_GlkBXsJyhwRkjHPSnAF8zCg,38636
|
|
40
42
|
code_node/report/tabs.py,sha256=K2XR16owfgEL1kfux61PI9nBcRsgjQurTx1ptMM5Mac,3016
|
|
41
|
-
code_node/report/walk.py,sha256=
|
|
43
|
+
code_node/report/walk.py,sha256=xPQCWSfE8XnV5yMzSw5MzXH88-xRgHIalbiO2OHz9Ao,29828
|
|
42
44
|
code_node/report/logos/README.md,sha256=8Evw8eApl_56QJrwY7LAtGgJMZE0mp0-HIpRz9bu1ME,613
|
|
43
45
|
code_node/report/logos/anthropic-icon.svg,sha256=-_25zx86lfDTm-ksVXkLE4uQ_ldzLbTd3U0z-wjT-JA,302
|
|
44
46
|
code_node/report/logos/aws-amplify.svg,sha256=62WXM0XCn4WrQYWcVZFz4ln62xidiqF8eO4ELlgO8hg,531
|
|
@@ -171,8 +173,8 @@ code_node/report/logos/small/aws-systems-manager.svg,sha256=9VzzFdTjaRZO9ulR8Ulp
|
|
|
171
173
|
code_node/report/logos/small/aws-timestream.svg,sha256=yKdKIj7pbooFqDKClEQxW9h7dYV5mnDn0RCHnLUDf8Q,639
|
|
172
174
|
code_node/report/logos/small/aws-waf.svg,sha256=l9ZzBZAl2g8bK1-m6A50ga37l5g1t-9Mj70bxWDykWE,591
|
|
173
175
|
code_node/report/logos/small/aws-xray.svg,sha256=VKg_QtKGZKDCbZvKBRDn7eReuNVbJpduBUVV8MQrZZU,591
|
|
174
|
-
code_node_graph-0.
|
|
175
|
-
code_node_graph-0.
|
|
176
|
-
code_node_graph-0.
|
|
177
|
-
code_node_graph-0.
|
|
178
|
-
code_node_graph-0.
|
|
176
|
+
code_node_graph-0.5.0.dist-info/METADATA,sha256=orlGcH8jtm6pXZmpXTyjWuhUeRWCPWs07cPaJFEZB4A,7725
|
|
177
|
+
code_node_graph-0.5.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
178
|
+
code_node_graph-0.5.0.dist-info/entry_points.txt,sha256=eEArp-uk7ZzODIWr6l62rI0-mIA0-mLDaqJEyKikPJw,49
|
|
179
|
+
code_node_graph-0.5.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
180
|
+
code_node_graph-0.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|