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: paths:
- '*.py' - '*.py'
- 'requirements.txt' - 'requirements.txt'
- 'app/**' - 'libretranslate/**'
- 'tests/**'
- '.github/workflows/run-tests.yml' - '.github/workflows/run-tests.yml'
jobs: jobs:

View file

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

View file

@ -3,7 +3,7 @@ import sqlite3
import uuid import uuid
import requests import requests
from expiringdict import ExpiringDict 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'] 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.utils import secure_filename
from werkzeug.exceptions import HTTPException from werkzeug.exceptions import HTTPException
from app import flood, remove_translated_files, security from libretranslate import flood, remove_translated_files, security
from app.language import detect_languages, improve_translation_formatting from libretranslate.language import detect_languages, improve_translation_formatting
from .api_keys import Database, RemoteDatabase from .api_keys import Database, RemoteDatabase
from .suggestions import Database as SuggestionsDatabase 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): def create_app(args):
from app.init import boot from libretranslate.init import boot
boot(args.load_only, args.update_models) boot(args.load_only, args.update_models)
from app.language import load_languages from libretranslate.language import load_languages
app = Flask(__name__) app = Flask(__name__)

View file

@ -2,7 +2,7 @@ from pathlib import Path
from argostranslate import package, translate from argostranslate import package, translate
import app.language import libretranslate.language
def boot(load_only=None, update_models=False): def boot(load_only=None, update_models=False):

View file

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

View file

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

View file

@ -1,8 +1,8 @@
import argparse import argparse
import os import os
from app.api_keys import Database from libretranslate.api_keys import Database
from app.default_values import DEFAULT_ARGUMENTS as DEFARGS from libretranslate.default_values import DEFAULT_ARGUMENTS as DEFARGS
def manage(): 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 sys
import pytest import pytest
from app.app import create_app from libretranslate.app import create_app
from app.default_values import DEFAULT_ARGUMENTS from libretranslate.default_values import DEFAULT_ARGUMENTS
from app.main import get_args from libretranslate.main import get_args
@pytest.fixture() @pytest.fixture()

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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