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
python3 port Tickets/dm 7288 #42
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty straightforward.
print >> fd, s.getId(), s.getXAstrom(), s.getYAstrom(), s.getRa( | ||
), s.getDec(), s.getPsfFlux(), s.getFlagForDetection() | ||
print(s.getId(), s.getXAstrom(), s.getYAstrom(), s.getRa( | ||
), s.getDec(), s.getPsfFlux(), s.getFlagForDetection(), file=fd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to my eyes, the line break here is weird. I'd expect the new line to occur at s.getRa(),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fair.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and the indenting looks wrong.
@@ -3,6 +3,9 @@ | |||
mechanism, but we need nested lists, so we do this home-brew version | |||
instead. | |||
''' | |||
from past.builtins import execfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should make a note to fix this in a python3 way at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix what? I would have thought all the past and builtins imports would be fixed together when we go to python3 only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have generally used past.builtins
to give us compatibility with behavioral changes between 2 and 3. In particular using long
and basestring
as they are providing semantics to python 2 that do not exist on 3. execfile
is not like that and it just a function that needs to be replaced with a modern approach.
@@ -102,7 +103,7 @@ def testMakeMatchStatistics(self): | |||
""" | |||
np.random.seed(47) | |||
distList = list((np.random.random_sample([self.numMatches]) - 0.5) * 10) | |||
for dist, match in itertools.izip(distList, self.matchList): | |||
for dist, match in zip(distList, self.matchList): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from builtins import zip
at top.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
# don't want this to depend on how many files e.g. py.test has open at the start. | ||
currentOpenFiles = len(getOpenFiles()) | ||
print('NOFILE rlimit:', self.originalLimits) | ||
resource.setrlimit(resource.RLIMIT_NOFILE, (currentOpenFiles+5, self.originalLimits[1])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces need around +
operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, though my linter doesn't catch that one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's because we disable "spaces around operator" warnings because it's an area where there is vagueness in PEP8 and where we disagree with some interpretations.
1b80e5f
to
9ffdf73
Compare
Please remember to add |
e4d172e
to
9f82dca
Compare
9f82dca
to
18dd11a
Compare
No description provided.