Skip to content

Use ABC for DataModelElement instead of __metaclass__ - #1010

Merged
dhalperi merged 1 commit into
batfish:masterfrom
progwriter:fix/datamodel-abc-metaclass
Nov 16, 2026
Merged

dhalperi merged 1 commit into
batfish:masterfrom
progwriter:fix/datamodel-abc-metaclass

Conversation

@progwriter

Copy link
Copy Markdown
Contributor

__metaclass__ = ABCMeta is a Python 2 idiom with no effect in Python 3, so the abstractmethod on from_dict was never enforced. Inherit from ABC instead, and drop the redundant explicit ABCMeta on NextHop and ForwardingDetail.

Unit tests (pytest tests) and mypy pybatfish tests pass.

`__metaclass__ = ABCMeta` is a Python 2 idiom and has no effect in
Python 3, so the abstractmethod on from_dict was never enforced. Inherit
from ABC instead, and drop the redundant explicit ABCMeta on NextHop and
ForwardingDetail, which already inherit it through DataModelElement.
@batfish-bot

Copy link
Copy Markdown

This change is Reviewable

@dhalperi dhalperi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhalperi reviewed 3 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on progwriter).

@dhalperi
dhalperi merged commit babf6df into batfish:master Nov 16, 2026
13 of 16 checks passed
@progwriter
progwriter deleted the fix/datamodel-abc-metaclass branch November 19, 2026 03:22
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

Successfully merging this pull request may close these issues.

3 participants