Update rx.get_upload_url signature to accept Var[str] (#4826)
* Update rx.get_upload_url signature to accept Var[str] * Add py.typed Fix #4806
This commit is contained in:
parent
10bae9577c
commit
6848915883
@ -147,7 +147,7 @@ uploaded_files_url_prefix = Var(
|
|||||||
).to(str)
|
).to(str)
|
||||||
|
|
||||||
|
|
||||||
def get_upload_url(file_path: str) -> Var[str]:
|
def get_upload_url(file_path: str | Var[str]) -> Var[str]:
|
||||||
"""Get the URL of an uploaded file.
|
"""Get the URL of an uploaded file.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -158,7 +158,7 @@ def get_upload_url(file_path: str) -> Var[str]:
|
|||||||
"""
|
"""
|
||||||
Upload.is_used = True
|
Upload.is_used = True
|
||||||
|
|
||||||
return uploaded_files_url_prefix + "/" + file_path
|
return Var.create(f"{uploaded_files_url_prefix}/{file_path}")
|
||||||
|
|
||||||
|
|
||||||
def _on_drop_spec(files: Var) -> Tuple[Var[Any]]:
|
def _on_drop_spec(files: Var) -> Tuple[Var[Any]]:
|
||||||
|
@ -35,7 +35,7 @@ uploaded_files_url_prefix = Var(
|
|||||||
),
|
),
|
||||||
).to(str)
|
).to(str)
|
||||||
|
|
||||||
def get_upload_url(file_path: str) -> Var[str]: ...
|
def get_upload_url(file_path: str | Var[str]) -> Var[str]: ...
|
||||||
|
|
||||||
class UploadFilesProvider(Component):
|
class UploadFilesProvider(Component):
|
||||||
@overload
|
@overload
|
||||||
|
0
reflex/py.typed
Normal file
0
reflex/py.typed
Normal file
Loading…
Reference in New Issue
Block a user