MCPcopy Create free account
hub / github.com/AdaCompNUS/summit / inspect

Function inspect

PythonAPI/util/config.py:75–113  ·  view source on GitHub ↗
(args, client)

Source from the content-addressed store, hash-verified

73
74
75def inspect(args, client):
76 address = '%s:%d' % (get_ip(args.host), args.port)
77
78 world = client.get_world()
79 elapsed_time = world.get_snapshot().timestamp.elapsed_seconds
80 elapsed_time = datetime.timedelta(seconds=int(elapsed_time))
81
82 actors = world.get_actors()
83 s = world.get_settings()
84
85 weather = 'Custom'
86 current_weather = world.get_weather()
87 for preset, name in find_weather_presets():
88 if current_weather == preset:
89 weather = name
90
91 if s.fixed_delta_seconds is None:
92 frame_rate = 'variable'
93 else:
94 frame_rate = '%.2f ms (%d FPS)' % (
95 1000.0 * s.fixed_delta_seconds,
96 1.0 / s.fixed_delta_seconds)
97
98 print('-' * 34)
99 print('address:% 26s' % address)
100 print('version:% 26s\n' % client.get_server_version())
101 print('map: % 22s' % world.get_map().name)
102 print('weather: % 22s\n' % weather)
103 print('time: % 22s\n' % elapsed_time)
104 print('frame rate: % 22s' % frame_rate)
105 print('rendering: % 22s' % ('disabled' if s.no_rendering_mode else 'enabled'))
106 print('sync mode: % 22s\n' % ('disabled' if not s.synchronous_mode else 'enabled'))
107 print('actors: % 22d' % len(actors))
108 print(' * spectator:% 20d' % len(actors.filter('spectator')))
109 print(' * static: % 20d' % len(actors.filter('static.*')))
110 print(' * traffic: % 20d' % len(actors.filter('traffic.*')))
111 print(' * vehicles: % 20d' % len(actors.filter('vehicle.*')))
112 print(' * walkers: % 20d' % len(actors.filter('walker.*')))
113 print('-' * 34)
114
115
116def main():

Callers 1

mainFunction · 0.85

Calls 2

get_ipFunction · 0.85
find_weather_presetsFunction · 0.70

Tested by

no test coverage detected