Skip to content

Commit 42816d6

Browse files
authored
Reformat all Python files with black (#123)
* reformat files * run black on backend code * add line length option * update black and run on all files
1 parent d8b9be0 commit 42816d6

File tree

8 files changed

+26
-9
lines changed

8 files changed

+26
-9
lines changed

.github/workflows/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Black Code Formatter
2828
uses: lgeiger/black-action@master
2929
with:
30-
args: '{{cookiecutter.project_slug}}/backend --check'
30+
args: '{{cookiecutter.project_slug}}/backend --check --line-length 79'
3131
- name: Run tests
3232
run: |
3333
sudo ./scripts/test.sh

{{cookiecutter.project_slug}}/backend/app/alembic/env.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ def run_migrations_online():
6161
configuration = config.get_section(config.config_ini_section)
6262
configuration["sqlalchemy.url"] = get_url()
6363
connectable = engine_from_config(
64-
configuration, prefix="sqlalchemy.", poolclass=pool.NullPool,
64+
configuration,
65+
prefix="sqlalchemy.",
66+
poolclass=pool.NullPool,
6567
)
6668

6769
with connectable.connect() as connection:

{{cookiecutter.project_slug}}/backend/app/api/api_v1/routers/tests/test_auth.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ def test_resignup(client, test_user, monkeypatch):
4343
assert response.status_code == 409
4444

4545

46-
def test_wrong_password(client, test_db, test_user, test_password, monkeypatch):
46+
def test_wrong_password(
47+
client, test_db, test_user, test_password, monkeypatch
48+
):
4749
def verify_password_failed_mock(first: str, second: str):
4850
return False
4951

{{cookiecutter.project_slug}}/backend/app/api/api_v1/routers/tests/test_users.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ def test_edit_user_not_found(client, test_db, superuser_token_headers):
6464

6565

6666
def test_get_user(
67-
client, test_user, superuser_token_headers,
67+
client,
68+
test_user,
69+
superuser_token_headers,
6870
):
6971
response = client.get(
7072
f"/api/v1/users/{test_user.id}", headers=superuser_token_headers

{{cookiecutter.project_slug}}/backend/app/api/api_v1/routers/users.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717

1818
@r.get(
19-
"/users", response_model=t.List[User], response_model_exclude_none=True,
19+
"/users",
20+
response_model=t.List[User],
21+
response_model_exclude_none=True,
2022
)
2123
async def users_list(
2224
response: Response,
@@ -41,7 +43,9 @@ async def user_me(current_user=Depends(get_current_active_user)):
4143

4244

4345
@r.get(
44-
"/users/{user_id}", response_model=User, response_model_exclude_none=True,
46+
"/users/{user_id}",
47+
response_model=User,
48+
response_model_exclude_none=True,
4549
)
4650
async def user_details(
4751
request: Request,

{{cookiecutter.project_slug}}/backend/app/core/auth.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ def sign_up_new_user(db, email: str, password: str):
6666
new_user = create_user(
6767
db,
6868
schemas.UserCreate(
69-
email=email, password=password, is_active=True, is_superuser=False,
69+
email=email,
70+
password=password,
71+
is_active=True,
72+
is_superuser=False,
7073
),
7174
)
7275
return new_user

{{cookiecutter.project_slug}}/backend/app/db/session.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
from app.core import config
66

7-
engine = create_engine(config.SQLALCHEMY_DATABASE_URI,)
7+
engine = create_engine(
8+
config.SQLALCHEMY_DATABASE_URI,
9+
)
810
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
911

1012
Base = declarative_base()

{{cookiecutter.project_slug}}/backend/conftest.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ def test_db():
2222
This is to avoid tests affecting the database state of other tests.
2323
"""
2424
# Connect to the test database
25-
engine = create_engine(get_test_db_url(),)
25+
engine = create_engine(
26+
get_test_db_url(),
27+
)
2628

2729
connection = engine.connect()
2830
trans = connection.begin()

0 commit comments

Comments
 (0)