Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make classnames class variables and identifiers instance variables. #75

Open
lukethehuman opened this issue Oct 8, 2024 · 0 comments
Open

Comments

@lukethehuman
Copy link
Collaborator

lukethehuman commented Oct 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant