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