sort yaml file (even generated by opencv with bugs)
# for avoiding 'pip Installing collected packages: UNKNOWN'
pip3 install setuptools --upgrade
pip3 install https://github.com/umaumax/yaml-sort/archive/master.tar.gz
yaml-sort in.yml
yaml-sort in.yml out.yml
diff -U 100 <(yaml-sort sample1.yml) <(yaml-sort sample2.yml)
- write test code
[test.yml]
%YAML:1.0
---
set:
- { x:1, y:2, x:[ 1, 0, 0, 1, 1, 0, 1, 1 ] }
tag: !!hello
cols: 3
rows: 4
data: [1,-2,3]
abc: 1234
date: "Fri Jul 26 23:42:37 2019"
%YAML:x.x
: version---
: データ区切り!!xxx
: tag- YAML Ain’t Markup Language (YAML™) Version 1.2
- see:
Secondary Handle
- see:
- YAML Ain’t Markup Language (YAML™) Version 1.2
-
%YAML:1.0
: これは正しくは%YAML 1.0
- YAML Ain’t Markup Language (YAML™) Version 1.2
%YAML
で検索すると正しい例がヒットする(ただし,このフォーマットが正式かどうかについての定義は見つからず)
- YAML Ain’t Markup Language (YAML™) Version 1.2
-
How to skip lines when reading a yaml file in python? - Stack Overflow
- 非常に参考になる
-
pyyaml - yaml.scanner.ScannerError: while scanning a directive - Stack Overflow
-
How do I load an OpenCV generated yaml file in python? - OpenCV Q&A Forum
pip install -U PyYAML
yaml.constructor.ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:opencv-matrix'
CloudFormationのYAMLをPyYAMLで読み込む - GALACTIC1969 - Medium
下記がパースできない
%YAML:1.0
これは,opencv側のbugらしいので,その点では問題ない
abc: {x:[12,3]}
- for pip packaging umaumax/gtrans