Skip to content

Commit 6937bf1

Browse files
committed
rebase and black/flake8 without fixing long lines
1 parent 6b8496b commit 6937bf1

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

xbout/xarraybackend.py

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,15 @@
1515
import numpy as np
1616
from adios2 import FileReader
1717

18-
# from xarray.core.dataset import Dataset
1918
from xarray import Dataset, Variable
20-
from xarray import coding, conventions
2119
from xarray.backends.common import (
22-
BACKEND_ENTRYPOINTS,
23-
AbstractWritableDataStore,
2420
BackendArray,
2521
BackendEntrypoint,
26-
_encode_variable_name,
2722
_normalize_path,
2823
)
2924

30-
# from xarray.backends.store import StoreBackendEntrypoint
3125
from xarray.core import indexing
3226

33-
# from xarray.core.indexing import LazilyIndexedArray
34-
35-
# from xarray.core.parallelcompat import guess_chunkmanager
36-
# from xarray.core.pycompat import integer_types
37-
# from xarray.core.utils import (
38-
# FrozenDict,
39-
# HiddenKeyDict,
40-
# close_on_error,
41-
# )
42-
4327
if TYPE_CHECKING:
4428
from io import BufferedIOBase
4529
from xarray.backends.common import AbstractDataStore
@@ -69,7 +53,9 @@
6953
class BoutADIOSBackendArray(BackendArray):
7054
"""ADIOS2 backend for lazily indexed arrays"""
7155

72-
def __init__(self, shape: list, dtype: np.dtype, lock, adiosfile: FileReader, varname: str):
56+
def __init__(
57+
self, shape: list, dtype: np.dtype, lock, adiosfile: FileReader, varname: str
58+
):
7359
self.shape = shape
7460
self.dtype = dtype
7561
self.lock = lock
@@ -94,7 +80,7 @@ def _raw_indexing_method(self, key: tuple) -> np.typing.ArrayLike:
9480
# f"key = {key} steps = {self.steps}")
9581
# print(f" data shape {data.shape}")
9682

97-
# thread safe method that access to data on disk needed because
83+
# thread safe method that access to data on disk needed because
9884
# adios is not thread safe even for reading
9985
# with self.lock:
10086
start = []
@@ -103,17 +89,17 @@ def _raw_indexing_method(self, key: tuple) -> np.typing.ArrayLike:
10389
first_sl = True
10490
for sl in key:
10591
if isinstance(sl, slice):
106-
if sl.start == None:
92+
if sl.start is None:
10793
st = 0
10894
else:
10995
st = sl.start
11096

111-
if sl.stop == None:
97+
if sl.stop is None:
11298
ct = self.shape[dimid] - st
11399
else:
114100
ct = sl.stop - st
115101

116-
if sl.step != 1 and sl.step != None:
102+
if sl.step != 1 and sl.step is not None:
117103
msg = (
118104
"The indexing operation with step != 1 you are attempting to perform "
119105
"is not valid on ADIOS2.Variable object. "
@@ -284,7 +270,9 @@ def open_dataset( # type: ignore[override] # allow LSP violation, not supporti
284270
avar.set_step_selection([0, avar.steps()])
285271
data = self._fh.read(avar)
286272
# print(f"\tCreate timed scalar variable {varname}")
287-
xvar = Variable("t", data, attrs=xattrs, encoding={"dtype": data.dtype})
273+
xvar = Variable(
274+
"t", data, attrs=xattrs, encoding={"dtype": data.dtype}
275+
)
288276
else:
289277
data = self._fh.read(varname)
290278
if varinfo["Type"] == "string":

0 commit comments

Comments
 (0)