Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/fastavro/_write_common.py: 12%
8 statements
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-26 06:10 +0000
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-26 06:10 +0000
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