prjemian / punx

Python Utilities for NeXus HDF5 files
https://prjemian.github.io/punx
5 stars 7 forks source link

tree: use double quotes when rendering string values #129

Closed prjemian closed 2 years ago

prjemian commented 3 years ago

Per https://github.com/nexusformat/definitions/issues/851, render string values with double quotes and string lists inside [ and ].

carterbox commented 2 years ago

My understanding is that any attribute that is a string should be split at whitespace and be rendered as a list of double quoted substrings. Is this correct? For example

"fee fi fo fum" -> ["fee", "fi", "fo", "fum"] "one-sided aces:2" -> ["one-sided", "aces:2"] "foo" -> ["foo"]

carterbox commented 2 years ago

I think my understanding is incorrect. Because I ended up with something like this:

  S22:NXentry
    @NX_class = ["NXentry"]
    @default = ["data"]
    Q:NX_FLOAT64[3] = [ ... ]
      @description = ["hkl", "at", "start", "of", "scan"]
    T:NX_FLOAT64 = 1.0
      @description = ["SPEC", "scan", "with", "constant", "counting", "time"]
      @units = ["s"]

I guess this rule is only supposed to apply to the @axes attribute?

carterbox commented 2 years ago

Is the @axes attribute allowed to be a non-string or array of non-string? One of the test files has @axes = 1.

prjemian commented 2 years ago

Is the @axes attribute allowed to be non-string ...

I believe that should be an error. Which test file?