edges: add abstract

This commit is contained in:
Rotzbua 2023-01-23 20:08:04 +01:00 committed by Florian Festi
parent 71ddb11cee
commit 4a957c2f8b
1 changed files with 6 additions and 5 deletions

View File

@ -15,11 +15,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import abc
import argparse import argparse
import inspect import inspect
import math import math
import re import re
from abc import ABC, abstractmethod
from typing import Any from typing import Any
from boxes import gears from boxes import gears
@ -74,7 +74,7 @@ def getDescriptions() -> dict:
return d return d
class BoltPolicy: class BoltPolicy(ABC):
"""Abstract class """Abstract class
Distributes (bed) bolts on a number of segments Distributes (bed) bolts on a number of segments
@ -292,7 +292,7 @@ class Settings:
############################################################################# #############################################################################
class BaseEdge: class BaseEdge(ABC):
"""Abstract base class for all Edges""" """Abstract base class for all Edges"""
char: str | None = None char: str | None = None
description: str = "Abstract Edge Class" description: str = "Abstract Edge Class"
@ -306,7 +306,7 @@ class BaseEdge:
"""Hack for using unalter code form Boxes class""" """Hack for using unalter code form Boxes class"""
return getattr(self.boxes, name) return getattr(self.boxes, name)
@abc.abstractmethod @abstractmethod
def __call__(self, length, **kw): def __call__(self, length, **kw):
pass pass
@ -868,7 +868,8 @@ Values:
return self._edgeObjects(edges, boxes, chars, add) return self._edgeObjects(edges, boxes, chars, add)
class FingerJointBase: class FingerJointBase(ABC):
"""Abstract base class for finger joint."""
def calcFingers(self, length: float, bedBolts) -> tuple[int, float]: def calcFingers(self, length: float, bedBolts) -> tuple[int, float]:
space, finger = self.settings.space, self.settings.finger # type: ignore space, finger = self.settings.space, self.settings.finger # type: ignore