autoverse-cli 0.3.0__tar.gz → 0.4.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/PKG-INFO +1 -1
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/pyproject.toml +1 -1
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/autoverse_cli.egg-info/PKG-INFO +1 -1
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/autoverse_cli.egg-info/SOURCES.txt +3 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/app_version.py +1 -1
- autoverse_cli-0.4.0/src/avrs/argparse_help.py +30 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/avrs.py +11 -3
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/launcher.py +1 -1
- autoverse_cli-0.4.0/src/avrs/requests/code_booz.py +65 -0
- autoverse_cli-0.4.0/src/avrs/requests/edit_environment.py +21 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/requests/request.py +1 -1
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/requests/reserve_mv_slot.py +2 -1
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/LICENSE +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/README.md +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/setup.cfg +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/autoverse_cli.egg-info/dependency_links.txt +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/autoverse_cli.egg-info/entry_points.txt +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/autoverse_cli.egg-info/top_level.txt +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/__init__.py +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/cfg.py +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/launcher_util.py +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/requests/can.py +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/requests/demo.py +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/requests/input.py +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/requests/log_path.py +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/requests/move_to_landmark.py +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/requests/npc.py +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/requests/reset_to_track.py +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/requests/restart.py +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/requests/teleport.py +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/requests/vd.py +0 -0
- {autoverse_cli-0.3.0 → autoverse_cli-0.4.0}/src/avrs/tests.py +0 -0
@@ -8,13 +8,16 @@ src/autoverse_cli.egg-info/entry_points.txt
|
|
8
8
|
src/autoverse_cli.egg-info/top_level.txt
|
9
9
|
src/avrs/__init__.py
|
10
10
|
src/avrs/app_version.py
|
11
|
+
src/avrs/argparse_help.py
|
11
12
|
src/avrs/avrs.py
|
12
13
|
src/avrs/cfg.py
|
13
14
|
src/avrs/launcher.py
|
14
15
|
src/avrs/launcher_util.py
|
15
16
|
src/avrs/tests.py
|
16
17
|
src/avrs/requests/can.py
|
18
|
+
src/avrs/requests/code_booz.py
|
17
19
|
src/avrs/requests/demo.py
|
20
|
+
src/avrs/requests/edit_environment.py
|
18
21
|
src/avrs/requests/input.py
|
19
22
|
src/avrs/requests/log_path.py
|
20
23
|
src/avrs/requests/move_to_landmark.py
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import argparse
|
2
|
+
|
3
|
+
def generate_argparse_docs(parser):
|
4
|
+
"""
|
5
|
+
Try to generate a nice markdown with all help from a parser
|
6
|
+
"""
|
7
|
+
s = recursive_get_argparse_help(parser, 'avrs', True)
|
8
|
+
#print(s)
|
9
|
+
|
10
|
+
with open('out.txt', 'w', encoding='utf-8') as f:
|
11
|
+
f.write(s)
|
12
|
+
|
13
|
+
def recursive_get_argparse_help(parser, parent_name, is_root):
|
14
|
+
|
15
|
+
s = ''
|
16
|
+
if not is_root:
|
17
|
+
s += '\n' + '_' * 72 + '\n\n'
|
18
|
+
|
19
|
+
s += '{}\n'.format(parent_name)
|
20
|
+
s += '{}\n'.format(parser.format_help())
|
21
|
+
|
22
|
+
for action in parser._actions:
|
23
|
+
if isinstance(action, argparse._SubParsersAction):
|
24
|
+
#s += '{}\n'.format(dir(action))
|
25
|
+
#s += '{}\n'.format(action._choices_actions)
|
26
|
+
#for a in action._choices_actions:
|
27
|
+
# s += '{}\n'.format(a.dest)
|
28
|
+
for subcmd, subpsr in action.choices.items():
|
29
|
+
s += recursive_get_argparse_help(subpsr, parent_name + ' ' + subcmd, False)
|
30
|
+
return s
|
@@ -6,6 +6,7 @@ from argparse import RawTextHelpFormatter
|
|
6
6
|
from avrs.app_version import *
|
7
7
|
from avrs.cfg import *
|
8
8
|
from avrs.launcher import *
|
9
|
+
from avrs.argparse_help import *
|
9
10
|
|
10
11
|
from avrs.requests.move_to_landmark import MoveToLandmarkRequest
|
11
12
|
from avrs.requests.restart import Restart
|
@@ -18,6 +19,8 @@ from avrs.requests.vd import Vd
|
|
18
19
|
from avrs.requests.input import InputRequest
|
19
20
|
from avrs.requests.log_path import LogPath
|
20
21
|
from avrs.requests.demo import AvrsDemoRequest
|
22
|
+
from avrs.requests.edit_environment import AvrsEditEnvironmentRequests
|
23
|
+
from avrs.requests.code_booz import *
|
21
24
|
|
22
25
|
|
23
26
|
def get_version():
|
@@ -28,7 +31,7 @@ def main():
|
|
28
31
|
prog='avrs',
|
29
32
|
description='Autoverse CLI',
|
30
33
|
epilog='',
|
31
|
-
formatter_class=
|
34
|
+
formatter_class=RawTextHelpFormatter)
|
32
35
|
|
33
36
|
version_psr = parser.add_argument(
|
34
37
|
'--version',
|
@@ -54,11 +57,16 @@ def main():
|
|
54
57
|
Vd(sps, cfg)
|
55
58
|
#InputRequest(sps, cfg)
|
56
59
|
LogPath(sps, cfg)
|
57
|
-
|
58
|
-
|
60
|
+
AvrsEditEnvironmentRequests(sps, cfg)
|
61
|
+
AvrsCodeBoozRequest(sps, cfg)
|
62
|
+
AvrsDemoRequest(sps, cfg)
|
63
|
+
|
64
|
+
if os.environ.get('AVRS_GEN_DOCS', '0') == '1':
|
65
|
+
generate_argparse_docs(parser)
|
59
66
|
|
60
67
|
args = parser.parse_args()
|
61
68
|
args.func(args)
|
62
69
|
|
70
|
+
|
63
71
|
if __name__ == '__main__':
|
64
72
|
main()
|
@@ -11,7 +11,7 @@ class AvrsLauncher:
|
|
11
11
|
self.cfg = cfg
|
12
12
|
provision_parser = parent_parser.add_parser(
|
13
13
|
'launcher',
|
14
|
-
help='launcher operations, such as license registration or updating a sim install')
|
14
|
+
help='launcher operations, such as license registration or updating a sim install\n\n')
|
15
15
|
sps = provision_parser.add_subparsers(required=True, help='launcher options')
|
16
16
|
|
17
17
|
register_license_psr = sps.add_parser(
|
@@ -0,0 +1,65 @@
|
|
1
|
+
from avrs.requests.request import AvrsApiRequest
|
2
|
+
from argparse import RawTextHelpFormatter
|
3
|
+
|
4
|
+
class AvrsCodeBoozRequest():
|
5
|
+
def __init__(self, parent_parser, cfg):
|
6
|
+
psr = parent_parser.add_parser(
|
7
|
+
'lwi',
|
8
|
+
help='light-weight interface logging options\n\n')
|
9
|
+
sps = psr.add_subparsers(required=True, help='light-wieght interface logging options')
|
10
|
+
|
11
|
+
AvrsCodeBoozStartLogging(sps, cfg)
|
12
|
+
AvrsCodeBoozStopLogging(sps, cfg)
|
13
|
+
AvrsCodeBoozGetTimes(sps, cfg)
|
14
|
+
|
15
|
+
class AvrsCodeBoozStartLogging(AvrsApiRequest):
|
16
|
+
def __init__(self, parser, cfg):
|
17
|
+
AvrsApiRequest.__init__(self, parser, cfg, 'CodeBoozLog', 'Ego')
|
18
|
+
psr = parser.add_parser(
|
19
|
+
'start-log', help='starts logging', formatter_class=RawTextHelpFormatter)
|
20
|
+
|
21
|
+
psr.add_argument(
|
22
|
+
'out_file',
|
23
|
+
help='the name of the log file to create (within the \"Saved\" directory)')
|
24
|
+
|
25
|
+
psr.add_argument(
|
26
|
+
'--format', choices=('binary', 'csv'), default='binary', help='the format to save logged data')
|
27
|
+
|
28
|
+
psr.add_argument(
|
29
|
+
'--rate-hz', type=float, default=100.0, help='the rate in hz to log data')
|
30
|
+
|
31
|
+
psr.set_defaults(func=self.send_request)
|
32
|
+
|
33
|
+
def get_request_body(self, args):
|
34
|
+
return {
|
35
|
+
'Action': 'Start',
|
36
|
+
'FileName': args.out_file,
|
37
|
+
'RateHz': args.rate_hz,
|
38
|
+
'Format': args.format
|
39
|
+
}
|
40
|
+
|
41
|
+
class AvrsCodeBoozStopLogging(AvrsApiRequest):
|
42
|
+
def __init__(self, parser, cfg):
|
43
|
+
AvrsApiRequest.__init__(self, parser, cfg, 'CodeBoozLog', 'Ego')
|
44
|
+
psr = parser.add_parser(
|
45
|
+
'stop-log', help='starts logging', formatter_class=RawTextHelpFormatter)
|
46
|
+
|
47
|
+
psr.set_defaults(func=self.send_request)
|
48
|
+
|
49
|
+
def get_request_body(self, args):
|
50
|
+
return {
|
51
|
+
'Action': 'Stop'
|
52
|
+
}
|
53
|
+
|
54
|
+
class AvrsCodeBoozGetTimes(AvrsApiRequest):
|
55
|
+
def __init__(self, parser, cfg):
|
56
|
+
AvrsApiRequest.__init__(self, parser, cfg, 'CodeBoozLog', 'Ego')
|
57
|
+
psr = parser.add_parser(
|
58
|
+
'get-times', help='starts logging', formatter_class=RawTextHelpFormatter)
|
59
|
+
|
60
|
+
psr.set_defaults(func=self.send_request)
|
61
|
+
|
62
|
+
def get_request_body(self, args):
|
63
|
+
return {
|
64
|
+
'Action': 'GetTimes'
|
65
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
from avrs.requests.request import AvrsApiRequest
|
2
|
+
|
3
|
+
class AvrsEditEnvironmentRequests():
|
4
|
+
def __init__(self, parser, cfg):
|
5
|
+
psr = parser.add_parser('edit-environment', help='Edits the environment')
|
6
|
+
sps = psr.add_subparsers(required= True, help='')
|
7
|
+
AvrsSetTimeOfDayRequest(sps, cfg)
|
8
|
+
|
9
|
+
|
10
|
+
class AvrsSetTimeOfDayRequest(AvrsApiRequest):
|
11
|
+
def __init__(self, parser, cfg):
|
12
|
+
AvrsApiRequest.__init__(self, parser, cfg, 'SetTimeOfDay', '')
|
13
|
+
psr = parser.add_parser('set-time-of-day', help='sets the current time of day')
|
14
|
+
psr.add_argument('tod', type=float, help='The time of day (0-24) to set')
|
15
|
+
psr.set_defaults(func=self.send_request)
|
16
|
+
|
17
|
+
def get_request_body(self, args):
|
18
|
+
self.target_object_id = ''
|
19
|
+
return {
|
20
|
+
'TimeOfDay': args.tod
|
21
|
+
}
|
@@ -35,7 +35,7 @@ class AvrsApiRequest:
|
|
35
35
|
# print('{}'.format(response))
|
36
36
|
|
37
37
|
def send_http_request(self, args):
|
38
|
-
connection = http.client.HTTPConnection("localhost", 30313, timeout=
|
38
|
+
connection = http.client.HTTPConnection("localhost", 30313, timeout=10)
|
39
39
|
headers = {'Content-type': 'application/json'}
|
40
40
|
body = json.dumps(self.get_request(args)).encode('utf-8')
|
41
41
|
connection.request('POST', '/post', body, headers)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from avrs.requests.request import AvrsApiRequest
|
2
|
+
from argparse import RawTextHelpFormatter
|
2
3
|
|
3
4
|
RESERVE_MV_SLOT_HELP = '''
|
4
5
|
slot (if an open slot exists, there are 4 total) using the given name to add a new vehicle and the appropriate topics.
|
@@ -19,7 +20,7 @@ MV_LANDMARKS = [
|
|
19
20
|
class ReserveMvSlot(AvrsApiRequest):
|
20
21
|
def __init__(self, parser, cfg):
|
21
22
|
AvrsApiRequest.__init__(self, parser, cfg, 'SpawnObject', 0)
|
22
|
-
psr = parser.add_parser('reserve-mv-slot', help=RESERVE_MV_SLOT_HELP)
|
23
|
+
psr = parser.add_parser('reserve-mv-slot', help=RESERVE_MV_SLOT_HELP, formatter_class=RawTextHelpFormatter)
|
23
24
|
|
24
25
|
psr.add_argument(
|
25
26
|
'slot_name',
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|