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

Method open

Lib/test/libregrtest/runtests.py:54–63  ·  view source on GitHub ↗
(self, mode='r', *, encoding)

Source from the content-addressed store, hash-verified

52 yield
53
54 def open(self, mode='r', *, encoding):
55 if self.file_type == JsonFileType.STDOUT:
56 raise ValueError("for STDOUT file type, just use sys.stdout")
57
58 file = self.file
59 if self.file_type == JsonFileType.WINDOWS_HANDLE:
60 import msvcrt
61 # Create a file descriptor from the handle
62 file = msvcrt.open_osfhandle(file, os.O_WRONLY)
63 return open(file, mode, encoding=encoding)
64
65
66@dataclasses.dataclass(slots=True, frozen=True)

Callers 6

read_jsonMethod · 0.45
worker_processFunction · 0.45
open_urlresourceFunction · 0.45
create_empty_fileFunction · 0.45
open_dir_fdFunction · 0.45

Calls 1

openFunction · 0.50

Tested by

no test coverage detected