-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove 3.8 syntax #41
Conversation
Reviewer's Guide by SourceryThis PR updates the type hint syntax throughout the codebase to use the new Python 3.9+ pipe operator syntax (|) instead of typing.Union. It also adds collections.abc imports to replace typing.Sequence and other typing collection types. Class diagram for updated type hintsclassDiagram
class Base {
+__init__(bypass_prob: float | observe.Base, unit: str, preserve_level: bool | observe.Base, aux: str | observe.Base | np.ndarray | Base, transform: Base, num_repeat: int)
}
class AMRNB {
+__init__(bit_rate: int | observe.Base, dtx: bool | observe.Base, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class Append {
+__init__(aux: str | observe.Base | np.ndarray | Base, read_pos_aux: int | float | observe.Base | Time, read_dur_aux: int | float | observe.Base | Time, unit: str, transform: Base, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class AppendValue {
+__init__(duration: int | float | observe.Base | Time, value: float | observe.Base, unit: str, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class BabbleNoise {
+__init__(speech: collections.abc.Sequence[str | np.ndarray], num_speakers: int | observe.Base, gain_db: float | observe.Base, snr_db: float | observe.Base, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class BandPass {
+__init__(center: float | observe.Base, bandwidth: float | observe.Base, order: int | observe.Base, design: str, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class BandStop {
+__init__(center: float | observe.Base, bandwidth: float | observe.Base, order: int | observe.Base, design: str, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class Clip {
+__init__(threshold: float | observe.Base, soft: bool | observe.Base, normalize: bool | observe.Base, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class ClipByRatio {
+__init__(ratio: float | observe.Base, soft: bool | observe.Base, normalize: bool | observe.Base, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class Compose {
+__init__(transforms: collections.abc.Sequence[observe.Base], preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class CompressDynamicRange {
+__init__(threshold_db: float | observe.Base, ratio: float | observe.Base, attack_time: float | observe.Base, release_time: float | observe.Base, knee_radius_db: float | observe.Base, makeup_db: None | float | observe.Base, clip: bool | observe.Base, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class Fade {
+__init__(in_dur: int | float | observe.Base | Time, out_dur: int | float | observe.Base | Time, in_shape: str, out_shape: str, in_db: float, out_db: float, unit: str, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class FFTConvolve {
+__init__(aux: str | observe.Base | np.ndarray | Base, keep_tail: bool | observe.Base, transform: Base, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class GainStage {
+__init__(gain_db: float | observe.Base, max_peak_db: float | observe.Base, clip: bool | observe.Base, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class HighPass {
+__init__(cutoff: float | observe.Base, order: int | observe.Base, design: str, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class LowPass {
+__init__(cutoff: float | observe.Base, order: int | observe.Base, design: str, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class Mix {
+__init__(aux: str | observe.Base | np.ndarray | Base, gain_base_db: float | observe.Base, gain_aux_db: float | observe.Base, snr_db: float | observe.Base, write_pos_base: int | float | observe.Base | Time, read_pos_aux: int | float | observe.Base | Time, read_dur_aux: int | float | observe.Base | Time, clip_mix: bool | observe.Base, loop_aux: bool | observe.Base, extend_base: bool | observe.Base, num_repeat: int | observe.Base, unit: str, transform: Base, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class NormalizeByPeak {
+__init__(peak_db: float | observe.Base, clip: bool | observe.Base, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class PinkNoise {
+__init__(gain_db: float | observe.Base, snr_db: float | observe.Base, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class Prepend {
+__init__(aux: str | observe.Base | np.ndarray | Base, read_pos_aux: int | float | observe.Base | Time, read_dur_aux: int | float | observe.Base | Time, unit: str, transform: Base, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class PrependValue {
+__init__(duration: int | float | observe.Base | Time, value: float | observe.Base, unit: str, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class Resample {
+__init__(target_rate: int | observe.List, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class Select {
+__init__(transforms: collections.abc.Sequence[Base], preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class Shift {
+__init__(duration: int | float | observe.Base | Time, unit: str, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class Tone {
+__init__(freq: float | observe.Base, gain_db: float | observe.Base, snr_db: float | observe.Base, shape: str | observe.Base, lfo_rate: float | observe.Base, lfo_range: float | observe.Base, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class Trim {
+__init__(start_pos: int | float | observe.Base | Time, end_pos: int | float | observe.Base | Time, duration: int | float | observe.Base | Time, fill: str, fill_pos: str, unit: str, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class WhiteNoiseGaussian {
+__init__(gain_db: float | observe.Base, snr_db: float | observe.Base, stddev: float | observe.Base, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class WhiteNoiseUniform {
+__init__(gain_db: float | observe.Base, snr_db: float | observe.Base, preserve_level: bool | observe.Base, bypass_prob: float | observe.Base)
}
class ArrayResolver {
+decode(value: object) object
+encode(value: object) object
}
class ObservableListResolver {
+decode(value: object) object
+encode(value: collections.abc.MutableSequence[object]) object
}
class List {
+__init__(elements: collections.abc.MutableSequence[object], shuffle: bool, draw: bool)
+_draw() object
+_next() object
+__call__() object
}
class Interface {
+__init__(sampling_rate: int, resample: bool, channels: int | collections.abc.Sequence[int], mixdown: bool, keep_nat: bool, num_workers: int | None, multiprocessing: bool, seed: int, verbose: bool)
+augment(data: pd.Index | pd.Series | pd.DataFrame, cache_root: str, data_root: str, modified_only: bool, num_variants: int, force: bool) pd.Index | pd.Series | pd.DataFrame
}
class Utils {
+from_db(x_db: float | observe.Base) float
+to_db(x: float | observe.Base) float
+to_samples(value: int | float | observe.Base | time.Time, sampling_rate: int, length: int)
}
class Time {
+__init__(value: int | float | observe.Base, unit: str)
}
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ChristianGeng - I've reviewed your changes - here's some feedback:
Overall Comments:
- The PR uses the | union operator syntax which requires Python 3.10+, but pyproject.toml specifies Python >=3.9. This will cause errors for users on Python 3.9. Either keep using typing.Union for 3.9 compatibility or update the Python requirement to >=3.10.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
|
I am not so sure. Can this not be fetched from
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, beside my single comment, it all looks good.
Closes #40
Summary by Sourcery
Update type annotations across the codebase to use Python 3.9+ syntax, replacing 'typing.Union' with the '|' operator and updating sequence types to use 'collections.abc'. Adjust the project configuration to require Python 3.9 or higher.
Enhancements:
Build: