traci

 1# -*- coding: utf-8 -*-
 2# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
 3# Copyright (C) 2008-2026 German Aerospace Center (DLR) and others.
 4# This program and the accompanying materials are made available under the
 5# terms of the Eclipse Public License 2.0 which is available at
 6# https://www.eclipse.org/legal/epl-2.0/
 7# This Source Code may also be made available under the following Secondary
 8# Licenses when the conditions for such availability set forth in the Eclipse
 9# Public License 2.0 are satisfied: GNU General Public License, version 2
10# or later which is available at
11# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
14# @file    __init__.py
15# @author  Michael Behrisch
16# @author  Lena Kalleske
17# @author  Mario Krumnow
18# @author  Daniel Krajzewicz
19# @author  Jakob Erdmann
20# @date    2008-10-09
21
22from __future__ import absolute_import
23import os
24import sys
25import warnings
26
27__all__ = ['busstop', 'calibrator', 'chargingstation', 'edge', 'gui', 'inductionloop', 'junction', 'lane', 'lanearea',
28           'multientryexit', 'overheadwire', 'parkingarea', 'person', 'poi', 'polygon', 'rerouter', 'route',
29           'routeprobe', 'simulation', 'trafficlight', 'variablespeedsign', 'vehicle', 'vehicletype',
30           'constants', 'exceptions']
31
32try:
33    # this tries to determine the version number of an installed wheel
34    import importlib.metadata  # noqa
35    __version__ = importlib.metadata.version(__name__)
36except ImportError:
37    # this is the fallback version, it gets replaced with the current version on "make install" or "make dist"
38    __version__ = "0.0.0"
39
40# the pure python version needs to be the first variant to help IDEs finding the docstrings
41if 'LIBSUMO_AS_TRACI' not in os.environ and 'LIBTRACI_AS_TRACI' not in os.environ:
42    from .main import *  # noqa
43else:
44    try:
45        if 'LIBSUMO_AS_TRACI' in os.environ:
46            from libsumo import *  # noqa
47            if os.environ['LIBSUMO_AS_TRACI'] != "quiet":
48                print("Using libsumo as traci as requested by environment variable.")
49        else:
50            from libtraci import *  # noqa
51            if os.environ['LIBTRACI_AS_TRACI'] != "quiet":
52                print("Using libtraci as traci as requested by environment variable.")
53    except ImportError as e:
54        if 'LIBSUMO_AS_TRACI' in os.environ:
55            warnings.warn("Could not import libsumo using %s, falling back to pure python traci (%s)." %
56                          (sys.executable, e))
57        else:
58            warnings.warn("Could not import libtraci, falling back to pure python traci (%s)." % e)
59        from .main import *  # noqa
busstop = <traci._busstop.BusStopDomain object>
calibrator = <traci._calibrator.CalibratorDomain object>
edge = <traci._edge.EdgeDomain object>
gui = <traci._gui.GuiDomain object>
inductionloop = <traci._inductionloop.InductionLoopDomain object>
junction = <traci._junction.JunctionDomain object>
lane = <traci._lane.LaneDomain object>
lanearea = <traci._lanearea.LaneAreaDomain object>
multientryexit = <traci._multientryexit.MultiEntryExitDomain object>
overheadwire = <traci._overheadwire.OverheadWireDomain object>
parkingarea = <traci._parkingarea.ParkingAreaDomain object>
person = <traci._person.PersonDomain object>
poi = <traci._poi.PoiDomain object>
polygon = <traci._polygon.PolygonDomain object>
rerouter = <traci._rerouter.RerouterDomain object>
route = <traci._route.RouteDomain object>
routeprobe = <traci._routeprobe.RouteProbeDomain object>
simulation = <traci._simulation.SimulationDomain object>
trafficlight = <traci._trafficlight.TrafficLightDomain object>
vehicle = <traci._vehicle.VehicleDomain object>
vehicletype = <traci._vehicletype.VehicleTypeDomain object>