Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

dumper.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. """
  2. Dumps odML-Structures
  3. """
  4. from .xmlparser import to_csv
  5. def get_props(obj, props):
  6. out = []
  7. for p in props:
  8. if hasattr(obj, p):
  9. x = getattr(obj, p)
  10. if x is not None:
  11. if isinstance(x, list) or isinstance(x, tuple):
  12. out.append("%s=%s" % (p, to_csv(x)))
  13. else:
  14. out.append("%s=%s" % (p, repr(x)))
  15. return ", ".join(out)
  16. def dumpProperty(property, indent=1):
  17. # TODO : (PEP8) Find a better way to split the following line
  18. print("%*s:%s (%s)" % (indent, " ", property.name,
  19. get_props(property, ["definition", "values", "uncertainty", "unit",
  20. "dtype", "value_reference", "dependency",
  21. "dependencyValue"])))
  22. def dumpSection(section, indent=1):
  23. if section is None:
  24. return
  25. # TODO : (PEP8) Find a better way to split the following line
  26. print("%*s*%s (%s)" % (indent, " ", section.name,
  27. get_props(section, ["type", "definition", "link",
  28. "include", "repository"])))
  29. for prop in section.properties:
  30. dumpProperty(prop, indent + 1)
  31. for sub in section.sections:
  32. dumpSection(sub, indent * 2)
  33. def dumpDoc(doc):
  34. for sec in doc:
  35. dumpSection(sec)