[PATCH 6 of 6 seda] [cleanup] Drop unreachable code

Sylvain Thenault sylvain.thenault at logilab.fr
Wed Mar 29 10:28:41 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1490770524 -7200
#      Wed Mar 29 08:55:24 2017 +0200
# Node ID f3caee65699fe9088358c5920faca9e7fd27c617
# Parent  8702ac5af4920fa29243d387eb9a97cd8378dbaf
[cleanup] Drop unreachable code

We never run into this part of the  code, so let's drop it.

diff --git a/cubicweb_seda/xsd.py b/cubicweb_seda/xsd.py
--- a/cubicweb_seda/xsd.py
+++ b/cubicweb_seda/xsd.py
@@ -295,16 +295,10 @@ class _CleanerVisitor(object):
     def leave_group(self, element):
         parent_occ = self._stack[-1]
         if len(element.children) == 1:
             assert parent_occ.minimum == parent_occ.maximum == 1
             _jump(self._stack[-2], parent_occ, element.children[0])
-        # skip sequence with maxOccurs = 1 and either minOccurs = 1 or all children have
-        # minOccurs = 0
-        elif parent_occ.maximum == 1 and (parent_occ.minimum == 1
-                                          or all(cocc.minimum == 0 for cocc in element.children)):
-            if not isinstance(self._stack[-2], (graph_nodes.XMLElement, graph_nodes.Alternative)):
-                _replace(self._stack[-2], parent_occ, element.children)
 
     leave_sequence = leave_group
 
     def leave_alternative(self, element):
         parent_occ = self._stack[-1]


More information about the saem-devel mailing list