@@ -174,13 +174,18 @@ def next_version(self) -> str:
174174 if self ._next_version is None :
175175 self ._next_version = self .calculate_next_version ()
176176 return self ._next_version
177-
178- # Use the template to update readme and setup by packaging_tools
179- @return_origin_path
180- def check_file_with_packaging_tool (self ):
181-
182- os .chdir (Path (f"sdk/{ self .sdk_folder } " ))
183- title = ""
177+
178+ @property
179+ def extract_client_title_from_init (self ) -> str :
180+ """
181+ Extract the client title from a package's __init__.py file.
182+
183+ Args:
184+ package_name (str): The package name (e.g., "azure-mgmt-compute")
185+
186+ Returns:
187+ str: The client title if found, empty string otherwise
188+ """
184189 init_file = Path (self .whole_package_name ) / self .whole_package_name .replace ("-" , "/" ) / "__init__.py"
185190 try :
186191 with open (init_file , "r" ) as f :
@@ -195,10 +200,18 @@ def check_file_with_packaging_tool(self):
195200 # Extract the value
196201 for elt in node .value .elts :
197202 if isinstance (elt , ast .Constant ) and elt .value .endswith ("Client" ):
198- title = elt .value
199- break
203+ return elt .value
200204 except Exception as e :
201205 _LOGGER .info (f"Failed to extract title from { init_file } : { e } " )
206+
207+ return ""
208+
209+ # Use the template to update readme and setup by packaging_tools
210+ @return_origin_path
211+ def check_file_with_packaging_tool (self ):
212+
213+ os .chdir (Path (f"sdk/{ self .sdk_folder } " ))
214+ title = self .extract_client_title_from_init
202215
203216 if not title :
204217 _LOGGER .info (f"Can not find the title for { self .whole_package_name } " )
0 commit comments