Skip to content

Conversation

@anchitjain1234
Copy link
Contributor

For #3888. Also fixed AASTex tests in test_write.py to incorporate these changes.

@hamogu
Copy link
Member

hamogu commented Feb 4, 2016

@taldcroft : This looks good to me (Tracis failure is unrelated).

@bsipocz : There is a failure of the coverage test here, which I'm very sure is unrelated to the content of the PR. Do you now if that is a ci-helpers issue?

@anchitjain1234 : Just a small tip: If you include the string closes #xxxx or fixes #xxxx in a commit message then you automatically reference that issue on github and that issue will be closed automatically when your PR is merged.

@astrofrog
Copy link
Member

We fixed the coverage earlier today, will restart that build.

@anchitjain1234
Copy link
Contributor Author

Thanks @hamogu for reviewing. In which version should the changelog entry be added?

@hamogu
Copy link
Member

hamogu commented Feb 5, 2016

This is an easy bug fix with no risk of merge conflicts. It should go in 1.0.9.

core.BaseData.write(self, lines)
# To remove extra space and // appended which creates an extra new line
# in the end.
if len(lines) > lines_length_initial:
Copy link
Member

Choose a reason for hiding this comment

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

There is probably a reason why not, but could you just do (without the len(lines) > lines_length_initial test):

lines[-1] = re.sub(r'//\s*$', '', lines[-1])

I guess I'm not sure about a corner case of a zero-length table or something.

Copy link
Member

Choose a reason for hiding this comment

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

I thought about that, too, when I reviewed it, and decided that the ways it's implemented now is better for exactly the case of an empty table you mention. I don't think that ever comes up, but we should not put in bug just for the sake of saving one line of code (and this is not performance critical - nobody writes millions of AASTeX tables).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So it should be left as it is?

Copy link
Member

Choose a reason for hiding this comment

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

What about a hybrid of using the regex within the existing if statement. I always get nervous about things like [:-3] since that is just begging to break if anything changes upstream. I know it's not likely in this case, but in theory someone could make a sub-class and change join so that it adds just r'\\' (without the space).

Also, I guess you would want the regex to be r'\s* \\ \s* $' (with re.VERBOSE).

@anchitjain1234
Copy link
Contributor Author

@taldcroft @hamogu Please check changes now.

@hamogu
Copy link
Member

hamogu commented Feb 5, 2016

I thought the old version was good enough. This is even better.

@anchitjain1234
Copy link
Contributor Author

@taldcroft Please check the changes.

@taldcroft taldcroft added this to the v1.0.9 milestone Feb 8, 2016
@taldcroft taldcroft self-assigned this Feb 8, 2016
taldcroft added a commit that referenced this pull request Feb 8, 2016
Remove new line characters after last row of data in ascii.latex.AASTex
@taldcroft taldcroft merged commit b4f30c9 into astropy:master Feb 8, 2016
@taldcroft
Copy link
Member

Thanks @anchitjain1234 !

@hamogu
Copy link
Member

hamogu commented Feb 8, 2016

@anchitjain1234 : Sometimes there is some patience required. Almost all of us work on astropy as a hobby in our free time and @taldcroft is responsible for > 100 of the PRs and issues.

@anchitjain1234
Copy link
Contributor Author

@hamogu @taldcroft Sorry for spamming 😞. Won't happen again.

@hamogu
Copy link
Member

hamogu commented Feb 8, 2016

@anchitjain1234 : Don't worry. That's OK. And sometimes we do forget about open PRs and then it's a good idea to ask again; I was just explaining why we might not respond immediately.

eteq pushed a commit that referenced this pull request Feb 24, 2016
Remove new line characters after last row of data in ascii.latex.AASTex
eteq pushed a commit that referenced this pull request Feb 29, 2016
Remove new line characters after last row of data in ascii.latex.AASTex
@anchitjain1234 anchitjain1234 deleted the fix-3888 branch April 8, 2016 17:11
@wmwv
Copy link
Contributor

wmwv commented Jul 6, 2016

This change broke reading of AASTex deluxetable files. The line parser requires the final terminating '' on each line, including the last one. E.g., the following has been in since ee9c71bf (2014-08-02):

https://github.com/astropy/astropy/blob/master/astropy/io/ascii/latex.py#L77

The parser is wrong, but that's a separate issue. We should at least preserve round-tripping and add that to the test suite.

Bug reported in #5160

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants