audformat 1.4.2__tar.gz → 1.4.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {audformat-1.4.2 → audformat-1.4.4}/.github/workflows/doc.yml +6 -4
- {audformat-1.4.2 → audformat-1.4.4}/.github/workflows/linter.yml +5 -3
- {audformat-1.4.2 → audformat-1.4.4}/.github/workflows/publish.yml +6 -4
- {audformat-1.4.2 → audformat-1.4.4}/.github/workflows/test.yml +14 -10
- {audformat-1.4.2 → audformat-1.4.4}/.pre-commit-config.yaml +0 -2
- {audformat-1.4.2 → audformat-1.4.4}/CHANGELOG.rst +20 -0
- {audformat-1.4.2 → audformat-1.4.4}/PKG-INFO +3 -3
- audformat-1.4.4/audformat/core/conftest.py +61 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/database.py +2 -2
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/table.py +26 -9
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/utils.py +2 -2
- {audformat-1.4.2 → audformat-1.4.4}/audformat.egg-info/PKG-INFO +3 -3
- {audformat-1.4.2 → audformat-1.4.4}/audformat.egg-info/SOURCES.txt +2 -0
- audformat-1.4.4/audformat.egg-info/scm_file_list.json +86 -0
- audformat-1.4.4/audformat.egg-info/scm_version.json +8 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/combine-tables.rst +3 -3
- {audformat-1.4.2 → audformat-1.4.4}/docs/conf.py +3 -3
- {audformat-1.4.2 → audformat-1.4.4}/docs/conftest.py +9 -5
- {audformat-1.4.2 → audformat-1.4.4}/pyproject.toml +9 -3
- {audformat-1.4.2 → audformat-1.4.4}/tests/conftest.py +2 -7
- {audformat-1.4.2 → audformat-1.4.4}/tests/test_common.py +23 -0
- {audformat-1.4.2 → audformat-1.4.4}/tests/test_database.py +18 -0
- {audformat-1.4.2 → audformat-1.4.4}/tests/test_eq.py +1 -1
- {audformat-1.4.2 → audformat-1.4.4}/tests/test_misc_table.py +6 -0
- {audformat-1.4.2 → audformat-1.4.4}/tests/test_table.py +34 -1
- audformat-1.4.2/audformat/core/conftest.py +0 -40
- {audformat-1.4.2 → audformat-1.4.4}/.gitignore +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/CONTRIBUTING.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/LICENSE +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/README.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/__init__.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/__init__.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/attachment.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/column.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/common.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/define.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/errors.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/index.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/media.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/rater.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/scheme.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/split.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/testing.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/core/typing.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/define/__init__.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/errors/__init__.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/testing/__init__.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat/utils/__init__.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat.egg-info/dependency_links.txt +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat.egg-info/requires.txt +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/audformat.egg-info/top_level.txt +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/benchmarks/benchmark_hash.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/benchmarks/benchmark_union.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/accessing-data.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/api/audformat.define.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/api/audformat.errors.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/api/audformat.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/api/audformat.testing.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/api/audformat.utils.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/api-src/audformat.define.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/api-src/audformat.errors.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/api-src/audformat.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/api-src/audformat.testing.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/api-src/audformat.utils.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/changelog.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/contributing.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/create-database.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/data-conventions.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/data-example.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/data-format.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/data-header.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/data-introduction.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/data-misc-tables.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/data-tables.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/emodb-example.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/genindex.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/index.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/install.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/map-scheme.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/pics/audformat-database.dot +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/pics/audformat-misc-table.dot +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/pics/audformat-table.dot +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/docs/update-database.rst +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/setup.cfg +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/tests/test_attachment.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/tests/test_column.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/tests/test_database_get.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/tests/test_errors.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/tests/test_index.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/tests/test_scheme.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/tests/test_utils.py +0 -0
- {audformat-1.4.2 → audformat-1.4.4}/tests/test_utils_concat.py +0 -0
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
python-version: [ '3.12' ]
|
|
17
17
|
|
|
18
18
|
steps:
|
|
19
|
-
- uses: actions/checkout@
|
|
19
|
+
- uses: actions/checkout@v7
|
|
20
20
|
with:
|
|
21
21
|
# Ensure audformat is assigned a version,
|
|
22
22
|
# so we can install audb as a dependency
|
|
@@ -25,18 +25,20 @@ jobs:
|
|
|
25
25
|
fetch-tags: true
|
|
26
26
|
|
|
27
27
|
- name: Cache emodb
|
|
28
|
-
uses: actions/cache@
|
|
28
|
+
uses: actions/cache@v6
|
|
29
29
|
with:
|
|
30
30
|
path: emodb-src
|
|
31
31
|
key: emodb-src
|
|
32
32
|
|
|
33
33
|
- name: Set up Python ${{ matrix.python-version }}
|
|
34
|
-
uses: actions/setup-python@
|
|
34
|
+
uses: actions/setup-python@v7
|
|
35
35
|
with:
|
|
36
36
|
python-version: ${{ matrix.python-version }}
|
|
37
37
|
|
|
38
38
|
- name: Install uv
|
|
39
|
-
uses: astral-sh/setup-uv@
|
|
39
|
+
uses: astral-sh/setup-uv@v9.0.0
|
|
40
|
+
with:
|
|
41
|
+
save-cache: false
|
|
40
42
|
|
|
41
43
|
- name: Ubuntu - install graphviz
|
|
42
44
|
run: |
|
|
@@ -12,15 +12,17 @@ jobs:
|
|
|
12
12
|
runs-on: ubuntu-latest
|
|
13
13
|
|
|
14
14
|
steps:
|
|
15
|
-
- uses: actions/checkout@
|
|
15
|
+
- uses: actions/checkout@v7
|
|
16
16
|
|
|
17
17
|
- name: Set up Python
|
|
18
|
-
uses: actions/setup-python@
|
|
18
|
+
uses: actions/setup-python@v7
|
|
19
19
|
with:
|
|
20
20
|
python-version: '3.12'
|
|
21
21
|
|
|
22
22
|
- name: Install uv
|
|
23
|
-
uses: astral-sh/setup-uv@
|
|
23
|
+
uses: astral-sh/setup-uv@v9.0.0
|
|
24
|
+
with:
|
|
25
|
+
save-cache: false
|
|
24
26
|
|
|
25
27
|
- name: Install pre-commit hooks
|
|
26
28
|
run: uvx pre-commit install --install-hooks
|
|
@@ -16,23 +16,25 @@ jobs:
|
|
|
16
16
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
17
17
|
|
|
18
18
|
steps:
|
|
19
|
-
- uses: actions/checkout@
|
|
19
|
+
- uses: actions/checkout@v7
|
|
20
20
|
with:
|
|
21
21
|
fetch-depth: 2
|
|
22
22
|
|
|
23
23
|
- name: Cache emodb
|
|
24
|
-
uses: actions/cache@
|
|
24
|
+
uses: actions/cache@v6
|
|
25
25
|
with:
|
|
26
26
|
path: emodb-src
|
|
27
27
|
key: emodb-src
|
|
28
28
|
|
|
29
29
|
- name: Set up Python
|
|
30
|
-
uses: actions/setup-python@
|
|
30
|
+
uses: actions/setup-python@v7
|
|
31
31
|
with:
|
|
32
32
|
python-version: '3.12'
|
|
33
33
|
|
|
34
34
|
- name: Install uv
|
|
35
|
-
uses: astral-sh/setup-uv@
|
|
35
|
+
uses: astral-sh/setup-uv@v9.0.0
|
|
36
|
+
with:
|
|
37
|
+
save-cache: false
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
# PyPI package
|
|
@@ -15,8 +15,6 @@ jobs:
|
|
|
15
15
|
os: [ ubuntu-latest, windows-latest, macOS-latest ]
|
|
16
16
|
python-version: [ '3.12' ]
|
|
17
17
|
include:
|
|
18
|
-
- os: ubuntu-latest
|
|
19
|
-
python-version: '3.10'
|
|
20
18
|
- os: ubuntu-latest
|
|
21
19
|
python-version: '3.11'
|
|
22
20
|
- os: ubuntu-latest
|
|
@@ -24,11 +22,13 @@ jobs:
|
|
|
24
22
|
- os: ubuntu-latest
|
|
25
23
|
python-version: '3.14'
|
|
26
24
|
- os: ubuntu-latest
|
|
27
|
-
python-version: '3.
|
|
25
|
+
python-version: '3.15'
|
|
26
|
+
- os: ubuntu-latest
|
|
27
|
+
python-version: '3.11'
|
|
28
28
|
requirements: 'minimum'
|
|
29
29
|
|
|
30
30
|
steps:
|
|
31
|
-
- uses: actions/checkout@
|
|
31
|
+
- uses: actions/checkout@v7
|
|
32
32
|
with:
|
|
33
33
|
# Ensure audformat is assigned a version,
|
|
34
34
|
# so we can install audb as a dependency
|
|
@@ -37,18 +37,22 @@ jobs:
|
|
|
37
37
|
fetch-tags: true
|
|
38
38
|
|
|
39
39
|
- name: Cache emodb
|
|
40
|
-
uses: actions/cache@
|
|
40
|
+
uses: actions/cache@v6
|
|
41
41
|
with:
|
|
42
42
|
path: emodb-src
|
|
43
43
|
key: emodb-src
|
|
44
44
|
|
|
45
45
|
- name: Set up Python ${{ matrix.python-version }}
|
|
46
|
-
uses: actions/setup-python@
|
|
46
|
+
uses: actions/setup-python@v7
|
|
47
47
|
with:
|
|
48
48
|
python-version: ${{ matrix.python-version }}
|
|
49
|
+
allow-prereleases: true
|
|
50
|
+
check-latest: true
|
|
49
51
|
|
|
50
52
|
- name: Install uv
|
|
51
|
-
uses: astral-sh/setup-uv@
|
|
53
|
+
uses: astral-sh/setup-uv@v9.0.0
|
|
54
|
+
with:
|
|
55
|
+
save-cache: ${{ matrix.requirements != 'minimum' }}
|
|
52
56
|
|
|
53
57
|
- name: Prepare Ubuntu
|
|
54
58
|
run: |
|
|
@@ -79,8 +83,8 @@ jobs:
|
|
|
79
83
|
run: uv run pytest
|
|
80
84
|
|
|
81
85
|
- name: Upload coverage to Codecov
|
|
82
|
-
uses: codecov/codecov-action@
|
|
86
|
+
uses: codecov/codecov-action@v7
|
|
83
87
|
with:
|
|
84
88
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
85
|
-
|
|
86
|
-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.
|
|
89
|
+
files: ./coverage.xml
|
|
90
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
|
|
@@ -7,6 +7,26 @@ The format is based on `Keep a Changelog`_,
|
|
|
7
7
|
and this project adheres to `Semantic Versioning`_.
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
Version 1.4.4 (2026-12-01)
|
|
11
|
+
--------------------------
|
|
12
|
+
|
|
13
|
+
* Changed: dataframe updates by
|
|
14
|
+
``audformat.Table.drop_columns(inplace=True)``
|
|
15
|
+
and ``audformat.Table.drop_files(inplace=True)``
|
|
16
|
+
do not affect a dataframe requested before with ``audformat.Table.df``
|
|
17
|
+
* Fixed: avoid deprecation warning with ``pandas>=3.1``
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
Version 1.4.3 (2026-10-09)
|
|
21
|
+
--------------------------
|
|
22
|
+
|
|
23
|
+
* Added: support for Python 3.15
|
|
24
|
+
* Changed: load and save header YAML files always with UTF-8
|
|
25
|
+
* Removed: support for Python 3.10
|
|
26
|
+
* Fixed: ensure correct index dtype for ``file`` column
|
|
27
|
+
when creating a table in pandas 3.x
|
|
28
|
+
|
|
29
|
+
|
|
10
30
|
Version 1.4.2 (2026-05-12)
|
|
11
31
|
--------------------------
|
|
12
32
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: audformat
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.4
|
|
4
4
|
Summary: Python implementation of audformat
|
|
5
5
|
Author: Johannes Wagner, BahaEddine Abrougui
|
|
6
6
|
Author-email: Hagen Wierstorf <hwierstorf@audeering.com>, Christian Geng <cgeng@audeering.com>
|
|
@@ -14,13 +14,13 @@ Classifier: Intended Audience :: Developers
|
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
15
15
|
Classifier: Programming Language :: Python
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
22
22
|
Classifier: Topic :: Scientific/Engineering
|
|
23
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
24
|
Description-Content-Type: text/x-rst
|
|
25
25
|
License-File: LICENSE
|
|
26
26
|
Requires-Dist: audeer>=2.0.0
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import contextlib
|
|
2
|
+
from doctest import ELLIPSIS
|
|
3
|
+
from doctest import NORMALIZE_WHITESPACE
|
|
4
|
+
import tempfile
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
import pandas as pd
|
|
8
|
+
import pytest
|
|
9
|
+
import sybil
|
|
10
|
+
from sybil.parsers.rest import DocTestParser
|
|
11
|
+
from sybil.parsers.rest import SkipParser
|
|
12
|
+
|
|
13
|
+
import audeer
|
|
14
|
+
import audiofile
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@pytest.fixture(scope="module", autouse=True)
|
|
18
|
+
def pandas_display():
|
|
19
|
+
r"""Show dataframes independent of the terminal.
|
|
20
|
+
|
|
21
|
+
By default,
|
|
22
|
+
pandas adjusts the number of displayed columns
|
|
23
|
+
to the width of the terminal.
|
|
24
|
+
Instead, show a fixed number of columns
|
|
25
|
+
and never wrap them.
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
with pd.option_context("display.max_columns", 5, "display.width", 1000):
|
|
29
|
+
yield
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@pytest.fixture(scope="package", autouse=True)
|
|
33
|
+
def prepare_docstring_tests(doctest_namespace):
|
|
34
|
+
# Prepare files and tmp folder needed in doctests
|
|
35
|
+
with tempfile.TemporaryDirectory() as tmp, contextlib.chdir(tmp):
|
|
36
|
+
doctest_namespace["tmp"] = tmp
|
|
37
|
+
|
|
38
|
+
# audformat.utils.to_filewise_index()
|
|
39
|
+
audiofile.write("f.wav", np.ones((1, 8000)), 8000)
|
|
40
|
+
|
|
41
|
+
yield
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# Doctests show dataframes as displayed by ``pandas>=3.1``,
|
|
45
|
+
# which uses the same number of decimal places
|
|
46
|
+
# for all timedelta values of an index level or column.
|
|
47
|
+
# Older versions of pandas drop trailing zeros,
|
|
48
|
+
# and would fail the doctests
|
|
49
|
+
DOCTESTS_SUPPORTED = audeer.LooseVersion(pd.__version__) >= audeer.LooseVersion("3.1")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
parsers = [
|
|
53
|
+
DocTestParser(optionflags=ELLIPSIS + NORMALIZE_WHITESPACE),
|
|
54
|
+
SkipParser(),
|
|
55
|
+
]
|
|
56
|
+
if DOCTESTS_SUPPORTED:
|
|
57
|
+
pytest_collect_file = sybil.Sybil(
|
|
58
|
+
parsers=parsers,
|
|
59
|
+
pattern="*.py",
|
|
60
|
+
fixtures=["pandas_display", "prepare_docstring_tests"],
|
|
61
|
+
).pytest()
|
|
@@ -1024,7 +1024,7 @@ class Database(HeaderBase):
|
|
|
1024
1024
|
|
|
1025
1025
|
ext = ".yaml"
|
|
1026
1026
|
header_path = os.path.join(root, name + ext)
|
|
1027
|
-
with open(header_path, "w") as fp:
|
|
1027
|
+
with open(header_path, "w", encoding="utf-8") as fp:
|
|
1028
1028
|
self.dump(fp, indent=indent)
|
|
1029
1029
|
|
|
1030
1030
|
if not header_only:
|
|
@@ -1437,7 +1437,7 @@ class Database(HeaderBase):
|
|
|
1437
1437
|
if not os.path.exists(path):
|
|
1438
1438
|
raise FileNotFoundError(path)
|
|
1439
1439
|
|
|
1440
|
-
with open(path) as fp:
|
|
1440
|
+
with open(path, encoding="utf-8") as fp:
|
|
1441
1441
|
header = yaml.load(fp, Loader=Loader)
|
|
1442
1442
|
db = Database.load_header_from_yaml(header)
|
|
1443
1443
|
|
|
@@ -37,6 +37,14 @@ _KEY_VERSION = "audformat-version"
|
|
|
37
37
|
_KEY_DATAFRAME = "df"
|
|
38
38
|
_KEY_HASH = "hash"
|
|
39
39
|
|
|
40
|
+
# ``pandas>=3.1`` always parses floats in CSV files with full precision
|
|
41
|
+
# and deprecated the ``float_precision`` argument of ``pandas.read_csv()``
|
|
42
|
+
CSV_FLOAT_PRECISION = (
|
|
43
|
+
None
|
|
44
|
+
if audeer.LooseVersion(pd.__version__) >= audeer.LooseVersion("3.1")
|
|
45
|
+
else "round_trip"
|
|
46
|
+
)
|
|
47
|
+
|
|
40
48
|
|
|
41
49
|
class Base(HeaderBase):
|
|
42
50
|
r"""Table base class."""
|
|
@@ -291,7 +299,7 @@ class Base(HeaderBase):
|
|
|
291
299
|
column_ids_ = set()
|
|
292
300
|
for column_id in column_ids:
|
|
293
301
|
column_ids_.add(column_id)
|
|
294
|
-
self.df.drop(column_ids_,
|
|
302
|
+
self._df = self.df.drop(column_ids_, axis="columns")
|
|
295
303
|
for column_id in column_ids_:
|
|
296
304
|
self.columns.pop(column_id)
|
|
297
305
|
|
|
@@ -444,7 +452,7 @@ class Base(HeaderBase):
|
|
|
444
452
|
map=mapped_column,
|
|
445
453
|
)
|
|
446
454
|
if column not in mapped_columns:
|
|
447
|
-
result.drop(columns=column
|
|
455
|
+
result = result.drop(columns=column)
|
|
448
456
|
|
|
449
457
|
return result.copy() if (copy and not result_is_copy) else result
|
|
450
458
|
|
|
@@ -945,7 +953,7 @@ class Base(HeaderBase):
|
|
|
945
953
|
dtype=dtypes_wo_converters,
|
|
946
954
|
index_col=levels,
|
|
947
955
|
converters=converters,
|
|
948
|
-
float_precision=
|
|
956
|
+
float_precision=CSV_FLOAT_PRECISION,
|
|
949
957
|
)
|
|
950
958
|
|
|
951
959
|
self._df = df
|
|
@@ -1301,8 +1309,6 @@ class Base(HeaderBase):
|
|
|
1301
1309
|
def _set_index(self, df: pd.DataFrame, columns: Sequence) -> pd.DataFrame:
|
|
1302
1310
|
r"""Set columns as index.
|
|
1303
1311
|
|
|
1304
|
-
Setting of index columns is performed inplace!
|
|
1305
|
-
|
|
1306
1312
|
Args:
|
|
1307
1313
|
df: dataframe
|
|
1308
1314
|
columns: columns to be set as index of dataframe
|
|
@@ -1318,7 +1324,7 @@ class Base(HeaderBase):
|
|
|
1318
1324
|
#
|
|
1319
1325
|
if len(columns) > 1:
|
|
1320
1326
|
dtypes = {column: df[column].dtype for column in columns}
|
|
1321
|
-
df.set_index(columns
|
|
1327
|
+
df = df.set_index(columns)
|
|
1322
1328
|
if len(columns) > 1:
|
|
1323
1329
|
df.index = utils.set_index_dtypes(df.index, dtypes)
|
|
1324
1330
|
return df
|
|
@@ -1730,7 +1736,7 @@ class Table(Base):
|
|
|
1730
1736
|
level = "file"
|
|
1731
1737
|
else:
|
|
1732
1738
|
level = None
|
|
1733
|
-
self.df.drop(index,
|
|
1739
|
+
self._df = self.df.drop(index, level=level)
|
|
1734
1740
|
|
|
1735
1741
|
return self
|
|
1736
1742
|
|
|
@@ -1966,12 +1972,23 @@ def _assert_table_index(
|
|
|
1966
1972
|
)
|
|
1967
1973
|
|
|
1968
1974
|
|
|
1975
|
+
def _is_correct_string_dtype(dtype) -> bool:
|
|
1976
|
+
r"""Return whether the dtype matches the desired string dtype."""
|
|
1977
|
+
if dtype == "string":
|
|
1978
|
+
na_value = getattr(dtype, "na_value", None)
|
|
1979
|
+
# If pd.StringDtype has the na_value attribute (pandas 3.x)
|
|
1980
|
+
# it must be set to pd.NA
|
|
1981
|
+
return na_value is None or na_value is pd.NA
|
|
1982
|
+
return False
|
|
1983
|
+
|
|
1984
|
+
|
|
1969
1985
|
def _maybe_convert_dtype_to_string(
|
|
1970
1986
|
index: pd.Index,
|
|
1971
1987
|
) -> pd.Index:
|
|
1972
1988
|
r"""Possibly set dtype of file level to 'string'."""
|
|
1973
|
-
if (is_filewise_index(index) and index.dtype
|
|
1974
|
-
is_segmented_index(index)
|
|
1989
|
+
if (is_filewise_index(index) and not _is_correct_string_dtype(index.dtype)) or (
|
|
1990
|
+
is_segmented_index(index)
|
|
1991
|
+
and not _is_correct_string_dtype(index.dtypes[define.IndexField.FILE])
|
|
1975
1992
|
):
|
|
1976
1993
|
index = utils.set_index_dtypes(
|
|
1977
1994
|
index,
|
|
@@ -343,7 +343,7 @@ def concat(
|
|
|
343
343
|
"right": column[intersection],
|
|
344
344
|
}
|
|
345
345
|
)
|
|
346
|
-
combine.dropna(
|
|
346
|
+
combine = combine.dropna()
|
|
347
347
|
differ = combine["left"] != combine["right"]
|
|
348
348
|
|
|
349
349
|
if np.any(differ):
|
|
@@ -1486,7 +1486,7 @@ def read_csv(
|
|
|
1486
1486
|
index = filewise_index(files)
|
|
1487
1487
|
else:
|
|
1488
1488
|
index = segmented_index(files, starts=starts, ends=ends)
|
|
1489
|
-
frame.drop(drop, axis="columns"
|
|
1489
|
+
frame = frame.drop(drop, axis="columns")
|
|
1490
1490
|
|
|
1491
1491
|
if len(frame.columns) == 0 and not as_dataframe:
|
|
1492
1492
|
return index
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: audformat
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.4
|
|
4
4
|
Summary: Python implementation of audformat
|
|
5
5
|
Author: Johannes Wagner, BahaEddine Abrougui
|
|
6
6
|
Author-email: Hagen Wierstorf <hwierstorf@audeering.com>, Christian Geng <cgeng@audeering.com>
|
|
@@ -14,13 +14,13 @@ Classifier: Intended Audience :: Developers
|
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
15
15
|
Classifier: Programming Language :: Python
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
22
22
|
Classifier: Topic :: Scientific/Engineering
|
|
23
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
24
|
Description-Content-Type: text/x-rst
|
|
25
25
|
License-File: LICENSE
|
|
26
26
|
Requires-Dist: audeer>=2.0.0
|
|
@@ -14,6 +14,8 @@ audformat.egg-info/PKG-INFO
|
|
|
14
14
|
audformat.egg-info/SOURCES.txt
|
|
15
15
|
audformat.egg-info/dependency_links.txt
|
|
16
16
|
audformat.egg-info/requires.txt
|
|
17
|
+
audformat.egg-info/scm_file_list.json
|
|
18
|
+
audformat.egg-info/scm_version.json
|
|
17
19
|
audformat.egg-info/top_level.txt
|
|
18
20
|
audformat/core/__init__.py
|
|
19
21
|
audformat/core/attachment.py
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": [
|
|
3
|
+
".github/workflows/doc.yml",
|
|
4
|
+
".github/workflows/linter.yml",
|
|
5
|
+
".github/workflows/publish.yml",
|
|
6
|
+
".github/workflows/test.yml",
|
|
7
|
+
".gitignore",
|
|
8
|
+
".pre-commit-config.yaml",
|
|
9
|
+
"CHANGELOG.rst",
|
|
10
|
+
"CONTRIBUTING.rst",
|
|
11
|
+
"LICENSE",
|
|
12
|
+
"README.rst",
|
|
13
|
+
"audformat/__init__.py",
|
|
14
|
+
"audformat/core/__init__.py",
|
|
15
|
+
"audformat/core/attachment.py",
|
|
16
|
+
"audformat/core/column.py",
|
|
17
|
+
"audformat/core/common.py",
|
|
18
|
+
"audformat/core/conftest.py",
|
|
19
|
+
"audformat/core/database.py",
|
|
20
|
+
"audformat/core/define.py",
|
|
21
|
+
"audformat/core/errors.py",
|
|
22
|
+
"audformat/core/index.py",
|
|
23
|
+
"audformat/core/media.py",
|
|
24
|
+
"audformat/core/rater.py",
|
|
25
|
+
"audformat/core/scheme.py",
|
|
26
|
+
"audformat/core/split.py",
|
|
27
|
+
"audformat/core/table.py",
|
|
28
|
+
"audformat/core/testing.py",
|
|
29
|
+
"audformat/core/typing.py",
|
|
30
|
+
"audformat/core/utils.py",
|
|
31
|
+
"audformat/define/__init__.py",
|
|
32
|
+
"audformat/errors/__init__.py",
|
|
33
|
+
"audformat/testing/__init__.py",
|
|
34
|
+
"audformat/utils/__init__.py",
|
|
35
|
+
"benchmarks/benchmark_hash.py",
|
|
36
|
+
"benchmarks/benchmark_union.py",
|
|
37
|
+
"docs/accessing-data.rst",
|
|
38
|
+
"docs/api-src/audformat.define.rst",
|
|
39
|
+
"docs/api-src/audformat.errors.rst",
|
|
40
|
+
"docs/api-src/audformat.rst",
|
|
41
|
+
"docs/api-src/audformat.testing.rst",
|
|
42
|
+
"docs/api-src/audformat.utils.rst",
|
|
43
|
+
"docs/api/audformat.define.rst",
|
|
44
|
+
"docs/api/audformat.errors.rst",
|
|
45
|
+
"docs/api/audformat.rst",
|
|
46
|
+
"docs/api/audformat.testing.rst",
|
|
47
|
+
"docs/api/audformat.utils.rst",
|
|
48
|
+
"docs/changelog.rst",
|
|
49
|
+
"docs/combine-tables.rst",
|
|
50
|
+
"docs/conf.py",
|
|
51
|
+
"docs/conftest.py",
|
|
52
|
+
"docs/contributing.rst",
|
|
53
|
+
"docs/create-database.rst",
|
|
54
|
+
"docs/data-conventions.rst",
|
|
55
|
+
"docs/data-example.rst",
|
|
56
|
+
"docs/data-format.rst",
|
|
57
|
+
"docs/data-header.rst",
|
|
58
|
+
"docs/data-introduction.rst",
|
|
59
|
+
"docs/data-misc-tables.rst",
|
|
60
|
+
"docs/data-tables.rst",
|
|
61
|
+
"docs/emodb-example.rst",
|
|
62
|
+
"docs/genindex.rst",
|
|
63
|
+
"docs/index.rst",
|
|
64
|
+
"docs/install.rst",
|
|
65
|
+
"docs/map-scheme.rst",
|
|
66
|
+
"docs/pics/audformat-database.dot",
|
|
67
|
+
"docs/pics/audformat-misc-table.dot",
|
|
68
|
+
"docs/pics/audformat-table.dot",
|
|
69
|
+
"docs/update-database.rst",
|
|
70
|
+
"pyproject.toml",
|
|
71
|
+
"tests/conftest.py",
|
|
72
|
+
"tests/test_attachment.py",
|
|
73
|
+
"tests/test_column.py",
|
|
74
|
+
"tests/test_common.py",
|
|
75
|
+
"tests/test_database.py",
|
|
76
|
+
"tests/test_database_get.py",
|
|
77
|
+
"tests/test_eq.py",
|
|
78
|
+
"tests/test_errors.py",
|
|
79
|
+
"tests/test_index.py",
|
|
80
|
+
"tests/test_misc_table.py",
|
|
81
|
+
"tests/test_scheme.py",
|
|
82
|
+
"tests/test_table.py",
|
|
83
|
+
"tests/test_utils.py",
|
|
84
|
+
"tests/test_utils_concat.py"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
@@ -96,9 +96,9 @@ audio/004.wav 0 days 00:00:00.276361409 0 days 00:00:00.625730112 0.717525 <
|
|
|
96
96
|
0 days 00:00:02.320023510 0 days 00:00:02.419307606 0.607638 <NA>
|
|
97
97
|
0 days 00:00:02.798096347 0 days 00:00:02.892323558 0.918130 <NA>
|
|
98
98
|
0 days 00:00:03.617486299 0 days 00:00:03.943024074 0.414640 <NA>
|
|
99
|
-
audio/001.wav 0 days 00:00:00
|
|
100
|
-
audio/002.wav 0 days 00:00:00
|
|
101
|
-
audio/003.wav 0 days 00:00:00
|
|
99
|
+
audio/001.wav 0 days 00:00:00.000000000 NaT NaN 40
|
|
100
|
+
audio/002.wav 0 days 00:00:00.000000000 NaT NaN 33
|
|
101
|
+
audio/003.wav 0 days 00:00:00.000000000 NaT NaN 38
|
|
102
102
|
|
|
103
103
|
Or, if you just want to have the likability information for all segments,
|
|
104
104
|
for which age information is available:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from datetime import date
|
|
2
|
-
|
|
3
|
-
import toml
|
|
2
|
+
import tomllib
|
|
4
3
|
|
|
5
4
|
import audeer
|
|
6
5
|
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
with open(audeer.path("..", "pyproject.toml"), "rb") as fp:
|
|
8
|
+
config = tomllib.load(fp)
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
# Project -----------------------------------------------------------------
|
|
@@ -6,6 +6,9 @@ from sybil.parsers.rest import DocTestParser
|
|
|
6
6
|
from sybil.parsers.rest import PythonCodeBlockParser
|
|
7
7
|
from sybil.parsers.rest import SkipParser
|
|
8
8
|
|
|
9
|
+
from audformat.core.conftest import DOCTESTS_SUPPORTED
|
|
10
|
+
from audformat.core.conftest import pandas_display # noqa: F401
|
|
11
|
+
|
|
9
12
|
|
|
10
13
|
# Collect doctests
|
|
11
14
|
#
|
|
@@ -17,8 +20,9 @@ parsers = [
|
|
|
17
20
|
PythonCodeBlockParser(),
|
|
18
21
|
SkipParser(),
|
|
19
22
|
]
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
if DOCTESTS_SUPPORTED:
|
|
24
|
+
pytest_collect_file = sybil.Sybil(
|
|
25
|
+
parsers=parsers,
|
|
26
|
+
pattern="*.rst",
|
|
27
|
+
fixtures=["pandas_display", "tmpdir"],
|
|
28
|
+
).pytest()
|
|
@@ -24,14 +24,14 @@ classifiers = [
|
|
|
24
24
|
'Operating System :: OS Independent',
|
|
25
25
|
'Programming Language :: Python',
|
|
26
26
|
'Programming Language :: Python :: 3',
|
|
27
|
-
'Programming Language :: Python :: 3.10',
|
|
28
27
|
'Programming Language :: Python :: 3.11',
|
|
29
28
|
'Programming Language :: Python :: 3.12',
|
|
30
29
|
'Programming Language :: Python :: 3.13',
|
|
31
30
|
'Programming Language :: Python :: 3.14',
|
|
31
|
+
'Programming Language :: Python :: 3.15',
|
|
32
32
|
'Topic :: Scientific/Engineering',
|
|
33
33
|
]
|
|
34
|
-
requires-python = '>=3.
|
|
34
|
+
requires-python = '>=3.11'
|
|
35
35
|
dependencies = [
|
|
36
36
|
'audeer >=2.0.0',
|
|
37
37
|
'audiofile >=0.4.0',
|
|
@@ -72,7 +72,6 @@ dev = [
|
|
|
72
72
|
'sphinx-copybutton',
|
|
73
73
|
'sphinxcontrib-katex',
|
|
74
74
|
'sybil',
|
|
75
|
-
'toml',
|
|
76
75
|
]
|
|
77
76
|
|
|
78
77
|
|
|
@@ -109,6 +108,13 @@ addopts = '''
|
|
|
109
108
|
'''
|
|
110
109
|
|
|
111
110
|
|
|
111
|
+
# ----- coverage ----------------------------------------------------------
|
|
112
|
+
#
|
|
113
|
+
[tool.coverage.run]
|
|
114
|
+
# The doctest fixtures are only used with pandas>=3.1
|
|
115
|
+
omit = ['audformat/core/conftest.py']
|
|
116
|
+
|
|
117
|
+
|
|
112
118
|
# ----- ruff --------------------------------------------------------------
|
|
113
119
|
#
|
|
114
120
|
[tool.ruff]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import contextlib
|
|
2
2
|
import tempfile
|
|
3
3
|
|
|
4
4
|
import pandas as pd
|
|
@@ -21,10 +21,7 @@ pytest.FILE_DUR = pd.to_timedelta("1s")
|
|
|
21
21
|
def prepare_tests():
|
|
22
22
|
# Prepare files used in tests
|
|
23
23
|
# and set a temporary working directory
|
|
24
|
-
with tempfile.TemporaryDirectory() as tmp:
|
|
25
|
-
current_dir = os.getcwd()
|
|
26
|
-
os.chdir(tmp)
|
|
27
|
-
|
|
24
|
+
with tempfile.TemporaryDirectory() as tmp, contextlib.chdir(tmp):
|
|
28
25
|
pytest.DB.save(pytest.DB_ROOT)
|
|
29
26
|
|
|
30
27
|
audformat.testing.create_audio_files(
|
|
@@ -37,5 +34,3 @@ def prepare_tests():
|
|
|
37
34
|
)
|
|
38
35
|
|
|
39
36
|
yield
|
|
40
|
-
|
|
41
|
-
os.chdir(current_dir)
|
|
@@ -24,6 +24,29 @@ def test_is_relative_path(path, expected):
|
|
|
24
24
|
assert relative == expected
|
|
25
25
|
|
|
26
26
|
|
|
27
|
+
def test_get_callback():
|
|
28
|
+
calls = []
|
|
29
|
+
|
|
30
|
+
def get_callback(key, value):
|
|
31
|
+
calls.append((key, value))
|
|
32
|
+
return value + value
|
|
33
|
+
|
|
34
|
+
d = audformat.core.common.HeaderDict(get_callback=get_callback)
|
|
35
|
+
d["a"] = 1
|
|
36
|
+
assert calls == []
|
|
37
|
+
assert d["a"] == 2
|
|
38
|
+
assert calls == [("a", 1)]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def test_repr():
|
|
42
|
+
d = audformat.core.common.HeaderDict()
|
|
43
|
+
assert repr(d) == ""
|
|
44
|
+
d["b"] = 1
|
|
45
|
+
d["a"] = "text"
|
|
46
|
+
assert repr(d) == "a:\n text\nb:\n 1"
|
|
47
|
+
assert repr(d) == d.dump()
|
|
48
|
+
|
|
49
|
+
|
|
27
50
|
def test_items_order():
|
|
28
51
|
d = audformat.core.common.HeaderDict(sort_by_key=False)
|
|
29
52
|
d["b"] = 1
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
import filecmp
|
|
3
|
+
import locale
|
|
3
4
|
import os
|
|
4
5
|
import re
|
|
5
6
|
|
|
@@ -427,6 +428,23 @@ def test_load(tmpdir):
|
|
|
427
428
|
assert list(db.schemes) == ["misc", "scheme1", "scheme2", "scheme3"]
|
|
428
429
|
|
|
429
430
|
|
|
431
|
+
def test_load_ascii_locale(tmpdir):
|
|
432
|
+
# Test loading a database containing a non-ascii character
|
|
433
|
+
# when not using utf-8 locale
|
|
434
|
+
db = audformat.testing.create_db(minimal=True)
|
|
435
|
+
db.description = "Non-ascii description: äöü"
|
|
436
|
+
db.save(tmpdir)
|
|
437
|
+
|
|
438
|
+
old_locale = locale.getlocale(locale.LC_CTYPE)
|
|
439
|
+
try:
|
|
440
|
+
locale.setlocale(locale.LC_CTYPE, "C")
|
|
441
|
+
db_loaded = audformat.Database.load(tmpdir)
|
|
442
|
+
finally:
|
|
443
|
+
locale.setlocale(locale.LC_CTYPE, old_locale)
|
|
444
|
+
|
|
445
|
+
assert db_loaded.description == db.description
|
|
446
|
+
|
|
447
|
+
|
|
430
448
|
@pytest.mark.parametrize("load_data", [(True, False)])
|
|
431
449
|
def test_load_with_misc_table_as_scheme_labels(tmpdir, load_data):
|
|
432
450
|
"""Test loading database when regular table uses scheme with misc table labels.
|
|
@@ -38,7 +38,7 @@ def test_with_data(tmpdir):
|
|
|
38
38
|
|
|
39
39
|
db.save(tmpdir)
|
|
40
40
|
db4 = audformat.Database.load(tmpdir)
|
|
41
|
-
db4["files"].df.
|
|
41
|
+
db4["files"].df.loc[db4["files"].index[0], "string"] = "Believe me, I am special!"
|
|
42
42
|
|
|
43
43
|
assert db != db4
|
|
44
44
|
assert db["files"] != db4["files"]
|
|
@@ -1313,6 +1313,12 @@ def test_get_column(table, column, expected):
|
|
|
1313
1313
|
pd.testing.assert_series_equal(table[column].get(), expected)
|
|
1314
1314
|
|
|
1315
1315
|
|
|
1316
|
+
def test_get_index():
|
|
1317
|
+
table = pytest.DB["misc"]
|
|
1318
|
+
index = table.index[[2, 0]]
|
|
1319
|
+
pd.testing.assert_frame_equal(table.get(index), table.df.loc[index])
|
|
1320
|
+
|
|
1321
|
+
|
|
1316
1322
|
@pytest.mark.parametrize(
|
|
1317
1323
|
"index",
|
|
1318
1324
|
[
|
|
@@ -1436,7 +1436,7 @@ def test_map(table, map):
|
|
|
1436
1436
|
map=mapped_column,
|
|
1437
1437
|
)
|
|
1438
1438
|
if column not in mapped_columns:
|
|
1439
|
-
expected.drop(columns=column
|
|
1439
|
+
expected = expected.drop(columns=column)
|
|
1440
1440
|
pd.testing.assert_frame_equal(result, expected)
|
|
1441
1441
|
|
|
1442
1442
|
|
|
@@ -2538,3 +2538,36 @@ def test_zero_columns(tmpdir, storage_format):
|
|
|
2538
2538
|
db[table_id].df.index,
|
|
2539
2539
|
)
|
|
2540
2540
|
assert db_loaded[table_id].df.shape == db[table_id].df.shape
|
|
2541
|
+
|
|
2542
|
+
|
|
2543
|
+
@pytest.mark.parametrize(
|
|
2544
|
+
"index, expected_index",
|
|
2545
|
+
[
|
|
2546
|
+
# filewise index with str dtype
|
|
2547
|
+
(
|
|
2548
|
+
pd.Index(["f1.wav", "f2.wav"], dtype="str", name="file"),
|
|
2549
|
+
audformat.filewise_index(["f1.wav", "f2.wav"]),
|
|
2550
|
+
),
|
|
2551
|
+
# segmented index with str dtype
|
|
2552
|
+
(
|
|
2553
|
+
audformat.utils.set_index_dtypes(
|
|
2554
|
+
pd.MultiIndex.from_arrays(
|
|
2555
|
+
[
|
|
2556
|
+
["f1.wav"],
|
|
2557
|
+
[pd.Timedelta(0).as_unit("ns")],
|
|
2558
|
+
[pd.Timedelta(4, unit="s").as_unit("ns")],
|
|
2559
|
+
],
|
|
2560
|
+
names=["file", "start", "end"],
|
|
2561
|
+
),
|
|
2562
|
+
{"file": "str"},
|
|
2563
|
+
),
|
|
2564
|
+
audformat.segmented_index(files=["f1.wav"], starts=[0.0], ends=[4.0]),
|
|
2565
|
+
),
|
|
2566
|
+
],
|
|
2567
|
+
)
|
|
2568
|
+
def test_create_table_dtype(index, expected_index):
|
|
2569
|
+
# Check that the index of the created table
|
|
2570
|
+
# has the correct dtype
|
|
2571
|
+
# https://github.com/audeering/audformat/issues/544
|
|
2572
|
+
table = audformat.Table(index=index)
|
|
2573
|
+
pd.testing.assert_index_equal(table.index, expected_index)
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
from doctest import ELLIPSIS
|
|
2
|
-
from doctest import NORMALIZE_WHITESPACE
|
|
3
|
-
import os
|
|
4
|
-
import tempfile
|
|
5
|
-
|
|
6
|
-
import numpy as np
|
|
7
|
-
import pytest
|
|
8
|
-
import sybil
|
|
9
|
-
from sybil.parsers.rest import DocTestParser
|
|
10
|
-
from sybil.parsers.rest import SkipParser
|
|
11
|
-
|
|
12
|
-
import audiofile
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@pytest.fixture(scope="package", autouse=True)
|
|
16
|
-
def prepare_docstring_tests(doctest_namespace):
|
|
17
|
-
# Prepare files and tmp folder needed in doctests
|
|
18
|
-
with tempfile.TemporaryDirectory() as tmp:
|
|
19
|
-
doctest_namespace["tmp"] = tmp
|
|
20
|
-
|
|
21
|
-
current_dir = os.getcwd()
|
|
22
|
-
os.chdir(tmp)
|
|
23
|
-
|
|
24
|
-
# audformat.utils.to_filewise_index()
|
|
25
|
-
audiofile.write("f.wav", np.ones((1, 8000)), 8000)
|
|
26
|
-
|
|
27
|
-
yield
|
|
28
|
-
|
|
29
|
-
os.chdir(current_dir)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
parsers = [
|
|
33
|
-
DocTestParser(optionflags=ELLIPSIS + NORMALIZE_WHITESPACE),
|
|
34
|
-
SkipParser(),
|
|
35
|
-
]
|
|
36
|
-
pytest_collect_file = sybil.Sybil(
|
|
37
|
-
parsers=parsers,
|
|
38
|
-
pattern="*.py",
|
|
39
|
-
fixtures=["prepare_docstring_tests"],
|
|
40
|
-
).pytest()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|