Commit 1d828ec1 authored by Jan Kiene's avatar Jan Kiene
Browse files

fix all but one linter complaint

parent c861ca0a
Loading
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ logger = logging.getLogger("__main__")
logger.setLevel(logging.DEBUG)


### Functions used in this module
# Functions used in this module
def trim(
    x: np.ndarray,
    fs: Optional[int] = 48000,
@@ -183,13 +183,13 @@ def delay_compensation(
    """

    # Get the delay in number of samples
    if flt_type == "SHQ2" and up == True:
    if flt_type == "SHQ2" and up:
        d_samples = DELAY_COMPENSATION_FOR_FILTERING["SHQ2"]["up"]
    elif flt_type == "SHQ2" and down == True:
    elif flt_type == "SHQ2" and down:
        d_samples = DELAY_COMPENSATION_FOR_FILTERING["SHQ2"]["down"]
    elif flt_type == "SHQ3" and up == True:
    elif flt_type == "SHQ3" and up:
        d_samples = DELAY_COMPENSATION_FOR_FILTERING["SHQ3"]["up"]
    elif flt_type == "SHQ3" and down == True:
    elif flt_type == "SHQ3" and down:
        d_samples = DELAY_COMPENSATION_FOR_FILTERING["SHQ3"]["down"]
    else:
        d_samples = DELAY_COMPENSATION_FOR_FILTERING[flt_type]
@@ -405,7 +405,7 @@ def framewise_io(
    )


### Deprecated functions (partly replaced by ITU binaries)
# Deprecated functions (partly replaced by ITU binaries)
def resample(
    x: np.ndarray,
    in_freq: int,
+2 −3
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@
#  the United Nations Convention on Contracts on the International Sales of Goods.
#

import logging
import warnings
from pathlib import Path
from typing import Optional, Tuple, Union
@@ -149,7 +148,7 @@ def load_ir(
                ).is_file():
                    dataset_suffix = "SBA3"
                    warnings.warn(
                        f"No SBA1 dataset found -> use truncated SBA3 dataset"
                        "No SBA1 dataset found -> use truncated SBA3 dataset"
                    )
            elif in_fmt.endswith("2"):
                dataset_suffix = "SBA2"
@@ -161,7 +160,7 @@ def load_ir(
                ).is_file():
                    dataset_suffix = "SBA3"
                    warnings.warn(
                        f"No SBA2 dataset found -> use truncated SBA3 dataset"
                        "No SBA2 dataset found -> use truncated SBA3 dataset"
                    )
            else:
                dataset_suffix = "SBA3"
+4 −4
Original line number Diff line number Diff line
@@ -258,13 +258,13 @@ def process_audio(
    """MNRU"""
    if mnru_q is not None:
        if logger:
            logger.debug(f"Applying P.50 Fullband MNRU")
            logger.debug("Applying P.50 Fullband MNRU")
        x.audio = p50fbmnru(x, mnru_q)

    """ESDRU"""
    if esdru_alpha is not None:
        if logger:
            logger.debug(f"Applying ESDRU Recommendation ITU-T P.811")
            logger.debug("Applying ESDRU Recommendation ITU-T P.811")
        x.audio = esdru(x, esdru_alpha)

    """limiting"""
@@ -284,11 +284,11 @@ def format_conversion(

    # validation
    if isinstance(output, audio.MetadataAssistedSpatialAudio):
        raise NotImplementedError(f"MASA is not supported as an output for rendering!")
        raise NotImplementedError("MASA is not supported as an output for rendering!")

    if isinstance(output, audio.ObjectBasedAudio) and input.name != output.name:
        raise NotImplementedError(
            f"ISM is not supported as an output for rendering! Only usable as pass-through"
            "ISM is not supported as an output for rendering! Only usable as pass-through"
        )

    if logger:
+3 −3
Original line number Diff line number Diff line
@@ -450,7 +450,7 @@ def check_ISM_metadata(
                path_meta = in_meta["all_items"]
            except KeyError:
                raise ValueError(
                    f'Only one metadata path is given but not with key "all_items".'
                    'Only one metadata path is given but not with key "all_items".'
                )

            list_meta = metadata_search(path_meta, item_names, num_objects)
@@ -477,7 +477,7 @@ def check_ISM_metadata(
                    # just read out
                    list_item = current_item
                else:
                    raise ValueError(f"Number of objects and metadata does not match.")
                    raise ValueError("Number of objects and metadata does not match.")
                list_meta.append(list_item)
        else:
            raise ValueError("Number of metadata inputs does not match number of items")
@@ -494,7 +494,7 @@ def metadata_search(
    """Search for ISM metadata with structure item_name.{0-3}.csv in in_meta folder"""

    if not item_names:
        raise ValueError(f"Item names not provided, can't search for metadata")
        raise ValueError("Item names not provided, can't search for metadata")

    list_meta = []
    for item in item_names:
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ def esdru(
        write(tmp_output_file, tmp_output_signal, sf)

        # run command
        result = run(cmd)
        run(cmd)

        tmp_output_signal, out_fs = read(tmp_output_file, 2, sf)

Loading