File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5+ from functools import lru_cache
56import logging
67from typing import TYPE_CHECKING , Any , Final , Literal
78
2526_MIN_VERSION_UNSUPPORTED : Final = AwesomeVersion ("2.0.0" )
2627
2728
29+ @lru_cache (maxsize = 2 )
30+ def _version_is_supported (version : AwesomeVersion ) -> bool :
31+ """Check if the server version is supported."""
32+ return _MIN_VERSION_SUPPORTED <= version < _MIN_VERSION_UNSUPPORTED
33+
34+
2835class _BaseClient :
2936 """Base client for go2rtc."""
3037
@@ -149,11 +156,7 @@ async def validate_server_version(self) -> AwesomeVersion:
149156 """Validate the server version is compatible."""
150157 application_info = await self .application .get_info ()
151158 try :
152- version_supported = (
153- _MIN_VERSION_SUPPORTED
154- <= application_info .version
155- < _MIN_VERSION_UNSUPPORTED
156- )
159+ version_supported = _version_is_supported (application_info .version )
157160 except AwesomeVersionException as err :
158161 raise Go2RtcVersionError (
159162 application_info .version if application_info else "unknown" ,
You can’t perform that action at this time.
0 commit comments