Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand All @@ -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]
8 changes: 4 additions & 4 deletions crystal_toolkit/apps/examples/mpcontribs/catalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
}
Expand Down
2 changes: 1 addition & 1 deletion crystal_toolkit/components/diffraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion crystal_toolkit/components/diffraction_tem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions crystal_toolkit/components/submit_snl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions crystal_toolkit/core/legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down
Loading