@@ -83,16 +83,19 @@ def run(self):
83
83
import re
84
84
85
85
async_source = header + source
86
- async_source = re .sub (" def (?!__init__|__check_error)" , " async def " , async_source )
87
- async_source = re .sub ("from .http_client import HttpClient, RequestsHttpClient" , "" , async_source )
86
+ async_source = re .sub (" def (?!__init__|__check_error)" , " async def " ,
87
+ async_source )
88
+ async_source = re .sub ("from .http_client import HttpClient, RequestsHttpClient" , "" ,
89
+ async_source )
88
90
89
91
# Change the signature of the __init__.
90
92
# self, channel_access_token
91
93
async_source = re .sub (r"def __init__\(self, channel_access_token," ,
92
94
"def __init__(self, channel_access_token, async_http_client," ,
93
95
async_source )
94
- async_source = re .sub (r",\s*timeout=HttpClient.DEFAULT_TIMEOUT, http_client=RequestsHttpClient" ,
95
- "" , async_source )
96
+ async_source = re .sub (
97
+ r",\s*timeout=HttpClient.DEFAULT_TIMEOUT, http_client=RequestsHttpClient" ,
98
+ "" , async_source )
96
99
async_source = re .sub (
97
100
r"if http_client:\n"
98
101
+ r"\s*self.http_client = http_client\(timeout=timeout\)\n"
@@ -107,21 +110,26 @@ def run(self):
107
110
+ " :param str data_endpoint: (optional) Default is https://api-data.line.me\n "
108
111
+ "\n \" \" \" \n "
109
112
, async_source , flags = re .DOTALL )
110
- async_source = re .sub ("'line-bot-sdk-python/'" , '"line-bot-sdk-python-async/"' , async_source )
113
+ async_source = re .sub ("'line-bot-sdk-python/'" , '"line-bot-sdk-python-async/"' ,
114
+ async_source )
111
115
112
- async_source = re .sub ('"""linebot.api module."""' , '"""linebot.async_api module."""' , async_source )
116
+ async_source = re .sub ('"""linebot.api module."""' , '"""linebot.async_api module."""' ,
117
+ async_source )
113
118
async_source = re .sub (
114
119
"self.(_get|_post|_delete|_put)" , "await self.\\ 1" , async_source
115
120
)
116
121
async_source = re .sub (
117
- "self.http_client.(get|post|delete|put)" , "await self.async_http_client.\\ 1" , async_source
122
+ "self.http_client.(get|post|delete|put)" , "await self.async_http_client.\\ 1" ,
123
+ async_source
118
124
)
119
125
async_source = re .sub (
120
126
"from .http_client import HttpClient, RequestsHttpClient" ,
121
- "from .async_http_client import AsyncHttpClient, AiohttpAsyncHttpClient" , async_source
127
+ "from .async_http_client import AsyncHttpClient, AiohttpAsyncHttpClient" ,
128
+ async_source
122
129
)
123
130
async_source = re .sub (
124
- "linebot.http_client.RequestsHttpClient" , "linebot.async_http_client.AiohttpAsyncHttpClient" ,
131
+ "linebot.http_client.RequestsHttpClient" ,
132
+ "linebot.async_http_client.AiohttpAsyncHttpClient" ,
125
133
async_source
126
134
)
127
135
async_source = re .sub (
@@ -131,7 +139,8 @@ def run(self):
131
139
"RequestsHttpClient" , "AiohttpAsyncHttpClient" , async_source
132
140
)
133
141
async_source = re .sub (
134
- "Default is self.http_client.timeout" , "Default is self.async_http_client.timeout" , async_source
142
+ "Default is self.http_client.timeout" , "Default is self.async_http_client.timeout" ,
143
+ async_source
135
144
)
136
145
async_source = re .sub (
137
146
"class LineBotApi" ,
0 commit comments