Skip to content

Commit

Permalink
adding logger again
Browse files Browse the repository at this point in the history
  • Loading branch information
aleneum committed Mar 10, 2021
1 parent fb5e997 commit 919b131
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 16 deletions.
6 changes: 3 additions & 3 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Changelog

## 0.4.1 (December 2020)
## 0.4.3 (March 2021)
* Add logging helper function.
* Make sure pya runs on Python3.8

* Make sure `pya` runs on Python3.8
* Bugfix #43: Handle `None` as a return value of `get_server_info` in `pya.helper.backend.determine_backend` (thanks @paulvickers)

## 0.4.1 (July 2020)
* Fix bug of extend mode result in a change of dtype (from the default f32 to f64). Now it is fixed at f32.
Expand Down
4 changes: 4 additions & 0 deletions pya/amfcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
from scipy.signal import get_window
from scipy.fftpack import dct
import pya.asig
import logging

# _LOGGER = logging.getLogger(__name__)
# _LOGGER.addHandler(logging.NullHandler())


class Amfcc:
Expand Down
6 changes: 5 additions & 1 deletion pya/arecorder.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# Arecorder class
import time
import logging
import numbers
from warnings import warn
import numpy as np
import pyaudio
from . import Asig
from . import Aserver
from .helper import dbamp
from .helper import _LOGGER


_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.NullHandler())


class Arecorder(Aserver):
Expand Down
6 changes: 5 additions & 1 deletion pya/aserver.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import copy
import time
import logging
import numpy as np
from warnings import warn
from .helper import _LOGGER


_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.NullHandler())


class Aserver:
Expand Down
6 changes: 5 additions & 1 deletion pya/asig.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numbers
from warnings import warn
import logging
from itertools import compress
import matplotlib.pyplot as plt
import numpy as np
Expand All @@ -13,7 +14,10 @@
from .helper import ampdb, dbamp, linlin
from .helper import spectrum, audio_from_file, padding
from .helper import basicplot
from .helper import _LOGGER


_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.NullHandler())


class Asig:
Expand Down
6 changes: 5 additions & 1 deletion pya/aspec.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import logging
import numpy as np
import scipy.interpolate
import pya.asig
from .helper import basicplot
from .helper import _LOGGER


_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.NullHandler())


class Aspec:
Expand Down
5 changes: 5 additions & 0 deletions pya/astft.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
from __future__ import absolute_import
import logging
import numpy as np
from scipy.signal import stft, istft
import pya.asig
from .helper import basicplot


_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.NullHandler())


# TODO, check with multichannel
class Astft:
"""Audio spectrogram (STFT) class, attributes refers to scipy.signal.stft. With an addition
Expand Down
1 change: 0 additions & 1 deletion pya/helper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
# from .helpers import normalize, device_info, find_device
# from .helpers import padding, shift_bit_length
from .helpers import *
from .logging import _LOGGER
from .visualization import basicplot, gridplot
5 changes: 0 additions & 5 deletions pya/helper/logging.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/test_codestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ def test_conformance(self):
# E722 bare except
style = pycodestyle.StyleGuide(quiet=False,
ignore=['E501', 'E731', 'W291', 'W504',
'W391', 'W292', 'E722', 'E402'])
'W391', 'W292', 'E722', 'E402'])
# style.input_dir('../../pya')
style.input_dir('./pya')
# style.input_dir('tests')
style.input_dir('./tests')
result = style.check_files()
self.assertEqual(0, result.total_errors,
"Found code style errors (and warnings).")
2 changes: 1 addition & 1 deletion tests/test_setitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def test_byte_index(self):
self.assertTrue(np.array_equal(self.azeros[[0, 1, 2]].sig, self.aones[[0, 1, 2]].sig))

def test_asig_index(self):
self.azeros[self.aones.sig.astype(np.bool)] = self.aones.sig
self.azeros[self.aones.sig.astype(bool)] = self.aones.sig
self.assertTrue(np.array_equal(np.ones(self.sr), self.azeros.sig))

def test_invalid_slicing_type(self):
Expand Down

0 comments on commit 919b131

Please sign in to comment.