@@ -99,17 +99,21 @@ def process(source: Path, target: Path):
99
99
with Path .open (module_path ) as fp :
100
100
module_dump = fp .read ()
101
101
102
- module_dump = re .sub (r"( {4}def )(?!_)" , r" async def " , module_dump )
103
-
104
- module_dump = re .sub (r"self\.client\.(.+)\(" , r"await self.client.\1(" , module_dump )
105
-
102
+ # Adjust imports.
106
103
for relative_import in [".base" , "..client" , "..knowledge" , "..model" ]:
107
104
module_dump = module_dump .replace (f"from { relative_import } " , f"from .{ relative_import } " )
108
105
109
- module_dump = module_dump .replace ("self.api.version" , "await self.api.version" )
106
+ # Modify function definitions.
107
+ module_dump = re .sub (r"( {4}def )(?!_)" , r" async def " , module_dump )
108
+
109
+ # Modify function calls.
110
+ module_dump = re .sub (r"self\.client\.(.+)\(" , r"await self.client.\1(" , module_dump )
110
111
module_dump = re .sub (r"= self\.(.+)\(" , r"= await self.\1(" , module_dump )
111
112
module_dump = re .sub (r"send_request\(" , r"await send_request(" , module_dump )
112
113
114
+ # Modify property accesses.
115
+ module_dump = module_dump .replace ("self.api.version" , "await self.api.version" )
116
+
113
117
module_processed .append (module_path )
114
118
target_path = Path (str (module_path ).replace (str (source ), str (target )))
115
119
with Path .open (target_path , "w" ) as fp :
0 commit comments