Skip to content

Commit

Permalink
flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Jun 16, 2024
1 parent 112f6a8 commit fe59ce2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
per-file-ignores =
# line too long
tests/test_ibw.py: E501,
10 changes: 6 additions & 4 deletions tests/helper.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import pathlib
import numpy as _numpy
from pprint import pformat, PrettyPrinter
from pprint import PrettyPrinter
from igor2.binarywave import load as loadibw

data_dir = pathlib.Path(__file__).parent / "data"


class NumpyPrettyPrinter(PrettyPrinter):
def format(self, object, context, maxlevels, level):
if isinstance(object, _numpy.ndarray):
# Generate the entire array string using numpy's own mechanism but ensuring dtype is displayed
# Generate the entire array string using numpy's own mechanism but
# ensuring dtype is displayed
array_repr = _numpy.array2string(object, separator=', ')
# Append dtype only once for the whole array
formatted_array = f"array({array_repr}, dtype='{object.dtype}')"
Expand All @@ -18,11 +20,11 @@ def format(self, object, context, maxlevels, level):


def custom_pformat(object, indent=1, width=80, depth=None, *, compact=False):
printer = NumpyPrettyPrinter(indent=indent, width=width, depth=depth, compact=compact)
printer = NumpyPrettyPrinter(
indent=indent, width=width, depth=depth, compact=compact)
return printer.pformat(object)



def assert_equal_dump_no_whitespace_no_byte(data_a, data_b):
def repl(x):
for old, new in [
Expand Down

0 comments on commit fe59ce2

Please sign in to comment.