Path: blob/main/tests/complex/traci/misc/signature/runner.py
169689 views
#!/usr/bin/env python1# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2# Copyright (C) 2008-2025 German Aerospace Center (DLR) and others.3# This program and the accompanying materials are made available under the4# terms of the Eclipse Public License 2.0 which is available at5# https://www.eclipse.org/legal/epl-2.0/6# This Source Code may also be made available under the following Secondary7# Licenses when the conditions for such availability set forth in the Eclipse8# Public License 2.0 are satisfied: GNU General Public License, version 29# or later which is available at10# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later1213# @file runner.py14# @author Michael Behrisch15# @date 2023-11-14161718import os19import sys20import inspect21if "SUMO_HOME" in os.environ:22sys.path.append(os.path.join(os.environ["SUMO_HOME"], "tools"))23import sumolib24import traci25if sys.version_info[0] > 2:26import libsumo27else:28def libsumo(): return None29libsumo.DOMAINS = []3031VERBOSE = False3233for dt in traci.DOMAINS:34for dl in libsumo.DOMAINS:35if dt.DOMAIN_ID == dl.DOMAIN_ID:36for ft in inspect.getmembers(dt):37if ft[0][0] != "_" and inspect.ismethod(ft[1]):38if VERBOSE:39print("checking", dt._name, ft[0])40for fl in inspect.getmembers(dl):41if fl[0] == ft[0]:42sigt = inspect.signature(ft[1])43sigl = inspect.signature(fl[1])44if VERBOSE:45print("checking", sigt, sigl)46if sigt != sigl:47params = list(sigl.parameters.values())48if not params or params[0].kind != inspect.Parameter.VAR_POSITIONAL:49print(".".join([dt._name, ft[0]]), "traci:", sigt, "libsumo:", sigl)50if not traci.isLibsumo():51try:52traci.start([sumolib.checkBinary("sumo"), "-c", "sumo.sumocfg"])53traci.simulationStep()54if not traci.isLibtraci():55traci.vehicle.setLaneChangeMode("horiz", lcm=0)56traci.vehicle.setParameter(objectID="horiz", key="blub", value="blubber")57traci.vehicle.setParameter(objID="horiz", key="blub", value="blubber")58traci.vehicle.setParameter(objectID="horiz", param="blub", value="blubber")59traci.vehicle.setParameter(objID="horiz", param="blub", value="blubber")60try:61traci.vehicle.setParameter(oID="horiz", param="blub", value="blubber")62except TypeError as e:63print(str(e).replace("Domain.", ""))64finally:65traci.close()666768