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

Build misc examples #6868

Merged
merged 11 commits into from Aug 7, 2016
Merged

Conversation

jenshnielsen
Copy link
Member

Fixes #6866

urllib has moved from python 2 to 3. file is no more.

In mlab:

iterkeys was being called on the keys instead of the dict.
Unicode strings need to be encoded on python2 to be used in np.dtype

Should probably still add some tests to test_mlab.

newdtype = np.dtype(rec.dtype.descr + list(zip(names, dtypes)))
old_dtypes = rec.dtype.descr
if six.PY2:
old_dtypes = [(a[0].encode('utf-8'), a[1]) for a in old_dtypes]
Copy link
Member

Choose a reason for hiding this comment

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

A bit less cryptic variant: old_dtypes = [(name.encode('utf-8'), dt) for name, dt in old_dtypes]

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed but I am not sure this is the right solution anyway. The recarray can handle unicode keys it's only that np.dtype cannot. We should probably do this in a completely different way

@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Aug 2, 2016
@tacaswell
Copy link
Member

I am inclined to merge this as-is. It improves things and we should not let the perfect be the enemy of the good here.

@jenshnielsen
Copy link
Member Author

I will at least implement @Kojoley's suggestion

@jenshnielsen jenshnielsen changed the title [WIP] Build misc examples Build misc examples Aug 7, 2016
@jenshnielsen
Copy link
Member Author

Implemented @Kojoley's sugestion. The proper solution is most likely to use fromrecords to build the recarrays but I don't want to make any more modifications to this code which should probably be deprecated and removed instead

@tacaswell tacaswell merged commit 70e7a6c into matplotlib:v2.x Aug 7, 2016
@jenshnielsen jenshnielsen deleted the buildmiscexamples branch August 7, 2016 09:13
@QuLogic QuLogic modified the milestones: 2.0 (style change major release), 2.0.1 (next bug fix release) Aug 7, 2016
@QuLogic QuLogic mentioned this pull request Oct 15, 2016
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

4 participants