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

add missing file-like object methods #588

Merged
merged 3 commits into from Dec 18, 2015
Merged

add missing file-like object methods #588

merged 3 commits into from Dec 18, 2015

Conversation

@ameily
Copy link
Contributor

@ameily ameily commented Sep 21, 2015

The Python io module requires that file-like objects implement a specific API. For paramiko, four methods were missing: readable(), writable(), seekable(), and readinto().

Test

The following Python3 code can be run to test that this Pull Request implements the missing file-like object methods. An exception will be raised without this Pull Request applied. Here, s is an SSHClient instance.

sftp = s.open_sftp()
raw = sftp.open("/path/to/a/text/file.txt", "r")
wrapper = io.TextIOWrapper(raw, encoding='utf-8')

data = wrapper.read(10)
wrapper.seek(0)
data2 = wrapper.read(10)
Four methods were missing: readable(), writable(), seekable(), and
readinto().
@ameily
Copy link
Contributor Author

@ameily ameily commented Dec 17, 2015

Is there anything I have to do on my end to get this PR merged?

@bitprophet bitprophet added this to the 1.17 milestone Dec 17, 2015
@bitprophet
Copy link
Member

@bitprophet bitprophet commented Dec 17, 2015

It looks like there's merge conflicts - keeping a PR branch up to date with master is definitely a good idea! (But you can ignore Travis status for now, there is a race condition it's triggering that needs fixing.)

I also notice I did not add to a milestone, just did so. Thanks for your patience!

Conflicts:
	paramiko/sftp_file.py
	sites/www/changelog.rst
@ameily
Copy link
Contributor Author

@ameily ameily commented Dec 18, 2015

I merged upstream master

@bitprophet bitprophet merged commit 9a87a8e into paramiko:master Dec 18, 2015
1 check failed
1 check failed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
@bitprophet
Copy link
Member

@bitprophet bitprophet commented Dec 18, 2015

Thanks @ameily! Figured I'd review and merge while I was lookin :)

For the future, some notes, please:

  • Try not to include whitespace changes, they make the diff longer & pollute git-blame ;)
  • No need for :meth: in front of method name references, Sphinx's default role stuff tends to work as-is and it's our style to rely on that.
  • The changelog needs issue links & class/method links when possible - just refer to how nearby line-items do it for a reference.
@ameily
Copy link
Contributor Author

@ameily ameily commented Dec 18, 2015

Awesome! Thanks for the heads up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants