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

refactor: self-referential type annotations for self-referential ContinuedFraction methods #41

Closed
sr-murthy opened this issue Mar 16, 2024 · 0 comments · Fixed by #44
Closed
Labels
refactor Refactoring changes

Comments

@sr-murthy
Copy link
Owner

ATM the type annotations for ContinuedFraction class or instance methods that actually return ContinuedFraction objects are incorrect - the current return type for these is fractions.Fraction, whereas in fact they should be ContinuedFraction. To enable this a future statement is required for type annotations:

from __future__ import annotations

This is also a problem for the ContinuedFraction.validate class method and the ContinuedFraction.__init__ method, which need to be amended to accept valid input combinations involving ContinuedFraction objects.

The methods that need to be fixed are:

Examples in docstrings and the documentation should be updated.

@sr-murthy sr-murthy added the refactor Refactoring changes label Mar 16, 2024
@sr-murthy sr-murthy changed the title refactor: fix type annotations for ContinuedFraction methods to allow them to refer to the ContinuedFraction type refactor: self-referential type annotations for some ContinuedFraction methods Mar 16, 2024
@sr-murthy sr-murthy changed the title refactor: self-referential type annotations for some ContinuedFraction methods refactor: self-referential type annotations for self-referential ContinuedFraction methods Mar 16, 2024
sr-murthy added a commit that referenced this issue Mar 17, 2024
…nput validation and instance creation for `ContinuedFraction` methods
sr-murthy added a commit that referenced this issue Mar 17, 2024
* chore: bump version refs to `0.11.17`

* fix: issue #43: input validation for `ContinuedFraction.from_elements` for negative elements + update tests and docstrings

* fix: issues #40, #41: support for self-referential type annotation, input validation and instance creation for `ContinuedFraction` methods

* docs: RST typesetting fixes + improvements
@sr-murthy sr-murthy linked a pull request Mar 17, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactoring changes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant