Comments (7)
Is this not what you expect?
>>> import hiyapyco
>>> yaml1="""
... yaml: 1
... saml: 0
... baml: 2
... """
>>> yaml2="""
... gaml: cool
... yaml: good
... saml: not working
... """
>>> conf = hiyapyco.load([yaml1, yaml2], method=hiyapyco.METHOD_MERGE)
>>> print(hiyapyco.dump(conf))
yaml: good
saml: not working
baml: 2
gaml: cool
>>>
from hiyapyco.
why do i get something like this, see the brackets :
templates:
utter_ask_answer:
- {text: Type the answer to the question}
utter_exercise_submit:
- {text: finished}
utter_process_answer:
- {text: 'process answer : answer <=> expected_result'}
from hiyapyco.
can you provide me some reproducible code samples please?
I am unable to reproduce this.
>>> import hiyapyco
>>> c="""
... m:
... - a: A
... b: BB
... c: BABA
... - a: ABBA
... b: BAAB
... c: C
... - a: CACA
... b: ACAC
... c:
... - suba: aaa
... subb: bbbb
... subc: ccc
... """
>>> conf = hiyapyco.load([c])
>>> print(hiyapyco.dump(conf))
m:
- a: A
b: BB
c: BABA
- a: ABBA
b: BAAB
c: C
- a: CACA
b: ACAC
c:
- suba: aaa
subb: bbbb
subc: ccc
>>>
>>> c="""
... templates:
... utter_ask_answer:
... - {text: Type the answer to the question}
... utter_exercise_submit:
... - {text: finished}
... utter_process_answer:
... - {text: 'process answer : answer <=> expected_result'}
... """
>>> conf = hiyapyco.load([c])
>>> print(hiyapyco.dump(conf))
templates:
utter_ask_answer:
- text: Type the answer to the question
utter_exercise_submit:
- text: finished
utter_process_answer:
- text: 'process answer : answer <=> expected_result'
>>>
from hiyapyco.
Interesting .... here is what I get (even if I remove the brackets from the source) :
/and as you see I get this dump of data on .load() !!/
In [6]: c="""
...: templates:
...: utter_ask_answer:
...: - {text: Type the answer to the question}
...: utter_exercise_submit:
...: - {text: finished}
...: utter_process_answer:
...: - {text: 'process answer : answer <=> expected_result'}
...: """
In [7]: conf = hiyapyco.load([c])
yamlfile:
templates:
utter_ask_answer:
- {text: Type the answer to the question}
utter_exercise_submit:
- {text: finished}
utter_process_answer:
- {text: 'process answer : answer <=> expected_result'}
...
loading yaml doc from str ...
yaml data: OrderedDict([('templates', OrderedDict([('utter_ask_answer', [OrderedDict([('text', 'Type the answer to the question')])]), ('utter_exercise_submit', [OrderedDict([('text', 'finished')])]), ('utter_process_answer', [OrderedDict([('text', 'process answer : answer <=> expected_result')])])]))])
In [8]: print(hiyapyco.dump(conf))
templates:
utter_ask_answer:
- {text: Type the answer to the question}
utter_exercise_submit:
- {text: finished}
utter_process_answer:
- {text: 'process answer : answer <=> expected_result'}
from hiyapyco.
Can you please provide some information regarding:
- OS
- python interpreter and version
- pyyaml aka. python-yaml version
- hiyapyco version
- everything else you consider valuable / noteworthy
Try to use the
usedefaultyamlloader=True
arg while loading the yaml @ hiyapyco.load
and see if there is a difference in the output
from hiyapyco.
# python --version
Python 2.7.15rc1
# pip show pyyaml
Name: PyYAML
Version: 3.10
# pip show hiyapyco
Name: HiYaPyCo
Version: 0.4.14
from hiyapyco.
use default_flow_style=False
arg for dump
seems this is some default that changed in the pyyaml lib somewhere between 3.12 and 3.13 ...
>>> import hiyapyco
>>> c="""
... templates:
... utter_ask_answer:
... - {text: Type the answer to the question}
... utter_exercise_submit:
... - {text: finished}
... utter_process_answer:
... - {text: 'process answer : answer <=> expected_result'}
... """
>>>
>>> conf = hiyapyco.load([c])
>>> print(hiyapyco.dump(conf))
templates:
utter_ask_answer:
- {text: Type the answer to the question}
utter_exercise_submit:
- {text: finished}
utter_process_answer:
- {text: 'process answer : answer <=> expected_result'}
>>> print(hiyapyco.dump(conf, default_flow_style=False))
templates:
utter_ask_answer:
- text: Type the answer to the question
utter_exercise_submit:
- text: finished
utter_process_answer:
- text: 'process answer : answer <=> expected_result'
from hiyapyco.
Related Issues (20)
- what are the requirements for this package? HOT 2
- New Merge Method proposal HOT 7
- is there a way to use ruamel YAML isntead of pyyaml? HOT 1
- Jinja2 dependency increased to include Jinja2 3.x.x HOT 1
- How do you specify jinja variables in yaml files for interpolation? HOT 7
- release pr #42 HOT 2
- Cannot import name 'soft_unicode' from 'markupsafe' HOT 3
- bring python build process up to date
- github actions HOT 1
- List Items order matters? HOT 1
- ansible !vault variable not load HOT 1
- how add !vault tag HOT 9
- update outdated dependencies HOT 2
- Versioned release HOT 1
- optional: support python3-ruamel HOT 1
- racially loaded terms - rename default branch to main HOT 1
- Wrong Recursive call on method _substmerge HOT 8
- remove deprecated distutils HOT 3
- extend tests to debian 12 HOT 1
- pypi release fails: The description failed to render in the default format of reStructuredText. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hiyapyco.