Skip to content

Commit d92eeaa

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 517a6e8 commit d92eeaa

File tree

13 files changed

+55
-54
lines changed

13 files changed

+55
-54
lines changed

.github/workflows/maintests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ jobs:
4141

4242

4343
- name: Run tests
44-
run: uv run pytest tests --ignore-glob='**/*api_calls*' -m "not api_side_ci"
44+
run: uv run pytest tests --ignore-glob='**/*api_calls*' -m "not api_side_ci"

docs/.pages

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ nav:
2121
- SDK Client Design: concepts/client_design
2222
- Backend Values Mappers: concepts/backend_values_mappers
2323
- horde_sdk
24-
24+
2525
- GitHub Repo: 'https://github.com/Haidra-Org/horde-sdk'
2626

2727
order: desc

docs/concepts/backend_values_mappers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def map_to_example_backend_sampler(self, sdk_sampler: KNOWN_IMAGE_SAMPLERS) -> K
131131
"""Maps an SDK sampler to a backend sampler."""
132132
...
133133

134-
...
134+
...
135135
```
136136

137137
#### Understanding `_map_value` and `_is_valid_value`

docs/concepts/client_design.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ classDiagram
1212
class GenericHordeAPIManualClient
1313
1414
class GenericAsyncHordeAPIManualClient
15-
class GenericHordeAPISession
15+
class GenericHordeAPISession
1616
17-
class GenericAsyncHordeAPISession
17+
class GenericAsyncHordeAPISession
1818
1919
BaseHordeAPIClient <|-- GenericHordeAPIManualClient
2020
BaseHordeAPIClient <|-- GenericAsyncHordeAPIManualClient

docs/concepts/style_guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Many classes contain standardized prefixes, suffixes, or identifiers within thei
162162
- For example, methods which are known to rely on external resources (e.g., network calls, file I/O) should document the exceptions that may be raised in the event of a failure.
163163
- It is **not** expected that every conceivable exception raised from a particular call hierarchy is documented, but rather those that are most likely to occur and can be reasonably anticipated.
164164
- A method that opens a file should document `FileNotFoundError` and `IOError` in its `Raises` section, while network-related methods should document `ConnectionError`, `TimeoutError`, and other relevant exceptions.
165-
165+
166166
### API Model Specific Documentation
167167

168168
Many docstrings in the SDK have additional requirements when they are related to API models or requests/responses. While these rules would be difficult to remember, they are luckily enforced by CI and the `horde_sdk.meta` module has helper functions to assist in generating the required docstrings. The correct docstrings will also be emitted by the `object_verify` tests. Be sure to run the tests with `-s` to see the output.

docs/worker/generation_states_flow.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ flowchart TD
1414
1515
NOT_STARTED@{shape: subproc}
1616
PRELOADING@{shape: subproc}
17-
PRELOADING_COMPLETE@{shape: subproc}
17+
PRELOADING_COMPLETE@{shape: subproc}
1818
PENDING_POST_PROCESSING@{ shape: subproc}
1919
POST_PROCESSING@{ shape: subproc}
2020
GENERATING@{ shape: subproc}
@@ -119,7 +119,7 @@ Good:
119119
- Here, the worker encountered an error during preloading, attempted to recover, but failed again and then aborted the job. Note that you can set the intended number of retries in worker job configuration. See the `HordeWorkerJobConfig` class and the `state_error_limits` arg in a generation class constructor for more details.
120120
- `NOT_STARTED` -> `PRELOADING` -> `USER_REQUESTED_ABORT` -> `USER_ABORT_COMPLETE`
121121
- In this case, the user who created the job requested an abort, and the worker was able to complete the abort process successfully.
122-
122+
123123
Bad:
124124

125125
- `NOT_STARTED` -> `PRELOADING` -> `ERROR` -> `GENERATING`

docs/worker/generations.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ These functions return the transitioned to state.
8585
#### Important Notes on State Transitions
8686

8787
- **Strict Order:** You must call state transition methods in the correct sequence. For example, you cannot call `on_generating()` before `on_preloading_complete()`. This strictness helps catch workflow errors early. Out-of-order calls almost always indicate a problem in your logic or resource handling.
88-
- **Error Handling:** If an error occurs at any step, use `on_error(failed_message="...")` to move the generation into the `ERROR` state. This lets you handle errors gracefully and, if needed, recover. To continue after an error, you must return to the most recent valid state before proceeding.
88+
- **Error Handling:** If an error occurs at any step, use `on_error(failed_message="...")` to move the generation into the `ERROR` state. This lets you handle errors gracefully and, if needed, recover. To continue after an error, you must return to the most recent valid state before proceeding.
8989
- For example, if you are in the `GENERATING` state and an error occurs, call `on_error()` to enter `ERROR`, then call `on_generating()` again to retry.
9090
- **Dynamic States:** Some transition methods, such as `on_generation_work_complete()`, may lead to different next states depending on context (e.g., whether post-processing is required). The class handles these decisions internally, so you don’t need to manually select the next state.
9191
- **Manual States:** You can use the generic `step(state)` or `on_state(state)` methods to transition to a specific state. However, you are responsible for ensuring the transition is valid—these methods bypass some of the built-in checks.
@@ -346,7 +346,7 @@ flowchart TD
346346
347347
NOT_STARTED@{shape: subproc}
348348
PRELOADING@{shape: subproc}
349-
PRELOADING_COMPLETE@{shape: subproc}
349+
PRELOADING_COMPLETE@{shape: subproc}
350350
PENDING_POST_PROCESSING@{ shape: subproc}
351351
POST_PROCESSING@{ shape: subproc}
352352
GENERATING@{ shape: subproc}
@@ -451,7 +451,7 @@ Good:
451451
- Here, the worker encountered an error during preloading, attempted to recover, but failed again and then aborted the job. Note that you can set the intended number of retries in worker job configuration. See the `HordeWorkerJobConfig` class and the `state_error_limits` arg in a generation class constructor for more details.
452452
- `NOT_STARTED` -> `PRELOADING` -> `USER_REQUESTED_ABORT` -> `USER_ABORT_COMPLETE`
453453
- In this case, the user who created the job requested an abort, and the worker was able to complete the abort process successfully.
454-
454+
455455
Bad:
456456

457457
- `NOT_STARTED` -> `PRELOADING` -> `ERROR` -> `GENERATING`

horde_sdk/generation_parameters/image/object_models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ class BasicImageGenerationParameters(BasicImageGenerationParametersTemplate):
259259
from_attributes=True,
260260
)
261261

262-
263262
model: str
264263
"""The model to use for the generation."""
265264

horde_sdk/generation_parameters/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ class TemplateFinalization[TemplateT: BaseModel]:
4141
payload: dict[str, object]
4242

4343

44-
def apply_template_overrides[TemplateT: BaseModel](
44+
def apply_template_overrides[
45+
TemplateT: BaseModel
46+
](
4547
template: TemplateT,
4648
*,
4749
overrides: Mapping[str, object] | None = None,

tests/ai_horde_api/test_ai_horde_generate_api_calls.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ async def submit_request(
5151
) -> ImageGenerateAsyncResponse | RequestErrorResponse | None:
5252
await asyncio.sleep(delay)
5353
async with AIHordeAPIAsyncClientSession(aiohttp_session) as horde_session:
54-
api_response: (
55-
ImageGenerateAsyncResponse | RequestErrorResponse
56-
) = await horde_session.submit_request(
57-
simple_image_gen_request,
58-
simple_image_gen_request.get_default_success_response_type(),
54+
api_response: ImageGenerateAsyncResponse | RequestErrorResponse = (
55+
await horde_session.submit_request(
56+
simple_image_gen_request,
57+
simple_image_gen_request.get_default_success_response_type(),
58+
)
5959
)
6060
return api_response
6161
return None

0 commit comments

Comments
 (0)