Skip to content

Commit

Permalink
Make pep8 bot happy
Browse files Browse the repository at this point in the history
  • Loading branch information
ritiek committed Jun 27, 2018
1 parent 1361cec commit a404ddb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions plasmapy/classes/sources/openpmd_hdf5.py
Expand Up @@ -76,7 +76,6 @@ def __init__(self, hdf5, **kwargs):

self.subname = tuple(self.h5['data'])[0]


def _check_valid_openpmd_version(self):
try:
openPMD_version = self.h5.attrs["openPMD"].decode('utf-8')
Expand Down Expand Up @@ -117,7 +116,7 @@ def charge_density(self):

@classmethod
def is_datasource_for(cls, **kwargs):
if not "hdf5" in kwargs:
if "hdf5" not in kwargs:
return False

hdf5 = kwargs.get("hdf5")
Expand All @@ -127,7 +126,7 @@ def is_datasource_for(cls, **kwargs):
if not isfile:
raise FileNotFoundError(f"Could not find file: '{hdf5}'")

if not "openPMD" in kwargs and isfile:
if "openPMD" not in kwargs and isfile:
h5 = h5py.File(hdf5)
try:
openPMD = h5.attrs["openPMD"]
Expand Down
4 changes: 3 additions & 1 deletion plasmapy/classes/sources/tests/test_openpmd_hdf5.py
Expand Up @@ -49,7 +49,7 @@ def test_correct_shape_charge_density(self):


units_test_table = [
((1., 1., 0., -1., 0. ,0., 2.),
((1., 1., 0., -1., 0., 0., 2.),
u.m * u.kg / u.amp * u.cd ** 2),
((1, 0, 1, 2, 0, 0, 0),
u.m * u.s * u.amp ** 2),
Expand All @@ -58,6 +58,8 @@ def test_correct_shape_charge_density(self):
([2, 1, -3, -2, 0, 0, 0],
u.ohm)
]


@pytest.mark.parametrize("openPMD_dims, expected", units_test_table)
def test_fetch_units(openPMD_dims, expected: Union[Tuple, List]):
units = openpmd_hdf5._fetch_units(openPMD_dims)
Expand Down
5 changes: 1 addition & 4 deletions plasmapy/data/test/__init__.py
@@ -1,10 +1,7 @@
from pathlib import Path
import os
import glob

import plasmapy

rootdir = Path(os.path.join(os.path.dirname(plasmapy.__file__),
"data",
"test"))
rootdir = os.path.join(os.path.dirname(plasmapy.__file__), "data", "test"))
file_list = glob.glob(os.path.join(rootdir, '*.[!p]*'))

0 comments on commit a404ddb

Please sign in to comment.