Skip to content

Commit c4e6690

Browse files
committed
refactor: move UploadChunk exports from event.py to _upload module
Re-export UploadChunk and UploadChunkIterator directly from reflex._upload instead of re-importing them through reflex.event, removing the eager import_module call at module load time.
1 parent 611bd6f commit c4e6690

3 files changed

Lines changed: 5 additions & 11 deletions

File tree

pyi_hashes.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"reflex/__init__.pyi": "276759cf35be6503c710e2203405adb6",
2+
"reflex/__init__.pyi": "a0266c47111e9af7f340186013c7a31e",
33
"reflex/components/__init__.pyi": "ac05995852baa81062ba3d18fbc489fb",
44
"reflex/components/base/__init__.pyi": "16e47bf19e0d62835a605baa3d039c5a",
55
"reflex/components/base/app_wrap.pyi": "22e94feaa9fe675bcae51c412f5b67f1",

reflex/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,14 @@
297297
"config": ["Config", "DBConfig"],
298298
"constants": ["Env"],
299299
"constants.colors": ["Color"],
300+
"_upload": [
301+
"UploadChunk",
302+
"UploadChunkIterator",
303+
],
300304
"event": [
301305
"event",
302306
"EventChain",
303307
"EventHandler",
304-
"UploadChunk",
305-
"UploadChunkIterator",
306308
"call_script",
307309
"call_function",
308310
"run_script",

reflex/event.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from base64 import b64encode
88
from collections.abc import Callable, Mapping, Sequence
99
from functools import lru_cache, partial
10-
from importlib import import_module
1110
from typing import (
1211
TYPE_CHECKING,
1312
Annotated,
@@ -1101,11 +1100,6 @@ def as_event_spec(self, handler: EventHandler) -> EventSpec:
11011100
upload_files_chunk = UploadFilesChunk
11021101

11031102

1104-
_upload_module = import_module("reflex._upload")
1105-
UploadChunk = _upload_module.UploadChunk
1106-
UploadChunkIterator = _upload_module.UploadChunkIterator
1107-
1108-
11091103
# Special server-side events.
11101104
def server_side(name: str, sig: inspect.Signature, **kwargs) -> EventSpec:
11111105
"""A server-side event.
@@ -2468,8 +2462,6 @@ class EventNamespace:
24682462

24692463
# File Upload
24702464
FileUpload = FileUpload
2471-
UploadChunk = UploadChunk
2472-
UploadChunkIterator = UploadChunkIterator
24732465
UploadFilesChunk = UploadFilesChunk
24742466

24752467
# Type Aliases

0 commit comments

Comments
 (0)