audformat 1.4.3__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.
Files changed (93) hide show
  1. {audformat-1.4.3 → audformat-1.4.4}/CHANGELOG.rst +10 -0
  2. {audformat-1.4.3 → audformat-1.4.4}/PKG-INFO +1 -1
  3. audformat-1.4.4/audformat/core/conftest.py +61 -0
  4. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/table.py +13 -7
  5. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/utils.py +2 -2
  6. {audformat-1.4.3 → audformat-1.4.4}/audformat.egg-info/PKG-INFO +1 -1
  7. audformat-1.4.4/audformat.egg-info/scm_version.json +8 -0
  8. {audformat-1.4.3 → audformat-1.4.4}/docs/combine-tables.rst +3 -3
  9. {audformat-1.4.3 → audformat-1.4.4}/docs/conftest.py +9 -5
  10. {audformat-1.4.3 → audformat-1.4.4}/pyproject.toml +7 -0
  11. {audformat-1.4.3 → audformat-1.4.4}/tests/test_common.py +23 -0
  12. {audformat-1.4.3 → audformat-1.4.4}/tests/test_eq.py +1 -1
  13. {audformat-1.4.3 → audformat-1.4.4}/tests/test_misc_table.py +6 -0
  14. {audformat-1.4.3 → audformat-1.4.4}/tests/test_table.py +1 -1
  15. audformat-1.4.3/audformat/core/conftest.py +0 -35
  16. audformat-1.4.3/audformat.egg-info/scm_version.json +0 -8
  17. {audformat-1.4.3 → audformat-1.4.4}/.github/workflows/doc.yml +0 -0
  18. {audformat-1.4.3 → audformat-1.4.4}/.github/workflows/linter.yml +0 -0
  19. {audformat-1.4.3 → audformat-1.4.4}/.github/workflows/publish.yml +0 -0
  20. {audformat-1.4.3 → audformat-1.4.4}/.github/workflows/test.yml +0 -0
  21. {audformat-1.4.3 → audformat-1.4.4}/.gitignore +0 -0
  22. {audformat-1.4.3 → audformat-1.4.4}/.pre-commit-config.yaml +0 -0
  23. {audformat-1.4.3 → audformat-1.4.4}/CONTRIBUTING.rst +0 -0
  24. {audformat-1.4.3 → audformat-1.4.4}/LICENSE +0 -0
  25. {audformat-1.4.3 → audformat-1.4.4}/README.rst +0 -0
  26. {audformat-1.4.3 → audformat-1.4.4}/audformat/__init__.py +0 -0
  27. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/__init__.py +0 -0
  28. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/attachment.py +0 -0
  29. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/column.py +0 -0
  30. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/common.py +0 -0
  31. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/database.py +0 -0
  32. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/define.py +0 -0
  33. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/errors.py +0 -0
  34. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/index.py +0 -0
  35. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/media.py +0 -0
  36. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/rater.py +0 -0
  37. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/scheme.py +0 -0
  38. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/split.py +0 -0
  39. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/testing.py +0 -0
  40. {audformat-1.4.3 → audformat-1.4.4}/audformat/core/typing.py +0 -0
  41. {audformat-1.4.3 → audformat-1.4.4}/audformat/define/__init__.py +0 -0
  42. {audformat-1.4.3 → audformat-1.4.4}/audformat/errors/__init__.py +0 -0
  43. {audformat-1.4.3 → audformat-1.4.4}/audformat/testing/__init__.py +0 -0
  44. {audformat-1.4.3 → audformat-1.4.4}/audformat/utils/__init__.py +0 -0
  45. {audformat-1.4.3 → audformat-1.4.4}/audformat.egg-info/SOURCES.txt +0 -0
  46. {audformat-1.4.3 → audformat-1.4.4}/audformat.egg-info/dependency_links.txt +0 -0
  47. {audformat-1.4.3 → audformat-1.4.4}/audformat.egg-info/requires.txt +0 -0
  48. {audformat-1.4.3 → audformat-1.4.4}/audformat.egg-info/scm_file_list.json +0 -0
  49. {audformat-1.4.3 → audformat-1.4.4}/audformat.egg-info/top_level.txt +0 -0
  50. {audformat-1.4.3 → audformat-1.4.4}/benchmarks/benchmark_hash.py +0 -0
  51. {audformat-1.4.3 → audformat-1.4.4}/benchmarks/benchmark_union.py +0 -0
  52. {audformat-1.4.3 → audformat-1.4.4}/docs/accessing-data.rst +0 -0
  53. {audformat-1.4.3 → audformat-1.4.4}/docs/api/audformat.define.rst +0 -0
  54. {audformat-1.4.3 → audformat-1.4.4}/docs/api/audformat.errors.rst +0 -0
  55. {audformat-1.4.3 → audformat-1.4.4}/docs/api/audformat.rst +0 -0
  56. {audformat-1.4.3 → audformat-1.4.4}/docs/api/audformat.testing.rst +0 -0
  57. {audformat-1.4.3 → audformat-1.4.4}/docs/api/audformat.utils.rst +0 -0
  58. {audformat-1.4.3 → audformat-1.4.4}/docs/api-src/audformat.define.rst +0 -0
  59. {audformat-1.4.3 → audformat-1.4.4}/docs/api-src/audformat.errors.rst +0 -0
  60. {audformat-1.4.3 → audformat-1.4.4}/docs/api-src/audformat.rst +0 -0
  61. {audformat-1.4.3 → audformat-1.4.4}/docs/api-src/audformat.testing.rst +0 -0
  62. {audformat-1.4.3 → audformat-1.4.4}/docs/api-src/audformat.utils.rst +0 -0
  63. {audformat-1.4.3 → audformat-1.4.4}/docs/changelog.rst +0 -0
  64. {audformat-1.4.3 → audformat-1.4.4}/docs/conf.py +0 -0
  65. {audformat-1.4.3 → audformat-1.4.4}/docs/contributing.rst +0 -0
  66. {audformat-1.4.3 → audformat-1.4.4}/docs/create-database.rst +0 -0
  67. {audformat-1.4.3 → audformat-1.4.4}/docs/data-conventions.rst +0 -0
  68. {audformat-1.4.3 → audformat-1.4.4}/docs/data-example.rst +0 -0
  69. {audformat-1.4.3 → audformat-1.4.4}/docs/data-format.rst +0 -0
  70. {audformat-1.4.3 → audformat-1.4.4}/docs/data-header.rst +0 -0
  71. {audformat-1.4.3 → audformat-1.4.4}/docs/data-introduction.rst +0 -0
  72. {audformat-1.4.3 → audformat-1.4.4}/docs/data-misc-tables.rst +0 -0
  73. {audformat-1.4.3 → audformat-1.4.4}/docs/data-tables.rst +0 -0
  74. {audformat-1.4.3 → audformat-1.4.4}/docs/emodb-example.rst +0 -0
  75. {audformat-1.4.3 → audformat-1.4.4}/docs/genindex.rst +0 -0
  76. {audformat-1.4.3 → audformat-1.4.4}/docs/index.rst +0 -0
  77. {audformat-1.4.3 → audformat-1.4.4}/docs/install.rst +0 -0
  78. {audformat-1.4.3 → audformat-1.4.4}/docs/map-scheme.rst +0 -0
  79. {audformat-1.4.3 → audformat-1.4.4}/docs/pics/audformat-database.dot +0 -0
  80. {audformat-1.4.3 → audformat-1.4.4}/docs/pics/audformat-misc-table.dot +0 -0
  81. {audformat-1.4.3 → audformat-1.4.4}/docs/pics/audformat-table.dot +0 -0
  82. {audformat-1.4.3 → audformat-1.4.4}/docs/update-database.rst +0 -0
  83. {audformat-1.4.3 → audformat-1.4.4}/setup.cfg +0 -0
  84. {audformat-1.4.3 → audformat-1.4.4}/tests/conftest.py +0 -0
  85. {audformat-1.4.3 → audformat-1.4.4}/tests/test_attachment.py +0 -0
  86. {audformat-1.4.3 → audformat-1.4.4}/tests/test_column.py +0 -0
  87. {audformat-1.4.3 → audformat-1.4.4}/tests/test_database.py +0 -0
  88. {audformat-1.4.3 → audformat-1.4.4}/tests/test_database_get.py +0 -0
  89. {audformat-1.4.3 → audformat-1.4.4}/tests/test_errors.py +0 -0
  90. {audformat-1.4.3 → audformat-1.4.4}/tests/test_index.py +0 -0
  91. {audformat-1.4.3 → audformat-1.4.4}/tests/test_scheme.py +0 -0
  92. {audformat-1.4.3 → audformat-1.4.4}/tests/test_utils.py +0 -0
  93. {audformat-1.4.3 → audformat-1.4.4}/tests/test_utils_concat.py +0 -0
@@ -7,6 +7,16 @@ 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
+
10
20
  Version 1.4.3 (2026-10-09)
11
21
  --------------------------
12
22
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: audformat
3
- Version: 1.4.3
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>
@@ -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()
@@ -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_, inplace=True, axis="columns")
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, inplace=True)
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="round_trip",
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, inplace=True)
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, inplace=True, level=level)
1739
+ self._df = self.df.drop(index, level=level)
1734
1740
 
1735
1741
  return self
1736
1742
 
@@ -343,7 +343,7 @@ def concat(
343
343
  "right": column[intersection],
344
344
  }
345
345
  )
346
- combine.dropna(inplace=True)
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", inplace=True)
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
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>
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "1.4.4",
3
+ "distance": 0,
4
+ "node": "gb37f1b67002ae5f258945c2f7861f8b276e57044",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-12-01"
8
+ }
@@ -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 NaT NaN 40
100
- audio/002.wav 0 days 00:00:00 NaT NaN 33
101
- audio/003.wav 0 days 00:00:00 NaT NaN 38
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:
@@ -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
- pytest_collect_file = sybil.Sybil(
21
- parsers=parsers,
22
- pattern="*.rst",
23
- fixtures=["tmpdir"],
24
- ).pytest()
23
+ if DOCTESTS_SUPPORTED:
24
+ pytest_collect_file = sybil.Sybil(
25
+ parsers=parsers,
26
+ pattern="*.rst",
27
+ fixtures=["pandas_display", "tmpdir"],
28
+ ).pytest()
@@ -108,6 +108,13 @@ addopts = '''
108
108
  '''
109
109
 
110
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
+
111
118
  # ----- ruff --------------------------------------------------------------
112
119
  #
113
120
  [tool.ruff]
@@ -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
@@ -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.at["string", 0] = "Believe me, I am special!"
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, inplace=True)
1439
+ expected = expected.drop(columns=column)
1440
1440
  pd.testing.assert_frame_equal(result, expected)
1441
1441
 
1442
1442
 
@@ -1,35 +0,0 @@
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 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, contextlib.chdir(tmp):
19
- doctest_namespace["tmp"] = tmp
20
-
21
- # audformat.utils.to_filewise_index()
22
- audiofile.write("f.wav", np.ones((1, 8000)), 8000)
23
-
24
- yield
25
-
26
-
27
- parsers = [
28
- DocTestParser(optionflags=ELLIPSIS + NORMALIZE_WHITESPACE),
29
- SkipParser(),
30
- ]
31
- pytest_collect_file = sybil.Sybil(
32
- parsers=parsers,
33
- pattern="*.py",
34
- fixtures=["prepare_docstring_tests"],
35
- ).pytest()
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "1.4.3",
3
- "distance": 0,
4
- "node": "geb2df689d7a59fcf2ae515c9061c5558e4853bcf",
5
- "dirty": false,
6
- "branch": "HEAD",
7
- "node_date": "2026-10-09"
8
- }
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