mirror of
https://github.com/thomasasfk/sd-webui-aspect-ratio-helper.git
synced 2026-01-26 11:09:55 +00:00
Add tox configuration, we support 3.10 & 3.11 (#22)
This commit is contained in:
17
.github/workflows/pytest.yml
vendored
17
.github/workflows/pytest.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Run pytest
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
@@ -9,14 +9,23 @@ jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.11', '3.10']
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pytest
|
||||
pip install tox
|
||||
|
||||
- name: Run pytest
|
||||
run: pytest
|
||||
- name: Run tox
|
||||
run: tox
|
||||
|
||||
@@ -54,6 +54,8 @@ Install via the extensions tab on the [AUTOMATIC1111 webui](https://github.com/A
|
||||
|
||||
Developed using existing [AUTOMATIC1111 webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) dependencies.
|
||||
|
||||
It's recommended to use the python version specified by A111 webui.
|
||||
|
||||
However - for running unit tests, we use pytest.
|
||||
|
||||
```bash
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from abc import ABC
|
||||
from abc import abstractmethod
|
||||
from functools import partial
|
||||
from typing import Callable
|
||||
|
||||
import gradio as gr
|
||||
|
||||
@@ -190,7 +191,7 @@ class PredefinedAspectRatioButtons(ArhUIComponent):
|
||||
)
|
||||
|
||||
@property
|
||||
def display_func(self) -> callable:
|
||||
def display_func(self) -> Callable[[str], str]:
|
||||
return lambda _: None # todo: different displays for aspect ratios.
|
||||
|
||||
|
||||
@@ -268,7 +269,7 @@ class PredefinedPercentageButtons(ArhUIComponent):
|
||||
)
|
||||
|
||||
@property
|
||||
def display_func(self) -> callable:
|
||||
def display_func(self) -> Callable[[str], str]:
|
||||
return _settings.PREDEFINED_PERCENTAGES_DISPLAY_MAP.get(
|
||||
_settings.safe_opt(
|
||||
_constants.ARH_PREDEFINED_PERCENTAGES_DISPLAY_KEY,
|
||||
|
||||
@@ -3,7 +3,7 @@ import contextlib
|
||||
import aspect_ratio_helper._constants as _const
|
||||
|
||||
|
||||
def safe_opt_util(shared_opts, key, default_key_map):
|
||||
def safe_opt_util(shared_opts, key, default_key_map: dict[str, object]):
|
||||
# attempt to retrieve key from shared options
|
||||
with contextlib.suppress(AttributeError):
|
||||
value = shared_opts.__getattr__(key)
|
||||
|
||||
Reference in New Issue
Block a user