kopia lustrzana https://github.com/corrscope/corrscope
Rename default_config to template_config, to avoid confusion
rodzic
33a5531da8
commit
8f2c334c16
|
@ -9,7 +9,7 @@ import click
|
|||
import corrscope
|
||||
from corrscope.channel import ChannelConfig
|
||||
from corrscope.config import yaml
|
||||
from corrscope.corrscope import default_config, CorrScope, Config, Arguments
|
||||
from corrscope.corrscope import template_config, CorrScope, Config, Arguments
|
||||
from corrscope.outputs import IOutputConfig, FFplayOutputConfig
|
||||
from corrscope.settings.paths import MissingFFmpegError
|
||||
|
||||
|
@ -160,7 +160,7 @@ def main(
|
|||
break
|
||||
|
||||
elif path.suffix in YAML_EXTS:
|
||||
# Load a YAML file to cfg, and skip default_config().
|
||||
# Load a YAML file to cfg, and skip template_config().
|
||||
if len(files) > 1:
|
||||
raise click.ClickException(
|
||||
f'Cannot supply multiple arguments when providing config {path}')
|
||||
|
@ -182,7 +182,7 @@ def main(
|
|||
# cfg and cfg_dir are always initialized together.
|
||||
channels = [ChannelConfig(str(wav_path)) for wav_path in wav_list]
|
||||
|
||||
cfg_or_path = default_config(
|
||||
cfg_or_path = template_config(
|
||||
master_audio=audio,
|
||||
# fps=default,
|
||||
channels=channels,
|
||||
|
|
|
@ -102,7 +102,7 @@ class Config(
|
|||
_FPS = 60 # f_s
|
||||
|
||||
|
||||
def default_config(**kwargs) -> Config:
|
||||
def template_config(**kwargs) -> Config:
|
||||
""" Default template values do NOT indicate optional attributes. """
|
||||
cfg = Config(
|
||||
master_audio="",
|
||||
|
|
|
@ -30,7 +30,7 @@ import corrscope.settings.global_prefs as gp
|
|||
from corrscope import cli
|
||||
from corrscope.channel import ChannelConfig, DefaultLabel
|
||||
from corrscope.config import CorrError, copy_config, yaml
|
||||
from corrscope.corrscope import CorrScope, Config, Arguments, default_config
|
||||
from corrscope.corrscope import CorrScope, Config, Arguments, template_config
|
||||
from corrscope.gui.history_file_dlg import (
|
||||
get_open_file_name,
|
||||
get_open_file_list,
|
||||
|
@ -327,7 +327,7 @@ class MainWindow(qw.QMainWindow, Ui_MainWindow):
|
|||
def on_action_new(self):
|
||||
if not self.should_close_document(self.tr("New Project")):
|
||||
return
|
||||
cfg = default_config()
|
||||
cfg = template_config()
|
||||
self.load_cfg(cfg, None)
|
||||
|
||||
def on_action_open(self):
|
||||
|
@ -343,7 +343,7 @@ class MainWindow(qw.QMainWindow, Ui_MainWindow):
|
|||
def load_cfg_from_path(self, cfg_path: Path):
|
||||
# Bind GUI to dummy config, in case loading cfg_path raises Exception.
|
||||
if self.model is None:
|
||||
self.load_cfg(default_config(), None)
|
||||
self.load_cfg(template_config(), None)
|
||||
|
||||
assert cfg_path.is_file()
|
||||
self.pref.file_dir = str(cfg_path.parent.resolve())
|
||||
|
|
|
@ -9,7 +9,7 @@ from pytest_mock import MockFixture
|
|||
import corrscope.channel
|
||||
import corrscope.corrscope
|
||||
from corrscope.channel import ChannelConfig, Channel, DefaultLabel
|
||||
from corrscope.corrscope import default_config, CorrScope, BenchmarkMode, Arguments
|
||||
from corrscope.corrscope import template_config, CorrScope, BenchmarkMode, Arguments
|
||||
from corrscope.triggers import NullTriggerConfig
|
||||
from corrscope.util import coalesce
|
||||
from corrscope.wave import Flatten
|
||||
|
@ -82,7 +82,7 @@ def test_config_channel_integration(
|
|||
)
|
||||
|
||||
def get_cfg():
|
||||
return default_config(
|
||||
return template_config(
|
||||
trigger_ms=trigger_ms,
|
||||
render_ms=render_ms,
|
||||
trigger_subsampling=tsub,
|
||||
|
@ -177,7 +177,7 @@ def test_per_channel_stereo(
|
|||
stereo = coalesce(chan_stereo, global_stereo)
|
||||
|
||||
# Test render wave.
|
||||
cfg = default_config(render_stereo=global_stereo)
|
||||
cfg = template_config(render_stereo=global_stereo)
|
||||
ccfg = ChannelConfig("tests/stereo in-phase.wav", render_stereo=chan_stereo)
|
||||
channel = Channel(ccfg, cfg)
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import PyQt5.QtWidgets as qw
|
||||
|
||||
from corrscope import gui
|
||||
from corrscope.corrscope import default_config
|
||||
from corrscope.corrscope import template_config
|
||||
|
||||
|
||||
def test_gui_init():
|
||||
app = qw.QApplication([])
|
||||
cfg = default_config()
|
||||
cfg = template_config()
|
||||
gui.MainWindow(cfg)
|
||||
|
|
|
@ -12,7 +12,7 @@ import attr
|
|||
import pytest
|
||||
|
||||
from corrscope.channel import ChannelConfig
|
||||
from corrscope.corrscope import default_config, Config, CorrScope, Arguments
|
||||
from corrscope.corrscope import template_config, Config, CorrScope, Arguments
|
||||
from corrscope.outputs import (
|
||||
FFmpegOutput,
|
||||
FFmpegOutputConfig,
|
||||
|
@ -47,11 +47,11 @@ class DummyException(Exception):
|
|||
NULL_FFMPEG_OUTPUT = FFmpegOutputConfig(None, "-f null")
|
||||
|
||||
render_cfg = RendererConfig(WIDTH, HEIGHT)
|
||||
CFG = default_config(render=render_cfg)
|
||||
CFG = template_config(render=render_cfg)
|
||||
|
||||
|
||||
def sine440_config():
|
||||
cfg = default_config(
|
||||
cfg = template_config(
|
||||
channels=[ChannelConfig("tests/sine440.wav")],
|
||||
master_audio="tests/sine440.wav",
|
||||
end_time=0.5, # Reduce test duration
|
||||
|
|
|
@ -7,7 +7,7 @@ import pytest
|
|||
from hypothesis import given
|
||||
|
||||
from corrscope.channel import ChannelConfig, Channel
|
||||
from corrscope.corrscope import CorrScope, default_config, Arguments
|
||||
from corrscope.corrscope import CorrScope, template_config, Arguments
|
||||
from corrscope.layout import LayoutConfig
|
||||
from corrscope.outputs import FFplayOutputConfig
|
||||
from corrscope.renderer import (
|
||||
|
@ -375,7 +375,7 @@ def test_stereo_render_integration(mocker: "pytest_mock.MockFixture"):
|
|||
mocker.patch.object(FFplayOutputConfig, "cls")
|
||||
|
||||
# Render in stereo.
|
||||
cfg = default_config(
|
||||
cfg = template_config(
|
||||
channels=[ChannelConfig("tests/stereo in-phase.wav")],
|
||||
render_stereo=Flatten.Stereo,
|
||||
end_time=0.5, # Reduce test duration
|
||||
|
@ -466,7 +466,7 @@ def test_renderer_knows_stride(mocker: "pytest_mock.MockFixture", integration: b
|
|||
width_mul = 3
|
||||
|
||||
chan_cfg = ChannelConfig("tests/sine440.wav", render_width=width_mul)
|
||||
corr_cfg = default_config(
|
||||
corr_cfg = template_config(
|
||||
render_subsampling=subsampling, channels=[chan_cfg], end_time=0
|
||||
)
|
||||
|
||||
|
@ -498,7 +498,7 @@ def test_frontend_overrides_backend(mocker: "pytest_mock.MockFixture"):
|
|||
frontend_get_frame = mocker.spy(RendererFrontend, "get_frame")
|
||||
backend_get_frame = mocker.spy(AbstractMatplotlibRenderer, "get_frame")
|
||||
|
||||
corr_cfg = default_config()
|
||||
corr_cfg = template_config()
|
||||
chan_cfg = ChannelConfig("tests/sine440.wav")
|
||||
channel = Channel(chan_cfg, corr_cfg, channel_idx=0)
|
||||
data = channel.get_render_around(0)
|
||||
|
|
|
@ -26,7 +26,7 @@ triggers.SHOW_TRIGGER = False
|
|||
|
||||
|
||||
def cfg_template(**kwargs) -> CorrelationTriggerConfig:
|
||||
""" Not identical to default_config() template. """
|
||||
""" Not identical to template_config() template. """
|
||||
cfg = CorrelationTriggerConfig(
|
||||
edge_strength=2, responsiveness=1, buffer_falloff=0.5
|
||||
)
|
||||
|
|
Ładowanie…
Reference in New Issue