def __init__(self, conn): object.__init__(self) self.conn = conn self.cursor = StatementCursor(self.conn) self.current = None self.parent = SimpleRelation(self.conn, 'family_parent', 'family') self.env = Environment(self.conn, 'family_environment', 'family')
class Family(object): def __init__(self, conn): object.__init__(self) self.conn = conn self.cursor = StatementCursor(self.conn) self.current = None self.parent = SimpleRelation(self.conn, 'family_parent', 'family') self.env = Environment(self.conn, 'family_environment', 'family') def set_family(self, family): self.current = family self.parent.set_current(family) self.env.set_main(family) def add_family(self, family, type='general'): pass def get_families(self, families=[]): rows = self.cursor.select(table='family_parent') graph = kjGraph([(r.family, r.parent) for r in rows]) dfamilies = Set() for fam in families: dfamilies |= Set([fam]) | Set(graph.reachable(fam).items()) return dfamilies def parents(self, family=None): if family is None: family = self.current self.parent.set_clause(family) rows = self.parent.cmd.select(fields=['parent'], order='parent') self.parent.reset_clause() return [x.parent for x in rows]
def __init__(self, conn, hostname): Environment.__init__(self, conn, 'current_environment', 'hostname') self.set_main(hostname)
def __init__(self, conn, profile): self.suite = get_suite(conn, profile) self.profile = profile Environment.__init__(self, conn, 'profile_variables', 'trait') self.traitparent = TraitParent(self.conn, self.suite)
def _make_superdict_(self): clause = Eq('profile', self.profile) return Environment._make_superdict_(self, clause)
def __init__(self, conn, suite, trait): self.suite = suite table = ujoin(suite, 'variables') Environment.__init__(self, conn, table, 'trait') self.set_main(trait)
def __init__(self, conn, table): Environment.__init__(self, conn, table, 'package')