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

Expose the line number in the parsed content #22

Merged
merged 1 commit into from Apr 18, 2022

Conversation

tosky
Copy link
Contributor

@tosky tosky commented Apr 18, 2022

The information about the current line number is already available,
just expose it.

@@ -282,10 +282,15 @@ def set_value(self, data):
else:
self.add(EmptyLine())

def get_line_number(self):
return self.contents[0].line_number if self.contents else None
Copy link
Member

Choose a reason for hiding this comment

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

Will contents always be an array and will the item at the first index always have a line number attribute?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is defined above as self.contents = [], so it is always an array.
If I read the code correctly, contents is populated through the add method whose argument seems to always be a child class of LineType.

@cnsnyder
Copy link
Member

This looks good to me! Thanks for the contribution. Would you mind rebasing on candlepin:main so we can get the tests to run via packit as well prior to merge?

The information about the current line number is already available,
just expose it.
@tosky
Copy link
Contributor Author

tosky commented Apr 18, 2022

Sure, rebase incoming!

@cnsnyder cnsnyder merged commit fd552cc into candlepin:main Apr 18, 2022
@tosky tosky deleted the store-line-number branch April 18, 2022 21:12
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.

None yet

2 participants