diff options
author | 2017-06-11 14:33:57 +0300 | |
---|---|---|
committer | 2017-06-11 14:33:57 +0300 | |
commit | 04387deeab820e75c6d37d2ddd5b514cb7bcfd9e (patch) | |
tree | 2f4dfacba74ec390c4371c62dc96af2b1d5f19ef /jython-tosca-parser/src/main/resources/Lib/site-packages/pip/_vendor/requests/packages/chardet/chardetect.py | |
parent | fff70fce14ebe7dec3a4d52b7b90cee4414d0562 (diff) |
[SDC-32] separate Tosca Parser from DC
Change-Id: I7e7f31ff2bd92fec22031f75b7051d129a21d01b
Signed-off-by: Pavel Aharoni <pa0916@att.com>
Diffstat (limited to 'jython-tosca-parser/src/main/resources/Lib/site-packages/pip/_vendor/requests/packages/chardet/chardetect.py')
-rw-r--r-- | jython-tosca-parser/src/main/resources/Lib/site-packages/pip/_vendor/requests/packages/chardet/chardetect.py | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/pip/_vendor/requests/packages/chardet/chardetect.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/pip/_vendor/requests/packages/chardet/chardetect.py deleted file mode 100644 index ecd0163..0000000 --- a/jython-tosca-parser/src/main/resources/Lib/site-packages/pip/_vendor/requests/packages/chardet/chardetect.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/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 io import open -from sys import argv, stdin - -from chardet.universaldetector import UniversalDetector - - -def description_of(file, name='stdin'): - """Return a string describing the probable encoding of a file.""" - u = UniversalDetector() - for line in file: - u.feed(line) - u.close() - result = u.result - if result['encoding']: - return '%s: %s with confidence %s' % (name, - result['encoding'], - result['confidence']) - else: - return '%s: no result' % name - - -def main(): - if len(argv) <= 1: - print(description_of(stdin)) - else: - for path in argv[1:]: - with open(path, 'rb') as f: - print(description_of(f, path)) - - -if __name__ == '__main__': - main() |