mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-23 00:11:03 +00:00
app->libretranslate; mv tests/ inside libretranslate/
This commit is contained in:
parent
40a1141eac
commit
a23a9fbd75
47 changed files with 24 additions and 25 deletions
3
.github/workflows/run-tests.yml
vendored
3
.github/workflows/run-tests.yml
vendored
|
@ -9,8 +9,7 @@ on:
|
|||
paths:
|
||||
- '*.py'
|
||||
- 'requirements.txt'
|
||||
- 'app/**'
|
||||
- 'tests/**'
|
||||
- 'libretranslate/**'
|
||||
- '.github/workflows/run-tests.yml'
|
||||
|
||||
jobs:
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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']
|
||||
|
|
@ -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__)
|
||||
|
|
@ -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):
|
|
@ -1,7 +1,7 @@
|
|||
import string
|
||||
|
||||
from argostranslate import translate
|
||||
from app.detect import Detector, UnknownLanguage
|
||||
from libretranslate.detect import Detector, UnknownLanguage
|
||||
|
||||
__languages = None
|
||||
|
|
@ -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():
|
|
@ -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():
|
Before Width: | Height: | Size: 262 KiB After Width: | Height: | Size: 262 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
@ -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()
|
|
@ -1,4 +1,4 @@
|
|||
from app.init import boot
|
||||
from libretranslate.init import boot
|
||||
from argostranslate import package
|
||||
|
||||
|
2
main.py
2
main.py
|
@ -1,4 +1,4 @@
|
|||
from app import main
|
||||
from libretranslate import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from app import manage
|
||||
from libretranslate import manage
|
||||
|
||||
if __name__ == "__main__":
|
||||
manage()
|
||||
|
|
|
@ -6,7 +6,7 @@ exclude = .git,
|
|||
venv,
|
||||
test,
|
||||
setup.py,
|
||||
app/__init__.py
|
||||
libretranslate/__init__.py
|
||||
|
||||
max-line-length = 136
|
||||
ignore = E741
|
||||
|
|
4
setup.py
4
setup.py
|
@ -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'
|
||||
],
|
||||
},
|
||||
|
||||
|
|
2
wsgi.py
2
wsgi.py
|
@ -1,4 +1,4 @@
|
|||
from app import main
|
||||
from libretranslate import main
|
||||
|
||||
def app(*args, **kwargs):
|
||||
import sys
|
||||
|
|
Loading…
Reference in a new issue