Skip to content

Commit

Permalink
utilities/exceptions: Drop 'UndefinedReferenceWarning'
Browse files Browse the repository at this point in the history
This warning had the function to inform the user if she/he/* used a
tempo point without a reference. Then this reference was automatically
set to 1. Unfortunately this warning isn't very useful. Very often such
tempo points are used and then the warnings just pollute the logging.
They may also look frightening to new users, while they can simply be
ignored. So it's better to drop this warning.
  • Loading branch information
levinericzimmermann committed Nov 21, 2023
1 parent 178f0e0 commit 0783f90
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
1 change: 0 additions & 1 deletion mutwo/core_converters/tempos.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def _extract_beats_per_minute_and_reference_from_tempo_point(
try:
reference = tempo_point.reference # type: ignore
except AttributeError:
self._logger.warning(core_utilities.UndefinedReferenceWarning(tempo_point))
reference = 1

return beats_per_minute, reference
Expand Down
18 changes: 2 additions & 16 deletions mutwo/core_utilities/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
"""Module for mutwo specific exceptions."""

import typing

from mutwo import core_constants

__all__ = (
"CannotSetDurationOfEmptyComplexEvent",
"AlreadyDefinedValueNameError",
Expand All @@ -19,7 +15,6 @@
"InvalidCutOutStartAndEndValuesError",
"SplitUnavailableChildError",
"EmptyEnvelopeError",
"UndefinedReferenceWarning",
"ConcatenationError",
"NoTagError",
"SplitError",
Expand Down Expand Up @@ -139,12 +134,12 @@ def __init__(self, start, end, simple_event, duration):


class SplitError(Exception):
def __init__(self, absolute_time: 'core_parameters.abc.Duration'):
def __init__(self, absolute_time: "core_parameters.abc.Duration"):
super().__init__(f"Can't split event at absolute time '{absolute_time}'.")


class SplitUnavailableChildError(Exception):
def __init__(self, absolute_time: 'core_parameters.abc.Duration'):
def __init__(self, absolute_time: "core_parameters.abc.Duration"):
super().__init__(
f"Can't split child at absolute time '{absolute_time}'. There is no child"
" event available at the requested time."
Expand All @@ -156,15 +151,6 @@ def __init__(self, envelope, method):
super().__init__(f"Can't call '{method}' on empty envelope '{envelope}'!")


class UndefinedReferenceWarning(RuntimeWarning):
def __init__(self, tempo_point: typing.Any):
super().__init__(
f"Tempo point '{tempo_point}' of type '{type(tempo_point)}' "
"doesn't know attribute 'reference'."
" Therefore reference has been set to 1."
)


class ConcatenationError(TypeError):
def __init__(self, ancestor, event):
super().__init__(
Expand Down

0 comments on commit 0783f90

Please sign in to comment.