!20 Add a decoder implementing the toml-test protocol
From: @linker99 Reviewed-by: @Charlie_li Signed-off-by: @Charlie_li
This commit is contained in:
commit
138601d679
41
Add-a-decoder-implementing-the-toml-test-protocol.patch
Normal file
41
Add-a-decoder-implementing-the-toml-test-protocol.patch
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
From f527cd48a3e6232ace55a3e76a2f413eeca04242 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Martin=20Vejn=C3=A1r?= <vejnar.martin@gmail.com>
|
||||||
|
Date: Sun, 28 Oct 2018 13:29:01 +0100
|
||||||
|
Subject: [PATCH] Add a decoder implementing the `toml-test` protocol
|
||||||
|
|
||||||
|
---
|
||||||
|
test/decoder.py | 22 ++++++++++++++++++++++
|
||||||
|
1 file changed, 22 insertions(+)
|
||||||
|
create mode 100644 test/decoder.py
|
||||||
|
|
||||||
|
diff --git a/test/decoder.py b/test/decoder.py
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..26efe79
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/decoder.py
|
||||||
|
@@ -0,0 +1,22 @@
|
||||||
|
+#!/usr/bin/env python
|
||||||
|
+
|
||||||
|
+import argparse
|
||||||
|
+import json
|
||||||
|
+import pytoml
|
||||||
|
+import sys
|
||||||
|
+
|
||||||
|
+def _main():
|
||||||
|
+ ap = argparse.ArgumentParser()
|
||||||
|
+ ap.add_argument('-i', '--input', type=argparse.FileType('r', encoding='utf-8'))
|
||||||
|
+ ap.add_argument('-o', '--output', type=argparse.FileType('w', encoding='utf-8'), default='-')
|
||||||
|
+ args = ap.parse_args()
|
||||||
|
+
|
||||||
|
+ if not args.input:
|
||||||
|
+ args.input = sys.stdin.buffer
|
||||||
|
+
|
||||||
|
+ v = pytoml.load(args.input)
|
||||||
|
+ translated = pytoml.translate_to_test(v)
|
||||||
|
+ json.dump(translated, args.output)
|
||||||
|
+
|
||||||
|
+if __name__ == '__main__':
|
||||||
|
+ _main()
|
||||||
|
--
|
||||||
|
2.42.0.windows.2
|
||||||
|
|
||||||
@ -11,6 +11,7 @@ Patch0: Add-.vscode-and-.pytest_cache-to-.gitignore.patch
|
|||||||
Patch1: Fix-datetime-serialization.patch
|
Patch1: Fix-datetime-serialization.patch
|
||||||
Patch2: Reject-invalid-escapes-in-strings.patch
|
Patch2: Reject-invalid-escapes-in-strings.patch
|
||||||
Patch3: Avoid-annoying-SystemExit-breaks-in-vscode.patch
|
Patch3: Avoid-annoying-SystemExit-breaks-in-vscode.patch
|
||||||
|
Patch4: Add-a-decoder-implementing-the-toml-test-protocol.patch
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
%global my_description \
|
%global my_description \
|
||||||
@ -64,6 +65,9 @@ BuildRequires: python3-setuptools
|
|||||||
%{python3_sitelib}/%{github_name}/
|
%{python3_sitelib}/%{github_name}/
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Dec 27 2023 fandehui <fandehui@xfusion.com> - 0.1.18-7
|
||||||
|
- Add a decoder implementing the `toml-test` protocol
|
||||||
|
|
||||||
* Mon Dec 11 2023 fandehui <fandehui@xfusion.com> - 0.1.18-6
|
* Mon Dec 11 2023 fandehui <fandehui@xfusion.com> - 0.1.18-6
|
||||||
- Avoid annoying SystemExit breaks in vscode
|
- Avoid annoying SystemExit breaks in vscode
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user