use Self type
This commit is contained in:
parent
1463535676
commit
4482ede3a7
17 changed files with 142 additions and 205 deletions
|
|
@ -4,7 +4,7 @@
|
|||
"""
|
||||
#TODO more top-level documentation
|
||||
|
||||
from typing import Sequence, Mapping, TYPE_CHECKING, Any, TypeVar, cast
|
||||
from typing import Sequence, Mapping, TYPE_CHECKING, Any, Self, cast
|
||||
import copy
|
||||
|
||||
import numpy
|
||||
|
|
@ -24,9 +24,6 @@ if TYPE_CHECKING:
|
|||
from . import Pattern, NamedPattern
|
||||
|
||||
|
||||
R = TypeVar('R', bound='Ref')
|
||||
|
||||
|
||||
class Ref(
|
||||
PositionableImpl, RotatableImpl, ScalableImpl, Mirrorable,
|
||||
PivotableImpl, Copyable, RepeatableImpl, AnnotatableImpl,
|
||||
|
|
@ -164,13 +161,13 @@ class Ref(
|
|||
|
||||
return pattern
|
||||
|
||||
def rotate(self: R, rotation: float) -> R:
|
||||
def rotate(self, rotation: float) -> Self:
|
||||
self.rotation += rotation
|
||||
if self.repetition is not None:
|
||||
self.repetition.rotate(rotation)
|
||||
return self
|
||||
|
||||
def mirror(self: R, axis: int) -> R:
|
||||
def mirror(self, axis: int) -> Self:
|
||||
self.mirrored[axis] = not self.mirrored[axis]
|
||||
self.rotation *= -1
|
||||
if self.repetition is not None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue