Skip to content

Commit 4776c2a

Browse files
Try to fix failing linting test.
1 parent fde7ab7 commit 4776c2a

File tree

8 files changed

+17
-19
lines changed

8 files changed

+17
-19
lines changed

nbconvert/exporters/html.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def from_notebook_node( # type:ignore[explicit-override, override]
266266
markdown_collection = markdown_collection + cell.source + "\n"
267267

268268
resources = self._init_resources(resources)
269-
resources.update({"tableofcontents": extract_titles_from_markdown_input(markdown_collection)})
269+
resources= resources.update({"tableofcontents": extract_titles_from_markdown_input(markdown_collection)})
270270

271271
filter_data_type = WidgetsDataTypeFilter(
272272
notebook_metadata=self._nb_metadata, parent=self, resources=resources

nbconvert/exporters/slides.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def preprocess(self, nb, resources=None):
4141

4242
in_fragment = False
4343

44-
for index, cell in enumerate(nb.cells[first_slide_ix + 1 :], start=(first_slide_ix + 1)):
44+
for index, cell in enumerate(nb.cells[first_slide_ix + 1:], start=(first_slide_ix + 1)):
4545
previous_cell = nb.cells[index - 1]
4646

4747
# Slides are <section> elements in the HTML, subslides (the vertically

nbconvert/exporters/templateexporter.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,8 @@ def default_config(self):
203203
enable_async = Bool(False, help="Enable Jinja async template execution").tag(
204204
affects_environment=True
205205
)
206-
207206
include_tableofcontents = Bool(False, allow_none=True, help="Enable to include a table of contents").tag(
208-
config=True, affects_template=True
207+
config=True, affects_template=True
209208
)
210209

211210
_last_template_file = ""
@@ -289,8 +288,7 @@ def _template_extension_default(self):
289288
).tag(config=True)
290289

291290
exclude_output = Bool(
292-
False,
293-
help="This allows you to exclude code cell outputs from all templates if set to True.",
291+
False, help="This allows you to exclude code cell outputs from all templates if set to True.",
294292
).tag(config=True)
295293

296294
exclude_output_prompt = Bool(
@@ -686,5 +684,3 @@ def _init_resources(self, resources):
686684
resources["deprecated"] = deprecated
687685
resources["include_tableofcontents"] = self.include_tableofcontents
688686
return resources
689-
690-

nbconvert/filters/ansi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def _ansi2anything(text, converter):
197197
pass # Invalid color specification
198198
else:
199199
pass # Not a color code
200-
chunk, text = text[: m.start()], text[m.end() :]
200+
chunk, text = text[: m.start()], text[m.end():]
201201
else:
202202
chunk, text = text, ""
203203

nbconvert/filters/citation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def citation2latex(s):
4242
outtext = ""
4343
startpos = 0
4444
for citation in parser.citelist:
45-
outtext += s[startpos : citation[1]]
45+
outtext += s[startpos: citation[1]]
4646
outtext += "\\cite{%s}" % citation[0]
4747
startpos = citation[2] if len(citation) == 3 else -1
4848
outtext += s[startpos:] if startpos != -1 else ""

nbconvert/filters/markdown_mistune.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def _embed_image_or_attachment(self, src: str) -> str:
385385

386386
attachment_prefix = "attachment:"
387387
if src.startswith(attachment_prefix):
388-
name = src[len(attachment_prefix) :]
388+
name = src[len(attachment_prefix):]
389389

390390
if name not in self.attachments:
391391
msg = f"missing attachment: {name}"
@@ -485,6 +485,7 @@ def render(self, source: str) -> str:
485485
"""Render the HTML output for a Markdown source."""
486486
return str(super().__call__(source))
487487

488+
488489
def markdown2html_mistune(source: str) -> str:
489490
"""Convert a markdown string to HTML using mistune"""
490491
return MarkdownWithMath(renderer=IPythonRenderer(escape=False)).render(source)
@@ -500,6 +501,7 @@ def heading(self, text, level):
500501
self.headings.append((level, text))
501502
return "" # We return an empty string to avoid outputting the headings
502503

504+
503505
def extract_titles_from_markdown_input(markdown_input):
504506
# Markdown_input is a single string with all the markdown content concatenated
505507
# Initiate list of titles
@@ -515,12 +517,12 @@ def extract_titles_from_markdown_input(markdown_input):
515517
extract_titles(markdown_input)
516518

517519
# Extracted headings
518-
for level, title in renderer.headings: # renderer.headings is an array for each markdown element
520+
for level, title in renderer.headings:
519521
children = title["children"]
520522
attrs = title["attrs"]
521523
raw_text = children[0]["raw"]
522524
level = attrs["level"]
523525
id = raw_text.replace(' ', '-')
524-
href= "#" + id
526+
href = "#" + id
525527
titles_array.append([level, raw_text, id, href])
526528
return titles_array

nbconvert/nbconvertapp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def _classes_default(self):
223223

224224
return classes
225225

226-
description = Unicode(# type:ignore[assignment]
226+
description = Unicode( # type:ignore[assignment]
227227
"""This application is used to convert notebook files (*.ipynb)
228228
to various other formats.
229229
@@ -342,7 +342,7 @@ def _postprocessor_class_changed(self, change):
342342
if new:
343343
self.postprocessor_factory = import_item(new)
344344

345-
export_format = Unicode(# type:ignore[call-overload]
345+
export_format = Unicode( # type:ignore[call-overload]
346346
allow_none=False,
347347
help=f"""The export format to be used, either one of the built-in formats
348348
{get_export_names()}

tests/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,15 @@ def assert_big_text_equal(a, b, chunk_size=80):
176176
to give better info than vanilla assertEqual for large text blobs.
177177
"""
178178
for i in range(0, len(a), chunk_size):
179-
chunk_a = a[i : i + chunk_size]
180-
chunk_b = b[i : i + chunk_size]
179+
chunk_a = a[i: i + chunk_size]
180+
chunk_b = b[i: i + chunk_size]
181181
assert chunk_a == chunk_b, "[offset: %i]\n%r != \n%r" % (i, chunk_a, chunk_b)
182182

183183
if len(a) > len(b):
184184
raise AssertionError(
185-
"Length doesn't match (%i > %i). Extra text:\n%r" % (len(a), len(b), a[len(b) :])
185+
"Length doesn't match (%i > %i). Extra text:\n%r" % (len(a), len(b), a[len(b):])
186186
)
187187
if len(a) < len(b):
188188
raise AssertionError(
189-
"Length doesn't match (%i < %i). Extra text:\n%r" % (len(a), len(b), a[len(b) :])
189+
"Length doesn't match (%i < %i). Extra text:\n%r" % (len(a), len(b), a[len(b):])
190190
)

0 commit comments

Comments
 (0)