diff options
author | Christian Heimes <christian@python.org> | 2019-04-14 13:58:09 +0200 |
---|---|---|
committer | Christian Heimes <christian@python.org> | 2019-04-14 13:58:09 +0200 |
commit | d46e04fcf6b51f771b671ebf869988b0677bec73 (patch) | |
tree | 148e8f14ad6d38ae120b53e6b57c4ad7db5a8cc5 /defusedxml/minidom.py | |
parent | c67738d61dabc1a410f7760f23cb5b3108ac4c30 (diff) | |
download | defusedxml-git-d46e04fcf6b51f771b671ebf869988b0677bec73.tar.gz |
Reformat all code with black 18.9b0
Signed-off-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'defusedxml/minidom.py')
-rw-r--r-- | defusedxml/minidom.py | 57 |
1 files changed, 39 insertions, 18 deletions
diff --git a/defusedxml/minidom.py b/defusedxml/minidom.py index eea895c..78033b6 100644 --- a/defusedxml/minidom.py +++ b/defusedxml/minidom.py @@ -14,29 +14,50 @@ from . import pulldom as _pulldom __origin__ = "xml.dom.minidom" -def parse(file, parser=None, bufsize=None, forbid_dtd=False, - forbid_entities=True, forbid_external=True): +def parse( + file, parser=None, bufsize=None, forbid_dtd=False, forbid_entities=True, forbid_external=True +): """Parse a file into a DOM by filename or file object.""" if parser is None and not bufsize: - return _expatbuilder.parse(file, forbid_dtd=forbid_dtd, - forbid_entities=forbid_entities, - forbid_external=forbid_external) + return _expatbuilder.parse( + file, + forbid_dtd=forbid_dtd, + forbid_entities=forbid_entities, + forbid_external=forbid_external, + ) else: - return _do_pulldom_parse(_pulldom.parse, (file,), - {'parser': parser, 'bufsize': bufsize, - 'forbid_dtd': forbid_dtd, 'forbid_entities': forbid_entities, - 'forbid_external': forbid_external}) + return _do_pulldom_parse( + _pulldom.parse, + (file,), + { + "parser": parser, + "bufsize": bufsize, + "forbid_dtd": forbid_dtd, + "forbid_entities": forbid_entities, + "forbid_external": forbid_external, + }, + ) -def parseString(string, parser=None, forbid_dtd=False, - forbid_entities=True, forbid_external=True): +def parseString( + string, parser=None, forbid_dtd=False, forbid_entities=True, forbid_external=True +): """Parse a file into a DOM from a string.""" if parser is None: - return _expatbuilder.parseString(string, forbid_dtd=forbid_dtd, - forbid_entities=forbid_entities, - forbid_external=forbid_external) + return _expatbuilder.parseString( + string, + forbid_dtd=forbid_dtd, + forbid_entities=forbid_entities, + forbid_external=forbid_external, + ) else: - return _do_pulldom_parse(_pulldom.parseString, (string,), - {'parser': parser, 'forbid_dtd': forbid_dtd, - 'forbid_entities': forbid_entities, - 'forbid_external': forbid_external}) + return _do_pulldom_parse( + _pulldom.parseString, + (string,), + { + "parser": parser, + "forbid_dtd": forbid_dtd, + "forbid_entities": forbid_entities, + "forbid_external": forbid_external, + }, + ) |