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


Python CallHistory.from_identifier方法代碼示例

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


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

示例1: test_from_identifier

# 需要導入模塊: from core.callhistory import CallHistory [as 別名]
# 或者: from core.callhistory.CallHistory import from_identifier [as 別名]
 def test_from_identifier(self):
     self.assertEqual(CallHistory.from_identifier('E:EW:P').identifier(), CallHistory.from_string('P', 'E', 'E-W').identifier())
     # Test that from_identifier is forgiving of a missing trailing colon
     self.assertEqual(CallHistory.from_identifier('E:EW:').identifier(), CallHistory.from_string('', 'E', 'E-W').identifier())
     self.assertEqual(CallHistory.from_identifier('E:EW').identifier(), CallHistory.from_string('', 'E', 'E-W').identifier())
     # Test that from_identifier is forgiving of a trailing comma.
     self.assertEqual(CallHistory.from_identifier('N:NO:P,').calls_string(), "P")
開發者ID:samfin,項目名稱:saycbridge,代碼行數:9,代碼來源:test_callhistory.py

示例2: from_identifier

# 需要導入模塊: from core.callhistory import CallHistory [as 別名]
# 或者: from core.callhistory.CallHistory import from_identifier [as 別名]
    def from_identifier(self, identifier):
        components = identifier.split("-")
        if len(components) == 2:
            (board_number_string, deal_and_history_identifier) = components
            if ':' in deal_and_history_identifier:
                deal_identifier, call_history_identifier = deal_and_history_identifier.split(':')
                # We have to do a bit of a dance to convert from the board url system that
                # the JS code uses to the one the python uses.
                call_history = CallHistory.from_board_number_and_calls_string(int(board_number_string), call_history_identifier)
            else:
                deal_identifier = deal_and_history_identifier
                call_history = CallHistory.empty_for_board_number(int(board_number_string))
        else:
            (board_number_string, deal_identifier, call_history_identifier) = components
            call_history = CallHistory.from_identifier(call_history_identifier)

        board_number = int(board_number_string)
        deal = Deal.from_identifier(deal_identifier)
        return Board(number=board_number, deal=deal, call_history=call_history)
開發者ID:pdm55,項目名稱:saycbridge,代碼行數:21,代碼來源:board.py

示例3: _history_from_calls_string

# 需要導入模塊: from core.callhistory import CallHistory [as 別名]
# 或者: from core.callhistory.CallHistory import from_identifier [as 別名]
 def _history_from_calls_string(self, calls_string):
     history_identifier = "N:NO:%s" % calls_string  # FIXME: I doubt this is right with the new identifiers.
     return CallHistory.from_identifier(history_identifier)
開發者ID:samfin,項目名稱:saycbridge,代碼行數:5,代碼來源:explore_handler.py


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