add missing file-like object methods #588

Merged
merged 3 commits into from Dec 18, 2015

Projects

None yet

2 participants

@ameily
Contributor
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)
@ameily ameily add missing file-like object methods
Four methods were missing: readable(), writable(), seekable(), and
readinto().
e9b9dca
@ameily
Contributor
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
Member

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!

@ameily ameily Merge branch 'master' of github.com:paramiko/paramiko
Conflicts:
	paramiko/sftp_file.py
	sites/www/changelog.rst
9a87a8e
@ameily
Contributor
ameily commented Dec 18, 2015

I merged upstream master

@bitprophet bitprophet merged commit 9a87a8e into paramiko:master Dec 18, 2015

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
@bitprophet
Member

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
Contributor
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