datumseal 0.2.0__tar.gz

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 (167) hide show
  1. datumseal-0.2.0/LICENSE +21 -0
  2. datumseal-0.2.0/PKG-INFO +71 -0
  3. datumseal-0.2.0/README.md +42 -0
  4. datumseal-0.2.0/THIRD_PARTY.md +100 -0
  5. datumseal-0.2.0/datumseal/__init__.py +8 -0
  6. datumseal-0.2.0/datumseal/__main__.py +3 -0
  7. datumseal-0.2.0/datumseal/cli.py +295 -0
  8. datumseal-0.2.0/datumseal/comparison.py +142 -0
  9. datumseal-0.2.0/datumseal/contracts.py +64 -0
  10. datumseal-0.2.0/datumseal/envelope.py +28 -0
  11. datumseal-0.2.0/datumseal/examples/DEMO_PROVENANCE.md +6 -0
  12. datumseal-0.2.0/datumseal/examples/DEMO_asof_no_match.json +115 -0
  13. datumseal-0.2.0/datumseal/examples/DEMO_asof_result.json +134 -0
  14. datumseal-0.2.0/datumseal/examples/DEMO_asof_result_multi_v4.json +112 -0
  15. datumseal-0.2.0/datumseal/examples/DEMO_asof_result_v2.json +91 -0
  16. datumseal-0.2.0/datumseal/examples/DEMO_asof_result_v3.json +91 -0
  17. datumseal-0.2.0/datumseal/examples/DEMO_asof_result_v4.json +105 -0
  18. datumseal-0.2.0/datumseal/examples/DEMO_command_error.json +17 -0
  19. datumseal-0.2.0/datumseal/examples/DEMO_last_revision_result.json +121 -0
  20. datumseal-0.2.0/datumseal/examples/DEMO_last_revision_result_multi_v4.json +120 -0
  21. datumseal-0.2.0/datumseal/examples/DEMO_last_revision_result_v2.json +99 -0
  22. datumseal-0.2.0/datumseal/examples/DEMO_last_revision_result_v3.json +99 -0
  23. datumseal-0.2.0/datumseal/examples/DEMO_last_revision_result_v4.json +113 -0
  24. datumseal-0.2.0/datumseal/examples/DEMO_ledger_result.json +38 -0
  25. datumseal-0.2.0/datumseal/examples/DEMO_ledger_result_multi_v4.json +73 -0
  26. datumseal-0.2.0/datumseal/examples/DEMO_ledger_result_v2.json +43 -0
  27. datumseal-0.2.0/datumseal/examples/DEMO_ledger_result_v3.json +53 -0
  28. datumseal-0.2.0/datumseal/examples/DEMO_ledger_result_v4.json +66 -0
  29. datumseal-0.2.0/datumseal/examples/DEMO_manifest.json +36 -0
  30. datumseal-0.2.0/datumseal/examples/DEMO_manifest.md +31 -0
  31. datumseal-0.2.0/datumseal/examples/DEMO_manifest_pack_v6.json +100 -0
  32. datumseal-0.2.0/datumseal/examples/DEMO_manifest_v5.json +119 -0
  33. datumseal-0.2.0/datumseal/examples/DEMO_manifest_v6.json +120 -0
  34. datumseal-0.2.0/datumseal/examples/DEMO_markdown_result.json +10 -0
  35. datumseal-0.2.0/datumseal/examples/DEMO_new_change_types_v5.jsonl +3 -0
  36. datumseal-0.2.0/datumseal/examples/DEMO_pack.json +13 -0
  37. datumseal-0.2.0/datumseal/examples/DEMO_pack_v2.json +13 -0
  38. datumseal-0.2.0/datumseal/examples/DEMO_rejected_rows.json +208 -0
  39. datumseal-0.2.0/datumseal/examples/DEMO_revision_record.json +26 -0
  40. datumseal-0.2.0/datumseal/examples/DEMO_revision_record_v3.json +28 -0
  41. datumseal-0.2.0/datumseal/examples/DEMO_revision_record_v4.json +32 -0
  42. datumseal-0.2.0/datumseal/examples/DEMO_revision_record_v5.json +20 -0
  43. datumseal-0.2.0/datumseal/examples/DEMO_schemas_result.json +278 -0
  44. datumseal-0.2.0/datumseal/examples/DEMO_seen_add.json +71 -0
  45. datumseal-0.2.0/datumseal/examples/DEMO_seen_check.json +106 -0
  46. datumseal-0.2.0/datumseal/examples/DEMO_seen_list.json +71 -0
  47. datumseal-0.2.0/datumseal/examples/DEMO_seen_log.jsonl +2 -0
  48. datumseal-0.2.0/datumseal/examples/DEMO_seen_record.json +22 -0
  49. datumseal-0.2.0/datumseal/examples/DEMO_seen_table.md +5 -0
  50. datumseal-0.2.0/datumseal/examples/DEMO_seen_vintage_check.json +133 -0
  51. datumseal-0.2.0/datumseal/examples/DEMO_verify_result.json +46 -0
  52. datumseal-0.2.0/datumseal/examples/DEMO_vintage_ledger.jsonl +5 -0
  53. datumseal-0.2.0/datumseal/examples/DEMO_vintage_ledger_v5.jsonl +2 -0
  54. datumseal-0.2.0/datumseal/examples/manifest.json +31 -0
  55. datumseal-0.2.0/datumseal/examples/manifest.md +31 -0
  56. datumseal-0.2.0/datumseal/examples/verify_result.json +41 -0
  57. datumseal-0.2.0/datumseal/ignores.py +34 -0
  58. datumseal-0.2.0/datumseal/ledger/__init__.py +11 -0
  59. datumseal-0.2.0/datumseal/ledger/_metadata.py +4 -0
  60. datumseal-0.2.0/datumseal/ledger/asof.py +98 -0
  61. datumseal-0.2.0/datumseal/ledger/last_revision.py +115 -0
  62. datumseal-0.2.0/datumseal/ledger/ledger.py +333 -0
  63. datumseal-0.2.0/datumseal/ledger/pack.py +158 -0
  64. datumseal-0.2.0/datumseal/ledger/record.schema.json +42 -0
  65. datumseal-0.2.0/datumseal/ledger/record.v2.schema.json +215 -0
  66. datumseal-0.2.0/datumseal/ledger/record.v3.schema.json +220 -0
  67. datumseal-0.2.0/datumseal/ledger/record.v4.schema.json +243 -0
  68. datumseal-0.2.0/datumseal/ledger/record.v5.schema.json +290 -0
  69. datumseal-0.2.0/datumseal/ledger/record_pack.v1.schema.json +79 -0
  70. datumseal-0.2.0/datumseal/ledger/record_pack.v2.schema.json +78 -0
  71. datumseal-0.2.0/datumseal/ledger/sources.py +180 -0
  72. datumseal-0.2.0/datumseal/manifest.py +312 -0
  73. datumseal-0.2.0/datumseal/markdown.py +43 -0
  74. datumseal-0.2.0/datumseal/output.py +158 -0
  75. datumseal-0.2.0/datumseal/registry.py +234 -0
  76. datumseal-0.2.0/datumseal/schemas/asof_result.v1.schema.json +768 -0
  77. datumseal-0.2.0/datumseal/schemas/asof_result.v2.schema.json +1011 -0
  78. datumseal-0.2.0/datumseal/schemas/asof_result.v3.schema.json +470 -0
  79. datumseal-0.2.0/datumseal/schemas/asof_result.v4.schema.json +588 -0
  80. datumseal-0.2.0/datumseal/schemas/command_error.v1.schema.json +96 -0
  81. datumseal-0.2.0/datumseal/schemas/last_revision_result.v1.schema.json +831 -0
  82. datumseal-0.2.0/datumseal/schemas/last_revision_result.v2.schema.json +1074 -0
  83. datumseal-0.2.0/datumseal/schemas/last_revision_result.v3.schema.json +533 -0
  84. datumseal-0.2.0/datumseal/schemas/last_revision_result.v4.schema.json +651 -0
  85. datumseal-0.2.0/datumseal/schemas/ledger_result.v1.schema.json +653 -0
  86. datumseal-0.2.0/datumseal/schemas/ledger_result.v2.schema.json +896 -0
  87. datumseal-0.2.0/datumseal/schemas/ledger_result.v3.schema.json +355 -0
  88. datumseal-0.2.0/datumseal/schemas/ledger_result.v4.schema.json +437 -0
  89. datumseal-0.2.0/datumseal/schemas/manifest.schema.json +129 -0
  90. datumseal-0.2.0/datumseal/schemas/manifest.v2.schema.json +93 -0
  91. datumseal-0.2.0/datumseal/schemas/manifest.v4.schema.json +195 -0
  92. datumseal-0.2.0/datumseal/schemas/manifest.v5.schema.json +359 -0
  93. datumseal-0.2.0/datumseal/schemas/manifest.v6.schema.json +397 -0
  94. datumseal-0.2.0/datumseal/schemas/markdown_result.v1.schema.json +92 -0
  95. datumseal-0.2.0/datumseal/schemas/schemas_result.v1.schema.json +161 -0
  96. datumseal-0.2.0/datumseal/schemas/seen_log.v1.schema.json +438 -0
  97. datumseal-0.2.0/datumseal/schemas/verify_result.schema.json +357 -0
  98. datumseal-0.2.0/datumseal/schemas/verify_result.v2.schema.json +237 -0
  99. datumseal-0.2.0/datumseal/schemas/verify_result.v4.schema.json +424 -0
  100. datumseal-0.2.0/datumseal/seen.py +289 -0
  101. datumseal-0.2.0/datumseal/seen_cli.py +125 -0
  102. datumseal-0.2.0/datumseal/seen_contracts.py +38 -0
  103. datumseal-0.2.0/datumseal/tables/__init__.py +7 -0
  104. datumseal-0.2.0/datumseal/tables/cli.py +69 -0
  105. datumseal-0.2.0/datumseal/tables/core.py +275 -0
  106. datumseal-0.2.0/datumseal/tables/examples/rejected_rows_v1.json +80 -0
  107. datumseal-0.2.0/datumseal/tables/examples/rejected_rows_v2.json +198 -0
  108. datumseal-0.2.0/datumseal/tables/readers.py +496 -0
  109. datumseal-0.2.0/datumseal/tables/rejected_rows.schema.json +537 -0
  110. datumseal-0.2.0/datumseal/tables/rejected_rows_v1.schema.json +441 -0
  111. datumseal-0.2.0/datumseal/tables/rejected_rows_v3.schema.json +662 -0
  112. datumseal-0.2.0/datumseal/tables/schema.py +200 -0
  113. datumseal-0.2.0/datumseal/version.py +17 -0
  114. datumseal-0.2.0/datumseal/vintages.py +267 -0
  115. datumseal-0.2.0/datumseal.egg-info/PKG-INFO +71 -0
  116. datumseal-0.2.0/datumseal.egg-info/SOURCES.txt +165 -0
  117. datumseal-0.2.0/datumseal.egg-info/dependency_links.txt +1 -0
  118. datumseal-0.2.0/datumseal.egg-info/entry_points.txt +2 -0
  119. datumseal-0.2.0/datumseal.egg-info/requires.txt +4 -0
  120. datumseal-0.2.0/datumseal.egg-info/top_level.txt +1 -0
  121. datumseal-0.2.0/pyproject.toml +54 -0
  122. datumseal-0.2.0/setup.cfg +4 -0
  123. datumseal-0.2.0/tests/test_a1_cli.py +160 -0
  124. datumseal-0.2.0/tests/test_a1_contracts.py +184 -0
  125. datumseal-0.2.0/tests/test_a1_freeze.py +241 -0
  126. datumseal-0.2.0/tests/test_a1_round3.py +348 -0
  127. datumseal-0.2.0/tests/test_a1_unicode.py +140 -0
  128. datumseal-0.2.0/tests/test_a2_asof.py +281 -0
  129. datumseal-0.2.0/tests/test_a2_delivery.py +32 -0
  130. datumseal-0.2.0/tests/test_a2_input.py +267 -0
  131. datumseal-0.2.0/tests/test_a2_last_revision.py +327 -0
  132. datumseal-0.2.0/tests/test_a2_pack.py +324 -0
  133. datumseal-0.2.0/tests/test_a2_pack_contracts.py +38 -0
  134. datumseal-0.2.0/tests/test_a3_cli.py +109 -0
  135. datumseal-0.2.0/tests/test_a3_contract.py +108 -0
  136. datumseal-0.2.0/tests/test_a3_core.py +105 -0
  137. datumseal-0.2.0/tests/test_a3_encoding.py +51 -0
  138. datumseal-0.2.0/tests/test_a3_readers.py +240 -0
  139. datumseal-0.2.0/tests/test_a3_round3.py +235 -0
  140. datumseal-0.2.0/tests/test_a3_schema.py +128 -0
  141. datumseal-0.2.0/tests/test_a3_xls.py +380 -0
  142. datumseal-0.2.0/tests/test_a4_cli.py +222 -0
  143. datumseal-0.2.0/tests/test_a4_contracts.py +56 -0
  144. datumseal-0.2.0/tests/test_a4_seen.py +181 -0
  145. datumseal-0.2.0/tests/test_a4_wheel.py +82 -0
  146. datumseal-0.2.0/tests/test_ledger.py +279 -0
  147. datumseal-0.2.0/tests/test_u46_3b.py +635 -0
  148. datumseal-0.2.0/tests/test_u46_3c.py +242 -0
  149. datumseal-0.2.0/tests/test_u46_6.py +194 -0
  150. datumseal-0.2.0/tests/test_u46_8.py +47 -0
  151. datumseal-0.2.0/tests/test_u46_freeze_pack.py +293 -0
  152. datumseal-0.2.0/tests/test_u46_multi.py +364 -0
  153. datumseal-0.2.0/tests/test_u46_registry.py +229 -0
  154. datumseal-0.2.0/tests/test_u46_selected.py +319 -0
  155. datumseal-0.2.0/tests/test_u46_sources.py +328 -0
  156. datumseal-0.2.0/tests/test_u46_wheel.py +66 -0
  157. datumseal-0.2.0/tests/test_u4_vintages.py +337 -0
  158. datumseal-0.2.0/tests/test_u5_jsonschema.py +293 -0
  159. datumseal-0.2.0/tests/test_u5_source_policy.py +80 -0
  160. datumseal-0.2.0/tests/test_u_cli.py +223 -0
  161. datumseal-0.2.0/tests/test_u_contracts.py +134 -0
  162. datumseal-0.2.0/tests/test_v2_wheel.py +579 -0
  163. datumseal-0.2.0/tests/test_v4_examples.py +58 -0
  164. datumseal-0.2.0/tests/test_v4_output.py +282 -0
  165. datumseal-0.2.0/tests/test_v5_third_party.py +216 -0
  166. datumseal-0.2.0/tests/test_v6_docs.py +682 -0
  167. datumseal-0.2.0/tests/test_version_flag.py +27 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Datumseal contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,71 @@
1
+ Metadata-Version: 2.4
2
+ Name: datumseal
3
+ Version: 0.2.0
4
+ Summary: Verification tools for researchers: table reading, freezing and verification of research inputs, and revision ledgers
5
+ Author-email: "VF Software Co., Ltd." <support@vf-software.co.jp>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/vfsoftware/datumseal
8
+ Project-URL: Repository, https://github.com/vfsoftware/datumseal
9
+ Project-URL: Issues, https://github.com/vfsoftware/datumseal/issues
10
+ Project-URL: Documentation, https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/01-start.md
11
+ Project-URL: Changelog, https://github.com/vfsoftware/datumseal/blob/v0.2.0/CHANGELOG.md
12
+ Keywords: reproducibility,preregistration,hashing,data vintages,revision ledger,research verification
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Operating System :: MacOS
20
+ Classifier: Topic :: Scientific/Engineering
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ License-File: THIRD_PARTY.md
25
+ Requires-Dist: xlrd==2.0.2
26
+ Provides-Extra: test
27
+ Requires-Dist: jsonschema==4.26.0; extra == "test"
28
+ Dynamic: license-file
29
+
30
+ 計画書・コード・データの凍結と照合、表の読み取り、改定の台帳、見た値の記録を行う CLI です。 / A CLI for file freezing and comparison, table reading, revision ledgers, and records of values seen.
31
+ 入力や判断の理由を手元に残す分析担当者向けです。 / For analysts keeping local records of their inputs and decisions.
32
+ まず [日本語のはじめに](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/01-start.md)・[English getting started](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/01-start.md)へ進んでください。
33
+
34
+ # Datumseal
35
+
36
+ - **凍結と照合**:計画書・コード・データをハッシュで凍結し、移動・変更・追加・欠落を照合します。
37
+ - **表の読み取り**:CSV・xlsx・xls の行を理由つきで分類し、問題行と元のセルを残します。
38
+ - **改定の台帳**:改定範囲と一次の引用を持つ台帳を検査し、指定日の版や対象期の最後の改定を調べます。複数の台帳・記録集を混ぜて読み、衝突時は `--prefer` で採る入力を指定できます。
39
+ - **見た値の記録**:系列・期間・版を追記し、凍結前に見た範囲を確認します。
40
+
41
+ 統計の自動取得は行いません。自己ハッシュは第三者署名や時刻証明ではありません。
42
+
43
+ ## 入れ方 / Installation
44
+
45
+ Python 3.11 以上を `python3 --version` で確かめ、PyPI から
46
+ `uv tool install datumseal` で入れます。
47
+ uv が無ければ `python3 -m pip install --user datumseal` を使います。
48
+ `datumseal --version` で確認してください。xlrd は自動で入り、.xls の読み取りだけに使います。
49
+
50
+ Check Python 3.11+ with `python3 --version`, install from PyPI using `uv tool install datumseal` or `python3 -m pip install --user datumseal`,
51
+ and confirm with `datumseal --version`. pip and uv install xlrd automatically for .xls reading.
52
+ Follow the first example in the manual below.
53
+
54
+ ## 説明書 / Manuals
55
+
56
+ | 内容 / Topic | 日本語 | English |
57
+ | --- | --- | --- |
58
+ | 入れ方・5分の例 / Getting started | [01 はじめに](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/01-start.md) | [01 Getting started](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/01-start.md) |
59
+ | 終了コード・直し方 / Exit codes and remedies | [02 終了コードと理由](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/02-codes.md) | [02 Exit codes and reasons](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/02-codes.md) |
60
+ | JSON と Schema / JSON and schemas | [03 JSON の形](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/03-json.md) | [03 JSON format](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/03-json.md) |
61
+ | Stata・R / Stata and R | [04 Stata・R](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/04-stata-r.md) | [04 Stata and R](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/04-stata-r.md) |
62
+ | 過去の版・記録集 / Past vintages and record packs | [05 記録集](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/05-record-packs.md) | [05 Record packs](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/05-record-packs.md) |
63
+
64
+ 公開版の変化 / User-visible changes: [CHANGELOG](https://github.com/vfsoftware/datumseal/blob/v0.2.0/CHANGELOG.md)
65
+
66
+ ## 改定の台帳 / Revision ledger
67
+
68
+ 台帳の書き方と試し方は[日本語01](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/01-start.md)、値の対応表と記録集の使い方は[日本語05](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/05-record-packs.md)へ進んでください。
69
+ See [English 01](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/01-start.md) to write and try a ledger, and [English 05](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/05-record-packs.md) for allowed values and record packs.
70
+
71
+ 開発者向け / For developers: [台帳の開発・互換性の確認](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/dev/ledger-development.md)
@@ -0,0 +1,42 @@
1
+ 計画書・コード・データの凍結と照合、表の読み取り、改定の台帳、見た値の記録を行う CLI です。 / A CLI for file freezing and comparison, table reading, revision ledgers, and records of values seen.
2
+ 入力や判断の理由を手元に残す分析担当者向けです。 / For analysts keeping local records of their inputs and decisions.
3
+ まず [日本語のはじめに](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/01-start.md)・[English getting started](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/01-start.md)へ進んでください。
4
+
5
+ # Datumseal
6
+
7
+ - **凍結と照合**:計画書・コード・データをハッシュで凍結し、移動・変更・追加・欠落を照合します。
8
+ - **表の読み取り**:CSV・xlsx・xls の行を理由つきで分類し、問題行と元のセルを残します。
9
+ - **改定の台帳**:改定範囲と一次の引用を持つ台帳を検査し、指定日の版や対象期の最後の改定を調べます。複数の台帳・記録集を混ぜて読み、衝突時は `--prefer` で採る入力を指定できます。
10
+ - **見た値の記録**:系列・期間・版を追記し、凍結前に見た範囲を確認します。
11
+
12
+ 統計の自動取得は行いません。自己ハッシュは第三者署名や時刻証明ではありません。
13
+
14
+ ## 入れ方 / Installation
15
+
16
+ Python 3.11 以上を `python3 --version` で確かめ、PyPI から
17
+ `uv tool install datumseal` で入れます。
18
+ uv が無ければ `python3 -m pip install --user datumseal` を使います。
19
+ `datumseal --version` で確認してください。xlrd は自動で入り、.xls の読み取りだけに使います。
20
+
21
+ Check Python 3.11+ with `python3 --version`, install from PyPI using `uv tool install datumseal` or `python3 -m pip install --user datumseal`,
22
+ and confirm with `datumseal --version`. pip and uv install xlrd automatically for .xls reading.
23
+ Follow the first example in the manual below.
24
+
25
+ ## 説明書 / Manuals
26
+
27
+ | 内容 / Topic | 日本語 | English |
28
+ | --- | --- | --- |
29
+ | 入れ方・5分の例 / Getting started | [01 はじめに](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/01-start.md) | [01 Getting started](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/01-start.md) |
30
+ | 終了コード・直し方 / Exit codes and remedies | [02 終了コードと理由](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/02-codes.md) | [02 Exit codes and reasons](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/02-codes.md) |
31
+ | JSON と Schema / JSON and schemas | [03 JSON の形](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/03-json.md) | [03 JSON format](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/03-json.md) |
32
+ | Stata・R / Stata and R | [04 Stata・R](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/04-stata-r.md) | [04 Stata and R](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/04-stata-r.md) |
33
+ | 過去の版・記録集 / Past vintages and record packs | [05 記録集](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/05-record-packs.md) | [05 Record packs](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/05-record-packs.md) |
34
+
35
+ 公開版の変化 / User-visible changes: [CHANGELOG](https://github.com/vfsoftware/datumseal/blob/v0.2.0/CHANGELOG.md)
36
+
37
+ ## 改定の台帳 / Revision ledger
38
+
39
+ 台帳の書き方と試し方は[日本語01](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/01-start.md)、値の対応表と記録集の使い方は[日本語05](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/ja/05-record-packs.md)へ進んでください。
40
+ See [English 01](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/01-start.md) to write and try a ledger, and [English 05](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/en/05-record-packs.md) for allowed values and record packs.
41
+
42
+ 開発者向け / For developers: [台帳の開発・互換性の確認](https://github.com/vfsoftware/datumseal/blob/v0.2.0/docs/dev/ledger-development.md)
@@ -0,0 +1,100 @@
1
+ # 利用部品と配布範囲
2
+
3
+ - 自作のライブラリ・CLI・試験: MIT(LICENSE)。
4
+ - 外部の実行時Pythonパッケージ: xlrd 2.0.2(BSD、旧 .xls の読み取り専用)の1つ。下の「許可」を参照。CSV、ZIP、XML、CLI、JSON Schemaの限定語彙検証にはPython標準ライブラリを利用。試験は Python 標準ライブラリで動く。xlrd は実行時の依存で、試験の .xls の確認でも使う。公式の検査器との照合だけ、試験専用の任意依存である jsonschema を使い、入っていなければその確認は skip になる。wheel をビルドする確認は setuptools が使える環境でだけ行い、無ければ skip になる。Schema・検証器・見本も自作部分(MIT)。PyQt6・PySide6は使用しない。
5
+ - Python実行環境: PSF License等のPythonに付属するライセンスが適用される。Python本体はこのリポジトリに同梱しない。
6
+ - setuptools: Pythonパッケージのビルドに指定するMITのツール。実行時依存ではない。
7
+
8
+ Python、Expat、zlib等を別のアプリに同梱する場合は、それぞれのライセンスと表示義務が適用される。このリポジトリの実装・試験は、同梱物全体のライセンスの監査や、署名・公証・販売配布の受入を証明するものではない。
9
+
10
+ ## 固定した版
11
+
12
+ - xlrd 2.0.2(BSD、実行時の依存、旧 .xls の読み取り専用)。`xlrd==2.0.2` を pyproject.toml の `dependencies` と uv.lock で固定している。
13
+ - jsonschema 4.26.0(MIT、試験だけの依存、配布物に入らない)。`jsonschema==4.26.0` を pyproject.toml の `optional-dependencies.test` と uv.lock で固定している。
14
+
15
+ jsonschema が連れてくる試験用の部品(すべて試験だけ、配布物に入れない)と版・ライセンス: attrs 26.1.0(MIT)・jsonschema-specifications 2025.9.1(MIT)・referencing 0.37.0(MIT)・rpds-py 2026.9.1(MIT)・typing-extensions 4.16.0(PSF、Python 3.11 のみ)。版は uv.lock で固定している。
16
+
17
+ 試験用の仮想環境: Python 3.11・3.14 に上記の固定した版を使用します。試験環境自体は配布物に含めません。
18
+
19
+ ## xlrd の許可文全文(配布物に同梱)
20
+
21
+ xlrd 2.0.2 の dist-info/LICENSE の原文を、旧部分の許可文・謝辞も含めて転載する。製品 wheel の dist-info に本ファイルを同梱する。
22
+
23
+ ```text
24
+ There are two licenses associated with xlrd. This one relates to the bulk of
25
+ the work done on the library::
26
+
27
+ Portions copyright © 2005-2009, Stephen John Machin, Lingfo Pty Ltd
28
+ All rights reserved.
29
+
30
+ Redistribution and use in source and binary forms, with or without
31
+ modification, are permitted provided that the following conditions are met:
32
+
33
+ 1. Redistributions of source code must retain the above copyright notice,
34
+ this list of conditions and the following disclaimer.
35
+
36
+ 2. Redistributions in binary form must reproduce the above copyright notice,
37
+ this list of conditions and the following disclaimer in the documentation
38
+ and/or other materials provided with the distribution.
39
+
40
+ 3. None of the names of Stephen John Machin, Lingfo Pty Ltd and any
41
+ contributors may be used to endorse or promote products derived from this
42
+ software without specific prior written permission.
43
+
44
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
45
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
46
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
47
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
48
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
49
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
50
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
51
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
52
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
53
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
54
+ THE POSSIBILITY OF SUCH DAMAGE.
55
+
56
+ This one covers some earlier work::
57
+
58
+ /*-
59
+ * Copyright (c) 2001 David Giffin.
60
+ * All rights reserved.
61
+ *
62
+ * Based on the the Java version: Andrew Khan Copyright (c) 2000.
63
+ *
64
+ *
65
+ * Redistribution and use in source and binary forms, with or without
66
+ * modification, are permitted provided that the following conditions
67
+ * are met:
68
+ *
69
+ * 1. Redistributions of source code must retain the above copyright
70
+ * notice, this list of conditions and the following disclaimer.
71
+ *
72
+ * 2. Redistributions in binary form must reproduce the above copyright
73
+ * notice, this list of conditions and the following disclaimer in
74
+ * the documentation and/or other materials provided with the
75
+ * distribution.
76
+ *
77
+ * 3. All advertising materials mentioning features or use of this
78
+ * software must display the following acknowledgment:
79
+ * "This product includes software developed by
80
+ * David Giffin <david@giffin.org>."
81
+ *
82
+ * 4. Redistributions of any form whatsoever must retain the following
83
+ * acknowledgment:
84
+ * "This product includes software developed by
85
+ * David Giffin <david@giffin.org>."
86
+ *
87
+ * THIS SOFTWARE IS PROVIDED BY DAVID GIFFIN ``AS IS'' AND ANY
88
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
89
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
90
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID GIFFIN OR
91
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
92
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
93
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
94
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
95
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
96
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
97
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
98
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
99
+ */
100
+ ```
@@ -0,0 +1,8 @@
1
+ """Portable preregistration snapshots and content-first verification."""
2
+ from .version import TOOL_VERSION as __version__
3
+ from .manifest import ManifestError, freeze, load_manifest, write_manifest
4
+ from .comparison import compare
5
+ from .markdown import manifest_markdown, write_markdown
6
+
7
+ __all__ = ["ManifestError", "freeze", "load_manifest", "write_manifest", "compare",
8
+ "manifest_markdown", "write_markdown"]
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ raise SystemExit(main())
@@ -0,0 +1,295 @@
1
+ """Command-line interface: JSON for automation, Japanese text for review."""
2
+ import argparse
3
+ import json
4
+ import os
5
+ from pathlib import Path
6
+ import sys
7
+
8
+ from . import ManifestError, compare, freeze, load_manifest, write_manifest
9
+ from .markdown import manifest_markdown, write_markdown
10
+ from .manifest import ManifestStopped
11
+ from .seen_cli import (validate_contract, register_seen, add_read_seen_arguments, record_read)
12
+ from .envelope import envelope, finding
13
+ from .registry import register_schemas
14
+ from .output import (OutputRequest, OutputUsageError, register_output_arguments,
15
+ recover_output_request, emit_output, result_paths)
16
+ from datumseal.ledger import asof
17
+
18
+
19
+ def _inside(path, root):
20
+ path = Path(os.path.abspath(path))
21
+ root = Path(os.path.abspath(root))
22
+ try:
23
+ return path.relative_to(root).as_posix()
24
+ except ValueError:
25
+ # Mac may accept two Unicode spellings of one parent directory.
26
+ # Compare directory identity, not just normalized absolute strings:
27
+ # other filesystems can have distinct NFC/NFD sibling directories.
28
+ for parent in path.parents:
29
+ try:
30
+ if parent.samefile(root):
31
+ return path.relative_to(parent).as_posix()
32
+ except OSError:
33
+ continue
34
+ return None
35
+
36
+
37
+ def _quoted(path):
38
+ return json.dumps(path, ensure_ascii=False)
39
+
40
+
41
+ def _human_report(report):
42
+ lines = ["凍結との照合", f"記録 SHA-256: {report['manifest_sha256']}",
43
+ "中身: " + ("一致" if report["content_matches"] else "差分あり")]
44
+ for key, title in (("unchanged", "同じ"), ("moved", "道だけ変わった・中身は同じ"),
45
+ ("modified", "中身が変わった"), ("added", "足された"), ("removed", "消えた")):
46
+ lines.append(f"{title}: {len(report[key])} 件")
47
+ for entry in report[key]:
48
+ path = _quoted(entry["path"])
49
+ if key == "moved":
50
+ path = f"{_quoted(entry['old_path'])} → {path}"
51
+ lines.append(f" {path}")
52
+ lines.append(f"改行だけの差(CRLF/LF・元のバイトは不一致): {len(report['text_normalized'])} 件")
53
+ for entry in report["text_normalized"]:
54
+ lines.append(f" {_quoted(entry['path'])}")
55
+ for warning in report["warnings"]:
56
+ lines.append(f"警告: {warning['reason']}")
57
+ lines.append(" 凍結時: " + json.dumps(warning["frozen_paths"], ensure_ascii=False))
58
+ lines.append(" 現在: " + json.dumps(warning["current_paths"], ensure_ascii=False))
59
+ for group in report["ambiguous_moves"]:
60
+ lines.append("移動の対応が未確定: " + json.dumps(
61
+ {"frozen_paths": group["frozen_paths"], "current_paths": group["current_paths"]}, ensure_ascii=False))
62
+ statuses = {"match": "一致", "mismatch": "不一致", "not_checked": "未照合(指定なし)",
63
+ "no_frozen_code": "照合不可(凍結時のコード指定なし)"}
64
+ code = report["judgment_code"]
65
+ lines.append("判定用コード: " + statuses[code["status"]])
66
+ for key, title in (("missing", "一致しない凍結コード"), ("unexpected", "凍結に対応しない判定コード")):
67
+ for entry in code[key]:
68
+ lines.append(f" {title}: {_quoted(entry['path'])} SHA-256={entry['sha256']}")
69
+ lines.append("除外パス: " + json.dumps(report["excluded_paths"], ensure_ascii=False))
70
+ lines.append("無視規則: " + json.dumps(report["ignore_rules"], ensure_ascii=False))
71
+ for marker in report["unicode_normalizations"]:
72
+ lines.append("Unicode 正規化の表記差: "
73
+ f"{_quoted(marker['frozen_path'])} → {_quoted(marker['path'])}")
74
+ return "\n".join(lines)
75
+
76
+
77
+ class UsageError(ValueError):
78
+ """Argparse usage failure, caught at the shared JSON boundary."""
79
+
80
+
81
+ class Parser(argparse.ArgumentParser):
82
+ def error(self, message):
83
+ # Do not echo user-supplied values into machine diagnostics.
84
+ self.print_usage(sys.stderr)
85
+ raise UsageError("コマンドの引数が不正です。--help を確認してください")
86
+
87
+
88
+ def _json_option(parser):
89
+ parser.add_argument("--json", action="store_true", default=argparse.SUPPRESS,
90
+ help="結果を標準出力の単一 JSON で表示")
91
+
92
+
93
+ def register_read(commands):
94
+ from datumseal.tables.cli import add_read_arguments
95
+ read = commands.add_parser("read", help="CSV・xlsx の行を理由つきで検査")
96
+ add_read_arguments(read)
97
+ add_read_seen_arguments(read)
98
+ _json_option(read)
99
+ read.set_defaults(handler=_read, canonical="read")
100
+
101
+
102
+ def register_freeze(commands):
103
+ create = commands.add_parser("freeze", help="ルート内のファイルを JSON 記録に凍結")
104
+ create.add_argument("root", type=Path)
105
+ create.add_argument("--output", required=True, type=Path, help="新規 JSON ファイル(上書き不可)")
106
+ for flag in ("document", "code", "data"):
107
+ create.add_argument(f"--{flag}", action="append", default=[], help="役割の相対パス(繰り返し可)")
108
+ create.add_argument("--ignore", action="append", default=[], help="追加の無視規則(繰り返し可)")
109
+ create.add_argument("--no-default-ignores", action="store_true")
110
+ create.add_argument("--markdown-output", type=Path, help="同じ記録の Markdown 表を新規保存")
111
+ create.add_argument("--asof", help="版を求める日付 YYYY-MM-DD(--ledger と併用)")
112
+ create.add_argument("--ledger", help="凍結ルート内の台帳ファイルまたは記録集フォルダの相対パス")
113
+ create.add_argument("--vintage-series", nargs=2, action="append", default=[], metavar=("STATISTIC", "SERIES"))
114
+ create.add_argument("--base", help="asof に渡す基準(完全一致)")
115
+ _json_option(create)
116
+ create.set_defaults(handler=_freeze, canonical="freeze")
117
+
118
+
119
+ def register_verify(commands):
120
+ for name in ("verify", "compare"):
121
+ check = commands.add_parser(name, help="凍結記録と現在の中身を照合" + ("(非推奨の別名)" if name == "compare" else ""))
122
+ check.add_argument("manifest", type=Path)
123
+ if name == "compare":
124
+ check.add_argument("root", type=Path)
125
+ else:
126
+ check.add_argument("root", type=Path, nargs="?", help="省略時は manifest の親フォルダ")
127
+ check.add_argument("--judgment-code", action="append", help="判定用コードの相対パス(繰り返し可)")
128
+ check.add_argument("--text-normalize", action="store_true", help="CRLF/LF だけの差を別記")
129
+ _json_option(check)
130
+ check.set_defaults(handler=_verify, canonical="verify")
131
+
132
+
133
+ def register_ledger(commands):
134
+ ledger = commands.add_parser("ledger", help="改定台帳の検査")
135
+ _json_option(ledger)
136
+ actions = ledger.add_subparsers(dest="ledger_command", required=True)
137
+ check = actions.add_parser("validate", help="JSON Lines 台帳を検査")
138
+ check.add_argument("ledger", nargs="+")
139
+ check.add_argument("--prefer")
140
+ _json_option(check)
141
+ check.set_defaults(canonical="ledger validate") # run by datumseal.ledger.pack._adapt (validate_sources)
142
+ latest = actions.add_parser("asof", help="指定日の時点で最新の版を取り出す")
143
+ latest.add_argument("ledger", nargs="+")
144
+ latest.add_argument("--prefer")
145
+ latest.add_argument("--statistic", required=True)
146
+ latest.add_argument("--series", required=True)
147
+ latest.add_argument("--date", required=True)
148
+ latest.add_argument("--base", default=None)
149
+ _json_option(latest)
150
+ latest.set_defaults(handler=_asof, canonical="ledger asof")
151
+ from datumseal.ledger.last_revision import register_last_revision
152
+ register_last_revision(actions)
153
+ from datumseal.ledger.pack import register_pack_inputs
154
+ register_pack_inputs(actions)
155
+
156
+
157
+ # Add a registrar for each future command family (e.g. seen). No placeholder commands.
158
+ COMMAND_REGISTRARS = (register_read, register_freeze, register_verify, register_ledger)
159
+
160
+
161
+ def build_parser():
162
+ parser = Parser(prog="datumseal", description="表の検査・凍結と照合・改定台帳")
163
+ _json_option(parser)
164
+ commands = parser.add_subparsers(dest="command", required=True)
165
+ for register in COMMAND_REGISTRARS:
166
+ register(commands)
167
+ register_seen(commands)
168
+ render = commands.add_parser("markdown", help="既存の凍結記録を Markdown 表へ(互換機能)")
169
+ render.add_argument("manifest", type=Path)
170
+ render.add_argument("--output", type=Path)
171
+ _json_option(render)
172
+ render.set_defaults(handler=_markdown, canonical="markdown")
173
+ register_schemas(commands)
174
+ register_output_arguments(parser)
175
+ return parser
176
+
177
+
178
+ def _read(args):
179
+ from datumseal.tables.cli import build_report
180
+ value, _ = build_report(args)
181
+ if args.record_seen is not None:
182
+ record_read(args, value)
183
+ return value, None
184
+
185
+
186
+ def _freeze(args):
187
+ outputs = [args.output] + ([args.markdown_output] if args.markdown_output else [])
188
+ for output in outputs:
189
+ if output.exists() or output.is_symlink():
190
+ raise FileExistsError()
191
+ if args.markdown_output and os.path.abspath(args.output) == os.path.abspath(args.markdown_output):
192
+ raise ManifestError("JSON と Markdown には別々の新規出力先が必要です")
193
+ internal = [rel for output in outputs + result_paths(args) if (rel := _inside(output, args.root))]
194
+ manifest = freeze(args.root, documents=args.document, code=args.code, data=args.data,
195
+ exclude=internal, ignore=args.ignore,
196
+ asof=args.asof, ledger=args.ledger, vintage_series=args.vintage_series, base=args.base,
197
+ default_ignores=not args.no_default_ignores)
198
+ write_manifest(manifest, args.output)
199
+ if args.markdown_output:
200
+ write_markdown(manifest, args.markdown_output)
201
+ return manifest, f"凍結しました: {len(manifest['files'])} 件\n記録 SHA-256: {manifest['manifest_sha256']}"
202
+
203
+
204
+ def _verify(args):
205
+ if args.command == "compare":
206
+ print("非推奨: compare は verify を使用してください。", file=sys.stderr)
207
+ root = args.root if args.root is not None else args.manifest.parent
208
+ manifest = load_manifest(args.manifest)
209
+ internal = _inside(args.manifest, root)
210
+ report = compare(manifest, root, judgment_code=args.judgment_code,
211
+ exclude=[internal] if internal else [], text_normalize=args.text_normalize)
212
+ return report, _human_report(report)
213
+
214
+
215
+ def _asof(args):
216
+ value = asof(args.ledger, args.statistic, args.series, args.date, base=args.base, prefer=args.prefer)
217
+ if value.get("found"):
218
+ row = value["selected"]
219
+ human = f"最新版: {row['vintage_id']}(公表日 {row['release_date']}、順番 {row['release_seq']})"
220
+ else:
221
+ human = "\n".join(item["reason"] for item in value["findings"])
222
+ return value, human
223
+
224
+
225
+ def _markdown(args):
226
+ manifest = load_manifest(args.manifest)
227
+ text = manifest_markdown(manifest)
228
+ if args.output:
229
+ write_markdown(manifest, args.output)
230
+ value = dict(envelope("markdown_result", "markdown"), markdown=text)
231
+ return value, "" if args.output else text.rstrip("\n")
232
+
233
+
234
+ def _error(command, code, reason, issue_code):
235
+ return dict(envelope("command_error", command, code,
236
+ [finding("stop", issue_code, reason, command)]), error=reason)
237
+
238
+
239
+ def _command_hint(argv):
240
+ """Keep the attempted command in reports even when parsing fails."""
241
+ tokens = [token for token in argv if token != "--json"]
242
+ if tokens and tokens[0] in ("read", "freeze", "verify", "markdown", "compare"):
243
+ return "verify" if tokens[0] == "compare" else tokens[0]
244
+ if len(tokens) >= 2 and tokens[0] == "ledger" and tokens[1] in ("validate", "asof"):
245
+ return "ledger " + tokens[1]
246
+ return "datumseal"
247
+
248
+
249
+ def main(argv=None):
250
+ argv = list(sys.argv[1:] if argv is None else argv)
251
+ if argv == ["--version"]:
252
+ from .version import TOOL_VERSION
253
+ print(TOOL_VERSION)
254
+ return 0
255
+ json_requested = "--json" in argv
256
+ command = _command_hint(argv)
257
+ default_json = False
258
+ serialized = None
259
+ output = None
260
+ try:
261
+ parser = build_parser()
262
+ args = parser.parse_args(argv)
263
+ command = args.canonical
264
+ default_json = command == "read"
265
+ json_requested = getattr(args, "json", False)
266
+ output = OutputRequest.from_args(args)
267
+ output.prepare(args)
268
+ value, human = args.handler(args)
269
+ validate_contract(value, value["type"])
270
+ # ASCII escapes preserve cells/reasons while also supporting ASCII stdout.
271
+ # Serialization failures belong to the same C1 exception boundary.
272
+ if json_requested or default_json:
273
+ serialized = json.dumps(value, ensure_ascii=True, allow_nan=False)
274
+ except (UsageError, OutputUsageError) as error:
275
+ value, human = _error(command, 2, str(error), "usage_error"), None
276
+ except ManifestStopped as error:
277
+ value, human = _error(command, 1, str(error), "input_stopped"), None
278
+ except (ManifestError, OSError) as error:
279
+ # OSError.__str__ can contain absolute paths. Do not serialize it.
280
+ reason = str(error) if isinstance(error, ManifestError) else "入力または出力を読み書きできません"
281
+ if isinstance(error, FileExistsError):
282
+ reason = "出力先が既に存在します。別の新規ファイルを指定してください"
283
+ value, human = _error(command, 2, reason, "invalid_input"), None
284
+ except Exception:
285
+ value, human = _error(command, 3, "内部の失敗により処理を停止しました", "internal_error"), None
286
+ output = output if output is not None else recover_output_request(argv)
287
+ if output.active:
288
+ return emit_output(output, value, json_requested=json_requested)
289
+ if json_requested or default_json:
290
+ print(serialized if serialized is not None else json.dumps(value, ensure_ascii=True, allow_nan=False))
291
+ elif value["type"] == "command_error":
292
+ print("エラー: " + value["error"], file=sys.stderr)
293
+ elif human:
294
+ print(human)
295
+ return value["exit_code"]