zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
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
65
66
67
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 úqd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\selenium/webdriver/common/devtools/v113/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@sbeZdZUded<ded<ded<ded<ded    <ded
<d ed <ded <dd„Zedd„ƒZdS)ÚBackgroundServiceEventznetwork.TimeSinceEpochÚ    timestamprÚoriginzservice_worker.RegistrationIDÚservice_worker_registration_idr    ÚserviceÚ
event_nameÚ instance_idztyping.List[EventMetadata]Úevent_metadataÚ storage_keycCsptƒ}|j ¡|d<|j|d<|j ¡|d<|j ¡|d<|j|d<|j|d<dd„|jDƒ|d    <|j    |d
<|S) Nr r!ÚserviceWorkerRegistrationIdr#Ú    eventNameÚ
instanceIdcSsg|] }| ¡‘qSr )r©Ú.0Úir r rÚ
<listcomp>^sz2BackgroundServiceEvent.to_json.<locals>.<listcomp>Ú eventMetadataÚ
storageKey)
rr rr!r"r#r$r%r&r'rr r rrVs
 
 
 
zBackgroundServiceEvent.to_jsonc Csh|tj |d¡t|dƒtj |d¡t |d¡t|dƒt|dƒdd„|d    Dƒt|d
ƒd S) Nr r!r(r#r)r*cSsg|]}t |¡‘qSr )rrr+r r rr.ksz4BackgroundServiceEvent.from_json.<locals>.<listcomp>r/r0)r r!r"r#r$r%r&r')rZTimeSinceEpochrrrZRegistrationIDr    rr r rrbs
 
 
 
ø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#r4Úcmd_dictrr r rÚstart_observingps  þr8ccs&tƒ}| ¡|d<d|dœ}|V}dS)zF
    Disables event updates for the service.
 
    :param service:
    r#zBackgroundService.stopObservingr2Nr5r6r r rÚstop_observings  þr9Úbool)Ú should_recordr#r1ccs.tƒ}||d<| ¡|d<d|dœ}|V}dS)za
    Set the recording state for the service.
 
    :param should_record:
    :param service:
    Z shouldRecordr#zBackgroundService.setRecordingr2Nr5)r;r#r4r7rr 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.clearEventsr2Nr5r6r 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.
    r:Ú is_recordingr    r#r©rr1cCs|t|dƒt |d¡dS)NZ isRecordingr#)r?r#)r:r    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)rC)rrrr r rrÑs ÿz(BackgroundServiceEventReceived.from_jsonNrAr r r rrBÈs
rB)Ú
__future__rÚutilrrZ dataclassesrÚenumÚtypingÚrrÚEnumr    rrr8r9r<r=r>rBr r r rÚ<module>s*    3