8000 the line number of the yaml file is displayed in the error message by andreaa93 · Pull Request #34 · FAIRmat-NFDI/pynxtools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

the line number of the yaml file is displayed in the error message #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
- uses: actions/checkout@v2
with:
lfs: true
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: 3.8
- name: Install dependencies
run: |
git submodule sync --recursive
Expand Down
588 changes: 0 additions & 588 deletions nexusparser/tools/yaml2nxdl/NXellipsometry-docCheck.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions nexusparser/tools/yaml2nxdl/NXtest_links.nxdl.xml

This file was deleted.

8 changes: 0 additions & 8 deletions nexusparser/tools/yaml2nxdl/NXtest_links.yml

This file was deleted.

755 changes: 0 additions & 755 deletions nexusparser/tools/yaml2nxdl/Ref_NXellipsometry-docCheck.nxdl.xml

This file was deleted.

Oops, something went wrong.
25 changes: 19 additions & 6 deletions nexusparser/tools/yaml2nxdl/yaml2nxdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,25 @@ def yaml2nxdl(input_file: str, verbose: bool):
application and base are valid categories!'
assert 'doc' in yml_appdef.keys(), 'Required root-level keyword doc is missing!'

xml_root.set('extends', 'NXobject')
xml_root.set('type', 'group')

if 'extends' in yml_appdef.keys():
xml_root.set('extends', yml_appdef['extends'])
del yml_appdef['extends']
else:
xml_root.set('extends', 'NXobject')

if yml_appdef['category'] == 'application':
xml_root.set('category', 'application')
del yml_appdef['category']
else:
xml_root.set('category', 'base')
del yml_appdef['category']
del yml_appdef['category']

if 'symbols' in yml_appdef.keys():
yaml2nxdl_forward_tools.xml_handle_symbols(xml_root, yml_appdef['symbols'])
yaml2nxdl_forward_tools.xml_handle_symbols(yml_appdef,
xml_root,
'symbols',
yml_appdef['symbols'])
del yml_appdef['symbols']

assert isinstance(yml_appdef['doc'], str) and yml_appdef['doc'] != '', 'Doc \
Expand All @@ -119,9 +127,14 @@ def yaml2nxdl(input_file: str, verbose: bool):

del yml_appdef['doc']

assert len(yml_appdef.keys()) == 1, 'Accepting at most keywords: category, \
root_keys = 0
for key in yml_appdef.keys():
if '__line__' not in key:
root_keys += 1

assert root_keys == 1, 'Accepting at most keywords: category, \
doc, symbols, and NX... at root-level!'
keyword = list(yml_appdef.keys())[0] # which is the only one
keyword = list(yml_appdef.keys())[0]
assert (keyword[0:3] == '(NX' and keyword[-1:] == ')' and len(keyword) > 4), 'NX \
keyword has an invalid pattern, or is too short!'
xml_root.set('name', keyword[1:-1])
Expand Down
Loading
0