Waze Travel Time: optional inclusive/exclusive filters#14000
Waze Travel Time: optional inclusive/exclusive filters#14000fabaff merged 6 commits intohome-assistant:devfrom
Conversation
Added optional `inc_filter` and `excl_filter' params that allow to refine the reported routes: the first is not always the best/desired. A simple case-insensitive filtering (no regular expression) is used.
This comment has been minimized.
This comment has been minimized.
| if self._inc_filter is not None: | ||
| results = {k: v for k, v in results.items() if self._inc_filter.lower() in k.lower()} | ||
| if self._excl_filter is not None: | ||
| results = {k: v for k, v in results.items() if self._excl_filter.lower() not in k.lower()} |
There was a problem hiding this comment.
line too long (106 > 79 characters)
| self._origin, self._destination, self._region, None) | ||
| results = params.calc_all_routes_info() | ||
| if self._inc_filter is not None: | ||
| results = {k: v for k, v in results.items() if self._inc_filter.lower() in k.lower()} |
There was a problem hiding this comment.
line too long (101 > 79 characters)
|
|
||
| try: | ||
| waze_data = WazeRouteData(origin, destination, region) | ||
| waze_data = WazeRouteData(origin, destination, region, inc_filter, excl_filter) |
There was a problem hiding this comment.
line too long (87 > 79 characters)
| self._inc_filter.lower() in k.lower()} | ||
| if self._excl_filter is not None: | ||
| results = {k: v for k, v in results.items() if | ||
| self._excl_filter.lower() not in k.lower()} |
There was a problem hiding this comment.
continuation line under-indented for visual indent
| results = {k: v for k, v in results.items() if | ||
| self._inc_filter.lower() in k.lower()} | ||
| if self._excl_filter is not None: | ||
| results = {k: v for k, v in results.items() if |
| results = params.calc_all_routes_info() | ||
| if self._inc_filter is not None: | ||
| results = {k: v for k, v in results.items() if | ||
| self._inc_filter.lower() in k.lower()} |
There was a problem hiding this comment.
continuation line under-indented for visual indent
| self._origin, self._destination, self._region, None) | ||
| results = params.calc_all_routes_info() | ||
| if self._inc_filter is not None: | ||
| results = {k: v for k, v in results.items() if |
| try: | ||
| waze_data = WazeRouteData(origin, destination, region) | ||
| waze_data = WazeRouteData(origin, destination, region, | ||
| inc_filter, excl_filter) |
There was a problem hiding this comment.
continuation line under-indented for visual indent
|
|
||
| try: | ||
| waze_data = WazeRouteData(origin, destination, region) | ||
| waze_data = WazeRouteData(origin, destination, region, |
|
@Myrddyn1, can you please comment on this? Thanks |
|
Maybe the example of usage of the filters proposed in the documentation doesn't make so sense. |
|
Hi, |
|
@Myrddyn1 If I use an "inclusive filter" with the high-way name, he would select it even if longer than the others (not using the high-way). If I use an "exclusive filter" with a not-preferred road name, he would remove any path reporting such name event if it is shorter. Such filters are a simple way to apply personal preferences and, as in my case, to prevent continuing variation of the selected path (few minutes of difference among the alternatives). IMHO such filters should not annoy anyone who don't want to use them and they could even used in combination with other future criteria. They just cut-off the reported list. |
|
@diraimondo Anyway, with or without that threshold, I agree with your feature :) |
…t#14000) * Waze Travel Time: optional inclusive/exclusive filters Added optional `inc_filter` and `excl_filter' params that allow to refine the reported routes: the first is not always the best/desired. A simple case-insensitive filtering (no regular expression) is used. * fix line lenght * fix spaces * Rename var * Fix typo * Fix missing var
Added optional
inc_filterand `excl_filter' params that allow to refine the reported routes: the first is not always the best/desired. A simple case-insensitive filtering (no regular expression) is used.Description:
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#5208
Example entry for
configuration.yaml(if applicable):Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.If the code does not interact with devices: