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,581 @@
1
+ # Backport of selectors.py from Python 3.5+ to support Python < 3.4
2
+ # Also has the behavior specified in PEP 475 which is to retry syscalls
3
+ # in the case of an EINTR error. This module is required because selectors34
4
+ # does not follow this behavior and instead returns that no dile descriptor
5
+ # events have occurred rather than retry the syscall. The decision to drop
6
+ # support for select.devpoll is made to maintain 100% test coverage.
7
+
8
+ import errno
9
+ import math
10
+ import select
11
+ import socket
12
+ import sys
13
+ import time
14
+ from collections import namedtuple, Mapping
15
+
16
+ try:
17
+ monotonic = time.monotonic
18
+ except (AttributeError, ImportError): # Python 3.3<
19
+ monotonic = time.time
20
+
21
+ EVENT_READ = (1 << 0)
22
+ EVENT_WRITE = (1 << 1)
23
+
24
+ HAS_SELECT = True # Variable that shows whether the platform has a selector.
25
+ _SYSCALL_SENTINEL = object() # Sentinel in case a system call returns None.
26
+ _DEFAULT_SELECTOR = None
27
+
28
+
29
+ class SelectorError(Exception):
30
+ def __init__(self, errcode):
31
+ super(SelectorError, self).__init__()
32
+ self.errno = errcode
33
+
34
+ def __repr__(self):
35
+ return "<SelectorError errno={0}>".format(self.errno)
36
+
37
+ def __str__(self):
38
+ return self.__repr__()
39
+
40
+
41
+ def _fileobj_to_fd(fileobj):
42
+ """ Return a file descriptor from a file object. If
43
+ given an integer will simply return that integer back. """
44
+ if isinstance(fileobj, int):
45
+ fd = fileobj
46
+ else:
47
+ try:
48
+ fd = int(fileobj.fileno())
49
+ except (AttributeError, TypeError, ValueError):
50
+ raise ValueError("Invalid file object: {0!r}".format(fileobj))
51
+ if fd < 0:
52
+ raise ValueError("Invalid file descriptor: {0}".format(fd))
53
+ return fd
54
+
55
+
56
+ # Determine which function to use to wrap system calls because Python 3.5+
57
+ # already handles the case when system calls are interrupted.
58
+ if sys.version_info >= (3, 5):
59
+ def _syscall_wrapper(func, _, *args, **kwargs):
60
+ """ This is the short-circuit version of the below logic
61
+ because in Python 3.5+ all system calls automatically restart
62
+ and recalculate their timeouts. """
63
+ try:
64
+ return func(*args, **kwargs)
65
+ except (OSError, IOError, select.error) as e:
66
+ errcode = None
67
+ if hasattr(e, "errno"):
68
+ errcode = e.errno
69
+ raise SelectorError(errcode)
70
+ else:
71
+ def _syscall_wrapper(func, recalc_timeout, *args, **kwargs):
72
+ """ Wrapper function for syscalls that could fail due to EINTR.
73
+ All functions should be retried if there is time left in the timeout
74
+ in accordance with PEP 475. """
75
+ timeout = kwargs.get("timeout", None)
76
+ if timeout is None:
77
+ expires = None
78
+ recalc_timeout = False
79
+ else:
80
+ timeout = float(timeout)
81
+ if timeout < 0.0: # Timeout less than 0 treated as no timeout.
82
+ expires = None
83
+ else:
84
+ expires = monotonic() + timeout
85
+
86
+ args = list(args)
87
+ if recalc_timeout and "timeout" not in kwargs:
88
+ raise ValueError(
89
+ "Timeout must be in args or kwargs to be recalculated")
90
+
91
+ result = _SYSCALL_SENTINEL
92
+ while result is _SYSCALL_SENTINEL:
93
+ try:
94
+ result = func(*args, **kwargs)
95
+ # OSError is thrown by select.select
96
+ # IOError is thrown by select.epoll.poll
97
+ # select.error is thrown by select.poll.poll
98
+ # Aren't we thankful for Python 3.x rework for exceptions?
99
+ except (OSError, IOError, select.error) as e:
100
+ # select.error wasn't a subclass of OSError in the past.
101
+ errcode = None
102
+ if hasattr(e, "errno"):
103
+ errcode = e.errno
104
+ elif hasattr(e, "args"):
105
+ errcode = e.args[0]
106
+
107
+ # Also test for the Windows equivalent of EINTR.
108
+ is_interrupt = (errcode == errno.EINTR or (hasattr(errno, "WSAEINTR") and
109
+ errcode == errno.WSAEINTR))
110
+
111
+ if is_interrupt:
112
+ if expires is not None:
113
+ current_time = monotonic()
114
+ if current_time > expires:
115
+ raise OSError(errno=errno.ETIMEDOUT)
116
+ if recalc_timeout:
117
+ if "timeout" in kwargs:
118
+ kwargs["timeout"] = expires - current_time
119
+ continue
120
+ if errcode:
121
+ raise SelectorError(errcode)
122
+ else:
123
+ raise
124
+ return result
125
+
126
+
127
+ SelectorKey = namedtuple('SelectorKey', ['fileobj', 'fd', 'events', 'data'])
128
+
129
+
130
+ class _SelectorMapping(Mapping):
131
+ """ Mapping of file objects to selector keys """
132
+
133
+ def __init__(self, selector):
134
+ self._selector = selector
135
+
136
+ def __len__(self):
137
+ return len(self._selector._fd_to_key)
138
+
139
+ def __getitem__(self, fileobj):
140
+ try:
141
+ fd = self._selector._fileobj_lookup(fileobj)
142
+ return self._selector._fd_to_key[fd]
143
+ except KeyError:
144
+ raise KeyError("{0!r} is not registered.".format(fileobj))
145
+
146
+ def __iter__(self):
147
+ return iter(self._selector._fd_to_key)
148
+
149
+
150
+ class BaseSelector(object):
151
+ """ Abstract Selector class
152
+
153
+ A selector supports registering file objects to be monitored
154
+ for specific I/O events.
155
+
156
+ A file object is a file descriptor or any object with a
157
+ `fileno()` method. An arbitrary object can be attached to the
158
+ file object which can be used for example to store context info,
159
+ a callback, etc.
160
+
161
+ A selector can use various implementations (select(), poll(), epoll(),
162
+ and kqueue()) depending on the platform. The 'DefaultSelector' class uses
163
+ the most efficient implementation for the current platform.
164
+ """
165
+ def __init__(self):
166
+ # Maps file descriptors to keys.
167
+ self._fd_to_key = {}
168
+
169
+ # Read-only mapping returned by get_map()
170
+ self._map = _SelectorMapping(self)
171
+
172
+ def _fileobj_lookup(self, fileobj):
173
+ """ Return a file descriptor from a file object.
174
+ This wraps _fileobj_to_fd() to do an exhaustive
175
+ search in case the object is invalid but we still
176
+ have it in our map. Used by unregister() so we can
177
+ unregister an object that was previously registered
178
+ even if it is closed. It is also used by _SelectorMapping
179
+ """
180
+ try:
181
+ return _fileobj_to_fd(fileobj)
182
+ except ValueError:
183
+
184
+ # Search through all our mapped keys.
185
+ for key in self._fd_to_key.values():
186
+ if key.fileobj is fileobj:
187
+ return key.fd
188
+
189
+ # Raise ValueError after all.
190
+ raise
191
+
192
+ def register(self, fileobj, events, data=None):
193
+ """ Register a file object for a set of events to monitor. """
194
+ if (not events) or (events & ~(EVENT_READ | EVENT_WRITE)):
195
+ raise ValueError("Invalid events: {0!r}".format(events))
196
+
197
+ key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data)
198
+
199
+ if key.fd in self._fd_to_key:
200
+ raise KeyError("{0!r} (FD {1}) is already registered"
201
+ .format(fileobj, key.fd))
202
+
203
+ self._fd_to_key[key.fd] = key
204
+ return key
205
+
206
+ def unregister(self, fileobj):
207
+ """ Unregister a file object from being monitored. """
208
+ try:
209
+ key = self._fd_to_key.pop(self._fileobj_lookup(fileobj))
210
+ except KeyError:
211
+ raise KeyError("{0!r} is not registered".format(fileobj))
212
+
213
+ # Getting the fileno of a closed socket on Windows errors with EBADF.
214
+ except socket.error as e: # Platform-specific: Windows.
215
+ if e.errno != errno.EBADF:
216
+ raise
217
+ else:
218
+ for key in self._fd_to_key.values():
219
+ if key.fileobj is fileobj:
220
+ self._fd_to_key.pop(key.fd)
221
+ break
222
+ else:
223
+ raise KeyError("{0!r} is not registered".format(fileobj))
224
+ return key
225
+
226
+ def modify(self, fileobj, events, data=None):
227
+ """ Change a registered file object monitored events and data. """
228
+ # NOTE: Some subclasses optimize this operation even further.
229
+ try:
230
+ key = self._fd_to_key[self._fileobj_lookup(fileobj)]
231
+ except KeyError:
232
+ raise KeyError("{0!r} is not registered".format(fileobj))
233
+
234
+ if events != key.events:
235
+ self.unregister(fileobj)
236
+ key = self.register(fileobj, events, data)
237
+
238
+ elif data != key.data:
239
+ # Use a shortcut to update the data.
240
+ key = key._replace(data=data)
241
+ self._fd_to_key[key.fd] = key
242
+
243
+ return key
244
+
245
+ def select(self, timeout=None):
246
+ """ Perform the actual selection until some monitored file objects
247
+ are ready or the timeout expires. """
248
+ raise NotImplementedError()
249
+
250
+ def close(self):
251
+ """ Close the selector. This must be called to ensure that all
252
+ underlying resources are freed. """
253
+ self._fd_to_key.clear()
254
+ self._map = None
255
+
256
+ def get_key(self, fileobj):
257
+ """ Return the key associated with a registered file object. """
258
+ mapping = self.get_map()
259
+ if mapping is None:
260
+ raise RuntimeError("Selector is closed")
261
+ try:
262
+ return mapping[fileobj]
263
+ except KeyError:
264
+ raise KeyError("{0!r} is not registered".format(fileobj))
265
+
266
+ def get_map(self):
267
+ """ Return a mapping of file objects to selector keys """
268
+ return self._map
269
+
270
+ def _key_from_fd(self, fd):
271
+ """ Return the key associated to a given file descriptor
272
+ Return None if it is not found. """
273
+ try:
274
+ return self._fd_to_key[fd]
275
+ except KeyError:
276
+ return None
277
+
278
+ def __enter__(self):
279
+ return self
280
+
281
+ def __exit__(self, *args):
282
+ self.close()
283
+
284
+
285
+ # Almost all platforms have select.select()
286
+ if hasattr(select, "select"):
287
+ class SelectSelector(BaseSelector):
288
+ """ Select-based selector. """
289
+ def __init__(self):
290
+ super(SelectSelector, self).__init__()
291
+ self._readers = set()
292
+ self._writers = set()
293
+
294
+ def register(self, fileobj, events, data=None):
295
+ key = super(SelectSelector, self).register(fileobj, events, data)
296
+ if events & EVENT_READ:
297
+ self._readers.add(key.fd)
298
+ if events & EVENT_WRITE:
299
+ self._writers.add(key.fd)
300
+ return key
301
+
302
+ def unregister(self, fileobj):
303
+ key = super(SelectSelector, self).unregister(fileobj)
304
+ self._readers.discard(key.fd)
305
+ self._writers.discard(key.fd)
306
+ return key
307
+
308
+ def _select(self, r, w, timeout=None):
309
+ """ Wrapper for select.select because timeout is a positional arg """
310
+ return select.select(r, w, [], timeout)
311
+
312
+ def select(self, timeout=None):
313
+ # Selecting on empty lists on Windows errors out.
314
+ if not len(self._readers) and not len(self._writers):
315
+ return []
316
+
317
+ timeout = None if timeout is None else max(timeout, 0.0)
318
+ ready = []
319
+ r, w, _ = _syscall_wrapper(self._select, True, self._readers,
320
+ self._writers, timeout)
321
+ r = set(r)
322
+ w = set(w)
323
+ for fd in r | w:
324
+ events = 0
325
+ if fd in r:
326
+ events |= EVENT_READ
327
+ if fd in w:
328
+ events |= EVENT_WRITE
329
+
330
+ key = self._key_from_fd(fd)
331
+ if key:
332
+ ready.append((key, events & key.events))
333
+ return ready
334
+
335
+
336
+ if hasattr(select, "poll"):
337
+ class PollSelector(BaseSelector):
338
+ """ Poll-based selector """
339
+ def __init__(self):
340
+ super(PollSelector, self).__init__()
341
+ self._poll = select.poll()
342
+
343
+ def register(self, fileobj, events, data=None):
344
+ key = super(PollSelector, self).register(fileobj, events, data)
345
+ event_mask = 0
346
+ if events & EVENT_READ:
347
+ event_mask |= select.POLLIN
348
+ if events & EVENT_WRITE:
349
+ event_mask |= select.POLLOUT
350
+ self._poll.register(key.fd, event_mask)
351
+ return key
352
+
353
+ def unregister(self, fileobj):
354
+ key = super(PollSelector, self).unregister(fileobj)
355
+ self._poll.unregister(key.fd)
356
+ return key
357
+
358
+ def _wrap_poll(self, timeout=None):
359
+ """ Wrapper function for select.poll.poll() so that
360
+ _syscall_wrapper can work with only seconds. """
361
+ if timeout is not None:
362
+ if timeout <= 0:
363
+ timeout = 0
364
+ else:
365
+ # select.poll.poll() has a resolution of 1 millisecond,
366
+ # round away from zero to wait *at least* timeout seconds.
367
+ timeout = math.ceil(timeout * 1e3)
368
+
369
+ result = self._poll.poll(timeout)
370
+ return result
371
+
372
+ def select(self, timeout=None):
373
+ ready = []
374
+ fd_events = _syscall_wrapper(self._wrap_poll, True, timeout=timeout)
375
+ for fd, event_mask in fd_events:
376
+ events = 0
377
+ if event_mask & ~select.POLLIN:
378
+ events |= EVENT_WRITE
379
+ if event_mask & ~select.POLLOUT:
380
+ events |= EVENT_READ
381
+
382
+ key = self._key_from_fd(fd)
383
+ if key:
384
+ ready.append((key, events & key.events))
385
+
386
+ return ready
387
+
388
+
389
+ if hasattr(select, "epoll"):
390
+ class EpollSelector(BaseSelector):
391
+ """ Epoll-based selector """
392
+ def __init__(self):
393
+ super(EpollSelector, self).__init__()
394
+ self._epoll = select.epoll()
395
+
396
+ def fileno(self):
397
+ return self._epoll.fileno()
398
+
399
+ def register(self, fileobj, events, data=None):
400
+ key = super(EpollSelector, self).register(fileobj, events, data)
401
+ events_mask = 0
402
+ if events & EVENT_READ:
403
+ events_mask |= select.EPOLLIN
404
+ if events & EVENT_WRITE:
405
+ events_mask |= select.EPOLLOUT
406
+ _syscall_wrapper(self._epoll.register, False, key.fd, events_mask)
407
+ return key
408
+
409
+ def unregister(self, fileobj):
410
+ key = super(EpollSelector, self).unregister(fileobj)
411
+ try:
412
+ _syscall_wrapper(self._epoll.unregister, False, key.fd)
413
+ except SelectorError:
414
+ # This can occur when the fd was closed since registry.
415
+ pass
416
+ return key
417
+
418
+ def select(self, timeout=None):
419
+ if timeout is not None:
420
+ if timeout <= 0:
421
+ timeout = 0.0
422
+ else:
423
+ # select.epoll.poll() has a resolution of 1 millisecond
424
+ # but luckily takes seconds so we don't need a wrapper
425
+ # like PollSelector. Just for better rounding.
426
+ timeout = math.ceil(timeout * 1e3) * 1e-3
427
+ timeout = float(timeout)
428
+ else:
429
+ timeout = -1.0 # epoll.poll() must have a float.
430
+
431
+ # We always want at least 1 to ensure that select can be called
432
+ # with no file descriptors registered. Otherwise will fail.
433
+ max_events = max(len(self._fd_to_key), 1)
434
+
435
+ ready = []
436
+ fd_events = _syscall_wrapper(self._epoll.poll, True,
437
+ timeout=timeout,
438
+ maxevents=max_events)
439
+ for fd, event_mask in fd_events:
440
+ events = 0
441
+ if event_mask & ~select.EPOLLIN:
442
+ events |= EVENT_WRITE
443
+ if event_mask & ~select.EPOLLOUT:
444
+ events |= EVENT_READ
445
+
446
+ key = self._key_from_fd(fd)
447
+ if key:
448
+ ready.append((key, events & key.events))
449
+ return ready
450
+
451
+ def close(self):
452
+ self._epoll.close()
453
+ super(EpollSelector, self).close()
454
+
455
+
456
+ if hasattr(select, "kqueue"):
457
+ class KqueueSelector(BaseSelector):
458
+ """ Kqueue / Kevent-based selector """
459
+ def __init__(self):
460
+ super(KqueueSelector, self).__init__()
461
+ self._kqueue = select.kqueue()
462
+
463
+ def fileno(self):
464
+ return self._kqueue.fileno()
465
+
466
+ def register(self, fileobj, events, data=None):
467
+ key = super(KqueueSelector, self).register(fileobj, events, data)
468
+ if events & EVENT_READ:
469
+ kevent = select.kevent(key.fd,
470
+ select.KQ_FILTER_READ,
471
+ select.KQ_EV_ADD)
472
+
473
+ _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
474
+
475
+ if events & EVENT_WRITE:
476
+ kevent = select.kevent(key.fd,
477
+ select.KQ_FILTER_WRITE,
478
+ select.KQ_EV_ADD)
479
+
480
+ _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
481
+
482
+ return key
483
+
484
+ def unregister(self, fileobj):
485
+ key = super(KqueueSelector, self).unregister(fileobj)
486
+ if key.events & EVENT_READ:
487
+ kevent = select.kevent(key.fd,
488
+ select.KQ_FILTER_READ,
489
+ select.KQ_EV_DELETE)
490
+ try:
491
+ _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
492
+ except SelectorError:
493
+ pass
494
+ if key.events & EVENT_WRITE:
495
+ kevent = select.kevent(key.fd,
496
+ select.KQ_FILTER_WRITE,
497
+ select.KQ_EV_DELETE)
498
+ try:
499
+ _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
500
+ except SelectorError:
501
+ pass
502
+
503
+ return key
504
+
505
+ def select(self, timeout=None):
506
+ if timeout is not None:
507
+ timeout = max(timeout, 0)
508
+
509
+ max_events = len(self._fd_to_key) * 2
510
+ ready_fds = {}
511
+
512
+ kevent_list = _syscall_wrapper(self._kqueue.control, True,
513
+ None, max_events, timeout)
514
+
515
+ for kevent in kevent_list:
516
+ fd = kevent.ident
517
+ event_mask = kevent.filter
518
+ events = 0
519
+ if event_mask == select.KQ_FILTER_READ:
520
+ events |= EVENT_READ
521
+ if event_mask == select.KQ_FILTER_WRITE:
522
+ events |= EVENT_WRITE
523
+
524
+ key = self._key_from_fd(fd)
525
+ if key:
526
+ if key.fd not in ready_fds:
527
+ ready_fds[key.fd] = (key, events & key.events)
528
+ else:
529
+ old_events = ready_fds[key.fd][1]
530
+ ready_fds[key.fd] = (key, (events | old_events) & key.events)
531
+
532
+ return list(ready_fds.values())
533
+
534
+ def close(self):
535
+ self._kqueue.close()
536
+ super(KqueueSelector, self).close()
537
+
538
+
539
+ if not hasattr(select, 'select'): # Platform-specific: AppEngine
540
+ HAS_SELECT = False
541
+
542
+
543
+ def _can_allocate(struct):
544
+ """ Checks that select structs can be allocated by the underlying
545
+ operating system, not just advertised by the select module. We don't
546
+ check select() because we'll be hopeful that most platforms that
547
+ don't have it available will not advertise it. (ie: GAE) """
548
+ try:
549
+ # select.poll() objects won't fail until used.
550
+ if struct == 'poll':
551
+ p = select.poll()
552
+ p.poll(0)
553
+
554
+ # All others will fail on allocation.
555
+ else:
556
+ getattr(select, struct)().close()
557
+ return True
558
+ except (OSError, AttributeError) as e:
559
+ return False
560
+
561
+
562
+ # Choose the best implementation, roughly:
563
+ # kqueue == epoll > poll > select. Devpoll not supported. (See above)
564
+ # select() also can't accept a FD > FD_SETSIZE (usually around 1024)
565
+ def DefaultSelector():
566
+ """ This function serves as a first call for DefaultSelector to
567
+ detect if the select module is being monkey-patched incorrectly
568
+ by eventlet, greenlet, and preserve proper behavior. """
569
+ global _DEFAULT_SELECTOR
570
+ if _DEFAULT_SELECTOR is None:
571
+ if _can_allocate('kqueue'):
572
+ _DEFAULT_SELECTOR = KqueueSelector
573
+ elif _can_allocate('epoll'):
574
+ _DEFAULT_SELECTOR = EpollSelector
575
+ elif _can_allocate('poll'):
576
+ _DEFAULT_SELECTOR = PollSelector
577
+ elif hasattr(select, 'select'):
578
+ _DEFAULT_SELECTOR = SelectSelector
579
+ else: # Platform-specific: AppEngine
580
+ raise ValueError('Platform does not have a selector')
581
+ return _DEFAULT_SELECTOR()