Skip to content

Commit

Permalink
Solve and enforce flake8-bugbear B009
Browse files Browse the repository at this point in the history
"Do not call getattr with a constant attribute value, it is not any
safer than normal property access."
  • Loading branch information
berland committed Sep 5, 2023
1 parent ea08d99 commit d4ac0b9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ ignore =
# line break before binary operator, solved by black:
W503
# The minimal set of ignores that makes flake8 pass when flake8-bugbear is installed:
B009
B019
max-line-length = 88
4 changes: 1 addition & 3 deletions tests/unit_tests/config/config_dict_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,7 @@ def _observation_dates(
restart_obs = [
o for o in observations if hasattr(o, "restart") and o.restart is not None
]
segments = [
s for o in observations if hasattr(o, "segment") for s in getattr(o, "segment")
]
segments = [s for o in observations if hasattr(o, "segment") for s in o.segment]
restart_indecies = (
[o.restart for o in restart_obs]
+ [s.start for s in segments]
Expand Down

0 comments on commit d4ac0b9

Please sign in to comment.