Merge pull request #2163 from forslund/bugfix/metaclass
Fix obsolete metaclass declarations.pull/2165/head
commit
e9879d91bf
|
@ -15,7 +15,7 @@
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
|
|
||||||
|
|
||||||
class AudioBackend:
|
class AudioBackend(metaclass=ABCMeta):
|
||||||
"""
|
"""
|
||||||
Base class for all audio backend implementations.
|
Base class for all audio backend implementations.
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ class AudioBackend:
|
||||||
config: configuration dict for the instance
|
config: configuration dict for the instance
|
||||||
bus: Mycroft messagebus emitter
|
bus: Mycroft messagebus emitter
|
||||||
"""
|
"""
|
||||||
__metaclass__ = ABCMeta
|
|
||||||
|
|
||||||
def __init__(self, config, bus):
|
def __init__(self, config, bus):
|
||||||
self._track_start_callback = None
|
self._track_start_callback = None
|
||||||
|
@ -115,7 +114,6 @@ class AudioBackend:
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def seek_forward(self, seconds=1):
|
def seek_forward(self, seconds=1):
|
||||||
"""
|
"""
|
||||||
Skip X seconds
|
Skip X seconds
|
||||||
|
@ -125,7 +123,6 @@ class AudioBackend:
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def seek_backward(self, seconds=1):
|
def seek_backward(self, seconds=1):
|
||||||
"""
|
"""
|
||||||
Rewind X seconds
|
Rewind X seconds
|
||||||
|
|
|
@ -25,9 +25,8 @@ from mycroft.configuration import Configuration
|
||||||
from mycroft.util.log import LOG
|
from mycroft.util.log import LOG
|
||||||
|
|
||||||
|
|
||||||
class STT:
|
class STT(metaclass=ABCMeta):
|
||||||
__metaclass__ = ABCMeta
|
""" STT Base class, all STT backends derives from this one. """
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
config_core = Configuration.get()
|
config_core = Configuration.get()
|
||||||
self.lang = str(self.init_language(config_core))
|
self.lang = str(self.init_language(config_core))
|
||||||
|
@ -50,24 +49,19 @@ class STT:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TokenSTT(STT):
|
class TokenSTT(STT, metaclass=ABCMeta):
|
||||||
__metaclass__ = ABCMeta
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(TokenSTT, self).__init__()
|
super(TokenSTT, self).__init__()
|
||||||
self.token = str(self.credential.get("token"))
|
self.token = str(self.credential.get("token"))
|
||||||
|
|
||||||
|
|
||||||
class GoogleJsonSTT(STT):
|
class GoogleJsonSTT(STT, metaclass=ABCMeta):
|
||||||
__metaclass__ = ABCMeta
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(GoogleJsonSTT, self).__init__()
|
super(GoogleJsonSTT, self).__init__()
|
||||||
self.json_credentials = json.dumps(self.credential.get("json"))
|
self.json_credentials = json.dumps(self.credential.get("json"))
|
||||||
|
|
||||||
|
|
||||||
class BasicSTT(STT):
|
class BasicSTT(STT, metaclass=ABCMeta):
|
||||||
__metaclass__ = ABCMeta
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(BasicSTT, self).__init__()
|
super(BasicSTT, self).__init__()
|
||||||
|
@ -75,8 +69,7 @@ class BasicSTT(STT):
|
||||||
self.password = str(self.credential.get("password"))
|
self.password = str(self.credential.get("password"))
|
||||||
|
|
||||||
|
|
||||||
class KeySTT(STT):
|
class KeySTT(STT, metaclass=ABCMeta):
|
||||||
__metaclass__ = ABCMeta
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(KeySTT, self).__init__()
|
super(KeySTT, self).__init__()
|
||||||
|
@ -169,11 +162,10 @@ class DeepSpeechServerSTT(STT):
|
||||||
return response.text
|
return response.text
|
||||||
|
|
||||||
|
|
||||||
class StreamThread(Thread):
|
class StreamThread(Thread, metaclass=ABCMeta):
|
||||||
"""
|
"""
|
||||||
ABC class to be used with StreamingSTT class implementations.
|
ABC class to be used with StreamingSTT class implementations.
|
||||||
"""
|
"""
|
||||||
__metaclass__ = ABCMeta
|
|
||||||
|
|
||||||
def __init__(self, queue, language):
|
def __init__(self, queue, language):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -197,12 +189,10 @@ class StreamThread(Thread):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class StreamingSTT(STT):
|
class StreamingSTT(STT, metaclass=ABCMeta):
|
||||||
"""
|
"""
|
||||||
ABC class for threaded streaming STT implemenations.
|
ABC class for threaded streaming STT implemenations.
|
||||||
"""
|
"""
|
||||||
__metaclass__ = ABCMeta
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.stream = None
|
self.stream = None
|
||||||
|
|
|
@ -141,7 +141,7 @@ class PlaybackThread(Thread):
|
||||||
self.clear_queue()
|
self.clear_queue()
|
||||||
|
|
||||||
|
|
||||||
class TTS:
|
class TTS(metaclass=ABCMeta):
|
||||||
"""
|
"""
|
||||||
TTS abstract class to be implemented by all TTS engines.
|
TTS abstract class to be implemented by all TTS engines.
|
||||||
|
|
||||||
|
@ -155,8 +155,6 @@ class TTS:
|
||||||
phonetic_spelling (bool): Whether to spell certain words phonetically
|
phonetic_spelling (bool): Whether to spell certain words phonetically
|
||||||
ssml_tags (list): Supported ssml properties. Ex. ['speak', 'prosody']
|
ssml_tags (list): Supported ssml properties. Ex. ['speak', 'prosody']
|
||||||
"""
|
"""
|
||||||
__metaclass__ = ABCMeta
|
|
||||||
|
|
||||||
def __init__(self, lang, config, validator, audio_ext='wav',
|
def __init__(self, lang, config, validator, audio_ext='wav',
|
||||||
phonetic_spelling=True, ssml_tags=None):
|
phonetic_spelling=True, ssml_tags=None):
|
||||||
super(TTS, self).__init__()
|
super(TTS, self).__init__()
|
||||||
|
@ -395,15 +393,13 @@ class TTS:
|
||||||
self.playback.join()
|
self.playback.join()
|
||||||
|
|
||||||
|
|
||||||
class TTSValidator:
|
class TTSValidator(metaclass=ABCMeta):
|
||||||
"""
|
"""
|
||||||
TTS Validator abstract class to be implemented by all TTS engines.
|
TTS Validator abstract class to be implemented by all TTS engines.
|
||||||
|
|
||||||
It exposes and implements ``validate(tts)`` function as a template to
|
It exposes and implements ``validate(tts)`` function as a template to
|
||||||
validate the TTS engines.
|
validate the TTS engines.
|
||||||
"""
|
"""
|
||||||
__metaclass__ = ABCMeta
|
|
||||||
|
|
||||||
def __init__(self, tts):
|
def __init__(self, tts):
|
||||||
self.tts = tts
|
self.tts = tts
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue