Skip to content

Commit bacf188

Browse files
committed
Update of 3rd party library chardet
1 parent 75905e0 commit bacf188

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2019
-2953
lines changed

lib/core/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty.six import unichr as _unichr
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.6.3.1"
23+
VERSION = "1.6.3.2"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

thirdparty/chardet/__init__.py

+19-12
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,25 @@
1515
# 02110-1301 USA
1616
######################### END LICENSE BLOCK #########################
1717

18-
__version__ = "2.3.0"
19-
from sys import version_info
2018

19+
from .compat import PY2, PY3
20+
from .universaldetector import UniversalDetector
21+
from .version import __version__, VERSION
2122

22-
def detect(aBuf):
23-
if ((version_info < (3, 0) and isinstance(aBuf, unicode)) or
24-
(version_info >= (3, 0) and not isinstance(aBuf, bytes))):
25-
raise ValueError('Expected a bytes object, not a unicode object')
2623

27-
from . import universaldetector
28-
u = universaldetector.UniversalDetector()
29-
u.reset()
30-
u.feed(aBuf)
31-
u.close()
32-
return u.result
24+
def 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()

thirdparty/chardet/big5freq.py

+3-542
Large diffs are not rendered by default.

thirdparty/chardet/big5prober.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,20 @@
2828
from .mbcharsetprober import MultiByteCharSetProber
2929
from .codingstatemachine import CodingStateMachine
3030
from .chardistribution import Big5DistributionAnalysis
31-
from .mbcssm import Big5SMModel
31+
from .mbcssm import BIG5_SM_MODEL
3232

3333

3434
class Big5Prober(MultiByteCharSetProber):
3535
def __init__(self):
36-
MultiByteCharSetProber.__init__(self)
37-
self._mCodingSM = CodingStateMachine(Big5SMModel)
38-
self._mDistributionAnalyzer = Big5DistributionAnalysis()
36+
super(Big5Prober, self).__init__()
37+
self.coding_sm = CodingStateMachine(BIG5_SM_MODEL)
38+
self.distribution_analyzer = Big5DistributionAnalysis()
3939
self.reset()
4040

41-
def get_charset_name(self):
41+
@property
42+
def charset_name(self):
4243
return "Big5"
44+
45+
@property
46+
def language(self):
47+
return "Chinese"

thirdparty/chardet/chardetect.py

-80
This file was deleted.

0 commit comments

Comments
 (0)