MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / parse

Function parse

py/generate.py:921–937  ·  view source on GitHub ↗

Parse JSON protocol description and return domain objects. :param Path json_path: path to a JSON CDP schema :param Path output_path: a directory path to create the modules in :returns: a list of CDP domain objects

(json_path, output_path)

Source from the content-addressed store, hash-verified

919
920
921def parse(json_path, output_path):
922 """Parse JSON protocol description and return domain objects.
923
924 :param Path json_path: path to a JSON CDP schema
925 :param Path output_path: a directory path to create the modules in
926 :returns: a list of CDP domain objects
927 """
928 global current_version
929 with open(json_path, encoding="utf-8") as json_file:
930 schema = json.load(json_file)
931 version = schema["version"]
932 assert (version["major"], version["minor"]) == ("1", "3")
933 current_version = f"{version['major']}.{version['minor']}"
934 domains = []
935 for domain in schema["domains"]:
936 domains.append(CdpDomain.from_json(domain))
937 return domains
938
939
940def generate_init(init_path, domains):

Callers 7

mainFunction · 0.70
mainFunction · 0.50
uncompress_debFunction · 0.50
parseCddlFunction · 0.50
get_chrome_milestoneFunction · 0.50

Calls 3

loadMethod · 0.45
appendMethod · 0.45
from_jsonMethod · 0.45

Tested by

no test coverage detected