Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/fastavro/_write_common.py: 12%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

8 statements  

1def _is_appendable(file_like): 

2 if file_like.seekable() and file_like.tell() != 0: 

3 if "<stdout>" == getattr(file_like, "name", ""): 

4 # In OSX, sys.stdout is seekable and has a non-zero tell() but 

5 # we wouldn't want to append to a stdout. In the python REPL, 

6 # sys.stdout is named `<stdout>` 

7 return False 

8 if file_like.readable(): 

9 return True 

10 else: 

11 raise ValueError( 

12 "When appending to an avro file you must use the " 

13 + "'a+' mode, not just 'a'" 

14 ) 

15 else: 

16 return False