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

Function pyod

numpy/core/setup_common.py:288–313  ·  view source on GitHub ↗

Python implementation of the od UNIX utility (od -b, more exactly). Parameters ---------- filename : str name of the file to get the dump from. Returns ------- out : seq list of lines of od output Notes ----- We only implement enough to get the

(filename)

Source from the content-addressed store, hash-verified

286"""
287
288def pyod(filename):
289 """Python implementation of the od UNIX utility (od -b, more exactly).
290
291 Parameters
292 ----------
293 filename : str
294 name of the file to get the dump from.
295
296 Returns
297 -------
298 out : seq
299 list of lines of od output
300
301 Notes
302 -----
303 We only implement enough to get the necessary information for long double
304 representation, this is not intended as a compatible replacement for od.
305 """
306 out = []
307 with open(filename, 'rb') as fid:
308 yo2 = [oct(o)[2:] for o in fid.read()]
309 for i in range(0, len(yo2), 16):
310 line = ['%07d' % int(oct(i)[2:])]
311 line.extend(['%03d' % int(c) for c in yo2[i:i+16]])
312 out.append(" ".join(line))
313 return out
314
315
316_BEFORE_SEQ = ['000', '000', '000', '000', '000', '000', '000', '000',

Callers 1

Calls 3

openFunction · 0.85
readMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected