1
0
mirror of https://github.com/LibreTranslate/LibreTranslate.git synced 2024-11-16 10:08:23 +02:00

app->libretranslate; mv tests/ inside libretranslate/

This commit is contained in:
reynoldsnlp 2022-12-29 16:44:53 -07:00
parent 40a1141eac
commit a23a9fbd75
47 changed files with 24 additions and 25 deletions

View File

@ -9,8 +9,7 @@ on:
paths:
- '*.py'
- 'requirements.txt'
- 'app/**'
- 'tests/**'
- 'libretranslate/**'
- '.github/workflows/run-tests.yml'
jobs:

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
import argparse
from app.init import check_and_install_models
from libretranslate.init import check_and_install_models
if __name__ == "__main__":
parser = argparse.ArgumentParser()

View File

@ -3,7 +3,7 @@ import sqlite3
import uuid
import requests
from expiringdict import ExpiringDict
from app.default_values import DEFAULT_ARGUMENTS as DEFARGS
from libretranslate.default_values import DEFAULT_ARGUMENTS as DEFARGS
DEFAULT_DB_PATH = DEFARGS['API_KEYS_DB_PATH']

View File

@ -16,8 +16,8 @@ from translatehtml import translate_html
from werkzeug.utils import secure_filename
from werkzeug.exceptions import HTTPException
from app import flood, remove_translated_files, security
from app.language import detect_languages, improve_translation_formatting
from libretranslate import flood, remove_translated_files, security
from libretranslate.language import detect_languages, improve_translation_formatting
from .api_keys import Database, RemoteDatabase
from .suggestions import Database as SuggestionsDatabase
@ -100,11 +100,11 @@ def get_routes_limits(default_req_limit, daily_req_limit, api_keys_db):
def create_app(args):
from app.init import boot
from libretranslate.init import boot
boot(args.load_only, args.update_models)
from app.language import load_languages
from libretranslate.language import load_languages
app = Flask(__name__)

View File

@ -2,7 +2,7 @@ from pathlib import Path
from argostranslate import package, translate
import app.language
import libretranslate.language
def boot(load_only=None, update_models=False):
@ -57,4 +57,4 @@ def check_and_install_models(force=False, load_only_lang_codes=None):
print(
"Loaded support for %s languages (%s models total)!"
% (len(translate.get_installed_languages()), len(available_packages))
)
)

View File

@ -1,7 +1,7 @@
import string
from argostranslate import translate
from app.detect import Detector, UnknownLanguage
from libretranslate.detect import Detector, UnknownLanguage
__languages = None

View File

@ -2,8 +2,8 @@ import argparse
import operator
import sys
from app.app import create_app
from app.default_values import DEFAULT_ARGUMENTS as DEFARGS
from libretranslate.app import create_app
from libretranslate.default_values import DEFAULT_ARGUMENTS as DEFARGS
def get_args():

View File

@ -1,8 +1,8 @@
import argparse
import os
from app.api_keys import Database
from app.default_values import DEFAULT_ARGUMENTS as DEFARGS
from libretranslate.api_keys import Database
from libretranslate.default_values import DEFAULT_ARGUMENTS as DEFARGS
def manage():

View File

Before

Width:  |  Height:  |  Size: 262 KiB

After

Width:  |  Height:  |  Size: 262 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -1,9 +1,9 @@
import sys
import pytest
from app.app import create_app
from app.default_values import DEFAULT_ARGUMENTS
from app.main import get_args
from libretranslate.app import create_app
from libretranslate.default_values import DEFAULT_ARGUMENTS
from libretranslate.main import get_args
@pytest.fixture()

View File

@ -1,4 +1,4 @@
from app.init import boot
from libretranslate.init import boot
from argostranslate import package

View File

@ -1,4 +1,4 @@
from app import main
from libretranslate import main
if __name__ == "__main__":
main()

View File

@ -1,4 +1,4 @@
from app import manage
from libretranslate import manage
if __name__ == "__main__":
manage()

View File

@ -6,7 +6,7 @@ exclude = .git,
venv,
test,
setup.py,
app/__init__.py
libretranslate/__init__.py
max-line-length = 136
ignore = E741

View File

@ -17,8 +17,8 @@ setup(
include_package_data=True,
entry_points={
'console_scripts': [
'libretranslate=app.main:main',
'ltmanage=app.manage:manage'
'libretranslate=libretranslate.main:main',
'ltmanage=libretranslate.manage:manage'
],
},

View File

@ -1,4 +1,4 @@
from app import main
from libretranslate import main
def app(*args, **kwargs):
import sys