Skip to content

Commit cf18bfc

Browse files
committed
Add a files and pathlib example
Teaches Path joining, whole-file and line-by-line text I/O, directory listing and the missing-file boundary inside a temporary directory. The program was run in the local Worker sandbox and matches its expected output. Adds the page's figure, registry scores, journey placement and social card. Social cards were re-rasterised because every figure's SVG now carries its intrinsic width for the phone layout. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4DAa9EdQbgyvwGUWyEBAc
1 parent 6b65288 commit cf18bfc

133 files changed

Lines changed: 350 additions & 128 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/quality-registries.toml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ journey = "shapes"
389389
section = "Cross text and data boundaries."
390390
support = [
391391
"number-parsing",
392+
"files-and-pathlib",
392393
"json",
393394
"regular-expressions",
394395
"datetime",
@@ -908,6 +909,11 @@ kind = "example"
908909
value = "number-parsing"
909910
description = "turn text into numbers safely"
910911

912+
[[journeys.sections.items]]
913+
kind = "example"
914+
value = "files-and-pathlib"
915+
description = "read and write text files through `Path` objects"
916+
911917
[[journeys.sections.items]]
912918
kind = "example"
913919
value = "json"
@@ -1740,6 +1746,12 @@ anchor = "cell-0"
17401746
figure = "datetime-instant"
17411747
caption = "An aware datetime carries a UTC offset; one instant in time reads differently on two clocks."
17421748

1749+
[[figure_attachments]]
1750+
slug = "files-and-pathlib"
1751+
anchor = "cell-0"
1752+
figure = "path-tree"
1753+
caption = "Each `Path` names one place in the directory tree; `/` steps down one level per name."
1754+
17431755
[[figure_attachments]]
17441756
slug = "json"
17451757
anchor = "cell-0"
@@ -2403,6 +2415,11 @@ slug = "regular-expressions"
24032415
score = 9.0
24042416
comment = "the cell's pattern with both capture groups dropped onto Ada: 10; one-move 0.75 and restraint 0.75 for two rows plus two drops; 1.5/1/0.75/1/1 · 1/1/0.75 · 1/0.5"
24052417

2418+
[[example_figure_scores]]
2419+
slug = "files-and-pathlib"
2420+
score = 9.0
2421+
comment = "the page's own tree with the two paths the cells build; containment hairlines, dashed path-to-place links, no accent"
2422+
24062423
[[example_figure_scores]]
24072424
slug = "json"
24082425
score = 9.0
@@ -3300,6 +3317,11 @@ slug = "custom-exceptions"
33003317
score = 9.0
33013318
comment = "domain error naming, raise point, recovery boundary"
33023319

3320+
[[example_quality_scores]]
3321+
slug = "files-and-pathlib"
3322+
score = 9.0
3323+
comment = "path vs file distinction, whole-file and line-by-line reading, directory listing, missing-file boundary; all cells run in the sandbox"
3324+
33033325
[[example_quality_scores]]
33043326
slug = "json"
33053327
score = 9.0

‎public/og/about.jpg‎

1.91 KB
2.11 KB
1.94 KB

‎public/og/args-and-kwargs.jpg‎

1.95 KB

‎public/og/assertions.jpg‎

1.61 KB
2.2 KB

‎public/og/async-await.jpg‎

2.01 KB
2.7 KB

‎public/og/attribute-access.jpg‎

1.96 KB

0 commit comments

Comments
 (0)