Skip to content

Commit

Permalink
silence new flake8-bugbear B028 error
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfikl authored and inducer committed Feb 15, 2023
1 parent 6533d47 commit 1dff711
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion boxtree/distributed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ def make_distributed_wrangler(
# TODO: should replace the default calibration params with a more
# accurate one
warnings.warn("Calibration parameters for the cost model are not "
"supplied. The default one will be used.")
"supplied. The default one will be used.",
stacklevel=2)
calibration_params = \
FMMCostModel.get_unit_calibration_params()

Expand Down
4 changes: 2 additions & 2 deletions boxtree/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ def filter_target_lists_in_user_order(queue, tree, flags):
"filter_target_lists_in_user_order() is deprecated and will go "
"away in a future release. Use "
"ParticleListFilter.filter_target_lists_in_user_order() instead.",
DeprecationWarning)
DeprecationWarning, stacklevel=2)

return (ParticleListFilter(queue.context)
.filter_target_lists_in_user_order(queue, tree, flags))
Expand All @@ -1206,7 +1206,7 @@ def filter_target_lists_in_tree_order(queue, tree, flags):
"filter_target_lists_in_tree_order() is deprecated and will go "
"away in a future release. Use "
"ParticleListFilter.filter_target_lists_in_tree_order() instead.",
DeprecationWarning)
DeprecationWarning, stacklevel=2)

return (ParticleListFilter(queue.context)
.filter_target_lists_in_tree_order(queue, tree, flags))
Expand Down
2 changes: 1 addition & 1 deletion boxtree/tree_of_boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def _apply_coarsen_flags(coarsen_flags, tob, error_on_ignored_flags=True):
raise RuntimeError(msg)
else:
import warnings
warnings.warn(msg)
warnings.warn(msg, stacklevel=3)

# deleted boxes are marked as:
# level = inf
Expand Down
2 changes: 1 addition & 1 deletion test/test_fmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ def fmm_level_to_order(tree, lev):
have_sumpy = False
from warnings import warn
warn("sumpy unavailable: cannot compute independent reference "
"values for pyfmmlib")
"values for pyfmmlib", stacklevel=1)
else:
have_sumpy = True

Expand Down

0 comments on commit 1dff711

Please sign in to comment.