def table(self, drs: DRS) -> DRS: """ Given a DRS, it configures it to the table view :param drs: the DRS to configure :return: the same DRS in the table mode """ drs.set_table_mode() return drs
def test_drs_table_iteration(self): print(self._testMethodName) h1 = Hit(0, "dba", "table_a", "a", -1) h2 = Hit(1, "dba", "table_a", "b", -1) h3 = Hit(2, "dba", "table_b", "c", -1) h4 = Hit(3, "dba", "table_b", "d", -1) drs = DRS([h1, h2, h3, h4], Operation(OP.ORIGIN)) drs.set_table_mode() for el in drs: print(str(el)) self.assertTrue(True)
def _hit_to_drs(self, hit: Hit, table_mode=False) -> DRS: """ Given a Hit, return a DRS. If in table mode, the resulting DRS will contain Hits representing that table. :param hit: Hit :param table_mode: if the Hit represents an entire table :return: DRS """ drs = None if table_mode: table = hit.source_name hits = self._network.get_hits_from_table(table) drs = DRS([x for x in hits], Operation(OP.TABLE, params=[hit])) drs.set_table_mode() else: drs = DRS([hit], Operation(OP.ORIGIN)) return drs