Skip to content

Commit 49945b7

Browse files
committed
Result of running ruff check --fix
1 parent f9d0004 commit 49945b7

File tree

11 files changed

+59
-55
lines changed

11 files changed

+59
-55
lines changed

docs/conf.py

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
#
32
# Configuration file for the Sphinx documentation builder.
43
#
@@ -14,18 +13,18 @@
1413
# If extensions (or modules to document with autodoc) are in another directory,
1514
# add these directories to sys.path here. If the directory is relative to the
1615
# documentation root, use os.path.abspath to make it absolute, like shown here.
17-
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
16+
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
1817

1918
# -- Project information -----------------------------------------------------
2019

21-
project = u'ATIP'
22-
copyright = u'2019, Tobyn Nicholls'
23-
author = u'Tobyn Nicholls'
20+
project = "ATIP"
21+
copyright = "2019, Tobyn Nicholls"
22+
author = "Tobyn Nicholls"
2423

2524
# The short X.Y version
26-
version = u'1.0'
25+
version = "1.0"
2726
# The full version, including alpha/beta/rc tags
28-
release = u'1.0'
27+
release = "1.0"
2928

3029

3130
# -- General configuration ---------------------------------------------------
@@ -38,49 +37,49 @@
3837
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3938
# ones.
4039
extensions = [
41-
'sphinx.ext.autodoc',
42-
'sphinx.ext.intersphinx',
43-
'sphinx.ext.napoleon',
44-
'sphinx.ext.viewcode',
40+
"sphinx.ext.autodoc",
41+
"sphinx.ext.intersphinx",
42+
"sphinx.ext.napoleon",
43+
"sphinx.ext.viewcode",
4544
]
4645

4746
# Include both class and __init__() docstrings.
48-
autoclass_content = 'both'
47+
autoclass_content = "both"
4948

5049
# Add any paths that contain templates here, relative to this directory.
51-
templates_path = ['_templates']
50+
templates_path = ["_templates"]
5251

5352
# The suffix(es) of source filenames.
5453
# You can specify multiple suffix as a list of string:
5554
#
5655
# source_suffix = ['.rst', '.md']
57-
source_suffix = '.rst'
56+
source_suffix = ".rst"
5857

5958
# The master toctree document.
60-
master_doc = 'index'
59+
master_doc = "index"
6160

6261
# The language for content autogenerated by Sphinx. Refer to documentation
6362
# for a list of supported languages.
6463
#
6564
# This is also used if you do content translation via gettext catalogs.
6665
# Usually you set "language" from the command line for these cases.
67-
language = 'en'
66+
language = "en"
6867

6968
# List of patterns, relative to source directory, that match files and
7069
# directories to ignore when looking for source files.
7170
# This pattern also affects html_static_path and html_extra_path.
72-
exclude_patterns = ['_build']
71+
exclude_patterns = ["_build"]
7372

7473
# The name of the Pygments (syntax highlighting) style to use.
75-
pygments_style = 'sphinx'
74+
pygments_style = "sphinx"
7675

7776

7877
# -- Options for HTML output -------------------------------------------------
7978

8079
# The theme to use for HTML and HTML Help pages. See the documentation for
8180
# a list of builtin themes.
8281
#
83-
html_theme = 'sphinx_rtd_theme'
82+
html_theme = "sphinx_rtd_theme"
8483

8584
# Theme options are theme-specific and customize the look and feel of a theme
8685
# further. For a list of options available for each theme, see the
@@ -91,7 +90,7 @@
9190
# Add any paths that contain custom static files (such as style sheets) here,
9291
# relative to this directory. They are copied after the builtin static files,
9392
# so a file named "default.css" will overwrite the builtin "default.css".
94-
#html_static_path = ['_static']
93+
# html_static_path = ['_static']
9594

9695
# Custom sidebar templates, must be a dictionary that maps document names
9796
# to template names.
@@ -107,7 +106,7 @@
107106
# -- Options for HTMLHelp output ---------------------------------------------
108107

109108
# Output file base name for HTML help builder.
110-
htmlhelp_basename = 'docsdoc'
109+
htmlhelp_basename = "docsdoc"
111110

112111

113112
# -- Options for LaTeX output ------------------------------------------------
@@ -116,15 +115,12 @@
116115
# The paper size ('letterpaper' or 'a4paper').
117116
#
118117
# 'papersize': 'letterpaper',
119-
120118
# The font size ('10pt', '11pt' or '12pt').
121119
#
122120
# 'pointsize': '10pt',
123-
124121
# Additional stuff for the LaTeX preamble.
125122
#
126123
# 'preamble': '',
127-
128124
# Latex figure (float) alignment
129125
#
130126
# 'figure_align': 'htbp',
@@ -134,19 +130,15 @@
134130
# (source start file, target name, title,
135131
# author, documentclass [howto, manual, or own class]).
136132
latex_documents = [
137-
(master_doc, 'docs.tex', u'ATIP Documentation',
138-
u'Tobyn Nicholls', 'manual'),
133+
(master_doc, "docs.tex", "ATIP Documentation", "Tobyn Nicholls", "manual"),
139134
]
140135

141136

142137
# -- Options for manual page output ------------------------------------------
143138

144139
# One entry per manual page. List of tuples
145140
# (source start file, name, description, authors, manual section).
146-
man_pages = [
147-
(master_doc, 'docs', u'ATIP Documentation',
148-
[author], 1)
149-
]
141+
man_pages = [(master_doc, "docs", "ATIP Documentation", [author], 1)]
150142

151143

152144
# -- Options for Texinfo output ----------------------------------------------
@@ -155,9 +147,15 @@
155147
# (source start file, target name, title, author,
156148
# dir menu entry, description, category)
157149
texinfo_documents = [
158-
(master_doc, 'docs', u'ATIP Documentation',
159-
author, 'docs', 'ATIP - Accelerator Toolbox Interface for Pytac.',
160-
'Accelerator Physics'),
150+
(
151+
master_doc,
152+
"docs",
153+
"ATIP Documentation",
154+
author,
155+
"docs",
156+
"ATIP - Accelerator Toolbox Interface for Pytac.",
157+
"Accelerator Physics",
158+
),
161159
]
162160

163161

@@ -176,7 +174,7 @@
176174
# epub_uid = ''
177175

178176
# A list of files that should not be packed into the epub file.
179-
epub_exclude_files = ['search.html']
177+
epub_exclude_files = ["search.html"]
180178

181179

182180
# -- Extension configuration -------------------------------------------------
@@ -185,7 +183,7 @@
185183

186184
# Example configuration for intersphinx: refer to the Python standard library.
187185
intersphinx_mapping = {
188-
'python': ('https://docs.python.org/', None),
189-
'pytac': ('https://pytac.readthedocs.io/en/latest/', None),
190-
'cothread': ('https://cothread.readthedocs.io/en/latest/', None)
186+
"python": ("https://docs.python.org/", None),
187+
"pytac": ("https://pytac.readthedocs.io/en/latest/", None),
188+
"cothread": ("https://cothread.readthedocs.io/en/latest/", None),
191189
}

src/atip/simulator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def calculate_optics(
6060
return LatticeData(twiss, beamdata.tune, beamdata.chromaticity, emitdata, radint)
6161

6262

63-
class ATSimulator(object):
63+
class ATSimulator:
6464
"""A centralised class which makes use of AT to simulate the physics data
6565
for the copy of the AT lattice which it holds. It works as follows, when a
6666
change is made to the lattice in Pytac it is added to the queue attribute

src/atip/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def preload_at(at_lat):
7373
class elems:
7474
pass
7575

76-
setattr(elems, "all", [elem for elem in at_lat])
76+
elems.all = [elem for elem in at_lat]
7777
elems_dict = {
7878
type_: []
7979
for type_ in [
@@ -120,7 +120,7 @@ def preload(pytac_lat):
120120
class elems:
121121
pass
122122

123-
setattr(elems, "all", pytac_lat.get_elements())
123+
elems.all = pytac_lat.get_elements()
124124
for family in pytac_lat.get_all_families():
125125
setattr(elems, family, pytac_lat.get_elements(family))
126126
return elems

src/virtac/atip_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from .mirror_objects import collate, refresher, summate, transform
1616

1717

18-
class ATIPServer(object):
18+
class ATIPServer:
1919
"""A soft-ioc server allowing ATIP to be interfaced using EPICS, in the
2020
same manner as the live machine.
2121

src/virtac/create_csv.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ def generate_tune_pvs(lattice):
235235
for pv in tune_pvs:
236236
offset_pvs.append(":".join([pv.split(":")[0], "OFFSET1"]))
237237
delta_pvs.append(f"SR-CS-TFB-01:{pv[2:4]}{pv[9:12]}{pv[13:15]}:I")
238-
for tune_pv, offset_pv, delta_pv in zip(tune_pvs, offset_pvs, delta_pvs):
238+
for tune_pv, offset_pv, delta_pv in zip(
239+
tune_pvs, offset_pvs, delta_pvs, strict=False
240+
):
239241
data.append((tune_pv, offset_pv, delta_pv))
240242
return data
241243

src/virtac/masks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from cothread.catools import caget, caput
22

33

4-
class callback_offset(object):
4+
class callback_offset:
55
"""A class to hold a method to be passed as a callback to camonitor."""
66

77
def __init__(self, server, quad_pv, offset_record):
@@ -31,7 +31,7 @@ def callback(self, value, index=None):
3131
self.server.refresh_record(self.quad_pv)
3232

3333

34-
class callback_set(object):
34+
class callback_set:
3535
"""A class to hold a method to be passed as a callback to camonitor."""
3636

3737
def __init__(self, output):
@@ -52,7 +52,7 @@ def callback(self, value, index=None):
5252
record.set(value)
5353

5454

55-
class caget_mask(object):
55+
class caget_mask:
5656
"""A mask for caget so it can comply with the record.get() syntax."""
5757

5858
def __init__(self, pv):
@@ -67,7 +67,7 @@ def get(self):
6767
return caget(self.pv)
6868

6969

70-
class caput_mask(object):
70+
class caput_mask:
7171
"""A mask for caput so it can comply with the record.set(value) syntax."""
7272

7373
def __init__(self, pv):

src/virtac/mirror_objects.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy
22

33

4-
class summate(object):
4+
class summate:
55
"""This class is designed to be passed instead of a mirror record, when its
66
set method is then called it takes the sum of all the input records and
77
sets it to the output record.
@@ -27,7 +27,7 @@ def set(self, value=None):
2727
self.output_record.set(value)
2828

2929

30-
class collate(object):
30+
class collate:
3131
"""This class is designed to be passed instead of a mirror record, when its
3232
set method is then called it gets the values of all the input records and
3333
combines them in order before setting the combined array to the output
@@ -55,7 +55,7 @@ def set(self, value=None):
5555
self.output_record.set(value)
5656

5757

58-
class transform(object):
58+
class transform:
5959
"""This class is designed to be passed instead of a mirror record, when its
6060
set method is then called it applies the held transformation and then sets
6161
the new value to the held output record.
@@ -85,7 +85,7 @@ def set(self, value):
8585
self.output_record.set(value)
8686

8787

88-
class refresher(object):
88+
class refresher:
8989
"""This class is designed to be passed instead of a mirror record, when its
9090
set method is then called it refreshes the held PV on the held server.
9191
"""

tests/test_at_simulator_object.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
from unittest import mock
2+
13
import at
24
import cothread
3-
import mock
45
import numpy
56
import pytest
67
from pytac.exceptions import DataSourceException, FieldException
@@ -225,7 +226,7 @@ def test_get_at_element(atsim, at_lattice):
225226

226227

227228
def test_get_at_lattice(atsim, at_lattice):
228-
for elem1, elem2 in zip(atsim.get_at_lattice(), atsim._at_lat):
229+
for elem1, elem2 in zip(atsim.get_at_lattice(), atsim._at_lat, strict=False):
229230
assert elem1 == elem2
230231

231232

tests/test_element_data_source.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
from unittest import mock
2+
13
import at
2-
import mock
34
import pytest
45
from pytac.exceptions import ControlSystemException, FieldException, HandleException
56
from testfixtures import LogCapture

tests/test_lattice_data_source.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import mock
1+
from unittest import mock
2+
23
import pytest
34
from pytac.exceptions import ControlSystemException, FieldException, HandleException
45
from testfixtures import LogCapture

0 commit comments

Comments
 (0)