Skip to content

Commit

Permalink
Apply black changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Umaaz authored and github-actions[bot] committed Feb 19, 2024
1 parent 46256f5 commit e65dc12
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions markdown_include/include.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ def run(self, lines):

text[i] = text[i].rstrip("\r\n")
text_to_insert = "\r\n".join(text)
line = line[: m.start()] + text_to_insert.strip() + line[m.end() :]
line = (
line[: m.start()] + text_to_insert.strip() + line[m.end() :]
)
del lines[loc]
lines[loc:loc] = line.splitlines()
m = INC_SYNTAX.search(line)
Expand All @@ -202,14 +204,16 @@ def run(self, lines):
def load_remote(self, filename):
name = None
# do not delete on close as we open it later on
with tempfile.NamedTemporaryFile(mode='wb', delete=False) as file:
with tempfile.NamedTemporaryFile(mode="wb", delete=False) as file:
name = file.name
try:
urlopen = urllib.request.urlopen(filename)
data = urlopen.read()
file.write(data)
except urllib.error.HTTPError as e:
file.write(bytes(f"Error loading remote template ({filename}): {e}", "utf-8"))
file.write(
bytes(f"Error loading remote template ({filename}): {e}", "utf-8")
)
return name


Expand Down

0 comments on commit e65dc12

Please sign in to comment.