Skip to content

Commit

Permalink
Fix pytest (maybe last)
Browse files Browse the repository at this point in the history
  • Loading branch information
dotX12 committed Feb 18, 2024
1 parent d57a1a3 commit 160f812
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 36 deletions.
4 changes: 2 additions & 2 deletions shazamio/converter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any
from typing import Any, Dict

from pydub import AudioSegment
from shazamio.algorithm import SignatureGenerator
Expand Down Expand Up @@ -42,7 +42,7 @@ async def all_cities_from_country(self, country: Union[CountryCode, str]) -> Lis

class Converter:
@staticmethod
def data_search(timezone: str, uri: str, samplems: int, timestamp: int) -> dict[str, Any]:
def data_search(timezone: str, uri: str, samplems: int, timestamp: int) -> Dict[str, Any]:
return {
"timezone": timezone,
"signature": {"uri": uri, "samplems": samplems},
Expand Down
34 changes: 0 additions & 34 deletions shazamio/signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,40 +164,6 @@ def decode_from_binary(cls, data: bytes):

return self

@classmethod
def decode_from_uri(cls, uri: str):
assert uri.startswith(DATA_URI_PREFIX)

return cls.decode_from_binary(b64decode(uri.replace(DATA_URI_PREFIX, "", 1)))

"""
Encode the current object to a readable JSON format, for debugging
purposes.
"""

def encode_to_json(self) -> dict:
return {
"sample_rate_hz": self.sample_rate_hz,
"number_samples": self.number_samples,
"_seconds": self.number_samples / self.sample_rate_hz,
"frequency_band_to_peaks": {
frequency_band.name.strip("_"): [
{
"fft_pass_number": frequency_peak.fft_pass_number,
"peak_magnitude": frequency_peak.peak_magnitude,
"corrected_peak_frequency_bin": frequency_peak.corrected_peak_frequency_bin,
"_frequency_hz": frequency_peak.get_frequency_hz(),
"_amplitude_pcm": frequency_peak.get_amplitude_pcm(),
"_seconds": frequency_peak.get_seconds(),
}
for frequency_peak in frequency_peaks
]
for frequency_band, frequency_peaks in sorted(
self.frequency_band_to_sound_peaks.items()
)
},
}

def encode_to_binary(self) -> bytes:
header = RawSignatureHeader()

Expand Down

0 comments on commit 160f812

Please sign in to comment.