|
40 | 40 | from circuit_maintenance_parser.parsers.telstra import HtmlParserTelstra1, HtmlParserTelstra2 |
41 | 41 | from circuit_maintenance_parser.parsers.turkcell import HtmlParserTurkcell1 |
42 | 42 | from circuit_maintenance_parser.parsers.verizon import HtmlParserVerizon1 |
| 43 | +from circuit_maintenance_parser.parsers.windstream import HtmlParserWindstream1 |
43 | 44 | from circuit_maintenance_parser.parsers.zayo import HtmlParserZayo1, SubjectParserZayo1 |
44 | 45 | from circuit_maintenance_parser.processor import CombinedProcessor, GenericProcessor, SimpleProcessor |
45 | 46 | from circuit_maintenance_parser.utils import rgetattr |
@@ -150,22 +151,38 @@ def get_maintenances(self, data: NotificationData) -> Iterable[Maintenance]: |
150 | 151 | @classmethod |
151 | 152 | def get_default_organizer(cls) -> str: |
152 | 153 | """Expose default_organizer as class attribute.""" |
153 | | - return cls._default_organizer.get_default() # type: ignore |
| 154 | + try: |
| 155 | + return cls._default_organizer.get_default() # type: ignore |
| 156 | + except AttributeError: |
| 157 | + # TODO: This exception handling is required for Pydantic 1.x compatibility. To be removed when the dependency is deprecated. |
| 158 | + return cls._default_organizer |
154 | 159 |
|
155 | 160 | @classmethod |
156 | 161 | def get_default_processors(cls) -> List[GenericProcessor]: |
157 | 162 | """Expose default_processors as class attribute.""" |
158 | | - return cls._processors.get_default() # type: ignore |
| 163 | + try: |
| 164 | + return cls._processors.get_default() # type: ignore |
| 165 | + except AttributeError: |
| 166 | + # TODO: This exception handling is required for Pydantic 1.x compatibility. To be removed when the dependency is deprecated. |
| 167 | + return cls._processors |
159 | 168 |
|
160 | 169 | @classmethod |
161 | 170 | def get_default_include_filters(cls) -> Dict[str, List[str]]: |
162 | 171 | """Expose include_filter as class attribute.""" |
163 | | - return cls._include_filter.get_default() # type: ignore |
| 172 | + try: |
| 173 | + return cls._include_filter.get_default() # type: ignore |
| 174 | + except AttributeError: |
| 175 | + # TODO: This exception handling is required for Pydantic 1.x compatibility. To be removed when the dependency is deprecated. |
| 176 | + return cls._include_filter |
164 | 177 |
|
165 | 178 | @classmethod |
166 | 179 | def get_default_exclude_filters(cls) -> Dict[str, List[str]]: |
167 | 180 | """Expose exclude_filter as class attribute.""" |
168 | | - return cls._exclude_filter.get_default() # type: ignore |
| 181 | + try: |
| 182 | + return cls._exclude_filter.get_default() # type: ignore |
| 183 | + except AttributeError: |
| 184 | + # TODO: This exception handling is required for Pydantic 1.x compatibility. To be removed when the dependency is deprecated. |
| 185 | + return cls._exclude_filter |
169 | 186 |
|
170 | 187 | @classmethod |
171 | 188 | def get_extended_data(cls): |
@@ -307,10 +324,13 @@ class GTT(GenericProvider): |
307 | 324 | """EXA (formerly GTT) provider custom class.""" |
308 | 325 |
|
309 | 326 | # "Planned Work Notification", "Emergency Work Notification" |
310 | | - _include_filter = PrivateAttr({EMAIL_HEADER_SUBJECT: ["Work Notification"]}) |
| 327 | + _include_filter = PrivateAttr( |
| 328 | + {"Icalendar": ["BEGIN"], "ical": ["BEGIN"], EMAIL_HEADER_SUBJECT: ["Work Notification"]} |
| 329 | + ) |
311 | 330 |
|
312 | 331 | _processors: List[GenericProcessor] = PrivateAttr( |
313 | 332 | [ |
| 333 | + SimpleProcessor(data_parsers=[ICal]), |
314 | 334 | CombinedProcessor(data_parsers=[EmailDateParser, HtmlParserGTT1]), |
315 | 335 | ] |
316 | 336 | ) |
@@ -449,6 +469,17 @@ class Verizon(GenericProvider): |
449 | 469 | _default_organizer = PrivateAttr( "[email protected]") |
450 | 470 |
|
451 | 471 |
|
| 472 | +class Windstream(GenericProvider): |
| 473 | + """Windstream provider custom class.""" |
| 474 | + |
| 475 | + _processors: List[GenericProcessor] = PrivateAttr( |
| 476 | + [ |
| 477 | + CombinedProcessor(data_parsers=[EmailDateParser, HtmlParserWindstream1]), |
| 478 | + ] |
| 479 | + ) |
| 480 | + _default_organizer = PrivateAttr( "[email protected]") |
| 481 | + |
| 482 | + |
452 | 483 | class Zayo(GenericProvider): |
453 | 484 | """Zayo provider custom class.""" |
454 | 485 |
|
|
0 commit comments