golden hour
/opt/alt/python37/lib/python3.7/site-packages/pip/_vendor/chardet
⬆️ Go Up
Upload
File/Folder
Size
Actions
__init__.py
1.52 KB
Del
OK
__init__.pyc
1020 B
Del
OK
__init__.pyo
1020 B
Del
OK
__pycache__
-
Del
OK
big5freq.py
30.52 KB
Del
OK
big5freq.pyc
53.43 KB
Del
OK
big5freq.pyo
53.43 KB
Del
OK
big5prober.py
1.72 KB
Del
OK
big5prober.pyc
1.39 KB
Del
OK
big5prober.pyo
1.39 KB
Del
OK
chardistribution.py
9.19 KB
Del
OK
chardistribution.pyc
8 KB
Del
OK
chardistribution.pyo
8 KB
Del
OK
charsetgroupprober.py
3.7 KB
Del
OK
charsetgroupprober.pyc
2.91 KB
Del
OK
charsetgroupprober.pyo
2.91 KB
Del
OK
charsetprober.py
4.99 KB
Del
OK
charsetprober.pyc
4.19 KB
Del
OK
charsetprober.pyo
4.19 KB
Del
OK
cli
-
Del
OK
codingstatemachine.py
3.51 KB
Del
OK
codingstatemachine.pyc
3.38 KB
Del
OK
codingstatemachine.pyo
3.38 KB
Del
OK
compat.py
1.11 KB
Del
OK
compat.pyc
417 B
Del
OK
compat.pyo
417 B
Del
OK
cp949prober.py
1.81 KB
Del
OK
cp949prober.pyc
1.4 KB
Del
OK
cp949prober.pyo
1.4 KB
Del
OK
enums.py
1.62 KB
Del
OK
enums.pyc
3.16 KB
Del
OK
enums.pyo
3.16 KB
Del
OK
escprober.py
3.86 KB
Del
OK
escprober.pyc
3.26 KB
Del
OK
escprober.pyo
3.26 KB
Del
OK
escsm.py
10.26 KB
Del
OK
escsm.pyc
7.84 KB
Del
OK
escsm.pyo
7.84 KB
Del
OK
eucjpprober.py
3.66 KB
Del
OK
eucjpprober.pyc
3.08 KB
Del
OK
eucjpprober.pyo
3.08 KB
Del
OK
euckrfreq.py
13.23 KB
Del
OK
euckrfreq.pyc
23.54 KB
Del
OK
euckrfreq.pyo
23.54 KB
Del
OK
euckrprober.py
1.71 KB
Del
OK
euckrprober.pyc
1.4 KB
Del
OK
euckrprober.pyo
1.4 KB
Del
OK
euctwfreq.py
30.88 KB
Del
OK
euctwfreq.pyc
53.44 KB
Del
OK
euctwfreq.pyo
53.44 KB
Del
OK
euctwprober.py
1.71 KB
Del
OK
euctwprober.pyc
1.4 KB
Del
OK
euctwprober.pyo
1.4 KB
Del
OK
gb2312freq.py
20.23 KB
Del
OK
gb2312freq.pyc
37.47 KB
Del
OK
gb2312freq.pyo
37.47 KB
Del
OK
gb2312prober.py
1.71 KB
Del
OK
gb2312prober.pyc
1.41 KB
Del
OK
gb2312prober.pyo
1.41 KB
Del
OK
hebrewprober.py
13.51 KB
Del
OK
hebrewprober.pyc
3.86 KB
Del
OK
hebrewprober.pyo
3.86 KB
Del
OK
jisfreq.py
25.17 KB
Del
OK
jisfreq.pyc
43.47 KB
Del
OK
jisfreq.pyo
43.47 KB
Del
OK
jpcntx.py
19.18 KB
Del
OK
jpcntx.pyc
24.91 KB
Del
OK
jpcntx.pyo
24.91 KB
Del
OK
langbulgarianmodel.py
12.54 KB
Del
OK
langbulgarianmodel.pyc
24.39 KB
Del
OK
langbulgarianmodel.pyo
24.39 KB
Del
OK
langcyrillicmodel.py
17.53 KB
Del
OK
langcyrillicmodel.pyc
29.98 KB
Del
OK
langcyrillicmodel.pyo
29.98 KB
Del
OK
langgreekmodel.py
12.39 KB
Del
OK
langgreekmodel.pyc
24.07 KB
Del
OK
langgreekmodel.pyo
24.07 KB
Del
OK
langhebrewmodel.py
11.08 KB
Del
OK
langhebrewmodel.pyc
22.91 KB
Del
OK
langhebrewmodel.pyo
22.91 KB
Del
OK
langhungarianmodel.py
12.3 KB
Del
OK
langhungarianmodel.pyc
24.36 KB
Del
OK
langhungarianmodel.pyo
24.36 KB
Del
OK
langthaimodel.py
11.03 KB
Del
OK
langthaimodel.pyc
22.89 KB
Del
OK
langthaimodel.pyo
22.89 KB
Del
OK
langturkishmodel.py
10.84 KB
Del
OK
langturkishmodel.pyc
22.91 KB
Del
OK
langturkishmodel.pyo
22.91 KB
Del
OK
latin1prober.py
5.24 KB
Del
OK
latin1prober.pyc
3.75 KB
Del
OK
latin1prober.pyo
3.75 KB
Del
OK
mbcharsetprober.py
3.33 KB
Del
OK
mbcharsetprober.pyc
2.83 KB
Del
OK
mbcharsetprober.pyo
2.83 KB
Del
OK
mbcsgroupprober.py
1.96 KB
Del
OK
mbcsgroupprober.pyc
1.34 KB
Del
OK
mbcsgroupprober.pyo
1.34 KB
Del
OK
mbcssm.py
24.88 KB
Del
OK
mbcssm.pyc
18.69 KB
Del
OK
mbcssm.pyo
18.69 KB
Del
OK
sbcharsetprober.py
5.52 KB
Del
OK
sbcharsetprober.pyc
3.69 KB
Del
OK
sbcharsetprober.pyo
3.69 KB
Del
OK
sbcsgroupprober.py
3.46 KB
Del
OK
sbcsgroupprober.pyc
1.92 KB
Del
OK
sbcsgroupprober.pyo
1.92 KB
Del
OK
sjisprober.py
3.69 KB
Del
OK
sjisprober.pyc
3.1 KB
Del
OK
sjisprober.pyo
3.1 KB
Del
OK
universaldetector.py
12.19 KB
Del
OK
universaldetector.pyc
7.03 KB
Del
OK
universaldetector.pyo
7.03 KB
Del
OK
utf8prober.py
2.7 KB
Del
OK
utf8prober.pyc
2.56 KB
Del
OK
utf8prober.pyo
2.56 KB
Del
OK
version.py
242 B
Del
OK
version.pyc
444 B
Del
OK
version.pyo
444 B
Del
OK
Edit: escprober.py
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetprober import CharSetProber from .codingstatemachine import CodingStateMachine from .enums import LanguageFilter, ProbingState, MachineState from .escsm import (HZ_SM_MODEL, ISO2022CN_SM_MODEL, ISO2022JP_SM_MODEL, ISO2022KR_SM_MODEL) class EscCharSetProber(CharSetProber): """ This CharSetProber uses a "code scheme" approach for detecting encodings, whereby easily recognizable escape or shift sequences are relied on to identify these encodings. """ def __init__(self, lang_filter=None): super(EscCharSetProber, self).__init__(lang_filter=lang_filter) self.coding_sm = [] if self.lang_filter & LanguageFilter.CHINESE_SIMPLIFIED: self.coding_sm.append(CodingStateMachine(HZ_SM_MODEL)) self.coding_sm.append(CodingStateMachine(ISO2022CN_SM_MODEL)) if self.lang_filter & LanguageFilter.JAPANESE: self.coding_sm.append(CodingStateMachine(ISO2022JP_SM_MODEL)) if self.lang_filter & LanguageFilter.KOREAN: self.coding_sm.append(CodingStateMachine(ISO2022KR_SM_MODEL)) self.active_sm_count = None self._detected_charset = None self._detected_language = None self._state = None self.reset() def reset(self): super(EscCharSetProber, self).reset() for coding_sm in self.coding_sm: if not coding_sm: continue coding_sm.active = True coding_sm.reset() self.active_sm_count = len(self.coding_sm) self._detected_charset = None self._detected_language = None @property def charset_name(self): return self._detected_charset @property def language(self): return self._detected_language def get_confidence(self): if self._detected_charset: return 0.99 else: return 0.00 def feed(self, byte_str): for c in byte_str: for coding_sm in self.coding_sm: if not coding_sm or not coding_sm.active: continue coding_state = coding_sm.next_state(c) if coding_state == MachineState.ERROR: coding_sm.active = False self.active_sm_count -= 1 if self.active_sm_count <= 0: self._state = ProbingState.NOT_ME return self.state elif coding_state == MachineState.ITS_ME: self._state = ProbingState.FOUND_IT self._detected_charset = coding_sm.get_coding_state_machine() self._detected_language = coding_sm.language return self.state return self.state
Save