Skip to content

Commit

Permalink
Fix mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
PJ-Finlay committed Aug 15, 2024
1 parent 1db4060 commit 4a3732e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 24 deletions.
2 changes: 1 addition & 1 deletion argostranslate/apply_bpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def isolate_glossary(word, glossary):
if __name__ == "__main__":

currentdir = os.path.dirname(
os.path.abspath(inspect.getfile(inspect.currentframe()))
os.path.abspath(inspect.getfile(inspect.currentframe())) # type: ignore
)
newdir = os.path.join(currentdir, "subword_nmt")
if os.path.isdir(newdir):
Expand Down
4 changes: 2 additions & 2 deletions argostranslate/sbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def parse_fewshot_response(response_text: str) -> str | None:
return response[-1]


def process_seq2seq_sbd(input_text: str, sbd_translated_guess: str) -> int:
def process_seq2seq_sbd(input_text: str, sbd_translated_guess: str) -> int | None:
sbd_translated_guess_index = sbd_translated_guess.find(SENTENCE_BOUNDARY_TOKEN)
if sbd_translated_guess_index != -1:
sbd_translated_guess = sbd_translated_guess[:sbd_translated_guess_index]
Expand All @@ -107,7 +107,7 @@ def process_seq2seq_sbd(input_text: str, sbd_translated_guess: str) -> int:

def detect_sentence(
input_text: str, sbd_translation, sentence_guess_length: int = 150
) -> int:
) -> int | None:
"""Given input text, return the index after the end of the first sentence.
Args:
Expand Down
16 changes: 0 additions & 16 deletions argostranslate/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,22 +466,6 @@ def get_installed_languages() -> list[Language]:
)
from_lang.translations_from.append(remote_translation)
to_lang.translations_to.append(remote_translation)
elif (
argostranslate.settings.model_provider
== argostranslate.settings.ModelProvider.OPENAI
):
language_model = argostranslate.apis.OpenAIAPI(
argostranslate.settings.openai_api_key
)
# TODO
languages = [Language("en", "English"), Language("es", "Spanish")]
for from_lang in languages:
for to_lang in languages:
few_shot_translation = FewShotTranslation(
from_lang, to_lang, language_model
)
from_lang.translations_from.append(few_shot_translation)
to_lang.translations_to.append(few_shot_translation)

info("languages", languages)

Expand Down
5 changes: 0 additions & 5 deletions argostranslate/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
# https://docs.python.org/3/library/logging.html#levels


def debug(*argv):
"""Debug level log"""
logger.debug(str(argv))


def get_json_string(argv):
if len(argv) == 1:
return json.dumps(str(argv[0]))
Expand Down

0 comments on commit 4a3732e

Please sign in to comment.