@@ -97,17 +97,21 @@ def process(source: Path, target: Path):
9797 with Path .open (module_path ) as fp :
9898 module_dump = fp .read ()
9999
100- module_dump = re .sub (r"( {4}def )(?!_)" , r" async def " , module_dump )
101-
102- module_dump = re .sub (r"self\.client\.(.+)\(" , r"await self.client.\1(" , module_dump )
103-
100+ # Adjust imports.
104101 for relative_import in [".base" , "..client" , "..knowledge" , "..model" ]:
105102 module_dump = module_dump .replace (f"from { relative_import } " , f"from .{ relative_import } " )
106103
107- module_dump = module_dump .replace ("self.api.version" , "await self.api.version" )
104+ # Modify function definitions.
105+ module_dump = re .sub (r"( {4}def )(?!_)" , r" async def " , module_dump )
106+
107+ # Modify function calls.
108+ module_dump = re .sub (r"self\.client\.(.+)\(" , r"await self.client.\1(" , module_dump )
108109 module_dump = re .sub (r"= self\.(.+)\(" , r"= await self.\1(" , module_dump )
109110 module_dump = re .sub (r"send_request\(" , r"await send_request(" , module_dump )
110111
112+ # Modify property accesses.
113+ module_dump = module_dump .replace ("self.api.version" , "await self.api.version" )
114+
111115 module_processed .append (module_path )
112116 target_path = Path (str (module_path ).replace (str (source ), str (target )))
113117 with Path .open (target_path , "w" ) as fp :
0 commit comments