Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try:
langs = tts_langs()
if lang.lower() not in langs:
raise ValueError("Language not supported: %s" % lang)
except RuntimeError as e:
log.debug(str(e), exc_info=True)
log.warning(str(e))
self.lang_check = lang_check
self.lang = lang.lower()
# Read speed
if slow:
self.speed = Speed.SLOW
else:
self.speed = Speed.NORMAL
# Pre-processors and tokenizer
self.pre_processor_funcs = pre_processor_funcs
self.tokenizer_func = tokenizer_func
# Google Translate token
self.token = gtts_token.Token()
# Language
if lang_check:
try:
langs = gtts.tts.tts_langs()
if lang.lower() not in langs:
raise ValueError("Language not supported: %s" % lang)
except RuntimeError:
pass
self.lang_check = lang_check
self.lang = lang.lower()
# Read speed
if slow:
self.speed = gtts.tts.Speed.SLOW
else:
self.speed = gtts.tts.Speed.NORMAL
# Pre-processors and tokenizer
self.pre_processor_funcs = pre_processor_funcs
self.tokenizer_func = tokenizer_func
# Google Translate token
self.token = _Token()
# Language
if lang_check:
try:
langs = tts_langs()
if lang.lower() not in langs:
raise ValueError("Language not supported: %s" % lang)
except RuntimeError as e:
log.debug(str(e), exc_info=True)
log.warning(str(e))
self.lang_check = lang_check
self.lang = lang.lower()
# Read speed
if slow:
self.speed = Speed.SLOW
else:
self.speed = Speed.NORMAL
# Pre-processors and tokenizer
self.pre_processor_funcs = pre_processor_funcs
self.tokenizer_func = tokenizer_func
# Google Translate token
self.token = gtts_token.Token()
if lang_check:
try:
langs = gtts.tts.tts_langs()
if lang.lower() not in langs:
raise ValueError("Language not supported: %s" % lang)
except RuntimeError:
pass
self.lang_check = lang_check
self.lang = lang.lower()
# Read speed
if slow:
self.speed = gtts.tts.Speed.SLOW
else:
self.speed = gtts.tts.Speed.NORMAL
# Pre-processors and tokenizer
self.pre_processor_funcs = pre_processor_funcs
self.tokenizer_func = tokenizer_func
# Google Translate token
self.token = _Token()