From 4888e1fe2fb25984907f918de442eb5c2f983fa1 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Mon, 15 Apr 2019 13:15:03 +0200 Subject: Mark some lines as non-reachable --- defusedxml/ElementTree.py | 2 +- defusedxml/common.py | 2 +- defusedxml/expatbuilder.py | 2 +- defusedxml/expatreader.py | 2 +- defusedxml/xmlrpc.py | 10 +++++----- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/defusedxml/ElementTree.py b/defusedxml/ElementTree.py index f9e2032..b1504e4 100644 --- a/defusedxml/ElementTree.py +++ b/defusedxml/ElementTree.py @@ -114,7 +114,7 @@ class DefusedXMLParser(_XMLParser): def defused_unparsed_entity_decl(self, name, base, sysid, pubid, notation_name): # expat 1.2 - raise EntitiesForbidden(name, None, base, sysid, pubid, notation_name) + raise EntitiesForbidden(name, None, base, sysid, pubid, notation_name) # pragma: no cover def defused_external_entity_ref_handler(self, context, base, sysid, pubid): raise ExternalReferenceForbidden(context, base, sysid, pubid) diff --git a/defusedxml/common.py b/defusedxml/common.py index 9dcdc5a..7e4bb0b 100644 --- a/defusedxml/common.py +++ b/defusedxml/common.py @@ -12,7 +12,7 @@ PY3 = sys.version_info[0] == 3 # Fail early when pyexpat is not installed correctly if not hasattr(xml.parsers.expat, "ParserCreate"): - raise ImportError("pyexpat") + raise ImportError("pyexpat") # pragma: no cover class DefusedXmlException(ValueError): diff --git a/defusedxml/expatbuilder.py b/defusedxml/expatbuilder.py index ab743d2..7bfc57e 100644 --- a/defusedxml/expatbuilder.py +++ b/defusedxml/expatbuilder.py @@ -36,7 +36,7 @@ class DefusedExpatBuilder(_ExpatBuilder): def defused_unparsed_entity_decl(self, name, base, sysid, pubid, notation_name): # expat 1.2 - raise EntitiesForbidden(name, None, base, sysid, pubid, notation_name) + raise EntitiesForbidden(name, None, base, sysid, pubid, notation_name) # pragma: no cover def defused_external_entity_ref_handler(self, context, base, sysid, pubid): raise ExternalReferenceForbidden(context, base, sysid, pubid) diff --git a/defusedxml/expatreader.py b/defusedxml/expatreader.py index 198588f..890e1d1 100644 --- a/defusedxml/expatreader.py +++ b/defusedxml/expatreader.py @@ -40,7 +40,7 @@ class DefusedExpatParser(_ExpatParser): def defused_unparsed_entity_decl(self, name, base, sysid, pubid, notation_name): # expat 1.2 - raise EntitiesForbidden(name, None, base, sysid, pubid, notation_name) + raise EntitiesForbidden(name, None, base, sysid, pubid, notation_name) # pragma: no cover def defused_external_entity_ref_handler(self, context, base, sysid, pubid): raise ExternalReferenceForbidden(context, base, sysid, pubid) diff --git a/defusedxml/xmlrpc.py b/defusedxml/xmlrpc.py index 3569167..fbc674d 100644 --- a/defusedxml/xmlrpc.py +++ b/defusedxml/xmlrpc.py @@ -31,7 +31,7 @@ else: try: import gzip -except ImportError: +except ImportError: # pragma: no cover gzip = None @@ -47,7 +47,7 @@ def defused_gzip_decode(data, limit=None): Decode data using the gzip content encoding as described in RFC 1952 """ - if not gzip: + if not gzip: # pragma: no cover raise NotImplementedError if limit is None: limit = MAX_DATA @@ -58,7 +58,7 @@ def defused_gzip_decode(data, limit=None): decoded = gzf.read() else: decoded = gzf.read(limit + 1) - except IOError: + except IOError: # pragma: no cover raise ValueError("invalid data") f.close() gzf.close() @@ -75,7 +75,7 @@ class DefusedGzipDecodedResponse(gzip.GzipFile if gzip else object): def __init__(self, response, limit=None): # response doesn't support tell() and read(), required by # GzipFile - if not gzip: + if not gzip: # pragma: no cover raise NotImplementedError self.limit = limit = limit if limit is not None else MAX_DATA if limit < 0: # no limit @@ -131,7 +131,7 @@ class DefusedExpatParser(ExpatParser): def defused_unparsed_entity_decl(self, name, base, sysid, pubid, notation_name): # expat 1.2 - raise EntitiesForbidden(name, None, base, sysid, pubid, notation_name) + raise EntitiesForbidden(name, None, base, sysid, pubid, notation_name) # pragma: no cover def defused_external_entity_ref_handler(self, context, base, sysid, pubid): raise ExternalReferenceForbidden(context, base, sysid, pubid) -- cgit v1.2.1