Skip to content

Commit 35e8750

Browse files
committed
Clean up
1 parent 4009efe commit 35e8750

File tree

6 files changed

+24
-20
lines changed

6 files changed

+24
-20
lines changed

docs/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import os
77
from datetime import date
8+
89
from linkml_arrays import __version__
910

1011
# -- Project information -----------------------------------------------------

src/linkml_arrays/dumpers/yaml_array_file_dumper.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""Base class for dumpling a LinkML model to a YAML file with paths to NumPy files."""
22

3-
from typing import Union, List
4-
from pathlib import Path
53
import os
64
from abc import ABCMeta, abstractmethod
75
from collections.abc import Callable
6+
from pathlib import Path
7+
from typing import List, Union
88

99
import numpy as np
1010
import yaml

src/linkml_arrays/dumpers/yaml_hdf5_dumper.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""Class for dumping a LinkML model to a YAML file with paths to HDF5 files."""
22

3+
from pathlib import Path
4+
from typing import List, Union
5+
36
import h5py
47
import numpy as np
5-
from pathlib import Path
6-
from typing import Union, List
78

89
from .yaml_array_file_dumper import YamlArrayFileDumper
910

src/linkml_arrays/dumpers/yaml_numpy_dumper.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
"""Class for dumpling a LinkML model to a YAML file with paths to NumPy files."""
22

3-
import numpy as np
43
from pathlib import Path
5-
from typing import Union, List
4+
from typing import List, Union
5+
6+
import numpy as np
67

78
from .yaml_array_file_dumper import YamlArrayFileDumper
89

tests/array_classes_lol.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
from __future__ import annotations
2-
from datetime import datetime, date
3-
from decimal import Decimal
4-
from enum import Enum
2+
53
import re
64
import sys
7-
from typing import Any, ClassVar, List, Literal, Dict, Optional, Union
5+
from datetime import date, datetime
6+
from decimal import Decimal
7+
from enum import Enum
8+
from typing import Any, ClassVar, Dict, List, Literal, Optional, Union
9+
810
from pydantic.version import VERSION as PYDANTIC_VERSION
911

1012
if int(PYDANTIC_VERSION[0]) >= 2:

tests/test_dumpers/test_dumpers.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
import os
44
import unittest
5-
import h5py
6-
import zarr
7-
from ruamel.yaml import YAML
85
from pathlib import Path
96

7+
import h5py
108
import numpy as np
9+
import zarr
1110
from linkml_runtime import SchemaView
11+
from ruamel.yaml import YAML
1212

1313
from linkml_arrays.dumpers import (
1414
Hdf5Dumper,
@@ -105,12 +105,12 @@ def test_yaml_hdf5_dumper():
105105
assert actual == expected
106106

107107

108-
def test_hdf5_dumper():
108+
def test_hdf5_dumper(tmp_path):
109109
"""Test Hdf5Dumper dumping to an HDF5 file."""
110110
container = create_container()
111111

112112
schemaview = SchemaView(INPUT_DIR / "temperature_schema.yaml")
113-
output_file_path = "my_container.h5"
113+
output_file_path = tmp_path / "my_container.h5"
114114
Hdf5Dumper().dumps(container, schemaview=schemaview, output_file_path=output_file_path)
115115

116116
assert os.path.exists(output_file_path)
@@ -135,20 +135,19 @@ def test_hdf5_dumper():
135135
)
136136

137137

138-
def test_zarr_directory_store_dumper():
138+
def test_zarr_directory_store_dumper(tmp_path):
139139
"""Test ZarrDumper dumping to an HDF5 file."""
140140
container = create_container()
141141

142142
schemaview = SchemaView(INPUT_DIR / "temperature_schema.yaml")
143-
output_file_path = "my_container.zarr"
143+
output_file_path = tmp_path / "my_container.zarr"
144144
ZarrDirectoryStoreDumper().dumps(
145145
container, schemaview=schemaview, output_file_path=output_file_path
146146
)
147147

148-
file_path = "my_container.zarr"
149-
assert os.path.exists(file_path)
148+
assert os.path.exists(output_file_path)
150149

151-
root = zarr.group(store=file_path)
150+
root = zarr.group(store=output_file_path)
152151
# NOTE this is pretty much the same code as test_hdf5_dumper
153152
assert root.attrs["name"] == "my_container"
154153
assert set(root["latitude_series"].keys()) == set(["values"])

0 commit comments

Comments
 (0)