Skip to content

Avoid mutable default arguments (#2501) - #2839

Open
HafizMHussain wants to merge 1 commit into
gee-community:masterfrom
HafizMHussain:fix-mutable-default-args
Open

Avoid mutable default arguments (#2501)#2839
HafizMHussain wants to merge 1 commit into
gee-community:masterfrom
HafizMHussain:fix-mutable-default-args

Conversation

@HafizMHussain

Copy link
Copy Markdown

Fixes part of #2501.

Per the Google Python style guide,
mutable objects should not be used as default argument values. This PR fixes
a focused set of occurrences by defaulting to None and initializing the
mutable value inside the function body:

  • chart.py: image_histogram (reducer_args)
  • common.py: search_ee_data (keys), download_ee_image_tiles_parallel (job_args)
  • deck.py: Map.add_ee_layer (vis_params) — also removes the now-resolved TODO
  • plotlymap.py: Map.add_ee_layer (vis_params)

deck.py and plotlymap.py already guarded against None internally, so
those are signature/docstring updates only. Behavior is preserved.

Verification: black --check passes and all changed files compile.

Scope note: This is a focused first pass. There are more occurrences
(mainly in maplibregl.py and timelapse.py) that I'm happy to address in
a follow-up PR if you'd like — kept this one small for easy review.

Per the Google Python style guide, mutable objects should not be used as
default argument values. This fixes several occurrences by defaulting to
None and initializing the mutable value inside the function body:

- chart.py: image_histogram (reducer_args)
- common.py: search_ee_data (keys), download_ee_image_tiles_parallel (job_args)
- deck.py: Map.add_ee_layer (vis_params) - also removes the resolved TODO
- plotlymap.py: Map.add_ee_layer (vis_params)

deck.py and plotlymap.py already guarded against None internally, so those
are signature/docstring updates only. Behavior is preserved; black and
compile checks pass.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

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.

1 participant