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

Function check

Lib/tokenize.py:388–398  ·  view source on GitHub ↗
(line, encoding)

Source from the content-addressed store, hash-verified

386 return b''
387
388 def check(line, encoding):
389 # Check if the line matches the encoding.
390 if 0 in line:
391 raise SyntaxError("source code cannot contain null bytes")
392 try:
393 line.decode(encoding)
394 except UnicodeDecodeError:
395 msg = "invalid or missing encoding declaration"
396 if filename is not None:
397 msg = '{} for {!r}'.format(msg, filename)
398 raise SyntaxError(msg)
399
400 def find_cookie(line):
401 match = cookie_re.match(line)

Callers 1

detect_encodingFunction · 0.70

Calls 2

decodeMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…