예제 #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')
예제 #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]
예제 #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]
예제 #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')
예제 #5
0
 def __init__(self, conn, hostname):
     Environment.__init__(self, conn, 'current_environment', 'hostname')
     self.set_main(hostname)
예제 #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)
예제 #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)
예제 #8
0
 def _make_superdict_(self):
     clause = Eq('profile', self.profile)
     return Environment._make_superdict_(self, clause)
예제 #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)
예제 #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)
예제 #11
0
 def __init__(self, conn, table):
     Environment.__init__(self, conn, table, 'package')
예제 #12
0
 def _make_superdict_(self):
     clause = Eq('profile', self.profile)
     return Environment._make_superdict_(self, clause)
예제 #13
0
 def __init__(self, conn, table):
     Environment.__init__(self, conn, table, 'package')
예제 #14
0
 def __init__(self, conn, hostname):
     Environment.__init__(self, conn, 'current_environment', 'hostname')
     self.set_main(hostname)