diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c65ad29c..49fc5d90 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ exclude: ^(docs/.+|.*lock.*|jupyterlab-extension/.+|.*\.(svg|js|css))|_version.p repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.0 + rev: v0.12.2 hooks: - id: ruff args: [--fix, --ignore, D] @@ -23,7 +23,7 @@ repos: # - id: mypy - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-case-conflict - id: check-symlinks @@ -33,14 +33,14 @@ repos: - id: trailing-whitespace - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: v2.4.1 hooks: - id: codespell stages: [pre-commit, commit-msg] args: [--ignore-words-list, "nd,te,ois,dscribe", --check-filenames] - repo: https://github.com/kynan/nbstripout - rev: 0.7.1 + rev: 0.8.1 hooks: - id: nbstripout args: [--drop-empty-cells, --keep-output] diff --git a/crystal_toolkit/apps/examples/mpcontribs/catalysis.py b/crystal_toolkit/apps/examples/mpcontribs/catalysis.py index 717a9587..80018fcf 100644 --- a/crystal_toolkit/apps/examples/mpcontribs/catalysis.py +++ b/crystal_toolkit/apps/examples/mpcontribs/catalysis.py @@ -436,15 +436,15 @@ def get_search_layout(self, payload=None): "Surface Formula": unicodeify(contribution["formula"]), "Surface Material ID": dcc.Link( contribution["data"]["mpid"], - href=f'/materials/{contribution["data"]["mpid"]}', + href=f"/materials/{contribution['data']['mpid']}", ), "Adsorbate SMILES": adsorbate_smiles, "Adsorbate IUPAC Formula": contribution["data"]["adsorbateIUPACFormula"], "Adsorption Energy": contribution["data"]["adsorptionEnergy"]["value"], "Miller Index": unicodeify_spacegroup( - f'({int(contribution["data"]["h"]["value"])} ' - f'{int(contribution["data"]["k"]["value"])} ' - f'{int(contribution["data"]["l"]["value"])})' + f"({int(contribution['data']['h']['value'])} " + f"{int(contribution['data']['k']['value'])} " + f"{int(contribution['data']['l']['value'])})" ), "Surface Shift": contribution["data"]["surfaceShift"]["value"], } diff --git a/crystal_toolkit/components/diffraction.py b/crystal_toolkit/components/diffraction.py index 1696106a..d783dbd5 100644 --- a/crystal_toolkit/components/diffraction.py +++ b/crystal_toolkit/components/diffraction.py @@ -207,7 +207,7 @@ def _sub_layouts(self) -> dict[str, Component]: help_str="This defines the wavelength of the incident X-ray radiation.", options=[ { - "label": f'{name.replace("a", "α").replace("b", "β")} ({wavelength:.3f} Å)', # noqa: RUF001 + "label": f"{name.replace('a', 'α').replace('b', 'β')} ({wavelength:.3f} Å)", # noqa: RUF001 "value": name, } for name, wavelength in WAVELENGTHS.items() diff --git a/crystal_toolkit/components/diffraction_tem.py b/crystal_toolkit/components/diffraction_tem.py index 3053e3c7..25385b01 100644 --- a/crystal_toolkit/components/diffraction_tem.py +++ b/crystal_toolkit/components/diffraction_tem.py @@ -294,7 +294,7 @@ def get_plot_2d( pattern, thickness=thickness, zone_axis_lattice=beam_direction ) - print(f"Generated pattern in {time()-t0:.3f} seconds") + print(f"Generated pattern in {time() - t0:.3f} seconds") # generate plotly Figure return self.pointlist_to_spots(pattern, beam_direction, gamma) diff --git a/crystal_toolkit/components/submit_snl.py b/crystal_toolkit/components/submit_snl.py index 709a3600..77ff5c96 100644 --- a/crystal_toolkit/components/submit_snl.py +++ b/crystal_toolkit/components/submit_snl.py @@ -115,8 +115,8 @@ def generate_description(structure, comments, panel_open, url): description = dcc.Markdown( f""" > **Structure to upload:** {structure.composition.reduced_formula} ({len(structure)} sites) -> **Name:** {contents['first_name']} {contents['last_name']} -> **Email:** {contents['email']} +> **Name:** {contents["first_name"]} {contents["last_name"]} +> **Email:** {contents["email"]} > **Comment:** {comments} This information is stored so that we can give credit to you on the Materials diff --git a/crystal_toolkit/core/legend.py b/crystal_toolkit/core/legend.py index 19a779c5..03d23693 100644 --- a/crystal_toolkit/core/legend.py +++ b/crystal_toolkit/core/legend.py @@ -279,8 +279,7 @@ def get_color(self, sp: Species | Element, site: Site | None = None) -> str: elif self.color_scheme in self.site_prop_types.get("scalar", []): if not site: raise ValueError( - "Requires a site for context to get the " - "appropriate site property." + "Requires a site for context to get the appropriate site property." ) prop = site.properties[self.color_scheme] @@ -301,8 +300,7 @@ def get_color(self, sp: Species | Element, site: Site | None = None) -> str: elif self.color_scheme in self.site_prop_types.get("categorical", []): if not site: raise ValueError( - "Requires a site for context to get the " - "appropriate site property." + "Requires a site for context to get the appropriate site property." ) prop = site.properties[self.color_scheme] diff --git a/tests/test_utils.py b/tests/test_utils.py index 06ca832e..8ba66d7f 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -10,7 +10,7 @@ from crystal_toolkit.helpers.utils import hook_up_fig_with_struct_viewer -@pytest.fixture() +@pytest.fixture def sample_df() -> pd.DataFrame: """Create sample data for testing.""" # Create a simple structure @@ -33,7 +33,7 @@ def sample_df() -> pd.DataFrame: ).set_index("material_id", drop=False) -@pytest.fixture() +@pytest.fixture def fig(sample_df: pd.DataFrame) -> go.Figure: # Create a simple scatter plot return px.scatter(