Skip to content

Commit 9e88155

Browse files
committed
remove starred import in crystal_toolkit/apps/main.py
i.e. replace from crystal_toolkit.helpers.layouts import * with explicit imports
1 parent d0f4a92 commit 9e88155

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
repos:
22
- repo: https://github.com/ambv/black
3-
rev: stable
3+
rev: 22.6.0
44
hooks:
55
- id: black

crystal_toolkit/apps/main.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22
import os
3-
from ast import literal_eval
3+
import warnings
44
from random import choice
55
from time import time
66
from typing import Optional
@@ -9,17 +9,28 @@
99

1010
import dash
1111
import sentry_sdk
12+
from dash import dcc, html
1213
from dash.dependencies import Input, Output, State
1314
from dash.exceptions import PreventUpdate
1415
from flask_caching import Cache
1516
from monty.serialization import loadfn
1617
from pymatgen.core import __version__ as pmg_version
17-
from pymatgen.ext.matproj import MPRester
18+
from pymatgen.ext.matproj import MPRester, MPRestError
1819

1920
import crystal_toolkit.components as ctc
2021
from crystal_toolkit import __file__ as module_path
2122
from crystal_toolkit.core.mpcomponent import MPComponent
22-
from crystal_toolkit.helpers.layouts import *
23+
from crystal_toolkit.helpers.layouts import (
24+
Box,
25+
Column,
26+
Columns,
27+
Container,
28+
Loading,
29+
MessageBody,
30+
MessageContainer,
31+
MessageHeader,
32+
Reveal,
33+
)
2334
from crystal_toolkit.settings import SETTINGS
2435

2536
# choose a default structure on load
@@ -196,17 +207,17 @@
196207
mp_panels = []
197208

198209
mp_section = (
199-
H3("Materials Project"),
210+
html.H3("Materials Project"),
200211
html.Div([panel.panel_layout() for panel in mp_panels], id="mp_panels"),
201212
)
202213

203214

204215
body_layout = [
205216
html.Br(),
206-
H3("Transform"),
217+
html.H3("Transform"),
207218
html.Div([transformation_component.layout()]),
208219
html.Br(),
209-
H3("Analyze"),
220+
html.H3("Analyze"),
210221
html.Div([panel.panel_layout() for panel in panels], id="panels"),
211222
# html.Br(),
212223
# *mp_section,
@@ -270,7 +281,7 @@
270281
################################################################################
271282

272283

273-
footer = Footer(
284+
footer = html.Footer(
274285
html.Div(
275286
[
276287
dcc.Markdown(
@@ -317,7 +328,7 @@
317328
[
318329
dcc.Location(id="url", refresh=False),
319330
banner,
320-
Section(
331+
html.Section(
321332
[
322333
Columns(
323334
[
@@ -398,7 +409,7 @@
398409
Columns([Column(body_layout)]),
399410
]
400411
),
401-
Section(footer),
412+
html.Section(footer),
402413
]
403414
)
404415

@@ -524,7 +535,7 @@ def master_update_structure(search_mpid: Optional[str], upload_data: Optional[st
524535
try:
525536
struct = mpr.get_task_data(search_mpid, "structure")[0]["structure"]
526537
print("Struct from task.")
527-
except:
538+
except MPRestError:
528539
struct = mpr.get_structure_by_material_id(search_mpid)
529540
print("Struct from material.")
530541
else:

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,3 @@ profile = "black"
6565
[build-system]
6666
requires = ["poetry>=0.12"]
6767
build-backend = "poetry.masonry.api"
68-

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
max-line-length = 88

0 commit comments

Comments
 (0)