construct-typing/construct_typed
‮nerB‭‮ taraM‭ 14a10ebfc5
In csfield, force cs.Default to appear as init
Default[Construct] always has flagbuildnone as True, and therefore Default won't be available in the dataclass init.
This behaviour makes sense for Const and many other flagbuildnone, as then there is no need to provide a value, but with Default the current implementation removes the possibility of providing a overriding value.

Short example:
```py
import dataclasses
from construct_typed import DataclassMixin, csfield

@dataclasses.dataclass
class BandSystemTime(DataclassMixin):

    Year: int = csfield(Default(Int16ul, 0))
    Month: int = csfield(Default(Int16ul, 0))
    DayOfWeek: int = csfield(Default(Int16ul, 0))
    Day: int = csfield(Default(Int16ul, 0))
    Hour: int = csfield(Default(Int16ul, 0))
    Minute: int = csfield(Default(Int16ul, 0))
    Second: int = csfield(Default(Int16ul, 0))
    Milliseconds: int = csfield(Default(Int16ul, 0))```

```py
# Current behaviour
>>> BandSystemTime(Hour=12)
TypeError: __init__() got an unexpected keyword argument 'Hour'

>>> BandSystemTime.__init__
<function <...>.__create_fn__.<locals>.__init__(self) -> None>```

```py
# Desired behaviour
>>> BandSystemTime(Hour=12)
BandSystemTime(Year=0, Month=10, DayOfWeek=1, Day=0, Hour=2, Minute=0, Second=0, Milliseconds=0)

>>> BandSystemTime.__init__
<function <...>.__create_fn__.<locals>.__init__(self, Year: int = 0, Month: int = 0, DayOfWeek: int = 0, Day: int = 0, Hour: int = 0, Minute: int = 0, Second: int = 0, Milliseconds: int = 0) -> None>```
2022-04-30 22:04:54 +01:00
..
__init__.py - updated documentation 2021-05-23 15:28:27 +02:00
dataclass_struct.py In csfield, force cs.Default to appear as init 2022-04-30 22:04:54 +01:00
generic_wrapper.py - updated documentation 2021-05-23 15:28:27 +02:00
py.typed - divided construct_typed in multiple files 2020-12-31 17:11:21 +01:00
tenum.py fixed __new__ 2021-03-24 20:19:15 +01:00
version.py Revert "incremented version to 0.5.3" 2021-10-23 13:07:06 +02:00