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

[Resolve #1506] Remove unused __eq__ method #1508

Merged
merged 1 commit into from
Aug 30, 2024
Merged

Conversation

alex-harvey-z3q
Copy link
Contributor

@alex-harvey-z3q alex-harvey-z3q commented Aug 30, 2024

Way back in 2018, the original team were adding the debug command, and in that context set about to improve the output in some debug circumstances during inspection of Sceptre's internal objects.

In response to #570, a custom __eq__ method was added in df9fc20.

Based on what can be seen of the original implementation of the custom __eq__, it has not been maintained in a long time, other than changes to it that appeared forced on the current maintainers.

A recent change 993ef09 was done to improve the output during cyclical dependency errors. This change introduced a call to nx.find_cycle, a function that explicitly searches for a cycle in the graph. This appears to result in code testing for the equality of nodes in the graph and thus calls to the custom __eq__ method.

The __eq__ method however has been technically broken ever since template_path was made optional. This then results in __eq__ failing. This fails as the code to announce the deprecation of template_path is then executed, which fails if the deprecated setting is not actually in use.

This PR proposes to simply remove __eq__ since it is believed that it is no longer in use by anything. It has been more than 2 years since template_path was deprecrated and made optional, and the fact that this bug has not surfaced until now is good evidence that the code is not otherwise used or needed.

PR Checklist

  • Wrote a good commit message & description [see guide below].
  • Commit message starts with [Resolve #issue-number].
  • Added/Updated unit tests.
  • Added/Updated integration tests (if applicable).
  • All unit tests (poetry run tox) are passing.
  • Used the same coding conventions as the rest of the project.
  • The new code passes pre-commit validations (poetry run pre-commit run --all-files).
  • The PR relates to only one subject with a clear title.
    and description in grammatically correct, complete sentences.

Approver/Reviewer Checklist

  • Before merge squash related commits.

Other Information

Guide to writing a good commit

Way back in 2018, the original team were adding the debug command, and in
that context set about to improve the output in some debug circumstances
during inspection of Sceptre's internal objects.

In response to #570, a custom
`__eq__` method was added in df9fc20.

Based on what can be seen of the original implementation of the custom
`__eq__`, it has not been maintained in a long time, other than changes
to it that appeared to cause issues for the current maintainers.

--

A recent change to improve the output during cyclical dependency errors
has introduced a call to `nx.find_cycle`. This function explicitly
searches for a cycle in the graph. This appears to resolve in code
testing for equality of nodes and thus calls to our custom `__eq__`
function.

The `__eq__` method however has been technically broken ever since
`template_path` was made optional. This then results in `__eq__`
failing. This fails as the code to indicate that `template_path` is
deprecrated is then executed, which will fail if the setting has not
really been defined.

--

This PR proposes to simply remove `__eq__` since it is believed that it
is no longer in use by anything. It has been more than 2 years since
`template_path` was deprecrated and made optional, and the fact of this
bug having never been observed until now is good evidence that it is not
used or needed.
@alex-harvey-z3q alex-harvey-z3q merged commit 6c9ccd9 into master Aug 30, 2024
12 checks passed
@alex-harvey-z3q alex-harvey-z3q deleted the ah/1506-eq branch August 30, 2024 23:10
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.

2 participants