| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 # This file is part of the Adblock Plus web scripts, | 1 # This file is part of the Adblock Plus web scripts, |
| 2 # Copyright (C) 2006-present eyeo GmbH | 2 # Copyright (C) 2006-present eyeo GmbH |
| 3 # | 3 # |
| 4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
| 5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
| 6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
| 7 # | 7 # |
| 8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
| 12 # | 12 # |
| 13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
| 14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 15 | |
| 15 import collections | 16 import collections |
|
Vasily Kuznetsov
2018/10/05 14:51:25
Nit: empty line after the top comment -- I missed
Tudor Avram
2018/10/05 16:28:47
Done.
| |
| 16 import logging | 17 import logging |
| 17 import os | 18 import os |
| 18 import time | 19 import time |
| 19 import json | 20 import json |
| 20 | 21 |
| 21 from cms.utils import process_page | 22 from cms.utils import process_page |
| 22 import cms.translations.xtm.constants as const | 23 import cms.translations.xtm.constants as const |
| 23 from cms.translations.xtm.xtm_api import XTMCloudException | 24 from cms.translations.xtm.xtm_api import XTMCloudException |
| 24 | 25 |
| 25 | 26 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 | 252 |
| 252 return mapped_locales | 253 return mapped_locales |
| 253 | 254 |
| 254 | 255 |
| 255 def local_to_remote(local_names): | 256 def local_to_remote(local_names): |
| 256 """Convert local file names to valid remote ones. | 257 """Convert local file names to valid remote ones. |
| 257 | 258 |
| 258 Parameters | 259 Parameters |
| 259 ---------- | 260 ---------- |
| 260 local_names: iterable | 261 local_names: iterable |
| 261 The local file names(without any extension). | 262 The local file names (without any extension). |
|
Vasily Kuznetsov
2018/10/05 14:51:24
Nit: space before the parenthesis
Tudor Avram
2018/10/05 16:28:47
Done.
| |
| 262 | 263 |
| 263 Returns | 264 Returns |
| 264 ------- | 265 ------- |
| 265 dict | 266 dict |
| 266 With the local files. Each element in the set is a tuple with the | 267 With the local files. Each element in the set is a tuple with the |
| 267 format: | 268 format: |
| 268 <local_filename>: <remote_filename> | 269 <local_filename>: <remote_filename> |
| 269 | 270 |
| 270 """ | 271 """ |
| 271 files = {} | 272 files = {} |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 | 434 |
| 434 with open(file_path, 'wb') as f: | 435 with open(file_path, 'wb') as f: |
| 435 f.write(data) | 436 f.write(data) |
| 436 | 437 |
| 437 | 438 |
| 438 def input_fn(text): | 439 def input_fn(text): |
| 439 try: | 440 try: |
| 440 return raw_input(text) | 441 return raw_input(text) |
| 441 except Exception: | 442 except Exception: |
| 442 return input(text) | 443 return input(text) |
| LEFT | RIGHT |