File tree Expand file tree Collapse file tree 6 files changed +24
-8
lines changed Expand file tree Collapse file tree 6 files changed +24
-8
lines changed Original file line number Diff line number Diff line change 11from decimal import Decimal
22from typing import Any , Dict
33
4+ from scaleway_core .profile import ProfileDefaults
5+
46
57def unmarshal_Decimal (data : Any ) -> Decimal :
68 """
@@ -19,7 +21,7 @@ def unmarshal_Decimal(data: Any) -> Decimal:
1921 return Decimal (data ["value" ])
2022
2123
22- def marshal_Decimal (data : Decimal ) -> Dict [str , Any ]:
24+ def marshal_Decimal (data : Decimal , _defaults : ProfileDefaults | None ) -> Dict [str , Any ]:
2325 """
2426 Marshal an instance of Decimal into google.protobuf.Decimal JSON representation.
2527 """
Original file line number Diff line number Diff line change 11from dataclasses import dataclass
22from typing import Any , Dict
33
4+ from scaleway_core .profile import ProfileDefaults
5+
46
57@dataclass
68class Money :
@@ -48,7 +50,7 @@ def unmarshal_Money(data: Any) -> Money:
4850 )
4951
5052
51- def marshal_Money (data : Money ) -> Dict [str , Any ]:
53+ def marshal_Money (data : Money , _defaults : ProfileDefaults | None ) -> Dict [str , Any ]:
5254 """
5355 Marshal an instance of Money into a JSON compatible data structure.
5456 """
Original file line number Diff line number Diff line change 11from dataclasses import dataclass
22from typing import Any , Dict
33
4+ from scaleway_core .profile import ProfileDefaults
5+
46
57@dataclass
68class ScwFile :
@@ -40,7 +42,7 @@ def unmarshal_ScwFile(data: Any) -> ScwFile:
4042 )
4143
4244
43- def marshal_ScwFile (obj : ScwFile ) -> Dict [str , Any ]:
45+ def marshal_ScwFile (obj : ScwFile , _defaults : ProfileDefaults | None ) -> Dict [str , Any ]:
4446 """
4547 Marshals a ScwFile object into a dict.
4648 """
Original file line number Diff line number Diff line change 11from dataclasses import dataclass
22from typing import Any , Dict , Optional
33
4+ from scaleway_core .profile import ProfileDefaults
5+
46
57@dataclass
68class ServiceInfo :
@@ -48,7 +50,9 @@ def unmarshal_ServiceInfo(data: Any) -> ServiceInfo:
4850 )
4951
5052
51- def marshal_ServiceInfo (obj : ServiceInfo ) -> Dict [str , Any ]:
53+ def marshal_ServiceInfo (
54+ obj : ServiceInfo , _defaults : ProfileDefaults | None
55+ ) -> Dict [str , Any ]:
5256 """
5357 Marshals a ServiceInfo object into a dict.
5458 """
Original file line number Diff line number Diff line change 33from typing import Any , Dict , List
44from dateutil import parser
55
6+ from scaleway_core .profile import ProfileDefaults
7+
68
79@dataclass
810class TimeSeriesPoint :
@@ -36,7 +38,9 @@ def unmarshal_TimeSeriesPoint(data: Any) -> TimeSeriesPoint:
3638 )
3739
3840
39- def marshal_TimeSeriesPoint (data : TimeSeriesPoint ) -> Dict [str , Any ]:
41+ def marshal_TimeSeriesPoint (
42+ data : TimeSeriesPoint , _defaults : ProfileDefaults | None
43+ ) -> Dict [str , Any ]:
4044 """
4145 Marshal an instance of TimeSeriesPoint into a JSON compatible data structure.
4246 """
@@ -84,12 +88,14 @@ def unmarshal_TimeSeries(data: Any) -> TimeSeries:
8488 )
8589
8690
87- def marshal_TimeSeries (data : TimeSeries ) -> Dict [str , Any ]:
91+ def marshal_TimeSeries (
92+ data : TimeSeries , defaults : ProfileDefaults | None
93+ ) -> Dict [str , Any ]:
8894 """
8995 Marshal an instance of TimeSeries into a JSON compatible data structure.
9096 """
9197 return {
9298 "name" : data .name ,
93- "points" : [marshal_TimeSeriesPoint (point ) for point in data .points ],
99+ "points" : [marshal_TimeSeriesPoint (point , defaults ) for point in data .points ],
94100 "metadata" : data .metadata ,
95101 }
Original file line number Diff line number Diff line change 77class TestBridgeMarshal (unittest .TestCase ):
88 def test_decimal_marshal (self ):
99 decimal = Decimal ("1.2" )
10- self .assertEqual (marshal_Decimal (decimal ), {"value" : "1.2" })
10+ self .assertEqual (marshal_Decimal (decimal , None ), {"value" : "1.2" })
1111
1212 def test_decimal_unmarshal (self ):
1313 decimal = Decimal ("1.2" )
You can’t perform that action at this time.
0 commit comments