mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Dont wrap '/int' parameters with tuple
This commit is contained in:
parent
2c3a6e7905
commit
ca070a36e3
@ -198,6 +198,8 @@ def _process_match_param(parameter):
|
||||
""" Wraps parameter in a tuple if it is not one and returns it. """
|
||||
if parameter is None or parameter == MATCH_ALL:
|
||||
return MATCH_ALL
|
||||
elif isinstance(parameter, str) and parameter.startswith('/'):
|
||||
return parameter
|
||||
elif isinstance(parameter, str) or not hasattr(parameter, '__iter__'):
|
||||
return (parameter,)
|
||||
else:
|
||||
@ -209,10 +211,9 @@ def _matcher(subject, pattern):
|
||||
|
||||
Pattern is either a tuple of allowed subjects or a `MATCH_ALL`.
|
||||
"""
|
||||
if isinstance(pattern, tuple) \
|
||||
and isinstance(pattern[0], str) and pattern[0].startswith('/'):
|
||||
if isinstance(pattern, str) and pattern.startswith('/'):
|
||||
try:
|
||||
return subject % float(pattern[0].lstrip('/')) == 0
|
||||
return subject % float(pattern.lstrip('/')) == 0
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user