hunterHearsPy 1.4.1__tar.gz → 1.4.2__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 (45) hide show
  1. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/PKG-INFO +29 -19
  2. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/README.md +24 -4
  3. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy.egg-info/PKG-INFO +29 -19
  4. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy.egg-info/SOURCES.txt +0 -7
  5. hunterhearspy-1.4.2/hunterHearsPy.egg-info/requires.txt +11 -0
  6. hunterhearspy-1.4.2/hunterHearsPy.egg-info/top_level.txt +1 -0
  7. hunterhearspy-1.4.2/pyproject.toml +290 -0
  8. hunterhearspy-1.4.1/astTransformations/__init__.py +0 -1
  9. hunterhearspy-1.4.1/astTransformations/windowingFunctions.py +0 -109
  10. hunterhearspy-1.4.1/hunterHearsPy.egg-info/requires.txt +0 -23
  11. hunterhearspy-1.4.1/hunterHearsPy.egg-info/top_level.txt +0 -5
  12. hunterhearspy-1.4.1/pyproject.toml +0 -64
  13. hunterhearspy-1.4.1/tests/__init__.py +0 -7
  14. hunterhearspy-1.4.1/tests/_theSSOT.py +0 -8
  15. hunterhearspy-1.4.1/tests/conftest.py +0 -105
  16. hunterhearspy-1.4.1/tests/conftestAnnex.py +0 -38
  17. hunterhearspy-1.4.1/tests/oldSampleData.py +0 -42
  18. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/LICENSE +0 -0
  19. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy/__init__.py +0 -0
  20. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy/_arrays.py +0 -0
  21. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy/_fft.py +0 -0
  22. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy/_io.py +0 -0
  23. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy/_resample.py +0 -0
  24. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy/amplitude.py +0 -0
  25. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy/autoRevert.py +0 -0
  26. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy/clippingArrays.py +0 -0
  27. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy/dataBaskets.py +0 -0
  28. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy/py.typed +0 -0
  29. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy/theSSOT.py +0 -0
  30. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy/theTypes.py +0 -0
  31. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy/windowingFunctions.py +0 -0
  32. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy/windowingFunctionsTensor.py +0 -0
  33. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/hunterHearsPy.egg-info/dependency_links.txt +0 -0
  34. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/setup.cfg +0 -0
  35. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/tests/test_arrays.py +0 -0
  36. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/tests/test_fft.py +0 -0
  37. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/tests/test_io.py +0 -0
  38. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/tests/test_old_amplitude.py +0 -0
  39. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/tests/test_old_autoRevert.py +0 -0
  40. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/tests/test_old_clippingArrays.py +0 -0
  41. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/tests/test_old_spectrogram.py +0 -0
  42. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/tests/test_old_waveform.py +0 -0
  43. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/tests/test_resample.py +0 -0
  44. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/tests/test_windowingFunctions.py +0 -0
  45. {hunterhearspy-1.4.1 → hunterhearspy-1.4.2}/tests/test_windowingFunctionsTensor.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hunterHearsPy
3
- Version: 1.4.1
3
+ Version: 1.4.2
4
4
  Summary: Audio processing.
5
5
  Author-email: Hunter Hogan <HunterHogan@pm.me>
6
6
  Maintainer-email: Hunter Hogan <HunterHogan@pm.me>
@@ -27,26 +27,17 @@ Description-Content-Type: text/markdown
27
27
  License-File: LICENSE
28
28
  Requires-Dist: Z0Z_tools>=4.0.0
29
29
  Requires-Dist: hunterMakesPy>=0.10.0
30
- Requires-Dist: numpy
31
- Requires-Dist: resampy
32
- Requires-Dist: scipy
30
+ Requires-Dist: numpy>=2.0
31
+ Requires-Dist: resampy>=0.4.3
32
+ Requires-Dist: scipy>=1.15
33
33
  Requires-Dist: soundfile>=0.14.0
34
- Requires-Dist: tqdm
34
+ Requires-Dist: tqdm>=4.66
35
35
  Requires-Dist: typing-extensions>=4.0.0
36
- Provides-Extra: development
37
- Requires-Dist: astToolkit; extra == "development"
38
- Requires-Dist: pytest-cov; extra == "development"
39
- Requires-Dist: scipy-stubs; extra == "development"
40
- Requires-Dist: types-resampy; extra == "development"
41
- Provides-Extra: testing
42
- Requires-Dist: pytest; extra == "testing"
43
- Requires-Dist: pytest-mock; extra == "testing"
44
- Requires-Dist: pytest-xdist; extra == "testing"
45
- Requires-Dist: torch; extra == "testing"
46
36
  Provides-Extra: torch
47
37
  Requires-Dist: torch; extra == "torch"
48
38
  Dynamic: license-file
49
39
 
40
+ <!-- path-sync copy -n hunterhogan -->
50
41
  # hunterHearsPy
51
42
 
52
43
  A comprehensive collection of Python utilities for audio processing.
@@ -185,14 +176,33 @@ I don't know a good way to implement user-configurable universal settings. There
185
176
  pip install hunterHearsPy
186
177
  ```
187
178
 
188
- ## My recovery
179
+ ### Contributing
180
+
181
+ The `testing` and `development` [dependency groups](https://peps.python.org/pep-0735/) (pip 25.1
182
+ or newer) are not extras of the published distribution. From a clone of the repository, install the
183
+ tests' requirements and run the tests:
184
+
185
+ ```bash
186
+ pip install -e . --group testing
187
+ pytest
188
+ ```
189
189
 
190
- [![Static Badge](https://img.shields.io/badge/2011_August-Homeless_since-blue?style=flat)](https://HunterThinks.com/support)
190
+ The `development` group includes the `testing` group, and adds the tools and type stubs for
191
+ working on the code:
192
+
193
+ ```bash
194
+ pip install -e . --group development
195
+ ```
196
+
197
+ <!-- === DO_NOT_EDIT: path-sync hunterhogan === -->
198
+ ## My recovery
191
199
 
192
- [![CC-BY-NC-4.0](https://raw.githubusercontent.com/hunterhogan/hunterHearsPy/refs/heads/main/.github/CC-BY-NC-4.0.png)](https://creativecommons.org/licenses/by-nc/4.0/)
200
+ [![2011 August: Homeless since](https://img.shields.io/badge/2011_August-Homeless_since-blue?style=flat)](https://HunterThinks.com/support)
201
+ ![License: CC BY-NC 4.0](https://img.shields.io/badge/license-CC%20BY--NC%204.0-blue.svg)
193
202
 
194
- By law, authors retain their copyrights unless they grant exceptions. The [Attribution-NonCommercial 4.0 International Deed](https://github.com/hunterhogan/hunterHearsPy#License-1-ov-file) outlines how you may use this work.
203
+ By law, authors retain their copyrights unless they grant exceptions. The Creative Commons Attribution-NonCommercial 4.0 International Deed outlines how you may use this work.
195
204
 
196
205
  The restriction on commercial use (without a license) limits advantage-taking, unjust enrichment, and exploitation. You would be morally wrong if you were to enrich yourself by using this work while I am denied healthcare, housing, security of property, and the safety of my person.
197
206
 
198
207
  To obtain and retain the right to use this work, you incur the cost of attributing the work to me. Your nominal cost might accrue as a benefit that mitigates my suffering or saves my life.
208
+ <!-- === OK_EDIT: path-sync hunterhogan === -->
@@ -1,3 +1,4 @@
1
+ <!-- path-sync copy -n hunterhogan -->
1
2
  # hunterHearsPy
2
3
 
3
4
  A comprehensive collection of Python utilities for audio processing.
@@ -136,14 +137,33 @@ I don't know a good way to implement user-configurable universal settings. There
136
137
  pip install hunterHearsPy
137
138
  ```
138
139
 
139
- ## My recovery
140
+ ### Contributing
141
+
142
+ The `testing` and `development` [dependency groups](https://peps.python.org/pep-0735/) (pip 25.1
143
+ or newer) are not extras of the published distribution. From a clone of the repository, install the
144
+ tests' requirements and run the tests:
145
+
146
+ ```bash
147
+ pip install -e . --group testing
148
+ pytest
149
+ ```
140
150
 
141
- [![Static Badge](https://img.shields.io/badge/2011_August-Homeless_since-blue?style=flat)](https://HunterThinks.com/support)
151
+ The `development` group includes the `testing` group, and adds the tools and type stubs for
152
+ working on the code:
153
+
154
+ ```bash
155
+ pip install -e . --group development
156
+ ```
157
+
158
+ <!-- === DO_NOT_EDIT: path-sync hunterhogan === -->
159
+ ## My recovery
142
160
 
143
- [![CC-BY-NC-4.0](https://raw.githubusercontent.com/hunterhogan/hunterHearsPy/refs/heads/main/.github/CC-BY-NC-4.0.png)](https://creativecommons.org/licenses/by-nc/4.0/)
161
+ [![2011 August: Homeless since](https://img.shields.io/badge/2011_August-Homeless_since-blue?style=flat)](https://HunterThinks.com/support)
162
+ ![License: CC BY-NC 4.0](https://img.shields.io/badge/license-CC%20BY--NC%204.0-blue.svg)
144
163
 
145
- By law, authors retain their copyrights unless they grant exceptions. The [Attribution-NonCommercial 4.0 International Deed](https://github.com/hunterhogan/hunterHearsPy#License-1-ov-file) outlines how you may use this work.
164
+ By law, authors retain their copyrights unless they grant exceptions. The Creative Commons Attribution-NonCommercial 4.0 International Deed outlines how you may use this work.
146
165
 
147
166
  The restriction on commercial use (without a license) limits advantage-taking, unjust enrichment, and exploitation. You would be morally wrong if you were to enrich yourself by using this work while I am denied healthcare, housing, security of property, and the safety of my person.
148
167
 
149
168
  To obtain and retain the right to use this work, you incur the cost of attributing the work to me. Your nominal cost might accrue as a benefit that mitigates my suffering or saves my life.
169
+ <!-- === OK_EDIT: path-sync hunterhogan === -->
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hunterHearsPy
3
- Version: 1.4.1
3
+ Version: 1.4.2
4
4
  Summary: Audio processing.
5
5
  Author-email: Hunter Hogan <HunterHogan@pm.me>
6
6
  Maintainer-email: Hunter Hogan <HunterHogan@pm.me>
@@ -27,26 +27,17 @@ Description-Content-Type: text/markdown
27
27
  License-File: LICENSE
28
28
  Requires-Dist: Z0Z_tools>=4.0.0
29
29
  Requires-Dist: hunterMakesPy>=0.10.0
30
- Requires-Dist: numpy
31
- Requires-Dist: resampy
32
- Requires-Dist: scipy
30
+ Requires-Dist: numpy>=2.0
31
+ Requires-Dist: resampy>=0.4.3
32
+ Requires-Dist: scipy>=1.15
33
33
  Requires-Dist: soundfile>=0.14.0
34
- Requires-Dist: tqdm
34
+ Requires-Dist: tqdm>=4.66
35
35
  Requires-Dist: typing-extensions>=4.0.0
36
- Provides-Extra: development
37
- Requires-Dist: astToolkit; extra == "development"
38
- Requires-Dist: pytest-cov; extra == "development"
39
- Requires-Dist: scipy-stubs; extra == "development"
40
- Requires-Dist: types-resampy; extra == "development"
41
- Provides-Extra: testing
42
- Requires-Dist: pytest; extra == "testing"
43
- Requires-Dist: pytest-mock; extra == "testing"
44
- Requires-Dist: pytest-xdist; extra == "testing"
45
- Requires-Dist: torch; extra == "testing"
46
36
  Provides-Extra: torch
47
37
  Requires-Dist: torch; extra == "torch"
48
38
  Dynamic: license-file
49
39
 
40
+ <!-- path-sync copy -n hunterhogan -->
50
41
  # hunterHearsPy
51
42
 
52
43
  A comprehensive collection of Python utilities for audio processing.
@@ -185,14 +176,33 @@ I don't know a good way to implement user-configurable universal settings. There
185
176
  pip install hunterHearsPy
186
177
  ```
187
178
 
188
- ## My recovery
179
+ ### Contributing
180
+
181
+ The `testing` and `development` [dependency groups](https://peps.python.org/pep-0735/) (pip 25.1
182
+ or newer) are not extras of the published distribution. From a clone of the repository, install the
183
+ tests' requirements and run the tests:
184
+
185
+ ```bash
186
+ pip install -e . --group testing
187
+ pytest
188
+ ```
189
189
 
190
- [![Static Badge](https://img.shields.io/badge/2011_August-Homeless_since-blue?style=flat)](https://HunterThinks.com/support)
190
+ The `development` group includes the `testing` group, and adds the tools and type stubs for
191
+ working on the code:
192
+
193
+ ```bash
194
+ pip install -e . --group development
195
+ ```
196
+
197
+ <!-- === DO_NOT_EDIT: path-sync hunterhogan === -->
198
+ ## My recovery
191
199
 
192
- [![CC-BY-NC-4.0](https://raw.githubusercontent.com/hunterhogan/hunterHearsPy/refs/heads/main/.github/CC-BY-NC-4.0.png)](https://creativecommons.org/licenses/by-nc/4.0/)
200
+ [![2011 August: Homeless since](https://img.shields.io/badge/2011_August-Homeless_since-blue?style=flat)](https://HunterThinks.com/support)
201
+ ![License: CC BY-NC 4.0](https://img.shields.io/badge/license-CC%20BY--NC%204.0-blue.svg)
193
202
 
194
- By law, authors retain their copyrights unless they grant exceptions. The [Attribution-NonCommercial 4.0 International Deed](https://github.com/hunterhogan/hunterHearsPy#License-1-ov-file) outlines how you may use this work.
203
+ By law, authors retain their copyrights unless they grant exceptions. The Creative Commons Attribution-NonCommercial 4.0 International Deed outlines how you may use this work.
195
204
 
196
205
  The restriction on commercial use (without a license) limits advantage-taking, unjust enrichment, and exploitation. You would be morally wrong if you were to enrich yourself by using this work while I am denied healthcare, housing, security of property, and the safety of my person.
197
206
 
198
207
  To obtain and retain the right to use this work, you incur the cost of attributing the work to me. Your nominal cost might accrue as a benefit that mitigates my suffering or saves my life.
208
+ <!-- === OK_EDIT: path-sync hunterhogan === -->
@@ -1,8 +1,6 @@
1
1
  LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
- astTransformations/__init__.py
5
- astTransformations/windowingFunctions.py
6
4
  hunterHearsPy/__init__.py
7
5
  hunterHearsPy/_arrays.py
8
6
  hunterHearsPy/_fft.py
@@ -22,11 +20,6 @@ hunterHearsPy.egg-info/SOURCES.txt
22
20
  hunterHearsPy.egg-info/dependency_links.txt
23
21
  hunterHearsPy.egg-info/requires.txt
24
22
  hunterHearsPy.egg-info/top_level.txt
25
- tests/__init__.py
26
- tests/_theSSOT.py
27
- tests/conftest.py
28
- tests/conftestAnnex.py
29
- tests/oldSampleData.py
30
23
  tests/test_arrays.py
31
24
  tests/test_fft.py
32
25
  tests/test_io.py
@@ -0,0 +1,11 @@
1
+ Z0Z_tools>=4.0.0
2
+ hunterMakesPy>=0.10.0
3
+ numpy>=2.0
4
+ resampy>=0.4.3
5
+ scipy>=1.15
6
+ soundfile>=0.14.0
7
+ tqdm>=4.66
8
+ typing-extensions>=4.0.0
9
+
10
+ [torch]
11
+ torch
@@ -0,0 +1 @@
1
+ hunterHearsPy
@@ -0,0 +1,290 @@
1
+ # path-sync copy -n hunterhogan
2
+ [project]
3
+ name = "hunterHearsPy"
4
+ version = "1.4.2"
5
+ description = "Audio processing."
6
+ readme = "README.md"
7
+ requires-python = ">=3.12"
8
+ license = "CC-BY-NC-4.0"
9
+ license-files = ["LICEN[CS]E*"]
10
+ authors = [{ name = "Hunter Hogan", email = "HunterHogan@pm.me" }]
11
+ maintainers = [{ name = "Hunter Hogan", email = "HunterHogan@pm.me" }]
12
+ keywords = []
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Environment :: Console",
16
+ "Intended Audience :: Developers",
17
+ "Intended Audience :: Science/Research",
18
+ "Natural Language :: English",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Programming Language :: Python :: 3.14",
23
+ "Programming Language :: Python :: 3.15",
24
+ "Typing :: Typed",
25
+ ]
26
+ dependencies = [
27
+ "Z0Z_tools>=4.0.0",
28
+ "hunterMakesPy>=0.10.0",
29
+ "numpy>=2.0",
30
+ "resampy>=0.4.3",
31
+ "scipy>=1.15",
32
+ "soundfile>=0.14.0",
33
+ "tqdm>=4.66",
34
+ "typing-extensions>=4.0.0",
35
+ ]
36
+ optional-dependencies = { torch = ["torch"] }
37
+
38
+ [project.urls]
39
+ Context7 = "https://context7.com/hunterhogan/hunterhearspy"
40
+ Donate = "https://www.patreon.com/integrated"
41
+ Download = "https://pypi.org/project/hunterHearsPy"
42
+ Homepage = "https://github.com/hunterhogan/hunterHearsPy"
43
+ Issues = "https://github.com/hunterhogan/hunterHearsPy/issues"
44
+ Repository = "https://github.com/hunterhogan/hunterHearsPy.git"
45
+
46
+ [dependency-groups]
47
+ development = ["astToolkit", "pytest-cov", "scipy-stubs", "types-resampy", "types-tqdm", { include-group = "testing" }]
48
+ testing = ["pytest", "pytest-mock", "pytest-xdist", "torch"]
49
+
50
+ [build-system]
51
+ requires = ["setuptools>=77.0.1"]
52
+ build-backend = "setuptools.build_meta"
53
+
54
+ [tool.coverage]
55
+ report = { exclude_lines = ["if TYPE_CHECKING:", "if __name__ == \"__main__\":"], ignore_errors = false }
56
+ run = { branch = true, concurrency = ["multiprocessing"], data_file = "tests/coverage/.coverage", omit = ["tests/*"], parallel = true, source = ["."] }
57
+
58
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
59
+ [tool.isort]
60
+ add_imports = ["from __future__ import annotations"]
61
+ append_only = true
62
+ atomic = true
63
+ combine_as_imports = true
64
+ extend_skip_glob = ["*.pyi"]
65
+ filter_files = true
66
+ force_alphabetical_sort_within_sections = true
67
+ from_first = true
68
+ honor_noqa = true
69
+ indent = "\t"
70
+ line_length = 140
71
+ lines_after_imports = 1
72
+ lines_between_types = 0
73
+ multi_line_output = 4
74
+ no_sections = true
75
+ skip_gitignore = true
76
+ use_parentheses = true
77
+ # === OK_EDIT: path-sync hunterhogan ===
78
+
79
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
80
+ [tool.pyrefly]
81
+ enabled-ignores = ["pyrefly"]
82
+ # ignore-errors-in-generated-code = true
83
+ infer-with-first-use = false
84
+ preset = "strict"
85
+ python-platform = "all"
86
+ # === OK_EDIT: path-sync hunterhogan ===
87
+
88
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
89
+ [tool.pyrefly.errors]
90
+ bad-return = "warn"
91
+ invalid-yield = "warn"
92
+ # === OK_EDIT: path-sync hunterhogan ===
93
+
94
+ [tool.pytest]
95
+ addopts = ["--color=auto", "--tb=line", "-n", "4"]
96
+ log_auto_indent = "On"
97
+ testpaths = ["tests"]
98
+
99
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
100
+ [tool.ruff]
101
+ line-length = 140
102
+ # === OK_EDIT: path-sync hunterhogan ===
103
+
104
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
105
+ [tool.ruff.lint]
106
+ allowed-confusables = ["–", "’", "′", "×", "−", "∖", "∗", "∣", "∨", "∪", "∼", "⊗", "ℂ", "ℋ", "ℒ", "ℓ", "ℕ", "ℙ", "ℚ", "ℝ", "ℤ", "ℰ", "ℱ", "𝒪", "𝒮", "𝔼", "𝕀", "𝟙", "α", "Β", "γ", "ι", "Κ", "ν", "ο", "ρ", "σ"]
107
+ future-annotations = true
108
+ ignore = [
109
+ # ====== Linters ===========
110
+ "FIX", # flake8-fixme
111
+ "I", # isort
112
+ "N", # pep8-naming
113
+ "TD", # flake8-todos
114
+ # ====== complexity ========
115
+ "dict-index-missing-items",
116
+ "explicit-f-string-type-conversion",
117
+ "non-pep695-type-alias",
118
+ "redundant-numeric-union",
119
+ "static-join-to-f-string",
120
+ "unnecessary-literal-dict",
121
+ "useless-import-alias",
122
+ # ====== correctness =======
123
+ "unused-variable",
124
+ # ====== formatting ========
125
+ "bad-quotes-inline-string",
126
+ "blank-lines-after-function-or-class",
127
+ "blank-lines-top-level",
128
+ "docstring-tab-indentation",
129
+ "incorrect-blank-line-after-class",
130
+ "line-too-long",
131
+ "missing-newline-at-end-of-file",
132
+ "missing-trailing-comma",
133
+ "no-space-after-block-comment",
134
+ "tab-indentation",
135
+ "too-many-blank-lines",
136
+ # ====== pedantic ==========
137
+ "any-type",
138
+ "blanket-noqa",
139
+ "docstring-in-stub",
140
+ "docstring-missing-exception",
141
+ "docstring-missing-returns",
142
+ "docstring-missing-yields",
143
+ "if-else-block-instead-of-if-exp",
144
+ "incorrect-section-order",
145
+ "magic-value-comparison",
146
+ "missing-copyright-notice",
147
+ "missing-trailing-period",
148
+ "non-ascii-import-name",
149
+ "non-ascii-name",
150
+ "non-imperative-mood",
151
+ "redefined-loop-name",
152
+ "superfluous-else-continue",
153
+ "superfluous-else-return",
154
+ "too-many-arguments",
155
+ "too-many-branches",
156
+ "too-many-locals",
157
+ "too-many-nested-blocks",
158
+ "too-many-positional-arguments",
159
+ "too-many-public-methods",
160
+ "too-many-statements",
161
+ "typed-argument-default-in-stub",
162
+ "yoda-conditions",
163
+ # ====== restriction =======
164
+ "complex-structure",
165
+ # ====== security ==========
166
+ "subprocess-without-shell-equals-true",
167
+ "suspicious-pickle-import",
168
+ # ====== style =============
169
+ "snake-case-type-alias",
170
+ "type-name-incorrect-variance",
171
+ # ====== suspicious ========
172
+ "self-or-cls-assignment",
173
+ "subclass-builtin",
174
+ "unused-import",
175
+ "useless-else-on-loop",
176
+ ]
177
+ preview = true
178
+ select = ["ALL"]
179
+ extend-select = ["missing-terminal-punctuation", "undocumented-param", "undocumented-public-init"]
180
+ task-tags = ["DEVELOPMENT", "NOTE", "SEMIOTICS", "TODO"]
181
+ # === OK_EDIT: path-sync hunterhogan ===
182
+
183
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
184
+ [tool.ruff.lint.flake8-comprehensions]
185
+ allow-dict-calls-with-keyword-arguments = true
186
+ # === OK_EDIT: path-sync hunterhogan ===
187
+
188
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
189
+ [tool.ruff.lint.flake8-import-conventions]
190
+ banned-aliases = { altair = ["alt"], datetime = ["dt"], holoviews = ["hv"], matplotlib = ["mpl"], "matplotlib.pyplot" = ["plt"], networkx = ["nx"], numpy = ["np"], "numpy.typing" = ["npt"], optype = ["op"], pandas = ["pd"], panel = ["pn"], "plotly.express" = ["px"], polars = ["pl"], pyarrow = ["pa"], regex = ["re"], seaborn = ["sns"], tensorflow = ["tf"], tkinter = ["tk"], "xml.etree.ElementTree" = ["ET"] }
191
+ # === OK_EDIT: path-sync hunterhogan ===
192
+
193
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
194
+ [tool.ruff.lint.flake8-import-conventions.aliases]
195
+ "accelerate.utils.dataclasses" = "accelerate_dataclasses"
196
+ "fs.path" = "fs_path"
197
+ "gmpy2.bit_test" = "isBit1吗"
198
+ "gmpy2.is_even" = "isEven吗"
199
+ "gmpy2.is_odd" = "isOdd吗"
200
+ "humpy_cytoolz.assoc" = "associateKeyValue"
201
+ "humpy_cytoolz.curry" = "syntacticCurry"
202
+ "humpy_cytoolz.groupby" = "toolz_groupby"
203
+ "itertools.product" = "CartesianProduct"
204
+ "math.comb" = "nCr"
205
+ "more_itertools.all_unique" = "allUnique吗"
206
+ "regex" = "regex"
207
+ "scipy" = "scipy"
208
+ "sympy.binomial" = "sympy_binomial"
209
+ "sympy.catalan" = "sympy_catalan"
210
+ "sympy.functions.combinatorial.factorials.binomial" = "sympy_binomial"
211
+ "sympy.functions.combinatorial.numbers.catalan" = "sympy_catalan"
212
+ "sympy" = "sympy"
213
+ "torch.autograd.grad" = "torch_grad"
214
+ "torch.nn.functional" = "F"
215
+ "torch.nn.parallel.DistributedDataParallel" = "DDP"
216
+ numpy = "numpy"
217
+ pandas = "pandas"
218
+ polars = "polars"
219
+ re = "regex"
220
+ # === OK_EDIT: path-sync hunterhogan ===
221
+
222
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
223
+ [tool.ruff.lint.flake8-quotes]
224
+ inline-quotes = "single"
225
+ # === OK_EDIT: path-sync hunterhogan ===
226
+
227
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
228
+ [tool.ruff.lint.per-file-ignores]
229
+ "**/*_test.py" = ["ARG", "assert", "BLE", "D", "DTZ", "FBT", "PT", "suspicious-non-cryptographic-random-usage", "TRY"]
230
+ "**/conftest*.py" = ["ARG", "assert", "BLE", "D", "DTZ", "FBT", "PT", "suspicious-non-cryptographic-random-usage", "TRY"]
231
+ "**/test_*.py" = ["ARG", "assert", "BLE", "D", "DTZ", "FBT", "PT", "suspicious-non-cryptographic-random-usage", "TRY"]
232
+ "**/tests/**" = ["ARG", "assert", "BLE", "D", "DTZ", "FBT", "PT", "suspicious-non-cryptographic-random-usage", "TRY"]
233
+ # === OK_EDIT: path-sync hunterhogan ===
234
+
235
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
236
+ [tool.ruff.lint.pydocstyle]
237
+ convention = "numpy"
238
+ # === OK_EDIT: path-sync hunterhogan ===
239
+
240
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
241
+ [tool.ruff.format]
242
+ docstring-code-format = true
243
+ indent-style = "tab"
244
+ line-ending = "lf"
245
+ nested-string-quote-style = "preferred"
246
+ quote-style = "single"
247
+ skip-magic-trailing-comma = true
248
+ # === OK_EDIT: path-sync hunterhogan ===
249
+
250
+ [tool.setuptools]
251
+ package-data = { "*" = ["py.typed"] }
252
+ packages = { find = { include = ["hunterHearsPy", "hunterHearsPy.*"], namespaces = false } }
253
+
254
+ # To fill `typings/` with these stubs, run this in this folder: uv run https://raw.githubusercontent.com/hunterhogan/stubFileNotFound/main/stubFileNotFound/installStubs.py
255
+ [tool.stubFileNotFound]
256
+ stubs = ["soundfile"]
257
+
258
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
259
+ [tool.tombi.format.rules]
260
+ line-ending = "lf"
261
+ # === OK_EDIT: path-sync hunterhogan ===
262
+
263
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
264
+ [tool.ty.analysis]
265
+ respect-type-ignore-comments = false
266
+ return-type-inference = "always"
267
+ # === OK_EDIT: path-sync hunterhogan ===
268
+
269
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
270
+ [tool.ty.environment]
271
+ extra-paths = ["./typings"]
272
+ python-platform = "all"
273
+ # === OK_EDIT: path-sync hunterhogan ===
274
+
275
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
276
+ [tool.ty.rules]
277
+ blanket-ignore-comment = "error"
278
+ missing-override-decorator = "error"
279
+ missing-type-argument = "error"
280
+ possibly-missing-attribute = "warn" # Might annoy you: ty's docs say this rule produces many false positives.
281
+ possibly-unresolved-reference = "warn" # Might annoy you: ty's docs say this rule produces many false positives.
282
+ truthiness-test-of-none-union = "warn" # Might annoy you: flags `if value:` on `int | None` or `str | None` even when treating 0 or '' like None is deliberate.
283
+ # === OK_EDIT: path-sync hunterhogan ===
284
+
285
+ [tool.updateCitation]
286
+ filenameCitationDOTcff = "CITATION.cff"
287
+ pathFilenameCitationSSOT = "citations/CITATION.cff"
288
+
289
+ [tool.wheelTest]
290
+ modulesOptional = { "hunterHearsPy.windowingFunctionsTensor" = "torch" }
@@ -1 +0,0 @@
1
- # ruff:ignore[undocumented-public-package]
@@ -1,109 +0,0 @@
1
- """Generate PyTorch tensor windowing functions from NumPy windowing functions.
2
-
3
- This module programmatically creates PyTorch tensor versions of windowing functions by transforming
4
- existing functions from the `windowingFunctions` module. It generates functions that return PyTorch
5
- tensors instead of NumPy arrays.
6
- """
7
- from __future__ import annotations
8
-
9
- from astToolkit import Be, Make, NodeTourist, Then
10
- from astToolkit.changeDef import makeDictionaryFunctionDef
11
- from astToolkit.filesystem import parseLogicalPath2astModule, write_astModule
12
- from hunterHearsPy.theSSOT import settingsPackage
13
- from hunterMakesPy import raiseIfNone
14
- from typing import TYPE_CHECKING
15
- import ast
16
-
17
- if TYPE_CHECKING:
18
- from pathlib import Path
19
-
20
- moduleDestination = 'windowingFunctionsTensor'
21
- moduleSource = 'windowingFunctions'
22
-
23
- pathFilenameDestination: Path = settingsPackage.pathPackage / (moduleDestination + settingsPackage.fileExtension)
24
- pathFilenameSource: Path = pathFilenameDestination.with_stem(moduleSource)
25
-
26
- def make_windowingFunctionsTensor() -> None:
27
- """Generate PyTorch tensor windowing functions from NumPy windowing functions."""
28
- listImports: list[ast.stmt] = [Make.ImportFrom('__future__', [Make.alias('annotations')])
29
- , Make.ImportFrom('typing', [Make.alias('TYPE_CHECKING')])]
30
- listBody: list[ast.stmt] = []
31
-
32
- listBody.append(Make.If(test=Make.Name('TYPE_CHECKING') # ruff: ignore[repeated-append]
33
- , body=[Make.ImportFrom('torch.types', [Make.alias('Device')])
34
- , Make.ImportFrom('typing', [Make.alias('Any')])
35
- , Make.ImportFrom(settingsPackage.identifierPackage + '.theTypes', [Make.alias('callableReturnsNDArray')])
36
- ]))
37
- listBody.append(Make.FunctionDef(
38
- '_convertToTensor'
39
- , Make.arguments(vararg=Make.arg('arguments', annotation=Make.Name('Any'))
40
- , kwonlyargs=[Make.arg('callableTarget', annotation=Make.Name('callableReturnsNDArray'))
41
- , Make.arg('device', annotation=Make.BitOr.join([Make.Name('Device'), Make.Constant(None)]))
42
- , Make.arg('dtype', annotation=Make.BitOr.join([Make.Attribute(Make.Name('torch'), 'dtype'), Make.Constant(None)]))]
43
- , kw_defaults=[None, Make.Constant(None), Make.Constant(None)]
44
- , kwarg=Make.arg('keywordArguments', annotation=Make.Name('Any'))
45
- )
46
- , body=[Make.Assign([Make.Name('arrayTarget', ast.Store())]
47
- , value=Make.Call(Make.Name('callableTarget')
48
- , listParameters=[Make.Starred(value=Make.Name('arguments'))]
49
- , list_keyword=[Make.keyword(None, value=Make.Name('keywordArguments'))])
50
- )
51
- , Make.If(test=Make.Compare(left=Make.Name('device'), ops=[Make.Is()], comparators=[Make.Constant(None)])
52
- , body=[Make.Assign([Make.Name('device', ast.Store())], value=Make.Call(Make.Attribute(Make.Name('torch'), 'device'), list_keyword=[Make.keyword('device', value=Make.Constant('cpu'))]))]
53
- )
54
- , Make.Return(Make.Call(Make.Attribute(Make.Name('torch'), 'tensor'), list_keyword=[
55
- Make.keyword('data', value=Make.Name('arrayTarget'))
56
- , Make.keyword('dtype', value=Make.Or.join([Make.Name('dtype'), Make.Attribute(Make.Name('torch'), 'float32')]))
57
- , Make.keyword('device', value=Make.Name('device'))
58
- ]))
59
- ]
60
- , returns=Make.Attribute(Make.Name('torch'), 'Tensor')
61
- ))
62
-
63
- dictionaryFunctionDef: dict[str, ast.FunctionDef] = makeDictionaryFunctionDef(parseLogicalPath2astModule('.'.join([settingsPackage.identifierPackage, moduleSource])))
64
-
65
- ImaIndent: str = ' ' * 4
66
- ImaReturnsSection: str = f"\n{ImaIndent}Returns"
67
- docstringDevice: str = f"{ImaIndent}device : Device = torch.device(device='cpu')\n{ImaIndent}{ImaIndent}PyTorch device for `Tensor`.\n"
68
- docstringDtype: str = f"{ImaIndent}dtype : torch.dtype = torch.float32\n{ImaIndent}{ImaIndent}PyTorch data type for `Tensor`.\n"
69
-
70
- for callableIdentifier, astFunctionDef in dictionaryFunctionDef.items():
71
- if callableIdentifier.startswith('_'):
72
- continue
73
-
74
- docstring: ast.Expr = Make.Expr(Make.Constant(
75
- raiseIfNone(ast.get_docstring(astFunctionDef, clean=False), errorMessage="Where's the windowing function docstring?")
76
- .replace('\t', ImaIndent).replace(ImaReturnsSection, docstringDevice + docstringDtype + ImaReturnsSection)))
77
-
78
- listImports.append(Make.ImportFrom(settingsPackage.identifierPackage, [Make.alias(callableIdentifier)]))
79
-
80
- argumentSpecification: ast.arguments = raiseIfNone(NodeTourist(Be.arguments, Then.extractIt).captureLastMatch(astFunctionDef))
81
- args: list[ast.expr] = [Make.Name(ast_arg.arg) for ast_arg in [*argumentSpecification.args, *argumentSpecification.kwonlyargs]]
82
-
83
- list_keyword: list[ast.keyword] = [Make.keyword('callableTarget', Make.Name(callableIdentifier))
84
- , Make.keyword('device', Make.Name('device'))
85
- , Make.keyword('dtype', Make.Name('dtype'))]
86
- if argumentSpecification.kwarg:
87
- list_keyword.append(Make.keyword(None, value=Make.Name(argumentSpecification.kwarg.arg)))
88
-
89
- argumentSpecification.args.append(Make.arg('device', annotation=Make.BitOr.join([Make.Name('Device'), Make.Constant(None)])))
90
- argumentSpecification.defaults.append(Make.Constant(None))
91
- argumentSpecification.args.append(Make.arg('dtype', annotation=Make.BitOr.join([Make.Attribute(Make.Name('torch'), 'dtype'), Make.Constant(None)])))
92
- argumentSpecification.defaults.append(Make.Constant(None))
93
-
94
- listBody.append(Make.FunctionDef(callableIdentifier + 'Tensor'
95
- , argumentSpecification
96
- , body=[docstring
97
- , Make.Return(Make.Call(Make.Name('_convertToTensor'), listParameters=args, list_keyword=list_keyword))]
98
- , returns=Make.Attribute(Make.Name('torch'), 'Tensor')
99
- ))
100
-
101
- listImports.append(Make.Import('torch'))
102
-
103
- docstringModule = Make.Expr(Make.Constant("""Create PyTorch tensor windowing functions."""))
104
- astModule = Make.Module(body=[docstringModule, *listImports, *listBody])
105
-
106
- write_astModule(astModule, pathFilenameDestination, identifierPackage=settingsPackage.identifierPackage)
107
-
108
- if __name__ == '__main__':
109
- make_windowingFunctionsTensor()
@@ -1,23 +0,0 @@
1
- Z0Z_tools>=4.0.0
2
- hunterMakesPy>=0.10.0
3
- numpy
4
- resampy
5
- scipy
6
- soundfile>=0.14.0
7
- tqdm
8
- typing-extensions>=4.0.0
9
-
10
- [development]
11
- astToolkit
12
- pytest-cov
13
- scipy-stubs
14
- types-resampy
15
-
16
- [testing]
17
- pytest
18
- pytest-mock
19
- pytest-xdist
20
- torch
21
-
22
- [torch]
23
- torch
@@ -1,5 +0,0 @@
1
- astTransformations
2
- citations
3
- dist
4
- hunterHearsPy
5
- tests
@@ -1,64 +0,0 @@
1
- [project]
2
- name = "hunterHearsPy"
3
- version = "1.4.1"
4
- description = "Audio processing."
5
- readme = "README.md"
6
- requires-python = ">=3.12"
7
- license = "CC-BY-NC-4.0"
8
- license-files = ["LICEN[CS]E*"]
9
- authors = [{ name = "Hunter Hogan", email = "HunterHogan@pm.me" }]
10
- maintainers = [{ name = "Hunter Hogan", email = "HunterHogan@pm.me" }]
11
- keywords = []
12
- classifiers = [
13
- "Development Status :: 4 - Beta",
14
- "Environment :: Console",
15
- "Intended Audience :: Developers",
16
- "Intended Audience :: Science/Research",
17
- "Natural Language :: English",
18
- "Operating System :: OS Independent",
19
- "Programming Language :: Python :: 3.12",
20
- "Programming Language :: Python :: 3.13",
21
- "Programming Language :: Python :: 3.14",
22
- "Programming Language :: Python :: 3.15",
23
- "Typing :: Typed",
24
- ]
25
- dependencies = [
26
- "Z0Z_tools>=4.0.0",
27
- "hunterMakesPy>=0.10.0",
28
- "numpy",
29
- "resampy",
30
- "scipy",
31
- "soundfile>=0.14.0",
32
- "tqdm",
33
- "typing-extensions>=4.0.0",
34
- ]
35
- optional-dependencies = { development = ["astToolkit", "pytest-cov", "scipy-stubs", "types-resampy"], testing = ["pytest", "pytest-mock", "pytest-xdist", "torch"], torch = ["torch"] }
36
-
37
- [project.urls]
38
- Context7 = "https://context7.com/hunterhogan/hunterhearspy"
39
- Donate = "https://www.patreon.com/integrated"
40
- Download = "https://pypi.org/project/hunterHearsPy"
41
- Homepage = "https://github.com/hunterhogan/hunterHearsPy"
42
- Issues = "https://github.com/hunterhogan/hunterHearsPy/issues"
43
- Repository = "https://github.com/hunterhogan/hunterHearsPy.git"
44
-
45
- [build-system]
46
- requires = ["setuptools"]
47
- build-backend = "setuptools.build_meta"
48
-
49
- [tool.coverage]
50
- report = { exclude_lines = ["if TYPE_CHECKING:", "if __name__ == \"__main__\":"], ignore_errors = false }
51
- run = { branch = true, concurrency = ["multiprocessing"], data_file = "tests/coverage/.coverage", omit = ["tests/*"], parallel = true, source = ["."] }
52
-
53
- [tool.pytest]
54
- addopts = ["--color=auto", "--tb=line", "-n", "4"]
55
- log_auto_indent = "On"
56
- testpaths = ["tests"]
57
-
58
- [tool.setuptools]
59
- package-data = { "*" = ["py.typed"]}
60
- packages = { find = {} }
61
-
62
- [tool.updateCitation]
63
- filenameCitationDOTcff = "CITATION.cff"
64
- pathFilenameCitationSSOT = "citations/CITATION.cff"
@@ -1,7 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from tests._theSSOT import (
4
- dtypeTokens as dtypeTokens, pathDataSamples as pathDataSamples, pathDataSamplesExpected as pathDataSamplesExpected)
5
- from tests.conftestAnnex import (
6
- assert_allclose as assert_allclose, assert_approx as assert_approx, assert_array_equal as assert_array_equal,
7
- assertEqualTo as assertEqualTo, messageTestFailure as messageTestFailure, messageTestFailure_ndarray as messageTestFailure_ndarray)
@@ -1,8 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from pathlib import Path
4
-
5
- pathDataSamples = Path('tests/dataSamples')
6
- pathDataSamplesExpected: Path = pathDataSamples / 'expected'
7
-
8
- dtypeTokens: frozenset[str] = frozenset(('int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float16', 'float32', 'float64', 'complex64', 'complex128'))
@@ -1,105 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from hashlib import blake2b
4
- from humpy_cytoolz.dicttoolz import keyfilter, merge
5
- from hunterHearsPy import loadWaveforms, readAudioFile
6
- from hunterMakesPy.dataStructures import stringItUp
7
- from more_itertools import one
8
- from soundfile import dtype_str as Options_dtype_str
9
- from tests import pathDataSamples, pathDataSamplesExpected
10
- from typing import cast, TYPE_CHECKING
11
- import inspect
12
- import numpy
13
- import operator
14
- import pytest
15
-
16
- if TYPE_CHECKING:
17
- from collections.abc import Sequence
18
- from hunterHearsPy.theTypes import ArrayWaveforms, Waveform, 形ndarray
19
- from inspect import Parameter
20
- from pathlib import Path
21
- from pytest import FixtureRequest
22
- from torch.types import Device
23
- from types import MappingProxyType
24
-
25
- # ================== Test-function parameters ======================================================
26
-
27
- @pytest.fixture()
28
- def approx_abs(request: FixtureRequest) -> float:
29
- """The `abs` (***abs***olute tolerance) parameter value for `pytest.approx`."""
30
- return 1e-12
31
-
32
- @pytest.fixture()
33
- def approx_rel(request: FixtureRequest) -> float:
34
- """The `rel` (***rel***ative tolerance) parameter value for `pytest.approx`."""
35
- return 1e-6
36
-
37
- @pytest.fixture()
38
- def atol(request: FixtureRequest) -> float:
39
- """The `atol` (***a***bsolute ***tol***erance) parameter value for `numpy.allclose`."""
40
- return 1e-08
41
-
42
- @pytest.fixture()
43
- def expected(request: FixtureRequest) -> 形ndarray:
44
- """Test-function and its parameters encoded in a `__` delimited filename.
45
-
46
- Each parameter created with `parametrize` (as opposed to, for example, `fixture`) is encoded as `{parameter}~{value}`.
47
- """
48
- request_nodeParameters: MappingProxyType[str, Parameter] = cast('MappingProxyType[str, Parameter]', request.node.callspec.params) # pyright: ignore[reportUnknownVariableType, reportUnknownMemberType]
49
- filenameStem: str = '__'.join((
50
- str(request.function.__name__).removeprefix('test_')
51
- , *(f'{keyAndValue[0]}~{"".join(stringItUp(keyAndValue[1]) or ["None"])}'
52
- for keyAndValue in keyfilter(request_nodeParameters.keys().__contains__, merge(inspect.signature(request.function).parameters, request_nodeParameters)).items()
53
- )))
54
- if 251 < len(filenameStem):
55
- filenameStem = f'{str(request.function.__name__).removeprefix("test_")}__blake2b~{blake2b(filenameStem.encode(), digest_size=16).hexdigest()}'
56
- pathFilename: Path = pathDataSamplesExpected / f'{filenameStem}.npz'
57
- with numpy.load(pathFilename, allow_pickle=False) as archiveExpected:
58
- return archiveExpected['expected']
59
-
60
- @pytest.fixture()
61
- def rtol(request: FixtureRequest) -> float:
62
- """The `rtol` (***r***elative ***tol***erance) parameter value for `numpy.allclose`."""
63
- return 1e-05
64
-
65
- # ================== Parameter values to test against the package's `Callable` =====================
66
-
67
- @pytest.fixture()
68
- def arrayTarget(request: FixtureRequest) -> Waveform | ArrayWaveforms:
69
- return cast('Waveform | ArrayWaveforms', request.getfixturevalue(getattr(request, 'param', 'waveform')))
70
-
71
- @pytest.fixture()
72
- def arrayWaveforms(listPathFilenames: tuple[Path, ...], CPUlimit: bool | float | int | None) -> ArrayWaveforms:
73
- return loadWaveforms(listPathFilenames, CPUlimit=CPUlimit).array
74
-
75
- @pytest.fixture()
76
- def CPUlimit(request: FixtureRequest) -> int:
77
- return 1
78
-
79
- @pytest.fixture(params=tuple(map(pytest.param, (None, 'cpu'))))
80
- def device(request: FixtureRequest) -> Device | None:
81
- return request.param
82
-
83
- @pytest.fixture()
84
- def dtype_str(pathFilename: Path) -> Options_dtype_str | None:
85
- return one(set(Options_dtype_str.__args__).intersection(pathFilename.stem.split('_')), too_short=None)
86
-
87
- # TODO Resolving the actual location for every `pathFilename` and `listPathFilenames` parameter MUST
88
- # be centralized in one function.
89
- @pytest.fixture()
90
- def listPathFilenames(request: FixtureRequest) -> tuple[Path, ...]:
91
- listFilenames: Sequence[str] = cast('Sequence[str]', request.node.callspec.params['listPathFilenames']) # pyright: ignore[reportUnknownMemberType]
92
- return tuple(map(pathDataSamples.joinpath, listFilenames))
93
-
94
- @pytest.fixture()
95
- def pathFilename(request: FixtureRequest) -> Path:
96
- filename: str = request.param
97
- return pathDataSamples / filename
98
-
99
- @pytest.fixture()
100
- def sampleRateSource(pathFilename: Path) -> float:
101
- return float(one(filter(str.isdecimal, map(operator.itemgetter(slice(2, None)), filter(lambda string: string.startswith('Hz'), pathFilename.stem.split('_'))))))
102
-
103
- @pytest.fixture()
104
- def waveform(pathFilename: Path, sampleRateSource: float, dtype_str: Options_dtype_str | None) -> Waveform:
105
- return readAudioFile(pathFilename, sampleRateSource, dtype_str)
@@ -1,38 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from itertools import starmap
4
- from typing import TYPE_CHECKING
5
- import numpy
6
- import pytest
7
-
8
- if TYPE_CHECKING:
9
- from hunterHearsPy.theTypes import 个, 形ndarray
10
- from typing import Any
11
-
12
- #================== Assert scalar and built-in containers ========================================================================
13
-
14
- def assertEqualTo(actual: 个, expected: 个, function: str, *arguments: Any, **keywordArguments: Any) -> None:
15
- """Assert that two objects are equal, and if not, raise an AssertionError with a detailed message."""
16
- assert actual == expected, messageTestFailure(actual, expected, function, *arguments, **keywordArguments)
17
-
18
- def assert_approx(actual: 个, expected: 个, pytest_rel: float, pytest_abs: float, function: str, *arguments: Any, **keywordArguments: Any) -> None:
19
- assert actual == pytest.approx(expected, pytest_rel, pytest_abs, nan_ok=True), messageTestFailure(actual, expected, function, *arguments, **keywordArguments)
20
-
21
- def messageTestFailure(actual: Any, expected: Any, function: str, *arguments: Any, **keywordArguments: Any) -> str:
22
- """Format assertion message for any test comparison."""
23
- parameters: list[str] = [*map(repr, arguments), *starmap('{}={!r}'.format, keywordArguments.items())]
24
- return f'{function}({", ".join(parameters)}) = {actual!r}, but {expected = }.'
25
-
26
- #================== Assert NumPy arrays ========================================================================
27
-
28
- def assert_array_equal(actual: 形ndarray, expected: 形ndarray, function: str, *arguments: Any, **keywordArguments: Any) -> None:
29
- """Assert that two arrays are equal, and if not, raise an AssertionError with a detailed message."""
30
- assert numpy.array_equal(actual, expected), messageTestFailure_ndarray(actual, expected, function, *arguments, **keywordArguments)
31
-
32
- def assert_allclose(actual: 形ndarray, expected: 形ndarray, rtol: float, atol: float, function: str, *arguments: Any, **keywordArguments: Any) -> None:
33
- assert numpy.allclose(actual, expected, rtol, atol), messageTestFailure_ndarray(actual, expected, function, *arguments, **keywordArguments)
34
-
35
- def messageTestFailure_ndarray(actual: 形ndarray, expected: 形ndarray, function: str, *arguments: Any, **keywordArguments: Any) -> str:
36
- """Printing arrays is absurd."""
37
- parameters: list[str] = [*map(repr, arguments), *starmap('{}={!r}'.format, keywordArguments.items())]
38
- return f'{function}({", ".join(parameters)}) = {actual.shape=},\t{actual.dtype=}, but {expected.shape=}, {expected.dtype=}.'
@@ -1,42 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from functools import cache
4
- from hunterHearsPy import readAudioFile
5
- from pathlib import Path
6
- from typing import ClassVar, TYPE_CHECKING
7
-
8
- if TYPE_CHECKING:
9
- from hunterHearsPy.theTypes import Waveform
10
-
11
- class WaveformAndMetadata:
12
- _cacheWaveforms: ClassVar[dict[Path, Waveform]] = {}
13
-
14
- def __init__(self, pathFilename: Path, LUFS: float, sampleRate: float, channelsTotal: int, ID: str) -> None:
15
- self.pathFilename: Path = pathFilename
16
- self.LUFS: float = LUFS
17
- self.sampleRate: float = sampleRate
18
- self.channelsTotal: int = channelsTotal
19
- self.ID: str = ID
20
-
21
- @property
22
- def waveform(self) -> Waveform:
23
- if self.pathFilename not in self._cacheWaveforms:
24
- self._cacheWaveforms[self.pathFilename] = readAudioFile(self.pathFilename, self.sampleRate)
25
- return self._cacheWaveforms[self.pathFilename]
26
-
27
- pathDataSamples_labeled = Path('tests/dataSamples/labeled')
28
-
29
- def ingestSampleData() -> list[WaveformAndMetadata]:
30
- """Parse LUFS*.wav filenames and create WaveformData objects without loading waveforms."""
31
- listWaveformData: list[WaveformAndMetadata] = []
32
- for pathFilename in pathDataSamples_labeled.glob('LUFS*.wav'):
33
- LUFSAsStr, sampleRateAsStr, channelsTotalAsStr, ID = pathFilename.stem.split('_', maxsplit=3)
34
- LUFS = -float(LUFSAsStr[len('LUFS') :])
35
- sampleRate = float(sampleRateAsStr)
36
- channelsTotal = int(channelsTotalAsStr[len('ch') :])
37
- listWaveformData.append(WaveformAndMetadata(pathFilename, LUFS, sampleRate, channelsTotal, ID))
38
- return listWaveformData
39
-
40
- @cache
41
- def sampleData() -> list[WaveformAndMetadata]:
42
- return ingestSampleData()
File without changes
File without changes