You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pre-commit rules remove unused variables but does not delete the object assigned to that variable
During the testing process of PR #56 I discovered the pre-commit rules had deleted an unused variable but did not delete the subsequent code / object assigned to that variable. This resulted in error B018 Found useless attribute access. Either assign it to a variable or remove it.
How to reproduce
Original code lines in utilities.py:
battery_annual_energy_kwh = hopp_results["annual_energies"]["battery"] # annual energy from battery (kWh)
battery_system_capacity_kwh = hopp_results["hybrid_plant"].battery.system_capacity_kwh # battery rated capacity (kWh)
where the two variables were not used later in the code
run pre-commit run --file greenheart/tools/eco/utilities.py
Relevant output
greenheart/tools/eco/utilities.py:1479:5: B018 Found useless attribute access. Either assign it to a variable or remove it.
|
1477 | ] # annual energy from solar (kWh)
1478 | hopp_results["annual_energies"]["battery"] # annual energy from battery (kWh)
1479 | hopp_results["hybrid_plant"].battery.system_capacity_kwh # battery rated capacity (kWh)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B018
1480 | wind_turbine_rating_MW = (
1481 | hopp_config["technologies"]["wind"]["turbine_rating_kw"] / 1000
System Information
OS: <macOS 15.2>
Python version: <3.11.10>
GreenHEART version: <0.1.1>
The text was updated successfully, but these errors were encountered:
pre-commit rules remove unused variables but does not delete the object assigned to that variable
During the testing process of PR #56 I discovered the pre-commit rules had deleted an unused variable but did not delete the subsequent code / object assigned to that variable. This resulted in error B018 Found useless attribute access. Either assign it to a variable or remove it.
How to reproduce
Original code lines in utilities.py:
where the two variables were not used later in the code
run pre-commit run --file greenheart/tools/eco/utilities.py
Relevant output
System Information
The text was updated successfully, but these errors were encountered: