From 506c3a353b01d449ef5054021ae8f373d57a779d Mon Sep 17 00:00:00 2001 From: Alexander Sokol Date: Thu, 26 Sep 2024 18:26:45 -0400 Subject: [PATCH] Run code formatters. --- cl/runtime/__main__.py | 7 ++++--- cl/runtime/log/exceptions/user_error.py | 6 +++--- cl/runtime/log/log_entry.py | 1 - cl/runtime/log/log_entry_key.py | 1 - cl/runtime/routers/entity/panel_response_util.py | 1 - cl/runtime/schema/handler_declare_block_decl.py | 3 +-- stubs/cl/runtime/views/stub_plots.py | 5 ++--- stubs/cl/runtime/views/stub_plots_key.py | 1 - 8 files changed, 10 insertions(+), 15 deletions(-) diff --git a/cl/runtime/__main__.py b/cl/runtime/__main__.py index c6f74660..62d9ad0d 100644 --- a/cl/runtime/__main__.py +++ b/cl/runtime/__main__.py @@ -11,11 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import os import traceback import uuid -from datetime import datetime, timezone - +from datetime import datetime +from datetime import timezone import uvicorn from fastapi import FastAPI from starlette.middleware.cors import CORSMiddleware @@ -62,7 +63,7 @@ async def handle_exception(request, exc, log_level): id=str(uuid.uuid4()), message=str(exc), level=log_level, - timestamp=DatetimeUtil.to_iso_int(DatetimeUtil.now()) + timestamp=DatetimeUtil.to_iso_int(DatetimeUtil.now()), ) Context.current().save_one(entry) diff --git a/cl/runtime/log/exceptions/user_error.py b/cl/runtime/log/exceptions/user_error.py index 8eaea25a..1d6ff462 100644 --- a/cl/runtime/log/exceptions/user_error.py +++ b/cl/runtime/log/exceptions/user_error.py @@ -16,12 +16,12 @@ class UserError(Exception): """Custom exception for user-related errors.""" - def __init__(self, message='A user error occurred', username=None): + def __init__(self, message="A user error occurred", username=None): super().__init__(message) self.username = username def __str__(self): - message = f'UserError: {self.args[0]}' + message = f"UserError: {self.args[0]}" if self.username: - message += f' (User: {self.username})' + message += f" (User: {self.username})" return message diff --git a/cl/runtime/log/log_entry.py b/cl/runtime/log/log_entry.py index 24e4d0ec..70362653 100644 --- a/cl/runtime/log/log_entry.py +++ b/cl/runtime/log/log_entry.py @@ -13,7 +13,6 @@ # limitations under the License. from dataclasses import dataclass - from cl.runtime import RecordMixin from cl.runtime.log.log_entry_key import LogEntryKey from cl.runtime.log.log_entry_level_enum import LogEntryLevelEnum diff --git a/cl/runtime/log/log_entry_key.py b/cl/runtime/log/log_entry_key.py index aee83d11..daa05d6e 100644 --- a/cl/runtime/log/log_entry_key.py +++ b/cl/runtime/log/log_entry_key.py @@ -14,7 +14,6 @@ from dataclasses import dataclass from typing import Type - from cl.runtime.records.dataclasses_extensions import missing from cl.runtime.records.key_mixin import KeyMixin diff --git a/cl/runtime/routers/entity/panel_response_util.py b/cl/runtime/routers/entity/panel_response_util.py index 139b4590..db9e7fdf 100644 --- a/cl/runtime/routers/entity/panel_response_util.py +++ b/cl/runtime/routers/entity/panel_response_util.py @@ -18,7 +18,6 @@ from typing import Any from typing import Dict from typing import List - from matplotlib.figure import Figure from pydantic import BaseModel from cl.runtime.context.context import Context diff --git a/cl/runtime/schema/handler_declare_block_decl.py b/cl/runtime/schema/handler_declare_block_decl.py index 264b15d3..9134fb09 100644 --- a/cl/runtime/schema/handler_declare_block_decl.py +++ b/cl/runtime/schema/handler_declare_block_decl.py @@ -58,8 +58,7 @@ def get_type_methods(cls, record_type: type, inherit: bool = False) -> "HandlerD # It does not matter if it is a classmethod or staticmethod from UI perspective # (they are both considered static) isinstance(inspect.getattr_static(record_type, member_name), staticmethod) - or - isinstance(inspect.getattr_static(record_type, member_name), classmethod) + or isinstance(inspect.getattr_static(record_type, member_name), classmethod) ) # TODO: Add labels support diff --git a/stubs/cl/runtime/views/stub_plots.py b/stubs/cl/runtime/views/stub_plots.py index b09dcc35..944063ad 100644 --- a/stubs/cl/runtime/views/stub_plots.py +++ b/stubs/cl/runtime/views/stub_plots.py @@ -14,10 +14,9 @@ from dataclasses import dataclass from pathlib import Path - import pandas as pd - -from cl.runtime import RecordMixin, viewer +from cl.runtime import RecordMixin +from cl.runtime import viewer from cl.runtime.backend.core.ui_app_state import UiAppState from cl.runtime.plots.confusion_matrix_plot import ConfusionMatrixPlot from cl.runtime.plots.confusion_matrix_plot_style import ConfusionMatrixPlotStyle diff --git a/stubs/cl/runtime/views/stub_plots_key.py b/stubs/cl/runtime/views/stub_plots_key.py index a30a985a..65f33990 100644 --- a/stubs/cl/runtime/views/stub_plots_key.py +++ b/stubs/cl/runtime/views/stub_plots_key.py @@ -14,7 +14,6 @@ from dataclasses import dataclass from typing import Type - from cl.runtime.records.dataclasses_extensions import field from cl.runtime.records.key_mixin import KeyMixin