MCPcopy Index your code
hub / github.com/python/cpython / make_parser

Function make_parser

Lib/xml/sax/__init__.py:66–88  ·  view source on GitHub ↗

Creates and returns a SAX parser. Creates the first parser it is able to instantiate of the ones given in the iterable created by chaining parser_list and default_parser_list. The iterables must contain the names of Python modules containing both a SAX parser and a create_parser fu

(parser_list=())

Source from the content-addressed store, hash-verified

64
65
66def make_parser(parser_list=()):
67 """Creates and returns a SAX parser.
68
69 Creates the first parser it is able to instantiate of the ones
70 given in the iterable created by chaining parser_list and
71 default_parser_list. The iterables must contain the names of Python
72 modules containing both a SAX parser and a create_parser function."""
73
74 for parser_name in list(parser_list) + default_parser_list:
75 try:
76 return _create_parser(parser_name)
77 except ImportError:
78 import sys
79 if parser_name in sys.modules:
80 # The parser module was found, but importing it
81 # failed unexpectedly, pass this exception through
82 raise
83 except SAXReaderNotAvailable:
84 # The parser module detected that it won't work properly,
85 # so try the next one
86 pass
87
88 raise SAXReaderNotAvailable("No parsers found", None)
89
90# --- Internal utility methods used by make_parser
91

Callers 9

test_sax.pyFile · 0.90
test_make_parser2Method · 0.90
test_make_parser3Method · 0.90
test_make_parser4Method · 0.90
test_make_parser5Method · 0.90
test_make_parserMethod · 0.90
test_5027_1Method · 0.90
parseFunction · 0.70
parseStringFunction · 0.70

Calls 3

listClass · 0.85
_create_parserFunction · 0.70

Tested by 6

test_make_parser2Method · 0.72
test_make_parser3Method · 0.72
test_make_parser4Method · 0.72
test_make_parser5Method · 0.72
test_make_parserMethod · 0.72
test_5027_1Method · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…