MCPcopy Index your code
hub / github.com/python/cpython / open

Function open

Lib/tokenize.py:457–470  ·  view source on GitHub ↗

Open a file in read only mode using the encoding detected by detect_encoding().

(filename)

Source from the content-addressed store, hash-verified

455
456
457def open(filename):
458 """Open a file in read only mode using the encoding detected by
459 detect_encoding().
460 """
461 buffer = _builtin_open(filename, 'rb')
462 try:
463 encoding, lines = detect_encoding(buffer.readline)
464 buffer.seek(0)
465 text = TextIOWrapper(buffer, encoding, line_buffering=True)
466 text.mode = 'r'
467 return text
468 except:
469 buffer.close()
470 raise
471
472def tokenize(readline):
473 """

Callers

nothing calls this directly

Calls 4

TextIOWrapperClass · 0.90
detect_encodingFunction · 0.70
seekMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…