Update processing/video/__init__.py
Browse files- processing/video/__init__.py +32 -5
processing/video/__init__.py
CHANGED
|
@@ -1,8 +1,35 @@
|
|
| 1 |
"""
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
| 4 |
"""
|
| 5 |
-
# If someone does `from processing.video import CoreVideoProcessor`
|
| 6 |
-
from .video_processor import CoreVideoProcessor
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
"""
|
| 2 |
+
Lightweight package init.
|
| 3 |
+
|
| 4 |
+
Avoid importing heavy submodules at import-time to prevent partially
|
| 5 |
+
initialized modules and mysterious ImportErrors on Spaces.
|
| 6 |
+
PEP 562-style lazy export of symbols from video_processor.
|
| 7 |
"""
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
from typing import List
|
| 10 |
+
|
| 11 |
+
__all__ = ["CoreVideoProcessor", "VideoProcessor", "ProcessorConfig", "ProcessingConfig"]
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def __getattr__(name):
|
| 15 |
+
if name in __all__:
|
| 16 |
+
# Lazy import to avoid circular/early import errors
|
| 17 |
+
from .video_processor import (
|
| 18 |
+
CoreVideoProcessor,
|
| 19 |
+
VideoProcessor,
|
| 20 |
+
ProcessorConfig,
|
| 21 |
+
ProcessingConfig,
|
| 22 |
+
)
|
| 23 |
+
mapping = {
|
| 24 |
+
"CoreVideoProcessor": CoreVideoProcessor,
|
| 25 |
+
"VideoProcessor": VideoProcessor,
|
| 26 |
+
"ProcessorConfig": ProcessorConfig,
|
| 27 |
+
"ProcessingConfig": ProcessingConfig,
|
| 28 |
+
}
|
| 29 |
+
return mapping[name]
|
| 30 |
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def __dir__() -> List[str]:
|
| 34 |
+
return sorted(list(globals().keys()) + __all__)
|
| 35 |
+
|