From 8c48f1f45c70f356f3625be035c2cdfd238138b3 Mon Sep 17 00:00:00 2001 From: Kyle Oman Date: Wed, 17 Apr 2024 12:13:46 +0100 Subject: [PATCH] Lint with black. --- swiftgalaxy/halo_finders.py | 2 -- swiftgalaxy/masks.py | 1 - swiftgalaxy/reader.py | 46 +++++++++++++++++-------------------- tests/toysnap.py | 6 ++--- 4 files changed, 24 insertions(+), 31 deletions(-) diff --git a/swiftgalaxy/halo_finders.py b/swiftgalaxy/halo_finders.py index a522762..f848a78 100644 --- a/swiftgalaxy/halo_finders.py +++ b/swiftgalaxy/halo_finders.py @@ -102,7 +102,6 @@ def velocity_centre(self) -> cosmo_array: class Velociraptor(_HaloFinder): - """ Interface to velociraptor halo catalogues for use with :mod:`swiftgalaxy`. @@ -371,7 +370,6 @@ def __repr__(self) -> str: class Caesar(_HaloFinder): - """ Interface to Caesar halo catalogues for use with :mod:`swiftgalaxy`. diff --git a/swiftgalaxy/masks.py b/swiftgalaxy/masks.py index f9eb1a2..c98288b 100644 --- a/swiftgalaxy/masks.py +++ b/swiftgalaxy/masks.py @@ -1,5 +1,4 @@ class MaskCollection(object): - """ Barebones container for mask objects. diff --git a/swiftgalaxy/reader.py b/swiftgalaxy/reader.py index 98234d6..5c9099d 100644 --- a/swiftgalaxy/reader.py +++ b/swiftgalaxy/reader.py @@ -99,7 +99,6 @@ def _apply_4transform( class _CoordinateHelper(object): - """ Container class for coordinates. @@ -135,7 +134,6 @@ def __repr__(self) -> str: class _SWIFTNamedColumnDatasetHelper(object): - """ A wrapper class to enable :class:`SWIFTGalaxy` functionality for a :class:`swiftsimio.reader.__SWIFTNamedColumnDataset`. @@ -255,7 +253,6 @@ def _data_copy( class _SWIFTParticleDatasetHelper(object): - """ A wrapper class to enable :class:`SWIFTGalaxy` functionality for a :class:`swiftsimio.reader.__SWIFTParticleDataset`. @@ -359,9 +356,9 @@ def __init__( TypeNamedColumnDatasetHelper = type( nice_name, (_SWIFTNamedColumnDatasetHelper, object), dict() ) - self._named_column_dataset_helpers[ - named_columns_name - ] = TypeNamedColumnDatasetHelper(named_columns, self) + self._named_column_dataset_helpers[named_columns_name] = ( + TypeNamedColumnDatasetHelper(named_columns, self) + ) self._spherical_coordinates: Optional[dict] = None self._cylindrical_coordinates: Optional[dict] = None self._spherical_velocities: Optional[dict] = None @@ -949,14 +946,14 @@ def _mask_derived_coordinates(self, mask: slice) -> None: ][mask] if self._cylindrical_coordinates is not None: for coord in ("rho", "phi", "z"): - self._cylindrical_coordinates[ - f"_{coord}" - ] = self._cylindrical_coordinates[f"_{coord}"][mask] + self._cylindrical_coordinates[f"_{coord}"] = ( + self._cylindrical_coordinates[f"_{coord}"][mask] + ) if self._cylindrical_velocities is not None: for coord in ("v_rho", "v_phi", "v_z"): - self._cylindrical_velocities[ - f"_{coord}" - ] = self._cylindrical_velocities[f"_{coord}"][mask] + self._cylindrical_velocities[f"_{coord}"] = ( + self._cylindrical_velocities[f"_{coord}"][mask] + ) return def _void_derived_coordinates(self) -> None: @@ -968,7 +965,6 @@ def _void_derived_coordinates(self) -> None: class SWIFTGalaxy(SWIFTDataset): - """ A representation of a simulated galaxy. @@ -1303,27 +1299,27 @@ def _data_copy(self, mask_collection: Optional[MaskCollection] = None): if particle_dataset_helper._spherical_coordinates is not None: new_particle_dataset_helper._spherical_coordinates = dict() for c in ("_r", "_theta", "_phi"): - new_particle_dataset_helper._spherical_coordinates[ - c - ] = particle_dataset_helper._spherical_coordinates[c][mask] + new_particle_dataset_helper._spherical_coordinates[c] = ( + particle_dataset_helper._spherical_coordinates[c][mask] + ) if particle_dataset_helper._spherical_velocities is not None: new_particle_dataset_helper._spherical_velocities = dict() for c in ("_v_r", "_v_t", "_v_p"): - new_particle_dataset_helper._spherical_velocities[ - c - ] = particle_dataset_helper._spherical_velocities[c][mask] + new_particle_dataset_helper._spherical_velocities[c] = ( + particle_dataset_helper._spherical_velocities[c][mask] + ) if particle_dataset_helper._cylindrical_coordinates is not None: new_particle_dataset_helper._cylindrical_coordinates = dict() for c in ("_rho", "_phi", "_z"): - new_particle_dataset_helper._cylindrical_coordinates[ - c - ] = particle_dataset_helper._cylindrical_coordinates[c][mask] + new_particle_dataset_helper._cylindrical_coordinates[c] = ( + particle_dataset_helper._cylindrical_coordinates[c][mask] + ) if particle_dataset_helper._cylindrical_velocities is not None: new_particle_dataset_helper._cylindrical_velocities = dict() for c in ("_v_rho", "_v_phi", "_v_z"): - new_particle_dataset_helper._cylindrical_velocities[ - c - ] = particle_dataset_helper._cylindrical_velocities[c][mask] + new_particle_dataset_helper._cylindrical_velocities[c] = ( + particle_dataset_helper._cylindrical_velocities[c][mask] + ) return SG def __getattribute__(self, attr: str) -> Any: diff --git a/tests/toysnap.py b/tests/toysnap.py index 715625b..398173c 100644 --- a/tests/toysnap.py +++ b/tests/toysnap.py @@ -838,9 +838,9 @@ def create_toycaesar(filename=toycaesar_filename): # f["/simulation_attributes"].attrs["effective_resolution"] = ... # f["/simulation_attributes"].attrs["fullpath"] = ... f["/simulation_attributes"].attrs["hubble_constant"] = 0.7 - f["/simulation_attributes"].attrs[ - "mean_interparticle_separation" - ] = boxsize.to_value(u.kpc) / n_dm ** (1 / 3) + f["/simulation_attributes"].attrs["mean_interparticle_separation"] = ( + boxsize.to_value(u.kpc) / n_dm ** (1 / 3) + ) f["/simulation_attributes"].attrs["nbh"] = n_bh f["/simulation_attributes"].attrs["ndm"] = n_dm_all f["/simulation_attributes"].attrs["ndust"] = 0