audformat 1.3.1__tar.gz → 1.3.3__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.
Files changed (97) hide show
  1. {audformat-1.3.1 → audformat-1.3.3}/.github/workflows/doc.yml +12 -11
  2. {audformat-1.3.1 → audformat-1.3.3}/.github/workflows/linter.yml +6 -6
  3. {audformat-1.3.1 → audformat-1.3.3}/.github/workflows/publish.yml +7 -13
  4. {audformat-1.3.1 → audformat-1.3.3}/.github/workflows/test.yml +25 -17
  5. {audformat-1.3.1 → audformat-1.3.3}/.gitignore +1 -0
  6. {audformat-1.3.1 → audformat-1.3.3}/.pre-commit-config.yaml +3 -3
  7. {audformat-1.3.1 → audformat-1.3.3}/CHANGELOG.rst +28 -0
  8. {audformat-1.3.1 → audformat-1.3.3}/CONTRIBUTING.rst +15 -31
  9. {audformat-1.3.1 → audformat-1.3.3}/PKG-INFO +8 -33
  10. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/attachment.py +2 -3
  11. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/column.py +39 -34
  12. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/common.py +10 -7
  13. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/conftest.py +16 -0
  14. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/database.py +84 -44
  15. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/errors.py +10 -14
  16. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/index.py +7 -9
  17. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/media.py +2 -2
  18. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/scheme.py +20 -23
  19. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/table.py +30 -45
  20. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/testing.py +15 -27
  21. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/utils.py +67 -65
  22. {audformat-1.3.1 → audformat-1.3.3}/audformat.egg-info/PKG-INFO +8 -33
  23. {audformat-1.3.1 → audformat-1.3.3}/audformat.egg-info/SOURCES.txt +1 -3
  24. {audformat-1.3.1 → audformat-1.3.3}/benchmarks/benchmark_union.py +1 -1
  25. {audformat-1.3.1 → audformat-1.3.3}/docs/accessing-data.rst +17 -18
  26. audformat-1.3.3/docs/combine-tables.rst +199 -0
  27. {audformat-1.3.1 → audformat-1.3.3}/docs/conf.py +0 -1
  28. audformat-1.3.3/docs/conftest.py +24 -0
  29. {audformat-1.3.1 → audformat-1.3.3}/docs/create-database.rst +65 -18
  30. {audformat-1.3.1 → audformat-1.3.3}/docs/data-conventions.rst +115 -29
  31. audformat-1.3.3/docs/data-example.rst +143 -0
  32. {audformat-1.3.1 → audformat-1.3.3}/docs/data-format.rst +4 -3
  33. {audformat-1.3.1 → audformat-1.3.3}/docs/data-header.rst +114 -101
  34. audformat-1.3.3/docs/data-misc-tables.rst +79 -0
  35. audformat-1.3.3/docs/data-tables.rst +200 -0
  36. {audformat-1.3.1 → audformat-1.3.3}/docs/emodb-example.rst +132 -47
  37. audformat-1.3.3/docs/install.rst +14 -0
  38. audformat-1.3.3/docs/map-scheme.rst +148 -0
  39. {audformat-1.3.1 → audformat-1.3.3}/docs/update-database.rst +89 -14
  40. {audformat-1.3.1 → audformat-1.3.3}/pyproject.toml +29 -6
  41. {audformat-1.3.1 → audformat-1.3.3}/tests/test_attachment.py +1 -2
  42. {audformat-1.3.1 → audformat-1.3.3}/tests/test_database.py +37 -3
  43. {audformat-1.3.1 → audformat-1.3.3}/tests/test_database_get.py +270 -0
  44. {audformat-1.3.1 → audformat-1.3.3}/tests/test_misc_table.py +54 -6
  45. {audformat-1.3.1 → audformat-1.3.3}/tests/test_scheme.py +86 -29
  46. {audformat-1.3.1 → audformat-1.3.3}/tests/test_table.py +48 -3
  47. {audformat-1.3.1 → audformat-1.3.3}/tests/test_utils.py +4 -5
  48. {audformat-1.3.1 → audformat-1.3.3}/tests/test_utils_concat.py +1 -2
  49. audformat-1.3.1/docs/combine-tables.rst +0 -132
  50. audformat-1.3.1/docs/data-example.rst +0 -50
  51. audformat-1.3.1/docs/data-misc-tables.rst +0 -85
  52. audformat-1.3.1/docs/data-tables.rst +0 -187
  53. audformat-1.3.1/docs/install.rst +0 -11
  54. audformat-1.3.1/docs/map-scheme.rst +0 -124
  55. audformat-1.3.1/docs/requirements.txt +0 -11
  56. audformat-1.3.1/requirements.txt +0 -1
  57. audformat-1.3.1/tests/requirements.txt +0 -7
  58. {audformat-1.3.1 → audformat-1.3.3}/LICENSE +0 -0
  59. {audformat-1.3.1 → audformat-1.3.3}/README.rst +0 -0
  60. {audformat-1.3.1 → audformat-1.3.3}/audformat/__init__.py +0 -0
  61. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/__init__.py +0 -0
  62. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/define.py +0 -0
  63. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/rater.py +0 -0
  64. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/split.py +0 -0
  65. {audformat-1.3.1 → audformat-1.3.3}/audformat/core/typing.py +0 -0
  66. {audformat-1.3.1 → audformat-1.3.3}/audformat/define/__init__.py +0 -0
  67. {audformat-1.3.1 → audformat-1.3.3}/audformat/errors/__init__.py +0 -0
  68. {audformat-1.3.1 → audformat-1.3.3}/audformat/testing/__init__.py +0 -0
  69. {audformat-1.3.1 → audformat-1.3.3}/audformat/utils/__init__.py +0 -0
  70. {audformat-1.3.1 → audformat-1.3.3}/audformat.egg-info/dependency_links.txt +0 -0
  71. {audformat-1.3.1 → audformat-1.3.3}/audformat.egg-info/requires.txt +0 -0
  72. {audformat-1.3.1 → audformat-1.3.3}/audformat.egg-info/top_level.txt +0 -0
  73. {audformat-1.3.1 → audformat-1.3.3}/docs/api/audformat.define.rst +0 -0
  74. {audformat-1.3.1 → audformat-1.3.3}/docs/api/audformat.errors.rst +0 -0
  75. {audformat-1.3.1 → audformat-1.3.3}/docs/api/audformat.rst +0 -0
  76. {audformat-1.3.1 → audformat-1.3.3}/docs/api/audformat.testing.rst +0 -0
  77. {audformat-1.3.1 → audformat-1.3.3}/docs/api/audformat.utils.rst +0 -0
  78. {audformat-1.3.1 → audformat-1.3.3}/docs/api-src/audformat.define.rst +0 -0
  79. {audformat-1.3.1 → audformat-1.3.3}/docs/api-src/audformat.errors.rst +0 -0
  80. {audformat-1.3.1 → audformat-1.3.3}/docs/api-src/audformat.rst +0 -0
  81. {audformat-1.3.1 → audformat-1.3.3}/docs/api-src/audformat.testing.rst +0 -0
  82. {audformat-1.3.1 → audformat-1.3.3}/docs/api-src/audformat.utils.rst +0 -0
  83. {audformat-1.3.1 → audformat-1.3.3}/docs/changelog.rst +0 -0
  84. {audformat-1.3.1 → audformat-1.3.3}/docs/contributing.rst +0 -0
  85. {audformat-1.3.1 → audformat-1.3.3}/docs/data-introduction.rst +0 -0
  86. {audformat-1.3.1 → audformat-1.3.3}/docs/genindex.rst +0 -0
  87. {audformat-1.3.1 → audformat-1.3.3}/docs/index.rst +0 -0
  88. {audformat-1.3.1 → audformat-1.3.3}/docs/pics/audformat-database.dot +0 -0
  89. {audformat-1.3.1 → audformat-1.3.3}/docs/pics/audformat-misc-table.dot +0 -0
  90. {audformat-1.3.1 → audformat-1.3.3}/docs/pics/audformat-table.dot +0 -0
  91. {audformat-1.3.1 → audformat-1.3.3}/setup.cfg +0 -0
  92. {audformat-1.3.1 → audformat-1.3.3}/tests/conftest.py +0 -0
  93. {audformat-1.3.1 → audformat-1.3.3}/tests/test_column.py +0 -0
  94. {audformat-1.3.1 → audformat-1.3.3}/tests/test_common.py +0 -0
  95. {audformat-1.3.1 → audformat-1.3.3}/tests/test_eq.py +0 -0
  96. {audformat-1.3.1 → audformat-1.3.3}/tests/test_errors.py +0 -0
  97. {audformat-1.3.1 → audformat-1.3.3}/tests/test_index.py +0 -0
@@ -13,10 +13,16 @@ jobs:
13
13
  strategy:
14
14
  matrix:
15
15
  os: [ ubuntu-latest ]
16
- python-version: [ '3.10' ]
16
+ python-version: [ '3.12' ]
17
17
 
18
18
  steps:
19
19
  - uses: actions/checkout@v4
20
+ with:
21
+ # Ensure audformat is assigned a version,
22
+ # so we can install audb as a dependency
23
+ # https://github.com/astral-sh/uv/issues/8148#issuecomment-2408639333
24
+ fetch-depth: 0
25
+ fetch-tags: true
20
26
 
21
27
  - name: Cache emodb
22
28
  uses: actions/cache@v4
@@ -29,21 +35,16 @@ jobs:
29
35
  with:
30
36
  python-version: ${{ matrix.python-version }}
31
37
 
38
+ - name: Install uv
39
+ uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d
40
+
32
41
  - name: Ubuntu - install graphviz
33
42
  run: |
34
43
  sudo apt-get update
35
44
  sudo apt-get install --yes graphviz
36
45
 
37
- - name: Install package
38
- run: |
39
- python -m pip install --upgrade pip
40
- pip install -r requirements.txt
41
-
42
- - name: Install docs requirements
43
- run: pip install -r docs/requirements.txt
44
-
45
46
  - name: Test building documentation
46
- run: python -m sphinx docs/ docs/_build/ -b html -W
47
+ run: uv run python -m sphinx docs/ docs/_build/ -b html -W
47
48
 
48
49
  - name: Check links in documentation
49
- run: python -m sphinx docs/ docs/_build/ -b linkcheck -W
50
+ run: uv run python -m sphinx docs/ docs/_build/ -b linkcheck -W
@@ -17,13 +17,13 @@ jobs:
17
17
  - name: Set up Python
18
18
  uses: actions/setup-python@v5
19
19
  with:
20
- python-version: '3.10'
20
+ python-version: '3.12'
21
+
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d
21
24
 
22
25
  - name: Install pre-commit hooks
23
- run: |
24
- pip install pre-commit
25
- pre-commit install --install-hooks
26
+ run: uvx pre-commit install --install-hooks
26
27
 
27
28
  - name: Code style check via pre-commit
28
- run: |
29
- pre-commit run --all-files
29
+ run: uvx pre-commit run --all-files
@@ -29,34 +29,28 @@ jobs:
29
29
  - name: Set up Python
30
30
  uses: actions/setup-python@v5
31
31
  with:
32
- python-version: '3.10'
32
+ python-version: '3.12'
33
+
34
+ - name: Install uv
35
+ uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d
33
36
 
34
- - name: Install dependencies
35
- run: |
36
- python -m pip install --upgrade pip
37
- pip install build virtualenv
38
37
 
39
38
  # PyPI package
40
39
  - name: Build Python package
41
- run: python -m build
40
+ run: uv build
42
41
 
43
42
  - name: Publish Python package to PyPI
44
43
  uses: pypa/gh-action-pypi-publish@release/v1
45
44
 
46
- # Docuemntation
45
+ # Documentation
47
46
  - name: Prepare Ubuntu
48
47
  run: |
49
48
  sudo apt-get update
50
49
  sudo apt-get install --no-install-recommends --yes graphviz libsndfile1 sox
51
50
 
52
- - name: Install doc dependencies
53
- run: |
54
- pip install -r requirements.txt
55
- pip install -r docs/requirements.txt
56
51
 
57
52
  - name: Build documentation
58
- run: |
59
- python -m sphinx docs/ docs/_build/ -b html
53
+ run: uv run python -m sphinx docs/ docs/_build/ -b html
60
54
 
61
55
  - name: Deploy documentation to Github pages
62
56
  uses: peaceiris/actions-gh-pages@v4
@@ -12,47 +12,56 @@ jobs:
12
12
  runs-on: ${{ matrix.os }}
13
13
  strategy:
14
14
  matrix:
15
- os: [ ubuntu-20.04, windows-latest, macOS-latest ]
16
- python-version: [ '3.10' ]
15
+ os: [ ubuntu-latest, windows-latest, macOS-latest ]
16
+ python-version: [ '3.12' ]
17
17
  include:
18
18
  - os: ubuntu-latest
19
- python-version: '3.9'
19
+ python-version: '3.10'
20
20
  - os: ubuntu-latest
21
21
  python-version: '3.11'
22
22
  - os: ubuntu-latest
23
- python-version: '3.9'
23
+ python-version: '3.13'
24
+ - os: ubuntu-latest
25
+ python-version: '3.14'
26
+ - os: ubuntu-latest
27
+ python-version: '3.10'
24
28
  requirements: 'minimum'
25
29
 
26
30
  steps:
27
31
  - uses: actions/checkout@v4
28
32
  with:
33
+ # Ensure audformat is assigned a version,
34
+ # so we can install audb as a dependency
35
+ # https://github.com/astral-sh/uv/issues/8148#issuecomment-2408639333
36
+ fetch-depth: 0
29
37
  fetch-tags: true
30
- fetch-depth: 50
31
38
 
32
39
  - name: Cache emodb
33
40
  uses: actions/cache@v4
34
41
  with:
35
42
  path: emodb-src
36
43
  key: emodb-ubuntu
37
- if: matrix.os == 'ubuntu-20.04'
44
+ if: matrix.os == 'ubuntu-latest'
38
45
 
39
46
  - name: Set up Python ${{ matrix.python-version }}
40
47
  uses: actions/setup-python@v5
41
48
  with:
42
49
  python-version: ${{ matrix.python-version }}
43
50
 
51
+ - name: Install uv
52
+ uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d
53
+
44
54
  - name: Prepare Ubuntu
45
55
  run: |
46
56
  sudo apt-get update
47
57
  sudo apt-get install --no-install-recommends --yes libsndfile1
48
- if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-20.04'
58
+ if: matrix.os == 'ubuntu-latest'
49
59
 
50
- - name: Install dependencies
51
- run: |
52
- python -V
53
- python -m pip install --upgrade pip
54
- pip install -r requirements.txt
55
- pip install -r tests/requirements.txt
60
+ - name: Sync Python environment
61
+ run: uv sync
62
+
63
+ - name: List installed Python packages
64
+ run: uv pip list
56
65
 
57
66
  - name: Downgrade to minimum dependencies
58
67
  run: |
@@ -61,19 +70,18 @@ jobs:
61
70
  pip install "numpy<2.0.0"
62
71
  pip install "pandas==2.1.0"
63
72
  pip install "pyarrow==10.0.1"
64
- pip install "pyyaml==5.4.1"
73
+ pip install "pyyaml==6.0.1"
65
74
  # need to use an audb version in the test,
66
75
  # that supports audeer==2.0.0
67
76
  pip install "audb==1.7.4"
68
77
  if: matrix.requirements == 'minimum'
69
78
 
70
79
  - name: Test with pytest
71
- run: |
72
- python -m pytest
80
+ run: uv run pytest
73
81
 
74
82
  - name: Upload coverage to Codecov
75
83
  uses: codecov/codecov-action@v4
76
84
  with:
77
85
  token: ${{ secrets.CODECOV_TOKEN }}
78
86
  file: ./coverage.xml
79
- if: matrix.os == 'ubuntu-20.04'
87
+ if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
@@ -11,3 +11,4 @@ emodb-src/
11
11
  emodb.zip
12
12
  coverage.xml
13
13
  docs/api/
14
+ uv.lock
@@ -9,17 +9,17 @@
9
9
  #
10
10
  #
11
11
  default_language_version:
12
- python: python3.10
12
+ python: python3.12
13
13
 
14
14
  repos:
15
15
  - repo: https://github.com/astral-sh/ruff-pre-commit
16
- rev: v0.1.8
16
+ rev: v0.13.3
17
17
  hooks:
18
18
  - id: ruff
19
19
  args: [ --fix ]
20
20
  - id: ruff-format
21
21
  - repo: https://github.com/codespell-project/codespell
22
- rev: v2.2.4
22
+ rev: v2.4.1
23
23
  hooks:
24
24
  - id: codespell
25
25
  additional_dependencies:
@@ -7,6 +7,34 @@ The format is based on `Keep a Changelog`_,
7
7
  and this project adheres to `Semantic Versioning`_.
8
8
 
9
9
 
10
+ Version 1.3.3 (2026-01-12)
11
+ --------------------------
12
+
13
+ * Added: support for Python 3.14
14
+ * Added: document support for (misc) tables with zero columns
15
+ in the specification
16
+ * Fixed: ensure cache compatibility between different ``pandas`` versions
17
+ * Removed: support for Python 3.9
18
+
19
+
20
+ Version 1.3.2 (2025-05-27)
21
+ --------------------------
22
+
23
+ * Added: support for Python 3.13
24
+ * Added: support for Python 3.12
25
+ * Fixed: ``audformat.Database.update()`` for misc tables
26
+ * Fixed: ``audformat.Database.get()``
27
+ if ``scheme`` is stored in a segmented table,
28
+ and ``additional_schemes`` are stored in filewise tables.
29
+ Before,
30
+ values of the additional schemes were set to ``<NA>``
31
+ * Fixed: if ``audformat.Column.set()`` assigns values
32
+ to a column with scheme labels
33
+ given by a misc table,
34
+ the misc table is only converted once to a dictionary
35
+ instead of once for each value
36
+
37
+
10
38
  Version 1.3.1 (2024-09-16)
11
39
  --------------------------
12
40
 
@@ -22,11 +22,7 @@ you should get the newest development version from Github_::
22
22
 
23
23
  git clone https://github.com/audeering/audformat/
24
24
  cd audformat
25
- # Create virtual environment for this project
26
- # e.g.
27
- # virtualenv --python="python3" $HOME/.envs/audformat
28
- # source $HOME/.envs/audformat/bin/activate
29
- pip install -r requirements.txt
25
+ uv sync
30
26
 
31
27
 
32
28
  This way,
@@ -50,9 +46,8 @@ are defined in :file:`pyproject.toml`.
50
46
  The checks are executed in the CI using `pre-commit`_.
51
47
  You can enable those checks locally by executing::
52
48
 
53
- pip install pre-commit # consider system wide installation
54
- pre-commit install
55
- pre-commit run --all-files
49
+ uvx pre-commit install
50
+ uvx pre-commit run --all-files
56
51
 
57
52
  Afterwards ruff_ and codespell_ are executed
58
53
  every time you create a commit.
@@ -60,15 +55,14 @@ every time you create a commit.
60
55
  You can also install ruff_ and codespell_
61
56
  and call it directly::
62
57
 
63
- pip install ruff codespell # consider system wide installation
64
- ruff check --fix . # lint all Python files, and fix any fixable errors
65
- ruff format . # format code of all Python files
66
- codespell
58
+ uvx ruff check --fix . # lint all Python files, and fix any fixable errors
59
+ uvx ruff format . # format code of all Python files
60
+ uvx codespell
67
61
 
68
62
  It can be restricted to specific folders::
69
63
 
70
- ruff check audfoo/ tests/
71
- codespell audfoo/ tests/
64
+ uvx ruff check audformat/ tests/
65
+ uvx codespell audformat/ tests/
72
66
 
73
67
 
74
68
  .. _codespell: https://github.com/codespell-project/codespell/
@@ -81,36 +75,26 @@ Building the Documentation
81
75
  --------------------------
82
76
 
83
77
  If you make changes to the documentation,
84
- you can re-create the HTML pages using Sphinx_.
85
- You can install it and a few other necessary packages with::
78
+ you can re-create the HTML pages using Sphinx_::
86
79
 
87
- pip install -r docs/requirements.txt
88
-
89
- To create the HTML pages, use::
90
-
91
- python -m sphinx docs/ build/sphinx/html -b html
80
+ uv run python -m sphinx docs/ build/html -b html
92
81
 
93
82
  The generated files will be available
94
- in the directory :file:`build/sphinx/html/`.
83
+ in the directory :file:`build/html/`.
95
84
 
96
85
  It is also possible to automatically check if all links are still valid::
97
86
 
98
- python -m sphinx docs/ build/sphinx/html -b linkcheck
87
+ uv run python -m sphinx docs/ build/html -b linkcheck
99
88
 
100
- .. _Sphinx: http://sphinx-doc.org
89
+ .. _Sphinx: https://www.sphinx-doc.org
101
90
 
102
91
 
103
92
  Running the Tests
104
93
  -----------------
105
94
 
106
- You'll need pytest_ for that.
107
- It can be installed with::
108
-
109
- pip install -r tests/requirements.txt
110
-
111
- To execute the tests, simply run::
95
+ You can run tests with pytest_::
112
96
 
113
- python -m pytest
97
+ uv run pytest
114
98
 
115
99
  .. _pytest: https://pytest.org
116
100
 
@@ -1,52 +1,26 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: audformat
3
- Version: 1.3.1
3
+ Version: 1.3.3
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>
7
- License: MIT License
8
-
9
- Copyright (c) 2018-present audEERING GmbH and Contributors
10
-
11
- Authors:
12
- Hagen Wierstorf
13
- Johannes Wagner
14
- Christian Geng
15
- Baha Eddine Abrougui
16
-
17
- Permission is hereby granted, free of charge, to any person obtaining a copy
18
- of this software and associated documentation files (the "Software"), to deal
19
- in the Software without restriction, including without limitation the rights
20
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
- copies of the Software, and to permit persons to whom the Software is
22
- furnished to do so, subject to the following conditions:
23
-
24
- The above copyright notice and this permission notice shall be included in all
25
- copies or substantial portions of the Software.
26
-
27
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
- SOFTWARE.
34
-
7
+ License-Expression: MIT
35
8
  Project-URL: repository, https://github.com/audeering/audformat/
36
9
  Project-URL: documentation, https://audeering.github.io/audformat/
37
10
  Keywords: audio,database,annotation
38
11
  Classifier: Development Status :: 5 - Production/Stable
39
12
  Classifier: Intended Audience :: Science/Research
40
13
  Classifier: Intended Audience :: Developers
41
- Classifier: License :: OSI Approved :: MIT License
42
14
  Classifier: Operating System :: OS Independent
43
15
  Classifier: Programming Language :: Python
44
16
  Classifier: Programming Language :: Python :: 3
45
- Classifier: Programming Language :: Python :: 3.9
46
17
  Classifier: Programming Language :: Python :: 3.10
47
18
  Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
48
22
  Classifier: Topic :: Scientific/Engineering
49
- Requires-Python: >=3.9
23
+ Requires-Python: >=3.10
50
24
  Description-Content-Type: text/x-rst
51
25
  License-File: LICENSE
52
26
  Requires-Dist: audeer>=2.0.0
@@ -57,6 +31,7 @@ Requires-Dist: oyaml
57
31
  Requires-Dist: pandas>=2.1.0
58
32
  Requires-Dist: pyarrow>=10.0.1
59
33
  Requires-Dist: pyyaml>=5.4.1
34
+ Dynamic: license-file
60
35
 
61
36
  =========
62
37
  audformat
@@ -1,5 +1,4 @@
1
1
  import os
2
- import typing
3
2
 
4
3
  import audeer
5
4
 
@@ -62,7 +61,7 @@ class Attachment(HeaderBase):
62
61
  @property
63
62
  def files(
64
63
  self,
65
- ) -> typing.List[str]:
64
+ ) -> list[str]:
66
65
  r"""List all files that are part of the attachment.
67
66
 
68
67
  List recursively the relative path
@@ -136,7 +135,7 @@ class Attachment(HeaderBase):
136
135
  or other.path.startswith(self.path)
137
136
  ):
138
137
  raise RuntimeError(
139
- f"Attachments '{self.path}' and '{other.path}' " "are nested."
138
+ f"Attachments '{self.path}' and '{other.path}' are nested."
140
139
  )
141
140
 
142
141
  def _check_path(
@@ -1,5 +1,6 @@
1
- from __future__ import annotations # allow typing without string
1
+ from __future__ import annotations
2
2
 
3
+ import itertools
3
4
  import typing
4
5
  import warnings
5
6
 
@@ -29,7 +30,7 @@ def assert_values(
29
30
  scheme: Scheme,
30
31
  ):
31
32
  r"""Raise error if values do not match scheme."""
32
- bad_values = []
33
+ error_msg = ""
33
34
 
34
35
  if (
35
36
  scheme.labels is not None
@@ -40,29 +41,38 @@ def assert_values(
40
41
  values = [values]
41
42
  elif isinstance(values, pd.Series):
42
43
  values = values.values
43
- elif isinstance(values, np.ndarray):
44
- if scheme.is_numeric:
45
- # Support type object with None entries,
46
- # which need to be converted to NaN
47
- # to support min/max
48
- values = values.astype(float)
49
- values = [
50
- np.nanmin(values),
51
- np.nanmax(values),
52
- ]
53
- # Get unique values and preserve order
54
- values = list(dict.fromkeys(values))
55
- bad_values = [value for value in values if value not in scheme]
56
-
57
- if len(bad_values) > 0:
58
- max_display = 10
59
- values = str(bad_values[:max_display])[1:-1]
60
- if len(bad_values) > max_display:
61
- values += ", ..."
44
+ values = [v for v in values if v is not None and not pd.isna(v)]
45
+ if not values:
46
+ return
47
+
48
+ if scheme.labels is not None:
49
+ bad_values = set(values) - set(scheme.labels_as_list)
50
+ if len(bad_values) > 0:
51
+ # Convert only `max_display` entries from set to list
52
+ max_display = 10
53
+ show_bad_values = sorted(
54
+ [v for v in itertools.islice(bad_values, max_display)]
55
+ )
56
+ error_msg = str(show_bad_values)[1:-1]
57
+ if len(bad_values) > max_display:
58
+ error_msg += ", ..."
59
+ error_msg += "\n"
60
+
61
+ if scheme.is_numeric:
62
+ if scheme.minimum is not None:
63
+ min_value = min(values)
64
+ if float(min_value) < scheme.minimum:
65
+ error_msg += f"minimum {min_value} smaller than scheme minimum\n"
66
+ if scheme.maximum is not None:
67
+ max_value = max(values)
68
+ if float(max_value) > scheme.maximum:
69
+ error_msg += f"maximum {max_value} larger than scheme maximum\n"
70
+
71
+ if error_msg:
62
72
  raise ValueError(
63
73
  f"Some value(s) do not match scheme\n{scheme}\n"
64
74
  f"with scheme ID '{scheme._id}':\n"
65
- f"{values}"
75
+ f"{error_msg}"
66
76
  )
67
77
 
68
78
 
@@ -103,7 +113,7 @@ class Column(HeaderBase):
103
113
  self._id = None
104
114
 
105
115
  @property
106
- def rater(self) -> typing.Optional[Rater]:
116
+ def rater(self) -> Rater | None:
107
117
  r"""Rater object.
108
118
 
109
119
  Returns:
@@ -118,7 +128,7 @@ class Column(HeaderBase):
118
128
  return self.table.db.raters[self.rater_id]
119
129
 
120
130
  @property
121
- def scheme(self) -> typing.Optional[Scheme]:
131
+ def scheme(self) -> Scheme | None:
122
132
  r"""Scheme object.
123
133
 
124
134
  Returns:
@@ -151,7 +161,7 @@ class Column(HeaderBase):
151
161
  as_segmented: bool = False,
152
162
  allow_nat: bool = True,
153
163
  root: str = None,
154
- num_workers: typing.Optional[int] = 1,
164
+ num_workers: int | None = 1,
155
165
  verbose: bool = False,
156
166
  ) -> pd.Series:
157
167
  r"""Get labels.
@@ -239,7 +249,7 @@ class Column(HeaderBase):
239
249
 
240
250
  if not any(labels.values()):
241
251
  raise ValueError(
242
- f"Scheme '{self.scheme_id}' provides no mapping " "for its labels."
252
+ f"Scheme '{self.scheme_id}' provides no mapping for its labels."
243
253
  )
244
254
 
245
255
  # Check that at least one key is available for map
@@ -251,12 +261,7 @@ class Column(HeaderBase):
251
261
  keys = sorted(list(set(keys)))
252
262
  if len(keys) > 0 and map not in keys:
253
263
  raise ValueError(
254
- f"Cannot map "
255
- f"'{self._id}' "
256
- f"to "
257
- f"'{map}'. "
258
- f"Expected one of "
259
- f"{list(keys)}."
264
+ f"Cannot map '{self._id}' to '{map}'. Expected one of {list(keys)}."
260
265
  )
261
266
 
262
267
  mapping = {}
@@ -345,7 +350,7 @@ class Column(HeaderBase):
345
350
  return self.set(values, index=index)
346
351
  else:
347
352
  raise ValueError(
348
- "Cannot set values of a filewise column " "using a segmented index."
353
+ "Cannot set values of a filewise column using a segmented index."
349
354
  )
350
355
  else:
351
356
  if is_scalar(values):
@@ -377,7 +382,7 @@ class Column(HeaderBase):
377
382
 
378
383
  def __eq__(
379
384
  self,
380
- other: "Column",
385
+ other: Column,
381
386
  ) -> bool:
382
387
  r"""Compare if column equals another column."""
383
388
  if self.dump() != other.dump():
@@ -1,8 +1,11 @@
1
+ from __future__ import annotations
2
+
1
3
  from collections import OrderedDict
4
+ from collections.abc import Callable
5
+ from collections.abc import Sequence
2
6
  import inspect
3
7
  import os
4
8
  import textwrap
5
- import typing
6
9
 
7
10
  import oyaml as yaml
8
11
  import pandas as pd
@@ -72,8 +75,8 @@ class HeaderDict(OrderedDict):
72
75
  *args,
73
76
  sort_by_key: bool = True,
74
77
  value_type: type = None,
75
- get_callback: typing.Callable = None,
76
- set_callback: typing.Callable = None,
78
+ get_callback: Callable = None,
79
+ set_callback: Callable = None,
77
80
  **kwargs,
78
81
  ):
79
82
  self.sort_by_key = sort_by_key
@@ -223,7 +226,7 @@ class HeaderBase:
223
226
  def from_dict(
224
227
  self,
225
228
  d: dict,
226
- ignore_keys: typing.Sequence[str] = None,
229
+ ignore_keys: Sequence[str] = None,
227
230
  ):
228
231
  r"""Deserialize object from dictionary.
229
232
 
@@ -267,7 +270,7 @@ class HeaderBase:
267
270
 
268
271
  def __eq__(
269
272
  self,
270
- other: "HeaderBase",
273
+ other: HeaderBase,
271
274
  ) -> bool:
272
275
  return self.dump() == other.dump()
273
276
 
@@ -328,7 +331,7 @@ def series_to_html(self): # pragma: no cover
328
331
  return df.to_html()
329
332
 
330
333
 
331
- def to_audformat_dtype(dtype: typing.Union[str, typing.Type]) -> str:
334
+ def to_audformat_dtype(dtype: str | type) -> str:
332
335
  r"""Convert pandas to audformat dtype."""
333
336
  # bool
334
337
  if pd.api.types.is_bool_dtype(dtype):
@@ -359,7 +362,7 @@ def to_audformat_dtype(dtype: typing.Union[str, typing.Type]) -> str:
359
362
  return define.DataType.OBJECT
360
363
 
361
364
 
362
- def to_pandas_dtype(dtype: str) -> typing.Optional[str]:
365
+ def to_pandas_dtype(dtype: str) -> str | None:
363
366
  r"""Convert audformat to pandas dtype.
364
367
 
365
368
  We use ``"Int64"`` instead of ``"int64"``,
@@ -1,8 +1,13 @@
1
+ from doctest import ELLIPSIS
2
+ from doctest import NORMALIZE_WHITESPACE
1
3
  import os
2
4
  import tempfile
3
5
 
4
6
  import numpy as np
5
7
  import pytest
8
+ import sybil
9
+ from sybil.parsers.rest import DocTestParser
10
+ from sybil.parsers.rest import SkipParser
6
11
 
7
12
  import audiofile
8
13
 
@@ -22,3 +27,14 @@ def prepare_docstring_tests(doctest_namespace):
22
27
  yield
23
28
 
24
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()