MCPcopy Index your code
hub / github.com/bpython/bpython / get_encoding

Function get_encoding

bpython/inspection.py:364–370  ·  view source on GitHub ↗

Try to obtain encoding information of the source of an object.

(obj)

Source from the content-addressed store, hash-verified

362
363
364def get_encoding(obj) -> str:
365 """Try to obtain encoding information of the source of an object."""
366 for line in inspect.findsource(obj)[0][:2]:
367 m = _get_encoding_line_re.search(line)
368 if m:
369 return m.group(1)
370 return "utf8"
371
372
373def get_encoding_file(fname: str) -> str:

Callers

nothing calls this directly

Calls 1

searchMethod · 0.80

Tested by

no test coverage detected