11# Copyright (c) Microsoft Corporation.
22# Licensed under the MIT License.
33
4- from typing import Any , TypeVar
4+ from typing import Any , Optional , Type , TypeVar
55from microsoft_agents .activity import Activity
6-
7- from .email_reference import EmailReference
86from .notification_types import NotificationTypes
7+ from .email_reference import EmailReference
98from .wpx_comment import WpxComment
109
1110TModel = TypeVar ("TModel" )
@@ -42,9 +41,9 @@ def __init__(self, activity: Activity):
4241 if not activity :
4342 raise ValueError ("activity parameter is required and cannot be None" )
4443 self .activity = activity
45- self ._email : EmailReference | None = None
46- self ._wpx_comment : WpxComment | None = None
47- self ._notification_type : NotificationTypes | None = None
44+ self ._email : Optional [ EmailReference ] = None
45+ self ._wpx_comment : Optional [ WpxComment ] = None
46+ self ._notification_type : Optional [ NotificationTypes ] = None
4847
4948 entities = self .activity .entities or []
5049 for ent in entities :
@@ -75,7 +74,7 @@ def __init__(self, activity: Activity):
7574
7675 # ---- passthroughs ----
7776 @property
78- def channel (self ) -> str | None :
77+ def channel (self ) -> Optional [ str ] :
7978 """The channel identifier from the activity's channel_id.
8079
8180 Returns:
@@ -85,7 +84,7 @@ def channel(self) -> str | None:
8584 return ch .channel if ch else None
8685
8786 @property
88- def sub_channel (self ) -> str | None :
87+ def sub_channel (self ) -> Optional [ str ] :
8988 """The subchannel identifier from the activity's channel_id.
9089
9190 Returns:
@@ -104,7 +103,7 @@ def value(self) -> Any:
104103 return self .activity .value
105104
106105 @property
107- def type (self ) -> str | None :
106+ def type (self ) -> Optional [ str ] :
108107 """The activity type.
109108
110109 Returns:
@@ -114,7 +113,7 @@ def type(self) -> str | None:
114113
115114 # --- typed entities available directly on the activity ---
116115 @property
117- def email (self ) -> EmailReference | None :
116+ def email (self ) -> Optional [ EmailReference ] :
118117 """The parsed email reference entity, if present.
119118
120119 Returns:
@@ -124,7 +123,7 @@ def email(self) -> EmailReference | None:
124123 return self ._email
125124
126125 @property
127- def wpx_comment (self ) -> WpxComment | None :
126+ def wpx_comment (self ) -> Optional [ WpxComment ] :
128127 """The parsed Word/PowerPoint/Excel comment entity, if present.
129128
130129 Returns:
@@ -134,7 +133,7 @@ def wpx_comment(self) -> WpxComment | None:
134133 return self ._wpx_comment
135134
136135 @property
137- def notification_type (self ) -> NotificationTypes | None :
136+ def notification_type (self ) -> Optional [ NotificationTypes ] :
138137 """The detected notification type.
139138
140139 Returns:
@@ -145,7 +144,7 @@ def notification_type(self) -> NotificationTypes | None:
145144 return self ._notification_type
146145
147146 # Generic escape hatch
148- def as_model (self , model : type [TModel ]) -> TModel | None :
147+ def as_model (self , model : Type [TModel ]) -> Optional [ TModel ] :
149148 """Parse the activity value as a custom model type.
150149
151150 This method provides a generic way to validate and parse the activity's value
0 commit comments