masque/masque/traits/copyable.py
Jan Petykiewicz f364970403 style and type fixes (per flake8)
could potentially fix some bugs in `Library` class and dxf reader
2020-10-16 19:00:50 -07:00

35 lines
635 B
Python

from typing import TypeVar
from abc import ABCMeta
import copy
T = TypeVar('T', bound='Copyable')
class Copyable(metaclass=ABCMeta):
"""
Abstract class which adds .copy() and .deepcopy()
"""
__slots__ = ()
'''
---- Non-abstract methods
'''
def copy(self: T) -> T:
"""
Return a shallow copy of the object.
Returns:
`copy.copy(self)`
"""
return copy.copy(self)
def deepcopy(self: T) -> T:
"""
Return a deep copy of the object.
Returns:
`copy.deepcopy(self)`
"""
return copy.deepcopy(self)