forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d912be8
commit f5ba665
Showing
4 changed files
with
84 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import typing | ||
|
||
|
||
T_JSON_DICT = typing.Dict[str, typing.Any] | ||
_event_parsers = dict() | ||
|
||
|
||
def event_class(method): | ||
''' A decorator that registers a class as an event class. ''' | ||
def decorate(cls): | ||
_event_parsers[method] = cls | ||
return cls | ||
return decorate | ||
|
||
|
||
def parse_json_event(json: T_JSON_DICT) -> typing.Any: | ||
''' Parse a JSON dictionary into a CDP event. ''' | ||
return _event_parsers[json['method']].from_json(json['params']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import typing | ||
|
||
|
||
T_JSON_DICT = typing.Dict[str, typing.Any] | ||
_event_parsers = dict() | ||
|
||
|
||
def event_class(method): | ||
''' A decorator that registers a class as an event class. ''' | ||
def decorate(cls): | ||
_event_parsers[method] = cls | ||
return cls | ||
return decorate | ||
|
||
|
||
def parse_json_event(json: T_JSON_DICT) -> typing.Any: | ||
''' Parse a JSON dictionary into a CDP event. ''' | ||
return _event_parsers[json['method']].from_json(json['params']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import typing | ||
|
||
|
||
T_JSON_DICT = typing.Dict[str, typing.Any] | ||
_event_parsers = dict() | ||
|
||
|
||
def event_class(method): | ||
''' A decorator that registers a class as an event class. ''' | ||
def decorate(cls): | ||
_event_parsers[method] = cls | ||
return cls | ||
return decorate | ||
|
||
|
||
def parse_json_event(json: T_JSON_DICT) -> typing.Any: | ||
''' Parse a JSON dictionary into a CDP event. ''' | ||
return _event_parsers[json['method']].from_json(json['params']) |