autoverse-cli 0.3.0__py3-none-any.whl → 0.4.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autoverse-cli
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: The Autoverse CLI
5
5
  Author-email: Dan Kamrath <dan.kamrath@autonomalabs.com>
6
6
  License: # End-User License Agreement (EULA) of the Autonoma AutoVerse CLI
@@ -1,25 +1,28 @@
1
1
  avrs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- avrs/app_version.py,sha256=huc5Z36H19yQWjvI0Tw5vY3O1Q5KXiwSfpDn8wu2tEs,855
3
- avrs/avrs.py,sha256=zkpQRKRFdhN6rmdRGQDPIU6vA5DSH8GZmmEm_w1y3Ro,1655
2
+ avrs/app_version.py,sha256=U9S11DYP1oLycncpvTmnWvqUunUHaEDl_O6Elho4iEw,855
3
+ avrs/argparse_help.py,sha256=EoEaohGXZXqJvs1dFEzbo9vh47CYdHdSY2Im2Ps2iFo,945
4
+ avrs/avrs.py,sha256=3dP6YE8aB2IGN0wu_FUcRW4fch6h-b97sFcUeF0vfC0,1953
4
5
  avrs/cfg.py,sha256=9NBtPrJjVN7gj_vxlvO4wOEx3OFw4d2qQgLIVLiccD0,701
5
- avrs/launcher.py,sha256=tysm0CHZQ_l5Etj-PtfQoG6VYIWFHSdASBmE6api-_g,7463
6
+ avrs/launcher.py,sha256=OWwIQDgeIwGLgmLnCxv7RbzVfRNLxSbg3eaZLJ2K64s,7467
6
7
  avrs/launcher_util.py,sha256=X60Jd2JUXr1MmdEF0lwjUBC5gHZte9uLlSgLWOLofXc,5121
7
8
  avrs/tests.py,sha256=3JeYBjn0tRqHXERDROfzmYuW1KXeCcKur5Bw-EIegto,153
8
9
  avrs/requests/can.py,sha256=iL2Dsk-V4tm37D-F1QoauaxeQtLAbg5br7zJcoR9h0o,5295
10
+ avrs/requests/code_booz.py,sha256=5bzT8Ra6EIwI19TqXMxkHG_llnyFgqSzTSo7yLNV9Vc,2274
9
11
  avrs/requests/demo.py,sha256=TksvKX5YmL8-FQ4h7MWwjyIwcaZQrF9vCQ20PdfgS3Q,1138
12
+ avrs/requests/edit_environment.py,sha256=iITvLHJ4N6m-RE8dC_KnFxoTNKSjQu7ydERfQvVtb58,828
10
13
  avrs/requests/input.py,sha256=SkfVjk3LsOhYNXEwn0rcSS6kZK3g8DXoMPX8Zc9LnCo,1855
11
14
  avrs/requests/log_path.py,sha256=Ur24C9VqPVx78MfpicgQu2uOEe-0dXbGoWF_7dzMtZE,1326
12
15
  avrs/requests/move_to_landmark.py,sha256=cLRBKu9XEDsmCoftBJ8JwoBLqzb0IZsxFMBnus4T-kc,702
13
16
  avrs/requests/npc.py,sha256=Y_WovbcLomCCcOLAMMO_DHZtc1crAzWo97qEIGS3SvU,9691
14
- avrs/requests/request.py,sha256=d0DB8tXXK9iQI-j5WmCNWA0f_8B6zU6gWeTLNHpwh_w,1511
15
- avrs/requests/reserve_mv_slot.py,sha256=51MuiQgu22NF4wl-Y-0wjvozIpe1GPBBk_QfvG7FS4k,3763
17
+ avrs/requests/request.py,sha256=3hbBAt_Kd9n-HuggIbziJ3xs-VcRfLBc2GEFSOQ-LJ4,1512
18
+ avrs/requests/reserve_mv_slot.py,sha256=p_jiTV7rcoyJU6u3UR9sqPBpSaq8-PWMEs0Ckm2Hf8w,3843
16
19
  avrs/requests/reset_to_track.py,sha256=lSd2YavBxDV_hQMhVoi08_TpTFEq7G2MA18xosFYa1g,450
17
20
  avrs/requests/restart.py,sha256=ih5mnWiU34q3-xhOth45CtOUXxKI0PoMDCnFJV0JbwE,415
18
21
  avrs/requests/teleport.py,sha256=WpnB2-Ii0FGI11EXTAHlaF5zqZIsgEyJnJ2j_w4rDFY,824
19
22
  avrs/requests/vd.py,sha256=at6oUAGY2h0OxYU6MLOi1gnxyUn6i24vL9DUAj0L880,1600
20
- autoverse_cli-0.3.0.dist-info/LICENSE,sha256=d4eWXho-u18HkBsX4K21uHX_bBb2UXZSrJdsb7Z_JlM,2647
21
- autoverse_cli-0.3.0.dist-info/METADATA,sha256=GLUAOUt_i7yl4U2uJXvixMdOSymCirJcKopwckZ6b9s,3296
22
- autoverse_cli-0.3.0.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
23
- autoverse_cli-0.3.0.dist-info/entry_points.txt,sha256=Cb9qsUyU5AKkklehCcvtfT0-N3SXbUEqvjze4iEU5kE,40
24
- autoverse_cli-0.3.0.dist-info/top_level.txt,sha256=-AJO2e4MCVej6hY0U84pu5NfMeMW5qaAPSMisDT5rmA,5
25
- autoverse_cli-0.3.0.dist-info/RECORD,,
23
+ autoverse_cli-0.4.0.dist-info/LICENSE,sha256=d4eWXho-u18HkBsX4K21uHX_bBb2UXZSrJdsb7Z_JlM,2647
24
+ autoverse_cli-0.4.0.dist-info/METADATA,sha256=1ekzIvDf6Hwm5gthZcMYVCzcjFKRC7DIETN7cOCD4ng,3296
25
+ autoverse_cli-0.4.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
26
+ autoverse_cli-0.4.0.dist-info/entry_points.txt,sha256=Cb9qsUyU5AKkklehCcvtfT0-N3SXbUEqvjze4iEU5kE,40
27
+ autoverse_cli-0.4.0.dist-info/top_level.txt,sha256=-AJO2e4MCVej6hY0U84pu5NfMeMW5qaAPSMisDT5rmA,5
28
+ autoverse_cli-0.4.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
avrs/app_version.py CHANGED
@@ -2,7 +2,7 @@ import http.client
2
2
  import json
3
3
 
4
4
  def get_app_version():
5
- return '0.3.0'
5
+ return '0.4.0'
6
6
 
7
7
  def check_app_is_latest():
8
8
  pass
avrs/argparse_help.py ADDED
@@ -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
avrs/avrs.py CHANGED
@@ -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=RawDescriptionHelpFormatter)
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
- #AvrsDemoRequest(sps, cfg)
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()
avrs/launcher.py CHANGED
@@ -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
+ }
avrs/requests/request.py CHANGED
@@ -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=2)
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',