-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Python 3 compatibility #272
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
Conversation
@jaberg I'd like to merge this as soon as possible, so that we can get out a new release soon. A lot of people seem to be waiting for this. If there's anything you don't like or would like to see improved, please let me know. |
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.
Thanks for doing this! These changes look great. I made some notes of minor cleanup as I went, but I'd consider most of these nice-to-haves rather than blockers. The only things I'd request to look at are a couple of print statements that I flagged as not printing to stderr properly, and the removal of the defaults variable in the function inspection code.
@@ -148,7 +147,7 @@ def set_in_memo(self, memo, k, v): | |||
# then we can free memo[ii] by replacing it | |||
# with a dummy symbol | |||
if all(iic in memo for iic in self.clients[ii]): | |||
#print 'collecting', ii | |||
# print('collecting', ii) |
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.
del
#ltvs = np.asarray(sorted(zip(losses, tids, vals))) | ||
#best_loss, best_tid, best_val = ltvs[best_idx] | ||
# ltvs = np.asarray(sorted(zip(losses, tids, vals))) | ||
# best_loss, best_tid, best_val = ltvs[best_idx] |
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.
del
@@ -309,14 +315,14 @@ def __iter__(self): | |||
try: | |||
return iter(self._trials) | |||
except AttributeError: | |||
print(sys.stderr, "You have to refresh before you iterate") | |||
print((sys.stderr, "You have to refresh before you iterate")) |
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.
(1) how to print to a specific fd in py3?
(2) does insisting on stderr make sense here?
raise | ||
|
||
def __len__(self): | ||
try: | ||
return len(self._trials) | ||
except AttributeError: | ||
print(sys.stderr, "You have to refresh before you compute len") | ||
print((sys.stderr, "You have to refresh before you compute len")) |
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.
stder business again here
# print pmin | ||
# print loss3[:cutoff, 0] | ||
# print loss3[:cutoff, 1] | ||
# print loss3[:cutoff, 2] |
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.
del
b_post = fn(*b_args, **dict(named_args)) | ||
a_args = [obs_above, prior_weight] + aa | ||
a_post = fn(*a_args, **dict(named_args)) | ||
|
||
assert a_post.name == b_post.name | ||
fn_lpdf = getattr(scope, a_post.name + '_lpdf') | ||
#print fn_lpdf | ||
# print fn_lpdf |
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.
del
#print 'FULL IDXS' | ||
#print full_idxs | ||
# print 'FULL IDXS' | ||
# print full_idxs |
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.
del
@@ -742,14 +752,14 @@ def idxs_prod(full_idxs, idxs_by_label, llik_by_label): | |||
assert len(idxs) == len(llik) | |||
for ii, ll in zip(idxs, llik): | |||
rval[pos_of_tid[ii]] += ll | |||
#rval[full_idxs.index(ii)] += ll | |||
# rval[full_idxs.index(ii)] += ll |
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.
del
return rval | ||
|
||
|
||
@scope.define | ||
def broadcast_best(samples, below_llik, above_llik): | ||
if len(samples): | ||
#print 'AA2', dict(zip(samples, below_llik - above_llik)) | ||
# print 'AA2', dict(zip(samples, below_llik - above_llik)) |
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.
del
from .pyll import toposort | ||
from .pyll import scope | ||
from .pyll import stochastic | ||
# from pyll import clone_merge |
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.
del
Alright @jaberg, that should do it for now. I'll address CI and other enhancements later on. I'll do a last few test and would then proceed to merge this. Thanks again for having me onboard! |
@jaberg I pushed the new tag
would you do the honors and quickly do this? Thanks! |
Tomorrow morning I'll take the new code for a spin on py27 and upload it if On Sun, Nov 20, 2016 at 3:59 AM, Max Pumperla notifications@github.com
|
This pull request addresses the topics:
six
as new dependency to ensure backward compatibility0.1
to support python 3