@@ -32,9 +32,9 @@ def save_cache(cache: Dict) -> None:
3232 f .write ("\n " )
3333
3434
35-
36-
37- def get_changed_serializers ( old_commit : str , new_commit : str , api_path : str ) -> List [str ]:
35+ def get_changed_serializers (
36+ old_commit : str , new_commit : str , api_path : str
37+ ) -> List [str ]:
3838 """Get list of serializer files changed between commits."""
3939 import subprocess
4040
@@ -52,7 +52,9 @@ def get_changed_serializers(old_commit: str, new_commit: str, api_path: str) ->
5252 return [f for f in files if "serializers.py" in f ]
5353
5454
55- def find_types_using_serializer (cache : Dict , serializer_path : str , serializer_name : str ) -> List [str ]:
55+ def find_types_using_serializer (
56+ cache : Dict , serializer_path : str , serializer_name : str
57+ ) -> List [str ]:
5658 """Find all type keys that use a specific serializer."""
5759 search_string = f"{ serializer_path } :{ serializer_name } "
5860 types = []
@@ -67,8 +69,6 @@ def find_types_using_serializer(cache: Dict, serializer_path: str, serializer_na
6769 return types
6870
6971
70-
71-
7272def update_metadata (stats : Dict ) -> None :
7373 """Update cache metadata with sync statistics."""
7474 cache = load_cache ()
@@ -80,7 +80,9 @@ def update_metadata(stats: Dict) -> None:
8080 save_cache (cache )
8181
8282
83- def get_types_needing_sync (serializer_files : List [str ], api_path : str , type_category : str = "response" ) -> List [Dict ]:
83+ def get_types_needing_sync (
84+ serializer_files : List [str ], api_path : str , type_category : str = "response"
85+ ) -> List [Dict ]:
8486 """
8587 Get list of types that need syncing based on changed serializer files.
8688
@@ -108,12 +110,14 @@ def get_types_needing_sync(serializer_files: List[str], api_path: str, type_cate
108110 serializer = type_data .get ("serializer" , "" )
109111 if file_path in serializer and ":" in serializer :
110112 serializer_class = serializer .split (":" )[- 1 ].strip ()
111- types_to_check .append ({
112- "key" : type_key ,
113- "serializer_file" : file_path ,
114- "serializer_class" : serializer_class ,
115- "type_name" : type_data .get ("type" , "" ),
116- })
113+ types_to_check .append (
114+ {
115+ "key" : type_key ,
116+ "serializer_file" : file_path ,
117+ "serializer_class" : serializer_class ,
118+ "type_name" : type_data .get ("type" , "" ),
119+ }
120+ )
117121
118122 return types_to_check
119123
@@ -152,12 +156,14 @@ def filter_syncable_types(cache: Dict, type_category: str = "response") -> List[
152156 if "serializers.py:" in serializer and ":" in serializer :
153157 parts = serializer .split (":" )
154158 if len (parts ) == 2 :
155- syncable .append ({
156- "key" : type_key ,
157- "serializer_file" : parts [0 ],
158- "serializer_class" : parts [1 ].strip (),
159- "type_name" : type_data .get ("type" , "" ),
160- })
159+ syncable .append (
160+ {
161+ "key" : type_key ,
162+ "serializer_file" : parts [0 ],
163+ "serializer_class" : parts [1 ].strip (),
164+ "type_name" : type_data .get ("type" , "" ),
165+ }
166+ )
161167
162168 return syncable
163169
@@ -208,8 +214,18 @@ def get_last_commit() -> str:
208214
209215 else :
210216 print ("Usage:" )
211- print (" changed-serializers OLD NEW PATH - Get changed serializer files" )
212- print (" types-to-sync [response|request] FILE... PATH - Get types needing sync" )
213- print (" update-metadata - Update metadata (JSON via stdin)" )
214- print (" syncable-types [response|request] - Get all syncable type info" )
215- print (" get-last-commit - Get last backend commit from cache" )
217+ print (
218+ " changed-serializers OLD NEW PATH - Get changed serializer files"
219+ )
220+ print (
221+ " types-to-sync [response|request] FILE... PATH - Get types needing sync"
222+ )
223+ print (
224+ " update-metadata - Update metadata (JSON via stdin)"
225+ )
226+ print (
227+ " syncable-types [response|request] - Get all syncable type info"
228+ )
229+ print (
230+ " get-last-commit - Get last backend commit from cache"
231+ )
0 commit comments