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


Python StorageTools.constructPath方法代碼示例

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


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

示例1: initStore

# 需要導入模塊: from yowsup.common.tools import StorageTools [as 別名]
# 或者: from yowsup.common.tools.StorageTools import constructPath [as 別名]
 def initStore(self):
     self.store = LiteAxolotlStore(
         StorageTools.constructPath(
             self.getProp(
                 YowAuthenticationProtocolLayer.PROP_CREDENTIALS)[0],
             self.__class__._DB
         )
     )
     self.state = self.__class__._STATE_HASKEYS if self.store.getLocalRegistrationId() is not None \
         else self.__class__._STATE_INIT
開發者ID:oscardb22,項目名稱:yowsup,代碼行數:12,代碼來源:layer.py

示例2: store

# 需要導入模塊: from yowsup.common.tools import StorageTools [as 別名]
# 或者: from yowsup.common.tools.StorageTools import constructPath [as 別名]
 def store(self):
     try:
         if self._store is None:
             self.store = LiteAxolotlStore(
                 StorageTools.constructPath(
                     self.getProp(
                         YowAuthenticationProtocolLayer.PROP_CREDENTIALS)[0],
                     self.__class__._DB
                 )
             )
         return self._store
     except AttributeError:
         return None
開發者ID:Adutchlegend,項目名稱:yowsup,代碼行數:15,代碼來源:layer_base.py

示例3: get_manager

# 需要導入模塊: from yowsup.common.tools import StorageTools [as 別名]
# 或者: from yowsup.common.tools.StorageTools import constructPath [as 別名]
 def get_manager(self, username):
     logger.debug("get_manager(username=%s)" % username)
     dbpath = StorageTools.constructPath(username, self.DB)
     store = LiteAxolotlStore(dbpath)
     return AxolotlManager(store, username)
開發者ID:tgalal,項目名稱:yowsup,代碼行數:7,代碼來源:factory.py

示例4: len

# 需要導入模塊: from yowsup.common.tools import StorageTools [as 別名]
# 或者: from yowsup.common.tools.StorageTools import constructPath [as 別名]
from yowsup_ext.layers.store import YowStorageLayer

import sys
import logging

logging.basicConfig(level = logging.DEBUG)
logger = logging.getLogger(__name__)

if __name__ == "__main__":
    if len(sys.argv) < 3:
        print("Usage: run.py username password")
        sys.exit(1)
    credentials = (sys.argv[1], sys.argv[2])
    stackBuilder = YowStackBuilder()
    phoneStorage =  StorageTools.getStorageForPhone(credentials[0])
    stackBuilder.setProp(YowStorageLayer.PROP_DB_PATH, StorageTools.constructPath(phoneStorage, "yowstore.db"))
    stack = stackBuilder\
        .pushDefaultLayers(True)\
        .push(YowStorageLayer)\
        .push(YowCleverBotLayer)\
        .build()

    stack.setCredentials(credentials)
    logger.info("Starting")
    stack.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_CONNECT))

    try:
        stack.loop(timeout = 0.5, discrete = 0.5)
    except AuthError as e:
        print("Auth Error, reason %s" % e)
    except KeyboardInterrupt:
開發者ID:jorgehortelano,項目名稱:yowlayer-cleverbot,代碼行數:33,代碼來源:run.py


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