1
1
from __future__ import annotations
2
2
import json
3
- from typing import Optional
4
3
from sys import getsizeof
5
4
6
5
@@ -9,25 +8,31 @@ def _camelcased(value: str) -> str:
9
8
return capitalized [0 ].lower () + capitalized [1 :]
10
9
11
10
11
+ # pylint: disable=too-many-arguments
12
12
class FabricError (Exception ):
13
- context : Optional [ dict [str , str ]]
13
+ context : dict [str , str ] | None
14
14
description : str
15
15
http_code : int = 500
16
- name : Optional [ str ]
16
+ name : str | None
17
17
return_value : int
18
18
19
19
def __init__ (
20
20
self ,
21
- context : Optional [dict [str , str ]] = None ,
22
- description : Optional [str ] = None ,
23
- http_code : Optional [int ] = None ,
24
- name : Optional [str ] = None ):
21
+ context : dict [str , str ] | None = None ,
22
+ description : str | None = None ,
23
+ http_code : int | None = None ,
24
+ name : str = None ,
25
+ return_value : int | None = None ,
26
+ ** kwargs ):
25
27
self .context = context
28
+ self .name = name
29
+
26
30
if description :
27
31
self .description = description
28
- if http_code :
29
- self .http_code = http_code
30
- self .name = name
32
+ if http_code or kwargs .get ('httpCode' , None ):
33
+ self .http_code = http_code or kwargs .get ('httpCode' , None )
34
+ if return_value or kwargs .get ('returnValue' , None ):
35
+ self .return_value = return_value or kwargs .get ('returnValue' , None )
31
36
32
37
def __iter__ (self ):
33
38
yield from {
0 commit comments