Skip to content

Commit db40fb7

Browse files
Workflow improvements and code quality passing (#1052)
* CI: Checkout v4 and unit tests name correction * Small tweaks to ensure Code Quality passes --------- Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>
1 parent a762135 commit db40fb7

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

.github/workflows/static_code_check.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-20.04
1313

1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1616

1717
- name: Install Dependencies
1818
run: |
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: ubuntu-20.04
3636

3737
steps:
38-
- uses: actions/checkout@v2
38+
- uses: actions/checkout@v4
3939

4040
- name: Install Dependencies
4141
run: |

.github/workflows/unit_test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Static Code Analysis
1+
name: Unit Tests
22

33
on:
44
push:
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-20.04
1313

1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1616

1717
- name: Install Dependencies
1818
run: |

srunner/scenariomanager/carla_data_provider.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,10 @@ def find_weather_presets():
303303
"""
304304
Get weather presets from CARLA
305305
"""
306+
def name(string):
307+
return ' '.join(m.group(0) for m in rgx.finditer(string))
308+
306309
rgx = re.compile('.+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)')
307-
name = lambda x: ' '.join(m.group(0) for m in rgx.finditer(x))
308310
presets = [x for x in dir(carla.WeatherParameters) if re.match('[A-Z].+', x)]
309311
return [(getattr(carla.WeatherParameters, x), name(x)) for x in presets]
310312

srunner/scenariomanager/scenarioatomics/atomic_behaviors.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -797,9 +797,9 @@ def initialise(self):
797797
# At the moment everything besides "shortest" will use the CARLA GlobalPlanner
798798
grp = CarlaDataProvider.get_global_route_planner()
799799
route = []
800-
for i, _ in enumerate(carla_route_elements):
801-
if carla_route_elements[i][1] == "shortest":
802-
route.append(carla_route_elements[i][0])
800+
for i, element in enumerate(carla_route_elements):
801+
if element[1] == "shortest":
802+
route.append(element[0])
803803
else:
804804
if i == 0:
805805
mmap = CarlaDataProvider.get_map()
@@ -812,12 +812,12 @@ def initialise(self):
812812
waypoint = ego_next_wp.transform.location
813813
else:
814814
waypoint = carla_route_elements[i - 1][0].location
815-
waypoint_next = carla_route_elements[i][0].location
815+
waypoint_next = element[0].location
816816
try:
817817
interpolated_trace = grp.trace_route(waypoint, waypoint_next)
818818
except networkx.NetworkXNoPath:
819819
print("WARNING: No route from {} to {} - Using direct path instead".format(waypoint, waypoint_next))
820-
route.append(carla_route_elements[i][0])
820+
route.append(element[0])
821821
continue
822822
for wp_tuple in interpolated_trace:
823823
# The router sometimes produces points that go backward, or are almost identical

srunner/scenarios/open_scenario.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,9 @@ def _create_behavior(self):
392392
for actor in sequence.iter("Actors"):
393393
for entity in actor.iter("EntityRef"):
394394
entity_name = entity.attrib.get('entityRef', None)
395-
for k, _ in enumerate(joint_actor_list):
396-
if (joint_actor_list[k] and
397-
entity_name == joint_actor_list[k].attributes['role_name']):
395+
for k, actor in enumerate(joint_actor_list):
396+
if (actor and
397+
entity_name == actor.attributes['role_name']):
398398
actor_ids.append(k)
399399
break
400400

0 commit comments

Comments
 (0)