Remove the 3.1 renames, at the release their notices named - #486
Conversation
The function aliases, the renamed constants and the deprecated keywords have carried a 4.0 removal notice since 3.1, and phonometry._plotting has carried one since 3.2. They are gone; the canonical names they delegated to are untouched. Taking the package-level __getattr__ with them would have cost the type checkers their view of phonometry.building and its seventeen siblings, which the flat API only ever bound as a side effect, so the domain packages are now named in the facade. Three annotations that the checker could finally see through were too narrow for the scalars the docstrings promise.
|
You've reached the fair usage limit for the Bito Code Review Agent trial. Upgrade to a paid plan or contact support@bito.in for assistance. Learn more |
📝 WalkthroughWalkthroughThe PR removes deprecated 3.1 aliases, keyword parameters, constants, warning shims, and the ChangesDeprecated API removal
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideRemoves all phonometry 3.1 deprecation shims (function aliases, constants, keywords, and the _plotting module) now that 4.0 is the removal release, simplifies the underlying implementations, and makes domain subpackages explicit exports so type checkers can see them; tests and docs are updated to assert absence of the old names while confirming canonical APIs are intact and certain type signatures are widened to accept documented scalar inputs. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/phonometry/building/measurement/survey_insulation.py (1)
587-595: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winBroadcast scalar
reverberation_indexvalues before shape validation.The annotation promises scalar support, but
_finite_bandsreturns a 0-D array for a scalar. The shape check then requires(n_bands,), so scalar calls to all three survey functions raiseValueError. Broadcast 0-D input to(n_bands,)before the shape check, and add scalar-input tests.Proposed fix
kk = _finite_bands(k, "reverberation_index") + if kk.ndim == 0: + kk = np.broadcast_to(kk, (n_bands,)).copy() if kk.shape != (n_bands,):Also applies to: 603-603, 671-671, 708-708
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/phonometry/building/measurement/survey_insulation.py` around lines 587 - 595, Update _validate_index to broadcast a scalar 0-D result from _finite_bands to shape (n_bands,) before the existing shape validation, while preserving sequence and array handling. Ensure the shared validation path used by all three survey functions accepts scalar reverberation_index values, and add tests covering scalar input for each function.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/phonometry/psychoacoustics/loudness/ecma.py`:
- Line 200: Replace the relative :mod: target with
phonometry._plot.psychoacoustics in
src/phonometry/psychoacoustics/loudness/ecma.py:200-200,
moore_glasberg.py:538-538, moore_glasberg_time.py:377-377, and
zwicker.py:121-121; apply the same canonical-module update in
src/phonometry/psychoacoustics/quality/roughness_ecma.py, tonality_ecma.py, and
fluctuation_strength_ecma.py. Regenerate
site/src/content/docs/reference/api/psychoacoustics/roughness-ecma.md:94-94,
tonality-ecma.md:75-75, and zwicker.md:147-147 with scripts/generate_api_docs.py
rather than editing generated Markdown directly.
---
Outside diff comments:
In `@src/phonometry/building/measurement/survey_insulation.py`:
- Around line 587-595: Update _validate_index to broadcast a scalar 0-D result
from _finite_bands to shape (n_bands,) before the existing shape validation,
while preserving sequence and array handling. Ensure the shared validation path
used by all three survey functions accepts scalar reverberation_index values,
and add tests covering scalar input for each function.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c3515f8e-8383-4806-9b39-78cf1f8b270d
📒 Files selected for processing (45)
CHANGELOG.mddocs/api-reference.mdllms-full.txtsite/src/content/docs/reference/api/building/uncertainty.mdsite/src/content/docs/reference/api/environment/outdoor-propagation.mdsite/src/content/docs/reference/api/filters/core.mdsite/src/content/docs/reference/api/filters/frequencies.mdsite/src/content/docs/reference/api/materials/road-absorption.mdsite/src/content/docs/reference/api/metrology/calibration.mdsite/src/content/docs/reference/api/power/sound-power.mdsite/src/content/docs/reference/api/psychoacoustics/ecma.mdsite/src/content/docs/reference/api/psychoacoustics/fluctuation-strength-ecma.mdsite/src/content/docs/reference/api/psychoacoustics/moore-glasberg-time.mdsite/src/content/docs/reference/api/psychoacoustics/moore-glasberg.mdsite/src/content/docs/reference/api/psychoacoustics/roughness-ecma.mdsite/src/content/docs/reference/api/psychoacoustics/tonality-ecma.mdsite/src/content/docs/reference/api/psychoacoustics/zwicker.mdsrc/phonometry/__init__.pysrc/phonometry/_plotting.pysrc/phonometry/building/__init__.pysrc/phonometry/building/measurement/__init__.pysrc/phonometry/building/measurement/survey_insulation.pysrc/phonometry/building/measurement/uncertainty.pysrc/phonometry/emission/sound_power.pysrc/phonometry/emission/sound_power_reverberation.pysrc/phonometry/environment/propagation/outdoor_propagation.pysrc/phonometry/filters/__init__.pysrc/phonometry/filters/core.pysrc/phonometry/filters/frequencies.pysrc/phonometry/hearing/occupational_exposure.pysrc/phonometry/materials/absorbers/rating.pysrc/phonometry/materials/diffusers/scattering_diffusion.pysrc/phonometry/materials/surfaces/road_absorption.pysrc/phonometry/metrology/__init__.pysrc/phonometry/metrology/calibration.pysrc/phonometry/psychoacoustics/loudness/ecma.pysrc/phonometry/psychoacoustics/loudness/moore_glasberg.pysrc/phonometry/psychoacoustics/loudness/moore_glasberg_time.pysrc/phonometry/psychoacoustics/loudness/zwicker.pysrc/phonometry/psychoacoustics/quality/fluctuation_strength_ecma.pysrc/phonometry/psychoacoustics/quality/roughness_ecma.pysrc/phonometry/psychoacoustics/quality/tonality_ecma.pysrc/phonometry/speech/sii.pytests/building/measurement/test_building_uncertainty.pytests/test_deprecated_aliases.py
💤 Files with no reviewable changes (13)
- site/src/content/docs/reference/api/filters/frequencies.md
- site/src/content/docs/reference/api/metrology/calibration.md
- src/phonometry/speech/sii.py
- site/src/content/docs/reference/api/materials/road-absorption.md
- src/phonometry/_plotting.py
- site/src/content/docs/reference/api/building/uncertainty.md
- site/src/content/docs/reference/api/filters/core.md
- src/phonometry/building/init.py
- src/phonometry/materials/absorbers/rating.py
- site/src/content/docs/reference/api/power/sound-power.md
- site/src/content/docs/reference/api/environment/outdoor-propagation.md
- src/phonometry/building/measurement/init.py
- src/phonometry/building/measurement/uncertainty.py
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #486 +/- ##
==========================================
- Coverage 96.99% 96.99% -0.01%
==========================================
Files 273 272 -1
Lines 38661 38575 -86
==========================================
- Hits 37500 37416 -84
+ Misses 1161 1159 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Numerical conformance report✅ 533/533 conformance checks pass across 57 domains and 362 standards - filters class 1 - weightings within IEC 61672-1 class 1. Each row pins a standard clause to its expected normative value and the value the library computes. Every section below is collapsible and stays collapsed while all of its rows pass; a section with any failing row opens automatically. ✅ Numerical validation - filters & weightings: class showcase (IEC 61260-1 · IEC 61672-1 · ISO 7196)IEC 61260-1:2014 class per filter architecture (order 6, one-third-octave, 100 Hz-10 kHz, fs = 48 kHz). For each architecture the table shows, at its binding band, the measured relative attenuation and the class-1 limit it must clear, so the number and the range it must sit in are both visible. A positive margin means the acceptance limits are met with that much room.
Only Butterworth (the library default) and Chebyshev-II are class-compliant architectures. Chebyshev-I and elliptic trade the mask for passband ripple, and Bessel for a maximally-flat group delay (soft rolloff); they cannot satisfy the IEC 61260-1 Class 1/2 attenuation mask by construction, so they are labelled By design - this is expected, not a failure or regression. Frequency-weighting conformance (A/C: IEC 61672-1 Table 3; G: ISO 7196 A.3). The max deviation from nominal is informational (it falls at a frequency extreme where the tolerance is widest and asymmetric); compliance is judged at the binding frequency - the one with the least headroom - where the deviation, the applicable tolerance band and the headroom are shown together.
✅ Filters & weightings: 100% (10/10)
✅ Levels & dosimetry: 100% (9/9)
✅ Room & building acoustics: 100% (72/72)
✅ Room acoustics: 100% (16/16)
✅ Psychoacoustics: 100% (14/14)
✅ Speech transmission (IEC 60268-16): 100% (10/10)
✅ System measurement (Golay / Kirkeby / Mueller-Massarani): 100% (5/5)
✅ Intensity & sound power: 100% (10/10)
✅ Building prediction & uncertainty: 100% (15/15)
✅ Outdoor propagation & occupational exposure: 100% (10/10)
✅ Materials: absorption, airflow & impedance: 100% (6/6)
✅ Scattering & diffusion (ISO 17497): 100% (14/14)
✅ In-situ road absorption (ISO 13472): 100% (3/3)
✅ Precision sound power (ISO 3745 / 9614-3): 100% (4/4)
✅ Human vibration (ISO 8041 / 2631 / 5349): 100% (15/15)
✅ Speech intelligibility (ANSI S3.5-1997): 100% (24/24)
✅ Objective intelligibility (STOI / ESTOI): 100% (3/3)
✅ Impulsive-sound prominence (NT ACOU 112): 100% (2/2)
✅ Impulsive-sound prominence (ISO/PAS 1996-3): 100% (2/2)
✅ Room noise (ANSI S12.2-2019): 100% (3/3)
✅ Hearing threshold (ISO 7029 / ISO 389-7): 100% (3/3)
✅ Measurement uncertainty (GUM / Supplement 1): 100% (7/7)
✅ Noise-induced hearing loss (ISO 1999): 100% (6/6)
✅ Multiple-shock whole-body vibration (ISO 2631-5): 100% (6/6)
✅ Sound absorption in enclosed spaces (EN 12354-6): 100% (2/2)
✅ Prominent discrete tones (ECMA-418-1): 100% (2/2)
✅ Tonal audibility (ISO/PAS 20065): 100% (11/11)
✅ Psychoacoustic annoyance & fluctuation strength (Fastl & Zwicker): 100% (3/3)
✅ Electroacoustics: distortion & frequency response: 100% (20/20)
✅ Calibrated spectral analysis (Bendat & Piersol): 100% (12/12)
✅ Multiple-input coherence (Bendat & Piersol): 100% (5/5)
✅ Time-frequency analysis (Bendat & Piersol): 100% (3/3)
✅ Correlation, time delay and envelope (B&P / Knapp & Carter): 100% (7/7)
✅ Cepstrum, liftering and envelope spectrum (Havelock / B&P): 100% (3/3)
✅ Time synchronous averaging (McFadden 1987): 100% (5/5)
✅ Data qualification and Rice statistics (Bendat & Piersol): 100% (8/8)
✅ Underwater acoustics (ISO 18405/17208/18406): 100% (6/6)
✅ Underwater sound propagation (transmission loss): 100% (16/16)
✅ Underwater propagation regimes (Weston flux theory): 100% (3/3)
✅ Marine-mammal auditory weighting (NMFS / Southall): 100% (4/4)
✅ Underwater numerical propagation (modes / rays / PE): 100% (4/4)
✅ Aircraft noise (ICAO Annex 16 / IEC 61265): 100% (15/15)
✅ Rotorcraft noise (ECAC Doc 32 / NORAH2): 100% (12/12)
✅ CNOSSOS-EU road source (Directive 2002/49/EC Annex II): 100% (6/6)
✅ Wind-turbine noise (IEC 61400-11): 100% (3/3)
✅ Porous & multilayer absorbers (Mechel / Bies / Cox & D'Antonio): 100% (20/20)
✅ Slow-sound perfect absorbers (Jimenez et al. Appl. Sci. 2017): 100% (3/3)
✅ Program loudness (ITU-R BS.1770 / EBU R 128): 100% (8/8)
✅ 2D FDTD wave simulation (Attenborough & Van Renterghem 2021, Ch. 4): 100% (4/4)
✅ Swept-sine distortion & phase utilities (Farina / Novak): 100% (7/7)
✅ Spherical ground & barriers (Attenborough / Salomons / Bies): 100% (7/7)
✅ Panel & aperture sound insulation (Bies / Hopkins / Cremer): 100% (17/17)
✅ Bending-wave plate-junction transmission (Cremer / Craik / Hopkins): 100% (6/6)
✅ Atmospheric refraction (Salomons rays / GFPE): 100% (3/3)
✅ Electroacoustics: 100% (9/9)
✅ Industrial noise control: 100% (22/22)
✅ CNOSSOS-EU railway source (Directive 2002/49/EC Annex II): 100% (8/8)
Tests & coverage — 48084 tests, 0 failures (✅ all green)
Conformance harness: |
Three of the widened annotations said the survey methods take a scalar reverberation index, and the validator rejects one: they are back to what the code accepts, and the type error they were papering over is fixed where it started, by overloading estimate_reverberation_index on the flag that decides its return type. The rest is what the removal left behind: a label glob for the deleted plot module, a comment that had drifted onto the wrong import, a doc note pointing at BAND_CENTERS as if it were a flat name, seven cross-references that rendered as an ellipsis, and the two missing-fs branches that lost their only callers.
|
You've reached the fair usage limit for the Bito Code Review Agent trial. Upgrade to a paid plan or contact support@bito.in for assistance. Learn more |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/phonometry/building/measurement/survey_insulation.py (1)
599-606: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winPreserve scalar
reverberation_indexsupport in the survey APIs.
estimate_reverberation_index(..., weighted=True)returns a scalar A/C index, butsurvey_airborne_insulation,survey_impact_insulation, andsurvey_facade_insulationreject it because their annotations excludefloatand_validate_indexrequires shape(n_bands,). Addfloatto the helper and the three parameter annotations, then broadcast a finite scalar ton_bandsbefore the shape check.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/phonometry/building/measurement/survey_insulation.py` around lines 599 - 606, Preserve scalar reverberation_index support by adding float to _validate_index and the reverberation_index annotations of survey_airborne_insulation, survey_impact_insulation, and survey_facade_insulation. In _validate_index, broadcast a finite scalar to an array of length n_bands before enforcing the existing per-band shape check; retain current validation for non-scalar inputs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/phonometry/__init__.py`:
- Around line 2823-2840: Add the 18 domain package names bound by the imports in
the module-level __all__ definition so from phonometry import * exports
aircraft, broadcast, building, electroacoustics, emission, environment, filters,
hearing, materials, metrology, noise_control, psychoacoustics, room, signals,
simulation, speech, underwater, and vibration. Add a regression test that
verifies these names are available through the star-import path.
In `@src/phonometry/building/measurement/survey_insulation.py`:
- Around line 250-261: Add a final overload for estimate_reverberation_index
accepting weighted: bool and returning np.ndarray | float, after the existing
Literal[False] and Literal[True] overloads. Preserve the current
literal-specific overloads so type checkers retain precise return types for
literal arguments.
---
Outside diff comments:
In `@src/phonometry/building/measurement/survey_insulation.py`:
- Around line 599-606: Preserve scalar reverberation_index support by adding
float to _validate_index and the reverberation_index annotations of
survey_airborne_insulation, survey_impact_insulation, and
survey_facade_insulation. In _validate_index, broadcast a finite scalar to an
array of length n_bands before enforcing the existing per-band shape check;
retain current validation for non-scalar inputs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 7ca0d4c9-2ada-4823-a32a-12f655c8de4e
📒 Files selected for processing (22)
.github/labeler.ymldocs/api-reference.mdllms-full.txtsite/src/content/docs/reference/api/psychoacoustics/ecma.mdsite/src/content/docs/reference/api/psychoacoustics/fluctuation-strength-ecma.mdsite/src/content/docs/reference/api/psychoacoustics/moore-glasberg-time.mdsite/src/content/docs/reference/api/psychoacoustics/moore-glasberg.mdsite/src/content/docs/reference/api/psychoacoustics/roughness-ecma.mdsite/src/content/docs/reference/api/psychoacoustics/tonality-ecma.mdsite/src/content/docs/reference/api/psychoacoustics/zwicker.mdsrc/phonometry/__init__.pysrc/phonometry/building/measurement/survey_insulation.pysrc/phonometry/environment/propagation/outdoor_propagation.pysrc/phonometry/psychoacoustics/loudness/ecma.pysrc/phonometry/psychoacoustics/loudness/moore_glasberg.pysrc/phonometry/psychoacoustics/loudness/moore_glasberg_time.pysrc/phonometry/psychoacoustics/loudness/zwicker.pysrc/phonometry/psychoacoustics/quality/fluctuation_strength_ecma.pysrc/phonometry/psychoacoustics/quality/roughness_ecma.pysrc/phonometry/psychoacoustics/quality/tonality_ecma.pytests/materials/surfaces/test_road_absorption.pytests/test_deprecated_aliases.py
💤 Files with no reviewable changes (2)
- .github/labeler.yml
- src/phonometry/environment/propagation/outdoor_propagation.py
| from . import aircraft as aircraft | ||
| from . import broadcast as broadcast | ||
| from . import building as building | ||
| from . import electroacoustics as electroacoustics | ||
| from . import emission as emission | ||
| from . import environment as environment | ||
| from . import filters as filters | ||
| from . import hearing as hearing | ||
| from . import materials as materials | ||
| from . import metrology as metrology | ||
| from . import noise_control as noise_control | ||
| from . import psychoacoustics as psychoacoustics | ||
| from . import room as room | ||
| from . import signals as signals | ||
| from . import simulation as simulation | ||
| from . import speech as speech | ||
| from . import underwater as underwater | ||
| from . import vibration as vibration |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Add the domain packages to __all__.
Lines 2823-2840 bind the packages, but __all__ closes at line 2811 without these names. Therefore, from phonometry import * omits every new public domain package. Add all 18 package names to __all__ and add a regression test for this export path.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/phonometry/__init__.py` around lines 2823 - 2840, Add the 18 domain
package names bound by the imports in the module-level __all__ definition so
from phonometry import * exports aircraft, broadcast, building,
electroacoustics, emission, environment, filters, hearing, materials, metrology,
noise_control, psychoacoustics, room, signals, simulation, speech, underwater,
and vibration. Add a regression test that verifies these names are available
through the star-import path.
| @overload | ||
| def estimate_reverberation_index( | ||
| volume: float, room: str, *, weighted: Literal[False] = False | ||
| ) -> np.ndarray: ... | ||
|
|
||
|
|
||
| @overload | ||
| def estimate_reverberation_index( | ||
| volume: float, room: str, *, weighted: Literal[True] | ||
| ) -> float: ... | ||
|
|
||
|
|
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== locate files =="
fd -a 'survey_insulation.py|__init__.py' . | sed 's#^\./##'
echo "== relevant source excerpt =="
if [ -f src/phonometry/building/measurement/survey_insulation.py ]; then
nl -ba src/phonometry/building/measurement/survey_insulation.py | sed -n '220,285p'
fi
echo "== re-exports =="
if [ -f src/phonometry/__init__.py ]; then
nl -ba src/phonometry/__init__.py | sed -n '1,220p'
fi
echo "== type checker config/files =="
for f in pyrightconfig.json pyproject.toml setup.cfg tox.ini setup.py; do
[ -f "$f" ] && { echo "--- $f"; sed -n '1,220p' "$f"; }
done
fd 'pyrightconfig.json|setup.cfg|pyproject.toml' . -x sh -c 'echo "--- $1"; sed -n "1,180p" "$1"' sh {}
echo "== search overload pattern in package =="
rg -n "`@overload`|estimate_reverberation_index|from .*survey_insulation|survey_insulation" src README.md pyproject.toml setup.cfg 2>/dev/null || true
echo "== behavioral/provenance check (static overloads only) =="
python3 - <<'PY'
from pathlib import Path
p=Path('src/phonometry/building/measurement/survey_insulation.py')
text=p.read_text()
for part in ['def estimate_reverberation_index(', '`@overload`', 'weighted: Literal[False]', 'weighted: Literal[True]', 'weighted: bool']:
print(f"{part!r}: {part in text}")
PYRepository: jmrplens/phonometry
Length of output: 2874
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== candidate type-checking invocations =="
if [ -x .venv/bin/pyright ] || [ -x venv/bin/pyright ]; then
pyright --version
elif command -v pyright >/dev/null 2>&1; then
pyright --version
elif python3 - <<'PY' >/tmp/pyright.py 2>/tmp/pyright.err; import pathlib,builtins; print(builtins.__file__); PY
import pathlib, builtins
print(pathlib.Path(builtins.__file__).parent)
else
echo "pyright unavailable"
exit 0
fi
echo "== install/check from requirements if pyright missing =="
python3 - <<'PY'
import subprocess, sys, pathlib
try:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-q', '--no-build-isolation', 'pyright'], stderr=subprocess.PIPE)
subprocess.run([sys.executable, '-m', 'pyright', '--version'], check=True)
except Exception as e:
print(f"pip/pyright install failed: {type(e).__name__}: {e}")
PYRepository: jmrplens/phonometry
Length of output: 268
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== relevant source excerpt =="
sed -n '220,275p' src/phonometry/building/measurement/survey_insulation.py
echo "== root __init__ excerpt =="
sed -n '1,220p' src/phonometry/__init__.py
echo "== config search =="
find . -maxdepth 2 \( -name pyrightconfig.json -o -name pyproject.toml -o -name setup.cfg -o -name tox.ini \) -print -exec sh -c 'echo "--- $1"; sed -n "1,200p" "$1"' sh {} \;
echo "== overload and export references =="
grep -RIn '`@overload`\|estimate_reverberation_index\|survey_insulation' src tests pyproject.toml setup.cfg pyrightconfig.json 2>/dev/null || true
echo "== source contains weighted bool overload? =="
python3 - <<'PY'
from pathlib import Path
text = Path('src/phonometry/building/measurement/survey_insulation.py').read_text()
for s in ['`@overload`', 'Literal[False]', 'Literal[True]', 'weighted: bool']:
print(f'{s!r}: {s in text}')
PYRepository: jmrplens/phonometry
Length of output: 19823
Add a fallback overload for non-literal bool.
Type checkers select types from the overload declarations. Callers with weighted: bool match neither Literal[False] nor Literal[True], while estimate_reverberation_index is exposed through phonometry.building.measurement and phonometry. Add a final overload weighted: bool with return type np.ndarray | float.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/phonometry/building/measurement/survey_insulation.py` around lines 250 -
261, Add a final overload for estimate_reverberation_index accepting weighted:
bool and returning np.ndarray | float, after the existing Literal[False] and
Literal[True] overloads. Preserve the current literal-specific overloads so type
checkers retain precise return types for literal arguments.
|
|
You've reached the fair usage limit for the Bito Code Review Agent trial. Upgrade to a paid plan or contact support@bito.in for assistance. Learn more |



The 3.1 renames have been warning that 4.0 would remove them since 3.1, and
phonometry._plottingsince 3.2. This removes them.Gone, with the name to use instead:
octavefilteroctave_filtergetansifrequenciesnominal_frequenciesnormalizedfreqnormalized_frequenciescalculate_sensitivitysensitivitycoverage_factor,expanded_uncertainty(the ISO 12999-1 pair that shadowed the GUM functions at the root)insulation_coverage_factor,insulation_expanded_uncertainty, andphonometry.metrology.uncertaintyfor the GUM pairOCTAVE_BANDS_HZ,THIRD_OCTAVE_BANDS_HZ,BASE_PLATE_BANDS_HZOCTAVE_BANDS,THIRD_OCTAVE_BANDS,BASE_PLATE_BANDSBAND_CENTRESBAND_CENTERSExposureWarningOccupationalExposureWarningsample_ratekeyword (ISO 13472)fshumiditykeyword (ISO 9613)relative_humidityroom_volumekeyword (ISO 3744)volumephonometry._plottingphonometry._plotThe canonical names they delegated to are untouched, and so is every number the
library computes: the removal takes the aliases and their sentinel defaults,
nothing else.
One consequence worth naming. The package-level
__getattr__that served therenamed constants also made every attribute of
phonometrylook likeAnyto atype checker, which is what kept
ph.buildingresolving in the scripts. With itgone, the eighteen domain packages are named explicitly in the facade, where
they belong: they were only ever bound as a side effect of importing the flat
API. That in turn let mypy see through three annotations that were narrower than
their own docstrings, so
sound_power_reverberationaccepts the scalart60itdocuments, and the three
survey_*_insulationfunctions accept the scalarreverberation index that
estimate_reverberation_indexreturns when weighted.The tests that asserted each alias warned and delegated now assert it is gone,
alongside a check that every canonical name it pointed at is still there.
Summary by CodeRabbit
New Features
Breaking Changes
Documentation