/usr/lib64/python3.9/encodings
NameSizeModeActions
__pycache__/-0755rm
aliases.py156770644editdlrm
ascii.py12480644editdlrm
base64_codec.py15330644editdlrm
big5.py10190644editdlrm
big5hkscs.py10390644editdlrm
bz2_codec.py22490644editdlrm
charmap.py20840644editdlrm
cp037.pyc24240644editdlrm
cp273.pyc24100644editdlrm
cp424.pyc24540644editdlrm
cp437.pyc78480644editdlrm
cp500.pyc24240644editdlrm
cp720.py136860644editdlrm
cp737.pyc81700644editdlrm
cp775.pyc78780644editdlrm
cp850.pyc75090644editdlrm
cp852.pyc78860644editdlrm
cp855.pyc81390644editdlrm
cp856.pyc24860644editdlrm
cp857.pyc74890644editdlrm
cp858.py340150644editdlrm
cp860.pyc78270644editdlrm
cp861.pyc78420644editdlrm
cp862.pyc80310644editdlrm
cp863.pyc78420644editdlrm
cp864.pyc79860644editdlrm
cp865.pyc78420644editdlrm
cp866.pyc81750644editdlrm
cp869.pyc78660644editdlrm
cp874.pyc25520644editdlrm
cp875.pyc24210644editdlrm
cp932.py10230644editdlrm
cp949.py10230644editdlrm
cp950.py10230644editdlrm
cp1006.pyc25000644editdlrm
cp1026.pyc24280644editdlrm
cp1125.py345970644editdlrm
cp1140.pyc24140644editdlrm
cp1250.pyc24510644editdlrm
cp1251.pyc24480644editdlrm
cp1252.pyc24510644editdlrm
cp1253.pyc24640644editdlrm
cp1254.pyc24530644editdlrm
cp1255.pyc24720644editdlrm
cp1256.pyc24500644editdlrm
cp1257.pyc24580644editdlrm
cp1258.pyc24560644editdlrm
euc_jisx0213.py10510644editdlrm
euc_jis_2004.py10510644editdlrm
euc_jp.py10270644editdlrm
euc_kr.py10270644editdlrm
gb2312.py10270644editdlrm
gb18030.py10310644editdlrm
gbk.py10150644editdlrm
hex_codec.py15080644editdlrm
hp_roman8.pyc26250644editdlrm
hz.py10110644editdlrm
idna.py90980644editdlrm
iso2022_jp.py10530644editdlrm
iso2022_jp_1.py10610644editdlrm
iso2022_jp_2.py10610644editdlrm
iso2022_jp_3.py10610644editdlrm
iso2022_jp_2004.py10730644editdlrm
iso2022_jp_ext.py10690644editdlrm
iso2022_kr.py10530644editdlrm
iso8859_1.pyc24230644editdlrm
iso8859_2.pyc24230644editdlrm
iso8859_3.pyc24300644editdlrm
iso8859_4.pyc24230644editdlrm
iso8859_5.pyc24240644editdlrm
iso8859_6.pyc24680644editdlrm
iso8859_7.pyc24310644editdlrm
iso8859_8.pyc24620644editdlrm
iso8859_9.pyc24230644editdlrm
iso8859_10.pyc24280644editdlrm
iso8859_11.pyc25220644editdlrm
iso8859_13.pyc24310644editdlrm
iso8859_14.pyc24490644editdlrm
iso8859_15.pyc24280644editdlrm
iso8859_16.pyc24300644editdlrm
johab.py10230644editdlrm
koi8_r.pyc24750644editdlrm
koi8_t.py131930644editdlrm
koi8_u.pyc24610644editdlrm
kz1048.pyc24380644editdlrm
latin_1.py12640644editdlrm
mac_arabic.pyc77420644editdlrm
mac_croatian.pyc24700644editdlrm
mac_cyrillic.pyc24600644editdlrm
mac_farsi.pyc24040644editdlrm
mac_greek.pyc24440644editdlrm
mac_iceland.pyc24630644editdlrm
mac_latin2.pyc26040644editdlrm
mac_roman.pyc24610644editdlrm
mac_romanian.pyc24710644editdlrm
mac_turkish.pyc24640644editdlrm
mbcs.py12110644editdlrm
oem.py10190644editdlrm
palmos.py135190644editdlrm
ptcp154.pyc25450644editdlrm
punycode.py68830644editdlrm
quopri_codec.py15250644editdlrm
raw_unicode_escape.py13320644editdlrm
rot_13.py24480755editdlrm
shift_jis.py10390644editdlrm
shift_jisx0213.py10590644editdlrm
shift_jis_2004.py10590644editdlrm
tis_620.pyc25130644editdlrm
undefined.py12990644editdlrm
unicode_escape.py13040644editdlrm
utf_7.py9460644editdlrm
utf_8.py10050644editdlrm
utf_8_sig.py41330644editdlrm
utf_16.py52360644editdlrm
utf_16_be.py10370644editdlrm
utf_16_le.py10370644editdlrm
utf_32.py51290644editdlrm
utf_32_be.py9300644editdlrm
utf_32_le.py9300644editdlrm
uu_codec.py28510644editdlrm
zlib_codec.py22040644editdlrm
__init__.py55880644editdlrm
Edit: /usr/lib64/python3.9/encodings/__init__.py (5588B)
""" Standard "encodings" Package Standard Python encoding modules are stored in this package directory. Codec modules must have names corresponding to normalized encoding names as defined in the normalize_encoding() function below, e.g. 'utf-8' must be implemented by the module 'utf_8.py'. Each codec module must export the following interface: * getregentry() -> codecs.CodecInfo object The getregentry() API must return a CodecInfo object with encoder, decoder, incrementalencoder, incrementaldecoder, streamwriter and streamreader attributes which adhere to the Python Codec Interface Standard. In addition, a module may optionally also define the following APIs which are then used by the package's codec search function: * getaliases() -> sequence of encoding name strings to use as aliases Alias names returned by getaliases() must be normalized encoding names as defined by normalize_encoding(). Written by Marc-Andre Lemburg (mal@lemburg.com). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. """#" import codecs import sys from . import aliases _cache = {} _unknown = '--unknown--' _import_tail = ['*'] _aliases = aliases.aliases class CodecRegistryError(LookupError, SystemError): pass def normalize_encoding(encoding): """ Normalize an encoding name. Normalization works as follows: all non-alphanumeric characters except the dot used for Python package names are collapsed and replaced with a single underscore, e.g. ' -;#' becomes '_'. Leading and trailing underscores are removed. Note that encoding names should be ASCII only. """ if isinstance(encoding, bytes): encoding = str(encoding, "ascii") chars = [] punct = False for c in encoding: if c.isalnum() or c == '.': if punct and chars: chars.append('_') chars.append(c) punct = False else: punct = True return ''.join(chars) def search_function(encoding): # Cache lookup entry = _cache.get(encoding, _unknown) if entry is not _unknown: return entry # Import the module: # # First try to find an alias for the normalized encoding # name and lookup the module using the aliased name, then try to # lookup the module using the standard import scheme, i.e. first # try in the encodings package, then at top-level. # norm_encoding = normalize_encoding(encoding) aliased_encoding = _aliases.get(norm_encoding) or \ _aliases.get(norm_encoding.replace('.', '_')) if aliased_encoding is not None: modnames = [aliased_encoding, norm_encoding] else: modnames = [norm_encoding] for modname in modnames: if not modname or '.' in modname: continue try: # Import is absolute to prevent the possibly malicious import of a # module with side-effects that is not in the 'encodings' package. mod = __import__('encodings.' + modname, fromlist=_import_tail, level=0) except ImportError: # ImportError may occur because 'encodings.(modname)' does not exist, # or because it imports a name that does not exist (see mbcs and oem) pass else: break else: mod = None try: getregentry = mod.getregentry except AttributeError: # Not a codec module mod = None if mod is None: # Cache misses _cache[encoding] = None return None # Now ask the module for the registry entry entry = getregentry() if not isinstance(entry, codecs.CodecInfo): if not 4 <= len(entry) <= 7: raise CodecRegistryError('module "%s" (%s) failed to register' % (mod.__name__, mod.__file__)) if not callable(entry[0]) or not callable(entry[1]) or \ (entry[2] is not None and not callable(entry[2])) or \ (entry[3] is not None and not callable(entry[3])) or \ (len(entry) > 4 and entry[4] is not None and not callable(entry[4])) or \ (len(entry) > 5 and entry[5] is not None and not callable(entry[5])): raise CodecRegistryError('incompatible codecs in module "%s" (%s)' % (mod.__name__, mod.__file__)) if len(entry)<7 or entry[6] is None: entry += (None,)*(6-len(entry)) + (mod.__name__.split(".", 1)[1],) entry = codecs.CodecInfo(*entry) # Cache the codec registry entry _cache[encoding] = entry # Register its aliases (without overwriting previously registered # aliases) try: codecaliases = mod.getaliases() except AttributeError: pass else: for alias in codecaliases: if alias not in _aliases: _aliases[alias] = modname # Return the registry entry return entry # Register the search_function in the Python codec registry codecs.register(search_function) if sys.platform == 'win32': def _alias_mbcs(encoding): try: import _winapi ansi_code_page = "cp%s" % _winapi.GetACP() if encoding == ansi_code_page: import encodings.mbcs return encodings.mbcs.getregentry() except ImportError: # Imports may fail while we are shutting down pass codecs.register(_alias_mbcs)