Skip to content

Commit d46a432

Browse files
committed
Renaming internal function to not be confused with dunder methods
1 parent f3b490a commit d46a432

2 files changed

Lines changed: 25 additions & 25 deletions

File tree

libraries/Builder/microsoft-agents-builder/microsoft/agents/builder/app/agent_application.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,14 @@ async def on_event(context: TurnContext, state: TurnState):
174174
- `type`: The type of the activity
175175
"""
176176

177-
def __selector__(context: TurnContext):
177+
def __selector(context: TurnContext):
178178
return type == context.activity.type
179179

180-
def __call__(func: RouteHandler[StateT]) -> RouteHandler[StateT]:
181-
self._routes.append(Route[StateT](__selector__, func))
180+
def __call(func: RouteHandler[StateT]) -> RouteHandler[StateT]:
181+
self._routes.append(Route[StateT](__selector, func))
182182
return func
183183

184-
return __call__
184+
return __call
185185

186186
def message(
187187
self, select: Union[str, Pattern[str], List[Union[str, Pattern[str]]]]
@@ -201,7 +201,7 @@ async def on_hi_message(context: TurnContext, state: TurnState):
201201
- `select`: a string or regex pattern
202202
"""
203203

204-
def __selector__(context: TurnContext):
204+
def __selector(context: TurnContext):
205205
if context.activity.type != ActivityTypes.message:
206206
return False
207207

@@ -212,11 +212,11 @@ def __selector__(context: TurnContext):
212212

213213
return text == select
214214

215-
def __call__(func: RouteHandler[StateT]) -> RouteHandler[StateT]:
216-
self._routes.append(Route[StateT](__selector__, func))
215+
def __call(func: RouteHandler[StateT]) -> RouteHandler[StateT]:
216+
self._routes.append(Route[StateT](__selector, func))
217217
return func
218218

219-
return __call__
219+
return __call
220220

221221
def conversation_update(
222222
self, type: ConversationUpdateTypes
@@ -238,7 +238,7 @@ async def on_channel_created(context: TurnContext, state: TurnState):
238238
- `type`: a string or regex pattern
239239
"""
240240

241-
def __selector__(context: TurnContext):
241+
def __selector(context: TurnContext):
242242
if context.activity.type != ActivityTypes.conversation_update:
243243
return False
244244

@@ -258,11 +258,11 @@ def __selector__(context: TurnContext):
258258

259259
return False
260260

261-
def __call__(func: RouteHandler[StateT]) -> RouteHandler[StateT]:
262-
self._routes.append(Route[StateT](__selector__, func))
261+
def __call(func: RouteHandler[StateT]) -> RouteHandler[StateT]:
262+
self._routes.append(Route[StateT](__selector, func))
263263
return func
264264

265-
return __call__
265+
return __call
266266

267267
def message_reaction(
268268
self, type: MessageReactionTypes
@@ -283,7 +283,7 @@ async def on_reactions_added(context: TurnContext, state: TurnState):
283283
- `type`: a string or regex pattern
284284
"""
285285

286-
def __selector__(context: TurnContext):
286+
def __selector(context: TurnContext):
287287
if context.activity.type != ActivityTypes.message_reaction:
288288
return False
289289

@@ -299,11 +299,11 @@ def __selector__(context: TurnContext):
299299

300300
return False
301301

302-
def __call__(func: RouteHandler[StateT]) -> RouteHandler[StateT]:
303-
self._routes.append(Route[StateT](__selector__, func))
302+
def __call(func: RouteHandler[StateT]) -> RouteHandler[StateT]:
303+
self._routes.append(Route[StateT](__selector, func))
304304
return func
305305

306-
return __call__
306+
return __call
307307

308308
def message_update(
309309
self, type: MessageUpdateTypes
@@ -324,7 +324,7 @@ async def on_edit_message(context: TurnContext, state: TurnState):
324324
- `type`: a string or regex pattern
325325
"""
326326

327-
def __selector__(context: TurnContext):
327+
def __selector(context: TurnContext):
328328
if type == "editMessage":
329329
if (
330330
context.activity.type == ActivityTypes.message_update
@@ -353,11 +353,11 @@ def __selector__(context: TurnContext):
353353
return False
354354
return False
355355

356-
def __call__(func: RouteHandler[StateT]) -> RouteHandler[StateT]:
357-
self._routes.append(Route[StateT](__selector__, func))
356+
def __call(func: RouteHandler[StateT]) -> RouteHandler[StateT]:
357+
self._routes.append(Route[StateT](__selector, func))
358358
return func
359359

360-
return __call__
360+
return __call
361361

362362
def handoff(
363363
self,
@@ -377,13 +377,13 @@ async def on_handoff(
377377
```
378378
"""
379379

380-
def __selector__(context: TurnContext) -> bool:
380+
def __selector(context: TurnContext) -> bool:
381381
return (
382382
context.activity.type == ActivityTypes.invoke
383383
and context.activity.name == "handoff/action"
384384
)
385385

386-
def __call__(
386+
def __call(
387387
func: Callable[[TurnContext, StateT, str], Awaitable[None]],
388388
) -> Callable[[TurnContext, StateT, str], Awaitable[None]]:
389389
async def __handler__(context: TurnContext, state: StateT):
@@ -398,10 +398,10 @@ async def __handler__(context: TurnContext, state: StateT):
398398
)
399399
return True
400400

401-
self._routes.append(Route[StateT](__selector__, __handler__, True))
401+
self._routes.append(Route[StateT](__selector, __handler__, True))
402402
return func
403403

404-
return __call__
404+
return __call
405405

406406
def before_turn(self, func: RouteHandler[StateT]) -> RouteHandler[StateT]:
407407
"""

test_samples/app_style_emtpy/emtpy_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ async def on_members_added(context: TurnContext, _state: TurnState):
7878

7979
@AGENT_APP.message(re.compile(r"^hello$"))
8080
async def on_hello(context: TurnContext, _state: TurnState):
81-
await context.send_activity("Hello! How can I assist you today?")
81+
await context.send_activity("Hello!")
8282

8383

8484
@AGENT_APP.activity("message")

0 commit comments

Comments
 (0)