Skip to content

Commit

Permalink
style(pre-commit.ci): auto fixes [...]
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Feb 5, 2024
1 parent 476bc63 commit 4b3b911
Show file tree
Hide file tree
Showing 51 changed files with 89 additions and 93 deletions.
1 change: 1 addition & 0 deletions docs/examples/applications/callable.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This example demonstrates handling callable functions with magicgui.
"""

from magicgui import magicgui


Expand Down
1 change: 1 addition & 0 deletions docs/examples/applications/chaining.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This example demonstrates chaining multiple functions together.
"""

from magicgui import magicgui, widgets


Expand Down
1 change: 1 addition & 0 deletions docs/examples/applications/hotdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Demo app to upload an image and classify if it's an hotdog or not.
"""

import pathlib
from enum import Enum

Expand Down
1 change: 1 addition & 0 deletions docs/examples/applications/pint_quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from and to different units.
https://pint.readthedocs.io/en/stable/
"""

from pint import Quantity

from magicgui import magicgui
Expand Down
1 change: 1 addition & 0 deletions docs/examples/basic_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A basic example using magicgui.
"""

from magicgui import magicgui


Expand Down
1 change: 1 addition & 0 deletions docs/examples/basic_widgets_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
This code demonstrates a few of the widget types that magicgui can create
based on the parameter types in your function.
"""

import datetime
from enum import Enum
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/change_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
An example showing how to create custom text labels for your widgets.
"""

from magicgui import magicgui


Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/choices.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Choices for dropdowns can be provided in a few different ways.
"""

from enum import Enum

from magicgui import magicgui, widgets
Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/file_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A file dialog widget example.
"""

from pathlib import Path
from typing import Sequence

Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/log_slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A logarithmic scale range slider widget.
"""

from magicgui import magicgui


Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A password login field widget.
"""

from magicgui import magicgui


Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/optional.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Optional user input using a dropdown selection widget.
"""

from typing import Optional

from magicgui import magicgui
Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/range_slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A double ended range slider widget.
"""

from typing import Tuple

from magicgui import magicgui
Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A selection widget allowing multiple selections by the user.
"""

from magicgui import magicgui


Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Demonstrating a few ways to input tables.
"""

import numpy as np

from magicgui.widgets import Table
Expand Down
1 change: 1 addition & 0 deletions docs/examples/matplotlib/waveform.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Simple waveform generator widget, with plotting.
"""

from dataclasses import dataclass, field
from enum import Enum
from functools import partial
Expand Down
1 change: 1 addition & 0 deletions docs/examples/napari/napari_combine_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
This example shows how to use just that widget in the context
of a larger custom QWidget.
"""

import napari
from qtpy.QtWidgets import QVBoxLayout, QWidget

Expand Down
1 change: 1 addition & 0 deletions docs/examples/napari/napari_forward_refs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
a *string* representation of the type (rather than the type itself). This is called a
"forward reference": https://www.python.org/dev/peps/pep-0484/#forward-references
"""

# Note: if you'd like to avoid circular imports, or just want to avoid having your
# linter yell at you for an undefined type annotation, you can place the import
# inside of an `if typing.TYPE_CHECKING` conditional. This is not evaluated at runtime,
Expand Down
1 change: 1 addition & 0 deletions docs/examples/progress_bars/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A simple progress bar demo with magicgui.
"""

from time import sleep

from magicgui import magicgui
Expand Down
1 change: 1 addition & 0 deletions docs/examples/progress_bars/progress_indeterminate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
of unknown time.
"""

import time

from superqt.utils import thread_worker
Expand Down
1 change: 1 addition & 0 deletions docs/examples/progress_bars/progress_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Example of a progress bar being updated manually.
"""

from magicgui import magicgui
from magicgui.widgets import ProgressBar

Expand Down
1 change: 1 addition & 0 deletions docs/examples/under_the_hood/class_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
in which the instance will always be provided as the first argument (i.e. "self") when
the FunctionGui or method is called.
"""

from magicgui import event_loop, magicgui
from magicgui.widgets import Container

Expand Down
1 change: 1 addition & 0 deletions docs/examples/under_the_hood/self_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Widgets created with magicgui can reference themselves, and use the widget API.
"""

from magicgui import magicgui


Expand Down
1 change: 1 addition & 0 deletions docs/scripts/_hooks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""https://www.mkdocs.org/dev-guide/plugins/#events ."""

from __future__ import annotations

import importlib.abc
Expand Down
1 change: 1 addition & 0 deletions src/magicgui/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""magicgui is a utility for generating a GUI from a python function."""

from importlib.metadata import PackageNotFoundError, version

try:
Expand Down
8 changes: 4 additions & 4 deletions src/magicgui/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@


@overload
def debounce(function: Callable[P, T]) -> Callable[P, T | None]:
...
def debounce(function: Callable[P, T]) -> Callable[P, T | None]: ...


@overload
def debounce(*, wait: float = 0.2) -> Callable[[Callable[P, T]], Callable[P, T | None]]:
...
def debounce(
*, wait: float = 0.2
) -> Callable[[Callable[P, T]], Callable[P, T | None]]: ...


def debounce(function: Callable[P, T] | None = None, wait: float = 0.2) -> Callable:
Expand Down
1 change: 1 addition & 0 deletions src/magicgui/application.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Magicgui application object, wrapping a backend application."""

from __future__ import annotations

import signal
Expand Down
1 change: 1 addition & 0 deletions src/magicgui/backends/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Backend modules implementing applications and widgets."""

from __future__ import annotations

BACKENDS: dict[str, tuple[str, str]] = {
Expand Down
1 change: 1 addition & 0 deletions src/magicgui/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Note: these are not guaranteed to be stable. Names and parameters may change or be
removed in future releases. Use at your own risk.
"""

from .schema._guiclass import button, guiclass, is_guiclass

__all__ = ["guiclass", "button", "is_guiclass"]
16 changes: 6 additions & 10 deletions src/magicgui/schema/_guiclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
2. Adds a `gui` property to the class that will return a `magicgui` widget, bound to
the values of the dataclass instance.
"""

from __future__ import annotations

import contextlib
Expand Down Expand Up @@ -63,8 +64,7 @@ def __dataclass_transform__(

@__dataclass_transform__(field_specifiers=(Field, field))
@overload
def guiclass(cls: T) -> T:
...
def guiclass(cls: T) -> T: ...


@__dataclass_transform__(field_specifiers=(Field, field))
Expand All @@ -75,8 +75,7 @@ def guiclass(
events_namespace: str = "events",
follow_changes: bool = True,
**dataclass_kwargs: Any,
) -> Callable[[T], T]:
...
) -> Callable[[T], T]: ...


def guiclass(
Expand Down Expand Up @@ -168,13 +167,11 @@ def is_guiclass(obj: object) -> TypeGuard[GuiClassProtocol]:


@overload
def button(func: F) -> F:
...
def button(func: F) -> F: ...


@overload
def button(**kwargs: Any) -> Callable[[F], F]:
...
def button(**kwargs: Any) -> Callable[[F], F]: ...


def button(func: F | None = None, **button_kwargs: Any) -> F | Callable[[F], F]:
Expand Down Expand Up @@ -339,5 +336,4 @@ class GuiClass(metaclass=GuiClassMeta):
# the mypy dataclass magic doesn't work without the literal decorator
# it WILL work with pyright due to the __dataclass_transform__ above
# here we just avoid a false error in mypy
def __init__(self, *args: Any, **kwargs: Any) -> None:
...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
1 change: 1 addition & 0 deletions src/magicgui/signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
(it returns a ``MagicSignature``, which is a subclass of ``inspect.Signature``)
"""

from __future__ import annotations

import inspect
Expand Down
1 change: 1 addition & 0 deletions src/magicgui/tqdm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A wrapper around the tqdm.tqdm iterator that adds a ProgressBar to a magicgui."""

from __future__ import annotations

import contextlib
Expand Down
1 change: 1 addition & 0 deletions src/magicgui/type_map/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions that map python types to widgets."""

from ._type_map import get_widget_class, register_type, type2callback, type_registered

__all__ = [
Expand Down
24 changes: 8 additions & 16 deletions src/magicgui/type_map/_magicgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ def magicgui(
persist: bool = False,
raise_on_unknown: bool = False,
**param_options: dict,
) -> FunctionGui[_P, _R]:
...
) -> FunctionGui[_P, _R]: ...


@overload
Expand All @@ -65,8 +64,7 @@ def magicgui(
persist: bool = False,
raise_on_unknown: bool = False,
**param_options: dict,
) -> Callable[[Callable[_P, _R]], FunctionGui[_P, _R]]:
...
) -> Callable[[Callable[_P, _R]], FunctionGui[_P, _R]]: ...


@overload
Expand All @@ -85,8 +83,7 @@ def magicgui(
persist: bool = False,
raise_on_unknown: bool = False,
**param_options: dict,
) -> MainFunctionGui[_P, _R]:
...
) -> MainFunctionGui[_P, _R]: ...


@overload
Expand All @@ -105,8 +102,7 @@ def magicgui(
persist: bool = False,
raise_on_unknown: bool = False,
**param_options: dict,
) -> Callable[[Callable[_P, _R]], MainFunctionGui[_P, _R]]:
...
) -> Callable[[Callable[_P, _R]], MainFunctionGui[_P, _R]]: ...


def magicgui(
Expand Down Expand Up @@ -226,8 +222,7 @@ def magic_factory(
widget_init: Callable[[FunctionGui], None] | None = None,
raise_on_unknown: bool = False,
**param_options: dict,
) -> MagicFactory[FunctionGui[_P, _R]]:
...
) -> MagicFactory[FunctionGui[_P, _R]]: ...


@overload
Expand All @@ -247,8 +242,7 @@ def magic_factory(
widget_init: Callable[[FunctionGui], None] | None = None,
raise_on_unknown: bool = False,
**param_options: dict,
) -> Callable[[Callable[_P, _R]], MagicFactory[FunctionGui[_P, _R]]]:
...
) -> Callable[[Callable[_P, _R]], MagicFactory[FunctionGui[_P, _R]]]: ...


@overload
Expand All @@ -268,8 +262,7 @@ def magic_factory(
widget_init: Callable[[FunctionGui], None] | None = None,
raise_on_unknown: bool = False,
**param_options: dict,
) -> MagicFactory[MainFunctionGui[_P, _R]]:
...
) -> MagicFactory[MainFunctionGui[_P, _R]]: ...


@overload
Expand All @@ -289,8 +282,7 @@ def magic_factory(
widget_init: Callable[[FunctionGui], None] | None = None,
raise_on_unknown: bool = False,
**param_options: dict,
) -> Callable[[Callable[_P, _R]], MagicFactory[MainFunctionGui[_P, _R]]]:
...
) -> Callable[[Callable[_P, _R]], MagicFactory[MainFunctionGui[_P, _R]]]: ...


def magic_factory(
Expand Down
Loading

0 comments on commit 4b3b911

Please sign in to comment.