當前位置: 首頁>>代碼示例>>Python>>正文


Python Family.write_family方法代碼示例

本文整理匯總了Python中family.Family.write_family方法的典型用法代碼示例。如果您正苦於以下問題:Python Family.write_family方法的具體用法?Python Family.write_family怎麽用?Python Family.write_family使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在family.Family的用法示例。


在下文中一共展示了Family.write_family方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: PaellaExporter

# 需要導入模塊: from family import Family [as 別名]
# 或者: from family.Family import write_family [as 別名]

#.........這裏部分代碼省略.........
            self.profile.export_profile(dirname, profile=profile, env=env)
            self.report_profile_exported(profile)

    def export_diskconfig(self, name=None, dirname=None, row=None):
        if dirname is None:
            dirname = self.db_export_path / 'diskconfig'
        dirname = path(dirname)
        makepaths(dirname)
        if name is None and row is None:
            raise RuntimeError , 'either name or row must be passed to export_diskconfig'
        if name is not None:
            row = self.diskconfig.get(name)
        filename = row.name
        content = row.content
        diskconfig = dirname / filename
        diskconfig.write_text(content)
        
    def export_all_diskconfigs(self, dirname=None):
        for row in self.diskconfig.cursor.select():
            self.export_diskconfig(dirname=dirname, row=row)
            
    def export_all_families(self, dirname=None):
        if dirname is None:
            dirname = self.db_export_path / 'families'
        dirname = path(dirname)
        makepaths(dirname)
        self.family.export_families(dirname)

    def export_family(self, family, dirname=None):
        if dirname is None:
            dirname = self.db_export_path / 'families'
        dirname = path(dirname)
        makepaths(dirname)
        self.family.write_family(family, dirname)
        
        
    def export_trait(self, trait, suite=None, dirname=None, traitdb=None):
        if traitdb is None:
            if suite is None:
                RuntimeError , "you must pass a suite if you don't pass a Trait object"
            print "make new traitdb"
            traitdb = Trait(self.conn, suite)
        traitdb.set_trait(trait)
        if suite is None:
            suite = traitdb.suite
        if dirname is None:
            dirname = self._make_suite_export_path(suite)
        traitdb.export_trait(dirname)
        self.report_trait_exported(trait, dirname)
        

    def export_all_traits(self, suite, dirname=None):
        self.report_start_exporting_traits()
        traitdb = Trait(self.conn, suite)
        traits = traitdb.get_trait_list()
        self.report_total_traits(len(traits))
        for trait in traits:
            self.export_trait(trait, dirname=dirname, traitdb=traitdb)
        #self.report_all_traits_exported()
            
    def export_suite(self, suite, dirname=None):
        self.export_all_traits(suite, dirname=dirname)

    def export_all_suites(self, dirname=None):
        suites = self.suitecursor.get_suites()
        self.report_total_suites(len(suites))
開發者ID:joelsefus,項目名稱:paella,代碼行數:70,代碼來源:main.py


注:本文中的family.Family.write_family方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。