pyfilesystem2 icon indicating copy to clipboard operation
pyfilesystem2 copied to clipboard

add options for several IO operation

Open tzing opened this issue 6 years ago • 4 comments

Type of changes

  • [ ] Bug fix
  • [ ] New feature
  • [ ] Documentation / docstrings
  • [ ] Tests
  • [x] Other

Checklist

  • [x] I've run the latest black with default args on new code.
  • [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • [ ] I've added tests for new code.
  • [x] I accept that @willmcgugan may be pedantic in the code review.

Description

Pre discuss in #361, this PR add options for readbytes and readtext in each class.

Also it changes a behavior in FS.open, I found this when I was investigate if there's any other thing to be changed. It seems no extra parameters are required for iotools.make_stream, and the description for options is arguments for the filesystem. So I guess it was misplaced and move options for openbin inside the function.

tzing avatar Dec 06 '19 17:12 tzing

Just an observation, readtext is as readable as read_text. But I guess it is down to historical design decision.

chfw avatar Dec 06 '19 21:12 chfw

And maybe it's worth adding docstrings like this too?

lurch avatar Dec 07 '19 00:12 lurch

Question for @willmcgugan - looking at https://docs.pyfilesystem.org/en/latest/reference/base.html , should all functions that take path parameter(s) also take an options kwargs?

@tzing Sorry for potentially opening a can of worms... :confused: Your PR looks great so far IMHO :+1:

lurch avatar Dec 08 '19 10:12 lurch

ping @willmcgugan

tzing avatar Dec 14 '19 04:12 tzing