Skip to content

Commit 0ef7039

Browse files
authored
Dashboard: Simplify imports (#837)
* centralize vuetify import into dashboard/__init__.py * centralize setup_server import * simplify some more imports * move some __main__.py imports to __init__.py * centralize some analyze imports
1 parent 73ab343 commit 0ef7039

File tree

25 files changed

+93
-70
lines changed

25 files changed

+93
-70
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from .analyzeFunctions import AnalyzeFunctions
2+
from .plot_ParameterEvolutionOverS.overS import line_plot_1d
3+
4+
__all__ = [
5+
"AnalyzeFunctions",
6+
"line_plot_1d",
7+
]

src/python/impactx/dashboard/Analyze/analyzeFunctions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import pandas as pd
1010

11-
from ..trame_setup import setup_server
11+
from .. import setup_server
1212

1313
server, state, ctrl = setup_server()
1414

src/python/impactx/dashboard/Analyze/plotsMain.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
import glob
1010
import os
1111

12-
from trame.widgets import matplotlib, plotly, vuetify
12+
from trame.widgets import matplotlib, plotly
1313

14-
from ..trame_setup import setup_server
15-
from .analyzeFunctions import AnalyzeFunctions
16-
from .plot_ParameterEvolutionOverS.overS import line_plot_1d
14+
from .. import setup_server, vuetify
15+
from . import AnalyzeFunctions, line_plot_1d
1716

1817
server, state, ctrl = setup_server()
1918

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
from trame.widgets import vuetify as vuetify
2-
3-
from ..trame_setup import setup_server
41
from .components import CardComponents, InputComponents, NavigationComponents
52
from .defaults import DashboardDefaults
63
from .generalFunctions import generalFunctions
74

85
__all__ = [
96
"InputComponents",
107
"CardComponents",
11-
"vuetify",
128
"DashboardDefaults",
139
"NavigationComponents",
1410
"generalFunctions",
15-
"setup_server",
1611
]

src/python/impactx/dashboard/Input/components.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Optional
22

3-
from . import setup_server, vuetify
3+
from .. import setup_server, vuetify
44
from .generalFunctions import generalFunctions
55

66
server, state, ctrl = setup_server()

src/python/impactx/dashboard/Input/csrConfiguration/csrMain.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from .. import CardComponents, InputComponents, setup_server, vuetify
1+
from ... import setup_server, vuetify
2+
from .. import CardComponents, InputComponents
23

34
server, state, ctrl = setup_server()
45

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from .distributionFunctions import DistributionFunctions
2+
3+
__all__ = [
4+
"DistributionFunctions",
5+
]

src/python/impactx/dashboard/Input/distributionParameters/distributionFunctions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ...trame_setup import setup_server
1+
from ... import setup_server
22

33
server, state, ctrl = setup_server()
44

src/python/impactx/dashboard/Input/distributionParameters/distributionMain.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,9 @@
1212

1313
from impactx import distribution
1414

15-
from .. import (
16-
CardComponents,
17-
DashboardDefaults,
18-
InputComponents,
19-
generalFunctions,
20-
setup_server,
21-
vuetify,
22-
)
23-
from .distributionFunctions import DistributionFunctions
15+
from ... import setup_server, vuetify
16+
from .. import CardComponents, DashboardDefaults, InputComponents, generalFunctions
17+
from . import DistributionFunctions
2418

2519
server, state, ctrl = setup_server()
2620

src/python/impactx/dashboard/Input/generalFunctions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import subprocess
1313
import webbrowser
1414

15-
from ..trame_setup import setup_server
15+
from .. import setup_server
1616
from .defaults import DashboardDefaults
1717

1818
server, state, ctrl = setup_server()

0 commit comments

Comments
 (0)