Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump the python-packages group with 5 updates #140

Merged
merged 2 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.2.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.14
rev: v0.2.1
hooks:
- id: ruff
- repo: https://github.com/pre-commit/mirrors-mypy
Expand Down
1 change: 1 addition & 0 deletions horde_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Any model or helper useful for creating or interacting with a horde API."""

# isort: off
# We import dotenv first so that we can use it to load environment variables before importing anything else.
import dotenv
Expand Down
1 change: 1 addition & 0 deletions horde_sdk/ai_horde_api/ai_horde_clients.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Definitions to help interact with the AI-Horde API."""

from __future__ import annotations

import asyncio
Expand Down
1 change: 1 addition & 0 deletions horde_sdk/ai_horde_api/apimodels/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""All requests, responses and API models defined for the AI Horde API."""

from horde_sdk.ai_horde_api.apimodels._find_user import (
ContributionsDetails,
FindUserRequest,
Expand Down
1 change: 1 addition & 0 deletions horde_sdk/ai_horde_api/apimodels/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The base classes for all AI Horde API requests/responses."""

from __future__ import annotations

import os
Expand Down
2 changes: 1 addition & 1 deletion horde_sdk/ai_horde_api/apimodels/generate/_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class ImageGenerateAsyncRequest(

@model_validator(mode="before")
def validate_censor_nsfw(cls, values: dict) -> dict:
if values.get("censor_nsfw", None) and values.get("nsfw", None):
if values.get("censor_nsfw") and values.get("nsfw"):
raise ValueError("censor_nsfw is only valid when nsfw is False")
return values

Expand Down
1 change: 1 addition & 0 deletions horde_sdk/ai_horde_api/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
However, this module may still assist in the construction of valid requests to the API, primarily
by providing additional type hints for the request and response payloads and validation.
"""

import uuid
from typing import Any, ClassVar

Expand Down
1 change: 1 addition & 0 deletions horde_sdk/ai_horde_api/metadata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Request metadata specific to the AI-Horde API."""

from horde_sdk.generic_api.metadata import GenericPathFields


Expand Down
1 change: 1 addition & 0 deletions horde_sdk/generic_api/apimodels.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API data model bases applicable across all (or many) horde APIs."""

from __future__ import annotations

import abc
Expand Down
1 change: 1 addition & 0 deletions horde_sdk/ratings_api/apimodels.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model definitions for AI Horde Ratings API."""

import uuid
from enum import auto

Expand Down
1 change: 0 additions & 1 deletion horde_sdk/ratings_api/endpoints.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Information and helper functions for URL endpoints to horde APIs."""


# TODO make RATING_API_BASE_URL a env variable?
from horde_sdk.generic_api.endpoints import GENERIC_API_ENDPOINT_SUBPATH

Expand Down
1 change: 1 addition & 0 deletions horde_sdk/ratings_api/metadata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Request metadata specific to the Ratings API."""

from enum import auto

from horde_sdk.generic_api.metadata import GenericPathFields, GenericQueryFields
Expand Down
1 change: 1 addition & 0 deletions horde_sdk/scripts/write_all_payload_examples_for_tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Write all example payloads to a file in the tests/test_data directory."""

from pathlib import Path

from horde_sdk.ai_horde_api.endpoints import get_ai_horde_swagger_url
Expand Down
1 change: 1 addition & 0 deletions horde_sdk/scripts/write_all_response_examples_for_tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Write all example responses to a file in the tests/test_data directory."""

from pathlib import Path

from horde_sdk.ai_horde_api.endpoints import get_ai_horde_swagger_url
Expand Down
8 changes: 4 additions & 4 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pytest==7.4.4
pytest==8.0.0
mypy==1.8.0
black==23.12.1
ruff==0.1.14
black==24.2.0
ruff==0.2.1
tox~=4.12.1
pre-commit~=3.6.0
pre-commit~=3.6.1
build>=0.10.0
coverage>=7.2.7

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
horde_model_reference~=0.5.3
horde_model_reference~=0.5.4

pydantic
requests
Expand Down
18 changes: 12 additions & 6 deletions tests/ai_horde_api/test_ai_horde_api_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,12 @@ def test_HordeRequestSession_cleanup(self, simple_image_gen_request: ImageGenera
@pytest.mark.asyncio
async def test_HordeRequestSession_async(self, simple_image_gen_request: ImageGenerateAsyncRequest) -> None:
"""Test that the context manager cleans up correctly asynchronously."""
async with aiohttp.ClientSession() as aiohttp_session, AIHordeAPIAsyncClientSession(
aiohttp_session=aiohttp_session,
) as horde_session:
async with (
aiohttp.ClientSession() as aiohttp_session,
AIHordeAPIAsyncClientSession(
aiohttp_session=aiohttp_session,
) as horde_session,
):
api_response = await horde_session.submit_request( # noqa: F841
simple_image_gen_request,
simple_image_gen_request.get_default_success_response_type(),
Expand All @@ -128,9 +131,12 @@ async def test_HordeRequestSession_async_exception_raised(
) -> None:
"""Test that the context manager cleans up correctly asynchronously when an exception is raised."""
with pytest.raises(HordeTestException):
async with aiohttp.ClientSession() as aiohttp_session, AIHordeAPIAsyncClientSession(
aiohttp_session=aiohttp_session,
) as horde_session:
async with (
aiohttp.ClientSession() as aiohttp_session,
AIHordeAPIAsyncClientSession(
aiohttp_session=aiohttp_session,
) as horde_session,
):
api_response = await horde_session.submit_request( # noqa: F841
simple_image_gen_request,
simple_image_gen_request.get_default_success_response_type(),
Expand Down
1 change: 1 addition & 0 deletions tests/ai_horde_api/test_ai_horde_api_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit tests for AI-Horde API models."""

import json
from uuid import UUID

Expand Down
1 change: 1 addition & 0 deletions tests/test_dynamically_check_apimodels.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Check that all models defined in all APIs `apimodels` module/subpackage can be instantiated from example JSON."""

import json
import os
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_generic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test generic API models not specific to a particular API."""

import json

from horde_sdk.generic_api.apimodels import RequestErrorResponse
Expand Down
1 change: 0 additions & 1 deletion tests/test_ratings_api_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Unit tests for Ratings API models."""


import pydantic
import pytest

Expand Down
Loading