ectype-data 0.1.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.
Files changed (115) hide show
  1. ectype/__init__.py +134 -0
  2. ectype/_version.py +5 -0
  3. ectype/authoring/__init__.py +13 -0
  4. ectype/authoring/builder.py +134 -0
  5. ectype/authoring/spec.py +555 -0
  6. ectype/calibration/__init__.py +26 -0
  7. ectype/calibration/adjustments.py +539 -0
  8. ectype/calibration/calibrator.py +781 -0
  9. ectype/cli.py +1181 -0
  10. ectype/compiler/__init__.py +1 -0
  11. ectype/compiler/plan.py +678 -0
  12. ectype/errors.py +43 -0
  13. ectype/fingerprint/__init__.py +1 -0
  14. ectype/fingerprint/comparison.py +746 -0
  15. ectype/fingerprint/container.py +408 -0
  16. ectype/fingerprint/core.py +263 -0
  17. ectype/fingerprint/disclosure.py +207 -0
  18. ectype/fingerprint/expressions.py +1317 -0
  19. ectype/fingerprint/schema.py +645 -0
  20. ectype/fingerprint/targets.py +352 -0
  21. ectype/generation/__init__.py +1 -0
  22. ectype/generation/enforce.py +163 -0
  23. ectype/generation/generator.py +525 -0
  24. ectype/generation/identifiers.py +235 -0
  25. ectype/generation/manifest.py +71 -0
  26. ectype/generation/parallel.py +229 -0
  27. ectype/io/__init__.py +16 -0
  28. ectype/io/adapters.py +224 -0
  29. ectype/io/sql.py +289 -0
  30. ectype/io/values.py +269 -0
  31. ectype/llm/__init__.py +27 -0
  32. ectype/llm/authoring.py +766 -0
  33. ectype/llm/providers.py +269 -0
  34. ectype/models/__init__.py +8 -0
  35. ectype/models/base.py +120 -0
  36. ectype/models/chain.py +2426 -0
  37. ectype/models/copulas.py +254 -0
  38. ectype/models/encoding.py +1117 -0
  39. ectype/models/forest.py +1087 -0
  40. ectype/models/marginals.py +2099 -0
  41. ectype/models/mixtures.py +336 -0
  42. ectype/models/neural/__init__.py +21 -0
  43. ectype/models/neural/adapter.py +638 -0
  44. ectype/models/neural/vae.py +432 -0
  45. ectype/models/vines.py +608 -0
  46. ectype/plugins.py +40 -0
  47. ectype/privacy/__init__.py +49 -0
  48. ectype/privacy/attacks.py +599 -0
  49. ectype/privacy/dp.py +313 -0
  50. ectype/privacy/report.py +364 -0
  51. ectype/profiler.py +783 -0
  52. ectype/profiling/__init__.py +1 -0
  53. ectype/profiling/bivariate.py +130 -0
  54. ectype/profiling/calendar.py +743 -0
  55. ectype/profiling/conditional.py +263 -0
  56. ectype/profiling/constraints.py +661 -0
  57. ectype/profiling/entity.py +1143 -0
  58. ectype/profiling/functional.py +651 -0
  59. ectype/profiling/multivariate.py +492 -0
  60. ectype/profiling/personal.py +277 -0
  61. ectype/profiling/pseudonym.py +370 -0
  62. ectype/profiling/reference.py +334 -0
  63. ectype/profiling/sketches.py +653 -0
  64. ectype/profiling/structural.py +1087 -0
  65. ectype/profiling/structure.py +1733 -0
  66. ectype/profiling/sums.py +1710 -0
  67. ectype/profiling/tolerance.py +435 -0
  68. ectype/profiling/univariate.py +555 -0
  69. ectype/py.typed +0 -0
  70. ectype/registry.py +48 -0
  71. ectype/relational/__init__.py +61 -0
  72. ectype/relational/container.py +212 -0
  73. ectype/relational/fit.py +633 -0
  74. ectype/relational/generate.py +418 -0
  75. ectype/relational/schema.py +280 -0
  76. ectype/relational/validate.py +288 -0
  77. ectype/reporting/__init__.py +439 -0
  78. ectype/reporting/adapter.py +2003 -0
  79. ectype/reporting/charts.py +964 -0
  80. ectype/reporting/drift.py +902 -0
  81. ectype/reporting/findings.py +622 -0
  82. ectype/reporting/fmt.py +429 -0
  83. ectype/reporting/render.py +1705 -0
  84. ectype/reporting/select.py +84 -0
  85. ectype/reporting/style.py +272 -0
  86. ectype/reporting/view.py +593 -0
  87. ectype/rng.py +33 -0
  88. ectype/scenarios/__init__.py +30 -0
  89. ectype/scenarios/feasibility.py +411 -0
  90. ectype/scenarios/merge.py +1392 -0
  91. ectype/scenarios/mutate.py +1613 -0
  92. ectype/temporal/__init__.py +80 -0
  93. ectype/temporal/contract.py +221 -0
  94. ectype/temporal/detect.py +431 -0
  95. ectype/temporal/events.py +946 -0
  96. ectype/temporal/panel.py +937 -0
  97. ectype/temporal/pipeline.py +192 -0
  98. ectype/temporal/regular.py +674 -0
  99. ectype/types.py +46 -0
  100. ectype/validation/__init__.py +1 -0
  101. ectype/validation/metrics/__init__.py +7 -0
  102. ectype/validation/metrics/base.py +68 -0
  103. ectype/validation/metrics/bivariate.py +353 -0
  104. ectype/validation/metrics/missingness.py +54 -0
  105. ectype/validation/metrics/multivariate.py +265 -0
  106. ectype/validation/metrics/temporal.py +596 -0
  107. ectype/validation/metrics/univariate.py +514 -0
  108. ectype/validation/report.py +627 -0
  109. ectype/validation/validator.py +707 -0
  110. ectype_data-0.1.0.dist-info/METADATA +376 -0
  111. ectype_data-0.1.0.dist-info/RECORD +115 -0
  112. ectype_data-0.1.0.dist-info/WHEEL +4 -0
  113. ectype_data-0.1.0.dist-info/entry_points.txt +2 -0
  114. ectype_data-0.1.0.dist-info/licenses/LICENSE +192 -0
  115. ectype_data-0.1.0.dist-info/licenses/NOTICE +5 -0
@@ -0,0 +1,84 @@
1
+ """A report on some of a table's columns: a view cut down to a selection (ADR-0016).
2
+
3
+ Pure: standard library and :mod:`ectype.reporting.view` only. The input view is never
4
+ changed; :func:`select_columns` returns a new one.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import copy
10
+ from collections.abc import Iterable, Sequence
11
+
12
+ from ectype.reporting.view import Matrix, ReportView
13
+
14
+ #: unknown names quoted in the error before the rest are counted
15
+ MAX_NAMED = 5
16
+
17
+
18
+ def _any(names: Iterable[str | None], keep: set[str]) -> bool:
19
+ return any(n in keep for n in names if n)
20
+
21
+
22
+ def select_columns(view: ReportView, names: Sequence[str]) -> ReportView:
23
+ """A copy of ``view`` that describes only the columns ``names``.
24
+
25
+ Columns keep their table order and their ``index``. A pair, or a matrix entry, is kept when
26
+ both its columns are selected; a structure (an ordering, a computed column, a sum, an entity
27
+ group, a reference key, a weekly pattern) when at least one of its columns is; a privacy row
28
+ when its column is. The overview (including ``overview.columns``, the source table's width),
29
+ the rules over rows and the unread records are kept as they are.
30
+
31
+ Raises :class:`ValueError` when a name is not a column of the view, naming up to five of
32
+ them, and when ``names`` is empty.
33
+ """
34
+ if isinstance(names, str):
35
+ raise TypeError("names must be a sequence of column names, not a single string")
36
+ wanted = [str(n) for n in names]
37
+ if not wanted:
38
+ raise ValueError("no columns selected")
39
+ present = {c.name for c in view.columns}
40
+ unknown = list(dict.fromkeys(n for n in wanted if n not in present))
41
+ if unknown:
42
+ shown = ", ".join(repr(n) for n in unknown[:MAX_NAMED])
43
+ more = f" and {len(unknown) - MAX_NAMED} more" if len(unknown) > MAX_NAMED else ""
44
+ word = "column" if len(unknown) == 1 else "columns"
45
+ raise ValueError(f"unknown {word}: {shown}{more}")
46
+ keep = set(wanted)
47
+
48
+ out = copy.deepcopy(view)
49
+ out.columns = [c for c in out.columns if c.name in keep]
50
+
51
+ rel = out.relationships
52
+ rel.pairs = [p for p in rel.pairs if p.a in keep and p.b in keep]
53
+ rel.left_out = [n for n in rel.left_out if n in keep]
54
+ if rel.matrix is not None:
55
+ idx = [i for i, n in enumerate(rel.matrix.columns) if n in keep]
56
+ if len(idx) < 2:
57
+ rel.matrix = None
58
+ else:
59
+ vals = rel.matrix.values
60
+ rel.matrix = Matrix(
61
+ columns=[rel.matrix.columns[i] for i in idx],
62
+ values=[[vals[i][j] for j in idx] for i in idx]
63
+ if all(len(row) == len(rel.matrix.columns) for row in vals)
64
+ and len(vals) == len(rel.matrix.columns) else [],
65
+ )
66
+
67
+ st = out.structure
68
+ st.orderings = [o for o in st.orderings
69
+ if _any([o.target, *o.lower, *o.upper, o.base], keep)]
70
+ st.computed = [c for c in st.computed if _any([c.column, *c.inputs], keep)]
71
+ st.sums = [s for s in st.sums if _any([s.total, *s.parts], keep)]
72
+ st.entities = [g for g in st.entities
73
+ if _any([g.key, *(a.column for a in g.attributes)], keep)]
74
+ st.references = [r for r in st.references if r.column in keep]
75
+ st.weekly = [w for w in st.weekly if _any([w.column, *w.tied_to], keep)]
76
+
77
+ pv = out.privacy
78
+ pv.personal = [p for p in pv.personal if p.column in keep]
79
+ pv.pooled = [p for p in pv.pooled if p.column in keep]
80
+ pv.coarse_columns = [n for n in pv.coarse_columns if n in keep]
81
+ return out
82
+
83
+
84
+ __all__ = ["MAX_NAMED", "select_columns"]
@@ -0,0 +1,272 @@
1
+ """Stylesheet and the small optional script of the profile report page (ADR-0016).
2
+
3
+ Standard library only (nothing to import). The page is complete without the script: it only
4
+ un-hides the column filter and opens every ``<details>`` before printing. Neither string makes
5
+ any external request: no ``url(``, no ``@import``, no web font, no network call.
6
+
7
+ Colours are tokens on ``:root``, redefined for ``prefers-color-scheme: dark``. Body text and
8
+ secondary text (``--ink``, ``--ink-2``, ``--ink-3``) meet WCAG AA (4.5:1) on ``--ground`` and
9
+ ``--surface`` in both schemes; ``tests/report/test_report_render.py`` computes the ratios from
10
+ this string.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ _TOKENS_LIGHT = (
16
+ "--ground:#f4f3f8;--surface:#ffffff;--ink:#1d1530;--ink-2:#4f4768;--ink-3:#686080;"
17
+ "--line:#dcd8e8;--track:#e9e6f1;"
18
+ "--purple:#4a1d7a;--purple-ink:#4a1d7a;--purple-wash:#efe9f7;"
19
+ "--teal:#0a6b70;--teal-ink:#0a6b70;--teal-wash:#e2f0f0;"
20
+ "--rose:#b4235a;--rose-ink:#a31d50;--rose-wash:#fbe9f0;"
21
+ )
22
+ _TOKENS_DARK = (
23
+ "--ground:#120e1c;--surface:#1b1629;--ink:#ece9f5;--ink-2:#bdb6d1;--ink-3:#9b93b3;"
24
+ "--line:#342c4a;--track:#2a2340;"
25
+ "--purple:#a18ae0;--purple-ink:#c5b5f2;--purple-wash:#272040;"
26
+ "--teal:#35a6aa;--teal-ink:#63c7cb;--teal-wash:#15302f;"
27
+ "--rose:#e2638f;--rose-ink:#f291b4;--rose-wash:#3a1826;"
28
+ )
29
+
30
+ CSS: str = (
31
+ ":root{" + _TOKENS_LIGHT
32
+ + '--sans:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;'
33
+ '--mono:ui-monospace,"Cascadia Mono","SF Mono",Menlo,Consolas,monospace;'
34
+ "color-scheme:light dark}\n"
35
+ "@media (prefers-color-scheme:dark){:root{" + _TOKENS_DARK + "}}\n"
36
+ """*{box-sizing:border-box}
37
+ [hidden]{display:none!important}
38
+ html{-webkit-text-size-adjust:100%;scroll-padding-top:16px}
39
+ body{margin:0;background:var(--ground);color:var(--ink);font:16px/1.55 var(--sans);overflow-wrap:anywhere}
40
+ a{color:var(--purple-ink);text-underline-offset:2px}
41
+ a:focus-visible,summary:focus-visible,input:focus-visible,.scroll:focus-visible{outline:2px solid var(--teal-ink);outline-offset:2px;border-radius:2px}
42
+ code{font:0.88em/1.4 var(--mono);background:var(--purple-wash);padding:1px 5px;border-radius:4px;overflow-wrap:anywhere}
43
+ b{font-weight:650}
44
+ p{margin:0 0 10px}
45
+ ul,ol{margin:0 0 14px}
46
+ .vh{position:absolute!important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}
47
+ .skip{position:absolute;left:-999px;top:0;background:var(--surface);padding:8px 12px;z-index:5}
48
+ .skip:focus{left:8px;top:8px}
49
+ .shell{display:grid;grid-template-columns:200px minmax(0,1fr);gap:40px;max-width:1240px;margin:0 auto;padding:32px 28px 80px}
50
+ .rail{position:sticky;top:24px;align-self:start;font-size:.92rem}
51
+ .brand{margin:0 0 20px;font-weight:700;color:var(--purple-ink);letter-spacing:-.01em}
52
+ .brand span{display:block;font-weight:400;color:var(--ink-3)}
53
+ .rail ol{list-style:none;margin:0;padding:0;border-left:1px solid var(--line)}
54
+ .rail li a{display:flex;justify-content:space-between;gap:8px;padding:5px 0 5px 14px;margin-left:-1px;border-left:2px solid transparent;color:var(--ink-2);text-decoration:none}
55
+ .rail li a:hover{color:var(--ink);border-left-color:var(--purple)}
56
+ .rail li a span{color:var(--ink-3);font-variant-numeric:tabular-nums}
57
+ main{min-width:0}
58
+ section{margin:0 0 56px}
59
+ h1{font-size:2.25rem;line-height:1.12;letter-spacing:-.02em;margin:0 0 14px;font-weight:700}
60
+ h2{font-size:1.45rem;line-height:1.2;letter-spacing:-.012em;margin:0 0 6px;font-weight:700}
61
+ h2.minor{font-size:1.05rem;margin:30px 0 8px}
62
+ h3{font-size:1rem;line-height:1.3;margin:0;font-weight:650}
63
+ section>h3{margin:28px 0 8px}
64
+ .lede{font-size:1.12rem;line-height:1.55;max-width:68ch;margin:0 0 18px;color:var(--ink)}
65
+ .desc,.intro{max-width:70ch;margin:0 0 14px;color:var(--ink-2)}
66
+ .notice{max-width:76ch;margin:0 0 14px;padding:8px 12px;border-left:3px solid var(--teal);background:var(--teal-wash);border-radius:0 6px 6px 0}
67
+ .notice.serious{border-left-color:var(--rose);background:var(--rose-wash)}
68
+ .facts{display:flex;flex-wrap:wrap;gap:10px 34px;margin:8px 0 26px;padding:14px 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}
69
+ .facts div{min-width:0}
70
+ .facts dt{font-size:.8rem;color:var(--ink-3)}
71
+ .facts dd{margin:0;font-weight:650;font-variant-numeric:tabular-nums}
72
+ .facts dd.mono{font:500 .9rem/1.6 var(--mono)}
73
+ figure{margin:0 0 18px}
74
+ figcaption{font-size:.85rem;color:var(--ink-3);max-width:78ch;margin-bottom:8px}
75
+ .act{list-style:none;margin:0 0 10px;padding:0;max-width:76ch}
76
+ .act li{position:relative;padding:7px 0 7px 22px;border-bottom:1px solid var(--line)}
77
+ .act li::before{content:"";position:absolute;left:3px;top:.95em;width:8px;height:8px;border-radius:50%;border:2px solid var(--ink-3)}
78
+ .act li.serious::before{background:var(--rose);border-color:var(--rose)}
79
+ .act .advice,table.alerts .advice{display:block;color:var(--ink-2);font-size:.92rem}
80
+ .lvl{font-weight:650;white-space:nowrap;margin-right:4px}
81
+ .serious .lvl,.lvl.serious{color:var(--rose-ink)}
82
+ td .lvl::before{content:"";display:inline-block;width:8px;height:8px;border-radius:50%;border:2px solid var(--ink-3);margin-right:7px;vertical-align:0}
83
+ td .lvl.serious::before{background:var(--rose);border-color:var(--rose)}
84
+ .filter{display:flex;flex-wrap:wrap;gap:8px 20px;align-items:center;margin:0 0 16px;font-size:.92rem}
85
+ .filter input[type=search]{font:inherit;padding:5px 9px;border:1px solid var(--ink-3);border-radius:6px;background:var(--surface);color:var(--ink);width:16rem;max-width:100%;margin-left:6px}
86
+ .filter input[type=checkbox]{accent-color:var(--purple);margin-right:6px}
87
+ .filter .count{margin:0;color:var(--ink-3)}
88
+ .grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(290px,100%),1fr));gap:14px}
89
+ .col{background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:14px 14px 12px;min-width:0;break-inside:avoid}
90
+ .col:target,tr:target{outline:2px solid var(--purple);outline-offset:-1px}
91
+ .col header{display:block;margin-bottom:8px}
92
+ .kind{margin:2px 0 0;font-size:.84rem;color:var(--ink-2);display:flex;justify-content:space-between;gap:10px}
93
+ .kind span:first-child{flex:none;max-width:60%;color:var(--ink-2);text-align:left}
94
+ .kind span{color:var(--ink-3);text-align:right;min-width:0}
95
+ .missline{margin:0 0 10px;font-size:.8rem;color:var(--ink-3);display:flex;align-items:center;gap:8px}
96
+ .missline.has{color:var(--ink-2)}
97
+ .miss{display:block;flex:none;width:64px;height:6px;border-radius:3px;background:var(--track);overflow:hidden}
98
+ .miss span{display:block;height:100%;background:var(--rose);border-radius:3px}
99
+ .stats{display:flex;flex-wrap:wrap;gap:4px 18px;margin:8px 0 0;font-size:.84rem}
100
+ .stats dt{color:var(--ink-3);font-size:.76rem}
101
+ .stats dd{margin:0;font-variant-numeric:tabular-nums}
102
+ .stats1{margin:6px 0 0;font-size:.82rem;color:var(--ink-2);font-variant-numeric:tabular-nums}
103
+ .nochart{margin:6px 0 0;font-size:.9rem;color:var(--ink-2)}
104
+ .small{margin:6px 0 0;font-size:.82rem;color:var(--ink-2)}
105
+ .small.intro{margin:-6px 0 14px;max-width:68ch}
106
+ .flagline{margin:6px 0 0;font-size:.82rem;color:var(--ink-2)}
107
+ .notes{margin:10px 0 0;padding:8px 0 0;border-top:1px solid var(--line);font-size:.82rem;color:var(--ink-2)}
108
+ .notes summary{cursor:pointer;color:var(--ink-3)}
109
+ .notes ul{margin:6px 0 0;padding-left:16px}
110
+ .notes li{margin:3px 0}
111
+ .col.compact{padding:10px 12px 9px}
112
+ .col.compact .missline{margin-bottom:6px}
113
+ details.more{margin:6px 0 14px}
114
+ details.more>summary{cursor:pointer;color:var(--ink-2);padding:6px 0}
115
+ .chart{display:block;width:100%;height:auto;overflow:visible}
116
+ .col .chart{max-width:460px}
117
+ .chart .axis{stroke:var(--line);stroke-width:1}
118
+ .chart .bar{fill:var(--purple)}
119
+ .chart .bar.rest{fill:var(--ink-3);opacity:.6}
120
+ .chart .bar.pooled{fill:var(--rose)}
121
+ .chart .atom line{stroke:var(--rose);stroke-width:2}
122
+ .chart .atom circle{fill:var(--rose);stroke:var(--surface);stroke-width:2}
123
+ .chart .median{fill:var(--ink)}
124
+ .chart text{font:12px var(--sans);fill:var(--ink-2)}
125
+ .chart text.tick{fill:var(--ink-3);font-variant-numeric:tabular-nums}
126
+ .chart text.val{font-variant-numeric:tabular-nums}
127
+ .chart text.rest,.chart text.pooled{font-style:italic}
128
+ .chart text.atom-lab{fill:var(--rose-ink)}
129
+ .chart text.lab{fill:var(--ink-2)}
130
+ .chart .second{fill:none;stroke:var(--teal);stroke-width:1.5;stroke-linejoin:round}
131
+ .chart .atom.second line{stroke:var(--teal)}
132
+ .chart .atom.second circle{fill:var(--surface);stroke:var(--teal);stroke-width:1.5}
133
+ .chart .median.second{fill:none;stroke:var(--teal);stroke-width:1.2}
134
+ .chart .cell{fill:var(--teal)}
135
+ .chart .cell.none{fill:none;stroke:var(--line)}
136
+ .chart a text{fill:var(--purple-ink);text-decoration:underline}
137
+ .chart.parts{max-width:420px;margin:6px 0}
138
+ .chart.parts .track{fill:var(--track)}
139
+ .chart .seg.a{fill:var(--teal)}
140
+ .chart .seg.b{fill:var(--teal);opacity:.55}
141
+ .chart.strip{height:58px}
142
+ .strip .track{fill:var(--track)}
143
+ .strip .on{fill:var(--purple)}
144
+ .strip .off{fill:var(--ink-3);opacity:.55}
145
+ .strip .flag{fill:var(--rose)}
146
+ .strip a:hover .track,.strip a:focus .track{fill:var(--purple-wash);stroke:var(--purple);stroke-width:1;vector-effect:non-scaling-stroke}
147
+ .mini{max-width:330px;margin:8px 0 4px}
148
+ .chart.weekdays{max-width:360px}
149
+ .pairs{list-style:none;margin:0;padding:0;max-width:86ch}
150
+ .pairs li{display:grid;grid-template-columns:72px 38px minmax(0,1fr);gap:10px;align-items:center;padding:7px 0;border-bottom:1px solid var(--line)}
151
+ .meter{display:block;height:6px;border-radius:3px;background:var(--track);overflow:hidden}
152
+ .meter span{display:block;height:100%;background:var(--teal);border-radius:3px}
153
+ .num{font-variant-numeric:tabular-nums;color:var(--ink-2)}
154
+ .pairs .num{font-size:.9rem}
155
+ .tag{display:inline-block;margin-left:8px;padding:0 7px;border-radius:9px;font-size:.76rem;line-height:1.6;background:var(--teal-wash);color:var(--teal-ink);max-width:100%}
156
+ .tag.plain{background:var(--track);color:var(--ink-2)}
157
+ .with{color:var(--ink-2)}
158
+ .rules{padding-left:18px;max-width:86ch}
159
+ .eq{font-weight:600}.eq a{font-weight:600}
160
+ section>p,section>ul:not([class]),section>ol:not([class]){max-width:80ch}
161
+ .rules>li{margin:8px 0}
162
+ .rules .how{display:block;color:var(--ink-2);font-size:.92rem}
163
+ .plain{list-style:none;padding:0}
164
+ .scroll{overflow-x:auto;max-width:100%;margin:0 0 18px}
165
+ .scroll table.wide{min-width:640px}
166
+ table{border-collapse:collapse;width:auto;min-width:min(100%,30rem);font-size:.9rem;background:var(--surface);border:1px solid var(--line)}
167
+ th,td{text-align:left;vertical-align:top;padding:6px 10px;border-bottom:1px solid var(--line);overflow-wrap:break-word}
168
+ thead th{overflow-wrap:normal}
169
+ table.alerts tbody th,tbody th:first-child{overflow-wrap:anywhere}
170
+ table.cols,table.alerts{width:100%}
171
+ td.why{width:45%}
172
+ table.alerts tbody th{font-weight:400}
173
+ thead th{font-size:.8rem;font-weight:600;color:var(--ink-3)}
174
+ tbody th{font-weight:600}
175
+ table:not(.kf):not(.two) tbody th:first-child{min-width:10em}
176
+ td.num,th.num{text-align:right}td.num{white-space:nowrap}
177
+ table.cols td:last-child{color:var(--ink-2);min-width:16rem}
178
+ .matrixfig .scroll{max-width:600px}
179
+ .box{background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:14px;margin:0 0 14px}
180
+ .defs{display:grid;grid-template-columns:13rem minmax(0,1fr);gap:8px 20px;max-width:64rem}
181
+ .defs dt{font-weight:650}
182
+ .defs dd{margin:0;color:var(--ink-2);max-width:72ch}
183
+ .explain{max-width:78ch;margin:14px 0 22px;font-size:.88rem;color:var(--ink-2)}
184
+ .about{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:4px 18px;margin:0 0 14px}
185
+ .about dt{color:var(--ink-3)}
186
+ .about dd{margin:0}
187
+ footer{margin-top:40px;padding-top:14px;border-top:1px solid var(--line);font-size:.86rem;color:var(--ink-3)}
188
+ @media (max-width:860px){
189
+ .shell{grid-template-columns:minmax(0,1fr);gap:18px;padding:18px 16px 60px}
190
+ .rail{position:static}
191
+ .brand{margin-bottom:10px}.brand span{display:inline}
192
+ .rail ol{display:flex;flex-wrap:wrap;gap:2px 16px;border-left:0}
193
+ .rail li a{padding:3px 0;border-left:0;margin:0;text-decoration:underline}
194
+ h1{font-size:1.7rem}.lede{font-size:1.02rem}
195
+ .pairs li{grid-template-columns:48px 34px minmax(0,1fr)}
196
+ .about,.defs{grid-template-columns:minmax(0,1fr);gap:0}
197
+ .defs dd{margin-bottom:8px}
198
+ .about dd{margin-bottom:6px}
199
+ table.special:not(.kf):not(.two) tbody th:first-child{min-width:7.5em}
200
+ table.special td.why{width:52%}
201
+ }
202
+ @media print{
203
+ :root{""" + _TOKENS_LIGHT + """}
204
+ body{background:#fff}.shell{display:block;padding:0}
205
+ .rail,.skip,.filter{display:none!important}
206
+ .col,.box,figure,tr,.pairs li,.rules>li{break-inside:avoid}
207
+ section{break-inside:auto}h2,h3{break-after:avoid}
208
+ .col{border-color:#bbb}
209
+ .scroll{overflow:visible}
210
+ details::details-content{content-visibility:visible;display:contents}
211
+ }
212
+ """
213
+ )
214
+
215
+ # -- comparison page (ectype.reporting.drift) ----------------------------------------------------
216
+ # The first fingerprint is purple and filled, the second teal and outlined: the two never
217
+ # differ by colour alone. Appended to CSS; nothing above is changed.
218
+ CSS += """
219
+ .verdict{display:flex;gap:12px;align-items:flex-start;max-width:76ch;margin:0 0 16px;padding:12px 14px;border:1px solid var(--line);border-radius:8px;background:var(--surface);font-size:1.08rem}
220
+ .verdict .mark{flex:none;width:14px;height:14px;margin-top:.3em;border-radius:50%}
221
+ .verdict.v-drift{border-left:4px solid var(--rose)}
222
+ .verdict.v-drift .mark{background:var(--rose);border-radius:2px;transform:rotate(45deg)}
223
+ .verdict.v-none{border-left:4px solid var(--teal)}
224
+ .verdict.v-none .mark{border:3px solid var(--teal)}
225
+ .verdict.v-inconclusive{border-left:4px dashed var(--ink-3)}
226
+ .verdict.v-inconclusive .mark{border:3px dashed var(--ink-3)}
227
+ .legend{display:flex;flex-wrap:wrap;gap:2px 16px;margin:4px 0 0;font-size:.8rem;color:var(--ink-2)}
228
+ .legend span{display:inline-flex;align-items:center;gap:6px;min-width:0}
229
+ .sw{flex:none;display:inline-block;width:14px;height:9px;border-radius:2px}
230
+ .sw1{background:var(--purple)}
231
+ .sw2{background:var(--teal-wash);border:1.5px solid var(--teal)}
232
+ .chart .bar.second{fill:var(--teal-wash);stroke:var(--teal);stroke-width:1.25}
233
+ .chart .bar.second.rest,.chart .bar.second.pooled{opacity:1}
234
+ .chart text.v2{fill:var(--teal-ink)}
235
+ .dcol .chart .second{stroke-width:2}
236
+ .dcol .chart.hist rect.bar:not(.second){fill-opacity:.78}
237
+ .side{margin:8px 0 2px;font-size:.8rem;color:var(--ink-3)}
238
+ .howfar{margin:0 0 8px;font-size:.88rem;color:var(--ink-2)}
239
+ .changes{margin:8px 0 0;padding-left:18px;font-size:.84rem;color:var(--ink-2)}
240
+ .changes li{margin:2px 0}
241
+ .kfw{margin:10px 0 0}
242
+ table.kf{width:100%;min-width:0;font-size:.82rem;border:0;background:transparent}
243
+ table.kf th,table.kf td{padding:3px 6px 3px 0;border-bottom:1px solid var(--line)}
244
+ table.kf td{font-variant-numeric:tabular-nums}
245
+ table.kf thead th:nth-child(2){color:var(--purple-ink)}
246
+ table.kf thead th:nth-child(3){color:var(--teal-ink)}
247
+ table.kf tbody th{font-weight:400;color:var(--ink-3)}
248
+ table.two thead th:nth-child(2){color:var(--purple-ink)}
249
+ table.two thead th:nth-child(3){color:var(--teal-ink)}
250
+ table.two tbody th{font-weight:500;color:var(--ink-2)}
251
+ .decision{max-width:76ch;font-size:.92rem;color:var(--ink-2)}
252
+ .pairs .say b{font-weight:600}
253
+ """
254
+
255
+
256
+ #: progressive enhancement only: the column filter and opening ``<details>`` for printing
257
+ SCRIPT: str = (
258
+ "(function(){var d=document,f=d.querySelector('form.filter');"
259
+ "if(f){var q=f.querySelector('input[type=search]'),c=f.querySelector('input[type=checkbox]'),"
260
+ "o=f.querySelector('.count'),it=d.querySelectorAll('#columns [data-name]'),n=it.length;"
261
+ "var u=function(){var t=q.value.trim().toLowerCase(),k=c.checked,s=0;"
262
+ "for(var i=0;i<n;i++){var e=it[i],v=(!t||e.getAttribute('data-name').indexOf(t)>=0)"
263
+ "&&(!k||e.getAttribute('data-flag')==='1');e.hidden=!v;if(v)s++}"
264
+ "o.textContent='Showing '+s+' of '+n+(n===1?' column':' columns')};"
265
+ "f.addEventListener('input',u);f.addEventListener('change',u);"
266
+ "f.addEventListener('submit',function(e){e.preventDefault()});f.hidden=false;u()}"
267
+ "var p=[];addEventListener('beforeprint',function(){"
268
+ "d.querySelectorAll('details:not([open])').forEach(function(x){x.open=true;p.push(x)})});"
269
+ "addEventListener('afterprint',function(){p.forEach(function(x){x.open=false});p=[]})})();"
270
+ )
271
+
272
+ __all__ = ["CSS", "SCRIPT"]