summaryrefslogtreecommitdiff
path: root/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/chardet/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/chardet/__init__.py')
-rw-r--r--venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/chardet/__init__.py39
1 files changed, 0 insertions, 39 deletions
diff --git a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/chardet/__init__.py b/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/chardet/__init__.py
deleted file mode 100644
index 45bf7e6..0000000
--- a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/chardet/__init__.py
+++ /dev/null
@@ -1,39 +0,0 @@
1######################## BEGIN LICENSE BLOCK ########################
2# This library is free software; you can redistribute it and/or
3# modify it under the terms of the GNU Lesser General Public
4# License as published by the Free Software Foundation; either
5# version 2.1 of the License, or (at your option) any later version.
6#
7# This library is distributed in the hope that it will be useful,
8# but WITHOUT ANY WARRANTY; without even the implied warranty of
9# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10# Lesser General Public License for more details.
11#
12# You should have received a copy of the GNU Lesser General Public
13# License along with this library; if not, write to the Free Software
14# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
15# 02110-1301 USA
16######################### END LICENSE BLOCK #########################
17
18
19from .compat import PY2, PY3
20from .universaldetector import UniversalDetector
21from .version import __version__, VERSION
22
23
24def detect(byte_str):
25 """
26 Detect the encoding of the given byte string.
27
28 :param byte_str: The byte sequence to examine.
29 :type byte_str: ``bytes`` or ``bytearray``
30 """
31 if not isinstance(byte_str, bytearray):
32 if not isinstance(byte_str, bytes):
33 raise TypeError('Expected object of type bytes or bytearray, got: '
34 '{0}'.format(type(byte_str)))
35 else:
36 byte_str = bytearray(byte_str)
37 detector = UniversalDetector()
38 detector.feed(byte_str)
39 return detector.close()