Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable bugbear lint #5861

Merged
merged 16 commits into from
Oct 16, 2023
Merged

Enable bugbear lint #5861

merged 16 commits into from
Oct 16, 2023

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Aug 18, 2023

Continuation of work done in #5768

As mentioned in #5621 (comment), we want to add a linter to remove mutable objects in functions/methods signatures and with the release of Ruff 0.0.285, there now is an auto-fix for it in the ruleset Bugbear (B) in B006.

I have enabled the Bugbear rule and updated the code to comply with it. Two warnings are still in the code as I can see if this is expected behavior or if it is a real bug. EDIT: Not a bug, so I have replaced it with v with _.

holoviews/plotting/util.py:228:17: B007 Loop control variable `v` not used within loop body
holoviews/plotting/util.py:235:21: B007 Loop control variable `v` not used within loop body

for v in obj.last.values():
layers.append(obj)
elif issubclass(obj.type, Overlay):
if obj.callback.inputs and is_dynamic_overlay(obj):
for inp in obj.callback.inputs:
layers += split_dmap_overlay(inp, depth+1)
else:
for v in obj.last.values():
layers.append(obj)

@hoxbro hoxbro marked this pull request as draft August 18, 2023 07:24
@codecov-commenter
Copy link

codecov-commenter commented Aug 29, 2023

Codecov Report

Merging #5861 (bc90da6) into main (912d520) will decrease coverage by 0.22%.
The diff coverage is 74.85%.

@@            Coverage Diff             @@
##             main    #5861      +/-   ##
==========================================
- Coverage   88.58%   88.36%   -0.22%     
==========================================
  Files         313      313              
  Lines       65066    65302     +236     
==========================================
+ Hits        57636    57703      +67     
- Misses       7430     7599     +169     
Flag Coverage Δ
ui-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
holoviews/annotators.py 86.36% <100.00%> (+0.09%) ⬆️
holoviews/core/overlay.py 68.45% <100.00%> (ø)
holoviews/element/graphs.py 85.50% <100.00%> (+0.06%) ⬆️
holoviews/ipython/archive.py 45.36% <100.00%> (+1.15%) ⬆️
holoviews/plotting/bokeh/chart.py 88.21% <100.00%> (+0.03%) ⬆️
holoviews/plotting/bokeh/element.py 88.19% <100.00%> (+0.05%) ⬆️
holoviews/plotting/bokeh/graphs.py 91.25% <100.00%> (ø)
holoviews/plotting/bokeh/plot.py 92.32% <100.00%> (+0.05%) ⬆️
holoviews/plotting/mpl/graphs.py 88.15% <100.00%> (ø)
holoviews/plotting/mpl/plot.py 60.80% <100.00%> (+0.11%) ⬆️
... and 47 more

... and 3 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@hoxbro hoxbro marked this pull request as ready for review August 29, 2023 07:42
@@ -14,7 +14,9 @@ def _build_selection(self, el, exprs, **kwargs):
opts['selected'] = list(np.where(mask)[0])
return el.opts(clone=True, backend='bokeh', **opts)

def build_selection(self, selection_streams, hvobj, operations, region_stream=None, cache={}):
def build_selection(self, selection_streams, hvobj, operations, region_stream=None, cache=None):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it okay to change cache here?

raise NotImplementedError()

@staticmethod
def _select(element, selection_expr, cache={}):
def _select(element, selection_expr, cache=None):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it okay to change cache here?

@@ -645,7 +649,9 @@ def __init__(self, color_prop='color', alpha_prop='alpha', backend=None):
self.alpha_props = [alpha_prop]
self.backend = backend

def build_selection(self, selection_streams, hvobj, operations, region_stream=None, cache={}):
def build_selection(self, selection_streams, hvobj, operations, region_stream=None, cache=None):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it okay to change cache here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that's correct. The idea is that you can pass in an external cache.

@hoxbro hoxbro merged commit 4f24047 into main Oct 16, 2023
11 checks passed
@hoxbro hoxbro deleted the bugbear_lint2 branch October 16, 2023 10:15
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants