nidhal baccouri commited on
Commit
810451b
Β·
1 Parent(s): 674f1bf

refactored and moved tests in root

Browse files
deep_translator/__init__.py CHANGED
@@ -19,13 +19,13 @@ __version__ = '1.5.0'
19
 
20
  __all__ = [
21
  "GoogleTranslator",
22
- "PonsTranslator",
23
- "LingueeTranslator",
24
- "MyMemoryTranslator",
25
- "YandexTranslator",
26
- "MicrosoftTranslator",
27
- "QCRI",
28
- "DeepL",
29
- "single_detection",
30
- "batch_detection"
31
  ]
 
19
 
20
  __all__ = [
21
  "GoogleTranslator",
22
+ "PonsTranslator",
23
+ "LingueeTranslator",
24
+ "MyMemoryTranslator",
25
+ "YandexTranslator",
26
+ "MicrosoftTranslator",
27
+ "QCRI",
28
+ "DeepL",
29
+ "single_detection",
30
+ "batch_detection"
31
  ]
deep_translator/deepl.py CHANGED
@@ -1,6 +1,6 @@
1
  import requests
2
- from constants import BASE_URLS, DEEPL_LANGUAGE_TO_CODE
3
- from exceptions import (ServerException,
4
  TranslationNotFound,
5
  LanguageNotSupportedException,
6
  AuthorizationException)
 
1
  import requests
2
+ from .constants import BASE_URLS, DEEPL_LANGUAGE_TO_CODE
3
+ from .exceptions import (ServerException,
4
  TranslationNotFound,
5
  LanguageNotSupportedException,
6
  AuthorizationException)
deep_translator/google_trans.py CHANGED
@@ -2,9 +2,9 @@
2
  google translator API
3
  """
4
 
5
- from constants import BASE_URLS, GOOGLE_LANGUAGES_TO_CODES
6
- from exceptions import TooManyRequests, LanguageNotSupportedException, TranslationNotFound, NotValidPayload, RequestError
7
- from parent import BaseTranslator
8
  from bs4 import BeautifulSoup
9
  import requests
10
  from time import sleep
 
2
  google translator API
3
  """
4
 
5
+ from .constants import BASE_URLS, GOOGLE_LANGUAGES_TO_CODES
6
+ from .exceptions import TooManyRequests, LanguageNotSupportedException, TranslationNotFound, NotValidPayload, RequestError
7
+ from .parent import BaseTranslator
8
  from bs4 import BeautifulSoup
9
  import requests
10
  from time import sleep
deep_translator/linguee.py CHANGED
@@ -2,14 +2,14 @@
2
  linguee translator API
3
  """
4
 
5
- from constants import BASE_URLS, LINGUEE_LANGUAGES_TO_CODES, LINGUEE_CODE_TO_LANGUAGE
6
- from exceptions import (LanguageNotSupportedException,
7
  TranslationNotFound,
8
  NotValidPayload,
9
  ElementNotFoundInGetRequest,
10
  RequestError,
11
  TooManyRequests)
12
- from parent import BaseTranslator
13
  from bs4 import BeautifulSoup
14
  import requests
15
  from requests.utils import requote_uri
 
2
  linguee translator API
3
  """
4
 
5
+ from .constants import BASE_URLS, LINGUEE_LANGUAGES_TO_CODES, LINGUEE_CODE_TO_LANGUAGE
6
+ from .exceptions import (LanguageNotSupportedException,
7
  TranslationNotFound,
8
  NotValidPayload,
9
  ElementNotFoundInGetRequest,
10
  RequestError,
11
  TooManyRequests)
12
+ from .parent import BaseTranslator
13
  from bs4 import BeautifulSoup
14
  import requests
15
  from requests.utils import requote_uri
deep_translator/main.py CHANGED
@@ -1,15 +1,15 @@
1
  """Console script for deep_translator."""
2
 
3
  import click
4
- from google_trans import GoogleTranslator
5
- from mymemory import MyMemoryTranslator
6
- from deepl import DeepL
7
- from qcri import QCRI
8
- from linguee import LingueeTranslator
9
- from pons import PonsTranslator
10
- from yandex import YandexTranslator
11
- from microsoft import MicrosoftTranslator
12
- from papago import PapagoTranslator
13
 
14
  CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
15
  @click.group()
 
1
  """Console script for deep_translator."""
2
 
3
  import click
4
+ from .google_trans import GoogleTranslator
5
+ from .mymemory import MyMemoryTranslator
6
+ from .deepl import DeepL
7
+ from .qcri import QCRI
8
+ from .linguee import LingueeTranslator
9
+ from .pons import PonsTranslator
10
+ from .yandex import YandexTranslator
11
+ from .microsoft import MicrosoftTranslator
12
+ from .papago import PapagoTranslator
13
 
14
  CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
15
  @click.group()
deep_translator/microsoft.py CHANGED
@@ -4,8 +4,8 @@ import requests
4
  import logging
5
  import sys
6
 
7
- from constants import BASE_URLS, MICROSOFT_CODES_TO_LANGUAGES
8
- from exceptions import LanguageNotSupportedException, ServerException, MicrosoftAPIerror
9
 
10
 
11
  class MicrosoftTranslator:
 
4
  import logging
5
  import sys
6
 
7
+ from .constants import BASE_URLS, MICROSOFT_CODES_TO_LANGUAGES
8
+ from .exceptions import LanguageNotSupportedException, ServerException, MicrosoftAPIerror
9
 
10
 
11
  class MicrosoftTranslator:
deep_translator/mymemory.py CHANGED
@@ -4,13 +4,13 @@ mymemory translator API
4
  import logging
5
  import warnings
6
 
7
- from constants import BASE_URLS, GOOGLE_LANGUAGES_TO_CODES
8
- from exceptions import (NotValidPayload,
9
  TranslationNotFound,
10
  LanguageNotSupportedException,
11
  RequestError,
12
  TooManyRequests)
13
- from parent import BaseTranslator
14
  import requests
15
  from time import sleep
16
 
 
4
  import logging
5
  import warnings
6
 
7
+ from .constants import BASE_URLS, GOOGLE_LANGUAGES_TO_CODES
8
+ from .exceptions import (NotValidPayload,
9
  TranslationNotFound,
10
  LanguageNotSupportedException,
11
  RequestError,
12
  TooManyRequests)
13
+ from .parent import BaseTranslator
14
  import requests
15
  from time import sleep
16
 
deep_translator/papago.py CHANGED
@@ -2,8 +2,8 @@
2
  google translator API
3
  """
4
  import json
5
- from constants import BASE_URLS, PAPAGO_LANGUAGE_TO_CODE
6
- from exceptions import LanguageNotSupportedException, TranslationNotFound, NotValidPayload
7
  import requests
8
  import warnings
9
  import logging
 
2
  google translator API
3
  """
4
  import json
5
+ from .constants import BASE_URLS, PAPAGO_LANGUAGE_TO_CODE
6
+ from .exceptions import LanguageNotSupportedException, TranslationNotFound, NotValidPayload
7
  import requests
8
  import warnings
9
  import logging
deep_translator/parent.py CHANGED
@@ -1,6 +1,6 @@
1
  """parent translator class"""
2
 
3
- from exceptions import NotValidPayload, NotValidLength, InvalidSourceOrTargetLanguage
4
  from abc import ABC, abstractmethod
5
  import string
6
  class BaseTranslator(ABC):
 
1
  """parent translator class"""
2
 
3
+ from .exceptions import NotValidPayload, NotValidLength, InvalidSourceOrTargetLanguage
4
  from abc import ABC, abstractmethod
5
  import string
6
  class BaseTranslator(ABC):
deep_translator/pons.py CHANGED
@@ -3,14 +3,14 @@ pons translator API
3
  """
4
  from bs4 import BeautifulSoup
5
  import requests
6
- from constants import BASE_URLS, PONS_LANGUAGES_TO_CODES, PONS_CODES_TO_LANGUAGES
7
- from exceptions import (LanguageNotSupportedException,
8
  TranslationNotFound,
9
  NotValidPayload,
10
  ElementNotFoundInGetRequest,
11
  RequestError,
12
  TooManyRequests)
13
- from parent import BaseTranslator
14
  from requests.utils import requote_uri
15
 
16
 
 
3
  """
4
  from bs4 import BeautifulSoup
5
  import requests
6
+ from .constants import BASE_URLS, PONS_LANGUAGES_TO_CODES, PONS_CODES_TO_LANGUAGES
7
+ from .exceptions import (LanguageNotSupportedException,
8
  TranslationNotFound,
9
  NotValidPayload,
10
  ElementNotFoundInGetRequest,
11
  RequestError,
12
  TooManyRequests)
13
+ from .parent import BaseTranslator
14
  from requests.utils import requote_uri
15
 
16
 
deep_translator/qcri.py CHANGED
@@ -1,8 +1,7 @@
1
 
2
  import requests
3
- from constants import BASE_URLS, QCRI_LANGUAGE_TO_CODE
4
- from exceptions import (ServerException, TranslationNotFound)
5
-
6
 
7
  class QCRI(object):
8
  """
 
1
 
2
  import requests
3
+ from .constants import BASE_URLS, QCRI_LANGUAGE_TO_CODE
4
+ from .exceptions import (ServerException, TranslationNotFound)
 
5
 
6
  class QCRI(object):
7
  """
deep_translator/yandex.py CHANGED
@@ -2,8 +2,8 @@
2
  Yandex translator API
3
  """
4
  import requests
5
- from constants import BASE_URLS
6
- from exceptions import (RequestError, ServerException, TranslationNotFound, TooManyRequests)
7
 
8
 
9
  class YandexTranslator(object):
 
2
  Yandex translator API
3
  """
4
  import requests
5
+ from .constants import BASE_URLS
6
+ from .exceptions import (RequestError, ServerException, TranslationNotFound, TooManyRequests)
7
 
8
 
9
  class YandexTranslator(object):
{deep_translator/tests β†’ tests}/__init__.py RENAMED
File without changes
{deep_translator/tests β†’ tests}/test_cli.py RENAMED
@@ -5,6 +5,7 @@
5
  from click.testing import CliRunner
6
  from deep_translator.main import cli
7
 
 
8
  class TestClass:
9
  def test_translate(self):
10
  runner = CliRunner()
 
5
  from click.testing import CliRunner
6
  from deep_translator.main import cli
7
 
8
+
9
  class TestClass:
10
  def test_translate(self):
11
  runner = CliRunner()
{deep_translator/tests β†’ tests}/test_deepl.py RENAMED
File without changes
{deep_translator/tests β†’ tests}/test_google_trans.py RENAMED
File without changes
{deep_translator/tests β†’ tests}/test_linguee.py RENAMED
File without changes
{deep_translator/tests β†’ tests}/test_microsoft_trans.py RENAMED
File without changes
{deep_translator/tests β†’ tests}/test_mymemory.py RENAMED
File without changes
{deep_translator/tests β†’ tests}/test_pons.py RENAMED
File without changes