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


Python DBCache.__init__方法代码示例

本文整理汇总了Python中database.DBCache.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python DBCache.__init__方法的具体用法?Python DBCache.__init__怎么用?Python DBCache.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在database.DBCache的用法示例。


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

示例1: __init__

# 需要导入模块: from database import DBCache [as 别名]
# 或者: from database.DBCache import __init__ [as 别名]
    def __init__(self, path=None, setting=None, db=None, useshell=True):
        DBCache.__init__(self, db=db)
        self.log = MythLog(self.logmodule, db=self)
        self.path = None

        if setting is not None:
            # pull setting from database, substitute from argument if needed
            host = self.gethostname()
            self.path = self.settings[host][setting]
            if (self.path is None) and (path is None):
                raise MythDBError(MythError.DB_SETTING, setting, host)

        if self.path is None:
            # setting not given, use path from argument
            if path is None:
                raise MythError('Invalid input to System()')
            self.path = path

        cmd = self.path.split()[0]
        if self.path.startswith('/'):
            # test full given path
            if not os.access(cmd, os.F_OK):
                raise MythFileError('Defined executable path does not exist.')
        else:
            # search command from PATH
            for folder in os.environ['PATH'].split(':'):
                if os.access(os.path.join(folder,cmd), os.F_OK):
                    self.path = os.path.join(folder,self.path)
                    break
            else:
                raise MythFileError('Defined executable path does not exist.')
                
        self.returncode = 0
        self.stderr = ''
        self.useshell = useshell
开发者ID:afljafa,项目名称:mythtv,代码行数:37,代码来源:system.py

示例2: __init__

# 需要导入模块: from database import DBCache [as 别名]
# 或者: from database.DBCache import __init__ [as 别名]
 def __init__(self, path=None, setting=None, db=None):
     DBCache.__init__(self, db=db)
     self.log = MythLog(self.logmodule, db=self)
     self.path = None
     if setting is not None:
         host = self.gethostname()
         self.path = self.settings[host][setting]
         if (self.path is None) and (path is None):
             raise MythDBError(MythError.DB_SETTING, setting, host)
     if self.path is None:
         if path is None:
             raise MythError('Invalid input to System()')
         self.path = path
     if self.path.startswith('/'):
         if not os.access(self.path.split()[0], os.F_OK):
             raise MythFileError('Defined grabber path does not exist.')
     self.returncode = 0
     self.stderr = ''
开发者ID:Cougar,项目名称:mythtv,代码行数:20,代码来源:system.py


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