Skip to content

Fix mutable default arguments in jump_to and zoom_to (#2501) - #2858

Open
Jamessshhh wants to merge 5 commits into
gee-community:masterfrom
Jamessshhh:fix-mutable-defaults-2501
Open

Jamessshhh wants to merge 5 commits into
gee-community:masterfrom
Jamessshhh:fix-mutable-defaults-2501

Conversation

@Jamessshhh

Copy link
Copy Markdown

Partially addresses #2501

Fixes mutable default arguments ({}) in jump_to and zoom_to in maplibregl.py, replacing them with None defaults 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.

Copilot AI lite review requested due to automatic review settings August 12, 2026 18:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 with None for jump_to(...) and zoom_to(...).
  • Add guard clauses to initialize options to 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants