MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / open

Function open

tools/python-3.11.9-amd64/Lib/tokenize.py:392–405  ·  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

390
391
392def open(filename):
393 """Open a file in read only mode using the encoding detected by
394 detect_encoding().
395 """
396 buffer = _builtin_open(filename, 'rb')
397 try:
398 encoding, lines = detect_encoding(buffer.readline)
399 buffer.seek(0)
400 text = TextIOWrapper(buffer, encoding, line_buffering=True)
401 text.mode = 'r'
402 return text
403 except:
404 buffer.close()
405 raise
406
407
408def tokenize(readline):

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