Skip to content

Commit

Permalink
feature: add UiField as the new intermediate object representing wi…
Browse files Browse the repository at this point in the history
…dget parameters (#475)

* wip

* tests working

* more bugs and tests

* remove notes file

* remove typemap2

* fix docs and types

* add another test

* update doc

* move sentinel

* docstring

* undo change in signature

* reduce code

* wip: starting on schema

* make func

* fix py3.8

* improving compat

* tests passing (cheating)

* fill out UiField func

* star

* playing with GUIField

* wip

* wip

* wip

* feat: support annotated types

* fix merge

* starting on create method

* wip

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix tests

* cleanup a bit

* refactor: make uifield generic

* misc

* minimize test

* add values and more annotations support

* refactor: rename file

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
tlambert03 and pre-commit-ci[bot] committed Nov 12, 2022
1 parent 1a618e2 commit 811efce
Show file tree
Hide file tree
Showing 8 changed files with 1,057 additions and 45 deletions.
9 changes: 6 additions & 3 deletions magicgui/_type_resolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
from copy import copy
from functools import lru_cache, partial
from importlib import import_module
from typing import Any, Callable, Dict, Optional, Tuple, Type, Union, get_type_hints
from typing import Any, Callable, Dict, Optional, Tuple, Type, Union

# required for python 3.8 to strip annotations
from typing_extensions import get_type_hints

try:
from toolz import curry
Expand Down Expand Up @@ -53,7 +56,7 @@ def resolve_types(
obj = _unwrap_partial(obj)

try:
hints = get_type_hints(obj, globalns=globalns, localns=localns)
hints = get_type_hints(obj, globalns=globalns, localns=localns) # type: ignore
except NameError as e:
if do_imports:
# try to import the top level name and try again
Expand Down Expand Up @@ -106,7 +109,7 @@ def resolve_single_type(
return hints["obj"]


_cached_resolve = lru_cache(maxsize=1)(resolve_single_type)
_cached_resolve = lru_cache(maxsize=None)(resolve_single_type)


def _try_cached_resolve(v):
Expand Down
Loading

0 comments on commit 811efce

Please sign in to comment.