Skip to content

Commit

Permalink
chore: update pre-commit hook versions
Browse files Browse the repository at this point in the history
also adds `horde_sdk` to mypy hook addtl. deps, and applies the `black` format changes now required
  • Loading branch information
tazlin committed Feb 6, 2024
1 parent c161575 commit 1fd63a5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
exclude: ^hordelib/nodes/.*\..*$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.11
rev: v0.2.1
hooks:
- id: ruff
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.8.0'
hooks:
- id: mypy
exclude: ^examples/.*$ # FIXME
additional_dependencies: [pydantic, strenum, types-colorama, types-docutils, types-Pillow, types-psutil, types-Pygments, types-pywin32, types-PyYAML, types-regex, types-requests, types-setuptools, types-tabulate, types-tqdm, types-urllib3]
additional_dependencies: [pydantic, strenum, types-colorama, types-docutils, types-Pillow, types-psutil, types-Pygments, types-pywin32, types-PyYAML, types-regex, types-requests, types-setuptools, types-tabulate, types-tqdm, types-urllib3, horde_sdk]
25 changes: 14 additions & 11 deletions hordelib/model_manager/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,17 +498,20 @@ def download_file(
response.raise_for_status()

# Write the content to file in chunks
with open(partial_pathname, "ab") as f, tqdm(
# all optional kwargs
unit="B",
initial=partial_size,
unit_scale=True,
unit_divisor=1024,
miniters=1,
desc=filename,
total=remote_file_size + partial_size,
# disable=UserSettings.download_progress_callback is not None,
) as pbar:
with (
open(partial_pathname, "ab") as f,
tqdm(
# all optional kwargs
unit="B",
initial=partial_size,
unit_scale=True,
unit_divisor=1024,
miniters=1,
desc=filename,
total=remote_file_size + partial_size,
# disable=UserSettings.download_progress_callback is not None,
) as pbar,
):
downloaded = partial_size
for chunk in response.iter_content(chunk_size=1024 * 1024 * 16):
response.raise_for_status()
Expand Down
7 changes: 4 additions & 3 deletions hordelib/model_manager/hyper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Home for the controller class ModelManager, and related meta information."""

import os
import threading
from collections.abc import Callable, Iterable
Expand Down Expand Up @@ -180,9 +181,9 @@ def init_model_managers(
self.active_model_managers.append(
resolve_manager_to_load_type(
multiprocessing_lock=multiprocessing_lock,
civitai_api_token=os.environ["CIVIT_API_TOKEN"]
if "CIVIT_API_TOKEN" in os.environ.keys()
else None,
civitai_api_token=(
os.environ["CIVIT_API_TOKEN"] if "CIVIT_API_TOKEN" in os.environ.keys() else None
),
),
)

Expand Down

0 comments on commit 1fd63a5

Please sign in to comment.