From 0e1596d4f9168236cff3d060152fe42d04451b65 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 22:31:49 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- crystal_toolkit/__init__.py | 2 +- crystal_toolkit/helpers/layouts.py | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/crystal_toolkit/__init__.py b/crystal_toolkit/__init__.py index 15778456..88de798c 100644 --- a/crystal_toolkit/__init__.py +++ b/crystal_toolkit/__init__.py @@ -5,6 +5,7 @@ from monty.json import MSONable +import crystal_toolkit.helpers.layouts as ctl from crystal_toolkit.core.jupyter import patch_msonable from crystal_toolkit.renderables import ( Lattice, @@ -16,7 +17,6 @@ StructureGraph, VolumetricData, ) -import crystal_toolkit.helpers.layouts as ctl patch_msonable() diff --git a/crystal_toolkit/helpers/layouts.py b/crystal_toolkit/helpers/layouts.py index f84ade69..996696b5 100644 --- a/crystal_toolkit/helpers/layouts.py +++ b/crystal_toolkit/helpers/layouts.py @@ -1,21 +1,22 @@ """ -Helper methods to make working with Bulma classes easier. This file incorporates +Helper methods to make working with Bulma classes easier. This file incorporates language from the Bulma documentation. See https://github.com/jgthms/bulma/blob/master/LICENSE """ from __future__ import annotations import warnings -from typing import Any, Literal, TypeAlias, Union, Sequence +from typing import TYPE_CHECKING, Any, Literal, Sequence, TypeAlias from uuid import uuid4 import dash_mp_components as mpc from dash import dcc, html -from dash.development.base_component import Component from monty.serialization import loadfn from crystal_toolkit.settings import SETTINGS +if TYPE_CHECKING: + from dash.development.base_component import Component BulmaSize: TypeAlias = Literal["small", "normal", "medium", "large"] @@ -683,7 +684,7 @@ def __init__( class Breadcrumb(html.Nav): def __init__( self, - parts: Sequence[tuple[Union[str, Component], str]], + parts: Sequence[tuple[str | Component, str]], alignment: Literal["centered", "right"] | None = None, separator: Literal["arrow", "bullet", "dot", "succeeds"] | None = None, size: Literal["small", "medium", "large"] | None = None, @@ -1273,10 +1274,7 @@ def __init__(self, *args, **kwargs) -> None: FONT_AWESOME_CSS = {"external_url": SETTINGS.FONT_AWESOME_CSS_URL} -if SETTINGS.DOI_CACHE_PATH: - DOI_CACHE = loadfn(SETTINGS.DOI_CACHE_PATH) -else: - DOI_CACHE = {} +DOI_CACHE = loadfn(SETTINGS.DOI_CACHE_PATH) if SETTINGS.DOI_CACHE_PATH else {} def get_table(rows: list[list[Any]], header: list[str] | None = None) -> html.Table: