Skip to content

Commit bfca34c

Browse files
committed
Fix linting issues
1 parent 3f701a6 commit bfca34c

File tree

6 files changed

+8
-7
lines changed

6 files changed

+8
-7
lines changed

.github/workflows/python-app.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ jobs:
3434
- name: Lint with flake8
3535
run: |
3636
# stop the build if there are Python syntax errors or undefined names
37-
flake8 . --ignore=E501,F401,W503,E266 --count --select=E9,F63,F7,F82 --show-source --statistics
37+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
3838
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
39-
flake8 . --ignore=E501,F401,W503,E266,C901 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
39+
flake8 . --ignore=E501,W503,E266,C901 --count --exit-zero --max-complexity=10 --statistics
4040
4141
- name: Unit testing
4242
run: |

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ dependencies = [
3333
"geopandas >= 1.0.1",
3434
"contextily >= 1.6.2",
3535
"coverage[toml] >= 7.8.0",
36+
"flake8 >= 7.2.0",
3637
]
3738
requires-python = ">=3.10"
3839

src/pownet/core/data_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def create_cycle_map(self) -> None:
252252
)
253253
cycles = nx.cycle_basis(graph)
254254
# Save this map to be uses by ModelBuilder
255-
self.cycle_map = {f"cycle_{idx+1}": cycle for idx, cycle in enumerate(cycles)}
255+
self.cycle_map = {f"cycle_{idx + 1}": cycle for idx, cycle in enumerate(cycles)}
256256

257257
def write_cycle_map(self) -> None:
258258
"""

src/pownet/coupler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def reoperate(
118118
):
119119
reop_converge = True
120120
logger.info(
121-
f"PowNet: Day {step_k+1} - Reservoirs converged at iteration {reop_k}"
121+
f"PowNet: Day {step_k + 1} - Reservoirs converged at iteration {reop_k}"
122122
)
123123

124124
logger.info("Max deviation:", max_deviation)

src/pownet/data_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def get_dates(year, num_days=365):
2424
# Remove 29th Feb because we do not deal with them
2525
dates = dates.loc[dates.date.dt.strftime("%m-%d") != "02-29"]
2626
# Remove 1st Jan of the next year in case it is included when it is not a leap year
27-
dates = dates.loc[dates.date.dt.strftime("%Y-%m-%d") != f"{year+1}-01-01"]
27+
dates = dates.loc[dates.date.dt.strftime("%Y-%m-%d") != f"{year + 1}-01-01"]
2828

2929
# In case we need three columns: date, hour, and day
3030
dates = dates.loc[dates.index.repeat(24)]
@@ -35,7 +35,7 @@ def get_dates(year, num_days=365):
3535

3636
def get_datetime_index(year: int) -> pd.DatetimeIndex:
3737
"""Return a datetime index for the given year. The index will have 8760 entries, one for each hour of the year. Exclude 29th February."""
38-
dates = pd.date_range(start=f"{year}-01-01", end=f"{year+1}-01-01", freq="h")
38+
dates = pd.date_range(start=f"{year}-01-01", end=f"{year + 1}-01-01", freq="h")
3939
# Remove 29th February
4040
dates = dates[~((dates.month == 2) & (dates.day == 29))]
4141
return dates[dates.year == year]

src/pownet/input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ def check_data(self):
912912
# Number of edges in the node_edge dictionary must be equal to TWICE the number of edges
913913
if sum(len(v) for v in self.node_edge.values()) != 2 * len(self.edges):
914914
raise ValueError(
915-
f"PowNet: The number of edges in the node_edge dictionary must be equal to the number of edges. {sum(len(v) for v in self.node_edge.values())} != {2*len(self.edges)}"
915+
f"PowNet: The number of edges in the node_edge dictionary must be equal to the number of edges. {sum(len(v) for v in self.node_edge.values())} != {2 * len(self.edges)}"
916916
)
917917

918918
##################################

0 commit comments

Comments
 (0)