Merge pull request #335 from mawoka-myblock/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
This commit is contained in:
@@ -16,7 +16,7 @@ repos:
|
|||||||
# - id: check-added-large-files
|
# - id: check-added-large-files
|
||||||
|
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 23.12.1
|
rev: 24.1.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||||
|
|||||||
@@ -70,9 +70,10 @@ async def generate_spreadsheet(quiz_results: dict, quiz: Quiz, player_fields: di
|
|||||||
worksheet.write(i + 1, 1, question["time"])
|
worksheet.write(i + 1, 1, question["time"])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with ClientSession() as session, session.get(
|
async with (
|
||||||
f"{settings.root_address}/api/v1/storage/download/{question['image']}"
|
ClientSession() as session,
|
||||||
) as response:
|
session.get(f"{settings.root_address}/api/v1/storage/download/{question['image']}") as response,
|
||||||
|
):
|
||||||
if "image" in response.headers.get("Content-Type"):
|
if "image" in response.headers.get("Content-Type"):
|
||||||
img_data = BytesIO(await response.read())
|
img_data = BytesIO(await response.read())
|
||||||
worksheet.insert_image(i + 1, 2, question["image"], {"image_data": img_data})
|
worksheet.insert_image(i + 1, 2, question["image"], {"image_data": img_data})
|
||||||
@@ -226,13 +227,16 @@ async def telemetry_ping():
|
|||||||
except ormar.exceptions.NoMatch:
|
except ormar.exceptions.NoMatch:
|
||||||
instance_data = InstanceData()
|
instance_data = InstanceData()
|
||||||
await instance_data.save()
|
await instance_data.save()
|
||||||
async with ClientSession() as session, session.post(
|
async with (
|
||||||
|
ClientSession() as session,
|
||||||
|
session.post(
|
||||||
f"https://cit.mawoka.eu.org/public/{instance_data.instance_id}",
|
f"https://cit.mawoka.eu.org/public/{instance_data.instance_id}",
|
||||||
json={
|
json={
|
||||||
"public_quizzes": await Quiz.objects.filter(public=True).count(),
|
"public_quizzes": await Quiz.objects.filter(public=True).count(),
|
||||||
"private_quizzes": await Quiz.objects.filter(public=False).count(),
|
"private_quizzes": await Quiz.objects.filter(public=False).count(),
|
||||||
"users": await User.objects.count(),
|
"users": await User.objects.count(),
|
||||||
},
|
},
|
||||||
|
),
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -125,9 +125,10 @@ class NotFoundError(Exception):
|
|||||||
|
|
||||||
|
|
||||||
async def get_images(api_key: str, params: GetImagesParams) -> GetImagesResponse:
|
async def get_images(api_key: str, params: GetImagesParams) -> GetImagesResponse:
|
||||||
async with ClientSession() as session, session.get(
|
async with (
|
||||||
"https://pixabay.com/api/", params={"key": api_key, **params.dict()}
|
ClientSession() as session,
|
||||||
) as resp:
|
session.get("https://pixabay.com/api/", params={"key": api_key, **params.dict()}) as resp,
|
||||||
|
):
|
||||||
if resp.status == 200:
|
if resp.status == 200:
|
||||||
return GetImagesResponse.parse_obj(await resp.json())
|
return GetImagesResponse.parse_obj(await resp.json())
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -15,9 +15,10 @@ class _Response(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
async def get(game_id: str) -> _Response | int:
|
async def get(game_id: str) -> _Response | int:
|
||||||
async with ClientSession() as session, session.get(
|
async with (
|
||||||
f"https://create.kahoot.it/rest/kahoots/{game_id}/card/?includeKahoot=true"
|
ClientSession() as session,
|
||||||
) as response:
|
session.get(f"https://create.kahoot.it/rest/kahoots/{game_id}/card/?includeKahoot=true") as response,
|
||||||
|
):
|
||||||
if response.status == 200:
|
if response.status == 200:
|
||||||
return _Response(**await response.json())
|
return _Response(**await response.json())
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -35,7 +35,10 @@ async def search(
|
|||||||
:param limit: Less or equals 100
|
:param limit: Less or equals 100
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
async with ClientSession() as session, session.get(
|
async with (
|
||||||
|
ClientSession() as session,
|
||||||
|
session.get(
|
||||||
f"https://create.kahoot.it/rest/kahoots/?query={query}&limit={limit}&cursor={cursor}&searchCluster={search_cluster}&includeExtendedCounters=false&inventoryItemId={inventory_item_id}" # noqa : E501
|
f"https://create.kahoot.it/rest/kahoots/?query={query}&limit={limit}&cursor={cursor}&searchCluster={search_cluster}&includeExtendedCounters=false&inventoryItemId={inventory_item_id}" # noqa : E501
|
||||||
) as response:
|
) as response,
|
||||||
|
):
|
||||||
return _Response(**await response.json())
|
return _Response(**await response.json())
|
||||||
|
|||||||
@@ -62,9 +62,10 @@ async def export_quiz(quiz_id: uuid.UUID, user: User = Depends(get_current_user)
|
|||||||
for image_key in image_urls:
|
for image_key in image_urls:
|
||||||
bin_data = bin_data + image_delimiter + str(image_key).encode("utf-8") + image_index_delimiter
|
bin_data = bin_data + image_delimiter + str(image_key).encode("utf-8") + image_index_delimiter
|
||||||
image_data = None
|
image_data = None
|
||||||
async with ClientSession() as session, session.get(
|
async with (
|
||||||
f"{settings.root_address}/api/v1/storage/download/{image_urls[image_key]}"
|
ClientSession() as session,
|
||||||
) as resp:
|
session.get(f"{settings.root_address}/api/v1/storage/download/{image_urls[image_key]}") as resp,
|
||||||
|
):
|
||||||
image_data = await resp.read()
|
image_data = await resp.read()
|
||||||
bin_data = bin_data + image_data
|
bin_data = bin_data + image_data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user