Skip to content

Commit

Permalink
update googletrans to version 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wizyoung committed Dec 25, 2017
1 parent 56144d5 commit b787337
Show file tree
Hide file tree
Showing 16 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/googletrans/__init__.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Free Google Translate API for Python. Translates totally free of charge."""
__all__ = 'Translator',
__version__ = '2.1.4'
__version__ = '2.2.0'


from googletrans.client import Translator
Expand Down
Binary file modified src/googletrans/__init__.pyc
Binary file not shown.
Empty file modified src/googletrans/client.py
100755 → 100644
Empty file.
Binary file modified src/googletrans/client.pyc
Binary file not shown.
Empty file modified src/googletrans/compat.py
100755 → 100644
Empty file.
Binary file modified src/googletrans/compat.pyc
Binary file not shown.
Empty file modified src/googletrans/constants.py
100755 → 100644
Empty file.
Binary file modified src/googletrans/constants.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion src/googletrans/gtoken.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def acquire(self, text):
e.append(l >> 12 & 63 | 128)
else:
e.append(l >> 12 | 224)
e.append(l >> 6 & 63 | 128)
e.append(l >> 6 & 63 | 128)
e.append(l & 63 | 128)
a = b
for i, value in enumerate(e):
Expand Down
Binary file modified src/googletrans/gtoken.pyc
Binary file not shown.
Empty file modified src/googletrans/models.py
100755 → 100644
Empty file.
Binary file modified src/googletrans/models.pyc
Binary file not shown.
Empty file modified src/googletrans/urls.py
100755 → 100644
Empty file.
Binary file modified src/googletrans/urls.pyc
Binary file not shown.
13 changes: 12 additions & 1 deletion src/googletrans/utils.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ def build_params(query, src, dest, token):
return params


def format_json(original):
def legacy_format_json(original):
# save state
states = []
text = original

# save position for double-quoted texts
for i, pos in enumerate(re.finditer('"', text)):
# pos.start() is a double-quote
p = pos.start() + 1
if i % 2 == 0:
nxt = text.find('"', p)
Expand All @@ -52,6 +55,14 @@ def format_json(original):
return converted


def format_json(original):
try:
converted = json.loads(original)
except ValueError:
converted = legacy_format_json(original)
return converted


def rshift(val, n):
"""python port for '>>>'(right shift with padding)
"""
Expand Down
Binary file modified src/googletrans/utils.pyc
Binary file not shown.

0 comments on commit b787337

Please sign in to comment.