CQ-editor icon indicating copy to clipboard operation
CQ-editor copied to clipboard

Fix empty dict as default arg

Open eudoxos opened this issue 3 years ago • 3 comments

See e.g. https://towardsdatascience.com/python-pitfall-mutable-default-arguments-9385e8265422

(It happened to me that an object was stubbornly getting color set in previous runs.)

eudoxos avatar Feb 11 '22 11:02 eudoxos

Codecov Report

Merging #322 (14146f8) into master (0d091ba) will increase coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #322   +/-   ##
=======================================
  Coverage   88.59%   88.59%           
=======================================
  Files          19       19           
  Lines        1490     1491    +1     
  Branches      201      201           
=======================================
+ Hits         1320     1321    +1     
  Misses        137      137           
  Partials       33       33           
Impacted Files Coverage Δ
cq_editor/widgets/object_tree.py 93.92% <100.00%> (+0.02%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0d091ba...14146f8. Read the comment docs.

codecov[bot] avatar Feb 11 '22 11:02 codecov[bot]

Thanks, how did you manage to modify the dict? Or did it happen in the CQ-editor code?

adam-urbanczyk avatar Feb 22 '22 17:02 adam-urbanczyk

Thanks, how did you manage to modify the dict? \

I can't remember anymore; I was trying different ways to make show_object show the object with label (and persistent properties) in the CQ editor; and then it happened that re-running the script with options removed was still setting the color.

eudoxos avatar Feb 28 '22 08:02 eudoxos