def __init__(self, sample): # XML tree in parameter Sample.__init__(self, sample) self._input_type = sample.find("input_type").text.lower() self._output_type = sample.find("output_type").text.lower() self._flaws = {} for flaw in sample.find("flaws").findall("flaw"): flaw_type = flaw.get("flaw_type").lower() self._flaws[flaw_type] = {} self._flaws[flaw_type]["safe"] = (flaw.get("safe") == "1") self._flaws[flaw_type]["unsafe"] = (flaw.get("unsafe") == "1")
def __init__(self, sample): # XML tree in parameter Sample.__init__(self, sample) self._input_type = sample.find("input_type").text.lower() self._output_type = sample.find("output_type").text.lower() self._flaws = {} for flaw in sample.find("flaws").findall("flaw"): flaw_type = flaw.get("flaw_type").lower() self._flaws[flaw_type] = {} self._flaws[flaw_type]["safe"] = flaw.get("safe") == "1" self._flaws[flaw_type]["unsafe"] = flaw.get("unsafe") == "1"
def __init__(self, sample): # Add parameters showing the beginning and the end of the sample Sample.__init__(self, sample) self._input_type = sample.find("input_type").text.lower() self._exec_type = sample.find("exec_type").text.lower() self._flaw_type = sample.find("flaw_type").text.lower() self._flaw_group = sample.find("flaw_type").get("flaw_group").lower() self._need_complexity = True # TODO check why [0] if sample.findall("options") and sample.findall("options")[0].get("need_complexity"): self._need_complexity = (sample.findall("options")[0].get("need_complexity") == "1")
def __init__( self, sample ): # Add parameters showing the beginning and the end of the sample Sample.__init__(self, sample) self._input_type = sample.find("input_type").text.lower() self._exec_type = sample.find("exec_type").text.lower() self._flaw_type = sample.find("flaw_type").text.lower() self._flaw_group = sample.find("flaw_type").get("flaw_group").lower() self._need_complexity = True # TODO check why [0] if sample.findall("options") and sample.findall("options")[0].get( "need_complexity"): self._need_complexity = ( sample.findall("options")[0].get("need_complexity") == "1")
def __init__(self, sample): # XML tree in parameter Sample.__init__(self, sample) self._type = sample.get("type").lower() self._code = sample.find("code").text self._safe = sample.get("safe") == "1"