Open randallpittman opened 5 years ago
Whoops, I didn't see the other pull request. I didn't try to compare the cdlparser.py code from that PR, but there are some similar changes to the tests, though actually I think that PR has some better improvements to test_constants.py. But I did try to keep this PR narrowly focused to 2/3 compatibility and no pep8'ing!
expand_escapes()
in Hugo's PR just returned the input string for Py3. I'm still wrapping my mind around that function and its use, so that simpler approach may be better.
Edit: Nevermind, I do understand the function (you can have e.g. \n
in CDL and have it turn into a newline), so you do need to do something to convert it. I think my approach works. Hex escape codes have to be valid utf-8 though.
Hi Randall. Apologies for not having looked at this PR until now. For some reason I didn't receive an automatic notification in my mailbox - or if I did it must have gone straight into my junk mailbox and then been auto-deleted (our back-end systems here at work have been migrated recently and the junk mail settings are now all over the shop!)
Anyhows, I'll aim to find time to look at your code changes over the next week or two. As you can tell, I've not been active on GH for some time, so it's going to take me a while to get back up to speed!
@randallpittman Thanks for identifying and implementing the workaround for the NETCDF_CLASSIC bug, and for spotting the handful of occurrences of the now-deprecated except Exception, exc
idiom.
Addresses issue #21.
As a side note, both Python 2 and 3 fail
test_constants.py
with netcdf4-python v1.4.2, as there's a bug where NETCDF3_CLASSIC files won't mask fill values unless the _FillValue attribute is explicitly set. Adding this line to the CDL intest_constants.py
allows all tests to pass (the actual value isn't important for the test):Change list:
long
vs.int
,print
function, exceptionsas
0o
int_val
tolong_val