Skip to content

Commit 17155c1

Browse files
committed
Refactor pdl.py to improve function parameter formatting and enhance readability
1 parent 82e0153 commit 17155c1

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

common/devtools/pdl.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
]
2525

2626

27-
def assignType(item:dict, type:str, is_array:bool=False, map_binary_to_string:bool=False) -> None:
27+
def assignType(
28+
item: dict, type: str, is_array: bool = False, map_binary_to_string: bool = False
29+
) -> None:
2830
if is_array:
2931
item["type"] = "array"
3032
item["items"] = OrderedDict()
@@ -41,7 +43,9 @@ def assignType(item:dict, type:str, is_array:bool=False, map_binary_to_string:bo
4143
item["$ref"] = type
4244

4345

44-
def createItem(d:dict, experimental:bool | Any , deprecated:bool | Any, name:str | Any =None)->OrderedDict[str, Any]:
46+
def createItem(
47+
d: dict, experimental: bool | Any, deprecated: bool | Any, name: str | Any = None
48+
) -> OrderedDict[str, Any]:
4549
result = OrderedDict(d)
4650
if name:
4751
result["name"] = name
@@ -55,7 +59,9 @@ def createItem(d:dict, experimental:bool | Any , deprecated:bool | Any, name:str
5559
return result
5660

5761

58-
def parse(data:str, file_name:str, map_binary_to_string:bool=False)-> OrderedDict[str, Any]:
62+
def parse(
63+
data: str, file_name: str, map_binary_to_string: bool = False
64+
) -> OrderedDict[str, Any]:
5965
protocol = OrderedDict()
6066
protocol["version"] = OrderedDict()
6167
protocol["domains"] = []
@@ -184,7 +190,9 @@ def parse(data:str, file_name:str, map_binary_to_string:bool=False)-> OrderedDic
184190
return protocol
185191

186192

187-
def loads(data:str, file_name:str, map_binary_to_string:bool=False) -> OrderedDict[str, Any] | Any:
193+
def loads(
194+
data: str, file_name: str, map_binary_to_string: bool = False
195+
) -> OrderedDict[str, Any] | Any:
188196
if file_name.endswith(".pdl"):
189197
return parse(data, file_name, map_binary_to_string)
190198
return json.loads(data)

0 commit comments

Comments
 (0)