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


Python Constants.load_constants方法代碼示例

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


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

示例1: get_all_buses

# 需要導入模塊: from constants import Constants [as 別名]
# 或者: from constants.Constants import load_constants [as 別名]
        logging.info("\nIn find_routes_for_colloquial_bus_numbers: dict_colloquial_bus_numbers :"+str(dict_colloquial_bus_numbers))
        return dict_colloquial_bus_numbers

    def get_all_buses(self):
        """
        Returns the list of colloquial_bus_numbers for the specified city/university.
        """
        doublemap_routes_url = self.DOUBLEMAP_ROUTES_API_URL
        response = json.loads(urllib.urlopen(doublemap_routes_url).read())

        busList = []
        for route in response:
            busList.append(route['name'])
        return busList

if __name__ == "__main__":

    #Input
    city = "IUB"
    #target location coordinates
    targetCoordinates = (39.17155659473131, -86.50890111923218)
     #Create constans object to fetch all constant values
    constantsObject = Constants()
    constantsObject.load_constants("constants.json")
    #Create route object
    routeObject = Route(constantsObject, city)
    listColloquialBusNumbers = ['3 College Mall / Bradford Place','6 Campus Shuttle - Sat']
    listOfActualBusNumbers = routeObject.get_actual_bus_numbers(listColloquialBusNumbers)
    print listOfActualBusNumbers

開發者ID:nakul225,項目名稱:TripleMap,代碼行數:31,代碼來源:Route.py


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