From afd4f21703b65214a934d62722309a6b6ee70602 Mon Sep 17 00:00:00 2001 From: Malcolm Ross Date: Fri, 8 Mar 2024 10:58:05 -0600 Subject: [PATCH] Fix check errors (pre-commit) try 2 --- src/geophires_x_client/geophires_x_result.py | 6 +- src/hip_ra/__init__.py | 6 +- src/hip_ra_x/hip_ra_x.py | 154 +++++++++---------- 3 files changed, 83 insertions(+), 83 deletions(-) diff --git a/src/geophires_x_client/geophires_x_result.py b/src/geophires_x_client/geophires_x_result.py index c75f0479..b5716eac 100644 --- a/src/geophires_x_client/geophires_x_result.py +++ b/src/geophires_x_client/geophires_x_result.py @@ -306,9 +306,9 @@ def __init__(self, output_file_path, logger_name='root'): try: self.result['POWER GENERATION PROFILE'] = self._get_power_generation_profile() - self.result[ - 'HEAT AND/OR ELECTRICITY EXTRACTION AND GENERATION PROFILE' - ] = self._get_heat_electricity_extraction_generation_profile() + self.result['HEAT AND/OR ELECTRICITY EXTRACTION AND GENERATION PROFILE'] = ( + self._get_heat_electricity_extraction_generation_profile() + ) except Exception as e: # FIXME self._logger.error(f'Failed to parse power and/or extraction profiles: {e}') diff --git a/src/hip_ra/__init__.py b/src/hip_ra/__init__.py index c5db063a..a602cc46 100644 --- a/src/hip_ra/__init__.py +++ b/src/hip_ra/__init__.py @@ -37,9 +37,9 @@ def _parse_fields(self): matches = re.findall(pattern, text) result = { - key.strip(): {'value': float(value), 'unit': unit.strip()} - if unit - else {'value': float(value), 'unit': None} + key.strip(): ( + {'value': float(value), 'unit': unit.strip()} if unit else {'value': float(value), 'unit': None} + ) for key, value, unit in matches } diff --git a/src/hip_ra_x/hip_ra_x.py b/src/hip_ra_x/hip_ra_x.py index 16b26b75..7cdd9eb2 100644 --- a/src/hip_ra_x/hip_ra_x.py +++ b/src/hip_ra_x/hip_ra_x.py @@ -419,29 +419,29 @@ def parameter_dict_entry(param: Parameter) -> Parameter: PreferredUnits=HeatUnit.KJ, CurrentUnits=HeatUnit.KJ, ) - self.wellhead_heat_recovery_rock = self.OutputParameterDict[ - self.wellhead_heat_recovery_rock.Name - ] = OutputParameter( - Name='Wellhead Heat (rock)', - UnitType=Units.HEAT, - PreferredUnits=HeatUnit.KJ, - CurrentUnits=HeatUnit.KJ, + self.wellhead_heat_recovery_rock = self.OutputParameterDict[self.wellhead_heat_recovery_rock.Name] = ( + OutputParameter( + Name='Wellhead Heat (rock)', + UnitType=Units.HEAT, + PreferredUnits=HeatUnit.KJ, + CurrentUnits=HeatUnit.KJ, + ) ) - self.wellhead_heat_recovery_fluid = self.OutputParameterDict[ - self.wellhead_heat_recovery_fluid.Name - ] = OutputParameter( - Name='Wellhead Heat (fluid)', - UnitType=Units.HEAT, - PreferredUnits=HeatUnit.KJ, - CurrentUnits=HeatUnit.KJ, + self.wellhead_heat_recovery_fluid = self.OutputParameterDict[self.wellhead_heat_recovery_fluid.Name] = ( + OutputParameter( + Name='Wellhead Heat (fluid)', + UnitType=Units.HEAT, + PreferredUnits=HeatUnit.KJ, + CurrentUnits=HeatUnit.KJ, + ) ) - self.reservoir_recovery_factor = self.OutputParameterDict[ - self.reservoir_recovery_factor.Name - ] = OutputParameter( - Name='Recovery Factor (reservoir)', - UnitType=Units.PERCENT, - PreferredUnits=PercentUnit.PERCENT, - CurrentUnits=PercentUnit.PERCENT, + self.reservoir_recovery_factor = self.OutputParameterDict[self.reservoir_recovery_factor.Name] = ( + OutputParameter( + Name='Recovery Factor (reservoir)', + UnitType=Units.PERCENT, + PreferredUnits=PercentUnit.PERCENT, + CurrentUnits=PercentUnit.PERCENT, + ) ) self.recovery_factor_rock = self.OutputParameterDict[self.recovery_factor_rock.Name] = OutputParameter( Name='Recovery Factor (rock)', @@ -473,13 +473,13 @@ def parameter_dict_entry(param: Parameter) -> Parameter: PreferredUnits=HeatUnit.KJ, CurrentUnits=HeatUnit.KJ, ) - self.reservoir_producible_heat = self.OutputParameterDict[ - self.reservoir_producible_heat.Name - ] = OutputParameter( - Name='Producible Heat (reservoir)', - UnitType=Units.HEAT, - PreferredUnits=HeatUnit.KJ, - CurrentUnits=HeatUnit.KJ, + self.reservoir_producible_heat = self.OutputParameterDict[self.reservoir_producible_heat.Name] = ( + OutputParameter( + Name='Producible Heat (reservoir)', + UnitType=Units.HEAT, + PreferredUnits=HeatUnit.KJ, + CurrentUnits=HeatUnit.KJ, + ) ) self.producible_heat_rock = self.OutputParameterDict[self.producible_heat_rock.Name] = OutputParameter( Name='Producible Heat (rock)', @@ -493,37 +493,37 @@ def parameter_dict_entry(param: Parameter) -> Parameter: PreferredUnits=HeatUnit.KJ, CurrentUnits=HeatUnit.KJ, ) - self.reservoir_producible_electricity = self.OutputParameterDict[ - self.reservoir_producible_electricity.Name - ] = OutputParameter( - Name='Producible Electricity (reservoir)', - UnitType=Units.POWER, - PreferredUnits=PowerUnit.MW, - CurrentUnits=PowerUnit.MW, + self.reservoir_producible_electricity = self.OutputParameterDict[self.reservoir_producible_electricity.Name] = ( + OutputParameter( + Name='Producible Electricity (reservoir)', + UnitType=Units.POWER, + PreferredUnits=PowerUnit.MW, + CurrentUnits=PowerUnit.MW, + ) ) - self.producible_electricity_rock = self.OutputParameterDict[ - self.producible_electricity_rock.Name - ] = OutputParameter( - Name='Producible Electricity (rock)', - UnitType=Units.POWER, - PreferredUnits=PowerUnit.MW, - CurrentUnits=PowerUnit.MW, + self.producible_electricity_rock = self.OutputParameterDict[self.producible_electricity_rock.Name] = ( + OutputParameter( + Name='Producible Electricity (rock)', + UnitType=Units.POWER, + PreferredUnits=PowerUnit.MW, + CurrentUnits=PowerUnit.MW, + ) ) - self.producible_electricity_fluid = self.OutputParameterDict[ - self.producible_electricity_fluid.Name - ] = OutputParameter( - Name='Producible Electricity (fluid)', - UnitType=Units.POWER, - PreferredUnits=PowerUnit.MW, - CurrentUnits=PowerUnit.MW, + self.producible_electricity_fluid = self.OutputParameterDict[self.producible_electricity_fluid.Name] = ( + OutputParameter( + Name='Producible Electricity (fluid)', + UnitType=Units.POWER, + PreferredUnits=PowerUnit.MW, + CurrentUnits=PowerUnit.MW, + ) ) - self.producible_heat_per_unit_area = self.OutputParameterDict[ - self.producible_heat_per_unit_area.Name - ] = OutputParameter( - Name='Producible Heat/Unit Area (reservoir)', - UnitType=Units.HEATPERUNITAREA, - PreferredUnits=HeatPerUnitAreaUnit.KJPERSQKM, - CurrentUnits=HeatPerUnitAreaUnit.KJPERSQKM, + self.producible_heat_per_unit_area = self.OutputParameterDict[self.producible_heat_per_unit_area.Name] = ( + OutputParameter( + Name='Producible Heat/Unit Area (reservoir)', + UnitType=Units.HEATPERUNITAREA, + PreferredUnits=HeatPerUnitAreaUnit.KJPERSQKM, + CurrentUnits=HeatPerUnitAreaUnit.KJPERSQKM, + ) ) self.heat_per_unit_area_rock = self.OutputParameterDict[self.heat_per_unit_area_rock.Name] = OutputParameter( Name='Producible Heat/Unit Area (rock)', @@ -537,13 +537,13 @@ def parameter_dict_entry(param: Parameter) -> Parameter: PreferredUnits=HeatPerUnitAreaUnit.KJPERSQKM, CurrentUnits=HeatPerUnitAreaUnit.KJPERSQKM, ) - self.heat_per_unit_volume_reservoir = self.OutputParameterDict[ - self.heat_per_unit_volume_reservoir.Name - ] = OutputParameter( - Name='Producible Heat/Unit Volume (reservoir)', - UnitType=Units.HEATPERUNITVOLUME, - PreferredUnits=HeatPerUnitVolumeUnit.KJPERCUBICKM, - CurrentUnits=HeatPerUnitVolumeUnit.KJPERCUBICKM, + self.heat_per_unit_volume_reservoir = self.OutputParameterDict[self.heat_per_unit_volume_reservoir.Name] = ( + OutputParameter( + Name='Producible Heat/Unit Volume (reservoir)', + UnitType=Units.HEATPERUNITVOLUME, + PreferredUnits=HeatPerUnitVolumeUnit.KJPERCUBICKM, + CurrentUnits=HeatPerUnitVolumeUnit.KJPERCUBICKM, + ) ) self.producible_electricity_per_unit_area = self.OutputParameterDict[ self.producible_electricity_per_unit_area.Name @@ -553,21 +553,21 @@ def parameter_dict_entry(param: Parameter) -> Parameter: PreferredUnits=PowerPerUnitAreaUnit.MWPERSQKM, CurrentUnits=PowerPerUnitAreaUnit.MWPERSQKM, ) - self.electricity_per_unit_area_rock = self.OutputParameterDict[ - self.electricity_per_unit_area_rock.Name - ] = OutputParameter( - Name='Producible Electricity/Unit Area (rock)', - UnitType=Units.POWERPERUNITAREA, - PreferredUnits=PowerPerUnitAreaUnit.MWPERSQKM, - CurrentUnits=PowerPerUnitAreaUnit.MWPERSQKM, + self.electricity_per_unit_area_rock = self.OutputParameterDict[self.electricity_per_unit_area_rock.Name] = ( + OutputParameter( + Name='Producible Electricity/Unit Area (rock)', + UnitType=Units.POWERPERUNITAREA, + PreferredUnits=PowerPerUnitAreaUnit.MWPERSQKM, + CurrentUnits=PowerPerUnitAreaUnit.MWPERSQKM, + ) ) - self.electricity_per_unit_area_fluid = self.OutputParameterDict[ - self.electricity_per_unit_area_fluid.Name - ] = OutputParameter( - Name='Producible Electricity/Unit Area (fluid)', - UnitType=Units.POWERPERUNITAREA, - PreferredUnits=PowerPerUnitAreaUnit.MWPERSQKM, - CurrentUnits=PowerPerUnitAreaUnit.MWPERSQKM, + self.electricity_per_unit_area_fluid = self.OutputParameterDict[self.electricity_per_unit_area_fluid.Name] = ( + OutputParameter( + Name='Producible Electricity/Unit Area (fluid)', + UnitType=Units.POWERPERUNITAREA, + PreferredUnits=PowerPerUnitAreaUnit.MWPERSQKM, + CurrentUnits=PowerPerUnitAreaUnit.MWPERSQKM, + ) ) self.electricity_per_unit_volume_reservoir = self.OutputParameterDict[ self.electricity_per_unit_volume_reservoir.Name