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

Function parse_js_file

javascript/private/closure_make_deps.py:44–58  ·  view source on GitHub ↗

Extract goog.provide, goog.module, and goog.require namespaces from a JS file.

(path)

Source from the content-addressed store, hash-verified

42
43
44def parse_js_file(path):
45 """Extract goog.provide, goog.module, and goog.require namespaces from a JS file."""
46 with open(path, encoding="utf-8") as f:
47 content = f.read()
48
49 cleaned = strip_comments(content)
50
51 provides = sorted(PROVIDE_RE.findall(cleaned))
52 modules = sorted(MODULE_RE.findall(cleaned))
53 requires = sorted(REQUIRE_RE.findall(cleaned))
54
55 is_module = len(modules) > 0
56 all_provides = sorted(set(provides + modules))
57
58 return all_provides, requires, is_module
59
60
61def main():

Callers 1

mainFunction · 0.85

Calls 3

strip_commentsFunction · 0.85
setFunction · 0.85
readMethod · 0.65

Tested by

no test coverage detected