def _repr_html_(self): # type: () -> str return "Src IP: {src_ip}<br>Src Port: {src_port}<br>Dst IP: {dst_ip}<br>Dst Port: {dst_port}<br>IP Protocol: {ip_protocol}<br>Start Location: {node}{iface}{vrf}" \ .format(node=self.ingressNode, iface=escape_html(self._iface_str()), vrf=escape_html(self._vrf_str()), src_ip=self.srcIp, src_port=self.srcPort, dst_ip=self.dstIp, dst_port=self.dstPort, ip_protocol=self.get_ip_protocol_str())
def _repr_html_(self): # type: () -> str indent = " " * 4 result = "{edge}<br>Route(s):<br>{routes}".format( edge=self.edge._repr_html_(), routes=indent + ("<br>" + indent).join([escape_html(r) for r in self.routes])) if self.transformedFlow: result += "<br>Transformed flow: {}".format( self.transformedFlow._repr_html_()) return result
def format_notes_html(self): # type: () -> str return '<span style="color:{color}; text-weight:bold;">{notes}</span>'.format( color=_get_color_for_disposition(self.disposition), notes=escape_html(self.notes))
def _repr_html_(self): # type: () -> str """Override this method to enable custom HTML formatting of the dataclass.""" return escape_html(repr(self))
def _repr_html_(self): # type: () -> str return "{}".format(escape_html(self.__str__()))
def test_escape_html(): assert escape_html('') == '' assert escape_html('a') == 'a' assert escape_html('"a"') == '"a"' assert escape_html('a&b') == 'a&b' assert escape_html('a & b') == 'a & b'
def _repr_html_(self): # type: () -> str return "{}:{}".format(escape_html(self.hostname), escape_html(self.interface))
def _repr_html_(self) -> str: return escape_html(str(self))
def test_escape_html(): assert escape_html("") == "" assert escape_html("a") == "a" assert escape_html('"a"') == ""a"" assert escape_html("a&b") == "a&b" assert escape_html("a & b") == "a & b"