counsyl / stor

A cross-compatible CLI and Python API for accessing block and object storage
https://counsyl.github.io/stor/
Other
35 stars 12 forks source link

added readable, writable, and seekable methods to OBSFile to fully implement the io.IOBase interface #121

Closed sampearl closed 5 years ago

sampearl commented 5 years ago
sampearl commented 5 years ago

@tophers42 @kyleabeauchamp @jtratner Could you all give this a look?

sampearl commented 5 years ago

Specifically I wasn't certain whether I put my test in the proper place (shared_obs), or that it would be properly parameterized/used by each type of OBS file system test using self.normal_path and self.drive.

kyleabeauchamp commented 5 years ago

I'll need another look from @jtratner et al then

jtratner commented 5 years ago

Looks great - thanks!

I have one small request (that I can also do before merging if you’re okay with it): let’s get rid of the assertTrue(hasattr checks - the next couple lines cover the same thing ;)

Jeff

On Mon, Aug 5, 2019 at 09:43 Sam Pearlman notifications@github.com wrote:

Specifically I wasn't sure whether I put my test in the proper place ( shared_obs), or that it would be properly parameterized/used by each type of OBS file system test using self.normal_path and self.drive.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/counsyl/stor/pull/121?email_source=notifications&email_token=AAMGHK7I4HJGCOWMF3C2WT3QDBKDXA5CNFSM4IJCADS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3SMNEI#issuecomment-518309521, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMGHKZ7YGLVJJZOIQ7O2DLQDBKDXANCNFSM4IJCADSQ .

sampearl commented 5 years ago

@jtratner re: hasattr - sure, if it doesn't have those methods it'll fail on the method invocation in a reasonable/useful way?

jtratner commented 5 years ago

@sampearl - yep - see below

In [1]: import stor
stor
In [2]: stor.Path("whatever")
Out[2]: PosixPath('whatever')

In [3]: _.reaaadable()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-3b3cec0e2a4b> in <module>
----> 1 _.reaaadable()

AttributeError: 'PosixPath' object has no attribute 'reaaadable'
jtratner commented 5 years ago

Thanks for the PR @sampearl !

sampearl commented 5 years ago

👍 !