Skip to content

Commit 1f51b6a

Browse files
committed
fix: lint, workflow checks fixed
1 parent de90699 commit 1f51b6a

8 files changed

Lines changed: 34 additions & 12 deletions

File tree

.ruff.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Exclude non-Python files, build artifacts and frontend bundles from ruff scanning
2+
exclude = [
3+
"**/dist/**",
4+
"**/node_modules/**",
5+
"**/__pycache__/**",
6+
"**/*.pyc",
7+
"requirements*.txt",
8+
"tracked.txt",
9+
"pytest.ini",
10+
".git",
11+
".github",
12+
"src/quant_research_starter/frontend/cauweb/dist/**"
13+
]
14+
15+
# Project line length
16+
line-length = 88
17+
18+
# Lint-specific settings
19+
[lint]
20+
# Use this to extend ignored error codes (legacy key moved here)
21+
extend-ignore = []

examples/csv_validation_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ def load_and_validate_prices(file_path: str):
8484
print(f"✓ Loaded {len(prices)} rows of price data")
8585
return prices
8686

87-
# Try with a file
87+
# Try with a file (we only demonstrate loading; don't keep the returned value)
8888
try:
89-
prices = load_and_validate_prices("data/sample_prices.csv")
89+
load_and_validate_prices("data/sample_prices.csv")
9090
except ValueError as e:
9191
print(f"✗ Error: {e}")
9292
except FileNotFoundError:

notebooks/01-getting-started.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@
388388
"# Backtest\n",
389389
"common = prices.index.intersection(signals.index)\n",
390390
"px = prices.loc[common]\n",
391-
"sg = pd.DataFrame({c: signals['composite'] for c in px.columns}, index=signals.index).loc[common]\n",
391+
"sg = pd.DataFrame(dict.fromkeys(px.columns, signals['composite']), index=signals.index).loc[common]\n",
392392
"\n",
393393
"bt = VectorizedBacktest(px, sg, initial_capital=100000)\n",
394394
"results = bt.run(weight_scheme=\"rank\")\n",

scripts/run_migrations.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
python scripts/run_migrations.py
55
"""
66
import os
7-
from alembic.config import Config
7+
88
from alembic import command
9+
from alembic.config import Config
910

1011
here = os.path.dirname(__file__)
1112
alembic_cfg = Config(os.path.join(here, "..", "alembic.ini"))

scripts/wait_for_services.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
are available before starting the web server or worker.
66
"""
77
import os
8-
import time
98
import socket
109
import sys
10+
import time
1111

1212

1313
def wait_tcp(host: str, port: int, timeout: int = 60) -> bool:

src/quant_research_starter/api/auth.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import os
6+
import secrets
67
from datetime import datetime, timedelta
78
from typing import Annotated, Optional
89

@@ -12,9 +13,7 @@
1213
from passlib.context import CryptContext
1314
from sqlalchemy.ext.asyncio import AsyncSession
1415

15-
from . import db, models
16-
from . import supabase
17-
import secrets
16+
from . import db, models, supabase
1817

1918
SECRET_KEY = os.getenv("JWT_SECRET", "dev-secret-change-me")
2019
ALGORITHM = "HS256"

src/quant_research_starter/api/routers/auth.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
from fastapi.security import OAuth2PasswordRequestForm
77
from sqlalchemy.ext.asyncio import AsyncSession
88

9-
from .. import auth, db, models, schemas
10-
from .. import supabase
9+
from .. import auth, db, models, schemas, supabase
1110

1211
router = APIRouter(prefix="/api/auth", tags=["auth"])
1312

@@ -23,7 +22,7 @@ async def register_user(
2322
try:
2423
supabase.signup(user_in.username, user_in.password)
2524
except Exception as exc:
26-
raise HTTPException(status_code=400, detail=str(exc))
25+
raise HTTPException(status_code=400, detail=str(exc)) from exc
2726

2827
q = await session.execute(
2928
models.User.__table__.select().where(models.User.username == user_in.username)
@@ -52,7 +51,7 @@ async def login_for_access_token(
5251
# token_response may contain access_token and refresh_token
5352
return {"access_token": token_response.get("access_token"), "token_type": "bearer"}
5453
except Exception as exc:
55-
raise HTTPException(status_code=400, detail=str(exc))
54+
raise HTTPException(status_code=400, detail=str(exc)) from exc
5655

5756
q = await session.execute(
5857
models.User.__table__.select().where(models.User.username == form_data.username)

test_conn.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# test_conn.py
22
import asyncio
3+
34
import asyncpg
45

6+
57
async def main():
68
try:
79
conn = await asyncpg.connect(user='postgres', password='password',

0 commit comments

Comments
 (0)