From a190c3912783d3d2a7b545485808b6d7675a1e4c Mon Sep 17 00:00:00 2001 From: Kyle Oman Date: Sat, 30 Nov 2024 22:37:41 +0800 Subject: [PATCH] Run formatter. --- .../metadata/metadata/metadata_fields.py | 2 +- swiftsimio/metadata/objects.py | 38 ++++++++----------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/swiftsimio/metadata/metadata/metadata_fields.py b/swiftsimio/metadata/metadata/metadata_fields.py index 75e12a5e..a032e039 100644 --- a/swiftsimio/metadata/metadata/metadata_fields.py +++ b/swiftsimio/metadata/metadata/metadata_fields.py @@ -77,7 +77,7 @@ def generate_cosmo_args_header_unpack_arrays(scale_factor) -> dict: # should not be cosmo_array'd). cosmo_args = { "boxsize": dict( - cosmo_factor=cosmo_factor(a**1, scale_factor=scale_factor), + cosmo_factor=cosmo_factor(a ** 1, scale_factor=scale_factor), comoving=True, # if it's not, then a=1 and it doesn't matter valid_transform=True, ) diff --git a/swiftsimio/metadata/objects.py b/swiftsimio/metadata/objects.py index 14a7385b..411deeb7 100644 --- a/swiftsimio/metadata/objects.py +++ b/swiftsimio/metadata/objects.py @@ -113,14 +113,12 @@ def postprocess_header(self): # items including the scale factor. # These must be unpacked as they are stored as length-1 arrays - header_unpack_float_units = ( - metadata.metadata_fields.generate_units_header_unpack_single_float( - m=self.units.mass, - l=self.units.length, - t=self.units.time, - I=self.units.current, - T=self.units.temperature, - ) + header_unpack_float_units = metadata.metadata_fields.generate_units_header_unpack_single_float( + m=self.units.mass, + l=self.units.length, + t=self.units.time, + I=self.units.current, + T=self.units.temperature, ) for field, names in metadata.metadata_fields.header_unpack_single_float.items(): try: @@ -166,19 +164,15 @@ def postprocess_header(self): self.scale_factor = 1.0 # These are just read straight in to variables - header_unpack_arrays_units = ( - metadata.metadata_fields.generate_units_header_unpack_arrays( - m=self.units.mass, - l=self.units.length, - t=self.units.time, - I=self.units.current, - T=self.units.temperature, - ) + header_unpack_arrays_units = metadata.metadata_fields.generate_units_header_unpack_arrays( + m=self.units.mass, + l=self.units.length, + t=self.units.time, + I=self.units.current, + T=self.units.temperature, ) - header_unpack_arrays_cosmo_args = ( - metadata.metadata_fields.generate_cosmo_args_header_unpack_arrays( - self.scale_factor - ) + header_unpack_arrays_cosmo_args = metadata.metadata_fields.generate_cosmo_args_header_unpack_arrays( + self.scale_factor ) for field, name in metadata.metadata_fields.header_unpack_arrays.items(): @@ -610,7 +604,7 @@ def get_units(unit_attribute): # Need to check if the exponent is 0 manually because of float precision unit_exponent = unit_attribute[f"U_{exponent} exponent"][0] if unit_exponent != 0.0: - units *= unit**unit_exponent + units *= unit ** unit_exponent except KeyError: # Can't load that data! # We should probably warn the user here... @@ -708,7 +702,7 @@ def get_cosmo(dataset): # Can't load, 'graceful' fallback. cosmo_exponent = 0.0 - a_factor_this_dataset = a**cosmo_exponent + a_factor_this_dataset = a ** cosmo_exponent return cosmo_factor(a_factor_this_dataset, current_scale_factor)