Skip to content

Commit 6a7cf6b

Browse files
committed
fix black issues
1 parent d337c00 commit 6a7cf6b

9 files changed

Lines changed: 308 additions & 252 deletions

File tree

docs/source/conf.py

Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@
3232
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3333
# ones.
3434
extensions = [
35-
'sphinx.ext.autodoc',
36-
'sphinx.ext.autosummary',
37-
'sphinx.ext.githubpages',
38-
'sphinx.ext.intersphinx',
39-
'sphinx.ext.mathjax',
40-
'sphinx.ext.viewcode',
41-
'IPython.sphinxext.ipython_directive',
42-
'IPython.sphinxext.ipython_console_highlighting',
43-
'matplotlib.sphinxext.plot_directive',
44-
'numpydoc',
45-
'sphinx_copybutton',
35+
"sphinx.ext.autodoc",
36+
"sphinx.ext.autosummary",
37+
"sphinx.ext.githubpages",
38+
"sphinx.ext.intersphinx",
39+
"sphinx.ext.mathjax",
40+
"sphinx.ext.viewcode",
41+
"IPython.sphinxext.ipython_directive",
42+
"IPython.sphinxext.ipython_console_highlighting",
43+
"matplotlib.sphinxext.plot_directive",
44+
"numpydoc",
45+
"sphinx_copybutton",
4646
]
4747

4848
# Configuration options for plot_directive. See:
@@ -55,21 +55,21 @@
5555
numpydoc_show_class_members = False
5656

5757
# Add any paths that contain templates here, relative to this directory.
58-
templates_path = ['_templates']
58+
templates_path = ["_templates"]
5959

6060
# The suffix(es) of source filenames.
6161
# You can specify multiple suffix as a list of string:
6262
#
6363
# source_suffix = ['.rst', '.md']
64-
source_suffix = '.rst'
64+
source_suffix = ".rst"
6565

6666
# The master toctree document.
67-
master_doc = 'index'
67+
master_doc = "index"
6868

6969
# General information about the project.
70-
project = 'qt-epics'
71-
copyright = '2020, Jun Aishima'
72-
author = 'Jun Aishima'
70+
project = "qt-epics"
71+
copyright = "2020, Jun Aishima"
72+
author = "Jun Aishima"
7373

7474
# The version info for the project you're documenting, acts as replacement for
7575
# |version| and |release|, also used in various other places throughout the
@@ -95,7 +95,7 @@
9595
exclude_patterns = []
9696

9797
# The name of the Pygments (syntax highlighting) style to use.
98-
pygments_style = 'sphinx'
98+
pygments_style = "sphinx"
9999

100100
# If true, `todo` and `todoList` produce output, else they produce nothing.
101101
todo_include_todos = False
@@ -106,7 +106,7 @@
106106
# The theme to use for HTML and HTML Help pages. See the documentation for
107107
# a list of builtin themes.
108108
#
109-
html_theme = 'sphinx_rtd_theme'
109+
html_theme = "sphinx_rtd_theme"
110110
import sphinx_rtd_theme
111111

112112
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
@@ -120,25 +120,25 @@
120120
# Add any paths that contain custom static files (such as style sheets) here,
121121
# relative to this directory. They are copied after the builtin static files,
122122
# so a file named "default.css" will overwrite the builtin "default.css".
123-
html_static_path = ['_static']
123+
html_static_path = ["_static"]
124124

125125
# Custom sidebar templates, must be a dictionary that maps document names
126126
# to template names.
127127
#
128128
# This is required for the alabaster theme
129129
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
130130
html_sidebars = {
131-
'**': [
132-
'relations.html', # needs 'show_related': True theme option to display
133-
'searchbox.html',
131+
"**": [
132+
"relations.html", # needs 'show_related': True theme option to display
133+
"searchbox.html",
134134
]
135135
}
136136

137137

138138
# -- Options for HTMLHelp output ------------------------------------------
139139

140140
# Output file base name for HTML help builder.
141-
htmlhelp_basename = 'qt-epics'
141+
htmlhelp_basename = "qt-epics"
142142

143143

144144
# -- Options for LaTeX output ---------------------------------------------
@@ -147,15 +147,12 @@
147147
# The paper size ('letterpaper' or 'a4paper').
148148
#
149149
# 'papersize': 'letterpaper',
150-
151150
# The font size ('10pt', '11pt' or '12pt').
152151
#
153152
# 'pointsize': '10pt',
154-
155153
# Additional stuff for the LaTeX preamble.
156154
#
157155
# 'preamble': '',
158-
159156
# Latex figure (float) alignment
160157
#
161158
# 'figure_align': 'htbp',
@@ -165,19 +162,15 @@
165162
# (source start file, target name, title,
166163
# author, documentclass [howto, manual, or own class]).
167164
latex_documents = [
168-
(master_doc, 'qt-epics.tex', 'qt-epics Documentation',
169-
'Contributors', 'manual'),
165+
(master_doc, "qt-epics.tex", "qt-epics Documentation", "Contributors", "manual"),
170166
]
171167

172168

173169
# -- Options for manual page output ---------------------------------------
174170

175171
# One entry per manual page. List of tuples
176172
# (source start file, name, description, authors, manual section).
177-
man_pages = [
178-
(master_doc, 'qt-epics', 'qt-epics Documentation',
179-
[author], 1)
180-
]
173+
man_pages = [(master_doc, "qt-epics", "qt-epics Documentation", [author], 1)]
181174

182175

183176
# -- Options for Texinfo output -------------------------------------------
@@ -186,19 +179,23 @@
186179
# (source start file, target name, title, author,
187180
# dir menu entry, description, category)
188181
texinfo_documents = [
189-
(master_doc, 'qt-epics', 'qt-epics Documentation',
190-
author, 'qt-epics', 'Qt-based widgets for PyEpics devices',
191-
'Miscellaneous'),
182+
(
183+
master_doc,
184+
"qt-epics",
185+
"qt-epics Documentation",
186+
author,
187+
"qt-epics",
188+
"Qt-based widgets for PyEpics devices",
189+
"Miscellaneous",
190+
),
192191
]
193192

194193

195-
196-
197194
# Example configuration for intersphinx: refer to the Python standard library.
198195
intersphinx_mapping = {
199-
'python': ('https://docs.python.org/3/', None),
200-
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
201-
'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
202-
'pandas': ('https://pandas.pydata.org/pandas-docs/stable', None),
203-
'matplotlib': ('https://matplotlib.org', None),
196+
"python": ("https://docs.python.org/3/", None),
197+
"numpy": ("https://docs.scipy.org/doc/numpy/", None),
198+
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", None),
199+
"pandas": ("https://pandas.pydata.org/pandas-docs/stable", None),
200+
"matplotlib": ("https://matplotlib.org", None),
204201
}

qt_epics/QtEpicsBaseWidget.py

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
from epics import PV
1313
from qtpy import QtCore, QtWidgets
1414

15-
STOPIFACTIVESIGNAL = 'stopifactive'
16-
STARTSIGNAL = 'start'
15+
STOPIFACTIVESIGNAL = "stopifactive"
16+
STARTSIGNAL = "start"
1717

1818

1919
class QtEpicsBaseWidget(QtWidgets.QWidget):
@@ -22,11 +22,20 @@ class QtEpicsBaseWidget(QtWidgets.QWidget):
2222
and the field is updated when the PV changes
2323
2424
"""
25+
2526
changeColor = QtCore.Signal(str)
2627
timerSignal = QtCore.Signal(str)
2728

28-
def __init__(self, pvname, parent, input_width, precision=2, editable=False, highlight_on_change=True,
29-
highlight_interval=2000):
29+
def __init__(
30+
self,
31+
pvname,
32+
parent,
33+
input_width,
34+
precision=2,
35+
editable=False,
36+
highlight_on_change=True,
37+
highlight_interval=2000,
38+
):
3039
"""
3140
3241
Inputs:
@@ -64,14 +73,14 @@ def __init__(self, pvname, parent, input_width, precision=2, editable=False, hig
6473
self.base_pv.get_ctrlvars()
6574

6675
self.enum_strs = None
67-
if("enum" in self.base_pv.type):
76+
if "enum" in self.base_pv.type:
6877
self.enum_strs = self.base_pv.enum_strs
6978

7079
self.__createWidget()
7180

7281
self.changeColor.connect(self.setColor)
7382

74-
if (input_width != 0):
83+
if input_width != 0:
7584
self.entry.setFixedWidth(input_width)
7685
time.sleep(0.05)
7786

@@ -82,11 +91,13 @@ def __init__(self, pvname, parent, input_width, precision=2, editable=False, hig
8291
self.entry.setText(self.entry_var)
8392
self.changeColor.emit("white")
8493
return
85-
'''
94+
95+
"""
8696
CALLBACKS SECTION
87-
'''
97+
"""
98+
8899
def _conCB(self, conn, **kwargs):
89-
if (conn):
100+
if conn:
90101
self.changeColor.emit("blue")
91102
# self.entry.configure(background="#729fff")
92103
else:
@@ -101,14 +112,15 @@ def _valueChangeCB(self, value, char_value, **kwargs):
101112
except Exception:
102113
pass
103114

104-
'''
115+
"""
105116
HELPER FUNCTIONS SECTION
106-
'''
117+
"""
118+
107119
def _set_entry_var_with_precision(self, inval):
108120
try:
109121
val = float(inval)
110-
if (self.precision in range(0, 5)):
111-
fmtStr = "%."+str(self.precision)+"f"
122+
if self.precision in range(0, 5):
123+
fmtStr = "%." + str(self.precision) + "f"
112124
self.entry_var = fmtStr % val
113125
else:
114126
self.entry_var = "%.5f" % val
@@ -118,18 +130,18 @@ def _set_entry_var_with_precision(self, inval):
118130
self.entry_var = str(inval)
119131

120132
def __createWidget(self):
121-
if(self.editable):
133+
if self.editable:
122134
self.entry = QtWidgets.QLineEdit(self.parent)
123135
else:
124136
self.entry = QtWidgets.QLabel(self.parent)
125137

126138
def __updateValue(self, value, skipHighlight=False):
127-
if(self.enum_strs is None):
139+
if self.enum_strs is None:
128140
self._set_entry_var_with_precision(value)
129141
else:
130142
self._set_entry_var_with_precision(self.enum_strs[value])
131143
self.entry.setText(self.entry_var)
132-
if(self.highlight_on_change and not skipHighlight):
144+
if self.highlight_on_change and not skipHighlight:
133145
self.changeColor.emit("#99FF66")
134146
self.timerSignal.emit(STARTSIGNAL)
135147

@@ -143,9 +155,11 @@ def timerSignalHandler(self, command):
143155
elif command == STOPIFACTIVESIGNAL:
144156
if self.timer.isActive():
145157
self.timer.stop()
146-
'''
158+
159+
"""
147160
GETTERS/SETTERS SECTION
148-
'''
161+
"""
162+
149163
def getEntry(self):
150164
return self.entry
151165

qt_epics/QtEpicsMotorEntry.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class QtEpicsMotorEntry(QtEpicsMotorWidget):
1717
and the field is updated when the PV changes
1818
1919
"""
20+
2021
def __init__(self, pvname, parent, input_width, precision=2):
2122
"""
2223

qt_epics/QtEpicsMotorWidget.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class QtEpicsMotorWidget(QtWidgets.QWidget):
1919
and the field is updated when the PV changes
2020
2121
"""
22+
2223
changeColor = QtCore.Signal(str)
2324

2425
def __init__(self, pvname, parent, input_width, precision=2, editable=False):
@@ -46,15 +47,15 @@ def __init__(self, pvname, parent, input_width, precision=2, editable=False):
4647
self.entry_var = ""
4748

4849
# Creates the PV
49-
self.entry_pv = PV(pvname+".RBV", connection_callback=self._conCB)
50+
self.entry_pv = PV(pvname + ".RBV", connection_callback=self._conCB)
5051
self.base_pv = PV(pvname)
5152

52-
if(self.editable):
53+
if self.editable:
5354
self.entry = QtWidgets.QLineEdit(parent)
5455
else:
5556
self.entry = QtWidgets.QLabel(parent)
5657

57-
if (input_width != 0):
58+
if input_width != 0:
5859
self.entry.setFixedWidth(input_width)
5960
time.sleep(0.05)
6061

@@ -69,12 +70,12 @@ def __init__(self, pvname, parent, input_width, precision=2, editable=False):
6970

7071
self.changeColor.connect(self.setColor)
7172
self.entry_pv.add_callback(self._entry_pv_movingCb)
72-
self.entry_dmov_pv = PV(pvname+".DMOV")
73+
self.entry_dmov_pv = PV(pvname + ".DMOV")
7374
self.entry_dmov_pv.add_callback(self._entry_pv_dmovCb)
7475

7576
def _conCB(self, conn, **kwargs):
7677

77-
if (conn):
78+
if conn:
7879
self.changeColor.emit("blue")
7980
else:
8081
self.entry_var = "-----"
@@ -86,23 +87,23 @@ def _entry_pv_movingCb(self, value, **kwargs):
8687
self.entry.setText(self.entry_var)
8788

8889
def _entry_pv_dmovCb(self, value, **kwargs):
89-
if (value == 1):
90+
if value == 1:
9091
self.changeColor.emit("None")
9192
else:
9293
self.changeColor.emit("yellow")
9394

9495
def _set_entry_var_with_precision(self, inval):
9596
try:
9697
val = float(inval)
97-
if (self.precision == 0):
98+
if self.precision == 0:
9899
self.entry_var = "%.0f" % val
99-
elif (self.precision == 1):
100+
elif self.precision == 1:
100101
self.entry_var = "%.1f" % val
101-
elif (self.precision == 2):
102+
elif self.precision == 2:
102103
self.entry_var = "%.2f" % val
103-
elif (self.precision == 3):
104+
elif self.precision == 3:
104105
self.entry_var = "%.3f" % val
105-
elif (self.precision == 4):
106+
elif self.precision == 4:
106107
self.entry_var = "%.4f" % val
107108
else:
108109
self.entry_var = "%.5f" % val

qt_epics/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
21
from ._version import get_versions
32

4-
__version__ = get_versions()['version']
3+
__version__ = get_versions()["version"]
54
del get_versions

0 commit comments

Comments
 (0)