Skip to content

Commit

Permalink
Separate black flags (#253)
Browse files Browse the repository at this point in the history
* Separate black flags

* Run black
  • Loading branch information
Andy-Grigg committed Dec 21, 2022
1 parent f27cfeb commit 13d2555
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 6 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,12 @@ def _copy_examples_and_convert_to_notebooks(source_dir, output_dir):
file_output_path = root_output_path / Path(file)
shutil.copy(file_source_path, file_output_path) # Copy everything
if file_source_path.suffix == ".py": # Also convert python scripts to jupyter notebooks
ntbk = jupytext.read(file_source_path)
jupytext.write(ntbk, file_output_path.with_suffix(".ipynb"))
notebook = jupytext.read(file_source_path)

# Filter out cells to remove
notebook.cells = [c for c in notebook.cells if "remove_cell" not in c.metadata.get("tags", [])]

jupytext.write(notebook, file_output_path.with_suffix(".ipynb"))


# If we already have a source/examples directory then don't do anything.
Expand Down
8 changes: 8 additions & 0 deletions examples/0_Getting_started.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,20 @@
# Fluent interfaces are designed to allow a complex object to be constructed in a single line of code. As such, you can
# consolidate the cells above into a single step:

# + tags=["remove_cell"]
# Turn off black formatting
# fmt: off
# -

# + tags=[]
query = queries.MaterialImpactedSubstancesQuery().with_material_ids(["plastic-abs-high-impact"]).with_legislations(["REACH - The Candidate List"]) # noqa: E501
query
# -

# + tags=["remove_cell"]
# Turn on black formatting
# fmt: on
# -

# Because the fluent interface can produce very long lines of code, it's necessary to break your query creation code
# into multiple lines. The following multi-line format is used throughout the examples. It is functionally equivalent to
Expand Down

0 comments on commit 13d2555

Please sign in to comment.