MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / __init__

Method __init__

tools/webassembly.py:198–207  ·  view source on GitHub ↗
(self, filename)

Source from the content-addressed store, hash-verified

196 """
197
198 def __init__(self, filename):
199 self.buf = None # Set this before FS calls below in case they throw.
200 self.filename = filename
201 self.size = os.path.getsize(filename)
202 self.buf = open(filename, 'rb')
203 magic = self.buf.read(4)
204 version = self.buf.read(4)
205 if magic != MAGIC or version != VERSION:
206 raise InvalidWasmError(f'{filename} is not a valid wasm file')
207 self._cache = {}
208
209 def __del__(self):
210 assert not self.buf, '`__exit__` should have already been called, please use context manager'

Callers

nothing calls this directly

Calls 3

InvalidWasmErrorClass · 0.85
openFunction · 0.50
readMethod · 0.45

Tested by

no test coverage detected