Skip to content

Commit

Permalink
chore: format with black
Browse files Browse the repository at this point in the history
  • Loading branch information
mradigen committed Dec 22, 2023
1 parent f1e9169 commit 8ed2f75
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/pwncore/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"user_removed": 19,
"user_already_in_team": 20,
"user_not_in_team": 21,
"insufficient_coins": 22
"insufficient_coins": 22,
}


Expand Down Expand Up @@ -64,5 +64,5 @@ class Config:
jwt_secret="mysecret",
jwt_valid_duration=12, # In hours
msg_codes=msg_codes,
hint_penalty=10
hint_penalty=10,
)
3 changes: 1 addition & 2 deletions src/pwncore/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ async def save(self, *args, **kwargs):
if self.team is not None and hasattr(self.team, "members"):
count = await self.team.members.filter(~Q(id=self.pk)).count()
if count >= 3:
raise IntegrityError(
"3 or more users already exist for the team")
raise IntegrityError("3 or more users already exist for the team")
return await super().save(*args, **kwargs)


Expand Down
4 changes: 3 additions & 1 deletion src/pwncore/routes/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ async def init_db():
image_config={"PortBindings": {"22/tcp": [{}]}},
)
await Team.create(name="CID Squad", secret_hash=bcrypt.hash("veryverysecret"))
await Team.create(name="Triple A battery", secret_hash=bcrypt.hash("chotiwali"), coins=20)
await Team.create(
name="Triple A battery", secret_hash=bcrypt.hash("chotiwali"), coins=20
)
await User.create(
tag="23BRS1000",
name="abc",
Expand Down
3 changes: 1 addition & 2 deletions src/pwncore/routes/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ async def team_login(team_data: AuthBody, response: Response):
return {"msg_code": config.msg_codes["wrong_password"]}

current_time = datetime.datetime.utcnow()
expiration_time = current_time + \
datetime.timedelta(hours=config.jwt_valid_duration)
expiration_time = current_time + datetime.timedelta(hours=config.jwt_valid_duration)
token_payload = {"team_id": team.id, "exp": expiration_time}
token = jwt.encode(token_payload, config.jwt_secret, algorithm="HS256")

Expand Down
2 changes: 1 addition & 1 deletion src/pwncore/routes/ctf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ViewedHint,
Problem_Pydantic,
Hint_Pydantic,
Team
Team,
)
from pwncore.config import config
from pwncore.routes.ctf.start import router as start_router
Expand Down
4 changes: 2 additions & 2 deletions src/pwncore/routes/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async def add_member(user: UserAddBody, response: Response, jwt: RequireJwt):
name=user.name,
email=user.email,
phone_num=user.phone_num,
team_id=team_id
team_id=team_id,
)
except Exception:
response.status_code = 500
Expand All @@ -67,7 +67,7 @@ async def add_member(user: UserAddBody, response: Response, jwt: RequireJwt):

@atomic()
@router.post("/remove")
async def add_member(user_info: UserRemoveBody, response: Response, jwt: RequireJwt):
async def remove_member(user_info: UserRemoveBody, response: Response, jwt: RequireJwt):
team_id = jwt["team_id"]

user = await User.get_or_none(team_id=team_id, tag=user_info.tag)
Expand Down

0 comments on commit 8ed2f75

Please sign in to comment.