Skip to content

Commit

Permalink
fix: updated acq_filters.py in docs additional examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
u625355 committed Sep 20, 2024
1 parent 63dd4da commit 0618757
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
22 changes: 18 additions & 4 deletions docs/additional_examples_and_pseudo_code/acq_filters.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
def any_horizontal_change(previous_header, current_header):
"""Prebuilt acq acceptance filter that accepts only acqs with
changes to horizontal settings.
from typing import Dict

from tekhsi import WaveformHeader


def any_horizontal_change(
previous_header: Dict[str, WaveformHeader],
current_header: Dict[str, WaveformHeader],
) -> bool:
"""Acq acceptance filter that accepts only acqs with changes to horizontal settings.
Args:
previous_header (dict[str, WaveformHeader]): Previous header dictionary.
current_header (dict[str, WaveformHeader]): Current header dictionary.
Returns:
True if the acquisition is accepted, False otherwise.
"""
for key, cur in current_header.items():
if key not in previous_header:
return True
prev = previous_header[key]
if prev is None and cur != None:
if prev is None and cur is not None:
return True
if prev is not None and (
prev.noofsamples != cur.noofsamples
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ order-by-type = false
[tool.ruff.lint.per-file-ignores]
"docs/additional_examples_and_pseudo_code/**" = [
"E501", # Line too long
"E711", # Comparison to None
"ERA001", # Found commented-out code
"S101", # Use of assert detected
"SIM117" # Use a single `with` statement with multiple contexts instead of nested `with` statements
Expand Down

0 comments on commit 0618757

Please sign in to comment.