Comments (2)
This looks like the wrong function call. Everything in the cli.py
is intended to be called via the command line interface (hence the name). They look like callable python functions, but the @-wrappers actually change how the function call works. What you want is what is inside the function, i.e.:
from omi.dialects import get_dialect
file_path = "in.json"
o = "out.json" # or None for printing
f = "oep-v1.4"
t = "oep-v1.4"
with open(file_path, "r") as infile:
from_dialect = get_dialect(f)()
obj = from_dialect.parse(infile.read())
to_dialect = get_dialect(t)()
s = to_dialect.compile_and_render(obj)
if o:
with open(o, "w") as outfile:
outfile.write(s)
else:
print(s)
Instead of loading the dialects dynamically (get_dialect(f)(), etc.), you can also use the respective dialect directly:
from_dialect = to_dialect = OEP_V_1_4_Dialect
from omi.
Thanks @MGlauer, works like a charm 👍
from omi.
Related Issues (20)
- Source code is cluttered
- New validation function needed
- Conversion update for 1.5.2, 1.6 and 2.0
- More Error messages needed HOT 4
- Conversion creates empty fields when adding new metadata keys
- The metadata generated by the omi compiler has a modified key sequence HOT 1
- Documentation on how to use conversion is missing in RTD and Readme
- Include the metadata validation scripts from the oedatamodel HOT 14
- omi compiler for oemetadata results in some unexpected key names
- Adapt to github actions from travis
- OMI omits `null` values from json during processing
- Compiling metadata with minimum or empty fields causes a NoneType error.
- Return error report in OMI validation
- Inconsistent omi field names compared to oemetadata spec
- Evaluate integration of functions to generate metadata with ioprocmeta HOT 1
- metadata parser wrongly adds current date to temporal metadata
- Add new Issue-Templates
- Document and reuse existing methods to (auto-)generate OEMetadata
- Minor improvements to the key sequence and some api enhancements
- OMI rewrite
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 omi.