-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: multiple avoid problem #417
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,8 @@ def distance_matrix(client, origins, destinations, | |
:type language: string | ||
|
||
:param avoid: Indicates that the calculated route(s) should avoid the | ||
indicated features. Valid values are "tolls", "highways" or "ferries". | ||
indicated features. Valid values are "tolls", "highways" or "ferries" | ||
as well as any combination of them separated by "|". | ||
:type avoid: string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To mirror the implementation in directions.py, let's update this to list or string |
||
|
||
:param units: Specifies the unit system to use when displaying results. | ||
|
@@ -107,8 +108,12 @@ def distance_matrix(client, origins, destinations, | |
params["language"] = language | ||
|
||
if avoid: | ||
if avoid not in ["tolls", "highways", "ferries"]: | ||
raise ValueError("Invalid route restriction.") | ||
valid_avoids = ["tolls", "highways", "ferries"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add "indoor" |
||
avoid_tokens = avoid.split("|") | ||
wangela marked this conversation as resolved.
Show resolved
Hide resolved
|
||
for token in avoid_tokens: | ||
if token not in valid_avoids: | ||
raise ValueError("Invalid route restriction.") | ||
valid_avoids.remove(token) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you mean to remove from |
||
params["avoid"] = avoid | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We want to set it to the value of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's where we could do parallel implementation with directions.py.
|
||
|
||
if units: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add "indoor"