python: Normalize quotes with Black.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-02-11 23:20:45 -08:00
committed by Tim Abbott
parent 11741543da
commit 6e4c3e41dc
989 changed files with 32792 additions and 32792 deletions

View File

@@ -7,14 +7,14 @@ from markdown_include.include import IncludePreprocessor, MarkdownInclude
from zerver.lib.exceptions import InvalidMarkdownIncludeStatement
INC_SYNTAX = re.compile(r'\{!\s*(.+?)\s*!\}')
INC_SYNTAX = re.compile(r"\{!\s*(.+?)\s*!\}")
class MarkdownIncludeCustom(MarkdownInclude):
def extendMarkdown(self, md: markdown.Markdown) -> None:
md.preprocessors.register(
IncludeCustomPreprocessor(md, self.getConfigs()),
'include_wrapper',
"include_wrapper",
500,
)
@@ -46,15 +46,15 @@ class IncludeCustomPreprocessor(IncludePreprocessor):
with open(filename, encoding=self.encoding) as r:
text = r.readlines()
except Exception as e:
print(f'Warning: could not find file {filename}. Error: {e}')
lines[loc] = INC_SYNTAX.sub('', line)
print(f"Warning: could not find file {filename}. Error: {e}")
lines[loc] = INC_SYNTAX.sub("", line)
raise InvalidMarkdownIncludeStatement(m.group(0).strip())
line_split = INC_SYNTAX.split(line)
if len(text) == 0:
text.append('')
text.append("")
for i in range(len(text)):
text[i] = text[i].rstrip('\r\n')
text[i] = text[i].rstrip("\r\n")
text[0] = line_split[0] + text[0]
text[-1] = text[-1] + line_split[2]
lines = lines[:loc] + text + lines[loc + 1 :]