PATH:
usr
/
local
/
jetapps
/
var
/
lib
/
aws
/
lib
/
python2.7
/
site-packages
/
pip
/
_vendor
/
requests
/
packages
/
chardet
#!/usr/bin/env python """ Script which takes one or more file paths and reports on their detected encodings Example:: % chardetect somefile someotherfile somefile: windows-1252 with confidence 0.5 someotherfile: ascii with confidence 1.0 If no paths are provided, it takes its input from stdin. """ from __future__ import absolute_import, print_function, unicode_literals import argparse import sys from io import open from chardet import __version__ from chardet.universaldetector import UniversalDetector def description_of(lines, name='stdin'): """ Return a string describing the probable encoding of a file or list of strings. :param lines: The lines to get the encoding of. :type lines: Iterable of bytes :param name: Name of file or collection of lines :type name: str """ u = UniversalDetector() for line in lines: u.feed(line) u.close() result = u.result if result['encoding']: return '{0}: {1} with confidence {2}'.format(name, result['encoding'], result['confidence']) else: return '{0}: no result'.format(name) def main(argv=None): ''' Handles command line arguments and gets things started. :param argv: List of arguments, as if specified on the command-line. If None, ``sys.argv[1:]`` is used instead. :type argv: list of str ''' # Get command line arguments parser = argparse.ArgumentParser( description="Takes one or more file paths and reports their detected \ encodings", formatter_class=argparse.ArgumentDefaultsHelpFormatter, conflict_handler='resolve') parser.add_argument('input', help='File whose encoding we would like to determine.', type=argparse.FileType('rb'), nargs='*', default=[sys.stdin]) parser.add_argument('--version', action='version', version='%(prog)s {0}'.format(__version__)) args = parser.parse_args(argv) for f in args.input: if f.isatty(): print("You are running chardetect interactively. Press " + "CTRL-D twice at the start of a blank line to signal the " + "end of your input. If you want help, run chardetect " + "--help\n", file=sys.stderr) print(description_of(f, f.name)) if __name__ == '__main__': main()
[-] sbcharsetprober.pyc
[edit]
[-] langhungarianmodel.pyc
[edit]
[-] mbcssm.py
[edit]
[-] langcyrillicmodel.pyc
[edit]
[-] euckrprober.py
[edit]
[-] charsetprober.py
[edit]
[-] sbcsgroupprober.py
[edit]
[-] euckrfreq.pyc
[edit]
[-] utf8prober.py
[edit]
[-] eucjpprober.py
[edit]
[-] mbcsgroupprober.pyc
[edit]
[-] chardistribution.pyc
[edit]
[-] codingstatemachine.py
[edit]
[-] eucjpprober.pyc
[edit]
[-] gb2312prober.py
[edit]
[-] sjisprober.py
[edit]
[-] escprober.py
[edit]
[-] universaldetector.py
[edit]
[+]
..
[-] gb2312freq.py
[edit]
[-] mbcharsetprober.py
[edit]
[-] big5freq.py
[edit]
[-] langgreekmodel.pyc
[edit]
[-] sjisprober.pyc
[edit]
[-] jisfreq.pyc
[edit]
[-] euctwprober.pyc
[edit]
[-] euctwprober.py
[edit]
[-] __init__.pyc
[edit]
[-] mbcssm.pyc
[edit]
[-] sbcsgroupprober.pyc
[edit]
[-] langthaimodel.py
[edit]
[-] charsetprober.pyc
[edit]
[-] sbcharsetprober.py
[edit]
[-] big5freq.pyc
[edit]
[-] cp949prober.pyc
[edit]
[-] constants.py
[edit]
[-] hebrewprober.pyc
[edit]
[-] langgreekmodel.py
[edit]
[-] euctwfreq.py
[edit]
[-] escsm.py
[edit]
[-] jpcntx.pyc
[edit]
[-] euckrfreq.py
[edit]
[-] big5prober.pyc
[edit]
[-] langbulgarianmodel.py
[edit]
[-] compat.pyc
[edit]
[-] langthaimodel.pyc
[edit]
[-] gb2312prober.pyc
[edit]
[-] compat.py
[edit]
[-] big5prober.py
[edit]
[-] cp949prober.py
[edit]
[-] jisfreq.py
[edit]
[-] mbcsgroupprober.py
[edit]
[-] chardetect.py
[edit]
[-] latin1prober.pyc
[edit]
[-] charsetgroupprober.py
[edit]
[-] __init__.py
[edit]
[-] hebrewprober.py
[edit]
[-] universaldetector.pyc
[edit]
[-] charsetgroupprober.pyc
[edit]
[-] latin1prober.py
[edit]
[-] langbulgarianmodel.pyc
[edit]
[-] escsm.pyc
[edit]
[-] jpcntx.py
[edit]
[-] escprober.pyc
[edit]
[-] langcyrillicmodel.py
[edit]
[-] chardetect.pyc
[edit]
[-] constants.pyc
[edit]
[-] mbcharsetprober.pyc
[edit]
[-] gb2312freq.pyc
[edit]
[-] langhebrewmodel.py
[edit]
[-] euctwfreq.pyc
[edit]
[-] chardistribution.py
[edit]
[-] langhebrewmodel.pyc
[edit]
[-] langhungarianmodel.py
[edit]
[-] utf8prober.pyc
[edit]
[-] codingstatemachine.pyc
[edit]
[-] euckrprober.pyc
[edit]