Skip to content

Commit

Permalink
Type hint Correction (#8972)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people committed Aug 2, 2024
1 parent fb502de commit d4c503a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/four-zebras-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gradio": patch
---

feat:Type hint Correction
4 changes: 2 additions & 2 deletions gradio/components/radio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -29,7 +29,7 @@ def __init__(
| 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,
Expand Down
2 changes: 1 addition & 1 deletion gradio/components/upload_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(
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,
):
Expand Down
2 changes: 1 addition & 1 deletion test/components/test_radio.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_component_functions(self):
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):
"""
Expand Down

0 comments on commit d4c503a

Please sign in to comment.