MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / detect

Function detect

thirdparty/chardet/__init__.py:24–39  ·  view source on GitHub ↗

Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray``

(byte_str)

Source from the content-addressed store, hash-verified

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()

Callers 1

getHeuristicCharEncodingFunction · 0.90

Calls 4

feedMethod · 0.95
closeMethod · 0.95
UniversalDetectorClass · 0.85
formatMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…