annotate charset_normalizer/__init__.py @ 16:dc2c003078e9 tip

planemo upload for repository https://toolrepo.galaxytrakr.org/view/jpayne/bioproject_to_srr_2/556cac4fb538
author jpayne
date Tue, 21 May 2024 01:09:25 -0400
parents 5eb2d5e3bf22
children
rev   line source
jpayne@7 1 # -*- coding: utf-8 -*-
jpayne@7 2 """
jpayne@7 3 Charset-Normalizer
jpayne@7 4 ~~~~~~~~~~~~~~
jpayne@7 5 The Real First Universal Charset Detector.
jpayne@7 6 A library that helps you read text from an unknown charset encoding.
jpayne@7 7 Motivated by chardet, This package is trying to resolve the issue by taking a new approach.
jpayne@7 8 All IANA character set names for which the Python core library provides codecs are supported.
jpayne@7 9
jpayne@7 10 Basic usage:
jpayne@7 11 >>> from charset_normalizer import from_bytes
jpayne@7 12 >>> results = from_bytes('Bсеки човек има право на образование. Oбразованието!'.encode('utf_8'))
jpayne@7 13 >>> best_guess = results.best()
jpayne@7 14 >>> str(best_guess)
jpayne@7 15 'Bсеки човек има право на образование. Oбразованието!'
jpayne@7 16
jpayne@7 17 Others methods and usages are available - see the full documentation
jpayne@7 18 at <https://github.com/Ousret/charset_normalizer>.
jpayne@7 19 :copyright: (c) 2021 by Ahmed TAHRI
jpayne@7 20 :license: MIT, see LICENSE for more details.
jpayne@7 21 """
jpayne@7 22 import logging
jpayne@7 23
jpayne@7 24 from .api import from_bytes, from_fp, from_path, is_binary
jpayne@7 25 from .legacy import detect
jpayne@7 26 from .models import CharsetMatch, CharsetMatches
jpayne@7 27 from .utils import set_logging_handler
jpayne@7 28 from .version import VERSION, __version__
jpayne@7 29
jpayne@7 30 __all__ = (
jpayne@7 31 "from_fp",
jpayne@7 32 "from_path",
jpayne@7 33 "from_bytes",
jpayne@7 34 "is_binary",
jpayne@7 35 "detect",
jpayne@7 36 "CharsetMatch",
jpayne@7 37 "CharsetMatches",
jpayne@7 38 "__version__",
jpayne@7 39 "VERSION",
jpayne@7 40 "set_logging_handler",
jpayne@7 41 )
jpayne@7 42
jpayne@7 43 # Attach a NullHandler to the top level logger by default
jpayne@7 44 # https://docs.python.org/3.3/howto/logging.html#configuring-logging-for-a-library
jpayne@7 45
jpayne@7 46 logging.getLogger("charset_normalizer").addHandler(logging.NullHandler())