Exemplo n.º 1
0
 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')
Exemplo n.º 2
0
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]
Exemplo n.º 3
0
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]
Exemplo n.º 4
0
 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')
Exemplo n.º 5
0
 def __init__(self, conn, hostname):
     Environment.__init__(self, conn, 'current_environment', 'hostname')
     self.set_main(hostname)
Exemplo n.º 6
0
 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)
Exemplo n.º 7
0
 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)
Exemplo n.º 8
0
 def _make_superdict_(self):
     clause = Eq('profile', self.profile)
     return Environment._make_superdict_(self, clause)
Exemplo n.º 9
0
 def __init__(self, conn, suite, trait):
     self.suite = suite
     table = ujoin(suite, 'variables')
     Environment.__init__(self, conn, table, 'trait')
     self.set_main(trait)
Exemplo n.º 10
0
 def __init__(self, conn, suite, trait):
     self.suite = suite
     table = ujoin(suite, 'variables')
     Environment.__init__(self, conn, table, 'trait')
     self.set_main(trait)
Exemplo n.º 11
0
 def __init__(self, conn, table):
     Environment.__init__(self, conn, table, 'package')
Exemplo n.º 12
0
 def _make_superdict_(self):
     clause = Eq('profile', self.profile)
     return Environment._make_superdict_(self, clause)
Exemplo n.º 13
0
 def __init__(self, conn, table):
     Environment.__init__(self, conn, table, 'package')
Exemplo n.º 14
0
 def __init__(self, conn, hostname):
     Environment.__init__(self, conn, 'current_environment', 'hostname')
     self.set_main(hostname)