@@ -319,13 +319,13 @@ def insert(self, idx: SupportsIndex, elem: Element, copy_elements=False):
319
319
If :py:obj:`True` a deep copy of elem
320
320
is used.
321
321
"""
322
- # noinspection PyUnusedLocal
323
322
# scan the new element to update it
324
- elist = list (self ._addition_filter ([elem ],
323
+ elist = list (self ._addition_filter ([elem ], # noqa: F841
325
324
copy_elements = copy_elements ))
326
325
super ().insert (idx , elem )
327
326
328
327
def extend (self , elems : Iterable [Element ], copy_elements = False ):
328
+ # noinspection PyUnresolvedReferences
329
329
r"""This method adds all the elements of `elems` to the end of the
330
330
lattice. The behavior is the same as for a :py:obj:`list`
331
331
@@ -347,24 +347,25 @@ def extend(self, elems: Iterable[Element], copy_elements=False):
347
347
super ().extend (elems )
348
348
349
349
def append (self , elem : Element , copy_elements = False ):
350
- r"""This method overwrites the inherited method
351
- :py:meth:`list.append()`,
352
- it behavior is changed, it accepts only AT lattice elements
353
- :py:obj:`Element` as input argument.
354
-
355
- Equivalents syntaxes:
356
- >>> ring.append(elem)
357
- >>> ring += [elem]
358
-
359
- Parameters:
360
- elem (Element): AT element to be appended to the lattice
361
- copy_elements(bool): Default :py:obj:`True`.
362
- If :py:obj:`True` a deep copy of elem
363
- is used
350
+ # noinspection PyUnresolvedReferences
351
+ r"""This method overwrites the inherited method :py:meth:`list.append()`,
352
+ its behavior is changed, it accepts only AT lattice elements
353
+ :py:obj:`Element` as input argument.
354
+
355
+ Equivalents syntaxes:
356
+ >>> ring.append(elem)
357
+ >>> ring += [elem]
358
+
359
+ Parameters:
360
+ elem (Element): AT element to be appended to the lattice
361
+ copy_elements(bool): Default :py:obj:`True`.
362
+ If :py:obj:`True` a deep copy of elem
363
+ is used
364
364
"""
365
365
self .extend ([elem ], copy_elements = copy_elements )
366
366
367
367
def repeat (self , n : int , copy_elements = True ):
368
+ # noinspection SpellCheckingInspection,PyUnresolvedReferences,PyRedeclaration
368
369
r"""This method allows to repeat the lattice `n` times.
369
370
If `n` does not divide `ring.periodicity`, the new ring
370
371
periodicity is set to 1, otherwise it is et to
@@ -409,6 +410,7 @@ def copy_fun(elem, copy):
409
410
410
411
def concatenate (self , * lattices : Iterable [Element ],
411
412
copy_elements = False , copy = False ):
413
+ # noinspection PyUnresolvedReferences,SpellCheckingInspection,PyRedeclaration
412
414
"""Concatenate several `Iterable[Element]` with the lattice
413
415
414
416
Equivalents syntaxes:
@@ -442,6 +444,7 @@ def concatenate(self, *lattices: Iterable[Element],
442
444
return lattice if copy else None
443
445
444
446
def reverse (self , copy = False ):
447
+ # noinspection PyUnresolvedReferences
445
448
r"""Reverse the order of the lattice and swapt the faces
446
449
of elements. Alignment errors are not swapped
447
450
@@ -520,7 +523,7 @@ def copy(self) -> Lattice:
520
523
def deepcopy (self ) -> Lattice :
521
524
"""Returns a deep copy of the lattice"""
522
525
return copy .deepcopy (self )
523
-
526
+
524
527
def slice_elements (self , refpts : Refpts , slices : int = 1 ) -> Lattice :
525
528
"""Create a new lattice by slicing the elements at refpts
526
529
@@ -542,7 +545,7 @@ def slice_generator(_):
542
545
else :
543
546
yield el
544
547
545
- return Lattice (slice_generator , iterator = self .attrs_filter )
548
+ return Lattice (slice_generator , iterator = self .attrs_filter )
546
549
547
550
def slice (self , size : Optional [float ] = None , slices : Optional [int ] = 1 ) \
548
551
-> Lattice :
@@ -639,8 +642,8 @@ def energy(self) -> float:
639
642
def energy (self , energy : float ):
640
643
# Set the Energy attribute of radiating elements
641
644
for elem in self :
642
- if (isinstance (elem , (elt .RFCavity , elt .Wiggler )) or
643
- elem .PassMethod .endswith ('RadPass' )):
645
+ if (isinstance (elem , (elt .RFCavity , elt .Wiggler ))
646
+ or elem .PassMethod .endswith ('RadPass' )):
644
647
elem .Energy = energy
645
648
# Set the energy attribute of the Lattice
646
649
# Use a numpy scalar to allow division by zero
0 commit comments