desy-ml / cheetah

Fast and differentiable particle accelerator optics simulation for reinforcement learning and optimisation applications.
https://cheetah-accelerator.readthedocs.io
GNU General Public License v3.0
27 stars 12 forks source link

Failing pipeline due to new flake8-bugbear version #118

Closed cr-xu closed 5 months ago

cr-xu commented 5 months ago

It looks like the pipeline is failing due to the new flake8-bugbear version.

This needs to be fixed before #94

jank324 commented 5 months ago

This is a bit weird. The flake8 warning is:

./cheetah/converters/dontbmad.py:429:35: B038 editing a loop's mutable iterable often leads to unexpected results/bugs

But I would argue that this loop doesn't actually edit its iterable 🤔

for property in properties:
    assert property in understood, (
        f"Property {property} with value {properties[property]} for element type"
        f" {properties['element_type']} is currently not understood. Other values"
        f" in properties are {properties.keys()}."
cr-xu commented 5 months ago

Looks like it's a common issue: https://github.com/PyCQA/flake8-bugbear/issues/451 For now, shall we add --extend-ignore=B038 or just leave it until they update to fix this issue?

jank324 commented 5 months ago

Ignoring it is probably the way to go then, but I would ignore it inline.