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

Iter #46

Merged
merged 8 commits into from
Jan 30, 2025
Merged

Iter #46

merged 8 commits into from
Jan 30, 2025

Conversation

sepandhaghighi
Copy link
Member

Reference Issues/PRs

What does this implement/fix? Explain your changes.

  • __iter__ overload added

Any other comments?

@sepandhaghighi sepandhaghighi self-assigned this Jan 28, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (a11b05f) to head (03f8e37).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev       #46   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          176       178    +2     
  Branches        25        25           
=========================================
+ Hits           176       178    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sepandhaghighi sepandhaghighi added the enhancement New feature or request label Jan 28, 2025
@sepandhaghighi sepandhaghighi added this to the opr v0.3 milestone Jan 28, 2025
opr/primer.py Outdated
Comment on lines 106 to 114
def __iter__(self):
"""
Iterate through Primer.

:return: None
"""
for base in self.sequence:
yield base

Copy link
Member

Choose a reason for hiding this comment

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

you can go with this:

def __iter__(self):
    """
    Iterate through Primer.

    :return: Iterator[str]
    """
    yield from self.sequence
    

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point ,fixed in be19663.
However, using return: None is more precise.

Copy link
Member

Choose a reason for hiding this comment

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

when I run type(primer_instance.iter()) it is printed as: <class 'generator'> and in this case it is Generator[str].

@sepandhaghighi sepandhaghighi marked this pull request as ready for review January 29, 2025 10:08
Copy link
Member

@AHReccese AHReccese left a comment

Choose a reason for hiding this comment

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

Thanks for your effort, the only comment that I have is the return type of the __iter__ function which is generator.

@sepandhaghighi
Copy link
Member Author

Thanks for your effort, the only comment that I have is the return type of the __iter__ function which is generator.

Fixed in 03f8e37

@AHReccese AHReccese merged commit ccfaa68 into dev Jan 30, 2025
24 checks passed
@AHReccese AHReccese deleted the iter branch January 30, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants