Skip to content

Fix some lgtm convention alerts #11963

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

Merged
merged 1 commit into from
Aug 28, 2018
Merged

Conversation

timhoffm
Copy link
Member

PR Summary

  • The missing commas are actually bugs.
  • zs = [float(zs)] * len(xs) is just rewritten to make the intention more clear. Can we make zs a numpy array instead of a list here? If so, that can be further simplified to np.full_like(xs, fill_value=float(zs)).

@tacaswell tacaswell added this to the v3.0 milestone Aug 28, 2018
Copy link
Contributor

@anntzer anntzer left a comment

Choose a reason for hiding this comment

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

anyone can merge pending ci

@timhoffm
Copy link
Member Author

Any opinions on the np.full_like?

@jklymak
Copy link
Member

jklymak commented Aug 28, 2018

Hah, I always do that z = x*0 + z

@dopplershift
Copy link
Contributor

👍 to np.full_like

@timhoffm
Copy link
Member Author

Changed to np.full_like

Hah, I always do that z = x*0 + z

That's almost the same 😄 The results differ if x contains nan values. Also x*0 + z is slightly slower (1ms vs. 366µs for a size of 1 000 000), not that this would matter in the present context.

@anntzer
Copy link
Contributor

anntzer commented Aug 28, 2018

@jklymak that one's cute

@tacaswell tacaswell merged commit 6001bf2 into matplotlib:master Aug 28, 2018
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Aug 28, 2018
tacaswell added a commit that referenced this pull request Aug 29, 2018
@timhoffm timhoffm deleted the ltgm-convention branch August 29, 2018 05:23
@@ -128,8 +128,8 @@
"/Network/Library/Fonts/",
"/System/Library/Fonts/",
# fonts installed via MacPorts
"/opt/local/share/fonts"
""
"/opt/local/share/fonts",

Choose a reason for hiding this comment

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

This comma changed semantics from implicit string concatenation to a new empty string in the list.

Copy link
Member

Choose a reason for hiding this comment

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

This is correcting a bug, we want to pick up fonts in the current directory.

Choose a reason for hiding this comment

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

Only on OSX, not windows or Linux?
Doesn't seem like something we'd want.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, that seems like a bug that it is missing in the other cases.

On the other hand, this recursion issue seems to be causing grief for many people and as this is cached, using the cwd is also a bit off (as the next time you read the cache your cwd is different).

On balance, I think my initial reaction to this was wrong.

tacaswell added a commit to tacaswell/matplotlib that referenced this pull request Sep 20, 2018
While including the cwd makes sense at first glance, it does not
because

a) the result is cached so the next time your cwd will be
   different but we will not find those files
b) the time it takes to search all the files is causing prolems
c) the other 2 platforms do not do this

The comma was introduced to fix what looked like a bug (implicit
string concatenation instead of adding the empty string to the list)
in matplotlib#11963.

Original code come in via 4799341 in
2011.

closes matplotlib#12176
tacaswell added a commit to tacaswell/matplotlib that referenced this pull request Sep 20, 2018
While including the cwd makes sense at first glance, it does not
because

a) the result is cached so the next time your cwd will be
   different but we will not find those files
b) the time it takes to search all the files is causing prolems
c) the other 2 platforms do not do this

The comma was introduced to fix what looked like a bug (implicit
string concatenation instead of adding the empty string to the list)
in matplotlib#11963.

Original code come in via 4799341 in
2011.

closes matplotlib#12176
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.

6 participants