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

Implementation of str.partition() with tuples #1619

Merged
merged 14 commits into from
Mar 31, 2023

Conversation

harshsingh-24
Copy link
Contributor

@harshsingh-24 harshsingh-24 commented Mar 24, 2023

  • Functionality: Split the string at the first occurrence of separator, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return a 3-tuple containing the string itself, followed by two empty strings.
  • Base Cases: If either string or separator is empty, a ValueError is raised. The ValueError function needs to be refactored further.
  • Added sufficient test cases for integration testing along with proper comments for understanding

PS: Had a nice experience with git merge and resolving conflicts 😀

@harshsingh-24
Copy link
Contributor Author

LPython CI build is successful. Can you please review @Thirumalai-Shaktivel @czgdp1807 and @Smit-create?

@certik
Copy link
Contributor

certik commented Mar 24, 2023

Otherwise I think this is fine.

@czgdp1807 czgdp1807 marked this pull request as draft March 25, 2023 08:28
@certik
Copy link
Contributor

certik commented Mar 25, 2023

This looks good, left some more comments. Keep this current design, no classes. Just a little more refactoring based on my comments above.

@harshsingh-24
Copy link
Contributor Author

harshsingh-24 commented Mar 28, 2023

Can you review @certik and @Thirumalai-Shaktivel @Smit-create @czgdp1807 ? I incorporated all the changes.

PS: This was a really good PR for me as I learnt a lot through this.

@harshsingh-24 harshsingh-24 marked this pull request as ready for review March 28, 2023 21:08
@harshsingh-24 harshsingh-24 requested review from certik and removed request for Thirumalai-Shaktivel March 29, 2023 06:22
@harshsingh-24 harshsingh-24 requested review from Thirumalai-Shaktivel and certik and removed request for certik and Thirumalai-Shaktivel March 29, 2023 06:22
@harshsingh-24
Copy link
Contributor Author

Should I refactor of all the other functions like endswith, capitalize in the same way as I did for this function? @certik

src/runtime/lpython_builtin.py Outdated Show resolved Hide resolved
src/runtime/lpython_builtin.py Outdated Show resolved Hide resolved
src/runtime/lpython_builtin.py Outdated Show resolved Hide resolved
@czgdp1807 czgdp1807 marked this pull request as draft March 30, 2023 04:47
@harshsingh-24
Copy link
Contributor Author

Made the changes. @czgdp1807

@harshsingh-24 harshsingh-24 requested review from czgdp1807 and removed request for certik March 30, 2023 05:34
@harshsingh-24 harshsingh-24 marked this pull request as ready for review March 30, 2023 13:45
Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

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

I think this looks good to me.

The history should be polished or squashed.

@czgdp1807 czgdp1807 enabled auto-merge (squash) March 30, 2023 15:52
@harshsingh-24
Copy link
Contributor Author

Why did the build fail? I submitted a successful build PR. @certik @czgdp1807

@czgdp1807 czgdp1807 merged commit b5d2554 into lcompilers:main Mar 31, 2023
@certik
Copy link
Contributor

certik commented Apr 1, 2023

@harshsingh-24 I think it failed due to #1645 (comment).

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.

4 participants