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

Unified Diff: cms/converters.py

Issue 29756692: Noissue - Adapt best practices for trailing commas (cms) (Closed)
Patch Set: More cleanup, added flake8-commas extension Created April 19, 2018, 2:19 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cms/bin/translate.py ('k') | cms/sources.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/converters.py
===================================================================
--- a/cms/converters.py
+++ b/cms/converters.py
@@ -184,7 +184,7 @@
def stringify_attribute(name, value):
return '{}="{}"'.format(
escape(name),
- escape(self.insert_localized_strings(value, {}))
+ escape(self.insert_localized_strings(value, {})),
)
for tag in self.whitelist:
@@ -203,16 +203,16 @@
tag,
' ' + ' '.join(attrs) if attrs else '',
match.group(1),
- tag
+ tag,
),
- result, 1, flags=re.S
+ result, 1, flags=re.S,
)
result = re.sub(
r'{}({}*?){}'.format(re_escape('<{}>'.format(tag)),
allowed_contents,
re_escape('</{}>'.format(tag))),
r'<{}>\1</{}>'.format(tag, tag),
- result, flags=re.S
+ result, flags=re.S,
)
return result
@@ -237,7 +237,7 @@
r'}}',
lookup_string,
text,
- flags=re.S
+ flags=re.S,
)
def process_links(self, text):
@@ -291,10 +291,10 @@
return re.sub(
r'{}\?\s*include\s+([^\s<>"]+)\s*\?{}'.format(
self.include_start_regex,
- self.include_end_regex
+ self.include_end_regex,
),
resolve_include,
- text
+ text,
)
def __call__(self):
@@ -312,11 +312,11 @@
class MarkdownConverter(Converter):
include_start_regex = r'(?:{}|{})'.format(
Converter.include_start_regex,
- re.escape(jinja2.escape(Converter.include_start_regex))
+ re.escape(jinja2.escape(Converter.include_start_regex)),
)
include_end_regex = r'(?:{}|{})'.format(
Converter.include_end_regex,
- re.escape(jinja2.escape(Converter.include_end_regex))
+ re.escape(jinja2.escape(Converter.include_end_regex)),
)
def get_html(self, source, filename):
@@ -422,7 +422,7 @@
def translate(self, default, name, comment=None):
return jinja2.Markup(self.localize_string(
self._params['page'], name, default, comment,
- self._params['localedata'], html_escapes
+ self._params['localedata'], html_escapes,
))
def get_string(self, name, page=None):
@@ -432,7 +432,7 @@
localedata = self._get_locale_data(page)
default = localedata[name]
return jinja2.Markup(self.localize_string(
- page, name, default, '', localedata, html_escapes
+ page, name, default, '', localedata, html_escapes,
))
def has_string(self, name, page=None):
@@ -455,7 +455,7 @@
return jinja2.Markup('<a{}>'.format(''.join(
' {}="{}"'.format(name, jinja2.escape(value)) for name, value in [
('href', url),
- ('hreflang', locale)
+ ('hreflang', locale),
] + attrs.items()
)))
@@ -502,7 +502,7 @@
'`get_canonical_url()`')
locale, page_url = self._params['source'].resolve_link(
- page, self._params['locale']
+ page, self._params['locale'],
)
# Remove the locale component that `resolve_link` adds at the
# beginning.
« no previous file with comments | « cms/bin/translate.py ('k') | cms/sources.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld