repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_pdf_structure.py | test_pdf_structure_with_toc | self.assertEqual | numeric_literal | 46 | import unittest
import os
import shutil
import fitz # PyMuPDF
from abogen.book_parser import PdfParser
class TestPdfStructure(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/test_data_pdf"
if os.path.exists(self.test_dir):
shutil.rmtree(self.test_dir)
os.makedirs(s... | 2) | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_pdf_structure.py | test_pdf_structure_with_toc | self.assertEqual | numeric_literal | 54 | import unittest
import os
import shutil
import fitz # PyMuPDF
from abogen.book_parser import PdfParser
class TestPdfStructure(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/test_data_pdf"
if os.path.exists(self.test_dir):
shutil.rmtree(self.test_dir)
os.makedirs(s... | 1) | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_calibre_opds.py | test_calibre_opds_feed_exposes_series_metadata | assert | numeric_literal | 35 | from abogen.integrations.calibre_opds import (
CalibreOPDSClient,
OPDSEntry,
OPDSFeed,
OPDSLink,
feed_to_dict,
)
def test_calibre_opds_feed_exposes_series_metadata() -> None:
client = CalibreOPDSClient("http://example.com/catalog")
xml_payload = """<?xml version=\"1.0\" encoding=\"UTF-8\"?>... | 4.0 | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_calibre_opds.py | test_calibre_opds_feed_extracts_series_from_categories | assert | numeric_literal | 37 | from abogen.integrations.calibre_opds import (
CalibreOPDSClient,
OPDSEntry,
OPDSFeed,
OPDSLink,
feed_to_dict,
)
def test_calibre_opds_feed_extracts_series_from_categories() -> None:
client = CalibreOPDSClient("http://example.com/catalog")
xml_payload = """<?xml version=\"1.0\" encoding=\"U... | 5.0 | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_calibre_opds.py | test_calibre_opds_extracts_tags_and_rating_from_summary | assert | numeric_literal | 36 | from abogen.integrations.calibre_opds import (
CalibreOPDSClient,
OPDSEntry,
OPDSFeed,
OPDSLink,
feed_to_dict,
)
def test_calibre_opds_extracts_tags_and_rating_from_summary() -> None:
client = CalibreOPDSClient("http://example.com/catalog")
xml_payload = """<?xml version=\"1.0\" encoding=\"... | 3.0 | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_service.py | test_retry_removes_failed_job | assert | complex_expr | 58 | from __future__ import annotations
import io
import time
from abogen.webui.service import (
Job,
JobStatus,
build_service,
_JOB_LOGGER,
build_audiobookshelf_metadata,
)
def test_retry_removes_failed_job(tmp_path):
uploads = tmp_path / "uploads"
outputs = tmp_path / "outputs"
uploads.mk... | job.id | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_tts_supertonic_unsupported_chars.py | test_supertonic_pipeline_strips_unsupported_characters_and_retries | assert | complex_expr | 18 | import numpy as np
from abogen.tts_supertonic import SupertonicPipeline
def test_supertonic_pipeline_strips_unsupported_characters_and_retries():
# Avoid importing/initializing real supertonic by manually constructing the pipeline.
pipeline = SupertonicPipeline.__new__(SupertonicPipeline)
pipeline.sample_... | np.float32 | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_service.py | test_job_add_log_handles_exception | assert | complex_expr | 49 | from __future__ import annotations
import io
import time
from abogen.webui.service import (
Job,
JobStatus,
build_service,
_JOB_LOGGER,
build_audiobookshelf_metadata,
)
def test_job_add_log_handles_exception(tmp_path, capsys):
sample = tmp_path / "sample.txt"
sample.write_text("payload", e... | captured.err | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_preview_applies_manual_overrides.py | test_preview_applies_manual_override_before_normalization | assert | complex_expr | 54 | from abogen.webui.routes.utils import preview
def test_preview_applies_manual_override_before_normalization(monkeypatch):
# Don't run real TTS/normalization; just exercise the override stage by
# forcing provider=kokoro and then stubbing normalize_for_pipeline.
monkeypatch.setattr(preview, "get_preview_pi... | captured["text"] | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_service.py | test_retry_removes_failed_job | assert | complex_expr | 54 | from __future__ import annotations
import io
import time
from abogen.webui.service import (
Job,
JobStatus,
build_service,
_JOB_LOGGER,
build_audiobookshelf_metadata,
)
def test_retry_removes_failed_job(tmp_path):
uploads = tmp_path / "uploads"
outputs = tmp_path / "outputs"
uploads.mk... | JobStatus.FAILED | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_service.py | test_service_processes_job | assert | complex_expr | 66 | from __future__ import annotations
import io
import time
from abogen.webui.service import (
Job,
JobStatus,
build_service,
_JOB_LOGGER,
build_audiobookshelf_metadata,
)
def test_service_processes_job(tmp_path):
uploads = tmp_path / "uploads"
outputs = tmp_path / "outputs"
uploads.mkdir... | JobStatus.COMPLETED | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_speaker_analysis.py | test_analyze_speakers_applies_threshold_suppression | assert | complex_expr | 34 | from abogen.speaker_analysis import analyze_speakers
def _chapters():
return [
{
"id": "0001",
"index": 0,
"title": "Test",
"text": "",
"enabled": True,
}
]
def _chunk(text: str, idx: int) -> dict:
return {
"id": f"chunk-{... | analysis.suppressed | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_book_parser.py | test_epub_parser_content | self.assertIn | complex_expr | 85 | import unittest
import os
import sys
import shutil
import fitz # PyMuPDF
from ebooklib import epub
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.book_parser import get_book_parser, PdfParser, EpubParser, MarkdownParser
class TestBookParser(unittest.TestCase):
de... | parser.content_texts) | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_pdf_structure.py | test_pdf_structure_without_toc | self.assertIn | complex_expr | 43 | import unittest
import os
import shutil
import fitz # PyMuPDF
from abogen.book_parser import PdfParser
class TestPdfStructure(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/test_data_pdf"
if os.path.exists(self.test_dir):
shutil.rmtree(self.test_dir)
os.makedirs(s... | children[0]['title']) | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_pdf_structure.py | test_pdf_structure_without_toc | self.assertIn | complex_expr | 44 | import unittest
import os
import shutil
import fitz # PyMuPDF
from abogen.book_parser import PdfParser
class TestPdfStructure(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/test_data_pdf"
if os.path.exists(self.test_dir):
shutil.rmtree(self.test_dir)
os.makedirs(s... | children[1]['title']) | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_debug_tts_samples.py | test_debug_samples_normalize_smoke | assert | complex_expr | 41 | import json
from pathlib import Path
import numpy as np
import pytest
from abogen.debug_tts_samples import (
DEBUG_TTS_SAMPLES,
MARKER_PREFIX,
MARKER_SUFFIX,
iter_expected_codes,
)
from abogen.kokoro_text_normalization import HAS_NUM2WORDS, normalize_for_pipeline
from abogen.normalization_settings imp... | normalized["FOOT_001"] | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_output_paths.py | test_prepare_project_layout_creates_project_subdirs | assert | complex_expr | 46 | from __future__ import annotations
import time
from pathlib import Path
import pytest
from abogen.webui.conversion_runner import _build_output_path, _prepare_project_layout
from abogen.webui.service import Job
def _sample_job(tmp_path: Path) -> Job:
source = tmp_path / "sample.txt"
source.write_text("exampl... | project_root / "audio" | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_output_paths.py | test_prepare_project_layout_creates_project_subdirs | assert | complex_expr | 48 | from __future__ import annotations
import time
from pathlib import Path
import pytest
from abogen.webui.conversion_runner import _build_output_path, _prepare_project_layout
from abogen.webui.service import Job
def _sample_job(tmp_path: Path) -> Job:
source = tmp_path / "sample.txt"
source.write_text("exampl... | project_root / "metadata" | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_output_paths.py | test_prepare_project_layout_creates_project_subdirs | assert | complex_expr | 47 | from __future__ import annotations
import time
from pathlib import Path
import pytest
from abogen.webui.conversion_runner import _build_output_path, _prepare_project_layout
from abogen.webui.service import Job
def _sample_job(tmp_path: Path) -> Job:
source = tmp_path / "sample.txt"
source.write_text("exampl... | project_root / "subtitles" | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_epub_ncx_parsing.py | test_ncx_only_parsing | self.assertIn | complex_expr | 84 | import unittest
import os
import shutil
import sys
from ebooklib import epub
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.book_parser import get_book_parser, EpubParser
class TestEpubNcxParsing(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/... | parser.content_texts[id_1]) | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_output_paths.py | test_prepare_project_layout_creates_project_subdirs | assert | complex_expr | 54 | from __future__ import annotations
import time
from pathlib import Path
import pytest
from abogen.webui.conversion_runner import _build_output_path, _prepare_project_layout
from abogen.webui.service import Job
def _sample_job(tmp_path: Path) -> Job:
source = tmp_path / "sample.txt"
source.write_text("exampl... | audio_dir / "Sample_Title.wav" | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_calibre_opds.py | test_calibre_opds_search_filters_by_title_and_author | assert | collection | 37 | from abogen.integrations.calibre_opds import (
CalibreOPDSClient,
OPDSEntry,
OPDSFeed,
OPDSLink,
feed_to_dict,
)
def test_calibre_opds_search_filters_by_title_and_author() -> None:
client = CalibreOPDSClient("http://example.com/catalog")
feed = OPDSFeed(
id="catalog",
title=... | [] | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_chapter_overrides.py | test_apply_chapter_overrides_with_custom_text | assert | collection | 124 | from __future__ import annotations
import sys
import types
def _install_dependency_stubs() -> None:
if "ebooklib" not in sys.modules:
ebooklib_stub = types.ModuleType("ebooklib")
epub_stub = types.ModuleType("ebooklib.epub")
setattr(ebooklib_stub, "epub", epub_stub)
sys.modules["eb... | {} | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_chapter_overrides.py | test_apply_chapter_overrides_with_custom_text | assert | collection | 125 | from __future__ import annotations
import sys
import types
def _install_dependency_stubs() -> None:
if "ebooklib" not in sys.modules:
ebooklib_stub = types.ModuleType("ebooklib")
epub_stub = types.ModuleType("ebooklib.epub")
setattr(ebooklib_stub, "epub", epub_stub)
sys.modules["eb... | [] | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_service.py | test_service_processes_job | assert | collection | 71 | from __future__ import annotations
import io
import time
from abogen.webui.service import (
Job,
JobStatus,
build_service,
_JOB_LOGGER,
build_audiobookshelf_metadata,
)
def test_service_processes_job(tmp_path):
uploads = tmp_path / "uploads"
outputs = tmp_path / "outputs"
uploads.mkdir... | [] | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_tts_supertonic_unsupported_chars.py | test_supertonic_pipeline_drops_chunk_if_only_unsupported_characters | assert | collection | 14 | import numpy as np
from abogen.tts_supertonic import SupertonicPipeline
def test_supertonic_pipeline_drops_chunk_if_only_unsupported_characters():
pipeline = SupertonicPipeline.__new__(SupertonicPipeline)
pipeline.sample_rate = 24000
pipeline.total_steps = 5
pipeline.max_chunk_length = 1000
pipeli... | [] | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_voice_cache.py | test_ensure_voice_assets_downloads_missing | assert | collection | 42 | from types import SimpleNamespace
from typing import cast
import pytest
from abogen.constants import VOICES_INTERNAL
from abogen.voice_cache import (
LocalEntryNotFoundError,
_CACHED_VOICES,
ensure_voice_assets,
)
from abogen.webui.conversion_runner import _collect_required_voice_ids
from abogen.webui.ser... | {} | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_voice_cache.py | test_ensure_voice_assets_downloads_missing | assert | collection | 50 | from types import SimpleNamespace
from typing import cast
import pytest
from abogen.constants import VOICES_INTERNAL
from abogen.voice_cache import (
LocalEntryNotFoundError,
_CACHED_VOICES,
ensure_voice_assets,
)
from abogen.webui.conversion_runner import _collect_required_voice_ids
from abogen.webui.ser... | [] | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_calibre_opds.py | test_calibre_opds_search_filters_by_title_and_author | assert | collection | 28 | from abogen.integrations.calibre_opds import (
CalibreOPDSClient,
OPDSEntry,
OPDSFeed,
OPDSLink,
feed_to_dict,
)
def test_calibre_opds_search_filters_by_title_and_author() -> None:
client = CalibreOPDSClient("http://example.com/catalog")
feed = OPDSFeed(
id="catalog",
title=... | ["1"] | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_calibre_opds.py | test_calibre_opds_search_filters_by_title_and_author | assert | collection | 31 | from abogen.integrations.calibre_opds import (
CalibreOPDSClient,
OPDSEntry,
OPDSFeed,
OPDSLink,
feed_to_dict,
)
def test_calibre_opds_search_filters_by_title_and_author() -> None:
client = CalibreOPDSClient("http://example.com/catalog")
feed = OPDSFeed(
id="catalog",
title=... | ["2"] | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_calibre_opds.py | test_calibre_opds_search_filters_by_title_and_author | assert | collection | 34 | from abogen.integrations.calibre_opds import (
CalibreOPDSClient,
OPDSEntry,
OPDSFeed,
OPDSLink,
feed_to_dict,
)
def test_calibre_opds_search_filters_by_title_and_author() -> None:
client = CalibreOPDSClient("http://example.com/catalog")
feed = OPDSFeed(
id="catalog",
title=... | ["3"] | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_epub_standard_nav.py | test_discovery_by_nav_property | self.assertEqual | collection | 102 | import unittest
import os
import shutil
import sys
from ebooklib import epub
import ebooklib
from unittest.mock import MagicMock
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.book_parser import get_book_parser
class TestEpubStandardNav(unittest.TestCase):
def set... | ["nav"]) | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_debug_tts_samples.py | test_settings_debug_route_writes_manifest | assert | collection | 49 | import json
from pathlib import Path
import numpy as np
import pytest
from abogen.debug_tts_samples import (
DEBUG_TTS_SAMPLES,
MARKER_PREFIX,
MARKER_SUFFIX,
iter_expected_codes,
)
from abogen.kokoro_text_normalization import HAS_NUM2WORDS, normalize_for_pipeline
from abogen.normalization_settings imp... | {302, 303} | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_settings_integrations_secrets.py | test_settings_update_preserves_abs_api_token_when_blank | assert | collection | 67 | from __future__ import annotations
from pathlib import Path
from abogen.utils import load_config, save_config
from abogen.webui.app import create_app
def test_settings_update_preserves_abs_api_token_when_blank(tmp_path):
# Seed config with stored integration secret.
save_config(
{
"langua... | {302, 303} | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_debug_tts_samples.py | test_debug_samples_normalize_smoke | assert | collection | 44 | import json
from pathlib import Path
import numpy as np
import pytest
from abogen.debug_tts_samples import (
DEBUG_TTS_SAMPLES,
MARKER_PREFIX,
MARKER_SUFFIX,
iter_expected_codes,
)
from abogen.kokoro_text_normalization import HAS_NUM2WORDS, normalize_for_pipeline
from abogen.normalization_settings imp... | {".", "!", "?"} | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_chunk_helpers.py | test_group_chunks_by_chapter_orders_and_groups | assert | collection | 18 | from __future__ import annotations
from types import SimpleNamespace
from abogen.chunking import chunk_text
from abogen.webui.conversion_runner import _chunk_voice_spec, _group_chunks_by_chapter
def test_group_chunks_by_chapter_orders_and_groups() -> None:
chunks = [
{"chapter_index": "0", "chunk_index":... | ["body", "tail"] | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_voice_cache.py | test_ensure_voice_assets_downloads_missing | assert | collection | 41 | from types import SimpleNamespace
from typing import cast
import pytest
from abogen.constants import VOICES_INTERNAL
from abogen.voice_cache import (
LocalEntryNotFoundError,
_CACHED_VOICES,
ensure_voice_assets,
)
from abogen.webui.conversion_runner import _collect_required_voice_ids
from abogen.webui.ser... | {"af_nova", "am_liam"} | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_calibre_opds.py | test_calibre_opds_does_not_map_author_into_series_from_categories | assert | none_literal | 40 | from abogen.integrations.calibre_opds import (
CalibreOPDSClient,
OPDSEntry,
OPDSFeed,
OPDSLink,
feed_to_dict,
)
def test_calibre_opds_does_not_map_author_into_series_from_categories() -> None:
client = CalibreOPDSClient("http://example.com/catalog")
xml_payload = """<?xml version=\"1.0\" e... | None | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_epub_exporter.py | test_epub3_preserves_original_whitespace | assert | none_literal | 94 | from __future__ import annotations
import html
import re
import zipfile
from abogen.epub3.exporter import build_epub3_package
from abogen.text_extractor import ExtractedChapter, ExtractionResult
def _make_sample_extraction() -> ExtractionResult:
return ExtractionResult(
chapters=[
ExtractedCh... | None | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_ffmetadata.py | test_render_ffmetadata_includes_chapters | assert | none_literal | 34 | from __future__ import annotations
from pathlib import Path
from abogen.webui.conversion_runner import _render_ffmetadata, _write_ffmetadata_file
def test_render_ffmetadata_includes_chapters(tmp_path):
metadata = {
"title": "Sample Book",
"artist": "Author Name",
"comment": "Line one\nLin... | None | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_output_paths.py | test_prepare_project_layout_uses_timestamped_folder | assert | none_literal | 50 | from __future__ import annotations
import time
from pathlib import Path
import pytest
from abogen.webui.conversion_runner import _build_output_path, _prepare_project_layout
from abogen.webui.service import Job
def _sample_job(tmp_path: Path) -> Job:
source = tmp_path / "sample.txt"
source.write_text("exampl... | None | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_service.py | test_retry_removes_failed_job | assert | none_literal | 57 | from __future__ import annotations
import io
import time
from abogen.webui.service import (
Job,
JobStatus,
build_service,
_JOB_LOGGER,
build_audiobookshelf_metadata,
)
def test_retry_removes_failed_job(tmp_path):
uploads = tmp_path / "uploads"
outputs = tmp_path / "outputs"
uploads.mk... | None | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_conversion_chapter_titles.py | test_strip_duplicate_heading_line_removes_first_match | assert | bool_literal | 16 | import sys
import types
from abogen.webui.conversion_runner import (
_format_spoken_chapter_title,
_headings_equivalent,
_normalize_chapter_opening_caps,
_strip_duplicate_heading_line,
)
def test_strip_duplicate_heading_line_removes_first_match() -> None:
text, removed = _strip_duplicate_heading_l... | True | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_speaker_analysis.py | test_analyze_speakers_applies_threshold_suppression | assert | bool_literal | 33 | from abogen.speaker_analysis import analyze_speakers
def _chapters():
return [
{
"id": "0001",
"index": 0,
"title": "Test",
"text": "",
"enabled": True,
}
]
def _chunk(text: str, idx: int) -> dict:
return {
"id": f"chunk-{... | True | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_conversion_chapter_titles.py | test_normalize_chapter_opening_caps_keeps_mixed_case | assert | bool_literal | 15 | import sys
import types
from abogen.webui.conversion_runner import (
_format_spoken_chapter_title,
_headings_equivalent,
_normalize_chapter_opening_caps,
_strip_duplicate_heading_line,
)
def test_normalize_chapter_opening_caps_keeps_mixed_case() -> None:
normalized, changed = _normalize_chapter_op... | False | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_epub_missing_file_error_handling.py | test_missing_file_recovery | self.assertTrue | bool_literal | 79 | import unittest
import os
import shutil
import zipfile
import sys
import logging
from ebooklib import epub
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.book_parser import get_book_parser
class TestEpubMissingFileErrorHandling(unittest.TestCase):
def setUp(self):... | True) | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
denizsafak/abogen | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | train | train | tests/test_prepare_form.py | test_apply_prepare_form_updates_closing_outro_flag | assert | bool_literal | 52 | from pathlib import Path
from werkzeug.datastructures import MultiDict
from abogen.webui.routes.utils.form import apply_prepare_form
from abogen.webui.routes.utils.voice import resolve_voice_setting
from abogen.webui.service import PendingJob
def _make_pending_job() -> PendingJob:
return PendingJob(
id="... | False | ded73843c9e431f53cc215d6ae4f80d7cf3fe618 | 0 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_audio_signal.py | test_io | assert | numeric_literal | 61 | import pathlib
import tempfile
import librosa
import numpy as np
import pytest
import rich
import torch
import audiotools
from audiotools import AudioSignal
def test_io():
audio_path = "tests/audio/spk/f10_script4_produced.wav"
signal = AudioSignal(pathlib.Path(audio_path))
with tempfile.NamedTemporaryF... | 3 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_audio_signal.py | test_to_mono | assert | numeric_literal | 19 | import pathlib
import tempfile
import librosa
import numpy as np
import pytest
import rich
import torch
import audiotools
from audiotools import AudioSignal
def test_to_mono():
array = np.random.randn(4, 2, 16000)
sr = 16000
signal = AudioSignal(array, sample_rate=sr)
assert signal.num_channels == | 2 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_audio_signal.py | test_to_mono | assert | numeric_literal | 22 | import pathlib
import tempfile
import librosa
import numpy as np
import pytest
import rich
import torch
import audiotools
from audiotools import AudioSignal
def test_to_mono():
array = np.random.randn(4, 2, 16000)
sr = 16000
signal = AudioSignal(array, sample_rate=sr)
assert signal.num_channels == 2... | 1 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_audio_signal.py | test_io | assert | numeric_literal | 32 | import pathlib
import tempfile
import librosa
import numpy as np
import pytest
import rich
import torch
import audiotools
from audiotools import AudioSignal
def test_io():
audio_path = "tests/audio/spk/f10_script4_produced.wav"
signal = AudioSignal(pathlib.Path(audio_path))
with tempfile.NamedTemporaryF... | 5.0 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_audio_signal.py | test_zeros | assert | numeric_literal | 16 | import pathlib
import tempfile
import librosa
import numpy as np
import pytest
import rich
import torch
import audiotools
from audiotools import AudioSignal
def test_zeros():
x = AudioSignal.zeros(0.5, 44100)
assert x.signal_duration == | 0.5 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_audio_signal.py | test_truncate | assert | numeric_literal | 19 | import pathlib
import tempfile
import librosa
import numpy as np
import pytest
import rich
import torch
import audiotools
from audiotools import AudioSignal
def test_truncate():
array = np.random.randn(4, 2, 16000)
sig1 = AudioSignal(array, sample_rate=16000)
sig1.truncate_samples(100)
assert sig1.... | 100 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_audio_signal.py | test_equality | assert | variable | 19 | import pathlib
import tempfile
import librosa
import numpy as np
import pytest
import rich
import torch
import audiotools
from audiotools import AudioSignal
def test_equality():
array = np.random.randn(2, 16000)
sig1 = AudioSignal(array, sample_rate=16000)
sig2 = AudioSignal(array, sample_rate=16000)
... | sig2 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_audio_signal.py | test_equality | assert | variable | 24 | import pathlib
import tempfile
import librosa
import numpy as np
import pytest
import rich
import torch
import audiotools
from audiotools import AudioSignal
def test_equality():
array = np.random.randn(2, 16000)
sig1 = AudioSignal(array, sample_rate=16000)
sig2 = AudioSignal(array, sample_rate=16000)
... | sig3 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_audio_signal.py | test_zeros | assert | numeric_literal | 18 | import pathlib
import tempfile
import librosa
import numpy as np
import pytest
import rich
import torch
import audiotools
from audiotools import AudioSignal
def test_zeros():
x = AudioSignal.zeros(0.5, 44100)
assert x.signal_duration == 0.5
assert x.duration == 0.5
assert x.sample_rate == | 44100 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_audio_signal.py | test_zero_pad_to | assert | numeric_literal | 21 | import pathlib
import tempfile
import librosa
import numpy as np
import pytest
import rich
import torch
import audiotools
from audiotools import AudioSignal
def test_zero_pad_to():
array = np.random.randn(4, 2, 16000)
sig1 = AudioSignal(array, sample_rate=16000)
sig1.zero_pad_to(16100)
zeros = torch... | 16100 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_audio_signal.py | test_zero_pad_to | assert | numeric_literal | 25 | import pathlib
import tempfile
import librosa
import numpy as np
import pytest
import rich
import torch
import audiotools
from audiotools import AudioSignal
def test_zero_pad_to():
array = np.random.randn(4, 2, 16000)
sig1 = AudioSignal(array, sample_rate=16000)
sig1.zero_pad_to(16100)
zeros = torch... | 16000 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_audio_signal.py | test_copy_and_clone | assert | func_call | 30 | import pathlib
import tempfile
import librosa
import numpy as np
import pytest
import rich
import torch
import audiotools
from audiotools import AudioSignal
def test_copy_and_clone():
audio_path = "tests/audio/spk/f10_script4_produced.wav"
signal = AudioSignal(audio_path)
signal.stft()
signal.loudnes... | id(a2) | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_audio_signal.py | test_copy_and_clone | assert | func_call | 31 | import pathlib
import tempfile
import librosa
import numpy as np
import pytest
import rich
import torch
import audiotools
from audiotools import AudioSignal
def test_copy_and_clone():
audio_path = "tests/audio/spk/f10_script4_produced.wav"
signal = AudioSignal(audio_path)
signal.stft()
signal.loudnes... | id(a3) | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_audio_signal.py | test_copy_and_clone | assert | func_call | 32 | import pathlib
import tempfile
import librosa
import numpy as np
import pytest
import rich
import torch
import audiotools
from audiotools import AudioSignal
def test_copy_and_clone():
audio_path = "tests/audio/spk/f10_script4_produced.wav"
signal = AudioSignal(audio_path)
signal.stft()
signal.loudnes... | id(a4) | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_dsp.py | test_corrupt_phase | assert | numeric_literal | 20 | import numpy as np
import pytest
import torch
from audiotools import AudioSignal
from audiotools.core.util import sample_from_dist
def test_corrupt_phase():
sample_rate = 44100
f = 440
t = torch.linspace(0, 1, sample_rate)
sine_wave = torch.sin(2 * np.pi * f * t)
sine_wave = AudioSignal(sine_wave,... | 0.0 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_dsp.py | test_corrupt_phase | assert | numeric_literal | 21 | import numpy as np
import pytest
import torch
from audiotools import AudioSignal
from audiotools.core.util import sample_from_dist
def test_corrupt_phase():
sample_rate = 44100
f = 440
t = torch.linspace(0, 1, sample_rate)
sine_wave = torch.sin(2 * np.pi * f * t)
sine_wave = AudioSignal(sine_wave,... | 1.0 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_dsp.py | test_low_pass | assert | numeric_literal | 18 | import numpy as np
import pytest
import torch
from audiotools import AudioSignal
from audiotools.core.util import sample_from_dist
def test_low_pass():
sample_rate = 44100
f = 440
t = torch.arange(0, 1, 1 / sample_rate)
sine_wave = torch.sin(2 * np.pi * f * t)
window = AudioSignal.get_window("hann... | 1e-4 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_dsp.py | test_low_pass | assert | numeric_literal | 21 | import numpy as np
import pytest
import torch
from audiotools import AudioSignal
from audiotools.core.util import sample_from_dist
def test_low_pass():
sample_rate = 44100
f = 440
t = torch.arange(0, 1, 1 / sample_rate)
sine_wave = torch.sin(2 * np.pi * f * t)
window = AudioSignal.get_window("hann... | 1e-3 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_dsp.py | _test | assert | variable | 16 | import numpy as np
import pytest
import torch
from audiotools import AudioSignal
from audiotools.core.util import sample_from_dist
def _test(signal):
hop_duration = window_duration / 2
windowed_signal = signal.deepcopy().collect_windows(
window_duration, hop_duration
... | signal | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_effects.py | test_clip_distortion | assert | numeric_literal | 23 | import numpy as np
import pytest
import torch
import torchaudio
from audiotools import AudioSignal
def test_clip_distortion():
audio_path = "tests/audio/spk/f10_script4_produced.wav"
spk = AudioSignal(audio_path, offset=10, duration=2)
clipped = spk.deepcopy().clip_distortion(0.05)
spk_batch = AudioS... | 1.0 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_effects.py | test_quantization | assert | variable | 33 | import numpy as np
import pytest
import torch
import torchaudio
from audiotools import AudioSignal
@pytest.mark.parametrize("quant_ch", [2, 4, 8, 16, 32, 64, 128])
def test_quantization(quant_ch):
audio_path = "tests/audio/spk/f10_script4_produced.wav"
spk = AudioSignal(audio_path, offset=10, duration=2)
... | q_ch | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_effects.py | test_quantization | assert | variable | 19 | import numpy as np
import pytest
import torch
import torchaudio
from audiotools import AudioSignal
@pytest.mark.parametrize("quant_ch", [2, 4, 8, 16, 32, 64, 128])
def test_quantization(quant_ch):
audio_path = "tests/audio/spk/f10_script4_produced.wav"
spk = AudioSignal(audio_path, offset=10, duration=2)
... | quant_ch | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_effects.py | test_convolve | assert | variable | 26 | import numpy as np
import pytest
import torch
import torchaudio
from audiotools import AudioSignal
def test_convolve():
np.random.seed(6) # Found a failing seed
audio_path = "tests/audio/spk/f10_script4_produced.wav"
spk = AudioSignal(audio_path, offset=10, duration=10)
impulse = np.zeros((1, 16000)... | spk_batch | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_effects.py | test_ensure_max_of_audio | assert | complex_expr | 15 | import numpy as np
import pytest
import torch
import torchaudio
from audiotools import AudioSignal
def test_ensure_max_of_audio():
spk = AudioSignal(torch.randn(1, 1, 44100), 44100)
max_vals = [1.0] + [np.random.rand() for _ in range(10)]
for val in max_vals:
after = spk.deepcopy().ensure_max_of_... | val + 1e-3 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_effects.py | test_codec | pytest.raises | variable | 16 | import numpy as np
import pytest
import torch
import torchaudio
from audiotools import AudioSignal
def test_codec():
torchaudio_version_070 = "0.7" in torchaudio.__version__
if torchaudio_version_070:
return
audio_path = "tests/audio/spk/f10_script4_produced.wav"
spk = AudioSignal(audio_path, ... | ValueError) | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_effects.py | test_impulse_response_augmentation | assert | complex_expr | 17 | import numpy as np
import pytest
import torch
import torchaudio
from audiotools import AudioSignal
def test_impulse_response_augmentation():
audio_path = "tests/audio/ir/h179_Bar_1txts.wav"
batch_size = 16
ir = AudioSignal(audio_path)
ir_batch = AudioSignal.batch([ir for _ in range(batch_size)])
e... | window.shape | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_effects.py | test_impulse_response_augmentation | assert | complex_expr | 16 | import numpy as np
import pytest
import torch
import torchaudio
from audiotools import AudioSignal
def test_impulse_response_augmentation():
audio_path = "tests/audio/ir/h179_Bar_1txts.wav"
batch_size = 16
ir = AudioSignal(audio_path)
ir_batch = AudioSignal.batch([ir for _ in range(batch_size)])
e... | late_field.shape | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_ffmpeg.py | test_ffmpeg_audio_offset | assert | numeric_literal | 65 | import shlex
import subprocess
import tempfile
from pathlib import Path
import numpy as np
import pyloudnorm
import pytest
import torch
from audiotools import AudioSignal
def test_ffmpeg_audio_offset():
with tempfile.TemporaryDirectory() as d:
video_path = Path(d) / "test.mp4"
audio_path = Path(d... | 50 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_ffmpeg.py | test_ffmpeg_resample | assert | variable | 22 | import shlex
import subprocess
import tempfile
from pathlib import Path
import numpy as np
import pyloudnorm
import pytest
import torch
from audiotools import AudioSignal
@pytest.mark.parametrize("sample_rate", [8000, 16000, 22050, 44100, 48000])
def test_ffmpeg_resample(sample_rate):
array = np.random.randn(4, ... | sample_rate | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_ffmpeg.py | test_ffmpeg_load | assert | complex_expr | 23 | import shlex
import subprocess
import tempfile
from pathlib import Path
import numpy as np
import pyloudnorm
import pytest
import torch
from audiotools import AudioSignal
def test_ffmpeg_load():
audio_path = "tests/audio/spk/f10_script4_produced.wav"
# convert to mp3 with ffmpeg
og_signal = AudioSignal(a... | signal_from_ffmpeg.signal_length | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_grad.py | test_batch_grad | assert | none_literal | 18 | from typing import Callable
import numpy as np
import pytest
import torch
import torchaudio
from audiotools import AudioSignal
def test_batch_grad():
audio_path = "tests/audio/spk/f10_script4_produced.wav"
signal = AudioSignal(audio_path)
signal.audio_data.requires_grad = True
assert signal.audio... | None | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_util.py | test_hz_to_bin | assert | numeric_literal | 20 | import os
import random
import tempfile
import numpy as np
import pytest
import torch
from audiotools import util
from audiotools.core.audio_signal import AudioSignal
def test_hz_to_bin():
hz = torch.from_numpy(np.array([100, 200, 300]))
sr = 1000
n_fft = 2048
bins = util.hz_to_bin(hz, n_fft, sr)
... | 1 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_util.py | test_sample_dist | assert | variable | 17 | import os
import random
import tempfile
import numpy as np
import pytest
import torch
from audiotools import util
from audiotools.core.audio_signal import AudioSignal
def test_sample_dist():
state = util.random_state(0)
v1 = state.uniform(0.0, 1.0)
v2 = util.sample_from_dist(("uniform", 0.0, 1.0), 0)
... | v2 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_util.py | test_sample_dist | assert | numeric_literal | 19 | import os
import random
import tempfile
import numpy as np
import pytest
import torch
from audiotools import util
from audiotools.core.audio_signal import AudioSignal
def test_sample_dist():
state = util.random_state(0)
v1 = state.uniform(0.0, 1.0)
v2 = util.sample_from_dist(("uniform", 0.0, 1.0), 0)
... | 1.0 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_util.py | test_find_audio | assert | func_call | 16 | import os
import random
import tempfile
import numpy as np
import pytest
import torch
from audiotools import util
from audiotools.core.audio_signal import AudioSignal
def test_find_audio():
audio_files = util.find_audio("tests/", ["wav"])
for a in audio_files:
assert "wav" in | str(a) | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_util.py | test_check_random_state | assert | variable | 17 | import os
import random
import tempfile
import numpy as np
import pytest
import torch
from audiotools import util
from audiotools.core.audio_signal import AudioSignal
def test_check_random_state():
# seed is None
rng_type = type(np.random.RandomState(10))
rng = util.random_state(None)
assert type(rn... | rng_type | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_util.py | test_collate | assert | variable | 29 | import os
import random
import tempfile
import numpy as np
import pytest
import torch
from audiotools import util
from audiotools.core.audio_signal import AudioSignal
def test_collate():
batch_size = 16
def _one_item():
return {
"signal": AudioSignal(torch.randn(1, 1, 44100), 44100),
... | batch_size | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_util.py | test_check_random_state | pytest.raises | variable | 29 | import os
import random
import tempfile
import numpy as np
import pytest
import torch
from audiotools import util
from audiotools.core.audio_signal import AudioSignal
def test_check_random_state():
# seed is None
rng_type = type(np.random.RandomState(10))
rng = util.random_state(None)
assert type(rng... | ValueError) | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_util.py | test_seed | assert | variable | 25 | import os
import random
import tempfile
import numpy as np
import pytest
import torch
from audiotools import util
from audiotools.core.audio_signal import AudioSignal
def test_seed():
util.seed(0)
torch_result_a = torch.randn(1)
np_result_a = np.random.randn(1)
py_result_a = random.random()
util... | np_result_b | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_util.py | test_seed | assert | variable | 26 | import os
import random
import tempfile
import numpy as np
import pytest
import torch
from audiotools import util
from audiotools.core.audio_signal import AudioSignal
def test_seed():
util.seed(0)
torch_result_a = torch.randn(1)
np_result_a = np.random.randn(1)
py_result_a = random.random()
util... | py_result_b | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_util.py | test_sample_dist | assert | collection | 22 | import os
import random
import tempfile
import numpy as np
import pytest
import torch
from audiotools import util
from audiotools.core.audio_signal import AudioSignal
def test_sample_dist():
state = util.random_state(0)
v1 = state.uniform(0.0, 1.0)
v2 = util.sample_from_dist(("uniform", 0.0, 1.0), 0)
... | [8, 16, 32] | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/core/test_util.py | test_seed | assert | variable | 24 | import os
import random
import tempfile
import numpy as np
import pytest
import torch
from audiotools import util
from audiotools.core.audio_signal import AudioSignal
def test_seed():
util.seed(0)
torch_result_a = torch.randn(1)
np_result_a = np.random.randn(1)
py_result_a = random.random()
util... | torch_result_b | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/data/test_datasets.py | test_static_shared_args | assert | numeric_literal | 58 | import numpy as np
import torch
import audiotools
from audiotools import AudioSignal
from audiotools import data
from audiotools.data import transforms as tfm
def test_static_shared_args():
dataset = audiotools.data.datasets.CSVDataset(
44100,
n_examples=100,
csv_files=["tests/audio/spk.cs... | 2 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/data/test_transforms.py | test_compose_basic | assert | numeric_literal | 48 | from pathlib import Path
import numpy as np
import pytest
import torch
import audiotools
from audiotools import AudioSignal
from audiotools import util
from audiotools.data import transforms as tfm
from audiotools.data.datasets import CSVDataset
non_deterministic_transforms = ["TimeNoise", "FrequencyNoise"]
transfor... | 2 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/data/test_transforms.py | test_transform | assert | variable | 71 | from pathlib import Path
import numpy as np
import pytest
import torch
import audiotools
from audiotools import AudioSignal
from audiotools import util
from audiotools.data import transforms as tfm
from audiotools.data.datasets import CSVDataset
non_deterministic_transforms = ["TimeNoise", "FrequencyNoise"]
transfor... | output | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/data/test_transforms.py | test_repeat | assert | complex_expr | 67 | from pathlib import Path
import numpy as np
import pytest
import torch
import audiotools
from audiotools import AudioSignal
from audiotools import util
from audiotools.data import transforms as tfm
from audiotools.data.datasets import CSVDataset
non_deterministic_transforms = ["TimeNoise", "FrequencyNoise"]
transfor... | 0.5**3 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/data/test_transforms.py | test_choose_basic | assert | variable | 70 | from pathlib import Path
import numpy as np
import pytest
import torch
import audiotools
from audiotools import AudioSignal
from audiotools import util
from audiotools.data import transforms as tfm
from audiotools.data.datasets import CSVDataset
non_deterministic_transforms = ["TimeNoise", "FrequencyNoise"]
transfor... | targets | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/data/test_transforms.py | test_transform | assert | variable | 80 | from pathlib import Path
import numpy as np
import pytest
import torch
import audiotools
from audiotools import AudioSignal
from audiotools import util
from audiotools.data import transforms as tfm
from audiotools.data.datasets import CSVDataset
non_deterministic_transforms = ["TimeNoise", "FrequencyNoise"]
transfor... | output_b | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/data/test_transforms.py | test_choose_weighted | assert | complex_expr | 53 | from pathlib import Path
import numpy as np
import pytest
import torch
import audiotools
from audiotools import AudioSignal
from audiotools import util
from audiotools.data import transforms as tfm
from audiotools.data.datasets import CSVDataset
non_deterministic_transforms = ["TimeNoise", "FrequencyNoise"]
transfor... | targets[1] | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/data/test_transforms.py | test_transform | assert | complex_expr | 50 | from pathlib import Path
import numpy as np
import pytest
import torch
import audiotools
from audiotools import AudioSignal
from audiotools import util
from audiotools.data import transforms as tfm
from audiotools.data.datasets import CSVDataset
non_deterministic_transforms = ["TimeNoise", "FrequencyNoise"]
transfor... | transform.keys | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/metrics/test_distance.py | test_sisdr | assert | variable | 35 | import numpy as np
import pytest
from numpy.core.fromnumeric import clip
from audiotools import AudioSignal
from audiotools import metrics
@pytest.mark.parametrize("scaling", [False, True])
@pytest.mark.parametrize("reduction", ["mean", "sum"])
@pytest.mark.parametrize("clip_min", [None, -30])
@pytest.mark.parametriz... | loss_val_identity | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/metrics/test_quality.py | test_pesq | assert | numeric_literal | 21 | import numpy as np
import pytest
import torch
import torchaudio
import audiotools
from audiotools import AudioSignal
from audiotools import metrics
from audiotools.core import audio_signal
def test_pesq():
audio_path = "tests/audio/spk/f10_script4_produced.wav"
x = AudioSignal.excerpt(audio_path, duration=1,... | 3.0 | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
descriptinc/audiotools | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | train | train | tests/metrics/test_quality.py | test_stoi | assert | variable | 32 | import numpy as np
import pytest
import torch
import torchaudio
import audiotools
from audiotools import AudioSignal
from audiotools import metrics
from audiotools.core import audio_signal
def test_stoi():
audio_path = "tests/audio/spk/f10_script4_produced.wav"
x = AudioSignal.excerpt(audio_path, duration=1,... | old_stoi | b1b0f4063feba878982b1ee1b2f4180e8c282d4c | 58 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.