You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@senssoft.apache.org by ar...@apache.org on 2016/12/16 17:10:55 UTC
[37/58] [abbrv] [partial] incubator-senssoft-tap git commit: Fixed
.gitignore file
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.py b/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.py
deleted file mode 100644
index 7389a73..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.py
+++ /dev/null
@@ -1,39 +0,0 @@
-"""
-The cache object API for implementing caches. The default is a thread
-safe in-memory dictionary.
-"""
-from threading import Lock
-
-
-class BaseCache(object):
-
- def get(self, key):
- raise NotImplemented()
-
- def set(self, key, value):
- raise NotImplemented()
-
- def delete(self, key):
- raise NotImplemented()
-
- def close(self):
- pass
-
-
-class DictCache(BaseCache):
-
- def __init__(self, init_dict=None):
- self.lock = Lock()
- self.data = init_dict or {}
-
- def get(self, key):
- return self.data.get(key, None)
-
- def set(self, key, value):
- with self.lock:
- self.data.update({key: value})
-
- def delete(self, key):
- with self.lock:
- if key in self.data:
- self.data.pop(key)
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/__init__.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/__init__.py b/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/__init__.py
deleted file mode 100644
index f9e66a1..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/__init__.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from textwrap import dedent
-
-try:
- from .file_cache import FileCache
-except ImportError:
- notice = dedent('''
- NOTE: In order to use the FileCache you must have
- lockfile installed. You can install it via pip:
- pip install lockfile
- ''')
- print(notice)
-
-
-try:
- import redis
- from .redis_cache import RedisCache
-except ImportError:
- pass
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py b/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py
deleted file mode 100644
index b77728f..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py
+++ /dev/null
@@ -1,116 +0,0 @@
-import hashlib
-import os
-
-from pip._vendor.lockfile import LockFile
-from pip._vendor.lockfile.mkdirlockfile import MkdirLockFile
-
-from ..cache import BaseCache
-from ..controller import CacheController
-
-
-def _secure_open_write(filename, fmode):
- # We only want to write to this file, so open it in write only mode
- flags = os.O_WRONLY
-
- # os.O_CREAT | os.O_EXCL will fail if the file already exists, so we only
- # will open *new* files.
- # We specify this because we want to ensure that the mode we pass is the
- # mode of the file.
- flags |= os.O_CREAT | os.O_EXCL
-
- # Do not follow symlinks to prevent someone from making a symlink that
- # we follow and insecurely open a cache file.
- if hasattr(os, "O_NOFOLLOW"):
- flags |= os.O_NOFOLLOW
-
- # On Windows we'll mark this file as binary
- if hasattr(os, "O_BINARY"):
- flags |= os.O_BINARY
-
- # Before we open our file, we want to delete any existing file that is
- # there
- try:
- os.remove(filename)
- except (IOError, OSError):
- # The file must not exist already, so we can just skip ahead to opening
- pass
-
- # Open our file, the use of os.O_CREAT | os.O_EXCL will ensure that if a
- # race condition happens between the os.remove and this line, that an
- # error will be raised. Because we utilize a lockfile this should only
- # happen if someone is attempting to attack us.
- fd = os.open(filename, flags, fmode)
- try:
- return os.fdopen(fd, "wb")
- except:
- # An error occurred wrapping our FD in a file object
- os.close(fd)
- raise
-
-
-class FileCache(BaseCache):
- def __init__(self, directory, forever=False, filemode=0o0600,
- dirmode=0o0700, use_dir_lock=None, lock_class=None):
-
- if use_dir_lock is not None and lock_class is not None:
- raise ValueError("Cannot use use_dir_lock and lock_class together")
-
- if use_dir_lock:
- lock_class = MkdirLockFile
-
- if lock_class is None:
- lock_class = LockFile
-
- self.directory = directory
- self.forever = forever
- self.filemode = filemode
- self.dirmode = dirmode
- self.lock_class = lock_class
-
-
- @staticmethod
- def encode(x):
- return hashlib.sha224(x.encode()).hexdigest()
-
- def _fn(self, name):
- # NOTE: This method should not change as some may depend on it.
- # See: https://github.com/ionrock/cachecontrol/issues/63
- hashed = self.encode(name)
- parts = list(hashed[:5]) + [hashed]
- return os.path.join(self.directory, *parts)
-
- def get(self, key):
- name = self._fn(key)
- if not os.path.exists(name):
- return None
-
- with open(name, 'rb') as fh:
- return fh.read()
-
- def set(self, key, value):
- name = self._fn(key)
-
- # Make sure the directory exists
- try:
- os.makedirs(os.path.dirname(name), self.dirmode)
- except (IOError, OSError):
- pass
-
- with self.lock_class(name) as lock:
- # Write our actual file
- with _secure_open_write(lock.path, self.filemode) as fh:
- fh.write(value)
-
- def delete(self, key):
- name = self._fn(key)
- if not self.forever:
- os.remove(name)
-
-
-def url_to_file_path(url, filecache):
- """Return the file cache path based on the URL.
-
- This does not ensure the file exists!
- """
- key = CacheController.cache_url(url)
- return filecache._fn(key)
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py b/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py
deleted file mode 100644
index 9f5d55f..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py
+++ /dev/null
@@ -1,41 +0,0 @@
-from __future__ import division
-
-from datetime import datetime
-
-
-def total_seconds(td):
- """Python 2.6 compatability"""
- if hasattr(td, 'total_seconds'):
- return td.total_seconds()
-
- ms = td.microseconds
- secs = (td.seconds + td.days * 24 * 3600)
- return (ms + secs * 10**6) / 10**6
-
-
-class RedisCache(object):
-
- def __init__(self, conn):
- self.conn = conn
-
- def get(self, key):
- return self.conn.get(key)
-
- def set(self, key, value, expires=None):
- if not expires:
- self.conn.set(key, value)
- else:
- expires = expires - datetime.now()
- self.conn.setex(key, total_seconds(expires), value)
-
- def delete(self, key):
- self.conn.delete(key)
-
- def clear(self):
- """Helper for clearing all the keys in a database. Use with
- caution!"""
- for key in self.conn.keys():
- self.conn.delete(key)
-
- def close(self):
- self.conn.disconnect()
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/compat.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/compat.py b/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/compat.py
deleted file mode 100644
index 018e6ac..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/compat.py
+++ /dev/null
@@ -1,20 +0,0 @@
-try:
- from urllib.parse import urljoin
-except ImportError:
- from urlparse import urljoin
-
-
-try:
- import cPickle as pickle
-except ImportError:
- import pickle
-
-
-from pip._vendor.requests.packages.urllib3.response import HTTPResponse
-from pip._vendor.requests.packages.urllib3.util import is_fp_closed
-
-# Replicate some six behaviour
-try:
- text_type = (unicode,)
-except NameError:
- text_type = (str,)
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py b/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py
deleted file mode 100644
index 5eb961f..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py
+++ /dev/null
@@ -1,353 +0,0 @@
-"""
-The httplib2 algorithms ported for use with requests.
-"""
-import logging
-import re
-import calendar
-import time
-from email.utils import parsedate_tz
-
-from pip._vendor.requests.structures import CaseInsensitiveDict
-
-from .cache import DictCache
-from .serialize import Serializer
-
-
-logger = logging.getLogger(__name__)
-
-URI = re.compile(r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?")
-
-
-def parse_uri(uri):
- """Parses a URI using the regex given in Appendix B of RFC 3986.
-
- (scheme, authority, path, query, fragment) = parse_uri(uri)
- """
- groups = URI.match(uri).groups()
- return (groups[1], groups[3], groups[4], groups[6], groups[8])
-
-
-class CacheController(object):
- """An interface to see if request should cached or not.
- """
- def __init__(self, cache=None, cache_etags=True, serializer=None):
- self.cache = cache or DictCache()
- self.cache_etags = cache_etags
- self.serializer = serializer or Serializer()
-
- @classmethod
- def _urlnorm(cls, uri):
- """Normalize the URL to create a safe key for the cache"""
- (scheme, authority, path, query, fragment) = parse_uri(uri)
- if not scheme or not authority:
- raise Exception("Only absolute URIs are allowed. uri = %s" % uri)
-
- scheme = scheme.lower()
- authority = authority.lower()
-
- if not path:
- path = "/"
-
- # Could do syntax based normalization of the URI before
- # computing the digest. See Section 6.2.2 of Std 66.
- request_uri = query and "?".join([path, query]) or path
- defrag_uri = scheme + "://" + authority + request_uri
-
- return defrag_uri
-
- @classmethod
- def cache_url(cls, uri):
- return cls._urlnorm(uri)
-
- def parse_cache_control(self, headers):
- """
- Parse the cache control headers returning a dictionary with values
- for the different directives.
- """
- retval = {}
-
- cc_header = 'cache-control'
- if 'Cache-Control' in headers:
- cc_header = 'Cache-Control'
-
- if cc_header in headers:
- parts = headers[cc_header].split(',')
- parts_with_args = [
- tuple([x.strip().lower() for x in part.split("=", 1)])
- for part in parts if -1 != part.find("=")
- ]
- parts_wo_args = [
- (name.strip().lower(), 1)
- for name in parts if -1 == name.find("=")
- ]
- retval = dict(parts_with_args + parts_wo_args)
- return retval
-
- def cached_request(self, request):
- """
- Return a cached response if it exists in the cache, otherwise
- return False.
- """
- cache_url = self.cache_url(request.url)
- logger.debug('Looking up "%s" in the cache', cache_url)
- cc = self.parse_cache_control(request.headers)
-
- # Bail out if the request insists on fresh data
- if 'no-cache' in cc:
- logger.debug('Request header has "no-cache", cache bypassed')
- return False
-
- if 'max-age' in cc and cc['max-age'] == 0:
- logger.debug('Request header has "max_age" as 0, cache bypassed')
- return False
-
- # Request allows serving from the cache, let's see if we find something
- cache_data = self.cache.get(cache_url)
- if cache_data is None:
- logger.debug('No cache entry available')
- return False
-
- # Check whether it can be deserialized
- resp = self.serializer.loads(request, cache_data)
- if not resp:
- logger.warning('Cache entry deserialization failed, entry ignored')
- return False
-
- # If we have a cached 301, return it immediately. We don't
- # need to test our response for other headers b/c it is
- # intrinsically "cacheable" as it is Permanent.
- # See:
- # https://tools.ietf.org/html/rfc7231#section-6.4.2
- #
- # Client can try to refresh the value by repeating the request
- # with cache busting headers as usual (ie no-cache).
- if resp.status == 301:
- msg = ('Returning cached "301 Moved Permanently" response '
- '(ignoring date and etag information)')
- logger.debug(msg)
- return resp
-
- headers = CaseInsensitiveDict(resp.headers)
- if not headers or 'date' not in headers:
- if 'etag' not in headers:
- # Without date or etag, the cached response can never be used
- # and should be deleted.
- logger.debug('Purging cached response: no date or etag')
- self.cache.delete(cache_url)
- logger.debug('Ignoring cached response: no date')
- return False
-
- now = time.time()
- date = calendar.timegm(
- parsedate_tz(headers['date'])
- )
- current_age = max(0, now - date)
- logger.debug('Current age based on date: %i', current_age)
-
- # TODO: There is an assumption that the result will be a
- # urllib3 response object. This may not be best since we
- # could probably avoid instantiating or constructing the
- # response until we know we need it.
- resp_cc = self.parse_cache_control(headers)
-
- # determine freshness
- freshness_lifetime = 0
-
- # Check the max-age pragma in the cache control header
- if 'max-age' in resp_cc and resp_cc['max-age'].isdigit():
- freshness_lifetime = int(resp_cc['max-age'])
- logger.debug('Freshness lifetime from max-age: %i',
- freshness_lifetime)
-
- # If there isn't a max-age, check for an expires header
- elif 'expires' in headers:
- expires = parsedate_tz(headers['expires'])
- if expires is not None:
- expire_time = calendar.timegm(expires) - date
- freshness_lifetime = max(0, expire_time)
- logger.debug("Freshness lifetime from expires: %i",
- freshness_lifetime)
-
- # Determine if we are setting freshness limit in the
- # request. Note, this overrides what was in the response.
- if 'max-age' in cc:
- try:
- freshness_lifetime = int(cc['max-age'])
- logger.debug('Freshness lifetime from request max-age: %i',
- freshness_lifetime)
- except ValueError:
- freshness_lifetime = 0
-
- if 'min-fresh' in cc:
- try:
- min_fresh = int(cc['min-fresh'])
- except ValueError:
- min_fresh = 0
- # adjust our current age by our min fresh
- current_age += min_fresh
- logger.debug('Adjusted current age from min-fresh: %i',
- current_age)
-
- # Return entry if it is fresh enough
- if freshness_lifetime > current_age:
- logger.debug('The response is "fresh", returning cached response')
- logger.debug('%i > %i', freshness_lifetime, current_age)
- return resp
-
- # we're not fresh. If we don't have an Etag, clear it out
- if 'etag' not in headers:
- logger.debug(
- 'The cached response is "stale" with no etag, purging'
- )
- self.cache.delete(cache_url)
-
- # return the original handler
- return False
-
- def conditional_headers(self, request):
- cache_url = self.cache_url(request.url)
- resp = self.serializer.loads(request, self.cache.get(cache_url))
- new_headers = {}
-
- if resp:
- headers = CaseInsensitiveDict(resp.headers)
-
- if 'etag' in headers:
- new_headers['If-None-Match'] = headers['ETag']
-
- if 'last-modified' in headers:
- new_headers['If-Modified-Since'] = headers['Last-Modified']
-
- return new_headers
-
- def cache_response(self, request, response, body=None):
- """
- Algorithm for caching requests.
-
- This assumes a requests Response object.
- """
- # From httplib2: Don't cache 206's since we aren't going to
- # handle byte range requests
- cacheable_status_codes = [200, 203, 300, 301]
- if response.status not in cacheable_status_codes:
- logger.debug(
- 'Status code %s not in %s',
- response.status,
- cacheable_status_codes
- )
- return
-
- response_headers = CaseInsensitiveDict(response.headers)
-
- # If we've been given a body, our response has a Content-Length, that
- # Content-Length is valid then we can check to see if the body we've
- # been given matches the expected size, and if it doesn't we'll just
- # skip trying to cache it.
- if (body is not None and
- "content-length" in response_headers and
- response_headers["content-length"].isdigit() and
- int(response_headers["content-length"]) != len(body)):
- return
-
- cc_req = self.parse_cache_control(request.headers)
- cc = self.parse_cache_control(response_headers)
-
- cache_url = self.cache_url(request.url)
- logger.debug('Updating cache with response from "%s"', cache_url)
-
- # Delete it from the cache if we happen to have it stored there
- no_store = False
- if cc.get('no-store'):
- no_store = True
- logger.debug('Response header has "no-store"')
- if cc_req.get('no-store'):
- no_store = True
- logger.debug('Request header has "no-store"')
- if no_store and self.cache.get(cache_url):
- logger.debug('Purging existing cache entry to honor "no-store"')
- self.cache.delete(cache_url)
-
- # If we've been given an etag, then keep the response
- if self.cache_etags and 'etag' in response_headers:
- logger.debug('Caching due to etag')
- self.cache.set(
- cache_url,
- self.serializer.dumps(request, response, body=body),
- )
-
- # Add to the cache any 301s. We do this before looking that
- # the Date headers.
- elif response.status == 301:
- logger.debug('Caching permanant redirect')
- self.cache.set(
- cache_url,
- self.serializer.dumps(request, response)
- )
-
- # Add to the cache if the response headers demand it. If there
- # is no date header then we can't do anything about expiring
- # the cache.
- elif 'date' in response_headers:
- # cache when there is a max-age > 0
- if cc and cc.get('max-age'):
- if cc['max-age'].isdigit() and int(cc['max-age']) > 0:
- logger.debug('Caching b/c date exists and max-age > 0')
- self.cache.set(
- cache_url,
- self.serializer.dumps(request, response, body=body),
- )
-
- # If the request can expire, it means we should cache it
- # in the meantime.
- elif 'expires' in response_headers:
- if response_headers['expires']:
- logger.debug('Caching b/c of expires header')
- self.cache.set(
- cache_url,
- self.serializer.dumps(request, response, body=body),
- )
-
- def update_cached_response(self, request, response):
- """On a 304 we will get a new set of headers that we want to
- update our cached value with, assuming we have one.
-
- This should only ever be called when we've sent an ETag and
- gotten a 304 as the response.
- """
- cache_url = self.cache_url(request.url)
-
- cached_response = self.serializer.loads(
- request,
- self.cache.get(cache_url)
- )
-
- if not cached_response:
- # we didn't have a cached response
- return response
-
- # Lets update our headers with the headers from the new request:
- # http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-26#section-4.1
- #
- # The server isn't supposed to send headers that would make
- # the cached body invalid. But... just in case, we'll be sure
- # to strip out ones we know that might be problmatic due to
- # typical assumptions.
- excluded_headers = [
- "content-length",
- ]
-
- cached_response.headers.update(
- dict((k, v) for k, v in response.headers.items()
- if k.lower() not in excluded_headers)
- )
-
- # we want a 200 b/c we have content via the cache
- cached_response.status = 200
-
- # update our cache
- self.cache.set(
- cache_url,
- self.serializer.dumps(request, cached_response),
- )
-
- return cached_response
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py b/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py
deleted file mode 100644
index f1e1ce0..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py
+++ /dev/null
@@ -1,78 +0,0 @@
-from io import BytesIO
-
-
-class CallbackFileWrapper(object):
- """
- Small wrapper around a fp object which will tee everything read into a
- buffer, and when that file is closed it will execute a callback with the
- contents of that buffer.
-
- All attributes are proxied to the underlying file object.
-
- This class uses members with a double underscore (__) leading prefix so as
- not to accidentally shadow an attribute.
- """
-
- def __init__(self, fp, callback):
- self.__buf = BytesIO()
- self.__fp = fp
- self.__callback = callback
-
- def __getattr__(self, name):
- # The vaguaries of garbage collection means that self.__fp is
- # not always set. By using __getattribute__ and the private
- # name[0] allows looking up the attribute value and raising an
- # AttributeError when it doesn't exist. This stop thigns from
- # infinitely recursing calls to getattr in the case where
- # self.__fp hasn't been set.
- #
- # [0] https://docs.python.org/2/reference/expressions.html#atom-identifiers
- fp = self.__getattribute__('_CallbackFileWrapper__fp')
- return getattr(fp, name)
-
- def __is_fp_closed(self):
- try:
- return self.__fp.fp is None
- except AttributeError:
- pass
-
- try:
- return self.__fp.closed
- except AttributeError:
- pass
-
- # We just don't cache it then.
- # TODO: Add some logging here...
- return False
-
- def _close(self):
- if self.__callback:
- self.__callback(self.__buf.getvalue())
-
- # We assign this to None here, because otherwise we can get into
- # really tricky problems where the CPython interpreter dead locks
- # because the callback is holding a reference to something which
- # has a __del__ method. Setting this to None breaks the cycle
- # and allows the garbage collector to do it's thing normally.
- self.__callback = None
-
- def read(self, amt=None):
- data = self.__fp.read(amt)
- self.__buf.write(data)
- if self.__is_fp_closed():
- self._close()
-
- return data
-
- def _safe_read(self, amt):
- data = self.__fp._safe_read(amt)
- if amt == 2 and data == b'\r\n':
- # urllib executes this read to toss the CRLF at the end
- # of the chunk.
- return data
-
- self.__buf.write(data)
- if self.__is_fp_closed():
- self._close()
-
- return data
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.py b/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.py
deleted file mode 100644
index 94715a4..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.py
+++ /dev/null
@@ -1,138 +0,0 @@
-import calendar
-import time
-
-from email.utils import formatdate, parsedate, parsedate_tz
-
-from datetime import datetime, timedelta
-
-TIME_FMT = "%a, %d %b %Y %H:%M:%S GMT"
-
-
-def expire_after(delta, date=None):
- date = date or datetime.now()
- return date + delta
-
-
-def datetime_to_header(dt):
- return formatdate(calendar.timegm(dt.timetuple()))
-
-
-class BaseHeuristic(object):
-
- def warning(self, response):
- """
- Return a valid 1xx warning header value describing the cache
- adjustments.
-
- The response is provided too allow warnings like 113
- http://tools.ietf.org/html/rfc7234#section-5.5.4 where we need
- to explicitly say response is over 24 hours old.
- """
- return '110 - "Response is Stale"'
-
- def update_headers(self, response):
- """Update the response headers with any new headers.
-
- NOTE: This SHOULD always include some Warning header to
- signify that the response was cached by the client, not
- by way of the provided headers.
- """
- return {}
-
- def apply(self, response):
- updated_headers = self.update_headers(response)
-
- if updated_headers:
- response.headers.update(updated_headers)
- warning_header_value = self.warning(response)
- if warning_header_value is not None:
- response.headers.update({'Warning': warning_header_value})
-
- return response
-
-
-class OneDayCache(BaseHeuristic):
- """
- Cache the response by providing an expires 1 day in the
- future.
- """
- def update_headers(self, response):
- headers = {}
-
- if 'expires' not in response.headers:
- date = parsedate(response.headers['date'])
- expires = expire_after(timedelta(days=1),
- date=datetime(*date[:6]))
- headers['expires'] = datetime_to_header(expires)
- headers['cache-control'] = 'public'
- return headers
-
-
-class ExpiresAfter(BaseHeuristic):
- """
- Cache **all** requests for a defined time period.
- """
-
- def __init__(self, **kw):
- self.delta = timedelta(**kw)
-
- def update_headers(self, response):
- expires = expire_after(self.delta)
- return {
- 'expires': datetime_to_header(expires),
- 'cache-control': 'public',
- }
-
- def warning(self, response):
- tmpl = '110 - Automatically cached for %s. Response might be stale'
- return tmpl % self.delta
-
-
-class LastModified(BaseHeuristic):
- """
- If there is no Expires header already, fall back on Last-Modified
- using the heuristic from
- http://tools.ietf.org/html/rfc7234#section-4.2.2
- to calculate a reasonable value.
-
- Firefox also does something like this per
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching_FAQ
- http://lxr.mozilla.org/mozilla-release/source/netwerk/protocol/http/nsHttpResponseHead.cpp#397
- Unlike mozilla we limit this to 24-hr.
- """
- cacheable_by_default_statuses = set([
- 200, 203, 204, 206, 300, 301, 404, 405, 410, 414, 501
- ])
-
- def update_headers(self, resp):
- headers = resp.headers
-
- if 'expires' in headers:
- return {}
-
- if 'cache-control' in headers and headers['cache-control'] != 'public':
- return {}
-
- if resp.status not in self.cacheable_by_default_statuses:
- return {}
-
- if 'date' not in headers or 'last-modified' not in headers:
- return {}
-
- date = calendar.timegm(parsedate_tz(headers['date']))
- last_modified = parsedate(headers['last-modified'])
- if date is None or last_modified is None:
- return {}
-
- now = time.time()
- current_age = max(0, now - date)
- delta = date - calendar.timegm(last_modified)
- freshness_lifetime = max(0, min(delta / 10, 24 * 3600))
- if freshness_lifetime <= current_age:
- return {}
-
- expires = date + freshness_lifetime
- return {'expires': time.strftime(TIME_FMT, time.gmtime(expires))}
-
- def warning(self, resp):
- return None
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py b/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py
deleted file mode 100644
index 8f9c589..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py
+++ /dev/null
@@ -1,196 +0,0 @@
-import base64
-import io
-import json
-import zlib
-
-from pip._vendor.requests.structures import CaseInsensitiveDict
-
-from .compat import HTTPResponse, pickle, text_type
-
-
-def _b64_encode_bytes(b):
- return base64.b64encode(b).decode("ascii")
-
-
-def _b64_encode_str(s):
- return _b64_encode_bytes(s.encode("utf8"))
-
-
-def _b64_encode(s):
- if isinstance(s, text_type):
- return _b64_encode_str(s)
- return _b64_encode_bytes(s)
-
-
-def _b64_decode_bytes(b):
- return base64.b64decode(b.encode("ascii"))
-
-
-def _b64_decode_str(s):
- return _b64_decode_bytes(s).decode("utf8")
-
-
-class Serializer(object):
-
- def dumps(self, request, response, body=None):
- response_headers = CaseInsensitiveDict(response.headers)
-
- if body is None:
- body = response.read(decode_content=False)
-
- # NOTE: 99% sure this is dead code. I'm only leaving it
- # here b/c I don't have a test yet to prove
- # it. Basically, before using
- # `cachecontrol.filewrapper.CallbackFileWrapper`,
- # this made an effort to reset the file handle. The
- # `CallbackFileWrapper` short circuits this code by
- # setting the body as the content is consumed, the
- # result being a `body` argument is *always* passed
- # into cache_response, and in turn,
- # `Serializer.dump`.
- response._fp = io.BytesIO(body)
-
- data = {
- "response": {
- "body": _b64_encode_bytes(body),
- "headers": dict(
- (_b64_encode(k), _b64_encode(v))
- for k, v in response.headers.items()
- ),
- "status": response.status,
- "version": response.version,
- "reason": _b64_encode_str(response.reason),
- "strict": response.strict,
- "decode_content": response.decode_content,
- },
- }
-
- # Construct our vary headers
- data["vary"] = {}
- if "vary" in response_headers:
- varied_headers = response_headers['vary'].split(',')
- for header in varied_headers:
- header = header.strip()
- data["vary"][header] = request.headers.get(header, None)
-
- # Encode our Vary headers to ensure they can be serialized as JSON
- data["vary"] = dict(
- (_b64_encode(k), _b64_encode(v) if v is not None else v)
- for k, v in data["vary"].items()
- )
-
- return b",".join([
- b"cc=2",
- zlib.compress(
- json.dumps(
- data, separators=(",", ":"), sort_keys=True,
- ).encode("utf8"),
- ),
- ])
-
- def loads(self, request, data):
- # Short circuit if we've been given an empty set of data
- if not data:
- return
-
- # Determine what version of the serializer the data was serialized
- # with
- try:
- ver, data = data.split(b",", 1)
- except ValueError:
- ver = b"cc=0"
-
- # Make sure that our "ver" is actually a version and isn't a false
- # positive from a , being in the data stream.
- if ver[:3] != b"cc=":
- data = ver + data
- ver = b"cc=0"
-
- # Get the version number out of the cc=N
- ver = ver.split(b"=", 1)[-1].decode("ascii")
-
- # Dispatch to the actual load method for the given version
- try:
- return getattr(self, "_loads_v{0}".format(ver))(request, data)
- except AttributeError:
- # This is a version we don't have a loads function for, so we'll
- # just treat it as a miss and return None
- return
-
- def prepare_response(self, request, cached):
- """Verify our vary headers match and construct a real urllib3
- HTTPResponse object.
- """
- # Special case the '*' Vary value as it means we cannot actually
- # determine if the cached response is suitable for this request.
- if "*" in cached.get("vary", {}):
- return
-
- # Ensure that the Vary headers for the cached response match our
- # request
- for header, value in cached.get("vary", {}).items():
- if request.headers.get(header, None) != value:
- return
-
- body_raw = cached["response"].pop("body")
-
- headers = CaseInsensitiveDict(data=cached['response']['headers'])
- if headers.get('transfer-encoding', '') == 'chunked':
- headers.pop('transfer-encoding')
-
- cached['response']['headers'] = headers
-
- try:
- body = io.BytesIO(body_raw)
- except TypeError:
- # This can happen if cachecontrol serialized to v1 format (pickle)
- # using Python 2. A Python 2 str(byte string) will be unpickled as
- # a Python 3 str (unicode string), which will cause the above to
- # fail with:
- #
- # TypeError: 'str' does not support the buffer interface
- body = io.BytesIO(body_raw.encode('utf8'))
-
- return HTTPResponse(
- body=body,
- preload_content=False,
- **cached["response"]
- )
-
- def _loads_v0(self, request, data):
- # The original legacy cache data. This doesn't contain enough
- # information to construct everything we need, so we'll treat this as
- # a miss.
- return
-
- def _loads_v1(self, request, data):
- try:
- cached = pickle.loads(data)
- except ValueError:
- return
-
- return self.prepare_response(request, cached)
-
- def _loads_v2(self, request, data):
- try:
- cached = json.loads(zlib.decompress(data).decode("utf8"))
- except ValueError:
- return
-
- # We need to decode the items that we've base64 encoded
- cached["response"]["body"] = _b64_decode_bytes(
- cached["response"]["body"]
- )
- cached["response"]["headers"] = dict(
- (_b64_decode_str(k), _b64_decode_str(v))
- for k, v in cached["response"]["headers"].items()
- )
- cached["response"]["reason"] = _b64_decode_str(
- cached["response"]["reason"],
- )
- cached["vary"] = dict(
- (_b64_decode_str(k), _b64_decode_str(v) if v is not None else v)
- for k, v in cached["vary"].items()
- )
-
- return self.prepare_response(request, cached)
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/wrapper.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/wrapper.py b/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/wrapper.py
deleted file mode 100644
index ea421aa..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/wrapper.py
+++ /dev/null
@@ -1,21 +0,0 @@
-from .adapter import CacheControlAdapter
-from .cache import DictCache
-
-
-def CacheControl(sess,
- cache=None,
- cache_etags=True,
- serializer=None,
- heuristic=None):
-
- cache = cache or DictCache()
- adapter = CacheControlAdapter(
- cache,
- cache_etags=cache_etags,
- serializer=serializer,
- heuristic=heuristic,
- )
- sess.mount('http://', adapter)
- sess.mount('https://', adapter)
-
- return sess
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/colorama/__init__.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/colorama/__init__.py b/env2/lib/python2.7/site-packages/pip/_vendor/colorama/__init__.py
deleted file mode 100644
index 670e6b3..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/colorama/__init__.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
-from .initialise import init, deinit, reinit, colorama_text
-from .ansi import Fore, Back, Style, Cursor
-from .ansitowin32 import AnsiToWin32
-
-__version__ = '0.3.7'
-
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.py b/env2/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.py
deleted file mode 100644
index 7877658..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
-'''
-This module generates ANSI character codes to printing colors to terminals.
-See: http://en.wikipedia.org/wiki/ANSI_escape_code
-'''
-
-CSI = '\033['
-OSC = '\033]'
-BEL = '\007'
-
-
-def code_to_chars(code):
- return CSI + str(code) + 'm'
-
-def set_title(title):
- return OSC + '2;' + title + BEL
-
-def clear_screen(mode=2):
- return CSI + str(mode) + 'J'
-
-def clear_line(mode=2):
- return CSI + str(mode) + 'K'
-
-
-class AnsiCodes(object):
- def __init__(self):
- # the subclasses declare class attributes which are numbers.
- # Upon instantiation we define instance attributes, which are the same
- # as the class attributes but wrapped with the ANSI escape sequence
- for name in dir(self):
- if not name.startswith('_'):
- value = getattr(self, name)
- setattr(self, name, code_to_chars(value))
-
-
-class AnsiCursor(object):
- def UP(self, n=1):
- return CSI + str(n) + 'A'
- def DOWN(self, n=1):
- return CSI + str(n) + 'B'
- def FORWARD(self, n=1):
- return CSI + str(n) + 'C'
- def BACK(self, n=1):
- return CSI + str(n) + 'D'
- def POS(self, x=1, y=1):
- return CSI + str(y) + ';' + str(x) + 'H'
-
-
-class AnsiFore(AnsiCodes):
- BLACK = 30
- RED = 31
- GREEN = 32
- YELLOW = 33
- BLUE = 34
- MAGENTA = 35
- CYAN = 36
- WHITE = 37
- RESET = 39
-
- # These are fairly well supported, but not part of the standard.
- LIGHTBLACK_EX = 90
- LIGHTRED_EX = 91
- LIGHTGREEN_EX = 92
- LIGHTYELLOW_EX = 93
- LIGHTBLUE_EX = 94
- LIGHTMAGENTA_EX = 95
- LIGHTCYAN_EX = 96
- LIGHTWHITE_EX = 97
-
-
-class AnsiBack(AnsiCodes):
- BLACK = 40
- RED = 41
- GREEN = 42
- YELLOW = 43
- BLUE = 44
- MAGENTA = 45
- CYAN = 46
- WHITE = 47
- RESET = 49
-
- # These are fairly well supported, but not part of the standard.
- LIGHTBLACK_EX = 100
- LIGHTRED_EX = 101
- LIGHTGREEN_EX = 102
- LIGHTYELLOW_EX = 103
- LIGHTBLUE_EX = 104
- LIGHTMAGENTA_EX = 105
- LIGHTCYAN_EX = 106
- LIGHTWHITE_EX = 107
-
-
-class AnsiStyle(AnsiCodes):
- BRIGHT = 1
- DIM = 2
- NORMAL = 22
- RESET_ALL = 0
-
-Fore = AnsiFore()
-Back = AnsiBack()
-Style = AnsiStyle()
-Cursor = AnsiCursor()
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.py b/env2/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.py
deleted file mode 100644
index b7ff6f2..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.py
+++ /dev/null
@@ -1,236 +0,0 @@
-# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
-import re
-import sys
-import os
-
-from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style
-from .winterm import WinTerm, WinColor, WinStyle
-from .win32 import windll, winapi_test
-
-
-winterm = None
-if windll is not None:
- winterm = WinTerm()
-
-
-def is_stream_closed(stream):
- return not hasattr(stream, 'closed') or stream.closed
-
-
-def is_a_tty(stream):
- return hasattr(stream, 'isatty') and stream.isatty()
-
-
-class StreamWrapper(object):
- '''
- Wraps a stream (such as stdout), acting as a transparent proxy for all
- attribute access apart from method 'write()', which is delegated to our
- Converter instance.
- '''
- def __init__(self, wrapped, converter):
- # double-underscore everything to prevent clashes with names of
- # attributes on the wrapped stream object.
- self.__wrapped = wrapped
- self.__convertor = converter
-
- def __getattr__(self, name):
- return getattr(self.__wrapped, name)
-
- def write(self, text):
- self.__convertor.write(text)
-
-
-class AnsiToWin32(object):
- '''
- Implements a 'write()' method which, on Windows, will strip ANSI character
- sequences from the text, and if outputting to a tty, will convert them into
- win32 function calls.
- '''
- ANSI_CSI_RE = re.compile('\001?\033\[((?:\d|;)*)([a-zA-Z])\002?') # Control Sequence Introducer
- ANSI_OSC_RE = re.compile('\001?\033\]((?:.|;)*?)(\x07)\002?') # Operating System Command
-
- def __init__(self, wrapped, convert=None, strip=None, autoreset=False):
- # The wrapped stream (normally sys.stdout or sys.stderr)
- self.wrapped = wrapped
-
- # should we reset colors to defaults after every .write()
- self.autoreset = autoreset
-
- # create the proxy wrapping our output stream
- self.stream = StreamWrapper(wrapped, self)
-
- on_windows = os.name == 'nt'
- # We test if the WinAPI works, because even if we are on Windows
- # we may be using a terminal that doesn't support the WinAPI
- # (e.g. Cygwin Terminal). In this case it's up to the terminal
- # to support the ANSI codes.
- conversion_supported = on_windows and winapi_test()
-
- # should we strip ANSI sequences from our output?
- if strip is None:
- strip = conversion_supported or (not is_stream_closed(wrapped) and not is_a_tty(wrapped))
- self.strip = strip
-
- # should we should convert ANSI sequences into win32 calls?
- if convert is None:
- convert = conversion_supported and not is_stream_closed(wrapped) and is_a_tty(wrapped)
- self.convert = convert
-
- # dict of ansi codes to win32 functions and parameters
- self.win32_calls = self.get_win32_calls()
-
- # are we wrapping stderr?
- self.on_stderr = self.wrapped is sys.stderr
-
- def should_wrap(self):
- '''
- True if this class is actually needed. If false, then the output
- stream will not be affected, nor will win32 calls be issued, so
- wrapping stdout is not actually required. This will generally be
- False on non-Windows platforms, unless optional functionality like
- autoreset has been requested using kwargs to init()
- '''
- return self.convert or self.strip or self.autoreset
-
- def get_win32_calls(self):
- if self.convert and winterm:
- return {
- AnsiStyle.RESET_ALL: (winterm.reset_all, ),
- AnsiStyle.BRIGHT: (winterm.style, WinStyle.BRIGHT),
- AnsiStyle.DIM: (winterm.style, WinStyle.NORMAL),
- AnsiStyle.NORMAL: (winterm.style, WinStyle.NORMAL),
- AnsiFore.BLACK: (winterm.fore, WinColor.BLACK),
- AnsiFore.RED: (winterm.fore, WinColor.RED),
- AnsiFore.GREEN: (winterm.fore, WinColor.GREEN),
- AnsiFore.YELLOW: (winterm.fore, WinColor.YELLOW),
- AnsiFore.BLUE: (winterm.fore, WinColor.BLUE),
- AnsiFore.MAGENTA: (winterm.fore, WinColor.MAGENTA),
- AnsiFore.CYAN: (winterm.fore, WinColor.CYAN),
- AnsiFore.WHITE: (winterm.fore, WinColor.GREY),
- AnsiFore.RESET: (winterm.fore, ),
- AnsiFore.LIGHTBLACK_EX: (winterm.fore, WinColor.BLACK, True),
- AnsiFore.LIGHTRED_EX: (winterm.fore, WinColor.RED, True),
- AnsiFore.LIGHTGREEN_EX: (winterm.fore, WinColor.GREEN, True),
- AnsiFore.LIGHTYELLOW_EX: (winterm.fore, WinColor.YELLOW, True),
- AnsiFore.LIGHTBLUE_EX: (winterm.fore, WinColor.BLUE, True),
- AnsiFore.LIGHTMAGENTA_EX: (winterm.fore, WinColor.MAGENTA, True),
- AnsiFore.LIGHTCYAN_EX: (winterm.fore, WinColor.CYAN, True),
- AnsiFore.LIGHTWHITE_EX: (winterm.fore, WinColor.GREY, True),
- AnsiBack.BLACK: (winterm.back, WinColor.BLACK),
- AnsiBack.RED: (winterm.back, WinColor.RED),
- AnsiBack.GREEN: (winterm.back, WinColor.GREEN),
- AnsiBack.YELLOW: (winterm.back, WinColor.YELLOW),
- AnsiBack.BLUE: (winterm.back, WinColor.BLUE),
- AnsiBack.MAGENTA: (winterm.back, WinColor.MAGENTA),
- AnsiBack.CYAN: (winterm.back, WinColor.CYAN),
- AnsiBack.WHITE: (winterm.back, WinColor.GREY),
- AnsiBack.RESET: (winterm.back, ),
- AnsiBack.LIGHTBLACK_EX: (winterm.back, WinColor.BLACK, True),
- AnsiBack.LIGHTRED_EX: (winterm.back, WinColor.RED, True),
- AnsiBack.LIGHTGREEN_EX: (winterm.back, WinColor.GREEN, True),
- AnsiBack.LIGHTYELLOW_EX: (winterm.back, WinColor.YELLOW, True),
- AnsiBack.LIGHTBLUE_EX: (winterm.back, WinColor.BLUE, True),
- AnsiBack.LIGHTMAGENTA_EX: (winterm.back, WinColor.MAGENTA, True),
- AnsiBack.LIGHTCYAN_EX: (winterm.back, WinColor.CYAN, True),
- AnsiBack.LIGHTWHITE_EX: (winterm.back, WinColor.GREY, True),
- }
- return dict()
-
- def write(self, text):
- if self.strip or self.convert:
- self.write_and_convert(text)
- else:
- self.wrapped.write(text)
- self.wrapped.flush()
- if self.autoreset:
- self.reset_all()
-
-
- def reset_all(self):
- if self.convert:
- self.call_win32('m', (0,))
- elif not self.strip and not is_stream_closed(self.wrapped):
- self.wrapped.write(Style.RESET_ALL)
-
-
- def write_and_convert(self, text):
- '''
- Write the given text to our wrapped stream, stripping any ANSI
- sequences from the text, and optionally converting them into win32
- calls.
- '''
- cursor = 0
- text = self.convert_osc(text)
- for match in self.ANSI_CSI_RE.finditer(text):
- start, end = match.span()
- self.write_plain_text(text, cursor, start)
- self.convert_ansi(*match.groups())
- cursor = end
- self.write_plain_text(text, cursor, len(text))
-
-
- def write_plain_text(self, text, start, end):
- if start < end:
- self.wrapped.write(text[start:end])
- self.wrapped.flush()
-
-
- def convert_ansi(self, paramstring, command):
- if self.convert:
- params = self.extract_params(command, paramstring)
- self.call_win32(command, params)
-
-
- def extract_params(self, command, paramstring):
- if command in 'Hf':
- params = tuple(int(p) if len(p) != 0 else 1 for p in paramstring.split(';'))
- while len(params) < 2:
- # defaults:
- params = params + (1,)
- else:
- params = tuple(int(p) for p in paramstring.split(';') if len(p) != 0)
- if len(params) == 0:
- # defaults:
- if command in 'JKm':
- params = (0,)
- elif command in 'ABCD':
- params = (1,)
-
- return params
-
-
- def call_win32(self, command, params):
- if command == 'm':
- for param in params:
- if param in self.win32_calls:
- func_args = self.win32_calls[param]
- func = func_args[0]
- args = func_args[1:]
- kwargs = dict(on_stderr=self.on_stderr)
- func(*args, **kwargs)
- elif command in 'J':
- winterm.erase_screen(params[0], on_stderr=self.on_stderr)
- elif command in 'K':
- winterm.erase_line(params[0], on_stderr=self.on_stderr)
- elif command in 'Hf': # cursor position - absolute
- winterm.set_cursor_position(params, on_stderr=self.on_stderr)
- elif command in 'ABCD': # cursor position - relative
- n = params[0]
- # A - up, B - down, C - forward, D - back
- x, y = {'A': (0, -n), 'B': (0, n), 'C': (n, 0), 'D': (-n, 0)}[command]
- winterm.cursor_adjust(x, y, on_stderr=self.on_stderr)
-
-
- def convert_osc(self, text):
- for match in self.ANSI_OSC_RE.finditer(text):
- start, end = match.span()
- text = text[:start] + text[end:]
- paramstring, command = match.groups()
- if command in '\x07': # \x07 = BEL
- params = paramstring.split(";")
- # 0 - change title and icon (we will only change title)
- # 1 - change icon (we don't support this)
- # 2 - change title
- if params[0] in '02':
- winterm.set_title(params[1])
- return text
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.py b/env2/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.py
deleted file mode 100644
index 834962a..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
-import atexit
-import contextlib
-import sys
-
-from .ansitowin32 import AnsiToWin32
-
-
-orig_stdout = None
-orig_stderr = None
-
-wrapped_stdout = None
-wrapped_stderr = None
-
-atexit_done = False
-
-
-def reset_all():
- if AnsiToWin32 is not None: # Issue #74: objects might become None at exit
- AnsiToWin32(orig_stdout).reset_all()
-
-
-def init(autoreset=False, convert=None, strip=None, wrap=True):
-
- if not wrap and any([autoreset, convert, strip]):
- raise ValueError('wrap=False conflicts with any other arg=True')
-
- global wrapped_stdout, wrapped_stderr
- global orig_stdout, orig_stderr
-
- orig_stdout = sys.stdout
- orig_stderr = sys.stderr
-
- if sys.stdout is None:
- wrapped_stdout = None
- else:
- sys.stdout = wrapped_stdout = \
- wrap_stream(orig_stdout, convert, strip, autoreset, wrap)
- if sys.stderr is None:
- wrapped_stderr = None
- else:
- sys.stderr = wrapped_stderr = \
- wrap_stream(orig_stderr, convert, strip, autoreset, wrap)
-
- global atexit_done
- if not atexit_done:
- atexit.register(reset_all)
- atexit_done = True
-
-
-def deinit():
- if orig_stdout is not None:
- sys.stdout = orig_stdout
- if orig_stderr is not None:
- sys.stderr = orig_stderr
-
-
-@contextlib.contextmanager
-def colorama_text(*args, **kwargs):
- init(*args, **kwargs)
- try:
- yield
- finally:
- deinit()
-
-
-def reinit():
- if wrapped_stdout is not None:
- sys.stdout = wrapped_stdout
- if wrapped_stderr is not None:
- sys.stderr = wrapped_stderr
-
-
-def wrap_stream(stream, convert, strip, autoreset, wrap):
- if wrap:
- wrapper = AnsiToWin32(stream,
- convert=convert, strip=strip, autoreset=autoreset)
- if wrapper.should_wrap():
- stream = wrapper.stream
- return stream
-
-
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/colorama/win32.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/colorama/win32.py b/env2/lib/python2.7/site-packages/pip/_vendor/colorama/win32.py
deleted file mode 100644
index 3d1d2f2..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/colorama/win32.py
+++ /dev/null
@@ -1,154 +0,0 @@
-# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
-
-# from winbase.h
-STDOUT = -11
-STDERR = -12
-
-try:
- import ctypes
- from ctypes import LibraryLoader
- windll = LibraryLoader(ctypes.WinDLL)
- from ctypes import wintypes
-except (AttributeError, ImportError):
- windll = None
- SetConsoleTextAttribute = lambda *_: None
- winapi_test = lambda *_: None
-else:
- from ctypes import byref, Structure, c_char, POINTER
-
- COORD = wintypes._COORD
-
- class CONSOLE_SCREEN_BUFFER_INFO(Structure):
- """struct in wincon.h."""
- _fields_ = [
- ("dwSize", COORD),
- ("dwCursorPosition", COORD),
- ("wAttributes", wintypes.WORD),
- ("srWindow", wintypes.SMALL_RECT),
- ("dwMaximumWindowSize", COORD),
- ]
- def __str__(self):
- return '(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)' % (
- self.dwSize.Y, self.dwSize.X
- , self.dwCursorPosition.Y, self.dwCursorPosition.X
- , self.wAttributes
- , self.srWindow.Top, self.srWindow.Left, self.srWindow.Bottom, self.srWindow.Right
- , self.dwMaximumWindowSize.Y, self.dwMaximumWindowSize.X
- )
-
- _GetStdHandle = windll.kernel32.GetStdHandle
- _GetStdHandle.argtypes = [
- wintypes.DWORD,
- ]
- _GetStdHandle.restype = wintypes.HANDLE
-
- _GetConsoleScreenBufferInfo = windll.kernel32.GetConsoleScreenBufferInfo
- _GetConsoleScreenBufferInfo.argtypes = [
- wintypes.HANDLE,
- POINTER(CONSOLE_SCREEN_BUFFER_INFO),
- ]
- _GetConsoleScreenBufferInfo.restype = wintypes.BOOL
-
- _SetConsoleTextAttribute = windll.kernel32.SetConsoleTextAttribute
- _SetConsoleTextAttribute.argtypes = [
- wintypes.HANDLE,
- wintypes.WORD,
- ]
- _SetConsoleTextAttribute.restype = wintypes.BOOL
-
- _SetConsoleCursorPosition = windll.kernel32.SetConsoleCursorPosition
- _SetConsoleCursorPosition.argtypes = [
- wintypes.HANDLE,
- COORD,
- ]
- _SetConsoleCursorPosition.restype = wintypes.BOOL
-
- _FillConsoleOutputCharacterA = windll.kernel32.FillConsoleOutputCharacterA
- _FillConsoleOutputCharacterA.argtypes = [
- wintypes.HANDLE,
- c_char,
- wintypes.DWORD,
- COORD,
- POINTER(wintypes.DWORD),
- ]
- _FillConsoleOutputCharacterA.restype = wintypes.BOOL
-
- _FillConsoleOutputAttribute = windll.kernel32.FillConsoleOutputAttribute
- _FillConsoleOutputAttribute.argtypes = [
- wintypes.HANDLE,
- wintypes.WORD,
- wintypes.DWORD,
- COORD,
- POINTER(wintypes.DWORD),
- ]
- _FillConsoleOutputAttribute.restype = wintypes.BOOL
-
- _SetConsoleTitleW = windll.kernel32.SetConsoleTitleA
- _SetConsoleTitleW.argtypes = [
- wintypes.LPCSTR
- ]
- _SetConsoleTitleW.restype = wintypes.BOOL
-
- handles = {
- STDOUT: _GetStdHandle(STDOUT),
- STDERR: _GetStdHandle(STDERR),
- }
-
- def winapi_test():
- handle = handles[STDOUT]
- csbi = CONSOLE_SCREEN_BUFFER_INFO()
- success = _GetConsoleScreenBufferInfo(
- handle, byref(csbi))
- return bool(success)
-
- def GetConsoleScreenBufferInfo(stream_id=STDOUT):
- handle = handles[stream_id]
- csbi = CONSOLE_SCREEN_BUFFER_INFO()
- success = _GetConsoleScreenBufferInfo(
- handle, byref(csbi))
- return csbi
-
- def SetConsoleTextAttribute(stream_id, attrs):
- handle = handles[stream_id]
- return _SetConsoleTextAttribute(handle, attrs)
-
- def SetConsoleCursorPosition(stream_id, position, adjust=True):
- position = COORD(*position)
- # If the position is out of range, do nothing.
- if position.Y <= 0 or position.X <= 0:
- return
- # Adjust for Windows' SetConsoleCursorPosition:
- # 1. being 0-based, while ANSI is 1-based.
- # 2. expecting (x,y), while ANSI uses (y,x).
- adjusted_position = COORD(position.Y - 1, position.X - 1)
- if adjust:
- # Adjust for viewport's scroll position
- sr = GetConsoleScreenBufferInfo(STDOUT).srWindow
- adjusted_position.Y += sr.Top
- adjusted_position.X += sr.Left
- # Resume normal processing
- handle = handles[stream_id]
- return _SetConsoleCursorPosition(handle, adjusted_position)
-
- def FillConsoleOutputCharacter(stream_id, char, length, start):
- handle = handles[stream_id]
- char = c_char(char.encode())
- length = wintypes.DWORD(length)
- num_written = wintypes.DWORD(0)
- # Note that this is hard-coded for ANSI (vs wide) bytes.
- success = _FillConsoleOutputCharacterA(
- handle, char, length, start, byref(num_written))
- return num_written.value
-
- def FillConsoleOutputAttribute(stream_id, attr, length, start):
- ''' FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )'''
- handle = handles[stream_id]
- attribute = wintypes.WORD(attr)
- length = wintypes.DWORD(length)
- num_written = wintypes.DWORD(0)
- # Note that this is hard-coded for ANSI (vs wide) bytes.
- return _FillConsoleOutputAttribute(
- handle, attribute, length, start, byref(num_written))
-
- def SetConsoleTitle(title):
- return _SetConsoleTitleW(title)
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.py b/env2/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.py
deleted file mode 100644
index 60309d3..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.py
+++ /dev/null
@@ -1,162 +0,0 @@
-# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
-from . import win32
-
-
-# from wincon.h
-class WinColor(object):
- BLACK = 0
- BLUE = 1
- GREEN = 2
- CYAN = 3
- RED = 4
- MAGENTA = 5
- YELLOW = 6
- GREY = 7
-
-# from wincon.h
-class WinStyle(object):
- NORMAL = 0x00 # dim text, dim background
- BRIGHT = 0x08 # bright text, dim background
- BRIGHT_BACKGROUND = 0x80 # dim text, bright background
-
-class WinTerm(object):
-
- def __init__(self):
- self._default = win32.GetConsoleScreenBufferInfo(win32.STDOUT).wAttributes
- self.set_attrs(self._default)
- self._default_fore = self._fore
- self._default_back = self._back
- self._default_style = self._style
- # In order to emulate LIGHT_EX in windows, we borrow the BRIGHT style.
- # So that LIGHT_EX colors and BRIGHT style do not clobber each other,
- # we track them separately, since LIGHT_EX is overwritten by Fore/Back
- # and BRIGHT is overwritten by Style codes.
- self._light = 0
-
- def get_attrs(self):
- return self._fore + self._back * 16 + (self._style | self._light)
-
- def set_attrs(self, value):
- self._fore = value & 7
- self._back = (value >> 4) & 7
- self._style = value & (WinStyle.BRIGHT | WinStyle.BRIGHT_BACKGROUND)
-
- def reset_all(self, on_stderr=None):
- self.set_attrs(self._default)
- self.set_console(attrs=self._default)
-
- def fore(self, fore=None, light=False, on_stderr=False):
- if fore is None:
- fore = self._default_fore
- self._fore = fore
- # Emulate LIGHT_EX with BRIGHT Style
- if light:
- self._light |= WinStyle.BRIGHT
- else:
- self._light &= ~WinStyle.BRIGHT
- self.set_console(on_stderr=on_stderr)
-
- def back(self, back=None, light=False, on_stderr=False):
- if back is None:
- back = self._default_back
- self._back = back
- # Emulate LIGHT_EX with BRIGHT_BACKGROUND Style
- if light:
- self._light |= WinStyle.BRIGHT_BACKGROUND
- else:
- self._light &= ~WinStyle.BRIGHT_BACKGROUND
- self.set_console(on_stderr=on_stderr)
-
- def style(self, style=None, on_stderr=False):
- if style is None:
- style = self._default_style
- self._style = style
- self.set_console(on_stderr=on_stderr)
-
- def set_console(self, attrs=None, on_stderr=False):
- if attrs is None:
- attrs = self.get_attrs()
- handle = win32.STDOUT
- if on_stderr:
- handle = win32.STDERR
- win32.SetConsoleTextAttribute(handle, attrs)
-
- def get_position(self, handle):
- position = win32.GetConsoleScreenBufferInfo(handle).dwCursorPosition
- # Because Windows coordinates are 0-based,
- # and win32.SetConsoleCursorPosition expects 1-based.
- position.X += 1
- position.Y += 1
- return position
-
- def set_cursor_position(self, position=None, on_stderr=False):
- if position is None:
- # I'm not currently tracking the position, so there is no default.
- # position = self.get_position()
- return
- handle = win32.STDOUT
- if on_stderr:
- handle = win32.STDERR
- win32.SetConsoleCursorPosition(handle, position)
-
- def cursor_adjust(self, x, y, on_stderr=False):
- handle = win32.STDOUT
- if on_stderr:
- handle = win32.STDERR
- position = self.get_position(handle)
- adjusted_position = (position.Y + y, position.X + x)
- win32.SetConsoleCursorPosition(handle, adjusted_position, adjust=False)
-
- def erase_screen(self, mode=0, on_stderr=False):
- # 0 should clear from the cursor to the end of the screen.
- # 1 should clear from the cursor to the beginning of the screen.
- # 2 should clear the entire screen, and move cursor to (1,1)
- handle = win32.STDOUT
- if on_stderr:
- handle = win32.STDERR
- csbi = win32.GetConsoleScreenBufferInfo(handle)
- # get the number of character cells in the current buffer
- cells_in_screen = csbi.dwSize.X * csbi.dwSize.Y
- # get number of character cells before current cursor position
- cells_before_cursor = csbi.dwSize.X * csbi.dwCursorPosition.Y + csbi.dwCursorPosition.X
- if mode == 0:
- from_coord = csbi.dwCursorPosition
- cells_to_erase = cells_in_screen - cells_before_cursor
- if mode == 1:
- from_coord = win32.COORD(0, 0)
- cells_to_erase = cells_before_cursor
- elif mode == 2:
- from_coord = win32.COORD(0, 0)
- cells_to_erase = cells_in_screen
- # fill the entire screen with blanks
- win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord)
- # now set the buffer's attributes accordingly
- win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord)
- if mode == 2:
- # put the cursor where needed
- win32.SetConsoleCursorPosition(handle, (1, 1))
-
- def erase_line(self, mode=0, on_stderr=False):
- # 0 should clear from the cursor to the end of the line.
- # 1 should clear from the cursor to the beginning of the line.
- # 2 should clear the entire line.
- handle = win32.STDOUT
- if on_stderr:
- handle = win32.STDERR
- csbi = win32.GetConsoleScreenBufferInfo(handle)
- if mode == 0:
- from_coord = csbi.dwCursorPosition
- cells_to_erase = csbi.dwSize.X - csbi.dwCursorPosition.X
- if mode == 1:
- from_coord = win32.COORD(0, csbi.dwCursorPosition.Y)
- cells_to_erase = csbi.dwCursorPosition.X
- elif mode == 2:
- from_coord = win32.COORD(0, csbi.dwCursorPosition.Y)
- cells_to_erase = csbi.dwSize.X
- # fill the entire screen with blanks
- win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord)
- # now set the buffer's attributes accordingly
- win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord)
-
- def set_title(self, title):
- win32.SetConsoleTitle(title)
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.py b/env2/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.py
deleted file mode 100644
index d186b0a..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012-2016 Vinay Sajip.
-# Licensed to the Python Software Foundation under a contributor agreement.
-# See LICENSE.txt and CONTRIBUTORS.txt.
-#
-import logging
-
-__version__ = '0.2.4'
-
-class DistlibException(Exception):
- pass
-
-try:
- from logging import NullHandler
-except ImportError: # pragma: no cover
- class NullHandler(logging.Handler):
- def handle(self, record): pass
- def emit(self, record): pass
- def createLock(self): self.lock = None
-
-logger = logging.getLogger(__name__)
-logger.addHandler(NullHandler())
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/__init__.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/__init__.py b/env2/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/__init__.py
deleted file mode 100644
index f7dbf4c..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-"""Modules copied from Python 3 standard libraries, for internal use only.
-
-Individual classes and functions are found in d2._backport.misc. Intended
-usage is to always import things missing from 3.1 from that module: the
-built-in/stdlib objects will be used if found.
-"""
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/misc.py
----------------------------------------------------------------------
diff --git a/env2/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/misc.py b/env2/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/misc.py
deleted file mode 100644
index cfb318d..0000000
--- a/env2/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/misc.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 The Python Software Foundation.
-# See LICENSE.txt and CONTRIBUTORS.txt.
-#
-"""Backports for individual classes and functions."""
-
-import os
-import sys
-
-__all__ = ['cache_from_source', 'callable', 'fsencode']
-
-
-try:
- from imp import cache_from_source
-except ImportError:
- def cache_from_source(py_file, debug=__debug__):
- ext = debug and 'c' or 'o'
- return py_file + ext
-
-
-try:
- callable = callable
-except NameError:
- from collections import Callable
-
- def callable(obj):
- return isinstance(obj, Callable)
-
-
-try:
- fsencode = os.fsencode
-except AttributeError:
- def fsencode(filename):
- if isinstance(filename, bytes):
- return filename
- elif isinstance(filename, str):
- return filename.encode(sys.getfilesystemencoding())
- else:
- raise TypeError("expect bytes or str, not %s" %
- type(filename).__name__)