Skip to content

Make classnames class variables and identifiers instance variables. #75

@lukethehuman

Description

@lukethehuman

Currently SimpleComponent and GenericComponentAssembly classes have a classname attribute and an identifier attribute which are initialised to the same value. During operation the identifier gets updated e.g. from pin to pin0, pin1 etc. based on the cubit design tree.

Since the original name is not an aspect of the instance, it should be a class variable defined, something like:

class Pin:
    name = "pin"

    def __init__(self):
        self.identifier = self.name

If we implement abstract base classes, subclasses could be required to have a name property like so, and a class variable would satisfy that requirement:

class Assembly(ABC):
    @property
    @abstractmethod
    def name(self) -> str:
    """Name of the assembly type."""

Edit: spelling

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions