Support and test python3.11
I am running py3.11.3 on M1 mac and in a conda env and I get an error for every example script I run:
$ python -u ".../w7x/examples/poincare.py" Traceback (most recent call last): File "/Users/tomie_g/w7x/examples/poincare.py", line 13, in import w7x File "/Users/tomie_g/opt/anaconda3/envs/eleven/lib/python3.11/site-packages/w7x/init.py", line 15, in from . import config File "/Users/tomie_g/opt/anaconda3/envs/eleven/lib/python3.11/site-packages/w7x/config.py", line 452, in class Plasma: File "/Users/tomie_g/opt/anaconda3/envs/eleven/lib/python3.11/site-packages/w7x/config.py", line 463, in Plasma @dataclasses.dataclass ^^^^^^^^^^^^^^^^^^^^^ File "/Users/tomie_g/opt/anaconda3/envs/eleven/lib/python3.11/site-packages/w7x/lib/dataclasses.py", line 127, in dataclass wrapped_cls = dataclasses.dataclass(**kwargs)(cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/tomie_g/opt/anaconda3/envs/eleven/lib/python3.11/dataclasses.py", line 1213, in wrap return _process_class(cls, init, repr, eq, order, unsafe_hash, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/tomie_g/opt/anaconda3/envs/eleven/lib/python3.11/dataclasses.py", line 958, in _process_class cls_fields.append(_get_field(cls, name, type, kw_only)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/tomie_g/opt/anaconda3/envs/eleven/lib/python3.11/dataclasses.py", line 815, in _get_field raise ValueError(f'mutable default {type(f.default)} for field ' ValueError: mutable default <class 'w7x.lib.profiles.PowerSeries'> for field t_e is not allowed: use default_factory
Where the t_e in question I believe is defined in the class Plasma on line 443 of w7x/config.py:
t_e: Profile = PowerSeries(coefficients=[0.0, 0.0], domain=[0, 1])
The error I think has to do with the default value given to the PowerSeries function here. Raising an error for not using a defualt_factory instead is new to py3.11 I think, in previous versions it was just not recommended.