📝[Refactor] ruffを使用しコード検証修正を行った

This commit is contained in:
misyaguziya
2023-11-08 17:35:50 +09:00
parent 02acc4a191
commit 4351122cb4
17 changed files with 107 additions and 90 deletions

View File

@@ -1,5 +1,4 @@
from time import sleep
from typing import List
from pythonosc import osc_message_builder
from pythonosc import udp_client
from pythonosc import dispatcher
@@ -15,7 +14,7 @@ def sendTyping(flag=False, ip_address="127.0.0.1", port=9000):
# send OSC message
def sendMessage(message=None, ip_address="127.0.0.1", port=9000):
if message != None:
if message is not None:
msg = osc_message_builder.OscMessageBuilder(address="/chatbox/input")
msg.add_arg(f"{message}")
msg.add_arg(True)

View File

@@ -38,7 +38,7 @@ class AudioTranscriber:
# os.close(fd)
audio_data = self.audio_sources["process_data_func"]()
text = self.audio_recognizer.recognize_google(audio_data, language=transcription_lang[language][country])
except Exception as e:
except Exception:
pass
finally:
pass

View File

@@ -1,7 +1,7 @@
from deepl import Translator as deepl_Translator
from deepl_translate import translate as deepl_web_Translator
from translators import translate_text as other_web_Translator
from .translation_languages import translatorEngine, translation_lang
from .translation_languages import translation_lang
# Translator
class Translator():
@@ -16,7 +16,7 @@ class Translator():
try:
self.deepl_client = deepl_Translator(authkey)
self.deepl_client.translate_text(" ", target_lang="EN-US")
except:
except Exception:
result = False
return result
@@ -52,7 +52,7 @@ class Translator():
from_language=source_language,
to_language=target_language,
)
except Exception as e:
except Exception:
import traceback
with open('error.log', 'a') as f:
traceback.print_exc(file=f)

View File

@@ -33,7 +33,7 @@ def XSOverlay(
with open(icon, "rb") as f:
icon_data_bytes = f.read()
icon_data = base64.b64encode(icon_data_bytes).decode("utf-8")
except:
except Exception:
icon_data = "default"
else:
icon_data = icon