Skip to content

Commit 16a092a

Browse files
author
Irina
committed
ruff formatting check
1 parent 5154c38 commit 16a092a

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

Homepage.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@
3030
"&offset=0&length=5000"
3131
)
3232

33+
3334
@st.cache_data(ttl=60 * 60) # cache 1 hour
3435
def fetch_supply_json(url: str) -> dict:
3536
r = requests.get(url, timeout=30)
3637
r.raise_for_status()
3738
return r.json()
3839

40+
3941
try:
4042
payload = fetch_supply_json(SUPPLY_URL)
4143
except Exception as e:

pages/2_WTI_Price.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@
2929
"&offset=0&length=5000"
3030
)
3131

32+
3233
@st.cache_data(ttl=60 * 60)
3334
def fetch_wti_json(url: str) -> dict:
3435
r = requests.get(url, timeout=30)
3536
r.raise_for_status()
3637
return r.json()
3738

39+
3840
try:
3941
payload = fetch_wti_json(URL)
4042
except Exception as e:
@@ -61,9 +63,8 @@ def fetch_wti_json(url: str) -> dict:
6163
st.stop()
6264

6365
# Aggregate weekly (safe even if already weekly)
64-
weekly_wti = (
65-
sum_by_week(df, date_col="week", value_col="value")
66-
.rename(columns={"value": "wti_price"})
66+
weekly_wti = sum_by_week(df, date_col="week", value_col="value").rename(
67+
columns={"value": "wti_price"}
6768
)
6869

6970
# Latest price

project.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
"st.caption(\n",
205205
" \"Note: 'Product supplied' is often used as a proxy for consumption. \"\n",
206206
" \"This visualization is descriptive (not causal).\"\n",
207-
")\n"
207+
")"
208208
]
209209
}
210210
],

tests/eia_part3.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def sum_by_week(df: pd.DataFrame, date_col: str, value_col: str) -> pd.DataFrame
6060
)
6161
return out
6262

63+
6364
def validate_required_columns(df: pd.DataFrame, required_cols: list[str]) -> None:
6465
"""Raise ValueError if any required column is missing."""
6566
missing = [c for c in required_cols if c not in df.columns]

tests/test_eia_part3.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,10 @@ def test_sum_by_week_sums_duplicates():
8080
assert list(out.columns) == ["week", "value"]
8181
assert len(out) == EXPECTED_WEEK_COUNT
8282
assert (
83-
out.loc[out["week"] == pd.to_datetime("2012-01-06"), "value"].iloc[0]
84-
== EXPECTED_WEEK1_SUM
83+
out.loc[out["week"] == pd.to_datetime("2012-01-06"), "value"].iloc[0] == EXPECTED_WEEK1_SUM
8584
)
8685
assert (
87-
out.loc[out["week"] == pd.to_datetime("2012-01-13"), "value"].iloc[0]
88-
== EXPECTED_WEEK2_SUM
86+
out.loc[out["week"] == pd.to_datetime("2012-01-13"), "value"].iloc[0] == EXPECTED_WEEK2_SUM
8987
)
9088

9189

0 commit comments

Comments
 (0)