Declare exports from stream explicitly (#71898)

This commit is contained in:
uvjustin 2022-05-15 23:58:57 +08:00 committed by GitHub
parent 98809675ff
commit 221b77297e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 31 additions and 10 deletions

View file

@ -29,8 +29,12 @@ from homeassistant.components.media_player.const import (
DOMAIN as DOMAIN_MP, DOMAIN as DOMAIN_MP,
SERVICE_PLAY_MEDIA, SERVICE_PLAY_MEDIA,
) )
from homeassistant.components.stream import Stream, create_stream from homeassistant.components.stream import (
from homeassistant.components.stream.const import FORMAT_CONTENT_TYPE, OUTPUT_FORMATS FORMAT_CONTENT_TYPE,
OUTPUT_FORMATS,
Stream,
create_stream,
)
from homeassistant.components.websocket_api import ActiveConnection from homeassistant.components.websocket_api import ActiveConnection
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ( from homeassistant.const import (

View file

@ -15,7 +15,7 @@ from homeassistant.components.media_source.models import (
MediaSourceItem, MediaSourceItem,
PlayMedia, PlayMedia,
) )
from homeassistant.components.stream.const import FORMAT_CONTENT_TYPE, HLS_PROVIDER from homeassistant.components.stream import FORMAT_CONTENT_TYPE, HLS_PROVIDER
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.entity_component import EntityComponent

View file

@ -12,7 +12,7 @@ from homeassistant.components.camera import (
Camera, Camera,
CameraEntityFeature, CameraEntityFeature,
) )
from homeassistant.components.stream.const import ( from homeassistant.components.stream import (
CONF_RTSP_TRANSPORT, CONF_RTSP_TRANSPORT,
CONF_USE_WALLCLOCK_AS_TIMESTAMPS, CONF_USE_WALLCLOCK_AS_TIMESTAMPS,
RTSP_TRANSPORTS, RTSP_TRANSPORTS,

View file

@ -16,7 +16,7 @@ from httpx import HTTPStatusError, RequestError, TimeoutException
import voluptuous as vol import voluptuous as vol
import yarl import yarl
from homeassistant.components.stream.const import ( from homeassistant.components.stream import (
CONF_RTSP_TRANSPORT, CONF_RTSP_TRANSPORT,
CONF_USE_WALLCLOCK_AS_TIMESTAMPS, CONF_USE_WALLCLOCK_AS_TIMESTAMPS,
RTSP_TRANSPORTS, RTSP_TRANSPORTS,

View file

@ -2,7 +2,7 @@
from onvif.exceptions import ONVIFAuthError, ONVIFError, ONVIFTimeoutError from onvif.exceptions import ONVIFAuthError, ONVIFError, ONVIFTimeoutError
from homeassistant.components.ffmpeg import CONF_EXTRA_ARGUMENTS from homeassistant.components.ffmpeg import CONF_EXTRA_ARGUMENTS
from homeassistant.components.stream.const import CONF_RTSP_TRANSPORT, RTSP_TRANSPORTS from homeassistant.components.stream import CONF_RTSP_TRANSPORT, RTSP_TRANSPORTS
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ( from homeassistant.const import (
EVENT_HOMEASSISTANT_STOP, EVENT_HOMEASSISTANT_STOP,

View file

@ -9,7 +9,7 @@ from yarl import URL
from homeassistant.components import ffmpeg from homeassistant.components import ffmpeg
from homeassistant.components.camera import Camera, CameraEntityFeature from homeassistant.components.camera import Camera, CameraEntityFeature
from homeassistant.components.ffmpeg import CONF_EXTRA_ARGUMENTS, get_ffmpeg_manager from homeassistant.components.ffmpeg import CONF_EXTRA_ARGUMENTS, get_ffmpeg_manager
from homeassistant.components.stream.const import CONF_RTSP_TRANSPORT from homeassistant.components.stream import CONF_RTSP_TRANSPORT
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import HTTP_BASIC_AUTHENTICATION from homeassistant.const import HTTP_BASIC_AUTHENTICATION
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant

View file

@ -43,12 +43,15 @@ from .const import (
CONF_SEGMENT_DURATION, CONF_SEGMENT_DURATION,
CONF_USE_WALLCLOCK_AS_TIMESTAMPS, CONF_USE_WALLCLOCK_AS_TIMESTAMPS,
DOMAIN, DOMAIN,
FORMAT_CONTENT_TYPE,
HLS_PROVIDER, HLS_PROVIDER,
MAX_SEGMENTS, MAX_SEGMENTS,
OUTPUT_FORMATS,
OUTPUT_IDLE_TIMEOUT, OUTPUT_IDLE_TIMEOUT,
RECORDER_PROVIDER, RECORDER_PROVIDER,
RTSP_TRANSPORTS, RTSP_TRANSPORTS,
SEGMENT_DURATION_ADJUSTER, SEGMENT_DURATION_ADJUSTER,
SOURCE_TIMEOUT,
STREAM_RESTART_INCREMENT, STREAM_RESTART_INCREMENT,
STREAM_RESTART_RESET_TIME, STREAM_RESTART_RESET_TIME,
TARGET_SEGMENT_DURATION_NON_LL_HLS, TARGET_SEGMENT_DURATION_NON_LL_HLS,
@ -57,6 +60,18 @@ from .core import PROVIDERS, IdleTimer, KeyFrameConverter, StreamOutput, StreamS
from .diagnostics import Diagnostics from .diagnostics import Diagnostics
from .hls import HlsStreamOutput, async_setup_hls from .hls import HlsStreamOutput, async_setup_hls
__all__ = [
"CONF_RTSP_TRANSPORT",
"CONF_USE_WALLCLOCK_AS_TIMESTAMPS",
"FORMAT_CONTENT_TYPE",
"HLS_PROVIDER",
"OUTPUT_FORMATS",
"RTSP_TRANSPORTS",
"SOURCE_TIMEOUT",
"Stream",
"create_stream",
]
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
STREAM_SOURCE_REDACT_PATTERN = [ STREAM_SOURCE_REDACT_PATTERN = [

View file

@ -2017,6 +2017,7 @@ disallow_untyped_defs = true
no_implicit_optional = true no_implicit_optional = true
warn_return_any = true warn_return_any = true
warn_unreachable = true warn_unreachable = true
no_implicit_reexport = true
[mypy-homeassistant.components.sun.*] [mypy-homeassistant.components.sun.*]
check_untyped_defs = true check_untyped_defs = true

View file

@ -200,6 +200,7 @@ IGNORED_MODULES: Final[list[str]] = [
NO_IMPLICIT_REEXPORT_MODULES: set[str] = { NO_IMPLICIT_REEXPORT_MODULES: set[str] = {
"homeassistant.components", "homeassistant.components",
"homeassistant.components.diagnostics.*", "homeassistant.components.diagnostics.*",
"homeassistant.components.stream.*",
} }
HEADER: Final = """ HEADER: Final = """

View file

@ -5,7 +5,7 @@ import pytest
from homeassistant.components import media_source from homeassistant.components import media_source
from homeassistant.components.camera.const import StreamType from homeassistant.components.camera.const import StreamType
from homeassistant.components.stream.const import FORMAT_CONTENT_TYPE from homeassistant.components.stream import FORMAT_CONTENT_TYPE
from homeassistant.setup import async_setup_component from homeassistant.setup import async_setup_component

View file

@ -19,7 +19,7 @@ from homeassistant.components.generic.const import (
CONF_STREAM_SOURCE, CONF_STREAM_SOURCE,
DOMAIN, DOMAIN,
) )
from homeassistant.components.stream.const import ( from homeassistant.components.stream import (
CONF_RTSP_TRANSPORT, CONF_RTSP_TRANSPORT,
CONF_USE_WALLCLOCK_AS_TIMESTAMPS, CONF_USE_WALLCLOCK_AS_TIMESTAMPS,
) )

View file

@ -52,7 +52,7 @@ from homeassistant.components.roku.const import (
DOMAIN, DOMAIN,
SERVICE_SEARCH, SERVICE_SEARCH,
) )
from homeassistant.components.stream.const import FORMAT_CONTENT_TYPE, HLS_PROVIDER from homeassistant.components.stream import FORMAT_CONTENT_TYPE, HLS_PROVIDER
from homeassistant.components.websocket_api.const import TYPE_RESULT from homeassistant.components.websocket_api.const import TYPE_RESULT
from homeassistant.config import async_process_ha_core_config from homeassistant.config import async_process_ha_core_config
from homeassistant.const import ( from homeassistant.const import (