当前位置: 首页>>代码示例>>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;未经允许,请勿转载。