Skip to content

Commit

Permalink
Other minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterKraus committed Apr 6, 2024
1 parent a47297c commit 4f8351a
Show file tree
Hide file tree
Showing 31 changed files with 37 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/yadg/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=
env=env,
stdout=subprocess.PIPE,
stderr=(subprocess.PIPE if hide_stderr else None),
**popen_kwargs
**popen_kwargs,
)
break
except OSError:
Expand Down
4 changes: 4 additions & 0 deletions src/yadg/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def process_schema(dataschema: DataSchema, strict_merge: bool = False) -> DataTr

while hasattr(dataschema, "update"):
dataschema = dataschema.update()
if hasattr(dataschema, "metadata"):
if hasattr(dataschema.metadata, "version"):
if dataschema.metadata.version == "5.0":
break

for si, step in enumerate(dataschema.steps):
logger.info("Processing step %d:", si)
Expand Down
3 changes: 2 additions & 1 deletion src/yadg/dgutils/pintutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
quantities (smL/min, sccm), and other dimensionless "units" present in several
file types.
"""

import logging
from typing import Union
import pint
Expand Down Expand Up @@ -48,7 +49,7 @@ def _sanitize_helper(unit: str) -> str:


def sanitize_units(
units: Union[str, dict[str, str], list[str]]
units: Union[str, dict[str, str], list[str]],
) -> Union[str, dict[str, str], list[str]]:
"""
Unit sanitizer.
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/chromdata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
````````````````
"""

import xarray as xr

from . import (
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/chromdata/empalccsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
.. codeauthor:: Peter Kraus
"""

import logging
import datetime
from uncertainties.core import str_to_number_with_uncert as tuple_fromstr
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/chromdata/empalcxlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
.. codeauthor:: Peter Kraus
"""

import logging
import datetime
import openpyxl
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/chromdata/fusioncsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
.. codeauthor:: Peter Kraus
"""

import logging
from zoneinfo import ZoneInfo
from ...dgutils.dateutils import str_to_uts
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/chromdata/fusionjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
.. codeauthor:: Peter Kraus
"""

import json
import logging
from zoneinfo import ZoneInfo
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/chromdata/fusionzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
.. codeauthor:: Peter Kraus
"""

import zipfile
import tempfile
import os
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/chromtrace/agilentch.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
.. codeauthor:: Peter Kraus
"""

import numpy as np
from zoneinfo import ZoneInfo
from ... import dgutils
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/chromtrace/agilentcsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
.. codeauthor:: Peter Kraus
"""

import numpy as np
from zoneinfo import ZoneInfo
from uncertainties.core import str_to_number_with_uncert as tuple_fromstr
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/chromtrace/agilentdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
.. codeauthor:: Peter Kraus
"""

import zipfile
import tempfile
import os
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/chromtrace/ezchromasc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.. codeauthor:: Peter Kraus
"""

import numpy as np
import logging
from zoneinfo import ZoneInfo
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/chromtrace/fusionjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
.. codeauthor:: Peter Kraus
"""

import json
from zoneinfo import ZoneInfo
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/chromtrace/fusionzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
.. codeauthor:: Peter Kraus
"""

import zipfile
import tempfile
import os
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/dummy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
````````````````
"""

from pydantic import BaseModel
import json
from ... import dgutils
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/electrochem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
````````````````
"""

import xarray as xr
from . import eclabmpr, eclabmpt, tomatojson

Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/electrochem/eclabcommon/techniques.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
in :func:`get_resolution`.
"""

import re
import numpy as np
from typing import Union
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/electrochem/eclabmpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
.. codeauthor:: Nicolas Vetsch
"""

import logging
from zoneinfo import ZoneInfo
import xarray as xr
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/electrochem/eclabmpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
.. codeauthor:: Nicolas Vetsch
"""

import re
import logging
import locale as lc
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/flowdata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
````````````````
"""

from .main import process

__all__ = ["process"]
1 change: 1 addition & 0 deletions src/yadg/parsers/flowdata/drycal.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
.. codeauthor:: Peter Kraus
"""

from striprtf.striprtf import rtf_to_text
from ..basiccsv.main import process_row, append_dicts, dicts_to_dataset
from ... import dgutils
Expand Down
1 change: 0 additions & 1 deletion src/yadg/parsers/flowdata/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def process(
"""

if filetype.startswith("drycal"):

if filetype.endswith(".rtf") or fn.endswith("rtf"):
vals = drycal.rtf(fn, encoding, timezone)
elif filetype.endswith(".csv") or fn.endswith("csv"):
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/masstrace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
````````````````
"""

import datatree
from . import quadstarsac

Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/masstrace/quadstarsac.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
.. codeauthor:: Nicolas Vetsch
"""

import numpy as np
from datatree import DataTree
import xarray as xr
Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/qftrace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
````````````````
"""

from . import labviewcsv
import datatree

Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/xpstrace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
````````````````
"""

import datatree
from . import phispe

Expand Down
1 change: 1 addition & 0 deletions src/yadg/parsers/xrdtrace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
intensity: (uts, angle) # Detector intensity (counts)
"""

import xarray as xr
from . import panalyticalxrdml, panalyticalcsv, panalyticalxy

Expand Down
4 changes: 4 additions & 0 deletions src/yadg/subcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ def process(args: argparse.Namespace) -> None:

while hasattr(ds, "update"):
ds = ds.update()
if hasattr(ds, "metadata"):
if hasattr(ds.metadata, "version"):
if ds.metadata.version == "5.0":
break

logger.debug("Processing schema")
datagram = core.process_schema(ds, strict_merge=not args.ignore_merge_errors)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_basiccsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@
},
},
},
),
],
)
Expand Down Expand Up @@ -300,4 +299,4 @@ def test_issue_143(datadir):
ver = input.pop("version", "4.0")
ret = datagram_from_input(input, "basiccsv", datadir, version=ver)
print(f"{ret=}")
assert ret['0']['DryCal smL_min'].attrs["units"] == "smL/min"
assert ret["0"]["DryCal smL_min"].attrs["units"] == "smL/min"
4 changes: 1 addition & 3 deletions versioneer.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,7 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=
return stdout, process.returncode


LONG_VERSION_PY[
"git"
] = r'''
LONG_VERSION_PY["git"] = r'''
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
Expand Down

0 comments on commit 4f8351a

Please sign in to comment.