Skip to content

Commit

Permalink
fix: include exception message for codacy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
newgene committed Dec 17, 2024
1 parent afebce2 commit 835b968
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions biothings_client/client/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ async def _set_caching(self, cache_db: Union[str, Path] = None, **kwargs) -> Non
:return: None
"""
if _CACHING_NOT_SUPPORTED:
raise CachingNotSupportedError()
raise CachingNotSupportedError("Caching is only supported for Python 3.8+")

if _CACHING:
if not self.caching_enabled:
Expand Down Expand Up @@ -355,7 +355,7 @@ async def _stop_caching(self) -> None:
:return: None
"""
if _CACHING_NOT_SUPPORTED:
raise CachingNotSupportedError()
raise CachingNotSupportedError("Caching is only supported for Python 3.8+")

if _CACHING:
if self.caching_enabled:
Expand Down Expand Up @@ -387,7 +387,7 @@ async def _clear_cache(self) -> None:
but the data stored in the cache stored will be dropped
"""
if _CACHING_NOT_SUPPORTED:
raise CachingNotSupportedError()
raise CachingNotSupportedError("Caching is only supported for Python 3.8+")

if _CACHING:
if self.caching_enabled:
Expand Down
6 changes: 3 additions & 3 deletions biothings_client/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def _set_caching(self, cache_db: Union[str, Path] = None, **kwargs) -> None:
:return: None
"""
if _CACHING_NOT_SUPPORTED:
raise CachingNotSupportedError()
raise CachingNotSupportedError("Caching is only supported for Python 3.8+")

if _CACHING:
if not self.caching_enabled:
Expand Down Expand Up @@ -347,7 +347,7 @@ def _stop_caching(self) -> None:
:return: None
"""
if _CACHING_NOT_SUPPORTED:
raise CachingNotSupportedError()
raise CachingNotSupportedError("Caching is only supported for Python 3.8+")

if _CACHING:
if self.caching_enabled:
Expand Down Expand Up @@ -385,7 +385,7 @@ def _clear_cache(self) -> None:
:return: None
"""
if _CACHING_NOT_SUPPORTED:
raise CachingNotSupportedError()
raise CachingNotSupportedError("Caching is only supported for Python 3.8+")

if _CACHING:
if self.caching_enabled:
Expand Down
4 changes: 1 addition & 3 deletions biothings_client/client/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,4 @@ def __init__(self, optional_function_access: str, optional_group: str, libraries


class CachingNotSupportedError(Exception):
def __init__(self, message: str):
message = f"Caching is only supported for Python 3.8+\n{message}"
super().__init__(message)
pass

0 comments on commit 835b968

Please sign in to comment.