当前位置: 首页>>代码示例>>Python>>正文


Python family.Family类代码示例

本文整理汇总了Python中family.Family的典型用法代码示例。如果您正苦于以下问题:Python Family类的具体用法?Python Family怎么用?Python Family使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Family类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: PaellaDatabase

class PaellaDatabase(Element):
    def __init__(self, conn, path='/'):
        Element.__init__(self, 'paelladatabase')
        self.conn = conn
        self.stmt = StatementCursor(self.conn)
        self._profile_traits_ = ProfileTrait(self.conn)
        self.path = path
        self.suites = SuitesElement()
        self.appendChild(self.suites)
        for row in self._suite_rows():
            args = map(str, [row.suite, row.nonus, row.updates, row.local, row.common])
            element = SuiteElement(*args)
            self.suites.appendChild(element)
        self.profiles = PaellaProfiles(self.conn)
        self.family = Family(self.conn)
        suites = [x.suite for x in self._suite_rows()]
        for suite in suites:
            self.appendChild(TraitsElement(self.conn, suite))

    def _suite_rows(self):
        return self.stmt.select(table='suites', order='suite')

    def write(self, filename):
        path = join(self.path, filename)
        xmlfile = file(path, 'w')
        self.writexml(xmlfile, indent='\t', newl='\n', addindent='\t')

    def backup(self, path=None):
        if path is None:
            path = self.path
        if not isdir(path):
            raise Error, '%s not a directory' % path
        dbfile = file(join(path, 'database.xml'), 'w')
        self.writexml(dbfile, indent='\t', newl='\n', addindent='\t')
        dbfile.close()
        self.backup_profiles(path)
        self.backup_families(path)
        suites = [x.suite for x in self._suite_rows()]
        for suite in suites:
            makepaths(join(path, suite))
            trait = Trait(self.conn, suite)
            for t in trait.get_trait_list():
                trait.set_trait(t)
                trait.backup_trait(join(path, suite))

    def backup_profiles(self, path=None):
        profiles_dir = join(path, 'profiles')
        makepaths(profiles_dir)
        self.profiles.export_profiles(profiles_dir)

    def backup_families(self, path=None):
        fpath = join(path, 'families')
        makepaths(fpath)
        self.family.export_families(fpath)
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:54,代码来源:main.py

示例2: test_marriedToSiblings

 def test_marriedToSiblings(self):
     self.famA = Family()
     self.famA.addFamID('@[email protected]')
     self.famA.addHusb('@[email protected]')
     self.famA.addWife('@[email protected]')
     self.famA.addMarr('5 OCT 1999')
     self.assertTrue(marriedToSiblings(self.famA, self.individuals))
     self.famB = Family()
     self.famB.addFamID('@[email protected]')
     self.famB.addHusb('@[email protected]')
     self.famB.addWife('@[email protected]')
     self.famB.addMarr('5 OCT 1999')
     self.assertFalse(marriedToSiblings(self.famB, self.individuals))
开发者ID:Gosin,项目名称:gedcom,代码行数:13,代码来源:gedcomTest.py

示例3: setUp

 def setUp(self):
     self.fam1 = Family()
     self.fam1.addFamID('@[email protected]')
     self.fam1.addHusb('@[email protected]')
     self.fam1.addWife('@[email protected]')
     self.fam1.addChil('@[email protected]')
     self.fam1.addChil('@[email protected]')
     self.fam1.addMarr('5 OCT 1999')
     self.fam1.addDiv('12 JUN 2012')
     self.fam2 = Family()
     self.fam2.addFamID('@[email protected]')
     self.fam2.addHusb('@[email protected]')
     self.fam2.addWife('@[email protected]')
开发者ID:puterdewd,项目名称:gedcom,代码行数:13,代码来源:familyTest.py

示例4: OutputTest

class OutputTest(unittest.TestCase):

    def setUp(self):
        self.indi = Individual()
        self.indi.addID('@[email protected]')
        self.indi.addName('John Rivas')
        self.indi.addSex('M')
        self.indi.addBirt('9 MAY 1978')
        self.indi.addDeat('12 APR 2013')
        self.indi.addFams('@[email protected]')
        self.indi.addFamc('@[email protected]')
        
        self.fam1 = Family()
        self.fam1.addFamID('@[email protected]')
        self.fam1.addHusb('@[email protected]')
        self.fam1.addWife('@[email protected]')
        self.fam1.addChil('@[email protected]')
        self.fam1.addChil('@[email protected]')

        self.individuals =  dict()
        self.individuals["one"] = self.indi
                
        self.families =  dict()
        self.families["one"] = self.fam1
        
    def test_outputIndiSummary(self):
        outputIndiSummary(self.individuals)

    def test_outputFamSummary(self):
        outputFamSummary(self.families, self.individuals)
开发者ID:Gosin,项目名称:gedcom,代码行数:30,代码来源:outputTest.py

示例5: __init__

 def __init__(self, conn):
     self.conn = conn
     self.suitecursor = SuiteCursor(self.conn)
     self.aptsrc = AptSourceHandler(self.conn)
     self.main_path = None
     self.profile = Profile(self.conn)
     self.family = Family(self.conn)
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:7,代码来源:main.py

示例6: __init__

 def __init__(self, conn, path='/'):
     Element.__init__(self, 'paelladatabase')
     self.conn = conn
     self.stmt = StatementCursor(self.conn)
     self._profile_traits_ = ProfileTrait(self.conn)
     self.path = path
     self.aptsources = AptSourceListElement()
     self.appendChild(self.aptsources)
     if 'apt_sources' in self.stmt.tables():
         for row in self.stmt.select(table='apt_sources', order=['apt_id']):
             element = AptSourceElement(row.apt_id, row.uri, row.dist, row.sections,
                                        row.local_path)
             self.aptsources.appendChild(element)
         self.suites = SuitesElement()
         self.appendChild(self.suites)
         for row in self._suite_rows():
             args = map(str, [row.suite, row.nonus, row.updates, row.local, row.common])
             element = SuiteElement(*args)
             for suiteapt in self.stmt.select(table='suite_apt_sources', order=['ord'],
                                              clause=Eq('suite', row.suite)):
                 element.appendChild(SuiteAptElement(row.suite,
                                                     suiteapt.apt_id, str(suiteapt.ord)))
             self.suites.appendChild(element)
     else:
         print 'WARNING, apt_sources table does not exist, backing up anyway'
     self.profiles = PaellaProfiles(self.conn)
     self.family = Family(self.conn)
     suites = [x.suite for x in self._suite_rows()]
     for suite in suites:
         self.appendChild(TraitsElement(self.conn, suite))
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:30,代码来源:main.py

示例7: compute_serializable_fields

 def compute_serializable_fields(cls, session, keys):
     from family import Family
     result = {'family': None}
     ## retrieve family object
     if keys.get('ht-epithet'):
         result['family'] = Family.retrieve_or_create(
             session, {'epithet': keys['ht-epithet']},
             create=True)
     if result['family'] is None:
         raise error.NoResultException()
     return result
开发者ID:jhonFitzgerald,项目名称:bauble.classic,代码行数:11,代码来源:genus.py

示例8: syn_cell_data_func

 def syn_cell_data_func(column, renderer, model, iter, data=None):
     '''
     '''
     v = model[iter][0]
     author = None
     if v.author is None:
         author = ''
     else:
         author = utils.xml_safe(unicode(v.author))
     renderer.set_property('markup', '<i>%s</i> %s (<small>%s</small>)'
                           % (Genus.str(v), author, Family.str(v.family)))
开发者ID:jhonFitzgerald,项目名称:bauble.classic,代码行数:11,代码来源:genus.py

示例9: __init__

    def __init__(self, farm_count=100, rng=None):
        self.activities = activity.Activities()
        if rng is None:
            rng = np.random.RandomState()
        self.rng = rng

        self.time = 0

        self.farms = []
        for i in range(farm_count):
            farm = Farm(eutopia=self, area=100)
            self.farms.append(farm)

        self.families = []
        for farm in self.farms:
            family = Family(self)
            family.add_farm(farm)
            self.families.append(family)

        self.govt_cost = 0
开发者ID:tcstewar,项目名称:farm_game,代码行数:20,代码来源:eutopia.py

示例10: _syn_data_func

 def _syn_data_func(column, cell, model, iter, data=None):
     v = model[iter][0]
     syn = v.synonym
     cell.set_property('markup', '<i>%s</i> %s (<small>%s</small>)'
                       % (Genus.str(syn),
                          utils.xml_safe(unicode(syn.author)),
                          Family.str(syn.family)))
     # set background color to indicate it's new
     if v.id is None:
         cell.set_property('foreground', 'blue')
     else:
         cell.set_property('foreground', None)
开发者ID:jhonFitzgerald,项目名称:bauble.classic,代码行数:12,代码来源:genus.py

示例11: test_tooManyChildren

 def test_tooManyChildren(self):
     self.assertFalse(tooManyChildren(self.fam1))
     famT = Family()
     self.assertFalse(tooManyChildren(famT))
     famT.addChil("1")
     famT.addChil("2")
     famT.addChil("3")
     famT.addChil("4")
     famT.addChil("5")
     self.assertTrue(tooManyChildren(famT))
开发者ID:Gosin,项目名称:gedcom,代码行数:10,代码来源:gedcomTest.py

示例12: test_marriedMoreThanOnePerson

    def test_marriedMoreThanOnePerson(self):
        self.families = dict()
        self.famA = Family()
        self.famA.addFamID('@[email protected]')
        self.famA.addHusb('@[email protected]')
        self.famA.addWife('@[email protected]')
        self.families['1'] = self.famA
        self.assertFalse(marriedMoreThanOnePerson(self.families))   

        self.famB = Family()
        self.famB.addFamID('@[email protected]')
        self.famB.addHusb('@[email protected]')
        self.famB.addWife('@[email protected]')
        self.families['2'] = self.famB
        self.assertFalse(marriedMoreThanOnePerson(self.families))
        
        self.famB.addWife('@[email protected]')
        self.assertTrue(marriedMoreThanOnePerson(self.families))
        
        self.famA.addDiv('12 JUN 2012')
        self.famB.addWife('@[email protected]')
        self.assertFalse(marriedMoreThanOnePerson(self.families))
开发者ID:Gosin,项目名称:gedcom,代码行数:22,代码来源:gedcomTest.py

示例13: grow_up

    def grow_up(self):
        """ upon reaching adulthood males start family and look for mate.
        females go onto Prospects list.
        can set profession manually.
        """
        if self.gender == 'm':
            prior_family = self.family
            self.family = Family(self.village, self.family.house, dad=self)
            prior_family.remove_kid(self)
        elif self.gender == 'f':
            pass

        self.check_mate()
        return self
开发者ID:ctasims,项目名称:village-people,代码行数:14,代码来源:villager.py

示例14: __init__

 def __init__(self, conn, path='/'):
     Element.__init__(self, 'paelladatabase')
     self.conn = conn
     self.stmt = StatementCursor(self.conn)
     self._profile_traits_ = ProfileTrait(self.conn)
     self.path = path
     self.suites = SuitesElement()
     self.appendChild(self.suites)
     for row in self._suite_rows():
         args = map(str, [row.suite, row.nonus, row.updates, row.local, row.common])
         element = SuiteElement(*args)
         self.suites.appendChild(element)
     self.profiles = PaellaProfiles(self.conn)
     self.family = Family(self.conn)
     suites = [x.suite for x in self._suite_rows()]
     for suite in suites:
         self.appendChild(TraitsElement(self.conn, suite))
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:17,代码来源:main.py

示例15: setUp

    def setUp(self):
        self.indi = Individual()
        self.indi.addID('@[email protected]')
        self.indi.addName('John Rivas')
        self.indi.addSex('M')
        self.indi.addBirt('9 MAY 1978')
        self.indi.addDeat('12 APR 2013')
        self.indi.addFams('@[email protected]')
        self.indi.addFamc('@[email protected]')
        
        self.fam1 = Family()
        self.fam1.addFamID('@[email protected]')
        self.fam1.addHusb('@[email protected]')
        self.fam1.addWife('@[email protected]')
        self.fam1.addChil('@[email protected]')
        self.fam1.addChil('@[email protected]')

        self.individuals =  dict()
        self.individuals["one"] = self.indi
                
        self.families =  dict()
        self.families["one"] = self.fam1
开发者ID:Gosin,项目名称:gedcom,代码行数:22,代码来源:outputTest.py


注:本文中的family.Family类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。