Fix type hints for stereo downmixing

pull/357/head
nyanpasu64 2020-05-03 17:18:30 -07:00
rodzic 36324d3386
commit ca164201fd
3 zmienionych plików z 8 dodań i 9 usunięć

Wyświetl plik

@ -15,7 +15,7 @@ from corrscope.config import (
) )
from corrscope.triggers import MainTriggerConfig from corrscope.triggers import MainTriggerConfig
from corrscope.util import coalesce from corrscope.util import coalesce
from corrscope.wave import Wave, Flatten from corrscope.wave import Wave, FlattenOrStr
if TYPE_CHECKING: if TYPE_CHECKING:
from corrscope.corrscope import Config from corrscope.corrscope import Config
@ -37,8 +37,8 @@ class ChannelConfig(DumpableAttrs):
amplification: Optional[float] = None amplification: Optional[float] = None
# Stereo config # Stereo config
trigger_stereo: Optional[Flatten] = None trigger_stereo: Optional[FlattenOrStr] = None
render_stereo: Optional[Flatten] = None render_stereo: Optional[FlattenOrStr] = None
line_color: Optional[str] = None line_color: Optional[str] = None

Wyświetl plik

@ -16,8 +16,7 @@ from corrscope.outputs import FFmpegOutputConfig, IOutputConfig
from corrscope.renderer import Renderer, RendererConfig, RendererFrontend from corrscope.renderer import Renderer, RendererConfig, RendererFrontend
from corrscope.triggers import CorrelationTriggerConfig, PerFrameCache, SpectrumConfig from corrscope.triggers import CorrelationTriggerConfig, PerFrameCache, SpectrumConfig
from corrscope.util import pushd, coalesce from corrscope.util import pushd, coalesce
from corrscope.wave import Wave, Flatten from corrscope.wave import Wave, Flatten, FlattenOrStr
PRINT_TIMESTAMP = True PRINT_TIMESTAMP = True
@ -78,8 +77,8 @@ class Config(
amplification: float amplification: float
# Stereo config # Stereo config
trigger_stereo: Flatten = Flatten.SumAvg trigger_stereo: FlattenOrStr = Flatten.SumAvg
render_stereo: Flatten = Flatten.SumAvg render_stereo: FlattenOrStr = Flatten.SumAvg
trigger: CorrelationTriggerConfig # Can be overriden per Wave trigger: CorrelationTriggerConfig # Can be overriden per Wave

Wyświetl plik

@ -143,7 +143,7 @@ class Wave:
self, self,
wave_path: str, wave_path: str,
amplification: float = 1.0, amplification: float = 1.0,
flatten: Flatten = Flatten.SumAvg, flatten: FlattenOrStr = Flatten.SumAvg,
): ):
self.wave_path = wave_path self.wave_path = wave_path
self.amplification = amplification self.amplification = amplification
@ -191,7 +191,7 @@ class Wave:
else: else:
raise CorrError(f"unexpected wavfile dtype {dtype}") raise CorrError(f"unexpected wavfile dtype {dtype}")
def with_flatten(self, flatten: Flatten, return_channels: bool) -> "Wave": def with_flatten(self, flatten: FlattenOrStr, return_channels: bool) -> "Wave":
new = copy.copy(self) new = copy.copy(self)
new.flatten = flatten new.flatten = flatten
new.return_channels = return_channels new.return_channels = return_channels