Skip to content

Commit

Permalink
Merge pull request #14 from legend-exp/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
chore: update pre-commit hooks
  • Loading branch information
gipert authored Oct 17, 2023
2 parents 0d3182f + 0978d2d commit a564e3f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 46 deletions.
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,31 @@ repos:
- id: isort

- repo: https://github.com/asottile/pyupgrade
rev: "v3.8.0"
rev: "v3.13.0"
hooks:
- id: pyupgrade
args: ["--py38-plus"]

- repo: https://github.com/psf/black
rev: "23.3.0"
rev: "23.9.1"
hooks:
- id: black-jupyter

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.4.1"
rev: "v1.5.1"
hooks:
- id: mypy
files: src
stages: [manual]

- repo: https://github.com/hadialqattan/pycln
rev: "v2.1.5"
rev: "v2.2.2"
hooks:
- id: pycln
args: ["--all"]

- repo: https://github.com/PyCQA/flake8
rev: "6.0.0"
rev: "6.1.0"
hooks:
- id: flake8
additional_dependencies: [
Expand Down Expand Up @@ -88,7 +88,7 @@ repos:
args: ["-L", "nd,unparseable,compiletime"]

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.9.0.5"
rev: "v0.9.0.6"
hooks:
- id: shellcheck

Expand All @@ -101,7 +101,7 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0-alpha.9-for-vscode"
rev: "v3.0.3"
hooks:
- id: prettier
types_or: [json]
10 changes: 5 additions & 5 deletions tests/buffer_processor/test_buffer_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def test_buffer_processor_waveform_lengths(lgnd_test_data, tmptestdir):
assert len(raw_packet_waveform_values[0].nda[0]) == presum_rate * len(
presummed_packet_waveform_values[0].nda[0]
)
assert presummed_packet_waveform_values[0].nda.dtype == np.uint32
assert isinstance(presummed_packet_waveform_values[0].nda[0][0], np.uint32)
assert len(raw_packet_waveform_values[0].nda[0]) == len(
windowed_packet_waveform_values[0].nda[0]
) + np.abs(window_start_index) + np.abs(window_end_index)
Expand Down Expand Up @@ -438,7 +438,7 @@ def test_buffer_processor_separate_name_tables(lgnd_test_data, tmptestdir):
assert len(raw_packet_waveform_values[0].nda[0]) == presum_rate * len(
presummed_packet_waveform_values[0].nda[0]
)
assert presummed_packet_waveform_values[0].dtype == np.uint32
assert isinstance(presummed_packet_waveform_values[0].nda[0][0], np.uint32)
assert len(raw_packet_waveform_values[0].nda[0]) == len(
windowed_packet_waveform_values[0].nda[0]
) + np.abs(window_start_index) + np.abs(window_end_index)
Expand Down Expand Up @@ -745,7 +745,7 @@ def test_proc_geds_no_proc_spms(lgnd_test_data, tmptestdir):

assert np.array_equal(raw_sat_lo.nda, proc_sat_lo.nda)
assert np.array_equal(raw_sat_hi.nda, proc_sat_hi.nda)
assert proc_sat_lo.dtype == np.uint16
assert isinstance(proc_sat_lo.nda[0], np.uint16)


# check that packet indexes match in verification test
Expand Down Expand Up @@ -1029,7 +1029,7 @@ def test_buffer_processor_multiple_keys(lgnd_test_data, tmptestdir):

assert np.array_equal(raw_sat_lo.nda, proc_sat_lo.nda)
assert np.array_equal(raw_sat_hi.nda, proc_sat_hi.nda)
assert proc_sat_lo.dtype == np.uint16
assert isinstance(proc_sat_lo.nda[0], np.uint16)


def test_buffer_processor_all_pass(lgnd_test_data, tmptestdir):
Expand Down Expand Up @@ -1365,7 +1365,7 @@ def test_buffer_processor_drop_waveform_small_buffer(lgnd_test_data, tmptestdir)

assert np.array_equal(raw_sat_lo.nda, proc_sat_lo.nda)
assert np.array_equal(raw_sat_hi.nda, proc_sat_hi.nda)
assert proc_sat_lo.dtype == np.uint16
assert isinstance(proc_sat_lo.nda[0], np.uint16)


# check that packet indexes match in verification test
Expand Down
4 changes: 2 additions & 2 deletions tests/buffer_processor/test_lh5_buffer_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ def test_raw_geds_no_proc_spms(lgnd_test_data):

assert np.array_equal(raw_sat_lo.nda, proc_sat_lo.nda)
assert np.array_equal(raw_sat_hi.nda, proc_sat_hi.nda)
assert type(proc_sat_lo.nda[0]) == np.uint16
assert isinstance(proc_sat_lo.nda[0], np.uint16)


# check that packet indexes match in verification test
Expand Down Expand Up @@ -1029,7 +1029,7 @@ def test_lh5_buffer_processor_multiple_keys(lgnd_test_data):

assert np.array_equal(raw_sat_lo.nda, proc_sat_lo.nda)
assert np.array_equal(raw_sat_hi.nda, proc_sat_hi.nda)
assert type(proc_sat_lo.nda[0]) == np.uint16
assert isinstance(proc_sat_lo.nda[0], np.uint16)


def test_buffer_processor_all_pass(lgnd_test_data):
Expand Down
56 changes: 24 additions & 32 deletions tests/compass/test_compass_header_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,24 @@ def test_values(compass_config):
}
# We have a nested struct, so we need some nasty recursion
for key in compass_config.keys():
if type(compass_config[key]) == Scalar:
if isinstance(compass_config[key], Scalar):
assert compass_config[key].value == expected_dict[key]
# Nested struct
else:
for key_2 in compass_config[key]:
if type(compass_config[key][key_2]) == Scalar:
if isinstance(compass_config[key][key_2], Scalar):
assert compass_config[key][key_2].value == expected_dict[key][key_2]
else:
for key_3 in compass_config[key][key_2]:
if type(compass_config[key][key_2][key_3]) == Scalar:
if isinstance(compass_config[key][key_2][key_3], Scalar):
assert (
compass_config[key][key_2][key_3].value
== expected_dict[key][key_2][key_3]
)
else:
for key_4 in compass_config[key][key_2][key_3]:
if (
type(compass_config[key][key_2][key_3][key_4])
== Scalar
if isinstance(
compass_config[key][key_2][key_3][key_4], Scalar
):
assert (
compass_config[key][key_2][key_3][key_4].value
Expand All @@ -77,13 +76,11 @@ def test_values(compass_config):
for key_5 in compass_config[key][key_2][key_3][
key_4
]:
if (
type(
compass_config[key][key_2][key_3][
key_4
][key_5]
)
== Scalar
if isinstance(
compass_config[key][key_2][key_3][key_4][
key_5
],
Scalar,
):
assert (
compass_config[key][key_2][key_3][
Expand Down Expand Up @@ -142,7 +139,7 @@ def test_values_no_config(compass_config_no_settings):
}
# We have a nested struct, so we need some nasty recursion
for key in compass_config_no_settings.keys():
if type(compass_config_no_settings[key]) == Scalar:
if isinstance(compass_config_no_settings[key], Scalar):
if (np.isnan(compass_config_no_settings[key].value)) and (
np.isnan(expected_dict[key])
):
Expand All @@ -151,7 +148,7 @@ def test_values_no_config(compass_config_no_settings):
assert compass_config_no_settings[key].value == expected_dict[key]
else:
for key_2 in compass_config_no_settings[key]:
if type(compass_config_no_settings[key][key_2]) == Scalar:
if isinstance(compass_config_no_settings[key][key_2], Scalar):
if (np.isnan(compass_config_no_settings[key][key_2].value)) and (
np.isnan(expected_dict[key][key_2])
):
Expand All @@ -163,9 +160,8 @@ def test_values_no_config(compass_config_no_settings):
)
else:
for key_3 in compass_config_no_settings[key][key_2]:
if (
type(compass_config_no_settings[key][key_2][key_3])
== Scalar
if isinstance(
compass_config_no_settings[key][key_2][key_3], Scalar
):
if (
np.isnan(
Expand All @@ -180,13 +176,11 @@ def test_values_no_config(compass_config_no_settings):
)
else:
for key_4 in compass_config_no_settings[key][key_2][key_3]:
if (
type(
compass_config_no_settings[key][key_2][key_3][
key_4
]
)
== Scalar
if isinstance(
compass_config_no_settings[key][key_2][key_3][
key_4
],
Scalar,
):
if np.isnan(
compass_config_no_settings[key][key_2][key_3][
Expand All @@ -209,13 +203,11 @@ def test_values_no_config(compass_config_no_settings):
for key_5 in compass_config_no_settings[key][key_2][
key_3
][key_4]:
if (
type(
compass_config_no_settings[key][key_2][
key_3
][key_4][key_5]
)
== Scalar
if isinstance(
compass_config_no_settings[key][key_2][
key_3
][key_4][key_5],
Scalar,
):
if (
np.isnan(
Expand Down

0 comments on commit a564e3f

Please sign in to comment.