MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / parse

Function parse

py/generate.py:920–936  ·  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

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

Callers 5

mainFunction · 0.70
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