Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/presubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install dependencies
run: pip install -e .[dev]
- name: Check formatting
run: nox -s format
run: nox -s lint

test:
name: Test (Python ${{ matrix.python-version }})
Expand Down
6 changes: 4 additions & 2 deletions notebooks/audience_e2e_advertiser_flow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,10 @@
" print(f\"{ingest_res}\")\n",
"\n",
" if ingest_res.field_warnings:\n",
" print(\"Request ingested successfully, but field warnings were returned. \"\n",
" \"Review warning details and update your implementation as needed.\")\n",
" print(\n",
" \"Request ingested successfully, but field warnings were returned. \"\n",
" \"Review warning details and update your implementation as needed.\"\n",
" )\n",
"\n",
" except Exception as e:\n",
" print(f\"Failed to ingest data: {e}\")\n",
Expand Down
6 changes: 4 additions & 2 deletions notebooks/audience_e2e_data_partner_dual_persona.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,10 @@
" print(f\"{ingest_res}\")\n",
"\n",
" if ingest_res.field_warnings:\n",
" print(\"Request ingested successfully, but field warnings were returned. \"\n",
" \"Review warning details and update your implementation as needed.\")\n",
" print(\n",
" \"Request ingested successfully, but field warnings were returned. \"\n",
" \"Review warning details and update your implementation as needed.\"\n",
" )\n",
"\n",
" except Exception as e:\n",
" print(f\"Failed to ingest data: {e}\")\n",
Expand Down
6 changes: 4 additions & 2 deletions notebooks/audience_e2e_data_partner_simplified.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,10 @@
" print(f\"{ingest_res}\")\n",
"\n",
" if ingest_res.field_warnings:\n",
" print(\"Request ingested successfully, but field warnings were returned. \"\n",
" \"Review warning details and update your implementation as needed.\")\n",
" print(\n",
" \"Request ingested successfully, but field warnings were returned. \"\n",
" \"Review warning details and update your implementation as needed.\"\n",
" )\n",
"\n",
" except Exception as e:\n",
" print(f\"Failed to ingest data: {e}\")\n",
Expand Down
16 changes: 15 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,24 @@ def tests(session):
session.run(*COVERAGE_COMMAND)


def _format(session, check=False):
black_command = ["black"]
if check:
black_command.append("--check")
black_command.append(".")
session.run(*black_command)


@nox.session(venv_backend="none")
def lint(session):
"""Fails if the code is not formatted correctly."""
_format(session, check=True)


@nox.session(venv_backend="none")
def format(session):
"""Runs the black formatter and applies formatting fixes."""
session.run("black", ".")
_format(session)


@nox.session(python="3.12")
Expand Down
Loading