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

Side by Side Diff: cms/sources.py

Issue 29756692: Noissue - Adapt best practices for trailing commas (cms) (Closed)
Patch Set: Manual cleanup Created April 19, 2018, 1:48 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
OLDNEW
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
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 # 108 #
109 # Localizable files helpers 109 # Localizable files helpers
110 # 110 #
111 111
112 @staticmethod 112 @staticmethod
113 def localizable_file_filename(locale, filename): 113 def localizable_file_filename(locale, filename):
114 return 'locales/%s/%s' % (locale, filename) 114 return 'locales/%s/%s' % (locale, filename)
115 115
116 def list_localizable_files(self): 116 def list_localizable_files(self):
117 default_locale = self.read_config().get('general', 'defaultlocale') 117 default_locale = self.read_config().get('general', 'defaultlocale')
118 return filter( 118 return filter(lambda f: os.path.splitext(f)[1].lower() != '.json',
119 lambda f: os.path.splitext(f)[1].lower() != '.json', 119 self.list_files('locales/%s' % default_locale))
120 self.list_files('locales/%s' % default_locale)
Sebastian Noack 2018/04/19 13:51:19 For whatever reason, my script missed this one.
121 )
122 120
123 def has_localizable_file(self, locale, filename): 121 def has_localizable_file(self, locale, filename):
124 return self.has_file(self.localizable_file_filename(locale, filename)) 122 return self.has_file(self.localizable_file_filename(locale, filename))
125 123
126 def read_localizable_file(self, locale, filename): 124 def read_localizable_file(self, locale, filename):
127 return self.read_file(self.localizable_file_filename(locale, filename), binary=True)[0] 125 return self.read_file(self.localizable_file_filename(locale, filename), binary=True)[0]
128 126
129 # 127 #
130 # Static file helpers 128 # Static file helpers
131 # 129 #
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 'resolve_link', 448 'resolve_link',
451 'read_config', 449 'read_config',
452 'read_template', 450 'read_template',
453 'read_locale', 451 'read_locale',
454 'read_include', 452 'read_include',
455 'exec_file', 453 'exec_file',
456 ]: 454 ]:
457 setattr(source, fname, _memoize(getattr(source, fname))) 455 setattr(source, fname, _memoize(getattr(source, fname)))
458 456
459 return source 457 return source
OLDNEW
« cms/bin/translate.py ('K') | « cms/converters.py ('k') | cms/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld