1010from typing import TYPE_CHECKING , Any
1111
1212
13- from lxml .etree import XPath , XPathSyntaxError
14- from zeep .client import Client
13+ from lxml .etree import XPath
1514from zeep .exceptions import Fault , XMLParseError , XMLSyntaxError
1615from zeep .loader import parse_xml
1716from zeep .wsdl .bindings .soap import SoapOperation
18- from zeep .xsd import Element , AnyObject
1917
2018import aiohttp
2119from onvif .exceptions import ONVIFError
@@ -57,7 +55,11 @@ def __init__(
5755 ) -> None :
5856 """Initialize the notification processor."""
5957 self ._device = device
60- self ._interval = interval if interval <= MINIMUM_SUBSCRIPTION_INTERVAL else MINIMUM_SUBSCRIPTION_INTERVAL
58+ self ._interval = (
59+ interval
60+ if interval <= MINIMUM_SUBSCRIPTION_INTERVAL
61+ else MINIMUM_SUBSCRIPTION_INTERVAL
62+ )
6163 self ._subscription : ONVIFService | None = None
6264 self ._restart_or_renew_task : asyncio .Task | None = None
6365 self ._loop = asyncio .get_event_loop ()
@@ -298,11 +300,11 @@ class PullPointManager(BaseManager):
298300 """Manager for PullPoint."""
299301
300302 def __init__ (
301- self ,
302- device : ONVIFCamera ,
303- interval : dt .timedelta ,
304- subscription_lost_callback : Callable [[], None ],
305- topic_filter : TopicExpression | None = None ,
303+ self ,
304+ device : ONVIFCamera ,
305+ interval : dt .timedelta ,
306+ subscription_lost_callback : Callable [[], None ],
307+ topic_filter : TopicExpression | None = None ,
306308 ) -> None :
307309 """
308310 Create a Manager for PullPoint
@@ -321,7 +323,9 @@ def __init__(
321323 >>> PullPointManager(cam, timedelta(seconds=60), lambda: print("Lost connection!"), "tns1:RuleEngine/CellMotionDetector/Motion")
322324
323325 """
324- self ._topic_filter : str | None = XPath (topic_filter ).path if topic_filter else None
326+ self ._topic_filter : str | None = (
327+ XPath (topic_filter ).path if topic_filter else None
328+ )
325329 super ().__init__ (device , interval , subscription_lost_callback )
326330
327331 async def _start (self ) -> float :
@@ -335,21 +339,19 @@ async def _start(self) -> float:
335339 events_service = await device .create_events_service ()
336340
337341 subscription_params = {
338- "InitialTerminationTime" : device .get_next_termination_time (
339- self ._interval
340- ),
342+ "InitialTerminationTime" : device .get_next_termination_time (self ._interval ),
341343 }
342344 # Alternatively, filter could be accepted as an argument
343345 # and we can expect the caller to create the TopicExpression
344346 # this would allow them to control the dialect too?
345347 if self ._topic_filter :
346348 subscription_params ["Filter" ] = {
347- "_value_1" : TopicExpression .from_client (events_service .zeep_client , self ._topic_filter ),
349+ "_value_1" : TopicExpression .from_client (
350+ events_service .zeep_client , self ._topic_filter
351+ ),
348352 }
349353
350- result = await events_service .CreatePullPointSubscription (
351- subscription_params
352- )
354+ result = await events_service .CreatePullPointSubscription (subscription_params )
353355 # pylint: disable=protected-access
354356
355357 device .xaddrs [
0 commit comments