1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
U
[±d€ã@sddlmZddlmZmZddlmZddlZddlZddl    m
Z
ddl    m Z Gdd    „d    ej ƒZ eGd
d „d ƒƒZeGd d „d ƒƒZd    ddœdd„Zd    ddœdd„Zdd    ddœdd„Zd    ddœdd„ZedƒeGdd„dƒƒƒZedƒeGdd„dƒƒƒZdS) é)Ú annotationsé)Ú event_classÚ T_JSON_DICT)Ú    dataclassN)Únetwork)Úservice_workerc@s<eZdZdZdZdZdZdZdZdZ    dd    „Z
e d
d „ƒZ d S) Ú ServiceNamez¨
    The Background Service that will be associated with the commands/events.
    Every Background Service operates independently, but they share the same
    API.
    ZbackgroundFetchZbackgroundSyncZ pushMessagingZ notificationsZpaymentHandlerZperiodicBackgroundSynccCs|jS©N)Úvalue)Úself©r úpd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\selenium/webdriver/common/devtools/v85/background_service.pyÚto_jsonszServiceName.to_jsoncCs||ƒSr
r ©ÚclsÚjsonr r rÚ    from_json szServiceName.from_jsonN) Ú__name__Ú
__module__Ú __qualname__Ú__doc__ZBACKGROUND_FETCHZBACKGROUND_SYNCZPUSH_MESSAGINGZ NOTIFICATIONSZPAYMENT_HANDLERZPERIODIC_BACKGROUND_SYNCrÚ classmethodrr r r rr    sr    c@s6eZdZUdZded<ded<dd„Zedd„ƒZd    S)
Ú EventMetadatazJ
    A key-value pair for additional event information to pass along.
    ÚstrÚkeyr cCstƒ}|j|d<|j|d<|S)Nrr )Údictrr ©r rr r rr.s
 
zEventMetadata.to_jsoncCs|t|dƒt|dƒdS)Nrr )rr )rrr r rr4s
 
þzEventMetadata.from_jsonN)rrrrÚ__annotations__rrrr r r rr%s
rc@sZeZdZUded<ded<ded<ded<ded    <ded
<d ed <d d„Zedd„ƒZdS)ÚBackgroundServiceEventznetwork.TimeSinceEpochÚ    timestamprÚoriginzservice_worker.RegistrationIDÚservice_worker_registration_idr    ÚserviceÚ
event_nameÚ instance_idztyping.List[EventMetadata]Úevent_metadatacCsftƒ}|j ¡|d<|j|d<|j ¡|d<|j ¡|d<|j|d<|j|d<dd„|jDƒ|d    <|S)
Nr r!ÚserviceWorkerRegistrationIdr#Ú    eventNameÚ
instanceIdcSsg|] }| ¡‘qSr )r©Ú.0Úir r rÚ
<listcomp>[sz2BackgroundServiceEvent.to_json.<locals>.<listcomp>Ú eventMetadata)    rr rr!r"r#r$r%r&rr r rrSs
 
 
zBackgroundServiceEvent.to_jsonc
Cs^|tj |d¡t|dƒtj |d¡t |d¡t|dƒt|dƒdd„|d    Dƒd
S) Nr r!r'r#r(r)cSsg|]}t |¡‘qSr )rrr*r r rr-gsz4BackgroundServiceEvent.from_json.<locals>.<listcomp>r.)r r!r"r#r$r%r&)rZTimeSinceEpochrrrZRegistrationIDr    rr r rr^s
 
 
ùz BackgroundServiceEvent.from_jsonN)rrrrrrrr r r rr<s
 rz0typing.Generator[T_JSON_DICT, T_JSON_DICT, None])r#Úreturnccs&tƒ}| ¡|d<d|dœ}|V}dS)zE
    Enables event updates for the service.
 
    :param service:
    r#z BackgroundService.startObserving©ÚmethodÚparamsN©rr©r#r2Úcmd_dictrr r rÚstart_observingks  þr6ccs&tƒ}| ¡|d<d|dœ}|V}dS)zF
    Disables event updates for the service.
 
    :param service:
    r#zBackgroundService.stopObservingr0Nr3r4r r rÚstop_observing|s  þr7Úbool)Ú should_recordr#r/ccs.tƒ}||d<| ¡|d<d|dœ}|V}dS)za
    Set the recording state for the service.
 
    :param should_record:
    :param service:
    Z shouldRecordr#zBackgroundService.setRecordingr0Nr3)r9r#r2r5rr r rÚ set_recordings
 þr:ccs&tƒ}| ¡|d<d|dœ}|V}dS)zF
    Clears all stored data for the service.
 
    :param service:
    r#zBackgroundService.clearEventsr0Nr3r4r r rÚ clear_events¡s  þr;z'BackgroundService.recordingStateChangedc@s6eZdZUdZded<ded<edddœdd    „ƒZd
S) ÚRecordingStateChangedzK
    Called when the recording state for the service has been updated.
    r8Ú is_recordingr    r#r©rr/cCs|t|dƒt |d¡dS)NZ isRecordingr#)r=r#)r8r    rrr r rr»s
 þzRecordingStateChanged.from_jsonN©rrrrrrrr r r rr<²s
 
r<z0BackgroundService.backgroundServiceEventReceivedc@s.eZdZUdZded<edddœdd„ƒZdS)    ÚBackgroundServiceEventReceivedz„
    Called with all existing backgroundServiceEvents when enabled, and all new
    events afterwards if enabled and recording.
    rÚbackground_service_eventrr>cCs|t |d¡dS)NZbackgroundServiceEvent)rA)rrrr r rrÌs ÿz(BackgroundServiceEventReceived.from_jsonNr?r r r rr@Ãs
r@)Ú
__future__rÚutilrrZ dataclassesrÚenumÚtypingÚrrÚEnumr    rrr6r7r:r;r<r@r r r rÚ<module>s*    .