Fix mutable default arguments in jump_to and zoom_to (#2501) - #2858
Open
Jamessshhh wants to merge 5 commits into
Open
Jamessshhh wants to merge 5 commits into
Jamessshhh wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates geemap’s MapLibre GL wrapper API to avoid mutable default arguments in jump_to and zoom_to, aligning with Python best practices and addressing the specific B006 concern raised in #2501.
Changes:
- Replace
{}default parameters withNoneforjump_to(...)andzoom_to(...). - Add guard clauses to initialize
optionsto a new{}per call when not provided. - Update docstrings to reflect the new default behavior.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Fixes source_args: dict = {} mutable defaults in add_geojson, add_vector,
add_gdf, add_tile_layer, and add_wms_layer. Follow-up to earlier fix of
jump_to/zoom_to. Part of gee-community#2501.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Partially addresses #2501
Fixes mutable default arguments (
{}) injump_toandzoom_toinmaplibregl.py, replacing them withNonedefaults and a guard clause, per Python best practices (flake8-bugbear B006).This is a partial fix — the issue affects several more instances across this file and others (geemap.py, foliumap.py, chart.py, core.py, deck.py, toolbar.py). Happy to follow up with additional PRs for those if that structure works for the maintainers.