MCPcopy Create free account
hub / github.com/numpy/numpy / isfileobj

Function isfileobj

numpy/compat/py3k.py:49–58  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

47 return str(s)
48
49def isfileobj(f):
50 if not isinstance(f, (io.FileIO, io.BufferedReader, io.BufferedWriter)):
51 return False
52 try:
53 # BufferedReader/Writer may raise OSError when
54 # fetching `fileno()` (e.g. when wrapping BytesIO).
55 f.fileno()
56 return True
57 except OSError:
58 return False
59
60def open_latin1(filename, mode='r'):
61 return open(filename, mode=mode, encoding='iso-8859-1')

Callers 4

test_isfileobjFunction · 0.90
write_arrayFunction · 0.90
read_arrayFunction · 0.90
open_memmapFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_isfileobjFunction · 0.72