weaveworks / grafanalib

Python library for building Grafana dashboards
Apache License 2.0
1.86k stars 309 forks source link

Fix bug with dict #590

Closed JamesGibo closed 1 year ago

JamesGibo commented 1 year ago

Replace everywhere default={} or default=[] used with factory=dict or factory=list instead, as if one value changed all change.

https://www.attrs.org/en/stable/api-attr.html#attr.ib

>>> import attr
>>> @attr.s
... class X:
...     d = attr.ib(default={})
...
>>> a = X()
>>> b = X()
>>> a.d['test']='test'
>>> b
X(d={'test': 'test'})
>>>

Thanks to @ilia-ilin-jiji for spotting

ujwalkumar1995 commented 1 year ago

Hey @JamesGibo I would like to work on this. Could you please assign?

JamesGibo commented 1 year ago

Closed in #593