Skip to content
Snippets Groups Projects
Commit 088c2728 authored by David Schäfer's avatar David Schäfer
Browse files

Merge branch 'warnings' into 'develop'

remove logging output in favor of warnings

See merge request !316
parents 1b563680 43254497
No related branches found
No related tags found
1 merge request!316remove logging output in favor of warnings
Pipeline #45889 failed with stage
in 1 minute and 40 seconds
......@@ -2,11 +2,10 @@
# -*- coding: utf-8 -*-
from __future__ import annotations
import logging
import inspect
import warnings
import copy as stdcopy
from typing import Any, Callable, Tuple, Union, Optional
from typing_extensions import Literal
import pandas as pd
import numpy as np
......@@ -310,8 +309,7 @@ def _warnForUnusedKwargs(func, keywords, translator: Translator):
Notes
-----
A single warning via the logging module is thrown, if any number of
missing kws are detected, naming each missing kw.
A single warning is thrown, if any number of missing kws are detected, naming each missing kw.
"""
sig_kws = inspect.signature(func).parameters
......@@ -328,4 +326,4 @@ def _warnForUnusedKwargs(func, keywords, translator: Translator):
if missing:
missing = ", ".join(missing)
logging.warning(f"Unused argument(s): {missing}")
warnings.warn(f"Unused argument(s): {missing}")
......@@ -2,8 +2,6 @@
# -*- coding: utf-8 -*-
from __future__ import annotations
import logging
import pandas as pd
import numpy as np
import numba
......@@ -18,8 +16,6 @@ from saqc.lib.tools import customRoller
from saqc.core import flagging, Flags
from saqc.lib.types import FreqString
logger = logging.getLogger("SaQC")
@flagging(masking="field", module="changepoints")
def flagChangePoints(
......
......@@ -3,7 +3,6 @@
from typing import Callable, Tuple, Optional, Union
from typing_extensions import Literal
import logging
import numpy as np
import pandas as pd
from dios import DictOfSeries
......@@ -17,8 +16,6 @@ from saqc.funcs.interpolation import interpolateIndex, _SUPPORTED_METHODS
import saqc.funcs.tools as tools
logger = logging.getLogger("SaQC")
METHOD2ARGS = {
"inverse_fshift": ("backward", pd.Timedelta),
"inverse_bshift": ("forward", pd.Timedelta),
......
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import re
import datetime
import itertools
import warnings
from typing import Sequence, Union, Any, Iterator, Callable
import numpy as np
......@@ -23,9 +23,6 @@ from saqc.lib.types import T
from saqc.lib.rolling import customRoller
logger = logging.getLogger("SaQC")
def assertScalar(name, value, optional=False):
if (not np.isscalar(value)) and (value is not None) and (optional is True):
raise ValueError(f"'{name}' needs to be a scalar or 'None'")
......@@ -446,9 +443,9 @@ def evalFreqStr(freq, check, index):
if freq is None:
freq, freqs = estimateFrequency(index)
if freq is None:
logging.warning("Sampling rate could not be estimated.")
warnings.warn("Sampling rate could not be estimated.")
if len(freqs) > 1:
logging.warning(
warnings.warn(
f"Sampling rate seems to be not uniform!." f"Detected: {freqs}"
)
......@@ -456,7 +453,7 @@ def evalFreqStr(freq, check, index):
f_passed_seconds = pd.Timedelta(f_passed).total_seconds()
freq_seconds = pd.Timedelta(freq).total_seconds()
if f_passed_seconds != freq_seconds:
logging.warning(
warnings.warn(
f"Sampling rate estimate ({freq}) missmatches passed frequency ({f_passed})."
)
elif check == "auto":
......
......@@ -4,9 +4,10 @@
"""
The module gathers all kinds of timeseries tranformations.
"""
import logging
import re
import warnings
from typing import Union
import pandas as pd
import numpy as np
import numba as nb
......@@ -15,8 +16,6 @@ from scipy.stats import iqr, median_abs_deviation
from scipy.signal import filtfilt, butter
import numpy.polynomial.polynomial as poly
logger = logging.getLogger("SaQC")
def identity(ts):
# identity function
......@@ -249,7 +248,7 @@ def interpolateNANs(
try:
return x.interpolate(method=wrap_method, order=int(wrap_order))
except (NotImplementedError, ValueError):
logger.warning(
warnings.warn(
f"Interpolation with method {method} is not supported at order "
f"{wrap_order}. and will be performed at order {wrap_order-1}"
)
......
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import pytest
import numpy as np
import pandas as pd
......@@ -13,10 +12,6 @@ from saqc import SaQC, flagging
from tests.common import initData, flagAll
# no logging output needed here
# -> can this be configured on the test runner level?
logging.disable(logging.CRITICAL)
OPTIONAL = [False, True]
......
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import pandas as pd
from hypothesis import given, settings
......@@ -13,9 +11,6 @@ from saqc.core.register import _maskData, _unmaskData, CallState
from tests.fuzzy.lib import dataFieldFlags, MAX_EXAMPLES
logging.disable(logging.CRITICAL)
@settings(max_examples=MAX_EXAMPLES, deadline=None)
@given(data_field_flags=dataFieldFlags())
def test_maskingMasksData(data_field_flags):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment