Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osc2_scenario: Fix SyntaxWarnings #1122

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
## Upcoming
* Improvements to the CarlaDataProvider:
- Added `spawn_actor` for a blueprint based actor creation similar to `World.spawn_actor`
* Removed SyntaxWarnings in osc2_scenario.py

## CARLA ScenarioRunner 0.9.15
### :rocket: New Features
Expand Down
8 changes: 4 additions & 4 deletions srunner/scenarios/osc2_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,8 @@ def visit_do_directive(self, node: ast_node.DoDirective):

def bool_result(self, option):
# wait(x < y) @drive_distance Handling of Boolean expressions x < y
expression_value = re.split("\W+", option)
symbol = re.search("\W+", option).group()
expression_value = re.split(r"\W+", option)
symbol = re.search(r"\W+", option).group()
if symbol == "<":
symbol = operator.lt
elif symbol == ">":
Expand Down Expand Up @@ -1194,10 +1194,10 @@ def visit_identifier_reference(self, node: ast_node.IdentifierReference):
if isinstance(para_value, (Physical, float, int)):
return para_value
para_value = para_value.strip('"')
if re.fullmatch("(^[-]?[0-9]+(\.[0-9]+)?)\s*(\w+)", para_value):
if re.fullmatch(r"(^[-]?[0-9]+(\.[0-9]+)?)\s*(\w+)", para_value):
# Regular expression ^[-]?[0-9]+(\.[0-9]+)? matching float
# para_value_num = re.findall('^[-]?[0-9]+(\.[0-9]+)?', para_value)[0]
patter = re.compile("(^[-]?[0-9]+[\.[0-9]+]?)\s*(\w+)")
patter = re.compile(r"(^[-]?[0-9]+[\.[0-9]+]?)\s*(\w+)")
para_value_num, para_value_unit = patter.match(para_value).groups()
if para_value_num.count(".") == 1:
return Physical(
Expand Down