style and type fixes (per flake8)

could potentially fix some bugs in `Library` class and dxf reader
This commit is contained in:
Jan Petykiewicz 2020-10-16 19:00:50 -07:00
commit f364970403
31 changed files with 293 additions and 297 deletions

View file

@ -1,7 +1,6 @@
from typing import TypeVar
from types import MappingProxyType
#from types import MappingProxyType
from abc import ABCMeta, abstractmethod
import copy
from ..utils import annotations_t
from ..error import PatternError
@ -44,10 +43,10 @@ class AnnotatableImpl(Annotatable, metaclass=ABCMeta):
'''
@property
def annotations(self) -> annotations_t:
return self._annotations
# # TODO: Find a way to make sure the subclass implements Lockable without dealing with diamond inheritance or this extra hasattr
# if hasattr(self, 'is_locked') and self.is_locked():
# return MappingProxyType(self._annotations)
return self._annotations
@annotations.setter
def annotations(self, annotations: annotations_t):

View file

@ -1,5 +1,5 @@
from typing import List, Tuple, Callable, TypeVar, Optional
from abc import ABCMeta, abstractmethod
from typing import TypeVar
from abc import ABCMeta
import copy

View file

@ -1,9 +1,7 @@
from typing import List, Tuple, Callable, TypeVar, Optional
from typing import TypeVar
from abc import ABCMeta, abstractmethod
import copy
from ..error import PatternError, PatternLockedError
from ..utils import is_scalar
from ..error import PatternError
T = TypeVar('T', bound='Doseable')
@ -70,7 +68,6 @@ class DoseableImpl(Doseable, metaclass=ABCMeta):
raise PatternError('Dose must be non-negative')
self._dose = val
'''
---- Non-abstract methods
'''

View file

@ -1,8 +1,6 @@
from typing import List, Tuple, Callable, TypeVar, Optional
from typing import TypeVar
from abc import ABCMeta, abstractmethod
import copy
from ..error import PatternError, PatternLockedError
from ..utils import layer_t

View file

@ -1,8 +1,7 @@
from typing import List, Tuple, Callable, TypeVar, Optional
from typing import TypeVar
from abc import ABCMeta, abstractmethod
import copy
from ..error import PatternError, PatternLockedError
from ..error import PatternLockedError
T = TypeVar('T', bound='Lockable')

View file

@ -1,8 +1,5 @@
from typing import List, Tuple, Callable, TypeVar, Optional
from typing import TypeVar
from abc import ABCMeta, abstractmethod
import copy
from ..error import PatternError, PatternLockedError
T = TypeVar('T', bound='Mirrorable')

View file

@ -1,12 +1,11 @@
# TODO top-level comment about how traits should set __slots__ = (), and how to use AutoSlots
from typing import List, Tuple, Callable, TypeVar, Optional
from typing import TypeVar
from abc import ABCMeta, abstractmethod
import copy
import numpy # type: ignore
from ..error import PatternError, PatternLockedError
from ..utils import is_scalar, rotation_matrix_2d, vector2
from ..error import PatternError
from ..utils import vector2
T = TypeVar('T', bound='Positionable')
@ -101,7 +100,6 @@ class PositionableImpl(Positionable, metaclass=ABCMeta):
raise PatternError('Offset must be convertible to size-2 ndarray')
self._offset = val.flatten()
'''
---- Methods
'''

View file

@ -1,8 +1,7 @@
from typing import List, Tuple, Callable, TypeVar, Optional, TYPE_CHECKING
from typing import TypeVar, Optional, TYPE_CHECKING
from abc import ABCMeta, abstractmethod
import copy
from ..error import PatternError, PatternLockedError
from ..error import PatternError
if TYPE_CHECKING:

View file

@ -1,12 +1,11 @@
from typing import List, Tuple, Callable, TypeVar, Optional
from typing import TypeVar
from abc import ABCMeta, abstractmethod
import copy
import numpy # type: ignore
from numpy import pi
from .positionable import Positionable
from ..error import PatternError, PatternLockedError
#from .positionable import Positionable
from ..error import PatternError
from ..utils import is_scalar, rotation_matrix_2d, vector2
T = TypeVar('T', bound='Rotatable')

View file

@ -1,8 +1,7 @@
from typing import List, Tuple, Callable, TypeVar, Optional
from typing import TypeVar
from abc import ABCMeta, abstractmethod
import copy
from ..error import PatternError, PatternLockedError
from ..error import PatternError
from ..utils import is_scalar