ansible / mazer

Experimental Ansible Galaxy Content Manager
GNU General Public License v3.0
114 stars 18 forks source link

Remove CollectionInfo() mutable defaults #171

Closed alikins closed 5 years ago

alikins commented 5 years ago
SUMMARY

Use factory=list instead of default=[] for attr default.

authors = attr.ib(default=[]) makes the default value for the 'authors' attribute of the class a mutable list. It can be modified and later new instances will use the mutated list as the default instead of new empty list.

Use attr.ib's factory option to specify to use an empty list if otherwise not provided.

https://www.attrs.org/en/stable/init.html#defaults has some notes on this.

ISSUE TYPE
MAZER VERSION
name = mazer
version = 0.3.0
config_file = /home/adrian/.ansible/mazer.yml
uname = Linux, newswoop, 4.18.12-100.fc27.x86_64, #1 SMP Thu Oct 4 16:22:17 UTC 2018, x86_64
executable_location = /home/adrian/venvs/galaxy-cli-py3-2/bin/mazer
python_version = 3.6.6 (default, Jul 19 2018, 16:29:00) [GCC 7.3.1 20180303 (Red Hat 7.3.1-5)]
python_executable = /home/adrian/venvs/galaxy-cli-py3-2/bin/python
ADDITIONAL INFORMATION