Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A hodgepodge of Py3 & style fixes.#10793

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jklymak merged 1 commit intomatplotlib:masterfromanntzer:style3
Mar 15, 2018
Merged

Conversation

anntzer
Copy link
Contributor

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzeranntzer added the Py3k labelMar 15, 2018
Copy link
Member

@jklymakjklymak left a comment

Choose a reason for hiding this comment

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

Looks good other than the Py3.5 pathlib question.

with open(os.path.join(image_path,
'matplotlib.png'), 'rb') as fd:
self.write(fd.read())
image_path = Path(rcParams["datapath"], "images", "matplotlib.png")
Copy link
Member

Choose a reason for hiding this comment

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

I'm a little confused about pathlib now. Will this work on 3.5? I wouldn't pick on it, but the test coverage of this PR is not good, so...

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, pathlib is 3.4+ (https://docs.python.org/3/library/pathlib.html) ({read,write}_{text,bytes} is 3.5+,https://docs.python.org/3/library/pathlib.html#pathlib.Path.read_bytes).

What changed in 3.6 is that a bunch of stdlib functions that were previously only accepting string paths (open, os.path.*, etc.) started to also accept Path objects (https://www.python.org/dev/peps/pep-0519/), thus greatly decreasing the friction when using Path objects. But that's not something we can rely on (yet).

There are quite a few places where we use the old idiom (e.g.)with open(...) as file: ... = file.read() which could trivially be replaced byPath(...).read_text(); I didn't change them (the gain is admittedly limited in that case), but only those where we also do path manipulations (because working on Path objects forthat is much nicer than using os.path, IMO) (or where we do this multiple times in a row).

jklymak reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

OK, and I take it nothing trivial can be done to increase the test coverage?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Probably not? If that makes you really uncomfortable I can revert that change, just let me know.

Copy link
Member

Choose a reason for hiding this comment

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

No, I trust you, just asking in case you felt guilty about it...

@jklymakjklymak merged commitb1f5c43 intomatplotlib:masterMar 15, 2018
@anntzeranntzer deleted the style3 branchMarch 15, 2018 18:51
@QuLogicQuLogic added this to thev3.0.0 milestoneJul 24, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jklymakjklymakjklymak approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.0.0
Development

Successfully merging this pull request may close these issues.

5 participants
@anntzer@jklymak@timhoffm@cclauss@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp