MCPcopy Create free account
hub / github.com/tinygrad/tinygrad / _open

Function _open

test/mockgpu/mockgpu.py:52–59  ·  view source on GitHub ↗
(path, flags)

Source from the content-addressed store, hash-verified

50builtins.memoryview = _MockMemoryviewMeta("memoryview", (), {'__new__': _memoryview}) # type: ignore
51
52def _open(path, flags):
53 for d in drivers:
54 for x in d.tracked_files:
55 if path == x.path:
56 virtfd = d.open(path, flags, 0o777, x)
57 tracked_fds[virtfd.fd] = virtfd
58 return virtfd.fd
59 return os.open(path, flags, 0o777) if os.path.exists(path) else None
60
61class MockFileIOInterface(FileIOInterface):
62 def __init__(self, path:str="", flags:int=os.O_RDONLY, fd:int|None=None):

Callers 2

__init__Method · 0.85
existsMethod · 0.85

Calls 2

openMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…