nidhal baccouri
commited on
Commit
·
7a05cd7
1
Parent(s):
76aa3b2
sorted imports
Browse files- Makefile +2 -4
- deep_translator/__init__.py +7 -7
- deep_translator/base.py +3 -2
- deep_translator/cli.py +2 -1
- deep_translator/deepl.py +6 -4
- deep_translator/detection.py +2 -2
- deep_translator/google.py +8 -6
- deep_translator/libre.py +5 -3
- deep_translator/linguee.py +10 -8
- deep_translator/microsoft.py +6 -4
- deep_translator/mymemory.py +7 -5
- deep_translator/papago.py +5 -3
- deep_translator/pons.py +8 -7
- deep_translator/qcri.py +4 -2
- deep_translator/validate.py +1 -1
- deep_translator/yandex.py +5 -3
- docs/conf.py +2 -0
- examples/linguee.py +0 -1
- examples/mymemory.py +0 -1
- examples/pons.py +0 -1
- examples/trans.py +1 -2
- poetry.lock +19 -1
- pyproject.toml +1 -0
- tests/test_cli.py +4 -2
- tests/test_deepl.py +3 -1
- tests/test_google.py +2 -1
- tests/test_libre.py +2 -1
- tests/test_linguee.py +2 -1
- tests/test_microsoft_trans.py +3 -2
- tests/test_mymemory.py +2 -1
- tests/test_pons.py +2 -1
Makefile
CHANGED
@@ -47,15 +47,13 @@ clean-test: ## remove test and coverage artifacts
|
|
47 |
rm -fr htmlcov/
|
48 |
rm -fr .pytest_cache
|
49 |
|
50 |
-
|
|
|
51 |
poetry run black deep_translator tests
|
52 |
|
53 |
test: ## run tests quickly with the default Python
|
54 |
pytest
|
55 |
|
56 |
-
test-all: ## run tests on every Python version with tox
|
57 |
-
tox
|
58 |
-
|
59 |
coverage: ## check code coverage quickly with the default Python
|
60 |
coverage run --source deep_translator -m pytest
|
61 |
coverage report -m
|
|
|
47 |
rm -fr htmlcov/
|
48 |
rm -fr .pytest_cache
|
49 |
|
50 |
+
format: ## format with black
|
51 |
+
poetry run isort .
|
52 |
poetry run black deep_translator tests
|
53 |
|
54 |
test: ## run tests quickly with the default Python
|
55 |
pytest
|
56 |
|
|
|
|
|
|
|
57 |
coverage: ## check code coverage quickly with the default Python
|
58 |
coverage run --source deep_translator -m pytest
|
59 |
coverage report -m
|
deep_translator/__init__.py
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
"""Top-level package for Deep Translator"""
|
2 |
|
|
|
|
|
3 |
from deep_translator.google import GoogleTranslator
|
4 |
-
from deep_translator.
|
5 |
from deep_translator.linguee import LingueeTranslator
|
6 |
-
from deep_translator.mymemory import MyMemoryTranslator
|
7 |
-
from deep_translator.yandex import YandexTranslator
|
8 |
-
from deep_translator.qcri import QcriTranslator
|
9 |
-
from deep_translator.deepl import DeeplTranslator
|
10 |
-
from deep_translator.detection import single_detection, batch_detection
|
11 |
from deep_translator.microsoft import MicrosoftTranslator
|
|
|
12 |
from deep_translator.papago import PapagoTranslator
|
13 |
-
from deep_translator.
|
|
|
|
|
14 |
|
15 |
__author__ = """Nidhal Baccouri"""
|
16 |
__email__ = "[email protected]"
|
|
|
1 |
"""Top-level package for Deep Translator"""
|
2 |
|
3 |
+
from deep_translator.deepl import DeeplTranslator
|
4 |
+
from deep_translator.detection import batch_detection, single_detection
|
5 |
from deep_translator.google import GoogleTranslator
|
6 |
+
from deep_translator.libre import LibreTranslator
|
7 |
from deep_translator.linguee import LingueeTranslator
|
|
|
|
|
|
|
|
|
|
|
8 |
from deep_translator.microsoft import MicrosoftTranslator
|
9 |
+
from deep_translator.mymemory import MyMemoryTranslator
|
10 |
from deep_translator.papago import PapagoTranslator
|
11 |
+
from deep_translator.pons import PonsTranslator
|
12 |
+
from deep_translator.qcri import QcriTranslator
|
13 |
+
from deep_translator.yandex import YandexTranslator
|
14 |
|
15 |
__author__ = """Nidhal Baccouri"""
|
16 |
__email__ = "[email protected]"
|
deep_translator/base.py
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
"""base translator class"""
|
2 |
|
|
|
|
|
|
|
3 |
from deep_translator.constants import GOOGLE_LANGUAGES_TO_CODES
|
4 |
from deep_translator.exceptions import InvalidSourceOrTargetLanguage
|
5 |
-
from abc import ABC, abstractmethod
|
6 |
-
from typing import Optional, List, Union
|
7 |
|
8 |
|
9 |
class BaseTranslator(ABC):
|
|
|
1 |
"""base translator class"""
|
2 |
|
3 |
+
from abc import ABC, abstractmethod
|
4 |
+
from typing import List, Optional, Union
|
5 |
+
|
6 |
from deep_translator.constants import GOOGLE_LANGUAGES_TO_CODES
|
7 |
from deep_translator.exceptions import InvalidSourceOrTargetLanguage
|
|
|
|
|
8 |
|
9 |
|
10 |
class BaseTranslator(ABC):
|
deep_translator/cli.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
"""Console script for deep_translator."""
|
2 |
import argparse
|
3 |
-
from deep_translator.engines import __engines__
|
4 |
from typing import Optional
|
5 |
|
|
|
|
|
6 |
|
7 |
class CLI(object):
|
8 |
translators_dict = __engines__
|
|
|
1 |
"""Console script for deep_translator."""
|
2 |
import argparse
|
|
|
3 |
from typing import Optional
|
4 |
|
5 |
+
from deep_translator.engines import __engines__
|
6 |
+
|
7 |
|
8 |
class CLI(object):
|
9 |
translators_dict = __engines__
|
deep_translator/deepl.py
CHANGED
@@ -1,13 +1,15 @@
|
|
|
|
|
|
1 |
import requests
|
2 |
-
|
3 |
-
from deep_translator.
|
4 |
from deep_translator.constants import BASE_URLS, DEEPL_LANGUAGE_TO_CODE
|
5 |
from deep_translator.exceptions import (
|
|
|
6 |
ServerException,
|
7 |
TranslationNotFound,
|
8 |
-
AuthorizationException,
|
9 |
)
|
10 |
-
from deep_translator.
|
11 |
|
12 |
|
13 |
class DeeplTranslator(BaseTranslator):
|
|
|
1 |
+
from typing import List, Optional
|
2 |
+
|
3 |
import requests
|
4 |
+
|
5 |
+
from deep_translator.base import BaseTranslator
|
6 |
from deep_translator.constants import BASE_URLS, DEEPL_LANGUAGE_TO_CODE
|
7 |
from deep_translator.exceptions import (
|
8 |
+
AuthorizationException,
|
9 |
ServerException,
|
10 |
TranslationNotFound,
|
|
|
11 |
)
|
12 |
+
from deep_translator.validate import is_empty, is_input_valid
|
13 |
|
14 |
|
15 |
class DeeplTranslator(BaseTranslator):
|
deep_translator/detection.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
"""
|
2 |
language detection API
|
3 |
"""
|
|
|
|
|
4 |
import requests
|
5 |
from requests.exceptions import HTTPError
|
6 |
-
from typing import Optional, List, Union
|
7 |
-
|
8 |
|
9 |
# Module global config
|
10 |
config = {
|
|
|
1 |
"""
|
2 |
language detection API
|
3 |
"""
|
4 |
+
from typing import List, Optional, Union
|
5 |
+
|
6 |
import requests
|
7 |
from requests.exceptions import HTTPError
|
|
|
|
|
8 |
|
9 |
# Module global config
|
10 |
config = {
|
deep_translator/google.py
CHANGED
@@ -2,17 +2,19 @@
|
|
2 |
google translator API
|
3 |
"""
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
from deep_translator.constants import BASE_URLS
|
6 |
from deep_translator.exceptions import (
|
|
|
7 |
TooManyRequests,
|
8 |
TranslationNotFound,
|
9 |
-
RequestError,
|
10 |
)
|
11 |
-
from deep_translator.
|
12 |
-
from deep_translator.validate import is_input_valid, is_empty
|
13 |
-
from bs4 import BeautifulSoup
|
14 |
-
import requests
|
15 |
-
from typing import Optional, List
|
16 |
|
17 |
|
18 |
class GoogleTranslator(BaseTranslator):
|
|
|
2 |
google translator API
|
3 |
"""
|
4 |
|
5 |
+
from typing import List, Optional
|
6 |
+
|
7 |
+
import requests
|
8 |
+
from bs4 import BeautifulSoup
|
9 |
+
|
10 |
+
from deep_translator.base import BaseTranslator
|
11 |
from deep_translator.constants import BASE_URLS
|
12 |
from deep_translator.exceptions import (
|
13 |
+
RequestError,
|
14 |
TooManyRequests,
|
15 |
TranslationNotFound,
|
|
|
16 |
)
|
17 |
+
from deep_translator.validate import is_empty, is_input_valid
|
|
|
|
|
|
|
|
|
18 |
|
19 |
|
20 |
class GoogleTranslator(BaseTranslator):
|
deep_translator/libre.py
CHANGED
@@ -2,16 +2,18 @@
|
|
2 |
LibreTranslate API
|
3 |
"""
|
4 |
|
|
|
|
|
5 |
import requests
|
6 |
-
|
7 |
-
from deep_translator.validate import is_empty, is_input_valid
|
8 |
from deep_translator.base import BaseTranslator
|
9 |
from deep_translator.constants import BASE_URLS, LIBRE_LANGUAGES_TO_CODES
|
10 |
from deep_translator.exceptions import (
|
|
|
11 |
ServerException,
|
12 |
TranslationNotFound,
|
13 |
-
AuthorizationException,
|
14 |
)
|
|
|
15 |
|
16 |
|
17 |
class LibreTranslator(BaseTranslator):
|
|
|
2 |
LibreTranslate API
|
3 |
"""
|
4 |
|
5 |
+
from typing import List, Optional
|
6 |
+
|
7 |
import requests
|
8 |
+
|
|
|
9 |
from deep_translator.base import BaseTranslator
|
10 |
from deep_translator.constants import BASE_URLS, LIBRE_LANGUAGES_TO_CODES
|
11 |
from deep_translator.exceptions import (
|
12 |
+
AuthorizationException,
|
13 |
ServerException,
|
14 |
TranslationNotFound,
|
|
|
15 |
)
|
16 |
+
from deep_translator.validate import is_empty, is_input_valid
|
17 |
|
18 |
|
19 |
class LibreTranslator(BaseTranslator):
|
deep_translator/linguee.py
CHANGED
@@ -1,20 +1,22 @@
|
|
1 |
"""
|
2 |
linguee translator API
|
3 |
"""
|
4 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
from deep_translator.constants import BASE_URLS, LINGUEE_LANGUAGES_TO_CODES
|
6 |
from deep_translator.exceptions import (
|
7 |
-
TranslationNotFound,
|
8 |
-
NotValidPayload,
|
9 |
ElementNotFoundInGetRequest,
|
|
|
10 |
RequestError,
|
11 |
TooManyRequests,
|
|
|
12 |
)
|
13 |
-
from deep_translator.
|
14 |
-
from bs4 import BeautifulSoup
|
15 |
-
import requests
|
16 |
-
from requests.utils import requote_uri
|
17 |
-
from typing import Optional, List, Union
|
18 |
|
19 |
|
20 |
class LingueeTranslator(BaseTranslator):
|
|
|
1 |
"""
|
2 |
linguee translator API
|
3 |
"""
|
4 |
+
from typing import List, Optional, Union
|
5 |
+
|
6 |
+
import requests
|
7 |
+
from bs4 import BeautifulSoup
|
8 |
+
from requests.utils import requote_uri
|
9 |
+
|
10 |
+
from deep_translator.base import BaseTranslator
|
11 |
from deep_translator.constants import BASE_URLS, LINGUEE_LANGUAGES_TO_CODES
|
12 |
from deep_translator.exceptions import (
|
|
|
|
|
13 |
ElementNotFoundInGetRequest,
|
14 |
+
NotValidPayload,
|
15 |
RequestError,
|
16 |
TooManyRequests,
|
17 |
+
TranslationNotFound,
|
18 |
)
|
19 |
+
from deep_translator.validate import is_empty, is_input_valid
|
|
|
|
|
|
|
|
|
20 |
|
21 |
|
22 |
class LingueeTranslator(BaseTranslator):
|
deep_translator/microsoft.py
CHANGED
@@ -1,13 +1,15 @@
|
|
1 |
# -*- coding: utf-8 -*-
|
2 |
|
3 |
-
import requests
|
4 |
import logging
|
5 |
import sys
|
6 |
-
from
|
7 |
-
|
|
|
|
|
8 |
from deep_translator.base import BaseTranslator
|
|
|
|
|
9 |
from deep_translator.validate import is_input_valid
|
10 |
-
from typing import Optional, List
|
11 |
|
12 |
|
13 |
class MicrosoftTranslator(BaseTranslator):
|
|
|
1 |
# -*- coding: utf-8 -*-
|
2 |
|
|
|
3 |
import logging
|
4 |
import sys
|
5 |
+
from typing import List, Optional
|
6 |
+
|
7 |
+
import requests
|
8 |
+
|
9 |
from deep_translator.base import BaseTranslator
|
10 |
+
from deep_translator.constants import BASE_URLS
|
11 |
+
from deep_translator.exceptions import MicrosoftAPIerror, ServerException
|
12 |
from deep_translator.validate import is_input_valid
|
|
|
13 |
|
14 |
|
15 |
class MicrosoftTranslator(BaseTranslator):
|
deep_translator/mymemory.py
CHANGED
@@ -1,16 +1,18 @@
|
|
1 |
"""
|
2 |
mymemory translator API
|
3 |
"""
|
4 |
-
from
|
|
|
|
|
|
|
|
|
5 |
from deep_translator.constants import BASE_URLS
|
6 |
from deep_translator.exceptions import (
|
7 |
-
TranslationNotFound,
|
8 |
RequestError,
|
9 |
TooManyRequests,
|
|
|
10 |
)
|
11 |
-
from deep_translator.
|
12 |
-
import requests
|
13 |
-
from typing import Optional, List, Union
|
14 |
|
15 |
|
16 |
class MyMemoryTranslator(BaseTranslator):
|
|
|
1 |
"""
|
2 |
mymemory translator API
|
3 |
"""
|
4 |
+
from typing import List, Optional, Union
|
5 |
+
|
6 |
+
import requests
|
7 |
+
|
8 |
+
from deep_translator.base import BaseTranslator
|
9 |
from deep_translator.constants import BASE_URLS
|
10 |
from deep_translator.exceptions import (
|
|
|
11 |
RequestError,
|
12 |
TooManyRequests,
|
13 |
+
TranslationNotFound,
|
14 |
)
|
15 |
+
from deep_translator.validate import is_empty, is_input_valid
|
|
|
|
|
16 |
|
17 |
|
18 |
class MyMemoryTranslator(BaseTranslator):
|
deep_translator/papago.py
CHANGED
@@ -2,11 +2,13 @@
|
|
2 |
google translator API
|
3 |
"""
|
4 |
import json
|
|
|
|
|
|
|
|
|
|
|
5 |
from deep_translator.constants import BASE_URLS, PAPAGO_LANGUAGE_TO_CODE
|
6 |
from deep_translator.exceptions import TranslationNotFound
|
7 |
-
from deep_translator.base import BaseTranslator
|
8 |
-
import requests
|
9 |
-
from typing import Optional, List
|
10 |
from deep_translator.validate import is_input_valid
|
11 |
|
12 |
|
|
|
2 |
google translator API
|
3 |
"""
|
4 |
import json
|
5 |
+
from typing import List, Optional
|
6 |
+
|
7 |
+
import requests
|
8 |
+
|
9 |
+
from deep_translator.base import BaseTranslator
|
10 |
from deep_translator.constants import BASE_URLS, PAPAGO_LANGUAGE_TO_CODE
|
11 |
from deep_translator.exceptions import TranslationNotFound
|
|
|
|
|
|
|
12 |
from deep_translator.validate import is_input_valid
|
13 |
|
14 |
|
deep_translator/pons.py
CHANGED
@@ -1,21 +1,22 @@
|
|
1 |
"""
|
2 |
pons translator API
|
3 |
"""
|
4 |
-
from
|
|
|
5 |
import requests
|
|
|
|
|
6 |
|
7 |
-
from deep_translator.
|
8 |
from deep_translator.constants import BASE_URLS, PONS_CODES_TO_LANGUAGES
|
9 |
from deep_translator.exceptions import (
|
10 |
-
TranslationNotFound,
|
11 |
-
NotValidPayload,
|
12 |
ElementNotFoundInGetRequest,
|
|
|
13 |
RequestError,
|
14 |
TooManyRequests,
|
|
|
15 |
)
|
16 |
-
from deep_translator.
|
17 |
-
from requests.utils import requote_uri
|
18 |
-
from typing import Optional, Union, List
|
19 |
|
20 |
|
21 |
class PonsTranslator(BaseTranslator):
|
|
|
1 |
"""
|
2 |
pons translator API
|
3 |
"""
|
4 |
+
from typing import List, Optional, Union
|
5 |
+
|
6 |
import requests
|
7 |
+
from bs4 import BeautifulSoup
|
8 |
+
from requests.utils import requote_uri
|
9 |
|
10 |
+
from deep_translator.base import BaseTranslator
|
11 |
from deep_translator.constants import BASE_URLS, PONS_CODES_TO_LANGUAGES
|
12 |
from deep_translator.exceptions import (
|
|
|
|
|
13 |
ElementNotFoundInGetRequest,
|
14 |
+
NotValidPayload,
|
15 |
RequestError,
|
16 |
TooManyRequests,
|
17 |
+
TranslationNotFound,
|
18 |
)
|
19 |
+
from deep_translator.validate import is_empty, is_input_valid
|
|
|
|
|
20 |
|
21 |
|
22 |
class PonsTranslator(BaseTranslator):
|
deep_translator/qcri.py
CHANGED
@@ -1,8 +1,10 @@
|
|
|
|
|
|
1 |
import requests
|
|
|
|
|
2 |
from deep_translator.constants import BASE_URLS, QCRI_LANGUAGE_TO_CODE
|
3 |
from deep_translator.exceptions import ServerException, TranslationNotFound
|
4 |
-
from deep_translator.base import BaseTranslator
|
5 |
-
from typing import Optional, List
|
6 |
|
7 |
|
8 |
class QcriTranslator(BaseTranslator):
|
|
|
1 |
+
from typing import List, Optional
|
2 |
+
|
3 |
import requests
|
4 |
+
|
5 |
+
from deep_translator.base import BaseTranslator
|
6 |
from deep_translator.constants import BASE_URLS, QCRI_LANGUAGE_TO_CODE
|
7 |
from deep_translator.exceptions import ServerException, TranslationNotFound
|
|
|
|
|
8 |
|
9 |
|
10 |
class QcriTranslator(BaseTranslator):
|
deep_translator/validate.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from deep_translator.exceptions import
|
2 |
|
3 |
|
4 |
def is_empty(text: str) -> bool:
|
|
|
1 |
+
from deep_translator.exceptions import NotValidLength, NotValidPayload
|
2 |
|
3 |
|
4 |
def is_empty(text: str) -> bool:
|
deep_translator/yandex.py
CHANGED
@@ -1,17 +1,19 @@
|
|
1 |
"""
|
2 |
Yandex translator API
|
3 |
"""
|
|
|
|
|
4 |
import requests
|
|
|
|
|
5 |
from deep_translator.constants import BASE_URLS
|
6 |
from deep_translator.exceptions import (
|
7 |
RequestError,
|
8 |
ServerException,
|
9 |
-
TranslationNotFound,
|
10 |
TooManyRequests,
|
|
|
11 |
)
|
12 |
-
from deep_translator.base import BaseTranslator
|
13 |
from deep_translator.validate import is_input_valid
|
14 |
-
from typing import Optional, List
|
15 |
|
16 |
|
17 |
class YandexTranslator(BaseTranslator):
|
|
|
1 |
"""
|
2 |
Yandex translator API
|
3 |
"""
|
4 |
+
from typing import List, Optional
|
5 |
+
|
6 |
import requests
|
7 |
+
|
8 |
+
from deep_translator.base import BaseTranslator
|
9 |
from deep_translator.constants import BASE_URLS
|
10 |
from deep_translator.exceptions import (
|
11 |
RequestError,
|
12 |
ServerException,
|
|
|
13 |
TooManyRequests,
|
14 |
+
TranslationNotFound,
|
15 |
)
|
|
|
16 |
from deep_translator.validate import is_input_valid
|
|
|
17 |
|
18 |
|
19 |
class YandexTranslator(BaseTranslator):
|
docs/conf.py
CHANGED
@@ -19,6 +19,7 @@
|
|
19 |
#
|
20 |
import os
|
21 |
import sys
|
|
|
22 |
sys.path.insert(0, os.path.abspath('..'))
|
23 |
|
24 |
# import deep_translator
|
@@ -58,6 +59,7 @@ author = "Nidhal Baccouri"
|
|
58 |
#
|
59 |
# The short X.Y version.
|
60 |
import toml
|
|
|
61 |
with open("../pyproject.toml", "r") as f:
|
62 |
tom = toml.load(f)
|
63 |
version = tom['tool']['poetry']['version']
|
|
|
19 |
#
|
20 |
import os
|
21 |
import sys
|
22 |
+
|
23 |
sys.path.insert(0, os.path.abspath('..'))
|
24 |
|
25 |
# import deep_translator
|
|
|
59 |
#
|
60 |
# The short X.Y version.
|
61 |
import toml
|
62 |
+
|
63 |
with open("../pyproject.toml", "r") as f:
|
64 |
tom = toml.load(f)
|
65 |
version = tom['tool']['poetry']['version']
|
examples/linguee.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
|
2 |
from deep_translator import LingueeTranslator
|
3 |
|
4 |
-
|
5 |
res = LingueeTranslator(source='de', target='en').translate('laufen', return_all=False)
|
6 |
|
7 |
print(res)
|
|
|
1 |
|
2 |
from deep_translator import LingueeTranslator
|
3 |
|
|
|
4 |
res = LingueeTranslator(source='de', target='en').translate('laufen', return_all=False)
|
5 |
|
6 |
print(res)
|
examples/mymemory.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
|
2 |
from deep_translator import MyMemoryTranslator
|
3 |
|
4 |
-
|
5 |
res = MyMemoryTranslator(source='ar', target='en').translate('آخُذ اَلْباص.')
|
6 |
|
7 |
print(res)
|
|
|
1 |
|
2 |
from deep_translator import MyMemoryTranslator
|
3 |
|
|
|
4 |
res = MyMemoryTranslator(source='ar', target='en').translate('آخُذ اَلْباص.')
|
5 |
|
6 |
print(res)
|
examples/pons.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
|
2 |
from deep_translator import PonsTranslator
|
3 |
|
4 |
-
|
5 |
res = PonsTranslator(source='en', target='de').translate('good', return_all=False)
|
6 |
|
7 |
print(res)
|
|
|
1 |
|
2 |
from deep_translator import PonsTranslator
|
3 |
|
|
|
4 |
res = PonsTranslator(source='en', target='de').translate('good', return_all=False)
|
5 |
|
6 |
print(res)
|
examples/trans.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
from deep_translator import GoogleTranslator,
|
2 |
-
|
3 |
|
4 |
# examples using google translate
|
5 |
|
|
|
1 |
+
from deep_translator import GoogleTranslator, LingueeTranslator, PonsTranslator
|
|
|
2 |
|
3 |
# examples using google translate
|
4 |
|
poetry.lock
CHANGED
@@ -219,6 +219,20 @@ category = "dev"
|
|
219 |
optional = false
|
220 |
python-versions = "*"
|
221 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
[[package]]
|
223 |
name = "jeepney"
|
224 |
version = "0.7.1"
|
@@ -720,7 +734,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
|
|
720 |
[metadata]
|
721 |
lock-version = "1.1"
|
722 |
python-versions = "^3.7"
|
723 |
-
content-hash = "
|
724 |
|
725 |
[metadata.files]
|
726 |
alabaster = [
|
@@ -936,6 +950,10 @@ iniconfig = [
|
|
936 |
{file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"},
|
937 |
{file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"},
|
938 |
]
|
|
|
|
|
|
|
|
|
939 |
jeepney = [
|
940 |
{file = "jeepney-0.7.1-py3-none-any.whl", hash = "sha256:1b5a0ea5c0e7b166b2f5895b91a08c14de8915afda4407fb5022a195224958ac"},
|
941 |
{file = "jeepney-0.7.1.tar.gz", hash = "sha256:fa9e232dfa0c498bd0b8a3a73b8d8a31978304dcef0515adc859d4e096f96f4f"},
|
|
|
219 |
optional = false
|
220 |
python-versions = "*"
|
221 |
|
222 |
+
[[package]]
|
223 |
+
name = "isort"
|
224 |
+
version = "5.10.1"
|
225 |
+
description = "A Python utility / library to sort Python imports."
|
226 |
+
category = "dev"
|
227 |
+
optional = false
|
228 |
+
python-versions = ">=3.6.1,<4.0"
|
229 |
+
|
230 |
+
[package.extras]
|
231 |
+
pipfile_deprecated_finder = ["pipreqs", "requirementslib"]
|
232 |
+
requirements_deprecated_finder = ["pipreqs", "pip-api"]
|
233 |
+
colors = ["colorama (>=0.4.3,<0.5.0)"]
|
234 |
+
plugins = ["setuptools"]
|
235 |
+
|
236 |
[[package]]
|
237 |
name = "jeepney"
|
238 |
version = "0.7.1"
|
|
|
734 |
[metadata]
|
735 |
lock-version = "1.1"
|
736 |
python-versions = "^3.7"
|
737 |
+
content-hash = "999f9269962bc8ce6f5ad597f7aa7afc6d5a4382b8cadfd8ffe75cd8ed16a41e"
|
738 |
|
739 |
[metadata.files]
|
740 |
alabaster = [
|
|
|
950 |
{file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"},
|
951 |
{file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"},
|
952 |
]
|
953 |
+
isort = [
|
954 |
+
{file = "isort-5.10.1-py3-none-any.whl", hash = "sha256:6f62d78e2f89b4500b080fe3a81690850cd254227f27f75c3a0c491a1f351ba7"},
|
955 |
+
{file = "isort-5.10.1.tar.gz", hash = "sha256:e8443a5e7a020e9d7f97f1d7d9cd17c88bcb3bc7e218bf9cf5095fe550be2951"},
|
956 |
+
]
|
957 |
jeepney = [
|
958 |
{file = "jeepney-0.7.1-py3-none-any.whl", hash = "sha256:1b5a0ea5c0e7b166b2f5895b91a08c14de8915afda4407fb5022a195224958ac"},
|
959 |
{file = "jeepney-0.7.1.tar.gz", hash = "sha256:fa9e232dfa0c498bd0b8a3a73b8d8a31978304dcef0515adc859d4e096f96f4f"},
|
pyproject.toml
CHANGED
@@ -41,6 +41,7 @@ pytest = "^6.2.4"
|
|
41 |
pytest-runner = "^5.3.1"
|
42 |
toml = "^0.10.2"
|
43 |
black = "^22.1.0"
|
|
|
44 |
|
45 |
[build-system]
|
46 |
requires = ["poetry-core>=1.0.0"]
|
|
|
41 |
pytest-runner = "^5.3.1"
|
42 |
toml = "^0.10.2"
|
43 |
black = "^22.1.0"
|
44 |
+
isort = "^5.10.1"
|
45 |
|
46 |
[build-system]
|
47 |
requires = ["poetry-core>=1.0.0"]
|
tests/test_cli.py
CHANGED
@@ -2,10 +2,12 @@
|
|
2 |
|
3 |
"""Tests for the CLI interface."""
|
4 |
|
5 |
-
from deep_translator.cli import CLI
|
6 |
-
import pytest
|
7 |
import sys
|
8 |
|
|
|
|
|
|
|
|
|
9 |
|
10 |
@pytest.fixture
|
11 |
def mock_args():
|
|
|
2 |
|
3 |
"""Tests for the CLI interface."""
|
4 |
|
|
|
|
|
5 |
import sys
|
6 |
|
7 |
+
import pytest
|
8 |
+
|
9 |
+
from deep_translator.cli import CLI
|
10 |
+
|
11 |
|
12 |
@pytest.fixture
|
13 |
def mock_args():
|
tests/test_deepl.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
-
import pytest
|
2 |
from unittest.mock import Mock, patch
|
|
|
|
|
|
|
3 |
from deep_translator.deepl import DeeplTranslator
|
4 |
from deep_translator.exceptions import AuthorizationException
|
5 |
|
|
|
|
|
1 |
from unittest.mock import Mock, patch
|
2 |
+
|
3 |
+
import pytest
|
4 |
+
|
5 |
from deep_translator.deepl import DeeplTranslator
|
6 |
from deep_translator.exceptions import AuthorizationException
|
7 |
|
tests/test_google.py
CHANGED
@@ -3,7 +3,8 @@
|
|
3 |
"""Tests for `deep_translator` package."""
|
4 |
|
5 |
import pytest
|
6 |
-
|
|
|
7 |
from deep_translator.constants import GOOGLE_LANGUAGES_TO_CODES
|
8 |
|
9 |
|
|
|
3 |
"""Tests for `deep_translator` package."""
|
4 |
|
5 |
import pytest
|
6 |
+
|
7 |
+
from deep_translator import GoogleTranslator, exceptions
|
8 |
from deep_translator.constants import GOOGLE_LANGUAGES_TO_CODES
|
9 |
|
10 |
|
tests/test_libre.py
CHANGED
@@ -3,7 +3,8 @@
|
|
3 |
"""Tests for `deep_translator` package."""
|
4 |
|
5 |
import pytest
|
6 |
-
|
|
|
7 |
from deep_translator.constants import LIBRE_LANGUAGES_TO_CODES
|
8 |
|
9 |
|
|
|
3 |
"""Tests for `deep_translator` package."""
|
4 |
|
5 |
import pytest
|
6 |
+
|
7 |
+
from deep_translator import LibreTranslator, exceptions
|
8 |
from deep_translator.constants import LIBRE_LANGUAGES_TO_CODES
|
9 |
|
10 |
|
tests/test_linguee.py
CHANGED
@@ -3,7 +3,8 @@
|
|
3 |
"""Tests for `deep_translator` package."""
|
4 |
|
5 |
import pytest
|
6 |
-
|
|
|
7 |
|
8 |
|
9 |
@pytest.fixture
|
|
|
3 |
"""Tests for `deep_translator` package."""
|
4 |
|
5 |
import pytest
|
6 |
+
|
7 |
+
from deep_translator import LingueeTranslator, exceptions
|
8 |
|
9 |
|
10 |
@pytest.fixture
|
tests/test_microsoft_trans.py
CHANGED
@@ -2,11 +2,12 @@
|
|
2 |
|
3 |
"""Tests for `deep_translator` package."""
|
4 |
|
5 |
-
import pytest
|
6 |
from unittest.mock import patch
|
|
|
|
|
7 |
import requests
|
8 |
|
9 |
-
from deep_translator import
|
10 |
|
11 |
|
12 |
# mocked request.post
|
|
|
2 |
|
3 |
"""Tests for `deep_translator` package."""
|
4 |
|
|
|
5 |
from unittest.mock import patch
|
6 |
+
|
7 |
+
import pytest
|
8 |
import requests
|
9 |
|
10 |
+
from deep_translator import MicrosoftTranslator, exceptions
|
11 |
|
12 |
|
13 |
# mocked request.post
|
tests/test_mymemory.py
CHANGED
@@ -3,7 +3,8 @@
|
|
3 |
"""Tests for `deep_translator` package."""
|
4 |
|
5 |
import pytest
|
6 |
-
|
|
|
7 |
|
8 |
|
9 |
@pytest.fixture
|
|
|
3 |
"""Tests for `deep_translator` package."""
|
4 |
|
5 |
import pytest
|
6 |
+
|
7 |
+
from deep_translator import MyMemoryTranslator, exceptions
|
8 |
|
9 |
|
10 |
@pytest.fixture
|
tests/test_pons.py
CHANGED
@@ -3,7 +3,8 @@
|
|
3 |
"""Tests for `deep_translator` package."""
|
4 |
|
5 |
import pytest
|
6 |
-
|
|
|
7 |
|
8 |
|
9 |
@pytest.fixture
|
|
|
3 |
"""Tests for `deep_translator` package."""
|
4 |
|
5 |
import pytest
|
6 |
+
|
7 |
+
from deep_translator import PonsTranslator, exceptions
|
8 |
|
9 |
|
10 |
@pytest.fixture
|