MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _get_normal_name

Function _get_normal_name

tools/python-3.11.9-amd64/Lib/tokenize.py:288–297  ·  view source on GitHub ↗

Imitates get_normal_name in tokenizer.c.

(orig_enc)

Source from the content-addressed store, hash-verified

286
287
288def _get_normal_name(orig_enc):
289 """Imitates get_normal_name in tokenizer.c."""
290 # Only care about the first 12 characters.
291 enc = orig_enc[:12].lower().replace("_", "-")
292 if enc == "utf-8" or enc.startswith("utf-8-"):
293 return "utf-8"
294 if enc in ("latin-1", "iso-8859-1", "iso-latin-1") or \
295 enc.startswith(("latin-1-", "iso-8859-1-", "iso-latin-1-")):
296 return "iso-8859-1"
297 return orig_enc
298
299def detect_encoding(readline):
300 """

Callers 1

find_cookieFunction · 0.70

Calls 3

startswithMethod · 0.80
replaceMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected