Skip to content

Commit 805396c

Browse files
committed
pre-commit run --all-files
1 parent 57754b8 commit 805396c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+441
-532
lines changed

crystal_toolkit/__init__.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@
66
# pleasant hack to support MSONable objects in Dash callbacks natively
77
from monty.json import MSONable
88

9-
from crystal_toolkit.renderables import *
9+
from crystal_toolkit.renderables import (
10+
Lattice,
11+
Molecule,
12+
MoleculeGraph,
13+
PhaseDiagram,
14+
Site,
15+
Structure,
16+
StructureGraph,
17+
VolumetricData,
18+
)
1019

1120
__version__ = "2022.07.25"
1221

@@ -21,7 +30,7 @@ def to_plotly_json(self):
2130

2231

2332
# Populate the default values from the JSON file
24-
_DEFAULTS = defaultdict(lambda: None)
33+
_DEFAULTS = defaultdict()
2534
default_js = _os.path.join(
2635
_os.path.join(_os.path.dirname(_os.path.abspath(__file__))), "./", "defaults.json"
2736
)
@@ -43,8 +52,8 @@ def _repr_mimebundle_(self, include=None, exclude=None):
4352
This only works in Jupyter Lab 3.x or above.\n\n
4453
"""
4554

46-
help_text_plotly = """If you see this text, the Plotly Jupyter Lab extension
47-
is not installed, please consult Plotly documentation for information on how to
55+
help_text_plotly = """If you see this text, the Plotly Jupyter Lab extension
56+
is not installed, please consult Plotly documentation for information on how to
4857
install.
4958
"""
5059

crystal_toolkit/apps/examples/bandstructure.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
# standard Dash imports
2-
import dash
3-
from dash import html
4-
from dash import dcc
1+
import os
52

6-
# standard Crystal Toolkit import
7-
import crystal_toolkit.components as ctc
8-
from crystal_toolkit.settings import SETTINGS
9-
from crystal_toolkit.helpers.layouts import H1, H2, Container
3+
import dash
104

115
# dos and bs data from local jsons
126
from monty.serialization import loadfn
13-
import os
147

8+
# standard Crystal Toolkit import
9+
import crystal_toolkit.components as ctc
10+
from crystal_toolkit.helpers.layouts import H1, Container
11+
from crystal_toolkit.settings import SETTINGS
1512

1613
# create Dash app as normal, assets folder set for visual styles only
1714
app = dash.Dash(assets_folder=SETTINGS.ASSETS_PATH)
@@ -35,7 +32,7 @@
3532

3633
# example layout to demonstrate capabilities of component
3734
my_layout = Container(
38-
[H1("Band Structure and Density of States Example"), bsdos_component.layout(),]
35+
[H1("Band Structure and Density of States Example"), bsdos_component.layout()]
3936
)
4037

4138
# wrap your app.layout with crystal_toolkit_layout()

crystal_toolkit/apps/examples/basic_hello_world.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
# standard Dash imports
21
import dash
32
from dash import html
4-
from dash import dcc
53

64
# standard Crystal Toolkit import
75
import crystal_toolkit.components as ctc

crystal_toolkit/apps/examples/diffraction.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
1-
# standard Dash imports
21
import dash
3-
from dash import html
4-
from dash import dcc
2+
3+
# create our crystal structure using pymatgen
4+
from pymatgen.core.lattice import Lattice
5+
from pymatgen.core.structure import Structure
56

67
# standard Crystal Toolkit import
78
import crystal_toolkit.components as ctc
8-
from crystal_toolkit.settings import SETTINGS
99
from crystal_toolkit.helpers.layouts import H1, H3, Container
10-
11-
# import for this example
12-
from pymatgen.ext.matproj import MPRester
13-
from pymatgen.analysis.phase_diagram import PhaseDiagram
14-
from pymatgen.analysis.diffraction.xrd import XRDCalculator
10+
from crystal_toolkit.settings import SETTINGS
1511

1612
# create Dash app as normal
1713
app = dash.Dash(assets_folder=SETTINGS.ASSETS_PATH)
1814

19-
# create our crystal structure using pymatgen
20-
from pymatgen.core.structure import Structure
21-
from pymatgen.core.lattice import Lattice
2215

2316
structure = Structure(Lattice.cubic(4.2), ["Na", "K"], [[0, 0, 0], [0.5, 0.5, 0.5]])
2417

crystal_toolkit/apps/examples/diffraction_dynamic.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# standard Dash imports
21
import dash
32
from dash.dependencies import Input, Output
43

crystal_toolkit/apps/examples/diffraction_empty.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,24 @@
1-
# standard Dash imports
21
import dash
3-
from dash import html
4-
from dash import dcc
2+
3+
# create our crystal structure using pymatgen
4+
from pymatgen.core.lattice import Lattice
5+
from pymatgen.core.structure import Structure
56

67
# standard Crystal Toolkit import
78
import crystal_toolkit.components as ctc
9+
from crystal_toolkit.helpers.layouts import H1, Container
810
from crystal_toolkit.settings import SETTINGS
9-
from crystal_toolkit.helpers.layouts import H1, H2, Container
10-
11-
# import for this example
12-
from pymatgen.core.structure import Structure
13-
from pymatgen.core.lattice import Lattice
14-
from pymatgen.ext.matproj import MPRester
15-
from pymatgen.analysis.phase_diagram import PhaseDiagram
16-
from pymatgen.analysis.diffraction.xrd import XRDCalculator
1711

1812
# create Dash app as normal
1913
app = dash.Dash(assets_folder=SETTINGS.ASSETS_PATH)
2014

21-
# create our crystal structure using pymatgen
22-
from pymatgen.core.structure import Structure
23-
from pymatgen.core.lattice import Lattice
24-
2515
structure = Structure(Lattice.cubic(4.2), ["Na", "K"], [[0, 0, 0], [0.5, 0.5, 0.5]])
2616

2717
xrd_component = ctc.XRayDiffractionComponent()
2818

2919
# example layout to demonstrate capabilities of component
3020
my_layout = Container(
31-
[H1("XRDComponent Example (Empty, No Structure Defined)"), xrd_component.layout(),]
21+
[H1("XRDComponent Example (Empty, No Structure Defined)"), xrd_component.layout()]
3222
)
3323

3424
# as explained in "preamble" section in documentation

crystal_toolkit/apps/examples/kwarg_inputs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import random
22

33
import dash
4-
from dash import html, dcc, Input, Output
5-
4+
from dash import Input, Output, dcc, html
65
from dash.exceptions import PreventUpdate
76

87
import crystal_toolkit.components as ctc

crystal_toolkit/apps/examples/phase_diagram.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
# standard Dash imports
21
import dash
3-
from dash import dcc
4-
from dash import html
5-
6-
# import for this example
7-
from pymatgen.ext.matproj import MPRester
2+
from dash import dcc, html
83
from pymatgen.analysis.phase_diagram import PhaseDiagram
4+
from pymatgen.ext.matproj import MPRester
95

106
# standard Crystal Toolkit import
117
import crystal_toolkit.components as ctc

crystal_toolkit/apps/examples/pourbaix.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
# standard Dash imports
21
import dash
3-
from dash import dcc
42
from dash import html
5-
6-
# import for this example
73
from pymatgen.ext.matproj import MPRester
84

95
# standard Crystal Toolkit import
@@ -30,7 +26,7 @@
3026
html.H1("PourbaixDiagramComponent Example"),
3127
html.Button("Get Pourbaix Diagram", id="get-pourbaix"),
3228
pourbaix_component.layout(),
33-
html.Div(id="pourbaix-output")
29+
html.Div(id="pourbaix-output"),
3430
]
3531
)
3632

crystal_toolkit/apps/examples/structure.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
# standard Dash imports
21
import dash
32
from dash import html
4-
5-
# import for this example
63
from pymatgen.core.lattice import Lattice
74
from pymatgen.core.structure import Structure
85

0 commit comments

Comments
 (0)