com.googler.python 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/package.json +4 -2
  2. package/python3.4.2/lib/python3.4/site-packages/pip/__init__.py +1 -277
  3. package/python3.4.2/lib/python3.4/site-packages/pip/__main__.py +19 -7
  4. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/__init__.py +246 -0
  5. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/basecommand.py +373 -0
  6. package/python3.4.2/lib/python3.4/site-packages/pip/{baseparser.py → _internal/baseparser.py} +240 -224
  7. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/build_env.py +92 -0
  8. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/cache.py +202 -0
  9. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/cmdoptions.py +609 -0
  10. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/__init__.py +79 -0
  11. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/check.py +42 -0
  12. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/completion.py +94 -0
  13. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/configuration.py +227 -0
  14. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/download.py +233 -0
  15. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/freeze.py +96 -0
  16. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/hash.py +57 -0
  17. package/python3.4.2/lib/python3.4/site-packages/pip/{commands → _internal/commands}/help.py +36 -33
  18. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/install.py +477 -0
  19. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/list.py +343 -0
  20. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/search.py +135 -0
  21. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/show.py +164 -0
  22. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/uninstall.py +71 -0
  23. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/wheel.py +179 -0
  24. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/compat.py +235 -0
  25. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/configuration.py +378 -0
  26. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/download.py +922 -0
  27. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/exceptions.py +249 -0
  28. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/index.py +1117 -0
  29. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/locations.py +194 -0
  30. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/models/__init__.py +4 -0
  31. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/models/index.py +15 -0
  32. package/python3.4.2/lib/python3.4/site-packages/pip/{_vendor/requests/packages/urllib3/contrib → _internal/operations}/__init__.py +0 -0
  33. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/check.py +106 -0
  34. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/freeze.py +252 -0
  35. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/prepare.py +378 -0
  36. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/pep425tags.py +317 -0
  37. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/__init__.py +69 -0
  38. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_file.py +338 -0
  39. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_install.py +1115 -0
  40. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_set.py +164 -0
  41. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_uninstall.py +455 -0
  42. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/resolve.py +354 -0
  43. package/python3.4.2/lib/python3.4/site-packages/pip/{status_codes.py → _internal/status_codes.py} +8 -6
  44. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/__init__.py +0 -0
  45. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/appdirs.py +258 -0
  46. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/deprecation.py +77 -0
  47. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/encoding.py +33 -0
  48. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/filesystem.py +28 -0
  49. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/glibc.py +84 -0
  50. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/hashes.py +94 -0
  51. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/logging.py +132 -0
  52. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/misc.py +851 -0
  53. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/outdated.py +163 -0
  54. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/packaging.py +70 -0
  55. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/setuptools_build.py +8 -0
  56. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/temp_dir.py +82 -0
  57. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/typing.py +29 -0
  58. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/ui.py +421 -0
  59. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/__init__.py +471 -0
  60. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/bazaar.py +113 -0
  61. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/git.py +311 -0
  62. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/mercurial.py +105 -0
  63. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/subversion.py +271 -0
  64. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/wheel.py +817 -0
  65. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/__init__.py +109 -8
  66. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/appdirs.py +604 -0
  67. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/__init__.py +11 -0
  68. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/_cmd.py +60 -0
  69. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/adapter.py +134 -0
  70. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/cache.py +39 -0
  71. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/__init__.py +2 -0
  72. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py +133 -0
  73. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py +43 -0
  74. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/compat.py +29 -0
  75. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/controller.py +373 -0
  76. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/filewrapper.py +78 -0
  77. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/heuristics.py +138 -0
  78. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/serialize.py +194 -0
  79. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/wrapper.py +27 -0
  80. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/__init__.py +3 -0
  81. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/__main__.py +2 -0
  82. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests → certifi}/cacert.pem +1765 -2358
  83. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/core.py +37 -0
  84. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/__init__.py +39 -32
  85. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/big5freq.py +386 -0
  86. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/big5prober.py +47 -42
  87. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/chardistribution.py +233 -231
  88. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/charsetgroupprober.py +106 -0
  89. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/charsetprober.py +145 -0
  90. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/cli/__init__.py +1 -0
  91. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/cli/chardetect.py +85 -0
  92. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/codingstatemachine.py +88 -0
  93. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/compat.py +34 -34
  94. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/cp949prober.py +49 -44
  95. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/enums.py +76 -0
  96. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/escprober.py +101 -0
  97. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/escsm.py +246 -0
  98. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/eucjpprober.py +92 -0
  99. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/euckrfreq.py +195 -0
  100. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euckrprober.py +47 -42
  101. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euctwfreq.py +387 -428
  102. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euctwprober.py +46 -41
  103. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/gb2312freq.py +283 -472
  104. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/gb2312prober.py +46 -41
  105. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/hebrewprober.py +292 -283
  106. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/jisfreq.py +325 -569
  107. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/jpcntx.py +233 -219
  108. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langbulgarianmodel.py +228 -229
  109. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langcyrillicmodel.py +333 -329
  110. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langgreekmodel.py +225 -225
  111. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langhebrewmodel.py +200 -201
  112. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langhungarianmodel.py +225 -225
  113. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langthaimodel.py +199 -200
  114. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/langturkishmodel.py +193 -0
  115. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/latin1prober.py +145 -139
  116. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/mbcharsetprober.py +91 -0
  117. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/mbcsgroupprober.py +54 -54
  118. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/mbcssm.py +572 -0
  119. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/sbcharsetprober.py +132 -0
  120. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/sbcsgroupprober.py +73 -69
  121. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/sjisprober.py +92 -0
  122. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/universaldetector.py +286 -0
  123. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/utf8prober.py +82 -76
  124. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/version.py +9 -0
  125. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/__init__.py +7 -7
  126. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/ansi.py +102 -50
  127. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/ansitowin32.py +236 -190
  128. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/initialise.py +82 -56
  129. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/win32.py +156 -137
  130. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/winterm.py +162 -120
  131. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/__init__.py +23 -23
  132. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/__init__.py +6 -6
  133. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/misc.py +41 -41
  134. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/shutil.py +761 -761
  135. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/sysconfig.cfg +84 -84
  136. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/sysconfig.py +788 -788
  137. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/tarfile.py +2607 -2607
  138. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/compat.py +1117 -1064
  139. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/database.py +1318 -1301
  140. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/index.py +516 -488
  141. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/locators.py +1292 -1194
  142. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/manifest.py +393 -364
  143. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/markers.py +131 -190
  144. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/metadata.py +1068 -1026
  145. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/resources.py +355 -317
  146. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/scripts.py +415 -323
  147. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/t32.exe +0 -0
  148. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/t64.exe +0 -0
  149. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/util.py +1755 -1575
  150. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/version.py +736 -721
  151. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/w32.exe +0 -0
  152. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/w64.exe +0 -0
  153. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/wheel.py +984 -958
  154. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distro.py +1104 -0
  155. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/__init__.py +35 -23
  156. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{ihatexml.py → _ihatexml.py} +288 -285
  157. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{inputstream.py → _inputstream.py} +923 -881
  158. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{tokenizer.py → _tokenizer.py} +1721 -1731
  159. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/__init__.py +14 -12
  160. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/_base.py +37 -37
  161. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/datrie.py +44 -44
  162. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/py.py +67 -67
  163. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{utils.py → _utils.py} +124 -82
  164. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/constants.py +2947 -3104
  165. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.py +29 -20
  166. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/{_base.py → base.py} +12 -12
  167. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/inject_meta_charset.py +73 -65
  168. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/lint.py +93 -93
  169. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/optionaltags.py +207 -205
  170. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/sanitizer.py +896 -12
  171. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/whitespace.py +38 -38
  172. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/html5parser.py +2791 -2713
  173. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer.py +409 -0
  174. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/__init__.py +30 -0
  175. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/genshi.py +54 -0
  176. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/sax.py +50 -44
  177. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/__init__.py +88 -76
  178. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/{_base.py → base.py} +417 -377
  179. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/dom.py +236 -227
  180. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/etree.py +340 -337
  181. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.py +366 -369
  182. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/__init__.py +154 -57
  183. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{_base.py → base.py} +252 -200
  184. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/dom.py +43 -46
  185. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/etree.py +130 -138
  186. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{lxmletree.py → etree_lxml.py} +213 -208
  187. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{genshistream.py → genshi.py} +69 -69
  188. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/__init__.py +2 -0
  189. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/codec.py +118 -0
  190. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/compat.py +12 -0
  191. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/core.py +387 -0
  192. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/idnadata.py +1585 -0
  193. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/intranges.py +53 -0
  194. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/package_data.py +2 -0
  195. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/uts46data.py +7634 -0
  196. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/ipaddress.py +2419 -0
  197. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/__init__.py +347 -0
  198. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/linklockfile.py +73 -0
  199. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/mkdirlockfile.py +84 -0
  200. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/pidlockfile.py +190 -0
  201. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/sqlitelockfile.py +156 -0
  202. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/symlinklockfile.py +70 -0
  203. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/__init__.py +66 -0
  204. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/_version.py +1 -0
  205. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/exceptions.py +41 -0
  206. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/fallback.py +971 -0
  207. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/__about__.py +21 -0
  208. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/__init__.py +14 -0
  209. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/_compat.py +30 -0
  210. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/_structures.py +70 -0
  211. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/markers.py +301 -0
  212. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/requirements.py +130 -0
  213. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/specifiers.py +774 -0
  214. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/utils.py +63 -0
  215. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/version.py +441 -0
  216. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{pkg_resources.py → pkg_resources/__init__.py} +3125 -2762
  217. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources/py31compat.py +22 -0
  218. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/__init__.py +127 -0
  219. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/bar.py +88 -0
  220. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/counter.py +48 -0
  221. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/helpers.py +91 -0
  222. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/spinner.py +44 -0
  223. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pyparsing.py +5720 -0
  224. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/__init__.py +3 -0
  225. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/core.py +13 -0
  226. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/parser.py +374 -0
  227. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/writer.py +127 -0
  228. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/__init__.py +123 -77
  229. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/__version__.py +14 -0
  230. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/_internal_utils.py +42 -0
  231. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/adapters.py +525 -388
  232. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/api.py +152 -120
  233. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/auth.py +293 -193
  234. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/certs.py +18 -24
  235. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/compat.py +73 -115
  236. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/cookies.py +542 -454
  237. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/exceptions.py +122 -75
  238. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/help.py +120 -0
  239. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/hooks.py +34 -45
  240. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/models.py +948 -803
  241. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages.py +16 -0
  242. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py +737 -637
  243. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/status_codes.py +91 -88
  244. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/structures.py +105 -127
  245. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/utils.py +904 -673
  246. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/retrying.py +267 -0
  247. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/six.py +891 -646
  248. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/__init__.py +97 -0
  249. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/_collections.py +319 -0
  250. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/connection.py +373 -0
  251. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/connectionpool.py +905 -710
  252. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/__init__.py +0 -0
  253. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py +0 -0
  254. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +593 -0
  255. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py +343 -0
  256. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/appengine.py +296 -0
  257. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/contrib/ntlmpool.py +112 -120
  258. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py +455 -0
  259. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/securetransport.py +810 -0
  260. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/socks.py +188 -0
  261. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/exceptions.py +246 -0
  262. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/fields.py +178 -177
  263. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/filepost.py +94 -100
  264. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/__init__.py +5 -4
  265. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/backports/__init__.py +0 -0
  266. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py +53 -0
  267. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ordered_dict.py +259 -260
  268. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/six.py +868 -0
  269. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ssl_match_hostname/__init__.py +19 -13
  270. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ssl_match_hostname/_implementation.py +157 -105
  271. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/poolmanager.py +440 -0
  272. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/request.py +148 -141
  273. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/response.py +626 -0
  274. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/__init__.py +54 -0
  275. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/connection.py +130 -0
  276. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/request.py +118 -0
  277. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/response.py +81 -0
  278. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/retry.py +401 -0
  279. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/selectors.py +581 -0
  280. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/ssl_.py +341 -0
  281. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/util/timeout.py +242 -234
  282. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/util/url.py +230 -162
  283. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/wait.py +40 -0
  284. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/__init__.py +342 -0
  285. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/labels.py +231 -0
  286. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/mklabels.py +59 -0
  287. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/tests.py +153 -0
  288. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/x_user_defined.py +325 -0
  289. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/_markerlib/__init__.py +0 -16
  290. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/_markerlib/markers.py +0 -119
  291. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/sanitizer.py +0 -271
  292. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer/__init__.py +0 -16
  293. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer/htmlserializer.py +0 -320
  294. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/pulldom.py +0 -63
  295. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/re-vendor.py +0 -34
  296. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/__init__.py +0 -3
  297. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/big5freq.py +0 -925
  298. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/chardetect.py +0 -46
  299. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/charsetgroupprober.py +0 -106
  300. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/charsetprober.py +0 -62
  301. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/codingstatemachine.py +0 -61
  302. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/constants.py +0 -39
  303. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/escprober.py +0 -86
  304. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/escsm.py +0 -242
  305. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/eucjpprober.py +0 -90
  306. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/euckrfreq.py +0 -596
  307. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/mbcharsetprober.py +0 -86
  308. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/mbcssm.py +0 -575
  309. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/sbcharsetprober.py +0 -120
  310. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/sjisprober.py +0 -91
  311. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/universaldetector.py +0 -170
  312. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py +0 -58
  313. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/_collections.py +0 -205
  314. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connection.py +0 -204
  315. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py +0 -422
  316. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/exceptions.py +0 -126
  317. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/packages/six.py +0 -385
  318. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py +0 -258
  319. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/response.py +0 -308
  320. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/__init__.py +0 -27
  321. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/connection.py +0 -45
  322. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/request.py +0 -68
  323. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/response.py +0 -13
  324. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py +0 -133
  325. package/python3.4.2/lib/python3.4/site-packages/pip/backwardcompat/__init__.py +0 -138
  326. package/python3.4.2/lib/python3.4/site-packages/pip/basecommand.py +0 -201
  327. package/python3.4.2/lib/python3.4/site-packages/pip/cmdoptions.py +0 -371
  328. package/python3.4.2/lib/python3.4/site-packages/pip/commands/__init__.py +0 -88
  329. package/python3.4.2/lib/python3.4/site-packages/pip/commands/bundle.py +0 -42
  330. package/python3.4.2/lib/python3.4/site-packages/pip/commands/completion.py +0 -59
  331. package/python3.4.2/lib/python3.4/site-packages/pip/commands/freeze.py +0 -114
  332. package/python3.4.2/lib/python3.4/site-packages/pip/commands/install.py +0 -314
  333. package/python3.4.2/lib/python3.4/site-packages/pip/commands/list.py +0 -162
  334. package/python3.4.2/lib/python3.4/site-packages/pip/commands/search.py +0 -132
  335. package/python3.4.2/lib/python3.4/site-packages/pip/commands/show.py +0 -80
  336. package/python3.4.2/lib/python3.4/site-packages/pip/commands/uninstall.py +0 -59
  337. package/python3.4.2/lib/python3.4/site-packages/pip/commands/unzip.py +0 -7
  338. package/python3.4.2/lib/python3.4/site-packages/pip/commands/wheel.py +0 -195
  339. package/python3.4.2/lib/python3.4/site-packages/pip/commands/zip.py +0 -351
  340. package/python3.4.2/lib/python3.4/site-packages/pip/download.py +0 -644
  341. package/python3.4.2/lib/python3.4/site-packages/pip/exceptions.py +0 -46
  342. package/python3.4.2/lib/python3.4/site-packages/pip/index.py +0 -990
  343. package/python3.4.2/lib/python3.4/site-packages/pip/locations.py +0 -171
  344. package/python3.4.2/lib/python3.4/site-packages/pip/log.py +0 -276
  345. package/python3.4.2/lib/python3.4/site-packages/pip/pep425tags.py +0 -102
  346. package/python3.4.2/lib/python3.4/site-packages/pip/req.py +0 -1931
  347. package/python3.4.2/lib/python3.4/site-packages/pip/runner.py +0 -18
  348. package/python3.4.2/lib/python3.4/site-packages/pip/util.py +0 -720
  349. package/python3.4.2/lib/python3.4/site-packages/pip/vcs/__init__.py +0 -251
  350. package/python3.4.2/lib/python3.4/site-packages/pip/vcs/bazaar.py +0 -131
  351. package/python3.4.2/lib/python3.4/site-packages/pip/vcs/git.py +0 -194
  352. package/python3.4.2/lib/python3.4/site-packages/pip/vcs/mercurial.py +0 -151
  353. package/python3.4.2/lib/python3.4/site-packages/pip/vcs/subversion.py +0 -273
  354. package/python3.4.2/lib/python3.4/site-packages/pip/wheel.py +0 -560
@@ -0,0 +1,132 @@
1
+ ######################## BEGIN LICENSE BLOCK ########################
2
+ # The Original Code is Mozilla Universal charset detector code.
3
+ #
4
+ # The Initial Developer of the Original Code is
5
+ # Netscape Communications Corporation.
6
+ # Portions created by the Initial Developer are Copyright (C) 2001
7
+ # the Initial Developer. All Rights Reserved.
8
+ #
9
+ # Contributor(s):
10
+ # Mark Pilgrim - port to Python
11
+ # Shy Shalom - original C code
12
+ #
13
+ # This library is free software; you can redistribute it and/or
14
+ # modify it under the terms of the GNU Lesser General Public
15
+ # License as published by the Free Software Foundation; either
16
+ # version 2.1 of the License, or (at your option) any later version.
17
+ #
18
+ # This library is distributed in the hope that it will be useful,
19
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
+ # Lesser General Public License for more details.
22
+ #
23
+ # You should have received a copy of the GNU Lesser General Public
24
+ # License along with this library; if not, write to the Free Software
25
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26
+ # 02110-1301 USA
27
+ ######################### END LICENSE BLOCK #########################
28
+
29
+ from .charsetprober import CharSetProber
30
+ from .enums import CharacterCategory, ProbingState, SequenceLikelihood
31
+
32
+
33
+ class SingleByteCharSetProber(CharSetProber):
34
+ SAMPLE_SIZE = 64
35
+ SB_ENOUGH_REL_THRESHOLD = 1024 # 0.25 * SAMPLE_SIZE^2
36
+ POSITIVE_SHORTCUT_THRESHOLD = 0.95
37
+ NEGATIVE_SHORTCUT_THRESHOLD = 0.05
38
+
39
+ def __init__(self, model, reversed=False, name_prober=None):
40
+ super(SingleByteCharSetProber, self).__init__()
41
+ self._model = model
42
+ # TRUE if we need to reverse every pair in the model lookup
43
+ self._reversed = reversed
44
+ # Optional auxiliary prober for name decision
45
+ self._name_prober = name_prober
46
+ self._last_order = None
47
+ self._seq_counters = None
48
+ self._total_seqs = None
49
+ self._total_char = None
50
+ self._freq_char = None
51
+ self.reset()
52
+
53
+ def reset(self):
54
+ super(SingleByteCharSetProber, self).reset()
55
+ # char order of last character
56
+ self._last_order = 255
57
+ self._seq_counters = [0] * SequenceLikelihood.get_num_categories()
58
+ self._total_seqs = 0
59
+ self._total_char = 0
60
+ # characters that fall in our sampling range
61
+ self._freq_char = 0
62
+
63
+ @property
64
+ def charset_name(self):
65
+ if self._name_prober:
66
+ return self._name_prober.charset_name
67
+ else:
68
+ return self._model['charset_name']
69
+
70
+ @property
71
+ def language(self):
72
+ if self._name_prober:
73
+ return self._name_prober.language
74
+ else:
75
+ return self._model.get('language')
76
+
77
+ def feed(self, byte_str):
78
+ if not self._model['keep_english_letter']:
79
+ byte_str = self.filter_international_words(byte_str)
80
+ if not byte_str:
81
+ return self.state
82
+ char_to_order_map = self._model['char_to_order_map']
83
+ for i, c in enumerate(byte_str):
84
+ # XXX: Order is in range 1-64, so one would think we want 0-63 here,
85
+ # but that leads to 27 more test failures than before.
86
+ order = char_to_order_map[c]
87
+ # XXX: This was SYMBOL_CAT_ORDER before, with a value of 250, but
88
+ # CharacterCategory.SYMBOL is actually 253, so we use CONTROL
89
+ # to make it closer to the original intent. The only difference
90
+ # is whether or not we count digits and control characters for
91
+ # _total_char purposes.
92
+ if order < CharacterCategory.CONTROL:
93
+ self._total_char += 1
94
+ if order < self.SAMPLE_SIZE:
95
+ self._freq_char += 1
96
+ if self._last_order < self.SAMPLE_SIZE:
97
+ self._total_seqs += 1
98
+ if not self._reversed:
99
+ i = (self._last_order * self.SAMPLE_SIZE) + order
100
+ model = self._model['precedence_matrix'][i]
101
+ else: # reverse the order of the letters in the lookup
102
+ i = (order * self.SAMPLE_SIZE) + self._last_order
103
+ model = self._model['precedence_matrix'][i]
104
+ self._seq_counters[model] += 1
105
+ self._last_order = order
106
+
107
+ charset_name = self._model['charset_name']
108
+ if self.state == ProbingState.DETECTING:
109
+ if self._total_seqs > self.SB_ENOUGH_REL_THRESHOLD:
110
+ confidence = self.get_confidence()
111
+ if confidence > self.POSITIVE_SHORTCUT_THRESHOLD:
112
+ self.logger.debug('%s confidence = %s, we have a winner',
113
+ charset_name, confidence)
114
+ self._state = ProbingState.FOUND_IT
115
+ elif confidence < self.NEGATIVE_SHORTCUT_THRESHOLD:
116
+ self.logger.debug('%s confidence = %s, below negative '
117
+ 'shortcut threshhold %s', charset_name,
118
+ confidence,
119
+ self.NEGATIVE_SHORTCUT_THRESHOLD)
120
+ self._state = ProbingState.NOT_ME
121
+
122
+ return self.state
123
+
124
+ def get_confidence(self):
125
+ r = 0.01
126
+ if self._total_seqs > 0:
127
+ r = ((1.0 * self._seq_counters[SequenceLikelihood.POSITIVE]) /
128
+ self._total_seqs / self._model['typical_positive_ratio'])
129
+ r = r * self._freq_char / self._total_char
130
+ if r >= 1.0:
131
+ r = 0.99
132
+ return r
@@ -1,69 +1,73 @@
1
- ######################## BEGIN LICENSE BLOCK ########################
2
- # The Original Code is Mozilla Universal charset detector code.
3
- #
4
- # The Initial Developer of the Original Code is
5
- # Netscape Communications Corporation.
6
- # Portions created by the Initial Developer are Copyright (C) 2001
7
- # the Initial Developer. All Rights Reserved.
8
- #
9
- # Contributor(s):
10
- # Mark Pilgrim - port to Python
11
- # Shy Shalom - original C code
12
- #
13
- # This library is free software; you can redistribute it and/or
14
- # modify it under the terms of the GNU Lesser General Public
15
- # License as published by the Free Software Foundation; either
16
- # version 2.1 of the License, or (at your option) any later version.
17
- #
18
- # This library is distributed in the hope that it will be useful,
19
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- # Lesser General Public License for more details.
22
- #
23
- # You should have received a copy of the GNU Lesser General Public
24
- # License along with this library; if not, write to the Free Software
25
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26
- # 02110-1301 USA
27
- ######################### END LICENSE BLOCK #########################
28
-
29
- from .charsetgroupprober import CharSetGroupProber
30
- from .sbcharsetprober import SingleByteCharSetProber
31
- from .langcyrillicmodel import (Win1251CyrillicModel, Koi8rModel,
32
- Latin5CyrillicModel, MacCyrillicModel,
33
- Ibm866Model, Ibm855Model)
34
- from .langgreekmodel import Latin7GreekModel, Win1253GreekModel
35
- from .langbulgarianmodel import Latin5BulgarianModel, Win1251BulgarianModel
36
- from .langhungarianmodel import Latin2HungarianModel, Win1250HungarianModel
37
- from .langthaimodel import TIS620ThaiModel
38
- from .langhebrewmodel import Win1255HebrewModel
39
- from .hebrewprober import HebrewProber
40
-
41
-
42
- class SBCSGroupProber(CharSetGroupProber):
43
- def __init__(self):
44
- CharSetGroupProber.__init__(self)
45
- self._mProbers = [
46
- SingleByteCharSetProber(Win1251CyrillicModel),
47
- SingleByteCharSetProber(Koi8rModel),
48
- SingleByteCharSetProber(Latin5CyrillicModel),
49
- SingleByteCharSetProber(MacCyrillicModel),
50
- SingleByteCharSetProber(Ibm866Model),
51
- SingleByteCharSetProber(Ibm855Model),
52
- SingleByteCharSetProber(Latin7GreekModel),
53
- SingleByteCharSetProber(Win1253GreekModel),
54
- SingleByteCharSetProber(Latin5BulgarianModel),
55
- SingleByteCharSetProber(Win1251BulgarianModel),
56
- SingleByteCharSetProber(Latin2HungarianModel),
57
- SingleByteCharSetProber(Win1250HungarianModel),
58
- SingleByteCharSetProber(TIS620ThaiModel),
59
- ]
60
- hebrewProber = HebrewProber()
61
- logicalHebrewProber = SingleByteCharSetProber(Win1255HebrewModel,
62
- False, hebrewProber)
63
- visualHebrewProber = SingleByteCharSetProber(Win1255HebrewModel, True,
64
- hebrewProber)
65
- hebrewProber.set_model_probers(logicalHebrewProber, visualHebrewProber)
66
- self._mProbers.extend([hebrewProber, logicalHebrewProber,
67
- visualHebrewProber])
68
-
69
- self.reset()
1
+ ######################## BEGIN LICENSE BLOCK ########################
2
+ # The Original Code is Mozilla Universal charset detector code.
3
+ #
4
+ # The Initial Developer of the Original Code is
5
+ # Netscape Communications Corporation.
6
+ # Portions created by the Initial Developer are Copyright (C) 2001
7
+ # the Initial Developer. All Rights Reserved.
8
+ #
9
+ # Contributor(s):
10
+ # Mark Pilgrim - port to Python
11
+ # Shy Shalom - original C code
12
+ #
13
+ # This library is free software; you can redistribute it and/or
14
+ # modify it under the terms of the GNU Lesser General Public
15
+ # License as published by the Free Software Foundation; either
16
+ # version 2.1 of the License, or (at your option) any later version.
17
+ #
18
+ # This library is distributed in the hope that it will be useful,
19
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
+ # Lesser General Public License for more details.
22
+ #
23
+ # You should have received a copy of the GNU Lesser General Public
24
+ # License along with this library; if not, write to the Free Software
25
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26
+ # 02110-1301 USA
27
+ ######################### END LICENSE BLOCK #########################
28
+
29
+ from .charsetgroupprober import CharSetGroupProber
30
+ from .sbcharsetprober import SingleByteCharSetProber
31
+ from .langcyrillicmodel import (Win1251CyrillicModel, Koi8rModel,
32
+ Latin5CyrillicModel, MacCyrillicModel,
33
+ Ibm866Model, Ibm855Model)
34
+ from .langgreekmodel import Latin7GreekModel, Win1253GreekModel
35
+ from .langbulgarianmodel import Latin5BulgarianModel, Win1251BulgarianModel
36
+ # from .langhungarianmodel import Latin2HungarianModel, Win1250HungarianModel
37
+ from .langthaimodel import TIS620ThaiModel
38
+ from .langhebrewmodel import Win1255HebrewModel
39
+ from .hebrewprober import HebrewProber
40
+ from .langturkishmodel import Latin5TurkishModel
41
+
42
+
43
+ class SBCSGroupProber(CharSetGroupProber):
44
+ def __init__(self):
45
+ super(SBCSGroupProber, self).__init__()
46
+ self.probers = [
47
+ SingleByteCharSetProber(Win1251CyrillicModel),
48
+ SingleByteCharSetProber(Koi8rModel),
49
+ SingleByteCharSetProber(Latin5CyrillicModel),
50
+ SingleByteCharSetProber(MacCyrillicModel),
51
+ SingleByteCharSetProber(Ibm866Model),
52
+ SingleByteCharSetProber(Ibm855Model),
53
+ SingleByteCharSetProber(Latin7GreekModel),
54
+ SingleByteCharSetProber(Win1253GreekModel),
55
+ SingleByteCharSetProber(Latin5BulgarianModel),
56
+ SingleByteCharSetProber(Win1251BulgarianModel),
57
+ # TODO: Restore Hungarian encodings (iso-8859-2 and windows-1250)
58
+ # after we retrain model.
59
+ # SingleByteCharSetProber(Latin2HungarianModel),
60
+ # SingleByteCharSetProber(Win1250HungarianModel),
61
+ SingleByteCharSetProber(TIS620ThaiModel),
62
+ SingleByteCharSetProber(Latin5TurkishModel),
63
+ ]
64
+ hebrew_prober = HebrewProber()
65
+ logical_hebrew_prober = SingleByteCharSetProber(Win1255HebrewModel,
66
+ False, hebrew_prober)
67
+ visual_hebrew_prober = SingleByteCharSetProber(Win1255HebrewModel, True,
68
+ hebrew_prober)
69
+ hebrew_prober.set_model_probers(logical_hebrew_prober, visual_hebrew_prober)
70
+ self.probers.extend([hebrew_prober, logical_hebrew_prober,
71
+ visual_hebrew_prober])
72
+
73
+ self.reset()
@@ -0,0 +1,92 @@
1
+ ######################## BEGIN LICENSE BLOCK ########################
2
+ # The Original Code is mozilla.org code.
3
+ #
4
+ # The Initial Developer of the Original Code is
5
+ # Netscape Communications Corporation.
6
+ # Portions created by the Initial Developer are Copyright (C) 1998
7
+ # the Initial Developer. All Rights Reserved.
8
+ #
9
+ # Contributor(s):
10
+ # Mark Pilgrim - port to Python
11
+ #
12
+ # This library is free software; you can redistribute it and/or
13
+ # modify it under the terms of the GNU Lesser General Public
14
+ # License as published by the Free Software Foundation; either
15
+ # version 2.1 of the License, or (at your option) any later version.
16
+ #
17
+ # This library is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
+ # Lesser General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public
23
+ # License along with this library; if not, write to the Free Software
24
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25
+ # 02110-1301 USA
26
+ ######################### END LICENSE BLOCK #########################
27
+
28
+ from .mbcharsetprober import MultiByteCharSetProber
29
+ from .codingstatemachine import CodingStateMachine
30
+ from .chardistribution import SJISDistributionAnalysis
31
+ from .jpcntx import SJISContextAnalysis
32
+ from .mbcssm import SJIS_SM_MODEL
33
+ from .enums import ProbingState, MachineState
34
+
35
+
36
+ class SJISProber(MultiByteCharSetProber):
37
+ def __init__(self):
38
+ super(SJISProber, self).__init__()
39
+ self.coding_sm = CodingStateMachine(SJIS_SM_MODEL)
40
+ self.distribution_analyzer = SJISDistributionAnalysis()
41
+ self.context_analyzer = SJISContextAnalysis()
42
+ self.reset()
43
+
44
+ def reset(self):
45
+ super(SJISProber, self).reset()
46
+ self.context_analyzer.reset()
47
+
48
+ @property
49
+ def charset_name(self):
50
+ return self.context_analyzer.charset_name
51
+
52
+ @property
53
+ def language(self):
54
+ return "Japanese"
55
+
56
+ def feed(self, byte_str):
57
+ for i in range(len(byte_str)):
58
+ coding_state = self.coding_sm.next_state(byte_str[i])
59
+ if coding_state == MachineState.ERROR:
60
+ self.logger.debug('%s %s prober hit error at byte %s',
61
+ self.charset_name, self.language, i)
62
+ self._state = ProbingState.NOT_ME
63
+ break
64
+ elif coding_state == MachineState.ITS_ME:
65
+ self._state = ProbingState.FOUND_IT
66
+ break
67
+ elif coding_state == MachineState.START:
68
+ char_len = self.coding_sm.get_current_charlen()
69
+ if i == 0:
70
+ self._last_char[1] = byte_str[0]
71
+ self.context_analyzer.feed(self._last_char[2 - char_len:],
72
+ char_len)
73
+ self.distribution_analyzer.feed(self._last_char, char_len)
74
+ else:
75
+ self.context_analyzer.feed(byte_str[i + 1 - char_len:i + 3
76
+ - char_len], char_len)
77
+ self.distribution_analyzer.feed(byte_str[i - 1:i + 1],
78
+ char_len)
79
+
80
+ self._last_char[0] = byte_str[-1]
81
+
82
+ if self.state == ProbingState.DETECTING:
83
+ if (self.context_analyzer.got_enough_data() and
84
+ (self.get_confidence() > self.SHORTCUT_THRESHOLD)):
85
+ self._state = ProbingState.FOUND_IT
86
+
87
+ return self.state
88
+
89
+ def get_confidence(self):
90
+ context_conf = self.context_analyzer.get_confidence()
91
+ distrib_conf = self.distribution_analyzer.get_confidence()
92
+ return max(context_conf, distrib_conf)
@@ -0,0 +1,286 @@
1
+ ######################## BEGIN LICENSE BLOCK ########################
2
+ # The Original Code is Mozilla Universal charset detector code.
3
+ #
4
+ # The Initial Developer of the Original Code is
5
+ # Netscape Communications Corporation.
6
+ # Portions created by the Initial Developer are Copyright (C) 2001
7
+ # the Initial Developer. All Rights Reserved.
8
+ #
9
+ # Contributor(s):
10
+ # Mark Pilgrim - port to Python
11
+ # Shy Shalom - original C code
12
+ #
13
+ # This library is free software; you can redistribute it and/or
14
+ # modify it under the terms of the GNU Lesser General Public
15
+ # License as published by the Free Software Foundation; either
16
+ # version 2.1 of the License, or (at your option) any later version.
17
+ #
18
+ # This library is distributed in the hope that it will be useful,
19
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
+ # Lesser General Public License for more details.
22
+ #
23
+ # You should have received a copy of the GNU Lesser General Public
24
+ # License along with this library; if not, write to the Free Software
25
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26
+ # 02110-1301 USA
27
+ ######################### END LICENSE BLOCK #########################
28
+ """
29
+ Module containing the UniversalDetector detector class, which is the primary
30
+ class a user of ``chardet`` should use.
31
+
32
+ :author: Mark Pilgrim (initial port to Python)
33
+ :author: Shy Shalom (original C code)
34
+ :author: Dan Blanchard (major refactoring for 3.0)
35
+ :author: Ian Cordasco
36
+ """
37
+
38
+
39
+ import codecs
40
+ import logging
41
+ import re
42
+
43
+ from .charsetgroupprober import CharSetGroupProber
44
+ from .enums import InputState, LanguageFilter, ProbingState
45
+ from .escprober import EscCharSetProber
46
+ from .latin1prober import Latin1Prober
47
+ from .mbcsgroupprober import MBCSGroupProber
48
+ from .sbcsgroupprober import SBCSGroupProber
49
+
50
+
51
+ class UniversalDetector(object):
52
+ """
53
+ The ``UniversalDetector`` class underlies the ``chardet.detect`` function
54
+ and coordinates all of the different charset probers.
55
+
56
+ To get a ``dict`` containing an encoding and its confidence, you can simply
57
+ run:
58
+
59
+ .. code::
60
+
61
+ u = UniversalDetector()
62
+ u.feed(some_bytes)
63
+ u.close()
64
+ detected = u.result
65
+
66
+ """
67
+
68
+ MINIMUM_THRESHOLD = 0.20
69
+ HIGH_BYTE_DETECTOR = re.compile(b'[\x80-\xFF]')
70
+ ESC_DETECTOR = re.compile(b'(\033|~{)')
71
+ WIN_BYTE_DETECTOR = re.compile(b'[\x80-\x9F]')
72
+ ISO_WIN_MAP = {'iso-8859-1': 'Windows-1252',
73
+ 'iso-8859-2': 'Windows-1250',
74
+ 'iso-8859-5': 'Windows-1251',
75
+ 'iso-8859-6': 'Windows-1256',
76
+ 'iso-8859-7': 'Windows-1253',
77
+ 'iso-8859-8': 'Windows-1255',
78
+ 'iso-8859-9': 'Windows-1254',
79
+ 'iso-8859-13': 'Windows-1257'}
80
+
81
+ def __init__(self, lang_filter=LanguageFilter.ALL):
82
+ self._esc_charset_prober = None
83
+ self._charset_probers = []
84
+ self.result = None
85
+ self.done = None
86
+ self._got_data = None
87
+ self._input_state = None
88
+ self._last_char = None
89
+ self.lang_filter = lang_filter
90
+ self.logger = logging.getLogger(__name__)
91
+ self._has_win_bytes = None
92
+ self.reset()
93
+
94
+ def reset(self):
95
+ """
96
+ Reset the UniversalDetector and all of its probers back to their
97
+ initial states. This is called by ``__init__``, so you only need to
98
+ call this directly in between analyses of different documents.
99
+ """
100
+ self.result = {'encoding': None, 'confidence': 0.0, 'language': None}
101
+ self.done = False
102
+ self._got_data = False
103
+ self._has_win_bytes = False
104
+ self._input_state = InputState.PURE_ASCII
105
+ self._last_char = b''
106
+ if self._esc_charset_prober:
107
+ self._esc_charset_prober.reset()
108
+ for prober in self._charset_probers:
109
+ prober.reset()
110
+
111
+ def feed(self, byte_str):
112
+ """
113
+ Takes a chunk of a document and feeds it through all of the relevant
114
+ charset probers.
115
+
116
+ After calling ``feed``, you can check the value of the ``done``
117
+ attribute to see if you need to continue feeding the
118
+ ``UniversalDetector`` more data, or if it has made a prediction
119
+ (in the ``result`` attribute).
120
+
121
+ .. note::
122
+ You should always call ``close`` when you're done feeding in your
123
+ document if ``done`` is not already ``True``.
124
+ """
125
+ if self.done:
126
+ return
127
+
128
+ if not len(byte_str):
129
+ return
130
+
131
+ if not isinstance(byte_str, bytearray):
132
+ byte_str = bytearray(byte_str)
133
+
134
+ # First check for known BOMs, since these are guaranteed to be correct
135
+ if not self._got_data:
136
+ # If the data starts with BOM, we know it is UTF
137
+ if byte_str.startswith(codecs.BOM_UTF8):
138
+ # EF BB BF UTF-8 with BOM
139
+ self.result = {'encoding': "UTF-8-SIG",
140
+ 'confidence': 1.0,
141
+ 'language': ''}
142
+ elif byte_str.startswith((codecs.BOM_UTF32_LE,
143
+ codecs.BOM_UTF32_BE)):
144
+ # FF FE 00 00 UTF-32, little-endian BOM
145
+ # 00 00 FE FF UTF-32, big-endian BOM
146
+ self.result = {'encoding': "UTF-32",
147
+ 'confidence': 1.0,
148
+ 'language': ''}
149
+ elif byte_str.startswith(b'\xFE\xFF\x00\x00'):
150
+ # FE FF 00 00 UCS-4, unusual octet order BOM (3412)
151
+ self.result = {'encoding': "X-ISO-10646-UCS-4-3412",
152
+ 'confidence': 1.0,
153
+ 'language': ''}
154
+ elif byte_str.startswith(b'\x00\x00\xFF\xFE'):
155
+ # 00 00 FF FE UCS-4, unusual octet order BOM (2143)
156
+ self.result = {'encoding': "X-ISO-10646-UCS-4-2143",
157
+ 'confidence': 1.0,
158
+ 'language': ''}
159
+ elif byte_str.startswith((codecs.BOM_LE, codecs.BOM_BE)):
160
+ # FF FE UTF-16, little endian BOM
161
+ # FE FF UTF-16, big endian BOM
162
+ self.result = {'encoding': "UTF-16",
163
+ 'confidence': 1.0,
164
+ 'language': ''}
165
+
166
+ self._got_data = True
167
+ if self.result['encoding'] is not None:
168
+ self.done = True
169
+ return
170
+
171
+ # If none of those matched and we've only see ASCII so far, check
172
+ # for high bytes and escape sequences
173
+ if self._input_state == InputState.PURE_ASCII:
174
+ if self.HIGH_BYTE_DETECTOR.search(byte_str):
175
+ self._input_state = InputState.HIGH_BYTE
176
+ elif self._input_state == InputState.PURE_ASCII and \
177
+ self.ESC_DETECTOR.search(self._last_char + byte_str):
178
+ self._input_state = InputState.ESC_ASCII
179
+
180
+ self._last_char = byte_str[-1:]
181
+
182
+ # If we've seen escape sequences, use the EscCharSetProber, which
183
+ # uses a simple state machine to check for known escape sequences in
184
+ # HZ and ISO-2022 encodings, since those are the only encodings that
185
+ # use such sequences.
186
+ if self._input_state == InputState.ESC_ASCII:
187
+ if not self._esc_charset_prober:
188
+ self._esc_charset_prober = EscCharSetProber(self.lang_filter)
189
+ if self._esc_charset_prober.feed(byte_str) == ProbingState.FOUND_IT:
190
+ self.result = {'encoding':
191
+ self._esc_charset_prober.charset_name,
192
+ 'confidence':
193
+ self._esc_charset_prober.get_confidence(),
194
+ 'language':
195
+ self._esc_charset_prober.language}
196
+ self.done = True
197
+ # If we've seen high bytes (i.e., those with values greater than 127),
198
+ # we need to do more complicated checks using all our multi-byte and
199
+ # single-byte probers that are left. The single-byte probers
200
+ # use character bigram distributions to determine the encoding, whereas
201
+ # the multi-byte probers use a combination of character unigram and
202
+ # bigram distributions.
203
+ elif self._input_state == InputState.HIGH_BYTE:
204
+ if not self._charset_probers:
205
+ self._charset_probers = [MBCSGroupProber(self.lang_filter)]
206
+ # If we're checking non-CJK encodings, use single-byte prober
207
+ if self.lang_filter & LanguageFilter.NON_CJK:
208
+ self._charset_probers.append(SBCSGroupProber())
209
+ self._charset_probers.append(Latin1Prober())
210
+ for prober in self._charset_probers:
211
+ if prober.feed(byte_str) == ProbingState.FOUND_IT:
212
+ self.result = {'encoding': prober.charset_name,
213
+ 'confidence': prober.get_confidence(),
214
+ 'language': prober.language}
215
+ self.done = True
216
+ break
217
+ if self.WIN_BYTE_DETECTOR.search(byte_str):
218
+ self._has_win_bytes = True
219
+
220
+ def close(self):
221
+ """
222
+ Stop analyzing the current document and come up with a final
223
+ prediction.
224
+
225
+ :returns: The ``result`` attribute, a ``dict`` with the keys
226
+ `encoding`, `confidence`, and `language`.
227
+ """
228
+ # Don't bother with checks if we're already done
229
+ if self.done:
230
+ return self.result
231
+ self.done = True
232
+
233
+ if not self._got_data:
234
+ self.logger.debug('no data received!')
235
+
236
+ # Default to ASCII if it is all we've seen so far
237
+ elif self._input_state == InputState.PURE_ASCII:
238
+ self.result = {'encoding': 'ascii',
239
+ 'confidence': 1.0,
240
+ 'language': ''}
241
+
242
+ # If we have seen non-ASCII, return the best that met MINIMUM_THRESHOLD
243
+ elif self._input_state == InputState.HIGH_BYTE:
244
+ prober_confidence = None
245
+ max_prober_confidence = 0.0
246
+ max_prober = None
247
+ for prober in self._charset_probers:
248
+ if not prober:
249
+ continue
250
+ prober_confidence = prober.get_confidence()
251
+ if prober_confidence > max_prober_confidence:
252
+ max_prober_confidence = prober_confidence
253
+ max_prober = prober
254
+ if max_prober and (max_prober_confidence > self.MINIMUM_THRESHOLD):
255
+ charset_name = max_prober.charset_name
256
+ lower_charset_name = max_prober.charset_name.lower()
257
+ confidence = max_prober.get_confidence()
258
+ # Use Windows encoding name instead of ISO-8859 if we saw any
259
+ # extra Windows-specific bytes
260
+ if lower_charset_name.startswith('iso-8859'):
261
+ if self._has_win_bytes:
262
+ charset_name = self.ISO_WIN_MAP.get(lower_charset_name,
263
+ charset_name)
264
+ self.result = {'encoding': charset_name,
265
+ 'confidence': confidence,
266
+ 'language': max_prober.language}
267
+
268
+ # Log all prober confidences if none met MINIMUM_THRESHOLD
269
+ if self.logger.getEffectiveLevel() == logging.DEBUG:
270
+ if self.result['encoding'] is None:
271
+ self.logger.debug('no probers hit minimum threshold')
272
+ for group_prober in self._charset_probers:
273
+ if not group_prober:
274
+ continue
275
+ if isinstance(group_prober, CharSetGroupProber):
276
+ for prober in group_prober.probers:
277
+ self.logger.debug('%s %s confidence = %s',
278
+ prober.charset_name,
279
+ prober.language,
280
+ prober.get_confidence())
281
+ else:
282
+ self.logger.debug('%s %s confidence = %s',
283
+ prober.charset_name,
284
+ prober.language,
285
+ prober.get_confidence())
286
+ return self.result