├── .gitignore ├── requirements.txt ├── vendor ├── pip-pop │ ├── pip │ │ ├── operations │ │ │ └── __init__.py │ │ ├── _vendor │ │ │ ├── html5lib │ │ │ │ ├── filters │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── _base.py │ │ │ │ │ ├── sanitizer.py │ │ │ │ │ ├── alphabeticalattributes.py │ │ │ │ │ ├── whitespace.py │ │ │ │ │ └── inject_meta_charset.py │ │ │ │ ├── treeadapters │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── sax.py │ │ │ │ ├── trie │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── _base.py │ │ │ │ │ ├── datrie.py │ │ │ │ │ └── py.py │ │ │ │ ├── serializer │ │ │ │ │ └── __init__.py │ │ │ │ ├── __init__.py │ │ │ │ ├── treewalkers │ │ │ │ │ ├── dom.py │ │ │ │ │ ├── pulldom.py │ │ │ │ │ └── genshistream.py │ │ │ │ ├── treebuilders │ │ │ │ │ └── __init__.py │ │ │ │ └── utils.py │ │ │ ├── requests │ │ │ │ ├── packages │ │ │ │ │ ├── urllib3 │ │ │ │ │ │ ├── contrib │ │ │ │ │ │ │ └── __init__.py │ │ │ │ │ │ ├── packages │ │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ │ └── ssl_match_hostname │ │ │ │ │ │ │ │ └── __init__.py │ │ │ │ │ │ ├── util │ │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ │ ├── response.py │ │ │ │ │ │ │ ├── request.py │ │ │ │ │ │ │ └── connection.py │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ └── filepost.py │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── chardet │ │ │ │ │ │ ├── compat.py │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── constants.py │ │ │ │ │ │ ├── euckrprober.py │ │ │ │ │ │ ├── euctwprober.py │ │ │ │ │ │ ├── gb2312prober.py │ │ │ │ │ │ ├── big5prober.py │ │ │ │ │ │ ├── cp949prober.py │ │ │ │ │ │ ├── charsetprober.py │ │ │ │ │ │ ├── mbcsgroupprober.py │ │ │ │ │ │ ├── codingstatemachine.py │ │ │ │ │ │ ├── chardetect.py │ │ │ │ │ │ ├── utf8prober.py │ │ │ │ │ │ ├── escprober.py │ │ │ │ │ │ ├── sbcsgroupprober.py │ │ │ │ │ │ ├── mbcharsetprober.py │ │ │ │ │ │ └── eucjpprober.py │ │ │ │ ├── certs.py │ │ │ │ ├── hooks.py │ │ │ │ ├── compat.py │ │ │ │ ├── __init__.py │ │ │ │ ├── exceptions.py │ │ │ │ ├── structures.py │ │ │ │ └── status_codes.py │ │ │ ├── distlib │ │ │ │ ├── t32.exe │ │ │ │ ├── t64.exe │ │ │ │ ├── w32.exe │ │ │ │ ├── w64.exe │ │ │ │ ├── _backport │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── misc.py │ │ │ │ │ └── sysconfig.cfg │ │ │ │ └── __init__.py │ │ │ ├── colorama │ │ │ │ ├── __init__.py │ │ │ │ ├── initialise.py │ │ │ │ └── ansi.py │ │ │ ├── vendor.txt │ │ │ ├── cachecontrol │ │ │ │ ├── __init__.py │ │ │ │ ├── compat.py │ │ │ │ ├── caches │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── redis_cache.py │ │ │ │ ├── wrapper.py │ │ │ │ ├── cache.py │ │ │ │ └── filewrapper.py │ │ │ ├── _markerlib │ │ │ │ └── __init__.py │ │ │ ├── re-vendor.py │ │ │ ├── packaging │ │ │ │ ├── __init__.py │ │ │ │ ├── __about__.py │ │ │ │ ├── _compat.py │ │ │ │ └── _structures.py │ │ │ ├── progress │ │ │ │ ├── spinner.py │ │ │ │ ├── counter.py │ │ │ │ ├── bar.py │ │ │ │ ├── helpers.py │ │ │ │ └── __init__.py │ │ │ ├── README.rst │ │ │ ├── __init__.py │ │ │ └── lockfile │ │ │ │ ├── symlinklockfile.py │ │ │ │ ├── linklockfile.py │ │ │ │ └── mkdirlockfile.py │ │ ├── models │ │ │ ├── __init__.py │ │ │ └── index.py │ │ ├── status_codes.py │ │ ├── req │ │ │ └── __init__.py │ │ ├── __main__.py │ │ ├── utils │ │ │ ├── filesystem.py │ │ │ ├── build.py │ │ │ ├── deprecation.py │ │ │ └── logging.py │ │ ├── commands │ │ │ ├── help.py │ │ │ ├── completion.py │ │ │ ├── __init__.py │ │ │ ├── freeze.py │ │ │ └── uninstall.py │ │ ├── exceptions.py │ │ └── compat │ │ │ └── __init__.py │ ├── pip-grep │ └── pip-diff ├── pip-8.1.1.tar.gz ├── bpwatch │ ├── bpwatch.zip │ └── bpwatch ├── setuptools-20.4.tar.gz └── python.gunicorn.sh ├── bin ├── steps │ ├── hooks │ │ ├── pre_compile │ │ └── post_compile │ ├── mercurial │ ├── setuptools │ ├── pip-uninstall │ ├── pip-install │ ├── pylibmc │ ├── gdal │ ├── cryptography │ ├── nltk-corpora │ ├── geo-libs │ ├── python │ └── collectstatic ├── release ├── detect ├── warnings ├── utils └── test ├── Makefile ├── LICENSE ├── Readme.md └── CHANGELOG.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | site 3 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | bob-builder==0.0.5 2 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/operations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/filters/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/treeadapters/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/urllib3/contrib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/pip-8.1.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megacool/heroku-buildpack-python-nltk/HEAD/vendor/pip-8.1.1.tar.gz -------------------------------------------------------------------------------- /vendor/bpwatch/bpwatch.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megacool/heroku-buildpack-python-nltk/HEAD/vendor/bpwatch/bpwatch.zip -------------------------------------------------------------------------------- /vendor/pip-pop/pip/models/__init__.py: -------------------------------------------------------------------------------- 1 | from pip.models.index import Index, PyPI 2 | 3 | 4 | __all__ = ["Index", "PyPI"] 5 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | from . import urllib3 4 | -------------------------------------------------------------------------------- /vendor/setuptools-20.4.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megacool/heroku-buildpack-python-nltk/HEAD/vendor/setuptools-20.4.tar.gz -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/distlib/t32.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megacool/heroku-buildpack-python-nltk/HEAD/vendor/pip-pop/pip/_vendor/distlib/t32.exe -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/distlib/t64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megacool/heroku-buildpack-python-nltk/HEAD/vendor/pip-pop/pip/_vendor/distlib/t64.exe -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/distlib/w32.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megacool/heroku-buildpack-python-nltk/HEAD/vendor/pip-pop/pip/_vendor/distlib/w32.exe -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/distlib/w64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megacool/heroku-buildpack-python-nltk/HEAD/vendor/pip-pop/pip/_vendor/distlib/w64.exe -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/urllib3/packages/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | from . import ssl_match_hostname 4 | 5 | -------------------------------------------------------------------------------- /bin/steps/hooks/pre_compile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -f bin/pre_compile ]; then 4 | echo "-----> Running pre-compile hook" 5 | chmod +x bin/pre_compile 6 | sub-env bin/pre_compile 7 | fi -------------------------------------------------------------------------------- /bin/steps/hooks/post_compile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -f bin/post_compile ]; then 4 | echo "-----> Running post-compile hook" 5 | chmod +x bin/post_compile 6 | sub-env bin/post_compile 7 | fi -------------------------------------------------------------------------------- /vendor/pip-pop/pip/status_codes.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | SUCCESS = 0 4 | ERROR = 1 5 | UNKNOWN_ERROR = 2 6 | VIRTUALENV_NOT_FOUND = 3 7 | PREVIOUS_BUILD_DIR_ERROR = 4 8 | NO_MATCHES_FOUND = 23 9 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # These targets are not files 2 | .PHONY: tests 3 | 4 | tests: 5 | ./bin/test 6 | 7 | tools: 8 | git clone https://github.com/kennethreitz/pip-pop.git 9 | mv pip-pop/bin/* vendor/pip-pop/ 10 | rm -fr pip-pop -------------------------------------------------------------------------------- /bin/steps/mercurial: -------------------------------------------------------------------------------- 1 | # Install Mercurial if it appears to be required. 2 | if (grep -Fiq "hg+" requirements.txt) then 3 | bpwatch start mercurial_install 4 | /app/.heroku/python/bin/pip install mercurial | cleanup | indent 5 | bpwatch stop mercurial_install 6 | fi -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/colorama/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. 2 | from .initialise import init, deinit, reinit 3 | from .ansi import Fore, Back, Style, Cursor 4 | from .ansitowin32 import AnsiToWin32 5 | 6 | __version__ = '0.3.3' 7 | 8 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/vendor.txt: -------------------------------------------------------------------------------- 1 | distlib==0.2.1 2 | html5lib==1.0b5 3 | six==1.9.0 4 | colorama==0.3.3 5 | requests==2.7.0 6 | CacheControl==0.11.5 7 | lockfile==0.10.2 8 | progress==1.2 9 | ipaddress==1.0.14 # Only needed on 2.6, 2.7, and 3.2 10 | packaging==15.3 11 | retrying==1.3.3 12 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/trie/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from .py import Trie as PyTrie 4 | 5 | Trie = PyTrie 6 | 7 | try: 8 | from .datrie import Trie as DATrie 9 | except ImportError: 10 | pass 11 | else: 12 | Trie = DATrie 13 | -------------------------------------------------------------------------------- /vendor/bpwatch/bpwatch: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | 4 | import os 5 | import sys 6 | 7 | 8 | DEFAULT_PATH = '{0}.zip'.format(os.path.abspath(__file__)) 9 | BPWATCH_DISTRO_PATH = os.environ.get('BPWATCH_DISTRO_PATH', DEFAULT_PATH) 10 | 11 | sys.path.insert(0, BPWATCH_DISTRO_PATH) 12 | 13 | import bp_cli 14 | bp_cli.main() 15 | -------------------------------------------------------------------------------- /bin/steps/setuptools: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Syntax sugar. 4 | source $BIN_DIR/utils 5 | 6 | if (pip-grep -s requirements.txt setuptools distribute &> /dev/null) then 7 | 8 | puts-warn 'The package setuptools/distribute is listed in requirements.txt.' 9 | puts-warn 'Please remove to ensure expected behavior. ' 10 | 11 | fi 12 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/distlib/_backport/__init__.py: -------------------------------------------------------------------------------- 1 | """Modules copied from Python 3 standard libraries, for internal use only. 2 | 3 | Individual classes and functions are found in d2._backport.misc. Intended 4 | usage is to always import things missing from 3.1 from that module: the 5 | built-in/stdlib objects will be used if found. 6 | """ 7 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/req/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | from .req_install import InstallRequirement 4 | from .req_set import RequirementSet, Requirements 5 | from .req_file import parse_requirements 6 | 7 | __all__ = [ 8 | "RequirementSet", "Requirements", "InstallRequirement", 9 | "parse_requirements", 10 | ] 11 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/filters/_base.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | 4 | class Filter(object): 5 | def __init__(self, source): 6 | self.source = source 7 | 8 | def __iter__(self): 9 | return iter(self.source) 10 | 11 | def __getattr__(self, name): 12 | return getattr(self.source, name) 13 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/cachecontrol/__init__.py: -------------------------------------------------------------------------------- 1 | """CacheControl import Interface. 2 | 3 | Make it easy to import from cachecontrol without long namespaces. 4 | """ 5 | __author__ = 'Eric Larson' 6 | __email__ = 'eric@ionrock.org' 7 | __version__ = '0.11.5' 8 | 9 | from .wrapper import CacheControl 10 | from .adapter import CacheControlAdapter 11 | from .controller import CacheController 12 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/cachecontrol/compat.py: -------------------------------------------------------------------------------- 1 | try: 2 | from urllib.parse import urljoin 3 | except ImportError: 4 | from urlparse import urljoin 5 | 6 | 7 | try: 8 | import cPickle as pickle 9 | except ImportError: 10 | import pickle 11 | 12 | 13 | from pip._vendor.requests.packages.urllib3.response import HTTPResponse 14 | from pip._vendor.requests.packages.urllib3.util import is_fp_closed 15 | -------------------------------------------------------------------------------- /bin/release: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # bin/release 3 | 4 | BIN_DIR=$(cd $(dirname $0); pwd) # absolute path 5 | BUILD_DIR=$1 6 | 7 | MANAGE_FILE=$(cd $BUILD_DIR && find . -maxdepth 3 -type f -name 'manage.py' | head -1) 8 | MANAGE_FILE=${MANAGE_FILE:2} 9 | 10 | cat < 14 | 15 | BUILD_DIR=$1 16 | 17 | # Exit early if app is clearly not Python. 18 | if [ ! -f $BUILD_DIR/requirements.txt ] && [ ! -f $BUILD_DIR/setup.py ]; then 19 | exit 1 20 | fi 21 | 22 | echo Python 23 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/cachecontrol/wrapper.py: -------------------------------------------------------------------------------- 1 | from .adapter import CacheControlAdapter 2 | from .cache import DictCache 3 | 4 | 5 | def CacheControl(sess, 6 | cache=None, 7 | cache_etags=True, 8 | serializer=None, 9 | heuristic=None): 10 | 11 | cache = cache or DictCache() 12 | adapter = CacheControlAdapter( 13 | cache, 14 | cache_etags=cache_etags, 15 | serializer=serializer, 16 | heuristic=heuristic, 17 | ) 18 | sess.mount('http://', adapter) 19 | sess.mount('https://', adapter) 20 | 21 | return sess 22 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/urllib3/util/__init__.py: -------------------------------------------------------------------------------- 1 | # For backwards compatibility, provide imports that used to be here. 2 | from .connection import is_connection_dropped 3 | from .request import make_headers 4 | from .response import is_fp_closed 5 | from .ssl_ import ( 6 | SSLContext, 7 | HAS_SNI, 8 | assert_fingerprint, 9 | resolve_cert_reqs, 10 | resolve_ssl_version, 11 | ssl_wrap_socket, 12 | ) 13 | from .timeout import ( 14 | current_time, 15 | Timeout, 16 | ) 17 | 18 | from .retry import Retry 19 | from .url import ( 20 | get_host, 21 | parse_url, 22 | split_first, 23 | Url, 24 | ) 25 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/_markerlib/__init__.py: -------------------------------------------------------------------------------- 1 | try: 2 | import ast 3 | from pip._vendor._markerlib.markers import default_environment, compile, interpret 4 | except ImportError: 5 | if 'ast' in globals(): 6 | raise 7 | def default_environment(): 8 | return {} 9 | def compile(marker): 10 | def marker_fn(environment=None, override=None): 11 | # 'empty markers are True' heuristic won't install extra deps. 12 | return not marker.strip() 13 | marker_fn.__doc__ = marker 14 | return marker_fn 15 | def interpret(marker, environment=None, override=None): 16 | return compile(marker)() 17 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/__main__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | import os 4 | import sys 5 | 6 | # If we are running from a wheel, add the wheel to sys.path 7 | # This allows the usage python pip-*.whl/pip install pip-*.whl 8 | if __package__ == '': 9 | # __file__ is pip-*.whl/pip/__main__.py 10 | # first dirname call strips of '/__main__.py', second strips off '/pip' 11 | # Resulting path is the name of the wheel itself 12 | # Add that to sys.path so we can import pip 13 | path = os.path.dirname(os.path.dirname(__file__)) 14 | sys.path.insert(0, path) 15 | 16 | import pip # noqa 17 | 18 | if __name__ == '__main__': 19 | sys.exit(pip.main()) 20 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/distlib/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) 2012-2014 Vinay Sajip. 4 | # Licensed to the Python Software Foundation under a contributor agreement. 5 | # See LICENSE.txt and CONTRIBUTORS.txt. 6 | # 7 | import logging 8 | 9 | __version__ = '0.2.1' 10 | 11 | class DistlibException(Exception): 12 | pass 13 | 14 | try: 15 | from logging import NullHandler 16 | except ImportError: # pragma: no cover 17 | class NullHandler(logging.Handler): 18 | def handle(self, record): pass 19 | def emit(self, record): pass 20 | def createLock(self): self.lock = None 21 | 22 | logger = logging.getLogger(__name__) 23 | logger.addHandler(NullHandler()) 24 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/urllib3/util/response.py: -------------------------------------------------------------------------------- 1 | def is_fp_closed(obj): 2 | """ 3 | Checks whether a given file-like object is closed. 4 | 5 | :param obj: 6 | The file-like object to check. 7 | """ 8 | 9 | try: 10 | # Check via the official file-like-object way. 11 | return obj.closed 12 | except AttributeError: 13 | pass 14 | 15 | try: 16 | # Check if the object is a container for another file-like object that 17 | # gets released on exhaustion (e.g. HTTPResponse). 18 | return obj.fp is None 19 | except AttributeError: 20 | pass 21 | 22 | raise ValueError("Unable to determine whether fp is closed.") 23 | -------------------------------------------------------------------------------- /bin/steps/pip-uninstall: -------------------------------------------------------------------------------- 1 | set +e 2 | # Install dependencies with Pip. 3 | bpwatch start pip_uninstall 4 | if [[ -f .heroku/python/requirements-declared.txt ]]; then 5 | 6 | cp .heroku/python/requirements-declared.txt requirements-declared.txt 7 | 8 | pip-diff --stale requirements-declared.txt requirements.txt --exclude setuptools pip wheel > .heroku/python/requirements-stale.txt 9 | 10 | rm -fr requirements-declared.txt 11 | 12 | if [[ -s .heroku/python/requirements-stale.txt ]]; then 13 | puts-step "Uninstalling stale dependencies" 14 | /app/.heroku/python/bin/pip uninstall -r .heroku/python/requirements-stale.txt -y --exists-action=w | cleanup | indent 15 | fi 16 | fi 17 | bpwatch stop pip_uninstall 18 | set -e -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/certs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | """ 5 | certs.py 6 | ~~~~~~~~ 7 | 8 | This module returns the preferred default CA certificate bundle. 9 | 10 | If you are packaging Requests, e.g., for a Linux distribution or a managed 11 | environment, you can change the definition of where() to return a separately 12 | packaged CA bundle. 13 | """ 14 | import os.path 15 | 16 | try: 17 | from certifi import where 18 | except ImportError: 19 | def where(): 20 | """Return the preferred certificate bundle.""" 21 | # vendored bundle inside Requests 22 | return os.path.join(os.path.dirname(__file__), 'cacert.pem') 23 | 24 | if __name__ == '__main__': 25 | print(where()) 26 | -------------------------------------------------------------------------------- /vendor/python.gunicorn.sh: -------------------------------------------------------------------------------- 1 | case $(ulimit -u) in 2 | 3 | # Automatic configuration for Gunicorn's Workers setting. 4 | 5 | # Standard-1X (+Free, +Hobby) Dyno 6 | 256) 7 | export DYNO_RAM=512 8 | export WEB_CONCURRENCY=${WEB_CONCURRENCY:-2} 9 | ;; 10 | 11 | # Standard-2X Dyno 12 | 512) 13 | export DYNO_RAM=1024 14 | export WEB_CONCURRENCY=${WEB_CONCURRENCY:-4} 15 | ;; 16 | 17 | # Performance-M Dyno 18 | 16384) 19 | export DYNO_RAM=2560 20 | export WEB_CONCURRENCY=${WEB_CONCURRENCY:-8} 21 | ;; 22 | 23 | # Performance-L Dyno 24 | 32768) 25 | export DYNO_RAM=6656 26 | export WEB_CONCURRENCY=${WEB_CONCURRENCY:-11} 27 | ;; 28 | 29 | esac 30 | 31 | # Automatic configuration for Gunicorn's ForwardedAllowIPS setting. 32 | export FORWARDED_ALLOW_IPS='*' -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/filters/alphabeticalattributes.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from . import _base 4 | 5 | try: 6 | from collections import OrderedDict 7 | except ImportError: 8 | from ordereddict import OrderedDict 9 | 10 | 11 | class Filter(_base.Filter): 12 | def __iter__(self): 13 | for token in _base.Filter.__iter__(self): 14 | if token["type"] in ("StartTag", "EmptyTag"): 15 | attrs = OrderedDict() 16 | for name, value in sorted(token["data"].items(), 17 | key=lambda x: x[0]): 18 | attrs[name] = value 19 | token["data"] = attrs 20 | yield token 21 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | HTML parsing library based on the WHATWG "HTML5" 3 | specification. The parser is designed to be compatible with existing 4 | HTML found in the wild and implements well-defined error recovery that 5 | is largely compatible with modern desktop web browsers. 6 | 7 | Example usage: 8 | 9 | import html5lib 10 | f = open("my_document.html") 11 | tree = html5lib.parse(f) 12 | """ 13 | 14 | from __future__ import absolute_import, division, unicode_literals 15 | 16 | from .html5parser import HTMLParser, parse, parseFragment 17 | from .treebuilders import getTreeBuilder 18 | from .treewalkers import getTreeWalker 19 | from .serializer import serialize 20 | 21 | __all__ = ["HTMLParser", "parse", "parseFragment", "getTreeBuilder", 22 | "getTreeWalker", "serialize"] 23 | __version__ = "1.0b5" 24 | -------------------------------------------------------------------------------- /bin/steps/pip-install: -------------------------------------------------------------------------------- 1 | # Install dependencies with Pip. 2 | puts-cmd "pip install -r requirements.txt" 3 | 4 | [ ! "$FRESH_PYTHON" ] && bpwatch start pip_install 5 | [ "$FRESH_PYTHON" ] && bpwatch start pip_install_first 6 | 7 | set +e 8 | /app/.heroku/python/bin/pip install -r requirements.txt --exists-action=w --src=./.heroku/src --disable-pip-version-check --no-cache-dir 2>&1 | tee $WARNINGS_LOG | cleanup | indent 9 | PIP_STATUS="${PIPESTATUS[0]}" 10 | set -e 11 | 12 | show-warnings 13 | 14 | if [[ ! $PIP_STATUS -eq 0 ]]; then 15 | exit 1 16 | fi 17 | 18 | 19 | # Smart Requirements handling 20 | cp requirements.txt .heroku/python/requirements-declared.txt 21 | /app/.heroku/python/bin/pip freeze --disable-pip-version-check > .heroku/python/requirements-installed.txt 22 | 23 | [ ! "$FRESH_PYTHON" ] && bpwatch stop pip_install 24 | [ "$FRESH_PYTHON" ] && bpwatch stop pip_install_first 25 | 26 | echo 27 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/re-vendor.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import pip 4 | import glob 5 | import shutil 6 | 7 | here = os.path.abspath(os.path.dirname(__file__)) 8 | 9 | def usage(): 10 | print("Usage: re-vendor.py [clean|vendor]") 11 | sys.exit(1) 12 | 13 | def clean(): 14 | for fn in os.listdir(here): 15 | dirname = os.path.join(here, fn) 16 | if os.path.isdir(dirname): 17 | shutil.rmtree(dirname) 18 | # six is a single file, not a package 19 | os.unlink(os.path.join(here, 'six.py')) 20 | 21 | def vendor(): 22 | pip.main(['install', '-t', here, '-r', 'vendor.txt']) 23 | for dirname in glob.glob('*.egg-info'): 24 | shutil.rmtree(dirname) 25 | 26 | if __name__ == '__main__': 27 | if len(sys.argv) != 2: 28 | usage() 29 | if sys.argv[1] == 'clean': 30 | clean() 31 | elif sys.argv[1] == 'vendor': 32 | vendor() 33 | else: 34 | usage() 35 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/cachecontrol/cache.py: -------------------------------------------------------------------------------- 1 | """ 2 | The cache object API for implementing caches. The default is a thread 3 | safe in-memory dictionary. 4 | """ 5 | from threading import Lock 6 | 7 | 8 | class BaseCache(object): 9 | 10 | def get(self, key): 11 | raise NotImplemented() 12 | 13 | def set(self, key, value): 14 | raise NotImplemented() 15 | 16 | def delete(self, key): 17 | raise NotImplemented() 18 | 19 | def close(self): 20 | pass 21 | 22 | 23 | class DictCache(BaseCache): 24 | 25 | def __init__(self, init_dict=None): 26 | self.lock = Lock() 27 | self.data = init_dict or {} 28 | 29 | def get(self, key): 30 | return self.data.get(key, None) 31 | 32 | def set(self, key, value): 33 | with self.lock: 34 | self.data.update({key: value}) 35 | 36 | def delete(self, key): 37 | with self.lock: 38 | if key in self.data: 39 | self.data.pop(key) 40 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/packaging/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014 Donald Stufft 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import absolute_import, division, print_function 15 | 16 | from .__about__ import ( 17 | __author__, __copyright__, __email__, __license__, __summary__, __title__, 18 | __uri__, __version__ 19 | ) 20 | 21 | __all__ = [ 22 | "__title__", "__summary__", "__uri__", "__version__", "__author__", 23 | "__email__", "__license__", "__copyright__", 24 | ] 25 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/utils/filesystem.py: -------------------------------------------------------------------------------- 1 | import os 2 | import os.path 3 | 4 | from pip.compat import get_path_uid 5 | 6 | 7 | def check_path_owner(path): 8 | # If we don't have a way to check the effective uid of this process, then 9 | # we'll just assume that we own the directory. 10 | if not hasattr(os, "geteuid"): 11 | return True 12 | 13 | previous = None 14 | while path != previous: 15 | if os.path.lexists(path): 16 | # Check if path is writable by current user. 17 | if os.geteuid() == 0: 18 | # Special handling for root user in order to handle properly 19 | # cases where users use sudo without -H flag. 20 | try: 21 | path_uid = get_path_uid(path) 22 | except OSError: 23 | return False 24 | return path_uid == 0 25 | else: 26 | return os.access(path, os.W_OK) 27 | else: 28 | previous, path = path, os.path.dirname(path) 29 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/hooks.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | requests.hooks 5 | ~~~~~~~~~~~~~~ 6 | 7 | This module provides the capabilities for the Requests hooks system. 8 | 9 | Available hooks: 10 | 11 | ``response``: 12 | The response generated from a Request. 13 | 14 | """ 15 | 16 | 17 | HOOKS = ['response'] 18 | 19 | 20 | def default_hooks(): 21 | hooks = {} 22 | for event in HOOKS: 23 | hooks[event] = [] 24 | return hooks 25 | 26 | # TODO: response is the only one 27 | 28 | 29 | def dispatch_hook(key, hooks, hook_data, **kwargs): 30 | """Dispatches a hook dictionary on a given piece of data.""" 31 | 32 | hooks = hooks or dict() 33 | 34 | if key in hooks: 35 | hooks = hooks.get(key) 36 | 37 | if hasattr(hooks, '__call__'): 38 | hooks = [hooks] 39 | 40 | for hook in hooks: 41 | _hook_data = hook(hook_data, **kwargs) 42 | if _hook_data is not None: 43 | hook_data = _hook_data 44 | 45 | return hook_data 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License: 2 | 3 | Copyright (C) 2016 Heroku, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/trie/_base.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from collections import Mapping 4 | 5 | 6 | class Trie(Mapping): 7 | """Abstract base class for tries""" 8 | 9 | def keys(self, prefix=None): 10 | keys = super().keys() 11 | 12 | if prefix is None: 13 | return set(keys) 14 | 15 | # Python 2.6: no set comprehensions 16 | return set([x for x in keys if x.startswith(prefix)]) 17 | 18 | def has_keys_with_prefix(self, prefix): 19 | for key in self.keys(): 20 | if key.startswith(prefix): 21 | return True 22 | 23 | return False 24 | 25 | def longest_prefix(self, prefix): 26 | if prefix in self: 27 | return prefix 28 | 29 | for i in range(1, len(prefix) + 1): 30 | if prefix[:-i] in self: 31 | return prefix[:-i] 32 | 33 | raise KeyError(prefix) 34 | 35 | def longest_prefix_item(self, prefix): 36 | lprefix = self.longest_prefix(prefix) 37 | return (lprefix, self[lprefix]) 38 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/commands/help.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | from pip.basecommand import Command, SUCCESS 4 | from pip.exceptions import CommandError 5 | 6 | 7 | class HelpCommand(Command): 8 | """Show help for commands""" 9 | name = 'help' 10 | usage = """ 11 | %prog """ 12 | summary = 'Show help for commands.' 13 | 14 | def run(self, options, args): 15 | from pip.commands import commands_dict, get_similar_commands 16 | 17 | try: 18 | # 'pip help' with no args is handled by pip.__init__.parseopt() 19 | cmd_name = args[0] # the command we need help for 20 | except IndexError: 21 | return SUCCESS 22 | 23 | if cmd_name not in commands_dict: 24 | guess = get_similar_commands(cmd_name) 25 | 26 | msg = ['unknown command "%s"' % cmd_name] 27 | if guess: 28 | msg.append('maybe you meant "%s"' % guess) 29 | 30 | raise CommandError(' - '.join(msg)) 31 | 32 | command = commands_dict[cmd_name]() 33 | command.parser.print_help() 34 | 35 | return SUCCESS 36 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/distlib/_backport/misc.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) 2012 The Python Software Foundation. 4 | # See LICENSE.txt and CONTRIBUTORS.txt. 5 | # 6 | """Backports for individual classes and functions.""" 7 | 8 | import os 9 | import sys 10 | 11 | __all__ = ['cache_from_source', 'callable', 'fsencode'] 12 | 13 | 14 | try: 15 | from imp import cache_from_source 16 | except ImportError: 17 | def cache_from_source(py_file, debug=__debug__): 18 | ext = debug and 'c' or 'o' 19 | return py_file + ext 20 | 21 | 22 | try: 23 | callable = callable 24 | except NameError: 25 | from collections import Callable 26 | 27 | def callable(obj): 28 | return isinstance(obj, Callable) 29 | 30 | 31 | try: 32 | fsencode = os.fsencode 33 | except AttributeError: 34 | def fsencode(filename): 35 | if isinstance(filename, bytes): 36 | return filename 37 | elif isinstance(filename, str): 38 | return filename.encode(sys.getfilesystemencoding()) 39 | else: 40 | raise TypeError("expect bytes or str, not %s" % 41 | type(filename).__name__) 42 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/cachecontrol/caches/redis_cache.py: -------------------------------------------------------------------------------- 1 | from __future__ import division 2 | 3 | from datetime import datetime 4 | 5 | 6 | def total_seconds(td): 7 | """Python 2.6 compatability""" 8 | if hasattr(td, 'total_seconds'): 9 | return td.total_seconds() 10 | 11 | ms = td.microseconds 12 | secs = (td.seconds + td.days * 24 * 3600) 13 | return (ms + secs * 10**6) / 10**6 14 | 15 | 16 | class RedisCache(object): 17 | 18 | def __init__(self, conn): 19 | self.conn = conn 20 | 21 | def get(self, key): 22 | return self.conn.get(key) 23 | 24 | def set(self, key, value, expires=None): 25 | if not expires: 26 | self.conn.set(key, value) 27 | else: 28 | expires = expires - datetime.now() 29 | self.conn.setex(key, total_seconds(expires), value) 30 | 31 | def delete(self, key): 32 | self.conn.delete(key) 33 | 34 | def clear(self): 35 | """Helper for clearing all the keys in a database. Use with 36 | caution!""" 37 | for key in self.conn.keys(): 38 | self.conn.delete(key) 39 | 40 | def close(self): 41 | self.conn.disconnect() 42 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/packaging/__about__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014 Donald Stufft 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import absolute_import, division, print_function 15 | 16 | __all__ = [ 17 | "__title__", "__summary__", "__uri__", "__version__", "__author__", 18 | "__email__", "__license__", "__copyright__", 19 | ] 20 | 21 | __title__ = "packaging" 22 | __summary__ = "Core utilities for Python packages" 23 | __uri__ = "https://github.com/pypa/packaging" 24 | 25 | __version__ = "15.3" 26 | 27 | __author__ = "Donald Stufft" 28 | __email__ = "donald@stufft.io" 29 | 30 | __license__ = "Apache License, Version 2.0" 31 | __copyright__ = "Copyright 2014 %s" % __author__ 32 | -------------------------------------------------------------------------------- /bin/steps/pylibmc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script serves as the Pylibmc build step of the 4 | # [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python) 5 | # compiler. 6 | # 7 | # A [buildpack](https://devcenter.heroku.com/articles/buildpacks) is an 8 | # adapter between a Python application and Heroku's runtime. 9 | # 10 | # This script is invoked by [`bin/compile`](/). 11 | 12 | # The location of the pre-compiled libmemcached binary. 13 | VENDORED_MEMCACHED="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/libmemcache.tar.gz" 14 | 15 | # Syntax sugar. 16 | source $BIN_DIR/utils 17 | 18 | 19 | bpwatch start pylibmc_install 20 | 21 | # If pylibmc exists within requirements, use vendored libmemcached. 22 | if (pip-grep -s requirements.txt pylibmc &> /dev/null) then 23 | 24 | if [ -d ".heroku/vendor/lib/sasl2" ]; then 25 | export LIBMEMCACHED=$(pwd)/vendor 26 | else 27 | echo "-----> Noticed pylibmc. Bootstrapping libmemcached." 28 | mkdir -p .heroku/vendor 29 | # Download and extract libmemcached into target vendor directory. 30 | curl $VENDORED_MEMCACHED -s | tar zxv -C .heroku/vendor &> /dev/null 31 | 32 | export LIBMEMCACHED=$(pwd)/vendor 33 | fi 34 | fi 35 | 36 | bpwatch stop pylibmc_install 37 | -------------------------------------------------------------------------------- /bin/steps/gdal: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script serves as the GDAL build step of the 4 | # [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python) 5 | # compiler. 6 | # 7 | # A [buildpack](https://devcenter.heroku.com/articles/buildpacks) is an 8 | # adapter between a Python application and Heroku's runtime. 9 | # 10 | # This script is invoked by [`bin/compile`](/). 11 | 12 | # The location of the pre-compiled cryptography binary. 13 | VENDORED_GDAL="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/gdal.tar.gz" 14 | 15 | PKG_CONFIG_PATH="/app/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH" 16 | 17 | # Syntax sugar. 18 | source $BIN_DIR/utils 19 | 20 | bpwatch start gdal_install 21 | 22 | # If GDAL exists within requirements, use vendored gdal. 23 | if (pip-grep -s requirements.txt GDAL gdal pygdal &> /dev/null) then 24 | 25 | if [ -f ".heroku/vendor/bin/gdalserver" ]; then 26 | export GDAL=$(pwd)/vendor 27 | else 28 | echo "-----> Noticed GDAL. Bootstrapping gdal." 29 | mkdir -p .heroku/vendor 30 | # Download and extract cryptography into target vendor directory. 31 | curl $VENDORED_GDAL -s | tar zxv -C .heroku/vendor &> /dev/null 32 | 33 | export GDAL=$(pwd)/vendor 34 | fi 35 | fi 36 | 37 | bpwatch stop gdal_install 38 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/filters/whitespace.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | import re 4 | 5 | from . import _base 6 | from ..constants import rcdataElements, spaceCharacters 7 | spaceCharacters = "".join(spaceCharacters) 8 | 9 | SPACES_REGEX = re.compile("[%s]+" % spaceCharacters) 10 | 11 | 12 | class Filter(_base.Filter): 13 | 14 | spacePreserveElements = frozenset(["pre", "textarea"] + list(rcdataElements)) 15 | 16 | def __iter__(self): 17 | preserve = 0 18 | for token in _base.Filter.__iter__(self): 19 | type = token["type"] 20 | if type == "StartTag" \ 21 | and (preserve or token["name"] in self.spacePreserveElements): 22 | preserve += 1 23 | 24 | elif type == "EndTag" and preserve: 25 | preserve -= 1 26 | 27 | elif not preserve and type == "SpaceCharacters" and token["data"]: 28 | # Test on token["data"] above to not introduce spaces where there were not 29 | token["data"] = " " 30 | 31 | elif not preserve and type == "Characters": 32 | token["data"] = collapse_spaces(token["data"]) 33 | 34 | yield token 35 | 36 | 37 | def collapse_spaces(text): 38 | return SPACES_REGEX.sub(' ', text) 39 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/compat.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # Contributor(s): 3 | # Ian Cordasco - port to Python 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 | # 02110-1301 USA 19 | ######################### END LICENSE BLOCK ######################### 20 | 21 | import sys 22 | 23 | 24 | if sys.version_info < (3, 0): 25 | base_str = (str, unicode) 26 | else: 27 | base_str = (bytes, str) 28 | 29 | 30 | def wrap_ord(a): 31 | if sys.version_info < (3, 0) and isinstance(a, base_str): 32 | return ord(a) 33 | else: 34 | return a 35 | -------------------------------------------------------------------------------- /bin/steps/cryptography: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script serves as the Pylibmc build step of the 4 | # [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python) 5 | # compiler. 6 | # 7 | # A [buildpack](https://devcenter.heroku.com/articles/buildpacks) is an 8 | # adapter between a Python application and Heroku's runtime. 9 | # 10 | # This script is invoked by [`bin/compile`](/). 11 | 12 | # The location of the pre-compiled libffi binary. 13 | VENDORED_LIBFFI="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/libffi.tar.gz" 14 | 15 | PKG_CONFIG_PATH="/app/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH" 16 | 17 | # Syntax sugar. 18 | source $BIN_DIR/utils 19 | 20 | bpwatch start libffi_install 21 | 22 | # If a package using cffi exists within requirements, use vendored libffi. 23 | if (pip-grep -s requirements.txt bcrypt cffi cryptography django[bcrypt] Django[bcrypt] PyNaCl pyOpenSSL PyOpenSSL requests[security] &> /dev/null) then 24 | 25 | if [ -d ".heroku/vendor/lib/libffi-3.1.1" ]; then 26 | export LIBFFI=$(pwd)/vendor 27 | else 28 | echo "-----> Noticed cffi. Bootstrapping libffi." 29 | mkdir -p .heroku/vendor 30 | # Download and extract libffi into target vendor directory. 31 | curl $VENDORED_LIBFFI -s | tar zxv -C .heroku/vendor &> /dev/null 32 | 33 | export LIBFFI=$(pwd)/vendor 34 | fi 35 | fi 36 | 37 | bpwatch stop libffi_install 38 | -------------------------------------------------------------------------------- /bin/steps/nltk-corpora: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script serves as the NLTK corpora download build step of the 4 | # [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python) 5 | # compiler. The NLTK packages to download should be specified in .nltk_packages 6 | # in the root of the repo. If not present this buildpack is identical to 7 | # heroku/python 8 | # 9 | # A [buildpack](http://devcenter.heroku.com/articles/buildpacks) is an 10 | # adapter between a Python application and Heroku's runtime. 11 | # 12 | # This script is invoked by [`bin/compile`](/). 13 | 14 | NLTK_DATA_DIR="nltk_data" 15 | 16 | # Syntax sugar. 17 | source $BIN_DIR/utils 18 | 19 | cd .heroku 20 | 21 | # Check that nltk was installed by pip, otherwise obviously not needed 22 | python -m nltk.downloader -h >/dev/null 2>&1 23 | if [ $? -eq 0 ]; then 24 | nltk_packages_definition="$BUILD_DIR/.nltk_packages" 25 | if [ -f "$nltk_packages_definition" ]; then 26 | nltk_packages=$(tr "\n" " " < "$nltk_packages_definition") 27 | puts-step "Downloading NLTK packages $nltk_packages" 28 | python -m nltk.downloader $nltk_packages 29 | set-env NLTK_DATA "/app/.heroku/nltk_data" 30 | else 31 | puts-warn ".nltk_packages not found, not downloading anything" 32 | fi 33 | else 34 | puts-warn "nltk not apparently installed, not downloading packages" 35 | fi 36 | 37 | cd .. 38 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/trie/datrie.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from datrie import Trie as DATrie 4 | from pip._vendor.six import text_type 5 | 6 | from ._base import Trie as ABCTrie 7 | 8 | 9 | class Trie(ABCTrie): 10 | def __init__(self, data): 11 | chars = set() 12 | for key in data.keys(): 13 | if not isinstance(key, text_type): 14 | raise TypeError("All keys must be strings") 15 | for char in key: 16 | chars.add(char) 17 | 18 | self._data = DATrie("".join(chars)) 19 | for key, value in data.items(): 20 | self._data[key] = value 21 | 22 | def __contains__(self, key): 23 | return key in self._data 24 | 25 | def __len__(self): 26 | return len(self._data) 27 | 28 | def __iter__(self): 29 | raise NotImplementedError() 30 | 31 | def __getitem__(self, key): 32 | return self._data[key] 33 | 34 | def keys(self, prefix=None): 35 | return self._data.keys(prefix) 36 | 37 | def has_keys_with_prefix(self, prefix): 38 | return self._data.has_keys_with_prefix(prefix) 39 | 40 | def longest_prefix(self, prefix): 41 | return self._data.longest_prefix(prefix) 42 | 43 | def longest_prefix_item(self, prefix): 44 | return self._data.longest_prefix_item(prefix) 45 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/packaging/_compat.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014 Donald Stufft 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import absolute_import, division, print_function 15 | 16 | import sys 17 | 18 | 19 | PY2 = sys.version_info[0] == 2 20 | PY3 = sys.version_info[0] == 3 21 | 22 | # flake8: noqa 23 | 24 | if PY3: 25 | string_types = str, 26 | else: 27 | string_types = basestring, 28 | 29 | 30 | def with_metaclass(meta, *bases): 31 | """ 32 | Create a base class with a metaclass. 33 | """ 34 | # This requires a bit of explanation: the basic idea is to make a dummy 35 | # metaclass for one level of class instantiation that replaces itself with 36 | # the actual metaclass. 37 | class metaclass(meta): 38 | def __new__(cls, name, this_bases, d): 39 | return meta(name, bases, d) 40 | return type.__new__(metaclass, 'temporary_class', (), {}) 41 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/__init__.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # This library is free software; you can redistribute it and/or 3 | # modify it under the terms of the GNU Lesser General Public 4 | # License as published by the Free Software Foundation; either 5 | # version 2.1 of the License, or (at your option) any later version. 6 | # 7 | # This library is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | # Lesser General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU Lesser General Public 13 | # License along with this library; if not, write to the Free Software 14 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 15 | # 02110-1301 USA 16 | ######################### END LICENSE BLOCK ######################### 17 | 18 | __version__ = "2.3.0" 19 | from sys import version_info 20 | 21 | 22 | def detect(aBuf): 23 | if ((version_info < (3, 0) and isinstance(aBuf, unicode)) or 24 | (version_info >= (3, 0) and not isinstance(aBuf, bytes))): 25 | raise ValueError('Expected a bytes object, not a unicode object') 26 | 27 | from . import universaldetector 28 | u = universaldetector.UniversalDetector() 29 | u.reset() 30 | u.feed(aBuf) 31 | u.close() 32 | return u.result 33 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/exceptions.py: -------------------------------------------------------------------------------- 1 | """Exceptions used throughout package""" 2 | from __future__ import absolute_import 3 | 4 | 5 | class PipError(Exception): 6 | """Base pip exception""" 7 | 8 | 9 | class InstallationError(PipError): 10 | """General exception during installation""" 11 | 12 | 13 | class UninstallationError(PipError): 14 | """General exception during uninstallation""" 15 | 16 | 17 | class DistributionNotFound(InstallationError): 18 | """Raised when a distribution cannot be found to satisfy a requirement""" 19 | 20 | 21 | class RequirementsFileParseError(InstallationError): 22 | """Raised when a general error occurs parsing a requirements file line.""" 23 | 24 | 25 | class BestVersionAlreadyInstalled(PipError): 26 | """Raised when the most up-to-date version of a package is already 27 | installed.""" 28 | 29 | 30 | class BadCommand(PipError): 31 | """Raised when virtualenv or a command is not found""" 32 | 33 | 34 | class CommandError(PipError): 35 | """Raised when there is an error in command-line arguments""" 36 | 37 | 38 | class PreviousBuildDirError(PipError): 39 | """Raised when there's a previous conflicting build directory""" 40 | 41 | 42 | class HashMismatch(InstallationError): 43 | """Distribution file hash values don't match.""" 44 | 45 | 46 | class InvalidWheelFilename(InstallationError): 47 | """Invalid wheel filename.""" 48 | 49 | 50 | class UnsupportedWheel(InstallationError): 51 | """Unsupported wheel.""" 52 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/utils/build.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | import os.path 4 | import tempfile 5 | 6 | from pip.utils import rmtree 7 | 8 | 9 | class BuildDirectory(object): 10 | 11 | def __init__(self, name=None, delete=None): 12 | # If we were not given an explicit directory, and we were not given an 13 | # explicit delete option, then we'll default to deleting. 14 | if name is None and delete is None: 15 | delete = True 16 | 17 | if name is None: 18 | # We realpath here because some systems have their default tmpdir 19 | # symlinked to another directory. This tends to confuse build 20 | # scripts, so we canonicalize the path by traversing potential 21 | # symlinks here. 22 | name = os.path.realpath(tempfile.mkdtemp(prefix="pip-build-")) 23 | # If we were not given an explicit directory, and we were not given 24 | # an explicit delete option, then we'll default to deleting. 25 | if delete is None: 26 | delete = True 27 | 28 | self.name = name 29 | self.delete = delete 30 | 31 | def __repr__(self): 32 | return "<{} {!r}>".format(self.__class__.__name__, self.name) 33 | 34 | def __enter__(self): 35 | return self.name 36 | 37 | def __exit__(self, exc, value, tb): 38 | self.cleanup() 39 | 40 | def cleanup(self): 41 | if self.delete: 42 | rmtree(self.name) 43 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/progress/spinner.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Copyright (c) 2012 Giorgos Verigakis 4 | # 5 | # Permission to use, copy, modify, and distribute this software for any 6 | # purpose with or without fee is hereby granted, provided that the above 7 | # copyright notice and this permission notice appear in all copies. 8 | # 9 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | 17 | from __future__ import unicode_literals 18 | 19 | from . import Infinite 20 | from .helpers import WriteMixin 21 | 22 | 23 | class Spinner(WriteMixin, Infinite): 24 | message = '' 25 | phases = ('-', '\\', '|', '/') 26 | hide_cursor = True 27 | 28 | def update(self): 29 | i = self.index % len(self.phases) 30 | self.write(self.phases[i]) 31 | 32 | 33 | class PieSpinner(Spinner): 34 | phases = ['◷', '◶', '◵', '◴'] 35 | 36 | 37 | class MoonSpinner(Spinner): 38 | phases = ['◑', '◒', '◐', '◓'] 39 | 40 | 41 | class LineSpinner(Spinner): 42 | phases = ['⎺', '⎻', '⎼', '⎽', '⎼', '⎻'] 43 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/constants.py: -------------------------------------------------------------------------------- 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 | _debug = 0 30 | 31 | eDetecting = 0 32 | eFoundIt = 1 33 | eNotMe = 2 34 | 35 | eStart = 0 36 | eError = 1 37 | eItsMe = 2 38 | 39 | SHORTCUT_THRESHOLD = 0.95 40 | -------------------------------------------------------------------------------- /bin/steps/geo-libs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script serves as the GDAL build step of the 4 | # [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python) 5 | # compiler. 6 | # 7 | # A [buildpack](https://devcenter.heroku.com/articles/buildpacks) is an 8 | # adapter between a Python application and Heroku's runtime. 9 | # 10 | # This script is invoked by [`bin/compile`](/). 11 | 12 | # The location of the pre-compiled cryptography binary. 13 | VENDORED_GDAL="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/gdal.tar.gz" 14 | VENDORED_GEOS="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/geos.tar.gz" 15 | VENDORED_PROJ="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/proj.tar.gz" 16 | 17 | PKG_CONFIG_PATH="/app/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH" 18 | 19 | # Syntax sugar. 20 | source $BIN_DIR/utils 21 | 22 | bpwatch start geo_libs_install 23 | 24 | # If GDAL exists within requirements, use vendored gdal. 25 | if [[ "$BUILD_WITH_GEO_LIBRARIES" ]]; then 26 | 27 | if [ -f ".heroku/vendor/bin/gdalserver" ]; then 28 | export GDAL=$(pwd)/vendor 29 | else 30 | echo "-----> Bootstrapping gdal, geos, proj." 31 | mkdir -p .heroku/vendor 32 | # Download and extract cryptography into target vendor directory. 33 | curl $VENDORED_GDAL -s | tar zxv -C .heroku/vendor &> /dev/null 34 | curl $VENDORED_GEOS -s | tar zxv -C .heroku/vendor &> /dev/null 35 | curl $VENDORED_PROJ -s | tar zxv -C .heroku/vendor &> /dev/null 36 | 37 | export GDAL=$(pwd)/vendor 38 | fi 39 | fi 40 | 41 | bpwatch stop geo_libs_install 42 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/treewalkers/dom.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from xml.dom import Node 4 | 5 | from . import _base 6 | 7 | 8 | class TreeWalker(_base.NonRecursiveTreeWalker): 9 | def getNodeDetails(self, node): 10 | if node.nodeType == Node.DOCUMENT_TYPE_NODE: 11 | return _base.DOCTYPE, node.name, node.publicId, node.systemId 12 | 13 | elif node.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE): 14 | return _base.TEXT, node.nodeValue 15 | 16 | elif node.nodeType == Node.ELEMENT_NODE: 17 | attrs = {} 18 | for attr in list(node.attributes.keys()): 19 | attr = node.getAttributeNode(attr) 20 | if attr.namespaceURI: 21 | attrs[(attr.namespaceURI, attr.localName)] = attr.value 22 | else: 23 | attrs[(None, attr.name)] = attr.value 24 | return (_base.ELEMENT, node.namespaceURI, node.nodeName, 25 | attrs, node.hasChildNodes()) 26 | 27 | elif node.nodeType == Node.COMMENT_NODE: 28 | return _base.COMMENT, node.nodeValue 29 | 30 | elif node.nodeType in (Node.DOCUMENT_NODE, Node.DOCUMENT_FRAGMENT_NODE): 31 | return (_base.DOCUMENT,) 32 | 33 | else: 34 | return _base.UNKNOWN, node.nodeType 35 | 36 | def getFirstChild(self, node): 37 | return node.firstChild 38 | 39 | def getNextSibling(self, node): 40 | return node.nextSibling 41 | 42 | def getParentNode(self, node): 43 | return node.parentNode 44 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/README.rst: -------------------------------------------------------------------------------- 1 | Policy 2 | ====== 3 | 4 | Vendored libraries should not be modified except as required to actually 5 | successfully vendor them. 6 | 7 | 8 | Modifications 9 | ============= 10 | 11 | * html5lib has been modified to import six from pip._vendor 12 | * pkg_resources has been modified to import _markerlib from pip._vendor 13 | * markerlib has been modified to import its API from pip._vendor 14 | * CacheControl has been modified to import it's dependencies from pip._vendor 15 | * progress has been modified to not use unicode literals for support for Python 3.2 16 | 17 | 18 | _markerlib and pkg_resources 19 | ============================ 20 | 21 | _markerlib and pkg_resources has been pulled in from setuptools 18.2 22 | 23 | 24 | Note to Downstream Distributors 25 | =============================== 26 | 27 | Libraries are vendored/bundled inside of this directory in order to prevent 28 | end users from needing to manually install packages if they accidently remove 29 | something that pip depends on. 30 | 31 | All bundled packages exist in the ``pip._vendor`` namespace, and the versions 32 | (fetched from PyPI) that we use are located in ``vendor.txt``. If you wish 33 | to debundle these you can do so by either deleting everything in 34 | ``pip/_vendor`` **except** for ``pip/_vendor/__init__.py`` or by running 35 | ``PIP_NO_VENDOR_FOR_DOWNSTREAM=1 setup.py install``. No other changes should 36 | be required as the ``pip/_vendor/__init__.py`` file will alias the "real" 37 | names (such as ``import six``) to the bundled names (such as 38 | ``import pip._vendor.six``) automatically. Alternatively if you delete the 39 | entire ``pip._vendor`` you will need to adjust imports that import from those 40 | locations. 41 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/progress/counter.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Copyright (c) 2012 Giorgos Verigakis 4 | # 5 | # Permission to use, copy, modify, and distribute this software for any 6 | # purpose with or without fee is hereby granted, provided that the above 7 | # copyright notice and this permission notice appear in all copies. 8 | # 9 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | 17 | from __future__ import unicode_literals 18 | 19 | from . import Infinite, Progress 20 | from .helpers import WriteMixin 21 | 22 | 23 | class Counter(WriteMixin, Infinite): 24 | message = '' 25 | hide_cursor = True 26 | 27 | def update(self): 28 | self.write(str(self.index)) 29 | 30 | 31 | class Countdown(WriteMixin, Progress): 32 | hide_cursor = True 33 | 34 | def update(self): 35 | self.write(str(self.remaining)) 36 | 37 | 38 | class Stack(WriteMixin, Progress): 39 | phases = (' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█') 40 | hide_cursor = True 41 | 42 | def update(self): 43 | nphases = len(self.phases) 44 | i = min(nphases - 1, int(self.progress * nphases)) 45 | self.write(self.phases[i]) 46 | 47 | 48 | class Pie(Stack): 49 | phases = ('○', '◔', '◑', '◕', '●') 50 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/compat.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | pythoncompat 5 | """ 6 | 7 | from .packages import chardet 8 | 9 | import sys 10 | 11 | # ------- 12 | # Pythons 13 | # ------- 14 | 15 | # Syntax sugar. 16 | _ver = sys.version_info 17 | 18 | #: Python 2.x? 19 | is_py2 = (_ver[0] == 2) 20 | 21 | #: Python 3.x? 22 | is_py3 = (_ver[0] == 3) 23 | 24 | try: 25 | import simplejson as json 26 | except (ImportError, SyntaxError): 27 | # simplejson does not support Python 3.2, it throws a SyntaxError 28 | # because of u'...' Unicode literals. 29 | import json 30 | 31 | # --------- 32 | # Specifics 33 | # --------- 34 | 35 | if is_py2: 36 | from urllib import quote, unquote, quote_plus, unquote_plus, urlencode, getproxies, proxy_bypass 37 | from urlparse import urlparse, urlunparse, urljoin, urlsplit, urldefrag 38 | from urllib2 import parse_http_list 39 | import cookielib 40 | from Cookie import Morsel 41 | from StringIO import StringIO 42 | from .packages.urllib3.packages.ordered_dict import OrderedDict 43 | 44 | builtin_str = str 45 | bytes = str 46 | str = unicode 47 | basestring = basestring 48 | numeric_types = (int, long, float) 49 | 50 | elif is_py3: 51 | from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, quote_plus, unquote_plus, urldefrag 52 | from urllib.request import parse_http_list, getproxies, proxy_bypass 53 | from http import cookiejar as cookielib 54 | from http.cookies import Morsel 55 | from io import StringIO 56 | from collections import OrderedDict 57 | 58 | builtin_str = str 59 | str = str 60 | bytes = bytes 61 | basestring = (str, bytes) 62 | numeric_types = (int, float) 63 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/treeadapters/sax.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from xml.sax.xmlreader import AttributesNSImpl 4 | 5 | from ..constants import adjustForeignAttributes, unadjustForeignAttributes 6 | 7 | prefix_mapping = {} 8 | for prefix, localName, namespace in adjustForeignAttributes.values(): 9 | if prefix is not None: 10 | prefix_mapping[prefix] = namespace 11 | 12 | 13 | def to_sax(walker, handler): 14 | """Call SAX-like content handler based on treewalker walker""" 15 | handler.startDocument() 16 | for prefix, namespace in prefix_mapping.items(): 17 | handler.startPrefixMapping(prefix, namespace) 18 | 19 | for token in walker: 20 | type = token["type"] 21 | if type == "Doctype": 22 | continue 23 | elif type in ("StartTag", "EmptyTag"): 24 | attrs = AttributesNSImpl(token["data"], 25 | unadjustForeignAttributes) 26 | handler.startElementNS((token["namespace"], token["name"]), 27 | token["name"], 28 | attrs) 29 | if type == "EmptyTag": 30 | handler.endElementNS((token["namespace"], token["name"]), 31 | token["name"]) 32 | elif type == "EndTag": 33 | handler.endElementNS((token["namespace"], token["name"]), 34 | token["name"]) 35 | elif type in ("Characters", "SpaceCharacters"): 36 | handler.characters(token["data"]) 37 | elif type == "Comment": 38 | pass 39 | else: 40 | assert False, "Unknown token type" 41 | 42 | for prefix, namespace in prefix_mapping.items(): 43 | handler.endPrefixMapping(prefix) 44 | handler.endDocument() 45 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/euckrprober.py: -------------------------------------------------------------------------------- 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 EUCKRDistributionAnalysis 31 | from .mbcssm import EUCKRSMModel 32 | 33 | 34 | class EUCKRProber(MultiByteCharSetProber): 35 | def __init__(self): 36 | MultiByteCharSetProber.__init__(self) 37 | self._mCodingSM = CodingStateMachine(EUCKRSMModel) 38 | self._mDistributionAnalyzer = EUCKRDistributionAnalysis() 39 | self.reset() 40 | 41 | def get_charset_name(self): 42 | return "EUC-KR" 43 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/euctwprober.py: -------------------------------------------------------------------------------- 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 EUCTWDistributionAnalysis 31 | from .mbcssm import EUCTWSMModel 32 | 33 | class EUCTWProber(MultiByteCharSetProber): 34 | def __init__(self): 35 | MultiByteCharSetProber.__init__(self) 36 | self._mCodingSM = CodingStateMachine(EUCTWSMModel) 37 | self._mDistributionAnalyzer = EUCTWDistributionAnalysis() 38 | self.reset() 39 | 40 | def get_charset_name(self): 41 | return "EUC-TW" 42 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/gb2312prober.py: -------------------------------------------------------------------------------- 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 GB2312DistributionAnalysis 31 | from .mbcssm import GB2312SMModel 32 | 33 | class GB2312Prober(MultiByteCharSetProber): 34 | def __init__(self): 35 | MultiByteCharSetProber.__init__(self) 36 | self._mCodingSM = CodingStateMachine(GB2312SMModel) 37 | self._mDistributionAnalyzer = GB2312DistributionAnalysis() 38 | self.reset() 39 | 40 | def get_charset_name(self): 41 | return "GB2312" 42 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/big5prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Communicator client 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 Big5DistributionAnalysis 31 | from .mbcssm import Big5SMModel 32 | 33 | 34 | class Big5Prober(MultiByteCharSetProber): 35 | def __init__(self): 36 | MultiByteCharSetProber.__init__(self) 37 | self._mCodingSM = CodingStateMachine(Big5SMModel) 38 | self._mDistributionAnalyzer = Big5DistributionAnalysis() 39 | self.reset() 40 | 41 | def get_charset_name(self): 42 | return "Big5" 43 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/colorama/initialise.py: -------------------------------------------------------------------------------- 1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. 2 | import atexit 3 | import sys 4 | 5 | from .ansitowin32 import AnsiToWin32 6 | 7 | 8 | orig_stdout = sys.stdout 9 | orig_stderr = sys.stderr 10 | 11 | wrapped_stdout = sys.stdout 12 | wrapped_stderr = sys.stderr 13 | 14 | atexit_done = False 15 | 16 | 17 | def reset_all(): 18 | AnsiToWin32(orig_stdout).reset_all() 19 | 20 | 21 | def init(autoreset=False, convert=None, strip=None, wrap=True): 22 | 23 | if not wrap and any([autoreset, convert, strip]): 24 | raise ValueError('wrap=False conflicts with any other arg=True') 25 | 26 | global wrapped_stdout, wrapped_stderr 27 | if sys.stdout is None: 28 | wrapped_stdout = None 29 | else: 30 | sys.stdout = wrapped_stdout = \ 31 | wrap_stream(orig_stdout, convert, strip, autoreset, wrap) 32 | if sys.stderr is None: 33 | wrapped_stderr = None 34 | else: 35 | sys.stderr = wrapped_stderr = \ 36 | wrap_stream(orig_stderr, convert, strip, autoreset, wrap) 37 | 38 | global atexit_done 39 | if not atexit_done: 40 | atexit.register(reset_all) 41 | atexit_done = True 42 | 43 | 44 | def deinit(): 45 | if orig_stdout is not None: 46 | sys.stdout = orig_stdout 47 | if orig_stderr is not None: 48 | sys.stderr = orig_stderr 49 | 50 | 51 | def reinit(): 52 | if wrapped_stdout is not None: 53 | sys.stdout = wrapped_stdout 54 | if wrapped_stderr is not None: 55 | sys.stderr = wrapped_stderr 56 | 57 | 58 | def wrap_stream(stream, convert, strip, autoreset, wrap): 59 | if wrap: 60 | wrapper = AnsiToWin32(stream, 61 | convert=convert, strip=strip, autoreset=autoreset) 62 | if wrapper.should_wrap(): 63 | stream = wrapper.stream 64 | return stream 65 | 66 | 67 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/cp949prober.py: -------------------------------------------------------------------------------- 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 EUCKRDistributionAnalysis 31 | from .mbcssm import CP949SMModel 32 | 33 | 34 | class CP949Prober(MultiByteCharSetProber): 35 | def __init__(self): 36 | MultiByteCharSetProber.__init__(self) 37 | self._mCodingSM = CodingStateMachine(CP949SMModel) 38 | # NOTE: CP949 is a superset of EUC-KR, so the distribution should be 39 | # not different. 40 | self._mDistributionAnalyzer = EUCKRDistributionAnalysis() 41 | self.reset() 42 | 43 | def get_charset_name(self): 44 | return "CP949" 45 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/trie/py.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | from pip._vendor.six import text_type 3 | 4 | from bisect import bisect_left 5 | 6 | from ._base import Trie as ABCTrie 7 | 8 | 9 | class Trie(ABCTrie): 10 | def __init__(self, data): 11 | if not all(isinstance(x, text_type) for x in data.keys()): 12 | raise TypeError("All keys must be strings") 13 | 14 | self._data = data 15 | self._keys = sorted(data.keys()) 16 | self._cachestr = "" 17 | self._cachepoints = (0, len(data)) 18 | 19 | def __contains__(self, key): 20 | return key in self._data 21 | 22 | def __len__(self): 23 | return len(self._data) 24 | 25 | def __iter__(self): 26 | return iter(self._data) 27 | 28 | def __getitem__(self, key): 29 | return self._data[key] 30 | 31 | def keys(self, prefix=None): 32 | if prefix is None or prefix == "" or not self._keys: 33 | return set(self._keys) 34 | 35 | if prefix.startswith(self._cachestr): 36 | lo, hi = self._cachepoints 37 | start = i = bisect_left(self._keys, prefix, lo, hi) 38 | else: 39 | start = i = bisect_left(self._keys, prefix) 40 | 41 | keys = set() 42 | if start == len(self._keys): 43 | return keys 44 | 45 | while self._keys[i].startswith(prefix): 46 | keys.add(self._keys[i]) 47 | i += 1 48 | 49 | self._cachestr = prefix 50 | self._cachepoints = (start, i) 51 | 52 | return keys 53 | 54 | def has_keys_with_prefix(self, prefix): 55 | if prefix in self._data: 56 | return True 57 | 58 | if prefix.startswith(self._cachestr): 59 | lo, hi = self._cachepoints 60 | i = bisect_left(self._keys, prefix, lo, hi) 61 | else: 62 | i = bisect_left(self._keys, prefix) 63 | 64 | if i == len(self._keys): 65 | return False 66 | 67 | return self._keys[i].startswith(prefix) 68 | -------------------------------------------------------------------------------- /bin/warnings: -------------------------------------------------------------------------------- 1 | shopt -s extglob 2 | 3 | old-platform() { 4 | if grep -qi 'InsecurePlatformWarning' "$WARNINGS_LOG"; then 5 | echo 6 | puts-warn "Hello! It looks like your application is using an outdated version of Python." 7 | puts-warn "This caused the security warning you saw above during the 'pip install' step." 8 | puts-warn "We recommend '$RECOMMENDED_PYTHON_VERSION', which you can specify in a 'runtime.txt' file." 9 | puts-warn " -- Much Love, Heroku." 10 | fi 11 | } 12 | 13 | pylibmc-missing() { 14 | if grep -qi 'fatal error: libmemcached/memcached.h: No such file or directory' "$WARNINGS_LOG"; then 15 | echo 16 | puts-warn "Hello! There was a problem with your build related to libmemcache." 17 | puts-warn "The Python library 'pylibmc' must be explicitly specified in 'requirements.txt' in order to build correctly." 18 | puts-warn "Once you do that, everything should work as expected. -- Much Love, Heroku." 19 | fi 20 | } 21 | 22 | scipy-included() { 23 | if grep -qi 'running setup.py install for scipy' "$WARNINGS_LOG"; then 24 | echo 25 | puts-warn "Hello! It looks like you're trying to use scipy on Heroku." 26 | puts-warn "Unfortunately, at this time, we do not directly support this library." 27 | puts-warn "There is, however, a buildpack available that makes it possible to use it on Heroku." 28 | puts-warn "You can learn more here: https://devcenter.heroku.com/articles/python-c-deps" 29 | puts-warn "Sorry for the inconvenience. -- Much Love, Heroku." 30 | fi 31 | } 32 | 33 | distribute-included() { 34 | if grep -qi 'Running setup.py install for distribute' "$WARNINGS_LOG"; then 35 | echo 36 | puts-warn "Hello! Your requirements.txt file contains the distribute package." 37 | puts-warn "This library is automatically installed by Heroku and shouldn't be in" 38 | puts-warn "Your requirements.txt file. This can cause unexpected behavior." 39 | puts-warn " -- Much Love, Heroku." 40 | fi 41 | } 42 | 43 | show-warnings() { 44 | old-platform 45 | pylibmc-missing 46 | scipy-included 47 | distribute-included 48 | } 49 | 50 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip-grep: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | """Usage: 5 | pip-grep [-s] ... 6 | 7 | Options: 8 | -h --help Show this screen. 9 | """ 10 | import os 11 | from docopt import docopt 12 | from pip.req import parse_requirements 13 | from pip.index import PackageFinder 14 | from pip._vendor.requests import session 15 | 16 | requests = session() 17 | 18 | class Requirements(object): 19 | def __init__(self, reqfile=None): 20 | super(Requirements, self).__init__() 21 | self.path = reqfile 22 | self.requirements = [] 23 | 24 | if reqfile: 25 | self.load(reqfile) 26 | 27 | def __repr__(self): 28 | return ''.format(self.path) 29 | 30 | def load(self, reqfile): 31 | 32 | if not os.path.exists(reqfile): 33 | raise ValueError('The given requirements file does not exist.') 34 | 35 | finder = PackageFinder([], [], session=requests) 36 | for requirement in parse_requirements(reqfile, finder=finder, session=requests): 37 | self.requirements.append(requirement) 38 | 39 | 40 | 41 | 42 | def grep(reqfile, packages, silent=False): 43 | 44 | try: 45 | r = Requirements(reqfile) 46 | except ValueError: 47 | 48 | if not silent: 49 | print('There was a problem loading the given requirement file.') 50 | 51 | exit(os.EX_NOINPUT) 52 | 53 | for requirement in r.requirements: 54 | 55 | if requirement.req: 56 | 57 | if requirement.req.project_name in packages: 58 | 59 | if not silent: 60 | print('Package {} found!'.format(requirement.req.project_name)) 61 | 62 | exit(0) 63 | 64 | if not silent: 65 | print('Not found.'.format(requirement.req.project_name)) 66 | 67 | exit(1) 68 | 69 | 70 | def main(): 71 | args = docopt(__doc__, version='pip-grep') 72 | 73 | kwargs = {'reqfile': args[''], 'packages': args[''], 'silent': args['-s']} 74 | 75 | 76 | grep(**kwargs) 77 | 78 | 79 | 80 | if __name__ == '__main__': 81 | main() 82 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/packaging/_structures.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014 Donald Stufft 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import absolute_import, division, print_function 15 | 16 | 17 | class Infinity(object): 18 | 19 | def __repr__(self): 20 | return "Infinity" 21 | 22 | def __hash__(self): 23 | return hash(repr(self)) 24 | 25 | def __lt__(self, other): 26 | return False 27 | 28 | def __le__(self, other): 29 | return False 30 | 31 | def __eq__(self, other): 32 | return isinstance(other, self.__class__) 33 | 34 | def __ne__(self, other): 35 | return not isinstance(other, self.__class__) 36 | 37 | def __gt__(self, other): 38 | return True 39 | 40 | def __ge__(self, other): 41 | return True 42 | 43 | def __neg__(self): 44 | return NegativeInfinity 45 | 46 | Infinity = Infinity() 47 | 48 | 49 | class NegativeInfinity(object): 50 | 51 | def __repr__(self): 52 | return "-Infinity" 53 | 54 | def __hash__(self): 55 | return hash(repr(self)) 56 | 57 | def __lt__(self, other): 58 | return True 59 | 60 | def __le__(self, other): 61 | return True 62 | 63 | def __eq__(self, other): 64 | return isinstance(other, self.__class__) 65 | 66 | def __ne__(self, other): 67 | return not isinstance(other, self.__class__) 68 | 69 | def __gt__(self, other): 70 | return False 71 | 72 | def __ge__(self, other): 73 | return False 74 | 75 | def __neg__(self): 76 | return Infinity 77 | 78 | NegativeInfinity = NegativeInfinity() 79 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/charsetprober.py: -------------------------------------------------------------------------------- 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 . import constants 30 | import re 31 | 32 | 33 | class CharSetProber: 34 | def __init__(self): 35 | pass 36 | 37 | def reset(self): 38 | self._mState = constants.eDetecting 39 | 40 | def get_charset_name(self): 41 | return None 42 | 43 | def feed(self, aBuf): 44 | pass 45 | 46 | def get_state(self): 47 | return self._mState 48 | 49 | def get_confidence(self): 50 | return 0.0 51 | 52 | def filter_high_bit_only(self, aBuf): 53 | aBuf = re.sub(b'([\x00-\x7F])+', b' ', aBuf) 54 | return aBuf 55 | 56 | def filter_without_english_letters(self, aBuf): 57 | aBuf = re.sub(b'([A-Za-z])+', b' ', aBuf) 58 | return aBuf 59 | 60 | def filter_with_english_letters(self, aBuf): 61 | # TODO 62 | return aBuf 63 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # __ 4 | # /__) _ _ _ _ _/ _ 5 | # / ( (- (/ (/ (- _) / _) 6 | # / 7 | 8 | """ 9 | requests HTTP library 10 | ~~~~~~~~~~~~~~~~~~~~~ 11 | 12 | Requests is an HTTP library, written in Python, for human beings. Basic GET 13 | usage: 14 | 15 | >>> import requests 16 | >>> r = requests.get('https://www.python.org') 17 | >>> r.status_code 18 | 200 19 | >>> 'Python is a programming language' in r.content 20 | True 21 | 22 | ... or POST: 23 | 24 | >>> payload = dict(key1='value1', key2='value2') 25 | >>> r = requests.post('http://httpbin.org/post', data=payload) 26 | >>> print(r.text) 27 | { 28 | ... 29 | "form": { 30 | "key2": "value2", 31 | "key1": "value1" 32 | }, 33 | ... 34 | } 35 | 36 | The other HTTP methods are supported - see `requests.api`. Full documentation 37 | is at . 38 | 39 | :copyright: (c) 2015 by Kenneth Reitz. 40 | :license: Apache 2.0, see LICENSE for more details. 41 | 42 | """ 43 | 44 | __title__ = 'requests' 45 | __version__ = '2.7.0' 46 | __build__ = 0x020700 47 | __author__ = 'Kenneth Reitz' 48 | __license__ = 'Apache 2.0' 49 | __copyright__ = 'Copyright 2015 Kenneth Reitz' 50 | 51 | # Attempt to enable urllib3's SNI support, if possible 52 | try: 53 | from .packages.urllib3.contrib import pyopenssl 54 | pyopenssl.inject_into_urllib3() 55 | except ImportError: 56 | pass 57 | 58 | from . import utils 59 | from .models import Request, Response, PreparedRequest 60 | from .api import request, get, head, post, patch, put, delete, options 61 | from .sessions import session, Session 62 | from .status_codes import codes 63 | from .exceptions import ( 64 | RequestException, Timeout, URLRequired, 65 | TooManyRedirects, HTTPError, ConnectionError 66 | ) 67 | 68 | # Set default logging handler to avoid "No handler found" warnings. 69 | import logging 70 | try: # Python 2.7+ 71 | from logging import NullHandler 72 | except ImportError: 73 | class NullHandler(logging.Handler): 74 | def emit(self, record): 75 | pass 76 | 77 | logging.getLogger(__name__).addHandler(NullHandler()) 78 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/mbcsgroupprober.py: -------------------------------------------------------------------------------- 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 | # Proofpoint, Inc. 13 | # 14 | # This library is free software; you can redistribute it and/or 15 | # modify it under the terms of the GNU Lesser General Public 16 | # License as published by the Free Software Foundation; either 17 | # version 2.1 of the License, or (at your option) any later version. 18 | # 19 | # This library is distributed in the hope that it will be useful, 20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | # Lesser General Public License for more details. 23 | # 24 | # You should have received a copy of the GNU Lesser General Public 25 | # License along with this library; if not, write to the Free Software 26 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 27 | # 02110-1301 USA 28 | ######################### END LICENSE BLOCK ######################### 29 | 30 | from .charsetgroupprober import CharSetGroupProber 31 | from .utf8prober import UTF8Prober 32 | from .sjisprober import SJISProber 33 | from .eucjpprober import EUCJPProber 34 | from .gb2312prober import GB2312Prober 35 | from .euckrprober import EUCKRProber 36 | from .cp949prober import CP949Prober 37 | from .big5prober import Big5Prober 38 | from .euctwprober import EUCTWProber 39 | 40 | 41 | class MBCSGroupProber(CharSetGroupProber): 42 | def __init__(self): 43 | CharSetGroupProber.__init__(self) 44 | self._mProbers = [ 45 | UTF8Prober(), 46 | SJISProber(), 47 | EUCJPProber(), 48 | GB2312Prober(), 49 | EUCKRProber(), 50 | CP949Prober(), 51 | Big5Prober(), 52 | EUCTWProber() 53 | ] 54 | self.reset() 55 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Heroku Buildpack: Python + NLTK 2 | ![python](https://cloud.githubusercontent.com/assets/51578/13712821/b68a42ce-e793-11e5-96b0-d8eb978137ba.png) 3 | 4 | This buildpack is identical to the official [python](https://github.com/heroku/heroku-buildpack-python), but also installs any NLTK corpora/packages desired. Desired packages should be defined in `.nltk_packages` in the root of the repo. Packages will only be downloaded if both this file exists and `nltk` is installed among your dependencies. 5 | 6 | The `.nltk_packages` file can contain either space-separated packages, or one package on each line. 7 | 8 | See it in Action 9 | ---------------- 10 | 11 | Deploying a Python application couldn't be easier: 12 | 13 | $ echo "punkt brown" > .nltk_packages 14 | $ ls -a 15 | .nltk_packages Procfile requirements.txt web.py 16 | 17 | $ heroku create --buildpack https://github.com/megacool/heroku-buildpack-python-nltk 18 | 19 | $ git push heroku master 20 | ... 21 | -----> Python app detected 22 | $ pip install -r requirements.txt 23 | -----> Downloading NLTK packages punkt brown 24 | [nltk_data] Downloading package punkt to /app/nltk_data... 25 | [nltk_data] Unzipping tokenizers/punkt.zip. 26 | [nltk_data] Downloading package brown to 27 | [nltk_data] /app/nltk_data... 28 | [nltk_data] Unzipping taggers/brown.zip. 29 | -----> Discovering process types 30 | Procfile declares types -> (none) 31 | 32 | A `requirements.txt` file must be present at the root of your application's repository. 33 | 34 | You can also specify the latest production release of this buildpack for upcoming builds of an existing application: 35 | 36 | $ heroku buildpacks:set https://github.com/megacool/heroku-buildpack-python-nltk 37 | 38 | 39 | Specify a Python Runtime 40 | ------------------------ 41 | 42 | Specific versions of the Python runtime can be specified with a `runtime.txt` file: 43 | 44 | $ cat runtime.txt 45 | python-3.5.1 46 | 47 | Runtime options include: 48 | 49 | - `python-2.7.11` 50 | - `python-3.5.1` 51 | - `pypy-5.0.1` (unsupported, experimental) 52 | 53 | Other [unsupported runtimes](https://github.com/heroku/heroku-buildpack-python/tree/master/builds/runtimes) are available as well. Use at your own risk. 54 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/commands/completion.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | import sys 4 | from pip.basecommand import Command 5 | 6 | BASE_COMPLETION = """ 7 | # pip %(shell)s completion start%(script)s# pip %(shell)s completion end 8 | """ 9 | 10 | COMPLETION_SCRIPTS = { 11 | 'bash': """ 12 | _pip_completion() 13 | { 14 | COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \\ 15 | COMP_CWORD=$COMP_CWORD \\ 16 | PIP_AUTO_COMPLETE=1 $1 ) ) 17 | } 18 | complete -o default -F _pip_completion pip 19 | """, 'zsh': """ 20 | function _pip_completion { 21 | local words cword 22 | read -Ac words 23 | read -cn cword 24 | reply=( $( COMP_WORDS="$words[*]" \\ 25 | COMP_CWORD=$(( cword-1 )) \\ 26 | PIP_AUTO_COMPLETE=1 $words[1] ) ) 27 | } 28 | compctl -K _pip_completion pip 29 | """} 30 | 31 | 32 | class CompletionCommand(Command): 33 | """A helper command to be used for command completion.""" 34 | name = 'completion' 35 | summary = 'A helper command to be used for command completion' 36 | hidden = True 37 | 38 | def __init__(self, *args, **kw): 39 | super(CompletionCommand, self).__init__(*args, **kw) 40 | 41 | cmd_opts = self.cmd_opts 42 | 43 | cmd_opts.add_option( 44 | '--bash', '-b', 45 | action='store_const', 46 | const='bash', 47 | dest='shell', 48 | help='Emit completion code for bash') 49 | cmd_opts.add_option( 50 | '--zsh', '-z', 51 | action='store_const', 52 | const='zsh', 53 | dest='shell', 54 | help='Emit completion code for zsh') 55 | 56 | self.parser.insert_option_group(0, cmd_opts) 57 | 58 | def run(self, options, args): 59 | """Prints the completion code of the given shell""" 60 | shells = COMPLETION_SCRIPTS.keys() 61 | shell_options = ['--' + shell for shell in sorted(shells)] 62 | if options.shell in shells: 63 | script = COMPLETION_SCRIPTS.get(options.shell, '') 64 | print(BASE_COMPLETION % {'script': script, 'shell': options.shell}) 65 | else: 66 | sys.stderr.write( 67 | 'ERROR: You must pass %s\n' % ' or '.join(shell_options) 68 | ) 69 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/commands/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Package containing all pip commands 3 | """ 4 | from __future__ import absolute_import 5 | 6 | from pip.commands.completion import CompletionCommand 7 | from pip.commands.freeze import FreezeCommand 8 | from pip.commands.help import HelpCommand 9 | from pip.commands.list import ListCommand 10 | from pip.commands.search import SearchCommand 11 | from pip.commands.show import ShowCommand 12 | from pip.commands.install import InstallCommand 13 | from pip.commands.uninstall import UninstallCommand 14 | from pip.commands.wheel import WheelCommand 15 | 16 | 17 | commands_dict = { 18 | CompletionCommand.name: CompletionCommand, 19 | FreezeCommand.name: FreezeCommand, 20 | HelpCommand.name: HelpCommand, 21 | SearchCommand.name: SearchCommand, 22 | ShowCommand.name: ShowCommand, 23 | InstallCommand.name: InstallCommand, 24 | UninstallCommand.name: UninstallCommand, 25 | ListCommand.name: ListCommand, 26 | WheelCommand.name: WheelCommand, 27 | } 28 | 29 | 30 | commands_order = [ 31 | InstallCommand, 32 | UninstallCommand, 33 | FreezeCommand, 34 | ListCommand, 35 | ShowCommand, 36 | SearchCommand, 37 | WheelCommand, 38 | HelpCommand, 39 | ] 40 | 41 | 42 | def get_summaries(ignore_hidden=True, ordered=True): 43 | """Yields sorted (command name, command summary) tuples.""" 44 | 45 | if ordered: 46 | cmditems = _sort_commands(commands_dict, commands_order) 47 | else: 48 | cmditems = commands_dict.items() 49 | 50 | for name, command_class in cmditems: 51 | if ignore_hidden and command_class.hidden: 52 | continue 53 | 54 | yield (name, command_class.summary) 55 | 56 | 57 | def get_similar_commands(name): 58 | """Command name auto-correct.""" 59 | from difflib import get_close_matches 60 | 61 | name = name.lower() 62 | 63 | close_commands = get_close_matches(name, commands_dict.keys()) 64 | 65 | if close_commands: 66 | return close_commands[0] 67 | else: 68 | return False 69 | 70 | 71 | def _sort_commands(cmddict, order): 72 | def keyfn(key): 73 | try: 74 | return order.index(key[1]) 75 | except ValueError: 76 | # unordered items should come last 77 | return 0xff 78 | 79 | return sorted(cmddict.items(), key=keyfn) 80 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/urllib3/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | urllib3 - Thread-safe connection pooling and re-using. 3 | """ 4 | 5 | __author__ = 'Andrey Petrov (andrey.petrov@shazow.net)' 6 | __license__ = 'MIT' 7 | __version__ = '1.10.4' 8 | 9 | 10 | from .connectionpool import ( 11 | HTTPConnectionPool, 12 | HTTPSConnectionPool, 13 | connection_from_url 14 | ) 15 | 16 | from . import exceptions 17 | from .filepost import encode_multipart_formdata 18 | from .poolmanager import PoolManager, ProxyManager, proxy_from_url 19 | from .response import HTTPResponse 20 | from .util.request import make_headers 21 | from .util.url import get_host 22 | from .util.timeout import Timeout 23 | from .util.retry import Retry 24 | 25 | 26 | # Set default logging handler to avoid "No handler found" warnings. 27 | import logging 28 | try: # Python 2.7+ 29 | from logging import NullHandler 30 | except ImportError: 31 | class NullHandler(logging.Handler): 32 | def emit(self, record): 33 | pass 34 | 35 | logging.getLogger(__name__).addHandler(NullHandler()) 36 | 37 | def add_stderr_logger(level=logging.DEBUG): 38 | """ 39 | Helper for quickly adding a StreamHandler to the logger. Useful for 40 | debugging. 41 | 42 | Returns the handler after adding it. 43 | """ 44 | # This method needs to be in this __init__.py to get the __name__ correct 45 | # even if urllib3 is vendored within another package. 46 | logger = logging.getLogger(__name__) 47 | handler = logging.StreamHandler() 48 | handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s')) 49 | logger.addHandler(handler) 50 | logger.setLevel(level) 51 | logger.debug('Added a stderr logging handler to logger: %s' % __name__) 52 | return handler 53 | 54 | # ... Clean up. 55 | del NullHandler 56 | 57 | 58 | import warnings 59 | # SecurityWarning's always go off by default. 60 | warnings.simplefilter('always', exceptions.SecurityWarning, append=True) 61 | # InsecurePlatformWarning's don't vary between requests, so we keep it default. 62 | warnings.simplefilter('default', exceptions.InsecurePlatformWarning, 63 | append=True) 64 | 65 | def disable_warnings(category=exceptions.HTTPWarning): 66 | """ 67 | Helper for quickly disabling all urllib3 warnings. 68 | """ 69 | warnings.simplefilter('ignore', category) 70 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/urllib3/util/request.py: -------------------------------------------------------------------------------- 1 | from base64 import b64encode 2 | 3 | from ..packages.six import b 4 | 5 | ACCEPT_ENCODING = 'gzip,deflate' 6 | 7 | 8 | def make_headers(keep_alive=None, accept_encoding=None, user_agent=None, 9 | basic_auth=None, proxy_basic_auth=None, disable_cache=None): 10 | """ 11 | Shortcuts for generating request headers. 12 | 13 | :param keep_alive: 14 | If ``True``, adds 'connection: keep-alive' header. 15 | 16 | :param accept_encoding: 17 | Can be a boolean, list, or string. 18 | ``True`` translates to 'gzip,deflate'. 19 | List will get joined by comma. 20 | String will be used as provided. 21 | 22 | :param user_agent: 23 | String representing the user-agent you want, such as 24 | "python-urllib3/0.6" 25 | 26 | :param basic_auth: 27 | Colon-separated username:password string for 'authorization: basic ...' 28 | auth header. 29 | 30 | :param proxy_basic_auth: 31 | Colon-separated username:password string for 'proxy-authorization: basic ...' 32 | auth header. 33 | 34 | :param disable_cache: 35 | If ``True``, adds 'cache-control: no-cache' header. 36 | 37 | Example:: 38 | 39 | >>> make_headers(keep_alive=True, user_agent="Batman/1.0") 40 | {'connection': 'keep-alive', 'user-agent': 'Batman/1.0'} 41 | >>> make_headers(accept_encoding=True) 42 | {'accept-encoding': 'gzip,deflate'} 43 | """ 44 | headers = {} 45 | if accept_encoding: 46 | if isinstance(accept_encoding, str): 47 | pass 48 | elif isinstance(accept_encoding, list): 49 | accept_encoding = ','.join(accept_encoding) 50 | else: 51 | accept_encoding = ACCEPT_ENCODING 52 | headers['accept-encoding'] = accept_encoding 53 | 54 | if user_agent: 55 | headers['user-agent'] = user_agent 56 | 57 | if keep_alive: 58 | headers['connection'] = 'keep-alive' 59 | 60 | if basic_auth: 61 | headers['authorization'] = 'Basic ' + \ 62 | b64encode(b(basic_auth)).decode('utf-8') 63 | 64 | if proxy_basic_auth: 65 | headers['proxy-authorization'] = 'Basic ' + \ 66 | b64encode(b(proxy_basic_auth)).decode('utf-8') 67 | 68 | if disable_cache: 69 | headers['cache-control'] = 'no-cache' 70 | 71 | return headers 72 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/utils/deprecation.py: -------------------------------------------------------------------------------- 1 | """ 2 | A module that implments tooling to enable easy warnings about deprecations. 3 | """ 4 | from __future__ import absolute_import 5 | 6 | import logging 7 | import warnings 8 | 9 | 10 | class PipDeprecationWarning(Warning): 11 | pass 12 | 13 | 14 | class RemovedInPip8Warning(PipDeprecationWarning, PendingDeprecationWarning): 15 | pass 16 | 17 | 18 | class RemovedInPip9Warning(PipDeprecationWarning, PendingDeprecationWarning): 19 | pass 20 | 21 | 22 | DEPRECATIONS = [RemovedInPip8Warning, RemovedInPip9Warning] 23 | 24 | 25 | # Warnings <-> Logging Integration 26 | 27 | 28 | _warnings_showwarning = None 29 | 30 | 31 | def _showwarning(message, category, filename, lineno, file=None, line=None): 32 | if file is not None: 33 | if _warnings_showwarning is not None: 34 | _warnings_showwarning( 35 | message, category, filename, lineno, file, line, 36 | ) 37 | else: 38 | if issubclass(category, PipDeprecationWarning): 39 | # We use a specially named logger which will handle all of the 40 | # deprecation messages for pip. 41 | logger = logging.getLogger("pip.deprecations") 42 | 43 | # This is purposely using the % formatter here instead of letting 44 | # the logging module handle the interpolation. This is because we 45 | # want it to appear as if someone typed this entire message out. 46 | log_message = "DEPRECATION: %s" % message 47 | 48 | # Things that are DeprecationWarnings will be removed in the very 49 | # next version of pip. We want these to be more obvious so we 50 | # use the ERROR logging level while the PendingDeprecationWarnings 51 | # are still have at least 2 versions to go until they are removed 52 | # so they can just be warnings. 53 | if issubclass(category, DeprecationWarning): 54 | logger.error(log_message) 55 | else: 56 | logger.warning(log_message) 57 | else: 58 | _warnings_showwarning( 59 | message, category, filename, lineno, file, line, 60 | ) 61 | 62 | 63 | def install_warning_logger(): 64 | global _warnings_showwarning 65 | 66 | if _warnings_showwarning is None: 67 | _warnings_showwarning = warnings.showwarning 68 | warnings.showwarning = _showwarning 69 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/cachecontrol/filewrapper.py: -------------------------------------------------------------------------------- 1 | from io import BytesIO 2 | 3 | 4 | class CallbackFileWrapper(object): 5 | """ 6 | Small wrapper around a fp object which will tee everything read into a 7 | buffer, and when that file is closed it will execute a callback with the 8 | contents of that buffer. 9 | 10 | All attributes are proxied to the underlying file object. 11 | 12 | This class uses members with a double underscore (__) leading prefix so as 13 | not to accidentally shadow an attribute. 14 | """ 15 | 16 | def __init__(self, fp, callback): 17 | self.__buf = BytesIO() 18 | self.__fp = fp 19 | self.__callback = callback 20 | 21 | def __getattr__(self, name): 22 | # The vaguaries of garbage collection means that self.__fp is 23 | # not always set. By using __getattribute__ and the private 24 | # name[0] allows looking up the attribute value and raising an 25 | # AttributeError when it doesn't exist. This stop thigns from 26 | # infinitely recursing calls to getattr in the case where 27 | # self.__fp hasn't been set. 28 | # 29 | # [0] https://docs.python.org/2/reference/expressions.html#atom-identifiers 30 | fp = self.__getattribute__('_CallbackFileWrapper__fp') 31 | return getattr(fp, name) 32 | 33 | def __is_fp_closed(self): 34 | try: 35 | return self.__fp.fp is None 36 | except AttributeError: 37 | pass 38 | 39 | try: 40 | return self.__fp.closed 41 | except AttributeError: 42 | pass 43 | 44 | # We just don't cache it then. 45 | # TODO: Add some logging here... 46 | return False 47 | 48 | def read(self, amt=None): 49 | data = self.__fp.read(amt) 50 | self.__buf.write(data) 51 | 52 | if self.__is_fp_closed(): 53 | if self.__callback: 54 | self.__callback(self.__buf.getvalue()) 55 | 56 | # We assign this to None here, because otherwise we can get into 57 | # really tricky problems where the CPython interpreter dead locks 58 | # because the callback is holding a reference to something which 59 | # has a __del__ method. Setting this to None breaks the cycle 60 | # and allows the garbage collector to do it's thing normally. 61 | self.__callback = None 62 | 63 | return data 64 | -------------------------------------------------------------------------------- /bin/steps/python: -------------------------------------------------------------------------------- 1 | set +e 2 | PYTHON_VERSION=$(cat runtime.txt) 3 | 4 | # Install Python. 5 | if [ -f .heroku/python-version ]; then 6 | if [ ! $(cat .heroku/python-version) = $PYTHON_VERSION ]; then 7 | bpwatch start uninstall_python 8 | puts-step "Found $(cat .heroku/python-version), removing" 9 | rm -fr .heroku/python 10 | bpwatch stop uninstall_python 11 | else 12 | SKIP_INSTALL=1 13 | fi 14 | fi 15 | 16 | if [ ! $STACK = $CACHED_PYTHON_STACK ]; then 17 | bpwatch start uninstall_python 18 | rm -fr .heroku/python .heroku/python-stack .heroku/vendor 19 | unset SKIP_INSTALL 20 | bpwatch stop uninstall_python 21 | fi 22 | 23 | 24 | if [ ! "$SKIP_INSTALL" ]; then 25 | bpwatch start install_python 26 | puts-step "Installing $PYTHON_VERSION" 27 | 28 | # Prepare destination directory. 29 | mkdir -p .heroku/python 30 | 31 | curl https://lang-python.s3.amazonaws.com/$STACK/runtimes/$PYTHON_VERSION.tar.gz -s | tar zxv -C .heroku/python &> /dev/null 32 | if [[ $? != 0 ]] ; then 33 | puts-warn "Requested runtime ($PYTHON_VERSION) is not available for this stack ($STACK)." 34 | puts-warn "Aborting. More info: https://devcenter.heroku.com/articles/python-support" 35 | exit 1 36 | fi 37 | 38 | bpwatch stop install_python 39 | 40 | # Record for future reference. 41 | echo $PYTHON_VERSION > .heroku/python-version 42 | echo $STACK > .heroku/python-stack 43 | FRESH_PYTHON=true 44 | 45 | hash -r 46 | fi 47 | 48 | # If Pip isn't up to date: 49 | if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *$PIP_VERSION* ]]; then 50 | WORKING_DIR=$(pwd) 51 | 52 | bpwatch start prepare_environment 53 | 54 | TMPTARDIR=$(mktemp -d) 55 | trap "rm -rf $TMPTARDIR" RETURN 56 | 57 | bpwatch start install_setuptools 58 | # Prepare it for the real world 59 | # puts-step "Installing Setuptools ($SETUPTOOLS_VERSION)" 60 | tar zxf $ROOT_DIR/vendor/setuptools-$SETUPTOOLS_VERSION.tar.gz -C $TMPTARDIR 61 | cd $TMPTARDIR/setuptools-$SETUPTOOLS_VERSION/ 62 | python setup.py install &> /dev/null 63 | cd $WORKING_DIR 64 | bpwatch stop install_setuptoools 65 | 66 | bpwatch start install_pip 67 | # puts-step "Installing Pip ($PIP_VERSION)" 68 | tar zxf $ROOT_DIR/vendor/pip-$PIP_VERSION.tar.gz -C $TMPTARDIR 69 | cd $TMPTARDIR/pip-$PIP_VERSION/ 70 | python setup.py install &> /dev/null 71 | cd $WORKING_DIR 72 | 73 | bpwatch stop install_pip 74 | bpwatch stop prepare_environment 75 | fi 76 | 77 | set -e 78 | hash -r 79 | -------------------------------------------------------------------------------- /bin/utils: -------------------------------------------------------------------------------- 1 | shopt -s extglob 2 | 3 | if [ $(uname) == Darwin ]; then 4 | sed() { command sed -l "$@"; } 5 | else 6 | sed() { command sed -u "$@"; } 7 | fi 8 | 9 | # Syntax sugar. 10 | indent() { 11 | sed "s/^/ /" 12 | } 13 | 14 | # Clean up pip output 15 | cleanup() { 16 | sed -e 's/\.\.\.\+/.../g' | sed -e '/already satisfied/Id' | sed -e '/Overwriting/Id' | sed -e '/python executable/Id' | sed -e '/no previously-included files/Id' 17 | } 18 | 19 | # Buildpack Indented line. 20 | puts-line() { 21 | echo " $@" 22 | } 23 | 24 | # Buildpack Steps. 25 | puts-step() { 26 | echo "-----> $@" 27 | } 28 | 29 | # Buildpack Warnings. 30 | puts-warn() { 31 | echo " ! $@" 32 | } 33 | 34 | # Buildpack Commands. 35 | puts-cmd() { 36 | echo " $ $@" 37 | } 38 | 39 | # Usage: $ set-env key value 40 | set-env() { 41 | echo "export $1=$2" >> $PROFILE_PATH 42 | } 43 | 44 | # Usage: $ set-default-env key value 45 | set-default-env() { 46 | echo "export $1=\${$1:-$2}" >> $PROFILE_PATH 47 | } 48 | 49 | # Usage: $ un-set-env key 50 | un-set-env() { 51 | echo "unset $1" >> $PROFILE_PATH 52 | } 53 | 54 | # Does some serious copying. 55 | deep-cp() { 56 | declare source="$1" target="$2" 57 | 58 | mkdir -p "$target" 59 | 60 | # cp doesn't like being called without source params, 61 | # so make sure they expand to something first. 62 | # subshell to avoid surprising caller with shopts. 63 | ( 64 | shopt -s nullglob dotglob 65 | set -- "$source"/!(tmp|.|..) 66 | [[ $# == 0 ]] || cp -a "$@" "$target" 67 | ) 68 | } 69 | 70 | # Does some serious moving. 71 | deep-mv() { 72 | deep-cp "$1" "$2" 73 | deep-rm "$1" 74 | } 75 | 76 | # Does some serious deleting. 77 | deep-rm() { 78 | # subshell to avoid surprising caller with shopts. 79 | ( 80 | shopt -s dotglob 81 | rm -rf "$1"/!(.curlrc|.netrc|tmp|.|..) 82 | ) 83 | } 84 | 85 | 86 | sub-env() { 87 | 88 | WHITELIST=${2:-''} 89 | BLACKLIST=${3:-'^(GIT_DIR|PYTHONHOME|LD_LIBRARY_PATH|LIBRARY_PATH|PATH)$'} 90 | 91 | # Python-specific variables. 92 | export PYHONHOME=$BUILD_DIR/.heroku/python 93 | export PYTHONPATH=$BUILD_DIR/ 94 | 95 | ( 96 | if [ -d "$ENV_DIR" ]; then 97 | for e in $(ls $ENV_DIR); do 98 | echo "$e" | grep -E "$WHITELIST" | grep -qvE "$BLACKLIST" && 99 | export "$e=$(cat $ENV_DIR/$e)" 100 | : 101 | done 102 | fi 103 | 104 | $1 105 | 106 | ) 107 | } 108 | 109 | -------------------------------------------------------------------------------- /bin/steps/collectstatic: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Django Collectstatic runner. If you have Django installed, collectstatic will 4 | # automatically be executed as part of the build process. If collectstatic 5 | # fails, your build fails. 6 | 7 | # This functionality will only activate if Django is in requirements.txt. 8 | 9 | # Runtime arguments: 10 | # - $DISABLE_COLLECTSTATIC: disables this functionality. 11 | # - $DEBUG_COLLECTSTATIC: upon failure, print out environment variables. 12 | 13 | source $BIN_DIR/utils 14 | 15 | # Location of 'manage.py', if it exists. 16 | MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' -printf '%d\t%P\n' | sort -nk1 | cut -f2 | head -1) 17 | MANAGE_FILE=${MANAGE_FILE:-fakepath} 18 | 19 | # Legacy file-based support for $DISABLE_COLLECTSTATIC 20 | [ -f .heroku/collectstatic_disabled ] && DISABLE_COLLECTSTATIC=1 21 | 22 | # Ensure that Django is explicitly specified in requirements.txt 23 | pip-grep -s requirements.txt django Django && DJANGO_INSTALLED=1 24 | 25 | bpwatch start collectstatic # metrics collection 26 | 27 | if [ ! "$DISABLE_COLLECTSTATIC" ] && [ -f "$MANAGE_FILE" ] && [ "$DJANGO_INSTALLED" ]; then 28 | set +e 29 | 30 | puts-cmd "python $MANAGE_FILE collectstatic --noinput" 31 | 32 | # Run collectstatic, cleanup some of the noisy output. 33 | python $MANAGE_FILE collectstatic --noinput --traceback 2>&1 | sed '/^Post-processed/d;/^Copying/d;/^$/d' | indent 34 | COLLECTSTATIC_STATUS="${PIPESTATUS[0]}" 35 | 36 | set -e 37 | 38 | # Display a warning if collectstatic failed. 39 | [ $COLLECTSTATIC_STATUS -ne 0 ] && { 40 | 41 | echo 42 | echo " ! Error while running '$ python $MANAGE_FILE collectstatic --noinput'." 43 | echo " See traceback above for details." 44 | echo 45 | echo " You may need to update application code to resolve this error." 46 | echo " Or, you can disable collectstatic for this application:" 47 | echo 48 | echo " $ heroku config:set DISABLE_COLLECTSTATIC=1" 49 | echo 50 | echo " https://devcenter.heroku.com/articles/django-assets" 51 | 52 | # Additionally, dump out the environment, if debug mode is on. 53 | if [ "$DEBUG_COLLECTSTATIC" ]; then 54 | echo 55 | echo "****** Collectstatic environment variables:" 56 | echo 57 | env | indent 58 | fi 59 | 60 | # Abort the build. 61 | exit 1 62 | } 63 | 64 | echo 65 | fi 66 | 67 | bpwatch stop collectstatic # metrics collection 68 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/treewalkers/pulldom.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from xml.dom.pulldom import START_ELEMENT, END_ELEMENT, \ 4 | COMMENT, IGNORABLE_WHITESPACE, CHARACTERS 5 | 6 | from . import _base 7 | 8 | from ..constants import voidElements 9 | 10 | 11 | class TreeWalker(_base.TreeWalker): 12 | def __iter__(self): 13 | ignore_until = None 14 | previous = None 15 | for event in self.tree: 16 | if previous is not None and \ 17 | (ignore_until is None or previous[1] is ignore_until): 18 | if previous[1] is ignore_until: 19 | ignore_until = None 20 | for token in self.tokens(previous, event): 21 | yield token 22 | if token["type"] == "EmptyTag": 23 | ignore_until = previous[1] 24 | previous = event 25 | if ignore_until is None or previous[1] is ignore_until: 26 | for token in self.tokens(previous, None): 27 | yield token 28 | elif ignore_until is not None: 29 | raise ValueError("Illformed DOM event stream: void element without END_ELEMENT") 30 | 31 | def tokens(self, event, next): 32 | type, node = event 33 | if type == START_ELEMENT: 34 | name = node.nodeName 35 | namespace = node.namespaceURI 36 | attrs = {} 37 | for attr in list(node.attributes.keys()): 38 | attr = node.getAttributeNode(attr) 39 | attrs[(attr.namespaceURI, attr.localName)] = attr.value 40 | if name in voidElements: 41 | for token in self.emptyTag(namespace, 42 | name, 43 | attrs, 44 | not next or next[1] is not node): 45 | yield token 46 | else: 47 | yield self.startTag(namespace, name, attrs) 48 | 49 | elif type == END_ELEMENT: 50 | name = node.nodeName 51 | namespace = node.namespaceURI 52 | if name not in voidElements: 53 | yield self.endTag(namespace, name) 54 | 55 | elif type == COMMENT: 56 | yield self.comment(node.nodeValue) 57 | 58 | elif type in (IGNORABLE_WHITESPACE, CHARACTERS): 59 | for token in self.text(node.nodeValue): 60 | yield token 61 | 62 | else: 63 | yield self.unknown(type) 64 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/treewalkers/genshistream.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from genshi.core import QName 4 | from genshi.core import START, END, XML_NAMESPACE, DOCTYPE, TEXT 5 | from genshi.core import START_NS, END_NS, START_CDATA, END_CDATA, PI, COMMENT 6 | 7 | from . import _base 8 | 9 | from ..constants import voidElements, namespaces 10 | 11 | 12 | class TreeWalker(_base.TreeWalker): 13 | def __iter__(self): 14 | # Buffer the events so we can pass in the following one 15 | previous = None 16 | for event in self.tree: 17 | if previous is not None: 18 | for token in self.tokens(previous, event): 19 | yield token 20 | previous = event 21 | 22 | # Don't forget the final event! 23 | if previous is not None: 24 | for token in self.tokens(previous, None): 25 | yield token 26 | 27 | def tokens(self, event, next): 28 | kind, data, pos = event 29 | if kind == START: 30 | tag, attribs = data 31 | name = tag.localname 32 | namespace = tag.namespace 33 | converted_attribs = {} 34 | for k, v in attribs: 35 | if isinstance(k, QName): 36 | converted_attribs[(k.namespace, k.localname)] = v 37 | else: 38 | converted_attribs[(None, k)] = v 39 | 40 | if namespace == namespaces["html"] and name in voidElements: 41 | for token in self.emptyTag(namespace, name, converted_attribs, 42 | not next or next[0] != END 43 | or next[1] != tag): 44 | yield token 45 | else: 46 | yield self.startTag(namespace, name, converted_attribs) 47 | 48 | elif kind == END: 49 | name = data.localname 50 | namespace = data.namespace 51 | if name not in voidElements: 52 | yield self.endTag(namespace, name) 53 | 54 | elif kind == COMMENT: 55 | yield self.comment(data) 56 | 57 | elif kind == TEXT: 58 | for token in self.text(data): 59 | yield token 60 | 61 | elif kind == DOCTYPE: 62 | yield self.doctype(*data) 63 | 64 | elif kind in (XML_NAMESPACE, DOCTYPE, START_NS, END_NS, 65 | START_CDATA, END_CDATA, PI): 66 | pass 67 | 68 | else: 69 | yield self.unknown(kind) 70 | -------------------------------------------------------------------------------- /bin/test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 4 | # Create a Heroku app with the following buildpack: 5 | # https://github.com/ddollar/buildpack-test 6 | # 7 | # Push this Python buildpack to that Heroku app to 8 | # run the tests. 9 | # 10 | 11 | testDetectWithReqs() { 12 | detect "simple-requirements" 13 | assertCapturedEquals "Python" 14 | assertCapturedSuccess 15 | } 16 | 17 | testDetectWithEmptyReqs() { 18 | detect "empty-requirements" 19 | assertCapturedEquals "Python" 20 | assertCapturedSuccess 21 | } 22 | 23 | testDetectDjango16() { 24 | detect "django-1.6-skeleton" 25 | assertCapturedEquals "Python" 26 | assertCapturedSuccess 27 | } 28 | 29 | testDetectDjango15() { 30 | detect "django-1.5-skeleton" 31 | assertCapturedEquals "Python" 32 | assertCapturedSuccess 33 | } 34 | 35 | testDetectDjango14() { 36 | detect "django-1.4-skeleton" 37 | assertCapturedEquals "Python" 38 | assertCapturedSuccess 39 | } 40 | 41 | testDetectDjango13() { 42 | detect "django-1.3-skeleton" 43 | assertCapturedEquals "Python" 44 | assertCapturedSuccess 45 | } 46 | 47 | testDetectNotDjangoWithSettings() { 48 | detect "not-django" 49 | assertCapturedEquals "Python" 50 | assertCapturedSuccess 51 | } 52 | 53 | testDetectWithSetupPy() { 54 | detect "distutils" 55 | assertCapturedEquals "Python" 56 | assertCapturedSuccess 57 | } 58 | 59 | testDetectWithSetupRequires() { 60 | detect "no-requirements" 61 | assertCapturedEquals "Python" 62 | assertCapturedSuccess 63 | } 64 | 65 | testDetectNotPython() { 66 | detect "not-python" 67 | assertNotCaptured "Python" 68 | assertEquals "1" "${RETURN}" 69 | } 70 | 71 | testDetectSimpleRuntimePypy2() { 72 | detect "simple-runtime-pypy2" 73 | assertCapturedEquals "Python" 74 | assertCapturedSuccess 75 | } 76 | 77 | testDetectSimpleRuntimePython2() { 78 | detect "simple-runtime-python2" 79 | assertCapturedEquals "Python" 80 | assertCapturedSuccess 81 | } 82 | 83 | testDetectSimpleRuntimePython3() { 84 | detect "simple-runtime" # should probably be renamed simple-runtime-python3 85 | assertCapturedEquals "Python" 86 | assertCapturedSuccess 87 | } 88 | 89 | ## utils ######################################## 90 | 91 | pushd $(dirname 0) >/dev/null 92 | BASE=$(pwd) 93 | popd >/dev/null 94 | 95 | source ${BASE}/vendor/test-utils 96 | 97 | detect() { 98 | capture ${BASE}/bin/detect ${BASE}/test/$1 99 | } 100 | 101 | compile() { 102 | capture ${BASE}/bin/compile ${BASE}/test/$1 103 | } 104 | 105 | source ${BASE}/vendor/shunit2 106 | 107 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/codingstatemachine.py: -------------------------------------------------------------------------------- 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 .constants import eStart 29 | from .compat import wrap_ord 30 | 31 | 32 | class CodingStateMachine: 33 | def __init__(self, sm): 34 | self._mModel = sm 35 | self._mCurrentBytePos = 0 36 | self._mCurrentCharLen = 0 37 | self.reset() 38 | 39 | def reset(self): 40 | self._mCurrentState = eStart 41 | 42 | def next_state(self, c): 43 | # for each byte we get its class 44 | # if it is first byte, we also get byte length 45 | # PY3K: aBuf is a byte stream, so c is an int, not a byte 46 | byteCls = self._mModel['classTable'][wrap_ord(c)] 47 | if self._mCurrentState == eStart: 48 | self._mCurrentBytePos = 0 49 | self._mCurrentCharLen = self._mModel['charLenTable'][byteCls] 50 | # from byte's class and stateTable, we get its next state 51 | curr_state = (self._mCurrentState * self._mModel['classFactor'] 52 | + byteCls) 53 | self._mCurrentState = self._mModel['stateTable'][curr_state] 54 | self._mCurrentBytePos += 1 55 | return self._mCurrentState 56 | 57 | def get_current_charlen(self): 58 | return self._mCurrentCharLen 59 | 60 | def get_coding_state_machine(self): 61 | return self._mModel['name'] 62 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/commands/freeze.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | import sys 4 | 5 | import pip 6 | from pip.basecommand import Command 7 | from pip.operations.freeze import freeze 8 | from pip.wheel import WheelCache 9 | 10 | 11 | class FreezeCommand(Command): 12 | """ 13 | Output installed packages in requirements format. 14 | 15 | packages are listed in a case-insensitive sorted order. 16 | """ 17 | name = 'freeze' 18 | usage = """ 19 | %prog [options]""" 20 | summary = 'Output installed packages in requirements format.' 21 | log_streams = ("ext://sys.stderr", "ext://sys.stderr") 22 | 23 | def __init__(self, *args, **kw): 24 | super(FreezeCommand, self).__init__(*args, **kw) 25 | 26 | self.cmd_opts.add_option( 27 | '-r', '--requirement', 28 | dest='requirement', 29 | action='store', 30 | default=None, 31 | metavar='file', 32 | help="Use the order in the given requirements file and its " 33 | "comments when generating output.") 34 | self.cmd_opts.add_option( 35 | '-f', '--find-links', 36 | dest='find_links', 37 | action='append', 38 | default=[], 39 | metavar='URL', 40 | help='URL for finding packages, which will be added to the ' 41 | 'output.') 42 | self.cmd_opts.add_option( 43 | '-l', '--local', 44 | dest='local', 45 | action='store_true', 46 | default=False, 47 | help='If in a virtualenv that has global access, do not output ' 48 | 'globally-installed packages.') 49 | self.cmd_opts.add_option( 50 | '--user', 51 | dest='user', 52 | action='store_true', 53 | default=False, 54 | help='Only output packages installed in user-site.') 55 | 56 | self.parser.insert_option_group(0, self.cmd_opts) 57 | 58 | def run(self, options, args): 59 | format_control = pip.index.FormatControl(set(), set()) 60 | wheel_cache = WheelCache(options.cache_dir, format_control) 61 | freeze_kwargs = dict( 62 | requirement=options.requirement, 63 | find_links=options.find_links, 64 | local_only=options.local, 65 | user_only=options.user, 66 | skip_regex=options.skip_requirements_regex, 67 | isolated=options.isolated_mode, 68 | wheel_cache=wheel_cache) 69 | 70 | for line in freeze(**freeze_kwargs): 71 | sys.stdout.write(line + '\n') 72 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/urllib3/filepost.py: -------------------------------------------------------------------------------- 1 | import codecs 2 | 3 | from uuid import uuid4 4 | from io import BytesIO 5 | 6 | from .packages import six 7 | from .packages.six import b 8 | from .fields import RequestField 9 | 10 | writer = codecs.lookup('utf-8')[3] 11 | 12 | 13 | def choose_boundary(): 14 | """ 15 | Our embarassingly-simple replacement for mimetools.choose_boundary. 16 | """ 17 | return uuid4().hex 18 | 19 | 20 | def iter_field_objects(fields): 21 | """ 22 | Iterate over fields. 23 | 24 | Supports list of (k, v) tuples and dicts, and lists of 25 | :class:`~urllib3.fields.RequestField`. 26 | 27 | """ 28 | if isinstance(fields, dict): 29 | i = six.iteritems(fields) 30 | else: 31 | i = iter(fields) 32 | 33 | for field in i: 34 | if isinstance(field, RequestField): 35 | yield field 36 | else: 37 | yield RequestField.from_tuples(*field) 38 | 39 | 40 | def iter_fields(fields): 41 | """ 42 | .. deprecated:: 1.6 43 | 44 | Iterate over fields. 45 | 46 | The addition of :class:`~urllib3.fields.RequestField` makes this function 47 | obsolete. Instead, use :func:`iter_field_objects`, which returns 48 | :class:`~urllib3.fields.RequestField` objects. 49 | 50 | Supports list of (k, v) tuples and dicts. 51 | """ 52 | if isinstance(fields, dict): 53 | return ((k, v) for k, v in six.iteritems(fields)) 54 | 55 | return ((k, v) for k, v in fields) 56 | 57 | 58 | def encode_multipart_formdata(fields, boundary=None): 59 | """ 60 | Encode a dictionary of ``fields`` using the multipart/form-data MIME format. 61 | 62 | :param fields: 63 | Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`). 64 | 65 | :param boundary: 66 | If not specified, then a random boundary will be generated using 67 | :func:`mimetools.choose_boundary`. 68 | """ 69 | body = BytesIO() 70 | if boundary is None: 71 | boundary = choose_boundary() 72 | 73 | for field in iter_field_objects(fields): 74 | body.write(b('--%s\r\n' % (boundary))) 75 | 76 | writer(body).write(field.render_headers()) 77 | data = field.data 78 | 79 | if isinstance(data, int): 80 | data = str(data) # Backwards compatibility 81 | 82 | if isinstance(data, six.text_type): 83 | writer(body).write(data) 84 | else: 85 | body.write(data) 86 | 87 | body.write(b'\r\n') 88 | 89 | body.write(b('--%s--\r\n' % (boundary))) 90 | 91 | content_type = str('multipart/form-data; boundary=%s' % boundary) 92 | 93 | return body.getvalue(), content_type 94 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | pip._vendor is for vendoring dependencies of pip to prevent needing pip to 3 | depend on something external. 4 | 5 | Files inside of pip._vendor should be considered immutable and should only be 6 | updated to versions from upstream. 7 | """ 8 | from __future__ import absolute_import 9 | 10 | import glob 11 | import os.path 12 | import sys 13 | 14 | # Downstream redistributors which have debundled our dependencies should also 15 | # patch this value to be true. This will trigger the additional patching 16 | # to cause things like "six" to be available as pip. 17 | DEBUNDLED = False 18 | 19 | # By default, look in this directory for a bunch of .whl files which we will 20 | # add to the beginning of sys.path before attempting to import anything. This 21 | # is done to support downstream re-distributors like Debian and Fedora who 22 | # wish to create their own Wheels for our dependencies to aid in debundling. 23 | WHEEL_DIR = os.path.abspath(os.path.dirname(__file__)) 24 | 25 | 26 | # Define a small helper function to alias our vendored modules to the real ones 27 | # if the vendored ones do not exist. This idea of this was taken from 28 | # https://github.com/kennethreitz/requests/pull/2567. 29 | def vendored(modulename): 30 | vendored_name = "{0}.{1}".format(__name__, modulename) 31 | 32 | try: 33 | __import__(vendored_name, globals(), locals(), level=0) 34 | except ImportError: 35 | __import__(modulename, globals(), locals(), level=0) 36 | sys.modules[vendored_name] = sys.modules[modulename] 37 | base, head = vendored_name.rsplit(".", 1) 38 | setattr(sys.modules[base], head, sys.modules[modulename]) 39 | 40 | 41 | # If we're operating in a debundled setup, then we want to go ahead and trigger 42 | # the aliasing of our vendored libraries as well as looking for wheels to add 43 | # to our sys.path. This will cause all of this code to be a no-op typically 44 | # however downstream redistributors can enable it in a consistent way across 45 | # all platforms. 46 | if DEBUNDLED: 47 | # Actually look inside of WHEEL_DIR to find .whl files and add them to the 48 | # front of our sys.path. 49 | sys.path[:] = glob.glob(os.path.join(WHEEL_DIR, "*.whl")) + sys.path 50 | 51 | # Actually alias all of our vendored dependencies. 52 | vendored("cachecontrol") 53 | vendored("colorama") 54 | vendored("distlib") 55 | vendored("html5lib") 56 | vendored("lockfile") 57 | vendored("six") 58 | vendored("six.moves") 59 | vendored("six.moves.urllib") 60 | vendored("packaging") 61 | vendored("packaging.version") 62 | vendored("packaging.specifiers") 63 | vendored("pkg_resources") 64 | vendored("progress") 65 | vendored("retrying") 66 | vendored("requests") 67 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/colorama/ansi.py: -------------------------------------------------------------------------------- 1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. 2 | ''' 3 | This module generates ANSI character codes to printing colors to terminals. 4 | See: http://en.wikipedia.org/wiki/ANSI_escape_code 5 | ''' 6 | 7 | CSI = '\033[' 8 | OSC = '\033]' 9 | BEL = '\007' 10 | 11 | 12 | def code_to_chars(code): 13 | return CSI + str(code) + 'm' 14 | 15 | 16 | class AnsiCodes(object): 17 | def __init__(self, codes): 18 | for name in dir(codes): 19 | if not name.startswith('_'): 20 | value = getattr(codes, name) 21 | setattr(self, name, code_to_chars(value)) 22 | 23 | 24 | class AnsiCursor(object): 25 | def UP(self, n=1): 26 | return CSI + str(n) + "A" 27 | def DOWN(self, n=1): 28 | return CSI + str(n) + "B" 29 | def FORWARD(self, n=1): 30 | return CSI + str(n) + "C" 31 | def BACK(self, n=1): 32 | return CSI + str(n) + "D" 33 | def POS(self, x=1, y=1): 34 | return CSI + str(y) + ";" + str(x) + "H" 35 | 36 | def set_title(title): 37 | return OSC + "2;" + title + BEL 38 | 39 | def clear_screen(mode=2): 40 | return CSI + str(mode) + "J" 41 | 42 | def clear_line(mode=2): 43 | return CSI + str(mode) + "K" 44 | 45 | 46 | class AnsiFore: 47 | BLACK = 30 48 | RED = 31 49 | GREEN = 32 50 | YELLOW = 33 51 | BLUE = 34 52 | MAGENTA = 35 53 | CYAN = 36 54 | WHITE = 37 55 | RESET = 39 56 | 57 | # These are fairly well supported, but not part of the standard. 58 | LIGHTBLACK_EX = 90 59 | LIGHTRED_EX = 91 60 | LIGHTGREEN_EX = 92 61 | LIGHTYELLOW_EX = 93 62 | LIGHTBLUE_EX = 94 63 | LIGHTMAGENTA_EX = 95 64 | LIGHTCYAN_EX = 96 65 | LIGHTWHITE_EX = 97 66 | 67 | 68 | class AnsiBack: 69 | BLACK = 40 70 | RED = 41 71 | GREEN = 42 72 | YELLOW = 43 73 | BLUE = 44 74 | MAGENTA = 45 75 | CYAN = 46 76 | WHITE = 47 77 | RESET = 49 78 | 79 | # These are fairly well supported, but not part of the standard. 80 | LIGHTBLACK_EX = 100 81 | LIGHTRED_EX = 101 82 | LIGHTGREEN_EX = 102 83 | LIGHTYELLOW_EX = 103 84 | LIGHTBLUE_EX = 104 85 | LIGHTMAGENTA_EX = 105 86 | LIGHTCYAN_EX = 106 87 | LIGHTWHITE_EX = 107 88 | 89 | 90 | class AnsiStyle: 91 | BRIGHT = 1 92 | DIM = 2 93 | NORMAL = 22 94 | RESET_ALL = 0 95 | 96 | Fore = AnsiCodes( AnsiFore ) 97 | Back = AnsiCodes( AnsiBack ) 98 | Style = AnsiCodes( AnsiStyle ) 99 | Cursor = AnsiCursor() 100 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/chardetect.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | Script which takes one or more file paths and reports on their detected 4 | encodings 5 | 6 | Example:: 7 | 8 | % chardetect somefile someotherfile 9 | somefile: windows-1252 with confidence 0.5 10 | someotherfile: ascii with confidence 1.0 11 | 12 | If no paths are provided, it takes its input from stdin. 13 | 14 | """ 15 | 16 | from __future__ import absolute_import, print_function, unicode_literals 17 | 18 | import argparse 19 | import sys 20 | from io import open 21 | 22 | from chardet import __version__ 23 | from chardet.universaldetector import UniversalDetector 24 | 25 | 26 | def description_of(lines, name='stdin'): 27 | """ 28 | Return a string describing the probable encoding of a file or 29 | list of strings. 30 | 31 | :param lines: The lines to get the encoding of. 32 | :type lines: Iterable of bytes 33 | :param name: Name of file or collection of lines 34 | :type name: str 35 | """ 36 | u = UniversalDetector() 37 | for line in lines: 38 | u.feed(line) 39 | u.close() 40 | result = u.result 41 | if result['encoding']: 42 | return '{0}: {1} with confidence {2}'.format(name, result['encoding'], 43 | result['confidence']) 44 | else: 45 | return '{0}: no result'.format(name) 46 | 47 | 48 | def main(argv=None): 49 | ''' 50 | Handles command line arguments and gets things started. 51 | 52 | :param argv: List of arguments, as if specified on the command-line. 53 | If None, ``sys.argv[1:]`` is used instead. 54 | :type argv: list of str 55 | ''' 56 | # Get command line arguments 57 | parser = argparse.ArgumentParser( 58 | description="Takes one or more file paths and reports their detected \ 59 | encodings", 60 | formatter_class=argparse.ArgumentDefaultsHelpFormatter, 61 | conflict_handler='resolve') 62 | parser.add_argument('input', 63 | help='File whose encoding we would like to determine.', 64 | type=argparse.FileType('rb'), nargs='*', 65 | default=[sys.stdin]) 66 | parser.add_argument('--version', action='version', 67 | version='%(prog)s {0}'.format(__version__)) 68 | args = parser.parse_args(argv) 69 | 70 | for f in args.input: 71 | if f.isatty(): 72 | print("You are running chardetect interactively. Press " + 73 | "CTRL-D twice at the start of a blank line to signal the " + 74 | "end of your input. If you want help, run chardetect " + 75 | "--help\n", file=sys.stderr) 76 | print(description_of(f, f.name)) 77 | 78 | 79 | if __name__ == '__main__': 80 | main() 81 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/lockfile/symlinklockfile.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | import time 4 | import os 5 | 6 | from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout, 7 | AlreadyLocked) 8 | 9 | class SymlinkLockFile(LockBase): 10 | """Lock access to a file using symlink(2).""" 11 | 12 | def __init__(self, path, threaded=True, timeout=None): 13 | # super(SymlinkLockFile).__init(...) 14 | LockBase.__init__(self, path, threaded, timeout) 15 | # split it back! 16 | self.unique_name = os.path.split(self.unique_name)[1] 17 | 18 | def acquire(self, timeout=None): 19 | # Hopefully unnecessary for symlink. 20 | #try: 21 | # open(self.unique_name, "wb").close() 22 | #except IOError: 23 | # raise LockFailed("failed to create %s" % self.unique_name) 24 | timeout = timeout is not None and timeout or self.timeout 25 | end_time = time.time() 26 | if timeout is not None and timeout > 0: 27 | end_time += timeout 28 | 29 | while True: 30 | # Try and create a symbolic link to it. 31 | try: 32 | os.symlink(self.unique_name, self.lock_file) 33 | except OSError: 34 | # Link creation failed. Maybe we've double-locked? 35 | if self.i_am_locking(): 36 | # Linked to out unique name. Proceed. 37 | return 38 | else: 39 | # Otherwise the lock creation failed. 40 | if timeout is not None and time.time() > end_time: 41 | if timeout > 0: 42 | raise LockTimeout("Timeout waiting to acquire" 43 | " lock for %s" % 44 | self.path) 45 | else: 46 | raise AlreadyLocked("%s is already locked" % 47 | self.path) 48 | time.sleep(timeout/10 if timeout is not None else 0.1) 49 | else: 50 | # Link creation succeeded. We're good to go. 51 | return 52 | 53 | def release(self): 54 | if not self.is_locked(): 55 | raise NotLocked("%s is not locked" % self.path) 56 | elif not self.i_am_locking(): 57 | raise NotMyLock("%s is locked, but not by me" % self.path) 58 | os.unlink(self.lock_file) 59 | 60 | def is_locked(self): 61 | return os.path.islink(self.lock_file) 62 | 63 | def i_am_locking(self): 64 | return os.path.islink(self.lock_file) and \ 65 | os.readlink(self.lock_file) == self.unique_name 66 | 67 | def break_lock(self): 68 | if os.path.islink(self.lock_file): # exists && link 69 | os.unlink(self.lock_file) 70 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/lockfile/linklockfile.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | import time 4 | import os 5 | 6 | from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout, 7 | AlreadyLocked) 8 | 9 | class LinkLockFile(LockBase): 10 | """Lock access to a file using atomic property of link(2). 11 | 12 | >>> lock = LinkLockFile('somefile') 13 | >>> lock = LinkLockFile('somefile', threaded=False) 14 | """ 15 | 16 | def acquire(self, timeout=None): 17 | try: 18 | open(self.unique_name, "wb").close() 19 | except IOError: 20 | raise LockFailed("failed to create %s" % self.unique_name) 21 | 22 | timeout = timeout is not None and timeout or self.timeout 23 | end_time = time.time() 24 | if timeout is not None and timeout > 0: 25 | end_time += timeout 26 | 27 | while True: 28 | # Try and create a hard link to it. 29 | try: 30 | os.link(self.unique_name, self.lock_file) 31 | except OSError: 32 | # Link creation failed. Maybe we've double-locked? 33 | nlinks = os.stat(self.unique_name).st_nlink 34 | if nlinks == 2: 35 | # The original link plus the one I created == 2. We're 36 | # good to go. 37 | return 38 | else: 39 | # Otherwise the lock creation failed. 40 | if timeout is not None and time.time() > end_time: 41 | os.unlink(self.unique_name) 42 | if timeout > 0: 43 | raise LockTimeout("Timeout waiting to acquire" 44 | " lock for %s" % 45 | self.path) 46 | else: 47 | raise AlreadyLocked("%s is already locked" % 48 | self.path) 49 | time.sleep(timeout is not None and timeout/10 or 0.1) 50 | else: 51 | # Link creation succeeded. We're good to go. 52 | return 53 | 54 | def release(self): 55 | if not self.is_locked(): 56 | raise NotLocked("%s is not locked" % self.path) 57 | elif not os.path.exists(self.unique_name): 58 | raise NotMyLock("%s is locked, but not by me" % self.path) 59 | os.unlink(self.unique_name) 60 | os.unlink(self.lock_file) 61 | 62 | def is_locked(self): 63 | return os.path.exists(self.lock_file) 64 | 65 | def i_am_locking(self): 66 | return (self.is_locked() and 67 | os.path.exists(self.unique_name) and 68 | os.stat(self.unique_name).st_nlink == 2) 69 | 70 | def break_lock(self): 71 | if os.path.exists(self.lock_file): 72 | os.unlink(self.lock_file) 73 | 74 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Python Buildpack Changelog 2 | 3 | ## v80 (2016-04-05) 4 | 5 | Improved pip-pop compatibility with latest pip releases. 6 | 7 | ## v79 (2016-03-22) 8 | 9 | Compatibility improvements with heroku-apt-buildpack. 10 | 11 | ## v78 (2016-03-18) 12 | 13 | Added automatic configuration of Gunicorn's `FORWARDED_ALLOW_IPS` setting. 14 | 15 | Improved detection of libffi dependency when using bcrypt via `Django[bcrypt]`. 16 | 17 | Improved GDAL support. 18 | 19 | - GDAL dependency detection now checks for pygdal and is case-insensitive. 20 | - The vendored GDAL library has been updated to 1.11.1. 21 | - GDAL bootstrapping now also installs the GEOS and Proj.4 libraries. 22 | 23 | Updated pip to 8.1.1 and setuptools to 20.3. 24 | 25 | ## v77 (2016-02-10) 26 | 27 | Improvements to warnings and minor bugfix. 28 | 29 | ## v76 (2016-02-08) 30 | 31 | Improved Django collectstatic support. 32 | 33 | - `$ python manage.py collectstatic` will only be run if `Django` is present in `requirements.txt`. 34 | - If collectstatic fails, the build fails. Full traceback is provided. 35 | - `$DISABLE_COLLECTSTATIC`: skip collectstatic step completely (not new). 36 | - `$DEBUG_COLLECTSTATIC`: echo environment variables upon collectstatic failure. 37 | - Updated build output style. 38 | - New warning for outdated Python (via pip `InsecurePlatform` warning). 39 | 40 | ## v75 (2016-01-29) 41 | 42 | Updated pip and Setuptools. 43 | 44 | ## v74 (2015-12-29) 45 | 46 | Added warnings for lack of Procfile. 47 | 48 | ## v72 (2015-12-07) 49 | 50 | Updated default Python to 2.7.11. 51 | 52 | ## v72 (2015-12-03) 53 | 54 | Added friendly warnings for common build failures. 55 | 56 | ## v70 (2015-10-29) 57 | 58 | Improved compatibility with multi and node.js buildpacks. 59 | 60 | ## v69 (2015-10-12) 61 | 62 | Revert to v66. 63 | 64 | ## v68 (2015-10-12) 65 | 66 | Fixed .heroku/venv error with modern apps. 67 | 68 | ## v67 (2015-10-12) 69 | 70 | Further improved cache compatibility with multi and node.js buildpacks. 71 | 72 | ## v66 (2015-10-09) 73 | 74 | Improved compatibility with multi and node.js buildpacks. 75 | 76 | ## v65 (2015-10-08) 77 | 78 | Reverted v64. 79 | 80 | ## v64 (2015-10-08) 81 | 82 | Improved compatibility with multi and node.js buildpacks. 83 | 84 | ## v63 (2015-10-08) 85 | 86 | Updated Pip and Setuptools. 87 | 88 | - Setuptools updated to v18.3.2 89 | - Pip updated to v7.1.2 90 | 91 | 92 | ## v62 (2015-08-07) 93 | 94 | Updated Pip and Setuptools. 95 | 96 | - Setuptools updated to v18.1 97 | - Pip updated to v7.1.0 98 | 99 | ## v61 (2015-06-30) 100 | 101 | Updated Pip and Setuptools. 102 | 103 | - Setuptools updated to v18.0.1 104 | - Pip updated to v7.0.3 105 | 106 | ## v60 (2015-05-27) 107 | 108 | Default Python is now latest 2.7.10. Updated Pip and Distribute. 109 | 110 | - Default Python version is v2.7.10 111 | - Setuptools updated to v16.0 112 | - Pip updated to v7.0.1 113 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/distlib/_backport/sysconfig.cfg: -------------------------------------------------------------------------------- 1 | [posix_prefix] 2 | # Configuration directories. Some of these come straight out of the 3 | # configure script. They are for implementing the other variables, not to 4 | # be used directly in [resource_locations]. 5 | confdir = /etc 6 | datadir = /usr/share 7 | libdir = /usr/lib 8 | statedir = /var 9 | # User resource directory 10 | local = ~/.local/{distribution.name} 11 | 12 | stdlib = {base}/lib/python{py_version_short} 13 | platstdlib = {platbase}/lib/python{py_version_short} 14 | purelib = {base}/lib/python{py_version_short}/site-packages 15 | platlib = {platbase}/lib/python{py_version_short}/site-packages 16 | include = {base}/include/python{py_version_short}{abiflags} 17 | platinclude = {platbase}/include/python{py_version_short}{abiflags} 18 | data = {base} 19 | 20 | [posix_home] 21 | stdlib = {base}/lib/python 22 | platstdlib = {base}/lib/python 23 | purelib = {base}/lib/python 24 | platlib = {base}/lib/python 25 | include = {base}/include/python 26 | platinclude = {base}/include/python 27 | scripts = {base}/bin 28 | data = {base} 29 | 30 | [nt] 31 | stdlib = {base}/Lib 32 | platstdlib = {base}/Lib 33 | purelib = {base}/Lib/site-packages 34 | platlib = {base}/Lib/site-packages 35 | include = {base}/Include 36 | platinclude = {base}/Include 37 | scripts = {base}/Scripts 38 | data = {base} 39 | 40 | [os2] 41 | stdlib = {base}/Lib 42 | platstdlib = {base}/Lib 43 | purelib = {base}/Lib/site-packages 44 | platlib = {base}/Lib/site-packages 45 | include = {base}/Include 46 | platinclude = {base}/Include 47 | scripts = {base}/Scripts 48 | data = {base} 49 | 50 | [os2_home] 51 | stdlib = {userbase}/lib/python{py_version_short} 52 | platstdlib = {userbase}/lib/python{py_version_short} 53 | purelib = {userbase}/lib/python{py_version_short}/site-packages 54 | platlib = {userbase}/lib/python{py_version_short}/site-packages 55 | include = {userbase}/include/python{py_version_short} 56 | scripts = {userbase}/bin 57 | data = {userbase} 58 | 59 | [nt_user] 60 | stdlib = {userbase}/Python{py_version_nodot} 61 | platstdlib = {userbase}/Python{py_version_nodot} 62 | purelib = {userbase}/Python{py_version_nodot}/site-packages 63 | platlib = {userbase}/Python{py_version_nodot}/site-packages 64 | include = {userbase}/Python{py_version_nodot}/Include 65 | scripts = {userbase}/Scripts 66 | data = {userbase} 67 | 68 | [posix_user] 69 | stdlib = {userbase}/lib/python{py_version_short} 70 | platstdlib = {userbase}/lib/python{py_version_short} 71 | purelib = {userbase}/lib/python{py_version_short}/site-packages 72 | platlib = {userbase}/lib/python{py_version_short}/site-packages 73 | include = {userbase}/include/python{py_version_short} 74 | scripts = {userbase}/bin 75 | data = {userbase} 76 | 77 | [osx_framework_user] 78 | stdlib = {userbase}/lib/python 79 | platstdlib = {userbase}/lib/python 80 | purelib = {userbase}/lib/python/site-packages 81 | platlib = {userbase}/lib/python/site-packages 82 | include = {userbase}/include 83 | scripts = {userbase}/bin 84 | data = {userbase} 85 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/utf8prober.py: -------------------------------------------------------------------------------- 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 . import constants 29 | from .charsetprober import CharSetProber 30 | from .codingstatemachine import CodingStateMachine 31 | from .mbcssm import UTF8SMModel 32 | 33 | ONE_CHAR_PROB = 0.5 34 | 35 | 36 | class UTF8Prober(CharSetProber): 37 | def __init__(self): 38 | CharSetProber.__init__(self) 39 | self._mCodingSM = CodingStateMachine(UTF8SMModel) 40 | self.reset() 41 | 42 | def reset(self): 43 | CharSetProber.reset(self) 44 | self._mCodingSM.reset() 45 | self._mNumOfMBChar = 0 46 | 47 | def get_charset_name(self): 48 | return "utf-8" 49 | 50 | def feed(self, aBuf): 51 | for c in aBuf: 52 | codingState = self._mCodingSM.next_state(c) 53 | if codingState == constants.eError: 54 | self._mState = constants.eNotMe 55 | break 56 | elif codingState == constants.eItsMe: 57 | self._mState = constants.eFoundIt 58 | break 59 | elif codingState == constants.eStart: 60 | if self._mCodingSM.get_current_charlen() >= 2: 61 | self._mNumOfMBChar += 1 62 | 63 | if self.get_state() == constants.eDetecting: 64 | if self.get_confidence() > constants.SHORTCUT_THRESHOLD: 65 | self._mState = constants.eFoundIt 66 | 67 | return self.get_state() 68 | 69 | def get_confidence(self): 70 | unlike = 0.99 71 | if self._mNumOfMBChar < 6: 72 | for i in range(0, self._mNumOfMBChar): 73 | unlike = unlike * ONE_CHAR_PROB 74 | return 1.0 - unlike 75 | else: 76 | return unlike 77 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/filters/inject_meta_charset.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from . import _base 4 | 5 | 6 | class Filter(_base.Filter): 7 | def __init__(self, source, encoding): 8 | _base.Filter.__init__(self, source) 9 | self.encoding = encoding 10 | 11 | def __iter__(self): 12 | state = "pre_head" 13 | meta_found = (self.encoding is None) 14 | pending = [] 15 | 16 | for token in _base.Filter.__iter__(self): 17 | type = token["type"] 18 | if type == "StartTag": 19 | if token["name"].lower() == "head": 20 | state = "in_head" 21 | 22 | elif type == "EmptyTag": 23 | if token["name"].lower() == "meta": 24 | # replace charset with actual encoding 25 | has_http_equiv_content_type = False 26 | for (namespace, name), value in token["data"].items(): 27 | if namespace is not None: 28 | continue 29 | elif name.lower() == 'charset': 30 | token["data"][(namespace, name)] = self.encoding 31 | meta_found = True 32 | break 33 | elif name == 'http-equiv' and value.lower() == 'content-type': 34 | has_http_equiv_content_type = True 35 | else: 36 | if has_http_equiv_content_type and (None, "content") in token["data"]: 37 | token["data"][(None, "content")] = 'text/html; charset=%s' % self.encoding 38 | meta_found = True 39 | 40 | elif token["name"].lower() == "head" and not meta_found: 41 | # insert meta into empty head 42 | yield {"type": "StartTag", "name": "head", 43 | "data": token["data"]} 44 | yield {"type": "EmptyTag", "name": "meta", 45 | "data": {(None, "charset"): self.encoding}} 46 | yield {"type": "EndTag", "name": "head"} 47 | meta_found = True 48 | continue 49 | 50 | elif type == "EndTag": 51 | if token["name"].lower() == "head" and pending: 52 | # insert meta into head (if necessary) and flush pending queue 53 | yield pending.pop(0) 54 | if not meta_found: 55 | yield {"type": "EmptyTag", "name": "meta", 56 | "data": {(None, "charset"): self.encoding}} 57 | while pending: 58 | yield pending.pop(0) 59 | meta_found = True 60 | state = "post_head" 61 | 62 | if state == "in_head": 63 | pending.append(token) 64 | else: 65 | yield token 66 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/progress/bar.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Copyright (c) 2012 Giorgos Verigakis 4 | # 5 | # Permission to use, copy, modify, and distribute this software for any 6 | # purpose with or without fee is hereby granted, provided that the above 7 | # copyright notice and this permission notice appear in all copies. 8 | # 9 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | 17 | from __future__ import unicode_literals 18 | 19 | 20 | from . import Progress 21 | from .helpers import WritelnMixin 22 | 23 | 24 | class Bar(WritelnMixin, Progress): 25 | width = 32 26 | message = '' 27 | suffix = '%(index)d/%(max)d' 28 | bar_prefix = ' |' 29 | bar_suffix = '| ' 30 | empty_fill = ' ' 31 | fill = '#' 32 | hide_cursor = True 33 | 34 | def update(self): 35 | filled_length = int(self.width * self.progress) 36 | empty_length = self.width - filled_length 37 | 38 | message = self.message % self 39 | bar = self.fill * filled_length 40 | empty = self.empty_fill * empty_length 41 | suffix = self.suffix % self 42 | line = ''.join([message, self.bar_prefix, bar, empty, self.bar_suffix, 43 | suffix]) 44 | self.writeln(line) 45 | 46 | 47 | class ChargingBar(Bar): 48 | suffix = '%(percent)d%%' 49 | bar_prefix = ' ' 50 | bar_suffix = ' ' 51 | empty_fill = '∙' 52 | fill = '█' 53 | 54 | 55 | class FillingSquaresBar(ChargingBar): 56 | empty_fill = '▢' 57 | fill = '▣' 58 | 59 | 60 | class FillingCirclesBar(ChargingBar): 61 | empty_fill = '◯' 62 | fill = '◉' 63 | 64 | 65 | class IncrementalBar(Bar): 66 | phases = (' ', '▏', '▎', '▍', '▌', '▋', '▊', '▉', '█') 67 | 68 | def update(self): 69 | nphases = len(self.phases) 70 | expanded_length = int(nphases * self.width * self.progress) 71 | filled_length = int(self.width * self.progress) 72 | empty_length = self.width - filled_length 73 | phase = expanded_length - (filled_length * nphases) 74 | 75 | message = self.message % self 76 | bar = self.phases[-1] * filled_length 77 | current = self.phases[phase] if phase > 0 else '' 78 | empty = self.empty_fill * max(0, empty_length - len(current)) 79 | suffix = self.suffix % self 80 | line = ''.join([message, self.bar_prefix, bar, current, empty, 81 | self.bar_suffix, suffix]) 82 | self.writeln(line) 83 | 84 | 85 | class ShadyBar(IncrementalBar): 86 | phases = (' ', '░', '▒', '▓', '█') 87 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/exceptions.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | requests.exceptions 5 | ~~~~~~~~~~~~~~~~~~~ 6 | 7 | This module contains the set of Requests' exceptions. 8 | 9 | """ 10 | from .packages.urllib3.exceptions import HTTPError as BaseHTTPError 11 | 12 | 13 | class RequestException(IOError): 14 | """There was an ambiguous exception that occurred while handling your 15 | request.""" 16 | 17 | def __init__(self, *args, **kwargs): 18 | """ 19 | Initialize RequestException with `request` and `response` objects. 20 | """ 21 | response = kwargs.pop('response', None) 22 | self.response = response 23 | self.request = kwargs.pop('request', None) 24 | if (response is not None and not self.request and 25 | hasattr(response, 'request')): 26 | self.request = self.response.request 27 | super(RequestException, self).__init__(*args, **kwargs) 28 | 29 | 30 | class HTTPError(RequestException): 31 | """An HTTP error occurred.""" 32 | 33 | 34 | class ConnectionError(RequestException): 35 | """A Connection error occurred.""" 36 | 37 | 38 | class ProxyError(ConnectionError): 39 | """A proxy error occurred.""" 40 | 41 | 42 | class SSLError(ConnectionError): 43 | """An SSL error occurred.""" 44 | 45 | 46 | class Timeout(RequestException): 47 | """The request timed out. 48 | 49 | Catching this error will catch both 50 | :exc:`~requests.exceptions.ConnectTimeout` and 51 | :exc:`~requests.exceptions.ReadTimeout` errors. 52 | """ 53 | 54 | 55 | class ConnectTimeout(ConnectionError, Timeout): 56 | """The request timed out while trying to connect to the remote server. 57 | 58 | Requests that produced this error are safe to retry. 59 | """ 60 | 61 | 62 | class ReadTimeout(Timeout): 63 | """The server did not send any data in the allotted amount of time.""" 64 | 65 | 66 | class URLRequired(RequestException): 67 | """A valid URL is required to make a request.""" 68 | 69 | 70 | class TooManyRedirects(RequestException): 71 | """Too many redirects.""" 72 | 73 | 74 | class MissingSchema(RequestException, ValueError): 75 | """The URL schema (e.g. http or https) is missing.""" 76 | 77 | 78 | class InvalidSchema(RequestException, ValueError): 79 | """See defaults.py for valid schemas.""" 80 | 81 | 82 | class InvalidURL(RequestException, ValueError): 83 | """ The URL provided was somehow invalid. """ 84 | 85 | 86 | class ChunkedEncodingError(RequestException): 87 | """The server declared chunked encoding but sent an invalid chunk.""" 88 | 89 | 90 | class ContentDecodingError(RequestException, BaseHTTPError): 91 | """Failed to decode response content""" 92 | 93 | 94 | class StreamConsumedError(RequestException, TypeError): 95 | """The content for this response was already consumed""" 96 | 97 | 98 | class RetryError(RequestException): 99 | """Custom retries logic failed""" 100 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/commands/uninstall.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | import pip 4 | from pip.wheel import WheelCache 5 | from pip.req import InstallRequirement, RequirementSet, parse_requirements 6 | from pip.basecommand import Command 7 | from pip.exceptions import InstallationError 8 | 9 | 10 | class UninstallCommand(Command): 11 | """ 12 | Uninstall packages. 13 | 14 | pip is able to uninstall most installed packages. Known exceptions are: 15 | 16 | - Pure distutils packages installed with ``python setup.py install``, which 17 | leave behind no metadata to determine what files were installed. 18 | - Script wrappers installed by ``python setup.py develop``. 19 | """ 20 | name = 'uninstall' 21 | usage = """ 22 | %prog [options] ... 23 | %prog [options] -r ...""" 24 | summary = 'Uninstall packages.' 25 | 26 | def __init__(self, *args, **kw): 27 | super(UninstallCommand, self).__init__(*args, **kw) 28 | self.cmd_opts.add_option( 29 | '-r', '--requirement', 30 | dest='requirements', 31 | action='append', 32 | default=[], 33 | metavar='file', 34 | help='Uninstall all the packages listed in the given requirements ' 35 | 'file. This option can be used multiple times.', 36 | ) 37 | self.cmd_opts.add_option( 38 | '-y', '--yes', 39 | dest='yes', 40 | action='store_true', 41 | help="Don't ask for confirmation of uninstall deletions.") 42 | 43 | self.parser.insert_option_group(0, self.cmd_opts) 44 | 45 | def run(self, options, args): 46 | with self._build_session(options) as session: 47 | format_control = pip.index.FormatControl(set(), set()) 48 | wheel_cache = WheelCache(options.cache_dir, format_control) 49 | requirement_set = RequirementSet( 50 | build_dir=None, 51 | src_dir=None, 52 | download_dir=None, 53 | isolated=options.isolated_mode, 54 | session=session, 55 | wheel_cache=wheel_cache, 56 | ) 57 | for name in args: 58 | requirement_set.add_requirement( 59 | InstallRequirement.from_line( 60 | name, isolated=options.isolated_mode, 61 | wheel_cache=wheel_cache 62 | ) 63 | ) 64 | for filename in options.requirements: 65 | for req in parse_requirements( 66 | filename, 67 | options=options, 68 | session=session, 69 | wheel_cache=wheel_cache): 70 | requirement_set.add_requirement(req) 71 | if not requirement_set.has_requirements: 72 | raise InstallationError( 73 | 'You must give at least one requirement to %(name)s (see ' 74 | '"pip help %(name)s")' % dict(name=self.name) 75 | ) 76 | requirement_set.uninstall(auto_confirm=options.yes) 77 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/progress/helpers.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 Giorgos Verigakis 2 | # 3 | # Permission to use, copy, modify, and distribute this software for any 4 | # purpose with or without fee is hereby granted, provided that the above 5 | # copyright notice and this permission notice appear in all copies. 6 | # 7 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | 15 | from __future__ import print_function 16 | from __future__ import unicode_literals 17 | 18 | 19 | HIDE_CURSOR = '\x1b[?25l' 20 | SHOW_CURSOR = '\x1b[?25h' 21 | 22 | 23 | class WriteMixin(object): 24 | hide_cursor = False 25 | 26 | def __init__(self, message=None, **kwargs): 27 | super(WriteMixin, self).__init__(**kwargs) 28 | self._width = 0 29 | if message: 30 | self.message = message 31 | 32 | if self.file.isatty(): 33 | if self.hide_cursor: 34 | print(HIDE_CURSOR, end='', file=self.file) 35 | print(self.message, end='', file=self.file) 36 | self.file.flush() 37 | 38 | def write(self, s): 39 | if self.file.isatty(): 40 | b = '\b' * self._width 41 | c = s.ljust(self._width) 42 | print(b + c, end='', file=self.file) 43 | self._width = max(self._width, len(s)) 44 | self.file.flush() 45 | 46 | def finish(self): 47 | if self.file.isatty() and self.hide_cursor: 48 | print(SHOW_CURSOR, end='', file=self.file) 49 | 50 | 51 | class WritelnMixin(object): 52 | hide_cursor = False 53 | 54 | def __init__(self, message=None, **kwargs): 55 | super(WritelnMixin, self).__init__(**kwargs) 56 | if message: 57 | self.message = message 58 | 59 | if self.file.isatty() and self.hide_cursor: 60 | print(HIDE_CURSOR, end='', file=self.file) 61 | 62 | def clearln(self): 63 | if self.file.isatty(): 64 | print('\r\x1b[K', end='', file=self.file) 65 | 66 | def writeln(self, line): 67 | if self.file.isatty(): 68 | self.clearln() 69 | print(line, end='', file=self.file) 70 | self.file.flush() 71 | 72 | def finish(self): 73 | if self.file.isatty(): 74 | print(file=self.file) 75 | if self.hide_cursor: 76 | print(SHOW_CURSOR, end='', file=self.file) 77 | 78 | 79 | from signal import signal, SIGINT 80 | from sys import exit 81 | 82 | 83 | class SigIntMixin(object): 84 | """Registers a signal handler that calls finish on SIGINT""" 85 | 86 | def __init__(self, *args, **kwargs): 87 | super(SigIntMixin, self).__init__(*args, **kwargs) 88 | signal(SIGINT, self._sigint_handler) 89 | 90 | def _sigint_handler(self, signum, frame): 91 | self.finish() 92 | exit(0) 93 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/lockfile/mkdirlockfile.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division 2 | 3 | import time 4 | import os 5 | import sys 6 | import errno 7 | 8 | from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout, 9 | AlreadyLocked) 10 | 11 | class MkdirLockFile(LockBase): 12 | """Lock file by creating a directory.""" 13 | def __init__(self, path, threaded=True, timeout=None): 14 | """ 15 | >>> lock = MkdirLockFile('somefile') 16 | >>> lock = MkdirLockFile('somefile', threaded=False) 17 | """ 18 | LockBase.__init__(self, path, threaded, timeout) 19 | # Lock file itself is a directory. Place the unique file name into 20 | # it. 21 | self.unique_name = os.path.join(self.lock_file, 22 | "%s.%s%s" % (self.hostname, 23 | self.tname, 24 | self.pid)) 25 | 26 | def acquire(self, timeout=None): 27 | timeout = timeout is not None and timeout or self.timeout 28 | end_time = time.time() 29 | if timeout is not None and timeout > 0: 30 | end_time += timeout 31 | 32 | if timeout is None: 33 | wait = 0.1 34 | else: 35 | wait = max(0, timeout / 10) 36 | 37 | while True: 38 | try: 39 | os.mkdir(self.lock_file) 40 | except OSError: 41 | err = sys.exc_info()[1] 42 | if err.errno == errno.EEXIST: 43 | # Already locked. 44 | if os.path.exists(self.unique_name): 45 | # Already locked by me. 46 | return 47 | if timeout is not None and time.time() > end_time: 48 | if timeout > 0: 49 | raise LockTimeout("Timeout waiting to acquire" 50 | " lock for %s" % 51 | self.path) 52 | else: 53 | # Someone else has the lock. 54 | raise AlreadyLocked("%s is already locked" % 55 | self.path) 56 | time.sleep(wait) 57 | else: 58 | # Couldn't create the lock for some other reason 59 | raise LockFailed("failed to create %s" % self.lock_file) 60 | else: 61 | open(self.unique_name, "wb").close() 62 | return 63 | 64 | def release(self): 65 | if not self.is_locked(): 66 | raise NotLocked("%s is not locked" % self.path) 67 | elif not os.path.exists(self.unique_name): 68 | raise NotMyLock("%s is locked, but not by me" % self.path) 69 | os.unlink(self.unique_name) 70 | os.rmdir(self.lock_file) 71 | 72 | def is_locked(self): 73 | return os.path.exists(self.lock_file) 74 | 75 | def i_am_locking(self): 76 | return (self.is_locked() and 77 | os.path.exists(self.unique_name)) 78 | 79 | def break_lock(self): 80 | if os.path.exists(self.lock_file): 81 | for name in os.listdir(self.lock_file): 82 | os.unlink(os.path.join(self.lock_file, name)) 83 | os.rmdir(self.lock_file) 84 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/structures.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | requests.structures 5 | ~~~~~~~~~~~~~~~~~~~ 6 | 7 | Data structures that power Requests. 8 | 9 | """ 10 | 11 | import collections 12 | 13 | 14 | class CaseInsensitiveDict(collections.MutableMapping): 15 | """ 16 | A case-insensitive ``dict``-like object. 17 | 18 | Implements all methods and operations of 19 | ``collections.MutableMapping`` as well as dict's ``copy``. Also 20 | provides ``lower_items``. 21 | 22 | All keys are expected to be strings. The structure remembers the 23 | case of the last key to be set, and ``iter(instance)``, 24 | ``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()`` 25 | will contain case-sensitive keys. However, querying and contains 26 | testing is case insensitive:: 27 | 28 | cid = CaseInsensitiveDict() 29 | cid['Accept'] = 'application/json' 30 | cid['aCCEPT'] == 'application/json' # True 31 | list(cid) == ['Accept'] # True 32 | 33 | For example, ``headers['content-encoding']`` will return the 34 | value of a ``'Content-Encoding'`` response header, regardless 35 | of how the header name was originally stored. 36 | 37 | If the constructor, ``.update``, or equality comparison 38 | operations are given keys that have equal ``.lower()``s, the 39 | behavior is undefined. 40 | 41 | """ 42 | def __init__(self, data=None, **kwargs): 43 | self._store = dict() 44 | if data is None: 45 | data = {} 46 | self.update(data, **kwargs) 47 | 48 | def __setitem__(self, key, value): 49 | # Use the lowercased key for lookups, but store the actual 50 | # key alongside the value. 51 | self._store[key.lower()] = (key, value) 52 | 53 | def __getitem__(self, key): 54 | return self._store[key.lower()][1] 55 | 56 | def __delitem__(self, key): 57 | del self._store[key.lower()] 58 | 59 | def __iter__(self): 60 | return (casedkey for casedkey, mappedvalue in self._store.values()) 61 | 62 | def __len__(self): 63 | return len(self._store) 64 | 65 | def lower_items(self): 66 | """Like iteritems(), but with all lowercase keys.""" 67 | return ( 68 | (lowerkey, keyval[1]) 69 | for (lowerkey, keyval) 70 | in self._store.items() 71 | ) 72 | 73 | def __eq__(self, other): 74 | if isinstance(other, collections.Mapping): 75 | other = CaseInsensitiveDict(other) 76 | else: 77 | return NotImplemented 78 | # Compare insensitively 79 | return dict(self.lower_items()) == dict(other.lower_items()) 80 | 81 | # Copy is required 82 | def copy(self): 83 | return CaseInsensitiveDict(self._store.values()) 84 | 85 | def __repr__(self): 86 | return str(dict(self.items())) 87 | 88 | class LookupDict(dict): 89 | """Dictionary lookup object.""" 90 | 91 | def __init__(self, name=None): 92 | self.name = name 93 | super(LookupDict, self).__init__() 94 | 95 | def __repr__(self): 96 | return '' % (self.name) 97 | 98 | def __getitem__(self, key): 99 | # We allow fall-through here, so values default to None 100 | 101 | return self.__dict__.get(key, None) 102 | 103 | def get(self, key, default=None): 104 | return self.__dict__.get(key, default) 105 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/escprober.py: -------------------------------------------------------------------------------- 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 . import constants 29 | from .escsm import (HZSMModel, ISO2022CNSMModel, ISO2022JPSMModel, 30 | ISO2022KRSMModel) 31 | from .charsetprober import CharSetProber 32 | from .codingstatemachine import CodingStateMachine 33 | from .compat import wrap_ord 34 | 35 | 36 | class EscCharSetProber(CharSetProber): 37 | def __init__(self): 38 | CharSetProber.__init__(self) 39 | self._mCodingSM = [ 40 | CodingStateMachine(HZSMModel), 41 | CodingStateMachine(ISO2022CNSMModel), 42 | CodingStateMachine(ISO2022JPSMModel), 43 | CodingStateMachine(ISO2022KRSMModel) 44 | ] 45 | self.reset() 46 | 47 | def reset(self): 48 | CharSetProber.reset(self) 49 | for codingSM in self._mCodingSM: 50 | if not codingSM: 51 | continue 52 | codingSM.active = True 53 | codingSM.reset() 54 | self._mActiveSM = len(self._mCodingSM) 55 | self._mDetectedCharset = None 56 | 57 | def get_charset_name(self): 58 | return self._mDetectedCharset 59 | 60 | def get_confidence(self): 61 | if self._mDetectedCharset: 62 | return 0.99 63 | else: 64 | return 0.00 65 | 66 | def feed(self, aBuf): 67 | for c in aBuf: 68 | # PY3K: aBuf is a byte array, so c is an int, not a byte 69 | for codingSM in self._mCodingSM: 70 | if not codingSM: 71 | continue 72 | if not codingSM.active: 73 | continue 74 | codingState = codingSM.next_state(wrap_ord(c)) 75 | if codingState == constants.eError: 76 | codingSM.active = False 77 | self._mActiveSM -= 1 78 | if self._mActiveSM <= 0: 79 | self._mState = constants.eNotMe 80 | return self.get_state() 81 | elif codingState == constants.eItsMe: 82 | self._mState = constants.eFoundIt 83 | self._mDetectedCharset = codingSM.get_coding_state_machine() # nopep8 84 | return self.get_state() 85 | 86 | return self.get_state() 87 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/status_codes.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from .structures import LookupDict 4 | 5 | _codes = { 6 | 7 | # Informational. 8 | 100: ('continue',), 9 | 101: ('switching_protocols',), 10 | 102: ('processing',), 11 | 103: ('checkpoint',), 12 | 122: ('uri_too_long', 'request_uri_too_long'), 13 | 200: ('ok', 'okay', 'all_ok', 'all_okay', 'all_good', '\\o/', '✓'), 14 | 201: ('created',), 15 | 202: ('accepted',), 16 | 203: ('non_authoritative_info', 'non_authoritative_information'), 17 | 204: ('no_content',), 18 | 205: ('reset_content', 'reset'), 19 | 206: ('partial_content', 'partial'), 20 | 207: ('multi_status', 'multiple_status', 'multi_stati', 'multiple_stati'), 21 | 208: ('already_reported',), 22 | 226: ('im_used',), 23 | 24 | # Redirection. 25 | 300: ('multiple_choices',), 26 | 301: ('moved_permanently', 'moved', '\\o-'), 27 | 302: ('found',), 28 | 303: ('see_other', 'other'), 29 | 304: ('not_modified',), 30 | 305: ('use_proxy',), 31 | 306: ('switch_proxy',), 32 | 307: ('temporary_redirect', 'temporary_moved', 'temporary'), 33 | 308: ('permanent_redirect', 34 | 'resume_incomplete', 'resume',), # These 2 to be removed in 3.0 35 | 36 | # Client Error. 37 | 400: ('bad_request', 'bad'), 38 | 401: ('unauthorized',), 39 | 402: ('payment_required', 'payment'), 40 | 403: ('forbidden',), 41 | 404: ('not_found', '-o-'), 42 | 405: ('method_not_allowed', 'not_allowed'), 43 | 406: ('not_acceptable',), 44 | 407: ('proxy_authentication_required', 'proxy_auth', 'proxy_authentication'), 45 | 408: ('request_timeout', 'timeout'), 46 | 409: ('conflict',), 47 | 410: ('gone',), 48 | 411: ('length_required',), 49 | 412: ('precondition_failed', 'precondition'), 50 | 413: ('request_entity_too_large',), 51 | 414: ('request_uri_too_large',), 52 | 415: ('unsupported_media_type', 'unsupported_media', 'media_type'), 53 | 416: ('requested_range_not_satisfiable', 'requested_range', 'range_not_satisfiable'), 54 | 417: ('expectation_failed',), 55 | 418: ('im_a_teapot', 'teapot', 'i_am_a_teapot'), 56 | 422: ('unprocessable_entity', 'unprocessable'), 57 | 423: ('locked',), 58 | 424: ('failed_dependency', 'dependency'), 59 | 425: ('unordered_collection', 'unordered'), 60 | 426: ('upgrade_required', 'upgrade'), 61 | 428: ('precondition_required', 'precondition'), 62 | 429: ('too_many_requests', 'too_many'), 63 | 431: ('header_fields_too_large', 'fields_too_large'), 64 | 444: ('no_response', 'none'), 65 | 449: ('retry_with', 'retry'), 66 | 450: ('blocked_by_windows_parental_controls', 'parental_controls'), 67 | 451: ('unavailable_for_legal_reasons', 'legal_reasons'), 68 | 499: ('client_closed_request',), 69 | 70 | # Server Error. 71 | 500: ('internal_server_error', 'server_error', '/o\\', '✗'), 72 | 501: ('not_implemented',), 73 | 502: ('bad_gateway',), 74 | 503: ('service_unavailable', 'unavailable'), 75 | 504: ('gateway_timeout',), 76 | 505: ('http_version_not_supported', 'http_version'), 77 | 506: ('variant_also_negotiates',), 78 | 507: ('insufficient_storage',), 79 | 509: ('bandwidth_limit_exceeded', 'bandwidth'), 80 | 510: ('not_extended',), 81 | } 82 | 83 | codes = LookupDict(name='status_codes') 84 | 85 | for (code, titles) in list(_codes.items()): 86 | for title in titles: 87 | setattr(codes, title, code) 88 | if not title.startswith('\\'): 89 | setattr(codes, title.upper(), code) 90 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/sbcsgroupprober.py: -------------------------------------------------------------------------------- 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() 70 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/mbcharsetprober.py: -------------------------------------------------------------------------------- 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 | # Proofpoint, Inc. 13 | # 14 | # This library is free software; you can redistribute it and/or 15 | # modify it under the terms of the GNU Lesser General Public 16 | # License as published by the Free Software Foundation; either 17 | # version 2.1 of the License, or (at your option) any later version. 18 | # 19 | # This library is distributed in the hope that it will be useful, 20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | # Lesser General Public License for more details. 23 | # 24 | # You should have received a copy of the GNU Lesser General Public 25 | # License along with this library; if not, write to the Free Software 26 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 27 | # 02110-1301 USA 28 | ######################### END LICENSE BLOCK ######################### 29 | 30 | import sys 31 | from . import constants 32 | from .charsetprober import CharSetProber 33 | 34 | 35 | class MultiByteCharSetProber(CharSetProber): 36 | def __init__(self): 37 | CharSetProber.__init__(self) 38 | self._mDistributionAnalyzer = None 39 | self._mCodingSM = None 40 | self._mLastChar = [0, 0] 41 | 42 | def reset(self): 43 | CharSetProber.reset(self) 44 | if self._mCodingSM: 45 | self._mCodingSM.reset() 46 | if self._mDistributionAnalyzer: 47 | self._mDistributionAnalyzer.reset() 48 | self._mLastChar = [0, 0] 49 | 50 | def get_charset_name(self): 51 | pass 52 | 53 | def feed(self, aBuf): 54 | aLen = len(aBuf) 55 | for i in range(0, aLen): 56 | codingState = self._mCodingSM.next_state(aBuf[i]) 57 | if codingState == constants.eError: 58 | if constants._debug: 59 | sys.stderr.write(self.get_charset_name() 60 | + ' prober hit error at byte ' + str(i) 61 | + '\n') 62 | self._mState = constants.eNotMe 63 | break 64 | elif codingState == constants.eItsMe: 65 | self._mState = constants.eFoundIt 66 | break 67 | elif codingState == constants.eStart: 68 | charLen = self._mCodingSM.get_current_charlen() 69 | if i == 0: 70 | self._mLastChar[1] = aBuf[0] 71 | self._mDistributionAnalyzer.feed(self._mLastChar, charLen) 72 | else: 73 | self._mDistributionAnalyzer.feed(aBuf[i - 1:i + 1], 74 | charLen) 75 | 76 | self._mLastChar[0] = aBuf[aLen - 1] 77 | 78 | if self.get_state() == constants.eDetecting: 79 | if (self._mDistributionAnalyzer.got_enough_data() and 80 | (self.get_confidence() > constants.SHORTCUT_THRESHOLD)): 81 | self._mState = constants.eFoundIt 82 | 83 | return self.get_state() 84 | 85 | def get_confidence(self): 86 | return self._mDistributionAnalyzer.get_confidence() 87 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/progress/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 Giorgos Verigakis 2 | # 3 | # Permission to use, copy, modify, and distribute this software for any 4 | # purpose with or without fee is hereby granted, provided that the above 5 | # copyright notice and this permission notice appear in all copies. 6 | # 7 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | 15 | from __future__ import division 16 | 17 | from collections import deque 18 | from datetime import timedelta 19 | from math import ceil 20 | from sys import stderr 21 | from time import time 22 | 23 | 24 | __version__ = '1.2' 25 | 26 | 27 | class Infinite(object): 28 | file = stderr 29 | sma_window = 10 30 | 31 | def __init__(self, *args, **kwargs): 32 | self.index = 0 33 | self.start_ts = time() 34 | self._ts = self.start_ts 35 | self._dt = deque(maxlen=self.sma_window) 36 | for key, val in kwargs.items(): 37 | setattr(self, key, val) 38 | 39 | def __getitem__(self, key): 40 | if key.startswith('_'): 41 | return None 42 | return getattr(self, key, None) 43 | 44 | @property 45 | def avg(self): 46 | return sum(self._dt) / len(self._dt) if self._dt else 0 47 | 48 | @property 49 | def elapsed(self): 50 | return int(time() - self.start_ts) 51 | 52 | @property 53 | def elapsed_td(self): 54 | return timedelta(seconds=self.elapsed) 55 | 56 | def update(self): 57 | pass 58 | 59 | def start(self): 60 | pass 61 | 62 | def finish(self): 63 | pass 64 | 65 | def next(self, n=1): 66 | if n > 0: 67 | now = time() 68 | dt = (now - self._ts) / n 69 | self._dt.append(dt) 70 | self._ts = now 71 | 72 | self.index = self.index + n 73 | self.update() 74 | 75 | def iter(self, it): 76 | for x in it: 77 | yield x 78 | self.next() 79 | self.finish() 80 | 81 | 82 | class Progress(Infinite): 83 | def __init__(self, *args, **kwargs): 84 | super(Progress, self).__init__(*args, **kwargs) 85 | self.max = kwargs.get('max', 100) 86 | 87 | @property 88 | def eta(self): 89 | return int(ceil(self.avg * self.remaining)) 90 | 91 | @property 92 | def eta_td(self): 93 | return timedelta(seconds=self.eta) 94 | 95 | @property 96 | def percent(self): 97 | return self.progress * 100 98 | 99 | @property 100 | def progress(self): 101 | return min(1, self.index / self.max) 102 | 103 | @property 104 | def remaining(self): 105 | return max(self.max - self.index, 0) 106 | 107 | def start(self): 108 | self.update() 109 | 110 | def goto(self, index): 111 | incr = index - self.index 112 | self.next(incr) 113 | 114 | def iter(self, it): 115 | try: 116 | self.max = len(it) 117 | except TypeError: 118 | pass 119 | 120 | for x in it: 121 | yield x 122 | self.next() 123 | self.finish() 124 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/treebuilders/__init__.py: -------------------------------------------------------------------------------- 1 | """A collection of modules for building different kinds of tree from 2 | HTML documents. 3 | 4 | To create a treebuilder for a new type of tree, you need to do 5 | implement several things: 6 | 7 | 1) A set of classes for various types of elements: Document, Doctype, 8 | Comment, Element. These must implement the interface of 9 | _base.treebuilders.Node (although comment nodes have a different 10 | signature for their constructor, see treebuilders.etree.Comment) 11 | Textual content may also be implemented as another node type, or not, as 12 | your tree implementation requires. 13 | 14 | 2) A treebuilder object (called TreeBuilder by convention) that 15 | inherits from treebuilders._base.TreeBuilder. This has 4 required attributes: 16 | documentClass - the class to use for the bottommost node of a document 17 | elementClass - the class to use for HTML Elements 18 | commentClass - the class to use for comments 19 | doctypeClass - the class to use for doctypes 20 | It also has one required method: 21 | getDocument - Returns the root node of the complete document tree 22 | 23 | 3) If you wish to run the unit tests, you must also create a 24 | testSerializer method on your treebuilder which accepts a node and 25 | returns a string containing Node and its children serialized according 26 | to the format used in the unittests 27 | """ 28 | 29 | from __future__ import absolute_import, division, unicode_literals 30 | 31 | from ..utils import default_etree 32 | 33 | treeBuilderCache = {} 34 | 35 | 36 | def getTreeBuilder(treeType, implementation=None, **kwargs): 37 | """Get a TreeBuilder class for various types of tree with built-in support 38 | 39 | treeType - the name of the tree type required (case-insensitive). Supported 40 | values are: 41 | 42 | "dom" - A generic builder for DOM implementations, defaulting to 43 | a xml.dom.minidom based implementation. 44 | "etree" - A generic builder for tree implementations exposing an 45 | ElementTree-like interface, defaulting to 46 | xml.etree.cElementTree if available and 47 | xml.etree.ElementTree if not. 48 | "lxml" - A etree-based builder for lxml.etree, handling 49 | limitations of lxml's implementation. 50 | 51 | implementation - (Currently applies to the "etree" and "dom" tree types). A 52 | module implementing the tree type e.g. 53 | xml.etree.ElementTree or xml.etree.cElementTree.""" 54 | 55 | treeType = treeType.lower() 56 | if treeType not in treeBuilderCache: 57 | if treeType == "dom": 58 | from . import dom 59 | # Come up with a sane default (pref. from the stdlib) 60 | if implementation is None: 61 | from xml.dom import minidom 62 | implementation = minidom 63 | # NEVER cache here, caching is done in the dom submodule 64 | return dom.getDomModule(implementation, **kwargs).TreeBuilder 65 | elif treeType == "lxml": 66 | from . import etree_lxml 67 | treeBuilderCache[treeType] = etree_lxml.TreeBuilder 68 | elif treeType == "etree": 69 | from . import etree 70 | if implementation is None: 71 | implementation = default_etree 72 | # NEVER cache here, caching is done in the etree submodule 73 | return etree.getETreeModule(implementation, **kwargs).TreeBuilder 74 | else: 75 | raise ValueError("""Unrecognised treebuilder "%s" """ % treeType) 76 | return treeBuilderCache.get(treeType) 77 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/urllib3/util/connection.py: -------------------------------------------------------------------------------- 1 | import socket 2 | try: 3 | from select import poll, POLLIN 4 | except ImportError: # `poll` doesn't exist on OSX and other platforms 5 | poll = False 6 | try: 7 | from select import select 8 | except ImportError: # `select` doesn't exist on AppEngine. 9 | select = False 10 | 11 | 12 | def is_connection_dropped(conn): # Platform-specific 13 | """ 14 | Returns True if the connection is dropped and should be closed. 15 | 16 | :param conn: 17 | :class:`httplib.HTTPConnection` object. 18 | 19 | Note: For platforms like AppEngine, this will always return ``False`` to 20 | let the platform handle connection recycling transparently for us. 21 | """ 22 | sock = getattr(conn, 'sock', False) 23 | if sock is False: # Platform-specific: AppEngine 24 | return False 25 | if sock is None: # Connection already closed (such as by httplib). 26 | return True 27 | 28 | if not poll: 29 | if not select: # Platform-specific: AppEngine 30 | return False 31 | 32 | try: 33 | return select([sock], [], [], 0.0)[0] 34 | except socket.error: 35 | return True 36 | 37 | # This version is better on platforms that support it. 38 | p = poll() 39 | p.register(sock, POLLIN) 40 | for (fno, ev) in p.poll(0.0): 41 | if fno == sock.fileno(): 42 | # Either data is buffered (bad), or the connection is dropped. 43 | return True 44 | 45 | 46 | # This function is copied from socket.py in the Python 2.7 standard 47 | # library test suite. Added to its signature is only `socket_options`. 48 | def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, 49 | source_address=None, socket_options=None): 50 | """Connect to *address* and return the socket object. 51 | 52 | Convenience function. Connect to *address* (a 2-tuple ``(host, 53 | port)``) and return the socket object. Passing the optional 54 | *timeout* parameter will set the timeout on the socket instance 55 | before attempting to connect. If no *timeout* is supplied, the 56 | global default timeout setting returned by :func:`getdefaulttimeout` 57 | is used. If *source_address* is set it must be a tuple of (host, port) 58 | for the socket to bind as a source address before making the connection. 59 | An host of '' or port 0 tells the OS to use the default. 60 | """ 61 | 62 | host, port = address 63 | err = None 64 | for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM): 65 | af, socktype, proto, canonname, sa = res 66 | sock = None 67 | try: 68 | sock = socket.socket(af, socktype, proto) 69 | 70 | # If provided, set socket level options before connecting. 71 | # This is the only addition urllib3 makes to this function. 72 | _set_socket_options(sock, socket_options) 73 | 74 | if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT: 75 | sock.settimeout(timeout) 76 | if source_address: 77 | sock.bind(source_address) 78 | sock.connect(sa) 79 | return sock 80 | 81 | except socket.error as _: 82 | err = _ 83 | if sock is not None: 84 | sock.close() 85 | sock = None 86 | 87 | if err is not None: 88 | raise err 89 | else: 90 | raise socket.error("getaddrinfo returns an empty list") 91 | 92 | 93 | def _set_socket_options(sock, options): 94 | if options is None: 95 | return 96 | 97 | for opt in options: 98 | sock.setsockopt(*opt) 99 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip-diff: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | """Usage: 5 | pip-diff (--fresh | --stale) [--exclude ...] 6 | pip-diff (-h | --help) 7 | 8 | Options: 9 | -h --help Show this screen. 10 | --fresh List newly added packages. 11 | --stale List removed packages. 12 | """ 13 | import os 14 | from docopt import docopt 15 | from pip.req import parse_requirements 16 | from pip.index import PackageFinder 17 | from pip._vendor.requests import session 18 | 19 | requests = session() 20 | 21 | class Requirements(object): 22 | def __init__(self, reqfile=None): 23 | super(Requirements, self).__init__() 24 | self.path = reqfile 25 | self.requirements = [] 26 | 27 | if reqfile: 28 | self.load(reqfile) 29 | 30 | def __repr__(self): 31 | return ''.format(self.path) 32 | 33 | def load(self, reqfile): 34 | 35 | if not os.path.exists(reqfile): 36 | raise ValueError('The given requirements file does not exist.') 37 | 38 | finder = PackageFinder([], [], session=requests) 39 | for requirement in parse_requirements(reqfile, finder=finder, session=requests): 40 | if requirement.req: 41 | self.requirements.append(requirement.req) 42 | 43 | 44 | def diff(self, requirements, ignore_versions=False, excludes=None): 45 | r1 = self 46 | r2 = requirements 47 | results = {'fresh': [], 'stale': []} 48 | 49 | # Generate fresh packages. 50 | other_reqs = ( 51 | [r.project_name for r in r1.requirements] 52 | if ignore_versions else r1.requirements 53 | ) 54 | 55 | for req in r2.requirements: 56 | r = req.project_name if ignore_versions else req 57 | 58 | if r not in other_reqs and r not in excludes: 59 | results['fresh'].append(req) 60 | 61 | # Generate stale packages. 62 | other_reqs = ( 63 | [r.project_name for r in r2.requirements] 64 | if ignore_versions else r2.requirements 65 | ) 66 | 67 | for req in r1.requirements: 68 | r = req.project_name if ignore_versions else req 69 | 70 | if r not in other_reqs and r not in excludes: 71 | results['stale'].append(req) 72 | 73 | return results 74 | 75 | 76 | 77 | 78 | 79 | def diff(r1, r2, include_fresh=False, include_stale=False, excludes=None): 80 | 81 | include_versions = True if include_stale else False 82 | excludes = excludes if len(excludes) else [] 83 | 84 | try: 85 | r1 = Requirements(r1) 86 | r2 = Requirements(r2) 87 | except ValueError: 88 | print('There was a problem loading the given requirements files.') 89 | exit(os.EX_NOINPUT) 90 | 91 | results = r1.diff(r2, ignore_versions=True, excludes=excludes) 92 | 93 | if include_fresh: 94 | for line in results['fresh']: 95 | print(line.project_name if include_versions else line) 96 | 97 | if include_stale: 98 | for line in results['stale']: 99 | print(line.project_name if include_versions else line) 100 | 101 | 102 | 103 | def main(): 104 | args = docopt(__doc__, version='pip-diff') 105 | 106 | kwargs = { 107 | 'r1': args[''], 108 | 'r2': args[''], 109 | 'include_fresh': args['--fresh'], 110 | 'include_stale': args['--stale'], 111 | 'excludes': args[''] 112 | } 113 | 114 | diff(**kwargs) 115 | 116 | 117 | 118 | if __name__ == '__main__': 119 | main() 120 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/html5lib/utils.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from types import ModuleType 4 | 5 | from pip._vendor.six import text_type 6 | 7 | try: 8 | import xml.etree.cElementTree as default_etree 9 | except ImportError: 10 | import xml.etree.ElementTree as default_etree 11 | 12 | 13 | __all__ = ["default_etree", "MethodDispatcher", "isSurrogatePair", 14 | "surrogatePairToCodepoint", "moduleFactoryFactory", 15 | "supports_lone_surrogates"] 16 | 17 | 18 | # Platforms not supporting lone surrogates (\uD800-\uDFFF) should be 19 | # caught by the below test. In general this would be any platform 20 | # using UTF-16 as its encoding of unicode strings, such as 21 | # Jython. This is because UTF-16 itself is based on the use of such 22 | # surrogates, and there is no mechanism to further escape such 23 | # escapes. 24 | try: 25 | _x = eval('"\\uD800"') 26 | if not isinstance(_x, text_type): 27 | # We need this with u"" because of http://bugs.jython.org/issue2039 28 | _x = eval('u"\\uD800"') 29 | assert isinstance(_x, text_type) 30 | except: 31 | supports_lone_surrogates = False 32 | else: 33 | supports_lone_surrogates = True 34 | 35 | 36 | class MethodDispatcher(dict): 37 | """Dict with 2 special properties: 38 | 39 | On initiation, keys that are lists, sets or tuples are converted to 40 | multiple keys so accessing any one of the items in the original 41 | list-like object returns the matching value 42 | 43 | md = MethodDispatcher({("foo", "bar"):"baz"}) 44 | md["foo"] == "baz" 45 | 46 | A default value which can be set through the default attribute. 47 | """ 48 | 49 | def __init__(self, items=()): 50 | # Using _dictEntries instead of directly assigning to self is about 51 | # twice as fast. Please do careful performance testing before changing 52 | # anything here. 53 | _dictEntries = [] 54 | for name, value in items: 55 | if type(name) in (list, tuple, frozenset, set): 56 | for item in name: 57 | _dictEntries.append((item, value)) 58 | else: 59 | _dictEntries.append((name, value)) 60 | dict.__init__(self, _dictEntries) 61 | self.default = None 62 | 63 | def __getitem__(self, key): 64 | return dict.get(self, key, self.default) 65 | 66 | 67 | # Some utility functions to dal with weirdness around UCS2 vs UCS4 68 | # python builds 69 | 70 | def isSurrogatePair(data): 71 | return (len(data) == 2 and 72 | ord(data[0]) >= 0xD800 and ord(data[0]) <= 0xDBFF and 73 | ord(data[1]) >= 0xDC00 and ord(data[1]) <= 0xDFFF) 74 | 75 | 76 | def surrogatePairToCodepoint(data): 77 | char_val = (0x10000 + (ord(data[0]) - 0xD800) * 0x400 + 78 | (ord(data[1]) - 0xDC00)) 79 | return char_val 80 | 81 | # Module Factory Factory (no, this isn't Java, I know) 82 | # Here to stop this being duplicated all over the place. 83 | 84 | 85 | def moduleFactoryFactory(factory): 86 | moduleCache = {} 87 | 88 | def moduleFactory(baseModule, *args, **kwargs): 89 | if isinstance(ModuleType.__name__, type("")): 90 | name = "_%s_factory" % baseModule.__name__ 91 | else: 92 | name = b"_%s_factory" % baseModule.__name__ 93 | 94 | if name in moduleCache: 95 | return moduleCache[name] 96 | else: 97 | mod = ModuleType(name) 98 | objs = factory(baseModule, *args, **kwargs) 99 | mod.__dict__.update(objs) 100 | moduleCache[name] = mod 101 | return mod 102 | 103 | return moduleFactory 104 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/compat/__init__.py: -------------------------------------------------------------------------------- 1 | """Stuff that differs in different Python versions and platform 2 | distributions.""" 3 | from __future__ import absolute_import, division 4 | 5 | import os 6 | import sys 7 | 8 | from pip._vendor.six import text_type 9 | 10 | try: 11 | from logging.config import dictConfig as logging_dictConfig 12 | except ImportError: 13 | from pip.compat.dictconfig import dictConfig as logging_dictConfig 14 | 15 | try: 16 | import ipaddress 17 | except ImportError: 18 | try: 19 | from pip._vendor import ipaddress 20 | except ImportError: 21 | import ipaddr as ipaddress 22 | ipaddress.ip_address = ipaddress.IPAddress 23 | ipaddress.ip_network = ipaddress.IPNetwork 24 | 25 | 26 | __all__ = [ 27 | "logging_dictConfig", "ipaddress", "uses_pycache", "console_to_str", 28 | "native_str", "get_path_uid", "stdlib_pkgs", "WINDOWS", 29 | ] 30 | 31 | 32 | if sys.version_info >= (3, 4): 33 | uses_pycache = True 34 | from importlib.util import cache_from_source 35 | else: 36 | import imp 37 | uses_pycache = hasattr(imp, 'cache_from_source') 38 | if uses_pycache: 39 | cache_from_source = imp.cache_from_source 40 | else: 41 | cache_from_source = None 42 | 43 | 44 | if sys.version_info >= (3,): 45 | def console_to_str(s): 46 | try: 47 | return s.decode(sys.__stdout__.encoding) 48 | except UnicodeDecodeError: 49 | return s.decode('utf_8') 50 | 51 | def native_str(s, replace=False): 52 | if isinstance(s, bytes): 53 | return s.decode('utf-8', 'replace' if replace else 'strict') 54 | return s 55 | 56 | else: 57 | def console_to_str(s): 58 | return s 59 | 60 | def native_str(s, replace=False): 61 | # Replace is ignored -- unicode to UTF-8 can't fail 62 | if isinstance(s, text_type): 63 | return s.encode('utf-8') 64 | return s 65 | 66 | 67 | def total_seconds(td): 68 | if hasattr(td, "total_seconds"): 69 | return td.total_seconds() 70 | else: 71 | val = td.microseconds + (td.seconds + td.days * 24 * 3600) * 10 ** 6 72 | return val / 10 ** 6 73 | 74 | 75 | def get_path_uid(path): 76 | """ 77 | Return path's uid. 78 | 79 | Does not follow symlinks: 80 | https://github.com/pypa/pip/pull/935#discussion_r5307003 81 | 82 | Placed this function in compat due to differences on AIX and 83 | Jython, that should eventually go away. 84 | 85 | :raises OSError: When path is a symlink or can't be read. 86 | """ 87 | if hasattr(os, 'O_NOFOLLOW'): 88 | fd = os.open(path, os.O_RDONLY | os.O_NOFOLLOW) 89 | file_uid = os.fstat(fd).st_uid 90 | os.close(fd) 91 | else: # AIX and Jython 92 | # WARNING: time of check vulnerabity, but best we can do w/o NOFOLLOW 93 | if not os.path.islink(path): 94 | # older versions of Jython don't have `os.fstat` 95 | file_uid = os.stat(path).st_uid 96 | else: 97 | # raise OSError for parity with os.O_NOFOLLOW above 98 | raise OSError( 99 | "%s is a symlink; Will not return uid for symlinks" % path 100 | ) 101 | return file_uid 102 | 103 | 104 | # packages in the stdlib that may have installation metadata, but should not be 105 | # considered 'installed'. this theoretically could be determined based on 106 | # dist.location (py27:`sysconfig.get_paths()['stdlib']`, 107 | # py26:sysconfig.get_config_vars('LIBDEST')), but fear platform variation may 108 | # make this ineffective, so hard-coding 109 | stdlib_pkgs = ['python', 'wsgiref'] 110 | if sys.version_info >= (2, 7): 111 | stdlib_pkgs.extend(['argparse']) 112 | 113 | 114 | # windows detection, covers cpython and ironpython 115 | WINDOWS = (sys.platform.startswith("win") or 116 | (sys.platform == 'cli' and os.name == 'nt')) 117 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/utils/logging.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | import contextlib 4 | import logging 5 | import logging.handlers 6 | import os 7 | 8 | try: 9 | import threading 10 | except ImportError: 11 | import dummy_threading as threading 12 | 13 | from pip.compat import WINDOWS 14 | from pip.utils import ensure_dir 15 | 16 | try: 17 | from pip._vendor import colorama 18 | # Lots of different errors can come from this, including SystemError and 19 | # ImportError. 20 | except Exception: 21 | colorama = None 22 | 23 | 24 | _log_state = threading.local() 25 | _log_state.indentation = 0 26 | 27 | 28 | @contextlib.contextmanager 29 | def indent_log(num=2): 30 | """ 31 | A context manager which will cause the log output to be indented for any 32 | log messages emited inside it. 33 | """ 34 | _log_state.indentation += num 35 | try: 36 | yield 37 | finally: 38 | _log_state.indentation -= num 39 | 40 | 41 | def get_indentation(): 42 | return getattr(_log_state, 'indentation', 0) 43 | 44 | 45 | class IndentingFormatter(logging.Formatter): 46 | 47 | def format(self, record): 48 | """ 49 | Calls the standard formatter, but will indent all of the log messages 50 | by our current indentation level. 51 | """ 52 | formatted = logging.Formatter.format(self, record) 53 | formatted = "".join([ 54 | (" " * get_indentation()) + line 55 | for line in formatted.splitlines(True) 56 | ]) 57 | return formatted 58 | 59 | 60 | def _color_wrap(*colors): 61 | def wrapped(inp): 62 | return "".join(list(colors) + [inp, colorama.Style.RESET_ALL]) 63 | return wrapped 64 | 65 | 66 | class ColorizedStreamHandler(logging.StreamHandler): 67 | 68 | # Don't build up a list of colors if we don't have colorama 69 | if colorama: 70 | COLORS = [ 71 | # This needs to be in order from highest logging level to lowest. 72 | (logging.ERROR, _color_wrap(colorama.Fore.RED)), 73 | (logging.WARNING, _color_wrap(colorama.Fore.YELLOW)), 74 | ] 75 | else: 76 | COLORS = [] 77 | 78 | def __init__(self, stream=None): 79 | logging.StreamHandler.__init__(self, stream) 80 | 81 | if WINDOWS and colorama: 82 | self.stream = colorama.AnsiToWin32(self.stream) 83 | 84 | def should_color(self): 85 | # Don't colorize things if we do not have colorama 86 | if not colorama: 87 | return False 88 | 89 | real_stream = ( 90 | self.stream if not isinstance(self.stream, colorama.AnsiToWin32) 91 | else self.stream.wrapped 92 | ) 93 | 94 | # If the stream is a tty we should color it 95 | if hasattr(real_stream, "isatty") and real_stream.isatty(): 96 | return True 97 | 98 | # If we have an ASNI term we should color it 99 | if os.environ.get("TERM") == "ANSI": 100 | return True 101 | 102 | # If anything else we should not color it 103 | return False 104 | 105 | def format(self, record): 106 | msg = logging.StreamHandler.format(self, record) 107 | 108 | if self.should_color(): 109 | for level, color in self.COLORS: 110 | if record.levelno >= level: 111 | msg = color(msg) 112 | break 113 | 114 | return msg 115 | 116 | 117 | class BetterRotatingFileHandler(logging.handlers.RotatingFileHandler): 118 | 119 | def _open(self): 120 | ensure_dir(os.path.dirname(self.baseFilename)) 121 | return logging.handlers.RotatingFileHandler._open(self) 122 | 123 | 124 | class MaxLevelFilter(logging.Filter): 125 | 126 | def __init__(self, level): 127 | self.level = level 128 | 129 | def filter(self, record): 130 | return record.levelno < self.level 131 | -------------------------------------------------------------------------------- /vendor/pip-pop/pip/_vendor/requests/packages/chardet/eucjpprober.py: -------------------------------------------------------------------------------- 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 | import sys 29 | from . import constants 30 | from .mbcharsetprober import MultiByteCharSetProber 31 | from .codingstatemachine import CodingStateMachine 32 | from .chardistribution import EUCJPDistributionAnalysis 33 | from .jpcntx import EUCJPContextAnalysis 34 | from .mbcssm import EUCJPSMModel 35 | 36 | 37 | class EUCJPProber(MultiByteCharSetProber): 38 | def __init__(self): 39 | MultiByteCharSetProber.__init__(self) 40 | self._mCodingSM = CodingStateMachine(EUCJPSMModel) 41 | self._mDistributionAnalyzer = EUCJPDistributionAnalysis() 42 | self._mContextAnalyzer = EUCJPContextAnalysis() 43 | self.reset() 44 | 45 | def reset(self): 46 | MultiByteCharSetProber.reset(self) 47 | self._mContextAnalyzer.reset() 48 | 49 | def get_charset_name(self): 50 | return "EUC-JP" 51 | 52 | def feed(self, aBuf): 53 | aLen = len(aBuf) 54 | for i in range(0, aLen): 55 | # PY3K: aBuf is a byte array, so aBuf[i] is an int, not a byte 56 | codingState = self._mCodingSM.next_state(aBuf[i]) 57 | if codingState == constants.eError: 58 | if constants._debug: 59 | sys.stderr.write(self.get_charset_name() 60 | + ' prober hit error at byte ' + str(i) 61 | + '\n') 62 | self._mState = constants.eNotMe 63 | break 64 | elif codingState == constants.eItsMe: 65 | self._mState = constants.eFoundIt 66 | break 67 | elif codingState == constants.eStart: 68 | charLen = self._mCodingSM.get_current_charlen() 69 | if i == 0: 70 | self._mLastChar[1] = aBuf[0] 71 | self._mContextAnalyzer.feed(self._mLastChar, charLen) 72 | self._mDistributionAnalyzer.feed(self._mLastChar, charLen) 73 | else: 74 | self._mContextAnalyzer.feed(aBuf[i - 1:i + 1], charLen) 75 | self._mDistributionAnalyzer.feed(aBuf[i - 1:i + 1], 76 | charLen) 77 | 78 | self._mLastChar[0] = aBuf[aLen - 1] 79 | 80 | if self.get_state() == constants.eDetecting: 81 | if (self._mContextAnalyzer.got_enough_data() and 82 | (self.get_confidence() > constants.SHORTCUT_THRESHOLD)): 83 | self._mState = constants.eFoundIt 84 | 85 | return self.get_state() 86 | 87 | def get_confidence(self): 88 | contxtCf = self._mContextAnalyzer.get_confidence() 89 | distribCf = self._mDistributionAnalyzer.get_confidence() 90 | return max(contxtCf, distribCf) 91 | --------------------------------------------------------------------------------