Skip to content

Address a few issues in grid_events.py as pointed out by pylint#426

Merged
jonasbardino merged 2 commits intonextfrom
fix/grid_events-issues-reported-by-pylint
Jan 28, 2026
Merged

Address a few issues in grid_events.py as pointed out by pylint#426
jonasbardino merged 2 commits intonextfrom
fix/grid_events-issues-reported-by-pylint

Conversation

@jonasbardino
Copy link
Contributor

@jonasbardino jonasbardino commented Jan 28, 2026

Address a couple of issues in grid_events.py as pointed out by pylint in GH Actions:

************* Module mig.server.grid_events
mig/server/grid_events.py:275:25: E0606: Possibly using variable 'hit_count' before assignment (possibly-used-before-assignment)
mig/server/grid_events.py:275:36: E0606: Possibly using variable 'hit_period' before assignment (possibly-used-before-assignment)

also covered in #338, and similarly pylint on Rocky9 deployments:

************* Module mig.server.grid_events
mig/server/grid_events.py:618:16: E4702: Iterated dict 'all_rules' is being modified inside for loop body, iterate through a copy of it instead. (modified-iterating-dict)
mig/server/grid_events.py:624:20: E4702: Iterated dict 'all_rules' is being modified inside for loop body, iterate through a copy of it instead. (modified-iterating-dict)

Added a similar fix for the in-place miss_cache clean up as well.

The last one about the PatternMatchingEventHandler only applies with watchdog 5.x and later:

************* Module mig.server.grid_events
mig/server/grid_events.py:521:8: E1121: Too many positional arguments for unbound method call (too-many-function-args)
mig/server/grid_events.py:684:8: E1121: Too many positional arguments for unbound method call (too-many-function-args)

due to an API change in the constructor, and it is fixed with a minor update to our constructor calls.

```
************* Module mig.server.grid_events
mig/server/grid_events.py:275:25: E0606: Possibly using variable 'hit_count' before assignment (possibly-used-before-assignment)
mig/server/grid_events.py:275:36: E0606: Possibly using variable 'hit_period' before assignment (possibly-used-before-assignment)
```
and on Rocky9 deployments:
```
************* Module mig.server.grid_events
mig/server/grid_events.py:618:16: E4702: Iterated dict 'all_rules' is being modified inside for loop body, iterate through a copy of it instead. (modified-iterating-dict)
mig/server/grid_events.py:624:20: E4702: Iterated dict 'all_rules' is being modified inside for loop body, iterate through a copy of it instead. (modified-iterating-dict)
```

Added a similar fix for the similar in-place `miss_cache` clean up.
@jonasbardino jonasbardino added the bug Something isn't working label Jan 28, 2026
…uments to

match the API update in watchdog 5.0 and later.
@jonasbardino jonasbardino marked this pull request as ready for review January 28, 2026 10:40
@jonasbardino jonasbardino requested a review from a team January 28, 2026 10:40
@jonasbardino jonasbardino changed the title Address a couple of issues in grid_events.py as pointed out by pylint Address a few issues in grid_events.py as pointed out by pylint Jan 28, 2026
Copy link
Contributor

@Martin-Rehr Martin-Rehr left a comment

Choose a reason for hiding this comment

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

Approved

@albu-diku
Copy link
Contributor

You beat me both to authoring and review :) great that we are just taking care of these immediately!

@jonasbardino
Copy link
Contributor Author

You beat me both to authoring and review :) great that we are just taking care of these immediately!

Thanks for the quick review @Martin-Rehr and @albu-diku . I'll merge and let the fixes trickle into #338 to silence one more "nagging-generator" from the dashboard.

@jonasbardino jonasbardino merged commit 40e3819 into next Jan 28, 2026
14 checks passed
@jonasbardino jonasbardino deleted the fix/grid_events-issues-reported-by-pylint branch January 28, 2026 12:12
@jonasbardino jonasbardino self-assigned this Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants