Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: localeTools.py

Issue 29670676: Issue 5844 - Remove redundant parentheses in buildtools (Closed) Base URL: https://hg.adblockplus.org/buildtools/
Patch Set: Created Jan. 16, 2018, 11:43 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« build.py ('K') | « ensure_dependencies.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This Source Code Form is subject to the terms of the Mozilla Public 1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this 2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 4
5 import re 5 import re
6 import os 6 import os
7 import sys 7 import sys
8 import codecs 8 import codecs
9 import json 9 import json
10 import urlparse 10 import urlparse
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 '\r\n{data}\r\n' 185 '\r\n{data}\r\n'
186 '--{boundary}--\r\n' 186 '--{boundary}--\r\n'
187 ).format(boundary=boundary, 187 ).format(boundary=boundary,
188 name=name, 188 name=name,
189 data=data.encode('utf-8'), 189 data=data.encode('utf-8'),
190 mimetype=mimetypes.guess_type(name)[0]) 190 mimetype=mimetypes.guess_type(name)[0])
191 191
192 return ( 192 return (
193 StringIO(body), 193 StringIO(body),
194 { 194 {
195 'Content-Type': ('multipart/form-data; boundary=' + boundary), 195 'Content-Type': 'multipart/form-data; boundary=' + boundary,
196 'Content-Length': len(body) 196 'Content-Length': len(body)
197 }, 197 },
198 ) 198 )
199 199
200 200
201 def updateTranslationMaster(localeConfig, metadata, dir, projectName, key): 201 def updateTranslationMaster(localeConfig, metadata, dir, projectName, key):
202 result = crowdin_request(projectName, 'info', key) 202 result = crowdin_request(projectName, 'info', key)
203 203
204 existing = set(map(lambda f: f['name'], result['files'])) 204 existing = set(map(lambda f: f['name'], result['files']))
205 add = [] 205 add = []
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 # Remove any extra files 318 # Remove any extra files
319 for dir, files in dirs.iteritems(): 319 for dir, files in dirs.iteritems():
320 baseDir = os.path.join(localeConfig['base_path'], dir) 320 baseDir = os.path.join(localeConfig['base_path'], dir)
321 if not os.path.exists(baseDir): 321 if not os.path.exists(baseDir):
322 continue 322 continue
323 for file in os.listdir(baseDir): 323 for file in os.listdir(baseDir):
324 path = os.path.join(baseDir, file) 324 path = os.path.join(baseDir, file)
325 valid_extension = file.endswith('.json') 325 valid_extension = file.endswith('.json')
326 if os.path.isfile(path) and valid_extension and not file in files: 326 if os.path.isfile(path) and valid_extension and not file in files:
327 os.remove(path) 327 os.remove(path)
OLDNEW
« build.py ('K') | « ensure_dependencies.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld