mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-16 20:40:10 +01:00
Run ruff
This commit is contained in:
parent
522b8b03d7
commit
3fd2abc1f9
@ -1,15 +1,15 @@
|
||||
import linguars
|
||||
from functools import lru_cache
|
||||
|
||||
import linguars
|
||||
|
||||
|
||||
class Language:
|
||||
def __init__(self, code, confidence):
|
||||
self.code = code
|
||||
self.confidence = float(confidence)
|
||||
|
||||
def __str__(self):
|
||||
return ("code: {:<9} confidence: {:>5.1f} ".format(
|
||||
self.code,
|
||||
self.confidence))
|
||||
return (f"code: {self.code:<9} confidence: {self.confidence:>5.1f} ")
|
||||
|
||||
@lru_cache(maxsize=None)
|
||||
def load_detector(langcodes = ()):
|
||||
@ -17,7 +17,7 @@ def load_detector(langcodes = ()):
|
||||
for lc in langcodes:
|
||||
try:
|
||||
languages.append(linguars.Language.from_iso_code_639_1(lc))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
print(f"{lc} is not supported by lingua")
|
||||
pass # Not supported
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
from functools import lru_cache
|
||||
|
||||
from argostranslate import translate
|
||||
from functools import lru_cache
|
||||
|
||||
from libretranslate.detect import Detector
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user