Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 20, 2023
1 parent 3c0556b commit 1671418
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
1 change: 1 addition & 0 deletions znh5md/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ZnH5MD: High Performance Interface for H5MD Trajectories."""

import contextlib
import importlib.metadata

Expand Down
19 changes: 9 additions & 10 deletions znh5md/format/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Format handler for h5md files."""

import contextlib
import dataclasses
import typing
Expand Down Expand Up @@ -33,16 +34,14 @@ class GRP:

@staticmethod
def encode_boundary(value) -> np.ndarray:
return np.array(
[
(
"periodic".encode(encoding="utf-8")
if x
else "none".encode(encoding="utf-8")
)
for x in value
]
)
return np.array([
(
"periodic".encode(encoding="utf-8")
if x
else "none".encode(encoding="utf-8")
)
for x in value
])

@staticmethod
def decode_boundary(value) -> np.ndarray:
Expand Down
12 changes: 6 additions & 6 deletions znh5md/io/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ def append_to_dataset(self, dataset_group: h5py.Group):
self.resize_by_particle_count(dataset_group)
for key in ("value", "time", "step"):
dataset_group[key].resize(n_current_frames + len(self), axis=0)
dataset_group[key][:] = np.concatenate(
[dataset_group[key][:n_current_frames], self.value]
)
dataset_group[key][:] = np.concatenate([
dataset_group[key][:n_current_frames], self.value
])


@dataclasses.dataclass
Expand All @@ -124,9 +124,9 @@ def append_to_dataset(self, dataset_group: h5py.Group):

self.resize_by_particle_count(dataset_group)
dataset_group["value"].resize(n_current_frames + len(self), axis=0)
dataset_group["value"][:] = np.concatenate(
[dataset_group["value"][:n_current_frames], self.value]
)
dataset_group["value"][:] = np.concatenate([
dataset_group["value"][:n_current_frames], self.value
])


CHUNK_DICT = typing.Dict[str, ExplicitStepTimeChunk]
Expand Down
6 changes: 3 additions & 3 deletions znh5md/io/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ def yield_chunks(self) -> typing.Iterator[typing.Dict[str, FixedStepTimeChunk]]:
if "energy" in frame.list_properties():
energy.append(np.copy(frame["energy"]).astype(float))
if "pbc" in frame.list_properties():
pbc.append(
[True if x == "T" else False for x in frame["pbc"].split()]
)
pbc.append([
True if x == "T" else False for x in frame["pbc"].split()
])

if len(positions) == self.frames_per_chunk:
positions = self._fill_with_nan(positions).astype(float)
Expand Down

0 comments on commit 1671418

Please sign in to comment.