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


Python state.State方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: import state [as 別名]
# 或者: from state import State [as 別名]
def __init__(self, session, authProvider, accessToken, location):
        self.session = session
        self.authProvider = authProvider
        self.accessToken = accessToken
        self.location = location
        if self.location.noop:
            logging.info("Limited functionality. No location provided")

        self._state = State()

        self.authTicket = None
        self.endpoint = None
        self.endpoint = 'https://{0}{1}'.format(
            self.createApiEndpoint(),
            '/rpc'
        )

        # Set up Inventory
        self.getInventory() 
開發者ID:cglatot,項目名稱:PokeManager,代碼行數:21,代碼來源:session.py

示例2: __reset_model

# 需要導入模塊: import state [as 別名]
# 或者: from state import State [as 別名]
def __reset_model(self):
        """
        Loads the model / resets it if it's loaded.
        """
        if self.fmu == None:
            self.fmu = load_fmu(self.fmu_path)
        else:
            self.fmu.reset()

    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    # State set/get
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
開發者ID:Halolegend94,項目名稱:uni_verifica-validazione,代碼行數:14,代碼來源:model.py

示例3: __get_state

# 需要導入模塊: import state [as 別名]
# 或者: from state import State [as 別名]
def __get_state(self):
        var_values = {}
        for v in self.state_vars:
            var_values[v] = self.__get(v)
        state = State(var_values)
        return state

    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    # Variable/input set/get
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
開發者ID:Halolegend94,項目名稱:uni_verifica-validazione,代碼行數:12,代碼來源:model.py

示例4: get_initial_state

# 需要導入模塊: import state [as 別名]
# 或者: from state import State [as 別名]
def get_initial_state(self):
        """
        Returns the initial state of the model.
        """
        self.__reset_model()
        var_values = {}
        for v in self.state_vars:
            var_values[v] = self.fmu.get(self.var_map[v])[0]
        state = State(var_values)
        return state 
開發者ID:Halolegend94,項目名稱:uni_verifica-validazione,代碼行數:12,代碼來源:model.py

示例5: parse

# 需要導入模塊: import state [as 別名]
# 或者: from state import State [as 別名]
def parse(inFileName):

    with open(inFileName, "r") as inFile:

        header = inFile.readline()
        rows, columns, nr_drones, nr_turns, max_payload = list(map(int, header.strip().split(" ")))

        # read product types
        nr_products = int(inFile.readline())
        products = list(map(int, inFile.readline().strip().split(" ")))
        assert len(products) == nr_products

        # read warehouses
        nr_warehouses = int(inFile.readline())
        warehouses = []
        for i in range(nr_warehouses):
            pos = tuple(map(int, inFile.readline().strip().split(" ")))
            items = list(map(int, inFile.readline().strip().split(" ")))
            assert len(items) == nr_products
            warehouses.append(Warehouse(i, pos, items))

        assert len(warehouses) == nr_warehouses

        # read orders
        nr_orders = int(inFile.readline())
        orders = []
        lines = inFile.readlines()
        for i, (pos, nr_items, items) in enumerate(zip(lines[::3], lines[1::3], lines[2::3])):
            pos = tuple(map(int, pos.split(" ")))
            items = list(map(int, items.strip().split(" ")))
            assert int(nr_items) == len(items)
            orders.append(Order(id=i, pos=pos, items=items))

        assert len(orders) == nr_orders

        # init drones to simulate
        drones = []
        first_warehouse = warehouses[0]
        for i in range(nr_drones):
            drone = Drone(pos=first_warehouse.pos, id=i, max_payload=max_payload)
            drones.append(drone)

        return State(
            rows = rows,
            columns = columns,
            nr_turns = nr_turns,
            max_payload = max_payload,
            products = products,
            warehouses = warehouses,
            orders = orders,
            drones = drones
        ) 
開發者ID:wilzbach,項目名稱:gh-2016,代碼行數:54,代碼來源:parser.py


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