Skip to content

Commit

Permalink
chore: refactor to comply with lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikita95 committed Sep 19, 2024
1 parent aeee10a commit 1be78b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/writer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@
)
PROPER_UI_INIT = False

def _raise_ui_runtime_error():
raise RuntimeError(
"UI module is unavailable – Writer Framework is not properly built. " +
def _get_ui_runtime_error_message() -> str:
return "UI module is unavailable – Writer Framework is not properly built. " + \
"Please refer to CONTRIBUTING.md for instructions to resolve this issue."
)

VERSION = importlib.metadata.version("writer")

Expand Down Expand Up @@ -96,7 +94,7 @@ def init_ui() -> WriterUIManager:
if PROPER_UI_INIT:
return WriterUIManager()
else:
_raise_ui_runtime_error()
raise RuntimeError(_get_ui_runtime_error_message())


def init_state(raw_state: Dict[str, Any], schema: Optional[Type[S]] = None) -> Union[S, WriterState]:
Expand Down
4 changes: 2 additions & 2 deletions src/writer/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2529,12 +2529,12 @@ def _event_handler_session_info() -> Dict[str, Any]:
return session_info

def _event_handler_ui_manager():
from writer import PROPER_UI_INIT, _raise_ui_runtime_error
from writer import PROPER_UI_INIT, _get_ui_runtime_error_message
if PROPER_UI_INIT:
from writer.ui import WriterUIManager
return WriterUIManager()
else:
_raise_ui_runtime_error()
raise RuntimeError(_get_ui_runtime_error_message())


def _split_record_as_pandas_record_and_index(param: dict, index_columns: list) -> Tuple[dict, tuple]:
Expand Down

0 comments on commit 1be78b8

Please sign in to comment.