Skip to content

Commit e83ebf1

Browse files
committed
reformatted OpenDX.py with black
1 parent 2915ee5 commit e83ebf1

1 file changed

Lines changed: 20 additions & 24 deletions

File tree

gridData/OpenDX.py

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@
202202
:members:
203203
204204
"""
205+
205206
import numpy
206207
import re
207208
import gzip
@@ -279,9 +280,7 @@ class gridpositions(DXclass):
279280
def __init__(self, classid, shape=None, origin=None, delta=None, **kwargs):
280281
if shape is None or origin is None or delta is None:
281282
raise ValueError("all keyword arguments are required")
282-
super().__init__(classid,
283-
name="gridpositions",
284-
component="positions")
283+
super().__init__(classid, name="gridpositions", component="positions")
285284
self.shape = numpy.asarray(shape) # D dimensional shape
286285
self.origin = numpy.asarray(origin) # D vector
287286
self.rank = len(self.shape) # D === rank
@@ -302,9 +301,7 @@ def __init__(self, classid, shape=None, origin=None, delta=None, **kwargs):
302301
)
303302

304303
def write(self, stream):
305-
super().write(
306-
stream, ("counts " + self.ndformat(" %d")) % tuple(self.shape)
307-
)
304+
super().write(stream, ("counts " + self.ndformat(" %d")) % tuple(self.shape))
308305
self._write_line(stream, "origin %f %f %f\n" % tuple(self.origin))
309306
for delta in self.delta:
310307
self._write_line(
@@ -330,9 +327,7 @@ class gridconnections(DXclass):
330327
def __init__(self, classid, shape=None, **kwargs):
331328
if shape is None:
332329
raise ValueError("all keyword arguments are required")
333-
super().__init__(classid,
334-
name="gridconnections",
335-
component="connections")
330+
super().__init__(classid, name="gridconnections", component="connections")
336331
self.shape = numpy.asarray(shape) # D dimensional shape
337332

338333
def write(self, stream):
@@ -411,9 +406,7 @@ def __init__(self, classid, array=None, type=None, typequote='"', **kwargs):
411406
"""
412407
if array is None:
413408
raise ValueError("array keyword argument is required")
414-
super().__init__(classid,
415-
name="array",
416-
component="data")
409+
super().__init__(classid, name="array", component="data")
417410
# detect type https://github.com/MDAnalysis/GridDataFormats/issues/35
418411
if type is None:
419412
self.array = numpy.asarray(array)
@@ -545,10 +538,11 @@ def __init__(self, classid="0", components=None, comments=None):
545538
dx = OpenDX.field('density',[gridpoints,gridconnections,array])
546539
547540
"""
548-
super().__init__(classid, # can be an arbitrary string
549-
name="field",
550-
component=None, # cannot be a component of a field
551-
)
541+
super().__init__(
542+
classid, # can be an arbitrary string
543+
name="field",
544+
component=None, # cannot be a component of a field
545+
)
552546
if components is None:
553547
components = dict(positions=None, connections=None, data=None)
554548
if comments is None:
@@ -586,8 +580,8 @@ def from_grid(cls, grid, type=None, typequote='"', **kwargs):
586580
-------
587581
field
588582
OpenDX field wrapper
589-
590-
583+
584+
591585
.. versionadded:: 1.2.0
592586
"""
593587
comments = [
@@ -614,10 +608,10 @@ def from_grid(cls, grid, type=None, typequote='"', **kwargs):
614608
@property
615609
def native(self):
616610
"""Return native object
617-
611+
618612
The "native" object is the :class:`gridData.OpenDX.field` itself.
619-
620-
613+
614+
621615
.. versionadded:: 1.2.0
622616
"""
623617
return self
@@ -685,9 +679,11 @@ def read(self, stream):
685679
except (UnicodeDecodeError, RecursionError) as err:
686680
# parser got confused, likely not a valid file
687681
# (RecursionError was only observed on Windows)
688-
raise ValueError("DX file could not be read. "
689-
"The original error was\n"
690-
f" {err.__class__.__name__}: {err}")
682+
raise ValueError(
683+
"DX file could not be read. "
684+
"The original error was\n"
685+
f" {err.__class__.__name__}: {err}"
686+
)
691687

692688
def add(self, component, DXobj):
693689
"""add a component to the field"""

0 commit comments

Comments
 (0)