mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-21 01:01:05 +08:00
Type hint Correction (#8972)
* Type hint Correction * add changeset * typecheck --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com> Co-authored-by: freddyaboulton <alfonsoboulton@gmail.com>
This commit is contained in:
parent
fb502de8af
commit
d4c503a471
5
.changeset/four-zebras-worry.md
Normal file
5
.changeset/four-zebras-worry.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
feat:Type hint Correction
|
@ -2,7 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Callable, Sequence
|
||||
from typing import TYPE_CHECKING, Any, Callable, Literal, Sequence
|
||||
|
||||
from gradio_client.documentation import document
|
||||
|
||||
@ -29,7 +29,7 @@ class Radio(FormComponent):
|
||||
| None = None,
|
||||
*,
|
||||
value: str | int | float | Callable | None = None,
|
||||
type: str = "value",
|
||||
type: Literal["value", "index"] = "value",
|
||||
label: str | None = None,
|
||||
info: str | None = None,
|
||||
every: Timer | float | None = None,
|
||||
|
@ -49,7 +49,7 @@ class UploadButton(Component):
|
||||
elem_classes: list[str] | str | None = None,
|
||||
render: bool = True,
|
||||
key: int | str | None = None,
|
||||
type: Literal["filepath", "bytes"] = "filepath",
|
||||
type: Literal["filepath", "binary"] = "filepath",
|
||||
file_count: Literal["single", "multiple", "directory"] = "single",
|
||||
file_types: list[str] | None = None,
|
||||
):
|
||||
|
@ -46,7 +46,7 @@ class TestRadio:
|
||||
assert radio.choices == [("a", "a"), ("b", "b"), ("c", "c full")]
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
gr.Radio(["a", "b"], type="unknown")
|
||||
gr.Radio(["a", "b"], type="unknown") # type: ignore
|
||||
|
||||
def test_in_interface(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user