site-packages/pip/_vendor/cachecontrol/caches/__init__.py000064400000000561147204247350017525 0ustar00from 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 site-packages/pip/_vendor/cachecontrol/caches/__init__.pyc000064400000001146147204247350017670 0ustar00 abc@sddlmZyddlmZWn"ek rHedZeGHnXy ddlZddlmZWnek r|nXdS(i(tdedenti(t FileCaches NOTE: In order to use the FileCache you must have lockfile installed. You can install it via pip: pip install lockfile N(t RedisCache( ttextwrapRt file_cacheRt ImportErrortnoticetredist redis_cacheR(((sL/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/__init__.pyts     site-packages/pip/_vendor/cachecontrol/caches/__init__.pyo000064400000001146147204247350017704 0ustar00 abc@sddlmZyddlmZWn"ek rHedZeGHnXy ddlZddlmZWnek r|nXdS(i(tdedenti(t FileCaches NOTE: In order to use the FileCache you must have lockfile installed. You can install it via pip: pip install lockfile N(t RedisCache( ttextwrapRt file_cacheRt ImportErrortnoticetredist redis_cacheR(((sL/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/__init__.pyts     site-packages/pip/_vendor/cachecontrol/caches/file_cache.py000064400000006714147204247350020036 0ustar00import 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) site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyc000064400000007377147204247350020207 0ustar00 abc@sddlZddlZddlmZddlmZddlmZddlm Z dZ defd YZ d Z dS( iN(tLockFile(t MkdirLockFilei(t BaseCache(tCacheControllercCstj}|tjtjBO}ttdr<|tjO}nttdr[|tjO}nytj|Wntt fk rnXtj |||}ytj |dSWntj |nXdS(Nt O_NOFOLLOWtO_BINARYtwb( tostO_WRONLYtO_CREATtO_EXCLthasattrRRtremovetIOErrortOSErrortopentfdopentclose(tfilenametfmodetflagstfd((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyt_secure_open_write s   t FileCachecBsSeZedddddZedZdZdZdZ dZ RS( iicCs||dk r'|dk r'tdn|r6t}n|dkrKt}n||_||_||_||_||_dS(Ns/Cannot use use_dir_lock and lock_class together( tNonet ValueErrorRRt directorytforevertfilemodetdirmodet lock_class(tselfRRRRt use_dir_lockR((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyt__init__4s       cCstj|jjS(N(thashlibtsha224tencodet hexdigest(tx((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyR$GscCs<|j|}t|d |g}tjj|j|S(Ni(R$tlistRtpathtjoinR(Rtnamethashedtparts((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyt_fnKscCsK|j|}tjj|s%dSt|d}|jSWdQXdS(Ntrb(R-RR(texistsRRtread(RtkeyR*tfh((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pytgetRs c Cs|j|}y#tjtjj||jWnttfk rKnX|j|2}t |j|j }|j |WdQXWdQXdS(N( R-RtmakedirsR(tdirnameRR RRRRtwrite(RR1tvalueR*tlockR2((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pytsetZs#cCs,|j|}|js(tj|ndS(N(R-RRR (RR1R*((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pytdeletehs N( t__name__t __module__tFalseRR!t staticmethodR$R-R3R9R:(((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyR3s   cCstj|}|j|S(s\Return the file cache path based on the URL. This does not ensure the file exists! (Rt cache_urlR-(turlt filecacheR1((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyturl_to_file_pathns( R"Rtpip._vendor.lockfileRt"pip._vendor.lockfile.mkdirlockfileRtcacheRt controllerRRRRB(((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyts   (;site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyo000064400000007377147204247350020223 0ustar00 abc@sddlZddlZddlmZddlmZddlmZddlm Z dZ defd YZ d Z dS( iN(tLockFile(t MkdirLockFilei(t BaseCache(tCacheControllercCstj}|tjtjBO}ttdr<|tjO}nttdr[|tjO}nytj|Wntt fk rnXtj |||}ytj |dSWntj |nXdS(Nt O_NOFOLLOWtO_BINARYtwb( tostO_WRONLYtO_CREATtO_EXCLthasattrRRtremovetIOErrortOSErrortopentfdopentclose(tfilenametfmodetflagstfd((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyt_secure_open_write s   t FileCachecBsSeZedddddZedZdZdZdZ dZ RS( iicCs||dk r'|dk r'tdn|r6t}n|dkrKt}n||_||_||_||_||_dS(Ns/Cannot use use_dir_lock and lock_class together( tNonet ValueErrorRRt directorytforevertfilemodetdirmodet lock_class(tselfRRRRt use_dir_lockR((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyt__init__4s       cCstj|jjS(N(thashlibtsha224tencodet hexdigest(tx((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyR$GscCs<|j|}t|d |g}tjj|j|S(Ni(R$tlistRtpathtjoinR(Rtnamethashedtparts((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyt_fnKscCsK|j|}tjj|s%dSt|d}|jSWdQXdS(Ntrb(R-RR(texistsRRtread(RtkeyR*tfh((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pytgetRs c Cs|j|}y#tjtjj||jWnttfk rKnX|j|2}t |j|j }|j |WdQXWdQXdS(N( R-RtmakedirsR(tdirnameRR RRRRtwrite(RR1tvalueR*tlockR2((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pytsetZs#cCs,|j|}|js(tj|ndS(N(R-RRR (RR1R*((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pytdeletehs N( t__name__t __module__tFalseRR!t staticmethodR$R-R3R9R:(((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyR3s   cCstj|}|j|S(s\Return the file cache path based on the URL. This does not ensure the file exists! (Rt cache_urlR-(turlt filecacheR1((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyturl_to_file_pathns( R"Rtpip._vendor.lockfileRt"pip._vendor.lockfile.mkdirlockfileRtcacheRt controllerRRRRB(((sN/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.pyts   (;site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py000064400000001715147204247350020221 0ustar00from __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() site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyc000064400000004531147204247350020363 0ustar00 abc@ sCddlmZddlmZdZdefdYZdS(i(tdivision(tdatetimecC sJt|dr|jS|j}|j|jdd}||ddS(sPython 2.6 compatabilityt total_secondsiii ii@Bi@B(thasattrRt microsecondstsecondstdays(ttdtmstsecs((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyRs   t RedisCachecB sAeZdZdZddZdZdZdZRS(cC s ||_dS(N(tconn(tselfR ((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyt__init__scC s|jj|S(N(R tget(R tkey((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyRscC sL|s|jj||n,|tj}|jj|t||dS(N(R tsetRtnowtsetexR(R Rtvaluetexpires((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyRscC s|jj|dS(N(R tdelete(R R((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyRscC s.x'|jjD]}|jj|qWdS(sIHelper for clearing all the keys in a database. Use with caution!N(R tkeysR(R R((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pytclear"scC s|jjdS(N(R t disconnect(R ((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pytclose(sN( t__name__t __module__R RtNoneRRRR(((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyR s      N(t __future__RRRtobjectR (((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyts site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyo000064400000004531147204247350020377 0ustar00 abc@ sCddlmZddlmZdZdefdYZdS(i(tdivision(tdatetimecC sJt|dr|jS|j}|j|jdd}||ddS(sPython 2.6 compatabilityt total_secondsiii ii@Bi@B(thasattrRt microsecondstsecondstdays(ttdtmstsecs((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyRs   t RedisCachecB sAeZdZdZddZdZdZdZRS(cC s ||_dS(N(tconn(tselfR ((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyt__init__scC s|jj|S(N(R tget(R tkey((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyRscC sL|s|jj||n,|tj}|jj|t||dS(N(R tsetRtnowtsetexR(R Rtvaluetexpires((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyRscC s|jj|dS(N(R tdelete(R R((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyRscC s.x'|jjD]}|jj|qWdS(sIHelper for clearing all the keys in a database. Use with caution!N(R tkeysR(R R((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pytclear"scC s|jjdS(N(R t disconnect(R ((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pytclose(sN( t__name__t __module__R RtNoneRRRR(((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyR s      N(t __future__RRRtobjectR (((sO/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.pyts site-packages/pip/_vendor/cachecontrol/__init__.py000064400000000456147204247350016302 0ustar00"""CacheControl import Interface. Make it easy to import from cachecontrol without long namespaces. """ __author__ = 'Eric Larson' __email__ = 'eric@ionrock.org' __version__ = '0.11.7' from .wrapper import CacheControl from .adapter import CacheControlAdapter from .controller import CacheController site-packages/pip/_vendor/cachecontrol/__init__.pyc000064400000001107147204247350016437 0ustar00 abc@sLdZdZdZdZddlmZddlmZddlm Z dS( sbCacheControl import Interface. Make it easy to import from cachecontrol without long namespaces. s Eric Larsonseric@ionrock.orgs0.11.7i(t CacheControl(tCacheControlAdapter(tCacheControllerN( t__doc__t __author__t __email__t __version__twrapperRtadapterRt controllerR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/__init__.pyts site-packages/pip/_vendor/cachecontrol/__init__.pyo000064400000001107147204247350016453 0ustar00 abc@sLdZdZdZdZddlmZddlmZddlm Z dS( sbCacheControl import Interface. Make it easy to import from cachecontrol without long namespaces. s Eric Larsonseric@ionrock.orgs0.11.7i(t CacheControl(tCacheControlAdapter(tCacheControllerN( t__doc__t __author__t __email__t __version__twrapperRtadapterRt controllerR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/__init__.pyts site-packages/pip/_vendor/cachecontrol/_cmd.py000064400000002450147204247350015441 0ustar00import logging from pip._vendor import requests from pip._vendor.cachecontrol.adapter import CacheControlAdapter from pip._vendor.cachecontrol.cache import DictCache from pip._vendor.cachecontrol.controller import logger from argparse import ArgumentParser def setup_logging(): logger.setLevel(logging.DEBUG) handler = logging.StreamHandler() logger.addHandler(handler) def get_session(): adapter = CacheControlAdapter( DictCache(), cache_etags=True, serializer=None, heuristic=None, ) sess = requests.Session() sess.mount('http://', adapter) sess.mount('https://', adapter) sess.cache_controller = adapter.controller return sess def get_args(): parser = ArgumentParser() parser.add_argument('url', help='The URL to try and cache') return parser.parse_args() def main(args=None): args = get_args() sess = get_session() # Make a request to get a response resp = sess.get(args.url) # Turn on logging setup_logging() # try setting the cache sess.cache_controller.cache_response(resp.request, resp.raw) # Now try to get it if sess.cache_controller.cached_request(resp.request): print('Cached!') else: print('Not cached :(') if __name__ == '__main__': main() site-packages/pip/_vendor/cachecontrol/_cmd.pyc000064400000004013147204247350015601 0ustar00 abc@sddlZddlmZddlmZddlmZddlmZddl m Z dZ dZ d Z dd Zed krendS( iN(trequests(tCacheControlAdapter(t DictCache(tlogger(tArgumentParsercCs-tjtjtj}tj|dS(N(RtsetLeveltloggingtDEBUGt StreamHandlert addHandler(thandler((sA/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/_cmd.pyt setup_logging s cCs]ttdtdddd}tj}|jd||jd||j|_|S(Nt cache_etagst serializert heuristicshttp://shttps://( RRtTruetNoneRtSessiontmountt controllertcache_controller(tadaptertsess((sA/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/_cmd.pyt get_sessions    cCs&t}|jddd|jS(NturlthelpsThe URL to try and cache(Rt add_argumentt parse_args(tparser((sA/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/_cmd.pytget_args!s cCsjt}t}|j|j}t|jj|j|j|jj |jradGHndGHdS(NsCached!s Not cached :(( RRtgetRR Rtcache_responsetrequesttrawtcached_request(targsRtresp((sA/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/_cmd.pytmain's  t__main__(Rt pip._vendorRt pip._vendor.cachecontrol.adapterRtpip._vendor.cachecontrol.cacheRt#pip._vendor.cachecontrol.controllerRtargparseRR RRRR%t__name__(((sA/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/_cmd.pyts      site-packages/pip/_vendor/cachecontrol/_cmd.pyo000064400000004013147204247350015615 0ustar00 abc@sddlZddlmZddlmZddlmZddlmZddl m Z dZ dZ d Z dd Zed krendS( iN(trequests(tCacheControlAdapter(t DictCache(tlogger(tArgumentParsercCs-tjtjtj}tj|dS(N(RtsetLeveltloggingtDEBUGt StreamHandlert addHandler(thandler((sA/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/_cmd.pyt setup_logging s cCs]ttdtdddd}tj}|jd||jd||j|_|S(Nt cache_etagst serializert heuristicshttp://shttps://( RRtTruetNoneRtSessiontmountt controllertcache_controller(tadaptertsess((sA/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/_cmd.pyt get_sessions    cCs&t}|jddd|jS(NturlthelpsThe URL to try and cache(Rt add_argumentt parse_args(tparser((sA/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/_cmd.pytget_args!s cCsjt}t}|j|j}t|jj|j|j|jj |jradGHndGHdS(NsCached!s Not cached :(( RRtgetRR Rtcache_responsetrequesttrawtcached_request(targsRtresp((sA/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/_cmd.pytmain's  t__main__(Rt pip._vendorRt pip._vendor.cachecontrol.adapterRtpip._vendor.cachecontrol.cacheRt#pip._vendor.cachecontrol.controllerRtargparseRR RRRR%t__name__(((sA/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/_cmd.pyts      site-packages/pip/_vendor/cachecontrol/adapter.py000064400000011000147204247350016146 0ustar00import types import functools from pip._vendor.requests.adapters import HTTPAdapter from .controller import CacheController from .cache import DictCache from .filewrapper import CallbackFileWrapper class CacheControlAdapter(HTTPAdapter): invalidating_methods = set(['PUT', 'DELETE']) def __init__(self, cache=None, cache_etags=True, controller_class=None, serializer=None, heuristic=None, *args, **kw): super(CacheControlAdapter, self).__init__(*args, **kw) self.cache = cache or DictCache() self.heuristic = heuristic controller_factory = controller_class or CacheController self.controller = controller_factory( self.cache, cache_etags=cache_etags, serializer=serializer, ) def send(self, request, **kw): """ Send a request. Use the request information to see if it exists in the cache and cache the response if we need to and can. """ if request.method == 'GET': cached_response = self.controller.cached_request(request) if cached_response: return self.build_response(request, cached_response, from_cache=True) # check for etags and add headers if appropriate request.headers.update( self.controller.conditional_headers(request) ) resp = super(CacheControlAdapter, self).send(request, **kw) return resp def build_response(self, request, response, from_cache=False): """ Build a response by making a request or using the cache. This will end up calling send and returning a potentially cached response """ if not from_cache and request.method == 'GET': # Check for any heuristics that might update headers # before trying to cache. if self.heuristic: response = self.heuristic.apply(response) # apply any expiration heuristics if response.status == 304: # We must have sent an ETag request. This could mean # that we've been expired already or that we simply # have an etag. In either case, we want to try and # update the cache if that is the case. cached_response = self.controller.update_cached_response( request, response ) if cached_response is not response: from_cache = True # We are done with the server response, read a # possible response body (compliant servers will # not return one, but we cannot be 100% sure) and # release the connection back to the pool. response.read(decode_content=False) response.release_conn() response = cached_response # We always cache the 301 responses elif response.status == 301: self.controller.cache_response(request, response) else: # Wrap the response file with a wrapper that will cache the # response when the stream has been consumed. response._fp = CallbackFileWrapper( response._fp, functools.partial( self.controller.cache_response, request, response, ) ) if response.chunked: super_update_chunk_length = response._update_chunk_length def _update_chunk_length(self): super_update_chunk_length() if self.chunk_left == 0: self._fp._close() response._update_chunk_length = types.MethodType(_update_chunk_length, response) resp = super(CacheControlAdapter, self).build_response( request, response ) # See if we should invalidate the cache. if request.method in self.invalidating_methods and resp.ok: cache_url = self.controller.cache_url(request.url) self.cache.delete(cache_url) # Give the request a from_cache attr to let people use it resp.from_cache = from_cache return resp def close(self): self.cache.close() super(CacheControlAdapter, self).close() site-packages/pip/_vendor/cachecontrol/adapter.pyc000064400000006703147204247350016327 0ustar00 abc@srddlZddlZddlmZddlmZddlmZddlm Z defdYZ dS( iN(t HTTPAdapteri(tCacheController(t DictCache(tCallbackFileWrappertCacheControlAdaptercBsPeZeddgZdeddddZdZedZ dZ RS(tPUTtDELETEc Osbtt|j|||p%t|_||_|p=t}||jd|d||_dS(Nt cache_etagst serializer(tsuperRt__init__Rtcachet heuristicRt controller( tselfR Rtcontroller_classRR targstkwtcontroller_factory((sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.pyR s   cKs{|jdkr\|jj|}|r=|j||dtS|jj|jj|ntt |j ||}|S(s Send a request. Use the request information to see if it exists in the cache and cache the response if we need to and can. tGETt from_cache( tmethodR tcached_requesttbuild_responsetTruetheaderstupdatetconditional_headersR Rtsend(RtrequestRtcached_responsetresp((sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.pyRs cs| r|jdkr|jr4|jj|}n|jdkr|jj||}||k rmt}n|jdt|j |}q|jdkr|jj ||qt |j t j|jj |||_ |jr|jfd}tj|||_qntt|j||}|j|jkry|jry|jj|j}|jj|n||_|S(s Build a response by making a request or using the cache. This will end up calling send and returning a potentially cached response Ri0tdecode_contenti-cs*|jdkr&|jjndS(Ni(t chunk_leftt_fpt_close(R(tsuper_update_chunk_length(sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.pyt_update_chunk_lengthgs(RR tapplytstatusR tupdate_cached_responseRtreadtFalset release_conntcache_responseRR"t functoolstpartialtchunkedR%ttypest MethodTypeR RRtinvalidating_methodstokt cache_urlturlR tdeleteR(RRtresponseRRR%RR4((R$sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.pyR3s<            cCs$|jjtt|jdS(N(R tcloseR R(R((sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.pyR8{s N( t__name__t __module__tsetR2tNoneRR RR*RR8(((sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.pyR s  H( R0R-tpip._vendor.requests.adaptersRR RR Rt filewrapperRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.pyts  site-packages/pip/_vendor/cachecontrol/adapter.pyo000064400000006703147204247350016343 0ustar00 abc@srddlZddlZddlmZddlmZddlmZddlm Z defdYZ dS( iN(t HTTPAdapteri(tCacheController(t DictCache(tCallbackFileWrappertCacheControlAdaptercBsPeZeddgZdeddddZdZedZ dZ RS(tPUTtDELETEc Osbtt|j|||p%t|_||_|p=t}||jd|d||_dS(Nt cache_etagst serializer(tsuperRt__init__Rtcachet heuristicRt controller( tselfR Rtcontroller_classRR targstkwtcontroller_factory((sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.pyR s   cKs{|jdkr\|jj|}|r=|j||dtS|jj|jj|ntt |j ||}|S(s Send a request. Use the request information to see if it exists in the cache and cache the response if we need to and can. tGETt from_cache( tmethodR tcached_requesttbuild_responsetTruetheaderstupdatetconditional_headersR Rtsend(RtrequestRtcached_responsetresp((sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.pyRs cs| r|jdkr|jr4|jj|}n|jdkr|jj||}||k rmt}n|jdt|j |}q|jdkr|jj ||qt |j t j|jj |||_ |jr|jfd}tj|||_qntt|j||}|j|jkry|jry|jj|j}|jj|n||_|S(s Build a response by making a request or using the cache. This will end up calling send and returning a potentially cached response Ri0tdecode_contenti-cs*|jdkr&|jjndS(Ni(t chunk_leftt_fpt_close(R(tsuper_update_chunk_length(sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.pyt_update_chunk_lengthgs(RR tapplytstatusR tupdate_cached_responseRtreadtFalset release_conntcache_responseRR"t functoolstpartialtchunkedR%ttypest MethodTypeR RRtinvalidating_methodstokt cache_urlturlR tdeleteR(RRtresponseRRR%RR4((R$sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.pyR3s<            cCs$|jjtt|jdS(N(R tcloseR R(R((sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.pyR8{s N( t__name__t __module__tsetR2tNoneRR RR*RR8(((sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.pyR s  H( R0R-tpip._vendor.requests.adaptersRR RR Rt filewrapperRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.pyts  site-packages/pip/_vendor/cachecontrol/cache.py000064400000001426147204247350015604 0ustar00""" 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) site-packages/pip/_vendor/cachecontrol/cache.pyc000064400000004541147204247350015750 0ustar00 abc@sFdZddlmZdefdYZdefdYZdS(sb The cache object API for implementing caches. The default is a thread safe in-memory dictionary. i(tLockt BaseCachecBs,eZdZdZdZdZRS(cCs tdS(N(tNotImplemented(tselftkey((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pytget scCs tdS(N(R(RRtvalue((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pytset scCs tdS(N(R(RR((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pytdeletescCsdS(N((R((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pytcloses(t__name__t __module__RRRR (((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pyRs   t DictCachecBs/eZddZdZdZdZRS(cCst|_|pi|_dS(N(Rtlocktdata(Rt init_dict((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pyt__init__s cCs|jj|dS(N(RRtNone(RR((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pyRscCs+|j|jji||6WdQXdS(N(R Rtupdate(RRR((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pyR s cCs6|j'||jkr,|jj|nWdQXdS(N(R Rtpop(RR((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pyR$s N(R R RRRRR(((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pyR s   N(t__doc__t threadingRtobjectRR (((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pytssite-packages/pip/_vendor/cachecontrol/cache.pyo000064400000004541147204247350015764 0ustar00 abc@sFdZddlmZdefdYZdefdYZdS(sb The cache object API for implementing caches. The default is a thread safe in-memory dictionary. i(tLockt BaseCachecBs,eZdZdZdZdZRS(cCs tdS(N(tNotImplemented(tselftkey((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pytget scCs tdS(N(R(RRtvalue((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pytset scCs tdS(N(R(RR((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pytdeletescCsdS(N((R((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pytcloses(t__name__t __module__RRRR (((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pyRs   t DictCachecBs/eZddZdZdZdZRS(cCst|_|pi|_dS(N(Rtlocktdata(Rt init_dict((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pyt__init__s cCs|jj|dS(N(RRtNone(RR((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pyRscCs+|j|jji||6WdQXdS(N(R Rtupdate(RRR((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pyR s cCs6|j'||jkr,|jj|nWdQXdS(N(R Rtpop(RR((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pyR$s N(R R RRRRR(((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pyR s   N(t__doc__t threadingRtobjectRR (((sB/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/cache.pytssite-packages/pip/_vendor/cachecontrol/compat.py000064400000000574147204247350016027 0ustar00try: from urllib.parse import urljoin except ImportError: from urlparse import urljoin try: import cPickle as pickle except ImportError: import pickle from pip._vendor.urllib3.response import HTTPResponse from pip._vendor.urllib3.util import is_fp_closed # Replicate some six behaviour try: text_type = (unicode,) except NameError: text_type = (str,) site-packages/pip/_vendor/cachecontrol/compat.pyc000064400000001152147204247350016163 0ustar00 abc@syddlmZWn!ek r7ddlmZnXyddlZWnek rgddlZnXddlmZddlm Z y e fZ Wne k re fZ nXdS(i(turljoinN(t HTTPResponse(t is_fp_closed(t urllib.parseRt ImportErrorturlparsetcPickletpickletpip._vendor.urllib3.responseRtpip._vendor.urllib3.utilRtunicodet text_typet NameErrortstr(((sC/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/compat.pyts    site-packages/pip/_vendor/cachecontrol/compat.pyo000064400000001152147204247350016177 0ustar00 abc@syddlmZWn!ek r7ddlmZnXyddlZWnek rgddlZnXddlmZddlm Z y e fZ Wne k re fZ nXdS(i(turljoinN(t HTTPResponse(t is_fp_closed(t urllib.parseRt ImportErrorturlparsetcPickletpickletpip._vendor.urllib3.responseRtpip._vendor.urllib3.utilRtunicodet text_typet NameErrortstr(((sC/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/compat.pyts    site-packages/pip/_vendor/cachecontrol/controller.py000064400000031340147204247350016722 0ustar00""" 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 site-packages/pip/_vendor/cachecontrol/controller.pyc000064400000021566147204247350017076 0ustar00 abc@sdZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ej eZejdZd Zd efd YZdS( s7 The httplib2 algorithms ported for use with requests. iN(t parsedate_tz(tCaseInsensitiveDicti(t DictCache(t Serializers9^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?cCs<tj|j}|d|d|d|d|dfS(sParses a URI using the regex given in Appendix B of RFC 3986. (scheme, authority, path, query, fragment) = parse_uri(uri) iiiii(tURItmatchtgroups(turiR((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pyt parse_uristCacheControllercBsneZdZd ed dZedZedZdZ dZ dZ d dZ dZ RS( s9An interface to see if request should cached or not. cCs1|p t|_||_|p't|_dS(N(Rtcachet cache_etagsRt serializer(tselfR R R ((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pyt__init__!s c Cst|\}}}}}| s)| r<td|n|j}|j}|scd}n|r~dj||gp|}|d||}|S(s4Normalize the URL to create a safe key for the caches(Only absolute URIs are allowed. uri = %st/t?s://(Rt Exceptiontlowertjoin( tclsRtschemet authoritytpathtquerytfragmentt request_urit defrag_uri((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pyt_urlnorm&s   !cCs |j|S(N(R(RR((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pyt cache_url:sc Csi}d}d|kr!d}n||kr||jd}g|D]R}d|jdkrGtg|jddD]}|jj^qx^qG}g|D]3}d|jdkr|jjdf^q} t|| }n|S(sz Parse the cache control headers returning a dictionary with values for the different directives. s cache-controls Cache-Controlt,it=i(tsplittfindttupletstripRtdict( R theaderstretvalt cc_headertpartstparttxtparts_with_argstnamet parts_wo_args((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pytparse_cache_control>s   \=cCs^|j|j}tjd||j|j}d|krQtjdtSd|kr~|ddkr~tjdtS|jj|}|dkrtjdtS|j j ||}|stj dtS|j d krd }tj||St|j}| s!d |kr^d |krMtjd |jj|ntjdtStj}tjt|d } td|| } tjd| |j|} d} d| kr| djrt| d} tjd| n`d|krZt|d} | dk rZtj| | }td|} tjd| qZnd|kry$t|d} tjd| Wqtk rd} qXnd|kryt|d}Wntk rd}nX| |7} tjd| n| | kr.tjdtjd| | |Sd |krZtjd|jj|ntS(se Return a cached response if it exists in the cache, otherwise return False. sLooking up "%s" in the cachesno-caches-Request header has "no-cache", cache bypassedsmax-ageis1Request header has "max_age" as 0, cache bypassedsNo cache entry availables1Cache entry deserialization failed, entry ignoredi-sVReturning cached "301 Moved Permanently" response (ignoring date and etag information)tdatetetags(Purging cached response: no date or etags!Ignoring cached response: no datesCurrent age based on date: %is#Freshness lifetime from max-age: %itexpiress#Freshness lifetime from expires: %is+Freshness lifetime from request max-age: %is min-freshs'Adjusted current age from min-fresh: %is2The response is "fresh", returning cached responses%i > %is4The cached response is "stale" with no etag, purgingN(RturltloggertdebugR.R%tFalseR tgettNoneR tloadstwarningtstatusRtdeletettimetcalendarttimegmRtmaxtisdigittintt ValueError(R trequestRtcct cache_datatresptmsgR%tnowR/t current_agetresp_cctfreshness_lifetimeR1t expire_timet min_fresh((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pytcached_requestVs                                cCs|j|j}|jj||jj|}i}|rt|j}d|krk|d|d 0R1sCaching b/c of expires header(R:R3R4RR%R7R@RAtlenR.RR2R5R6tTrueR R;R tsetR tdumps( R RCtresponseRRtcacheable_status_codestresponse_headerstcc_reqRDRtno_store((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pytcache_responsesd        &  "    cs|j|j}|jj||jj|}|s=|Sdg|jjtfd|jj Dd|_ |jj ||jj |||S(sOn 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. scontent-lengthc3s3|])\}}|jkr||fVqdS(N(R(t.0tktv(texcluded_headers(sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pys Ts i( RR2R R8R R6R%tupdateR$titemsR:RURV(R RCRWRtcached_response((R`sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pytupdate_cached_response6s   &  N(t__name__t __module__t__doc__R7RTRt classmethodRRR.RNRQR\Rd(((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pyR s  y  W(RgtloggingtreR=R<t email.utilsRtpip._vendor.requests.structuresRR Rt serializeRt getLoggerReR3tcompileRRtobjectR (((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pyts     site-packages/pip/_vendor/cachecontrol/controller.pyo000064400000021566147204247350017112 0ustar00 abc@sdZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ej eZejdZd Zd efd YZdS( s7 The httplib2 algorithms ported for use with requests. iN(t parsedate_tz(tCaseInsensitiveDicti(t DictCache(t Serializers9^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?cCs<tj|j}|d|d|d|d|dfS(sParses a URI using the regex given in Appendix B of RFC 3986. (scheme, authority, path, query, fragment) = parse_uri(uri) iiiii(tURItmatchtgroups(turiR((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pyt parse_uristCacheControllercBsneZdZd ed dZedZedZdZ dZ dZ d dZ dZ RS( s9An interface to see if request should cached or not. cCs1|p t|_||_|p't|_dS(N(Rtcachet cache_etagsRt serializer(tselfR R R ((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pyt__init__!s c Cst|\}}}}}| s)| r<td|n|j}|j}|scd}n|r~dj||gp|}|d||}|S(s4Normalize the URL to create a safe key for the caches(Only absolute URIs are allowed. uri = %st/t?s://(Rt Exceptiontlowertjoin( tclsRtschemet authoritytpathtquerytfragmentt request_urit defrag_uri((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pyt_urlnorm&s   !cCs |j|S(N(R(RR((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pyt cache_url:sc Csi}d}d|kr!d}n||kr||jd}g|D]R}d|jdkrGtg|jddD]}|jj^qx^qG}g|D]3}d|jdkr|jjdf^q} t|| }n|S(sz Parse the cache control headers returning a dictionary with values for the different directives. s cache-controls Cache-Controlt,it=i(tsplittfindttupletstripRtdict( R theaderstretvalt cc_headertpartstparttxtparts_with_argstnamet parts_wo_args((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pytparse_cache_control>s   \=cCs^|j|j}tjd||j|j}d|krQtjdtSd|kr~|ddkr~tjdtS|jj|}|dkrtjdtS|j j ||}|stj dtS|j d krd }tj||St|j}| s!d |kr^d |krMtjd |jj|ntjdtStj}tjt|d } td|| } tjd| |j|} d} d| kr| djrt| d} tjd| n`d|krZt|d} | dk rZtj| | }td|} tjd| qZnd|kry$t|d} tjd| Wqtk rd} qXnd|kryt|d}Wntk rd}nX| |7} tjd| n| | kr.tjdtjd| | |Sd |krZtjd|jj|ntS(se Return a cached response if it exists in the cache, otherwise return False. sLooking up "%s" in the cachesno-caches-Request header has "no-cache", cache bypassedsmax-ageis1Request header has "max_age" as 0, cache bypassedsNo cache entry availables1Cache entry deserialization failed, entry ignoredi-sVReturning cached "301 Moved Permanently" response (ignoring date and etag information)tdatetetags(Purging cached response: no date or etags!Ignoring cached response: no datesCurrent age based on date: %is#Freshness lifetime from max-age: %itexpiress#Freshness lifetime from expires: %is+Freshness lifetime from request max-age: %is min-freshs'Adjusted current age from min-fresh: %is2The response is "fresh", returning cached responses%i > %is4The cached response is "stale" with no etag, purgingN(RturltloggertdebugR.R%tFalseR tgettNoneR tloadstwarningtstatusRtdeletettimetcalendarttimegmRtmaxtisdigittintt ValueError(R trequestRtcct cache_datatresptmsgR%tnowR/t current_agetresp_cctfreshness_lifetimeR1t expire_timet min_fresh((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pytcached_requestVs                                cCs|j|j}|jj||jj|}i}|rt|j}d|krk|d|d 0R1sCaching b/c of expires header(R:R3R4RR%R7R@RAtlenR.RR2R5R6tTrueR R;R tsetR tdumps( R RCtresponseRRtcacheable_status_codestresponse_headerstcc_reqRDRtno_store((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pytcache_responsesd        &  "    cs|j|j}|jj||jj|}|s=|Sdg|jjtfd|jj Dd|_ |jj ||jj |||S(sOn 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. scontent-lengthc3s3|])\}}|jkr||fVqdS(N(R(t.0tktv(texcluded_headers(sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pys Ts i( RR2R R8R R6R%tupdateR$titemsR:RURV(R RCRWRtcached_response((R`sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pytupdate_cached_response6s   &  N(t__name__t __module__t__doc__R7RTRt classmethodRRR.RNRQR\Rd(((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pyR s  y  W(RgtloggingtreR=R<t email.utilsRtpip._vendor.requests.structuresRR Rt serializeRt getLoggerReR3tcompileRRtobjectR (((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.pyts     site-packages/pip/_vendor/cachecontrol/filewrapper.py000064400000004743147204247350017066 0ustar00from 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 site-packages/pip/_vendor/cachecontrol/filewrapper.pyc000064400000005153147204247350017225 0ustar00 abc@s*ddlmZdefdYZdS(i(tBytesIOtCallbackFileWrappercBsGeZdZdZdZdZdZddZdZ RS(sv 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. cCs"t|_||_||_dS(N(Rt_CallbackFileWrapper__buft_CallbackFileWrapper__fpt_CallbackFileWrapper__callback(tselftfptcallback((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pyt__init__s  cCs|jd}t||S(NR(t__getattribute__tgetattr(RtnameR((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pyt __getattr__s cCsNy|jjdkSWntk r'nXy|jjSWntk rInXtS(N(RRtNonetAttributeErrortclosedtFalse(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pyt__is_fp_closed!s  cCs/|jr"|j|jjnd|_dS(N(RRtgetvalueR (R((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pyt_close0s cCs?|jj|}|jj||jr;|jn|S(N(RtreadRtwritet"_CallbackFileWrapper__is_fp_closedR(Rtamttdata((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pyR;s   cCs[|jj|}|dkr.|dkr.|S|jj||jrW|jn|S(Nis (Rt _safe_readRRRR(RRR((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pyRCs  N( t__name__t __module__t__doc__RR RRR RR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pyRs    N(tioRtobjectR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pytssite-packages/pip/_vendor/cachecontrol/filewrapper.pyo000064400000005153147204247350017241 0ustar00 abc@s*ddlmZdefdYZdS(i(tBytesIOtCallbackFileWrappercBsGeZdZdZdZdZdZddZdZ RS(sv 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. cCs"t|_||_||_dS(N(Rt_CallbackFileWrapper__buft_CallbackFileWrapper__fpt_CallbackFileWrapper__callback(tselftfptcallback((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pyt__init__s  cCs|jd}t||S(NR(t__getattribute__tgetattr(RtnameR((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pyt __getattr__s cCsNy|jjdkSWntk r'nXy|jjSWntk rInXtS(N(RRtNonetAttributeErrortclosedtFalse(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pyt__is_fp_closed!s  cCs/|jr"|j|jjnd|_dS(N(RRtgetvalueR (R((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pyt_close0s cCs?|jj|}|jj||jr;|jn|S(N(RtreadRtwritet"_CallbackFileWrapper__is_fp_closedR(Rtamttdata((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pyR;s   cCs[|jj|}|dkr.|dkr.|S|jj||jrW|jn|S(Nis (Rt _safe_readRRRR(RRR((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pyRCs  N( t__name__t __module__t__doc__RR RRR RR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pyRs    N(tioRtobjectR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.pytssite-packages/pip/_vendor/cachecontrol/heuristics.py000064400000010055147204247350016721 0ustar00import 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 site-packages/pip/_vendor/cachecontrol/heuristics.pyc000064400000013461147204247350017070 0ustar00 abc@sddlZddlZddlmZmZmZddlmZmZdZddZ dZ de fdYZ d e fd YZd e fd YZd e fdYZdS(iN(t formatdatet parsedatet parsedate_tz(tdatetimet timedeltas%a, %d %b %Y %H:%M:%S GMTcCs|ptj}||S(N(Rtnow(tdeltatdate((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.pyt expire_after scCsttj|jS(N(Rtcalendarttimegmt timetuple(tdt((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.pytdatetime_to_headerst BaseHeuristiccBs#eZdZdZdZRS(cCsdS(s! 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. s110 - "Response is Stale"((tselftresponse((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.pytwarnings cCsiS(sUpdate 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. ((RR((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.pytupdate_headers!scCsa|j|}|r]|jj||j|}|dk r]|jji|d6q]n|S(NtWarning(RtheaderstupdateRtNone(RRtupdated_headerstwarning_header_value((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.pytapply*s (t__name__t __module__RRR(((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.pyRs t OneDayCachecBseZdZdZRS(sM Cache the response by providing an expires 1 day in the future. cCsni}d|jkrjt|jd}ttdddt|d }t||ds    "site-packages/pip/_vendor/cachecontrol/heuristics.pyo000064400000013461147204247350017104 0ustar00 abc@sddlZddlZddlmZmZmZddlmZmZdZddZ dZ de fdYZ d e fd YZd e fd YZd e fdYZdS(iN(t formatdatet parsedatet parsedate_tz(tdatetimet timedeltas%a, %d %b %Y %H:%M:%S GMTcCs|ptj}||S(N(Rtnow(tdeltatdate((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.pyt expire_after scCsttj|jS(N(Rtcalendarttimegmt timetuple(tdt((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.pytdatetime_to_headerst BaseHeuristiccBs#eZdZdZdZRS(cCsdS(s! 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. s110 - "Response is Stale"((tselftresponse((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.pytwarnings cCsiS(sUpdate 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. ((RR((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.pytupdate_headers!scCsa|j|}|r]|jj||j|}|dk r]|jji|d6q]n|S(NtWarning(RtheaderstupdateRtNone(RRtupdated_headerstwarning_header_value((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.pytapply*s (t__name__t __module__RRR(((sG/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.pyRs t OneDayCachecBseZdZdZRS(sM Cache the response by providing an expires 1 day in the future. cCsni}d|jkrjt|jd}ttdddt|d }t||ds    "site-packages/pip/_vendor/cachecontrol/serialize.py000064400000014610147204247350016527 0ustar00import 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) site-packages/pip/_vendor/cachecontrol/serialize.pyc000064400000013720147204247350016673 0ustar00 abc@sddlZddlZddlZddlZddlmZddlmZmZm Z dZ dZ dZ dZ d Zd efd YZdS( iN(tCaseInsensitiveDicti(t HTTPResponsetpicklet text_typecCstj|jdS(Ntascii(tbase64t b64encodetdecode(tb((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyt_b64_encode_bytes scCst|jdS(Ntutf8(R tencode(ts((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyt_b64_encode_strscCs#t|trt|St|S(N(t isinstanceRR R (R ((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyt _b64_encodes cCstj|jdS(NR(Rt b64decodeR (R((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyt_b64_decode_bytesscCst|jdS(NR (RR(R ((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyt_b64_decode_strst SerializercBsAeZddZdZdZdZdZdZRS(c Csxt|j}|dkrB|jdt}tj||_niit|d6t d|jj Dd6|j d6|j d6t |jd6|jd6|jd6d 6}i|d 9stheaderststatustversiontreasontstricttresponsetvaryt,css?|]5\}}t||dk r0t|n|fVqdS(N(RtNone(RRR((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pys Nsscc=2t separatorst:t sort_keysR (R R#(RRR!treadtFalsetiotBytesIOt_fpR tdicttitemsRRR RRRtsplittstriptgettjointzlibtcompresstjsontdumpstTrueR (tselftrequestRRtresponse_headerstdatatvaried_headerstheader((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyR3#s<          $cCs|s dSy|jdd\}}Wntk r?d}nX|d dkrc||}d}n|jdddjd}y#t|d j|||SWntk rdSXdS( NR iscc=0iscc=t=iRs _loads_v{0}(R,t ValueErrorRtgetattrtformattAttributeError(R5R6R8tver((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pytloads[s    # cCsd|jdikrdSxE|jdijD]+\}}|jj|d|kr5dSq5W|djd}td|dd}|jdd d kr|jdn||ddsRRcss?|]5\}}t||dk r0t|n|fVqdS(N(RR!(RRR((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pys sR( R2RAR0t decompressRR<RR*R+RRK(R5R6R8RH((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyt _loads_v2s% #N( t__name__t __module__R!R3RARKRLRMRO(((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyR!s  8  (  (RR'R2R0tpip._vendor.requests.structuresRtcompatRRRR R RRRtobjectR(((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyts         site-packages/pip/_vendor/cachecontrol/serialize.pyo000064400000013720147204247350016707 0ustar00 abc@sddlZddlZddlZddlZddlmZddlmZmZm Z dZ dZ dZ dZ d Zd efd YZdS( iN(tCaseInsensitiveDicti(t HTTPResponsetpicklet text_typecCstj|jdS(Ntascii(tbase64t b64encodetdecode(tb((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyt_b64_encode_bytes scCst|jdS(Ntutf8(R tencode(ts((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyt_b64_encode_strscCs#t|trt|St|S(N(t isinstanceRR R (R ((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyt _b64_encodes cCstj|jdS(NR(Rt b64decodeR (R((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyt_b64_decode_bytesscCst|jdS(NR (RR(R ((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyt_b64_decode_strst SerializercBsAeZddZdZdZdZdZdZRS(c Csxt|j}|dkrB|jdt}tj||_niit|d6t d|jj Dd6|j d6|j d6t |jd6|jd6|jd6d 6}i|d 9stheaderststatustversiontreasontstricttresponsetvaryt,css?|]5\}}t||dk r0t|n|fVqdS(N(RtNone(RRR((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pys Nsscc=2t separatorst:t sort_keysR (R R#(RRR!treadtFalsetiotBytesIOt_fpR tdicttitemsRRR RRRtsplittstriptgettjointzlibtcompresstjsontdumpstTrueR (tselftrequestRRtresponse_headerstdatatvaried_headerstheader((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyR3#s<          $cCs|s dSy|jdd\}}Wntk r?d}nX|d dkrc||}d}n|jdddjd}y#t|d j|||SWntk rdSXdS( NR iscc=0iscc=t=iRs _loads_v{0}(R,t ValueErrorRtgetattrtformattAttributeError(R5R6R8tver((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pytloads[s    # cCsd|jdikrdSxE|jdijD]+\}}|jj|d|kr5dSq5W|djd}td|dd}|jdd d kr|jdn||ddsRRcss?|]5\}}t||dk r0t|n|fVqdS(N(RR!(RRR((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pys sR( R2RAR0t decompressRR<RR*R+RRK(R5R6R8RH((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyt _loads_v2s% #N( t__name__t __module__R!R3RARKRLRMRO(((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyR!s  8  (  (RR'R2R0tpip._vendor.requests.structuresRtcompatRRRR R RRRtobjectR(((sF/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.pyts         site-packages/pip/_vendor/cachecontrol/wrapper.py000064400000000762147204247350016223 0ustar00from .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 site-packages/pip/_vendor/cachecontrol/wrapper.pyc000064400000001270147204247350016361 0ustar00 abc@s9ddlmZddlmZdedddZdS(i(tCacheControlAdapter(t DictCachecCsQ|p t}t|d|d|d|}|jd||jd||S(Nt cache_etagst serializert heuristicshttp://shttps://(RRtmount(tsesstcacheRRRtadapter((sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/wrapper.pyt CacheControls N(RRRRtNonetTrueR (((sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/wrapper.pyts site-packages/pip/_vendor/cachecontrol/wrapper.pyo000064400000001270147204247350016375 0ustar00 abc@s9ddlmZddlmZdedddZdS(i(tCacheControlAdapter(t DictCachecCsQ|p t}t|d|d|d|}|jd||jd||S(Nt cache_etagst serializert heuristicshttp://shttps://(RRtmount(tsesstcacheRRRtadapter((sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/wrapper.pyt CacheControls N(RRRRtNonetTrueR (((sD/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/wrapper.pyts site-packages/pip/_vendor/certifi/__init__.py000064400000000077147204247350015262 0ustar00from .core import where, old_where __version__ = "2018.01.18" site-packages/pip/_vendor/certifi/__init__.pyc000064400000000411147204247350015415 0ustar00 abc@s ddlmZmZdZdS(i(twheret old_wheres 2018.01.18N(tcoreRRt __version__(((s@/usr/lib/python2.7/site-packages/pip/_vendor/certifi/__init__.pytssite-packages/pip/_vendor/certifi/__init__.pyo000064400000000411147204247350015431 0ustar00 abc@s ddlmZmZdZdS(i(twheret old_wheres 2018.01.18N(tcoreRRt __version__(((s@/usr/lib/python2.7/site-packages/pip/_vendor/certifi/__init__.pytssite-packages/pip/_vendor/certifi/__main__.py000064400000000051147204247350015233 0ustar00from certifi import where print(where()) site-packages/pip/_vendor/certifi/__main__.pyc000064400000000326147204247350015403 0ustar00 abc@sddlmZeGHdS(i(twhereN(tcertifiR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/certifi/__main__.pytssite-packages/pip/_vendor/certifi/__main__.pyo000064400000000326147204247350015417 0ustar00 abc@sddlmZeGHdS(i(twhereN(tcertifiR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/certifi/__main__.pytssite-packages/pip/_vendor/certifi/core.py000064400000001446147204247350014454 0ustar00#!/usr/bin/env python # -*- coding: utf-8 -*- """ certifi.py ~~~~~~~~~~ This module returns the installation location of cacert.pem. """ import os import warnings class DeprecatedBundleWarning(DeprecationWarning): """ The weak security bundle is being deprecated. Please bother your service provider to get them to stop using cross-signed roots. """ def where(): return '/etc/pki/tls/certs/ca-bundle.crt' def old_where(): warnings.warn( "The weak security bundle has been removed. certifi.old_where() is now an alias " "of certifi.where(). Please update your code to use certifi.where() instead. " "certifi.old_where() will be removed in 2018.", DeprecatedBundleWarning ) return where() if __name__ == '__main__': print(where()) site-packages/pip/_vendor/certifi/core.pyc000064400000002514147204247350014614 0ustar00 abc@sadZddlZddlZdefdYZdZdZedkr]eGHndS(sU certifi.py ~~~~~~~~~~ This module returns the installation location of cacert.pem. iNtDeprecatedBundleWarningcBseZdZRS(s The weak security bundle is being deprecated. Please bother your service provider to get them to stop using cross-signed roots. (t__name__t __module__t__doc__(((s</usr/lib/python2.7/site-packages/pip/_vendor/certifi/core.pyRscCsdS(Ns /etc/pki/tls/certs/ca-bundle.crt((((s</usr/lib/python2.7/site-packages/pip/_vendor/certifi/core.pytwherescCstjdttS(NsThe weak security bundle has been removed. certifi.old_where() is now an alias of certifi.where(). Please update your code to use certifi.where() instead. certifi.old_where() will be removed in 2018.(twarningstwarnRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/certifi/core.pyt old_wherest__main__(RtosRtDeprecationWarningRRRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/certifi/core.pyt s    site-packages/pip/_vendor/certifi/core.pyo000064400000002514147204247350014630 0ustar00 abc@sadZddlZddlZdefdYZdZdZedkr]eGHndS(sU certifi.py ~~~~~~~~~~ This module returns the installation location of cacert.pem. iNtDeprecatedBundleWarningcBseZdZRS(s The weak security bundle is being deprecated. Please bother your service provider to get them to stop using cross-signed roots. (t__name__t __module__t__doc__(((s</usr/lib/python2.7/site-packages/pip/_vendor/certifi/core.pyRscCsdS(Ns /etc/pki/tls/certs/ca-bundle.crt((((s</usr/lib/python2.7/site-packages/pip/_vendor/certifi/core.pytwherescCstjdttS(NsThe weak security bundle has been removed. certifi.old_where() is now an alias of certifi.where(). Please update your code to use certifi.where() instead. certifi.old_where() will be removed in 2018.(twarningstwarnRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/certifi/core.pyt old_wherest__main__(RtosRtDeprecationWarningRRRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/certifi/core.pyt s    site-packages/pip/_vendor/chardet/__init__.pyc000064400000001742147204247350015412 0ustar00 abc@sIddlmZmZddlmZddlmZmZdZdS(i(tPY2tPY3(tUniversalDetector(t __version__tVERSIONcCskt|tsKt|ts<tdjt|qKt|}nt}|j||jS(s Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` s4Expected object of type bytes or bytearray, got: {0}( t isinstancet bytearraytbytest TypeErrortformatttypeRtfeedtclose(tbyte_strtdetector((s@/usr/lib/python2.7/site-packages/pip/_vendor/chardet/__init__.pytdetects   N( tcompatRRtuniversaldetectorRtversionRRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/chardet/__init__.pytssite-packages/pip/_vendor/chardet/big5freq.pyc000064400000152655147204247350015371 0ustar00 abc@sdZdZdZdS(g?iii iiiii iRiiiiiaii inii!i iiLi,iBii iiiiii{ i] iii ijiii.iNiiiiii:iiii?iii=iNiKiiikiq iii i ii ibii iiii ioi2 iiiii ici8iiiiiiiii{i|ii i"i i i@i\ii iiiiiiiFii| iQiHiiiPivii iiiiDi^ iiiFi} iiEi iOii0iisii4i<i2i ii&iMiii~ iiiGiii[ iii?ii iaiiK i*iigi iZi i:ii iiKi ii iiiiii`iliii ii i iqii~iii i ii iiiciiuiii*iii i ii~imiiiieiiGi^iinii iUiCiiCiiiiiii ijioi/iiiPi7 i[iii i? iiiioiSi(ii iipi]ii6iji i@ iiiiii8ii+i3 i[iii\iiiiii] iA iii i1iiiHi i idiii+i i2iiii iOiL iiifi1iiiiiiii3i9iili,ii iiiiiii ieiz iQiMi&i iXiiiiii iiiikipiiMiii i%ii iiiii'i ii\ i ii7iiJii!iiiiiiNiiB iPi_ iqiii iii i ii ii i iIii8 ii ii{ ii i iiiimiiifiiixii iii ii iigiii iiiiiiii&ii'iiiiii.ii iiiM iiiii$i#iiDihiAi iiiriiiUiGiiii i iQiSiiiiidi i0iFiiiC iiiii iiJii iUiiiiN i iii<ii i:iA i ii i i9ii}ii iiiWiPi ii)iDiiii4 i i i)iiir iisiiitii9 iiiis i*iiiiiii] iiiii iD iji( i iii iiui5iYiji iliiuiii iii` i i=i iiiiiii5ii!iiiTiE ixiiieii iiO iPii| i6iAi i/iki i iili!i iiBii`ii i iiAii iiii ivi i iiwiiiiMi iiiiiia iii i} iixi,i}ii iB iiiiiiiiiF ikimi ii ii ii iibii) i^ iP i i,ii ii7i5 i~ iyi|i iziiii iC i{iiiiiiiiii1iibii i iiit ii ii_ iiiiii i i ib iiii5iDiiilii|i[i* iii ii%iiG i^ iiliii ii` iii ipiiinicigimiii'i2iiii{ii ii iiiD iifi ii|i: iiiii i i i i ii inii iii;iiIiYi}ii iXi"ii iiiiiii-iiliiiiiiiiiEii~ii>i]ii,iiiiviLiBiii&iii iiiiGiiiiBii i+ iii iiiii i iaiiii ia ii}iE iiDii=ii0i ii i6 iiiivi!iiiiiiiii9iHiiiii iFiiiiii"iiH iii i ioiiiRi*ii.iiiiiiI i3ii, ii*iSiiiiXiii/iibipii iiiiiiiRii ii7 ii2ii iiiiiii_ iib ii iiii iiiiiii` iOii i i`i7i i iiiiiiia iiiiiiigiii ii i_ii~iiiiii iaii ib iiiii iii i;ii i-i iiQ iiiiqiiiii`ii#i#iiiiiri isiiiiditi iic ii ikiwi ii iiiiiiiigi iQiiUi i iiiiiCiSiic iii5iiiBii_i iciNiiiYiiii iiLidi i i iKi i8 iaiGiii i iiisi6i iti; iNiii i i4ii:ii\iqiiii.iii iui iiii i ii iriii i iic iiii@iii ii ii ii/i9 ii iiiiiii i< id iiii8iviiCiii iimii iiiiiiZiiiiiwi i{iiiii$iiiMid i0irii iigiiViiiii: iZiii{i$ie i0iii$i i i ii5ii[iiviiiciiViR i$i; iiiif iii idiiiWie iii iii i iiJ iiiiiuii ii ii i iK ii2iiL i i.iii2ii iiiiii%i iii i iiiiiiii i ixi iM ii}iiiTiiiid i iiiii`iiiii i3iii;i iiiiyiYiLiii i iiiiiUi\iiiiiiViN iii iii ii"ixi%ii;i= i iii2iEii!iiii^ii"iwi i#iiii ii$i<iQiiiri%ii]ii&ii< i'i i3i6iBii i(iii ii i iig i i i)i i i*i+i! iiiii:ii7ii^ii iii(i i,i+i i ixi-ii/ihi= i.iiiiiVi ii ihii i/iiiii<iii;i0iiii i i1izi i ii5i6i i_i)i2i3ii4iyi" iii ii^i5i i i?i%i+if i i6i_iWiii i7i> ii ig i# iiu i8i ii9ih iF iiVi{i iO iiIiwi~i i^iii:iiiiiiii i;iei1iiiiiiiii i i iiP i<i=ii>i ii(i`iRi? iYiiIi iii i7i i i?iii i@iioiiqiYiniiiliiii ii ii iEiPiVii! i iiiiiniiAii|i ii iBiiiiii- i iOi i iCiiDiWiTiTiiiii i}iEii&i i iiiiii iii~iG i iii$ iWiiiioii iFiiGiii" iiii# iiiDi-iQ iiHiei i iiIi iiiJizi iiKiiiLii$ i iiiiiH iiiiiiiMi:i iiiNiiI i iiiHiiiiiOiii iPiQiiikiRiR i iii i i ii iiiiiiSiTiii i% iiiiii& iS iUi iiS iiCiiiiVi~ii!iXiiiiii,iiiiiOii|iiiiPiie iiii i i iiiiiiiiT iiiiiWiiiiXiiYiiRi iviii ii i=i iiZiiU iii[i iiiV i% i\iii]iii^i8iT i. i' i_iiviiiiiwitii`iaibi> iii"i{ii i iiciidi9iiiii[i9iiidih i ieiii iJ i!iiifiiii iiiTigiii i%iiWiMihiiiiiiiiiiiiii( ij iiyi7imiijiki i? iW i"iiii iBiili|i ii) iziii iii iiiiimiiniuiv iwii i* iiioipiiiqi7i.irii i iii iifii i isi& iyi ii i iiiii i i>iiii iiYi iitiiui/ i+ i ivi ii i@ iwii i iii3iiii, ixi i6i9i i iii6i iii! iiiyiiQi:ici iii- ioiiiFiX i i iifi iizi iii iii{i/iii' i ibiii`iiiiui iviiiii i i iiii i0iEiiSii8i[i|i}iGii ii!i~iiiFiU ii ii iieisiii iw iiii" i iai iZi&iiiii i iiiiAiii iiii iiiiiiiii ioii ii i i ii iiA i iJi0i ix i ii iiY iiiiii i i iiZ i8ioiiiQiiiii iiiaiQiiipi;iiiPiibiiiii i ii iiii iii iiiiiiiii]iiiii iiiiii'iii. i ii iiiii iLiiiiii ii/ iiiiiB i0 i[ ii8iiiii iii/i3iiiii iiii0i iniiiiiiiii i iiiiiiiii4iiiii<i ii iiiYi iiiiC iiii iiiii}i1ii iiiiKii ii0 iFiiii ii#ii\iiiifi i>i iii iiiiii i iiiiijiiiiii-ipi9i@ i6iyiiii i i1 iiiiiiiiViiiii4iii iKi1 ii iD i iiiiii#iiii i2 iiii iZiHipiiigiii i iqiri iiiiii i iK iV i i\ i,i ii iiii]iiiuii iiiiiiiiiZiii iiiiijiii0ihihiii ii iE iii iii iiiiiiiiiii iiii2 iiiiiiiMiiwiii iy i?iiii itimi( i ii+iiiiiiiiii i ii i iii iiL iii) i ii iiif ii iiiiiiiRi"iA i3 i ii-i1ii$i i(ii] i i# ii$ i iiii i* iiii i ii i i=ik ii!ii iiii i ii ii_iiiii^ i2ii iiii9iii iiii4 i iii iibiiii ii iii5ii iii"i i iiiiii4iIi ii#ii iiiiiiij iiii$ik i ii ii\i igiiEi5 iiiiiiiii iii6 iiii ii%iii ii i[i iiiiii i&ieiii iiioi iil i i}iiiizii+ iii iiiini-ii i'iiii iiii(iii iiiiiiii ii iiiBiiiqiiii<ii*iji)i"i*ii>i)i7 ii+iiiiiiiizii,iiiiiM i)iriii-i i iiiiiiTiipiii#i#iiiiiiii iiii i ii iiSii.i8 iiiiiz i9 i=iiiim iiSiiiiiixiii/iiiqiii3ii5ii: i i ii iiiiii i; i i0i1iiiiiin ii_ ii]i i iniiiii i% iiiii i` iiiiiziTisi2i3 ii i{ ii5iiii ig iiikiiiii iii3i4ii iici iii i iiiai:i1i iii!iAihi io i i6i"iii il i-ii ia i5ii ii i ii#i! ii$ii ii4 ifii i%i& i iN i iiWiiiiii i' ii$iii< i iNiiiW ikiiO iiiiiiiX i, ii6i&itiiP ii i7i i i i- ijii i iiCi[ip ii i'i8i ib iim i i ii{i(i i ii i9i i i i:i i i^iiiiB i;iiiiii iii ii ii)i<i=i ii ii>iiiii i=iiiiiiiiiiin iiHiDi i?iiUiWi i= ii:ii iNi iKiEi@i4ic i ii> iiQ i iAiiihiii i i( i]iiiiBi*iiiliiCiDiiEih iiiiiiiXiiiii+iiii+iJiiiUiii iimi iEiiiiFiiGi iki inii id iiiiiiiiF i!i iiri@iiHi"iCiGiiii ii^i ii i8iti) i;i i? i!iioiIi i"i#i#i$iiJi i%i i&iriKi'i5 i(i)iio i@ i}iA ii,ii*i4i1i+ii i i ii" ii,ii iC iiuiriD i-i i-i iLivi{ii| iMi.i.iNiY i6 iii i/i0i/i ii1i$ii2i%iGiRiB i i_iiiC ii iD ii3iiiii ii i. ii i4i@iwii5ii6i7iii ii&i0ii8i i&i i* ii+ iG iOiuii# i i1iPiRiiQii ii)iii=i9iili iiiiE iSiiki i\i iii iyi:i i;i<iF i%i=iiRiii>idi'i, i?iei$ ii2i3i- ii i4ii(iSi@iAiBii.iTiiOi i iiiii i&i iii i<i iiiiCiiDi iiUiip iG ie i i i ii iEi;iViFi'iGi)i ii} iHi*iiWiiiIiiTii i iiiiii iiJi. igi~iiUiij i iiiXiii8ii*i iiiKi~ iii iLiiH i iii% ii+if iii iitiiMiNiii ii ii iiik iYiiYiiii*i/ iiOiR iZiH ii#iI i i iii5iS i]iE i[i\i isiI i+iPiQi,i i iRiiSiTii,iiUi]iVi iiLi-i!i iT i\i4iWi iiXiYiZii[i>iwiiiii+i^iiJ ii_i$ii\iiiili.i]i`ii^i_iq i%ii`iaiiii i6ig iU ibicidiai iq ixi iei ibiyi ifihigihiii'iii iii ijir ii i0 i i=iibi|iiiiii i iih iki iliii iaiicimiii ini iiui iidieiis iK i/ioi7ii& i iJ i8ipiqii ij ifii igi iii(ii`irisi i iii<iFik ifiiiii]iiiIiti>iiuiivii iii i0ii-iiwiL ii iiiiiGiaii it i ii iSiKixiiyiziiiV iiiOii1 ii i{i i iiF iyii9iZ ii|i}i~iFi iii i i:iiiii2 iiiipii;iG iii ihiiiii7 iiiiiqiiiM iiiiiii iii iii i(i8 iiN i ii3 i iiO i<iiiiTiiW i iiiii(iiii1iiiiiiiiu iZii i iciijiP ipiii iiii iv iiijii iiii iQ iK i ii i' iiiiii9 iii i izii i iiikiiiii ii2i iiliii>i=iCi'iii>i iiZiiii imini iibiii i iqi?ii ii ii i"ii i?i i}iiioi@i>iiAi i1ii)iiii?i i iiiixi ii ii i3i i ihii il iiii)ii ipii'iiii4ii i i iiiiAi_i iBiiL ii iPiqii iiriiiiiX iicisi! iiiiHii iw iiiiCiDitiiiiiiix i ii i/ iiii5i i4 iuiir iii_iii/i i<ii~i7iy im iii^i5 in ibi itiiil iiii6ii i7iiiiiiiviiii i8i: ii ii0 i i1 iiwiiIiiiii i( iiiBi ii4isi iiiii i iii?iCiixi iEiHi iiFiyiziGiiiii{iiii|ii; i}i9imiH i~iiz iiis i iiM iiii iiim iiiIiiiio iiiiiiii_iiii i2 i3 iHii*iii iiii< iiii:ii ii iiAii iiR iiiii i ii" ii iiiiii ii iii iiiQi i iY iiiiiiii{iKii ii[i iJiiiN iiS iiiiiI iiiT i@ii iii i i@iiRiii it iiiiJiIii iiiii iU iimiiii{ i ii i i;iV iii iii<iii idiiiiXiii9iii6 iiiUiiii iiLi!i= ii) ii i i iii i iii ii=i$i(iviii&iicii iii i ii>iiii{i"iiiii#iiiiiW ii iiii ii$i i%iiiiii&i^iii[ i ii'iiiiiiii(i iii2i\ iJi ip ipin iiu iq i)ii iO i> ii i*iX iii i+ii i,i iii iiiiiKii i iiIi-iii!iiiiii.iDiiiJisi# iii ii7 iiii/iwii|iiiiii"i4 i| i,iiiii iiiiiiiii?iY iP i0ii1iZ iZ i ii i ii i#i@i2ii|iiziiiiiAi'ii? ii ii8 ii iyiiLiVi i3i i i i$iiiiMii%ii i i i i i.ii4iNiii ii i i iiii i5i9 i%iiiiKiQ iiixi6i7iiBi i iOiv i[ iii&ii ii iiiXii* ii\ iPi i iNi+ iw iiiiiWiCi ii iQiDi i?i] iiii^ io iR i i iEii iiFi i'iiXiiGiiS i iiT iRii8ixi ikiSiiTiii ii iiDii9i!iiiii(iiLi"i#i$i%i_ ii&iJi:iUii}i i)ii i;i<i iEi+i'i iiHi=iVi*iHiyi, i+iWi3i>i ii?i(iIi,i-i` iqiia i iii ii)i*iXi i+iiOiiYi,i-ii.ii/i ii0i.iiii1i iJir i2i3i$ i i4ii5i6i7i iib i iii} i ifiiKii i i i i8iZi9ii: ii ic ii:ii i;is iJ i@ii it i; i i/i<id ii iiiU ii0iie i=iif iu iMiiiii i>i i[iiAiLiiii?i i i i i@iAiv iBiCi\iijii[ i ig iDiEiiiFi iBiiGi iiHii(iiMiCih iiIiNiJi iKiLiiiMii1i2iNiiidiOidiV iDi`ii#i5 iPi]iQiEini i iii^iRi_iFiSip ii iiTiUii i iVii i iiGiiiieiHiOi iiPi`iWiw ij iXi ii3i iaiiIiYiJix i7iiii- i i4ik iibiZi-iii. icii[i iri;i iKi5iLiXii i iii\i]iii6i% i^i_iii~i`il iy iaizi~ iiibi?iici7idi iiieiiz iiiMifigi/ ihi|ii@idiiiiiNiiii8ifiiijikiiOiPiiilimi@ini9i ioi i iii< isii\ iQi.iRiNi@i iipiiSi{ iqiiAii iiiiTi iiii:iiiri isi@ iW i;itiui iviwixiyi| iiiiizi i i3iQiiimiiAi{i|ii ii}iOiRi iigiii~iZi iiiiii i\im ii} ii<iX ii ii i iiii iiY iiii0 iiii i=i iiiiLiiiiihiiiiii>i>ii/i?iUiiiiiiei)ix itiifiSii iy i in i i iiTi i@ii i iiiiiiii ii iziUigiiViio iii6 ip itiiiiiii iAiiJiVihiZ i iiWiiiiN(ii iiiii iRiiiiiaii inii!i iiLi,iBii iiiiii{ i] iii ijiii.iNiiiiii:iiii?iii=iNiKiiikiq iii i ii ibii iiii ioi2 iiiii ici8iiiiiiiii{i|ii i"i i i@i\ii iiiiiiiFii| iQiHiiiPivii iiiiDi^ iiiFi} iiEi iOii0iisii4i<i2i ii&iMiii~ iiiGiii[ iii?ii iaiiK i*iigi iZi i:ii iiKi ii iiiiii`iliii ii i iqii~iii i ii iiiciiuiii*iii i ii~imiiiieiiGi^iinii iUiCiiCiiiiiii ijioi/iiiPi7 i[iii i? iiiioiSi(ii iipi]ii6iji i@ iiiiii8ii+i3 i[iii\iiiiii] iA iii i1iiiHi i idiii+i i2iiii iOiL iiifi1iiiiiiii3i9iili,ii iiiiiii ieiz iQiMi&i iXiiiiii iiiikipiiMiii i%ii iiiii'i ii\ i ii7iiJii!iiiiiiNiiB iPi_ iqiii iii i ii ii i iIii8 ii ii{ ii i iiiimiiifiiixii iii ii iigiii iiiiiiii&ii'iiiiii.ii iiiM iiiii$i#iiDihiAi iiiriiiUiGiiii i iQiSiiiiidi i0iFiiiC iiiii iiJii iUiiiiN i iii<ii i:iA i ii i i9ii}ii iiiWiPi ii)iDiiii4 i i i)iiir iisiiitii9 iiiis i*iiiiiii] iiiii iD iji( i iii iiui5iYiji iliiuiii iii` i i=i iiiiiii5ii!iiiTiE ixiiieii iiO iPii| i6iAi i/iki i iili!i iiBii`ii i iiAii iiii ivi i iiwiiiiMi iiiiiia iii i} iixi,i}ii iB iiiiiiiiiF ikimi ii ii ii iibii) i^ iP i i,ii ii7i5 i~ iyi|i iziiii iC i{iiiiiiiiii1iibii i iiit ii ii_ iiiiii i i ib iiii5iDiiilii|i[i* iii ii%iiG i^ iiliii ii` iii ipiiinicigimiii'i2iiii{ii ii iiiD iifi ii|i: iiiii i i i i ii inii iii;iiIiYi}ii iXi"ii iiiiiii-iiliiiiiiiiiEii~ii>i]ii,iiiiviLiBiii&iii iiiiGiiiiBii i+ iii iiiii i iaiiii ia ii}iE iiDii=ii0i ii i6 iiiivi!iiiiiiiii9iHiiiii iFiiiiii"iiH iii i ioiiiRi*ii.iiiiiiI i3ii, ii*iSiiiiXiii/iibipii iiiiiiiRii ii7 ii2ii iiiiiii_ iib ii iiii iiiiiii` iOii i i`i7i i iiiiiiia iiiiiiigiii ii i_ii~iiiiii iaii ib iiiii iii i;ii i-i iiQ iiiiqiiiii`ii#i#iiiiiri isiiiiditi iic ii ikiwi ii iiiiiiiigi iQiiUi i iiiiiCiSiic iii5iiiBii_i iciNiiiYiiii iiLidi i i iKi i8 iaiGiii i iiisi6i iti; iNiii i i4ii:ii\iqiiii.iii iui iiii i ii iriii i iic iiii@iii ii ii ii/i9 ii iiiiiii i< id iiii8iviiCiii iimii iiiiiiZiiiiiwi i{iiiii$iiiMid i0irii iigiiViiiii: iZiii{i$ie i0iii$i i i ii5ii[iiviiiciiViR i$i; iiiif iii idiiiWie iii iii i iiJ iiiiiuii ii ii i iK ii2iiL i i.iii2ii iiiiii%i iii i iiiiiiii i ixi iM ii}iiiTiiiid i iiiii`iiiii i3iii;i iiiiyiYiLiii i iiiiiUi\iiiiiiViN iii iii ii"ixi%ii;i= i iii2iEii!iiii^ii"iwi i#iiii ii$i<iQiiiri%ii]ii&ii< i'i i3i6iBii i(iii ii i iig i i i)i i i*i+i! iiiii:ii7ii^ii iii(i i,i+i i ixi-ii/ihi= i.iiiiiVi ii ihii i/iiiii<iii;i0iiii i i1izi i ii5i6i i_i)i2i3ii4iyi" iii ii^i5i i i?i%i+if i i6i_iWiii i7i> ii ig i# iiu i8i ii9ih iF iiVi{i iO iiIiwi~i i^iii:iiiiiiii i;iei1iiiiiiiii i i iiP i<i=ii>i ii(i`iRi? iYiiIi iii i7i i i?iii i@iioiiqiYiniiiliiii ii ii iEiPiVii! i iiiiiniiAii|i ii iBiiiiii- i iOi i iCiiDiWiTiTiiiii i}iEii&i i iiiiii iii~iG i iii$ iWiiiioii iFiiGiii" iiii# iiiDi-iQ iiHiei i iiIi iiiJizi iiKiiiLii$ i iiiiiH iiiiiiiMi:i iiiNiiI i iiiHiiiiiOiii iPiQiiikiRiR i iii i i ii iiiiiiSiTiii i% iiiiii& iS iUi iiS iiCiiiiVi~ii!iXiiiiii,iiiiiOii|iiiiPiie iiii i i iiiiiiiiT iiiiiWiiiiXiiYiiRi iviii ii i=i iiZiiU iii[i iiiV i% i\iii]iii^i8iT i. i' i_iiviiiiiwitii`iaibi> iii"i{ii i iiciidi9iiiii[i9iiidih i ieiii iJ i!iiifiiii iiiTigiii i%iiWiMihiiiiiiiiiiiiii( ij iiyi7imiijiki i? iW i"iiii iBiili|i ii) iziii iii iiiiimiiniuiv iwii i* iiioipiiiqi7i.irii i iii iifii i isi& iyi ii i iiiii i i>iiii iiYi iitiiui/ i+ i ivi ii i@ iwii i iii3iiii, ixi i6i9i i iii6i iii! iiiyiiQi:ici iii- ioiiiFiX i i iifi iizi iii iii{i/iii' i ibiii`iiiiui iviiiii i i iiii i0iEiiSii8i[i|i}iGii ii!i~iiiFiU ii ii iieisiii iw iiii" i iai iZi&iiiii i iiiiAiii iiii iiiiiiiii ioii ii i i ii iiA i iJi0i ix i ii iiY iiiiii i i iiZ i8ioiiiQiiiii iiiaiQiiipi;iiiPiibiiiii i ii iiii iii iiiiiiiii]iiiii iiiiii'iii. i ii iiiii iLiiiiii ii/ iiiiiB i0 i[ ii8iiiii iii/i3iiiii iiii0i iniiiiiiiii i iiiiiiiii4iiiii<i ii iiiYi iiiiC iiii iiiii}i1ii iiiiKii ii0 iFiiii ii#ii\iiiifi i>i iii iiiiii i iiiiijiiiiii-ipi9i@ i6iyiiii i i1 iiiiiiiiViiiii4iii iKi1 ii iD i iiiiii#iiii i2 iiii iZiHipiiigiii i iqiri iiiiii i iK iV i i\ i,i ii iiii]iiiuii iiiiiiiiiZiii iiiiijiii0ihihiii ii iE iii iii iiiiiiiiiii iiii2 iiiiiiiMiiwiii iy i?iiii itimi( i ii+iiiiiiiiii i ii i iii iiL iii) i ii iiif ii iiiiiiiRi"iA i3 i ii-i1ii$i i(ii] i i# ii$ i iiii i* iiii i ii i i=ik ii!ii iiii i ii ii_iiiii^ i2ii iiii9iii iiii4 i iii iibiiii ii iii5ii iii"i i iiiiii4iIi ii#ii iiiiiiij iiii$ik i ii ii\i igiiEi5 iiiiiiiii iii6 iiii ii%iii ii i[i iiiiii i&ieiii iiioi iil i i}iiiizii+ iii iiiini-ii i'iiii iiii(iii iiiiiiii ii iiiBiiiqiiii<ii*iji)i"i*ii>i)i7 ii+iiiiiiiizii,iiiiiM i)iriii-i i iiiiiiTiipiii#i#iiiiiiii iiii i ii iiSii.i8 iiiiiz i9 i=iiiim iiSiiiiiixiii/iiiqiii3ii5ii: i i ii iiiiii i; i i0i1iiiiiin ii_ ii]i i iniiiii i% iiiii i` iiiiiziTisi2i3 ii i{ ii5iiii ig iiikiiiii iii3i4ii iici iii i iiiai:i1i iii!iAihi io i i6i"iii il i-ii ia i5ii ii i ii#i! ii$ii ii4 ifii i%i& i iN ii iiWiiiiii i' ii$iii< i iNiiiW ikiiO iiiiiiiX i, ii6i&itiiP ii i7i i i i- ijii i iiCi[ip ii i'i8i ib iim i i ii{i(i i ii i9i i i i:i i i^iiiiB i;iiiiii iii ii ii)i<i=i ii ii>iiiii i=iiiiiiiiiiin iiHiDi i?iiUiWi i= ii:ii iNi iKiEi@i4ic i ii> iiQ i iAiiihiii i i( i]iiiiBi*iiiliiCiDiiEih iiiiiiiXiiiii+iiii+iJiiiUiii iimi iEiiiiFiiGi iki inii id iiiiiiiiF i!i iiri@iiHi"iCiGiiii ii^i ii i8iti) i;i i? i!iioiIi i"i#i#i$iiJi i%i i&iriKi'i5 i(i)iio i@ i}iA ii,ii*i4i1i+ii i i ii" ii,ii iC iiuiriD i-i i-i iLivi{ii| iMi.i.iNiY i6 iii i/i0i/i ii1i$ii2i%iGiRiB i i_iiiC ii iD ii3iiiii ii i. ii i4i@iwii5ii6i7iii ii&i0ii8i i&i i* ii+ iG iOiuii# i i1iPiRiiQii ii)iii=i9iili iiiiE iSiiki i\i iii iyi:i i;i<iF i%i=iiRiii>idi'i, i?iei$ ii2i3i- ii i4ii(iSi@iAiBii.iTiiOi i iiiii i&i iii i<i iiiiCiiDi iiUiip iG ie i i i ii iEi;iViFi'iGi)i ii} iHi*iiWiiiIiiTii i iiiiii iiJi. igi~iiUiij i iiiXiii8ii*i iiiKi~ iii iLiiH i iii% ii+if iii iitiiMiNiii ii ii iiik iYiiYiiii*i/ iiOiR iZiH ii#iI i i iii5iS i]iE i[i\i isiI i+iPiQi,i i iRiiSiTii,iiUi]iVi iiLi-i!i iT i\i4iWi iiXiYiZii[i>iwiiiii+i^iiJ ii_i$ii\iiiili.i]i`ii^i_iq i%ii`iaiiii i6ig iU ibicidiai iq ixi iei ibiyi ifihigihiii'iii iii ijir ii i0 i i=iibi|iiiiii i iih iki iliii iaiicimiii ini iiui iidieiis iK i/ioi7ii& i iJ i8ipiqii ij ifii igi iii(ii`irisi i iii<iFik ifiiiii]iiiIiti>iiuiivii iii i0ii-iiwiL ii iiiiiGiaii it i ii iSiKixiiyiziiiV iiiOii1 ii i{i i iiF iyii9iZ ii|i}i~iFi iii i i:iiiii2 iiiipii;iG iii ihiiiii7 iiiiiqiiiM iiiiiii iii iii i(i8 iiN i ii3 i iiO i<iiiiTiiW i iiiii(iiii1iiiiiiiiu iZii i iciijiP ipiii iiii iv iiijii iiii iQ iK i ii i' iiiiii9 iii i izii i iiikiiiii ii2i iiliii>i=iCi'iii>i iiZiiii imini iibiii i iqi?ii ii ii i"ii i?i i}iiioi@i>iiAi i1ii)iiii?i i iiiixi ii ii i3i i ihii il iiii)ii ipii'iiii4ii i i iiiiAi_i iBiiL ii iPiqii iiriiiiiX iicisi! iiiiHii iw iiiiCiDitiiiiiiix i ii i/ iiii5i i4 iuiir iii_iii/i i<ii~i7iy im iii^i5 in ibi itiiil iiii6ii i7iiiiiiiviiii i8i: ii ii0 i i1 iiwiiIiiiii i( iiiBi ii4isi iiiii i iii?iCiixi iEiHi iiFiyiziGiiiii{iiii|ii; i}i9imiH i~iiz iiis i iiM iiii iiim iiiIiiiio iiiiiiii_iiii i2 i3 iHii*iii iiii< iiii:ii ii iiAii iiR iiiii i ii" ii iiiiii ii iii iiiQi i iY iiiiiiii{iKii ii[i iJiiiN iiS iiiiiI iiiT i@ii iii i i@iiRiii it iiiiJiIii iiiii iU iimiiii{ i ii i i;iV iii iii<iii idiiiiXiii9iii6 iiiUiiii iiLi!i= ii) ii i i iii i iii ii=i$i(iviii&iicii iii i ii>iiii{i"iiiii#iiiiiW ii iiii ii$i i%iiiiii&i^iii[ i ii'iiiiiiii(i iii2i\ iJi ip ipin iiu iq i)ii iO i> ii i*iX iii i+ii i,i iii iiiiiKii i iiIi-iii!iiiiii.iDiiiJisi# iii ii7 iiii/iwii|iiiiii"i4 i| i,iiiii iiiiiiiii?iY iP i0ii1iZ iZ i ii i ii i#i@i2ii|iiziiiiiAi'ii? ii ii8 ii iyiiLiVi i3i i i i$iiiiMii%ii i i i i i.ii4iNiii ii i i iiii i5i9 i%iiiiKiQ iiixi6i7iiBi i iOiv i[ iii&ii ii iiiXii* ii\ iPi i iNi+ iw iiiiiWiCi ii iQiDi i?i] iiii^ io iR i i iEii iiFi i'iiXiiGiiS i iiT iRii8ixi ikiSiiTiii ii iiDii9i!iiiii(iiLi"i#i$i%i_ ii&iJi:iUii}i i)ii i;i<i iEi+i'i iiHi=iVi*iHiyi, i+iWi3i>i ii?i(iIi,i-i` iqiia i iii ii)i*iXi i+iiOiiYi,i-ii.ii/i ii0i.iiii1i iJir i2i3i$ i i4ii5i6i7i iib i iii} i ifiiKii i i i i8iZi9ii: ii ic ii:ii i;is iJ i@ii it i; i i/i<id ii iiiU ii0iie i=iif iu iMiiiii i>i i[iiAiLiiii?i i i i i@iAiv iBiCi\iijii[ i ig iDiEiiiFi iBiiGi iiHii(iiMiCih iiIiNiJi iKiLiiiMii1i2iNiiidiOidiV iDi`ii#i5 iPi]iQiEini i iii^iRi_iFiSip ii iiTiUii i iVii i iiGiiiieiHiOi iiPi`iWiw ij iXi ii3i iaiiIiYiJix i7iiii- i i4ik iibiZi-iii. icii[i iri;i iKi5iLiXii i iii\i]iii6i% i^i_iii~i`il iy iaizi~ iiibi?iici7idi iiieiiz iiiMifigi/ ihi|ii@idiiiiiNiiii8ifiiijikiiOiPiiilimi@ini9i ioi i iii< isii\ iQi.iRiNi@i iipiiSi{ iqiiAii iiiiTi iiii:iiiri isi@ iW i;itiui iviwixiyi| iiiiizi i i3iQiiimiiAi{i|ii ii}iOiRi iigiii~iZi iiiiii i\im ii} ii<iX ii ii i iiii iiY iiii0 iiii i=i iiiiLiiiiihiiiiii>i>ii/i?iUiiiiiiei)ix itiifiSii iy i in i i iiTi i@ii i iiiiiiii ii iziUigiiViio iii6 ip itiiiiiii iAiiJiVihiZ i iiWiiii(tBIG5_TYPICAL_DISTRIBUTION_RATIOtBIG5_TABLE_SIZEtBIG5_CHAR_TO_FREQ_ORDER(((s@/usr/lib/python2.7/site-packages/pip/_vendor/chardet/big5freq.pyt+ssite-packages/pip/_vendor/chardet/chardistribution.pyc000064400000017253147204247350017234 0ustar00 abc@s*ddlmZmZmZddlmZmZmZddlm Z m Z m Z ddl m Z mZmZddlmZmZmZdefdYZdefd YZd efd YZd efd YZdefdYZdefdYZdefdYZdS(i(tEUCTW_CHAR_TO_FREQ_ORDERtEUCTW_TABLE_SIZEt EUCTW_TYPICAL_DISTRIBUTION_RATIO(tEUCKR_CHAR_TO_FREQ_ORDERtEUCKR_TABLE_SIZEt EUCKR_TYPICAL_DISTRIBUTION_RATIO(tGB2312_CHAR_TO_FREQ_ORDERtGB2312_TABLE_SIZEt!GB2312_TYPICAL_DISTRIBUTION_RATIO(tBIG5_CHAR_TO_FREQ_ORDERtBIG5_TABLE_SIZEtBIG5_TYPICAL_DISTRIBUTION_RATIO(tJIS_CHAR_TO_FREQ_ORDERtJIS_TABLE_SIZEtJIS_TYPICAL_DISTRIBUTION_RATIOtCharDistributionAnalysiscBsVeZdZdZdZdZdZdZdZdZ dZ d Z RS( igGz?g{Gz?icCsDd|_d|_d|_d|_d|_d|_|jdS(N(tNonet_char_to_freq_ordert _table_sizettypical_distribution_ratiot_donet _total_charst _freq_charstreset(tself((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyt__init__.s      cCst|_d|_d|_dS(sreset analyser, clear any stateiN(tFalseRRR(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR=s  cCs}|dkr|j|}nd}|dkry|jd7_||jkryd|j|krv|jd7_qvqyndS(s"feed a character with known lengthiiiiiN(t get_orderRRRR(Rtchartchar_lentorder((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pytfeedFs  cCsu|jdks!|j|jkr(|jS|j|jkrn|j|j|j|j}||jkrn|Sn|jS(s(return confidence based on existing datai(RRtMINIMUM_DATA_THRESHOLDtSURE_NORtSURE_YES(Rtr((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pytget_confidenceTs! cCs|j|jkS(N(RtENOUGH_DATA_THRESHOLD(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pytgot_enough_datadscCsdS(Ni((Rtbyte_str((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRis( t__name__t __module__R%R"R!R RRRR$R&R(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR(s    tEUCTWDistributionAnalysiscBseZdZdZRS(cCs2tt|jt|_t|_t|_dS(N( tsuperR*RRRRRRR(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRrs  cCs6|d}|dkr.d|d|ddSdSdS(Niii^iii((RR't first_char((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRxs  (R(R)RR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR*qs tEUCKRDistributionAnalysiscBseZdZdZRS(cCs2tt|jt|_t|_t|_dS(N( R+R-RRRRRRR(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  cCs6|d}|dkr.d|d|ddSdSdS(Niii^iii((RR'R,((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  (R(R)RR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR-s tGB2312DistributionAnalysiscBseZdZdZRS(cCs2tt|jt|_t|_t|_dS(N( R+R.RRRRRRR(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  cCsI|d|d}}|dkrA|dkrAd|d|dSdSdS(Niiiii^i((RR'R,t second_char((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs(R(R)RR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR.s tBig5DistributionAnalysiscBseZdZdZRS(cCs2tt|jt|_t|_t|_dS(N( R+R0RR RR RR R(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  cCsd|d|d}}|dkr\|dkrEd|d|ddSd|d|dSndSdS( Niiiiii?i@i((RR'R,R/((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs   (R(R)RR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR0s tSJISDistributionAnalysiscBseZdZdZRS(cCs2tt|jt|_t|_t|_dS(N( R+R1RR RR RRR(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  cCs|d|d}}|dkr>|dkr>d|d}n1|dkrk|dkrkd|dd}nd S||d }|d krd }n|S( Niiiiiiiiii@i((RR'R,R/R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  (R(R)RR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR1s tEUCJPDistributionAnalysiscBseZdZdZRS(cCs2tt|jt|_t|_t|_dS(N( R+R2RR RR RRR(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  cCs6|d}|dkr.d|d|ddSdSdS(Niii^iii((RR'R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  (R(R)RR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR2s N(t euctwfreqRRRt euckrfreqRRRt gb2312freqRRRtbig5freqR R R tjisfreqR R RtobjectRR*R-R.R0R1R2(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pytsIsite-packages/pip/_vendor/chardet/charsetgroupprober.pyc000064400000005471147204247350017576 0ustar00 abc@s:ddlmZddlmZdefdYZdS(i(t ProbingState(t CharSetProbertCharSetGroupProbercBsMeZddZdZedZedZdZdZ RS(cCs8tt|jd|d|_g|_d|_dS(Nt lang_filteri(tsuperRt__init__t _active_numtproberstNonet_best_guess_prober(tselfR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pyR!s  cCshtt|jd|_x<|jD]1}|r&|jt|_|jd7_q&q&Wd|_dS(Nii( RRtresetRRtTruetactiveRR (R tprober((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pyR 's   cCs-|js#|j|js#dSn|jjS(N(R tget_confidenceRt charset_name(R ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pyR1s    cCs-|js#|j|js#dSn|jjS(N(R RRtlanguage(R ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pyR9s    cCsx|jD]}|sq n|js+q n|j|}|sFq n|tjkre||_|jS|tjkr t|_|j d8_ |j dkrtj|_ |jSq q W|jS(Nii( RR tfeedRtFOUND_ITR tstatetNOT_MEtFalseRt_state(R tbyte_strRR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pyRAs$    cCs|j}|tjkrdS|tjkr/dSd}d|_x|jD]}|sZqHn|js|jj d|j qHn|j }|jj d|j |j |||krH|}||_qHqHW|jsdS|S(NgGz?g{Gz?gs %s not actives%s %s confidence = %s( RRRRRR RR tloggertdebugRRR(R Rt best_confRtconf((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pyRUs*      N( t__name__t __module__RRR tpropertyRRRR(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pyR s    N(tenumsRt charsetproberRR(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pytssite-packages/pip/_vendor/chardet/charsetprober.pyc000064400000010065147204247350016514 0ustar00 abc@sBddlZddlZddlmZdefdYZdS(iNi(t ProbingStatet CharSetProbercBseZdZd dZdZedZdZedZ dZ e dZ e dZ e d ZRS( gffffff?cCs(d|_||_tjt|_dS(N(tNonet_statet lang_filtertloggingt getLoggert__name__tlogger(tselfR((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pyt__init__'s  cCstj|_dS(N(Rt DETECTINGR(R ((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pytreset,scCsdS(N(R(R ((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pyt charset_name/scCsdS(N((R tbuf((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pytfeed3scCs|jS(N(R(R ((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pytstate6scCsdS(Ng((R ((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pytget_confidence:scCstjdd|}|S(Ns([-])+t (tretsub(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pytfilter_high_byte_only=scCszt}tjd|}xX|D]P}|j|d |d}|j re|dkred}n|j|q"W|S(s5 We define three types of bytes: alphabet: english alphabets [a-zA-Z] international: international characters [-] marker: everything else [^a-zA-Z-] The input buffer can be thought to contain a series of words delimited by markers. This function works to filter all words that contain at least one international character. All contiguous sequences of markers are replaced by a single space ascii character. This filter applies to all scripts which do not use English characters. s%[a-zA-Z]*[-]+[a-zA-Z]*[^a-zA-Z-]?isR(t bytearrayRtfindalltextendtisalpha(Rtfilteredtwordstwordt last_char((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pytfilter_international_wordsBs      cCst}t}d}xtt|D]}|||d!}|dkrTt}n|dkrit}n|dkr(|j r(||kr| r|j|||!|jdn|d}q(q(W|s|j||n|S(s Returns a copy of ``buf`` that retains only the sequences of English alphabet and high byte characters that are not between <> characters. Also retains English alphabet and high byte characters immediately before occurrences of >. This filter can be applied to all scripts which contain both English characters and extended ASCII characters, but is currently only used by ``Latin1Prober``. iit>ts  site-packages/pip/_vendor/chardet/cli/__init__.py000064400000000001147204247350016001 0ustar00 site-packages/pip/_vendor/chardet/cli/__init__.pyc000064400000000233147204247350016153 0ustar00 abc@sdS(N((((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cli/__init__.pyttsite-packages/pip/_vendor/chardet/cli/__init__.pyo000064400000000233147204247350016167 0ustar00 abc@sdS(N((((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cli/__init__.pyttsite-packages/pip/_vendor/chardet/cli/chardetect.py000064400000005262147204247350016366 0ustar00#!/usr/bin/env python """ Script which takes one or more file paths and reports on their detected encodings Example:: % chardetect somefile someotherfile somefile: windows-1252 with confidence 0.5 someotherfile: ascii with confidence 1.0 If no paths are provided, it takes its input from stdin. """ from __future__ import absolute_import, print_function, unicode_literals import argparse import sys from chardet import __version__ from chardet.compat import PY2 from chardet.universaldetector import UniversalDetector def description_of(lines, name='stdin'): """ Return a string describing the probable encoding of a file or list of strings. :param lines: The lines to get the encoding of. :type lines: Iterable of bytes :param name: Name of file or collection of lines :type name: str """ u = UniversalDetector() for line in lines: line = bytearray(line) u.feed(line) # shortcut out of the loop to save reading further - particularly useful if we read a BOM. if u.done: break u.close() result = u.result if PY2: name = name.decode(sys.getfilesystemencoding(), 'ignore') if result['encoding']: return '{0}: {1} with confidence {2}'.format(name, result['encoding'], result['confidence']) else: return '{0}: no result'.format(name) def main(argv=None): """ Handles command line arguments and gets things started. :param argv: List of arguments, as if specified on the command-line. If None, ``sys.argv[1:]`` is used instead. :type argv: list of str """ # Get command line arguments parser = argparse.ArgumentParser( description="Takes one or more file paths and reports their detected \ encodings") parser.add_argument('input', help='File whose encoding we would like to determine. \ (default: stdin)', type=argparse.FileType('rb'), nargs='*', default=[sys.stdin if PY2 else sys.stdin.buffer]) parser.add_argument('--version', action='version', version='%(prog)s {0}'.format(__version__)) args = parser.parse_args(argv) for f in args.input: if f.isatty(): print("You are running chardetect interactively. Press " + "CTRL-D twice at the start of a blank line to signal the " + "end of your input. If you want help, run chardetect " + "--help\n", file=sys.stderr) print(description_of(f, f.name)) if __name__ == '__main__': main() site-packages/pip/_vendor/chardet/cli/chardetect.pyc000064400000006122147204247350016525 0ustar00 abc@@sdZddlmZmZmZddlZddlZddlmZddl m Z ddl m Z ddZ dd Zed krendS( u Script which takes one or more file paths and reports on their detected encodings Example:: % chardetect somefile someotherfile somefile: windows-1252 with confidence 0.5 someotherfile: ascii with confidence 1.0 If no paths are provided, it takes its input from stdin. i(tabsolute_importtprint_functiontunicode_literalsN(t __version__(tPY2(tUniversalDetectorustdincC@st}x4|D],}t|}|j||jrPqqW|j|j}trt|jtj d}n|drdj ||d|dSdj |SdS(u Return a string describing the probable encoding of a file or list of strings. :param lines: The lines to get the encoding of. :type lines: Iterable of bytes :param name: Name of file or collection of lines :type name: str uignoreuencodingu{0}: {1} with confidence {2}u confidenceu{0}: no resultN( Rt bytearraytfeedtdonetclosetresultRtdecodetsystgetfilesystemencodingtformat(tlinestnametutlineR ((sF/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cli/chardetect.pytdescription_ofs         c C@stjdd}|jddddtjddd d trHtjn tjjg|jd d d ddjt |j |}xU|j D]J}|j rt dddddtjnt t||jqWdS(u Handles command line arguments and gets things started. :param argv: List of arguments, as if specified on the command-line. If None, ``sys.argv[1:]`` is used instead. :type argv: list of str t descriptionuVTakes one or more file paths and reports their detected encodingsuinputthelpu^File whose encoding we would like to determine. (default: stdin)ttypeurbtnargsu*tdefaultu --versiontactionuversiontversionu %(prog)s {0}u0You are running chardetect interactively. Press u8CTRL-D twice at the start of a blank line to signal the u4end of your input. If you want help, run chardetect u--help tfileN(targparsetArgumentParsert add_argumenttFileTypeRR tstdintbufferRRt parse_argstinputtisattytprinttstderrRR(targvtparsertargstf((sF/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cli/chardetect.pytmain6s     u__main__(t__doc__t __future__RRRRR tchardetRtchardet.compatRtchardet.universaldetectorRRtNoneR+t__name__(((sF/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cli/chardetect.pyts     site-packages/pip/_vendor/chardet/cli/chardetect.pyo000064400000006122147204247350016541 0ustar00 abc@@sdZddlmZmZmZddlZddlZddlmZddl m Z ddl m Z ddZ dd Zed krendS( u Script which takes one or more file paths and reports on their detected encodings Example:: % chardetect somefile someotherfile somefile: windows-1252 with confidence 0.5 someotherfile: ascii with confidence 1.0 If no paths are provided, it takes its input from stdin. i(tabsolute_importtprint_functiontunicode_literalsN(t __version__(tPY2(tUniversalDetectorustdincC@st}x4|D],}t|}|j||jrPqqW|j|j}trt|jtj d}n|drdj ||d|dSdj |SdS(u Return a string describing the probable encoding of a file or list of strings. :param lines: The lines to get the encoding of. :type lines: Iterable of bytes :param name: Name of file or collection of lines :type name: str uignoreuencodingu{0}: {1} with confidence {2}u confidenceu{0}: no resultN( Rt bytearraytfeedtdonetclosetresultRtdecodetsystgetfilesystemencodingtformat(tlinestnametutlineR ((sF/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cli/chardetect.pytdescription_ofs         c C@stjdd}|jddddtjddd d trHtjn tjjg|jd d d ddjt |j |}xU|j D]J}|j rt dddddtjnt t||jqWdS(u Handles command line arguments and gets things started. :param argv: List of arguments, as if specified on the command-line. If None, ``sys.argv[1:]`` is used instead. :type argv: list of str t descriptionuVTakes one or more file paths and reports their detected encodingsuinputthelpu^File whose encoding we would like to determine. (default: stdin)ttypeurbtnargsu*tdefaultu --versiontactionuversiontversionu %(prog)s {0}u0You are running chardetect interactively. Press u8CTRL-D twice at the start of a blank line to signal the u4end of your input. If you want help, run chardetect u--help tfileN(targparsetArgumentParsert add_argumenttFileTypeRR tstdintbufferRRt parse_argstinputtisattytprinttstderrRR(targvtparsertargstf((sF/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cli/chardetect.pytmain6s     u__main__(t__doc__t __future__RRRRR tchardetRtchardet.compatRtchardet.universaldetectorRRtNoneR+t__name__(((sF/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cli/chardetect.pyts     site-packages/pip/_vendor/chardet/cp949prober.pyc000064400000002525147204247350015735 0ustar00 abc@sZddlmZddlmZddlmZddlmZdefdYZdS(i(tEUCKRDistributionAnalysis(tCodingStateMachine(tMultiByteCharSetProber(tCP949_SM_MODELt CP949ProbercBs/eZdZedZedZRS(cCs<tt|jtt|_t|_|jdS(N( tsuperRt__init__RRt coding_smRtdistribution_analyzertreset(tself((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cp949prober.pyR#s cCsdS(NtCP949((R ((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cp949prober.pyt charset_name+scCsdS(NtKorean((R ((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cp949prober.pytlanguage/s(t__name__t __module__RtpropertyR R(((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cp949prober.pyR"s N( tchardistributionRtcodingstatemachineRtmbcharsetproberRtmbcssmRR(((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cp949prober.pytssite-packages/pip/_vendor/chardet/enums.pyc000064400000006071147204247350015002 0ustar00 abc@sdZdefdYZdefdYZdefdYZdefdYZd efd YZd efd YZd S(sr All of the Enums that are used throughout the chardet package. :author: Dan Blanchard (dan.blanchard@gmail.com) t InputStatecBs eZdZdZdZdZRS(sS This enum represents the different states a universal detector can be in. iii(t__name__t __module__t__doc__t PURE_ASCIIt ESC_ASCIIt HIGH_BYTE(((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pyRstLanguageFiltercBsJeZdZdZdZdZdZdZdZeeBZ e eBeBZ RS(sj This enum represents the different language filters we can apply to a ``UniversalDetector``. iiiiii( RRRtCHINESE_SIMPLIFIEDtCHINESE_TRADITIONALtJAPANESEtKOREANtNON_CJKtALLtCHINESEtCJK(((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pyRs t ProbingStatecBs eZdZdZdZdZRS(sG This enum represents the different states a prober can be in. iii(RRRt DETECTINGtFOUND_ITtNOT_ME(((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pyR st MachineStatecBs eZdZdZdZdZRS(sN This enum represents the different states a state machine can be in. iii(RRRtSTARTtERRORtITS_ME(((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pyR)stSequenceLikelihoodcBs5eZdZdZdZdZdZedZRS(sX This enum represents the likelihood of a character following the previous one. iiiicCsdS(s::returns: The number of likelihood categories in the enum.i((tcls((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pytget_num_categories;s( RRRtNEGATIVEtUNLIKELYtLIKELYtPOSITIVEt classmethodR(((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pyR2s tCharacterCategorycBs,eZdZdZdZdZdZdZRS(s This enum represents the different categories language models for ``SingleByteCharsetProber`` put characters into. Anything less than CONTROL is considered a letter. iiiii(RRRt UNDEFINEDt LINE_BREAKtSYMBOLtDIGITtCONTROL(((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pyR As N(RtobjectRRRRRR (((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pyts    site-packages/pip/_vendor/chardet/escprober.pyc000064400000006237147204247350015643 0ustar00 abc@sxddlmZddlmZddlmZmZmZddlm Z m Z m Z m Z defdYZ dS(i(t CharSetProber(tCodingStateMachine(tLanguageFiltert ProbingStatet MachineState(t HZ_SM_MODELtISO2022CN_SM_MODELtISO2022JP_SM_MODELtISO2022KR_SM_MODELtEscCharSetProbercBsSeZdZddZdZedZedZdZ dZ RS(s This CharSetProber uses a "code scheme" approach for detecting encodings, whereby easily recognizable escape or shift sequences are relied on to identify these encodings. cCstt|jd|g|_|jtj@ra|jjtt |jjtt n|jtj @r|jjtt n|jtj @r|jjttnd|_d|_d|_d|_|jdS(Nt lang_filter(tsuperR t__init__t coding_smR RtCHINESE_SIMPLIFIEDtappendRRRtJAPANESERtKOREANRtNonetactive_sm_countt_detected_charsett_detected_languaget_statetreset(tselfR ((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pyR *s     cCsntt|jx0|jD]%}|s/qnt|_|jqWt|j|_d|_ d|_ dS(N( R R RR tTruetactivetlenRRRR(RR ((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pyR:s  cCs|jS(N(R(R((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pyt charset_nameEscCs|jS(N(R(R((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pytlanguageIscCs|jr dSdSdS(NgGz?g(R(R((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pytget_confidenceMs cCsx|D]}x|jD]}| s|j r4qn|j|}|tjkrt|_|jd8_|jdkrtj|_ |j Sq|tj krtj |_ |j |_|j|_|j SqWqW|j S(Nii(R Rt next_stateRtERRORtFalseRRtNOT_MERtstatetITS_MEtFOUND_ITtget_coding_state_machineRRR(Rtbyte_strtcR t coding_state((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pytfeedSs"      N( t__name__t __module__t__doc__RR RtpropertyRRRR*(((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pyR #s   N(t charsetproberRtcodingstatemachineRtenumsRRRtescsmRRRRR (((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pyts"site-packages/pip/_vendor/chardet/eucjpprober.pyc000064400000005746147204247350016203 0ustar00 abc@sddlmZmZddlmZddlmZddlmZddl m Z ddl m Z defdYZ d S( i(t ProbingStatet MachineState(tMultiByteCharSetProber(tCodingStateMachine(tEUCJPDistributionAnalysis(tEUCJPContextAnalysis(tEUCJP_SM_MODELt EUCJPProbercBsJeZdZdZedZedZdZdZRS(cCsHtt|jtt|_t|_t|_ |j dS(N( tsuperRt__init__RRt coding_smRtdistribution_analyzerRtcontext_analyzertreset(tself((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pyR %s   cCs$tt|j|jjdS(N(RRR R (R((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pyR ,scCsdS(NsEUC-JP((R((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pyt charset_name0scCsdS(NtJapanese((R((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pytlanguage4scCsx>tt|D]*}|jj||}|tjkrm|jjd|j|j |t j |_ Pq|tj krt j|_ Pq|tjkr|jj}|dkr|d|jd<|jj|j||jj|j|q=|jj||d|d!||jj||d|d!|qqW|d|jd<|jt jkr|jjr|j|jkrt j|_ qn|jS(Ns!%s %s prober hit error at byte %siii(trangetlenR t next_stateRtERRORtloggertdebugRRRtNOT_MEt_statetITS_MEtFOUND_ITtSTARTtget_current_charlent _last_charR tfeedR tstatet DETECTINGtgot_enough_datatget_confidencetSHORTCUT_THRESHOLD(Rtbyte_strtit coding_statetchar_len((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pyR8s4    cCs+|jj}|jj}t||S(N(R R#R tmax(Rt context_conft distrib_conf((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pyR#Ys( t__name__t __module__R R tpropertyRRRR#(((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pyR$s    !N(tenumsRRtmbcharsetproberRtcodingstatemachineRtchardistributionRtjpcntxRtmbcssmRR(((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pyts site-packages/pip/_vendor/chardet/euckrfreq.pyc000064400000057027147204247350015651 0ustar00 abc0 @sdZdZd2 Zd1 S(3 g@i0 i iixitiiiiHiaiiiii+iiWiuiihii]iiiiiiiiiiiviwiiiiimiFi!ipii iiiiiiixii/iiiiiiiii9iiiitii-iyiiKiiiiiiiiOiiniiiiiii0iii<i4i{iiiiiiiiiriiiiiiiiiiiiXiXiiiiiYiii&iiPiiiiiiii^iiiiiiii9iiiiiiiQii"iitiiiiii]i{i7iiii{ii;iiuiizi/ii|iiiii7iii.iiiiiiiiiiiiii{iiii#i|i}ii~iiti8ii_i i i i i i!iiii_iiiiiii*iiuii`i"iii|iiiiiiiaiiiiiii?iiRi!i i/iii!i"i=iii#ii$i%i&i'i(i)i,ii'ibi$i*ii+ii-ii,iiiiii&iUiii#iii-i.i'iiifi/isii0iiiiii ii9iei[i1iiiiZiii:iiii2i3iiGiiiiyi4iiii5i6i7i,iwiiisi8iii9i:iii~i;ii<i;i}i=i>i?ioi)iii@iiAiBiii2iYiCiDii<iEiFiGiHiIi%iJiKiLiMiNiOii`i>iPii=iQiiRiiSiTi;iiiii iUiiViWiXi4iYiiiZi[ii\i]iii^iii_i"iPiii`i;ii~iHiaiiviizi?iiiibiii<icididieifici0iidiigiyiiihiiisi0iji=ikiiliiii<ibiiiUi iiiiIiminioiipiqirisitiuiiiii6iviwii*ii]ixiyiiiziZii-i:iibi i{i|ii&i'iii5iiii>i}i~iwiigiiii6ii%iii(iiviiiiwiiiiiEiiiiiiiiiifiiVii7iiiiiBiiNii[ii'iiiiiiiiSiiiiiieiiixiiiiiiiiiiiiiiiiiiiiii?iiiiiqiifii(i)iii~ii\iiiiii)iiiiiiiiiiii$iiiiiiiliiiii~iiiCiiiii@iiiiii2iiiKiiziViiiiiiQirifiiiiii ihi+i3ii1ii iiiiigi(iiiiziiiiiiiiiiiiiiiiiiAii<ijiiiMigii2iiiiiiiiiiVihiiiJiii0iiibiiiiiiiiiiYiiiiiiiai!i*iiiiiiKiDi8iiRiiBii@iiiiiiiiyiiiiiiXi:iii#iiiiiiiGiiikiii=iiiii!iiiiJiii=iiii}iiijiiiiiiiiiiiiiEiiiiiijiOi4iiiiiiiiii ivi]iiCiiiiiiiioiiiii iiiiliciAiiiiiiiiiiTiiikiiiiiii3i*iiqiii>iiiiiii+iiiiii;iipiixiiiii iiiii ii i ii i iiiiiliiiiiii)iiiiimi8iiiDiiiii iiiiiiii7iLiBiiiDiiiiiitiiii i!i i"i#i$i%iRi&i'i(i)i*ii+i,ii,i-i.imii i^i/iciiEiiiiaimi0iEi1i2i3iiii4iTiiii5iiiii6i7iiniiioi8i9iFiiii:iGi;i<i=i>i?i@iAiBiCiDiEi$iFiGiii%iiipiHiIiJiKiLiiiiiiiiMiNiOiPiQiRiiiSi/iTiiUiiiiViiIiHiiiiiiWiiXiiqiYiZi[i\iiriisi]i^i_i`i iviLiaiii.iibiFi>iiijiciZiiiBi6ii`idieiii|iifiii5igiihiiiiHiijiiikiilii1iminioipiqiriCisitiuiviwiixiyizi{iii|i}i~iiiiiiiiiOiiiiiiiiiiiiiEiiiqiiiIii\ii-iiiSiiii iieiiiiliiMiiiQiiPiii^ii i-iFiiiiiiiiiiiiiiiiiii i.iitiiiiiJiiiiiiiigiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiuiiii9i iiii ii$iiiiii5i%iikiLiiiiiiiiiiiAiiiiiiiiiiRiiuiiiiii)iii:iiiiiiii"i$iviiiiciZiiiiiii*iWiiKiiLii+iiiiiiiiii iBiii?iiiiiiiiiiMi[i5iiiiniiiiiiCii'iiiiiiiii iiii iiiiiiiiFiTi/iiiiii8iiuiiiiKii(iMiiiiiiiiiiiiiiiTii?iiiiiiiiei i(iiiiiii%i0iiiiOii i8i i i i i iiii i i iii#iii iiiVi iiiPi i iMiWii ii ii|i i iSiiiiiiii i iii i i i i i ii i ii9iDiiiiiii i3iii i i i{i iii i i ii iiiiii! ikiiiiiNiiYii" i# i$ i% i& i' i( i]i) i* i+ i, i- i. ii/ iii>iiii1 iiiii\ii2 ii3 iii4 i5 i6 iwi7 ii8 ii3iiii9 i: iLi iii; ii< iiiiiii iiii= iiJi> i? i@ iiA iiB iC iD iiE iiiF iG iH iI iiiiiiiJ iK iiiL iM iN iiIiO iP iiQ iR iS iiT iiU iV iW iX iiY iZ i[ i\ i] iii^ i_ i` ia iiib ic id ie iiif ig iUiixi ih iiii ij iiii4i&iiii!iiiiSiyi iii"i ii#ik iil im in iiiipiQii.io iUiiOiip iiq ir is ixit iiu iv iw iii$ix iiy ii`iz i{ i| i} ii~ i i i i i i i iiCiiiii%iyiiioi ii i i i i i ii i i i iii iii i ii@iii iGi iiii2iiiii i i i iNi i iiiii i i i i iri iiziniiiiPi i#i i&iQi iimi iciii i'i iwi i ii(ili@iiii)ii*i i i i ii i i i iii iii i i iHii i ii iii i i ii i iri iiiAi iiiii i}i,iii:iiiii iiIi iNii1i iWiiiiiiii i+i i i1iibii iqi i,i iiieiii_iidi i i i i i iii2iiii ii i i i ii ii i ii-i iii i i i i i ii i i i i i ii ii i iii7i ii ii i i i i i i iiiiiiiii,iGiiii ii^i i i.i iigii ii i i iii iiii_ii i i iiihihii{i i|iiii3i i i iii i i i\iiiii i i i i i i ii i i i iiii iji iiii4ii i i i i i iii i i i ii6idii/i i iiiioi iiRiiii i&i ikiniziiiii ii iiiXiidiiSii}i i}iii~iiiii i! iNi" iiiiiii# iiisi$ i% i& ifiDii1i' iii( i@i) i^iiii* ii+ i, i- i. i/ iJi+i0 i1 i2 iiTii3 i4 i5 i6 ii7 iAi.iiii8 i9 ii"i: i; ii< i= i> iii0i? ii@ iiA iB iiC iD iE iF iG iii_i[iH iI iii`iaiJ iiiiiK iL iM iN iiO iiiiiiiP iQ iR N(0 i iixitiiiiHiaiiiii+iiWiuiihii]iiiiiiiiiiiviwiiiiimiFi!ipii iiiiiiixii/iiiiiiiii9iiiitii-iyiiKiiiiiiiiOiiniiiiiii0iii<i4i{iiiiiiiiiriiiiiiiiiiiiXiXiiiiiYiii&iiPiiiiiiii^iiiiiiii9iiiiiiiQii"iitiiiiii]i{i7iiii{ii;iiuiizi/ii|iiiii7iii.iiiiiiiiiiiiii{iiii#i|i}ii~iiti8ii_i i i i i i!iiii_iiiiiii*iiuii`i"iii|iiiiiiiaiiiiiii?iiRi!i i/iii!i"i=iii#ii$i%i&i'i(i)i,ii'ibi$i*ii+ii-ii,iiiiii&iUiii#iii-i.i'iiifi/isii0iiiiii ii9iei[i1iiiiZiii:iiii2i3iiGiiiiyi4iiii5i6i7i,iwiiisi8iii9i:iii~i;ii<i;i}i=i>i?ioi)iii@iiAiBiii2iYiCiDii<iEiFiGiHiIi%iJiKiLiMiNiOii`i>iPii=iQiiRiiSiTi;iiiii iUiiViWiXi4iYiiiZi[ii\i]iii^iii_i"iPiii`i;ii~iHiaiiviizi?iiiibiii<icididieifici0iidiigiyiiihiiisi0iji=ikiiliiii<ibiiiUi iiiiIiminioiipiqirisitiuiiiii6iviwii*ii]ixiyiiiziZii-i:iibi i{i|ii&i'iii5iiii>i}i~iwiigiiii6ii%iii(iiviiiiwiiiiiEiiiiiiiiiifiiVii7iiiiiBiiNii[ii'iiiiiiiiSiiiiiieiiixiiiiiiiiiiiiiiiiiiiiii?iiiiiqiifii(i)iii~ii\iiiiii)iiiiiiiiiiii$iiiiiiiliiiii~iiiCiiiii@iiiiii2iiiKiiziViiiiiiQirifiiiiii ihi+i3ii1ii iiiiigi(iiiiziiiiiiiiiiiiiiiiiiAii<ijiiiMigii2iiiiiiiiiiVihiiiJiii0iiibiiiiiiiiiiYiiiiiiiai!i*iiiiiiKiDi8iiRiiBii@iiiiiiiiyiiiiiiXi:iii#iiiiiiiGiiikiii=iiiii!iiiiJiii=iiii}iiijiiiiiiiiiiiiiEiiiiiijiOi4iiiiiiiiii ivi]iiCiiiiiiiioiiiii iiiiliciAiiiiiiiiiiTiiikiiiiiii3i*iiqiii>iiiiiii+iiiiii;iipiixiiiii iiiii ii i ii i iiiiiliiiiiii)iiiiimi8iiiDiiiii iiiiiiii7iLiBiiiDiiiiiitiiii i!i i"i#i$i%iRi&i'i(i)i*ii+i,ii,i-i.imii i^i/iciiEiiiiaimi0iEi1i2i3iiii4iTiiii5iiiii6i7iiniiioi8i9iFiiii:iGi;i<i=i>i?i@iAiBiCiDiEi$iFiGiii%iiipiHiIiJiKiLiiiiiiiiMiNiOiPiQiRiiiSi/iTiiUiiiiViiIiHiiiiiiWiiXiiqiYiZi[i\iiriisi]i^i_i`i iviLiaiii.iibiFi>iiijiciZiiiBi6ii`idieiii|iifiii5igiihiiiiHiijiiikiilii1iminioipiqiriCisitiuiviwiixiyizi{iii|i}i~iiiiiiiiiOiiiiiiiiiiiiiEiiiqiiiIii\ii-iiiSiiii iieiiiiliiMiiiQiiPiii^ii i-iFiiiiiiiiiiiiiiiiiii i.iitiiiiiJiiiiiiiigiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiuiiii9i iiii ii$iiiiii5i%iikiLiiiiiiiiiiiAiiiiiiiiiiRiiuiiiiii)iii:iiiiiiii"i$iviiiiciZiiiiiii*iWiiKiiLii+iiiiiiiiii iBiii?iiiiiiiiiiMi[i5iiiiniiiiiiCii'iiiiiiiii iiii iiiiiiiiFiTi/iiiiii8iiuiiiiKii(iMiiiiiiiiiiiiiiiTii?iiiiiiiiei i(iiiiiii%i0iiiiOii i8i i i i i iiii i i iii#iii iiiVi iiiPi i iMiWii ii ii|i i iSiiiiiiii i iii i i i i i ii i ii9iDiiiiiii i3iii i i i{i iii i i ii iiiiii! ikiiiiiNiiYii" i# i$ i% i& i' i( i]i) i* i+ i, i- i. ii/ iii>iiii0 i1 iiiii\ii2 ii3 iii4 i5 i6 iwi7 ii8 ii3iiii9 i: iLi iii; ii< iiiiiii iiii= iiJi> i? i@ iiA iiB iC iD iiE iiiF iG iH iI iiiiiiiJ iK iiiL iM iN iiIiO iP iiQ iR iS iiT iiU iV iW iX iiY iZ i[ i\ i] iii^ i_ i` ia iiib ic id ie iiif ig iUiixi ih iiii ij iiii4i&iiii!iiiiSiyi iii"i ii#ik iil im in iiiipiQii.io iUiiOiip iiq ir is ixit iiu iv iw iii$ix iiy ii`iz i{ i| i} ii~ i i i i i i i iiCiiiii%iyiiioi ii i i i i i ii i i i iii iii i ii@iii iGi iiii2iiiii i i i iNi i iiiii i i i i iri iiziniiiiPi i#i i&iQi iimi iciii i'i iwi i ii(ili@iiii)ii*i i i i ii i i i iii iii i i iHii i ii iii i i ii i iri iiiAi iiiii i}i,iii:iiiii iiIi iNii1i iWiiiiiiii i+i i i1iibii iqi i,i iiieiii_iidi i i i i i iii2iiii ii i i i ii ii i ii-i iii i i i i i ii i i i i i ii ii i iii7i ii ii i i i i i i iiiiiiiii,iGiiii ii^i i i.i iigii ii i i iii iiii_ii i i iiihihii{i i|iiii3i i i iii i i i\iiiii i i i i i i ii i i i iiii iji iiii4ii i i i i i iii i i i ii6idii/i i iiiioi iiRiiii i&i ikiniziiiii ii iiiXiidiiSii}i i}iii~iiiii i! iNi" iiiiiii# iiisi$ i% i& ifiDii1i' iii( i@i) i^iiii* ii+ i, i- i. i/ iJi+i0 i1 i2 iiTii3 i4 i5 i6 ii7 iAi.iiii8 i9 ii"i: i; ii< i= i> iii0i? ii@ iiA iB iiC iD iE iF iG iii_i[iH iI iii`iaiJ iiiiiK iL iM iN iiO iiiiiiiP iQ iR (t EUCKR_TYPICAL_DISTRIBUTION_RATIOtEUCKR_TABLE_SIZEtEUCKR_CHAR_TO_FREQ_ORDER(((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euckrfreq.pyt)s(site-packages/pip/_vendor/chardet/euckrprober.pyc000064400000002526147204247350016177 0ustar00 abc@sZddlmZddlmZddlmZddlmZdefdYZdS(i(tMultiByteCharSetProber(tCodingStateMachine(tEUCKRDistributionAnalysis(tEUCKR_SM_MODELt EUCKRProbercBs/eZdZedZedZRS(cCs<tt|jtt|_t|_|jdS(N( tsuperRt__init__RRt coding_smRtdistribution_analyzertreset(tself((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euckrprober.pyR#s cCsdS(NsEUC-KR((R ((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euckrprober.pyt charset_name)scCsdS(NtKorean((R ((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euckrprober.pytlanguage-s(t__name__t __module__RtpropertyR R (((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euckrprober.pyR"s N( tmbcharsetproberRtcodingstatemachineRtchardistributionRtmbcssmRR(((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euckrprober.pytssite-packages/pip/_vendor/chardet/euctwfreq.pyc000064400000152666147204247350015674 0ustar00 abc@sdZdZdZdS(g?iiiiiiii iRiiiiiii inii!i iiLi,iAiis iiiiiiL iS iii iiii.iNiiiiii:iiii?iii=iNiKiiiil iii i ii i ii iiii ioi$ iiiii ici8iiiiiiiiizi|iit i"i ie i@i\ii iiiiiiiFiiM iQiHiiiPiviif iiiiDiT iiiFiN iiEi iOii/iisii3i<i2i ii&iLiiiO iiiGiiiM iii?ii i`iiF i*iigi iZi i:ii iiKi ii iiiiii`iiiig ii i iqii~iiiP i ii iii!iiuiii*iii i ii~iiiiieiiGi^iiii iUiCiiBiiiiiii ijioi/iiiOi2 i[iii i& iiiiiSi(ii iipi]ii6iii i' iiiiii8ii+i% i[iii\iiiiiiX i( iii i0ii iHi i i"i!ii+i i1i"iii iOiG iiifi1iiiiiiii2i9iili,ii iiiiii}ih i#iq iQiMi&i iXiii#iii iiiijiiiMiii i%ii ii$iii'i iiN ii ii7iiJii!iiiiiiMii) iPiU iiii ii%i i ii ii i iIii3 ii iir ii i iiiimiii$iiixii iii ii ii%i&ii iiiiiiii&ii'iii'iii.ii iiiH iiiii$i#iiDi&iAi iiiiiiUiGiiii iQ iPiSi'iiidi i0iFiii* iiiiiiiJii iUiiiiI iR iii<iiS i:i7 i ii i i9ii}ii iiiViPiT ii)iCiiii& i i i)iiim iiiiiii4 iiiin i*iiiiiiiO iiiii i+ i(i i iiiU i(ii5iYiji iliiuii)i i*i+iV i i=i iiiiiii4ii!iiiTi, ixiiieii iiJ iPiis i5iAiV i/iki i iili!i iiAii`ii i iiAii iiii ii i iiiiiiMi iiiiiiW iii it iii+i}iij i8 iiiiiiiii- i)imi iiW ii ii iiaii iP iK i i,ii ii7i' iu ii{ik iiiii i9 iiiiiiiiiii1iibii i iiio iiX i,iQ iiiiii i i iX iiii5iDiiiliii[i iiiY ii%ii. iY ii*iii iiR iii ipiiinicigi+iii'i2iiii{iil iim iii: iifi ii|i5 iiiiiZ i i i i ii i,ii iii;iiIiYiii[ iXi"ii iiii~iii,iikiii-iiiiiiDiiii>i]ii,iiiiviLiBiii&iii iiiiGiiiiBii i! iiiu iiiii i iaiiiiv iS ii}i; iiDii=ii0i ii\ i( iiiivi iiiiii.iii9iHiiiii] iEiiiiii!ii/ iii i i-iiiQi*ii.i/iiiii0 i3ii" ii*iRiiiiWiii/iibi.ii iiiiiiiRii ii) ii2ii iiiiiiiZ iiT iiw iiii iiiiiii[ iOii i i`i7ix i^ iiiiiii\ iiiiiiigiiin ii i_ii~iiii0ii iaiiy i] iiiii iii i;ii i-i iiL iiii/iiiii`ii#i"iiiii0i isiiiidisi iiY ii ikiwio ii iiii1ii2iigip iQiiUi iv iiiiiCiSii^ iii5iiiBii_i ibiNiiiXiiii iiLici i i iKiw i* iaiGi3ii i iii1i6i i2i6 iNiii i i3ii:ii\iqiiii-iii i3i iiiix i ii irii4i i_ iiU iiii@ii5i ii ii ii/i+ i6i iiiiiii i7 iZ iiii8i4iiCiii iilii` iiiiiiYiiiii5i i{iiiii$i7iiMiV i0irii iigiiVii8ii9i, iZiii{i#iW i0iii$i i i ii4ii[iiviiiciiViM i$i- iiiiX iii idiiiWi[ iii iiiq i ii1 iiiiitiiii ii i i2 ii2i:i3 i i.iii2ii iiiiii%i iii i i iiiiiii i i6i i4 ii|iiiSiiii_ i iiiii`iiiii i3iii;ir iiii7iYiLi;ii i iiiiiTi\iiii<iiVi5 iii iii ii"ixi%ii;i8 i iii2iEi=i!iiii^iiwi i"iiiis ii#i<iQiiiri$ii]ii%ii. i&i i3i5iBiiy i'iii ii i i>iY ia ib i(i i i)i*i iiiii:ii6ii^ii iii(i i+i+i i ixi,i i.ihi/ i-iiii iVi ii ihiiz i.iiiii<iii;i/i?iii i i0i8i i ii5i6i i_i)i1i2i i3iyi iii i i^i4i i i?i$i+i\ i i5i_iWii iz i6i0 ii i] i iip i7i ii8i^ i< iiVi9i i6 iiIiwi}ic i^ii i9i@ii iAi iii i:iei1iiiBiiiiii i i ii7 i;i<ii=i{ ii(i`iRi1 iYiiIi ii i i6i id i>iiie i?iioiiqiYiniiiliiCiDi{ ii i_ iEiPiUii i iiiiEimii@ii:i ii iAiiiiii# i iNi i iBiiCiWiTiTiii iif i;iDii&i i| iiiiii iii<i= i iii iVii iioii iEi iFiii iiii iiiDi-i8 iiGidi i i iHit iiiIizi iiJi i iKii i| iiiii> iiiiiiiLi:i i=iiMii? i iiiHiiiiiNiii iOiPiiFikiQi9 i iii i iu iiv iiiiiiRiSiii} i i>iiiii i: iTi iiN iiCiiiiUi~ii iWiiGiiii,iiiiiOii|iiiiOi?iVi` ii ii~ i iw iiii@i!iii; iiiiiWii"i iXiiYiiRig iuii ih i ix i=i iiZii< iii[i i#ii= i i\i$ii]iHiIi^i7iO i$ i i_i%iviJii i!iwitii`iaibi9 i&ii"i{ii i i'iciidi8iiiii[i9iiidiZ i ieiii i@ i!i(i"ifiiii i#i$iTigiKii i%iiWiMihiiiiiiii%iiiiii i` iiyi7imiLijiki i: i> i!iiii iBi)ili|i ii iziiii iiMi ii iiimiiniuiq ivii i i*iNioipiiiqi7i.iriiy i iii iifii i isi! iyi iOi i iii+iPij i i>iiii iiYi iAitiiui% i i ivi iiz i2 iwi,i i iii3iQiii ixi i6i9ik iii&i6i ii-i iiRiyiiQi9ici i'i.i ioi(iBiFi? il i i)iei i izi iSiTi iii{i/iii" i ibi/ii`iii0iuiiviii1ii i iiUii*i i/iEiiSii8iZi|i}iFi+i ii!i~i2i,iFiP iim ii iieisiiCi ir iiii iiai3iZi%i-iiii i4iiiiAiii i iii iiiiDi.iiii inii iii iii ii3 i5iJi0i is i ii ii@ iiiVii/i i i6iWiA i7ioi iiPi0ii1iin iiiaiQi2iipi:iiiPiibiiiii i{ i3i7iEiii iii| iFiGiXiiiiii]i i4iii} iii i5ii&ii8i i ii iiiii iLiiiii i iYi iiiii4 i iB i9i8iiiii iHi i/i3iZi[ii io iii:i0i ini\ii]ii^iiii i iiiIiiii;ii4ii<ii=i;i ii iiiXi iiii5 i_ii i iiiii}i0i>ip iJiiiKii ii& iFiiii i i#ii[iiiifi i>iq ii?ir ii6iiii i iiiiijiiiii@i-ipi9i; i6iyiAiii i i' iiiiiiiiViii`ii4iii iKi iai i6 i iiiiii"iiiKi i iiii iYiGioiibifici7i is ipiri i8iiiii i iA iQ i iC i,i ii iiii\iLiiuii~ i iii9iiiBiiZiii iCiiiijidii0ihigiiei iMi} i7 i ii iiDi iiiiifi:iiiNi;i iEiFii( iii<iiiGiMi=iwigii~ it i?iiii itimi# i ii+iiihiiiiii[ i iOi i iii iiB iii$ it ii iiia ii iiHiiiiiQi"i< i i ii-i1ii#iu i'iiD i i ii i iIii>iJi% iiiPi i iii i i=ia iiKiiv iiii i ii ii_iijii?iE i1i i iikii8iQii iliii i imi@i iibiiii iRi iii5ii iiiLi iw iiniiii4iHi iiMii iiiiiii\ iioiiNi] i ii ii\ix igiiEi iiiiiiipii iiqi iiiiiiOiii iri iZi isitiiii iPieiii iiioi ii^ ii}iiiiziAi& iii i iiini-ii iQiiii iiiiRiiui iiiiBiii iy ii iviwiBihiqiiii<ii*iiiSi"iTiCi>i)i ixiUiiii~iiiiziiViiiiiC i)iqiiiWi i iiiDiiEiTiFipiii#i#iyii iiiGiiz iiiii ii iiSiiXi iiiiiu i i=iHiii_ iiRiiiiiiwiiiYizi{iqiii3ii5ii i i{ ii i|i}iSi~ii i i iZi[iiiiii` iiF ii]i i iniiiIii i iiiii iG iTiJiiKiziSiri\i) ii iv ii5iiii ib iiijiiiii iii]i^ii iiciiii i ii iai:i1i iiiiAihi ia i i6iiii ib i-ii iH i_ii ii i iii iiii| ii* ifii ii i iD ii iLiWiiiiUii i ii$ii i i iNiiiR ikiiE iiiiiMiiS i' ii`iisiiF ii iai} i i i( ijii i~ iViBi[ib iWi iibi iI iic i i ii{ii i ii ici i i idi i i]iiii= ieiiiiii iii iNi iiifigi i i iihiiiii i=iiXiiiiiiiiid iiHiCi iiiiTiWi i ii9ii iNi iKiEiji4iJ i iYi iiG i ikiiihiOii i i i]iPiZiiliiQi[ikiiminiRioic iiiiiiSiXiiii\i+iiiiiIiTiUiUiii iili iDiiiipiiqi iki imii iK iiiiiiiVi8 i i iiri@iWiri iCiGiiii ii^i ii i8iti i:i i i!iinisi i"i i#i$i]iti i%i i&iriui'i+ i(i)iie i i}i iiii*i4i1i+ii i i ii ii,ii i> iXitiri? ii i-i iviui{iiw iwii.ixiT i, iii i/i0ii ii1i ii2i iGiRi i i^iiYi iZi i i[i3i^iiii ii i) i\i i4i@ivii5ii6i7iid i]i ii^i8ii&i i ii i9 iyiuii i iiziRii{ii ii(i_ii<i9iili iii_i iSi`iki i[i iii ixi:i i;i<i! i$i=ii|iii>idi i i?iei iiii ii iii i}i@iAiBii.i~iaiOi i ii`ibii i%i iii i;i iiiiCiiDi iiiif i" iL i i i ii iEi;iiFi&iGi i iix iHi)iiiciiIidiTii i ieiiiii iiJi igi~iiUiie i iiiifiai8igi i ibihiKiy iii iLii: i iii ii*iM iiii icitiiMiNiii ii ii iiif iiiYidieii*i iiOiH ii# ii#i; i i iiiiI i\i@ iii isi$ i iPiQi i i iRijiSiTii+iiUiiVi iiLi i!i iJ i\i4iWi iiXiYiZii[i>iwikifiii+iii% iii$ii\iiiili i]iili^i_ig i%ii`iaigiiii iiN iK ibicidii ic iwi iei ibiyi ifihigihihii'iii imiiz ijid iii i i i<iii|iiiiii iiiO iki iliii iaiiimiii ini iiui iniiiie i& i ioiii i i< iipiqiP iQ iiji ii iii(ii_irisi i iii<iEiR ifiiiii]iiiIiti=iiuiivii iioi i iki,iliwi' ii imiiiiFi`ii if i ii iSiJixiiyiziniiL iipiOii ii i{i i iiA iyiiiU ii|i}i~iFi iqii i iiiiii iiiipiiiB iioi iiiipii- iiriiiqiqii( iiriiiisi iii iii i(i. isi) iiti i ii* iiuiiiTiviM i{ iiitii'iiii iiiiiiiig iZiwi i iciiji+ ipiiiixiii ih iiii iiii i, i= i ii i iuiiiii/ iyii i iyivi i iiwiiiiii ii iziiiii>iiCi'iiii{iiZiiii iii iiaiii iiqi?ii ii|ii i"ii ii i}iiiii=iiAi i1ii)iiii?i i iiiixi ii ii i i iihiiS iiii(ii iii'ixiyii ii i i iiiii_i iii> ii}iPiii iiii~ii iN iicii iiiiHii ii iiiiiiiiiiiiij iii i* iiii i i iiih iii_iii/i i<ii~i7ik iT iii]i iU ibi itiiig iizii ii| iiiiiiiii{iii ii0 ii ii+ i i, iiiiIiiiii i iiiBi ii4isi iiiii i iii?iCiii iiGi iiiiiiiiiiiiiii|i1 iiimiC iiil iiii i} ii? iiii iiih iiiIiiiiV iiiiiiii^iiii i- i. iii)iii iiii2 iiiiii ii iiAii ii- iiiii i ii ii iiiiii ii iii iiiQi i iO iiiiiiiiziKii ii[i iJiii@ ii. iiiiiD ii}i/ i@ii iii i i@iiRiii ij i~iiiJiii iiiii i0 iimiiiim i~ ii i ii1 iii iiiiii idiiiiXiii9iii iiiUiiiiiiLii3 ii ii i i iii i iii iii$i(iviii&iibii iii i iiiiii{iiiiiiiiiii2 ii iiii iii iiiiiiii^iiiV i iiiiiiiiiiiiii2iW ii iW ioii iik iX iii iA i4 ii ii3 iii iii ii iii iiiiiii i iiHiiiiiiiiiiiDiiiIisi iii ii iiiiiwii{iiiiiii/ in i,iiiii i iii ii ii i ii4 iB iiiiP i5 i ii i ii ii iii|iiziiiii i'ii5 iiii! ii iyiiiViii i i iiiiiiiiii i iii-iiiiii ii i i iiii ii" i%iiiiJiC iiixiiii i i iil i6 iiiii ii iiiXii ii7 ii i iNi im iiii iWi i i!i ii i i>i8 ii"i#i9 ij iD i i ii$i i%ii iiiXi&ii'iE i i(iF ii)iixi ikiiiii*i+ii iiDiii,iiiiiiiKi-i.i/i: ii0iJiii1i|i iii iii iEi*i2i iiiiiiHixi iii3ii iii3iiii; ipii< i iii ii4i5i i i6iiOii i7i8ii9ii:i ii;iiiii<i iiY i=i>i i i?ii@iAiBi i ii= i iiio i ifiiii i i i iCi iDii# ii i> iiEii iFiZ iE iii i[ i$ i iiGi? ii iiiG iiii@ iHiiA i\ iLiiiii iIi i iiiiiiiJi i i i iKiLi] iMiNi iijiiQ i iB iOiPiiiQi iiiRi iSiTii(iiiiC iiUiiVi iWiXiiiYiiiiZiiidi[iciH ii_ii#i0 i\ii]iini i iiii^iii_ik iD ii`iaii ibii i iciiiiidiii iiiidi^ iE ieiiii iiiifii_ i7iiii i iiF iiigi-iii! iiihi iqi;i iiiiXii i iiiiijiiii ikiliii~imiG i` iniyip iiioi>iipiiqi iiiriia iiiisiti" iui|ii?iiiiviiiiiieiiiwixiyiiiiizi{i@i|ii i}i i iii% isiiR ii.iiMi?i ii~iiib iii@ii iiiii iiiiiiii ii6 iI iiii iiiiic iiiiii i i2iiiimii@iiii iiiNii iifiiiiZi iiiiii i\iH iid iiiJ ii ii i iiii iiK iiii# iiii ii iiiiKiiiiigiiiihii>ii.iiiiiiiii)in itiiiii io i iI i i iiiq iiir i iiiiiip ii ii iziiiiUiiJ iii1 iK itiiiiiii iiiJiiiL i iiiiiiN(iiiiiii iRiiiiiii inii!i iiLi,iAiis iiiiiiL iS iii iiii.iNiiiiii:iiii?iii=iNiKiiiil iii i ii i ii iiii ioi$ iiiii ici8iiiiiiiiizi|iit i"i ie i@i\ii iiiiiiiFiiM iQiHiiiPiviif iiiiDiT iiiFiN iiEi iOii/iisii3i<i2i ii&iLiiiO iiiGiiiM iii?ii i`iiF i*iigi iZi i:ii iiKi ii iiiiii`iiiig ii i iqii~iiiP i ii iii!iiuiii*iii i ii~iiiiieiiGi^iiii iUiCiiBiiiiiii ijioi/iiiOi2 i[iii i& iiiiiSi(ii iipi]ii6iii i' iiiiii8ii+i% i[iii\iiiiiiX i( iii i0ii iHi i i"i!ii+i i1i"iii iOiG iiifi1iiiiiiii2i9iili,ii iiiiii}ih i#iq iQiMi&i iXiii#iii iiiijiiiMiii i%ii ii$iii'i iiN ii ii7iiJii!iiiiiiMii) iPiU iiii ii%i i ii ii i iIii3 ii iir ii i iiiimiii$iiixii iii ii ii%i&ii iiiiiiii&ii'iii'iii.ii iiiH iiiii$i#iiDi&iAi iiiiiiUiGiiii iQ iPiSi'iiidi i0iFiii* iiiiiiiJii iUiiiiI iR iii<iiS i:i7 i ii i i9ii}ii iiiViPiT ii)iCiiii& i i i)iiim iiiiiii4 iiiin i*iiiiiiiO iiiii i+ i(i i iiiU i(ii5iYiji iliiuii)i i*i+iV i i=i iiiiiii4ii!iiiTi, ixiiieii iiJ iPiis i5iAiV i/iki i iili!i iiAii`ii i iiAii iiii ii i iiiiiiMi iiiiiiW iii it iii+i}iij i8 iiiiiiiii- i)imi iiW ii ii iiaii iP iK i i,ii ii7i' iu ii{ik iiiii i9 iiiiiiiiiii1iibii i iiio iiX i,iQ iiiiii i i iX iiii5iDiiiliii[i iiiY ii%ii. iY ii*iii iiR iii ipiiinicigi+iii'i2iiii{iil iim iii: iifi ii|i5 iiiiiZ i i i i ii i,ii iii;iiIiYiii[ iXi"ii iiii~iii,iikiii-iiiiiiDiiii>i]ii,iiiiviLiBiii&iii iiiiGiiiiBii i! iiiu iiiii i iaiiiiv iS ii}i; iiDii=ii0i ii\ i( iiiivi iiiiii.iii9iHiiiii] iEiiiiii!ii/ iii i i-iiiQi*ii.i/iiiii0 i3ii" ii*iRiiiiWiii/iibi.ii iiiiiiiRii ii) ii2ii iiiiiiiZ iiT iiw iiii iiiiiii[ iOii i i`i7ix i^ iiiiiii\ iiiiiiigiiin ii i_ii~iiii0ii iaiiy i] iiiii iii i;ii i-i iiL iiii/iiiii`ii#i"iiiii0i isiiiidisi iiY ii ikiwio ii iiii1ii2iigip iQiiUi iv iiiiiCiSii^ iii5iiiBii_i ibiNiiiXiiii iiLici i i iKiw i* iaiGi3ii i iii1i6i i2i6 iNiii i i3ii:ii\iqiiii-iii i3i iiiix i ii irii4i i_ iiU iiii@ii5i ii ii ii/i+ i6i iiiiiii i7 iZ iiii8i4iiCiii iilii` iiiiiiYiiiii5i i{iiiii$i7iiMiV i0irii iigiiVii8ii9i, iZiii{i#iW i0iii$i i i ii4ii[iiviiiciiViM i$i- iiiiX iii idiiiWi[ iii iiiq i ii1 iiiiitiiii ii i i2 ii2i:i3 i i.iii2ii iiiiii%i iii i i iiiiiii i i6i i4 ii|iiiSiiii_ i iiiii`iiiii i3iii;ir iiii7iYiLi;ii i iiiiiTi\iiii<iiVi5 iii iii ii"ixi%ii;i8 i iii2iEi=i!iiii^iiwi i"iiiis ii#i<iQiiiri$ii]ii%ii. i&i i3i5iBiiy i'iii ii i i>iY ia ib i(i i i)i*i iiiii:ii6ii^ii iii(i i+i+i i ixi,i i.ihi/ i-iiii iVi ii ihiiz i.iiiii<iii;i/i?iii i i0i8i i ii5i6i i_i)i1i2i i3iyi iii i i^i4i i i?i$i+i\ i i5i_iWii iz i6i0 ii i] i iip i7i ii8i^ i< iiVi9i i6 iiIiwi}ic i^ii i9i@ii iAi iii i:iei1iiiBiiiiii i i ii7 i;i<ii=i{ ii(i`iRi1 iYiiIi ii i i6i id i>iiie i?iioiiqiYiniiiliiCiDi{ ii i_ iEiPiUii i iiiiEimii@ii:i ii iAiiiiii# i iNi i iBiiCiWiTiTiii iif i;iDii&i i| iiiiii iii<i= i iii iVii iioii iEi iFiii iiii iiiDi-i8 iiGidi i i iHit iiiIizi iiJi i iKii i| iiiii> iiiiiiiLi:i i=iiMii? i iiiHiiiiiNiii iOiPiiFikiQi9 i iii i iu iiv iiiiiiRiSiii} i i>iiiii i: iTi iiN iiCiiiiUi~ii iWiiGiiii,iiiiiOii|iiiiOi?iVi` ii ii~ i iw iiii@i!iii; iiiiiWii"i iXiiYiiRig iuii ih i ix i=i iiZii< iii[i i#ii= i i\i$ii]iHiIi^i7iO i$ i i_i%iviJii i!iwitii`iaibi9 i&ii"i{ii i i'iciidi8iiiii[i9iiidiZ i ieiii i@ i!i(i"ifiiii i#i$iTigiKii i%iiWiMihiiiiiiii%iiiiii i` iiyi7imiLijiki i: i> i!iiii iBi)ili|i ii iziiii iiMi ii iiimiiniuiq ivii i i*iNioipiiiqi7i.iriiy i iii iifii i isi! iyi iOi i iii+iPij i i>iiii iiYi iAitiiui% i i ivi iiz i2 iwi,i i iii3iQiii ixi i6i9ik iii&i6i ii-i iiRiyiiQi9ici i'i.i ioi(iBiFi? il i i)iei i izi iSiTi iii{i/iii" i ibi/ii`iii0iuiiviii1ii i iiUii*i i/iEiiSii8iZi|i}iFi+i ii!i~i2i,iFiP iim ii iieisiiCi ir iiii iiai3iZi%i-iiii i4iiiiAiii i iii iiiiDi.iiii inii iii iii ii3 i5iJi0i is i ii ii@ iiiVii/i i i6iWiA i7ioi iiPi0ii1iin iiiaiQi2iipi:iiiPiibiiiii i{ i3i7iEiii iii| iFiGiXiiiiii]i i4iii} iii i5ii&ii8i i ii iiiii iLiiiii i iYi iiiii4 i iB i9i8iiiii iHi i/i3iZi[ii io iii:i0i ini\ii]ii^iiii i iiiIiiii;ii4ii<ii=i;i ii iiiXi iiii5 i_ii i iiiii}i0i>ip iJiiiKii ii& iFiiii i i#ii[iiiifi i>iq ii?ir ii6iiii i iiiiijiiiii@i-ipi9i; i6iyiAiii i i' iiiiiiiiViii`ii4iii iKi iai i6 i iiiiii"iiiKi i iiii iYiGioiibifici7i is ipiri i8iiiii i iA iQ i iC i,i ii iiii\iLiiuii~ i iii9iiiBiiZiii iCiiiijidii0ihigiiei iMi} i7 i ii iiDi iiiiifi:iiiNi;i iEiFii( iii<iiiGiMi=iwigii~ it i?iiii itimi# i ii+iiihiiiiii[ i iOi i iii iiB iii$ it ii iiia ii iiHiiiiiQi"i< i i ii-i1ii#iu i'iiD i i ii i iIii>iJi% iiiPi i iii i i=ia iiKiiv iiii i ii ii_iijii?iE i1i i iikii8iQii iliii i imi@i iibiiii iRi iii5ii iiiLi iw iiniiii4iHi iiMii iiiiiii\ iioiiNi] i ii ii\ix igiiEi iiiiiiipii iiqi iiiiiiOiii iri iZi isitiiii iPieiii iiioi ii^ ii}iiiiziAi& iii i iiini-ii iQiiii iiiiRiiui iiiiBiii iy ii iviwiBihiqiiii<ii*iiiSi"iTiCi>i)i ixiUiiii~iiiiziiViiiiiC i)iqiiiWi i iiiDiiEiTiFipiii#i#iyii iiiGiiz iiiii ii iiSiiXi iiiiiu i i=iHiii_ iiRiiiiiiwiiiYizi{iqiii3ii5ii i i{ ii i|i}iSi~ii i i iZi[iiiiii` iiF ii]i i iniiiIii i iiiii iG iTiJiiKiziSiri\i) ii iv ii5iiii ib iiijiiiii iii]i^ii iiciiii i ii iai:i1i iiiiAihi ia i i6iiii ib i-ii iH i_ii ii i iii iiii| ii* ifii ii i iD ii iLiWiiiiUii i ii$ii i i iNiiiR ikiiE iiiiiMiiS i' ii`iisiiF ii iai} i i i( ijii i~ iViBi[ib iWi iibi iI iic i i ii{ii i ii ici i i idi i i]iiii= ieiiiiii iii iNi iiifigi i i iihiiiii i=iiXiiiiiiiiid iiHiCi iiiiTiWi i ii9ii iNi iKiEiji4iJ i iYi iiG i ikiiihiOii i i i]iPiZiiliiQi[ikiiminiRioic iiiiiiSiXiiii\i+iiiiiIiTiUiUiii iili iDiiiipiiqi iki imii iK iiiiiiiVi8 i i iiri@iWiri iCiGiiii ii^i ii i8iti i:i i i!iinisi i"i i#i$i]iti i%i i&iriui'i+ i(i)iie i i}i iiii*i4i1i+ii i i ii ii,ii i> iXitiri? ii i-i iviui{iiw iwii.ixiT i, iii i/i0ii ii1i ii2i iGiRi i i^iiYi iZi i i[i3i^iiii ii i) i\i i4i@ivii5ii6i7iid i]i ii^i8ii&i i ii i9 iyiuii i iiziRii{ii ii(i_ii<i9iili iii_i iSi`iki i[i iii ixi:i i;i<i! i$i=ii|iii>idi i i?iei iiii ii iii i}i@iAiBii.i~iaiOi i ii`ibii i%i iii i;i iiiiCiiDi iiiif i" iL i i i ii iEi;iiFi&iGi i iix iHi)iiiciiIidiTii i ieiiiii iiJi igi~iiUiie i iiiifiai8igi i ibihiKiy iii iLii: i iii ii*iM iiii icitiiMiNiii ii ii iiif iiiYidieii*i iiOiH ii# ii#i; i i iiiiI i\i@ iii isi$ i iPiQi i i iRijiSiTii+iiUiiVi iiLi i!i iJ i\i4iWi iiXiYiZii[i>iwikifiii+iii% iii$ii\iiiili i]iili^i_ig i%ii`iaigiiii iiN iK ibicidii ic iwi iei ibiyi ifihigihihii'iii imiiz ijid iii i i i<iii|iiiiii iiiO iki iliii iaiiimiii ini iiui iniiiie i& i ioiii i i< iipiqiP iQ iiji ii iii(ii_irisi i iii<iEiR ifiiiii]iiiIiti=iiuiivii iioi i iki,iliwi' ii imiiiiFi`ii if i ii iSiJixiiyiziniiL iipiOii ii i{i i iiA iyiiiU ii|i}i~iFi iqii i iiiiii iiiipiiiB iioi iiiipii- iiriiiqiqii( iiriiiisi iii iii i(i. isi) iiti i ii* iiuiiiTiviM i{ iiitii'iiii iiiiiiiig iZiwi i iciiji+ ipiiiixiii ih iiii iiii i, i= i ii i iuiiiii/ iyii i iyivi i iiwiiiiii ii iziiiii>iiCi'iiii{iiZiiii iii iiaiii iiqi?ii ii|ii i"ii ii i}iiiii=iiAi i1ii)iiii?i i iiiixi ii ii i i iihiiS iiii(ii iii'ixiyii ii i i iiiii_i iii> ii}iPiii iiii~ii iN iicii iiiiHii ii iiiiiiiiiiiiij iii i* iiii i i iiih iii_iii/i i<ii~i7ik iT iii]i iU ibi itiiig iizii ii| iiiiiiiii{iii ii0 ii ii+ i i, iiiiIiiiii i iiiBi ii4isi iiiii i iii?iCiii iiGi iiiiiiiiiiiiiii|i1 iiimiC iiil iiii i} ii? iiii iiih iiiIiiiiV iiiiiiii^iiii i- i. iii)iii iiii2 iiiiii ii iiAii ii- iiiii i ii ii iiiiii ii iii iiiQi i iO iiiiiiiiziKii ii[i iJiii@ ii. iiiiiD ii}i/ i@ii iii i i@iiRiii ij i~iiiJiii iiiii i0 iimiiiim i~ ii i ii1 iii iiiiii idiiiiXiii9iii iiiUiiiiiiLii3 ii ii i i iii i iii iii$i(iviii&iibii iii i iiiiii{iiiiiiiiiii2 ii iiii iii iiiiiiii^iiiV i iiiiiiiiiiiiii2iW ii iW ioii iik iX iii iA i4 ii ii3 iii iii ii iii iiiiiii i iiHiiiiiiiiiiiDiiiIisi iii ii iiiiiwii{iiiiiii/ in i,iiiii i iii ii ii i ii4 iB iiiiP i5 i ii i ii ii iii|iiziiiii i'ii5 iiii! ii iyiiiViii i i iiiiiiiiii i iii-iiiiii ii i i iiii ii" i%iiiiJiC iiixiiii i i iil i6 iiiii ii iiiXii ii7 ii i iNi im iiii iWi i i!i ii i i>i8 ii"i#i9 ij iD i i ii$i i%ii iiiXi&ii'iE i i(iF ii)iixi ikiiiii*i+ii iiDiii,iiiiiiiKi-i.i/i: ii0iJiii1i|i iii iii iEi*i2i iiiiiiHixi iii3ii iii3iiii; ipii< i iii ii4i5i i i6iiOii i7i8ii9ii:i ii;iiiii<i iiY i=i>i i i?ii@iAiBi i ii= i iiio i ifiiii i i i iCi iDii# ii i> iiEii iFiZ iE iii i[ i$ i iiGi? ii iiiG iiii@ iHiiA i\ iLiiiii iIi i iiiiiiiJi i i i iKiLi] iMiNi iijiiQ i iB iOiPiiiQi iiiRi iSiTii(iiiiC iiUiiVi iWiXiiiYiiiiZiiidi[iciH ii_ii#i0 i\ii]iini i iiii^iii_ik iD ii`iaii ibii i iciiiiidiii iiiidi^ iE ieiiii iiiifii_ i7iiii i iiF iiigi-iii! iiihi iqi;i iiiiXii i iiiiijiiii ikiliii~imiG i` iniyip iiioi>iipiiqi iiiriia iiiisiti" iui|ii?iiiiviiiiiieiiiwixiyiiiiizi{i@i|ii i}i i iii% isiiR ii.iiMi?i ii~iiib iii@ii iiiii iiiiiiii ii6 iI iiii iiiiic iiiiii i i2iiiimii@iiii iiiNii iifiiiiZi iiiiii i\iH iid iiiJ ii ii i iiii iiK iiii# iiii ii iiiiKiiiiigiiiihii>ii.iiiiiiiii)in itiiiii io i iI i i iiiq iiir i iiiiiip ii ii iziiiiUiiJ iii1 iK itiiiiiii iiiJiiiL i iiiiii(t EUCTW_TYPICAL_DISTRIBUTION_RATIOtEUCTW_TABLE_SIZEtEUCTW_CHAR_TO_FREQ_ORDER(((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euctwfreq.pyt,ssite-packages/pip/_vendor/chardet/euctwprober.pyc000064400000002526147204247350016215 0ustar00 abc@sZddlmZddlmZddlmZddlmZdefdYZdS(i(tMultiByteCharSetProber(tCodingStateMachine(tEUCTWDistributionAnalysis(tEUCTW_SM_MODELt EUCTWProbercBs/eZdZedZedZRS(cCs<tt|jtt|_t|_|jdS(N( tsuperRt__init__RRt coding_smRtdistribution_analyzertreset(tself((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euctwprober.pyR"s cCsdS(NsEUC-TW((R ((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euctwprober.pyt charset_name(scCsdS(NtTaiwan((R ((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euctwprober.pytlanguage,s(t__name__t __module__RtpropertyR R (((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euctwprober.pyR!s N( tmbcharsetproberRtcodingstatemachineRtchardistributionRtmbcssmRR(((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euctwprober.pytssite-packages/pip/_vendor/chardet/gb2312prober.pyc000064400000002537147204247350015770 0ustar00 abc@sZddlmZddlmZddlmZddlmZdefdYZdS(i(tMultiByteCharSetProber(tCodingStateMachine(tGB2312DistributionAnalysis(tGB2312_SM_MODELt GB2312ProbercBs/eZdZedZedZRS(cCs<tt|jtt|_t|_|jdS(N( tsuperRt__init__RRt coding_smRtdistribution_analyzertreset(tself((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/gb2312prober.pyR"s cCsdS(NtGB2312((R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/gb2312prober.pyt charset_name(scCsdS(NtChinese((R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/gb2312prober.pytlanguage,s(t__name__t __module__RtpropertyR R(((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/gb2312prober.pyR!s N( tmbcharsetproberRtcodingstatemachineRtchardistributionRtmbcssmRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/gb2312prober.pytssite-packages/pip/_vendor/chardet/hebrewprober.pyc000064400000007346147204247350016347 0ustar00 abc@s:ddlmZddlmZdefdYZdS(i(t CharSetProber(t ProbingStatet HebrewProbercBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZedZedZedZRS(iiiiiiiiiiig{Gz?s ISO-8859-8s windows-1255cCsWtt|jd|_d|_d|_d|_d|_d|_ |j dS(N( tsuperRt__init__tNonet_final_char_logical_scoret_final_char_visual_scoret_prevt _before_prevt_logical_probert_visual_probertreset(tself((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pyRs      cCs(d|_d|_d|_d|_dS(Nit (RRRR (R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pyR s   cCs||_||_dS(N(R R (R t logicalProbert visualProber((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pytset_model_proberss cCs(||j|j|j|j|jgkS(N(t FINAL_KAFt FINAL_MEMt FINAL_NUNtFINAL_PEt FINAL_TSADI(R tc((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pytis_finalscCs"||j|j|j|jgkS(N(t NORMAL_KAFt NORMAL_MEMt NORMAL_NUNt NORMAL_PE(R R((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pyt is_non_finals cCs|jtjkrtjS|j|}x|D]}|dkr|jdkr|j|jrt|jd7_q|j|jr|j d7_ qqn?|jdkr|j|jr|dkr|j d7_ n|j|_||_q/Wtj S(NRi( tstateRtNOT_MEtfilter_high_byte_onlyR RRRRRt DETECTING(R tbyte_strtcur((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pytfeeds     cCs|j|j}||jkr&|jS||j kr=|jS|jj|jj}||jkro|jS||j kr|jS|dkr|jS|jS(Ng( RRtMIN_FINAL_CHAR_DISTANCEtLOGICAL_HEBREW_NAMEtVISUAL_HEBREW_NAMER tget_confidenceR tMIN_MODEL_DISTANCE(R tfinalsubtmodelsub((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pyt charset_names  cCsdS(NtHebrew((R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pytlanguagescCs8|jjtjkr1|jjtjkr1tjStjS(N(R RRRR R!(R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pyRs(t__name__t __module__RRRRRRRRRt NORMAL_TSADIR%R)R'R&RR RRRR$tpropertyR,R.R(((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pyRs.    ;N(t charsetproberRtenumsRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pytscsite-packages/pip/_vendor/chardet/jisfreq.pyc000064400000126720147204247350015322 0ustar00 abc@sdZdZdZdS(g@ii(iiiiii'iOii}i ii ii] i i ii iiiiiii iiiiiXi}iiikiig i i ikiiiiiiiiii%i&i0i1i,i-iiiiiii iii<iiipiiiiiiigiiiiWiXii ih i"iiiii i ii\iii i/ ii iiiii0 ii ihi iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii ii!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7iiViji4iiiiBiii8i9i:i;i<i=i>iviiiiSiieiifi iid i+iiiaiw iiiiIii~ii ii?i@iAiBiCiDi ii- i iiiii iiEi^ i. i i3iii iFi/ iYi i iiiji iiGiHiIiJiqii1 iiYiiki/ii2iii#i iii*iiiiiii[ii\i5ii!i!i i%i@ilii'iAii i i4i iiiiii<iiii-iii7iSiii~iKi=iiEii;iii7i7i8imi&iii iiOiKi=i~idiiiLiMiNiOiPiQiRiSiTiUiViYi>iJi"ip ipiiiiiTi_iii.iXiiiLijieii9iPi iliyiii iDiii i)ihi iFi?ii+iiigiciiiBi]iNiii8iji:i5iii7iiiRi4iGidiiiiniihiti6i3i$iWiCi ii: ix iii*iV i iWiXiYiZi[i\i]i^i_i`iiaibicidieifigihiiijikiliminioipiqirisiti iuiviwixiyizi{i|iiiiili}i i~iii i i iiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiikii i> i i i i i ij iiiiZi[i\i]ii ii ii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i iiiiiii2 iii{iTiia i i^iii|i i=iimik i i ii iViy i ii iq iiii i iiiii!ii ii ii iiCiOi3iiiiiir iiinii+iiii ipiqi i; iAi iiiCi0 iini iiiTiCioi ii i# iii~iiPiiiiii ii i i$ iz ii i&iiiii iiiii_iiiUii is i ii iIiiiiiiii3 iii$iWi1 i5iPi iiiiiiiX iiiil iiiHii iiiiii i iWii~ipii$iiii@iLi i iiiiuii iJiI iW iii_ii i<iiii]iDiiiiihiiiiiiifi-ii}it ii iiiii,ii ibiiiXiiiFii{ i`iii+i3iqiimii4 iiiiiiBiliX i ii% iii% i2 iuii i iiJii|irii@i iii iii ii iL iiiiiiib iJ i icii iiiiii4 iRiim iTiii iiiiiie iii? i iiiii-i ii*iEi ii+i ii& i iii/iii.isi[ii+ii ii iBic iiiiii i) ii,i iu ii ii9i& iiiiiiv iiY i i3 ii iiiiDiiiiidiii| i(iyiiiii<i8i iiii i id i5 iBiini iiiii|i i!ii)i@ in imi i i0iaiii izi'iii iWii[iviii iii io i i ii iii' ii i"iii9iii iiJiiihiiie iii\iiiip i@iiQi9iiii iiiiw iiiEiiJiIi iiiiiifii ii i i1i ii iii' iri iiii iiici iqiixiii i2iiiii i*iiibiFiiviidi iii!iRiiiQiiiiPiiiiiiii( iii_ ii` iiif ii6 iiAiiia iiiuiTi i2iiiiii i^iCii ii[ii ivi%iiiini!iFiiZi^iiiidiiiix iii]i iBiici i iiiPiqi i iHiY iii( ii iigi}iKi iii4 iiWii iiCig i-idiikii4i} iiq i~ i+i iiihi@ i i i@iA iDi:iiiei iiqiwiiiiiiiidiiZii* iM i[iiisiZ i i ii>ii'i-i i ii ii) iiiiitiFi7 iiti#iiiiiiYiiifikib i1ii ii6ioic iiqi iiii iuii:iiiN iiUi=i iviiliNiiii]ii;iii iiiliLi i}iiiiiB ii8 iQii#i`iTii ixiiri iiiiii ii3iniiiiiii{iii@i iiii9 iiii5 ih id iZ iiiiiiiiiisi-ir iiiii[ ii0iiiii.iSi iRiO iii ii;i i4iy i i;iiz iipii i i ii: i(i|i ii"iiiiii iOiieiiii iC iti) ii6iKiii8iiP iihii ii ii3i$iii* i=ibie ii i4iii i.i7ii\ iiiiji iiiiiiii/iiii i=ii^ii5 i ii i\iiiii9i#i+ i is i,ii7iiiYiii iMii+ ii iQiii6 iiiiiiyi iisi#i{ i iUifi<iiiviii)i iiiiiimi<iii iiigii ilii iD ibiui i iDiBiii i[ i ii8iii>i iii iiii i] iiDiiii6iZii i5ii i i<imi i, i iiui^ i iiigiiiIiiigi ii\i:i iMiti iiEiioiiiiiEiRii iiEij iigiWiiiKi iCii=ii]i$i!ii iiii`iKiviii0iiii^ii i3ii"iiiiiiaik ii; iwiiiiiii iyiiiiiPiii iwiiiit i iii iiiJiaiii]iiii iiiiiLihiiii iu ijiii#iCiii iaii!isi| ii iYii iiiihiOi5iiiziii iSiiLii.ii&ii i< i7iisiA iiiMi iisii*i, i%i i iikii&ifiiOiji"ii(i-ii[iii ii- i=ii} iiiMiSiii iiiii ii i i ii ii~ iiJitikivieiyiiii< i if iiMiki iiioiiiiwiv ilii]iii.i iiii/if iqi$ig iiGiiinii>i6 i= ii iii iNi ixiiei* iih iiii$iiiioibi,ii iiitiii i ii iVii iiiiiiiw iiipiHi iViiii<iZi i8iriwii&ii ii/iiiii>ii> iE ixii&ieiiwi iii5iii ii\iiiiSii iiiii2iiiii+i'ii%iiix iOii iQ iiiiiii_iHiiii igiiiy ii i0i&i+ i iiii il i'ii'izii i ii_ iiii i ii? i ii iiz iim i|i ii ig i0iii ii*ii i i`iwiii i#iici)iiiR i iiiTiiiriiViiii_iiiiiriii i` ixiii iiifiiin i= i*iAii i(iixiiS ii{iT ii9iiiMi iriii;ii(ii%ii[ia ib iiiDiiii- i\ iii iio iEimi)ii!iiic ii, i1ii] iiii>iIiii iTiiii iiiyiikizixiiNi iiii i5i i i"iiHi<id ii iiih i ii ip iii:iLi1iii iii> iiq i?iZiMiIi iiB iK iDii#i i iYi>iiiii`iiiiiiiiiiiii iiiciiiiiiiTiiaii2iyi/ii"iU iiibii ii/ii ii i i{i iij ii ii5i*iiiiiaixiii iiFiiii7 iii i?iiwiiiiii+ii8 ii iNi iii,iinii i i ioisi_i?ii iii i iii?i0i i iiyi3ifi i=iiilii iivi]ii i iiizi iiyijiiui iipiijiii iiiziiir iiiiiiiiiFii'i i{ ini ixiui$iiiiMiiiik iipi i^ iqi i`i|ii ii i| i i i ii i iiii iGi ii-iiZi1iYii- i ieiii[iC iiiie i i.i-iiii iii i i7 ibil i iiii{ii.i i iizii i ii? iii9 ii iiii}ii iaii i iQi idi;iV ii/i^iD ii?im i i i9iIi iii iii i{i}i iiiiii&ii~iiXii i} i ii9i ii:ii"i\iii i_ ii8iWi~ i^i%iPisi iwii ii8 i iLiii. iii iiiNiiiPiiSiiii:iRi'i0ibiii iiiiizii iiiiiKiii i iriiqi iiin iL iiiiiiiiiiXi@ iigiiiii4ii: iiiiri iiQi ii i;i'i i>iibimiiwiiiis iiiiA iit i9 iiiii io i^iii2iiciiii i iriii i!iitii1i{i iiiiiisiiiii iixiiviaip iii iiLiOiiiUi i.iii)i. iiEi i"iiyii iiiii(i iiiq iE i6i i i2iui6i iiii. iii iiiViiisi iiiGiGijitiiWii iii`iiiiui ii ii{iQii iOiCi ii iiJi i i i$iiii/ iii_iiiij iRii7iii/ ii3iDiu i6iXi4iii iiii>iiii0 i`i` i iiiiUii i irii i)ii5iiHii iii~ir ii iiiii iii]iiiiiii i@ iii iaiiviiii/i!i6iiii7iwi i i3ici8ixii iiB iiiM iiiF iigiiii(ii i: iiiHii if iii"i i~iii i iyii i ii i!iNi i4iA iidieiiiziiii iiii0 ii iiiiiii{iii i iifi(iliiGi iii^iB imiF i|iiUiii2iRiii#ii iiiFii iUiiii1i icikiiN iSi iii iii$iO ii iYiiii iiGi iiiW i iC i?i iii~iiiUiFiiiiiiii iC i iiiiei iiiii/ iQi_iv i; i i iPi)iiGimi iiiG i,iIizi_i ii i9inii iAi i iX ii#iVi)i< i%ii}iiiHiw i5iipi.iiiimiiii i#ihi|ibii ii@i(i^izi iiAi i i i"i ig ii|iiiiii6iiXiii,iii iii$i#iIik iiiii:i iiQi ioih iVi$i iitiiiiY i,iii i iD ii i~i i iii%iii iiii ii i i7i/i iiii iEiVii iE iuii&iiii i iioiiiZiiiii i iiiii!iini8ii'iiiiiiii iiGi iRi2iii:ii,iiiZ ilii(iXiP i?ii i ioiiiii iiWi*iii;i8ii&i)ii i ioiiiiiHi_iii0iix ii0 ii; ii iiiXii iii1iiZi*i%i iii|idi`iiiSiji}i\iiiiG i ii ifiqi%iBii1 ipii"iiiii i|iiii iil i2 ii i iii@ihii;iiii ii iii&iiii}ii%i iii i?ii iia iy ii iii ii= i1 ii<ii{i#iiiii iAii iitiii ii> i iKi3 iii=iii\i i i'iAi+igiib iKiiiii ii ii4 ii*iim i ii ioiNii0i(ii ii$i4i i{i iiiQ iiiUiiii,i`ii iii ij i)i ii-i6ii iF i2i)ii i*i iYN(i(iiiiii'iOii}i ii ii] i i ii iiiiiii iiiiiXi}iiikiig i i ikiiiiiiiiii%i&i0i1i,i-iiiiiii iii<iiipiiiiiiigiiiiWiXii ih i"iiiii i ii\iii i/ ii iiiii0 ii ihi iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii ii!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7iiViji4iiiiBiii8i9i:i;i<i=i>iviiiiSiieiifi iid i+iiiaiw iiiiIii~ii ii?i@iAiBiCiDi ii- i iiiii iiEi^ i. i i3iii iFi/ iYi i iiiji iiGiHiIiJiqii1 iiYiiki/ii2iii#i iii*iiiiiii[ii\i5ii!i!i i%i@ilii'iAii i i4i iiiiii<iiii-iii7iSiii~iKi=iiEii;iii7i7i8imi&iii iiOiKi=i~idiiiLiMiNiOiPiQiRiSiTiUiViYi>iJi"ip ipiiiiiTi_iii.iXiiiLijieii9iPi iliyiii iDiii i)ihi iFi?ii+iiigiciiiBi]iNiii8iji:i5iii7iiiRi4iGidiiiiniihiti6i3i$iWiCi ii: ix iii*iV i iWiXiYiZi[i\i]i^i_i`iiaibicidieifigihiiijikiliminioipiqirisiti iuiviwixiyizi{i|iiiiili}i i~iii i i iiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiikii i> i i i i i ij iiiiZi[i\i]ii ii ii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i iiiiiii2 iii{iTiia i i^iii|i i=iimik i i ii iViy i ii iq iiii i iiiii!ii ii ii iiCiOi3iiiiiir iiinii+iiii ipiqi i; iAi iiiCi0 iini iiiTiCioi ii i# iii~iiPiiiiii ii i i$ iz ii i&iiiii iiiii_iiiUii is i ii iIiiiiiiii3 iii$iWi1 i5iPi iiiiiiiX iiiil iiiHii iiiiii i iWii~ipii$iiii@iLi i iiiiuii iJiI iW iii_ii i<iiii]iDiiiiihiiiiiiifi-ii}it ii iiiii,ii ibiiiXiiiFii{ i`iii+i3iqiimii4 iiiiiiBiliX i ii% iii% i2 iuii i iiJii|irii@i iii iii ii iL iiiiiiib iJ i icii iiiiii4 iRiim iTiii iiiiiie iii? i iiiii-i ii*iEi ii+i ii& i iii/iii.isi[ii+ii ii iBic iiiiii i) ii,i iu ii ii9i& iiiiiiv iiY i i3 ii iiiiDiiiiidiii| i(iyiiiii<i8i iiii i id i5 iBiini iiiii|i i!ii)i@ in imi i i0iaiii izi'iii iWii[iviii iii io i i ii iii' ii i"iii9iii iiJiiihiiie iii\iiiip i@iiQi9iiii iiiiw iiiEiiJiIi iiiiiifii ii i i1i ii iii' iri iiii iiici iqiixiii i2iiiii i*iiibiFiiviidi iii!iRiiiQiiiiPiiiiiiii( iii_ ii` iiif ii6 iiAiiia iiiuiTi i2iiiiii i^iCii ii[ii ivi%iiiini!iFiiZi^iiiidiiiix iii]i iBiici i iiiPiqi i iHiY iii( ii iigi}iKi iii4 iiWii iiCig i-idiikii4i} iiq i~ i+i iiihi@ i i i@iA iDi:iiiei iiqiwiiiiiiiidiiZii* iM i[iiisiZ i i ii>ii'i-i i ii ii) iiiiitiFi7 iiti#iiiiiiYiiifikib i1ii ii6ioic iiqi iiii iuii:iiiN iiUi=i iviiliNiiii]ii;iii iiiliLi i}iiiiiB ii8 iQii#i`iTii ixiiri iiiiii ii3iniiiiiii{iii@i iiii9 iiii5 ih id iZ iiiiiiiiiisi-ir iiiii[ ii0iiiii.iSi iRiO iii ii;i i4iy i i;iiz iipii i i ii: i(i|i ii"iiiiii iOiieiiii iC iti) ii6iKiii8iiP iihii ii ii3i$iii* i=ibie ii i4iii i.i7ii\ iiiiji iiiiiiii/iiii i=ii^ii5 i ii i\iiiii9i#i+ i is i,ii7iiiYiii iMii+ ii iQiii6 iiiiiiyi iisi#i{ i iUifi<iiiviii)i iiiiiimi<iii iiigii ilii iD ibiui i iDiBiii i[ i ii8iii>i iii iiii i] iiDiiii6iZii i5ii i i<imi i, i iiui^ i iiigiiiIiiigi ii\i:i iMiti iiEiioiiiiiEiRii iiEij iigiWiiiKi iCii=ii]i$i!ii iiii`iKiviii0iiii^ii i3ii"iiiiiiaik ii; iwiiiiiii iyiiiiiPiii iwiiiit i iii iiiJiaiii]iiii iiiiiLihiiii iu ijiii#iCiii iaii!isi| ii iYii iiiihiOi5iiiziii iSiiLii.ii&ii i< i7iisiA iiiMi iisii*i, i%i i iikii&ifiiOiji"ii(i-ii[iii ii- i=ii} iiiMiSiii iiiii ii i i ii ii~ iiJitikivieiyiiii< i if iiMiki iiioiiiiwiv ilii]iii.i iiii/if iqi$ig iiGiiinii>i6 i= ii iii iNi ixiiei* iih iiii$iiiioibi,ii iiitiii i ii iVii iiiiiiiw iiipiHi iViiii<iZi i8iriwii&ii ii/iiiii>ii> iE ixii&ieiiwi iii5iii ii\iiiiSii iiiii2iiiii+i'ii%iiix iOii iQ iiiiiii_iHiiii igiiiy ii i0i&i+ i iiii il i'ii'izii i ii_ iiii i ii? i ii iiz iim i|i ii ig i0iii ii*ii i i`iwiii i#iici)iiiR i iiiTiiiriiViiii_iiiiiriii i` ixiii iiifiiin i= i*iAii i(iixiiS ii{iT ii9iiiMi iriii;ii(ii%ii[ia ib iiiDiiii- i\ iii iio iEimi)ii!iiic ii, i1ii] iiii>iIiii iTiiii iiiyiikizixiiNi iiii i5i i i"iiHi<id ii iiih i ii ip iii:iLi1iii iii> iiq i?iZiMiIi iiB iK iDii#i i iYi>iiiii`iiiiiiiiiiiii iiiciiiiiiiTiiaii2iyi/ii"iU iiibii ii/ii ii i i{i iij ii ii5i*iiiiiaixiii iiFiiii7 iii i?iiwiiiiii+ii8 ii iNi iii,iinii i i ioisi_i?ii iii i iii?i0i i iiyi3ifi i=iiilii iivi]ii i iiizi iiyijiiui iipiijiii iiiziiir iiiiiiiiiFii'i i{ ini ixiui$iiiiMiiiik iipi i^ iqi i`i|ii ii i| i i i ii i iiii iGi ii-iiZi1iYii- i ieiii[iC iiiie i i.i-iiii iii i i7 ibil i iiii{ii.i i iizii i ii? iii9 ii iiii}ii iaii i iQi idi;iV ii/i^iD ii?im i i i9iIi iii iii i{i}i iiiiii&ii~iiXii i} i ii9i ii:ii"i\iii i_ ii8iWi~ i^i%iPisi iwii ii8 i iLiii. iii iiiNiiiPiiSiiii:iRi'i0ibiii iiiiizii iiiiiKiii i iriiqi iiin iL iiiiiiiiiiXi@ iigiiiii4ii: iiiiri iiQi ii i;i'i i>iibimiiwiiiis iiiiA iit i9 iiiii io i^iii2iiciiii i iriii i!iitii1i{i iiiiiisiiiii iixiiviaip iii iiLiOiiiUi i.iii)i. iiEi i"iiyii iiiii(i iiiq iE i6i i i2iui6i iiii. iii iiiViiisi iiiGiGijitiiWii iii`iiiiui ii ii{iQii iOiCi ii iiJi i i i$iiii/ iii_iiiij iRii7iii/ ii3iDiu i6iXi4iii iiii>iiii0 i`i` i iiiiUii i irii i)ii5iiHii iii~ir ii iiiii iii]iiiiiii i@ iii iaiiviiii/i!i6iiii7iwi i i3ici8ixii iiB iiiM iiiF iigiiii(ii i: iiiHii if iii"i i~iii i iyii i ii i!iNi i4iA iidieiiiziiii iiii0 ii iiiiiii{iii i iifi(iliiGi iii^iB imiF i|iiUiii2iRiii#ii iiiFii iUiiii1i icikiiN iSi iii iii$iO ii iYiiii iiGi iiiW i iC i?i iii~iiiUiFiiiiiiii iC i iiiiei iiiii/ iQi_iv i; i i iPi)iiGimi iiiG i,iIizi_i ii i9inii iAi i iX ii#iVi)i< i%ii}iiiHiw i5iipi.iiiimiiii i#ihi|ibii ii@i(i^izi iiAi i i i"i ig ii|iiiiii6iiXiii,iii iii$i#iIik iiiii:i iiQi ioih iVi$i iitiiiiY i,iii i iD ii i~i i iii%iii iiii ii i i7i/i iiii iEiVii iE iuii&iiii i iioiiiZiiiii i iiiii!iini8ii'iiiiiiii iiGi iRi2iii:ii,iiiZ ilii(iXiP i?ii i ioiiiii iiWi*iii;i8ii&i)ii i ioiiiiiHi_iii0iix ii0 ii; ii iiiXii iii1iiZi*i%i iii|idi`iiiSiji}i\iiiiG i ii ifiqi%iBii1 ipii"iiiii i|iiii iil i2 ii i iii@ihii;iiii ii iii&iiii}ii%i iii i?ii iia iy ii iii ii= i1 ii<ii{i#iiiii iAii iitiii ii> i iKi3 iii=iii\i i i'iAi+igiib iKiiiii ii ii4 ii*iim i ii ioiNii0i(ii ii$i4i i{i iiiQ iiiUiiii,i`ii iii ij i)i ii-i6ii iF i2i)ii i*i iY(tJIS_TYPICAL_DISTRIBUTION_RATIOtJIS_TABLE_SIZEtJIS_CHAR_TO_FREQ_ORDER(((s?/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jisfreq.pyt,s$site-packages/pip/_vendor/chardet/jpcntx.pyc000064400000061362147204247350015165 0ustar00 abc@sRdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSfSZdefdYZdefd YZd efd YZd S( iiiiiitJapaneseContextAnalysiscBs\eZdZdZdZdZdZdZdZdZ dZ d Z d Z RS( iiidiicCs;d|_d|_d|_d|_d|_|jdS(N(tNonet _total_relt _rel_samplet_need_to_skip_char_numt_last_char_ordert_donetreset(tself((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyt__init__{s      cCs;d|_dg|j|_d|_d|_t|_dS(Nii(RtNUM_OF_CATEGORYRRRtFalseR(R((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyRs    cCs|jr dS|j}x||kr|j|||d!\}}||7}||krt|||_d|_q|dkr|jdkr|jd7_|j|jkrt|_Pn|jt|j|cd7/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pytfeeds         !cCs|j|jkS(N(RtENOUGH_REL_THRESHOLD(R((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pytgot_enough_datascCs6|j|jkr+|j|jd|jS|jSdS(Ni(RtMINIMUM_DATA_THRESHOLDRt DONT_KNOW(R((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pytget_confidencescCsdS(Nii(ii((RR((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyR s( t__name__t __module__R RRR RR RRRRR (((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyRts    tSJISContextAnalysiscBs)eZdZedZdZRS(cCs tt|jd|_dS(Nt SHIFT_JIS(tsuperRR t _charset_name(R((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyR scCs|jS(N(R (R((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyt charset_namescCs|s dS|d}d|ko+dknsLd|koGdknrd}|d kszd |koudknrd |_qnd}t|dkr|d}|d krd|kod knr|d|fSnd|fS(NiiiiiiiiiitCP932ii(ii(R tlen(RRt first_charRt second_char((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyR s 8( ((RRR tpropertyR!R (((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyRs tEUCJPContextAnalysiscBseZdZRS(cCs|s d S|d}|dks<d|ko7dknrEd}n|dkrZd }nd}t|dkr|d}|d krd|kod knr|d|fSnd|fS( Niiiiiiiiiii(ii(R#(RRR$RR%((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyR s (    ((RRR (((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyR'sN(RtobjectRRR'(((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pytsCsite-packages/pip/_vendor/chardet/langbulgarianmodel.pyc000064400000060604147204247350017504 0ustar00 abc@svdZdZdZied6ed6dd6ed6dd6dd6Zied6ed6dd6ed6dd6dd6ZdS(iiiiiMiZicidiHimikieiOiiQifiLi^iRiniili[iJiwiTi`ioiisiAiEiFiBi?iDipigi\iihi_iViWiGitiiUi]iaiqiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii-iiii i#i+i%i,i7i/i(i;i!i.i&i$i)ii'ii"i3i0i1i5i2i6i9i=iiCii<i8iii ii iiiiii i iiii iiiiiiiiiiiiKi4ii*ii>iiii:iibiiiiiiixiNi@iSiyiuiXiziYijiIiPiviritchar_to_order_maptprecedence_matrixg! _B?ttypical_positive_ratiotkeep_english_letters ISO-8859-5t charset_namet Bulgairantlanguages windows-1251t BulgarianN(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiMiZicidiHimikieiOiiQifiLi^iRiniili[iJiwiTi`ioiisiiiiiiiAiEiFiBi?iDipigi\iihi_iViWiGitiiUi]iaiqiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiQiiiiiiiiiiiiii-iiii i#i+i%i,i7i/i(i;i!i.i&i$i)ii'ii"i3i0i1i5i2i6i9i=iiCii<i8iii ii iiiiii i iiii iiiiiiiiiiiiKi4ii*ii>iiii:iibiiiiiii[ii(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiMiZicidiHimikieiOiiQifiLi^iRiniili[iJiwiTi`ioiisiiiiiiiAiEiFiBi?iDipigi\iihi_iViWiGitiiUi]iaiqiiiiiiiiiiiiiiiiiiixiiiiiiiiiNi@iSiyibiuiiiiiiiiiiiXiiiiiziYijiiiiii-iiiIiPiviriiiiii>i:iiiiiii i#i+i%i,i7i/i(i;i!i.i&i$i)ii'ii"i3i0i1i5i2i6i9i=iiCii<i8iii ii iiiiii i iiii iiiiiiiiiiiiKi4ii*i(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii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/python2.7/site-packages/pip/_vendor/chardet/langbulgarianmodel.pyt&sZ  site-packages/pip/_vendor/chardet/langcyrillicmodel.pyc000064400000073734147204247350017362 0ustar00 abc@sNdZdZdZdZdZdZdZied6ed6dd6ed6dd6dd6Zied6ed6dd6ed6dd6dd6Z ied6ed6dd6ed6dd6dd6Z ied6ed6dd6ed6dd6dd6Z ied6ed6dd6ed6dd6dd6Z ied6ed6dd6ed6dd6dd6Z dS(iiiiiiiiiiiiiiiiJiiKiiiiiiiiiiiiiGiiBiiAiiLii@iiiMiHiiEiCiiNiIiiiOiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiDiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii ii'iiiii ii iiiii iiiii iiiiiiii6i;i%i,i:i)i0i5i.i7i*i<i$i1i&ii"i#i+i-i i(i4i8i!i=i>i3i9i/i?i2iFitchar_to_order_maptprecedence_matrixglP@?ttypical_positive_ratiotkeep_english_lettersKOI8-Rt charset_nametRussiantlanguages windows-1251s ISO-8859-5t MacCyrillictIBM866tIBM855N(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiJiiKiiiiiiiiiiiiiiiiiiiGiiBiiAiiLii@iiiMiHiiEiCiiNiIiiiOiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiDiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii ii'iiiii ii iiiii iiiii iiiiiiii6i;i%i,i:i)i0i5i.i7i*i<i$i1i&ii"i#i+i-i i(i4i8i!i=i>i3i9i/i?i2iF(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiJiiKiiiiiiiiiiiiiiiiiiiGiiBiiAiiLii@iiiMiHiiEiCiiNiIiiiOiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii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iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(tKOI8R_char_to_order_maptwin1251_char_to_order_maptlatin5_char_to_order_maptmacCyrillic_char_to_order_maptIBM855_char_to_order_maptIBM866_char_to_order_maptRussianLangModeltFalset Koi8rModeltWin1251CyrillicModeltLatin5CyrillicModeltMacCyrillicModelt Ibm866Modelt Ibm855Model(((sI/usr/lib/python2.7/site-packages/pip/_vendor/chardet/langcyrillicmodel.pyts      site-packages/pip/_vendor/chardet/langhebrewmodel.pyc000064400000055632147204247350017021 0ustar00 abc@s@dZdZied6ed6dd6ed6dd6dd6ZdS(iiiiiEi[iOiPi\iYiaiZiDioipiRiIi_iUiNiyiViGiCifikiTirigisi2iJi<i=i*iLiFi@i5iii]i8iAi6i1iBini3i+i,i?iQiMibiKili|iiiii(i:iiiiiiiiiiiSi4i/i.iHi i^iiqiimiiiii"itiividiiiuiwihi}iiiWiciijizi{ii7iiieiiixii0i'i9iii;i)iXi!i%i$iii#ii>iii~iii&i-iiiiiiiiiiiiii iiiiiiiiiiiii iii ii iiiiiii iiii`itchar_to_order_maptprecedence_matrixg C|?ttypical_positive_ratiotkeep_english_letters windows-1255t charset_nametHebrewtlanguageN(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiEi[iOiPi\iYiaiZiDioipiRiIi_iUiNiyiViGiCifikiTirigisiiiiiii2iJi<i=i*iLiFi@i5iii]i8iAi6i1iBini3i+i,i?iQiMibiKiliiiiii|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iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(tWIN1255_CHAR_TO_ORDER_MAPtHEBREW_LANG_MODELtFalsetWin1255HebrewModel(((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/langhebrewmodel.pyt&s, site-packages/pip/_vendor/chardet/langhungarianmodel.pyc000064400000060546147204247350017521 0ustar00 abc@svdZdZdZied6ed6dd6ed6dd6dd6Zied6ed6dd6ed6dd6dd6ZdS(iiiiii(i6i-i i2i1i&i'i5i$i)i"i#i/i.iGi+i!i%i9i0i@iDi7i4iiiiiii ii iiii iiiiCi iiiiiAi>ii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiKiiiiiiiiiOiiiiiiiiiiiiiiiii3iQiiNiiiii,iiii=iiiiii:iiBi;iiii<iEi?iiiiRiiJiiFiPiiHiiiSiMiTiiLiUiiiiiIi*iiiiii8iiiViWitchar_to_order_maptprecedence_matrixg(P?ttypical_positive_ratiotkeep_english_letters ISO-8859-2t charset_namet Hungariantlanguages windows-1250N(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(i6i-i i2i1i&i'i5i$i)i"i#i/i.iGi+i!i%i9i0i@iDi7i4iiiiiiiiiiiii ii iiii iiiiCi iiiiiAi>ii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiKiiiiiiiiiOiiiiiiiiiiiiiiiii3iQiiNiiiii,iiii=iiiiii:iiBi;iiii<iEi?iiiiRiiJiiFiPiiHiiiSiMiTiiLiUiiiiiIi*iiiiii8iiii(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(i6i-i i2i1i&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iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(tLatin2_HungarianCharToOrderMaptwin1250HungarianCharToOrderMaptHungarianLangModeltTruetLatin2HungarianModeltWin1250HungarianModel(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/langhungarianmodel.pyt#sZ  site-packages/pip/_vendor/chardet/langthaimodel.pyc000064400000055605147204247350016472 0ustar00 abc@s@dZdZied6ed6dd6ed6dd6dd6ZdS(iiiiiijikidiiiiei^iiiliminioiiiiYi_ipiqiiiii@iHiIiriJisitifiQiiuiZigiNiRi`ii[iOiTihiiiaibi\iiiiiiiXiiiiiiiiviiiiiciUiSiiiiiiiiiiiiiiiiiiKiii4i"i3iwi/i:i9i1i5i7i+iii,ii0iiii'i>ii6i-i iii=iii i*i.iiiLiiBi?ii ii$ii i(ii i#iViiiiii ii)ii!ii2i%iiiCiMi&i]iiiDi8i;iAiEi<iFiPiGiWiiiiitchar_to_order_maptprecedence_matrixg@?ttypical_positive_ratiotkeep_english_lettersTIS-620t charset_nametThaitlanguageN(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijikidiiiiei^iiiliminioiiiiYi_ipiqiiiiiiiiiii@iHiIiriJisitifiQiiuiZigiNiRi`ii[iOiTihiiiaibi\iiiiiiiiiiiiXiiiiiiiiviiiiiciUiSiiiiiiiiiiiiiiiiiiKiii4i"i3iwi/i:i9i1i5i7i+iii,ii0iiii'i>ii6i-i iii=iii i*i.iiiLiiBi?ii ii$ii i(ii i#iViiiiii ii)ii!ii2i%iiiCiMi&i]iiiDi8i;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iiiiiiiiiiiiiiiiiiii(tTIS620CharToOrderMapt ThaiLangModeltFalsetTIS620ThaiModel(((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/langthaimodel.pyt%s, site-packages/pip/_vendor/chardet/langturkishmodel.pyc000064400000055626147204247350017241 0ustar00 abc@s@dZdZied6ed6dd6ed6dd6dd6ZdS(iii%i/i'ii4i$i-i5i<ii1ii.i*i0iEi,i#ii3i&i>iAi+i8iiii iiiiiii ii iiii@iii ii i9i:i iiiiiiiiiiiiiiiiiiiiiiiieiiiiiiiiijiiiiiiiidiiiiiiiii^iPi]iiiiii?iiiiiii~i}i|ihiIiciOiUi{i6izibi\iyixi[igiwiDiviuiaitisi2iZiriqipioi7i)i(iViYiFi;iNiGiRiXi!iMiBiTiSiniKi=i`iiCimiJiWifi"i_iQiliLiHiiiikitchar_to_order_maptprecedence_matrixgX4 ?ttypical_positive_ratiotkeep_english_letters ISO-8859-9t charset_nametTurkishtlanguageN(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii%i/i'ii4i$i-i5i<ii1ii.i*i0iEi,i#ii3i&i>iAi+i8iiiiiiiiii iiiiiii ii iiii@iii ii i9i:i iiiiiiiiiiiiiiiiiiiiiiiiiiiiieiiiiiiiiijiiiiiiiidiiiiiiiii^iPi]iiiiii?iiiiiii~i}i|ihiIiciOiUi{i6izibi\iyixi[igiwiDiviuiaitisi2iZiriqipioi7i)i(iViYiFi;iNiGiRiXi!iMiBiTiSiniKi=i`iiCimiJiWifi"i_iQiliLiHiiiik(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii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iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(tLatin5_TurkishCharToOrderMaptTurkishLangModeltTruetLatin5TurkishModel(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/langturkishmodel.pyt%s,site-packages/pip/_vendor/chardet/latin1prober.pyc000064400000007235147204247350016260 0ustar00 abc@sddlmZddlmZdZdZdZdZdZdZ dZ dZ d Z d Z eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeee ee ee eeeeeeeeeeee ee ee e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee e e e e e e e e e e e e e e e e e e e e e e ee e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e ee e e e e e e e fZdZd efd YZd S(i(t CharSetProber(t ProbingStateiiiiiiiit Latin1ProbercBsJeZdZdZedZedZdZdZRS(cCs3tt|jd|_d|_|jdS(N(tsuperRt__init__tNonet_last_char_classt _freq_countertreset(tself((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pyRas  cCs*t|_dgt|_tj|dS(Ni(tOTHRt FREQ_CAT_NUMRRR(R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pyRgs cCsdS(Ns ISO-8859-1((R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pyt charset_namelscCsdS(Nt((R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pytlanguagepscCs~|j|}xe|D]]}t|}t|jt|}|dkrWtj|_Pn|j|cd7<||_qW|j S(Nii( tfilter_with_english_letterstLatin1_CharToClasstLatin1ClassModelRt CLASS_NUMRtNOT_MEt_stateRtstate(R tbyte_strtct char_classtfreq((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pytfeedts      cCs}|jtjkrdSt|j}|dkr:d}n |jd|jdd|}|dkrod}n|d}|S(Ng{Gz?giig4@g\(\?(RRRtsumR(R ttotalt confidence((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pytget_confidences     ( t__name__t __module__RRtpropertyR RRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pyR`s    N(@iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(t charsetproberRtenumsRR tUDFR tASCtASStACVtACOtASVtASORRRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pytsh site-packages/pip/_vendor/chardet/mbcharsetprober.pyo000064400000005353147204247350017053 0ustar00 abc@s@ddlmZddlmZmZdefdYZdS(i(t CharSetProber(t ProbingStatet MachineStatetMultiByteCharSetProbercBsSeZdZddZdZedZedZdZ dZ RS(s MultiByteCharSetProber cCs>tt|jd|d|_d|_ddg|_dS(Nt lang_filteri(tsuperRt__init__tNonetdistribution_analyzert coding_smt _last_char(tselfR((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pyR's  cCsXtt|j|jr,|jjn|jrE|jjnddg|_dS(Ni(RRtresetR RR (R ((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pyR -s   cCs tdS(N(tNotImplementedError(R ((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pyt charset_name5scCs tdS(N(R (R ((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pytlanguage9scCsixtt|D]}|jj||}|tjkrm|jjd|j|j |t j |_ Pq|tj krt j|_ Pq|tjkr|jj}|dkr|d|jd<|jj|j|q|jj||d|d!|qqW|d|jd<|jt jkrb|jjrb|j|jkrbt j|_ qbn|jS(Ns!%s %s prober hit error at byte %siii(trangetlenR t next_stateRtERRORtloggertdebugRRRtNOT_MEt_statetITS_MEtFOUND_ITtSTARTtget_current_charlenR Rtfeedtstatet DETECTINGtgot_enough_datatget_confidencetSHORTCUT_THRESHOLD(R tbyte_strtit coding_statetchar_len((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pyR=s.    cCs |jjS(N(RR (R ((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pyR ZsN( t__name__t __module__t__doc__RRR tpropertyRRRR (((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pyR"s   N(t charsetproberRtenumsRRR(((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pytssite-packages/pip/_vendor/chardet/mbcsgroupprober.pyc000064400000002470147204247350017065 0ustar00 abc@sddlmZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZd efd YZd S( i(tCharSetGroupProber(t UTF8Prober(t SJISProber(t EUCJPProber(t GB2312Prober(t EUCKRProber(t CP949Prober(t Big5Prober(t EUCTWProbertMBCSGroupProbercBseZddZRS(cCs`tt|jd|ttttttt t g|_ |j dS(Nt lang_filter( tsuperR t__init__RRRRRRRRtproberstreset(tselfR ((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcsgroupprober.pyR *sN(t__name__t __module__tNoneR (((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcsgroupprober.pyR )sN(tcharsetgroupproberRt utf8proberRt sjisproberRt eucjpproberRt gb2312proberRt euckrproberRt cp949proberRt big5proberRt euctwproberRR (((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcsgroupprober.pytssite-packages/pip/_vendor/chardet/mbcsgroupprober.pyo000064400000002470147204247350017101 0ustar00 abc@sddlmZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZd efd YZd S( i(tCharSetGroupProber(t UTF8Prober(t SJISProber(t EUCJPProber(t GB2312Prober(t EUCKRProber(t CP949Prober(t Big5Prober(t EUCTWProbertMBCSGroupProbercBseZddZRS(cCs`tt|jd|ttttttt t g|_ |j dS(Nt lang_filter( tsuperR t__init__RRRRRRRRtproberstreset(tselfR ((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcsgroupprober.pyR *sN(t__name__t __module__tNoneR (((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcsgroupprober.pyR )sN(tcharsetgroupproberRt utf8proberRt sjisproberRt eucjpproberRt gb2312proberRt euckrproberRt cp949proberRt big5proberRt euctwproberRR (((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcsgroupprober.pytssite-packages/pip/_vendor/chardet/mbcssm.pyc000064400000045261147204247350015143 0ustar00 abc@sddlmZd"ZejejejdejejejejejejejejejejejejejejejejejejejejfZd#Zied6dd6ed 6ed 6d d 6Zd$Z ejejdejejejddejd ejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejfFZ d%Z ie d6dd6e d 6e d 6dd 6Z d&Z ddddejejejejejejejejejejejejejejejejejejejejejejejejejejdejdejejejejejejejf(Zd'Zie d6d d6ed 6ed 6dd 6Zd(ZejejdejejejejejejejejejejejejejfZd)Zied6dd6ed 6ed 6dd 6Zd*Zejejejddddejejejejejejejejejejejejejejejejejejejejejejejejejdejejejejejejejejejejejejejejejf0Zd+Zied6dd6ed 6ed 6dd 6Zd,Zejejejejejejdejejejejejejejejejejejejejejejejejdejejejejejejejejejdejejejejejejejejejejejejejf0Zd-Zied6dd6ed 6ed 6dd 6Zd.ZejejejdejejejejejejejejejejejejejejejejejejejejfZd/Zied6d d6ed 6ed 6dd 6Z d0Z!dddejddejejejejejejejejejejejejd d d d ejejd d d d d ejd d d d d d dddejddd d ejd d d d d d d ejejejejf8Z"d1Z#ie!d6d d6e"d 6e#d 6dd 6Z$d2Z%d d dd ddejejejejejejejejejejejejdddejejejdddejdejd d dd dddddejdddejejejdddddejdejejejf8Z&d3Z'ie%d6d d6e&d 6e'd 6dd 6Z(d4Z)ejejejejejejddddddd dddejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejddddejejejejejejejejejejejejejdddejejejejejejejejejejejejddddejejejejejejejejejejejejejejddejejejejejejejejejejejejddddejejejejejejejejejejejejejejejdejejejejejejejejejejejejddddejejejejejejejejejejejejejejejdejejejejejejejejejejejejdddejejejejejejejejejejejejejejejejejejejejejejejejejejejfZ*d5Z+ie)d6dd6e*d 6e+d 6d d 6Z,d!S(6i(t MachineStateiiiit class_tableit class_factort state_tabletchar_len_tabletBig5tnameiiii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S2BE_CHAR_LEN_TABLEtUCS2BE_SM_MODELt UCS2LE_CLSt UCS2LE_STtUCS2LE_CHAR_LEN_TABLEtUCS2LE_SM_MODELtUTF8_CLStUTF8_STtUTF8_CHAR_LEN_TABLEt UTF8_SM_MODEL(((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcssm.pytsh-06  0<<<<<B  $00-3  -6  $000-6  -00--6  -06  !0$*  0'!*  *0000$0'0$0*0$0-0$0-0'006 site-packages/pip/_vendor/chardet/mbcssm.pyo000064400000045261147204247350015157 0ustar00 abc@sddlmZd"ZejejejdejejejejejejejejejejejejejejejejejejejejfZd#Zied6dd6ed 6ed 6d d 6Zd$Z ejejdejejejddejd ejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejfFZ d%Z ie d6dd6e d 6e d 6dd 6Z d&Z ddddejejejejejejejejejejejejejejejejejejejejejejejejejejdejdejejejejejejejf(Zd'Zie d6d d6ed 6ed 6dd 6Zd(ZejejdejejejejejejejejejejejejejfZd)Zied6dd6ed 6ed 6dd 6Zd*Zejejejddddejejejejejejejejejejejejejejejejejejejejejejejejejdejejejejejejejejejejejejejejejf0Zd+Zied6dd6ed 6ed 6dd 6Zd,Zejejejejejejdejejejejejejejejejejejejejejejejejdejejejejejejejejejdejejejejejejejejejejejejejf0Zd-Zied6dd6ed 6ed 6dd 6Zd.ZejejejdejejejejejejejejejejejejejejejejejejejejfZd/Zied6d d6ed 6ed 6dd 6Z d0Z!dddejddejejejejejejejejejejejejd d d d ejejd d d d d ejd d d d d d dddejddd d ejd d d d d d d ejejejejf8Z"d1Z#ie!d6d d6e"d 6e#d 6dd 6Z$d2Z%d d dd ddejejejejejejejejejejejejdddejejejdddejdejd d dd dddddejdddejejejdddddejdejejejf8Z&d3Z'ie%d6d d6e&d 6e'd 6dd 6Z(d4Z)ejejejejejejddddddd dddejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejddddejejejejejejejejejejejejejdddejejejejejejejejejejejejddddejejejejejejejejejejejejejejddejejejejejejejejejejejejddddejejejejejejejejejejejejejejejdejejejejejejejejejejejejddddejejejejejejejejejejejejejejejdejejejejejejejejejejejejdddejejejejejejejejejejejejejejejejejejejejejejejejejejejfZ*d5Z+ie)d6dd6e*d 6e+d 6d d 6Z,d!S(6i(t MachineStateiiiit class_tableit class_factort state_tabletchar_len_tabletBig5tnameiiii i tCP949sEUC-JPsEUC-KRsx-euc-twtGB2312t Shift_JISsUTF-16BEsUTF-16LEi i i iiisUTF-8N(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(iiiii(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii( iiiiiiiiii(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii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ODELt EUCKR_CLStEUCKR_STtEUCKR_CHAR_LEN_TABLEtEUCKR_SM_MODELt EUCTW_CLStEUCTW_STtEUCTW_CHAR_LEN_TABLEtEUCTW_SM_MODELt GB2312_CLSt GB2312_STtGB2312_CHAR_LEN_TABLEtGB2312_SM_MODELtSJIS_CLStSJIS_STtSJIS_CHAR_LEN_TABLEt SJIS_SM_MODELt UCS2BE_CLSt UCS2BE_STtUCS2BE_CHAR_LEN_TABLEtUCS2BE_SM_MODELt UCS2LE_CLSt UCS2LE_STtUCS2LE_CHAR_LEN_TABLEtUCS2LE_SM_MODELtUTF8_CLStUTF8_STtUTF8_CHAR_LEN_TABLEt UTF8_SM_MODEL(((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcssm.pytsh-06  0<<<<<B  $00-3  -6  $000-6  -00--6  -06  !0$*  0'!*  *0000$0'0$0*0$0-0$0-0'006 site-packages/pip/_vendor/chardet/sbcharsetprober.pyc000064400000007132147204247350017042 0ustar00 abc@sFddlmZddlmZmZmZdefdYZdS(i(t CharSetProber(tCharacterCategoryt ProbingStatetSequenceLikelihoodtSingleByteCharSetProbercBsheZdZdZdZdZed dZdZ e dZ e dZ dZ d ZRS( i@igffffff?g?cCsitt|j||_||_||_d|_d|_d|_ d|_ d|_ |j dS(N( tsuperRt__init__t_modelt _reversedt _name_probertNonet _last_ordert _seq_counterst _total_seqst _total_chart _freq_chartreset(tselftmodeltreversedt name_prober((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sbcharsetprober.pyR's        cCsQtt|jd|_dgtj|_d|_d|_d|_ dS(Nii( RRRR Rtget_num_categoriesR R RR(R((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sbcharsetprober.pyR5s    cCs"|jr|jjS|jdSdS(Nt charset_name(R RR(R((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sbcharsetprober.pyR?s  cCs'|jr|jjS|jjdSdS(Ntlanguage(R RRtget(R((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sbcharsetprober.pyRFs  c Cs|jds|j|}n|s,|jS|jd}xt|D]\}}||}|tjkr}|jd7_n||jkr+|jd7_|j |jkr+|j d7_ |j s|j |j|}|jd|}n%||j|j }|jd|}|j |cd7ssite-packages/pip/_vendor/chardet/sbcharsetprober.pyo000064400000007132147204247350017056 0ustar00 abc@sFddlmZddlmZmZmZdefdYZdS(i(t CharSetProber(tCharacterCategoryt ProbingStatetSequenceLikelihoodtSingleByteCharSetProbercBsheZdZdZdZdZed dZdZ e dZ e dZ dZ d ZRS( i@igffffff?g?cCsitt|j||_||_||_d|_d|_d|_ d|_ d|_ |j dS(N( tsuperRt__init__t_modelt _reversedt _name_probertNonet _last_ordert _seq_counterst _total_seqst _total_chart _freq_chartreset(tselftmodeltreversedt name_prober((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sbcharsetprober.pyR's        cCsQtt|jd|_dgtj|_d|_d|_d|_ dS(Nii( RRRR Rtget_num_categoriesR R RR(R((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sbcharsetprober.pyR5s    cCs"|jr|jjS|jdSdS(Nt charset_name(R RR(R((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sbcharsetprober.pyR?s  cCs'|jr|jjS|jjdSdS(Ntlanguage(R RRtget(R((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sbcharsetprober.pyRFs  c Cs|jds|j|}n|s,|jS|jd}xt|D]\}}||}|tjkr}|jd7_n||jkr+|jd7_|j |jkr+|j d7_ |j s|j |j|}|jd|}n%||j|j }|jd|}|j |cd7ssite-packages/pip/_vendor/chardet/sbcsgroupprober.py000064400000006732147204247350016735 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetgroupprober import CharSetGroupProber from .sbcharsetprober import SingleByteCharSetProber from .langcyrillicmodel import (Win1251CyrillicModel, Koi8rModel, Latin5CyrillicModel, MacCyrillicModel, Ibm866Model, Ibm855Model) from .langgreekmodel import Latin7GreekModel, Win1253GreekModel from .langbulgarianmodel import Latin5BulgarianModel, Win1251BulgarianModel # from .langhungarianmodel import Latin2HungarianModel, Win1250HungarianModel from .langthaimodel import TIS620ThaiModel from .langhebrewmodel import Win1255HebrewModel from .hebrewprober import HebrewProber from .langturkishmodel import Latin5TurkishModel class SBCSGroupProber(CharSetGroupProber): def __init__(self): super(SBCSGroupProber, self).__init__() self.probers = [ SingleByteCharSetProber(Win1251CyrillicModel), SingleByteCharSetProber(Koi8rModel), SingleByteCharSetProber(Latin5CyrillicModel), SingleByteCharSetProber(MacCyrillicModel), SingleByteCharSetProber(Ibm866Model), SingleByteCharSetProber(Ibm855Model), SingleByteCharSetProber(Latin7GreekModel), SingleByteCharSetProber(Win1253GreekModel), SingleByteCharSetProber(Latin5BulgarianModel), SingleByteCharSetProber(Win1251BulgarianModel), # TODO: Restore Hungarian encodings (iso-8859-2 and windows-1250) # after we retrain model. # SingleByteCharSetProber(Latin2HungarianModel), # SingleByteCharSetProber(Win1250HungarianModel), SingleByteCharSetProber(TIS620ThaiModel), SingleByteCharSetProber(Latin5TurkishModel), ] hebrew_prober = HebrewProber() logical_hebrew_prober = SingleByteCharSetProber(Win1255HebrewModel, False, hebrew_prober) visual_hebrew_prober = SingleByteCharSetProber(Win1255HebrewModel, True, hebrew_prober) hebrew_prober.set_model_probers(logical_hebrew_prober, visual_hebrew_prober) self.probers.extend([hebrew_prober, logical_hebrew_prober, visual_hebrew_prober]) self.reset() site-packages/pip/_vendor/chardet/sbcsgroupprober.pyc000064400000003611147204247350017071 0ustar00 abc@sddlmZddlmZddlmZmZmZmZm Z m Z ddl m Z m Z ddlmZmZddlmZddlmZddlmZdd lmZd efd YZd S( i(tCharSetGroupProber(tSingleByteCharSetProber(tWin1251CyrillicModelt Koi8rModeltLatin5CyrillicModeltMacCyrillicModelt Ibm866Modelt Ibm855Model(tLatin7GreekModeltWin1253GreekModel(tLatin5BulgarianModeltWin1251BulgarianModel(tTIS620ThaiModel(tWin1255HebrewModel(t HebrewProber(tLatin5TurkishModeltSBCSGroupProbercBseZdZRS(c Cstt|jtttttttttttt tt tt tt tt ttttg |_t}ttt|}ttt|}|j|||jj|||g|jdS(N(tsuperRt__init__RRRRRRRRR R R R RtprobersRR tFalsetTruetset_model_proberstextendtreset(tselft hebrew_probertlogical_hebrew_probertvisual_hebrew_prober((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sbcsgroupprober.pyR,s,                (t__name__t __module__R(((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sbcsgroupprober.pyR+sN(tcharsetgroupproberRtsbcharsetproberRtlangcyrillicmodelRRRRRRtlanggreekmodelRR tlangbulgarianmodelR R t langthaimodelR tlanghebrewmodelR t hebrewproberRtlangturkishmodelRR(((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sbcsgroupprober.pyts.site-packages/pip/_vendor/chardet/sjisprober.py000064400000007276147204247350015702 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import SJISDistributionAnalysis from .jpcntx import SJISContextAnalysis from .mbcssm import SJIS_SM_MODEL from .enums import ProbingState, MachineState class SJISProber(MultiByteCharSetProber): def __init__(self): super(SJISProber, self).__init__() self.coding_sm = CodingStateMachine(SJIS_SM_MODEL) self.distribution_analyzer = SJISDistributionAnalysis() self.context_analyzer = SJISContextAnalysis() self.reset() def reset(self): super(SJISProber, self).reset() self.context_analyzer.reset() @property def charset_name(self): return self.context_analyzer.charset_name @property def language(self): return "Japanese" def feed(self, byte_str): for i in range(len(byte_str)): coding_state = self.coding_sm.next_state(byte_str[i]) if coding_state == MachineState.ERROR: self.logger.debug('%s %s prober hit error at byte %s', self.charset_name, self.language, i) self._state = ProbingState.NOT_ME break elif coding_state == MachineState.ITS_ME: self._state = ProbingState.FOUND_IT break elif coding_state == MachineState.START: char_len = self.coding_sm.get_current_charlen() if i == 0: self._last_char[1] = byte_str[0] self.context_analyzer.feed(self._last_char[2 - char_len:], char_len) self.distribution_analyzer.feed(self._last_char, char_len) else: self.context_analyzer.feed(byte_str[i + 1 - char_len:i + 3 - char_len], char_len) self.distribution_analyzer.feed(byte_str[i - 1:i + 1], char_len) self._last_char[0] = byte_str[-1] if self.state == ProbingState.DETECTING: if (self.context_analyzer.got_enough_data() and (self.get_confidence() > self.SHORTCUT_THRESHOLD)): self._state = ProbingState.FOUND_IT return self.state def get_confidence(self): context_conf = self.context_analyzer.get_confidence() distrib_conf = self.distribution_analyzer.get_confidence() return max(context_conf, distrib_conf) site-packages/pip/_vendor/chardet/sjisprober.pyc000064400000005773147204247350016045 0ustar00 abc@sddlmZddlmZddlmZddlmZddlm Z ddl m Z m Z defdYZ d S( i(tMultiByteCharSetProber(tCodingStateMachine(tSJISDistributionAnalysis(tSJISContextAnalysis(t SJIS_SM_MODEL(t ProbingStatet MachineStatet SJISProbercBsJeZdZdZedZedZdZdZRS(cCsHtt|jtt|_t|_t|_ |j dS(N( tsuperRt__init__RRt coding_smRtdistribution_analyzerRtcontext_analyzertreset(tself((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pyR %s   cCs$tt|j|jjdS(N(RRR R (R((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pyR ,scCs |jjS(N(R t charset_name(R((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pyR0scCsdS(NtJapanese((R((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pytlanguage4scCsxNtt|D]:}|jj||}|tjkrm|jjd|j|j |t j |_ Pq|tj krt j|_ Pq|tjkr|jj}|dkr|d|jd<|jj|jd|||jj|j|qM|jj||d||d|!||jj||d|d!|qqW|d|jd<|jt jkr|jjr|j|jkrt j|_ qn|jS(Ns!%s %s prober hit error at byte %siiiii(trangetlenR t next_stateRtERRORtloggertdebugRRRtNOT_MEt_statetITS_MEtFOUND_ITtSTARTtget_current_charlent _last_charR tfeedR tstatet DETECTINGtgot_enough_datatget_confidencetSHORTCUT_THRESHOLD(Rtbyte_strtit coding_statetchar_len((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pyR8s6    cCs+|jj}|jj}t||S(N(R R#R tmax(Rt context_conft distrib_conf((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pyR#Ys( t__name__t __module__R R tpropertyRRRR#(((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pyR$s    !N(tmbcharsetproberRtcodingstatemachineRtchardistributionRtjpcntxRtmbcssmRtenumsRRR(((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pyts site-packages/pip/_vendor/chardet/universaldetector.py000064400000030305147204247350017247 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### """ Module containing the UniversalDetector detector class, which is the primary class a user of ``chardet`` should use. :author: Mark Pilgrim (initial port to Python) :author: Shy Shalom (original C code) :author: Dan Blanchard (major refactoring for 3.0) :author: Ian Cordasco """ import codecs import logging import re from .charsetgroupprober import CharSetGroupProber from .enums import InputState, LanguageFilter, ProbingState from .escprober import EscCharSetProber from .latin1prober import Latin1Prober from .mbcsgroupprober import MBCSGroupProber from .sbcsgroupprober import SBCSGroupProber class UniversalDetector(object): """ The ``UniversalDetector`` class underlies the ``chardet.detect`` function and coordinates all of the different charset probers. To get a ``dict`` containing an encoding and its confidence, you can simply run: .. code:: u = UniversalDetector() u.feed(some_bytes) u.close() detected = u.result """ MINIMUM_THRESHOLD = 0.20 HIGH_BYTE_DETECTOR = re.compile(b'[\x80-\xFF]') ESC_DETECTOR = re.compile(b'(\033|~{)') WIN_BYTE_DETECTOR = re.compile(b'[\x80-\x9F]') ISO_WIN_MAP = {'iso-8859-1': 'Windows-1252', 'iso-8859-2': 'Windows-1250', 'iso-8859-5': 'Windows-1251', 'iso-8859-6': 'Windows-1256', 'iso-8859-7': 'Windows-1253', 'iso-8859-8': 'Windows-1255', 'iso-8859-9': 'Windows-1254', 'iso-8859-13': 'Windows-1257'} def __init__(self, lang_filter=LanguageFilter.ALL): self._esc_charset_prober = None self._charset_probers = [] self.result = None self.done = None self._got_data = None self._input_state = None self._last_char = None self.lang_filter = lang_filter self.logger = logging.getLogger(__name__) self._has_win_bytes = None self.reset() def reset(self): """ Reset the UniversalDetector and all of its probers back to their initial states. This is called by ``__init__``, so you only need to call this directly in between analyses of different documents. """ self.result = {'encoding': None, 'confidence': 0.0, 'language': None} self.done = False self._got_data = False self._has_win_bytes = False self._input_state = InputState.PURE_ASCII self._last_char = b'' if self._esc_charset_prober: self._esc_charset_prober.reset() for prober in self._charset_probers: prober.reset() def feed(self, byte_str): """ Takes a chunk of a document and feeds it through all of the relevant charset probers. After calling ``feed``, you can check the value of the ``done`` attribute to see if you need to continue feeding the ``UniversalDetector`` more data, or if it has made a prediction (in the ``result`` attribute). .. note:: You should always call ``close`` when you're done feeding in your document if ``done`` is not already ``True``. """ if self.done: return if not len(byte_str): return if not isinstance(byte_str, bytearray): byte_str = bytearray(byte_str) # First check for known BOMs, since these are guaranteed to be correct if not self._got_data: # If the data starts with BOM, we know it is UTF if byte_str.startswith(codecs.BOM_UTF8): # EF BB BF UTF-8 with BOM self.result = {'encoding': "UTF-8-SIG", 'confidence': 1.0, 'language': ''} elif byte_str.startswith((codecs.BOM_UTF32_LE, codecs.BOM_UTF32_BE)): # FF FE 00 00 UTF-32, little-endian BOM # 00 00 FE FF UTF-32, big-endian BOM self.result = {'encoding': "UTF-32", 'confidence': 1.0, 'language': ''} elif byte_str.startswith(b'\xFE\xFF\x00\x00'): # FE FF 00 00 UCS-4, unusual octet order BOM (3412) self.result = {'encoding': "X-ISO-10646-UCS-4-3412", 'confidence': 1.0, 'language': ''} elif byte_str.startswith(b'\x00\x00\xFF\xFE'): # 00 00 FF FE UCS-4, unusual octet order BOM (2143) self.result = {'encoding': "X-ISO-10646-UCS-4-2143", 'confidence': 1.0, 'language': ''} elif byte_str.startswith((codecs.BOM_LE, codecs.BOM_BE)): # FF FE UTF-16, little endian BOM # FE FF UTF-16, big endian BOM self.result = {'encoding': "UTF-16", 'confidence': 1.0, 'language': ''} self._got_data = True if self.result['encoding'] is not None: self.done = True return # If none of those matched and we've only see ASCII so far, check # for high bytes and escape sequences if self._input_state == InputState.PURE_ASCII: if self.HIGH_BYTE_DETECTOR.search(byte_str): self._input_state = InputState.HIGH_BYTE elif self._input_state == InputState.PURE_ASCII and \ self.ESC_DETECTOR.search(self._last_char + byte_str): self._input_state = InputState.ESC_ASCII self._last_char = byte_str[-1:] # If we've seen escape sequences, use the EscCharSetProber, which # uses a simple state machine to check for known escape sequences in # HZ and ISO-2022 encodings, since those are the only encodings that # use such sequences. if self._input_state == InputState.ESC_ASCII: if not self._esc_charset_prober: self._esc_charset_prober = EscCharSetProber(self.lang_filter) if self._esc_charset_prober.feed(byte_str) == ProbingState.FOUND_IT: self.result = {'encoding': self._esc_charset_prober.charset_name, 'confidence': self._esc_charset_prober.get_confidence(), 'language': self._esc_charset_prober.language} self.done = True # If we've seen high bytes (i.e., those with values greater than 127), # we need to do more complicated checks using all our multi-byte and # single-byte probers that are left. The single-byte probers # use character bigram distributions to determine the encoding, whereas # the multi-byte probers use a combination of character unigram and # bigram distributions. elif self._input_state == InputState.HIGH_BYTE: if not self._charset_probers: self._charset_probers = [MBCSGroupProber(self.lang_filter)] # If we're checking non-CJK encodings, use single-byte prober if self.lang_filter & LanguageFilter.NON_CJK: self._charset_probers.append(SBCSGroupProber()) self._charset_probers.append(Latin1Prober()) for prober in self._charset_probers: if prober.feed(byte_str) == ProbingState.FOUND_IT: self.result = {'encoding': prober.charset_name, 'confidence': prober.get_confidence(), 'language': prober.language} self.done = True break if self.WIN_BYTE_DETECTOR.search(byte_str): self._has_win_bytes = True def close(self): """ Stop analyzing the current document and come up with a final prediction. :returns: The ``result`` attribute, a ``dict`` with the keys `encoding`, `confidence`, and `language`. """ # Don't bother with checks if we're already done if self.done: return self.result self.done = True if not self._got_data: self.logger.debug('no data received!') # Default to ASCII if it is all we've seen so far elif self._input_state == InputState.PURE_ASCII: self.result = {'encoding': 'ascii', 'confidence': 1.0, 'language': ''} # If we have seen non-ASCII, return the best that met MINIMUM_THRESHOLD elif self._input_state == InputState.HIGH_BYTE: prober_confidence = None max_prober_confidence = 0.0 max_prober = None for prober in self._charset_probers: if not prober: continue prober_confidence = prober.get_confidence() if prober_confidence > max_prober_confidence: max_prober_confidence = prober_confidence max_prober = prober if max_prober and (max_prober_confidence > self.MINIMUM_THRESHOLD): charset_name = max_prober.charset_name lower_charset_name = max_prober.charset_name.lower() confidence = max_prober.get_confidence() # Use Windows encoding name instead of ISO-8859 if we saw any # extra Windows-specific bytes if lower_charset_name.startswith('iso-8859'): if self._has_win_bytes: charset_name = self.ISO_WIN_MAP.get(lower_charset_name, charset_name) self.result = {'encoding': charset_name, 'confidence': confidence, 'language': max_prober.language} # Log all prober confidences if none met MINIMUM_THRESHOLD if self.logger.getEffectiveLevel() == logging.DEBUG: if self.result['encoding'] is None: self.logger.debug('no probers hit minimum threshold') for group_prober in self._charset_probers: if not group_prober: continue if isinstance(group_prober, CharSetGroupProber): for prober in group_prober.probers: self.logger.debug('%s %s confidence = %s', prober.charset_name, prober.language, prober.get_confidence()) else: self.logger.debug('%s %s confidence = %s', prober.charset_name, prober.language, prober.get_confidence()) return self.result site-packages/pip/_vendor/chardet/universaldetector.pyc000064400000015721147204247350017417 0ustar00 abc@sdZddlZddlZddlZddlmZddlmZmZm Z ddl m Z ddl m Z ddlmZdd lmZd efd YZdS( s Module containing the UniversalDetector detector class, which is the primary class a user of ``chardet`` should use. :author: Mark Pilgrim (initial port to Python) :author: Shy Shalom (original C code) :author: Dan Blanchard (major refactoring for 3.0) :author: Ian Cordasco iNi(tCharSetGroupProber(t InputStatetLanguageFiltert ProbingState(tEscCharSetProber(t Latin1Prober(tMBCSGroupProber(tSBCSGroupProbertUniversalDetectorcBseZdZdZejdZejdZejdZidd6dd6d d 6d d 6d d6dd6dd6dd6Z e j dZ dZ dZdZRS(sq The ``UniversalDetector`` class underlies the ``chardet.detect`` function and coordinates all of the different charset probers. To get a ``dict`` containing an encoding and its confidence, you can simply run: .. code:: u = UniversalDetector() u.feed(some_bytes) u.close() detected = u.result g?s[-]s(|~{)s[-]s Windows-1252s iso-8859-1s Windows-1250s iso-8859-2s Windows-1251s iso-8859-5s Windows-1256s iso-8859-6s Windows-1253s iso-8859-7s Windows-1255s iso-8859-8s Windows-1254s iso-8859-9s Windows-1257s iso-8859-13cCsqd|_g|_d|_d|_d|_d|_d|_||_t j t |_ d|_ |jdS(N(tNonet_esc_charset_probert_charset_proberstresulttdonet _got_datat _input_statet _last_chart lang_filtertloggingt getLoggert__name__tloggert_has_win_bytestreset(tselfR((sI/usr/lib/python2.7/site-packages/pip/_vendor/chardet/universaldetector.pyt__init__Qs         cCsidd6dd6dd6|_t|_t|_t|_tj|_d|_ |j rg|j j nx|j D]}|j qqWdS(s Reset the UniversalDetector and all of its probers back to their initial states. This is called by ``__init__``, so you only need to call this directly in between analyses of different documents. tencodinggt confidencetlanguagetN( R R tFalseR RRRt PURE_ASCIIRRR RR (Rtprober((sI/usr/lib/python2.7/site-packages/pip/_vendor/chardet/universaldetector.pyR^s      cCsy|jr dSt|sdSt|ts;t|}n|js{|jtjrwidd6dd6dd6|_n|jtj tj fridd6dd6dd6|_n|jd rid d6dd6dd6|_nl|jd rid d6dd6dd6|_n<|jtj tj frOid d6dd6dd6|_nt |_|jddk r{t |_dSn|jtjkr|jj|rtj|_q|jtjkr|jj|j|rtj|_qn|d|_|jtjkr|js(t|j|_n|jj|tjkrui|jjd6|jjd6|jj d6|_t |_qun|jtjkru|j!st"|jg|_!|jt#j$@r|j!j%t&n|j!j%t'nx`|j!D]U}|j|tjkri|jd6|jd6|j d6|_t |_PqqW|j(j|rut |_)qundS(s Takes a chunk of a document and feeds it through all of the relevant charset probers. After calling ``feed``, you can check the value of the ``done`` attribute to see if you need to continue feeding the ``UniversalDetector`` more data, or if it has made a prediction (in the ``result`` attribute). .. note:: You should always call ``close`` when you're done feeding in your document if ``done`` is not already ``True``. Ns UTF-8-SIGRg?RRRsUTF-32ssX-ISO-10646-UCS-4-3412ssX-ISO-10646-UCS-4-2143sUTF-16i(*R tlent isinstancet bytearrayRt startswithtcodecstBOM_UTF8R t BOM_UTF32_LEt BOM_UTF32_BEtBOM_LEtBOM_BEtTrueR RRRtHIGH_BYTE_DETECTORtsearcht HIGH_BYTEt ESC_DETECTORRt ESC_ASCIIR RRtfeedRtFOUND_ITt charset_nametget_confidenceRR RRtNON_CJKtappendRRtWIN_BYTE_DETECTORR(Rtbyte_strR ((sI/usr/lib/python2.7/site-packages/pip/_vendor/chardet/universaldetector.pyR1os~                  c Cs>|jr|jSt|_|js5|jjdn1|jtjkrhidd6dd6dd6|_n|jtj krfd }d}d }xD|j D]9}|sqn|j }||kr|}|}qqW|rf||j krf|j}|jj}|j }|jd r?|jr?|jj||}q?ni|d6|d6|jd6|_qfn|jjtjkr7|jdd kr7|jjd x|j D]}|sqnt|trx^|jD]+}|jjd |j|j|j qWq|jjd |j|j|j qWq7n|jS( s Stop analyzing the current document and come up with a final prediction. :returns: The ``result`` attribute, a ``dict`` with the keys `encoding`, `confidence`, and `language`. sno data received!tasciiRg?RRRgsiso-8859s no probers hit minimum thresholds%s %s confidence = %sN(R R R+RRtdebugRRRR.R R R4tMINIMUM_THRESHOLDR3tlowerR$Rt ISO_WIN_MAPtgetRtgetEffectiveLevelRtDEBUGR"Rtprobers( Rtprober_confidencetmax_prober_confidencet max_proberR R3tlower_charset_nameRt group_prober((sI/usr/lib/python2.7/site-packages/pip/_vendor/chardet/universaldetector.pytcloses`              (Rt __module__t__doc__R;tretcompileR,R/R7R=RtALLRRR1RG(((sI/usr/lib/python2.7/site-packages/pip/_vendor/chardet/universaldetector.pyR3s"    m(RIR%RRJtcharsetgroupproberRtenumsRRRt escproberRt latin1proberRtmbcsgroupproberRtsbcsgroupproberRtobjectR(((sI/usr/lib/python2.7/site-packages/pip/_vendor/chardet/universaldetector.pyt$s   site-packages/pip/_vendor/chardet/utf8prober.py000064400000005316147204247350015611 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetprober import CharSetProber from .enums import ProbingState, MachineState from .codingstatemachine import CodingStateMachine from .mbcssm import UTF8_SM_MODEL class UTF8Prober(CharSetProber): ONE_CHAR_PROB = 0.5 def __init__(self): super(UTF8Prober, self).__init__() self.coding_sm = CodingStateMachine(UTF8_SM_MODEL) self._num_mb_chars = None self.reset() def reset(self): super(UTF8Prober, self).reset() self.coding_sm.reset() self._num_mb_chars = 0 @property def charset_name(self): return "utf-8" @property def language(self): return "" def feed(self, byte_str): for c in byte_str: coding_state = self.coding_sm.next_state(c) if coding_state == MachineState.ERROR: self._state = ProbingState.NOT_ME break elif coding_state == MachineState.ITS_ME: self._state = ProbingState.FOUND_IT break elif coding_state == MachineState.START: if self.coding_sm.get_current_charlen() >= 2: self._num_mb_chars += 1 if self.state == ProbingState.DETECTING: if self.get_confidence() > self.SHORTCUT_THRESHOLD: self._state = ProbingState.FOUND_IT return self.state def get_confidence(self): unlike = 0.99 if self._num_mb_chars < 6: unlike *= self.ONE_CHAR_PROB ** self._num_mb_chars return 1.0 - unlike else: return unlike site-packages/pip/_vendor/chardet/utf8prober.pyc000064400000004724147204247350015756 0ustar00 abc@s`ddlmZddlmZmZddlmZddlmZdefdYZ dS(i(t CharSetProber(t ProbingStatet MachineState(tCodingStateMachine(t UTF8_SM_MODELt UTF8ProbercBsPeZdZdZdZedZedZdZdZ RS(g?cCs9tt|jtt|_d|_|jdS(N( tsuperRt__init__RRt coding_smtNonet _num_mb_charstreset(tself((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pyR&s cCs-tt|j|jjd|_dS(Ni(RRR RR (R ((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pyR ,s cCsdS(Nsutf-8((R ((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pyt charset_name1scCsdS(Nt((R ((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pytlanguage5scCsx|D]}|jj|}|tjkr>tj|_Pq|tjkr]tj|_Pq|tj kr|jj dkr|j d7_ qqqW|j tj kr|j|jkrtj|_qn|j S(Nii(Rt next_stateRtERRORRtNOT_MEt_statetITS_MEtFOUND_ITtSTARTtget_current_charlenR tstatet DETECTINGtget_confidencetSHORTCUT_THRESHOLD(R tbyte_strtct coding_state((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pytfeed9s   cCs9d}|jdkr1||j|j9}d|S|SdS(NgGz?ig?(R t ONE_CHAR_PROB(R tunlike((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pyRLs ( t__name__t __module__R RR tpropertyR RRR(((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pyR#s   N( t charsetproberRtenumsRRtcodingstatemachineRtmbcssmRR(((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pytssite-packages/pip/_vendor/chardet/utf8prober.pyo000064400000004724147204247350015772 0ustar00 abc@s`ddlmZddlmZmZddlmZddlmZdefdYZ dS(i(t CharSetProber(t ProbingStatet MachineState(tCodingStateMachine(t UTF8_SM_MODELt UTF8ProbercBsPeZdZdZdZedZedZdZdZ RS(g?cCs9tt|jtt|_d|_|jdS(N( tsuperRt__init__RRt coding_smtNonet _num_mb_charstreset(tself((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pyR&s cCs-tt|j|jjd|_dS(Ni(RRR RR (R ((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pyR ,s cCsdS(Nsutf-8((R ((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pyt charset_name1scCsdS(Nt((R ((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pytlanguage5scCsx|D]}|jj|}|tjkr>tj|_Pq|tjkr]tj|_Pq|tj kr|jj dkr|j d7_ qqqW|j tj kr|j|jkrtj|_qn|j S(Nii(Rt next_stateRtERRORRtNOT_MEt_statetITS_MEtFOUND_ITtSTARTtget_current_charlenR tstatet DETECTINGtget_confidencetSHORTCUT_THRESHOLD(R tbyte_strtct coding_state((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pytfeed9s   cCs9d}|jdkr1||j|j9}d|S|SdS(NgGz?ig?(R t ONE_CHAR_PROB(R tunlike((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pyRLs ( t__name__t __module__R RR tpropertyR RRR(((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pyR#s   N( t charsetproberRtenumsRRtcodingstatemachineRtmbcssmRR(((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/utf8prober.pytssite-packages/pip/_vendor/chardet/version.pyc000064400000000657147204247350015344 0ustar00 abc@sdZdZejdZdS(s This module exists only to simplify retrieving the version number of chardet from within setup.py and from chardet subpackages. :author: Dan Blanchard (dan.blanchard@gmail.com) s3.0.4t.N(t__doc__t __version__tsplittVERSION(((s?/usr/lib/python2.7/site-packages/pip/_vendor/chardet/version.pytssite-packages/pip/_vendor/chardet/version.pyo000064400000000657147204247350015360 0ustar00 abc@sdZdZejdZdS(s This module exists only to simplify retrieving the version number of chardet from within setup.py and from chardet subpackages. :author: Dan Blanchard (dan.blanchard@gmail.com) s3.0.4t.N(t__doc__t __version__tsplittVERSION(((s?/usr/lib/python2.7/site-packages/pip/_vendor/chardet/version.pytssite-packages/pip/_vendor/chardet/__init__.pyo000064400000001742147204247350015426 0ustar00 abc@sIddlmZmZddlmZddlmZmZdZdS(i(tPY2tPY3(tUniversalDetector(t __version__tVERSIONcCskt|tsKt|ts<tdjt|qKt|}nt}|j||jS(s Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` s4Expected object of type bytes or bytearray, got: {0}( t isinstancet bytearraytbytest TypeErrortformatttypeRtfeedtclose(tbyte_strtdetector((s@/usr/lib/python2.7/site-packages/pip/_vendor/chardet/__init__.pytdetects   N( tcompatRRtuniversaldetectorRtversionRRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/chardet/__init__.pytssite-packages/pip/_vendor/chardet/big5freq.py000064400000075026147204247350015222 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # Big5 frequency table # by Taiwan's Mandarin Promotion Council # # # 128 --> 0.42261 # 256 --> 0.57851 # 512 --> 0.74851 # 1024 --> 0.89384 # 2048 --> 0.97583 # # Ideal Distribution Ratio = 0.74851/(1-0.74851) =2.98 # Random Distribution Ration = 512/(5401-512)=0.105 # # Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR BIG5_TYPICAL_DISTRIBUTION_RATIO = 0.75 #Char to FreqOrder table BIG5_TABLE_SIZE = 5376 BIG5_CHAR_TO_FREQ_ORDER = ( 1,1801,1506, 255,1431, 198, 9, 82, 6,5008, 177, 202,3681,1256,2821, 110, # 16 3814, 33,3274, 261, 76, 44,2114, 16,2946,2187,1176, 659,3971, 26,3451,2653, # 32 1198,3972,3350,4202, 410,2215, 302, 590, 361,1964, 8, 204, 58,4510,5009,1932, # 48 63,5010,5011, 317,1614, 75, 222, 159,4203,2417,1480,5012,3555,3091, 224,2822, # 64 3682, 3, 10,3973,1471, 29,2787,1135,2866,1940, 873, 130,3275,1123, 312,5013, # 80 4511,2052, 507, 252, 682,5014, 142,1915, 124, 206,2947, 34,3556,3204, 64, 604, # 96 5015,2501,1977,1978, 155,1991, 645, 641,1606,5016,3452, 337, 72, 406,5017, 80, # 112 630, 238,3205,1509, 263, 939,1092,2654, 756,1440,1094,3453, 449, 69,2987, 591, # 128 179,2096, 471, 115,2035,1844, 60, 50,2988, 134, 806,1869, 734,2036,3454, 180, # 144 995,1607, 156, 537,2907, 688,5018, 319,1305, 779,2145, 514,2379, 298,4512, 359, # 160 2502, 90,2716,1338, 663, 11, 906,1099,2553, 20,2441, 182, 532,1716,5019, 732, # 176 1376,4204,1311,1420,3206, 25,2317,1056, 113, 399, 382,1950, 242,3455,2474, 529, # 192 3276, 475,1447,3683,5020, 117, 21, 656, 810,1297,2300,2334,3557,5021, 126,4205, # 208 706, 456, 150, 613,4513, 71,1118,2037,4206, 145,3092, 85, 835, 486,2115,1246, # 224 1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,5022,2128,2359, 347,3815, 221, # 240 3558,3135,5023,1956,1153,4207, 83, 296,1199,3093, 192, 624, 93,5024, 822,1898, # 256 2823,3136, 795,2065, 991,1554,1542,1592, 27, 43,2867, 859, 139,1456, 860,4514, # 272 437, 712,3974, 164,2397,3137, 695, 211,3037,2097, 195,3975,1608,3559,3560,3684, # 288 3976, 234, 811,2989,2098,3977,2233,1441,3561,1615,2380, 668,2077,1638, 305, 228, # 304 1664,4515, 467, 415,5025, 262,2099,1593, 239, 108, 300, 200,1033, 512,1247,2078, # 320 5026,5027,2176,3207,3685,2682, 593, 845,1062,3277, 88,1723,2038,3978,1951, 212, # 336 266, 152, 149, 468,1899,4208,4516, 77, 187,5028,3038, 37, 5,2990,5029,3979, # 352 5030,5031, 39,2524,4517,2908,3208,2079, 55, 148, 74,4518, 545, 483,1474,1029, # 368 1665, 217,1870,1531,3138,1104,2655,4209, 24, 172,3562, 900,3980,3563,3564,4519, # 384 32,1408,2824,1312, 329, 487,2360,2251,2717, 784,2683, 4,3039,3351,1427,1789, # 400 188, 109, 499,5032,3686,1717,1790, 888,1217,3040,4520,5033,3565,5034,3352,1520, # 416 3687,3981, 196,1034, 775,5035,5036, 929,1816, 249, 439, 38,5037,1063,5038, 794, # 432 3982,1435,2301, 46, 178,3278,2066,5039,2381,5040, 214,1709,4521, 804, 35, 707, # 448 324,3688,1601,2554, 140, 459,4210,5041,5042,1365, 839, 272, 978,2262,2580,3456, # 464 2129,1363,3689,1423, 697, 100,3094, 48, 70,1231, 495,3139,2196,5043,1294,5044, # 480 2080, 462, 586,1042,3279, 853, 256, 988, 185,2382,3457,1698, 434,1084,5045,3458, # 496 314,2625,2788,4522,2335,2336, 569,2285, 637,1817,2525, 757,1162,1879,1616,3459, # 512 287,1577,2116, 768,4523,1671,2868,3566,2526,1321,3816, 909,2418,5046,4211, 933, # 528 3817,4212,2053,2361,1222,4524, 765,2419,1322, 786,4525,5047,1920,1462,1677,2909, # 544 1699,5048,4526,1424,2442,3140,3690,2600,3353,1775,1941,3460,3983,4213, 309,1369, # 560 1130,2825, 364,2234,1653,1299,3984,3567,3985,3986,2656, 525,1085,3041, 902,2001, # 576 1475, 964,4527, 421,1845,1415,1057,2286, 940,1364,3141, 376,4528,4529,1381, 7, # 592 2527, 983,2383, 336,1710,2684,1846, 321,3461, 559,1131,3042,2752,1809,1132,1313, # 608 265,1481,1858,5049, 352,1203,2826,3280, 167,1089, 420,2827, 776, 792,1724,3568, # 624 4214,2443,3281,5050,4215,5051, 446, 229, 333,2753, 901,3818,1200,1557,4530,2657, # 640 1921, 395,2754,2685,3819,4216,1836, 125, 916,3209,2626,4531,5052,5053,3820,5054, # 656 5055,5056,4532,3142,3691,1133,2555,1757,3462,1510,2318,1409,3569,5057,2146, 438, # 672 2601,2910,2384,3354,1068, 958,3043, 461, 311,2869,2686,4217,1916,3210,4218,1979, # 688 383, 750,2755,2627,4219, 274, 539, 385,1278,1442,5058,1154,1965, 384, 561, 210, # 704 98,1295,2556,3570,5059,1711,2420,1482,3463,3987,2911,1257, 129,5060,3821, 642, # 720 523,2789,2790,2658,5061, 141,2235,1333, 68, 176, 441, 876, 907,4220, 603,2602, # 736 710, 171,3464, 404, 549, 18,3143,2398,1410,3692,1666,5062,3571,4533,2912,4534, # 752 5063,2991, 368,5064, 146, 366, 99, 871,3693,1543, 748, 807,1586,1185, 22,2263, # 768 379,3822,3211,5065,3212, 505,1942,2628,1992,1382,2319,5066, 380,2362, 218, 702, # 784 1818,1248,3465,3044,3572,3355,3282,5067,2992,3694, 930,3283,3823,5068, 59,5069, # 800 585, 601,4221, 497,3466,1112,1314,4535,1802,5070,1223,1472,2177,5071, 749,1837, # 816 690,1900,3824,1773,3988,1476, 429,1043,1791,2236,2117, 917,4222, 447,1086,1629, # 832 5072, 556,5073,5074,2021,1654, 844,1090, 105, 550, 966,1758,2828,1008,1783, 686, # 848 1095,5075,2287, 793,1602,5076,3573,2603,4536,4223,2948,2302,4537,3825, 980,2503, # 864 544, 353, 527,4538, 908,2687,2913,5077, 381,2629,1943,1348,5078,1341,1252, 560, # 880 3095,5079,3467,2870,5080,2054, 973, 886,2081, 143,4539,5081,5082, 157,3989, 496, # 896 4224, 57, 840, 540,2039,4540,4541,3468,2118,1445, 970,2264,1748,1966,2082,4225, # 912 3144,1234,1776,3284,2829,3695, 773,1206,2130,1066,2040,1326,3990,1738,1725,4226, # 928 279,3145, 51,1544,2604, 423,1578,2131,2067, 173,4542,1880,5083,5084,1583, 264, # 944 610,3696,4543,2444, 280, 154,5085,5086,5087,1739, 338,1282,3096, 693,2871,1411, # 960 1074,3826,2445,5088,4544,5089,5090,1240, 952,2399,5091,2914,1538,2688, 685,1483, # 976 4227,2475,1436, 953,4228,2055,4545, 671,2400, 79,4229,2446,3285, 608, 567,2689, # 992 3469,4230,4231,1691, 393,1261,1792,2401,5092,4546,5093,5094,5095,5096,1383,1672, # 1008 3827,3213,1464, 522,1119, 661,1150, 216, 675,4547,3991,1432,3574, 609,4548,2690, # 1024 2402,5097,5098,5099,4232,3045, 0,5100,2476, 315, 231,2447, 301,3356,4549,2385, # 1040 5101, 233,4233,3697,1819,4550,4551,5102, 96,1777,1315,2083,5103, 257,5104,1810, # 1056 3698,2718,1139,1820,4234,2022,1124,2164,2791,1778,2659,5105,3097, 363,1655,3214, # 1072 5106,2993,5107,5108,5109,3992,1567,3993, 718, 103,3215, 849,1443, 341,3357,2949, # 1088 1484,5110,1712, 127, 67, 339,4235,2403, 679,1412, 821,5111,5112, 834, 738, 351, # 1104 2994,2147, 846, 235,1497,1881, 418,1993,3828,2719, 186,1100,2148,2756,3575,1545, # 1120 1355,2950,2872,1377, 583,3994,4236,2581,2995,5113,1298,3699,1078,2557,3700,2363, # 1136 78,3829,3830, 267,1289,2100,2002,1594,4237, 348, 369,1274,2197,2178,1838,4552, # 1152 1821,2830,3701,2757,2288,2003,4553,2951,2758, 144,3358, 882,4554,3995,2759,3470, # 1168 4555,2915,5114,4238,1726, 320,5115,3996,3046, 788,2996,5116,2831,1774,1327,2873, # 1184 3997,2832,5117,1306,4556,2004,1700,3831,3576,2364,2660, 787,2023, 506, 824,3702, # 1200 534, 323,4557,1044,3359,2024,1901, 946,3471,5118,1779,1500,1678,5119,1882,4558, # 1216 165, 243,4559,3703,2528, 123, 683,4239, 764,4560, 36,3998,1793, 589,2916, 816, # 1232 626,1667,3047,2237,1639,1555,1622,3832,3999,5120,4000,2874,1370,1228,1933, 891, # 1248 2084,2917, 304,4240,5121, 292,2997,2720,3577, 691,2101,4241,1115,4561, 118, 662, # 1264 5122, 611,1156, 854,2386,1316,2875, 2, 386, 515,2918,5123,5124,3286, 868,2238, # 1280 1486, 855,2661, 785,2216,3048,5125,1040,3216,3578,5126,3146, 448,5127,1525,5128, # 1296 2165,4562,5129,3833,5130,4242,2833,3579,3147, 503, 818,4001,3148,1568, 814, 676, # 1312 1444, 306,1749,5131,3834,1416,1030, 197,1428, 805,2834,1501,4563,5132,5133,5134, # 1328 1994,5135,4564,5136,5137,2198, 13,2792,3704,2998,3149,1229,1917,5138,3835,2132, # 1344 5139,4243,4565,2404,3580,5140,2217,1511,1727,1120,5141,5142, 646,3836,2448, 307, # 1360 5143,5144,1595,3217,5145,5146,5147,3705,1113,1356,4002,1465,2529,2530,5148, 519, # 1376 5149, 128,2133, 92,2289,1980,5150,4003,1512, 342,3150,2199,5151,2793,2218,1981, # 1392 3360,4244, 290,1656,1317, 789, 827,2365,5152,3837,4566, 562, 581,4004,5153, 401, # 1408 4567,2252, 94,4568,5154,1399,2794,5155,1463,2025,4569,3218,1944,5156, 828,1105, # 1424 4245,1262,1394,5157,4246, 605,4570,5158,1784,2876,5159,2835, 819,2102, 578,2200, # 1440 2952,5160,1502, 436,3287,4247,3288,2836,4005,2919,3472,3473,5161,2721,2320,5162, # 1456 5163,2337,2068, 23,4571, 193, 826,3838,2103, 699,1630,4248,3098, 390,1794,1064, # 1472 3581,5164,1579,3099,3100,1400,5165,4249,1839,1640,2877,5166,4572,4573, 137,4250, # 1488 598,3101,1967, 780, 104, 974,2953,5167, 278, 899, 253, 402, 572, 504, 493,1339, # 1504 5168,4006,1275,4574,2582,2558,5169,3706,3049,3102,2253, 565,1334,2722, 863, 41, # 1520 5170,5171,4575,5172,1657,2338, 19, 463,2760,4251, 606,5173,2999,3289,1087,2085, # 1536 1323,2662,3000,5174,1631,1623,1750,4252,2691,5175,2878, 791,2723,2663,2339, 232, # 1552 2421,5176,3001,1498,5177,2664,2630, 755,1366,3707,3290,3151,2026,1609, 119,1918, # 1568 3474, 862,1026,4253,5178,4007,3839,4576,4008,4577,2265,1952,2477,5179,1125, 817, # 1584 4254,4255,4009,1513,1766,2041,1487,4256,3050,3291,2837,3840,3152,5180,5181,1507, # 1600 5182,2692, 733, 40,1632,1106,2879, 345,4257, 841,2531, 230,4578,3002,1847,3292, # 1616 3475,5183,1263, 986,3476,5184, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562, # 1632 4010,4011,2954, 967,2761,2665,1349, 592,2134,1692,3361,3003,1995,4258,1679,4012, # 1648 1902,2188,5185, 739,3708,2724,1296,1290,5186,4259,2201,2202,1922,1563,2605,2559, # 1664 1871,2762,3004,5187, 435,5188, 343,1108, 596, 17,1751,4579,2239,3477,3709,5189, # 1680 4580, 294,3582,2955,1693, 477, 979, 281,2042,3583, 643,2043,3710,2631,2795,2266, # 1696 1031,2340,2135,2303,3584,4581, 367,1249,2560,5190,3585,5191,4582,1283,3362,2005, # 1712 240,1762,3363,4583,4584, 836,1069,3153, 474,5192,2149,2532, 268,3586,5193,3219, # 1728 1521,1284,5194,1658,1546,4260,5195,3587,3588,5196,4261,3364,2693,1685,4262, 961, # 1744 1673,2632, 190,2006,2203,3841,4585,4586,5197, 570,2504,3711,1490,5198,4587,2633, # 1760 3293,1957,4588, 584,1514, 396,1045,1945,5199,4589,1968,2449,5200,5201,4590,4013, # 1776 619,5202,3154,3294, 215,2007,2796,2561,3220,4591,3221,4592, 763,4263,3842,4593, # 1792 5203,5204,1958,1767,2956,3365,3712,1174, 452,1477,4594,3366,3155,5205,2838,1253, # 1808 2387,2189,1091,2290,4264, 492,5206, 638,1169,1825,2136,1752,4014, 648, 926,1021, # 1824 1324,4595, 520,4596, 997, 847,1007, 892,4597,3843,2267,1872,3713,2405,1785,4598, # 1840 1953,2957,3103,3222,1728,4265,2044,3714,4599,2008,1701,3156,1551, 30,2268,4266, # 1856 5207,2027,4600,3589,5208, 501,5209,4267, 594,3478,2166,1822,3590,3479,3591,3223, # 1872 829,2839,4268,5210,1680,3157,1225,4269,5211,3295,4601,4270,3158,2341,5212,4602, # 1888 4271,5213,4015,4016,5214,1848,2388,2606,3367,5215,4603, 374,4017, 652,4272,4273, # 1904 375,1140, 798,5216,5217,5218,2366,4604,2269, 546,1659, 138,3051,2450,4605,5219, # 1920 2254, 612,1849, 910, 796,3844,1740,1371, 825,3845,3846,5220,2920,2562,5221, 692, # 1936 444,3052,2634, 801,4606,4274,5222,1491, 244,1053,3053,4275,4276, 340,5223,4018, # 1952 1041,3005, 293,1168, 87,1357,5224,1539, 959,5225,2240, 721, 694,4277,3847, 219, # 1968 1478, 644,1417,3368,2666,1413,1401,1335,1389,4019,5226,5227,3006,2367,3159,1826, # 1984 730,1515, 184,2840, 66,4607,5228,1660,2958, 246,3369, 378,1457, 226,3480, 975, # 2000 4020,2959,1264,3592, 674, 696,5229, 163,5230,1141,2422,2167, 713,3593,3370,4608, # 2016 4021,5231,5232,1186, 15,5233,1079,1070,5234,1522,3224,3594, 276,1050,2725, 758, # 2032 1126, 653,2960,3296,5235,2342, 889,3595,4022,3104,3007, 903,1250,4609,4023,3481, # 2048 3596,1342,1681,1718, 766,3297, 286, 89,2961,3715,5236,1713,5237,2607,3371,3008, # 2064 5238,2962,2219,3225,2880,5239,4610,2505,2533, 181, 387,1075,4024, 731,2190,3372, # 2080 5240,3298, 310, 313,3482,2304, 770,4278, 54,3054, 189,4611,3105,3848,4025,5241, # 2096 1230,1617,1850, 355,3597,4279,4612,3373, 111,4280,3716,1350,3160,3483,3055,4281, # 2112 2150,3299,3598,5242,2797,4026,4027,3009, 722,2009,5243,1071, 247,1207,2343,2478, # 2128 1378,4613,2010, 864,1437,1214,4614, 373,3849,1142,2220, 667,4615, 442,2763,2563, # 2144 3850,4028,1969,4282,3300,1840, 837, 170,1107, 934,1336,1883,5244,5245,2119,4283, # 2160 2841, 743,1569,5246,4616,4284, 582,2389,1418,3484,5247,1803,5248, 357,1395,1729, # 2176 3717,3301,2423,1564,2241,5249,3106,3851,1633,4617,1114,2086,4285,1532,5250, 482, # 2192 2451,4618,5251,5252,1492, 833,1466,5253,2726,3599,1641,2842,5254,1526,1272,3718, # 2208 4286,1686,1795, 416,2564,1903,1954,1804,5255,3852,2798,3853,1159,2321,5256,2881, # 2224 4619,1610,1584,3056,2424,2764, 443,3302,1163,3161,5257,5258,4029,5259,4287,2506, # 2240 3057,4620,4030,3162,2104,1647,3600,2011,1873,4288,5260,4289, 431,3485,5261, 250, # 2256 97, 81,4290,5262,1648,1851,1558, 160, 848,5263, 866, 740,1694,5264,2204,2843, # 2272 3226,4291,4621,3719,1687, 950,2479, 426, 469,3227,3720,3721,4031,5265,5266,1188, # 2288 424,1996, 861,3601,4292,3854,2205,2694, 168,1235,3602,4293,5267,2087,1674,4622, # 2304 3374,3303, 220,2565,1009,5268,3855, 670,3010, 332,1208, 717,5269,5270,3603,2452, # 2320 4032,3375,5271, 513,5272,1209,2882,3376,3163,4623,1080,5273,5274,5275,5276,2534, # 2336 3722,3604, 815,1587,4033,4034,5277,3605,3486,3856,1254,4624,1328,3058,1390,4035, # 2352 1741,4036,3857,4037,5278, 236,3858,2453,3304,5279,5280,3723,3859,1273,3860,4625, # 2368 5281, 308,5282,4626, 245,4627,1852,2480,1307,2583, 430, 715,2137,2454,5283, 270, # 2384 199,2883,4038,5284,3606,2727,1753, 761,1754, 725,1661,1841,4628,3487,3724,5285, # 2400 5286, 587, 14,3305, 227,2608, 326, 480,2270, 943,2765,3607, 291, 650,1884,5287, # 2416 1702,1226, 102,1547, 62,3488, 904,4629,3489,1164,4294,5288,5289,1224,1548,2766, # 2432 391, 498,1493,5290,1386,1419,5291,2056,1177,4630, 813, 880,1081,2368, 566,1145, # 2448 4631,2291,1001,1035,2566,2609,2242, 394,1286,5292,5293,2069,5294, 86,1494,1730, # 2464 4039, 491,1588, 745, 897,2963, 843,3377,4040,2767,2884,3306,1768, 998,2221,2070, # 2480 397,1827,1195,1970,3725,3011,3378, 284,5295,3861,2507,2138,2120,1904,5296,4041, # 2496 2151,4042,4295,1036,3490,1905, 114,2567,4296, 209,1527,5297,5298,2964,2844,2635, # 2512 2390,2728,3164, 812,2568,5299,3307,5300,1559, 737,1885,3726,1210, 885, 28,2695, # 2528 3608,3862,5301,4297,1004,1780,4632,5302, 346,1982,2222,2696,4633,3863,1742, 797, # 2544 1642,4043,1934,1072,1384,2152, 896,4044,3308,3727,3228,2885,3609,5303,2569,1959, # 2560 4634,2455,1786,5304,5305,5306,4045,4298,1005,1308,3728,4299,2729,4635,4636,1528, # 2576 2610, 161,1178,4300,1983, 987,4637,1101,4301, 631,4046,1157,3229,2425,1343,1241, # 2592 1016,2243,2570, 372, 877,2344,2508,1160, 555,1935, 911,4047,5307, 466,1170, 169, # 2608 1051,2921,2697,3729,2481,3012,1182,2012,2571,1251,2636,5308, 992,2345,3491,1540, # 2624 2730,1201,2071,2406,1997,2482,5309,4638, 528,1923,2191,1503,1874,1570,2369,3379, # 2640 3309,5310, 557,1073,5311,1828,3492,2088,2271,3165,3059,3107, 767,3108,2799,4639, # 2656 1006,4302,4640,2346,1267,2179,3730,3230, 778,4048,3231,2731,1597,2667,5312,4641, # 2672 5313,3493,5314,5315,5316,3310,2698,1433,3311, 131, 95,1504,4049, 723,4303,3166, # 2688 1842,3610,2768,2192,4050,2028,2105,3731,5317,3013,4051,1218,5318,3380,3232,4052, # 2704 4304,2584, 248,1634,3864, 912,5319,2845,3732,3060,3865, 654, 53,5320,3014,5321, # 2720 1688,4642, 777,3494,1032,4053,1425,5322, 191, 820,2121,2846, 971,4643, 931,3233, # 2736 135, 664, 783,3866,1998, 772,2922,1936,4054,3867,4644,2923,3234, 282,2732, 640, # 2752 1372,3495,1127, 922, 325,3381,5323,5324, 711,2045,5325,5326,4055,2223,2800,1937, # 2768 4056,3382,2224,2255,3868,2305,5327,4645,3869,1258,3312,4057,3235,2139,2965,4058, # 2784 4059,5328,2225, 258,3236,4646, 101,1227,5329,3313,1755,5330,1391,3314,5331,2924, # 2800 2057, 893,5332,5333,5334,1402,4305,2347,5335,5336,3237,3611,5337,5338, 878,1325, # 2816 1781,2801,4647, 259,1385,2585, 744,1183,2272,4648,5339,4060,2509,5340, 684,1024, # 2832 4306,5341, 472,3612,3496,1165,3315,4061,4062, 322,2153, 881, 455,1695,1152,1340, # 2848 660, 554,2154,4649,1058,4650,4307, 830,1065,3383,4063,4651,1924,5342,1703,1919, # 2864 5343, 932,2273, 122,5344,4652, 947, 677,5345,3870,2637, 297,1906,1925,2274,4653, # 2880 2322,3316,5346,5347,4308,5348,4309, 84,4310, 112, 989,5349, 547,1059,4064, 701, # 2896 3613,1019,5350,4311,5351,3497, 942, 639, 457,2306,2456, 993,2966, 407, 851, 494, # 2912 4654,3384, 927,5352,1237,5353,2426,3385, 573,4312, 680, 921,2925,1279,1875, 285, # 2928 790,1448,1984, 719,2168,5354,5355,4655,4065,4066,1649,5356,1541, 563,5357,1077, # 2944 5358,3386,3061,3498, 511,3015,4067,4068,3733,4069,1268,2572,3387,3238,4656,4657, # 2960 5359, 535,1048,1276,1189,2926,2029,3167,1438,1373,2847,2967,1134,2013,5360,4313, # 2976 1238,2586,3109,1259,5361, 700,5362,2968,3168,3734,4314,5363,4315,1146,1876,1907, # 2992 4658,2611,4070, 781,2427, 132,1589, 203, 147, 273,2802,2407, 898,1787,2155,4071, # 3008 4072,5364,3871,2803,5365,5366,4659,4660,5367,3239,5368,1635,3872, 965,5369,1805, # 3024 2699,1516,3614,1121,1082,1329,3317,4073,1449,3873, 65,1128,2848,2927,2769,1590, # 3040 3874,5370,5371, 12,2668, 45, 976,2587,3169,4661, 517,2535,1013,1037,3240,5372, # 3056 3875,2849,5373,3876,5374,3499,5375,2612, 614,1999,2323,3877,3110,2733,2638,5376, # 3072 2588,4316, 599,1269,5377,1811,3735,5378,2700,3111, 759,1060, 489,1806,3388,3318, # 3088 1358,5379,5380,2391,1387,1215,2639,2256, 490,5381,5382,4317,1759,2392,2348,5383, # 3104 4662,3878,1908,4074,2640,1807,3241,4663,3500,3319,2770,2349, 874,5384,5385,3501, # 3120 3736,1859, 91,2928,3737,3062,3879,4664,5386,3170,4075,2669,5387,3502,1202,1403, # 3136 3880,2969,2536,1517,2510,4665,3503,2511,5388,4666,5389,2701,1886,1495,1731,4076, # 3152 2370,4667,5390,2030,5391,5392,4077,2702,1216, 237,2589,4318,2324,4078,3881,4668, # 3168 4669,2703,3615,3504, 445,4670,5393,5394,5395,5396,2771, 61,4079,3738,1823,4080, # 3184 5397, 687,2046, 935, 925, 405,2670, 703,1096,1860,2734,4671,4081,1877,1367,2704, # 3200 3389, 918,2106,1782,2483, 334,3320,1611,1093,4672, 564,3171,3505,3739,3390, 945, # 3216 2641,2058,4673,5398,1926, 872,4319,5399,3506,2705,3112, 349,4320,3740,4082,4674, # 3232 3882,4321,3741,2156,4083,4675,4676,4322,4677,2408,2047, 782,4084, 400, 251,4323, # 3248 1624,5400,5401, 277,3742, 299,1265, 476,1191,3883,2122,4324,4325,1109, 205,5402, # 3264 2590,1000,2157,3616,1861,5403,5404,5405,4678,5406,4679,2573, 107,2484,2158,4085, # 3280 3507,3172,5407,1533, 541,1301, 158, 753,4326,2886,3617,5408,1696, 370,1088,4327, # 3296 4680,3618, 579, 327, 440, 162,2244, 269,1938,1374,3508, 968,3063, 56,1396,3113, # 3312 2107,3321,3391,5409,1927,2159,4681,3016,5410,3619,5411,5412,3743,4682,2485,5413, # 3328 2804,5414,1650,4683,5415,2613,5416,5417,4086,2671,3392,1149,3393,4087,3884,4088, # 3344 5418,1076, 49,5419, 951,3242,3322,3323, 450,2850, 920,5420,1812,2805,2371,4328, # 3360 1909,1138,2372,3885,3509,5421,3243,4684,1910,1147,1518,2428,4685,3886,5422,4686, # 3376 2393,2614, 260,1796,3244,5423,5424,3887,3324, 708,5425,3620,1704,5426,3621,1351, # 3392 1618,3394,3017,1887, 944,4329,3395,4330,3064,3396,4331,5427,3744, 422, 413,1714, # 3408 3325, 500,2059,2350,4332,2486,5428,1344,1911, 954,5429,1668,5430,5431,4089,2409, # 3424 4333,3622,3888,4334,5432,2307,1318,2512,3114, 133,3115,2887,4687, 629, 31,2851, # 3440 2706,3889,4688, 850, 949,4689,4090,2970,1732,2089,4335,1496,1853,5433,4091, 620, # 3456 3245, 981,1242,3745,3397,1619,3746,1643,3326,2140,2457,1971,1719,3510,2169,5434, # 3472 3246,5435,5436,3398,1829,5437,1277,4690,1565,2048,5438,1636,3623,3116,5439, 869, # 3488 2852, 655,3890,3891,3117,4092,3018,3892,1310,3624,4691,5440,5441,5442,1733, 558, # 3504 4692,3747, 335,1549,3065,1756,4336,3748,1946,3511,1830,1291,1192, 470,2735,2108, # 3520 2806, 913,1054,4093,5443,1027,5444,3066,4094,4693, 982,2672,3399,3173,3512,3247, # 3536 3248,1947,2807,5445, 571,4694,5446,1831,5447,3625,2591,1523,2429,5448,2090, 984, # 3552 4695,3749,1960,5449,3750, 852, 923,2808,3513,3751, 969,1519, 999,2049,2325,1705, # 3568 5450,3118, 615,1662, 151, 597,4095,2410,2326,1049, 275,4696,3752,4337, 568,3753, # 3584 3626,2487,4338,3754,5451,2430,2275, 409,3249,5452,1566,2888,3514,1002, 769,2853, # 3600 194,2091,3174,3755,2226,3327,4339, 628,1505,5453,5454,1763,2180,3019,4096, 521, # 3616 1161,2592,1788,2206,2411,4697,4097,1625,4340,4341, 412, 42,3119, 464,5455,2642, # 3632 4698,3400,1760,1571,2889,3515,2537,1219,2207,3893,2643,2141,2373,4699,4700,3328, # 3648 1651,3401,3627,5456,5457,3628,2488,3516,5458,3756,5459,5460,2276,2092, 460,5461, # 3664 4701,5462,3020, 962, 588,3629, 289,3250,2644,1116, 52,5463,3067,1797,5464,5465, # 3680 5466,1467,5467,1598,1143,3757,4342,1985,1734,1067,4702,1280,3402, 465,4703,1572, # 3696 510,5468,1928,2245,1813,1644,3630,5469,4704,3758,5470,5471,2673,1573,1534,5472, # 3712 5473, 536,1808,1761,3517,3894,3175,2645,5474,5475,5476,4705,3518,2929,1912,2809, # 3728 5477,3329,1122, 377,3251,5478, 360,5479,5480,4343,1529, 551,5481,2060,3759,1769, # 3744 2431,5482,2930,4344,3330,3120,2327,2109,2031,4706,1404, 136,1468,1479, 672,1171, # 3760 3252,2308, 271,3176,5483,2772,5484,2050, 678,2736, 865,1948,4707,5485,2014,4098, # 3776 2971,5486,2737,2227,1397,3068,3760,4708,4709,1735,2931,3403,3631,5487,3895, 509, # 3792 2854,2458,2890,3896,5488,5489,3177,3178,4710,4345,2538,4711,2309,1166,1010, 552, # 3808 681,1888,5490,5491,2972,2973,4099,1287,1596,1862,3179, 358, 453, 736, 175, 478, # 3824 1117, 905,1167,1097,5492,1854,1530,5493,1706,5494,2181,3519,2292,3761,3520,3632, # 3840 4346,2093,4347,5495,3404,1193,2489,4348,1458,2193,2208,1863,1889,1421,3331,2932, # 3856 3069,2182,3521, 595,2123,5496,4100,5497,5498,4349,1707,2646, 223,3762,1359, 751, # 3872 3121, 183,3522,5499,2810,3021, 419,2374, 633, 704,3897,2394, 241,5500,5501,5502, # 3888 838,3022,3763,2277,2773,2459,3898,1939,2051,4101,1309,3122,2246,1181,5503,1136, # 3904 2209,3899,2375,1446,4350,2310,4712,5504,5505,4351,1055,2615, 484,3764,5506,4102, # 3920 625,4352,2278,3405,1499,4353,4103,5507,4104,4354,3253,2279,2280,3523,5508,5509, # 3936 2774, 808,2616,3765,3406,4105,4355,3123,2539, 526,3407,3900,4356, 955,5510,1620, # 3952 4357,2647,2432,5511,1429,3766,1669,1832, 994, 928,5512,3633,1260,5513,5514,5515, # 3968 1949,2293, 741,2933,1626,4358,2738,2460, 867,1184, 362,3408,1392,5516,5517,4106, # 3984 4359,1770,1736,3254,2934,4713,4714,1929,2707,1459,1158,5518,3070,3409,2891,1292, # 4000 1930,2513,2855,3767,1986,1187,2072,2015,2617,4360,5519,2574,2514,2170,3768,2490, # 4016 3332,5520,3769,4715,5521,5522, 666,1003,3023,1022,3634,4361,5523,4716,1814,2257, # 4032 574,3901,1603, 295,1535, 705,3902,4362, 283, 858, 417,5524,5525,3255,4717,4718, # 4048 3071,1220,1890,1046,2281,2461,4107,1393,1599, 689,2575, 388,4363,5526,2491, 802, # 4064 5527,2811,3903,2061,1405,2258,5528,4719,3904,2110,1052,1345,3256,1585,5529, 809, # 4080 5530,5531,5532, 575,2739,3524, 956,1552,1469,1144,2328,5533,2329,1560,2462,3635, # 4096 3257,4108, 616,2210,4364,3180,2183,2294,5534,1833,5535,3525,4720,5536,1319,3770, # 4112 3771,1211,3636,1023,3258,1293,2812,5537,5538,5539,3905, 607,2311,3906, 762,2892, # 4128 1439,4365,1360,4721,1485,3072,5540,4722,1038,4366,1450,2062,2648,4367,1379,4723, # 4144 2593,5541,5542,4368,1352,1414,2330,2935,1172,5543,5544,3907,3908,4724,1798,1451, # 4160 5545,5546,5547,5548,2936,4109,4110,2492,2351, 411,4111,4112,3637,3333,3124,4725, # 4176 1561,2674,1452,4113,1375,5549,5550, 47,2974, 316,5551,1406,1591,2937,3181,5552, # 4192 1025,2142,3125,3182, 354,2740, 884,2228,4369,2412, 508,3772, 726,3638, 996,2433, # 4208 3639, 729,5553, 392,2194,1453,4114,4726,3773,5554,5555,2463,3640,2618,1675,2813, # 4224 919,2352,2975,2353,1270,4727,4115, 73,5556,5557, 647,5558,3259,2856,2259,1550, # 4240 1346,3024,5559,1332, 883,3526,5560,5561,5562,5563,3334,2775,5564,1212, 831,1347, # 4256 4370,4728,2331,3909,1864,3073, 720,3910,4729,4730,3911,5565,4371,5566,5567,4731, # 4272 5568,5569,1799,4732,3774,2619,4733,3641,1645,2376,4734,5570,2938, 669,2211,2675, # 4288 2434,5571,2893,5572,5573,1028,3260,5574,4372,2413,5575,2260,1353,5576,5577,4735, # 4304 3183, 518,5578,4116,5579,4373,1961,5580,2143,4374,5581,5582,3025,2354,2355,3912, # 4320 516,1834,1454,4117,2708,4375,4736,2229,2620,1972,1129,3642,5583,2776,5584,2976, # 4336 1422, 577,1470,3026,1524,3410,5585,5586, 432,4376,3074,3527,5587,2594,1455,2515, # 4352 2230,1973,1175,5588,1020,2741,4118,3528,4737,5589,2742,5590,1743,1361,3075,3529, # 4368 2649,4119,4377,4738,2295, 895, 924,4378,2171, 331,2247,3076, 166,1627,3077,1098, # 4384 5591,1232,2894,2231,3411,4739, 657, 403,1196,2377, 542,3775,3412,1600,4379,3530, # 4400 5592,4740,2777,3261, 576, 530,1362,4741,4742,2540,2676,3776,4120,5593, 842,3913, # 4416 5594,2814,2032,1014,4121, 213,2709,3413, 665, 621,4380,5595,3777,2939,2435,5596, # 4432 2436,3335,3643,3414,4743,4381,2541,4382,4744,3644,1682,4383,3531,1380,5597, 724, # 4448 2282, 600,1670,5598,1337,1233,4745,3126,2248,5599,1621,4746,5600, 651,4384,5601, # 4464 1612,4385,2621,5602,2857,5603,2743,2312,3078,5604, 716,2464,3079, 174,1255,2710, # 4480 4122,3645, 548,1320,1398, 728,4123,1574,5605,1891,1197,3080,4124,5606,3081,3082, # 4496 3778,3646,3779, 747,5607, 635,4386,4747,5608,5609,5610,4387,5611,5612,4748,5613, # 4512 3415,4749,2437, 451,5614,3780,2542,2073,4388,2744,4389,4125,5615,1764,4750,5616, # 4528 4390, 350,4751,2283,2395,2493,5617,4391,4126,2249,1434,4127, 488,4752, 458,4392, # 4544 4128,3781, 771,1330,2396,3914,2576,3184,2160,2414,1553,2677,3185,4393,5618,2494, # 4560 2895,2622,1720,2711,4394,3416,4753,5619,2543,4395,5620,3262,4396,2778,5621,2016, # 4576 2745,5622,1155,1017,3782,3915,5623,3336,2313, 201,1865,4397,1430,5624,4129,5625, # 4592 5626,5627,5628,5629,4398,1604,5630, 414,1866, 371,2595,4754,4755,3532,2017,3127, # 4608 4756,1708, 960,4399, 887, 389,2172,1536,1663,1721,5631,2232,4130,2356,2940,1580, # 4624 5632,5633,1744,4757,2544,4758,4759,5634,4760,5635,2074,5636,4761,3647,3417,2896, # 4640 4400,5637,4401,2650,3418,2815, 673,2712,2465, 709,3533,4131,3648,4402,5638,1148, # 4656 502, 634,5639,5640,1204,4762,3649,1575,4763,2623,3783,5641,3784,3128, 948,3263, # 4672 121,1745,3916,1110,5642,4403,3083,2516,3027,4132,3785,1151,1771,3917,1488,4133, # 4688 1987,5643,2438,3534,5644,5645,2094,5646,4404,3918,1213,1407,2816, 531,2746,2545, # 4704 3264,1011,1537,4764,2779,4405,3129,1061,5647,3786,3787,1867,2897,5648,2018, 120, # 4720 4406,4407,2063,3650,3265,2314,3919,2678,3419,1955,4765,4134,5649,3535,1047,2713, # 4736 1266,5650,1368,4766,2858, 649,3420,3920,2546,2747,1102,2859,2679,5651,5652,2000, # 4752 5653,1111,3651,2977,5654,2495,3921,3652,2817,1855,3421,3788,5655,5656,3422,2415, # 4768 2898,3337,3266,3653,5657,2577,5658,3654,2818,4135,1460, 856,5659,3655,5660,2899, # 4784 2978,5661,2900,3922,5662,4408, 632,2517, 875,3923,1697,3924,2296,5663,5664,4767, # 4800 3028,1239, 580,4768,4409,5665, 914, 936,2075,1190,4136,1039,2124,5666,5667,5668, # 4816 5669,3423,1473,5670,1354,4410,3925,4769,2173,3084,4137, 915,3338,4411,4412,3339, # 4832 1605,1835,5671,2748, 398,3656,4413,3926,4138, 328,1913,2860,4139,3927,1331,4414, # 4848 3029, 937,4415,5672,3657,4140,4141,3424,2161,4770,3425, 524, 742, 538,3085,1012, # 4864 5673,5674,3928,2466,5675, 658,1103, 225,3929,5676,5677,4771,5678,4772,5679,3267, # 4880 1243,5680,4142, 963,2250,4773,5681,2714,3658,3186,5682,5683,2596,2332,5684,4774, # 4896 5685,5686,5687,3536, 957,3426,2547,2033,1931,2941,2467, 870,2019,3659,1746,2780, # 4912 2781,2439,2468,5688,3930,5689,3789,3130,3790,3537,3427,3791,5690,1179,3086,5691, # 4928 3187,2378,4416,3792,2548,3188,3131,2749,4143,5692,3428,1556,2549,2297, 977,2901, # 4944 2034,4144,1205,3429,5693,1765,3430,3189,2125,1271, 714,1689,4775,3538,5694,2333, # 4960 3931, 533,4417,3660,2184, 617,5695,2469,3340,3539,2315,5696,5697,3190,5698,5699, # 4976 3932,1988, 618, 427,2651,3540,3431,5700,5701,1244,1690,5702,2819,4418,4776,5703, # 4992 3541,4777,5704,2284,1576, 473,3661,4419,3432, 972,5705,3662,5706,3087,5707,5708, # 5008 4778,4779,5709,3793,4145,4146,5710, 153,4780, 356,5711,1892,2902,4420,2144, 408, # 5024 803,2357,5712,3933,5713,4421,1646,2578,2518,4781,4782,3934,5714,3935,4422,5715, # 5040 2416,3433, 752,5716,5717,1962,3341,2979,5718, 746,3030,2470,4783,4423,3794, 698, # 5056 4784,1893,4424,3663,2550,4785,3664,3936,5719,3191,3434,5720,1824,1302,4147,2715, # 5072 3937,1974,4425,5721,4426,3192, 823,1303,1288,1236,2861,3542,4148,3435, 774,3938, # 5088 5722,1581,4786,1304,2862,3939,4787,5723,2440,2162,1083,3268,4427,4149,4428, 344, # 5104 1173, 288,2316, 454,1683,5724,5725,1461,4788,4150,2597,5726,5727,4789, 985, 894, # 5120 5728,3436,3193,5729,1914,2942,3795,1989,5730,2111,1975,5731,4151,5732,2579,1194, # 5136 425,5733,4790,3194,1245,3796,4429,5734,5735,2863,5736, 636,4791,1856,3940, 760, # 5152 1800,5737,4430,2212,1508,4792,4152,1894,1684,2298,5738,5739,4793,4431,4432,2213, # 5168 479,5740,5741, 832,5742,4153,2496,5743,2980,2497,3797, 990,3132, 627,1815,2652, # 5184 4433,1582,4434,2126,2112,3543,4794,5744, 799,4435,3195,5745,4795,2113,1737,3031, # 5200 1018, 543, 754,4436,3342,1676,4796,4797,4154,4798,1489,5746,3544,5747,2624,2903, # 5216 4155,5748,5749,2981,5750,5751,5752,5753,3196,4799,4800,2185,1722,5754,3269,3270, # 5232 1843,3665,1715, 481, 365,1976,1857,5755,5756,1963,2498,4801,5757,2127,3666,3271, # 5248 433,1895,2064,2076,5758, 602,2750,5759,5760,5761,5762,5763,3032,1628,3437,5764, # 5264 3197,4802,4156,2904,4803,2519,5765,2551,2782,5766,5767,5768,3343,4804,2905,5769, # 5280 4805,5770,2864,4806,4807,1221,2982,4157,2520,5771,5772,5773,1868,1990,5774,5775, # 5296 5776,1896,5777,5778,4808,1897,4158, 318,5779,2095,4159,4437,5780,5781, 485,5782, # 5312 938,3941, 553,2680, 116,5783,3942,3667,5784,3545,2681,2783,3438,3344,2820,5785, # 5328 3668,2943,4160,1747,2944,2983,5786,5787, 207,5788,4809,5789,4810,2521,5790,3033, # 5344 890,3669,3943,5791,1878,3798,3439,5792,2186,2358,3440,1652,5793,5794,5795, 941, # 5360 2299, 208,3546,4161,2020, 330,4438,3944,2906,2499,3799,4439,4811,5796,5797,5798, # 5376 ) site-packages/pip/_vendor/chardet/big5freq.pyo000064400000152655147204247350015405 0ustar00 abc@sdZdZdZdS(g?iii iiiii iRiiiiiaii inii!i iiLi,iBii iiiiii{ i] iii ijiii.iNiiiiii:iiii?iii=iNiKiiikiq iii i ii ibii iiii ioi2 iiiii ici8iiiiiiiii{i|ii i"i i i@i\ii iiiiiiiFii| iQiHiiiPivii iiiiDi^ iiiFi} iiEi iOii0iisii4i<i2i ii&iMiii~ iiiGiii[ iii?ii iaiiK i*iigi iZi i:ii iiKi ii iiiiii`iliii ii i iqii~iii i ii iiiciiuiii*iii i ii~imiiiieiiGi^iinii iUiCiiCiiiiiii ijioi/iiiPi7 i[iii i? iiiioiSi(ii iipi]ii6iji i@ iiiiii8ii+i3 i[iii\iiiiii] iA iii i1iiiHi i idiii+i i2iiii iOiL iiifi1iiiiiiii3i9iili,ii iiiiiii ieiz iQiMi&i iXiiiiii iiiikipiiMiii i%ii iiiii'i ii\ i ii7iiJii!iiiiiiNiiB iPi_ iqiii iii i ii ii i iIii8 ii ii{ ii i iiiimiiifiiixii iii ii iigiii iiiiiiii&ii'iiiiii.ii iiiM iiiii$i#iiDihiAi iiiriiiUiGiiii i iQiSiiiiidi i0iFiiiC iiiii iiJii iUiiiiN i iii<ii i:iA i ii i i9ii}ii iiiWiPi ii)iDiiii4 i i i)iiir iisiiitii9 iiiis i*iiiiiii] iiiii iD iji( i iii iiui5iYiji iliiuiii iii` i i=i iiiiiii5ii!iiiTiE ixiiieii iiO iPii| i6iAi i/iki i iili!i iiBii`ii i iiAii iiii ivi i iiwiiiiMi iiiiiia iii i} iixi,i}ii iB iiiiiiiiiF ikimi ii ii ii iibii) i^ iP i i,ii ii7i5 i~ iyi|i iziiii iC i{iiiiiiiiii1iibii i iiit ii ii_ iiiiii i i ib iiii5iDiiilii|i[i* iii ii%iiG i^ iiliii ii` iii ipiiinicigimiii'i2iiii{ii ii iiiD iifi ii|i: iiiii i i i i ii inii iii;iiIiYi}ii iXi"ii iiiiiii-iiliiiiiiiiiEii~ii>i]ii,iiiiviLiBiii&iii iiiiGiiiiBii i+ iii iiiii i iaiiii ia ii}iE iiDii=ii0i ii i6 iiiivi!iiiiiiiii9iHiiiii iFiiiiii"iiH iii i ioiiiRi*ii.iiiiiiI i3ii, ii*iSiiiiXiii/iibipii iiiiiiiRii ii7 ii2ii iiiiiii_ iib ii iiii iiiiiii` iOii i i`i7i i iiiiiiia iiiiiiigiii ii i_ii~iiiiii iaii ib iiiii iii i;ii i-i iiQ iiiiqiiiii`ii#i#iiiiiri isiiiiditi iic ii ikiwi ii iiiiiiiigi iQiiUi i iiiiiCiSiic iii5iiiBii_i iciNiiiYiiii iiLidi i i iKi i8 iaiGiii i iiisi6i iti; iNiii i i4ii:ii\iqiiii.iii iui iiii i ii iriii i iic iiii@iii ii ii ii/i9 ii iiiiiii i< id iiii8iviiCiii iimii iiiiiiZiiiiiwi i{iiiii$iiiMid i0irii iigiiViiiii: iZiii{i$ie i0iii$i i i ii5ii[iiviiiciiViR i$i; iiiif iii idiiiWie iii iii i iiJ iiiiiuii ii ii i iK ii2iiL i i.iii2ii iiiiii%i iii i iiiiiiii i ixi iM ii}iiiTiiiid i iiiii`iiiii i3iii;i iiiiyiYiLiii i iiiiiUi\iiiiiiViN iii iii ii"ixi%ii;i= i iii2iEii!iiii^ii"iwi i#iiii ii$i<iQiiiri%ii]ii&ii< i'i i3i6iBii i(iii ii i iig i i i)i i i*i+i! iiiii:ii7ii^ii iii(i i,i+i i ixi-ii/ihi= i.iiiiiVi ii ihii i/iiiii<iii;i0iiii i i1izi i ii5i6i i_i)i2i3ii4iyi" iii ii^i5i i i?i%i+if i i6i_iWiii i7i> ii ig i# iiu i8i ii9ih iF iiVi{i iO iiIiwi~i i^iii:iiiiiiii i;iei1iiiiiiiii i i iiP i<i=ii>i ii(i`iRi? iYiiIi iii i7i i i?iii i@iioiiqiYiniiiliiii ii ii iEiPiVii! i iiiiiniiAii|i ii iBiiiiii- i iOi i iCiiDiWiTiTiiiii i}iEii&i i iiiiii iii~iG i iii$ iWiiiioii iFiiGiii" iiii# iiiDi-iQ iiHiei i iiIi iiiJizi iiKiiiLii$ i iiiiiH iiiiiiiMi:i iiiNiiI i iiiHiiiiiOiii iPiQiiikiRiR i iii i i ii iiiiiiSiTiii i% iiiiii& iS iUi iiS iiCiiiiVi~ii!iXiiiiii,iiiiiOii|iiiiPiie iiii i i iiiiiiiiT iiiiiWiiiiXiiYiiRi iviii ii i=i iiZiiU iii[i iiiV i% i\iii]iii^i8iT i. i' i_iiviiiiiwitii`iaibi> iii"i{ii i iiciidi9iiiii[i9iiidih i ieiii iJ i!iiifiiii iiiTigiii i%iiWiMihiiiiiiiiiiiiii( ij iiyi7imiijiki i? iW i"iiii iBiili|i ii) iziii iii iiiiimiiniuiv iwii i* iiioipiiiqi7i.irii i iii iifii i isi& iyi ii i iiiii i i>iiii iiYi iitiiui/ i+ i ivi ii i@ iwii i iii3iiii, ixi i6i9i i iii6i iii! iiiyiiQi:ici iii- ioiiiFiX i i iifi iizi iii iii{i/iii' i ibiii`iiiiui iviiiii i i iiii i0iEiiSii8i[i|i}iGii ii!i~iiiFiU ii ii iieisiii iw iiii" i iai iZi&iiiii i iiiiAiii iiii iiiiiiiii ioii ii i i ii iiA i iJi0i ix i ii iiY iiiiii i i iiZ i8ioiiiQiiiii iiiaiQiiipi;iiiPiibiiiii i ii iiii iii iiiiiiiii]iiiii iiiiii'iii. i ii iiiii iLiiiiii ii/ iiiiiB i0 i[ ii8iiiii iii/i3iiiii iiii0i iniiiiiiiii i iiiiiiiii4iiiii<i ii iiiYi iiiiC iiii iiiii}i1ii iiiiKii ii0 iFiiii ii#ii\iiiifi i>i iii iiiiii i iiiiijiiiiii-ipi9i@ i6iyiiii i i1 iiiiiiiiViiiii4iii iKi1 ii iD i iiiiii#iiii i2 iiii iZiHipiiigiii i iqiri iiiiii i iK iV i i\ i,i ii iiii]iiiuii iiiiiiiiiZiii iiiiijiii0ihihiii ii iE iii iii iiiiiiiiiii iiii2 iiiiiiiMiiwiii iy i?iiii itimi( i ii+iiiiiiiiii i ii i iii iiL iii) i ii iiif ii iiiiiiiRi"iA i3 i ii-i1ii$i i(ii] i i# ii$ i iiii i* iiii i ii i i=ik ii!ii iiii i ii ii_iiiii^ i2ii iiii9iii iiii4 i iii iibiiii ii iii5ii iii"i i iiiiii4iIi ii#ii iiiiiiij iiii$ik i ii ii\i igiiEi5 iiiiiiiii iii6 iiii ii%iii ii i[i iiiiii i&ieiii iiioi iil i i}iiiizii+ iii iiiini-ii i'iiii iiii(iii iiiiiiii ii iiiBiiiqiiii<ii*iji)i"i*ii>i)i7 ii+iiiiiiiizii,iiiiiM i)iriii-i i iiiiiiTiipiii#i#iiiiiiii iiii i ii iiSii.i8 iiiiiz i9 i=iiiim iiSiiiiiixiii/iiiqiii3ii5ii: i i ii iiiiii i; i i0i1iiiiiin ii_ ii]i i iniiiii i% iiiii i` iiiiiziTisi2i3 ii i{ ii5iiii ig iiikiiiii iii3i4ii iici iii i iiiai:i1i iii!iAihi io i i6i"iii il i-ii ia i5ii ii i ii#i! ii$ii ii4 ifii i%i& i iN i iiWiiiiii i' ii$iii< i iNiiiW ikiiO iiiiiiiX i, ii6i&itiiP ii i7i i i i- ijii i iiCi[ip ii i'i8i ib iim i i ii{i(i i ii i9i i i i:i i i^iiiiB i;iiiiii iii ii ii)i<i=i ii ii>iiiii i=iiiiiiiiiiin iiHiDi i?iiUiWi i= ii:ii iNi iKiEi@i4ic i ii> iiQ i iAiiihiii i i( i]iiiiBi*iiiliiCiDiiEih iiiiiiiXiiiii+iiii+iJiiiUiii iimi iEiiiiFiiGi iki inii id iiiiiiiiF i!i iiri@iiHi"iCiGiiii ii^i ii i8iti) i;i i? i!iioiIi i"i#i#i$iiJi i%i i&iriKi'i5 i(i)iio i@ i}iA ii,ii*i4i1i+ii i i ii" ii,ii iC iiuiriD i-i i-i iLivi{ii| iMi.i.iNiY i6 iii i/i0i/i ii1i$ii2i%iGiRiB i i_iiiC ii iD ii3iiiii ii i. ii i4i@iwii5ii6i7iii ii&i0ii8i i&i i* ii+ iG iOiuii# i i1iPiRiiQii ii)iii=i9iili iiiiE iSiiki i\i iii iyi:i i;i<iF i%i=iiRiii>idi'i, i?iei$ ii2i3i- ii i4ii(iSi@iAiBii.iTiiOi i iiiii i&i iii i<i iiiiCiiDi iiUiip iG ie i i i ii iEi;iViFi'iGi)i ii} iHi*iiWiiiIiiTii i iiiiii iiJi. igi~iiUiij i iiiXiii8ii*i iiiKi~ iii iLiiH i iii% ii+if iii iitiiMiNiii ii ii iiik iYiiYiiii*i/ iiOiR iZiH ii#iI i i iii5iS i]iE i[i\i isiI i+iPiQi,i i iRiiSiTii,iiUi]iVi iiLi-i!i iT i\i4iWi iiXiYiZii[i>iwiiiii+i^iiJ ii_i$ii\iiiili.i]i`ii^i_iq i%ii`iaiiii i6ig iU ibicidiai iq ixi iei ibiyi ifihigihiii'iii iii ijir ii i0 i i=iibi|iiiiii i iih iki iliii iaiicimiii ini iiui iidieiis iK i/ioi7ii& i iJ i8ipiqii ij ifii igi iii(ii`irisi i iii<iFik ifiiiii]iiiIiti>iiuiivii iii i0ii-iiwiL ii iiiiiGiaii it i ii iSiKixiiyiziiiV iiiOii1 ii i{i i iiF iyii9iZ ii|i}i~iFi iii i i:iiiii2 iiiipii;iG iii ihiiiii7 iiiiiqiiiM iiiiiii iii iii i(i8 iiN i ii3 i iiO i<iiiiTiiW i iiiii(iiii1iiiiiiiiu iZii i iciijiP ipiii iiii iv iiijii iiii iQ iK i ii i' iiiiii9 iii i izii i iiikiiiii ii2i iiliii>i=iCi'iii>i iiZiiii imini iibiii i iqi?ii ii ii i"ii i?i i}iiioi@i>iiAi i1ii)iiii?i i iiiixi ii ii i3i i ihii il iiii)ii ipii'iiii4ii i i iiiiAi_i iBiiL ii iPiqii iiriiiiiX iicisi! iiiiHii iw iiiiCiDitiiiiiiix i ii i/ iiii5i i4 iuiir iii_iii/i i<ii~i7iy im iii^i5 in ibi itiiil iiii6ii i7iiiiiiiviiii i8i: ii ii0 i i1 iiwiiIiiiii i( iiiBi ii4isi iiiii i iii?iCiixi iEiHi iiFiyiziGiiiii{iiii|ii; i}i9imiH i~iiz iiis i iiM iiii iiim iiiIiiiio iiiiiiii_iiii i2 i3 iHii*iii iiii< iiii:ii ii iiAii iiR iiiii i ii" ii iiiiii ii iii iiiQi i iY iiiiiiii{iKii ii[i iJiiiN iiS iiiiiI iiiT i@ii iii i i@iiRiii it iiiiJiIii iiiii iU iimiiii{ i ii i i;iV iii iii<iii idiiiiXiii9iii6 iiiUiiii iiLi!i= ii) ii i i iii i iii ii=i$i(iviii&iicii iii i ii>iiii{i"iiiii#iiiiiW ii iiii ii$i i%iiiiii&i^iii[ i ii'iiiiiiii(i iii2i\ iJi ip ipin iiu iq i)ii iO i> ii i*iX iii i+ii i,i iii iiiiiKii i iiIi-iii!iiiiii.iDiiiJisi# iii ii7 iiii/iwii|iiiiii"i4 i| i,iiiii iiiiiiiii?iY iP i0ii1iZ iZ i ii i ii i#i@i2ii|iiziiiiiAi'ii? ii ii8 ii iyiiLiVi i3i i i i$iiiiMii%ii i i i i i.ii4iNiii ii i i iiii i5i9 i%iiiiKiQ iiixi6i7iiBi i iOiv i[ iii&ii ii iiiXii* ii\ iPi i iNi+ iw iiiiiWiCi ii iQiDi i?i] iiii^ io iR i i iEii iiFi i'iiXiiGiiS i iiT iRii8ixi ikiSiiTiii ii iiDii9i!iiiii(iiLi"i#i$i%i_ ii&iJi:iUii}i i)ii i;i<i iEi+i'i iiHi=iVi*iHiyi, i+iWi3i>i ii?i(iIi,i-i` iqiia i iii ii)i*iXi i+iiOiiYi,i-ii.ii/i ii0i.iiii1i iJir i2i3i$ i i4ii5i6i7i iib i iii} i ifiiKii i i i i8iZi9ii: ii ic ii:ii i;is iJ i@ii it i; i i/i<id ii iiiU ii0iie i=iif iu iMiiiii i>i i[iiAiLiiii?i i i i i@iAiv iBiCi\iijii[ i ig iDiEiiiFi iBiiGi iiHii(iiMiCih iiIiNiJi iKiLiiiMii1i2iNiiidiOidiV iDi`ii#i5 iPi]iQiEini i iii^iRi_iFiSip ii iiTiUii i iVii i iiGiiiieiHiOi iiPi`iWiw ij iXi ii3i iaiiIiYiJix i7iiii- i i4ik iibiZi-iii. icii[i iri;i iKi5iLiXii i iii\i]iii6i% i^i_iii~i`il iy iaizi~ iiibi?iici7idi iiieiiz iiiMifigi/ ihi|ii@idiiiiiNiiii8ifiiijikiiOiPiiilimi@ini9i ioi i iii< isii\ iQi.iRiNi@i iipiiSi{ iqiiAii iiiiTi iiii:iiiri isi@ iW i;itiui iviwixiyi| iiiiizi i i3iQiiimiiAi{i|ii ii}iOiRi iigiii~iZi iiiiii i\im ii} ii<iX ii ii i iiii iiY iiii0 iiii i=i iiiiLiiiiihiiiiii>i>ii/i?iUiiiiiiei)ix itiifiSii iy i in i i iiTi i@ii i iiiiiiii ii iziUigiiViio iii6 ip itiiiiiii iAiiJiVihiZ i iiWiiiiN(ii iiiii iRiiiiiaii inii!i iiLi,iBii iiiiii{ i] iii ijiii.iNiiiiii:iiii?iii=iNiKiiikiq iii i ii ibii iiii ioi2 iiiii ici8iiiiiiiii{i|ii i"i i i@i\ii iiiiiiiFii| iQiHiiiPivii iiiiDi^ iiiFi} iiEi iOii0iisii4i<i2i ii&iMiii~ iiiGiii[ iii?ii iaiiK i*iigi iZi i:ii iiKi ii iiiiii`iliii ii i iqii~iii i ii iiiciiuiii*iii i ii~imiiiieiiGi^iinii iUiCiiCiiiiiii ijioi/iiiPi7 i[iii i? iiiioiSi(ii iipi]ii6iji i@ iiiiii8ii+i3 i[iii\iiiiii] iA iii i1iiiHi i idiii+i i2iiii iOiL iiifi1iiiiiiii3i9iili,ii iiiiiii ieiz iQiMi&i iXiiiiii iiiikipiiMiii i%ii iiiii'i ii\ i ii7iiJii!iiiiiiNiiB iPi_ iqiii iii i ii ii i iIii8 ii ii{ ii i iiiimiiifiiixii iii ii iigiii iiiiiiii&ii'iiiiii.ii iiiM iiiii$i#iiDihiAi iiiriiiUiGiiii i iQiSiiiiidi i0iFiiiC iiiii iiJii iUiiiiN i iii<ii i:iA i ii i i9ii}ii iiiWiPi ii)iDiiii4 i i i)iiir iisiiitii9 iiiis i*iiiiiii] iiiii iD iji( i iii iiui5iYiji iliiuiii iii` i i=i iiiiiii5ii!iiiTiE ixiiieii iiO iPii| i6iAi i/iki i iili!i iiBii`ii i iiAii iiii ivi i iiwiiiiMi iiiiiia iii i} iixi,i}ii iB iiiiiiiiiF ikimi ii ii ii iibii) i^ iP i i,ii ii7i5 i~ iyi|i iziiii iC i{iiiiiiiiii1iibii i iiit ii ii_ iiiiii i i ib iiii5iDiiilii|i[i* iii ii%iiG i^ iiliii ii` iii ipiiinicigimiii'i2iiii{ii ii iiiD iifi ii|i: iiiii i i i i ii inii iii;iiIiYi}ii iXi"ii iiiiiii-iiliiiiiiiiiEii~ii>i]ii,iiiiviLiBiii&iii iiiiGiiiiBii i+ iii iiiii i iaiiii ia ii}iE iiDii=ii0i ii i6 iiiivi!iiiiiiiii9iHiiiii iFiiiiii"iiH iii i ioiiiRi*ii.iiiiiiI i3ii, ii*iSiiiiXiii/iibipii iiiiiiiRii ii7 ii2ii iiiiiii_ iib ii iiii iiiiiii` iOii i i`i7i i iiiiiiia iiiiiiigiii ii i_ii~iiiiii iaii ib iiiii iii i;ii i-i iiQ iiiiqiiiii`ii#i#iiiiiri isiiiiditi iic ii ikiwi ii iiiiiiiigi iQiiUi i iiiiiCiSiic iii5iiiBii_i iciNiiiYiiii iiLidi i i iKi i8 iaiGiii i iiisi6i iti; iNiii i i4ii:ii\iqiiii.iii iui iiii i ii iriii i iic iiii@iii ii ii ii/i9 ii iiiiiii i< id iiii8iviiCiii iimii iiiiiiZiiiiiwi i{iiiii$iiiMid i0irii iigiiViiiii: iZiii{i$ie i0iii$i i i ii5ii[iiviiiciiViR i$i; iiiif iii idiiiWie iii iii i iiJ iiiiiuii ii ii i iK ii2iiL i i.iii2ii iiiiii%i iii i iiiiiiii i ixi iM ii}iiiTiiiid i iiiii`iiiii i3iii;i iiiiyiYiLiii i iiiiiUi\iiiiiiViN iii iii ii"ixi%ii;i= i iii2iEii!iiii^ii"iwi i#iiii ii$i<iQiiiri%ii]ii&ii< i'i i3i6iBii i(iii ii i iig i i i)i i i*i+i! iiiii:ii7ii^ii iii(i i,i+i i ixi-ii/ihi= i.iiiiiVi ii ihii i/iiiii<iii;i0iiii i i1izi i ii5i6i i_i)i2i3ii4iyi" iii ii^i5i i i?i%i+if i i6i_iWiii i7i> ii ig i# iiu i8i ii9ih iF iiVi{i iO iiIiwi~i i^iii:iiiiiiii i;iei1iiiiiiiii i i iiP i<i=ii>i ii(i`iRi? iYiiIi iii i7i i i?iii i@iioiiqiYiniiiliiii ii ii iEiPiVii! i iiiiiniiAii|i ii iBiiiiii- i iOi i iCiiDiWiTiTiiiii i}iEii&i i iiiiii iii~iG i iii$ iWiiiioii iFiiGiii" iiii# iiiDi-iQ iiHiei i iiIi iiiJizi iiKiiiLii$ i iiiiiH iiiiiiiMi:i iiiNiiI i iiiHiiiiiOiii iPiQiiikiRiR i iii i i ii iiiiiiSiTiii i% iiiiii& iS iUi iiS iiCiiiiVi~ii!iXiiiiii,iiiiiOii|iiiiPiie iiii i i iiiiiiiiT iiiiiWiiiiXiiYiiRi iviii ii i=i iiZiiU iii[i iiiV i% i\iii]iii^i8iT i. i' i_iiviiiiiwitii`iaibi> iii"i{ii i iiciidi9iiiii[i9iiidih i ieiii iJ i!iiifiiii iiiTigiii i%iiWiMihiiiiiiiiiiiiii( ij iiyi7imiijiki i? iW i"iiii iBiili|i ii) iziii iii iiiiimiiniuiv iwii i* iiioipiiiqi7i.irii i iii iifii i isi& iyi ii i iiiii i i>iiii iiYi iitiiui/ i+ i ivi ii i@ iwii i iii3iiii, ixi i6i9i i iii6i iii! iiiyiiQi:ici iii- ioiiiFiX i i iifi iizi iii iii{i/iii' i ibiii`iiiiui iviiiii i i iiii i0iEiiSii8i[i|i}iGii ii!i~iiiFiU ii ii iieisiii iw iiii" i iai iZi&iiiii i iiiiAiii iiii iiiiiiiii ioii ii i i ii iiA i iJi0i ix i ii iiY iiiiii i i iiZ i8ioiiiQiiiii iiiaiQiiipi;iiiPiibiiiii i ii iiii iii iiiiiiiii]iiiii iiiiii'iii. i ii iiiii iLiiiiii ii/ iiiiiB i0 i[ ii8iiiii iii/i3iiiii iiii0i iniiiiiiiii i iiiiiiiii4iiiii<i ii iiiYi iiiiC iiii iiiii}i1ii iiiiKii ii0 iFiiii ii#ii\iiiifi i>i iii iiiiii i iiiiijiiiiii-ipi9i@ i6iyiiii i i1 iiiiiiiiViiiii4iii iKi1 ii iD i iiiiii#iiii i2 iiii iZiHipiiigiii i iqiri iiiiii i iK iV i i\ i,i ii iiii]iiiuii iiiiiiiiiZiii iiiiijiii0ihihiii ii iE iii iii iiiiiiiiiii iiii2 iiiiiiiMiiwiii iy i?iiii itimi( i ii+iiiiiiiiii i ii i iii iiL iii) i ii iiif ii iiiiiiiRi"iA i3 i ii-i1ii$i i(ii] i i# ii$ i iiii i* iiii i ii i i=ik ii!ii iiii i ii ii_iiiii^ i2ii iiii9iii iiii4 i iii iibiiii ii iii5ii iii"i i iiiiii4iIi ii#ii iiiiiiij iiii$ik i ii ii\i igiiEi5 iiiiiiiii iii6 iiii ii%iii ii i[i iiiiii i&ieiii iiioi iil i i}iiiizii+ iii iiiini-ii i'iiii iiii(iii iiiiiiii ii iiiBiiiqiiii<ii*iji)i"i*ii>i)i7 ii+iiiiiiiizii,iiiiiM i)iriii-i i iiiiiiTiipiii#i#iiiiiiii iiii i ii iiSii.i8 iiiiiz i9 i=iiiim iiSiiiiiixiii/iiiqiii3ii5ii: i i ii iiiiii i; i i0i1iiiiiin ii_ ii]i i iniiiii i% iiiii i` iiiiiziTisi2i3 ii i{ ii5iiii ig iiikiiiii iii3i4ii iici iii i iiiai:i1i iii!iAihi io i i6i"iii il i-ii ia i5ii ii i ii#i! ii$ii ii4 ifii i%i& i iN ii iiWiiiiii i' ii$iii< i iNiiiW ikiiO iiiiiiiX i, ii6i&itiiP ii i7i i i i- ijii i iiCi[ip ii i'i8i ib iim i i ii{i(i i ii i9i i i i:i i i^iiiiB i;iiiiii iii ii ii)i<i=i ii ii>iiiii i=iiiiiiiiiiin iiHiDi i?iiUiWi i= ii:ii iNi iKiEi@i4ic i ii> iiQ i iAiiihiii i i( i]iiiiBi*iiiliiCiDiiEih iiiiiiiXiiiii+iiii+iJiiiUiii iimi iEiiiiFiiGi iki inii id iiiiiiiiF i!i iiri@iiHi"iCiGiiii ii^i ii i8iti) i;i i? i!iioiIi i"i#i#i$iiJi i%i i&iriKi'i5 i(i)iio i@ i}iA ii,ii*i4i1i+ii i i ii" ii,ii iC iiuiriD i-i i-i iLivi{ii| iMi.i.iNiY i6 iii i/i0i/i ii1i$ii2i%iGiRiB i i_iiiC ii iD ii3iiiii ii i. ii i4i@iwii5ii6i7iii ii&i0ii8i i&i i* ii+ iG iOiuii# i i1iPiRiiQii ii)iii=i9iili iiiiE iSiiki i\i iii iyi:i i;i<iF i%i=iiRiii>idi'i, i?iei$ ii2i3i- ii i4ii(iSi@iAiBii.iTiiOi i iiiii i&i iii i<i iiiiCiiDi iiUiip iG ie i i i ii iEi;iViFi'iGi)i ii} iHi*iiWiiiIiiTii i iiiiii iiJi. igi~iiUiij i iiiXiii8ii*i iiiKi~ iii iLiiH i iii% ii+if iii iitiiMiNiii ii ii iiik iYiiYiiii*i/ iiOiR iZiH ii#iI i i iii5iS i]iE i[i\i isiI i+iPiQi,i i iRiiSiTii,iiUi]iVi iiLi-i!i iT i\i4iWi iiXiYiZii[i>iwiiiii+i^iiJ ii_i$ii\iiiili.i]i`ii^i_iq i%ii`iaiiii i6ig iU ibicidiai iq ixi iei ibiyi ifihigihiii'iii iii ijir ii i0 i i=iibi|iiiiii i iih iki iliii iaiicimiii ini iiui iidieiis iK i/ioi7ii& i iJ i8ipiqii ij ifii igi iii(ii`irisi i iii<iFik ifiiiii]iiiIiti>iiuiivii iii i0ii-iiwiL ii iiiiiGiaii it i ii iSiKixiiyiziiiV iiiOii1 ii i{i i iiF iyii9iZ ii|i}i~iFi iii i i:iiiii2 iiiipii;iG iii ihiiiii7 iiiiiqiiiM iiiiiii iii iii i(i8 iiN i ii3 i iiO i<iiiiTiiW i iiiii(iiii1iiiiiiiiu iZii i iciijiP ipiii iiii iv iiijii iiii iQ iK i ii i' iiiiii9 iii i izii i iiikiiiii ii2i iiliii>i=iCi'iii>i iiZiiii imini iibiii i iqi?ii ii ii i"ii i?i i}iiioi@i>iiAi i1ii)iiii?i i iiiixi ii ii i3i i ihii il iiii)ii ipii'iiii4ii i i iiiiAi_i iBiiL ii iPiqii iiriiiiiX iicisi! iiiiHii iw iiiiCiDitiiiiiiix i ii i/ iiii5i i4 iuiir iii_iii/i i<ii~i7iy im iii^i5 in ibi itiiil iiii6ii i7iiiiiiiviiii i8i: ii ii0 i i1 iiwiiIiiiii i( iiiBi ii4isi iiiii i iii?iCiixi iEiHi iiFiyiziGiiiii{iiii|ii; i}i9imiH i~iiz iiis i iiM iiii iiim iiiIiiiio iiiiiiii_iiii i2 i3 iHii*iii iiii< iiii:ii ii iiAii iiR iiiii i ii" ii iiiiii ii iii iiiQi i iY iiiiiiii{iKii ii[i iJiiiN iiS iiiiiI iiiT i@ii iii i i@iiRiii it iiiiJiIii iiiii iU iimiiii{ i ii i i;iV iii iii<iii idiiiiXiii9iii6 iiiUiiii iiLi!i= ii) ii i i iii i iii ii=i$i(iviii&iicii iii i ii>iiii{i"iiiii#iiiiiW ii iiii ii$i i%iiiiii&i^iii[ i ii'iiiiiiii(i iii2i\ iJi ip ipin iiu iq i)ii iO i> ii i*iX iii i+ii i,i iii iiiiiKii i iiIi-iii!iiiiii.iDiiiJisi# iii ii7 iiii/iwii|iiiiii"i4 i| i,iiiii iiiiiiiii?iY iP i0ii1iZ iZ i ii i ii i#i@i2ii|iiziiiiiAi'ii? ii ii8 ii iyiiLiVi i3i i i i$iiiiMii%ii i i i i i.ii4iNiii ii i i iiii i5i9 i%iiiiKiQ iiixi6i7iiBi i iOiv i[ iii&ii ii iiiXii* ii\ iPi i iNi+ iw iiiiiWiCi ii iQiDi i?i] iiii^ io iR i i iEii iiFi i'iiXiiGiiS i iiT iRii8ixi ikiSiiTiii ii iiDii9i!iiiii(iiLi"i#i$i%i_ ii&iJi:iUii}i i)ii i;i<i iEi+i'i iiHi=iVi*iHiyi, i+iWi3i>i ii?i(iIi,i-i` iqiia i iii ii)i*iXi i+iiOiiYi,i-ii.ii/i ii0i.iiii1i iJir i2i3i$ i i4ii5i6i7i iib i iii} i ifiiKii i i i i8iZi9ii: ii ic ii:ii i;is iJ i@ii it i; i i/i<id ii iiiU ii0iie i=iif iu iMiiiii i>i i[iiAiLiiii?i i i i i@iAiv iBiCi\iijii[ i ig iDiEiiiFi iBiiGi iiHii(iiMiCih iiIiNiJi iKiLiiiMii1i2iNiiidiOidiV iDi`ii#i5 iPi]iQiEini i iii^iRi_iFiSip ii iiTiUii i iVii i iiGiiiieiHiOi iiPi`iWiw ij iXi ii3i iaiiIiYiJix i7iiii- i i4ik iibiZi-iii. icii[i iri;i iKi5iLiXii i iii\i]iii6i% i^i_iii~i`il iy iaizi~ iiibi?iici7idi iiieiiz iiiMifigi/ ihi|ii@idiiiiiNiiii8ifiiijikiiOiPiiilimi@ini9i ioi i iii< isii\ iQi.iRiNi@i iipiiSi{ iqiiAii iiiiTi iiii:iiiri isi@ iW i;itiui iviwixiyi| iiiiizi i i3iQiiimiiAi{i|ii ii}iOiRi iigiii~iZi iiiiii i\im ii} ii<iX ii ii i iiii iiY iiii0 iiii i=i iiiiLiiiiihiiiiii>i>ii/i?iUiiiiiiei)ix itiifiSii iy i in i i iiTi i@ii i iiiiiiii ii iziUigiiViio iii6 ip itiiiiiii iAiiJiVihiZ i iiWiiii(tBIG5_TYPICAL_DISTRIBUTION_RATIOtBIG5_TABLE_SIZEtBIG5_CHAR_TO_FREQ_ORDER(((s@/usr/lib/python2.7/site-packages/pip/_vendor/chardet/big5freq.pyt+ssite-packages/pip/_vendor/chardet/big5prober.py000064400000003335147204247350015550 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import Big5DistributionAnalysis from .mbcssm import BIG5_SM_MODEL class Big5Prober(MultiByteCharSetProber): def __init__(self): super(Big5Prober, self).__init__() self.coding_sm = CodingStateMachine(BIG5_SM_MODEL) self.distribution_analyzer = Big5DistributionAnalysis() self.reset() @property def charset_name(self): return "Big5" @property def language(self): return "Chinese" site-packages/pip/_vendor/chardet/big5prober.pyc000064400000002515147204247350015712 0ustar00 abc@sZddlmZddlmZddlmZddlmZdefdYZdS(i(tMultiByteCharSetProber(tCodingStateMachine(tBig5DistributionAnalysis(t BIG5_SM_MODELt Big5ProbercBs/eZdZedZedZRS(cCs<tt|jtt|_t|_|jdS(N( tsuperRt__init__RRt coding_smRtdistribution_analyzertreset(tself((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/big5prober.pyR#s cCsdS(NtBig5((R ((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/big5prober.pyt charset_name)scCsdS(NtChinese((R ((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/big5prober.pytlanguage-s(t__name__t __module__RtpropertyR R(((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/big5prober.pyR"s N( tmbcharsetproberRtcodingstatemachineRtchardistributionRtmbcssmRR(((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/big5prober.pytssite-packages/pip/_vendor/chardet/big5prober.pyo000064400000002515147204247350015726 0ustar00 abc@sZddlmZddlmZddlmZddlmZdefdYZdS(i(tMultiByteCharSetProber(tCodingStateMachine(tBig5DistributionAnalysis(t BIG5_SM_MODELt Big5ProbercBs/eZdZedZedZRS(cCs<tt|jtt|_t|_|jdS(N( tsuperRt__init__RRt coding_smRtdistribution_analyzertreset(tself((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/big5prober.pyR#s cCsdS(NtBig5((R ((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/big5prober.pyt charset_name)scCsdS(NtChinese((R ((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/big5prober.pytlanguage-s(t__name__t __module__RtpropertyR R(((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/big5prober.pyR"s N( tmbcharsetproberRtcodingstatemachineRtchardistributionRtmbcssmRR(((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/big5prober.pytssite-packages/pip/_vendor/chardet/chardistribution.py000064400000022303147204247350017061 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .euctwfreq import (EUCTW_CHAR_TO_FREQ_ORDER, EUCTW_TABLE_SIZE, EUCTW_TYPICAL_DISTRIBUTION_RATIO) from .euckrfreq import (EUCKR_CHAR_TO_FREQ_ORDER, EUCKR_TABLE_SIZE, EUCKR_TYPICAL_DISTRIBUTION_RATIO) from .gb2312freq import (GB2312_CHAR_TO_FREQ_ORDER, GB2312_TABLE_SIZE, GB2312_TYPICAL_DISTRIBUTION_RATIO) from .big5freq import (BIG5_CHAR_TO_FREQ_ORDER, BIG5_TABLE_SIZE, BIG5_TYPICAL_DISTRIBUTION_RATIO) from .jisfreq import (JIS_CHAR_TO_FREQ_ORDER, JIS_TABLE_SIZE, JIS_TYPICAL_DISTRIBUTION_RATIO) class CharDistributionAnalysis(object): ENOUGH_DATA_THRESHOLD = 1024 SURE_YES = 0.99 SURE_NO = 0.01 MINIMUM_DATA_THRESHOLD = 3 def __init__(self): # Mapping table to get frequency order from char order (get from # GetOrder()) self._char_to_freq_order = None self._table_size = None # Size of above table # This is a constant value which varies from language to language, # used in calculating confidence. See # http://www.mozilla.org/projects/intl/UniversalCharsetDetection.html # for further detail. self.typical_distribution_ratio = None self._done = None self._total_chars = None self._freq_chars = None self.reset() def reset(self): """reset analyser, clear any state""" # If this flag is set to True, detection is done and conclusion has # been made self._done = False self._total_chars = 0 # Total characters encountered # The number of characters whose frequency order is less than 512 self._freq_chars = 0 def feed(self, char, char_len): """feed a character with known length""" if char_len == 2: # we only care about 2-bytes character in our distribution analysis order = self.get_order(char) else: order = -1 if order >= 0: self._total_chars += 1 # order is valid if order < self._table_size: if 512 > self._char_to_freq_order[order]: self._freq_chars += 1 def get_confidence(self): """return confidence based on existing data""" # if we didn't receive any character in our consideration range, # return negative answer if self._total_chars <= 0 or self._freq_chars <= self.MINIMUM_DATA_THRESHOLD: return self.SURE_NO if self._total_chars != self._freq_chars: r = (self._freq_chars / ((self._total_chars - self._freq_chars) * self.typical_distribution_ratio)) if r < self.SURE_YES: return r # normalize confidence (we don't want to be 100% sure) return self.SURE_YES def got_enough_data(self): # It is not necessary to receive all data to draw conclusion. # For charset detection, certain amount of data is enough return self._total_chars > self.ENOUGH_DATA_THRESHOLD def get_order(self, byte_str): # We do not handle characters based on the original encoding string, # but convert this encoding string to a number, here called order. # This allows multiple encodings of a language to share one frequency # table. return -1 class EUCTWDistributionAnalysis(CharDistributionAnalysis): def __init__(self): super(EUCTWDistributionAnalysis, self).__init__() self._char_to_freq_order = EUCTW_CHAR_TO_FREQ_ORDER self._table_size = EUCTW_TABLE_SIZE self.typical_distribution_ratio = EUCTW_TYPICAL_DISTRIBUTION_RATIO def get_order(self, byte_str): # for euc-TW encoding, we are interested # first byte range: 0xc4 -- 0xfe # second byte range: 0xa1 -- 0xfe # no validation needed here. State machine has done that first_char = byte_str[0] if first_char >= 0xC4: return 94 * (first_char - 0xC4) + byte_str[1] - 0xA1 else: return -1 class EUCKRDistributionAnalysis(CharDistributionAnalysis): def __init__(self): super(EUCKRDistributionAnalysis, self).__init__() self._char_to_freq_order = EUCKR_CHAR_TO_FREQ_ORDER self._table_size = EUCKR_TABLE_SIZE self.typical_distribution_ratio = EUCKR_TYPICAL_DISTRIBUTION_RATIO def get_order(self, byte_str): # for euc-KR encoding, we are interested # first byte range: 0xb0 -- 0xfe # second byte range: 0xa1 -- 0xfe # no validation needed here. State machine has done that first_char = byte_str[0] if first_char >= 0xB0: return 94 * (first_char - 0xB0) + byte_str[1] - 0xA1 else: return -1 class GB2312DistributionAnalysis(CharDistributionAnalysis): def __init__(self): super(GB2312DistributionAnalysis, self).__init__() self._char_to_freq_order = GB2312_CHAR_TO_FREQ_ORDER self._table_size = GB2312_TABLE_SIZE self.typical_distribution_ratio = GB2312_TYPICAL_DISTRIBUTION_RATIO def get_order(self, byte_str): # for GB2312 encoding, we are interested # first byte range: 0xb0 -- 0xfe # second byte range: 0xa1 -- 0xfe # no validation needed here. State machine has done that first_char, second_char = byte_str[0], byte_str[1] if (first_char >= 0xB0) and (second_char >= 0xA1): return 94 * (first_char - 0xB0) + second_char - 0xA1 else: return -1 class Big5DistributionAnalysis(CharDistributionAnalysis): def __init__(self): super(Big5DistributionAnalysis, self).__init__() self._char_to_freq_order = BIG5_CHAR_TO_FREQ_ORDER self._table_size = BIG5_TABLE_SIZE self.typical_distribution_ratio = BIG5_TYPICAL_DISTRIBUTION_RATIO def get_order(self, byte_str): # for big5 encoding, we are interested # first byte range: 0xa4 -- 0xfe # second byte range: 0x40 -- 0x7e , 0xa1 -- 0xfe # no validation needed here. State machine has done that first_char, second_char = byte_str[0], byte_str[1] if first_char >= 0xA4: if second_char >= 0xA1: return 157 * (first_char - 0xA4) + second_char - 0xA1 + 63 else: return 157 * (first_char - 0xA4) + second_char - 0x40 else: return -1 class SJISDistributionAnalysis(CharDistributionAnalysis): def __init__(self): super(SJISDistributionAnalysis, self).__init__() self._char_to_freq_order = JIS_CHAR_TO_FREQ_ORDER self._table_size = JIS_TABLE_SIZE self.typical_distribution_ratio = JIS_TYPICAL_DISTRIBUTION_RATIO def get_order(self, byte_str): # for sjis encoding, we are interested # first byte range: 0x81 -- 0x9f , 0xe0 -- 0xfe # second byte range: 0x40 -- 0x7e, 0x81 -- oxfe # no validation needed here. State machine has done that first_char, second_char = byte_str[0], byte_str[1] if (first_char >= 0x81) and (first_char <= 0x9F): order = 188 * (first_char - 0x81) elif (first_char >= 0xE0) and (first_char <= 0xEF): order = 188 * (first_char - 0xE0 + 31) else: return -1 order = order + second_char - 0x40 if second_char > 0x7F: order = -1 return order class EUCJPDistributionAnalysis(CharDistributionAnalysis): def __init__(self): super(EUCJPDistributionAnalysis, self).__init__() self._char_to_freq_order = JIS_CHAR_TO_FREQ_ORDER self._table_size = JIS_TABLE_SIZE self.typical_distribution_ratio = JIS_TYPICAL_DISTRIBUTION_RATIO def get_order(self, byte_str): # for euc-JP encoding, we are interested # first byte range: 0xa0 -- 0xfe # second byte range: 0xa1 -- 0xfe # no validation needed here. State machine has done that char = byte_str[0] if char >= 0xA0: return 94 * (char - 0xA1) + byte_str[1] - 0xa1 else: return -1 site-packages/pip/_vendor/chardet/chardistribution.pyo000064400000017253147204247350017250 0ustar00 abc@s*ddlmZmZmZddlmZmZmZddlm Z m Z m Z ddl m Z mZmZddlmZmZmZdefdYZdefd YZd efd YZd efd YZdefdYZdefdYZdefdYZdS(i(tEUCTW_CHAR_TO_FREQ_ORDERtEUCTW_TABLE_SIZEt EUCTW_TYPICAL_DISTRIBUTION_RATIO(tEUCKR_CHAR_TO_FREQ_ORDERtEUCKR_TABLE_SIZEt EUCKR_TYPICAL_DISTRIBUTION_RATIO(tGB2312_CHAR_TO_FREQ_ORDERtGB2312_TABLE_SIZEt!GB2312_TYPICAL_DISTRIBUTION_RATIO(tBIG5_CHAR_TO_FREQ_ORDERtBIG5_TABLE_SIZEtBIG5_TYPICAL_DISTRIBUTION_RATIO(tJIS_CHAR_TO_FREQ_ORDERtJIS_TABLE_SIZEtJIS_TYPICAL_DISTRIBUTION_RATIOtCharDistributionAnalysiscBsVeZdZdZdZdZdZdZdZdZ dZ d Z RS( igGz?g{Gz?icCsDd|_d|_d|_d|_d|_d|_|jdS(N(tNonet_char_to_freq_ordert _table_sizettypical_distribution_ratiot_donet _total_charst _freq_charstreset(tself((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyt__init__.s      cCst|_d|_d|_dS(sreset analyser, clear any stateiN(tFalseRRR(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR=s  cCs}|dkr|j|}nd}|dkry|jd7_||jkryd|j|krv|jd7_qvqyndS(s"feed a character with known lengthiiiiiN(t get_orderRRRR(Rtchartchar_lentorder((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pytfeedFs  cCsu|jdks!|j|jkr(|jS|j|jkrn|j|j|j|j}||jkrn|Sn|jS(s(return confidence based on existing datai(RRtMINIMUM_DATA_THRESHOLDtSURE_NORtSURE_YES(Rtr((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pytget_confidenceTs! cCs|j|jkS(N(RtENOUGH_DATA_THRESHOLD(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pytgot_enough_datadscCsdS(Ni((Rtbyte_str((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRis( t__name__t __module__R%R"R!R RRRR$R&R(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR(s    tEUCTWDistributionAnalysiscBseZdZdZRS(cCs2tt|jt|_t|_t|_dS(N( tsuperR*RRRRRRR(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRrs  cCs6|d}|dkr.d|d|ddSdSdS(Niii^iii((RR't first_char((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRxs  (R(R)RR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR*qs tEUCKRDistributionAnalysiscBseZdZdZRS(cCs2tt|jt|_t|_t|_dS(N( R+R-RRRRRRR(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  cCs6|d}|dkr.d|d|ddSdSdS(Niii^iii((RR'R,((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  (R(R)RR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR-s tGB2312DistributionAnalysiscBseZdZdZRS(cCs2tt|jt|_t|_t|_dS(N( R+R.RRRRRRR(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  cCsI|d|d}}|dkrA|dkrAd|d|dSdSdS(Niiiii^i((RR'R,t second_char((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs(R(R)RR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR.s tBig5DistributionAnalysiscBseZdZdZRS(cCs2tt|jt|_t|_t|_dS(N( R+R0RR RR RR R(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  cCsd|d|d}}|dkr\|dkrEd|d|ddSd|d|dSndSdS( Niiiiii?i@i((RR'R,R/((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs   (R(R)RR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR0s tSJISDistributionAnalysiscBseZdZdZRS(cCs2tt|jt|_t|_t|_dS(N( R+R1RR RR RRR(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  cCs|d|d}}|dkr>|dkr>d|d}n1|dkrk|dkrkd|dd}nd S||d }|d krd }n|S( Niiiiiiiiii@i((RR'R,R/R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  (R(R)RR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR1s tEUCJPDistributionAnalysiscBseZdZdZRS(cCs2tt|jt|_t|_t|_dS(N( R+R2RR RR RRR(R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  cCs6|d}|dkr.d|d|ddSdSdS(Niii^iii((RR'R((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyRs  (R(R)RR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pyR2s N(t euctwfreqRRRt euckrfreqRRRt gb2312freqRRRtbig5freqR R R tjisfreqR R RtobjectRR*R-R.R0R1R2(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/chardistribution.pytsIsite-packages/pip/_vendor/chardet/charsetgroupprober.py000064400000007313147204247350017430 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .enums import ProbingState from .charsetprober import CharSetProber class CharSetGroupProber(CharSetProber): def __init__(self, lang_filter=None): super(CharSetGroupProber, self).__init__(lang_filter=lang_filter) self._active_num = 0 self.probers = [] self._best_guess_prober = None def reset(self): super(CharSetGroupProber, self).reset() self._active_num = 0 for prober in self.probers: if prober: prober.reset() prober.active = True self._active_num += 1 self._best_guess_prober = None @property def charset_name(self): if not self._best_guess_prober: self.get_confidence() if not self._best_guess_prober: return None return self._best_guess_prober.charset_name @property def language(self): if not self._best_guess_prober: self.get_confidence() if not self._best_guess_prober: return None return self._best_guess_prober.language def feed(self, byte_str): for prober in self.probers: if not prober: continue if not prober.active: continue state = prober.feed(byte_str) if not state: continue if state == ProbingState.FOUND_IT: self._best_guess_prober = prober return self.state elif state == ProbingState.NOT_ME: prober.active = False self._active_num -= 1 if self._active_num <= 0: self._state = ProbingState.NOT_ME return self.state return self.state def get_confidence(self): state = self.state if state == ProbingState.FOUND_IT: return 0.99 elif state == ProbingState.NOT_ME: return 0.01 best_conf = 0.0 self._best_guess_prober = None for prober in self.probers: if not prober: continue if not prober.active: self.logger.debug('%s not active', prober.charset_name) continue conf = prober.get_confidence() self.logger.debug('%s %s confidence = %s', prober.charset_name, prober.language, conf) if best_conf < conf: best_conf = conf self._best_guess_prober = prober if not self._best_guess_prober: return 0.0 return best_conf site-packages/pip/_vendor/chardet/charsetgroupprober.pyo000064400000005471147204247350017612 0ustar00 abc@s:ddlmZddlmZdefdYZdS(i(t ProbingState(t CharSetProbertCharSetGroupProbercBsMeZddZdZedZedZdZdZ RS(cCs8tt|jd|d|_g|_d|_dS(Nt lang_filteri(tsuperRt__init__t _active_numtproberstNonet_best_guess_prober(tselfR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pyR!s  cCshtt|jd|_x<|jD]1}|r&|jt|_|jd7_q&q&Wd|_dS(Nii( RRtresetRRtTruetactiveRR (R tprober((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pyR 's   cCs-|js#|j|js#dSn|jjS(N(R tget_confidenceRt charset_name(R ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pyR1s    cCs-|js#|j|js#dSn|jjS(N(R RRtlanguage(R ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pyR9s    cCsx|jD]}|sq n|js+q n|j|}|sFq n|tjkre||_|jS|tjkr t|_|j d8_ |j dkrtj|_ |jSq q W|jS(Nii( RR tfeedRtFOUND_ITR tstatetNOT_MEtFalseRt_state(R tbyte_strRR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pyRAs$    cCs|j}|tjkrdS|tjkr/dSd}d|_x|jD]}|sZqHn|js|jj d|j qHn|j }|jj d|j |j |||krH|}||_qHqHW|jsdS|S(NgGz?g{Gz?gs %s not actives%s %s confidence = %s( RRRRRR RR tloggertdebugRRR(R Rt best_confRtconf((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pyRUs*      N( t__name__t __module__RRR tpropertyRRRR(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pyR s    N(tenumsRt charsetproberRR(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetgroupprober.pytssite-packages/pip/_vendor/chardet/charsetprober.py000064400000011766147204247350016362 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### import logging import re from .enums import ProbingState class CharSetProber(object): SHORTCUT_THRESHOLD = 0.95 def __init__(self, lang_filter=None): self._state = None self.lang_filter = lang_filter self.logger = logging.getLogger(__name__) def reset(self): self._state = ProbingState.DETECTING @property def charset_name(self): return None def feed(self, buf): pass @property def state(self): return self._state def get_confidence(self): return 0.0 @staticmethod def filter_high_byte_only(buf): buf = re.sub(b'([\x00-\x7F])+', b' ', buf) return buf @staticmethod def filter_international_words(buf): """ We define three types of bytes: alphabet: english alphabets [a-zA-Z] international: international characters [\x80-\xFF] marker: everything else [^a-zA-Z\x80-\xFF] The input buffer can be thought to contain a series of words delimited by markers. This function works to filter all words that contain at least one international character. All contiguous sequences of markers are replaced by a single space ascii character. This filter applies to all scripts which do not use English characters. """ filtered = bytearray() # This regex expression filters out only words that have at-least one # international character. The word may include one marker character at # the end. words = re.findall(b'[a-zA-Z]*[\x80-\xFF]+[a-zA-Z]*[^a-zA-Z\x80-\xFF]?', buf) for word in words: filtered.extend(word[:-1]) # If the last character in the word is a marker, replace it with a # space as markers shouldn't affect our analysis (they are used # similarly across all languages and may thus have similar # frequencies). last_char = word[-1:] if not last_char.isalpha() and last_char < b'\x80': last_char = b' ' filtered.extend(last_char) return filtered @staticmethod def filter_with_english_letters(buf): """ Returns a copy of ``buf`` that retains only the sequences of English alphabet and high byte characters that are not between <> characters. Also retains English alphabet and high byte characters immediately before occurrences of >. This filter can be applied to all scripts which contain both English characters and extended ASCII characters, but is currently only used by ``Latin1Prober``. """ filtered = bytearray() in_tag = False prev = 0 for curr in range(len(buf)): # Slice here to get bytes instead of an int with Python 3 buf_char = buf[curr:curr + 1] # Check if we're coming out of or entering an HTML tag if buf_char == b'>': in_tag = False elif buf_char == b'<': in_tag = True # If current character is not extended-ASCII and not alphabetic... if buf_char < b'\x80' and not buf_char.isalpha(): # ...and we're not in a tag if curr > prev and not in_tag: # Keep everything after last non-extended-ASCII, # non-alphabetic character filtered.extend(buf[prev:curr]) # Output a space to delimit stretch we kept filtered.extend(b' ') prev = curr + 1 # If we're not in a tag... if not in_tag: # Keep everything after last non-extended-ASCII, non-alphabetic # character filtered.extend(buf[prev:]) return filtered site-packages/pip/_vendor/chardet/charsetprober.pyo000064400000010065147204247350016530 0ustar00 abc@sBddlZddlZddlmZdefdYZdS(iNi(t ProbingStatet CharSetProbercBseZdZd dZdZedZdZedZ dZ e dZ e dZ e d ZRS( gffffff?cCs(d|_||_tjt|_dS(N(tNonet_statet lang_filtertloggingt getLoggert__name__tlogger(tselfR((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pyt__init__'s  cCstj|_dS(N(Rt DETECTINGR(R ((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pytreset,scCsdS(N(R(R ((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pyt charset_name/scCsdS(N((R tbuf((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pytfeed3scCs|jS(N(R(R ((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pytstate6scCsdS(Ng((R ((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pytget_confidence:scCstjdd|}|S(Ns([-])+t (tretsub(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pytfilter_high_byte_only=scCszt}tjd|}xX|D]P}|j|d |d}|j re|dkred}n|j|q"W|S(s5 We define three types of bytes: alphabet: english alphabets [a-zA-Z] international: international characters [-] marker: everything else [^a-zA-Z-] The input buffer can be thought to contain a series of words delimited by markers. This function works to filter all words that contain at least one international character. All contiguous sequences of markers are replaced by a single space ascii character. This filter applies to all scripts which do not use English characters. s%[a-zA-Z]*[-]+[a-zA-Z]*[^a-zA-Z-]?isR(t bytearrayRtfindalltextendtisalpha(Rtfilteredtwordstwordt last_char((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/charsetprober.pytfilter_international_wordsBs      cCst}t}d}xtt|D]}|||d!}|dkrTt}n|dkrit}n|dkr(|j r(||kr| r|j|||!|jdn|d}q(q(W|s|j||n|S(s Returns a copy of ``buf`` that retains only the sequences of English alphabet and high byte characters that are not between <> characters. Also retains English alphabet and high byte characters immediately before occurrences of >. This filter can be applied to all scripts which contain both English characters and extended ASCII characters, but is currently only used by ``Latin1Prober``. iit>ts  site-packages/pip/_vendor/chardet/codingstatemachine.py000064400000007006147204247350017340 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### import logging from .enums import MachineState class CodingStateMachine(object): """ A state machine to verify a byte sequence for a particular encoding. For each byte the detector receives, it will feed that byte to every active state machine available, one byte at a time. The state machine changes its state based on its previous state and the byte it receives. There are 3 states in a state machine that are of interest to an auto-detector: START state: This is the state to start with, or a legal byte sequence (i.e. a valid code point) for character has been identified. ME state: This indicates that the state machine identified a byte sequence that is specific to the charset it is designed for and that there is no other possible encoding which can contain this byte sequence. This will to lead to an immediate positive answer for the detector. ERROR state: This indicates the state machine identified an illegal byte sequence for that encoding. This will lead to an immediate negative answer for this encoding. Detector will exclude this encoding from consideration from here on. """ def __init__(self, sm): self._model = sm self._curr_byte_pos = 0 self._curr_char_len = 0 self._curr_state = None self.logger = logging.getLogger(__name__) self.reset() def reset(self): self._curr_state = MachineState.START def next_state(self, c): # for each byte we get its class # if it is first byte, we also get byte length byte_class = self._model['class_table'][c] if self._curr_state == MachineState.START: self._curr_byte_pos = 0 self._curr_char_len = self._model['char_len_table'][byte_class] # from byte's class and state_table, we get its next state curr_state = (self._curr_state * self._model['class_factor'] + byte_class) self._curr_state = self._model['state_table'][curr_state] self._curr_byte_pos += 1 return self._curr_state def get_current_charlen(self): return self._curr_char_len def get_coding_state_machine(self): return self._model['name'] @property def language(self): return self._model['language'] site-packages/pip/_vendor/chardet/codingstatemachine.pyc000064400000006440147204247350017504 0ustar00 abc@s6ddlZddlmZdefdYZdS(iNi(t MachineStatetCodingStateMachinecBsJeZdZdZdZdZdZdZedZ RS(s A state machine to verify a byte sequence for a particular encoding. For each byte the detector receives, it will feed that byte to every active state machine available, one byte at a time. The state machine changes its state based on its previous state and the byte it receives. There are 3 states in a state machine that are of interest to an auto-detector: START state: This is the state to start with, or a legal byte sequence (i.e. a valid code point) for character has been identified. ME state: This indicates that the state machine identified a byte sequence that is specific to the charset it is designed for and that there is no other possible encoding which can contain this byte sequence. This will to lead to an immediate positive answer for the detector. ERROR state: This indicates the state machine identified an illegal byte sequence for that encoding. This will lead to an immediate negative answer for this encoding. Detector will exclude this encoding from consideration from here on. cCsD||_d|_d|_d|_tjt|_|j dS(Ni( t_modelt_curr_byte_post_curr_char_lentNonet _curr_statetloggingt getLoggert__name__tloggertreset(tselftsm((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pyt__init__7s     cCstj|_dS(N(RtSTARTR(R ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pyR ?scCs|jd|}|jtjkrCd|_|jd||_n|j|jd|}|jd||_|jd7_|jS(Nt class_tableitchar_len_tablet class_factort state_tablei(RRRRRR(R tct byte_classt curr_state((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pyt next_stateBs cCs|jS(N(R(R ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pytget_current_charlenPscCs |jdS(Ntname(R(R ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pytget_coding_state_machineSscCs |jdS(Ntlanguage(R(R ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pyRVs( R t __module__t__doc__RR RRRtpropertyR(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pyR!s     (RtenumsRtobjectR(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pyts site-packages/pip/_vendor/chardet/codingstatemachine.pyo000064400000006440147204247350017520 0ustar00 abc@s6ddlZddlmZdefdYZdS(iNi(t MachineStatetCodingStateMachinecBsJeZdZdZdZdZdZdZedZ RS(s A state machine to verify a byte sequence for a particular encoding. For each byte the detector receives, it will feed that byte to every active state machine available, one byte at a time. The state machine changes its state based on its previous state and the byte it receives. There are 3 states in a state machine that are of interest to an auto-detector: START state: This is the state to start with, or a legal byte sequence (i.e. a valid code point) for character has been identified. ME state: This indicates that the state machine identified a byte sequence that is specific to the charset it is designed for and that there is no other possible encoding which can contain this byte sequence. This will to lead to an immediate positive answer for the detector. ERROR state: This indicates the state machine identified an illegal byte sequence for that encoding. This will lead to an immediate negative answer for this encoding. Detector will exclude this encoding from consideration from here on. cCsD||_d|_d|_d|_tjt|_|j dS(Ni( t_modelt_curr_byte_post_curr_char_lentNonet _curr_statetloggingt getLoggert__name__tloggertreset(tselftsm((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pyt__init__7s     cCstj|_dS(N(RtSTARTR(R ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pyR ?scCs|jd|}|jtjkrCd|_|jd||_n|j|jd|}|jd||_|jd7_|jS(Nt class_tableitchar_len_tablet class_factort state_tablei(RRRRRR(R tct byte_classt curr_state((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pyt next_stateBs cCs|jS(N(R(R ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pytget_current_charlenPscCs |jdS(Ntname(R(R ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pytget_coding_state_machineSscCs |jdS(Ntlanguage(R(R ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pyRVs( R t __module__t__doc__RR RRRtpropertyR(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pyR!s     (RtenumsRtobjectR(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/codingstatemachine.pyts site-packages/pip/_vendor/chardet/compat.py000064400000002156147204247350014773 0ustar00######################## BEGIN LICENSE BLOCK ######################## # Contributor(s): # Dan Blanchard # Ian Cordasco # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### import sys if sys.version_info < (3, 0): PY2 = True PY3 = False base_str = (str, unicode) text_type = unicode else: PY2 = False PY3 = True base_str = (bytes, str) text_type = str site-packages/pip/_vendor/chardet/compat.pyc000064400000000624147204247350015134 0ustar00 abc@s^ddlZejdkr<eZeZeefZeZ neZeZe efZeZ dS(iNii(ii( tsyst version_infotTruetPY2tFalsetPY3tstrtunicodetbase_strt text_typetbytes(((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/compat.pyts    site-packages/pip/_vendor/chardet/compat.pyo000064400000000624147204247350015150 0ustar00 abc@s^ddlZejdkr<eZeZeefZeZ neZeZe efZeZ dS(iNii(ii( tsyst version_infotTruetPY2tFalsetPY3tstrtunicodetbase_strt text_typetbytes(((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/compat.pyts    site-packages/pip/_vendor/chardet/cp949prober.py000064400000003477147204247350015601 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .chardistribution import EUCKRDistributionAnalysis from .codingstatemachine import CodingStateMachine from .mbcharsetprober import MultiByteCharSetProber from .mbcssm import CP949_SM_MODEL class CP949Prober(MultiByteCharSetProber): def __init__(self): super(CP949Prober, self).__init__() self.coding_sm = CodingStateMachine(CP949_SM_MODEL) # NOTE: CP949 is a superset of EUC-KR, so the distribution should be # not different. self.distribution_analyzer = EUCKRDistributionAnalysis() self.reset() @property def charset_name(self): return "CP949" @property def language(self): return "Korean" site-packages/pip/_vendor/chardet/cp949prober.pyo000064400000002525147204247350015751 0ustar00 abc@sZddlmZddlmZddlmZddlmZdefdYZdS(i(tEUCKRDistributionAnalysis(tCodingStateMachine(tMultiByteCharSetProber(tCP949_SM_MODELt CP949ProbercBs/eZdZedZedZRS(cCs<tt|jtt|_t|_|jdS(N( tsuperRt__init__RRt coding_smRtdistribution_analyzertreset(tself((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cp949prober.pyR#s cCsdS(NtCP949((R ((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cp949prober.pyt charset_name+scCsdS(NtKorean((R ((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cp949prober.pytlanguage/s(t__name__t __module__RtpropertyR R(((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cp949prober.pyR"s N( tchardistributionRtcodingstatemachineRtmbcharsetproberRtmbcssmRR(((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/cp949prober.pytssite-packages/pip/_vendor/chardet/enums.py000064400000003175147204247350014641 0ustar00""" All of the Enums that are used throughout the chardet package. :author: Dan Blanchard (dan.blanchard@gmail.com) """ class InputState(object): """ This enum represents the different states a universal detector can be in. """ PURE_ASCII = 0 ESC_ASCII = 1 HIGH_BYTE = 2 class LanguageFilter(object): """ This enum represents the different language filters we can apply to a ``UniversalDetector``. """ CHINESE_SIMPLIFIED = 0x01 CHINESE_TRADITIONAL = 0x02 JAPANESE = 0x04 KOREAN = 0x08 NON_CJK = 0x10 ALL = 0x1F CHINESE = CHINESE_SIMPLIFIED | CHINESE_TRADITIONAL CJK = CHINESE | JAPANESE | KOREAN class ProbingState(object): """ This enum represents the different states a prober can be in. """ DETECTING = 0 FOUND_IT = 1 NOT_ME = 2 class MachineState(object): """ This enum represents the different states a state machine can be in. """ START = 0 ERROR = 1 ITS_ME = 2 class SequenceLikelihood(object): """ This enum represents the likelihood of a character following the previous one. """ NEGATIVE = 0 UNLIKELY = 1 LIKELY = 2 POSITIVE = 3 @classmethod def get_num_categories(cls): """:returns: The number of likelihood categories in the enum.""" return 4 class CharacterCategory(object): """ This enum represents the different categories language models for ``SingleByteCharsetProber`` put characters into. Anything less than CONTROL is considered a letter. """ UNDEFINED = 255 LINE_BREAK = 254 SYMBOL = 253 DIGIT = 252 CONTROL = 251 site-packages/pip/_vendor/chardet/enums.pyo000064400000006071147204247350015016 0ustar00 abc@sdZdefdYZdefdYZdefdYZdefdYZd efd YZd efd YZd S(sr All of the Enums that are used throughout the chardet package. :author: Dan Blanchard (dan.blanchard@gmail.com) t InputStatecBs eZdZdZdZdZRS(sS This enum represents the different states a universal detector can be in. iii(t__name__t __module__t__doc__t PURE_ASCIIt ESC_ASCIIt HIGH_BYTE(((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pyRstLanguageFiltercBsJeZdZdZdZdZdZdZdZeeBZ e eBeBZ RS(sj This enum represents the different language filters we can apply to a ``UniversalDetector``. iiiiii( RRRtCHINESE_SIMPLIFIEDtCHINESE_TRADITIONALtJAPANESEtKOREANtNON_CJKtALLtCHINESEtCJK(((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pyRs t ProbingStatecBs eZdZdZdZdZRS(sG This enum represents the different states a prober can be in. iii(RRRt DETECTINGtFOUND_ITtNOT_ME(((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pyR st MachineStatecBs eZdZdZdZdZRS(sN This enum represents the different states a state machine can be in. iii(RRRtSTARTtERRORtITS_ME(((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pyR)stSequenceLikelihoodcBs5eZdZdZdZdZdZedZRS(sX This enum represents the likelihood of a character following the previous one. iiiicCsdS(s::returns: The number of likelihood categories in the enum.i((tcls((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pytget_num_categories;s( RRRtNEGATIVEtUNLIKELYtLIKELYtPOSITIVEt classmethodR(((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pyR2s tCharacterCategorycBs,eZdZdZdZdZdZdZRS(s This enum represents the different categories language models for ``SingleByteCharsetProber`` put characters into. Anything less than CONTROL is considered a letter. iiiii(RRRt UNDEFINEDt LINE_BREAKtSYMBOLtDIGITtCONTROL(((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pyR As N(RtobjectRRRRRR (((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/enums.pyts    site-packages/pip/_vendor/chardet/escprober.py000064400000007556147204247350015505 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetprober import CharSetProber from .codingstatemachine import CodingStateMachine from .enums import LanguageFilter, ProbingState, MachineState from .escsm import (HZ_SM_MODEL, ISO2022CN_SM_MODEL, ISO2022JP_SM_MODEL, ISO2022KR_SM_MODEL) class EscCharSetProber(CharSetProber): """ This CharSetProber uses a "code scheme" approach for detecting encodings, whereby easily recognizable escape or shift sequences are relied on to identify these encodings. """ def __init__(self, lang_filter=None): super(EscCharSetProber, self).__init__(lang_filter=lang_filter) self.coding_sm = [] if self.lang_filter & LanguageFilter.CHINESE_SIMPLIFIED: self.coding_sm.append(CodingStateMachine(HZ_SM_MODEL)) self.coding_sm.append(CodingStateMachine(ISO2022CN_SM_MODEL)) if self.lang_filter & LanguageFilter.JAPANESE: self.coding_sm.append(CodingStateMachine(ISO2022JP_SM_MODEL)) if self.lang_filter & LanguageFilter.KOREAN: self.coding_sm.append(CodingStateMachine(ISO2022KR_SM_MODEL)) self.active_sm_count = None self._detected_charset = None self._detected_language = None self._state = None self.reset() def reset(self): super(EscCharSetProber, self).reset() for coding_sm in self.coding_sm: if not coding_sm: continue coding_sm.active = True coding_sm.reset() self.active_sm_count = len(self.coding_sm) self._detected_charset = None self._detected_language = None @property def charset_name(self): return self._detected_charset @property def language(self): return self._detected_language def get_confidence(self): if self._detected_charset: return 0.99 else: return 0.00 def feed(self, byte_str): for c in byte_str: for coding_sm in self.coding_sm: if not coding_sm or not coding_sm.active: continue coding_state = coding_sm.next_state(c) if coding_state == MachineState.ERROR: coding_sm.active = False self.active_sm_count -= 1 if self.active_sm_count <= 0: self._state = ProbingState.NOT_ME return self.state elif coding_state == MachineState.ITS_ME: self._state = ProbingState.FOUND_IT self._detected_charset = coding_sm.get_coding_state_machine() self._detected_language = coding_sm.language return self.state return self.state site-packages/pip/_vendor/chardet/escprober.pyo000064400000006237147204247350015657 0ustar00 abc@sxddlmZddlmZddlmZmZmZddlm Z m Z m Z m Z defdYZ dS(i(t CharSetProber(tCodingStateMachine(tLanguageFiltert ProbingStatet MachineState(t HZ_SM_MODELtISO2022CN_SM_MODELtISO2022JP_SM_MODELtISO2022KR_SM_MODELtEscCharSetProbercBsSeZdZddZdZedZedZdZ dZ RS(s This CharSetProber uses a "code scheme" approach for detecting encodings, whereby easily recognizable escape or shift sequences are relied on to identify these encodings. cCstt|jd|g|_|jtj@ra|jjtt |jjtt n|jtj @r|jjtt n|jtj @r|jjttnd|_d|_d|_d|_|jdS(Nt lang_filter(tsuperR t__init__t coding_smR RtCHINESE_SIMPLIFIEDtappendRRRtJAPANESERtKOREANRtNonetactive_sm_countt_detected_charsett_detected_languaget_statetreset(tselfR ((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pyR *s     cCsntt|jx0|jD]%}|s/qnt|_|jqWt|j|_d|_ d|_ dS(N( R R RR tTruetactivetlenRRRR(RR ((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pyR:s  cCs|jS(N(R(R((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pyt charset_nameEscCs|jS(N(R(R((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pytlanguageIscCs|jr dSdSdS(NgGz?g(R(R((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pytget_confidenceMs cCsx|D]}x|jD]}| s|j r4qn|j|}|tjkrt|_|jd8_|jdkrtj|_ |j Sq|tj krtj |_ |j |_|j|_|j SqWqW|j S(Nii(R Rt next_stateRtERRORtFalseRRtNOT_MERtstatetITS_MEtFOUND_ITtget_coding_state_machineRRR(Rtbyte_strtcR t coding_state((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pytfeedSs"      N( t__name__t __module__t__doc__RR RtpropertyRRRR*(((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pyR #s   N(t charsetproberRtcodingstatemachineRtenumsRRRtescsmRRRRR (((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escprober.pyts"site-packages/pip/_vendor/chardet/escsm.py000064400000024416147204247350014625 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .enums import MachineState HZ_CLS = ( 1,0,0,0,0,0,0,0, # 00 - 07 0,0,0,0,0,0,0,0, # 08 - 0f 0,0,0,0,0,0,0,0, # 10 - 17 0,0,0,1,0,0,0,0, # 18 - 1f 0,0,0,0,0,0,0,0, # 20 - 27 0,0,0,0,0,0,0,0, # 28 - 2f 0,0,0,0,0,0,0,0, # 30 - 37 0,0,0,0,0,0,0,0, # 38 - 3f 0,0,0,0,0,0,0,0, # 40 - 47 0,0,0,0,0,0,0,0, # 48 - 4f 0,0,0,0,0,0,0,0, # 50 - 57 0,0,0,0,0,0,0,0, # 58 - 5f 0,0,0,0,0,0,0,0, # 60 - 67 0,0,0,0,0,0,0,0, # 68 - 6f 0,0,0,0,0,0,0,0, # 70 - 77 0,0,0,4,0,5,2,0, # 78 - 7f 1,1,1,1,1,1,1,1, # 80 - 87 1,1,1,1,1,1,1,1, # 88 - 8f 1,1,1,1,1,1,1,1, # 90 - 97 1,1,1,1,1,1,1,1, # 98 - 9f 1,1,1,1,1,1,1,1, # a0 - a7 1,1,1,1,1,1,1,1, # a8 - af 1,1,1,1,1,1,1,1, # b0 - b7 1,1,1,1,1,1,1,1, # b8 - bf 1,1,1,1,1,1,1,1, # c0 - c7 1,1,1,1,1,1,1,1, # c8 - cf 1,1,1,1,1,1,1,1, # d0 - d7 1,1,1,1,1,1,1,1, # d8 - df 1,1,1,1,1,1,1,1, # e0 - e7 1,1,1,1,1,1,1,1, # e8 - ef 1,1,1,1,1,1,1,1, # f0 - f7 1,1,1,1,1,1,1,1, # f8 - ff ) HZ_ST = ( MachineState.START,MachineState.ERROR, 3,MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,# 00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 08-0f MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START, 4,MachineState.ERROR,# 10-17 5,MachineState.ERROR, 6,MachineState.ERROR, 5, 5, 4,MachineState.ERROR,# 18-1f 4,MachineState.ERROR, 4, 4, 4,MachineState.ERROR, 4,MachineState.ERROR,# 20-27 4,MachineState.ITS_ME,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 28-2f ) HZ_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0) HZ_SM_MODEL = {'class_table': HZ_CLS, 'class_factor': 6, 'state_table': HZ_ST, 'char_len_table': HZ_CHAR_LEN_TABLE, 'name': "HZ-GB-2312", 'language': 'Chinese'} ISO2022CN_CLS = ( 2,0,0,0,0,0,0,0, # 00 - 07 0,0,0,0,0,0,0,0, # 08 - 0f 0,0,0,0,0,0,0,0, # 10 - 17 0,0,0,1,0,0,0,0, # 18 - 1f 0,0,0,0,0,0,0,0, # 20 - 27 0,3,0,0,0,0,0,0, # 28 - 2f 0,0,0,0,0,0,0,0, # 30 - 37 0,0,0,0,0,0,0,0, # 38 - 3f 0,0,0,4,0,0,0,0, # 40 - 47 0,0,0,0,0,0,0,0, # 48 - 4f 0,0,0,0,0,0,0,0, # 50 - 57 0,0,0,0,0,0,0,0, # 58 - 5f 0,0,0,0,0,0,0,0, # 60 - 67 0,0,0,0,0,0,0,0, # 68 - 6f 0,0,0,0,0,0,0,0, # 70 - 77 0,0,0,0,0,0,0,0, # 78 - 7f 2,2,2,2,2,2,2,2, # 80 - 87 2,2,2,2,2,2,2,2, # 88 - 8f 2,2,2,2,2,2,2,2, # 90 - 97 2,2,2,2,2,2,2,2, # 98 - 9f 2,2,2,2,2,2,2,2, # a0 - a7 2,2,2,2,2,2,2,2, # a8 - af 2,2,2,2,2,2,2,2, # b0 - b7 2,2,2,2,2,2,2,2, # b8 - bf 2,2,2,2,2,2,2,2, # c0 - c7 2,2,2,2,2,2,2,2, # c8 - cf 2,2,2,2,2,2,2,2, # d0 - d7 2,2,2,2,2,2,2,2, # d8 - df 2,2,2,2,2,2,2,2, # e0 - e7 2,2,2,2,2,2,2,2, # e8 - ef 2,2,2,2,2,2,2,2, # f0 - f7 2,2,2,2,2,2,2,2, # f8 - ff ) ISO2022CN_ST = ( MachineState.START, 3,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 00-07 MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 08-0f MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 10-17 MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 4,MachineState.ERROR,# 18-1f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 20-27 5, 6,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 28-2f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 30-37 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.START,# 38-3f ) ISO2022CN_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0, 0, 0, 0) ISO2022CN_SM_MODEL = {'class_table': ISO2022CN_CLS, 'class_factor': 9, 'state_table': ISO2022CN_ST, 'char_len_table': ISO2022CN_CHAR_LEN_TABLE, 'name': "ISO-2022-CN", 'language': 'Chinese'} ISO2022JP_CLS = ( 2,0,0,0,0,0,0,0, # 00 - 07 0,0,0,0,0,0,2,2, # 08 - 0f 0,0,0,0,0,0,0,0, # 10 - 17 0,0,0,1,0,0,0,0, # 18 - 1f 0,0,0,0,7,0,0,0, # 20 - 27 3,0,0,0,0,0,0,0, # 28 - 2f 0,0,0,0,0,0,0,0, # 30 - 37 0,0,0,0,0,0,0,0, # 38 - 3f 6,0,4,0,8,0,0,0, # 40 - 47 0,9,5,0,0,0,0,0, # 48 - 4f 0,0,0,0,0,0,0,0, # 50 - 57 0,0,0,0,0,0,0,0, # 58 - 5f 0,0,0,0,0,0,0,0, # 60 - 67 0,0,0,0,0,0,0,0, # 68 - 6f 0,0,0,0,0,0,0,0, # 70 - 77 0,0,0,0,0,0,0,0, # 78 - 7f 2,2,2,2,2,2,2,2, # 80 - 87 2,2,2,2,2,2,2,2, # 88 - 8f 2,2,2,2,2,2,2,2, # 90 - 97 2,2,2,2,2,2,2,2, # 98 - 9f 2,2,2,2,2,2,2,2, # a0 - a7 2,2,2,2,2,2,2,2, # a8 - af 2,2,2,2,2,2,2,2, # b0 - b7 2,2,2,2,2,2,2,2, # b8 - bf 2,2,2,2,2,2,2,2, # c0 - c7 2,2,2,2,2,2,2,2, # c8 - cf 2,2,2,2,2,2,2,2, # d0 - d7 2,2,2,2,2,2,2,2, # d8 - df 2,2,2,2,2,2,2,2, # e0 - e7 2,2,2,2,2,2,2,2, # e8 - ef 2,2,2,2,2,2,2,2, # f0 - f7 2,2,2,2,2,2,2,2, # f8 - ff ) ISO2022JP_ST = ( MachineState.START, 3,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 00-07 MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 08-0f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 10-17 MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,# 18-1f MachineState.ERROR, 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 4,MachineState.ERROR,MachineState.ERROR,# 20-27 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 6,MachineState.ITS_ME,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,# 28-2f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,# 30-37 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 38-3f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.START,MachineState.START,# 40-47 ) ISO2022JP_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0) ISO2022JP_SM_MODEL = {'class_table': ISO2022JP_CLS, 'class_factor': 10, 'state_table': ISO2022JP_ST, 'char_len_table': ISO2022JP_CHAR_LEN_TABLE, 'name': "ISO-2022-JP", 'language': 'Japanese'} ISO2022KR_CLS = ( 2,0,0,0,0,0,0,0, # 00 - 07 0,0,0,0,0,0,0,0, # 08 - 0f 0,0,0,0,0,0,0,0, # 10 - 17 0,0,0,1,0,0,0,0, # 18 - 1f 0,0,0,0,3,0,0,0, # 20 - 27 0,4,0,0,0,0,0,0, # 28 - 2f 0,0,0,0,0,0,0,0, # 30 - 37 0,0,0,0,0,0,0,0, # 38 - 3f 0,0,0,5,0,0,0,0, # 40 - 47 0,0,0,0,0,0,0,0, # 48 - 4f 0,0,0,0,0,0,0,0, # 50 - 57 0,0,0,0,0,0,0,0, # 58 - 5f 0,0,0,0,0,0,0,0, # 60 - 67 0,0,0,0,0,0,0,0, # 68 - 6f 0,0,0,0,0,0,0,0, # 70 - 77 0,0,0,0,0,0,0,0, # 78 - 7f 2,2,2,2,2,2,2,2, # 80 - 87 2,2,2,2,2,2,2,2, # 88 - 8f 2,2,2,2,2,2,2,2, # 90 - 97 2,2,2,2,2,2,2,2, # 98 - 9f 2,2,2,2,2,2,2,2, # a0 - a7 2,2,2,2,2,2,2,2, # a8 - af 2,2,2,2,2,2,2,2, # b0 - b7 2,2,2,2,2,2,2,2, # b8 - bf 2,2,2,2,2,2,2,2, # c0 - c7 2,2,2,2,2,2,2,2, # c8 - cf 2,2,2,2,2,2,2,2, # d0 - d7 2,2,2,2,2,2,2,2, # d8 - df 2,2,2,2,2,2,2,2, # e0 - e7 2,2,2,2,2,2,2,2, # e8 - ef 2,2,2,2,2,2,2,2, # f0 - f7 2,2,2,2,2,2,2,2, # f8 - ff ) ISO2022KR_ST = ( MachineState.START, 3,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,# 00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 08-0f MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 4,MachineState.ERROR,MachineState.ERROR,# 10-17 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 18-1f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 20-27 ) ISO2022KR_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0) ISO2022KR_SM_MODEL = {'class_table': ISO2022KR_CLS, 'class_factor': 6, 'state_table': ISO2022KR_ST, 'char_len_table': ISO2022KR_CHAR_LEN_TABLE, 'name': "ISO-2022-KR", 'language': 'Korean'} site-packages/pip/_vendor/chardet/escsm.pyc000064400000017517147204247350014774 0ustar00 abc@sddlmZdZejejdejejejejejejejejejejejejejejejejejejejdejdejdejdddejdejdddejdejdejejejejejejejf0ZdZied6dd 6ed 6ed 6d d 6dd6ZdZ ejdejejejejejejejejejejejejejejejejejejejejejejejejejejejejdejejejejejejejejejddejejejejejejejejejejejejejejejejejejejejejejf@Z dZ ie d6dd 6e d 6e d 6dd 6dd6Z dZ ejdejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejdejejejdejejejejejdejejejejejejejejejejejejejejejejejejejejejejejejejejejejfHZdZie d6dd 6ed 6ed 6dd 6dd6Zd Zejdejejejejejejejejejejejejejejejejejejejdejejejejejejdejejejejejejejejejejejf(Zd!Zied6dd 6ed 6ed 6dd 6dd6ZdS("i(t MachineStateiiiiiit class_tablet class_factort state_tabletchar_len_tables HZ-GB-2312tnametChinesetlanguagei s ISO-2022-CNiii s ISO-2022-JPtJapaneses ISO-2022-KRtKoreanN(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(iiiiii(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii( iiiiiiiii(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii( iiiiiiiiii(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(iiiiii(tenumsRtHZ_CLStSTARTtERRORtITS_MEtHZ_STtHZ_CHAR_LEN_TABLEt HZ_SM_MODELt ISO2022CN_CLSt ISO2022CN_STtISO2022CN_CHAR_LEN_TABLEtISO2022CN_SM_MODELt ISO2022JP_CLSt ISO2022JP_STtISO2022JP_CHAR_LEN_TABLEtISO2022JP_SM_MODELt ISO2022KR_CLSt ISO2022KR_STtISO2022KR_CHAR_LEN_TABLEtISO2022KR_SM_MODEL(((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escsm.pytsp-0-!!3  -00-0*06  -000*-006  -0--6 site-packages/pip/_vendor/chardet/escsm.pyo000064400000017517147204247350015010 0ustar00 abc@sddlmZdZejejdejejejejejejejejejejejejejejejejejejejdejdejdejdddejdejdddejdejdejejejejejejejf0ZdZied6dd 6ed 6ed 6d d 6dd6ZdZ ejdejejejejejejejejejejejejejejejejejejejejejejejejejejejejdejejejejejejejejejddejejejejejejejejejejejejejejejejejejejejejejf@Z dZ ie d6dd 6e d 6e d 6dd 6dd6Z dZ ejdejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejdejejejdejejejejejdejejejejejejejejejejejejejejejejejejejejejejejejejejejejfHZdZie d6dd 6ed 6ed 6dd 6dd6Zd Zejdejejejejejejejejejejejejejejejejejejejdejejejejejejdejejejejejejejejejejejf(Zd!Zied6dd 6ed 6ed 6dd 6dd6ZdS("i(t MachineStateiiiiiit class_tablet class_factort state_tabletchar_len_tables HZ-GB-2312tnametChinesetlanguagei s ISO-2022-CNiii s ISO-2022-JPtJapaneses ISO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iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(iiiiii(tenumsRtHZ_CLStSTARTtERRORtITS_MEtHZ_STtHZ_CHAR_LEN_TABLEt HZ_SM_MODELt ISO2022CN_CLSt ISO2022CN_STtISO2022CN_CHAR_LEN_TABLEtISO2022CN_SM_MODELt ISO2022JP_CLSt ISO2022JP_STtISO2022JP_CHAR_LEN_TABLEtISO2022JP_SM_MODELt ISO2022KR_CLSt ISO2022KR_STtISO2022KR_CHAR_LEN_TABLEtISO2022KR_SM_MODEL(((s=/usr/lib/python2.7/site-packages/pip/_vendor/chardet/escsm.pytsp-0-!!3  -00-0*06  -000*-006  -0--6 site-packages/pip/_vendor/chardet/eucjpprober.py000064400000007245147204247350016034 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .enums import ProbingState, MachineState from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import EUCJPDistributionAnalysis from .jpcntx import EUCJPContextAnalysis from .mbcssm import EUCJP_SM_MODEL class EUCJPProber(MultiByteCharSetProber): def __init__(self): super(EUCJPProber, self).__init__() self.coding_sm = CodingStateMachine(EUCJP_SM_MODEL) self.distribution_analyzer = EUCJPDistributionAnalysis() self.context_analyzer = EUCJPContextAnalysis() self.reset() def reset(self): super(EUCJPProber, self).reset() self.context_analyzer.reset() @property def charset_name(self): return "EUC-JP" @property def language(self): return "Japanese" def feed(self, byte_str): for i in range(len(byte_str)): # PY3K: byte_str is a byte array, so byte_str[i] is an int, not a byte coding_state = self.coding_sm.next_state(byte_str[i]) if coding_state == MachineState.ERROR: self.logger.debug('%s %s prober hit error at byte %s', self.charset_name, self.language, i) self._state = ProbingState.NOT_ME break elif coding_state == MachineState.ITS_ME: self._state = ProbingState.FOUND_IT break elif coding_state == MachineState.START: char_len = self.coding_sm.get_current_charlen() if i == 0: self._last_char[1] = byte_str[0] self.context_analyzer.feed(self._last_char, char_len) self.distribution_analyzer.feed(self._last_char, char_len) else: self.context_analyzer.feed(byte_str[i - 1:i + 1], char_len) self.distribution_analyzer.feed(byte_str[i - 1:i + 1], char_len) self._last_char[0] = byte_str[-1] if self.state == ProbingState.DETECTING: if (self.context_analyzer.got_enough_data() and (self.get_confidence() > self.SHORTCUT_THRESHOLD)): self._state = ProbingState.FOUND_IT return self.state def get_confidence(self): context_conf = self.context_analyzer.get_confidence() distrib_conf = self.distribution_analyzer.get_confidence() return max(context_conf, distrib_conf) site-packages/pip/_vendor/chardet/eucjpprober.pyo000064400000005746147204247350016217 0ustar00 abc@sddlmZmZddlmZddlmZddlmZddl m Z ddl m Z defdYZ d S( i(t ProbingStatet MachineState(tMultiByteCharSetProber(tCodingStateMachine(tEUCJPDistributionAnalysis(tEUCJPContextAnalysis(tEUCJP_SM_MODELt EUCJPProbercBsJeZdZdZedZedZdZdZRS(cCsHtt|jtt|_t|_t|_ |j dS(N( tsuperRt__init__RRt coding_smRtdistribution_analyzerRtcontext_analyzertreset(tself((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pyR %s   cCs$tt|j|jjdS(N(RRR R (R((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pyR ,scCsdS(NsEUC-JP((R((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pyt charset_name0scCsdS(NtJapanese((R((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pytlanguage4scCsx>tt|D]*}|jj||}|tjkrm|jjd|j|j |t j |_ Pq|tj krt j|_ Pq|tjkr|jj}|dkr|d|jd<|jj|j||jj|j|q=|jj||d|d!||jj||d|d!|qqW|d|jd<|jt jkr|jjr|j|jkrt j|_ qn|jS(Ns!%s %s prober hit error at byte %siii(trangetlenR t next_stateRtERRORtloggertdebugRRRtNOT_MEt_statetITS_MEtFOUND_ITtSTARTtget_current_charlent _last_charR tfeedR tstatet DETECTINGtgot_enough_datatget_confidencetSHORTCUT_THRESHOLD(Rtbyte_strtit coding_statetchar_len((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pyR8s4    cCs+|jj}|jj}t||S(N(R R#R tmax(Rt context_conft distrib_conf((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pyR#Ys( t__name__t __module__R R tpropertyRRRR#(((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pyR$s    !N(tenumsRRtmbcharsetproberRtcodingstatemachineRtchardistributionRtjpcntxRtmbcssmRR(((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/eucjpprober.pyts site-packages/pip/_vendor/chardet/euckrfreq.py000064400000032352147204247350015500 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # Sampling from about 20M text materials include literature and computer technology # 128 --> 0.79 # 256 --> 0.92 # 512 --> 0.986 # 1024 --> 0.99944 # 2048 --> 0.99999 # # Idea Distribution Ratio = 0.98653 / (1-0.98653) = 73.24 # Random Distribution Ration = 512 / (2350-512) = 0.279. # # Typical Distribution Ratio EUCKR_TYPICAL_DISTRIBUTION_RATIO = 6.0 EUCKR_TABLE_SIZE = 2352 # Char to FreqOrder table , EUCKR_CHAR_TO_FREQ_ORDER = ( 13, 130, 120,1396, 481,1719,1720, 328, 609, 212,1721, 707, 400, 299,1722, 87, 1397,1723, 104, 536,1117,1203,1724,1267, 685,1268, 508,1725,1726,1727,1728,1398, 1399,1729,1730,1731, 141, 621, 326,1057, 368,1732, 267, 488, 20,1733,1269,1734, 945,1400,1735, 47, 904,1270,1736,1737, 773, 248,1738, 409, 313, 786, 429,1739, 116, 987, 813,1401, 683, 75,1204, 145,1740,1741,1742,1743, 16, 847, 667, 622, 708,1744,1745,1746, 966, 787, 304, 129,1747, 60, 820, 123, 676,1748,1749,1750, 1751, 617,1752, 626,1753,1754,1755,1756, 653,1757,1758,1759,1760,1761,1762, 856, 344,1763,1764,1765,1766, 89, 401, 418, 806, 905, 848,1767,1768,1769, 946,1205, 709,1770,1118,1771, 241,1772,1773,1774,1271,1775, 569,1776, 999,1777,1778,1779, 1780, 337, 751,1058, 28, 628, 254,1781, 177, 906, 270, 349, 891,1079,1782, 19, 1783, 379,1784, 315,1785, 629, 754,1402, 559,1786, 636, 203,1206,1787, 710, 567, 1788, 935, 814,1789,1790,1207, 766, 528,1791,1792,1208,1793,1794,1795,1796,1797, 1403,1798,1799, 533,1059,1404,1405,1156,1406, 936, 884,1080,1800, 351,1801,1802, 1803,1804,1805, 801,1806,1807,1808,1119,1809,1157, 714, 474,1407,1810, 298, 899, 885,1811,1120, 802,1158,1812, 892,1813,1814,1408, 659,1815,1816,1121,1817,1818, 1819,1820,1821,1822, 319,1823, 594, 545,1824, 815, 937,1209,1825,1826, 573,1409, 1022,1827,1210,1828,1829,1830,1831,1832,1833, 556, 722, 807,1122,1060,1834, 697, 1835, 900, 557, 715,1836,1410, 540,1411, 752,1159, 294, 597,1211, 976, 803, 770, 1412,1837,1838, 39, 794,1413, 358,1839, 371, 925,1840, 453, 661, 788, 531, 723, 544,1023,1081, 869, 91,1841, 392, 430, 790, 602,1414, 677,1082, 457,1415,1416, 1842,1843, 475, 327,1024,1417, 795, 121,1844, 733, 403,1418,1845,1846,1847, 300, 119, 711,1212, 627,1848,1272, 207,1849,1850, 796,1213, 382,1851, 519,1852,1083, 893,1853,1854,1855, 367, 809, 487, 671,1856, 663,1857,1858, 956, 471, 306, 857, 1859,1860,1160,1084,1861,1862,1863,1864,1865,1061,1866,1867,1868,1869,1870,1871, 282, 96, 574,1872, 502,1085,1873,1214,1874, 907,1875,1876, 827, 977,1419,1420, 1421, 268,1877,1422,1878,1879,1880, 308,1881, 2, 537,1882,1883,1215,1884,1885, 127, 791,1886,1273,1423,1887, 34, 336, 404, 643,1888, 571, 654, 894, 840,1889, 0, 886,1274, 122, 575, 260, 908, 938,1890,1275, 410, 316,1891,1892, 100,1893, 1894,1123, 48,1161,1124,1025,1895, 633, 901,1276,1896,1897, 115, 816,1898, 317, 1899, 694,1900, 909, 734,1424, 572, 866,1425, 691, 85, 524,1010, 543, 394, 841, 1901,1902,1903,1026,1904,1905,1906,1907,1908,1909, 30, 451, 651, 988, 310,1910, 1911,1426, 810,1216, 93,1912,1913,1277,1217,1914, 858, 759, 45, 58, 181, 610, 269,1915,1916, 131,1062, 551, 443,1000, 821,1427, 957, 895,1086,1917,1918, 375, 1919, 359,1920, 687,1921, 822,1922, 293,1923,1924, 40, 662, 118, 692, 29, 939, 887, 640, 482, 174,1925, 69,1162, 728,1428, 910,1926,1278,1218,1279, 386, 870, 217, 854,1163, 823,1927,1928,1929,1930, 834,1931, 78,1932, 859,1933,1063,1934, 1935,1936,1937, 438,1164, 208, 595,1938,1939,1940,1941,1219,1125,1942, 280, 888, 1429,1430,1220,1431,1943,1944,1945,1946,1947,1280, 150, 510,1432,1948,1949,1950, 1951,1952,1953,1954,1011,1087,1955,1433,1043,1956, 881,1957, 614, 958,1064,1065, 1221,1958, 638,1001, 860, 967, 896,1434, 989, 492, 553,1281,1165,1959,1282,1002, 1283,1222,1960,1961,1962,1963, 36, 383, 228, 753, 247, 454,1964, 876, 678,1965, 1966,1284, 126, 464, 490, 835, 136, 672, 529, 940,1088,1435, 473,1967,1968, 467, 50, 390, 227, 587, 279, 378, 598, 792, 968, 240, 151, 160, 849, 882,1126,1285, 639,1044, 133, 140, 288, 360, 811, 563,1027, 561, 142, 523,1969,1970,1971, 7, 103, 296, 439, 407, 506, 634, 990,1972,1973,1974,1975, 645,1976,1977,1978,1979, 1980,1981, 236,1982,1436,1983,1984,1089, 192, 828, 618, 518,1166, 333,1127,1985, 818,1223,1986,1987,1988,1989,1990,1991,1992,1993, 342,1128,1286, 746, 842,1994, 1995, 560, 223,1287, 98, 8, 189, 650, 978,1288,1996,1437,1997, 17, 345, 250, 423, 277, 234, 512, 226, 97, 289, 42, 167,1998, 201,1999,2000, 843, 836, 824, 532, 338, 783,1090, 182, 576, 436,1438,1439, 527, 500,2001, 947, 889,2002,2003, 2004,2005, 262, 600, 314, 447,2006, 547,2007, 693, 738,1129,2008, 71,1440, 745, 619, 688,2009, 829,2010,2011, 147,2012, 33, 948,2013,2014, 74, 224,2015, 61, 191, 918, 399, 637,2016,1028,1130, 257, 902,2017,2018,2019,2020,2021,2022,2023, 2024,2025,2026, 837,2027,2028,2029,2030, 179, 874, 591, 52, 724, 246,2031,2032, 2033,2034,1167, 969,2035,1289, 630, 605, 911,1091,1168,2036,2037,2038,1441, 912, 2039, 623,2040,2041, 253,1169,1290,2042,1442, 146, 620, 611, 577, 433,2043,1224, 719,1170, 959, 440, 437, 534, 84, 388, 480,1131, 159, 220, 198, 679,2044,1012, 819,1066,1443, 113,1225, 194, 318,1003,1029,2045,2046,2047,2048,1067,2049,2050, 2051,2052,2053, 59, 913, 112,2054, 632,2055, 455, 144, 739,1291,2056, 273, 681, 499,2057, 448,2058,2059, 760,2060,2061, 970, 384, 169, 245,1132,2062,2063, 414, 1444,2064,2065, 41, 235,2066, 157, 252, 877, 568, 919, 789, 580,2067, 725,2068, 2069,1292,2070,2071,1445,2072,1446,2073,2074, 55, 588, 66,1447, 271,1092,2075, 1226,2076, 960,1013, 372,2077,2078,2079,2080,2081,1293,2082,2083,2084,2085, 850, 2086,2087,2088,2089,2090, 186,2091,1068, 180,2092,2093,2094, 109,1227, 522, 606, 2095, 867,1448,1093, 991,1171, 926, 353,1133,2096, 581,2097,2098,2099,1294,1449, 1450,2100, 596,1172,1014,1228,2101,1451,1295,1173,1229,2102,2103,1296,1134,1452, 949,1135,2104,2105,1094,1453,1454,1455,2106,1095,2107,2108,2109,2110,2111,2112, 2113,2114,2115,2116,2117, 804,2118,2119,1230,1231, 805,1456, 405,1136,2120,2121, 2122,2123,2124, 720, 701,1297, 992,1457, 927,1004,2125,2126,2127,2128,2129,2130, 22, 417,2131, 303,2132, 385,2133, 971, 520, 513,2134,1174, 73,1096, 231, 274, 962,1458, 673,2135,1459,2136, 152,1137,2137,2138,2139,2140,1005,1138,1460,1139, 2141,2142,2143,2144, 11, 374, 844,2145, 154,1232, 46,1461,2146, 838, 830, 721, 1233, 106,2147, 90, 428, 462, 578, 566,1175, 352,2148,2149, 538,1234, 124,1298, 2150,1462, 761, 565,2151, 686,2152, 649,2153, 72, 173,2154, 460, 415,2155,1463, 2156,1235, 305,2157,2158,2159,2160,2161,2162, 579,2163,2164,2165,2166,2167, 747, 2168,2169,2170,2171,1464, 669,2172,2173,2174,2175,2176,1465,2177, 23, 530, 285, 2178, 335, 729,2179, 397,2180,2181,2182,1030,2183,2184, 698,2185,2186, 325,2187, 2188, 369,2189, 799,1097,1015, 348,2190,1069, 680,2191, 851,1466,2192,2193, 10, 2194, 613, 424,2195, 979, 108, 449, 589, 27, 172, 81,1031, 80, 774, 281, 350, 1032, 525, 301, 582,1176,2196, 674,1045,2197,2198,1467, 730, 762,2199,2200,2201, 2202,1468,2203, 993,2204,2205, 266,1070, 963,1140,2206,2207,2208, 664,1098, 972, 2209,2210,2211,1177,1469,1470, 871,2212,2213,2214,2215,2216,1471,2217,2218,2219, 2220,2221,2222,2223,2224,2225,2226,2227,1472,1236,2228,2229,2230,2231,2232,2233, 2234,2235,1299,2236,2237, 200,2238, 477, 373,2239,2240, 731, 825, 777,2241,2242, 2243, 521, 486, 548,2244,2245,2246,1473,1300, 53, 549, 137, 875, 76, 158,2247, 1301,1474, 469, 396,1016, 278, 712,2248, 321, 442, 503, 767, 744, 941,1237,1178, 1475,2249, 82, 178,1141,1179, 973,2250,1302,2251, 297,2252,2253, 570,2254,2255, 2256, 18, 450, 206,2257, 290, 292,1142,2258, 511, 162, 99, 346, 164, 735,2259, 1476,1477, 4, 554, 343, 798,1099,2260,1100,2261, 43, 171,1303, 139, 215,2262, 2263, 717, 775,2264,1033, 322, 216,2265, 831,2266, 149,2267,1304,2268,2269, 702, 1238, 135, 845, 347, 309,2270, 484,2271, 878, 655, 238,1006,1478,2272, 67,2273, 295,2274,2275, 461,2276, 478, 942, 412,2277,1034,2278,2279,2280, 265,2281, 541, 2282,2283,2284,2285,2286, 70, 852,1071,2287,2288,2289,2290, 21, 56, 509, 117, 432,2291,2292, 331, 980, 552,1101, 148, 284, 105, 393,1180,1239, 755,2293, 187, 2294,1046,1479,2295, 340,2296, 63,1047, 230,2297,2298,1305, 763,1306, 101, 800, 808, 494,2299,2300,2301, 903,2302, 37,1072, 14, 5,2303, 79, 675,2304, 312, 2305,2306,2307,2308,2309,1480, 6,1307,2310,2311,2312, 1, 470, 35, 24, 229, 2313, 695, 210, 86, 778, 15, 784, 592, 779, 32, 77, 855, 964,2314, 259,2315, 501, 380,2316,2317, 83, 981, 153, 689,1308,1481,1482,1483,2318,2319, 716,1484, 2320,2321,2322,2323,2324,2325,1485,2326,2327, 128, 57, 68, 261,1048, 211, 170, 1240, 31,2328, 51, 435, 742,2329,2330,2331, 635,2332, 264, 456,2333,2334,2335, 425,2336,1486, 143, 507, 263, 943,2337, 363, 920,1487, 256,1488,1102, 243, 601, 1489,2338,2339,2340,2341,2342,2343,2344, 861,2345,2346,2347,2348,2349,2350, 395, 2351,1490,1491, 62, 535, 166, 225,2352,2353, 668, 419,1241, 138, 604, 928,2354, 1181,2355,1492,1493,2356,2357,2358,1143,2359, 696,2360, 387, 307,1309, 682, 476, 2361,2362, 332, 12, 222, 156,2363, 232,2364, 641, 276, 656, 517,1494,1495,1035, 416, 736,1496,2365,1017, 586,2366,2367,2368,1497,2369, 242,2370,2371,2372,1498, 2373, 965, 713,2374,2375,2376,2377, 740, 982,1499, 944,1500,1007,2378,2379,1310, 1501,2380,2381,2382, 785, 329,2383,2384,1502,2385,2386,2387, 932,2388,1503,2389, 2390,2391,2392,1242,2393,2394,2395,2396,2397, 994, 950,2398,2399,2400,2401,1504, 1311,2402,2403,2404,2405,1049, 749,2406,2407, 853, 718,1144,1312,2408,1182,1505, 2409,2410, 255, 516, 479, 564, 550, 214,1506,1507,1313, 413, 239, 444, 339,1145, 1036,1508,1509,1314,1037,1510,1315,2411,1511,2412,2413,2414, 176, 703, 497, 624, 593, 921, 302,2415, 341, 165,1103,1512,2416,1513,2417,2418,2419, 376,2420, 700, 2421,2422,2423, 258, 768,1316,2424,1183,2425, 995, 608,2426,2427,2428,2429, 221, 2430,2431,2432,2433,2434,2435,2436,2437, 195, 323, 726, 188, 897, 983,1317, 377, 644,1050, 879,2438, 452,2439,2440,2441,2442,2443,2444, 914,2445,2446,2447,2448, 915, 489,2449,1514,1184,2450,2451, 515, 64, 427, 495,2452, 583,2453, 483, 485, 1038, 562, 213,1515, 748, 666,2454,2455,2456,2457, 334,2458, 780, 996,1008, 705, 1243,2459,2460,2461,2462,2463, 114,2464, 493,1146, 366, 163,1516, 961,1104,2465, 291,2466,1318,1105,2467,1517, 365,2468, 355, 951,1244,2469,1319,2470, 631,2471, 2472, 218,1320, 364, 320, 756,1518,1519,1321,1520,1322,2473,2474,2475,2476, 997, 2477,2478,2479,2480, 665,1185,2481, 916,1521,2482,2483,2484, 584, 684,2485,2486, 797,2487,1051,1186,2488,2489,2490,1522,2491,2492, 370,2493,1039,1187, 65,2494, 434, 205, 463,1188,2495, 125, 812, 391, 402, 826, 699, 286, 398, 155, 781, 771, 585,2496, 590, 505,1073,2497, 599, 244, 219, 917,1018, 952, 646,1523,2498,1323, 2499,2500, 49, 984, 354, 741,2501, 625,2502,1324,2503,1019, 190, 357, 757, 491, 95, 782, 868,2504,2505,2506,2507,2508,2509, 134,1524,1074, 422,1525, 898,2510, 161,2511,2512,2513,2514, 769,2515,1526,2516,2517, 411,1325,2518, 472,1527,2519, 2520,2521,2522,2523,2524, 985,2525,2526,2527,2528,2529,2530, 764,2531,1245,2532, 2533, 25, 204, 311,2534, 496,2535,1052,2536,2537,2538,2539,2540,2541,2542, 199, 704, 504, 468, 758, 657,1528, 196, 44, 839,1246, 272, 750,2543, 765, 862,2544, 2545,1326,2546, 132, 615, 933,2547, 732,2548,2549,2550,1189,1529,2551, 283,1247, 1053, 607, 929,2552,2553,2554, 930, 183, 872, 616,1040,1147,2555,1148,1020, 441, 249,1075,2556,2557,2558, 466, 743,2559,2560,2561, 92, 514, 426, 420, 526,2562, 2563,2564,2565,2566,2567,2568, 185,2569,2570,2571,2572, 776,1530, 658,2573, 362, 2574, 361, 922,1076, 793,2575,2576,2577,2578,2579,2580,1531, 251,2581,2582,2583, 2584,1532, 54, 612, 237,1327,2585,2586, 275, 408, 647, 111,2587,1533,1106, 465, 3, 458, 9, 38,2588, 107, 110, 890, 209, 26, 737, 498,2589,1534,2590, 431, 202, 88,1535, 356, 287,1107, 660,1149,2591, 381,1536, 986,1150, 445,1248,1151, 974,2592,2593, 846,2594, 446, 953, 184,1249,1250, 727,2595, 923, 193, 883,2596, 2597,2598, 102, 324, 539, 817,2599, 421,1041,2600, 832,2601, 94, 175, 197, 406, 2602, 459,2603,2604,2605,2606,2607, 330, 555,2608,2609,2610, 706,1108, 389,2611, 2612,2613,2614, 233,2615, 833, 558, 931, 954,1251,2616,2617,1537, 546,2618,2619, 1009,2620,2621,2622,1538, 690,1328,2623, 955,2624,1539,2625,2626, 772,2627,2628, 2629,2630,2631, 924, 648, 863, 603,2632,2633, 934,1540, 864, 865,2634, 642,1042, 670,1190,2635,2636,2637,2638, 168,2639, 652, 873, 542,1054,1541,2640,2641,2642, # 512, 256 ) site-packages/pip/_vendor/chardet/euckrfreq.pyo000064400000057027147204247350015665 0ustar00 abc0 @sdZdZd2 Zd1 S(3 g@i0 i iixitiiiiHiaiiiii+iiWiuiihii]iiiiiiiiiiiviwiiiiimiFi!ipii iiiiiiixii/iiiiiiiii9iiiitii-iyiiKiiiiiiiiOiiniiiiiii0iii<i4i{iiiiiiiiiriiiiiiiiiiiiXiXiiiiiYiii&iiPiiiiiiii^iiiiiiii9iiiiiiiQii"iitiiiiii]i{i7iiii{ii;iiuiizi/ii|iiiii7iii.iiiiiiiiiiiiii{iiii#i|i}ii~iiti8ii_i i i i i i!iiii_iiiiiii*iiuii`i"iii|iiiiiiiaiiiiiii?iiRi!i i/iii!i"i=iii#ii$i%i&i'i(i)i,ii'ibi$i*ii+ii-ii,iiiiii&iUiii#iii-i.i'iiifi/isii0iiiiii ii9iei[i1iiiiZiii:iiii2i3iiGiiiiyi4iiii5i6i7i,iwiiisi8iii9i:iii~i;ii<i;i}i=i>i?ioi)iii@iiAiBiii2iYiCiDii<iEiFiGiHiIi%iJiKiLiMiNiOii`i>iPii=iQiiRiiSiTi;iiiii iUiiViWiXi4iYiiiZi[ii\i]iii^iii_i"iPiii`i;ii~iHiaiiviizi?iiiibiii<icididieifici0iidiigiyiiihiiisi0iji=ikiiliiii<ibiiiUi iiiiIiminioiipiqirisitiuiiiii6iviwii*ii]ixiyiiiziZii-i:iibi i{i|ii&i'iii5iiii>i}i~iwiigiiii6ii%iii(iiviiiiwiiiiiEiiiiiiiiiifiiVii7iiiiiBiiNii[ii'iiiiiiiiSiiiiiieiiixiiiiiiiiiiiiiiiiiiiiii?iiiiiqiifii(i)iii~ii\iiiiii)iiiiiiiiiiii$iiiiiiiliiiii~iiiCiiiii@iiiiii2iiiKiiziViiiiiiQirifiiiiii ihi+i3ii1ii iiiiigi(iiiiziiiiiiiiiiiiiiiiiiAii<ijiiiMigii2iiiiiiiiiiVihiiiJiii0iiibiiiiiiiiiiYiiiiiiiai!i*iiiiiiKiDi8iiRiiBii@iiiiiiiiyiiiiiiXi:iii#iiiiiiiGiiikiii=iiiii!iiiiJiii=iiii}iiijiiiiiiiiiiiiiEiiiiiijiOi4iiiiiiiiii ivi]iiCiiiiiiiioiiiii iiiiliciAiiiiiiiiiiTiiikiiiiiii3i*iiqiii>iiiiiii+iiiiii;iipiixiiiii iiiii ii i ii i iiiiiliiiiiii)iiiiimi8iiiDiiiii iiiiiiii7iLiBiiiDiiiiiitiiii i!i i"i#i$i%iRi&i'i(i)i*ii+i,ii,i-i.imii i^i/iciiEiiiiaimi0iEi1i2i3iiii4iTiiii5iiiii6i7iiniiioi8i9iFiiii:iGi;i<i=i>i?i@iAiBiCiDiEi$iFiGiii%iiipiHiIiJiKiLiiiiiiiiMiNiOiPiQiRiiiSi/iTiiUiiiiViiIiHiiiiiiWiiXiiqiYiZi[i\iiriisi]i^i_i`i iviLiaiii.iibiFi>iiijiciZiiiBi6ii`idieiii|iifiii5igiihiiiiHiijiiikiilii1iminioipiqiriCisitiuiviwiixiyizi{iii|i}i~iiiiiiiiiOiiiiiiiiiiiiiEiiiqiiiIii\ii-iiiSiiii iieiiiiliiMiiiQiiPiii^ii i-iFiiiiiiiiiiiiiiiiiii i.iitiiiiiJiiiiiiiigiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiuiiii9i iiii ii$iiiiii5i%iikiLiiiiiiiiiiiAiiiiiiiiiiRiiuiiiiii)iii:iiiiiiii"i$iviiiiciZiiiiiii*iWiiKiiLii+iiiiiiiiii iBiii?iiiiiiiiiiMi[i5iiiiniiiiiiCii'iiiiiiiii iiii iiiiiiiiFiTi/iiiiii8iiuiiiiKii(iMiiiiiiiiiiiiiiiTii?iiiiiiiiei i(iiiiiii%i0iiiiOii i8i i i i i iiii i i iii#iii iiiVi iiiPi i iMiWii ii ii|i i iSiiiiiiii i iii i i i i i ii i ii9iDiiiiiii i3iii i i i{i iii i i ii iiiiii! ikiiiiiNiiYii" i# i$ i% i& i' i( i]i) i* i+ i, i- i. ii/ iii>iiii1 iiiii\ii2 ii3 iii4 i5 i6 iwi7 ii8 ii3iiii9 i: iLi iii; ii< iiiiiii iiii= iiJi> i? i@ iiA iiB iC iD iiE iiiF iG iH iI iiiiiiiJ iK iiiL iM iN iiIiO iP iiQ iR iS iiT iiU iV iW iX iiY iZ i[ i\ i] iii^ i_ i` ia iiib ic id ie iiif ig iUiixi ih iiii ij iiii4i&iiii!iiiiSiyi iii"i ii#ik iil im in iiiipiQii.io iUiiOiip iiq ir is ixit iiu iv iw iii$ix iiy ii`iz i{ i| i} ii~ i i i i i i i iiCiiiii%iyiiioi ii i i i i i ii i i i iii iii i ii@iii iGi iiii2iiiii i i i iNi i iiiii i i i i iri iiziniiiiPi i#i i&iQi iimi iciii i'i iwi i ii(ili@iiii)ii*i i i i ii i i i iii iii i i iHii i ii iii i i ii i iri iiiAi iiiii i}i,iii:iiiii iiIi iNii1i iWiiiiiiii i+i i i1iibii iqi i,i iiieiii_iidi i i i i i iii2iiii ii i i i ii ii i ii-i iii i i i i i ii i i i i i ii ii i iii7i ii ii i i i i i i iiiiiiiii,iGiiii ii^i i i.i iigii ii i i iii iiii_ii i i iiihihii{i i|iiii3i i i iii i i i\iiiii i i i i i i ii i i i iiii iji iiii4ii i i i i i iii i i i ii6idii/i i iiiioi iiRiiii i&i ikiniziiiii ii iiiXiidiiSii}i i}iii~iiiii i! iNi" iiiiiii# iiisi$ i% i& ifiDii1i' iii( i@i) i^iiii* ii+ i, i- i. i/ iJi+i0 i1 i2 iiTii3 i4 i5 i6 ii7 iAi.iiii8 i9 ii"i: i; ii< i= i> iii0i? ii@ iiA iB iiC iD iE iF iG iii_i[iH iI iii`iaiJ iiiiiK iL iM iN iiO iiiiiiiP iQ iR N(0 i iixitiiiiHiaiiiii+iiWiuiihii]iiiiiiiiiiiviwiiiiimiFi!ipii iiiiiiixii/iiiiiiiii9iiiitii-iyiiKiiiiiiiiOiiniiiiiii0iii<i4i{iiiiiiiiiriiiiiiiiiiiiXiXiiiiiYiii&iiPiiiiiiii^iiiiiiii9iiiiiiiQii"iitiiiiii]i{i7iiii{ii;iiuiizi/ii|iiiii7iii.iiiiiiiiiiiiii{iiii#i|i}ii~iiti8ii_i i i i i i!iiii_iiiiiii*iiuii`i"iii|iiiiiiiaiiiiiii?iiRi!i i/iii!i"i=iii#ii$i%i&i'i(i)i,ii'ibi$i*ii+ii-ii,iiiiii&iUiii#iii-i.i'iiifi/isii0iiiiii ii9iei[i1iiiiZiii:iiii2i3iiGiiiiyi4iiii5i6i7i,iwiiisi8iii9i:iii~i;ii<i;i}i=i>i?ioi)iii@iiAiBiii2iYiCiDii<iEiFiGiHiIi%iJiKiLiMiNiOii`i>iPii=iQiiRiiSiTi;iiiii iUiiViWiXi4iYiiiZi[ii\i]iii^iii_i"iPiii`i;ii~iHiaiiviizi?iiiibiii<icididieifici0iidiigiyiiihiiisi0iji=ikiiliiii<ibiiiUi iiiiIiminioiipiqirisitiuiiiii6iviwii*ii]ixiyiiiziZii-i:iibi i{i|ii&i'iii5iiii>i}i~iwiigiiii6ii%iii(iiviiiiwiiiiiEiiiiiiiiiifiiVii7iiiiiBiiNii[ii'iiiiiiiiSiiiiiieiiixiiiiiiiiiiiiiiiiiiiiii?iiiiiqiifii(i)iii~ii\iiiiii)iiiiiiiiiiii$iiiiiiiliiiii~iiiCiiiii@iiiiii2iiiKiiziViiiiiiQirifiiiiii ihi+i3ii1ii iiiiigi(iiiiziiiiiiiiiiiiiiiiiiAii<ijiiiMigii2iiiiiiiiiiVihiiiJiii0iiibiiiiiiiiiiYiiiiiiiai!i*iiiiiiKiDi8iiRiiBii@iiiiiiiiyiiiiiiXi:iii#iiiiiiiGiiikiii=iiiii!iiiiJiii=iiii}iiijiiiiiiiiiiiiiEiiiiiijiOi4iiiiiiiiii ivi]iiCiiiiiiiioiiiii iiiiliciAiiiiiiiiiiTiiikiiiiiii3i*iiqiii>iiiiiii+iiiiii;iipiixiiiii iiiii ii i ii i iiiiiliiiiiii)iiiiimi8iiiDiiiii iiiiiiii7iLiBiiiDiiiiiitiiii i!i i"i#i$i%iRi&i'i(i)i*ii+i,ii,i-i.imii i^i/iciiEiiiiaimi0iEi1i2i3iiii4iTiiii5iiiii6i7iiniiioi8i9iFiiii:iGi;i<i=i>i?i@iAiBiCiDiEi$iFiGiii%iiipiHiIiJiKiLiiiiiiiiMiNiOiPiQiRiiiSi/iTiiUiiiiViiIiHiiiiiiWiiXiiqiYiZi[i\iiriisi]i^i_i`i iviLiaiii.iibiFi>iiijiciZiiiBi6ii`idieiii|iifiii5igiihiiiiHiijiiikiilii1iminioipiqiriCisitiuiviwiixiyizi{iii|i}i~iiiiiiiiiOiiiiiiiiiiiiiEiiiqiiiIii\ii-iiiSiiii iieiiiiliiMiiiQiiPiii^ii i-iFiiiiiiiiiiiiiiiiiii i.iitiiiiiJiiiiiiiigiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiuiiii9i iiii ii$iiiiii5i%iikiLiiiiiiiiiiiAiiiiiiiiiiRiiuiiiiii)iii:iiiiiiii"i$iviiiiciZiiiiiii*iWiiKiiLii+iiiiiiiiii iBiii?iiiiiiiiiiMi[i5iiiiniiiiiiCii'iiiiiiiii iiii iiiiiiiiFiTi/iiiiii8iiuiiiiKii(iMiiiiiiiiiiiiiiiTii?iiiiiiiiei i(iiiiiii%i0iiiiOii i8i i i i i iiii i i iii#iii iiiVi iiiPi i iMiWii ii ii|i i iSiiiiiiii i iii i i i i i ii i ii9iDiiiiiii i3iii i i i{i iii i i ii iiiiii! ikiiiiiNiiYii" i# i$ i% i& i' i( i]i) i* i+ i, i- i. ii/ iii>iiii0 i1 iiiii\ii2 ii3 iii4 i5 i6 iwi7 ii8 ii3iiii9 i: iLi iii; ii< iiiiiii iiii= iiJi> i? i@ iiA iiB iC iD iiE iiiF iG iH iI iiiiiiiJ iK iiiL iM iN iiIiO iP iiQ iR iS iiT iiU iV iW iX iiY iZ i[ i\ i] iii^ i_ i` ia iiib ic id ie iiif ig iUiixi ih iiii ij iiii4i&iiii!iiiiSiyi iii"i ii#ik iil im in iiiipiQii.io iUiiOiip iiq ir is ixit iiu iv iw iii$ix iiy ii`iz i{ i| i} ii~ i i i i i i i iiCiiiii%iyiiioi ii i i i i i ii i i i iii iii i ii@iii iGi iiii2iiiii i i i iNi i iiiii i i i i iri iiziniiiiPi i#i i&iQi iimi iciii i'i iwi i ii(ili@iiii)ii*i i i i ii i i i iii iii i i iHii i ii iii i i ii i iri iiiAi iiiii i}i,iii:iiiii iiIi iNii1i iWiiiiiiii i+i i i1iibii iqi i,i iiieiii_iidi i i i i i iii2iiii ii i i i ii ii i ii-i iii i i i i i ii i i i i i ii ii i iii7i ii ii i i i i i i iiiiiiiii,iGiiii ii^i i i.i iigii ii i i iii iiii_ii i i iiihihii{i i|iiii3i i i iii i i i\iiiii i i i i i i ii i i i iiii iji iiii4ii i i i i i iii i i i ii6idii/i i iiiioi iiRiiii i&i ikiniziiiii ii iiiXiidiiSii}i i}iii~iiiii i! iNi" iiiiiii# iiisi$ i% i& ifiDii1i' iii( i@i) i^iiii* ii+ i, i- i. i/ iJi+i0 i1 i2 iiTii3 i4 i5 i6 ii7 iAi.iiii8 i9 ii"i: i; ii< i= i> iii0i? ii@ iiA iB iiC iD iE iF iG iii_i[iH iI iii`iaiJ iiiiiK iL iM iN iiO iiiiiiiP iQ iR (t EUCKR_TYPICAL_DISTRIBUTION_RATIOtEUCKR_TABLE_SIZEtEUCKR_CHAR_TO_FREQ_ORDER(((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euckrfreq.pyt)s(site-packages/pip/_vendor/chardet/euckrprober.py000064400000003324147204247350016031 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import EUCKRDistributionAnalysis from .mbcssm import EUCKR_SM_MODEL class EUCKRProber(MultiByteCharSetProber): def __init__(self): super(EUCKRProber, self).__init__() self.coding_sm = CodingStateMachine(EUCKR_SM_MODEL) self.distribution_analyzer = EUCKRDistributionAnalysis() self.reset() @property def charset_name(self): return "EUC-KR" @property def language(self): return "Korean" site-packages/pip/_vendor/chardet/euckrprober.pyo000064400000002526147204247350016213 0ustar00 abc@sZddlmZddlmZddlmZddlmZdefdYZdS(i(tMultiByteCharSetProber(tCodingStateMachine(tEUCKRDistributionAnalysis(tEUCKR_SM_MODELt EUCKRProbercBs/eZdZedZedZRS(cCs<tt|jtt|_t|_|jdS(N( tsuperRt__init__RRt coding_smRtdistribution_analyzertreset(tself((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euckrprober.pyR#s cCsdS(NsEUC-KR((R ((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euckrprober.pyt charset_name)scCsdS(NtKorean((R ((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euckrprober.pytlanguage-s(t__name__t __module__RtpropertyR R (((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euckrprober.pyR"s N( tmbcharsetproberRtcodingstatemachineRtchardistributionRtmbcssmRR(((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euckrprober.pytssite-packages/pip/_vendor/chardet/euctwfreq.py000064400000075605147204247350015526 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # EUCTW frequency table # Converted from big5 work # by Taiwan's Mandarin Promotion Council # # 128 --> 0.42261 # 256 --> 0.57851 # 512 --> 0.74851 # 1024 --> 0.89384 # 2048 --> 0.97583 # # Idea Distribution Ratio = 0.74851/(1-0.74851) =2.98 # Random Distribution Ration = 512/(5401-512)=0.105 # # Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR EUCTW_TYPICAL_DISTRIBUTION_RATIO = 0.75 # Char to FreqOrder table , EUCTW_TABLE_SIZE = 5376 EUCTW_CHAR_TO_FREQ_ORDER = ( 1,1800,1506, 255,1431, 198, 9, 82, 6,7310, 177, 202,3615,1256,2808, 110, # 2742 3735, 33,3241, 261, 76, 44,2113, 16,2931,2184,1176, 659,3868, 26,3404,2643, # 2758 1198,3869,3313,4060, 410,2211, 302, 590, 361,1963, 8, 204, 58,4296,7311,1931, # 2774 63,7312,7313, 317,1614, 75, 222, 159,4061,2412,1480,7314,3500,3068, 224,2809, # 2790 3616, 3, 10,3870,1471, 29,2774,1135,2852,1939, 873, 130,3242,1123, 312,7315, # 2806 4297,2051, 507, 252, 682,7316, 142,1914, 124, 206,2932, 34,3501,3173, 64, 604, # 2822 7317,2494,1976,1977, 155,1990, 645, 641,1606,7318,3405, 337, 72, 406,7319, 80, # 2838 630, 238,3174,1509, 263, 939,1092,2644, 756,1440,1094,3406, 449, 69,2969, 591, # 2854 179,2095, 471, 115,2034,1843, 60, 50,2970, 134, 806,1868, 734,2035,3407, 180, # 2870 995,1607, 156, 537,2893, 688,7320, 319,1305, 779,2144, 514,2374, 298,4298, 359, # 2886 2495, 90,2707,1338, 663, 11, 906,1099,2545, 20,2436, 182, 532,1716,7321, 732, # 2902 1376,4062,1311,1420,3175, 25,2312,1056, 113, 399, 382,1949, 242,3408,2467, 529, # 2918 3243, 475,1447,3617,7322, 117, 21, 656, 810,1297,2295,2329,3502,7323, 126,4063, # 2934 706, 456, 150, 613,4299, 71,1118,2036,4064, 145,3069, 85, 835, 486,2114,1246, # 2950 1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,7324,2127,2354, 347,3736, 221, # 2966 3503,3110,7325,1955,1153,4065, 83, 296,1199,3070, 192, 624, 93,7326, 822,1897, # 2982 2810,3111, 795,2064, 991,1554,1542,1592, 27, 43,2853, 859, 139,1456, 860,4300, # 2998 437, 712,3871, 164,2392,3112, 695, 211,3017,2096, 195,3872,1608,3504,3505,3618, # 3014 3873, 234, 811,2971,2097,3874,2229,1441,3506,1615,2375, 668,2076,1638, 305, 228, # 3030 1664,4301, 467, 415,7327, 262,2098,1593, 239, 108, 300, 200,1033, 512,1247,2077, # 3046 7328,7329,2173,3176,3619,2673, 593, 845,1062,3244, 88,1723,2037,3875,1950, 212, # 3062 266, 152, 149, 468,1898,4066,4302, 77, 187,7330,3018, 37, 5,2972,7331,3876, # 3078 7332,7333, 39,2517,4303,2894,3177,2078, 55, 148, 74,4304, 545, 483,1474,1029, # 3094 1665, 217,1869,1531,3113,1104,2645,4067, 24, 172,3507, 900,3877,3508,3509,4305, # 3110 32,1408,2811,1312, 329, 487,2355,2247,2708, 784,2674, 4,3019,3314,1427,1788, # 3126 188, 109, 499,7334,3620,1717,1789, 888,1217,3020,4306,7335,3510,7336,3315,1520, # 3142 3621,3878, 196,1034, 775,7337,7338, 929,1815, 249, 439, 38,7339,1063,7340, 794, # 3158 3879,1435,2296, 46, 178,3245,2065,7341,2376,7342, 214,1709,4307, 804, 35, 707, # 3174 324,3622,1601,2546, 140, 459,4068,7343,7344,1365, 839, 272, 978,2257,2572,3409, # 3190 2128,1363,3623,1423, 697, 100,3071, 48, 70,1231, 495,3114,2193,7345,1294,7346, # 3206 2079, 462, 586,1042,3246, 853, 256, 988, 185,2377,3410,1698, 434,1084,7347,3411, # 3222 314,2615,2775,4308,2330,2331, 569,2280, 637,1816,2518, 757,1162,1878,1616,3412, # 3238 287,1577,2115, 768,4309,1671,2854,3511,2519,1321,3737, 909,2413,7348,4069, 933, # 3254 3738,7349,2052,2356,1222,4310, 765,2414,1322, 786,4311,7350,1919,1462,1677,2895, # 3270 1699,7351,4312,1424,2437,3115,3624,2590,3316,1774,1940,3413,3880,4070, 309,1369, # 3286 1130,2812, 364,2230,1653,1299,3881,3512,3882,3883,2646, 525,1085,3021, 902,2000, # 3302 1475, 964,4313, 421,1844,1415,1057,2281, 940,1364,3116, 376,4314,4315,1381, 7, # 3318 2520, 983,2378, 336,1710,2675,1845, 321,3414, 559,1131,3022,2742,1808,1132,1313, # 3334 265,1481,1857,7352, 352,1203,2813,3247, 167,1089, 420,2814, 776, 792,1724,3513, # 3350 4071,2438,3248,7353,4072,7354, 446, 229, 333,2743, 901,3739,1200,1557,4316,2647, # 3366 1920, 395,2744,2676,3740,4073,1835, 125, 916,3178,2616,4317,7355,7356,3741,7357, # 3382 7358,7359,4318,3117,3625,1133,2547,1757,3415,1510,2313,1409,3514,7360,2145, 438, # 3398 2591,2896,2379,3317,1068, 958,3023, 461, 311,2855,2677,4074,1915,3179,4075,1978, # 3414 383, 750,2745,2617,4076, 274, 539, 385,1278,1442,7361,1154,1964, 384, 561, 210, # 3430 98,1295,2548,3515,7362,1711,2415,1482,3416,3884,2897,1257, 129,7363,3742, 642, # 3446 523,2776,2777,2648,7364, 141,2231,1333, 68, 176, 441, 876, 907,4077, 603,2592, # 3462 710, 171,3417, 404, 549, 18,3118,2393,1410,3626,1666,7365,3516,4319,2898,4320, # 3478 7366,2973, 368,7367, 146, 366, 99, 871,3627,1543, 748, 807,1586,1185, 22,2258, # 3494 379,3743,3180,7368,3181, 505,1941,2618,1991,1382,2314,7369, 380,2357, 218, 702, # 3510 1817,1248,3418,3024,3517,3318,3249,7370,2974,3628, 930,3250,3744,7371, 59,7372, # 3526 585, 601,4078, 497,3419,1112,1314,4321,1801,7373,1223,1472,2174,7374, 749,1836, # 3542 690,1899,3745,1772,3885,1476, 429,1043,1790,2232,2116, 917,4079, 447,1086,1629, # 3558 7375, 556,7376,7377,2020,1654, 844,1090, 105, 550, 966,1758,2815,1008,1782, 686, # 3574 1095,7378,2282, 793,1602,7379,3518,2593,4322,4080,2933,2297,4323,3746, 980,2496, # 3590 544, 353, 527,4324, 908,2678,2899,7380, 381,2619,1942,1348,7381,1341,1252, 560, # 3606 3072,7382,3420,2856,7383,2053, 973, 886,2080, 143,4325,7384,7385, 157,3886, 496, # 3622 4081, 57, 840, 540,2038,4326,4327,3421,2117,1445, 970,2259,1748,1965,2081,4082, # 3638 3119,1234,1775,3251,2816,3629, 773,1206,2129,1066,2039,1326,3887,1738,1725,4083, # 3654 279,3120, 51,1544,2594, 423,1578,2130,2066, 173,4328,1879,7386,7387,1583, 264, # 3670 610,3630,4329,2439, 280, 154,7388,7389,7390,1739, 338,1282,3073, 693,2857,1411, # 3686 1074,3747,2440,7391,4330,7392,7393,1240, 952,2394,7394,2900,1538,2679, 685,1483, # 3702 4084,2468,1436, 953,4085,2054,4331, 671,2395, 79,4086,2441,3252, 608, 567,2680, # 3718 3422,4087,4088,1691, 393,1261,1791,2396,7395,4332,7396,7397,7398,7399,1383,1672, # 3734 3748,3182,1464, 522,1119, 661,1150, 216, 675,4333,3888,1432,3519, 609,4334,2681, # 3750 2397,7400,7401,7402,4089,3025, 0,7403,2469, 315, 231,2442, 301,3319,4335,2380, # 3766 7404, 233,4090,3631,1818,4336,4337,7405, 96,1776,1315,2082,7406, 257,7407,1809, # 3782 3632,2709,1139,1819,4091,2021,1124,2163,2778,1777,2649,7408,3074, 363,1655,3183, # 3798 7409,2975,7410,7411,7412,3889,1567,3890, 718, 103,3184, 849,1443, 341,3320,2934, # 3814 1484,7413,1712, 127, 67, 339,4092,2398, 679,1412, 821,7414,7415, 834, 738, 351, # 3830 2976,2146, 846, 235,1497,1880, 418,1992,3749,2710, 186,1100,2147,2746,3520,1545, # 3846 1355,2935,2858,1377, 583,3891,4093,2573,2977,7416,1298,3633,1078,2549,3634,2358, # 3862 78,3750,3751, 267,1289,2099,2001,1594,4094, 348, 369,1274,2194,2175,1837,4338, # 3878 1820,2817,3635,2747,2283,2002,4339,2936,2748, 144,3321, 882,4340,3892,2749,3423, # 3894 4341,2901,7417,4095,1726, 320,7418,3893,3026, 788,2978,7419,2818,1773,1327,2859, # 3910 3894,2819,7420,1306,4342,2003,1700,3752,3521,2359,2650, 787,2022, 506, 824,3636, # 3926 534, 323,4343,1044,3322,2023,1900, 946,3424,7421,1778,1500,1678,7422,1881,4344, # 3942 165, 243,4345,3637,2521, 123, 683,4096, 764,4346, 36,3895,1792, 589,2902, 816, # 3958 626,1667,3027,2233,1639,1555,1622,3753,3896,7423,3897,2860,1370,1228,1932, 891, # 3974 2083,2903, 304,4097,7424, 292,2979,2711,3522, 691,2100,4098,1115,4347, 118, 662, # 3990 7425, 611,1156, 854,2381,1316,2861, 2, 386, 515,2904,7426,7427,3253, 868,2234, # 4006 1486, 855,2651, 785,2212,3028,7428,1040,3185,3523,7429,3121, 448,7430,1525,7431, # 4022 2164,4348,7432,3754,7433,4099,2820,3524,3122, 503, 818,3898,3123,1568, 814, 676, # 4038 1444, 306,1749,7434,3755,1416,1030, 197,1428, 805,2821,1501,4349,7435,7436,7437, # 4054 1993,7438,4350,7439,7440,2195, 13,2779,3638,2980,3124,1229,1916,7441,3756,2131, # 4070 7442,4100,4351,2399,3525,7443,2213,1511,1727,1120,7444,7445, 646,3757,2443, 307, # 4086 7446,7447,1595,3186,7448,7449,7450,3639,1113,1356,3899,1465,2522,2523,7451, 519, # 4102 7452, 128,2132, 92,2284,1979,7453,3900,1512, 342,3125,2196,7454,2780,2214,1980, # 4118 3323,7455, 290,1656,1317, 789, 827,2360,7456,3758,4352, 562, 581,3901,7457, 401, # 4134 4353,2248, 94,4354,1399,2781,7458,1463,2024,4355,3187,1943,7459, 828,1105,4101, # 4150 1262,1394,7460,4102, 605,4356,7461,1783,2862,7462,2822, 819,2101, 578,2197,2937, # 4166 7463,1502, 436,3254,4103,3255,2823,3902,2905,3425,3426,7464,2712,2315,7465,7466, # 4182 2332,2067, 23,4357, 193, 826,3759,2102, 699,1630,4104,3075, 390,1793,1064,3526, # 4198 7467,1579,3076,3077,1400,7468,4105,1838,1640,2863,7469,4358,4359, 137,4106, 598, # 4214 3078,1966, 780, 104, 974,2938,7470, 278, 899, 253, 402, 572, 504, 493,1339,7471, # 4230 3903,1275,4360,2574,2550,7472,3640,3029,3079,2249, 565,1334,2713, 863, 41,7473, # 4246 7474,4361,7475,1657,2333, 19, 463,2750,4107, 606,7476,2981,3256,1087,2084,1323, # 4262 2652,2982,7477,1631,1623,1750,4108,2682,7478,2864, 791,2714,2653,2334, 232,2416, # 4278 7479,2983,1498,7480,2654,2620, 755,1366,3641,3257,3126,2025,1609, 119,1917,3427, # 4294 862,1026,4109,7481,3904,3760,4362,3905,4363,2260,1951,2470,7482,1125, 817,4110, # 4310 4111,3906,1513,1766,2040,1487,4112,3030,3258,2824,3761,3127,7483,7484,1507,7485, # 4326 2683, 733, 40,1632,1106,2865, 345,4113, 841,2524, 230,4364,2984,1846,3259,3428, # 4342 7486,1263, 986,3429,7487, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562,3907, # 4358 3908,2939, 967,2751,2655,1349, 592,2133,1692,3324,2985,1994,4114,1679,3909,1901, # 4374 2185,7488, 739,3642,2715,1296,1290,7489,4115,2198,2199,1921,1563,2595,2551,1870, # 4390 2752,2986,7490, 435,7491, 343,1108, 596, 17,1751,4365,2235,3430,3643,7492,4366, # 4406 294,3527,2940,1693, 477, 979, 281,2041,3528, 643,2042,3644,2621,2782,2261,1031, # 4422 2335,2134,2298,3529,4367, 367,1249,2552,7493,3530,7494,4368,1283,3325,2004, 240, # 4438 1762,3326,4369,4370, 836,1069,3128, 474,7495,2148,2525, 268,3531,7496,3188,1521, # 4454 1284,7497,1658,1546,4116,7498,3532,3533,7499,4117,3327,2684,1685,4118, 961,1673, # 4470 2622, 190,2005,2200,3762,4371,4372,7500, 570,2497,3645,1490,7501,4373,2623,3260, # 4486 1956,4374, 584,1514, 396,1045,1944,7502,4375,1967,2444,7503,7504,4376,3910, 619, # 4502 7505,3129,3261, 215,2006,2783,2553,3189,4377,3190,4378, 763,4119,3763,4379,7506, # 4518 7507,1957,1767,2941,3328,3646,1174, 452,1477,4380,3329,3130,7508,2825,1253,2382, # 4534 2186,1091,2285,4120, 492,7509, 638,1169,1824,2135,1752,3911, 648, 926,1021,1324, # 4550 4381, 520,4382, 997, 847,1007, 892,4383,3764,2262,1871,3647,7510,2400,1784,4384, # 4566 1952,2942,3080,3191,1728,4121,2043,3648,4385,2007,1701,3131,1551, 30,2263,4122, # 4582 7511,2026,4386,3534,7512, 501,7513,4123, 594,3431,2165,1821,3535,3432,3536,3192, # 4598 829,2826,4124,7514,1680,3132,1225,4125,7515,3262,4387,4126,3133,2336,7516,4388, # 4614 4127,7517,3912,3913,7518,1847,2383,2596,3330,7519,4389, 374,3914, 652,4128,4129, # 4630 375,1140, 798,7520,7521,7522,2361,4390,2264, 546,1659, 138,3031,2445,4391,7523, # 4646 2250, 612,1848, 910, 796,3765,1740,1371, 825,3766,3767,7524,2906,2554,7525, 692, # 4662 444,3032,2624, 801,4392,4130,7526,1491, 244,1053,3033,4131,4132, 340,7527,3915, # 4678 1041,2987, 293,1168, 87,1357,7528,1539, 959,7529,2236, 721, 694,4133,3768, 219, # 4694 1478, 644,1417,3331,2656,1413,1401,1335,1389,3916,7530,7531,2988,2362,3134,1825, # 4710 730,1515, 184,2827, 66,4393,7532,1660,2943, 246,3332, 378,1457, 226,3433, 975, # 4726 3917,2944,1264,3537, 674, 696,7533, 163,7534,1141,2417,2166, 713,3538,3333,4394, # 4742 3918,7535,7536,1186, 15,7537,1079,1070,7538,1522,3193,3539, 276,1050,2716, 758, # 4758 1126, 653,2945,3263,7539,2337, 889,3540,3919,3081,2989, 903,1250,4395,3920,3434, # 4774 3541,1342,1681,1718, 766,3264, 286, 89,2946,3649,7540,1713,7541,2597,3334,2990, # 4790 7542,2947,2215,3194,2866,7543,4396,2498,2526, 181, 387,1075,3921, 731,2187,3335, # 4806 7544,3265, 310, 313,3435,2299, 770,4134, 54,3034, 189,4397,3082,3769,3922,7545, # 4822 1230,1617,1849, 355,3542,4135,4398,3336, 111,4136,3650,1350,3135,3436,3035,4137, # 4838 2149,3266,3543,7546,2784,3923,3924,2991, 722,2008,7547,1071, 247,1207,2338,2471, # 4854 1378,4399,2009, 864,1437,1214,4400, 373,3770,1142,2216, 667,4401, 442,2753,2555, # 4870 3771,3925,1968,4138,3267,1839, 837, 170,1107, 934,1336,1882,7548,7549,2118,4139, # 4886 2828, 743,1569,7550,4402,4140, 582,2384,1418,3437,7551,1802,7552, 357,1395,1729, # 4902 3651,3268,2418,1564,2237,7553,3083,3772,1633,4403,1114,2085,4141,1532,7554, 482, # 4918 2446,4404,7555,7556,1492, 833,1466,7557,2717,3544,1641,2829,7558,1526,1272,3652, # 4934 4142,1686,1794, 416,2556,1902,1953,1803,7559,3773,2785,3774,1159,2316,7560,2867, # 4950 4405,1610,1584,3036,2419,2754, 443,3269,1163,3136,7561,7562,3926,7563,4143,2499, # 4966 3037,4406,3927,3137,2103,1647,3545,2010,1872,4144,7564,4145, 431,3438,7565, 250, # 4982 97, 81,4146,7566,1648,1850,1558, 160, 848,7567, 866, 740,1694,7568,2201,2830, # 4998 3195,4147,4407,3653,1687, 950,2472, 426, 469,3196,3654,3655,3928,7569,7570,1188, # 5014 424,1995, 861,3546,4148,3775,2202,2685, 168,1235,3547,4149,7571,2086,1674,4408, # 5030 3337,3270, 220,2557,1009,7572,3776, 670,2992, 332,1208, 717,7573,7574,3548,2447, # 5046 3929,3338,7575, 513,7576,1209,2868,3339,3138,4409,1080,7577,7578,7579,7580,2527, # 5062 3656,3549, 815,1587,3930,3931,7581,3550,3439,3777,1254,4410,1328,3038,1390,3932, # 5078 1741,3933,3778,3934,7582, 236,3779,2448,3271,7583,7584,3657,3780,1273,3781,4411, # 5094 7585, 308,7586,4412, 245,4413,1851,2473,1307,2575, 430, 715,2136,2449,7587, 270, # 5110 199,2869,3935,7588,3551,2718,1753, 761,1754, 725,1661,1840,4414,3440,3658,7589, # 5126 7590, 587, 14,3272, 227,2598, 326, 480,2265, 943,2755,3552, 291, 650,1883,7591, # 5142 1702,1226, 102,1547, 62,3441, 904,4415,3442,1164,4150,7592,7593,1224,1548,2756, # 5158 391, 498,1493,7594,1386,1419,7595,2055,1177,4416, 813, 880,1081,2363, 566,1145, # 5174 4417,2286,1001,1035,2558,2599,2238, 394,1286,7596,7597,2068,7598, 86,1494,1730, # 5190 3936, 491,1588, 745, 897,2948, 843,3340,3937,2757,2870,3273,1768, 998,2217,2069, # 5206 397,1826,1195,1969,3659,2993,3341, 284,7599,3782,2500,2137,2119,1903,7600,3938, # 5222 2150,3939,4151,1036,3443,1904, 114,2559,4152, 209,1527,7601,7602,2949,2831,2625, # 5238 2385,2719,3139, 812,2560,7603,3274,7604,1559, 737,1884,3660,1210, 885, 28,2686, # 5254 3553,3783,7605,4153,1004,1779,4418,7606, 346,1981,2218,2687,4419,3784,1742, 797, # 5270 1642,3940,1933,1072,1384,2151, 896,3941,3275,3661,3197,2871,3554,7607,2561,1958, # 5286 4420,2450,1785,7608,7609,7610,3942,4154,1005,1308,3662,4155,2720,4421,4422,1528, # 5302 2600, 161,1178,4156,1982, 987,4423,1101,4157, 631,3943,1157,3198,2420,1343,1241, # 5318 1016,2239,2562, 372, 877,2339,2501,1160, 555,1934, 911,3944,7611, 466,1170, 169, # 5334 1051,2907,2688,3663,2474,2994,1182,2011,2563,1251,2626,7612, 992,2340,3444,1540, # 5350 2721,1201,2070,2401,1996,2475,7613,4424, 528,1922,2188,1503,1873,1570,2364,3342, # 5366 3276,7614, 557,1073,7615,1827,3445,2087,2266,3140,3039,3084, 767,3085,2786,4425, # 5382 1006,4158,4426,2341,1267,2176,3664,3199, 778,3945,3200,2722,1597,2657,7616,4427, # 5398 7617,3446,7618,7619,7620,3277,2689,1433,3278, 131, 95,1504,3946, 723,4159,3141, # 5414 1841,3555,2758,2189,3947,2027,2104,3665,7621,2995,3948,1218,7622,3343,3201,3949, # 5430 4160,2576, 248,1634,3785, 912,7623,2832,3666,3040,3786, 654, 53,7624,2996,7625, # 5446 1688,4428, 777,3447,1032,3950,1425,7626, 191, 820,2120,2833, 971,4429, 931,3202, # 5462 135, 664, 783,3787,1997, 772,2908,1935,3951,3788,4430,2909,3203, 282,2723, 640, # 5478 1372,3448,1127, 922, 325,3344,7627,7628, 711,2044,7629,7630,3952,2219,2787,1936, # 5494 3953,3345,2220,2251,3789,2300,7631,4431,3790,1258,3279,3954,3204,2138,2950,3955, # 5510 3956,7632,2221, 258,3205,4432, 101,1227,7633,3280,1755,7634,1391,3281,7635,2910, # 5526 2056, 893,7636,7637,7638,1402,4161,2342,7639,7640,3206,3556,7641,7642, 878,1325, # 5542 1780,2788,4433, 259,1385,2577, 744,1183,2267,4434,7643,3957,2502,7644, 684,1024, # 5558 4162,7645, 472,3557,3449,1165,3282,3958,3959, 322,2152, 881, 455,1695,1152,1340, # 5574 660, 554,2153,4435,1058,4436,4163, 830,1065,3346,3960,4437,1923,7646,1703,1918, # 5590 7647, 932,2268, 122,7648,4438, 947, 677,7649,3791,2627, 297,1905,1924,2269,4439, # 5606 2317,3283,7650,7651,4164,7652,4165, 84,4166, 112, 989,7653, 547,1059,3961, 701, # 5622 3558,1019,7654,4167,7655,3450, 942, 639, 457,2301,2451, 993,2951, 407, 851, 494, # 5638 4440,3347, 927,7656,1237,7657,2421,3348, 573,4168, 680, 921,2911,1279,1874, 285, # 5654 790,1448,1983, 719,2167,7658,7659,4441,3962,3963,1649,7660,1541, 563,7661,1077, # 5670 7662,3349,3041,3451, 511,2997,3964,3965,3667,3966,1268,2564,3350,3207,4442,4443, # 5686 7663, 535,1048,1276,1189,2912,2028,3142,1438,1373,2834,2952,1134,2012,7664,4169, # 5702 1238,2578,3086,1259,7665, 700,7666,2953,3143,3668,4170,7667,4171,1146,1875,1906, # 5718 4444,2601,3967, 781,2422, 132,1589, 203, 147, 273,2789,2402, 898,1786,2154,3968, # 5734 3969,7668,3792,2790,7669,7670,4445,4446,7671,3208,7672,1635,3793, 965,7673,1804, # 5750 2690,1516,3559,1121,1082,1329,3284,3970,1449,3794, 65,1128,2835,2913,2759,1590, # 5766 3795,7674,7675, 12,2658, 45, 976,2579,3144,4447, 517,2528,1013,1037,3209,7676, # 5782 3796,2836,7677,3797,7678,3452,7679,2602, 614,1998,2318,3798,3087,2724,2628,7680, # 5798 2580,4172, 599,1269,7681,1810,3669,7682,2691,3088, 759,1060, 489,1805,3351,3285, # 5814 1358,7683,7684,2386,1387,1215,2629,2252, 490,7685,7686,4173,1759,2387,2343,7687, # 5830 4448,3799,1907,3971,2630,1806,3210,4449,3453,3286,2760,2344, 874,7688,7689,3454, # 5846 3670,1858, 91,2914,3671,3042,3800,4450,7690,3145,3972,2659,7691,3455,1202,1403, # 5862 3801,2954,2529,1517,2503,4451,3456,2504,7692,4452,7693,2692,1885,1495,1731,3973, # 5878 2365,4453,7694,2029,7695,7696,3974,2693,1216, 237,2581,4174,2319,3975,3802,4454, # 5894 4455,2694,3560,3457, 445,4456,7697,7698,7699,7700,2761, 61,3976,3672,1822,3977, # 5910 7701, 687,2045, 935, 925, 405,2660, 703,1096,1859,2725,4457,3978,1876,1367,2695, # 5926 3352, 918,2105,1781,2476, 334,3287,1611,1093,4458, 564,3146,3458,3673,3353, 945, # 5942 2631,2057,4459,7702,1925, 872,4175,7703,3459,2696,3089, 349,4176,3674,3979,4460, # 5958 3803,4177,3675,2155,3980,4461,4462,4178,4463,2403,2046, 782,3981, 400, 251,4179, # 5974 1624,7704,7705, 277,3676, 299,1265, 476,1191,3804,2121,4180,4181,1109, 205,7706, # 5990 2582,1000,2156,3561,1860,7707,7708,7709,4464,7710,4465,2565, 107,2477,2157,3982, # 6006 3460,3147,7711,1533, 541,1301, 158, 753,4182,2872,3562,7712,1696, 370,1088,4183, # 6022 4466,3563, 579, 327, 440, 162,2240, 269,1937,1374,3461, 968,3043, 56,1396,3090, # 6038 2106,3288,3354,7713,1926,2158,4467,2998,7714,3564,7715,7716,3677,4468,2478,7717, # 6054 2791,7718,1650,4469,7719,2603,7720,7721,3983,2661,3355,1149,3356,3984,3805,3985, # 6070 7722,1076, 49,7723, 951,3211,3289,3290, 450,2837, 920,7724,1811,2792,2366,4184, # 6086 1908,1138,2367,3806,3462,7725,3212,4470,1909,1147,1518,2423,4471,3807,7726,4472, # 6102 2388,2604, 260,1795,3213,7727,7728,3808,3291, 708,7729,3565,1704,7730,3566,1351, # 6118 1618,3357,2999,1886, 944,4185,3358,4186,3044,3359,4187,7731,3678, 422, 413,1714, # 6134 3292, 500,2058,2345,4188,2479,7732,1344,1910, 954,7733,1668,7734,7735,3986,2404, # 6150 4189,3567,3809,4190,7736,2302,1318,2505,3091, 133,3092,2873,4473, 629, 31,2838, # 6166 2697,3810,4474, 850, 949,4475,3987,2955,1732,2088,4191,1496,1852,7737,3988, 620, # 6182 3214, 981,1242,3679,3360,1619,3680,1643,3293,2139,2452,1970,1719,3463,2168,7738, # 6198 3215,7739,7740,3361,1828,7741,1277,4476,1565,2047,7742,1636,3568,3093,7743, 869, # 6214 2839, 655,3811,3812,3094,3989,3000,3813,1310,3569,4477,7744,7745,7746,1733, 558, # 6230 4478,3681, 335,1549,3045,1756,4192,3682,1945,3464,1829,1291,1192, 470,2726,2107, # 6246 2793, 913,1054,3990,7747,1027,7748,3046,3991,4479, 982,2662,3362,3148,3465,3216, # 6262 3217,1946,2794,7749, 571,4480,7750,1830,7751,3570,2583,1523,2424,7752,2089, 984, # 6278 4481,3683,1959,7753,3684, 852, 923,2795,3466,3685, 969,1519, 999,2048,2320,1705, # 6294 7754,3095, 615,1662, 151, 597,3992,2405,2321,1049, 275,4482,3686,4193, 568,3687, # 6310 3571,2480,4194,3688,7755,2425,2270, 409,3218,7756,1566,2874,3467,1002, 769,2840, # 6326 194,2090,3149,3689,2222,3294,4195, 628,1505,7757,7758,1763,2177,3001,3993, 521, # 6342 1161,2584,1787,2203,2406,4483,3994,1625,4196,4197, 412, 42,3096, 464,7759,2632, # 6358 4484,3363,1760,1571,2875,3468,2530,1219,2204,3814,2633,2140,2368,4485,4486,3295, # 6374 1651,3364,3572,7760,7761,3573,2481,3469,7762,3690,7763,7764,2271,2091, 460,7765, # 6390 4487,7766,3002, 962, 588,3574, 289,3219,2634,1116, 52,7767,3047,1796,7768,7769, # 6406 7770,1467,7771,1598,1143,3691,4198,1984,1734,1067,4488,1280,3365, 465,4489,1572, # 6422 510,7772,1927,2241,1812,1644,3575,7773,4490,3692,7774,7775,2663,1573,1534,7776, # 6438 7777,4199, 536,1807,1761,3470,3815,3150,2635,7778,7779,7780,4491,3471,2915,1911, # 6454 2796,7781,3296,1122, 377,3220,7782, 360,7783,7784,4200,1529, 551,7785,2059,3693, # 6470 1769,2426,7786,2916,4201,3297,3097,2322,2108,2030,4492,1404, 136,1468,1479, 672, # 6486 1171,3221,2303, 271,3151,7787,2762,7788,2049, 678,2727, 865,1947,4493,7789,2013, # 6502 3995,2956,7790,2728,2223,1397,3048,3694,4494,4495,1735,2917,3366,3576,7791,3816, # 6518 509,2841,2453,2876,3817,7792,7793,3152,3153,4496,4202,2531,4497,2304,1166,1010, # 6534 552, 681,1887,7794,7795,2957,2958,3996,1287,1596,1861,3154, 358, 453, 736, 175, # 6550 478,1117, 905,1167,1097,7796,1853,1530,7797,1706,7798,2178,3472,2287,3695,3473, # 6566 3577,4203,2092,4204,7799,3367,1193,2482,4205,1458,2190,2205,1862,1888,1421,3298, # 6582 2918,3049,2179,3474, 595,2122,7800,3997,7801,7802,4206,1707,2636, 223,3696,1359, # 6598 751,3098, 183,3475,7803,2797,3003, 419,2369, 633, 704,3818,2389, 241,7804,7805, # 6614 7806, 838,3004,3697,2272,2763,2454,3819,1938,2050,3998,1309,3099,2242,1181,7807, # 6630 1136,2206,3820,2370,1446,4207,2305,4498,7808,7809,4208,1055,2605, 484,3698,7810, # 6646 3999, 625,4209,2273,3368,1499,4210,4000,7811,4001,4211,3222,2274,2275,3476,7812, # 6662 7813,2764, 808,2606,3699,3369,4002,4212,3100,2532, 526,3370,3821,4213, 955,7814, # 6678 1620,4214,2637,2427,7815,1429,3700,1669,1831, 994, 928,7816,3578,1260,7817,7818, # 6694 7819,1948,2288, 741,2919,1626,4215,2729,2455, 867,1184, 362,3371,1392,7820,7821, # 6710 4003,4216,1770,1736,3223,2920,4499,4500,1928,2698,1459,1158,7822,3050,3372,2877, # 6726 1292,1929,2506,2842,3701,1985,1187,2071,2014,2607,4217,7823,2566,2507,2169,3702, # 6742 2483,3299,7824,3703,4501,7825,7826, 666,1003,3005,1022,3579,4218,7827,4502,1813, # 6758 2253, 574,3822,1603, 295,1535, 705,3823,4219, 283, 858, 417,7828,7829,3224,4503, # 6774 4504,3051,1220,1889,1046,2276,2456,4004,1393,1599, 689,2567, 388,4220,7830,2484, # 6790 802,7831,2798,3824,2060,1405,2254,7832,4505,3825,2109,1052,1345,3225,1585,7833, # 6806 809,7834,7835,7836, 575,2730,3477, 956,1552,1469,1144,2323,7837,2324,1560,2457, # 6822 3580,3226,4005, 616,2207,3155,2180,2289,7838,1832,7839,3478,4506,7840,1319,3704, # 6838 3705,1211,3581,1023,3227,1293,2799,7841,7842,7843,3826, 607,2306,3827, 762,2878, # 6854 1439,4221,1360,7844,1485,3052,7845,4507,1038,4222,1450,2061,2638,4223,1379,4508, # 6870 2585,7846,7847,4224,1352,1414,2325,2921,1172,7848,7849,3828,3829,7850,1797,1451, # 6886 7851,7852,7853,7854,2922,4006,4007,2485,2346, 411,4008,4009,3582,3300,3101,4509, # 6902 1561,2664,1452,4010,1375,7855,7856, 47,2959, 316,7857,1406,1591,2923,3156,7858, # 6918 1025,2141,3102,3157, 354,2731, 884,2224,4225,2407, 508,3706, 726,3583, 996,2428, # 6934 3584, 729,7859, 392,2191,1453,4011,4510,3707,7860,7861,2458,3585,2608,1675,2800, # 6950 919,2347,2960,2348,1270,4511,4012, 73,7862,7863, 647,7864,3228,2843,2255,1550, # 6966 1346,3006,7865,1332, 883,3479,7866,7867,7868,7869,3301,2765,7870,1212, 831,1347, # 6982 4226,4512,2326,3830,1863,3053, 720,3831,4513,4514,3832,7871,4227,7872,7873,4515, # 6998 7874,7875,1798,4516,3708,2609,4517,3586,1645,2371,7876,7877,2924, 669,2208,2665, # 7014 2429,7878,2879,7879,7880,1028,3229,7881,4228,2408,7882,2256,1353,7883,7884,4518, # 7030 3158, 518,7885,4013,7886,4229,1960,7887,2142,4230,7888,7889,3007,2349,2350,3833, # 7046 516,1833,1454,4014,2699,4231,4519,2225,2610,1971,1129,3587,7890,2766,7891,2961, # 7062 1422, 577,1470,3008,1524,3373,7892,7893, 432,4232,3054,3480,7894,2586,1455,2508, # 7078 2226,1972,1175,7895,1020,2732,4015,3481,4520,7896,2733,7897,1743,1361,3055,3482, # 7094 2639,4016,4233,4521,2290, 895, 924,4234,2170, 331,2243,3056, 166,1627,3057,1098, # 7110 7898,1232,2880,2227,3374,4522, 657, 403,1196,2372, 542,3709,3375,1600,4235,3483, # 7126 7899,4523,2767,3230, 576, 530,1362,7900,4524,2533,2666,3710,4017,7901, 842,3834, # 7142 7902,2801,2031,1014,4018, 213,2700,3376, 665, 621,4236,7903,3711,2925,2430,7904, # 7158 2431,3302,3588,3377,7905,4237,2534,4238,4525,3589,1682,4239,3484,1380,7906, 724, # 7174 2277, 600,1670,7907,1337,1233,4526,3103,2244,7908,1621,4527,7909, 651,4240,7910, # 7190 1612,4241,2611,7911,2844,7912,2734,2307,3058,7913, 716,2459,3059, 174,1255,2701, # 7206 4019,3590, 548,1320,1398, 728,4020,1574,7914,1890,1197,3060,4021,7915,3061,3062, # 7222 3712,3591,3713, 747,7916, 635,4242,4528,7917,7918,7919,4243,7920,7921,4529,7922, # 7238 3378,4530,2432, 451,7923,3714,2535,2072,4244,2735,4245,4022,7924,1764,4531,7925, # 7254 4246, 350,7926,2278,2390,2486,7927,4247,4023,2245,1434,4024, 488,4532, 458,4248, # 7270 4025,3715, 771,1330,2391,3835,2568,3159,2159,2409,1553,2667,3160,4249,7928,2487, # 7286 2881,2612,1720,2702,4250,3379,4533,7929,2536,4251,7930,3231,4252,2768,7931,2015, # 7302 2736,7932,1155,1017,3716,3836,7933,3303,2308, 201,1864,4253,1430,7934,4026,7935, # 7318 7936,7937,7938,7939,4254,1604,7940, 414,1865, 371,2587,4534,4535,3485,2016,3104, # 7334 4536,1708, 960,4255, 887, 389,2171,1536,1663,1721,7941,2228,4027,2351,2926,1580, # 7350 7942,7943,7944,1744,7945,2537,4537,4538,7946,4539,7947,2073,7948,7949,3592,3380, # 7366 2882,4256,7950,4257,2640,3381,2802, 673,2703,2460, 709,3486,4028,3593,4258,7951, # 7382 1148, 502, 634,7952,7953,1204,4540,3594,1575,4541,2613,3717,7954,3718,3105, 948, # 7398 3232, 121,1745,3837,1110,7955,4259,3063,2509,3009,4029,3719,1151,1771,3838,1488, # 7414 4030,1986,7956,2433,3487,7957,7958,2093,7959,4260,3839,1213,1407,2803, 531,2737, # 7430 2538,3233,1011,1537,7960,2769,4261,3106,1061,7961,3720,3721,1866,2883,7962,2017, # 7446 120,4262,4263,2062,3595,3234,2309,3840,2668,3382,1954,4542,7963,7964,3488,1047, # 7462 2704,1266,7965,1368,4543,2845, 649,3383,3841,2539,2738,1102,2846,2669,7966,7967, # 7478 1999,7968,1111,3596,2962,7969,2488,3842,3597,2804,1854,3384,3722,7970,7971,3385, # 7494 2410,2884,3304,3235,3598,7972,2569,7973,3599,2805,4031,1460, 856,7974,3600,7975, # 7510 2885,2963,7976,2886,3843,7977,4264, 632,2510, 875,3844,1697,3845,2291,7978,7979, # 7526 4544,3010,1239, 580,4545,4265,7980, 914, 936,2074,1190,4032,1039,2123,7981,7982, # 7542 7983,3386,1473,7984,1354,4266,3846,7985,2172,3064,4033, 915,3305,4267,4268,3306, # 7558 1605,1834,7986,2739, 398,3601,4269,3847,4034, 328,1912,2847,4035,3848,1331,4270, # 7574 3011, 937,4271,7987,3602,4036,4037,3387,2160,4546,3388, 524, 742, 538,3065,1012, # 7590 7988,7989,3849,2461,7990, 658,1103, 225,3850,7991,7992,4547,7993,4548,7994,3236, # 7606 1243,7995,4038, 963,2246,4549,7996,2705,3603,3161,7997,7998,2588,2327,7999,4550, # 7622 8000,8001,8002,3489,3307, 957,3389,2540,2032,1930,2927,2462, 870,2018,3604,1746, # 7638 2770,2771,2434,2463,8003,3851,8004,3723,3107,3724,3490,3390,3725,8005,1179,3066, # 7654 8006,3162,2373,4272,3726,2541,3163,3108,2740,4039,8007,3391,1556,2542,2292, 977, # 7670 2887,2033,4040,1205,3392,8008,1765,3393,3164,2124,1271,1689, 714,4551,3491,8009, # 7686 2328,3852, 533,4273,3605,2181, 617,8010,2464,3308,3492,2310,8011,8012,3165,8013, # 7702 8014,3853,1987, 618, 427,2641,3493,3394,8015,8016,1244,1690,8017,2806,4274,4552, # 7718 8018,3494,8019,8020,2279,1576, 473,3606,4275,3395, 972,8021,3607,8022,3067,8023, # 7734 8024,4553,4554,8025,3727,4041,4042,8026, 153,4555, 356,8027,1891,2888,4276,2143, # 7750 408, 803,2352,8028,3854,8029,4277,1646,2570,2511,4556,4557,3855,8030,3856,4278, # 7766 8031,2411,3396, 752,8032,8033,1961,2964,8034, 746,3012,2465,8035,4279,3728, 698, # 7782 4558,1892,4280,3608,2543,4559,3609,3857,8036,3166,3397,8037,1823,1302,4043,2706, # 7798 3858,1973,4281,8038,4282,3167, 823,1303,1288,1236,2848,3495,4044,3398, 774,3859, # 7814 8039,1581,4560,1304,2849,3860,4561,8040,2435,2161,1083,3237,4283,4045,4284, 344, # 7830 1173, 288,2311, 454,1683,8041,8042,1461,4562,4046,2589,8043,8044,4563, 985, 894, # 7846 8045,3399,3168,8046,1913,2928,3729,1988,8047,2110,1974,8048,4047,8049,2571,1194, # 7862 425,8050,4564,3169,1245,3730,4285,8051,8052,2850,8053, 636,4565,1855,3861, 760, # 7878 1799,8054,4286,2209,1508,4566,4048,1893,1684,2293,8055,8056,8057,4287,4288,2210, # 7894 479,8058,8059, 832,8060,4049,2489,8061,2965,2490,3731, 990,3109, 627,1814,2642, # 7910 4289,1582,4290,2125,2111,3496,4567,8062, 799,4291,3170,8063,4568,2112,1737,3013, # 7926 1018, 543, 754,4292,3309,1676,4569,4570,4050,8064,1489,8065,3497,8066,2614,2889, # 7942 4051,8067,8068,2966,8069,8070,8071,8072,3171,4571,4572,2182,1722,8073,3238,3239, # 7958 1842,3610,1715, 481, 365,1975,1856,8074,8075,1962,2491,4573,8076,2126,3611,3240, # 7974 433,1894,2063,2075,8077, 602,2741,8078,8079,8080,8081,8082,3014,1628,3400,8083, # 7990 3172,4574,4052,2890,4575,2512,8084,2544,2772,8085,8086,8087,3310,4576,2891,8088, # 8006 4577,8089,2851,4578,4579,1221,2967,4053,2513,8090,8091,8092,1867,1989,8093,8094, # 8022 8095,1895,8096,8097,4580,1896,4054, 318,8098,2094,4055,4293,8099,8100, 485,8101, # 8038 938,3862, 553,2670, 116,8102,3863,3612,8103,3498,2671,2773,3401,3311,2807,8104, # 8054 3613,2929,4056,1747,2930,2968,8105,8106, 207,8107,8108,2672,4581,2514,8109,3015, # 8070 890,3614,3864,8110,1877,3732,3402,8111,2183,2353,3403,1652,8112,8113,8114, 941, # 8086 2294, 208,3499,4057,2019, 330,4294,3865,2892,2492,3733,4295,8115,8116,8117,8118, # 8102 ) site-packages/pip/_vendor/chardet/euctwfreq.pyo000064400000152666147204247350015710 0ustar00 abc@sdZdZdZdS(g?iiiiiiii iRiiiiiii inii!i iiLi,iAiis iiiiiiL iS iii iiii.iNiiiiii:iiii?iii=iNiKiiiil iii i ii i ii iiii ioi$ iiiii ici8iiiiiiiiizi|iit i"i ie i@i\ii iiiiiiiFiiM iQiHiiiPiviif iiiiDiT iiiFiN iiEi iOii/iisii3i<i2i ii&iLiiiO iiiGiiiM iii?ii i`iiF i*iigi iZi i:ii iiKi ii iiiiii`iiiig ii i iqii~iiiP i ii iii!iiuiii*iii i ii~iiiiieiiGi^iiii iUiCiiBiiiiiii ijioi/iiiOi2 i[iii i& iiiiiSi(ii iipi]ii6iii i' iiiiii8ii+i% i[iii\iiiiiiX i( iii i0ii iHi i i"i!ii+i i1i"iii iOiG iiifi1iiiiiiii2i9iili,ii iiiiii}ih i#iq iQiMi&i iXiii#iii iiiijiiiMiii i%ii ii$iii'i iiN ii ii7iiJii!iiiiiiMii) iPiU iiii ii%i i ii ii i iIii3 ii iir ii i iiiimiii$iiixii iii ii ii%i&ii iiiiiiii&ii'iii'iii.ii iiiH iiiii$i#iiDi&iAi iiiiiiUiGiiii iQ iPiSi'iiidi i0iFiii* iiiiiiiJii iUiiiiI iR iii<iiS i:i7 i ii i i9ii}ii iiiViPiT ii)iCiiii& i i i)iiim iiiiiii4 iiiin i*iiiiiiiO iiiii i+ i(i i iiiU i(ii5iYiji iliiuii)i i*i+iV i i=i iiiiiii4ii!iiiTi, ixiiieii iiJ iPiis i5iAiV i/iki i iili!i iiAii`ii i iiAii iiii ii i iiiiiiMi iiiiiiW iii it iii+i}iij i8 iiiiiiiii- i)imi iiW ii ii iiaii iP iK i i,ii ii7i' iu ii{ik iiiii i9 iiiiiiiiiii1iibii i iiio iiX i,iQ iiiiii i i iX iiii5iDiiiliii[i iiiY ii%ii. iY ii*iii iiR iii ipiiinicigi+iii'i2iiii{iil iim iii: iifi ii|i5 iiiiiZ i i i i ii i,ii iii;iiIiYiii[ iXi"ii iiii~iii,iikiii-iiiiiiDiiii>i]ii,iiiiviLiBiii&iii iiiiGiiiiBii i! iiiu iiiii i iaiiiiv iS ii}i; iiDii=ii0i ii\ i( iiiivi iiiiii.iii9iHiiiii] iEiiiiii!ii/ iii i i-iiiQi*ii.i/iiiii0 i3ii" ii*iRiiiiWiii/iibi.ii iiiiiiiRii ii) ii2ii iiiiiiiZ iiT iiw iiii iiiiiii[ iOii i i`i7ix i^ iiiiiii\ iiiiiiigiiin ii i_ii~iiii0ii iaiiy i] iiiii iii i;ii i-i iiL iiii/iiiii`ii#i"iiiii0i isiiiidisi iiY ii ikiwio ii iiii1ii2iigip iQiiUi iv iiiiiCiSii^ iii5iiiBii_i ibiNiiiXiiii iiLici i i iKiw i* iaiGi3ii i iii1i6i i2i6 iNiii i i3ii:ii\iqiiii-iii i3i iiiix i ii irii4i i_ iiU iiii@ii5i ii ii ii/i+ i6i iiiiiii i7 iZ iiii8i4iiCiii iilii` iiiiiiYiiiii5i i{iiiii$i7iiMiV i0irii iigiiVii8ii9i, iZiii{i#iW i0iii$i i i ii4ii[iiviiiciiViM i$i- iiiiX iii idiiiWi[ iii iiiq i ii1 iiiiitiiii ii i i2 ii2i:i3 i i.iii2ii iiiiii%i iii i i iiiiiii i i6i i4 ii|iiiSiiii_ i iiiii`iiiii i3iii;ir iiii7iYiLi;ii i iiiiiTi\iiii<iiVi5 iii iii ii"ixi%ii;i8 i iii2iEi=i!iiii^iiwi i"iiiis ii#i<iQiiiri$ii]ii%ii. i&i i3i5iBiiy i'iii ii i i>iY ia ib i(i i i)i*i iiiii:ii6ii^ii iii(i i+i+i i ixi,i i.ihi/ i-iiii iVi ii ihiiz i.iiiii<iii;i/i?iii i i0i8i i ii5i6i i_i)i1i2i i3iyi iii i i^i4i i i?i$i+i\ i i5i_iWii iz i6i0 ii i] i iip i7i ii8i^ i< iiVi9i i6 iiIiwi}ic i^ii i9i@ii iAi iii i:iei1iiiBiiiiii i i ii7 i;i<ii=i{ ii(i`iRi1 iYiiIi ii i i6i id i>iiie i?iioiiqiYiniiiliiCiDi{ ii i_ iEiPiUii i iiiiEimii@ii:i ii iAiiiiii# i iNi i iBiiCiWiTiTiii iif i;iDii&i i| iiiiii iii<i= i iii iVii iioii iEi iFiii iiii iiiDi-i8 iiGidi i i iHit iiiIizi iiJi i iKii i| iiiii> iiiiiiiLi:i i=iiMii? i iiiHiiiiiNiii iOiPiiFikiQi9 i iii i iu iiv iiiiiiRiSiii} i i>iiiii i: iTi iiN iiCiiiiUi~ii iWiiGiiii,iiiiiOii|iiiiOi?iVi` ii ii~ i iw iiii@i!iii; iiiiiWii"i iXiiYiiRig iuii ih i ix i=i iiZii< iii[i i#ii= i i\i$ii]iHiIi^i7iO i$ i i_i%iviJii i!iwitii`iaibi9 i&ii"i{ii i i'iciidi8iiiii[i9iiidiZ i ieiii i@ i!i(i"ifiiii i#i$iTigiKii i%iiWiMihiiiiiiii%iiiiii i` iiyi7imiLijiki i: i> i!iiii iBi)ili|i ii iziiii iiMi ii iiimiiniuiq ivii i i*iNioipiiiqi7i.iriiy i iii iifii i isi! iyi iOi i iii+iPij i i>iiii iiYi iAitiiui% i i ivi iiz i2 iwi,i i iii3iQiii ixi i6i9ik iii&i6i ii-i iiRiyiiQi9ici i'i.i ioi(iBiFi? il i i)iei i izi iSiTi iii{i/iii" i ibi/ii`iii0iuiiviii1ii i iiUii*i i/iEiiSii8iZi|i}iFi+i ii!i~i2i,iFiP iim ii iieisiiCi ir iiii iiai3iZi%i-iiii i4iiiiAiii i iii iiiiDi.iiii inii iii iii ii3 i5iJi0i is i ii ii@ iiiVii/i i i6iWiA i7ioi iiPi0ii1iin iiiaiQi2iipi:iiiPiibiiiii i{ i3i7iEiii iii| iFiGiXiiiiii]i i4iii} iii i5ii&ii8i i ii iiiii iLiiiii i iYi iiiii4 i iB i9i8iiiii iHi i/i3iZi[ii io iii:i0i ini\ii]ii^iiii i iiiIiiii;ii4ii<ii=i;i ii iiiXi iiii5 i_ii i iiiii}i0i>ip iJiiiKii ii& iFiiii i i#ii[iiiifi i>iq ii?ir ii6iiii i iiiiijiiiii@i-ipi9i; i6iyiAiii i i' iiiiiiiiViii`ii4iii iKi iai i6 i iiiiii"iiiKi i iiii iYiGioiibifici7i is ipiri i8iiiii i iA iQ i iC i,i ii iiii\iLiiuii~ i iii9iiiBiiZiii iCiiiijidii0ihigiiei iMi} i7 i ii iiDi iiiiifi:iiiNi;i iEiFii( iii<iiiGiMi=iwigii~ it i?iiii itimi# i ii+iiihiiiiii[ i iOi i iii iiB iii$ it ii iiia ii iiHiiiiiQi"i< i i ii-i1ii#iu i'iiD i i ii i iIii>iJi% iiiPi i iii i i=ia iiKiiv iiii i ii ii_iijii?iE i1i i iikii8iQii iliii i imi@i iibiiii iRi iii5ii iiiLi iw iiniiii4iHi iiMii iiiiiii\ iioiiNi] i ii ii\ix igiiEi iiiiiiipii iiqi iiiiiiOiii iri iZi isitiiii iPieiii iiioi ii^ ii}iiiiziAi& iii i iiini-ii iQiiii iiiiRiiui iiiiBiii iy ii iviwiBihiqiiii<ii*iiiSi"iTiCi>i)i ixiUiiii~iiiiziiViiiiiC i)iqiiiWi i iiiDiiEiTiFipiii#i#iyii iiiGiiz iiiii ii iiSiiXi iiiiiu i i=iHiii_ iiRiiiiiiwiiiYizi{iqiii3ii5ii i i{ ii i|i}iSi~ii i i iZi[iiiiii` iiF ii]i i iniiiIii i iiiii iG iTiJiiKiziSiri\i) ii iv ii5iiii ib iiijiiiii iii]i^ii iiciiii i ii iai:i1i iiiiAihi ia i i6iiii ib i-ii iH i_ii ii i iii iiii| ii* ifii ii i iD ii iLiWiiiiUii i ii$ii i i iNiiiR ikiiE iiiiiMiiS i' ii`iisiiF ii iai} i i i( ijii i~ iViBi[ib iWi iibi iI iic i i ii{ii i ii ici i i idi i i]iiii= ieiiiiii iii iNi iiifigi i i iihiiiii i=iiXiiiiiiiiid iiHiCi iiiiTiWi i ii9ii iNi iKiEiji4iJ i iYi iiG i ikiiihiOii i i i]iPiZiiliiQi[ikiiminiRioic iiiiiiSiXiiii\i+iiiiiIiTiUiUiii iili iDiiiipiiqi iki imii iK iiiiiiiVi8 i i iiri@iWiri iCiGiiii ii^i ii i8iti i:i i i!iinisi i"i i#i$i]iti i%i i&iriui'i+ i(i)iie i i}i iiii*i4i1i+ii i i ii ii,ii i> iXitiri? ii i-i iviui{iiw iwii.ixiT i, iii i/i0ii ii1i ii2i iGiRi i i^iiYi iZi i i[i3i^iiii ii i) i\i i4i@ivii5ii6i7iid i]i ii^i8ii&i i ii i9 iyiuii i iiziRii{ii ii(i_ii<i9iili iii_i iSi`iki i[i iii ixi:i i;i<i! i$i=ii|iii>idi i i?iei iiii ii iii i}i@iAiBii.i~iaiOi i ii`ibii i%i iii i;i iiiiCiiDi iiiif i" iL i i i ii iEi;iiFi&iGi i iix iHi)iiiciiIidiTii i ieiiiii iiJi igi~iiUiie i iiiifiai8igi i ibihiKiy iii iLii: i iii ii*iM iiii icitiiMiNiii ii ii iiif iiiYidieii*i iiOiH ii# ii#i; i i iiiiI i\i@ iii isi$ i iPiQi i i iRijiSiTii+iiUiiVi iiLi i!i iJ i\i4iWi iiXiYiZii[i>iwikifiii+iii% iii$ii\iiiili i]iili^i_ig i%ii`iaigiiii iiN iK ibicidii ic iwi iei ibiyi ifihigihihii'iii imiiz ijid iii i i i<iii|iiiiii iiiO iki iliii iaiiimiii ini iiui iniiiie i& i ioiii i i< iipiqiP iQ iiji ii iii(ii_irisi i iii<iEiR ifiiiii]iiiIiti=iiuiivii iioi i iki,iliwi' ii imiiiiFi`ii if i ii iSiJixiiyiziniiL iipiOii ii i{i i iiA iyiiiU ii|i}i~iFi iqii i iiiiii iiiipiiiB iioi iiiipii- iiriiiqiqii( iiriiiisi iii iii i(i. isi) iiti i ii* iiuiiiTiviM i{ iiitii'iiii iiiiiiiig iZiwi i iciiji+ ipiiiixiii ih iiii iiii i, i= i ii i iuiiiii/ iyii i iyivi i iiwiiiiii ii iziiiii>iiCi'iiii{iiZiiii iii iiaiii iiqi?ii ii|ii i"ii ii i}iiiii=iiAi i1ii)iiii?i i iiiixi ii ii i i iihiiS iiii(ii iii'ixiyii ii i i iiiii_i iii> ii}iPiii iiii~ii iN iicii iiiiHii ii iiiiiiiiiiiiij iii i* iiii i i iiih iii_iii/i i<ii~i7ik iT iii]i iU ibi itiiig iizii ii| iiiiiiiii{iii ii0 ii ii+ i i, iiiiIiiiii i iiiBi ii4isi iiiii i iii?iCiii iiGi iiiiiiiiiiiiiii|i1 iiimiC iiil iiii i} ii? iiii iiih iiiIiiiiV iiiiiiii^iiii i- i. iii)iii iiii2 iiiiii ii iiAii ii- iiiii i ii ii iiiiii ii iii iiiQi i iO iiiiiiiiziKii ii[i iJiii@ ii. iiiiiD ii}i/ i@ii iii i i@iiRiii ij i~iiiJiii iiiii i0 iimiiiim i~ ii i ii1 iii iiiiii idiiiiXiii9iii iiiUiiiiiiLii3 ii ii i i iii i iii iii$i(iviii&iibii iii i iiiiii{iiiiiiiiiii2 ii iiii iii iiiiiiii^iiiV i iiiiiiiiiiiiii2iW ii iW ioii iik iX iii iA i4 ii ii3 iii iii ii iii iiiiiii i iiHiiiiiiiiiiiDiiiIisi iii ii iiiiiwii{iiiiiii/ in i,iiiii i iii ii ii i ii4 iB iiiiP i5 i ii i ii ii iii|iiziiiii i'ii5 iiii! ii iyiiiViii i i iiiiiiiiii i iii-iiiiii ii i i iiii ii" i%iiiiJiC iiixiiii i i iil i6 iiiii ii iiiXii ii7 ii i iNi im iiii iWi i i!i ii i i>i8 ii"i#i9 ij iD i i ii$i i%ii iiiXi&ii'iE i i(iF ii)iixi ikiiiii*i+ii iiDiii,iiiiiiiKi-i.i/i: ii0iJiii1i|i iii iii iEi*i2i iiiiiiHixi iii3ii iii3iiii; ipii< i iii ii4i5i i i6iiOii i7i8ii9ii:i ii;iiiii<i iiY i=i>i i i?ii@iAiBi i ii= i iiio i ifiiii i i i iCi iDii# ii i> iiEii iFiZ iE iii i[ i$ i iiGi? ii iiiG iiii@ iHiiA i\ iLiiiii iIi i iiiiiiiJi i i i iKiLi] iMiNi iijiiQ i iB iOiPiiiQi iiiRi iSiTii(iiiiC iiUiiVi iWiXiiiYiiiiZiiidi[iciH ii_ii#i0 i\ii]iini i iiii^iii_ik iD ii`iaii ibii i iciiiiidiii iiiidi^ iE ieiiii iiiifii_ i7iiii i iiF iiigi-iii! iiihi iqi;i iiiiXii i iiiiijiiii ikiliii~imiG i` iniyip iiioi>iipiiqi iiiriia iiiisiti" iui|ii?iiiiviiiiiieiiiwixiyiiiiizi{i@i|ii i}i i iii% isiiR ii.iiMi?i ii~iiib iii@ii iiiii iiiiiiii ii6 iI iiii iiiiic iiiiii i i2iiiimii@iiii iiiNii iifiiiiZi iiiiii i\iH iid iiiJ ii ii i iiii iiK iiii# iiii ii iiiiKiiiiigiiiihii>ii.iiiiiiiii)in itiiiii io i iI i i iiiq iiir i iiiiiip ii ii iziiiiUiiJ iii1 iK itiiiiiii iiiJiiiL i iiiiiiN(iiiiiii iRiiiiiii inii!i iiLi,iAiis iiiiiiL iS iii iiii.iNiiiiii:iiii?iii=iNiKiiiil iii i ii i ii iiii ioi$ iiiii ici8iiiiiiiiizi|iit i"i ie i@i\ii iiiiiiiFiiM iQiHiiiPiviif iiiiDiT iiiFiN iiEi iOii/iisii3i<i2i ii&iLiiiO iiiGiiiM iii?ii i`iiF i*iigi iZi i:ii iiKi ii iiiiii`iiiig ii i iqii~iiiP i ii iii!iiuiii*iii i ii~iiiiieiiGi^iiii iUiCiiBiiiiiii ijioi/iiiOi2 i[iii i& iiiiiSi(ii iipi]ii6iii i' iiiiii8ii+i% i[iii\iiiiiiX i( iii i0ii iHi i i"i!ii+i i1i"iii iOiG iiifi1iiiiiiii2i9iili,ii iiiiii}ih i#iq iQiMi&i iXiii#iii iiiijiiiMiii i%ii ii$iii'i iiN ii ii7iiJii!iiiiiiMii) iPiU iiii ii%i i ii ii i iIii3 ii iir ii i iiiimiii$iiixii iii ii ii%i&ii iiiiiiii&ii'iii'iii.ii iiiH iiiii$i#iiDi&iAi iiiiiiUiGiiii iQ iPiSi'iiidi i0iFiii* iiiiiiiJii iUiiiiI iR iii<iiS i:i7 i ii i i9ii}ii iiiViPiT ii)iCiiii& i i i)iiim iiiiiii4 iiiin i*iiiiiiiO iiiii i+ i(i i iiiU i(ii5iYiji iliiuii)i i*i+iV i i=i iiiiiii4ii!iiiTi, ixiiieii iiJ iPiis i5iAiV i/iki i iili!i iiAii`ii i iiAii iiii ii i iiiiiiMi iiiiiiW iii it iii+i}iij i8 iiiiiiiii- i)imi iiW ii ii iiaii iP iK i i,ii ii7i' iu ii{ik iiiii i9 iiiiiiiiiii1iibii i iiio iiX i,iQ iiiiii i i iX iiii5iDiiiliii[i iiiY ii%ii. iY ii*iii iiR iii ipiiinicigi+iii'i2iiii{iil iim iii: iifi ii|i5 iiiiiZ i i i i ii i,ii iii;iiIiYiii[ iXi"ii iiii~iii,iikiii-iiiiiiDiiii>i]ii,iiiiviLiBiii&iii iiiiGiiiiBii i! iiiu iiiii i iaiiiiv iS ii}i; iiDii=ii0i ii\ i( iiiivi iiiiii.iii9iHiiiii] iEiiiiii!ii/ iii i i-iiiQi*ii.i/iiiii0 i3ii" ii*iRiiiiWiii/iibi.ii iiiiiiiRii ii) ii2ii iiiiiiiZ iiT iiw iiii iiiiiii[ iOii i i`i7ix i^ iiiiiii\ iiiiiiigiiin ii i_ii~iiii0ii iaiiy i] iiiii iii i;ii i-i iiL iiii/iiiii`ii#i"iiiii0i isiiiidisi iiY ii ikiwio ii iiii1ii2iigip iQiiUi iv iiiiiCiSii^ iii5iiiBii_i ibiNiiiXiiii iiLici i i iKiw i* iaiGi3ii i iii1i6i i2i6 iNiii i i3ii:ii\iqiiii-iii i3i iiiix i ii irii4i i_ iiU iiii@ii5i ii ii ii/i+ i6i iiiiiii i7 iZ iiii8i4iiCiii iilii` iiiiiiYiiiii5i i{iiiii$i7iiMiV i0irii iigiiVii8ii9i, iZiii{i#iW i0iii$i i i ii4ii[iiviiiciiViM i$i- iiiiX iii idiiiWi[ iii iiiq i ii1 iiiiitiiii ii i i2 ii2i:i3 i i.iii2ii iiiiii%i iii i i iiiiiii i i6i i4 ii|iiiSiiii_ i iiiii`iiiii i3iii;ir iiii7iYiLi;ii i iiiiiTi\iiii<iiVi5 iii iii ii"ixi%ii;i8 i iii2iEi=i!iiii^iiwi i"iiiis ii#i<iQiiiri$ii]ii%ii. i&i i3i5iBiiy i'iii ii i i>iY ia ib i(i i i)i*i iiiii:ii6ii^ii iii(i i+i+i i ixi,i i.ihi/ i-iiii iVi ii ihiiz i.iiiii<iii;i/i?iii i i0i8i i ii5i6i i_i)i1i2i i3iyi iii i i^i4i i i?i$i+i\ i i5i_iWii iz i6i0 ii i] i iip i7i ii8i^ i< iiVi9i i6 iiIiwi}ic i^ii i9i@ii iAi iii i:iei1iiiBiiiiii i i ii7 i;i<ii=i{ ii(i`iRi1 iYiiIi ii i i6i id i>iiie i?iioiiqiYiniiiliiCiDi{ ii i_ iEiPiUii i iiiiEimii@ii:i ii iAiiiiii# i iNi i iBiiCiWiTiTiii iif i;iDii&i i| iiiiii iii<i= i iii iVii iioii iEi iFiii iiii iiiDi-i8 iiGidi i i iHit iiiIizi iiJi i iKii i| iiiii> iiiiiiiLi:i i=iiMii? i iiiHiiiiiNiii iOiPiiFikiQi9 i iii i iu iiv iiiiiiRiSiii} i i>iiiii i: iTi iiN iiCiiiiUi~ii iWiiGiiii,iiiiiOii|iiiiOi?iVi` ii ii~ i iw iiii@i!iii; iiiiiWii"i iXiiYiiRig iuii ih i ix i=i iiZii< iii[i i#ii= i i\i$ii]iHiIi^i7iO i$ i i_i%iviJii i!iwitii`iaibi9 i&ii"i{ii i i'iciidi8iiiii[i9iiidiZ i ieiii i@ i!i(i"ifiiii i#i$iTigiKii i%iiWiMihiiiiiiii%iiiiii i` iiyi7imiLijiki i: i> i!iiii iBi)ili|i ii iziiii iiMi ii iiimiiniuiq ivii i i*iNioipiiiqi7i.iriiy i iii iifii i isi! iyi iOi i iii+iPij i i>iiii iiYi iAitiiui% i i ivi iiz i2 iwi,i i iii3iQiii ixi i6i9ik iii&i6i ii-i iiRiyiiQi9ici i'i.i ioi(iBiFi? il i i)iei i izi iSiTi iii{i/iii" i ibi/ii`iii0iuiiviii1ii i iiUii*i i/iEiiSii8iZi|i}iFi+i ii!i~i2i,iFiP iim ii iieisiiCi ir iiii iiai3iZi%i-iiii i4iiiiAiii i iii iiiiDi.iiii inii iii iii ii3 i5iJi0i is i ii ii@ iiiVii/i i i6iWiA i7ioi iiPi0ii1iin iiiaiQi2iipi:iiiPiibiiiii i{ i3i7iEiii iii| iFiGiXiiiiii]i i4iii} iii i5ii&ii8i i ii iiiii iLiiiii i iYi iiiii4 i iB i9i8iiiii iHi i/i3iZi[ii io iii:i0i ini\ii]ii^iiii i iiiIiiii;ii4ii<ii=i;i ii iiiXi iiii5 i_ii i iiiii}i0i>ip iJiiiKii ii& iFiiii i i#ii[iiiifi i>iq ii?ir ii6iiii i iiiiijiiiii@i-ipi9i; i6iyiAiii i i' iiiiiiiiViii`ii4iii iKi iai i6 i iiiiii"iiiKi i iiii iYiGioiibifici7i is ipiri i8iiiii i iA iQ i iC i,i ii iiii\iLiiuii~ i iii9iiiBiiZiii iCiiiijidii0ihigiiei iMi} i7 i ii iiDi iiiiifi:iiiNi;i iEiFii( iii<iiiGiMi=iwigii~ it i?iiii itimi# i ii+iiihiiiiii[ i iOi i iii iiB iii$ it ii iiia ii iiHiiiiiQi"i< i i ii-i1ii#iu i'iiD i i ii i iIii>iJi% iiiPi i iii i i=ia iiKiiv iiii i ii ii_iijii?iE i1i i iikii8iQii iliii i imi@i iibiiii iRi iii5ii iiiLi iw iiniiii4iHi iiMii iiiiiii\ iioiiNi] i ii ii\ix igiiEi iiiiiiipii iiqi iiiiiiOiii iri iZi isitiiii iPieiii iiioi ii^ ii}iiiiziAi& iii i iiini-ii iQiiii iiiiRiiui iiiiBiii iy ii iviwiBihiqiiii<ii*iiiSi"iTiCi>i)i ixiUiiii~iiiiziiViiiiiC i)iqiiiWi i iiiDiiEiTiFipiii#i#iyii iiiGiiz iiiii ii iiSiiXi iiiiiu i i=iHiii_ iiRiiiiiiwiiiYizi{iqiii3ii5ii i i{ ii i|i}iSi~ii i i iZi[iiiiii` iiF ii]i i iniiiIii i iiiii iG iTiJiiKiziSiri\i) ii iv ii5iiii ib iiijiiiii iii]i^ii iiciiii i ii iai:i1i iiiiAihi ia i i6iiii ib i-ii iH i_ii ii i iii iiii| ii* ifii ii i iD ii iLiWiiiiUii i ii$ii i i iNiiiR ikiiE iiiiiMiiS i' ii`iisiiF ii iai} i i i( ijii i~ iViBi[ib iWi iibi iI iic i i ii{ii i ii ici i i idi i i]iiii= ieiiiiii iii iNi iiifigi i i iihiiiii i=iiXiiiiiiiiid iiHiCi iiiiTiWi i ii9ii iNi iKiEiji4iJ i iYi iiG i ikiiihiOii i i i]iPiZiiliiQi[ikiiminiRioic iiiiiiSiXiiii\i+iiiiiIiTiUiUiii iili iDiiiipiiqi iki imii iK iiiiiiiVi8 i i iiri@iWiri iCiGiiii ii^i ii i8iti i:i i i!iinisi i"i i#i$i]iti i%i i&iriui'i+ i(i)iie i i}i iiii*i4i1i+ii i i ii ii,ii i> iXitiri? ii i-i iviui{iiw iwii.ixiT i, iii i/i0ii ii1i ii2i iGiRi i i^iiYi iZi i i[i3i^iiii ii i) i\i i4i@ivii5ii6i7iid i]i ii^i8ii&i i ii i9 iyiuii i iiziRii{ii ii(i_ii<i9iili iii_i iSi`iki i[i iii ixi:i i;i<i! i$i=ii|iii>idi i i?iei iiii ii iii i}i@iAiBii.i~iaiOi i ii`ibii i%i iii i;i iiiiCiiDi iiiif i" iL i i i ii iEi;iiFi&iGi i iix iHi)iiiciiIidiTii i ieiiiii iiJi igi~iiUiie i iiiifiai8igi i ibihiKiy iii iLii: i iii ii*iM iiii icitiiMiNiii ii ii iiif iiiYidieii*i iiOiH ii# ii#i; i i iiiiI i\i@ iii isi$ i iPiQi i i iRijiSiTii+iiUiiVi iiLi i!i iJ i\i4iWi iiXiYiZii[i>iwikifiii+iii% iii$ii\iiiili i]iili^i_ig i%ii`iaigiiii iiN iK ibicidii ic iwi iei ibiyi ifihigihihii'iii imiiz ijid iii i i i<iii|iiiiii iiiO iki iliii iaiiimiii ini iiui iniiiie i& i ioiii i i< iipiqiP iQ iiji ii iii(ii_irisi i iii<iEiR ifiiiii]iiiIiti=iiuiivii iioi i iki,iliwi' ii imiiiiFi`ii if i ii iSiJixiiyiziniiL iipiOii ii i{i i iiA iyiiiU ii|i}i~iFi iqii i iiiiii iiiipiiiB iioi iiiipii- iiriiiqiqii( iiriiiisi iii iii i(i. isi) iiti i ii* iiuiiiTiviM i{ iiitii'iiii iiiiiiiig iZiwi i iciiji+ ipiiiixiii ih iiii iiii i, i= i ii i iuiiiii/ iyii i iyivi i iiwiiiiii ii iziiiii>iiCi'iiii{iiZiiii iii iiaiii iiqi?ii ii|ii i"ii ii i}iiiii=iiAi i1ii)iiii?i i iiiixi ii ii i i iihiiS iiii(ii iii'ixiyii ii i i iiiii_i iii> ii}iPiii iiii~ii iN iicii iiiiHii ii iiiiiiiiiiiiij iii i* iiii i i iiih iii_iii/i i<ii~i7ik iT iii]i iU ibi itiiig iizii ii| iiiiiiiii{iii ii0 ii ii+ i i, iiiiIiiiii i iiiBi ii4isi iiiii i iii?iCiii iiGi iiiiiiiiiiiiiii|i1 iiimiC iiil iiii i} ii? iiii iiih iiiIiiiiV iiiiiiii^iiii i- i. iii)iii iiii2 iiiiii ii iiAii ii- iiiii i ii ii iiiiii ii iii iiiQi i iO iiiiiiiiziKii ii[i iJiii@ ii. iiiiiD ii}i/ i@ii iii i i@iiRiii ij i~iiiJiii iiiii i0 iimiiiim i~ ii i ii1 iii iiiiii idiiiiXiii9iii iiiUiiiiiiLii3 ii ii i i iii i iii iii$i(iviii&iibii iii i iiiiii{iiiiiiiiiii2 ii iiii iii iiiiiiii^iiiV i iiiiiiiiiiiiii2iW ii iW ioii iik iX iii iA i4 ii ii3 iii iii ii iii iiiiiii i iiHiiiiiiiiiiiDiiiIisi iii ii iiiiiwii{iiiiiii/ in i,iiiii i iii ii ii i ii4 iB iiiiP i5 i ii i ii ii iii|iiziiiii i'ii5 iiii! ii iyiiiViii i i iiiiiiiiii i iii-iiiiii ii i i iiii ii" i%iiiiJiC iiixiiii i i iil i6 iiiii ii iiiXii ii7 ii i iNi im iiii iWi i i!i ii i i>i8 ii"i#i9 ij iD i i ii$i i%ii iiiXi&ii'iE i i(iF ii)iixi ikiiiii*i+ii iiDiii,iiiiiiiKi-i.i/i: ii0iJiii1i|i iii iii iEi*i2i iiiiiiHixi iii3ii iii3iiii; ipii< i iii ii4i5i i i6iiOii i7i8ii9ii:i ii;iiiii<i iiY i=i>i i i?ii@iAiBi i ii= i iiio i ifiiii i i i iCi iDii# ii i> iiEii iFiZ iE iii i[ i$ i iiGi? ii iiiG iiii@ iHiiA i\ iLiiiii iIi i iiiiiiiJi i i i iKiLi] iMiNi iijiiQ i iB iOiPiiiQi iiiRi iSiTii(iiiiC iiUiiVi iWiXiiiYiiiiZiiidi[iciH ii_ii#i0 i\ii]iini i iiii^iii_ik iD ii`iaii ibii i iciiiiidiii iiiidi^ iE ieiiii iiiifii_ i7iiii i iiF iiigi-iii! iiihi iqi;i iiiiXii i iiiiijiiii ikiliii~imiG i` iniyip iiioi>iipiiqi iiiriia iiiisiti" iui|ii?iiiiviiiiiieiiiwixiyiiiiizi{i@i|ii i}i i iii% isiiR ii.iiMi?i ii~iiib iii@ii iiiii iiiiiiii ii6 iI iiii iiiiic iiiiii i i2iiiimii@iiii iiiNii iifiiiiZi iiiiii i\iH iid iiiJ ii ii i iiii iiK iiii# iiii ii iiiiKiiiiigiiiihii>ii.iiiiiiiii)in itiiiii io i iI i i iiiq iiir i iiiiiip ii ii iziiiiUiiJ iii1 iK itiiiiiii iiiJiiiL i iiiiii(t EUCTW_TYPICAL_DISTRIBUTION_RATIOtEUCTW_TABLE_SIZEtEUCTW_CHAR_TO_FREQ_ORDER(((sA/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euctwfreq.pyt,ssite-packages/pip/_vendor/chardet/euctwprober.py000064400000003323147204247350016046 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import EUCTWDistributionAnalysis from .mbcssm import EUCTW_SM_MODEL class EUCTWProber(MultiByteCharSetProber): def __init__(self): super(EUCTWProber, self).__init__() self.coding_sm = CodingStateMachine(EUCTW_SM_MODEL) self.distribution_analyzer = EUCTWDistributionAnalysis() self.reset() @property def charset_name(self): return "EUC-TW" @property def language(self): return "Taiwan" site-packages/pip/_vendor/chardet/euctwprober.pyo000064400000002526147204247350016231 0ustar00 abc@sZddlmZddlmZddlmZddlmZdefdYZdS(i(tMultiByteCharSetProber(tCodingStateMachine(tEUCTWDistributionAnalysis(tEUCTW_SM_MODELt EUCTWProbercBs/eZdZedZedZRS(cCs<tt|jtt|_t|_|jdS(N( tsuperRt__init__RRt coding_smRtdistribution_analyzertreset(tself((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euctwprober.pyR"s cCsdS(NsEUC-TW((R ((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euctwprober.pyt charset_name(scCsdS(NtTaiwan((R ((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euctwprober.pytlanguage,s(t__name__t __module__RtpropertyR R (((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euctwprober.pyR!s N( tmbcharsetproberRtcodingstatemachineRtchardistributionRtmbcssmRR(((sC/usr/lib/python2.7/site-packages/pip/_vendor/chardet/euctwprober.pytssite-packages/pip/_vendor/chardet/gb2312freq.py000064400000050353147204247350015270 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # GB2312 most frequently used character table # # Char to FreqOrder table , from hz6763 # 512 --> 0.79 -- 0.79 # 1024 --> 0.92 -- 0.13 # 2048 --> 0.98 -- 0.06 # 6768 --> 1.00 -- 0.02 # # Ideal Distribution Ratio = 0.79135/(1-0.79135) = 3.79 # Random Distribution Ration = 512 / (3755 - 512) = 0.157 # # Typical Distribution Ratio about 25% of Ideal one, still much higher that RDR GB2312_TYPICAL_DISTRIBUTION_RATIO = 0.9 GB2312_TABLE_SIZE = 3760 GB2312_CHAR_TO_FREQ_ORDER = ( 1671, 749,1443,2364,3924,3807,2330,3921,1704,3463,2691,1511,1515, 572,3191,2205, 2361, 224,2558, 479,1711, 963,3162, 440,4060,1905,2966,2947,3580,2647,3961,3842, 2204, 869,4207, 970,2678,5626,2944,2956,1479,4048, 514,3595, 588,1346,2820,3409, 249,4088,1746,1873,2047,1774, 581,1813, 358,1174,3590,1014,1561,4844,2245, 670, 1636,3112, 889,1286, 953, 556,2327,3060,1290,3141, 613, 185,3477,1367, 850,3820, 1715,2428,2642,2303,2732,3041,2562,2648,3566,3946,1349, 388,3098,2091,1360,3585, 152,1687,1539, 738,1559, 59,1232,2925,2267,1388,1249,1741,1679,2960, 151,1566, 1125,1352,4271, 924,4296, 385,3166,4459, 310,1245,2850, 70,3285,2729,3534,3575, 2398,3298,3466,1960,2265, 217,3647, 864,1909,2084,4401,2773,1010,3269,5152, 853, 3051,3121,1244,4251,1895, 364,1499,1540,2313,1180,3655,2268, 562, 715,2417,3061, 544, 336,3768,2380,1752,4075, 950, 280,2425,4382, 183,2759,3272, 333,4297,2155, 1688,2356,1444,1039,4540, 736,1177,3349,2443,2368,2144,2225, 565, 196,1482,3406, 927,1335,4147, 692, 878,1311,1653,3911,3622,1378,4200,1840,2969,3149,2126,1816, 2534,1546,2393,2760, 737,2494, 13, 447, 245,2747, 38,2765,2129,2589,1079, 606, 360, 471,3755,2890, 404, 848, 699,1785,1236, 370,2221,1023,3746,2074,2026,2023, 2388,1581,2119, 812,1141,3091,2536,1519, 804,2053, 406,1596,1090, 784, 548,4414, 1806,2264,2936,1100, 343,4114,5096, 622,3358, 743,3668,1510,1626,5020,3567,2513, 3195,4115,5627,2489,2991, 24,2065,2697,1087,2719, 48,1634, 315, 68, 985,2052, 198,2239,1347,1107,1439, 597,2366,2172, 871,3307, 919,2487,2790,1867, 236,2570, 1413,3794, 906,3365,3381,1701,1982,1818,1524,2924,1205, 616,2586,2072,2004, 575, 253,3099, 32,1365,1182, 197,1714,2454,1201, 554,3388,3224,2748, 756,2587, 250, 2567,1507,1517,3529,1922,2761,2337,3416,1961,1677,2452,2238,3153, 615, 911,1506, 1474,2495,1265,1906,2749,3756,3280,2161, 898,2714,1759,3450,2243,2444, 563, 26, 3286,2266,3769,3344,2707,3677, 611,1402, 531,1028,2871,4548,1375, 261,2948, 835, 1190,4134, 353, 840,2684,1900,3082,1435,2109,1207,1674, 329,1872,2781,4055,2686, 2104, 608,3318,2423,2957,2768,1108,3739,3512,3271,3985,2203,1771,3520,1418,2054, 1681,1153, 225,1627,2929, 162,2050,2511,3687,1954, 124,1859,2431,1684,3032,2894, 585,4805,3969,2869,2704,2088,2032,2095,3656,2635,4362,2209, 256, 518,2042,2105, 3777,3657, 643,2298,1148,1779, 190, 989,3544, 414, 11,2135,2063,2979,1471, 403, 3678, 126, 770,1563, 671,2499,3216,2877, 600,1179, 307,2805,4937,1268,1297,2694, 252,4032,1448,1494,1331,1394, 127,2256, 222,1647,1035,1481,3056,1915,1048, 873, 3651, 210, 33,1608,2516, 200,1520, 415, 102, 0,3389,1287, 817, 91,3299,2940, 836,1814, 549,2197,1396,1669,2987,3582,2297,2848,4528,1070, 687, 20,1819, 121, 1552,1364,1461,1968,2617,3540,2824,2083, 177, 948,4938,2291, 110,4549,2066, 648, 3359,1755,2110,2114,4642,4845,1693,3937,3308,1257,1869,2123, 208,1804,3159,2992, 2531,2549,3361,2418,1350,2347,2800,2568,1291,2036,2680, 72, 842,1990, 212,1233, 1154,1586, 75,2027,3410,4900,1823,1337,2710,2676, 728,2810,1522,3026,4995, 157, 755,1050,4022, 710, 785,1936,2194,2085,1406,2777,2400, 150,1250,4049,1206, 807, 1910, 534, 529,3309,1721,1660, 274, 39,2827, 661,2670,1578, 925,3248,3815,1094, 4278,4901,4252, 41,1150,3747,2572,2227,4501,3658,4902,3813,3357,3617,2884,2258, 887, 538,4187,3199,1294,2439,3042,2329,2343,2497,1255, 107, 543,1527, 521,3478, 3568, 194,5062, 15, 961,3870,1241,1192,2664, 66,5215,3260,2111,1295,1127,2152, 3805,4135, 901,1164,1976, 398,1278, 530,1460, 748, 904,1054,1966,1426, 53,2909, 509, 523,2279,1534, 536,1019, 239,1685, 460,2353, 673,1065,2401,3600,4298,2272, 1272,2363, 284,1753,3679,4064,1695, 81, 815,2677,2757,2731,1386, 859, 500,4221, 2190,2566, 757,1006,2519,2068,1166,1455, 337,2654,3203,1863,1682,1914,3025,1252, 1409,1366, 847, 714,2834,2038,3209, 964,2970,1901, 885,2553,1078,1756,3049, 301, 1572,3326, 688,2130,1996,2429,1805,1648,2930,3421,2750,3652,3088, 262,1158,1254, 389,1641,1812, 526,1719, 923,2073,1073,1902, 468, 489,4625,1140, 857,2375,3070, 3319,2863, 380, 116,1328,2693,1161,2244, 273,1212,1884,2769,3011,1775,1142, 461, 3066,1200,2147,2212, 790, 702,2695,4222,1601,1058, 434,2338,5153,3640, 67,2360, 4099,2502, 618,3472,1329, 416,1132, 830,2782,1807,2653,3211,3510,1662, 192,2124, 296,3979,1739,1611,3684, 23, 118, 324, 446,1239,1225, 293,2520,3814,3795,2535, 3116, 17,1074, 467,2692,2201, 387,2922, 45,1326,3055,1645,3659,2817, 958, 243, 1903,2320,1339,2825,1784,3289, 356, 576, 865,2315,2381,3377,3916,1088,3122,1713, 1655, 935, 628,4689,1034,1327, 441, 800, 720, 894,1979,2183,1528,5289,2702,1071, 4046,3572,2399,1571,3281, 79, 761,1103, 327, 134, 758,1899,1371,1615, 879, 442, 215,2605,2579, 173,2048,2485,1057,2975,3317,1097,2253,3801,4263,1403,1650,2946, 814,4968,3487,1548,2644,1567,1285, 2, 295,2636, 97, 946,3576, 832, 141,4257, 3273, 760,3821,3521,3156,2607, 949,1024,1733,1516,1803,1920,2125,2283,2665,3180, 1501,2064,3560,2171,1592, 803,3518,1416, 732,3897,4258,1363,1362,2458, 119,1427, 602,1525,2608,1605,1639,3175, 694,3064, 10, 465, 76,2000,4846,4208, 444,3781, 1619,3353,2206,1273,3796, 740,2483, 320,1723,2377,3660,2619,1359,1137,1762,1724, 2345,2842,1850,1862, 912, 821,1866, 612,2625,1735,2573,3369,1093, 844, 89, 937, 930,1424,3564,2413,2972,1004,3046,3019,2011, 711,3171,1452,4178, 428, 801,1943, 432, 445,2811, 206,4136,1472, 730, 349, 73, 397,2802,2547, 998,1637,1167, 789, 396,3217, 154,1218, 716,1120,1780,2819,4826,1931,3334,3762,2139,1215,2627, 552, 3664,3628,3232,1405,2383,3111,1356,2652,3577,3320,3101,1703, 640,1045,1370,1246, 4996, 371,1575,2436,1621,2210, 984,4033,1734,2638, 16,4529, 663,2755,3255,1451, 3917,2257,1253,1955,2234,1263,2951, 214,1229, 617, 485, 359,1831,1969, 473,2310, 750,2058, 165, 80,2864,2419, 361,4344,2416,2479,1134, 796,3726,1266,2943, 860, 2715, 938, 390,2734,1313,1384, 248, 202, 877,1064,2854, 522,3907, 279,1602, 297, 2357, 395,3740, 137,2075, 944,4089,2584,1267,3802, 62,1533,2285, 178, 176, 780, 2440, 201,3707, 590, 478,1560,4354,2117,1075, 30, 74,4643,4004,1635,1441,2745, 776,2596, 238,1077,1692,1912,2844, 605, 499,1742,3947, 241,3053, 980,1749, 936, 2640,4511,2582, 515,1543,2162,5322,2892,2993, 890,2148,1924, 665,1827,3581,1032, 968,3163, 339,1044,1896, 270, 583,1791,1720,4367,1194,3488,3669, 43,2523,1657, 163,2167, 290,1209,1622,3378, 550, 634,2508,2510, 695,2634,2384,2512,1476,1414, 220,1469,2341,2138,2852,3183,2900,4939,2865,3502,1211,3680, 854,3227,1299,2976, 3172, 186,2998,1459, 443,1067,3251,1495, 321,1932,3054, 909, 753,1410,1828, 436, 2441,1119,1587,3164,2186,1258, 227, 231,1425,1890,3200,3942, 247, 959, 725,5254, 2741, 577,2158,2079, 929, 120, 174, 838,2813, 591,1115, 417,2024, 40,3240,1536, 1037, 291,4151,2354, 632,1298,2406,2500,3535,1825,1846,3451, 205,1171, 345,4238, 18,1163, 811, 685,2208,1217, 425,1312,1508,1175,4308,2552,1033, 587,1381,3059, 2984,3482, 340,1316,4023,3972, 792,3176, 519, 777,4690, 918, 933,4130,2981,3741, 90,3360,2911,2200,5184,4550, 609,3079,2030, 272,3379,2736, 363,3881,1130,1447, 286, 779, 357,1169,3350,3137,1630,1220,2687,2391, 747,1277,3688,2618,2682,2601, 1156,3196,5290,4034,3102,1689,3596,3128, 874, 219,2783, 798, 508,1843,2461, 269, 1658,1776,1392,1913,2983,3287,2866,2159,2372, 829,4076, 46,4253,2873,1889,1894, 915,1834,1631,2181,2318, 298, 664,2818,3555,2735, 954,3228,3117, 527,3511,2173, 681,2712,3033,2247,2346,3467,1652, 155,2164,3382, 113,1994, 450, 899, 494, 994, 1237,2958,1875,2336,1926,3727, 545,1577,1550, 633,3473, 204,1305,3072,2410,1956, 2471, 707,2134, 841,2195,2196,2663,3843,1026,4940, 990,3252,4997, 368,1092, 437, 3212,3258,1933,1829, 675,2977,2893, 412, 943,3723,4644,3294,3283,2230,2373,5154, 2389,2241,2661,2323,1404,2524, 593, 787, 677,3008,1275,2059, 438,2709,2609,2240, 2269,2246,1446, 36,1568,1373,3892,1574,2301,1456,3962, 693,2276,5216,2035,1143, 2720,1919,1797,1811,2763,4137,2597,1830,1699,1488,1198,2090, 424,1694, 312,3634, 3390,4179,3335,2252,1214, 561,1059,3243,2295,2561, 975,5155,2321,2751,3772, 472, 1537,3282,3398,1047,2077,2348,2878,1323,3340,3076, 690,2906, 51, 369, 170,3541, 1060,2187,2688,3670,2541,1083,1683, 928,3918, 459, 109,4427, 599,3744,4286, 143, 2101,2730,2490, 82,1588,3036,2121, 281,1860, 477,4035,1238,2812,3020,2716,3312, 1530,2188,2055,1317, 843, 636,1808,1173,3495, 649, 181,1002, 147,3641,1159,2414, 3750,2289,2795, 813,3123,2610,1136,4368, 5,3391,4541,2174, 420, 429,1728, 754, 1228,2115,2219, 347,2223,2733, 735,1518,3003,2355,3134,1764,3948,3329,1888,2424, 1001,1234,1972,3321,3363,1672,1021,1450,1584, 226, 765, 655,2526,3404,3244,2302, 3665, 731, 594,2184, 319,1576, 621, 658,2656,4299,2099,3864,1279,2071,2598,2739, 795,3086,3699,3908,1707,2352,2402,1382,3136,2475,1465,4847,3496,3865,1085,3004, 2591,1084, 213,2287,1963,3565,2250, 822, 793,4574,3187,1772,1789,3050, 595,1484, 1959,2770,1080,2650, 456, 422,2996, 940,3322,4328,4345,3092,2742, 965,2784, 739, 4124, 952,1358,2498,2949,2565, 332,2698,2378, 660,2260,2473,4194,3856,2919, 535, 1260,2651,1208,1428,1300,1949,1303,2942, 433,2455,2450,1251,1946, 614,1269, 641, 1306,1810,2737,3078,2912, 564,2365,1419,1415,1497,4460,2367,2185,1379,3005,1307, 3218,2175,1897,3063, 682,1157,4040,4005,1712,1160,1941,1399, 394, 402,2952,1573, 1151,2986,2404, 862, 299,2033,1489,3006, 346, 171,2886,3401,1726,2932, 168,2533, 47,2507,1030,3735,1145,3370,1395,1318,1579,3609,4560,2857,4116,1457,2529,1965, 504,1036,2690,2988,2405, 745,5871, 849,2397,2056,3081, 863,2359,3857,2096, 99, 1397,1769,2300,4428,1643,3455,1978,1757,3718,1440, 35,4879,3742,1296,4228,2280, 160,5063,1599,2013, 166, 520,3479,1646,3345,3012, 490,1937,1545,1264,2182,2505, 1096,1188,1369,1436,2421,1667,2792,2460,1270,2122, 727,3167,2143, 806,1706,1012, 1800,3037, 960,2218,1882, 805, 139,2456,1139,1521, 851,1052,3093,3089, 342,2039, 744,5097,1468,1502,1585,2087, 223, 939, 326,2140,2577, 892,2481,1623,4077, 982, 3708, 135,2131, 87,2503,3114,2326,1106, 876,1616, 547,2997,2831,2093,3441,4530, 4314, 9,3256,4229,4148, 659,1462,1986,1710,2046,2913,2231,4090,4880,5255,3392, 3274,1368,3689,4645,1477, 705,3384,3635,1068,1529,2941,1458,3782,1509, 100,1656, 2548, 718,2339, 408,1590,2780,3548,1838,4117,3719,1345,3530, 717,3442,2778,3220, 2898,1892,4590,3614,3371,2043,1998,1224,3483, 891, 635, 584,2559,3355, 733,1766, 1729,1172,3789,1891,2307, 781,2982,2271,1957,1580,5773,2633,2005,4195,3097,1535, 3213,1189,1934,5693,3262, 586,3118,1324,1598, 517,1564,2217,1868,1893,4445,3728, 2703,3139,1526,1787,1992,3882,2875,1549,1199,1056,2224,1904,2711,5098,4287, 338, 1993,3129,3489,2689,1809,2815,1997, 957,1855,3898,2550,3275,3057,1105,1319, 627, 1505,1911,1883,3526, 698,3629,3456,1833,1431, 746, 77,1261,2017,2296,1977,1885, 125,1334,1600, 525,1798,1109,2222,1470,1945, 559,2236,1186,3443,2476,1929,1411, 2411,3135,1777,3372,2621,1841,1613,3229, 668,1430,1839,2643,2916, 195,1989,2671, 2358,1387, 629,3205,2293,5256,4439, 123,1310, 888,1879,4300,3021,3605,1003,1162, 3192,2910,2010, 140,2395,2859, 55,1082,2012,2901, 662, 419,2081,1438, 680,2774, 4654,3912,1620,1731,1625,5035,4065,2328, 512,1344, 802,5443,2163,2311,2537, 524, 3399, 98,1155,2103,1918,2606,3925,2816,1393,2465,1504,3773,2177,3963,1478,4346, 180,1113,4655,3461,2028,1698, 833,2696,1235,1322,1594,4408,3623,3013,3225,2040, 3022, 541,2881, 607,3632,2029,1665,1219, 639,1385,1686,1099,2803,3231,1938,3188, 2858, 427, 676,2772,1168,2025, 454,3253,2486,3556, 230,1950, 580, 791,1991,1280, 1086,1974,2034, 630, 257,3338,2788,4903,1017, 86,4790, 966,2789,1995,1696,1131, 259,3095,4188,1308, 179,1463,5257, 289,4107,1248, 42,3413,1725,2288, 896,1947, 774,4474,4254, 604,3430,4264, 392,2514,2588, 452, 237,1408,3018, 988,4531,1970, 3034,3310, 540,2370,1562,1288,2990, 502,4765,1147, 4,1853,2708, 207, 294,2814, 4078,2902,2509, 684, 34,3105,3532,2551, 644, 709,2801,2344, 573,1727,3573,3557, 2021,1081,3100,4315,2100,3681, 199,2263,1837,2385, 146,3484,1195,2776,3949, 997, 1939,3973,1008,1091,1202,1962,1847,1149,4209,5444,1076, 493, 117,5400,2521, 972, 1490,2934,1796,4542,2374,1512,2933,2657, 413,2888,1135,2762,2314,2156,1355,2369, 766,2007,2527,2170,3124,2491,2593,2632,4757,2437, 234,3125,3591,1898,1750,1376, 1942,3468,3138, 570,2127,2145,3276,4131, 962, 132,1445,4196, 19, 941,3624,3480, 3366,1973,1374,4461,3431,2629, 283,2415,2275, 808,2887,3620,2112,2563,1353,3610, 955,1089,3103,1053, 96, 88,4097, 823,3808,1583, 399, 292,4091,3313, 421,1128, 642,4006, 903,2539,1877,2082, 596, 29,4066,1790, 722,2157, 130, 995,1569, 769, 1485, 464, 513,2213, 288,1923,1101,2453,4316, 133, 486,2445, 50, 625, 487,2207, 57, 423, 481,2962, 159,3729,1558, 491, 303, 482, 501, 240,2837, 112,3648,2392, 1783, 362, 8,3433,3422, 610,2793,3277,1390,1284,1654, 21,3823, 734, 367, 623, 193, 287, 374,1009,1483, 816, 476, 313,2255,2340,1262,2150,2899,1146,2581, 782, 2116,1659,2018,1880, 255,3586,3314,1110,2867,2137,2564, 986,2767,5185,2006, 650, 158, 926, 762, 881,3157,2717,2362,3587, 306,3690,3245,1542,3077,2427,1691,2478, 2118,2985,3490,2438, 539,2305, 983, 129,1754, 355,4201,2386, 827,2923, 104,1773, 2838,2771, 411,2905,3919, 376, 767, 122,1114, 828,2422,1817,3506, 266,3460,1007, 1609,4998, 945,2612,4429,2274, 726,1247,1964,2914,2199,2070,4002,4108, 657,3323, 1422, 579, 455,2764,4737,1222,2895,1670, 824,1223,1487,2525, 558, 861,3080, 598, 2659,2515,1967, 752,2583,2376,2214,4180, 977, 704,2464,4999,2622,4109,1210,2961, 819,1541, 142,2284, 44, 418, 457,1126,3730,4347,4626,1644,1876,3671,1864, 302, 1063,5694, 624, 723,1984,3745,1314,1676,2488,1610,1449,3558,3569,2166,2098, 409, 1011,2325,3704,2306, 818,1732,1383,1824,1844,3757, 999,2705,3497,1216,1423,2683, 2426,2954,2501,2726,2229,1475,2554,5064,1971,1794,1666,2014,1343, 783, 724, 191, 2434,1354,2220,5065,1763,2752,2472,4152, 131, 175,2885,3434, 92,1466,4920,2616, 3871,3872,3866, 128,1551,1632, 669,1854,3682,4691,4125,1230, 188,2973,3290,1302, 1213, 560,3266, 917, 763,3909,3249,1760, 868,1958, 764,1782,2097, 145,2277,3774, 4462, 64,1491,3062, 971,2132,3606,2442, 221,1226,1617, 218, 323,1185,3207,3147, 571, 619,1473,1005,1744,2281, 449,1887,2396,3685, 275, 375,3816,1743,3844,3731, 845,1983,2350,4210,1377, 773, 967,3499,3052,3743,2725,4007,1697,1022,3943,1464, 3264,2855,2722,1952,1029,2839,2467, 84,4383,2215, 820,1391,2015,2448,3672, 377, 1948,2168, 797,2545,3536,2578,2645, 94,2874,1678, 405,1259,3071, 771, 546,1315, 470,1243,3083, 895,2468, 981, 969,2037, 846,4181, 653,1276,2928, 14,2594, 557, 3007,2474, 156, 902,1338,1740,2574, 537,2518, 973,2282,2216,2433,1928, 138,2903, 1293,2631,1612, 646,3457, 839,2935, 111, 496,2191,2847, 589,3186, 149,3994,2060, 4031,2641,4067,3145,1870, 37,3597,2136,1025,2051,3009,3383,3549,1121,1016,3261, 1301, 251,2446,2599,2153, 872,3246, 637, 334,3705, 831, 884, 921,3065,3140,4092, 2198,1944, 246,2964, 108,2045,1152,1921,2308,1031, 203,3173,4170,1907,3890, 810, 1401,2003,1690, 506, 647,1242,2828,1761,1649,3208,2249,1589,3709,2931,5156,1708, 498, 666,2613, 834,3817,1231, 184,2851,1124, 883,3197,2261,3710,1765,1553,2658, 1178,2639,2351, 93,1193, 942,2538,2141,4402, 235,1821, 870,1591,2192,1709,1871, 3341,1618,4126,2595,2334, 603, 651, 69, 701, 268,2662,3411,2555,1380,1606, 503, 448, 254,2371,2646, 574,1187,2309,1770, 322,2235,1292,1801, 305, 566,1133, 229, 2067,2057, 706, 167, 483,2002,2672,3295,1820,3561,3067, 316, 378,2746,3452,1112, 136,1981, 507,1651,2917,1117, 285,4591, 182,2580,3522,1304, 335,3303,1835,2504, 1795,1792,2248, 674,1018,2106,2449,1857,2292,2845, 976,3047,1781,2600,2727,1389, 1281, 52,3152, 153, 265,3950, 672,3485,3951,4463, 430,1183, 365, 278,2169, 27, 1407,1336,2304, 209,1340,1730,2202,1852,2403,2883, 979,1737,1062, 631,2829,2542, 3876,2592, 825,2086,2226,3048,3625, 352,1417,3724, 542, 991, 431,1351,3938,1861, 2294, 826,1361,2927,3142,3503,1738, 463,2462,2723, 582,1916,1595,2808, 400,3845, 3891,2868,3621,2254, 58,2492,1123, 910,2160,2614,1372,1603,1196,1072,3385,1700, 3267,1980, 696, 480,2430, 920, 799,1570,2920,1951,2041,4047,2540,1321,4223,2469, 3562,2228,1271,2602, 401,2833,3351,2575,5157, 907,2312,1256, 410, 263,3507,1582, 996, 678,1849,2316,1480, 908,3545,2237, 703,2322, 667,1826,2849,1531,2604,2999, 2407,3146,2151,2630,1786,3711, 469,3542, 497,3899,2409, 858, 837,4446,3393,1274, 786, 620,1845,2001,3311, 484, 308,3367,1204,1815,3691,2332,1532,2557,1842,2020, 2724,1927,2333,4440, 567, 22,1673,2728,4475,1987,1858,1144,1597, 101,1832,3601, 12, 974,3783,4391, 951,1412, 1,3720, 453,4608,4041, 528,1041,1027,3230,2628, 1129, 875,1051,3291,1203,2262,1069,2860,2799,2149,2615,3278, 144,1758,3040, 31, 475,1680, 366,2685,3184, 311,1642,4008,2466,5036,1593,1493,2809, 216,1420,1668, 233, 304,2128,3284, 232,1429,1768,1040,2008,3407,2740,2967,2543, 242,2133, 778, 1565,2022,2620, 505,2189,2756,1098,2273, 372,1614, 708, 553,2846,2094,2278, 169, 3626,2835,4161, 228,2674,3165, 809,1454,1309, 466,1705,1095, 900,3423, 880,2667, 3751,5258,2317,3109,2571,4317,2766,1503,1342, 866,4447,1118, 63,2076, 314,1881, 1348,1061, 172, 978,3515,1747, 532, 511,3970, 6, 601, 905,2699,3300,1751, 276, 1467,3725,2668, 65,4239,2544,2779,2556,1604, 578,2451,1802, 992,2331,2624,1320, 3446, 713,1513,1013, 103,2786,2447,1661, 886,1702, 916, 654,3574,2031,1556, 751, 2178,2821,2179,1498,1538,2176, 271, 914,2251,2080,1325, 638,1953,2937,3877,2432, 2754, 95,3265,1716, 260,1227,4083, 775, 106,1357,3254, 426,1607, 555,2480, 772, 1985, 244,2546, 474, 495,1046,2611,1851,2061, 71,2089,1675,2590, 742,3758,2843, 3222,1433, 267,2180,2576,2826,2233,2092,3913,2435, 956,1745,3075, 856,2113,1116, 451, 3,1988,2896,1398, 993,2463,1878,2049,1341,2718,2721,2870,2108, 712,2904, 4363,2753,2324, 277,2872,2349,2649, 384, 987, 435, 691,3000, 922, 164,3939, 652, 1500,1184,4153,2482,3373,2165,4848,2335,3775,3508,3154,2806,2830,1554,2102,1664, 2530,1434,2408, 893,1547,2623,3447,2832,2242,2532,3169,2856,3223,2078, 49,3770, 3469, 462, 318, 656,2259,3250,3069, 679,1629,2758, 344,1138,1104,3120,1836,1283, 3115,2154,1437,4448, 934, 759,1999, 794,2862,1038, 533,2560,1722,2342, 855,2626, 1197,1663,4476,3127, 85,4240,2528, 25,1111,1181,3673, 407,3470,4561,2679,2713, 768,1925,2841,3986,1544,1165, 932, 373,1240,2146,1930,2673, 721,4766, 354,4333, 391,2963, 187, 61,3364,1442,1102, 330,1940,1767, 341,3809,4118, 393,2496,2062, 2211, 105, 331, 300, 439, 913,1332, 626, 379,3304,1557, 328, 689,3952, 309,1555, 931, 317,2517,3027, 325, 569, 686,2107,3084, 60,1042,1333,2794, 264,3177,4014, 1628, 258,3712, 7,4464,1176,1043,1778, 683, 114,1975, 78,1492, 383,1886, 510, 386, 645,5291,2891,2069,3305,4138,3867,2939,2603,2493,1935,1066,1848,3588,1015, 1282,1289,4609, 697,1453,3044,2666,3611,1856,2412, 54, 719,1330, 568,3778,2459, 1748, 788, 492, 551,1191,1000, 488,3394,3763, 282,1799, 348,2016,1523,3155,2390, 1049, 382,2019,1788,1170, 729,2968,3523, 897,3926,2785,2938,3292, 350,2319,3238, 1718,1717,2655,3453,3143,4465, 161,2889,2980,2009,1421, 56,1908,1640,2387,2232, 1917,1874,2477,4921, 148, 83,3438, 592,4245,2882,1822,1055, 741, 115,1496,1624, 381,1638,4592,1020, 516,3214, 458, 947,4575,1432, 211,1514,2926,1865,2142, 189, 852,1221,1400,1486, 882,2299,4036, 351, 28,1122, 700,6479,6480,6481,6482,6483, #last 512 ) site-packages/pip/_vendor/chardet/gb2312freq.pyc000064400000112720147204247350015430 0ustar00 abc@sdZdZdZdS(g?iiiii< iTii iQii i iii<iw ii9 ii iiiiZ iiiqi i i iW iyiiieioiiv ii i iiii iLiBi iQ iiiiQiiiEiifiiiiiiiidi( iyiii,i i i iE ieii iWiRiii| iR ii i i iX i ijiEii i+iPiiiiiii;iim iiliiii iiieiHiiiii^ iki6ii" iFi i i i i^ i i iiii?i`iui$i1i ii i iUi i1 iiigiliii iiGii2iiq i i iPiiL iiiiiy iii i iMiikii4 iiiiii i i@ i`ii5iiiN ii7i3iiniiuiGi&ibihi0i iM iNii i iY i ii i iii i&i iQi i7i^ihiiiJ iiPiiiiriiiiiiiT i-iGi,iui i ii$iii<iBii$i>iiix iLiWiiini iiTiiZii i i{ iii i iii i?i i0ibi;iDiiiiiCiSiiUi> i|igi ii i iKii iiii% i5 iiiiil iihi iii?ii i iUiiii ii*i< i i ii ii iii ii i! iX iii iiQ igiiii iiri ii iqii iiz ii i3ii iii i i]iciziii7 ii_ii iCii&iaiHi| ili ii=iiiIiPi ii~ i8i`i iw i i iTii i iiii iiiiii[iq iii igii|iCi ii iN iIiii5 i i(ii/iHiK i iiiii9iiIiii|iiii ii iWii iii^i~iiii i i= iXii3i iIiii iiiii3iriiiioi ii i{iiiiCii!iHi iiiifii= ii1i[i i| iDii%iitii i ii ii.iiiiyiiTiii9 i i i#iiiJiiniiii ii>iBi"iiiai iiMiKii iW i i i i! ir iFi+ i i i iix iHiJiiiii2iKiiR i$ii9i it ii ii iiiiiiiiii%i~i i` iiiii'iviii ii|ii'i iin i*ii iiFii%ii)i~ii iiiJi&ii i!iD iiwii[i ii i i i' i iikiii i i iiiiiiiih iBi_i i?iigihii'iiiiiiiiiiiii5i] ii iiiiiiii1 ii)ia iiiii; iii_iiiQi/iu i i iji[ii}ii iii iiiiQi^ i iGiizi iiiViOii ii ii imiui i6ii i-i$i iiRii} i ipir i] i iDi iiiiiiiiiiii1iniiiitiYiG i i i/ i|iti0i iiiii\i i iivii iiciiii i~iAi"ii" i!i8iCi8 ii iji i1iili>i ii] i i i~iiLi(iiiKidiiviDiiii%i iii i, ii2ii iiij i-i.i imiKi iiioi i;i ii idi@iai iM i1 iLi@i2 iiwiitiQi i/ii ii~iiiii i/ii i_ i#i iOiiOiGiiiki[iOioiii- i iii i!i i iIiiii{iri i.ihi i iT iiii'iL iaii i@iii iii iT i/ iiiii iiMiii il iii i{i8i#i iii9iiSiRi iwiiZii0 iEigig ii i iiLiiipiiiSi iiiii i@iiI iLi; iOiqiii) i i:iFii5iJidiA ii i) iEiLiYiiii im i ii i iiic iiRii!iiii ii(iii]iIii i iieiiii iiii`ii iii ii[iiC i(iPi,i i}iO i' iLi\ i i i iiiiZiiisi'i iUiiiiiN iiii i iiMiiiiii iiiiiigi'iii ii iiPi0 is iiiip i iniiii i\i iii i!ihiiimi(i& i iCiiBi)i5 iiiiiii iii>iiiii i ii{iNiiiiEi3iiJi#iicii ii$ ii5iixi i]iiikii iiiiP ii iiiriiL i izidiii#i iii[ iSiihiiGiiiii iUi+i iyiiwi"iiVi2 i&izi i iiJ iP i iiiii% iZi$ io iT iKi1 i ii`iVi ii id ii iii+i iiAii iiii$ii i_i3i\ iiiiiibi ifiiiii iAiniiixiiFi iOi[iii(i ii i#i7i2 ixiif i i i!i6i{ iiiYiiii+iiiii iiii i iKiei i i iTi$iiiih ii iRiii"i iiZi i_ ii@iiai iii3 i iki)ijiii ieii iA i^ii iW iiihi: iz i) ii| iii ii i8 ijii iii3i i iziipiyi i i2 ioiD i=ii.ii9 iaifii*i_ii i*ii i i ii i- ii i}ii i ii* i itiiti6 iqiiiiiii iSi iii!i)iiyi iii ij ii iiViIiiig iiiLii iipiDii i ii%ii iM iiii$i i iiE i"iU iie i i|i iQiii ii ii i1 iiiii$i i]i4i&iiiziii`iiwi iiii i)i% i&iiii*iii8i2i> iSi iii1i#i ii ii#i i iiii iF iii, i> i+i i iiZ i3iqii i$ii iVi i;iiiNiimiKiWiiii5i i iRi4i iIiiDiiii i i i iiii%iKi|iii iiiii9iin iii i-i3 i2 ipiii? ii~iiiiiiCii[ii iii i3 i> iili i`ix iiii i# iiii0iiii iL i iiQiiRii?i(imii` ii3iiii& i ii isiDii0 ib ifi@ i iii ii=i i i<iiii ii6iiis iii iSiii i8iZ iii ii iii i ii iiiiNi i i iLi iJ iii ibiig iii[ iiiiii~ ii i iiifiiiii i i` i4i= iiiili? iici ii iiii iiiiiiiiwiii i%ii id i^i+iii iZiiF iI iit ii i/i iiiyi* isi&i+iii) iii iii i i ie iiiQi] ii i_i7 ii0iciuiiiLiki iiiii#iiiiiiii?iiii ini i iii iii iHiiYiiu ii i iiJii_ i_i&iiii iiiZi%ii isiiSii i iViiiiii1i'iiiFi\i i|i iWiii|iiSiWi i* i iRiliPi#i i i-iq iii i ii4iiiiiia iiiii@ i iXiii%iii8 i3i,ii} iiiidixi ii# ii6i i i.iiiAi iir i i iR idiii+ iiii i{i{iHi i iiiiiici i i iii,iiI iici ii iii=i iJi. i,i>iiiiLiei]ii iC iiii*i; i ii iipi iiiRii9 i i ii iii?i:i i i iQi'isiiwi[i ii-i i)iiiMiiiii]i}i6i@i iiUiiii/iiis i iiik i? ii, i= i1iMi iii/iS id iiio i6 ikiui iiiWi{iixiWii iiiix i^ iii[ i+ i7i:iiU iii!iii i.iHiTiiYiii ii@i"iCisi i i iG ibii7i~i. iUi iqi iiii{iiiiYi/i iiiAi ii*i:i8i'i i ii iiA i_i0iiiiiiiiKi i iit i* iii iiii i i iiiDiiii>iiivii i i'iiViii iiikii i\iiiii!i ii*iU iiiiiizii\if iii i iiii iiii i iiB iii iii{ii=i ii&i iiV i ii"i! i i iii i( i=ii i ii9i ii4iaiii-iQ ii ii imiiiiiCiii7i}iqiDi4iiuii iiiv iiiF iiu ia iiH ioi i iliKiA iii izi4 i i! iH ii ii5 iijii`ii iB i:iOiai i#iiiidiii(i i& ii^imig iE iio ii(iG i$i@i iIiiiAi ii`iXii7ii/ii$ii iihiiii iUi"iTiiiiimiii!iiiiii iiMi iiii i2iqiii9iii iiiii/iiii ipi@iX iijiii i^ ibi i iniiviiiioioiiiviii0ii9ii$ iifiS izi iiDi{iiXiii iVi3 iYi ii iAiiiiiiqiU i i: ii2iji ii i{ ii iFi i i ii iiiiciiiR i;ik ihii i iiY iOixiiziZi<iv ii i i iiIiii4 iMiiiiib iiii ii iiCii iiiO ii8iii i.i]i iVic i iii iH iiTiii ii> i ii i3iiii,iiifiiiiliTiWiHi.i'i>ipiiii"ii iJii i ivi2iii ixi i2iigi i4iii i iii{ iz i i i iii iiiiii?iiii iJiiii i i8iiiE ij i\ii8i8 ii iiii`ii>ibiSiiii i iii0i iiiEi iidiiii1iiiini@ii iiTii iiiQiiCii iK i;ikiiiiii_i\ ieiiwiiiiiMii. iriaiii i ii iiiigii i' i iii i iTiii4ioii iXiyiixii i i iU i^i: iiii ii"i#iii ii iiiiNiUiiip ii" i-i i iii:ii ii iiii iiiW i iG iLii iGiw ioiii iMir iii iiQ iiI iNi%i iXiii i7 i iaii iii i' iiihi i}iNiyi?itii iD iiiii iliiii iiie iJisi2i*iyiiiiii iiqi ii5i}is i$iiii5 iBiiii# idisi} ii~iiib iiO i/ i]iii i]i2iiifi7iiiOi iRii# i i[iiEii if iS i idiFiiiiC iV i>ii iiBii i i1i6imiii iiiiip i ii i i<izi i| iXiiiisie i]iiii i iiOi i+i iiiiii:i iAii ii ii( i imii4iP ii inii ioioiiimiiyiii8i ii<iii<ic iC iii&iwi i i$i i9i&ii i)i`iiiiiiGibiEii:iQio iF i iii i iFi|i;i iii3i4 i%ii:i iciipi6 i\iCii0i9 ii iiii~ iii"ih iiii i)ii i iii* ii i i i%ii iiii i.iii9i iii iii ii"i! ii, i ig iJ igiF iiii ii;ii iZiEi^iA iiili5ii ii4i' iiiki ii i2ii ii iXi7iii i{iiBixi=iei(ii iii'iiiiiiiiiii iD iiikii iii-i, i iei7 i iii iiiini} ip i7ijii ii9ii iiiii0iPi iiiiiiO i i i iiUi iii< iii iJiitiNii)i i.iii*i iAiir i] i)iiiiiGii_ ipik iii i% i ii ii>ibi_i^i?ii:iYiDi%iii iiiiiiYii i iiiiil iAii i i iDiBi i ii i@ i(iv iiiigi i i}iviiii iiiii iiiiiiii i-i~iiy i%i i i_i iiiiiijiMi iiGi+i iiii iiii3 i;i iGi)ii iii i ii ii i ii,iIi iii iXiAi\iiiiP ivii iVii=i i i6 i<iiX i i i ii8 i- iY iiiii iiiciiii9i i- iuii ii iR i i ii6ii iih i}i i? iw i ii ia i( i ii1ii ii>iii i ii]i iXiriPi0 i,ii+ ijii`iiiii. iii ii& iWiB iii|i7 iUii iiWiiYii iiw i iii iiiiiuiibiiq iiibiii ii=i$ iiNiJiiiUiiii iiiiiKi,iii4iri{i iiHiipi5iii=i i iEi9ii;i i<ii5i iii ii\iiiipiiiiiriiNiii^iiiiiK ii i*ii{ i+ i ii*i8iiii iiii ij ii@il i6ii2i8ii iiii'iiiiB iiii\iiiS iV ii~iiiii i iiVi iz i i^i i iii_ i} iG iqiiI i iii8itihiS ii}iRi i9iiSin iPiiB iiiisiiXi}ifiiii iiiiiiin iIi^iiTiixiiriii_iibiiOiPiQiRiSN(iiii< iTii iQii i iii<iw ii9 ii iiiiZ iiiqi i i iW iyiiieioiiv ii i iiii iLiBi iQ iiiiQiiiEiifiiiiiiiidi( iyiii,i i i iE ieii iWiRiii| iR ii i i iX i ijiEii i+iPiiiiiii;iim iiliiii iiieiHiiiii^ iki6ii" iFi i i i i^ i i iiii?i`iui$i1i ii i iUi i1 iiigiliii iiGii2iiq i i iPiiL iiiiiy iii i iMiikii4 iiiiii i i@ i`ii5iiiN ii7i3iiniiuiGi&ibihi0i iM iNii i iY i ii i iii i&i iQi i7i^ihiiiJ iiPiiiiriiiiiiiT i-iGi,iui i ii$iii<iBii$i>iiix iLiWiiini iiTiiZii i i{ iii i iii i?i i0ibi;iDiiiiiCiSiiUi> i|igi ii i iKii iiii% i5 iiiiil iihi iii?ii i iUiiii ii*i< i i ii ii iii ii i! iX iii iiQ igiiii iiri ii iqii iiz ii i3ii iii i i]iciziii7 ii_ii iCii&iaiHi| ili ii=iiiIiPi ii~ i8i`i iw i i iTii i iiii iiiiii[iq iii igii|iCi ii iN iIiii5 i i(ii/iHiK i iiiii9iiIiii|iiii ii iWii iii^i~iiii i i= iXii3i iIiii iiiii3iriiiioi ii i{iiiiCii!iHi iiiifii= ii1i[i i| iDii%iitii i ii ii.iiiiyiiTiii9 i i i#iiiJiiniiii ii>iBi"iiiai iiMiKii iW i i i i! ir iFi+ i i i iix iHiJiiiii2iKiiR i$ii9i it ii ii iiiiiiiiii%i~i i` iiiii'iviii ii|ii'i iin i*ii iiFii%ii)i~ii iiiJi&ii i!iD iiwii[i ii i i i' i iikiii i i iiiiiiiih iBi_i i?iigihii'iiiiiiiiiiiii5i] ii iiiiiiii1 ii)ia iiiii; iii_iiiQi/iu i i iji[ii}ii iii iiiiQi^ i iGiizi iiiViOii ii ii imiui i6ii i-i$i iiRii} i ipir i] i iDi iiiiiiiiiiii1iniiiitiYiG i i i/ i|iti0i iiiii\i i iivii iiciiii i~iAi"ii" i!i8iCi8 ii iji i1iili>i ii] i i i~iiLi(iiiKidiiviDiiii%i iii i, ii2ii iiij i-i.i imiKi iiioi i;i ii idi@iai iM i1 iLi@i2 iiwiitiQi i/ii ii~iiiii i/ii i_ i#i iOiiOiGiiiki[iOioiii- i iii i!i i iIiiii{iri i.ihi i iT iiii'iL iaii i@iii iii iT i/ iiiii iiMiii il iii i{i8i#i iii9iiSiRi iwiiZii0 iEigig ii i iiLiiipiiiSi iiiii i@iiI iLi; iOiqiii) i i:iFii5iJidiA ii i) iEiLiYiiii im i ii i iiic iiRii!iiii ii(iii]iIii i iieiiii iiii`ii iii ii[iiC i(iPi,i i}iO i' iLi\ i i i iiiiZiiisi'i iUiiiiiN iiii i iiMiiiiii iiiiiigi'iii ii iiPi0 is iiiip i iniiii i\i iii i!ihiiimi(i& i iCiiBi)i5 iiiiiii iii>iiiii i ii{iNiiiiEi3iiJi#iicii ii$ ii5iixi i]iiikii iiiiP ii iiiriiL i izidiii#i iii[ iSiihiiGiiiii iUi+i iyiiwi"iiVi2 i&izi i iiJ iP i iiiii% iZi$ io iT iKi1 i ii`iVi ii id ii iii+i iiAii iiii$ii i_i3i\ iiiiiibi ifiiiii iAiniiixiiFi iOi[iii(i ii i#i7i2 ixiif i i i!i6i{ iiiYiiii+iiiii iiii i iKiei i i iTi$iiiih ii iRiii"i iiZi i_ ii@iiai iii3 i iki)ijiii ieii iA i^ii iW iiihi: iz i) ii| iii ii i8 ijii iii3i i iziipiyi i i2 ioiD i=ii.ii9 iaifii*i_ii i*ii i i ii i- ii i}ii i ii* i itiiti6 iqiiiiiii iSi iii!i)iiyi iii ij ii iiViIiiig iiiLii iipiDii i ii%ii iM iiii$i i iiE i"iU iie i i|i iQiii ii ii i1 iiiii$i i]i4i&iiiziii`iiwi iiii i)i% i&iiii*iii8i2i> iSi iii1i#i ii ii#i i iiii iF iii, i> i+i i iiZ i3iqii i$ii iVi i;iiiNiimiKiWiiii5i i iRi4i iIiiDiiii i i i iiii%iKi|iii iiiii9iin iii i-i3 i2 ipiii? ii~iiiiiiCii[ii iii i3 i> iili i`ix iiii i# iiii0iiii iL i iiQiiRii?i(imii` ii3iiii& i ii isiDii0 ib ifi@ i iii ii=i i i<iiii ii6iiis iii iSiii i8iZ iii ii iii i ii iiiiNi i i iLi iJ iii ibiig iii[ iiiiii~ ii i iiifiiiii i i` i4i= iiiili? iici ii iiii iiiiiiiiwiii i%ii id i^i+iii iZiiF iI iit ii i/i iiiyi* isi&i+iii) iii iii i i ie iiiQi] ii i_i7 ii0iciuiiiLiki iiiii#iiiiiiii?iiii ini i iii iii iHiiYiiu ii i iiJii_ i_i&iiii iiiZi%ii isiiSii i iViiiiii1i'iiiFi\i i|i iWiii|iiSiWi i* i iRiliPi#i i i-iq iii i ii4iiiiiia iiiii@ i iXiii%iii8 i3i,ii} iiiidixi ii# ii6i i i.iiiAi iir i i iR idiii+ iiii i{i{iHi i iiiiiici i i iii,iiI iici ii iii=i iJi. i,i>iiiiLiei]ii iC iiii*i; i ii iipi iiiRii9 i i ii iii?i:i i i iQi'isiiwi[i ii-i i)iiiMiiiii]i}i6i@i iiUiiii/iiis i iiik i? ii, i= i1iMi iii/iS id iiio i6 ikiui iiiWi{iixiWii iiiix i^ iii[ i+ i7i:iiU iii!iii i.iHiTiiYiii ii@i"iCisi i i iG ibii7i~i. iUi iqi iiii{iiiiYi/i iiiAi ii*i:i8i'i i ii iiA i_i0iiiiiiiiKi i iit i* iii iiii i i iiiDiiii>iiivii i i'iiViii iiikii i\iiiii!i ii*iU iiiiiizii\if iii i iiii iiii i iiB iii iii{ii=i ii&i iiV i ii"i! i i iii i( i=ii i ii9i ii4iaiii-iQ ii ii imiiiiiCiii7i}iqiDi4iiuii iiiv iiiF iiu ia iiH ioi i iliKiA iii izi4 i i! iH ii ii5 iijii`ii iB i:iOiai i#iiiidiii(i i& ii^imig iE iio ii(iG i$i@i iIiiiAi ii`iXii7ii/ii$ii iihiiii iUi"iTiiiiimiii!iiiiii iiMi iiii i2iqiii9iii iiiii/iiii ipi@iX iijiii i^ ibi i iniiviiiioioiiiviii0ii9ii$ iifiS izi iiDi{iiXiii iVi3 iYi ii iAiiiiiiqiU i i: ii2iji ii i{ ii iFi i i ii iiiiciiiR i;ik ihii i iiY iOixiiziZi<iv ii i i iiIiii4 iMiiiiib iiii ii iiCii iiiO ii8iii i.i]i iVic i iii iH iiTiii ii> i ii i3iiii,iiifiiiiliTiWiHi.i'i>ipiiii"ii iJii i ivi2iii ixi i2iigi i4iii i iii{ iz i i i iii iiiiii?iiii iJiiii i i8iiiE ij i\ii8i8 ii iiii`ii>ibiSiiii i iii0i iiiEi iidiiii1iiiini@ii iiTii iiiQiiCii iK i;ikiiiiii_i\ ieiiwiiiiiMii. iriaiii i ii iiiigii i' i iii i iTiii4ioii iXiyiixii i i iU i^i: iiii ii"i#iii ii iiiiNiUiiip ii" i-i i iii:ii ii iiii iiiW i iG iLii iGiw ioiii iMir iii iiQ iiI iNi%i iXiii i7 i iaii iii i' iiihi i}iNiyi?itii iD iiiii iliiii iiie iJisi2i*iyiiiiii iiqi ii5i}is i$iiii5 iBiiii# idisi} ii~iiib iiO i/ i]iii i]i2iiifi7iiiOi iRii# i i[iiEii if iS i idiFiiiiC iV i>ii iiBii i i1i6imiii iiiiip i ii i i<izi i| iXiiiisie i]iiii i iiOi i+i iiiiii:i iAii ii ii( i imii4iP ii inii ioioiiimiiyiii8i ii<iii<ic iC iii&iwi i i$i i9i&ii i)i`iiiiiiGibiEii:iQio iF i iii i iFi|i;i iii3i4 i%ii:i iciipi6 i\iCii0i9 ii iiii~ iii"ih iiii i)ii i iii* ii i i i%ii iiii i.iii9i iii iii ii"i! ii, i ig iJ igiF iiii ii;ii iZiEi^iA iiili5ii ii4i' iiiki ii i2ii ii iXi7iii i{iiBixi=iei(ii iii'iiiiiiiiiii iD iiikii iii-i, i iei7 i iii iiiini} ip i7ijii ii9ii iiiii0iPi iiiiiiO i i i iiUi iii< iii iJiitiNii)i i.iii*i iAiir i] i)iiiiiGii_ ipik iii i% i ii ii>ibi_i^i?ii:iYiDi%iii iiiiiiYii i iiiiil iAii i i iDiBi i ii i@ i(iv iiiigi i i}iviiii iiiii iiiiiiii i-i~iiy i%i i i_i iiiiiijiMi iiGi+i iiii iiii3 i;i iGi)ii iii i ii ii i ii,iIi iii iXiAi\iiiiP ivii iVii=i i i6 i<iiX i i i ii8 i- iY iiiii iiiciiii9i i- iuii ii iR i i ii6ii iih i}i i? iw i ii ia i( i ii1ii ii>iii i ii]i iXiriPi0 i,ii+ ijii`iiiii. iii ii& iWiB iii|i7 iUii iiWiiYii iiw i iii iiiiiuiibiiq iiibiii ii=i$ iiNiJiiiUiiii iiiiiKi,iii4iri{i iiHiipi5iii=i i iEi9ii;i i<ii5i iii ii\iiiipiiiiiriiNiii^iiiiiK ii i*ii{ i+ i ii*i8iiii iiii ij ii@il i6ii2i8ii iiii'iiiiB iiii\iiiS iV ii~iiiii i iiVi iz i i^i i iii_ i} iG iqiiI i iii8itihiS ii}iRi i9iiSin iPiiB iiiisiiXi}ifiiii iiiiiiin iIi^iiTiixiiriii_iibiiOiPiQiRiS(t!GB2312_TYPICAL_DISTRIBUTION_RATIOtGB2312_TABLE_SIZEtGB2312_CHAR_TO_FREQ_ORDER(((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/gb2312freq.pyt*ssite-packages/pip/_vendor/chardet/gb2312freq.pyo000064400000112720147204247350015444 0ustar00 abc@sdZdZdZdS(g?iiiii< iTii iQii i iii<iw ii9 ii iiiiZ iiiqi i i iW iyiiieioiiv ii i iiii iLiBi iQ iiiiQiiiEiifiiiiiiiidi( iyiii,i i i iE ieii iWiRiii| iR ii i i iX i ijiEii i+iPiiiiiii;iim iiliiii iiieiHiiiii^ iki6ii" iFi i i i i^ i i iiii?i`iui$i1i ii i iUi i1 iiigiliii iiGii2iiq i i iPiiL iiiiiy iii i iMiikii4 iiiiii i i@ i`ii5iiiN ii7i3iiniiuiGi&ibihi0i iM iNii i iY i ii i iii i&i iQi i7i^ihiiiJ iiPiiiiriiiiiiiT i-iGi,iui i ii$iii<iBii$i>iiix iLiWiiini iiTiiZii i i{ iii i iii i?i i0ibi;iDiiiiiCiSiiUi> i|igi ii i iKii iiii% i5 iiiiil iihi iii?ii i iUiiii ii*i< i i ii ii iii ii i! iX iii iiQ igiiii iiri ii iqii iiz ii i3ii iii i i]iciziii7 ii_ii iCii&iaiHi| ili ii=iiiIiPi ii~ i8i`i iw i i iTii i iiii iiiiii[iq iii igii|iCi ii iN iIiii5 i i(ii/iHiK i iiiii9iiIiii|iiii ii iWii iii^i~iiii i i= iXii3i iIiii iiiii3iriiiioi ii i{iiiiCii!iHi iiiifii= ii1i[i i| iDii%iitii i ii ii.iiiiyiiTiii9 i i i#iiiJiiniiii ii>iBi"iiiai iiMiKii iW i i i i! ir iFi+ i i i iix iHiJiiiii2iKiiR i$ii9i it ii ii iiiiiiiiii%i~i i` iiiii'iviii ii|ii'i iin i*ii iiFii%ii)i~ii iiiJi&ii i!iD iiwii[i ii i i i' i iikiii i i iiiiiiiih iBi_i i?iigihii'iiiiiiiiiiiii5i] ii iiiiiiii1 ii)ia iiiii; iii_iiiQi/iu i i iji[ii}ii iii iiiiQi^ i iGiizi iiiViOii ii ii imiui i6ii i-i$i iiRii} i ipir i] i iDi iiiiiiiiiiii1iniiiitiYiG i i i/ i|iti0i iiiii\i i iivii iiciiii i~iAi"ii" i!i8iCi8 ii iji i1iili>i ii] i i i~iiLi(iiiKidiiviDiiii%i iii i, ii2ii iiij i-i.i imiKi iiioi i;i ii idi@iai iM i1 iLi@i2 iiwiitiQi i/ii ii~iiiii i/ii i_ i#i iOiiOiGiiiki[iOioiii- i iii i!i i iIiiii{iri i.ihi i iT iiii'iL iaii i@iii iii iT i/ iiiii iiMiii il iii i{i8i#i iii9iiSiRi iwiiZii0 iEigig ii i iiLiiipiiiSi iiiii i@iiI iLi; iOiqiii) i i:iFii5iJidiA ii i) iEiLiYiiii im i ii i iiic iiRii!iiii ii(iii]iIii i iieiiii iiii`ii iii ii[iiC i(iPi,i i}iO i' iLi\ i i i iiiiZiiisi'i iUiiiiiN iiii i iiMiiiiii iiiiiigi'iii ii iiPi0 is iiiip i iniiii i\i iii i!ihiiimi(i& i iCiiBi)i5 iiiiiii iii>iiiii i ii{iNiiiiEi3iiJi#iicii ii$ ii5iixi i]iiikii iiiiP ii iiiriiL i izidiii#i iii[ iSiihiiGiiiii iUi+i iyiiwi"iiVi2 i&izi i iiJ iP i iiiii% iZi$ io iT iKi1 i ii`iVi ii id ii iii+i iiAii iiii$ii i_i3i\ iiiiiibi ifiiiii iAiniiixiiFi iOi[iii(i ii i#i7i2 ixiif i i i!i6i{ iiiYiiii+iiiii iiii i iKiei i i iTi$iiiih ii iRiii"i iiZi i_ ii@iiai iii3 i iki)ijiii ieii iA i^ii iW iiihi: iz i) ii| iii ii i8 ijii iii3i i iziipiyi i i2 ioiD i=ii.ii9 iaifii*i_ii i*ii i i ii i- ii i}ii i ii* i itiiti6 iqiiiiiii iSi iii!i)iiyi iii ij ii iiViIiiig iiiLii iipiDii i ii%ii iM iiii$i i iiE i"iU iie i i|i iQiii ii ii i1 iiiii$i i]i4i&iiiziii`iiwi iiii i)i% i&iiii*iii8i2i> iSi iii1i#i ii ii#i i iiii iF iii, i> i+i i iiZ i3iqii i$ii iVi i;iiiNiimiKiWiiii5i i iRi4i iIiiDiiii i i i iiii%iKi|iii iiiii9iin iii i-i3 i2 ipiii? ii~iiiiiiCii[ii iii i3 i> iili i`ix iiii i# iiii0iiii iL i iiQiiRii?i(imii` ii3iiii& i ii isiDii0 ib ifi@ i iii ii=i i i<iiii ii6iiis iii iSiii i8iZ iii ii iii i ii iiiiNi i i iLi iJ iii ibiig iii[ iiiiii~ ii i iiifiiiii i i` i4i= iiiili? iici ii iiii iiiiiiiiwiii i%ii id i^i+iii iZiiF iI iit ii i/i iiiyi* isi&i+iii) iii iii i i ie iiiQi] ii i_i7 ii0iciuiiiLiki iiiii#iiiiiiii?iiii ini i iii iii iHiiYiiu ii i iiJii_ i_i&iiii iiiZi%ii isiiSii i iViiiiii1i'iiiFi\i i|i iWiii|iiSiWi i* i iRiliPi#i i i-iq iii i ii4iiiiiia iiiii@ i iXiii%iii8 i3i,ii} iiiidixi ii# ii6i i i.iiiAi iir i i iR idiii+ iiii i{i{iHi i iiiiiici i i iii,iiI iici ii iii=i iJi. i,i>iiiiLiei]ii iC iiii*i; i ii iipi iiiRii9 i i ii iii?i:i i i iQi'isiiwi[i ii-i i)iiiMiiiii]i}i6i@i iiUiiii/iiis i iiik i? ii, i= i1iMi iii/iS id iiio i6 ikiui iiiWi{iixiWii iiiix i^ iii[ i+ i7i:iiU iii!iii i.iHiTiiYiii ii@i"iCisi i i iG ibii7i~i. iUi iqi iiii{iiiiYi/i iiiAi ii*i:i8i'i i ii iiA i_i0iiiiiiiiKi i iit i* iii iiii i i iiiDiiii>iiivii i i'iiViii iiikii i\iiiii!i ii*iU iiiiiizii\if iii i iiii iiii i iiB iii iii{ii=i ii&i iiV i ii"i! i i iii i( i=ii i ii9i ii4iaiii-iQ ii ii imiiiiiCiii7i}iqiDi4iiuii iiiv iiiF iiu ia iiH ioi i iliKiA iii izi4 i i! iH ii ii5 iijii`ii iB i:iOiai i#iiiidiii(i i& ii^imig iE iio ii(iG i$i@i iIiiiAi ii`iXii7ii/ii$ii iihiiii iUi"iTiiiiimiii!iiiiii iiMi iiii i2iqiii9iii iiiii/iiii ipi@iX iijiii i^ ibi i iniiviiiioioiiiviii0ii9ii$ iifiS izi iiDi{iiXiii iVi3 iYi ii iAiiiiiiqiU i i: ii2iji ii i{ ii iFi i i ii iiiiciiiR i;ik ihii i iiY iOixiiziZi<iv ii i i iiIiii4 iMiiiiib iiii ii iiCii iiiO ii8iii i.i]i iVic i iii iH iiTiii ii> i ii i3iiii,iiifiiiiliTiWiHi.i'i>ipiiii"ii iJii i ivi2iii ixi i2iigi i4iii i iii{ iz i i i iii iiiiii?iiii iJiiii i i8iiiE ij i\ii8i8 ii iiii`ii>ibiSiiii i iii0i iiiEi iidiiii1iiiini@ii iiTii iiiQiiCii iK i;ikiiiiii_i\ ieiiwiiiiiMii. iriaiii i ii iiiigii i' i iii i iTiii4ioii iXiyiixii i i iU i^i: iiii ii"i#iii ii iiiiNiUiiip ii" i-i i iii:ii ii iiii iiiW i iG iLii iGiw ioiii iMir iii iiQ iiI iNi%i iXiii i7 i iaii iii i' iiihi i}iNiyi?itii iD iiiii iliiii iiie iJisi2i*iyiiiiii iiqi ii5i}is i$iiii5 iBiiii# idisi} ii~iiib iiO i/ i]iii i]i2iiifi7iiiOi iRii# i i[iiEii if iS i idiFiiiiC iV i>ii iiBii i i1i6imiii iiiiip i ii i i<izi i| iXiiiisie i]iiii i iiOi i+i iiiiii:i iAii ii ii( i imii4iP ii inii ioioiiimiiyiii8i ii<iii<ic iC iii&iwi i i$i i9i&ii i)i`iiiiiiGibiEii:iQio iF i iii i iFi|i;i iii3i4 i%ii:i iciipi6 i\iCii0i9 ii iiii~ iii"ih iiii i)ii i iii* ii i i i%ii iiii i.iii9i iii iii ii"i! ii, i ig iJ igiF iiii ii;ii iZiEi^iA iiili5ii ii4i' iiiki ii i2ii ii iXi7iii i{iiBixi=iei(ii iii'iiiiiiiiiii iD iiikii iii-i, i iei7 i iii iiiini} ip i7ijii ii9ii iiiii0iPi iiiiiiO i i i iiUi iii< iii iJiitiNii)i i.iii*i iAiir i] i)iiiiiGii_ ipik iii i% i ii ii>ibi_i^i?ii:iYiDi%iii iiiiiiYii i iiiiil iAii i i iDiBi i ii i@ i(iv iiiigi i i}iviiii iiiii iiiiiiii i-i~iiy i%i i i_i iiiiiijiMi iiGi+i iiii iiii3 i;i iGi)ii iii i ii ii i ii,iIi iii iXiAi\iiiiP ivii iVii=i i i6 i<iiX i i i ii8 i- iY iiiii iiiciiii9i i- iuii ii iR i i ii6ii iih i}i i? iw i ii ia i( i ii1ii ii>iii i ii]i iXiriPi0 i,ii+ ijii`iiiii. iii ii& iWiB iii|i7 iUii iiWiiYii iiw i iii iiiiiuiibiiq iiibiii ii=i$ iiNiJiiiUiiii iiiiiKi,iii4iri{i iiHiipi5iii=i i iEi9ii;i i<ii5i iii ii\iiiipiiiiiriiNiii^iiiiiK ii i*ii{ i+ i ii*i8iiii iiii ij ii@il i6ii2i8ii iiii'iiiiB iiii\iiiS iV ii~iiiii i iiVi iz i i^i i iii_ i} iG iqiiI i iii8itihiS ii}iRi i9iiSin iPiiB iiiisiiXi}ifiiii iiiiiiin iIi^iiTiixiiriii_iibiiOiPiQiRiSN(iiii< iTii iQii i iii<iw ii9 ii iiiiZ iiiqi i i iW iyiiieioiiv ii i iiii iLiBi iQ iiiiQiiiEiifiiiiiiiidi( iyiii,i i i iE ieii iWiRiii| iR ii i i iX i ijiEii i+iPiiiiiii;iim iiliiii iiieiHiiiii^ iki6ii" iFi i i i i^ i i iiii?i`iui$i1i ii i iUi i1 iiigiliii iiGii2iiq i i iPiiL iiiiiy iii i iMiikii4 iiiiii i i@ i`ii5iiiN ii7i3iiniiuiGi&ibihi0i iM iNii i iY i ii i iii i&i iQi i7i^ihiiiJ iiPiiiiriiiiiiiT i-iGi,iui i ii$iii<iBii$i>iiix iLiWiiini iiTiiZii i i{ iii i iii i?i i0ibi;iDiiiiiCiSiiUi> i|igi ii i iKii iiii% i5 iiiiil iihi iii?ii i iUiiii ii*i< i i ii ii iii ii i! iX iii iiQ igiiii iiri ii iqii iiz ii i3ii iii i i]iciziii7 ii_ii iCii&iaiHi| ili ii=iiiIiPi ii~ i8i`i iw i i iTii i iiii iiiiii[iq iii igii|iCi ii iN iIiii5 i i(ii/iHiK i iiiii9iiIiii|iiii ii iWii iii^i~iiii i i= iXii3i iIiii iiiii3iriiiioi ii i{iiiiCii!iHi iiiifii= ii1i[i i| iDii%iitii i ii ii.iiiiyiiTiii9 i i i#iiiJiiniiii ii>iBi"iiiai iiMiKii iW i i i i! ir iFi+ i i i iix iHiJiiiii2iKiiR i$ii9i it ii ii iiiiiiiiii%i~i i` iiiii'iviii ii|ii'i iin i*ii iiFii%ii)i~ii iiiJi&ii i!iD iiwii[i ii i i i' i iikiii i i iiiiiiiih iBi_i i?iigihii'iiiiiiiiiiiii5i] ii iiiiiiii1 ii)ia iiiii; iii_iiiQi/iu i i iji[ii}ii iii iiiiQi^ i iGiizi iiiViOii ii ii imiui i6ii i-i$i iiRii} i ipir i] i iDi iiiiiiiiiiii1iniiiitiYiG i i i/ i|iti0i iiiii\i i iivii iiciiii i~iAi"ii" i!i8iCi8 ii iji i1iili>i ii] i i i~iiLi(iiiKidiiviDiiii%i iii i, ii2ii iiij i-i.i imiKi iiioi i;i ii idi@iai iM i1 iLi@i2 iiwiitiQi i/ii ii~iiiii i/ii i_ i#i iOiiOiGiiiki[iOioiii- i iii i!i i iIiiii{iri i.ihi i iT iiii'iL iaii i@iii iii iT i/ iiiii iiMiii il iii i{i8i#i iii9iiSiRi iwiiZii0 iEigig ii i iiLiiipiiiSi iiiii i@iiI iLi; iOiqiii) i i:iFii5iJidiA ii i) iEiLiYiiii im i ii i iiic iiRii!iiii ii(iii]iIii i iieiiii iiii`ii iii ii[iiC i(iPi,i i}iO i' iLi\ i i i iiiiZiiisi'i iUiiiiiN iiii i iiMiiiiii iiiiiigi'iii ii iiPi0 is iiiip i iniiii i\i iii i!ihiiimi(i& i iCiiBi)i5 iiiiiii iii>iiiii i ii{iNiiiiEi3iiJi#iicii ii$ ii5iixi i]iiikii iiiiP ii iiiriiL i izidiii#i iii[ iSiihiiGiiiii iUi+i iyiiwi"iiVi2 i&izi i iiJ iP i iiiii% iZi$ io iT iKi1 i ii`iVi ii id ii iii+i iiAii iiii$ii i_i3i\ iiiiiibi ifiiiii iAiniiixiiFi iOi[iii(i ii i#i7i2 ixiif i i i!i6i{ iiiYiiii+iiiii iiii i iKiei i i iTi$iiiih ii iRiii"i iiZi i_ ii@iiai iii3 i iki)ijiii ieii iA i^ii iW iiihi: iz i) ii| iii ii i8 ijii iii3i i iziipiyi i i2 ioiD i=ii.ii9 iaifii*i_ii i*ii i i ii i- ii i}ii i ii* i itiiti6 iqiiiiiii iSi iii!i)iiyi iii ij ii iiViIiiig iiiLii iipiDii i ii%ii iM iiii$i i iiE i"iU iie i i|i iQiii ii ii i1 iiiii$i i]i4i&iiiziii`iiwi iiii i)i% i&iiii*iii8i2i> iSi iii1i#i ii ii#i i iiii iF iii, i> i+i i iiZ i3iqii i$ii iVi i;iiiNiimiKiWiiii5i i iRi4i iIiiDiiii i i i iiii%iKi|iii iiiii9iin iii i-i3 i2 ipiii? ii~iiiiiiCii[ii iii i3 i> iili i`ix iiii i# iiii0iiii iL i iiQiiRii?i(imii` ii3iiii& i ii isiDii0 ib ifi@ i iii ii=i i i<iiii ii6iiis iii iSiii i8iZ iii ii iii i ii iiiiNi i i iLi iJ iii ibiig iii[ iiiiii~ ii i iiifiiiii i i` i4i= iiiili? iici ii iiii iiiiiiiiwiii i%ii id i^i+iii iZiiF iI iit ii i/i iiiyi* isi&i+iii) iii iii i i ie iiiQi] ii i_i7 ii0iciuiiiLiki iiiii#iiiiiiii?iiii ini i iii iii iHiiYiiu ii i iiJii_ i_i&iiii iiiZi%ii isiiSii i iViiiiii1i'iiiFi\i i|i iWiii|iiSiWi i* i iRiliPi#i i i-iq iii i ii4iiiiiia iiiii@ i iXiii%iii8 i3i,ii} iiiidixi ii# ii6i i i.iiiAi iir i i iR idiii+ iiii i{i{iHi i iiiiiici i i iii,iiI iici ii iii=i iJi. i,i>iiiiLiei]ii iC iiii*i; i ii iipi iiiRii9 i i ii iii?i:i i i iQi'isiiwi[i ii-i i)iiiMiiiii]i}i6i@i iiUiiii/iiis i iiik i? ii, i= i1iMi iii/iS id iiio i6 ikiui iiiWi{iixiWii iiiix i^ iii[ i+ i7i:iiU iii!iii i.iHiTiiYiii ii@i"iCisi i i iG ibii7i~i. iUi iqi iiii{iiiiYi/i iiiAi ii*i:i8i'i i ii iiA i_i0iiiiiiiiKi i iit i* iii iiii i i iiiDiiii>iiivii i i'iiViii iiikii i\iiiii!i ii*iU iiiiiizii\if iii i iiii iiii i iiB iii iii{ii=i ii&i iiV i ii"i! i i iii i( i=ii i ii9i ii4iaiii-iQ ii ii imiiiiiCiii7i}iqiDi4iiuii iiiv iiiF iiu ia iiH ioi i iliKiA iii izi4 i i! iH ii ii5 iijii`ii iB i:iOiai i#iiiidiii(i i& ii^imig iE iio ii(iG i$i@i iIiiiAi ii`iXii7ii/ii$ii iihiiii iUi"iTiiiiimiii!iiiiii iiMi iiii i2iqiii9iii iiiii/iiii ipi@iX iijiii i^ ibi i iniiviiiioioiiiviii0ii9ii$ iifiS izi iiDi{iiXiii iVi3 iYi ii iAiiiiiiqiU i i: ii2iji ii i{ ii iFi i i ii iiiiciiiR i;ik ihii i iiY iOixiiziZi<iv ii i i iiIiii4 iMiiiiib iiii ii iiCii iiiO ii8iii i.i]i iVic i iii iH iiTiii ii> i ii i3iiii,iiifiiiiliTiWiHi.i'i>ipiiii"ii iJii i ivi2iii ixi i2iigi i4iii i iii{ iz i i i iii iiiiii?iiii iJiiii i i8iiiE ij i\ii8i8 ii iiii`ii>ibiSiiii i iii0i iiiEi iidiiii1iiiini@ii iiTii iiiQiiCii iK i;ikiiiiii_i\ ieiiwiiiiiMii. iriaiii i ii iiiigii i' i iii i iTiii4ioii iXiyiixii i i iU i^i: iiii ii"i#iii ii iiiiNiUiiip ii" i-i i iii:ii ii iiii iiiW i iG iLii iGiw ioiii iMir iii iiQ iiI iNi%i iXiii i7 i iaii iii i' iiihi i}iNiyi?itii iD iiiii iliiii iiie iJisi2i*iyiiiiii iiqi ii5i}is i$iiii5 iBiiii# idisi} ii~iiib iiO i/ i]iii i]i2iiifi7iiiOi iRii# i i[iiEii if iS i idiFiiiiC iV i>ii iiBii i i1i6imiii iiiiip i ii i i<izi i| iXiiiisie i]iiii i iiOi i+i iiiiii:i iAii ii ii( i imii4iP ii inii ioioiiimiiyiii8i ii<iii<ic iC iii&iwi i i$i i9i&ii i)i`iiiiiiGibiEii:iQio iF i iii i iFi|i;i iii3i4 i%ii:i iciipi6 i\iCii0i9 ii iiii~ iii"ih iiii i)ii i iii* ii i i i%ii iiii i.iii9i iii iii ii"i! ii, i ig iJ igiF iiii ii;ii iZiEi^iA iiili5ii ii4i' iiiki ii i2ii ii iXi7iii i{iiBixi=iei(ii iii'iiiiiiiiiii iD iiikii iii-i, i iei7 i iii iiiini} ip i7ijii ii9ii iiiii0iPi iiiiiiO i i i iiUi iii< iii iJiitiNii)i i.iii*i iAiir i] i)iiiiiGii_ ipik iii i% i ii ii>ibi_i^i?ii:iYiDi%iii iiiiiiYii i iiiiil iAii i i iDiBi i ii i@ i(iv iiiigi i i}iviiii iiiii iiiiiiii i-i~iiy i%i i i_i iiiiiijiMi iiGi+i iiii iiii3 i;i iGi)ii iii i ii ii i ii,iIi iii iXiAi\iiiiP ivii iVii=i i i6 i<iiX i i i ii8 i- iY iiiii iiiciiii9i i- iuii ii iR i i ii6ii iih i}i i? iw i ii ia i( i ii1ii ii>iii i ii]i iXiriPi0 i,ii+ ijii`iiiii. iii ii& iWiB iii|i7 iUii iiWiiYii iiw i iii iiiiiuiibiiq iiibiii ii=i$ iiNiJiiiUiiii iiiiiKi,iii4iri{i iiHiipi5iii=i i iEi9ii;i i<ii5i iii ii\iiiipiiiiiriiNiii^iiiiiK ii i*ii{ i+ i ii*i8iiii iiii ij ii@il i6ii2i8ii iiii'iiiiB iiii\iiiS iV ii~iiiii i iiVi iz i i^i i iii_ i} iG iqiiI i iii8itihiS ii}iRi i9iiSin iPiiB iiiisiiXi}ifiiii iiiiiiin iIi^iiTiixiiriii_iibiiOiPiQiRiS(t!GB2312_TYPICAL_DISTRIBUTION_RATIOtGB2312_TABLE_SIZEtGB2312_CHAR_TO_FREQ_ORDER(((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/gb2312freq.pyt*ssite-packages/pip/_vendor/chardet/gb2312prober.py000064400000003332147204247350015617 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import GB2312DistributionAnalysis from .mbcssm import GB2312_SM_MODEL class GB2312Prober(MultiByteCharSetProber): def __init__(self): super(GB2312Prober, self).__init__() self.coding_sm = CodingStateMachine(GB2312_SM_MODEL) self.distribution_analyzer = GB2312DistributionAnalysis() self.reset() @property def charset_name(self): return "GB2312" @property def language(self): return "Chinese" site-packages/pip/_vendor/chardet/gb2312prober.pyo000064400000002537147204247350016004 0ustar00 abc@sZddlmZddlmZddlmZddlmZdefdYZdS(i(tMultiByteCharSetProber(tCodingStateMachine(tGB2312DistributionAnalysis(tGB2312_SM_MODELt GB2312ProbercBs/eZdZedZedZRS(cCs<tt|jtt|_t|_|jdS(N( tsuperRt__init__RRt coding_smRtdistribution_analyzertreset(tself((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/gb2312prober.pyR"s cCsdS(NtGB2312((R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/gb2312prober.pyt charset_name(scCsdS(NtChinese((R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/gb2312prober.pytlanguage,s(t__name__t __module__RtpropertyR R(((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/gb2312prober.pyR!s N( tmbcharsetproberRtcodingstatemachineRtchardistributionRtmbcssmRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/gb2312prober.pytssite-packages/pip/_vendor/chardet/hebrewprober.py000064400000033016147204247350016175 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Shy Shalom # Portions created by the Initial Developer are Copyright (C) 2005 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetprober import CharSetProber from .enums import ProbingState # This prober doesn't actually recognize a language or a charset. # It is a helper prober for the use of the Hebrew model probers ### General ideas of the Hebrew charset recognition ### # # Four main charsets exist in Hebrew: # "ISO-8859-8" - Visual Hebrew # "windows-1255" - Logical Hebrew # "ISO-8859-8-I" - Logical Hebrew # "x-mac-hebrew" - ?? Logical Hebrew ?? # # Both "ISO" charsets use a completely identical set of code points, whereas # "windows-1255" and "x-mac-hebrew" are two different proper supersets of # these code points. windows-1255 defines additional characters in the range # 0x80-0x9F as some misc punctuation marks as well as some Hebrew-specific # diacritics and additional 'Yiddish' ligature letters in the range 0xc0-0xd6. # x-mac-hebrew defines similar additional code points but with a different # mapping. # # As far as an average Hebrew text with no diacritics is concerned, all four # charsets are identical with respect to code points. Meaning that for the # main Hebrew alphabet, all four map the same values to all 27 Hebrew letters # (including final letters). # # The dominant difference between these charsets is their directionality. # "Visual" directionality means that the text is ordered as if the renderer is # not aware of a BIDI rendering algorithm. The renderer sees the text and # draws it from left to right. The text itself when ordered naturally is read # backwards. A buffer of Visual Hebrew generally looks like so: # "[last word of first line spelled backwards] [whole line ordered backwards # and spelled backwards] [first word of first line spelled backwards] # [end of line] [last word of second line] ... etc' " # adding punctuation marks, numbers and English text to visual text is # naturally also "visual" and from left to right. # # "Logical" directionality means the text is ordered "naturally" according to # the order it is read. It is the responsibility of the renderer to display # the text from right to left. A BIDI algorithm is used to place general # punctuation marks, numbers and English text in the text. # # Texts in x-mac-hebrew are almost impossible to find on the Internet. From # what little evidence I could find, it seems that its general directionality # is Logical. # # To sum up all of the above, the Hebrew probing mechanism knows about two # charsets: # Visual Hebrew - "ISO-8859-8" - backwards text - Words and sentences are # backwards while line order is natural. For charset recognition purposes # the line order is unimportant (In fact, for this implementation, even # word order is unimportant). # Logical Hebrew - "windows-1255" - normal, naturally ordered text. # # "ISO-8859-8-I" is a subset of windows-1255 and doesn't need to be # specifically identified. # "x-mac-hebrew" is also identified as windows-1255. A text in x-mac-hebrew # that contain special punctuation marks or diacritics is displayed with # some unconverted characters showing as question marks. This problem might # be corrected using another model prober for x-mac-hebrew. Due to the fact # that x-mac-hebrew texts are so rare, writing another model prober isn't # worth the effort and performance hit. # #### The Prober #### # # The prober is divided between two SBCharSetProbers and a HebrewProber, # all of which are managed, created, fed data, inquired and deleted by the # SBCSGroupProber. The two SBCharSetProbers identify that the text is in # fact some kind of Hebrew, Logical or Visual. The final decision about which # one is it is made by the HebrewProber by combining final-letter scores # with the scores of the two SBCharSetProbers to produce a final answer. # # The SBCSGroupProber is responsible for stripping the original text of HTML # tags, English characters, numbers, low-ASCII punctuation characters, spaces # and new lines. It reduces any sequence of such characters to a single space. # The buffer fed to each prober in the SBCS group prober is pure text in # high-ASCII. # The two SBCharSetProbers (model probers) share the same language model: # Win1255Model. # The first SBCharSetProber uses the model normally as any other # SBCharSetProber does, to recognize windows-1255, upon which this model was # built. The second SBCharSetProber is told to make the pair-of-letter # lookup in the language model backwards. This in practice exactly simulates # a visual Hebrew model using the windows-1255 logical Hebrew model. # # The HebrewProber is not using any language model. All it does is look for # final-letter evidence suggesting the text is either logical Hebrew or visual # Hebrew. Disjointed from the model probers, the results of the HebrewProber # alone are meaningless. HebrewProber always returns 0.00 as confidence # since it never identifies a charset by itself. Instead, the pointer to the # HebrewProber is passed to the model probers as a helper "Name Prober". # When the Group prober receives a positive identification from any prober, # it asks for the name of the charset identified. If the prober queried is a # Hebrew model prober, the model prober forwards the call to the # HebrewProber to make the final decision. In the HebrewProber, the # decision is made according to the final-letters scores maintained and Both # model probers scores. The answer is returned in the form of the name of the # charset identified, either "windows-1255" or "ISO-8859-8". class HebrewProber(CharSetProber): # windows-1255 / ISO-8859-8 code points of interest FINAL_KAF = 0xea NORMAL_KAF = 0xeb FINAL_MEM = 0xed NORMAL_MEM = 0xee FINAL_NUN = 0xef NORMAL_NUN = 0xf0 FINAL_PE = 0xf3 NORMAL_PE = 0xf4 FINAL_TSADI = 0xf5 NORMAL_TSADI = 0xf6 # Minimum Visual vs Logical final letter score difference. # If the difference is below this, don't rely solely on the final letter score # distance. MIN_FINAL_CHAR_DISTANCE = 5 # Minimum Visual vs Logical model score difference. # If the difference is below this, don't rely at all on the model score # distance. MIN_MODEL_DISTANCE = 0.01 VISUAL_HEBREW_NAME = "ISO-8859-8" LOGICAL_HEBREW_NAME = "windows-1255" def __init__(self): super(HebrewProber, self).__init__() self._final_char_logical_score = None self._final_char_visual_score = None self._prev = None self._before_prev = None self._logical_prober = None self._visual_prober = None self.reset() def reset(self): self._final_char_logical_score = 0 self._final_char_visual_score = 0 # The two last characters seen in the previous buffer, # mPrev and mBeforePrev are initialized to space in order to simulate # a word delimiter at the beginning of the data self._prev = ' ' self._before_prev = ' ' # These probers are owned by the group prober. def set_model_probers(self, logicalProber, visualProber): self._logical_prober = logicalProber self._visual_prober = visualProber def is_final(self, c): return c in [self.FINAL_KAF, self.FINAL_MEM, self.FINAL_NUN, self.FINAL_PE, self.FINAL_TSADI] def is_non_final(self, c): # The normal Tsadi is not a good Non-Final letter due to words like # 'lechotet' (to chat) containing an apostrophe after the tsadi. This # apostrophe is converted to a space in FilterWithoutEnglishLetters # causing the Non-Final tsadi to appear at an end of a word even # though this is not the case in the original text. # The letters Pe and Kaf rarely display a related behavior of not being # a good Non-Final letter. Words like 'Pop', 'Winamp' and 'Mubarak' # for example legally end with a Non-Final Pe or Kaf. However, the # benefit of these letters as Non-Final letters outweighs the damage # since these words are quite rare. return c in [self.NORMAL_KAF, self.NORMAL_MEM, self.NORMAL_NUN, self.NORMAL_PE] def feed(self, byte_str): # Final letter analysis for logical-visual decision. # Look for evidence that the received buffer is either logical Hebrew # or visual Hebrew. # The following cases are checked: # 1) A word longer than 1 letter, ending with a final letter. This is # an indication that the text is laid out "naturally" since the # final letter really appears at the end. +1 for logical score. # 2) A word longer than 1 letter, ending with a Non-Final letter. In # normal Hebrew, words ending with Kaf, Mem, Nun, Pe or Tsadi, # should not end with the Non-Final form of that letter. Exceptions # to this rule are mentioned above in isNonFinal(). This is an # indication that the text is laid out backwards. +1 for visual # score # 3) A word longer than 1 letter, starting with a final letter. Final # letters should not appear at the beginning of a word. This is an # indication that the text is laid out backwards. +1 for visual # score. # # The visual score and logical score are accumulated throughout the # text and are finally checked against each other in GetCharSetName(). # No checking for final letters in the middle of words is done since # that case is not an indication for either Logical or Visual text. # # We automatically filter out all 7-bit characters (replace them with # spaces) so the word boundary detection works properly. [MAP] if self.state == ProbingState.NOT_ME: # Both model probers say it's not them. No reason to continue. return ProbingState.NOT_ME byte_str = self.filter_high_byte_only(byte_str) for cur in byte_str: if cur == ' ': # We stand on a space - a word just ended if self._before_prev != ' ': # next-to-last char was not a space so self._prev is not a # 1 letter word if self.is_final(self._prev): # case (1) [-2:not space][-1:final letter][cur:space] self._final_char_logical_score += 1 elif self.is_non_final(self._prev): # case (2) [-2:not space][-1:Non-Final letter][ # cur:space] self._final_char_visual_score += 1 else: # Not standing on a space if ((self._before_prev == ' ') and (self.is_final(self._prev)) and (cur != ' ')): # case (3) [-2:space][-1:final letter][cur:not space] self._final_char_visual_score += 1 self._before_prev = self._prev self._prev = cur # Forever detecting, till the end or until both model probers return # ProbingState.NOT_ME (handled above) return ProbingState.DETECTING @property def charset_name(self): # Make the decision: is it Logical or Visual? # If the final letter score distance is dominant enough, rely on it. finalsub = self._final_char_logical_score - self._final_char_visual_score if finalsub >= self.MIN_FINAL_CHAR_DISTANCE: return self.LOGICAL_HEBREW_NAME if finalsub <= -self.MIN_FINAL_CHAR_DISTANCE: return self.VISUAL_HEBREW_NAME # It's not dominant enough, try to rely on the model scores instead. modelsub = (self._logical_prober.get_confidence() - self._visual_prober.get_confidence()) if modelsub > self.MIN_MODEL_DISTANCE: return self.LOGICAL_HEBREW_NAME if modelsub < -self.MIN_MODEL_DISTANCE: return self.VISUAL_HEBREW_NAME # Still no good, back to final letter distance, maybe it'll save the # day. if finalsub < 0.0: return self.VISUAL_HEBREW_NAME # (finalsub > 0 - Logical) or (don't know what to do) default to # Logical. return self.LOGICAL_HEBREW_NAME @property def language(self): return 'Hebrew' @property def state(self): # Remain active as long as any of the model probers are active. if (self._logical_prober.state == ProbingState.NOT_ME) and \ (self._visual_prober.state == ProbingState.NOT_ME): return ProbingState.NOT_ME return ProbingState.DETECTING site-packages/pip/_vendor/chardet/hebrewprober.pyo000064400000007346147204247350016363 0ustar00 abc@s:ddlmZddlmZdefdYZdS(i(t CharSetProber(t ProbingStatet HebrewProbercBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZedZedZedZRS(iiiiiiiiiiig{Gz?s ISO-8859-8s windows-1255cCsWtt|jd|_d|_d|_d|_d|_d|_ |j dS(N( tsuperRt__init__tNonet_final_char_logical_scoret_final_char_visual_scoret_prevt _before_prevt_logical_probert_visual_probertreset(tself((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pyRs      cCs(d|_d|_d|_d|_dS(Nit (RRRR (R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pyR s   cCs||_||_dS(N(R R (R t logicalProbert visualProber((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pytset_model_proberss cCs(||j|j|j|j|jgkS(N(t FINAL_KAFt FINAL_MEMt FINAL_NUNtFINAL_PEt FINAL_TSADI(R tc((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pytis_finalscCs"||j|j|j|jgkS(N(t NORMAL_KAFt NORMAL_MEMt NORMAL_NUNt NORMAL_PE(R R((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pyt is_non_finals cCs|jtjkrtjS|j|}x|D]}|dkr|jdkr|j|jrt|jd7_q|j|jr|j d7_ qqn?|jdkr|j|jr|dkr|j d7_ n|j|_||_q/Wtj S(NRi( tstateRtNOT_MEtfilter_high_byte_onlyR RRRRRt DETECTING(R tbyte_strtcur((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pytfeeds     cCs|j|j}||jkr&|jS||j kr=|jS|jj|jj}||jkro|jS||j kr|jS|dkr|jS|jS(Ng( RRtMIN_FINAL_CHAR_DISTANCEtLOGICAL_HEBREW_NAMEtVISUAL_HEBREW_NAMER tget_confidenceR tMIN_MODEL_DISTANCE(R tfinalsubtmodelsub((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pyt charset_names  cCsdS(NtHebrew((R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pytlanguagescCs8|jjtjkr1|jjtjkr1tjStjS(N(R RRRR R!(R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pyRs(t__name__t __module__RRRRRRRRRt NORMAL_TSADIR%R)R'R&RR RRRR$tpropertyR,R.R(((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pyRs.    ;N(t charsetproberRtenumsRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/hebrewprober.pytscsite-packages/pip/_vendor/chardet/jisfreq.py000064400000062261147204247350015156 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # Sampling from about 20M text materials include literature and computer technology # # Japanese frequency table, applied to both S-JIS and EUC-JP # They are sorted in order. # 128 --> 0.77094 # 256 --> 0.85710 # 512 --> 0.92635 # 1024 --> 0.97130 # 2048 --> 0.99431 # # Ideal Distribution Ratio = 0.92635 / (1-0.92635) = 12.58 # Random Distribution Ration = 512 / (2965+62+83+86-512) = 0.191 # # Typical Distribution Ratio, 25% of IDR JIS_TYPICAL_DISTRIBUTION_RATIO = 3.0 # Char to FreqOrder table , JIS_TABLE_SIZE = 4368 JIS_CHAR_TO_FREQ_ORDER = ( 40, 1, 6, 182, 152, 180, 295,2127, 285, 381,3295,4304,3068,4606,3165,3510, # 16 3511,1822,2785,4607,1193,2226,5070,4608, 171,2996,1247, 18, 179,5071, 856,1661, # 32 1262,5072, 619, 127,3431,3512,3230,1899,1700, 232, 228,1294,1298, 284, 283,2041, # 48 2042,1061,1062, 48, 49, 44, 45, 433, 434,1040,1041, 996, 787,2997,1255,4305, # 64 2108,4609,1684,1648,5073,5074,5075,5076,5077,5078,3687,5079,4610,5080,3927,3928, # 80 5081,3296,3432, 290,2285,1471,2187,5082,2580,2825,1303,2140,1739,1445,2691,3375, # 96 1691,3297,4306,4307,4611, 452,3376,1182,2713,3688,3069,4308,5083,5084,5085,5086, # 112 5087,5088,5089,5090,5091,5092,5093,5094,5095,5096,5097,5098,5099,5100,5101,5102, # 128 5103,5104,5105,5106,5107,5108,5109,5110,5111,5112,4097,5113,5114,5115,5116,5117, # 144 5118,5119,5120,5121,5122,5123,5124,5125,5126,5127,5128,5129,5130,5131,5132,5133, # 160 5134,5135,5136,5137,5138,5139,5140,5141,5142,5143,5144,5145,5146,5147,5148,5149, # 176 5150,5151,5152,4612,5153,5154,5155,5156,5157,5158,5159,5160,5161,5162,5163,5164, # 192 5165,5166,5167,5168,5169,5170,5171,5172,5173,5174,5175,1472, 598, 618, 820,1205, # 208 1309,1412,1858,1307,1692,5176,5177,5178,5179,5180,5181,5182,1142,1452,1234,1172, # 224 1875,2043,2149,1793,1382,2973, 925,2404,1067,1241, 960,1377,2935,1491, 919,1217, # 240 1865,2030,1406,1499,2749,4098,5183,5184,5185,5186,5187,5188,2561,4099,3117,1804, # 256 2049,3689,4309,3513,1663,5189,3166,3118,3298,1587,1561,3433,5190,3119,1625,2998, # 272 3299,4613,1766,3690,2786,4614,5191,5192,5193,5194,2161, 26,3377, 2,3929, 20, # 288 3691, 47,4100, 50, 17, 16, 35, 268, 27, 243, 42, 155, 24, 154, 29, 184, # 304 4, 91, 14, 92, 53, 396, 33, 289, 9, 37, 64, 620, 21, 39, 321, 5, # 320 12, 11, 52, 13, 3, 208, 138, 0, 7, 60, 526, 141, 151,1069, 181, 275, # 336 1591, 83, 132,1475, 126, 331, 829, 15, 69, 160, 59, 22, 157, 55,1079, 312, # 352 109, 38, 23, 25, 10, 19, 79,5195, 61, 382,1124, 8, 30,5196,5197,5198, # 368 5199,5200,5201,5202,5203,5204,5205,5206, 89, 62, 74, 34,2416, 112, 139, 196, # 384 271, 149, 84, 607, 131, 765, 46, 88, 153, 683, 76, 874, 101, 258, 57, 80, # 400 32, 364, 121,1508, 169,1547, 68, 235, 145,2999, 41, 360,3027, 70, 63, 31, # 416 43, 259, 262,1383, 99, 533, 194, 66, 93, 846, 217, 192, 56, 106, 58, 565, # 432 280, 272, 311, 256, 146, 82, 308, 71, 100, 128, 214, 655, 110, 261, 104,1140, # 448 54, 51, 36, 87, 67,3070, 185,2618,2936,2020, 28,1066,2390,2059,5207,5208, # 464 5209,5210,5211,5212,5213,5214,5215,5216,4615,5217,5218,5219,5220,5221,5222,5223, # 480 5224,5225,5226,5227,5228,5229,5230,5231,5232,5233,5234,5235,5236,3514,5237,5238, # 496 5239,5240,5241,5242,5243,5244,2297,2031,4616,4310,3692,5245,3071,5246,3598,5247, # 512 4617,3231,3515,5248,4101,4311,4618,3808,4312,4102,5249,4103,4104,3599,5250,5251, # 528 5252,5253,5254,5255,5256,5257,5258,5259,5260,5261,5262,5263,5264,5265,5266,5267, # 544 5268,5269,5270,5271,5272,5273,5274,5275,5276,5277,5278,5279,5280,5281,5282,5283, # 560 5284,5285,5286,5287,5288,5289,5290,5291,5292,5293,5294,5295,5296,5297,5298,5299, # 576 5300,5301,5302,5303,5304,5305,5306,5307,5308,5309,5310,5311,5312,5313,5314,5315, # 592 5316,5317,5318,5319,5320,5321,5322,5323,5324,5325,5326,5327,5328,5329,5330,5331, # 608 5332,5333,5334,5335,5336,5337,5338,5339,5340,5341,5342,5343,5344,5345,5346,5347, # 624 5348,5349,5350,5351,5352,5353,5354,5355,5356,5357,5358,5359,5360,5361,5362,5363, # 640 5364,5365,5366,5367,5368,5369,5370,5371,5372,5373,5374,5375,5376,5377,5378,5379, # 656 5380,5381, 363, 642,2787,2878,2788,2789,2316,3232,2317,3434,2011, 165,1942,3930, # 672 3931,3932,3933,5382,4619,5383,4620,5384,5385,5386,5387,5388,5389,5390,5391,5392, # 688 5393,5394,5395,5396,5397,5398,5399,5400,5401,5402,5403,5404,5405,5406,5407,5408, # 704 5409,5410,5411,5412,5413,5414,5415,5416,5417,5418,5419,5420,5421,5422,5423,5424, # 720 5425,5426,5427,5428,5429,5430,5431,5432,5433,5434,5435,5436,5437,5438,5439,5440, # 736 5441,5442,5443,5444,5445,5446,5447,5448,5449,5450,5451,5452,5453,5454,5455,5456, # 752 5457,5458,5459,5460,5461,5462,5463,5464,5465,5466,5467,5468,5469,5470,5471,5472, # 768 5473,5474,5475,5476,5477,5478,5479,5480,5481,5482,5483,5484,5485,5486,5487,5488, # 784 5489,5490,5491,5492,5493,5494,5495,5496,5497,5498,5499,5500,5501,5502,5503,5504, # 800 5505,5506,5507,5508,5509,5510,5511,5512,5513,5514,5515,5516,5517,5518,5519,5520, # 816 5521,5522,5523,5524,5525,5526,5527,5528,5529,5530,5531,5532,5533,5534,5535,5536, # 832 5537,5538,5539,5540,5541,5542,5543,5544,5545,5546,5547,5548,5549,5550,5551,5552, # 848 5553,5554,5555,5556,5557,5558,5559,5560,5561,5562,5563,5564,5565,5566,5567,5568, # 864 5569,5570,5571,5572,5573,5574,5575,5576,5577,5578,5579,5580,5581,5582,5583,5584, # 880 5585,5586,5587,5588,5589,5590,5591,5592,5593,5594,5595,5596,5597,5598,5599,5600, # 896 5601,5602,5603,5604,5605,5606,5607,5608,5609,5610,5611,5612,5613,5614,5615,5616, # 912 5617,5618,5619,5620,5621,5622,5623,5624,5625,5626,5627,5628,5629,5630,5631,5632, # 928 5633,5634,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646,5647,5648, # 944 5649,5650,5651,5652,5653,5654,5655,5656,5657,5658,5659,5660,5661,5662,5663,5664, # 960 5665,5666,5667,5668,5669,5670,5671,5672,5673,5674,5675,5676,5677,5678,5679,5680, # 976 5681,5682,5683,5684,5685,5686,5687,5688,5689,5690,5691,5692,5693,5694,5695,5696, # 992 5697,5698,5699,5700,5701,5702,5703,5704,5705,5706,5707,5708,5709,5710,5711,5712, # 1008 5713,5714,5715,5716,5717,5718,5719,5720,5721,5722,5723,5724,5725,5726,5727,5728, # 1024 5729,5730,5731,5732,5733,5734,5735,5736,5737,5738,5739,5740,5741,5742,5743,5744, # 1040 5745,5746,5747,5748,5749,5750,5751,5752,5753,5754,5755,5756,5757,5758,5759,5760, # 1056 5761,5762,5763,5764,5765,5766,5767,5768,5769,5770,5771,5772,5773,5774,5775,5776, # 1072 5777,5778,5779,5780,5781,5782,5783,5784,5785,5786,5787,5788,5789,5790,5791,5792, # 1088 5793,5794,5795,5796,5797,5798,5799,5800,5801,5802,5803,5804,5805,5806,5807,5808, # 1104 5809,5810,5811,5812,5813,5814,5815,5816,5817,5818,5819,5820,5821,5822,5823,5824, # 1120 5825,5826,5827,5828,5829,5830,5831,5832,5833,5834,5835,5836,5837,5838,5839,5840, # 1136 5841,5842,5843,5844,5845,5846,5847,5848,5849,5850,5851,5852,5853,5854,5855,5856, # 1152 5857,5858,5859,5860,5861,5862,5863,5864,5865,5866,5867,5868,5869,5870,5871,5872, # 1168 5873,5874,5875,5876,5877,5878,5879,5880,5881,5882,5883,5884,5885,5886,5887,5888, # 1184 5889,5890,5891,5892,5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904, # 1200 5905,5906,5907,5908,5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920, # 1216 5921,5922,5923,5924,5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,5936, # 1232 5937,5938,5939,5940,5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951,5952, # 1248 5953,5954,5955,5956,5957,5958,5959,5960,5961,5962,5963,5964,5965,5966,5967,5968, # 1264 5969,5970,5971,5972,5973,5974,5975,5976,5977,5978,5979,5980,5981,5982,5983,5984, # 1280 5985,5986,5987,5988,5989,5990,5991,5992,5993,5994,5995,5996,5997,5998,5999,6000, # 1296 6001,6002,6003,6004,6005,6006,6007,6008,6009,6010,6011,6012,6013,6014,6015,6016, # 1312 6017,6018,6019,6020,6021,6022,6023,6024,6025,6026,6027,6028,6029,6030,6031,6032, # 1328 6033,6034,6035,6036,6037,6038,6039,6040,6041,6042,6043,6044,6045,6046,6047,6048, # 1344 6049,6050,6051,6052,6053,6054,6055,6056,6057,6058,6059,6060,6061,6062,6063,6064, # 1360 6065,6066,6067,6068,6069,6070,6071,6072,6073,6074,6075,6076,6077,6078,6079,6080, # 1376 6081,6082,6083,6084,6085,6086,6087,6088,6089,6090,6091,6092,6093,6094,6095,6096, # 1392 6097,6098,6099,6100,6101,6102,6103,6104,6105,6106,6107,6108,6109,6110,6111,6112, # 1408 6113,6114,2044,2060,4621, 997,1235, 473,1186,4622, 920,3378,6115,6116, 379,1108, # 1424 4313,2657,2735,3934,6117,3809, 636,3233, 573,1026,3693,3435,2974,3300,2298,4105, # 1440 854,2937,2463, 393,2581,2417, 539, 752,1280,2750,2480, 140,1161, 440, 708,1569, # 1456 665,2497,1746,1291,1523,3000, 164,1603, 847,1331, 537,1997, 486, 508,1693,2418, # 1472 1970,2227, 878,1220, 299,1030, 969, 652,2751, 624,1137,3301,2619, 65,3302,2045, # 1488 1761,1859,3120,1930,3694,3516, 663,1767, 852, 835,3695, 269, 767,2826,2339,1305, # 1504 896,1150, 770,1616,6118, 506,1502,2075,1012,2519, 775,2520,2975,2340,2938,4314, # 1520 3028,2086,1224,1943,2286,6119,3072,4315,2240,1273,1987,3935,1557, 175, 597, 985, # 1536 3517,2419,2521,1416,3029, 585, 938,1931,1007,1052,1932,1685,6120,3379,4316,4623, # 1552 804, 599,3121,1333,2128,2539,1159,1554,2032,3810, 687,2033,2904, 952, 675,1467, # 1568 3436,6121,2241,1096,1786,2440,1543,1924, 980,1813,2228, 781,2692,1879, 728,1918, # 1584 3696,4624, 548,1950,4625,1809,1088,1356,3303,2522,1944, 502, 972, 373, 513,2827, # 1600 586,2377,2391,1003,1976,1631,6122,2464,1084, 648,1776,4626,2141, 324, 962,2012, # 1616 2177,2076,1384, 742,2178,1448,1173,1810, 222, 102, 301, 445, 125,2420, 662,2498, # 1632 277, 200,1476,1165,1068, 224,2562,1378,1446, 450,1880, 659, 791, 582,4627,2939, # 1648 3936,1516,1274, 555,2099,3697,1020,1389,1526,3380,1762,1723,1787,2229, 412,2114, # 1664 1900,2392,3518, 512,2597, 427,1925,2341,3122,1653,1686,2465,2499, 697, 330, 273, # 1680 380,2162, 951, 832, 780, 991,1301,3073, 965,2270,3519, 668,2523,2636,1286, 535, # 1696 1407, 518, 671, 957,2658,2378, 267, 611,2197,3030,6123, 248,2299, 967,1799,2356, # 1712 850,1418,3437,1876,1256,1480,2828,1718,6124,6125,1755,1664,2405,6126,4628,2879, # 1728 2829, 499,2179, 676,4629, 557,2329,2214,2090, 325,3234, 464, 811,3001, 992,2342, # 1744 2481,1232,1469, 303,2242, 466,1070,2163, 603,1777,2091,4630,2752,4631,2714, 322, # 1760 2659,1964,1768, 481,2188,1463,2330,2857,3600,2092,3031,2421,4632,2318,2070,1849, # 1776 2598,4633,1302,2254,1668,1701,2422,3811,2905,3032,3123,2046,4106,1763,1694,4634, # 1792 1604, 943,1724,1454, 917, 868,2215,1169,2940, 552,1145,1800,1228,1823,1955, 316, # 1808 1080,2510, 361,1807,2830,4107,2660,3381,1346,1423,1134,4108,6127, 541,1263,1229, # 1824 1148,2540, 545, 465,1833,2880,3438,1901,3074,2482, 816,3937, 713,1788,2500, 122, # 1840 1575, 195,1451,2501,1111,6128, 859, 374,1225,2243,2483,4317, 390,1033,3439,3075, # 1856 2524,1687, 266, 793,1440,2599, 946, 779, 802, 507, 897,1081, 528,2189,1292, 711, # 1872 1866,1725,1167,1640, 753, 398,2661,1053, 246, 348,4318, 137,1024,3440,1600,2077, # 1888 2129, 825,4319, 698, 238, 521, 187,2300,1157,2423,1641,1605,1464,1610,1097,2541, # 1904 1260,1436, 759,2255,1814,2150, 705,3235, 409,2563,3304, 561,3033,2005,2564, 726, # 1920 1956,2343,3698,4109, 949,3812,3813,3520,1669, 653,1379,2525, 881,2198, 632,2256, # 1936 1027, 778,1074, 733,1957, 514,1481,2466, 554,2180, 702,3938,1606,1017,1398,6129, # 1952 1380,3521, 921, 993,1313, 594, 449,1489,1617,1166, 768,1426,1360, 495,1794,3601, # 1968 1177,3602,1170,4320,2344, 476, 425,3167,4635,3168,1424, 401,2662,1171,3382,1998, # 1984 1089,4110, 477,3169, 474,6130,1909, 596,2831,1842, 494, 693,1051,1028,1207,3076, # 2000 606,2115, 727,2790,1473,1115, 743,3522, 630, 805,1532,4321,2021, 366,1057, 838, # 2016 684,1114,2142,4322,2050,1492,1892,1808,2271,3814,2424,1971,1447,1373,3305,1090, # 2032 1536,3939,3523,3306,1455,2199, 336, 369,2331,1035, 584,2393, 902, 718,2600,6131, # 2048 2753, 463,2151,1149,1611,2467, 715,1308,3124,1268, 343,1413,3236,1517,1347,2663, # 2064 2093,3940,2022,1131,1553,2100,2941,1427,3441,2942,1323,2484,6132,1980, 872,2368, # 2080 2441,2943, 320,2369,2116,1082, 679,1933,3941,2791,3815, 625,1143,2023, 422,2200, # 2096 3816,6133, 730,1695, 356,2257,1626,2301,2858,2637,1627,1778, 937, 883,2906,2693, # 2112 3002,1769,1086, 400,1063,1325,3307,2792,4111,3077, 456,2345,1046, 747,6134,1524, # 2128 884,1094,3383,1474,2164,1059, 974,1688,2181,2258,1047, 345,1665,1187, 358, 875, # 2144 3170, 305, 660,3524,2190,1334,1135,3171,1540,1649,2542,1527, 927, 968,2793, 885, # 2160 1972,1850, 482, 500,2638,1218,1109,1085,2543,1654,2034, 876, 78,2287,1482,1277, # 2176 861,1675,1083,1779, 724,2754, 454, 397,1132,1612,2332, 893, 672,1237, 257,2259, # 2192 2370, 135,3384, 337,2244, 547, 352, 340, 709,2485,1400, 788,1138,2511, 540, 772, # 2208 1682,2260,2272,2544,2013,1843,1902,4636,1999,1562,2288,4637,2201,1403,1533, 407, # 2224 576,3308,1254,2071, 978,3385, 170, 136,1201,3125,2664,3172,2394, 213, 912, 873, # 2240 3603,1713,2202, 699,3604,3699, 813,3442, 493, 531,1054, 468,2907,1483, 304, 281, # 2256 4112,1726,1252,2094, 339,2319,2130,2639, 756,1563,2944, 748, 571,2976,1588,2425, # 2272 2715,1851,1460,2426,1528,1392,1973,3237, 288,3309, 685,3386, 296, 892,2716,2216, # 2288 1570,2245, 722,1747,2217, 905,3238,1103,6135,1893,1441,1965, 251,1805,2371,3700, # 2304 2601,1919,1078, 75,2182,1509,1592,1270,2640,4638,2152,6136,3310,3817, 524, 706, # 2320 1075, 292,3818,1756,2602, 317, 98,3173,3605,3525,1844,2218,3819,2502, 814, 567, # 2336 385,2908,1534,6137, 534,1642,3239, 797,6138,1670,1529, 953,4323, 188,1071, 538, # 2352 178, 729,3240,2109,1226,1374,2000,2357,2977, 731,2468,1116,2014,2051,6139,1261, # 2368 1593, 803,2859,2736,3443, 556, 682, 823,1541,6140,1369,2289,1706,2794, 845, 462, # 2384 2603,2665,1361, 387, 162,2358,1740, 739,1770,1720,1304,1401,3241,1049, 627,1571, # 2400 2427,3526,1877,3942,1852,1500, 431,1910,1503, 677, 297,2795, 286,1433,1038,1198, # 2416 2290,1133,1596,4113,4639,2469,1510,1484,3943,6141,2442, 108, 712,4640,2372, 866, # 2432 3701,2755,3242,1348, 834,1945,1408,3527,2395,3243,1811, 824, 994,1179,2110,1548, # 2448 1453, 790,3003, 690,4324,4325,2832,2909,3820,1860,3821, 225,1748, 310, 346,1780, # 2464 2470, 821,1993,2717,2796, 828, 877,3528,2860,2471,1702,2165,2910,2486,1789, 453, # 2480 359,2291,1676, 73,1164,1461,1127,3311, 421, 604, 314,1037, 589, 116,2487, 737, # 2496 837,1180, 111, 244, 735,6142,2261,1861,1362, 986, 523, 418, 581,2666,3822, 103, # 2512 855, 503,1414,1867,2488,1091, 657,1597, 979, 605,1316,4641,1021,2443,2078,2001, # 2528 1209, 96, 587,2166,1032, 260,1072,2153, 173, 94, 226,3244, 819,2006,4642,4114, # 2544 2203, 231,1744, 782, 97,2667, 786,3387, 887, 391, 442,2219,4326,1425,6143,2694, # 2560 633,1544,1202, 483,2015, 592,2052,1958,2472,1655, 419, 129,4327,3444,3312,1714, # 2576 1257,3078,4328,1518,1098, 865,1310,1019,1885,1512,1734, 469,2444, 148, 773, 436, # 2592 1815,1868,1128,1055,4329,1245,2756,3445,2154,1934,1039,4643, 579,1238, 932,2320, # 2608 353, 205, 801, 115,2428, 944,2321,1881, 399,2565,1211, 678, 766,3944, 335,2101, # 2624 1459,1781,1402,3945,2737,2131,1010, 844, 981,1326,1013, 550,1816,1545,2620,1335, # 2640 1008, 371,2881, 936,1419,1613,3529,1456,1395,2273,1834,2604,1317,2738,2503, 416, # 2656 1643,4330, 806,1126, 229, 591,3946,1314,1981,1576,1837,1666, 347,1790, 977,3313, # 2672 764,2861,1853, 688,2429,1920,1462, 77, 595, 415,2002,3034, 798,1192,4115,6144, # 2688 2978,4331,3035,2695,2582,2072,2566, 430,2430,1727, 842,1396,3947,3702, 613, 377, # 2704 278, 236,1417,3388,3314,3174, 757,1869, 107,3530,6145,1194, 623,2262, 207,1253, # 2720 2167,3446,3948, 492,1117,1935, 536,1838,2757,1246,4332, 696,2095,2406,1393,1572, # 2736 3175,1782, 583, 190, 253,1390,2230, 830,3126,3389, 934,3245,1703,1749,2979,1870, # 2752 2545,1656,2204, 869,2346,4116,3176,1817, 496,1764,4644, 942,1504, 404,1903,1122, # 2768 1580,3606,2945,1022, 515, 372,1735, 955,2431,3036,6146,2797,1110,2302,2798, 617, # 2784 6147, 441, 762,1771,3447,3607,3608,1904, 840,3037, 86, 939,1385, 572,1370,2445, # 2800 1336, 114,3703, 898, 294, 203,3315, 703,1583,2274, 429, 961,4333,1854,1951,3390, # 2816 2373,3704,4334,1318,1381, 966,1911,2322,1006,1155, 309, 989, 458,2718,1795,1372, # 2832 1203, 252,1689,1363,3177, 517,1936, 168,1490, 562, 193,3823,1042,4117,1835, 551, # 2848 470,4645, 395, 489,3448,1871,1465,2583,2641, 417,1493, 279,1295, 511,1236,1119, # 2864 72,1231,1982,1812,3004, 871,1564, 984,3449,1667,2696,2096,4646,2347,2833,1673, # 2880 3609, 695,3246,2668, 807,1183,4647, 890, 388,2333,1801,1457,2911,1765,1477,1031, # 2896 3316,3317,1278,3391,2799,2292,2526, 163,3450,4335,2669,1404,1802,6148,2323,2407, # 2912 1584,1728,1494,1824,1269, 298, 909,3318,1034,1632, 375, 776,1683,2061, 291, 210, # 2928 1123, 809,1249,1002,2642,3038, 206,1011,2132, 144, 975, 882,1565, 342, 667, 754, # 2944 1442,2143,1299,2303,2062, 447, 626,2205,1221,2739,2912,1144,1214,2206,2584, 760, # 2960 1715, 614, 950,1281,2670,2621, 810, 577,1287,2546,4648, 242,2168, 250,2643, 691, # 2976 123,2644, 647, 313,1029, 689,1357,2946,1650, 216, 771,1339,1306, 808,2063, 549, # 2992 913,1371,2913,2914,6149,1466,1092,1174,1196,1311,2605,2396,1783,1796,3079, 406, # 3008 2671,2117,3949,4649, 487,1825,2220,6150,2915, 448,2348,1073,6151,2397,1707, 130, # 3024 900,1598, 329, 176,1959,2527,1620,6152,2275,4336,3319,1983,2191,3705,3610,2155, # 3040 3706,1912,1513,1614,6153,1988, 646, 392,2304,1589,3320,3039,1826,1239,1352,1340, # 3056 2916, 505,2567,1709,1437,2408,2547, 906,6154,2672, 384,1458,1594,1100,1329, 710, # 3072 423,3531,2064,2231,2622,1989,2673,1087,1882, 333, 841,3005,1296,2882,2379, 580, # 3088 1937,1827,1293,2585, 601, 574, 249,1772,4118,2079,1120, 645, 901,1176,1690, 795, # 3104 2207, 478,1434, 516,1190,1530, 761,2080, 930,1264, 355, 435,1552, 644,1791, 987, # 3120 220,1364,1163,1121,1538, 306,2169,1327,1222, 546,2645, 218, 241, 610,1704,3321, # 3136 1984,1839,1966,2528, 451,6155,2586,3707,2568, 907,3178, 254,2947, 186,1845,4650, # 3152 745, 432,1757, 428,1633, 888,2246,2221,2489,3611,2118,1258,1265, 956,3127,1784, # 3168 4337,2490, 319, 510, 119, 457,3612, 274,2035,2007,4651,1409,3128, 970,2758, 590, # 3184 2800, 661,2247,4652,2008,3950,1420,1549,3080,3322,3951,1651,1375,2111, 485,2491, # 3200 1429,1156,6156,2548,2183,1495, 831,1840,2529,2446, 501,1657, 307,1894,3247,1341, # 3216 666, 899,2156,1539,2549,1559, 886, 349,2208,3081,2305,1736,3824,2170,2759,1014, # 3232 1913,1386, 542,1397,2948, 490, 368, 716, 362, 159, 282,2569,1129,1658,1288,1750, # 3248 2674, 276, 649,2016, 751,1496, 658,1818,1284,1862,2209,2087,2512,3451, 622,2834, # 3264 376, 117,1060,2053,1208,1721,1101,1443, 247,1250,3179,1792,3952,2760,2398,3953, # 3280 6157,2144,3708, 446,2432,1151,2570,3452,2447,2761,2835,1210,2448,3082, 424,2222, # 3296 1251,2449,2119,2836, 504,1581,4338, 602, 817, 857,3825,2349,2306, 357,3826,1470, # 3312 1883,2883, 255, 958, 929,2917,3248, 302,4653,1050,1271,1751,2307,1952,1430,2697, # 3328 2719,2359, 354,3180, 777, 158,2036,4339,1659,4340,4654,2308,2949,2248,1146,2232, # 3344 3532,2720,1696,2623,3827,6158,3129,1550,2698,1485,1297,1428, 637, 931,2721,2145, # 3360 914,2550,2587, 81,2450, 612, 827,2646,1242,4655,1118,2884, 472,1855,3181,3533, # 3376 3534, 569,1353,2699,1244,1758,2588,4119,2009,2762,2171,3709,1312,1531,6159,1152, # 3392 1938, 134,1830, 471,3710,2276,1112,1535,3323,3453,3535, 982,1337,2950, 488, 826, # 3408 674,1058,1628,4120,2017, 522,2399, 211, 568,1367,3454, 350, 293,1872,1139,3249, # 3424 1399,1946,3006,1300,2360,3324, 588, 736,6160,2606, 744, 669,3536,3828,6161,1358, # 3440 199, 723, 848, 933, 851,1939,1505,1514,1338,1618,1831,4656,1634,3613, 443,2740, # 3456 3829, 717,1947, 491,1914,6162,2551,1542,4121,1025,6163,1099,1223, 198,3040,2722, # 3472 370, 410,1905,2589, 998,1248,3182,2380, 519,1449,4122,1710, 947, 928,1153,4341, # 3488 2277, 344,2624,1511, 615, 105, 161,1212,1076,1960,3130,2054,1926,1175,1906,2473, # 3504 414,1873,2801,6164,2309, 315,1319,3325, 318,2018,2146,2157, 963, 631, 223,4342, # 3520 4343,2675, 479,3711,1197,2625,3712,2676,2361,6165,4344,4123,6166,2451,3183,1886, # 3536 2184,1674,1330,1711,1635,1506, 799, 219,3250,3083,3954,1677,3713,3326,2081,3614, # 3552 1652,2073,4657,1147,3041,1752, 643,1961, 147,1974,3955,6167,1716,2037, 918,3007, # 3568 1994, 120,1537, 118, 609,3184,4345, 740,3455,1219, 332,1615,3830,6168,1621,2980, # 3584 1582, 783, 212, 553,2350,3714,1349,2433,2082,4124, 889,6169,2310,1275,1410, 973, # 3600 166,1320,3456,1797,1215,3185,2885,1846,2590,2763,4658, 629, 822,3008, 763, 940, # 3616 1990,2862, 439,2409,1566,1240,1622, 926,1282,1907,2764, 654,2210,1607, 327,1130, # 3632 3956,1678,1623,6170,2434,2192, 686, 608,3831,3715, 903,3957,3042,6171,2741,1522, # 3648 1915,1105,1555,2552,1359, 323,3251,4346,3457, 738,1354,2553,2311,2334,1828,2003, # 3664 3832,1753,2351,1227,6172,1887,4125,1478,6173,2410,1874,1712,1847, 520,1204,2607, # 3680 264,4659, 836,2677,2102, 600,4660,3833,2278,3084,6174,4347,3615,1342, 640, 532, # 3696 543,2608,1888,2400,2591,1009,4348,1497, 341,1737,3616,2723,1394, 529,3252,1321, # 3712 983,4661,1515,2120, 971,2592, 924, 287,1662,3186,4349,2700,4350,1519, 908,1948, # 3728 2452, 156, 796,1629,1486,2223,2055, 694,4126,1259,1036,3392,1213,2249,2742,1889, # 3744 1230,3958,1015, 910, 408, 559,3617,4662, 746, 725, 935,4663,3959,3009,1289, 563, # 3760 867,4664,3960,1567,2981,2038,2626, 988,2263,2381,4351, 143,2374, 704,1895,6175, # 3776 1188,3716,2088, 673,3085,2362,4352, 484,1608,1921,2765,2918, 215, 904,3618,3537, # 3792 894, 509, 976,3043,2701,3961,4353,2837,2982, 498,6176,6177,1102,3538,1332,3393, # 3808 1487,1636,1637, 233, 245,3962, 383, 650, 995,3044, 460,1520,1206,2352, 749,3327, # 3824 530, 700, 389,1438,1560,1773,3963,2264, 719,2951,2724,3834, 870,1832,1644,1000, # 3840 839,2474,3717, 197,1630,3394, 365,2886,3964,1285,2133, 734, 922, 818,1106, 732, # 3856 480,2083,1774,3458, 923,2279,1350, 221,3086, 85,2233,2234,3835,1585,3010,2147, # 3872 1387,1705,2382,1619,2475, 133, 239,2802,1991,1016,2084,2383, 411,2838,1113, 651, # 3888 1985,1160,3328, 990,1863,3087,1048,1276,2647, 265,2627,1599,3253,2056, 150, 638, # 3904 2019, 656, 853, 326,1479, 680,1439,4354,1001,1759, 413,3459,3395,2492,1431, 459, # 3920 4355,1125,3329,2265,1953,1450,2065,2863, 849, 351,2678,3131,3254,3255,1104,1577, # 3936 227,1351,1645,2453,2193,1421,2887, 812,2121, 634, 95,2435, 201,2312,4665,1646, # 3952 1671,2743,1601,2554,2702,2648,2280,1315,1366,2089,3132,1573,3718,3965,1729,1189, # 3968 328,2679,1077,1940,1136, 558,1283, 964,1195, 621,2074,1199,1743,3460,3619,1896, # 3984 1916,1890,3836,2952,1154,2112,1064, 862, 378,3011,2066,2113,2803,1568,2839,6178, # 4000 3088,2919,1941,1660,2004,1992,2194, 142, 707,1590,1708,1624,1922,1023,1836,1233, # 4016 1004,2313, 789, 741,3620,6179,1609,2411,1200,4127,3719,3720,4666,2057,3721, 593, # 4032 2840, 367,2920,1878,6180,3461,1521, 628,1168, 692,2211,2649, 300, 720,2067,2571, # 4048 2953,3396, 959,2504,3966,3539,3462,1977, 701,6181, 954,1043, 800, 681, 183,3722, # 4064 1803,1730,3540,4128,2103, 815,2314, 174, 467, 230,2454,1093,2134, 755,3541,3397, # 4080 1141,1162,6182,1738,2039, 270,3256,2513,1005,1647,2185,3837, 858,1679,1897,1719, # 4096 2954,2324,1806, 402, 670, 167,4129,1498,2158,2104, 750,6183, 915, 189,1680,1551, # 4112 455,4356,1501,2455, 405,1095,2955, 338,1586,1266,1819, 570, 641,1324, 237,1556, # 4128 2650,1388,3723,6184,1368,2384,1343,1978,3089,2436, 879,3724, 792,1191, 758,3012, # 4144 1411,2135,1322,4357, 240,4667,1848,3725,1574,6185, 420,3045,1546,1391, 714,4358, # 4160 1967, 941,1864, 863, 664, 426, 560,1731,2680,1785,2864,1949,2363, 403,3330,1415, # 4176 1279,2136,1697,2335, 204, 721,2097,3838, 90,6186,2085,2505, 191,3967, 124,2148, # 4192 1376,1798,1178,1107,1898,1405, 860,4359,1243,1272,2375,2983,1558,2456,1638, 113, # 4208 3621, 578,1923,2609, 880, 386,4130, 784,2186,2266,1422,2956,2172,1722, 497, 263, # 4224 2514,1267,2412,2610, 177,2703,3542, 774,1927,1344, 616,1432,1595,1018, 172,4360, # 4240 2325, 911,4361, 438,1468,3622, 794,3968,2024,2173,1681,1829,2957, 945, 895,3090, # 4256 575,2212,2476, 475,2401,2681, 785,2744,1745,2293,2555,1975,3133,2865, 394,4668, # 4272 3839, 635,4131, 639, 202,1507,2195,2766,1345,1435,2572,3726,1908,1184,1181,2457, # 4288 3727,3134,4362, 843,2611, 437, 916,4669, 234, 769,1884,3046,3047,3623, 833,6187, # 4304 1639,2250,2402,1355,1185,2010,2047, 999, 525,1732,1290,1488,2612, 948,1578,3728, # 4320 2413,2477,1216,2725,2159, 334,3840,1328,3624,2921,1525,4132, 564,1056, 891,4363, # 4336 1444,1698,2385,2251,3729,1365,2281,2235,1717,6188, 864,3841,2515, 444, 527,2767, # 4352 2922,3625, 544, 461,6189, 566, 209,2437,3398,2098,1065,2068,3331,3626,3257,2137, # 4368 #last 512 ) site-packages/pip/_vendor/chardet/jisfreq.pyo000064400000126720147204247350015336 0ustar00 abc@sdZdZdZdS(g@ii(iiiiii'iOii}i ii ii] i i ii iiiiiii iiiiiXi}iiikiig i i ikiiiiiiiiii%i&i0i1i,i-iiiiiii iii<iiipiiiiiiigiiiiWiXii ih i"iiiii i ii\iii i/ ii iiiii0 ii ihi iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii ii!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7iiViji4iiiiBiii8i9i:i;i<i=i>iviiiiSiieiifi iid i+iiiaiw iiiiIii~ii ii?i@iAiBiCiDi ii- i iiiii iiEi^ i. i i3iii iFi/ iYi i iiiji iiGiHiIiJiqii1 iiYiiki/ii2iii#i iii*iiiiiii[ii\i5ii!i!i i%i@ilii'iAii i i4i iiiiii<iiii-iii7iSiii~iKi=iiEii;iii7i7i8imi&iii iiOiKi=i~idiiiLiMiNiOiPiQiRiSiTiUiViYi>iJi"ip ipiiiiiTi_iii.iXiiiLijieii9iPi iliyiii iDiii i)ihi iFi?ii+iiigiciiiBi]iNiii8iji:i5iii7iiiRi4iGidiiiiniihiti6i3i$iWiCi ii: ix iii*iV i iWiXiYiZi[i\i]i^i_i`iiaibicidieifigihiiijikiliminioipiqirisiti iuiviwixiyizi{i|iiiiili}i i~iii i i iiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiikii i> i i i i i ij iiiiZi[i\i]ii ii ii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i iiiiiii2 iii{iTiia i i^iii|i i=iimik i i ii iViy i ii iq iiii i iiiii!ii ii ii iiCiOi3iiiiiir iiinii+iiii ipiqi i; iAi iiiCi0 iini iiiTiCioi ii i# iii~iiPiiiiii ii i i$ iz ii i&iiiii iiiii_iiiUii is i ii iIiiiiiiii3 iii$iWi1 i5iPi iiiiiiiX iiiil iiiHii iiiiii i iWii~ipii$iiii@iLi i iiiiuii iJiI iW iii_ii i<iiii]iDiiiiihiiiiiiifi-ii}it ii iiiii,ii ibiiiXiiiFii{ i`iii+i3iqiimii4 iiiiiiBiliX i ii% iii% i2 iuii i iiJii|irii@i iii iii ii iL iiiiiiib iJ i icii iiiiii4 iRiim iTiii iiiiiie iii? i iiiii-i ii*iEi ii+i ii& i iii/iii.isi[ii+ii ii iBic iiiiii i) ii,i iu ii ii9i& iiiiiiv iiY i i3 ii iiiiDiiiiidiii| i(iyiiiii<i8i iiii i id i5 iBiini iiiii|i i!ii)i@ in imi i i0iaiii izi'iii iWii[iviii iii io i i ii iii' ii i"iii9iii iiJiiihiiie iii\iiiip i@iiQi9iiii iiiiw iiiEiiJiIi iiiiiifii ii i i1i ii iii' iri iiii iiici iqiixiii i2iiiii i*iiibiFiiviidi iii!iRiiiQiiiiPiiiiiiii( iii_ ii` iiif ii6 iiAiiia iiiuiTi i2iiiiii i^iCii ii[ii ivi%iiiini!iFiiZi^iiiidiiiix iii]i iBiici i iiiPiqi i iHiY iii( ii iigi}iKi iii4 iiWii iiCig i-idiikii4i} iiq i~ i+i iiihi@ i i i@iA iDi:iiiei iiqiwiiiiiiiidiiZii* iM i[iiisiZ i i ii>ii'i-i i ii ii) iiiiitiFi7 iiti#iiiiiiYiiifikib i1ii ii6ioic iiqi iiii iuii:iiiN iiUi=i iviiliNiiii]ii;iii iiiliLi i}iiiiiB ii8 iQii#i`iTii ixiiri iiiiii ii3iniiiiiii{iii@i iiii9 iiii5 ih id iZ iiiiiiiiiisi-ir iiiii[ ii0iiiii.iSi iRiO iii ii;i i4iy i i;iiz iipii i i ii: i(i|i ii"iiiiii iOiieiiii iC iti) ii6iKiii8iiP iihii ii ii3i$iii* i=ibie ii i4iii i.i7ii\ iiiiji iiiiiiii/iiii i=ii^ii5 i ii i\iiiii9i#i+ i is i,ii7iiiYiii iMii+ ii iQiii6 iiiiiiyi iisi#i{ i iUifi<iiiviii)i iiiiiimi<iii iiigii ilii iD ibiui i iDiBiii i[ i ii8iii>i iii iiii i] iiDiiii6iZii i5ii i i<imi i, i iiui^ i iiigiiiIiiigi ii\i:i iMiti iiEiioiiiiiEiRii iiEij iigiWiiiKi iCii=ii]i$i!ii iiii`iKiviii0iiii^ii i3ii"iiiiiiaik ii; iwiiiiiii iyiiiiiPiii iwiiiit i iii iiiJiaiii]iiii iiiiiLihiiii iu ijiii#iCiii iaii!isi| ii iYii iiiihiOi5iiiziii iSiiLii.ii&ii i< i7iisiA iiiMi iisii*i, i%i i iikii&ifiiOiji"ii(i-ii[iii ii- i=ii} iiiMiSiii iiiii ii i i ii ii~ iiJitikivieiyiiii< i if iiMiki iiioiiiiwiv ilii]iii.i iiii/if iqi$ig iiGiiinii>i6 i= ii iii iNi ixiiei* iih iiii$iiiioibi,ii iiitiii i ii iVii iiiiiiiw iiipiHi iViiii<iZi i8iriwii&ii ii/iiiii>ii> iE ixii&ieiiwi iii5iii ii\iiiiSii iiiii2iiiii+i'ii%iiix iOii iQ iiiiiii_iHiiii igiiiy ii i0i&i+ i iiii il i'ii'izii i ii_ iiii i ii? i ii iiz iim i|i ii ig i0iii ii*ii i i`iwiii i#iici)iiiR i iiiTiiiriiViiii_iiiiiriii i` ixiii iiifiiin i= i*iAii i(iixiiS ii{iT ii9iiiMi iriii;ii(ii%ii[ia ib iiiDiiii- i\ iii iio iEimi)ii!iiic ii, i1ii] iiii>iIiii iTiiii iiiyiikizixiiNi iiii i5i i i"iiHi<id ii iiih i ii ip iii:iLi1iii iii> iiq i?iZiMiIi iiB iK iDii#i i iYi>iiiii`iiiiiiiiiiiii iiiciiiiiiiTiiaii2iyi/ii"iU iiibii ii/ii ii i i{i iij ii ii5i*iiiiiaixiii iiFiiii7 iii i?iiwiiiiii+ii8 ii iNi iii,iinii i i ioisi_i?ii iii i iii?i0i i iiyi3ifi i=iiilii iivi]ii i iiizi iiyijiiui iipiijiii iiiziiir iiiiiiiiiFii'i i{ ini ixiui$iiiiMiiiik iipi i^ iqi i`i|ii ii i| i i i ii i iiii iGi ii-iiZi1iYii- i ieiii[iC iiiie i i.i-iiii iii i i7 ibil i iiii{ii.i i iizii i ii? iii9 ii iiii}ii iaii i iQi idi;iV ii/i^iD ii?im i i i9iIi iii iii i{i}i iiiiii&ii~iiXii i} i ii9i ii:ii"i\iii i_ ii8iWi~ i^i%iPisi iwii ii8 i iLiii. iii iiiNiiiPiiSiiii:iRi'i0ibiii iiiiizii iiiiiKiii i iriiqi iiin iL iiiiiiiiiiXi@ iigiiiii4ii: iiiiri iiQi ii i;i'i i>iibimiiwiiiis iiiiA iit i9 iiiii io i^iii2iiciiii i iriii i!iitii1i{i iiiiiisiiiii iixiiviaip iii iiLiOiiiUi i.iii)i. iiEi i"iiyii iiiii(i iiiq iE i6i i i2iui6i iiii. iii iiiViiisi iiiGiGijitiiWii iii`iiiiui ii ii{iQii iOiCi ii iiJi i i i$iiii/ iii_iiiij iRii7iii/ ii3iDiu i6iXi4iii iiii>iiii0 i`i` i iiiiUii i irii i)ii5iiHii iii~ir ii iiiii iii]iiiiiii i@ iii iaiiviiii/i!i6iiii7iwi i i3ici8ixii iiB iiiM iiiF iigiiii(ii i: iiiHii if iii"i i~iii i iyii i ii i!iNi i4iA iidieiiiziiii iiii0 ii iiiiiii{iii i iifi(iliiGi iii^iB imiF i|iiUiii2iRiii#ii iiiFii iUiiii1i icikiiN iSi iii iii$iO ii iYiiii iiGi iiiW i iC i?i iii~iiiUiFiiiiiiii iC i iiiiei iiiii/ iQi_iv i; i i iPi)iiGimi iiiG i,iIizi_i ii i9inii iAi i iX ii#iVi)i< i%ii}iiiHiw i5iipi.iiiimiiii i#ihi|ibii ii@i(i^izi iiAi i i i"i ig ii|iiiiii6iiXiii,iii iii$i#iIik iiiii:i iiQi ioih iVi$i iitiiiiY i,iii i iD ii i~i i iii%iii iiii ii i i7i/i iiii iEiVii iE iuii&iiii i iioiiiZiiiii i iiiii!iini8ii'iiiiiiii iiGi iRi2iii:ii,iiiZ ilii(iXiP i?ii i ioiiiii iiWi*iii;i8ii&i)ii i ioiiiiiHi_iii0iix ii0 ii; ii iiiXii iii1iiZi*i%i iii|idi`iiiSiji}i\iiiiG i ii ifiqi%iBii1 ipii"iiiii i|iiii iil i2 ii i iii@ihii;iiii ii iii&iiii}ii%i iii i?ii iia iy ii iii ii= i1 ii<ii{i#iiiii iAii iitiii ii> i iKi3 iii=iii\i i i'iAi+igiib iKiiiii ii ii4 ii*iim i ii ioiNii0i(ii ii$i4i i{i iiiQ iiiUiiii,i`ii iii ij i)i ii-i6ii iF i2i)ii i*i iYN(i(iiiiii'iOii}i ii ii] i i ii iiiiiii iiiiiXi}iiikiig i i ikiiiiiiiiii%i&i0i1i,i-iiiiiii iii<iiipiiiiiiigiiiiWiXii ih i"iiiii i ii\iii i/ ii iiiii0 ii ihi iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii ii!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7iiViji4iiiiBiii8i9i:i;i<i=i>iviiiiSiieiifi iid i+iiiaiw iiiiIii~ii ii?i@iAiBiCiDi ii- i iiiii iiEi^ i. i i3iii iFi/ iYi i iiiji iiGiHiIiJiqii1 iiYiiki/ii2iii#i iii*iiiiiii[ii\i5ii!i!i i%i@ilii'iAii i i4i iiiiii<iiii-iii7iSiii~iKi=iiEii;iii7i7i8imi&iii iiOiKi=i~idiiiLiMiNiOiPiQiRiSiTiUiViYi>iJi"ip ipiiiiiTi_iii.iXiiiLijieii9iPi iliyiii iDiii i)ihi iFi?ii+iiigiciiiBi]iNiii8iji:i5iii7iiiRi4iGidiiiiniihiti6i3i$iWiCi ii: ix iii*iV i iWiXiYiZi[i\i]i^i_i`iiaibicidieifigihiiijikiliminioipiqirisiti iuiviwixiyizi{i|iiiiili}i i~iii i i iiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiikii i> i i i i i ij iiiiZi[i\i]ii ii ii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i iiiiiii2 iii{iTiia i i^iii|i i=iimik i i ii iViy i ii iq iiii i iiiii!ii ii ii iiCiOi3iiiiiir iiinii+iiii ipiqi i; iAi iiiCi0 iini iiiTiCioi ii i# iii~iiPiiiiii ii i i$ iz ii i&iiiii iiiii_iiiUii is i ii iIiiiiiiii3 iii$iWi1 i5iPi iiiiiiiX iiiil iiiHii iiiiii i iWii~ipii$iiii@iLi i iiiiuii iJiI iW iii_ii i<iiii]iDiiiiihiiiiiiifi-ii}it ii iiiii,ii ibiiiXiiiFii{ i`iii+i3iqiimii4 iiiiiiBiliX i ii% iii% i2 iuii i iiJii|irii@i iii iii ii iL iiiiiiib iJ i icii iiiiii4 iRiim iTiii iiiiiie iii? i iiiii-i ii*iEi ii+i ii& i iii/iii.isi[ii+ii ii iBic iiiiii i) ii,i iu ii ii9i& iiiiiiv iiY i i3 ii iiiiDiiiiidiii| i(iyiiiii<i8i iiii i id i5 iBiini iiiii|i i!ii)i@ in imi i i0iaiii izi'iii iWii[iviii iii io i i ii iii' ii i"iii9iii iiJiiihiiie iii\iiiip i@iiQi9iiii iiiiw iiiEiiJiIi iiiiiifii ii i i1i ii iii' iri iiii iiici iqiixiii i2iiiii i*iiibiFiiviidi iii!iRiiiQiiiiPiiiiiiii( iii_ ii` iiif ii6 iiAiiia iiiuiTi i2iiiiii i^iCii ii[ii ivi%iiiini!iFiiZi^iiiidiiiix iii]i iBiici i iiiPiqi i iHiY iii( ii iigi}iKi iii4 iiWii iiCig i-idiikii4i} iiq i~ i+i iiihi@ i i i@iA iDi:iiiei iiqiwiiiiiiiidiiZii* iM i[iiisiZ i i ii>ii'i-i i ii ii) iiiiitiFi7 iiti#iiiiiiYiiifikib i1ii ii6ioic iiqi iiii iuii:iiiN iiUi=i iviiliNiiii]ii;iii iiiliLi i}iiiiiB ii8 iQii#i`iTii ixiiri iiiiii ii3iniiiiiii{iii@i iiii9 iiii5 ih id iZ iiiiiiiiiisi-ir iiiii[ ii0iiiii.iSi iRiO iii ii;i i4iy i i;iiz iipii i i ii: i(i|i ii"iiiiii iOiieiiii iC iti) ii6iKiii8iiP iihii ii ii3i$iii* i=ibie ii i4iii i.i7ii\ iiiiji iiiiiiii/iiii i=ii^ii5 i ii i\iiiii9i#i+ i is i,ii7iiiYiii iMii+ ii iQiii6 iiiiiiyi iisi#i{ i iUifi<iiiviii)i iiiiiimi<iii iiigii ilii iD ibiui i iDiBiii i[ i ii8iii>i iii iiii i] iiDiiii6iZii i5ii i i<imi i, i iiui^ i iiigiiiIiiigi ii\i:i iMiti iiEiioiiiiiEiRii iiEij iigiWiiiKi iCii=ii]i$i!ii iiii`iKiviii0iiii^ii i3ii"iiiiiiaik ii; iwiiiiiii iyiiiiiPiii iwiiiit i iii iiiJiaiii]iiii iiiiiLihiiii iu ijiii#iCiii iaii!isi| ii iYii iiiihiOi5iiiziii iSiiLii.ii&ii i< i7iisiA iiiMi iisii*i, i%i i iikii&ifiiOiji"ii(i-ii[iii ii- i=ii} iiiMiSiii iiiii ii i i ii ii~ iiJitikivieiyiiii< i if iiMiki iiioiiiiwiv ilii]iii.i iiii/if iqi$ig iiGiiinii>i6 i= ii iii iNi ixiiei* iih iiii$iiiioibi,ii iiitiii i ii iVii iiiiiiiw iiipiHi iViiii<iZi i8iriwii&ii ii/iiiii>ii> iE ixii&ieiiwi iii5iii ii\iiiiSii iiiii2iiiii+i'ii%iiix iOii iQ iiiiiii_iHiiii igiiiy ii i0i&i+ i iiii il i'ii'izii i ii_ iiii i ii? i ii iiz iim i|i ii ig i0iii ii*ii i i`iwiii i#iici)iiiR i iiiTiiiriiViiii_iiiiiriii i` ixiii iiifiiin i= i*iAii i(iixiiS ii{iT ii9iiiMi iriii;ii(ii%ii[ia ib iiiDiiii- i\ iii iio iEimi)ii!iiic ii, i1ii] iiii>iIiii iTiiii iiiyiikizixiiNi iiii i5i i i"iiHi<id ii iiih i ii ip iii:iLi1iii iii> iiq i?iZiMiIi iiB iK iDii#i i iYi>iiiii`iiiiiiiiiiiii iiiciiiiiiiTiiaii2iyi/ii"iU iiibii ii/ii ii i i{i iij ii ii5i*iiiiiaixiii iiFiiii7 iii i?iiwiiiiii+ii8 ii iNi iii,iinii i i ioisi_i?ii iii i iii?i0i i iiyi3ifi i=iiilii iivi]ii i iiizi iiyijiiui iipiijiii iiiziiir iiiiiiiiiFii'i i{ ini ixiui$iiiiMiiiik iipi i^ iqi i`i|ii ii i| i i i ii i iiii iGi ii-iiZi1iYii- i ieiii[iC iiiie i i.i-iiii iii i i7 ibil i iiii{ii.i i iizii i ii? iii9 ii iiii}ii iaii i iQi idi;iV ii/i^iD ii?im i i i9iIi iii iii i{i}i iiiiii&ii~iiXii i} i ii9i ii:ii"i\iii i_ ii8iWi~ i^i%iPisi iwii ii8 i iLiii. iii iiiNiiiPiiSiiii:iRi'i0ibiii iiiiizii iiiiiKiii i iriiqi iiin iL iiiiiiiiiiXi@ iigiiiii4ii: iiiiri iiQi ii i;i'i i>iibimiiwiiiis iiiiA iit i9 iiiii io i^iii2iiciiii i iriii i!iitii1i{i iiiiiisiiiii iixiiviaip iii iiLiOiiiUi i.iii)i. iiEi i"iiyii iiiii(i iiiq iE i6i i i2iui6i iiii. iii iiiViiisi iiiGiGijitiiWii iii`iiiiui ii ii{iQii iOiCi ii iiJi i i i$iiii/ iii_iiiij iRii7iii/ ii3iDiu i6iXi4iii iiii>iiii0 i`i` i iiiiUii i irii i)ii5iiHii iii~ir ii iiiii iii]iiiiiii i@ iii iaiiviiii/i!i6iiii7iwi i i3ici8ixii iiB iiiM iiiF iigiiii(ii i: iiiHii if iii"i i~iii i iyii i ii i!iNi i4iA iidieiiiziiii iiii0 ii iiiiiii{iii i iifi(iliiGi iii^iB imiF i|iiUiii2iRiii#ii iiiFii iUiiii1i icikiiN iSi iii iii$iO ii iYiiii iiGi iiiW i iC i?i iii~iiiUiFiiiiiiii iC i iiiiei iiiii/ iQi_iv i; i i iPi)iiGimi iiiG i,iIizi_i ii i9inii iAi i iX ii#iVi)i< i%ii}iiiHiw i5iipi.iiiimiiii i#ihi|ibii ii@i(i^izi iiAi i i i"i ig ii|iiiiii6iiXiii,iii iii$i#iIik iiiii:i iiQi ioih iVi$i iitiiiiY i,iii i iD ii i~i i iii%iii iiii ii i i7i/i iiii iEiVii iE iuii&iiii i iioiiiZiiiii i iiiii!iini8ii'iiiiiiii iiGi iRi2iii:ii,iiiZ ilii(iXiP i?ii i ioiiiii iiWi*iii;i8ii&i)ii i ioiiiiiHi_iii0iix ii0 ii; ii iiiXii iii1iiZi*i%i iii|idi`iiiSiji}i\iiiiG i ii ifiqi%iBii1 ipii"iiiii i|iiii iil i2 ii i iii@ihii;iiii ii iii&iiii}ii%i iii i?ii iia iy ii iii ii= i1 ii<ii{i#iiiii iAii iitiii ii> i iKi3 iii=iii\i i i'iAi+igiib iKiiiii ii ii4 ii*iim i ii ioiNii0i(ii ii$i4i i{i iiiQ iiiUiiii,i`ii iii ij i)i ii-i6ii iF i2i)ii i*i iY(tJIS_TYPICAL_DISTRIBUTION_RATIOtJIS_TABLE_SIZEtJIS_CHAR_TO_FREQ_ORDER(((s?/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jisfreq.pyt,s$site-packages/pip/_vendor/chardet/jpcntx.py000064400000046273147204247350015026 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # This is hiragana 2-char sequence table, the number in each cell represents its frequency category jp2CharContext = ( (0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,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0,0,0,0,0,0,0,0,0,0,1,3,1,0,0,0,0,0,1,0,0,2,1,0,0,0,0,0,0,0,0,2), (0,4,0,4,0,4,0,3,0,4,4,3,4,2,4,3,2,0,4,4,4,3,5,3,5,3,3,2,4,2,4,3,4,3,1,4,0,2,3,4,4,4,3,3,3,4,4,4,3,4,1,3,4,3,2,1,2,1,3,3,3,4,4,3,3,5,0,4,0,3,0,4,3,3,3,2,1,0,3,0,0,3,3), (0,4,0,3,0,3,0,3,0,3,5,5,3,3,3,3,4,3,4,3,3,3,4,4,4,3,3,3,3,4,3,5,3,3,1,3,2,4,5,5,5,5,4,3,4,5,5,3,2,2,3,3,3,3,2,3,3,1,2,3,2,4,3,3,3,4,0,4,0,2,0,4,3,2,2,1,2,0,3,0,0,4,1), ) class JapaneseContextAnalysis(object): NUM_OF_CATEGORY = 6 DONT_KNOW = -1 ENOUGH_REL_THRESHOLD = 100 MAX_REL_THRESHOLD = 1000 MINIMUM_DATA_THRESHOLD = 4 def __init__(self): self._total_rel = None self._rel_sample = None self._need_to_skip_char_num = None self._last_char_order = None self._done = None self.reset() def reset(self): self._total_rel = 0 # total sequence received # category counters, each integer counts sequence in its category self._rel_sample = [0] * self.NUM_OF_CATEGORY # if last byte in current buffer is not the last byte of a character, # we need to know how many bytes to skip in next buffer self._need_to_skip_char_num = 0 self._last_char_order = -1 # The order of previous char # If this flag is set to True, detection is done and conclusion has # been made self._done = False def feed(self, byte_str, num_bytes): if self._done: return # The buffer we got is byte oriented, and a character may span in more than one # buffers. In case the last one or two byte in last buffer is not # complete, we record how many byte needed to complete that character # and skip these bytes here. We can choose to record those bytes as # well and analyse the character once it is complete, but since a # character will not make much difference, by simply skipping # this character will simply our logic and improve performance. i = self._need_to_skip_char_num while i < num_bytes: order, char_len = self.get_order(byte_str[i:i + 2]) i += char_len if i > num_bytes: self._need_to_skip_char_num = i - num_bytes self._last_char_order = -1 else: if (order != -1) and (self._last_char_order != -1): self._total_rel += 1 if self._total_rel > self.MAX_REL_THRESHOLD: self._done = True break self._rel_sample[jp2CharContext[self._last_char_order][order]] += 1 self._last_char_order = order def got_enough_data(self): return self._total_rel > self.ENOUGH_REL_THRESHOLD def get_confidence(self): # This is just one way to calculate confidence. It works well for me. if self._total_rel > self.MINIMUM_DATA_THRESHOLD: return (self._total_rel - self._rel_sample[0]) / self._total_rel else: return self.DONT_KNOW def get_order(self, byte_str): return -1, 1 class SJISContextAnalysis(JapaneseContextAnalysis): def __init__(self): super(SJISContextAnalysis, self).__init__() self._charset_name = "SHIFT_JIS" @property def charset_name(self): return self._charset_name def get_order(self, byte_str): if not byte_str: return -1, 1 # find out current char's byte length first_char = byte_str[0] if (0x81 <= first_char <= 0x9F) or (0xE0 <= first_char <= 0xFC): char_len = 2 if (first_char == 0x87) or (0xFA <= first_char <= 0xFC): self._charset_name = "CP932" else: char_len = 1 # return its order if it is hiragana if len(byte_str) > 1: second_char = byte_str[1] if (first_char == 202) and (0x9F <= second_char <= 0xF1): return second_char - 0x9F, char_len return -1, char_len class EUCJPContextAnalysis(JapaneseContextAnalysis): def get_order(self, byte_str): if not byte_str: return -1, 1 # find out current char's byte length first_char = byte_str[0] if (first_char == 0x8E) or (0xA1 <= first_char <= 0xFE): char_len = 2 elif first_char == 0x8F: char_len = 3 else: char_len = 1 # return its order if it is hiragana if len(byte_str) > 1: second_char = byte_str[1] if (first_char == 0xA4) and (0xA1 <= second_char <= 0xF3): return second_char - 0xA1, char_len return -1, char_len site-packages/pip/_vendor/chardet/jpcntx.pyo000064400000061362147204247350015201 0ustar00 abc@sRdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfSfSZdefdYZdefd YZd efd YZd S( iiiiiitJapaneseContextAnalysiscBs\eZdZdZdZdZdZdZdZdZ dZ d Z d Z RS( iiidiicCs;d|_d|_d|_d|_d|_|jdS(N(tNonet _total_relt _rel_samplet_need_to_skip_char_numt_last_char_ordert_donetreset(tself((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyt__init__{s      cCs;d|_dg|j|_d|_d|_t|_dS(Nii(RtNUM_OF_CATEGORYRRRtFalseR(R((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyRs    cCs|jr dS|j}x||kr|j|||d!\}}||7}||krt|||_d|_q|dkr|jdkr|jd7_|j|jkrt|_Pn|jt|j|cd7/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pytfeeds         !cCs|j|jkS(N(RtENOUGH_REL_THRESHOLD(R((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pytgot_enough_datascCs6|j|jkr+|j|jd|jS|jSdS(Ni(RtMINIMUM_DATA_THRESHOLDRt DONT_KNOW(R((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pytget_confidencescCsdS(Nii(ii((RR((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyR s( t__name__t __module__R RRR RR RRRRR (((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyRts    tSJISContextAnalysiscBs)eZdZedZdZRS(cCs tt|jd|_dS(Nt SHIFT_JIS(tsuperRR t _charset_name(R((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyR scCs|jS(N(R (R((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyt charset_namescCs|s dS|d}d|ko+dknsLd|koGdknrd}|d kszd |koudknrd |_qnd}t|dkr|d}|d krd|kod knr|d|fSnd|fS(NiiiiiiiiiitCP932ii(ii(R tlen(RRt first_charRt second_char((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyR s 8( ((RRR tpropertyR!R (((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyRs tEUCJPContextAnalysiscBseZdZRS(cCs|s d S|d}|dks<d|ko7dknrEd}n|dkrZd }nd}t|dkr|d}|d krd|kod knr|d|fSnd|fS( Niiiiiiiiiii(ii(R#(RRR$RR%((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyR s (    ((RRR (((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pyR'sN(RtobjectRRR'(((s>/usr/lib/python2.7/site-packages/pip/_vendor/chardet/jpcntx.pytsCsite-packages/pip/_vendor/chardet/langbulgarianmodel.py000064400000031047147204247350017340 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # 255: Control characters that usually does not exist in any text # 254: Carriage/Return # 253: symbol (punctuation) that does not belong to word # 252: 0 - 9 # Character Mapping Table: # this table is modified base on win1251BulgarianCharToOrderMap, so # only number <64 is sure valid Latin5_BulgarianCharToOrderMap = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 77, 90, 99,100, 72,109,107,101, 79,185, 81,102, 76, 94, 82, # 40 110,186,108, 91, 74,119, 84, 96,111,187,115,253,253,253,253,253, # 50 253, 65, 69, 70, 66, 63, 68,112,103, 92,194,104, 95, 86, 87, 71, # 60 116,195, 85, 93, 97,113,196,197,198,199,200,253,253,253,253,253, # 70 194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209, # 80 210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225, # 90 81,226,227,228,229,230,105,231,232,233,234,235,236, 45,237,238, # a0 31, 32, 35, 43, 37, 44, 55, 47, 40, 59, 33, 46, 38, 36, 41, 30, # b0 39, 28, 34, 51, 48, 49, 53, 50, 54, 57, 61,239, 67,240, 60, 56, # c0 1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, # d0 7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,241, 42, 16, # e0 62,242,243,244, 58,245, 98,246,247,248,249,250,251, 91,252,253, # f0 ) win1251BulgarianCharToOrderMap = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 77, 90, 99,100, 72,109,107,101, 79,185, 81,102, 76, 94, 82, # 40 110,186,108, 91, 74,119, 84, 96,111,187,115,253,253,253,253,253, # 50 253, 65, 69, 70, 66, 63, 68,112,103, 92,194,104, 95, 86, 87, 71, # 60 116,195, 85, 93, 97,113,196,197,198,199,200,253,253,253,253,253, # 70 206,207,208,209,210,211,212,213,120,214,215,216,217,218,219,220, # 80 221, 78, 64, 83,121, 98,117,105,222,223,224,225,226,227,228,229, # 90 88,230,231,232,233,122, 89,106,234,235,236,237,238, 45,239,240, # a0 73, 80,118,114,241,242,243,244,245, 62, 58,246,247,248,249,250, # b0 31, 32, 35, 43, 37, 44, 55, 47, 40, 59, 33, 46, 38, 36, 41, 30, # c0 39, 28, 34, 51, 48, 49, 53, 50, 54, 57, 61,251, 67,252, 60, 56, # d0 1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, # e0 7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,253, 42, 16, # f0 ) # Model Table: # total sequences: 100% # first 512 sequences: 96.9392% # first 1024 sequences:3.0618% # rest sequences: 0.2992% # negative sequences: 0.0020% BulgarianLangModel = ( 0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,3,3,3,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,2,2,3,2,2,1,2,2, 3,1,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,0,3,0,1, 0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,3,0,3,1,0, 0,1,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,0,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 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0, 0,1,1,0,1,1,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,2,0,0,2,0,1,0,0,1,0,0,1, 1,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0, 1,1,1,1,1,1,1,2,0,0,0,0,0,0,2,1,0,1,1,0,0,1,1,1,0,1,0,0,0,0,0,0, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,1,1,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, ) Latin5BulgarianModel = { 'char_to_order_map': Latin5_BulgarianCharToOrderMap, 'precedence_matrix': BulgarianLangModel, 'typical_positive_ratio': 0.969392, 'keep_english_letter': False, 'charset_name': "ISO-8859-5", 'language': 'Bulgairan', } Win1251BulgarianModel = { 'char_to_order_map': win1251BulgarianCharToOrderMap, 'precedence_matrix': BulgarianLangModel, 'typical_positive_ratio': 0.969392, 'keep_english_letter': False, 'charset_name': "windows-1251", 'language': 'Bulgarian', } site-packages/pip/_vendor/chardet/langbulgarianmodel.pyo000064400000060604147204247350017520 0ustar00 abc@svdZdZdZied6ed6dd6ed6dd6dd6Zied6ed6dd6ed6dd6dd6ZdS(iiiiiMiZicidiHimikieiOiiQifiLi^iRiniili[iJiwiTi`ioiisiAiEiFiBi?iDipigi\iihi_iViWiGitiiUi]iaiqiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii-iiii i#i+i%i,i7i/i(i;i!i.i&i$i)ii'ii"i3i0i1i5i2i6i9i=iiCii<i8iii ii iiiiii i iiii iiiiiiiiiiiiKi4ii*ii>iiii:iibiiiiiiixiNi@iSiyiuiXiziYijiIiPiviritchar_to_order_maptprecedence_matrixg! _B?ttypical_positive_ratiotkeep_english_letters ISO-8859-5t charset_namet Bulgairantlanguages windows-1251t BulgarianN(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiMiZicidiHimikieiOiiQifiLi^iRiniili[iJiwiTi`ioiisiiiiiiiAiEiFiBi?iDipigi\iihi_iViWiGitiiUi]iaiqiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiQiiiiiiiiiiiiii-iiii i#i+i%i,i7i/i(i;i!i.i&i$i)ii'ii"i3i0i1i5i2i6i9i=iiCii<i8iii ii iiiiii i iiii iiiiiiiiiiiiKi4ii*ii>iiii:iibiiiiiii[ii(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiMiZicidiHimikieiOiiQifiLi^iRiniili[iJiwiTi`ioiisiiiiiiiAiEiFiBi?iDipigi\iihi_iViWiGitiiUi]iaiqiiiiiiiiiiiiiiiiiiixiiiiiiiiiNi@iSiyibiuiiiiiiiiiiiXiiiiiziYijiiiiii-iiiIiPiviriiiiii>i:iiiiiii i#i+i%i,i7i/i(i;i!i.i&i$i)ii'ii"i3i0i1i5i2i6i9i=iiCii<i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iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(tLatin5_BulgarianCharToOrderMaptwin1251BulgarianCharToOrderMaptBulgarianLangModeltFalsetLatin5BulgarianModeltWin1251BulgarianModel(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/langbulgarianmodel.pyt&sZ  site-packages/pip/_vendor/chardet/langcyrillicmodel.py000064400000043034147204247350017205 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # KOI8-R language model # Character Mapping Table: KOI8R_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, # 80 207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, # 90 223,224,225, 68,226,227,228,229,230,231,232,233,234,235,236,237, # a0 238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253, # b0 27, 3, 21, 28, 13, 2, 39, 19, 26, 4, 23, 11, 8, 12, 5, 1, # c0 15, 16, 9, 7, 6, 14, 24, 10, 17, 18, 20, 25, 30, 29, 22, 54, # d0 59, 37, 44, 58, 41, 48, 53, 46, 55, 42, 60, 36, 49, 38, 31, 34, # e0 35, 43, 45, 32, 40, 52, 56, 33, 61, 62, 51, 57, 47, 63, 50, 70, # f0 ) win1251_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, 207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, 223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, 239,240,241,242,243,244,245,246, 68,247,248,249,250,251,252,253, 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, ) latin5_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, 207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, 223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, 239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255, ) macCyrillic_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, 207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, 223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, 239,240,241,242,243,244,245,246,247,248,249,250,251,252, 68, 16, 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27,255, ) IBM855_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 191,192,193,194, 68,195,196,197,198,199,200,201,202,203,204,205, 206,207,208,209,210,211,212,213,214,215,216,217, 27, 59, 54, 70, 3, 37, 21, 44, 28, 58, 13, 41, 2, 48, 39, 53, 19, 46,218,219, 220,221,222,223,224, 26, 55, 4, 42,225,226,227,228, 23, 60,229, 230,231,232,233,234,235, 11, 36,236,237,238,239,240,241,242,243, 8, 49, 12, 38, 5, 31, 1, 34, 15,244,245,246,247, 35, 16,248, 43, 9, 45, 7, 32, 6, 40, 14, 52, 24, 56, 10, 33, 17, 61,249, 250, 18, 62, 20, 51, 25, 57, 30, 47, 29, 63, 22, 50,251,252,255, ) IBM866_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, 207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, 223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, 239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255, ) # Model Table: # total sequences: 100% # first 512 sequences: 97.6601% # first 1024 sequences: 2.3389% # rest sequences: 0.1237% # negative sequences: 0.0009% RussianLangModel = ( 0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,1,3,3,3,2,3,2,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,2,2,2,2,0,0,2, 3,3,3,2,3,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,3,2,3,2,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,2,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,2,3,3,1,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,3,3,3,3,3,3,3,3,3,3,2,1, 0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,1,2,1,0,1,1,1,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1, 0,0,0,0,0,1,0,0,1,1,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1, 2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,1,1,0,1,0,1,0,0,1,1,1,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,1,0,1,1,0,1,0,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,0, 0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, ) Koi8rModel = { 'char_to_order_map': KOI8R_char_to_order_map, 'precedence_matrix': RussianLangModel, 'typical_positive_ratio': 0.976601, 'keep_english_letter': False, 'charset_name': "KOI8-R", 'language': 'Russian', } Win1251CyrillicModel = { 'char_to_order_map': win1251_char_to_order_map, 'precedence_matrix': RussianLangModel, 'typical_positive_ratio': 0.976601, 'keep_english_letter': False, 'charset_name': "windows-1251", 'language': 'Russian', } Latin5CyrillicModel = { 'char_to_order_map': latin5_char_to_order_map, 'precedence_matrix': RussianLangModel, 'typical_positive_ratio': 0.976601, 'keep_english_letter': False, 'charset_name': "ISO-8859-5", 'language': 'Russian', } MacCyrillicModel = { 'char_to_order_map': macCyrillic_char_to_order_map, 'precedence_matrix': RussianLangModel, 'typical_positive_ratio': 0.976601, 'keep_english_letter': False, 'charset_name': "MacCyrillic", 'language': 'Russian', } Ibm866Model = { 'char_to_order_map': IBM866_char_to_order_map, 'precedence_matrix': RussianLangModel, 'typical_positive_ratio': 0.976601, 'keep_english_letter': False, 'charset_name': "IBM866", 'language': 'Russian', } Ibm855Model = { 'char_to_order_map': IBM855_char_to_order_map, 'precedence_matrix': RussianLangModel, 'typical_positive_ratio': 0.976601, 'keep_english_letter': False, 'charset_name': "IBM855", 'language': 'Russian', } site-packages/pip/_vendor/chardet/langcyrillicmodel.pyo000064400000073734147204247350017376 0ustar00 abc@sNdZdZdZdZdZdZdZied6ed6dd6ed6dd6dd6Zied6ed6dd6ed6dd6dd6Z ied6ed6dd6ed6dd6dd6Z ied6ed6dd6ed6dd6dd6Z ied6ed6dd6ed6dd6dd6Z ied6ed6dd6ed6dd6dd6Z dS(iiiiiiiiiiiiiiiiJiiKiiiiiiiiiiiiiGiiBiiAiiLii@iiiMiHiiEiCiiNiIiiiOiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiDiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii ii'iiiii ii iiiii iiiii iiiiiiii6i;i%i,i:i)i0i5i.i7i*i<i$i1i&ii"i#i+i-i i(i4i8i!i=i>i3i9i/i?i2iFitchar_to_order_maptprecedence_matrixglP@?ttypical_positive_ratiotkeep_english_lettersKOI8-Rt charset_nametRussiantlanguages windows-1251s ISO-8859-5t MacCyrillictIBM866tIBM855N(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiJiiKiiiiiiiiiiiiiiiiiiiGiiBiiAiiLii@iiiMiHiiEiCiiNiIiiiOiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiDiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii ii'iiiii ii iiiii iiiii iiiiiiii6i;i%i,i:i)i0i5i.i7i*i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iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(tKOI8R_char_to_order_maptwin1251_char_to_order_maptlatin5_char_to_order_maptmacCyrillic_char_to_order_maptIBM855_char_to_order_maptIBM866_char_to_order_maptRussianLangModeltFalset Koi8rModeltWin1251CyrillicModeltLatin5CyrillicModeltMacCyrillicModelt Ibm866Modelt Ibm855Model(((sI/usr/lib/python2.7/site-packages/pip/_vendor/chardet/langcyrillicmodel.pyts      site-packages/pip/_vendor/chardet/langgreekmodel.py000064400000030620147204247350016465 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # 255: Control characters that usually does not exist in any text # 254: Carriage/Return # 253: symbol (punctuation) that does not belong to word # 252: 0 - 9 # Character Mapping Table: Latin7_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 82,100,104, 94, 98,101,116,102,111,187,117, 92, 88,113, 85, # 40 79,118,105, 83, 67,114,119, 95, 99,109,188,253,253,253,253,253, # 50 253, 72, 70, 80, 81, 60, 96, 93, 89, 68,120, 97, 77, 86, 69, 55, # 60 78,115, 65, 66, 58, 76,106,103, 87,107,112,253,253,253,253,253, # 70 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 80 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 90 253,233, 90,253,253,253,253,253,253,253,253,253,253, 74,253,253, # a0 253,253,253,253,247,248, 61, 36, 46, 71, 73,253, 54,253,108,123, # b0 110, 31, 51, 43, 41, 34, 91, 40, 52, 47, 44, 53, 38, 49, 59, 39, # c0 35, 48,250, 37, 33, 45, 56, 50, 84, 57,120,121, 17, 18, 22, 15, # d0 124, 1, 29, 20, 21, 3, 32, 13, 25, 5, 11, 16, 10, 6, 30, 4, # e0 9, 8, 14, 7, 2, 12, 28, 23, 42, 24, 64, 75, 19, 26, 27,253, # f0 ) win1253_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 82,100,104, 94, 98,101,116,102,111,187,117, 92, 88,113, 85, # 40 79,118,105, 83, 67,114,119, 95, 99,109,188,253,253,253,253,253, # 50 253, 72, 70, 80, 81, 60, 96, 93, 89, 68,120, 97, 77, 86, 69, 55, # 60 78,115, 65, 66, 58, 76,106,103, 87,107,112,253,253,253,253,253, # 70 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 80 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 90 253,233, 61,253,253,253,253,253,253,253,253,253,253, 74,253,253, # a0 253,253,253,253,247,253,253, 36, 46, 71, 73,253, 54,253,108,123, # b0 110, 31, 51, 43, 41, 34, 91, 40, 52, 47, 44, 53, 38, 49, 59, 39, # c0 35, 48,250, 37, 33, 45, 56, 50, 84, 57,120,121, 17, 18, 22, 15, # d0 124, 1, 29, 20, 21, 3, 32, 13, 25, 5, 11, 16, 10, 6, 30, 4, # e0 9, 8, 14, 7, 2, 12, 28, 23, 42, 24, 64, 75, 19, 26, 27,253, # f0 ) # Model Table: # total sequences: 100% # first 512 sequences: 98.2851% # first 1024 sequences:1.7001% # rest sequences: 0.0359% # negative sequences: 0.0148% GreekLangModel = ( 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,3,2,2,3,3,3,3,3,3,3,3,1,3,3,3,0,2,2,3,3,0,3,0,3,2,0,3,3,3,0, 3,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,3,3,3,3,0,3,3,0,3,2,3,3,0,3,2,3,3,3,0,0,3,0,3,0,3,3,2,0,0,0, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 0,2,3,2,2,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0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,2,0,0,0, 0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,2,0,2,0,0,0, 0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,2,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ) Latin7GreekModel = { 'char_to_order_map': Latin7_char_to_order_map, 'precedence_matrix': GreekLangModel, 'typical_positive_ratio': 0.982851, 'keep_english_letter': False, 'charset_name': "ISO-8859-7", 'language': 'Greek', } Win1253GreekModel = { 'char_to_order_map': win1253_char_to_order_map, 'precedence_matrix': GreekLangModel, 'typical_positive_ratio': 0.982851, 'keep_english_letter': False, 'charset_name': "windows-1253", 'language': 'Greek', } site-packages/pip/_vendor/chardet/langgreekmodel.pyc000064400000060077147204247350016641 0ustar00 abc@svdZdZdZied6ed6dd6ed6dd6dd6Zied6ed6dd6ed6dd6dd6ZdS(iiiiiRidihi^ibieitifioiiui\iXiqiUiOiviiiSiCiriwi_icimiiHiFiPiQi<i`i]iYiDixiaiMiViEi7iNisiAiBi:iLijigiWikipiiZiJiii=i$i.iGiIi6ili{inii3i+i)i"i[i(i4i/i,i5i&i1i;i'i#i0ii%i!i-i8i2iTi9iyiiiii|iiiiii i iii ii iiii iiiii iii*ii@iKiiiitchar_to_order_maptprecedence_matrixgs?ttypical_positive_ratiotkeep_english_letters ISO-8859-7t charset_nametGreektlanguages windows-1253N(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiRidihi^ibieitifioiiui\iXiqiUiOiviiiSiCiriwi_icimiiiiiiiiHiFiPiQi<i`i]iYiDixiaiMiViEi7iNisiAiBi:iLijigiWikipiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiZiiiiiiiiiiiJiiiiiiiii=i$i.iGiIii6iili{inii3i+i)i"i[i(i4i/i,i5i&i1i;i'i#i0ii%i!i-i8i2iTi9ixiyiiiii|iiiiii i iii ii iiii iiiii iii*ii@iKiiii(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiRidihi^ibieitifioiiui\iXiqiUiOiviiiSiCiriwi_icimiiiiiiiiHiFiPiQi<i`i]iYiDixiaiMiViEi7iNisiAiBi:iLijigiWikipiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii=iiiiiiiiiiiJiiiiiiiiii$i.iGiIii6iili{inii3i+i)i"i[i(i4i/i,i5i&i1i;i'i#i0ii%i!i-i8i2iTi9ixiyiiiii|iiiiii i iii ii iiii iiiii iii*ii@iKiiii(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii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/langgreekmodel.pyt#sZ  site-packages/pip/_vendor/chardet/langgreekmodel.pyo000064400000060077147204247350016655 0ustar00 abc@svdZdZdZied6ed6dd6ed6dd6dd6Zied6ed6dd6ed6dd6dd6ZdS(iiiiiRidihi^ibieitifioiiui\iXiqiUiOiviiiSiCiriwi_icimiiHiFiPiQi<i`i]iYiDixiaiMiViEi7iNisiAiBi:iLijigiWikipiiZiJiii=i$i.iGiIi6ili{inii3i+i)i"i[i(i4i/i,i5i&i1i;i'i#i0ii%i!i-i8i2iTi9iyiiiii|iiiiii i iii ii iiii iiiii iii*ii@iKiiiitchar_to_order_maptprecedence_matrixgs?ttypical_positive_ratiotkeep_english_letters ISO-8859-7t charset_nametGreektlanguages windows-1253N(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiRidihi^ibieitifioiiui\iXiqiUiOiviiiSiCiriwi_icimiiiiiiiiHiFiPiQi<i`i]iYiDixiaiMiViEi7iNisiAiBi:iLijigiWikipiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiZiiiiiiiiiiiJiiiiiiiii=i$i.iGiIii6iili{inii3i+i)i"i[i(i4i/i,i5i&i1i;i'i#i0ii%i!i-i8i2iTi9ixiyiiiii|iiiiii i iii ii iiii iiiii iii*ii@iKiiii(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiRidihi^ibieitifioiiui\iXiqiUiOiviiiSiCiriwi_icimiiiiiiiiHiFiPiQi<i`i]iYiDixiaiMiViEi7iNisiAiBi:iLijigiWikipiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii=iiiiiiiiiiiJiiiiiiiiii$i.iGiIii6iili{inii3i+i)i"i[i(i4i/i,i5i&i1i;i'i#i0ii%i!i-i8i2iTi9ixiyiiiii|iiiiii i iii ii iiii iiiii iii*ii@iKiiii(iiiiiiiiiiiiiiiiii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_char_to_order_maptGreekLangModeltFalsetLatin7GreekModeltWin1253GreekModel(((sF/usr/lib/python2.7/site-packages/pip/_vendor/chardet/langgreekmodel.pyt#sZ  site-packages/pip/_vendor/chardet/langhebrewmodel.py000064400000026121147204247350016645 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Simon Montagu # Portions created by the Initial Developer are Copyright (C) 2005 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # Shoshannah Forbes - original C code (?) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # 255: Control characters that usually does not exist in any text # 254: Carriage/Return # 253: symbol (punctuation) that does not belong to word # 252: 0 - 9 # Windows-1255 language model # Character Mapping Table: WIN1255_CHAR_TO_ORDER_MAP = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 69, 91, 79, 80, 92, 89, 97, 90, 68,111,112, 82, 73, 95, 85, # 40 78,121, 86, 71, 67,102,107, 84,114,103,115,253,253,253,253,253, # 50 253, 50, 74, 60, 61, 42, 76, 70, 64, 53,105, 93, 56, 65, 54, 49, # 60 66,110, 51, 43, 44, 63, 81, 77, 98, 75,108,253,253,253,253,253, # 70 124,202,203,204,205, 40, 58,206,207,208,209,210,211,212,213,214, 215, 83, 52, 47, 46, 72, 32, 94,216,113,217,109,218,219,220,221, 34,116,222,118,100,223,224,117,119,104,125,225,226, 87, 99,227, 106,122,123,228, 55,229,230,101,231,232,120,233, 48, 39, 57,234, 30, 59, 41, 88, 33, 37, 36, 31, 29, 35,235, 62, 28,236,126,237, 238, 38, 45,239,240,241,242,243,127,244,245,246,247,248,249,250, 9, 8, 20, 16, 3, 2, 24, 14, 22, 1, 25, 15, 4, 11, 6, 23, 12, 19, 13, 26, 18, 27, 21, 17, 7, 10, 5,251,252,128, 96,253, ) # Model Table: # total sequences: 100% # first 512 sequences: 98.4004% # first 1024 sequences: 1.5981% # rest sequences: 0.087% # negative sequences: 0.0015% HEBREW_LANG_MODEL = ( 0,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,3,2,1,2,0,1,0,0, 3,0,3,1,0,0,1,3,2,0,1,1,2,0,2,2,2,1,1,1,1,2,1,1,1,2,0,0,2,2,0,1, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2, 1,2,1,2,1,2,0,0,2,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2, 1,2,1,3,1,1,0,0,2,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,0,1,2,2,1,3, 1,2,1,1,2,2,0,0,2,2,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,2,2,2,3,2, 1,2,1,2,2,2,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,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,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,1,1,2,0,1,0,0,1,1,1,0,1,0,0,1,0,0,0,1,0,0,1, 1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,0,2,1,1,1,1,1,0,1,0,0,0,0,1,0,1, 0,1,1,1,2,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,1,1,0,0, ) Win1255HebrewModel = { 'char_to_order_map': WIN1255_CHAR_TO_ORDER_MAP, 'precedence_matrix': HEBREW_LANG_MODEL, 'typical_positive_ratio': 0.984004, 'keep_english_letter': False, 'charset_name': "windows-1255", 'language': 'Hebrew', } site-packages/pip/_vendor/chardet/langhebrewmodel.pyo000064400000055632147204247350017035 0ustar00 abc@s@dZdZied6ed6dd6ed6dd6dd6ZdS(iiiiiEi[iOiPi\iYiaiZiDioipiRiIi_iUiNiyiViGiCifikiTirigisi2iJi<i=i*iLiFi@i5iii]i8iAi6i1iBini3i+i,i?iQiMibiKili|iiiii(i:iiiiiiiiiiiSi4i/i.iHi i^iiqiimiiiii"itiividiiiuiwihi}iiiWiciijizi{ii7iiieiiixii0i'i9iii;i)iXi!i%i$iii#ii>iii~iii&i-iiiiiiiiiiiiii iiiiiiiiiiiii iii ii iiiiiii iiii`itchar_to_order_maptprecedence_matrixg C|?ttypical_positive_ratiotkeep_english_letters windows-1255t charset_nametHebrewtlangu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iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(tWIN1255_CHAR_TO_ORDER_MAPtHEBREW_LANG_MODELtFalsetWin1255HebrewModel(((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/langhebrewmodel.pyt&s, site-packages/pip/_vendor/chardet/langhungarianmodel.py000064400000030460147204247350017346 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # 255: Control characters that usually does not exist in any text # 254: Carriage/Return # 253: symbol (punctuation) that does not belong to word # 252: 0 - 9 # Character Mapping Table: Latin2_HungarianCharToOrderMap = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 28, 40, 54, 45, 32, 50, 49, 38, 39, 53, 36, 41, 34, 35, 47, 46, 71, 43, 33, 37, 57, 48, 64, 68, 55, 52,253,253,253,253,253, 253, 2, 18, 26, 17, 1, 27, 12, 20, 9, 22, 7, 6, 13, 4, 8, 23, 67, 10, 5, 3, 21, 19, 65, 62, 16, 11,253,253,253,253,253, 159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174, 175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190, 191,192,193,194,195,196,197, 75,198,199,200,201,202,203,204,205, 79,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220, 221, 51, 81,222, 78,223,224,225,226, 44,227,228,229, 61,230,231, 232,233,234, 58,235, 66, 59,236,237,238, 60, 69, 63,239,240,241, 82, 14, 74,242, 70, 80,243, 72,244, 15, 83, 77, 84, 30, 76, 85, 245,246,247, 25, 73, 42, 24,248,249,250, 31, 56, 29,251,252,253, ) win1250HungarianCharToOrderMap = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 28, 40, 54, 45, 32, 50, 49, 38, 39, 53, 36, 41, 34, 35, 47, 46, 72, 43, 33, 37, 57, 48, 64, 68, 55, 52,253,253,253,253,253, 253, 2, 18, 26, 17, 1, 27, 12, 20, 9, 22, 7, 6, 13, 4, 8, 23, 67, 10, 5, 3, 21, 19, 65, 62, 16, 11,253,253,253,253,253, 161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176, 177,178,179,180, 78,181, 69,182,183,184,185,186,187,188,189,190, 191,192,193,194,195,196,197, 76,198,199,200,201,202,203,204,205, 81,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220, 221, 51, 83,222, 80,223,224,225,226, 44,227,228,229, 61,230,231, 232,233,234, 58,235, 66, 59,236,237,238, 60, 70, 63,239,240,241, 84, 14, 75,242, 71, 82,243, 73,244, 15, 85, 79, 86, 30, 77, 87, 245,246,247, 25, 74, 42, 24,248,249,250, 31, 56, 29,251,252,253, ) # Model Table: # total sequences: 100% # first 512 sequences: 94.7368% # first 1024 sequences:5.2623% # rest sequences: 0.8894% # negative sequences: 0.0009% HungarianLangModel = ( 0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,2,3,3,1,1,2,2,2,2,2,1,2, 3,2,2,3,3,3,3,3,2,3,3,3,3,3,3,1,2,3,3,3,3,2,3,3,1,1,3,3,0,1,1,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0, 3,2,1,3,3,3,3,3,2,3,3,3,3,3,1,1,2,3,3,3,3,3,3,3,1,1,3,2,0,1,1,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,1,1,2,3,3,3,1,3,3,3,3,3,1,3,3,2,2,0,3,2,3, 0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,3,3,3,2,3,3,2,3,3,3,3,3,2,3,3,2,2,3,2,3,2,0,3,2,2, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0, 3,3,3,3,3,3,2,3,3,3,3,3,2,3,3,3,1,2,3,2,2,3,1,2,3,3,2,2,0,3,3,3, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,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 0,0,0,1,0,0,0,0,0,0,1,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,1,1,0,1,0,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0, 2,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,0,0,1,0,0,1,0,1,0,1,1,1,0,0,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,1,1,1,1,1,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0, ) Latin2HungarianModel = { 'char_to_order_map': Latin2_HungarianCharToOrderMap, 'precedence_matrix': HungarianLangModel, 'typical_positive_ratio': 0.947368, 'keep_english_letter': True, 'charset_name': "ISO-8859-2", 'language': 'Hungarian', } Win1250HungarianModel = { 'char_to_order_map': win1250HungarianCharToOrderMap, 'precedence_matrix': HungarianLangModel, 'typical_positive_ratio': 0.947368, 'keep_english_letter': True, 'charset_name': "windows-1250", 'language': 'Hungarian', } site-packages/pip/_vendor/chardet/langhungarianmodel.pyo000064400000060546147204247350017535 0ustar00 abc@svdZdZdZied6ed6dd6ed6dd6dd6Zied6ed6dd6ed6dd6dd6ZdS(iiiiii(i6i-i i2i1i&i'i5i$i)i"i#i/i.iGi+i!i%i9i0i@iDi7i4iiiiiii ii iiii iiiiCi iiiiiAi>ii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiKiiiiiiiiiOiiiiiiiiiiiiiiiii3iQiiNiiiii,iiii=iiiiii:iiBi;iiii<iEi?iiiiRiiJiiFiPiiHiiiSiMiTiiLiUiiiiiIi*iiiiii8iiiViWitchar_to_order_maptprecedence_matrixg(P?ttypical_positive_ratiotkeep_english_letters ISO-8859-2t charset_namet Hungariantlanguages windows-1250N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iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(tLatin2_HungarianCharToOrderMaptwin1250HungarianCharToOrderMaptHungarianLangModeltTruetLatin2HungarianModeltWin1250HungarianModel(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/chardet/langhungarianmodel.pyt#sZ  site-packages/pip/_vendor/chardet/langthaimodel.py000064400000026032147204247350016317 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # 255: Control characters that usually does not exist in any text # 254: Carriage/Return # 253: symbol (punctuation) that does not belong to word # 252: 0 - 9 # The following result for thai was collected from a limited sample (1M). # Character Mapping Table: TIS620CharToOrderMap = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253,182,106,107,100,183,184,185,101, 94,186,187,108,109,110,111, # 40 188,189,190, 89, 95,112,113,191,192,193,194,253,253,253,253,253, # 50 253, 64, 72, 73,114, 74,115,116,102, 81,201,117, 90,103, 78, 82, # 60 96,202, 91, 79, 84,104,105, 97, 98, 92,203,253,253,253,253,253, # 70 209,210,211,212,213, 88,214,215,216,217,218,219,220,118,221,222, 223,224, 99, 85, 83,225,226,227,228,229,230,231,232,233,234,235, 236, 5, 30,237, 24,238, 75, 8, 26, 52, 34, 51,119, 47, 58, 57, 49, 53, 55, 43, 20, 19, 44, 14, 48, 3, 17, 25, 39, 62, 31, 54, 45, 9, 16, 2, 61, 15,239, 12, 42, 46, 18, 21, 76, 4, 66, 63, 22, 10, 1, 36, 23, 13, 40, 27, 32, 35, 86,240,241,242,243,244, 11, 28, 41, 29, 33,245, 50, 37, 6, 7, 67, 77, 38, 93,246,247, 68, 56, 59, 65, 69, 60, 70, 80, 71, 87,248,249,250,251,252,253, ) # Model Table: # total sequences: 100% # first 512 sequences: 92.6386% # first 1024 sequences:7.3177% # rest sequences: 1.0230% # negative sequences: 0.0436% ThaiLangModel = ( 0,1,3,3,3,3,0,0,3,3,0,3,3,0,3,3,3,3,3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,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ) TIS620ThaiModel = { 'char_to_order_map': TIS620CharToOrderMap, 'precedence_matrix': ThaiLangModel, 'typical_positive_ratio': 0.926386, 'keep_english_letter': False, 'charset_name': "TIS-620", 'language': 'Thai', } site-packages/pip/_vendor/chardet/langthaimodel.pyo000064400000055605147204247350016506 0ustar00 abc@s@dZdZied6ed6dd6ed6dd6dd6ZdS(iiiiiijikidiiiiei^iiiliminioiiiiYi_ipiqiiiii@iHiIiriJisitifiQiiuiZigiNiRi`ii[iOiTihiiiaibi\iiiiiiiXiiiiiiiiviiiiiciUiSiiiiiiiiiiiiiiiiiiKiii4i"i3iwi/i:i9i1i5i7i+iii,ii0iiii'i>ii6i-i iii=iii i*i.iiiLiiBi?ii ii$ii i(ii i#iViiiiii ii)ii!ii2i%iiiCiMi&i]iiiDi8i;iAiEi<iFiPiGiWiiiiitchar_to_order_maptprecedence_matrixg@?ttypical_positive_ratiotkeep_english_lettersTIS-620t charset_nametThaitlanguageN(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijikidiiiiei^iiiliminioiiiiYi_ipiqiiiiiiiiiii@iHiIiriJisitifiQiiuiZigiNiRi`ii[iOiTihiiiaibi\iiiiiiiiiiiiXiiiiiiiiviiiiiciUiSiiiiiiiiiiiiiiiiiiKiii4i"i3iwi/i:i9i1i5i7i+iii,ii0iiii'i>ii6i-i iii=iii i*i.iiiLiiBi?ii ii$ii i(ii i#iViiiiii ii)ii!ii2i%iiiCiMi&i]iiiDi8i;iAiEi<iFiPiGiWiiiiii(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii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iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(tTIS620CharToOrderMapt ThaiLangModeltFalsetTIS620ThaiModel(((sE/usr/lib/python2.7/site-packages/pip/_vendor/chardet/langthaimodel.pyt%s, site-packages/pip/_vendor/chardet/langturkishmodel.py000064400000025536147204247350017073 0ustar00# -*- coding: utf-8 -*- ######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Özgür Baskın - Turkish Language Model # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # 255: Control characters that usually does not exist in any text # 254: Carriage/Return # 253: symbol (punctuation) that does not belong to word # 252: 0 - 9 # Character Mapping Table: Latin5_TurkishCharToOrderMap = ( 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255, 23, 37, 47, 39, 29, 52, 36, 45, 53, 60, 16, 49, 20, 46, 42, 48, 69, 44, 35, 31, 51, 38, 62, 65, 43, 56,255,255,255,255,255, 255, 1, 21, 28, 12, 2, 18, 27, 25, 3, 24, 10, 5, 13, 4, 15, 26, 64, 7, 8, 9, 14, 32, 57, 58, 11, 22,255,255,255,255,255, 180,179,178,177,176,175,174,173,172,171,170,169,168,167,166,165, 164,163,162,161,160,159,101,158,157,156,155,154,153,152,151,106, 150,149,148,147,146,145,144,100,143,142,141,140,139,138,137,136, 94, 80, 93,135,105,134,133, 63,132,131,130,129,128,127,126,125, 124,104, 73, 99, 79, 85,123, 54,122, 98, 92,121,120, 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0,1,0,0,0,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ) Latin5TurkishModel = { 'char_to_order_map': Latin5_TurkishCharToOrderMap, 'precedence_matrix': TurkishLangModel, 'typical_positive_ratio': 0.970290, 'keep_english_letter': True, 'charset_name': "ISO-8859-9", 'language': 'Turkish', } site-packages/pip/_vendor/chardet/langturkishmodel.pyo000064400000055626147204247350017255 0ustar00 abc@s@dZdZied6ed6dd6ed6dd6dd6ZdS(iii%i/i'ii4i$i-i5i<ii1ii.i*i0iEi,i#ii3i&i>iAi+i8iiii iiiiiii ii iiii@iii ii i9i:i iiiiiiiiiiiiiiiiiiiiiiiieiiiiiiiiijiiiiiiiidiiiiiiiii^iPi]iiiiii?iiiiiii~i}i|ihiIiciOiUi{i6izibi\iyixi[igiwiDiviuiaitisi2iZiriqipioi7i)i(iViYiFi;iNiGiRiXi!iMiBiTiSiniKi=i`iiCimiJiWifi"i_iQiliLiHiiiikitchar_to_order_maptprecedence_matrixgX4 ?ttypical_positive_ratiotkeep_english_letters ISO-8859-9t charset_nametTurkishtlanguageN(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii%i/i'ii4i$i-i5i<ii1ii.i*i0iEi,i#ii3i&i>iAi+i8iiiiiiiiii iiiiiii ii iiii@iii ii i9i:i iiiiiiiiiiiiiiiiiiiiiiiiiiiiieiiiiiiiiijiiiiiiiidiiiiiiiii^iPi]iiiiii?iiiiiii~i}i|ihiIiciOiUi{i6izib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iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(tLatin5_TurkishCharToOrderMaptTurkishLangModeltTruetLatin5TurkishModel(((sH/usr/lib/python2.7/site-packages/pip/_vendor/chardet/langturkishmodel.pyt%s,site-packages/pip/_vendor/chardet/latin1prober.py000064400000012372147204247350016113 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetprober import CharSetProber from .enums import ProbingState FREQ_CAT_NUM = 4 UDF = 0 # undefined OTH = 1 # other ASC = 2 # ascii capital letter ASS = 3 # ascii small letter ACV = 4 # accent capital vowel ACO = 5 # accent capital other ASV = 6 # accent small vowel ASO = 7 # accent small other CLASS_NUM = 8 # total classes Latin1_CharToClass = ( OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 00 - 07 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 08 - 0F OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 10 - 17 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 18 - 1F OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 20 - 27 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 28 - 2F OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 30 - 37 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 38 - 3F OTH, ASC, ASC, ASC, ASC, ASC, ASC, ASC, # 40 - 47 ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC, # 48 - 4F ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC, # 50 - 57 ASC, ASC, ASC, OTH, OTH, OTH, OTH, OTH, # 58 - 5F OTH, ASS, ASS, ASS, ASS, ASS, ASS, ASS, # 60 - 67 ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS, # 68 - 6F ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS, # 70 - 77 ASS, ASS, ASS, OTH, OTH, OTH, OTH, OTH, # 78 - 7F OTH, UDF, OTH, ASO, OTH, OTH, OTH, OTH, # 80 - 87 OTH, OTH, ACO, OTH, ACO, UDF, ACO, UDF, # 88 - 8F UDF, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 90 - 97 OTH, OTH, ASO, OTH, ASO, UDF, ASO, ACO, # 98 - 9F OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # A0 - A7 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # A8 - AF OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # B0 - B7 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # B8 - BF ACV, ACV, ACV, ACV, ACV, ACV, ACO, ACO, # C0 - C7 ACV, ACV, ACV, ACV, ACV, ACV, ACV, ACV, # C8 - CF ACO, ACO, ACV, ACV, ACV, ACV, ACV, OTH, # D0 - D7 ACV, ACV, ACV, ACV, ACV, ACO, ACO, ACO, # D8 - DF ASV, ASV, ASV, ASV, ASV, ASV, ASO, ASO, # E0 - E7 ASV, ASV, ASV, ASV, ASV, ASV, ASV, ASV, # E8 - EF ASO, ASO, ASV, ASV, ASV, ASV, ASV, OTH, # F0 - F7 ASV, ASV, ASV, ASV, ASV, ASO, ASO, ASO, # F8 - FF ) # 0 : illegal # 1 : very unlikely # 2 : normal # 3 : very likely Latin1ClassModel = ( # UDF OTH ASC ASS ACV ACO ASV ASO 0, 0, 0, 0, 0, 0, 0, 0, # UDF 0, 3, 3, 3, 3, 3, 3, 3, # OTH 0, 3, 3, 3, 3, 3, 3, 3, # ASC 0, 3, 3, 3, 1, 1, 3, 3, # ASS 0, 3, 3, 3, 1, 2, 1, 2, # ACV 0, 3, 3, 3, 3, 3, 3, 3, # ACO 0, 3, 1, 3, 1, 1, 1, 3, # ASV 0, 3, 1, 3, 1, 1, 3, 3, # ASO ) class Latin1Prober(CharSetProber): def __init__(self): super(Latin1Prober, self).__init__() self._last_char_class = None self._freq_counter = None self.reset() def reset(self): self._last_char_class = OTH self._freq_counter = [0] * FREQ_CAT_NUM CharSetProber.reset(self) @property def charset_name(self): return "ISO-8859-1" @property def language(self): return "" def feed(self, byte_str): byte_str = self.filter_with_english_letters(byte_str) for c in byte_str: char_class = Latin1_CharToClass[c] freq = Latin1ClassModel[(self._last_char_class * CLASS_NUM) + char_class] if freq == 0: self._state = ProbingState.NOT_ME break self._freq_counter[freq] += 1 self._last_char_class = char_class return self.state def get_confidence(self): if self.state == ProbingState.NOT_ME: return 0.01 total = sum(self._freq_counter) if total < 0.01: confidence = 0.0 else: confidence = ((self._freq_counter[3] - self._freq_counter[1] * 20.0) / total) if confidence < 0.0: confidence = 0.0 # lower the confidence of latin1 so that other more accurate # detector can take priority. confidence = confidence * 0.73 return confidence site-packages/pip/_vendor/chardet/latin1prober.pyo000064400000007235147204247350016274 0ustar00 abc@sddlmZddlmZdZdZdZdZdZdZ dZ dZ d Z d Z eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeee ee ee eeeeeeeeeeee ee ee e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee e e e e e e e e e e e e e e e e e e e e e e ee e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e ee e e e e e e e fZdZd efd YZd S(i(t CharSetProber(t ProbingStateiiiiiiiit Latin1ProbercBsJeZdZdZedZedZdZdZRS(cCs3tt|jd|_d|_|jdS(N(tsuperRt__init__tNonet_last_char_classt _freq_countertreset(tself((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pyRas  cCs*t|_dgt|_tj|dS(Ni(tOTHRt FREQ_CAT_NUMRRR(R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pyRgs cCsdS(Ns ISO-8859-1((R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pyt charset_namelscCsdS(Nt((R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pytlanguagepscCs~|j|}xe|D]]}t|}t|jt|}|dkrWtj|_Pn|j|cd7<||_qW|j S(Nii( tfilter_with_english_letterstLatin1_CharToClasstLatin1ClassModelRt CLASS_NUMRtNOT_MEt_stateRtstate(R tbyte_strtct char_classtfreq((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pytfeedts      cCs}|jtjkrdSt|j}|dkr:d}n |jd|jdd|}|dkrod}n|d}|S(Ng{Gz?giig4@g\(\?(RRRtsumR(R ttotalt confidence((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pytget_confidences     ( t__name__t __module__RRtpropertyR RRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pyR`s    N(@iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii(t charsetproberRtenumsRR tUDFR tASCtASStACVtACOtASVtASORRRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/chardet/latin1prober.pytsh site-packages/pip/_vendor/chardet/mbcharsetprober.py000064400000006525147204247350016676 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # Proofpoint, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetprober import CharSetProber from .enums import ProbingState, MachineState class MultiByteCharSetProber(CharSetProber): """ MultiByteCharSetProber """ def __init__(self, lang_filter=None): super(MultiByteCharSetProber, self).__init__(lang_filter=lang_filter) self.distribution_analyzer = None self.coding_sm = None self._last_char = [0, 0] def reset(self): super(MultiByteCharSetProber, self).reset() if self.coding_sm: self.coding_sm.reset() if self.distribution_analyzer: self.distribution_analyzer.reset() self._last_char = [0, 0] @property def charset_name(self): raise NotImplementedError @property def language(self): raise NotImplementedError def feed(self, byte_str): for i in range(len(byte_str)): coding_state = self.coding_sm.next_state(byte_str[i]) if coding_state == MachineState.ERROR: self.logger.debug('%s %s prober hit error at byte %s', self.charset_name, self.language, i) self._state = ProbingState.NOT_ME break elif coding_state == MachineState.ITS_ME: self._state = ProbingState.FOUND_IT break elif coding_state == MachineState.START: char_len = self.coding_sm.get_current_charlen() if i == 0: self._last_char[1] = byte_str[0] self.distribution_analyzer.feed(self._last_char, char_len) else: self.distribution_analyzer.feed(byte_str[i - 1:i + 1], char_len) self._last_char[0] = byte_str[-1] if self.state == ProbingState.DETECTING: if (self.distribution_analyzer.got_enough_data() and (self.get_confidence() > self.SHORTCUT_THRESHOLD)): self._state = ProbingState.FOUND_IT return self.state def get_confidence(self): return self.distribution_analyzer.get_confidence() site-packages/pip/_vendor/chardet/mbcharsetprober.pyc000064400000005353147204247350017037 0ustar00 abc@s@ddlmZddlmZmZdefdYZdS(i(t CharSetProber(t ProbingStatet MachineStatetMultiByteCharSetProbercBsSeZdZddZdZedZedZdZ dZ RS(s MultiByteCharSetProber cCs>tt|jd|d|_d|_ddg|_dS(Nt lang_filteri(tsuperRt__init__tNonetdistribution_analyzert coding_smt _last_char(tselfR((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pyR's  cCsXtt|j|jr,|jjn|jrE|jjnddg|_dS(Ni(RRtresetR RR (R ((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pyR -s   cCs tdS(N(tNotImplementedError(R ((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pyt charset_name5scCs tdS(N(R (R ((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pytlanguage9scCsixtt|D]}|jj||}|tjkrm|jjd|j|j |t j |_ Pq|tj krt j|_ Pq|tjkr|jj}|dkr|d|jd<|jj|j|q|jj||d|d!|qqW|d|jd<|jt jkrb|jjrb|j|jkrbt j|_ qbn|jS(Ns!%s %s prober hit error at byte %siii(trangetlenR t next_stateRtERRORtloggertdebugRRRtNOT_MEt_statetITS_MEtFOUND_ITtSTARTtget_current_charlenR Rtfeedtstatet DETECTINGtgot_enough_datatget_confidencetSHORTCUT_THRESHOLD(R tbyte_strtit coding_statetchar_len((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pyR=s.    cCs |jjS(N(RR (R ((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pyR ZsN( t__name__t __module__t__doc__RRR tpropertyRRRR (((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pyR"s   N(t charsetproberRtenumsRRR(((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/mbcharsetprober.pytssite-packages/pip/_vendor/chardet/mbcsgroupprober.py000064400000003734147204247350016726 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # Proofpoint, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetgroupprober import CharSetGroupProber from .utf8prober import UTF8Prober from .sjisprober import SJISProber from .eucjpprober import EUCJPProber from .gb2312prober import GB2312Prober from .euckrprober import EUCKRProber from .cp949prober import CP949Prober from .big5prober import Big5Prober from .euctwprober import EUCTWProber class MBCSGroupProber(CharSetGroupProber): def __init__(self, lang_filter=None): super(MBCSGroupProber, self).__init__(lang_filter=lang_filter) self.probers = [ UTF8Prober(), SJISProber(), EUCJPProber(), GB2312Prober(), EUCKRProber(), CP949Prober(), Big5Prober(), EUCTWProber() ] self.reset() site-packages/pip/_vendor/chardet/mbcssm.py000064400000061611147204247350014775 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .enums import MachineState # BIG5 BIG5_CLS = ( 1,1,1,1,1,1,1,1, # 00 - 07 #allow 0x00 as legal value 1,1,1,1,1,1,0,0, # 08 - 0f 1,1,1,1,1,1,1,1, # 10 - 17 1,1,1,0,1,1,1,1, # 18 - 1f 1,1,1,1,1,1,1,1, # 20 - 27 1,1,1,1,1,1,1,1, # 28 - 2f 1,1,1,1,1,1,1,1, # 30 - 37 1,1,1,1,1,1,1,1, # 38 - 3f 2,2,2,2,2,2,2,2, # 40 - 47 2,2,2,2,2,2,2,2, # 48 - 4f 2,2,2,2,2,2,2,2, # 50 - 57 2,2,2,2,2,2,2,2, # 58 - 5f 2,2,2,2,2,2,2,2, # 60 - 67 2,2,2,2,2,2,2,2, # 68 - 6f 2,2,2,2,2,2,2,2, # 70 - 77 2,2,2,2,2,2,2,1, # 78 - 7f 4,4,4,4,4,4,4,4, # 80 - 87 4,4,4,4,4,4,4,4, # 88 - 8f 4,4,4,4,4,4,4,4, # 90 - 97 4,4,4,4,4,4,4,4, # 98 - 9f 4,3,3,3,3,3,3,3, # a0 - a7 3,3,3,3,3,3,3,3, # a8 - af 3,3,3,3,3,3,3,3, # b0 - b7 3,3,3,3,3,3,3,3, # b8 - bf 3,3,3,3,3,3,3,3, # c0 - c7 3,3,3,3,3,3,3,3, # c8 - cf 3,3,3,3,3,3,3,3, # d0 - d7 3,3,3,3,3,3,3,3, # d8 - df 3,3,3,3,3,3,3,3, # e0 - e7 3,3,3,3,3,3,3,3, # e8 - ef 3,3,3,3,3,3,3,3, # f0 - f7 3,3,3,3,3,3,3,0 # f8 - ff ) BIG5_ST = ( MachineState.ERROR,MachineState.START,MachineState.START, 3,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,#08-0f MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START#10-17 ) BIG5_CHAR_LEN_TABLE = (0, 1, 1, 2, 0) BIG5_SM_MODEL = {'class_table': BIG5_CLS, 'class_factor': 5, 'state_table': BIG5_ST, 'char_len_table': BIG5_CHAR_LEN_TABLE, 'name': 'Big5'} # CP949 CP949_CLS = ( 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,0,0, # 00 - 0f 1,1,1,1,1,1,1,1, 1,1,1,0,1,1,1,1, # 10 - 1f 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, # 20 - 2f 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, # 30 - 3f 1,4,4,4,4,4,4,4, 4,4,4,4,4,4,4,4, # 40 - 4f 4,4,5,5,5,5,5,5, 5,5,5,1,1,1,1,1, # 50 - 5f 1,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5, # 60 - 6f 5,5,5,5,5,5,5,5, 5,5,5,1,1,1,1,1, # 70 - 7f 0,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, # 80 - 8f 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, # 90 - 9f 6,7,7,7,7,7,7,7, 7,7,7,7,7,8,8,8, # a0 - af 7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7, # b0 - bf 7,7,7,7,7,7,9,2, 2,3,2,2,2,2,2,2, # c0 - cf 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, # d0 - df 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, # e0 - ef 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,0, # f0 - ff ) CP949_ST = ( #cls= 0 1 2 3 4 5 6 7 8 9 # previous state = MachineState.ERROR,MachineState.START, 3,MachineState.ERROR,MachineState.START,MachineState.START, 4, 5,MachineState.ERROR, 6, # MachineState.START MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, # MachineState.ERROR MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME, # MachineState.ITS_ME MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START, # 3 MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START, # 4 MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START, # 5 MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START, # 6 ) CP949_CHAR_LEN_TABLE = (0, 1, 2, 0, 1, 1, 2, 2, 0, 2) CP949_SM_MODEL = {'class_table': CP949_CLS, 'class_factor': 10, 'state_table': CP949_ST, 'char_len_table': CP949_CHAR_LEN_TABLE, 'name': 'CP949'} # EUC-JP EUCJP_CLS = ( 4,4,4,4,4,4,4,4, # 00 - 07 4,4,4,4,4,4,5,5, # 08 - 0f 4,4,4,4,4,4,4,4, # 10 - 17 4,4,4,5,4,4,4,4, # 18 - 1f 4,4,4,4,4,4,4,4, # 20 - 27 4,4,4,4,4,4,4,4, # 28 - 2f 4,4,4,4,4,4,4,4, # 30 - 37 4,4,4,4,4,4,4,4, # 38 - 3f 4,4,4,4,4,4,4,4, # 40 - 47 4,4,4,4,4,4,4,4, # 48 - 4f 4,4,4,4,4,4,4,4, # 50 - 57 4,4,4,4,4,4,4,4, # 58 - 5f 4,4,4,4,4,4,4,4, # 60 - 67 4,4,4,4,4,4,4,4, # 68 - 6f 4,4,4,4,4,4,4,4, # 70 - 77 4,4,4,4,4,4,4,4, # 78 - 7f 5,5,5,5,5,5,5,5, # 80 - 87 5,5,5,5,5,5,1,3, # 88 - 8f 5,5,5,5,5,5,5,5, # 90 - 97 5,5,5,5,5,5,5,5, # 98 - 9f 5,2,2,2,2,2,2,2, # a0 - a7 2,2,2,2,2,2,2,2, # a8 - af 2,2,2,2,2,2,2,2, # b0 - b7 2,2,2,2,2,2,2,2, # b8 - bf 2,2,2,2,2,2,2,2, # c0 - c7 2,2,2,2,2,2,2,2, # c8 - cf 2,2,2,2,2,2,2,2, # d0 - d7 2,2,2,2,2,2,2,2, # d8 - df 0,0,0,0,0,0,0,0, # e0 - e7 0,0,0,0,0,0,0,0, # e8 - ef 0,0,0,0,0,0,0,0, # f0 - f7 0,0,0,0,0,0,0,5 # f8 - ff ) EUCJP_ST = ( 3, 4, 3, 5,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f MachineState.ITS_ME,MachineState.ITS_ME,MachineState.START,MachineState.ERROR,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#10-17 MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 3,MachineState.ERROR,#18-1f 3,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START#20-27 ) EUCJP_CHAR_LEN_TABLE = (2, 2, 2, 3, 1, 0) EUCJP_SM_MODEL = {'class_table': EUCJP_CLS, 'class_factor': 6, 'state_table': EUCJP_ST, 'char_len_table': EUCJP_CHAR_LEN_TABLE, 'name': 'EUC-JP'} # EUC-KR EUCKR_CLS = ( 1,1,1,1,1,1,1,1, # 00 - 07 1,1,1,1,1,1,0,0, # 08 - 0f 1,1,1,1,1,1,1,1, # 10 - 17 1,1,1,0,1,1,1,1, # 18 - 1f 1,1,1,1,1,1,1,1, # 20 - 27 1,1,1,1,1,1,1,1, # 28 - 2f 1,1,1,1,1,1,1,1, # 30 - 37 1,1,1,1,1,1,1,1, # 38 - 3f 1,1,1,1,1,1,1,1, # 40 - 47 1,1,1,1,1,1,1,1, # 48 - 4f 1,1,1,1,1,1,1,1, # 50 - 57 1,1,1,1,1,1,1,1, # 58 - 5f 1,1,1,1,1,1,1,1, # 60 - 67 1,1,1,1,1,1,1,1, # 68 - 6f 1,1,1,1,1,1,1,1, # 70 - 77 1,1,1,1,1,1,1,1, # 78 - 7f 0,0,0,0,0,0,0,0, # 80 - 87 0,0,0,0,0,0,0,0, # 88 - 8f 0,0,0,0,0,0,0,0, # 90 - 97 0,0,0,0,0,0,0,0, # 98 - 9f 0,2,2,2,2,2,2,2, # a0 - a7 2,2,2,2,2,3,3,3, # a8 - af 2,2,2,2,2,2,2,2, # b0 - b7 2,2,2,2,2,2,2,2, # b8 - bf 2,2,2,2,2,2,2,2, # c0 - c7 2,3,2,2,2,2,2,2, # c8 - cf 2,2,2,2,2,2,2,2, # d0 - d7 2,2,2,2,2,2,2,2, # d8 - df 2,2,2,2,2,2,2,2, # e0 - e7 2,2,2,2,2,2,2,2, # e8 - ef 2,2,2,2,2,2,2,2, # f0 - f7 2,2,2,2,2,2,2,0 # f8 - ff ) EUCKR_ST = ( MachineState.ERROR,MachineState.START, 3,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#00-07 MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START #08-0f ) EUCKR_CHAR_LEN_TABLE = (0, 1, 2, 0) EUCKR_SM_MODEL = {'class_table': EUCKR_CLS, 'class_factor': 4, 'state_table': EUCKR_ST, 'char_len_table': EUCKR_CHAR_LEN_TABLE, 'name': 'EUC-KR'} # EUC-TW EUCTW_CLS = ( 2,2,2,2,2,2,2,2, # 00 - 07 2,2,2,2,2,2,0,0, # 08 - 0f 2,2,2,2,2,2,2,2, # 10 - 17 2,2,2,0,2,2,2,2, # 18 - 1f 2,2,2,2,2,2,2,2, # 20 - 27 2,2,2,2,2,2,2,2, # 28 - 2f 2,2,2,2,2,2,2,2, # 30 - 37 2,2,2,2,2,2,2,2, # 38 - 3f 2,2,2,2,2,2,2,2, # 40 - 47 2,2,2,2,2,2,2,2, # 48 - 4f 2,2,2,2,2,2,2,2, # 50 - 57 2,2,2,2,2,2,2,2, # 58 - 5f 2,2,2,2,2,2,2,2, # 60 - 67 2,2,2,2,2,2,2,2, # 68 - 6f 2,2,2,2,2,2,2,2, # 70 - 77 2,2,2,2,2,2,2,2, # 78 - 7f 0,0,0,0,0,0,0,0, # 80 - 87 0,0,0,0,0,0,6,0, # 88 - 8f 0,0,0,0,0,0,0,0, # 90 - 97 0,0,0,0,0,0,0,0, # 98 - 9f 0,3,4,4,4,4,4,4, # a0 - a7 5,5,1,1,1,1,1,1, # a8 - af 1,1,1,1,1,1,1,1, # b0 - b7 1,1,1,1,1,1,1,1, # b8 - bf 1,1,3,1,3,3,3,3, # c0 - c7 3,3,3,3,3,3,3,3, # c8 - cf 3,3,3,3,3,3,3,3, # d0 - d7 3,3,3,3,3,3,3,3, # d8 - df 3,3,3,3,3,3,3,3, # e0 - e7 3,3,3,3,3,3,3,3, # e8 - ef 3,3,3,3,3,3,3,3, # f0 - f7 3,3,3,3,3,3,3,0 # f8 - ff ) EUCTW_ST = ( MachineState.ERROR,MachineState.ERROR,MachineState.START, 3, 3, 3, 4,MachineState.ERROR,#00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.START,MachineState.ERROR,#10-17 MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#18-1f 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.ERROR,MachineState.START,MachineState.START,#20-27 MachineState.START,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START #28-2f ) EUCTW_CHAR_LEN_TABLE = (0, 0, 1, 2, 2, 2, 3) EUCTW_SM_MODEL = {'class_table': EUCTW_CLS, 'class_factor': 7, 'state_table': EUCTW_ST, 'char_len_table': EUCTW_CHAR_LEN_TABLE, 'name': 'x-euc-tw'} # GB2312 GB2312_CLS = ( 1,1,1,1,1,1,1,1, # 00 - 07 1,1,1,1,1,1,0,0, # 08 - 0f 1,1,1,1,1,1,1,1, # 10 - 17 1,1,1,0,1,1,1,1, # 18 - 1f 1,1,1,1,1,1,1,1, # 20 - 27 1,1,1,1,1,1,1,1, # 28 - 2f 3,3,3,3,3,3,3,3, # 30 - 37 3,3,1,1,1,1,1,1, # 38 - 3f 2,2,2,2,2,2,2,2, # 40 - 47 2,2,2,2,2,2,2,2, # 48 - 4f 2,2,2,2,2,2,2,2, # 50 - 57 2,2,2,2,2,2,2,2, # 58 - 5f 2,2,2,2,2,2,2,2, # 60 - 67 2,2,2,2,2,2,2,2, # 68 - 6f 2,2,2,2,2,2,2,2, # 70 - 77 2,2,2,2,2,2,2,4, # 78 - 7f 5,6,6,6,6,6,6,6, # 80 - 87 6,6,6,6,6,6,6,6, # 88 - 8f 6,6,6,6,6,6,6,6, # 90 - 97 6,6,6,6,6,6,6,6, # 98 - 9f 6,6,6,6,6,6,6,6, # a0 - a7 6,6,6,6,6,6,6,6, # a8 - af 6,6,6,6,6,6,6,6, # b0 - b7 6,6,6,6,6,6,6,6, # b8 - bf 6,6,6,6,6,6,6,6, # c0 - c7 6,6,6,6,6,6,6,6, # c8 - cf 6,6,6,6,6,6,6,6, # d0 - d7 6,6,6,6,6,6,6,6, # d8 - df 6,6,6,6,6,6,6,6, # e0 - e7 6,6,6,6,6,6,6,6, # e8 - ef 6,6,6,6,6,6,6,6, # f0 - f7 6,6,6,6,6,6,6,0 # f8 - ff ) GB2312_ST = ( MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START, 3,MachineState.ERROR,#00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.START,#10-17 4,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#18-1f MachineState.ERROR,MachineState.ERROR, 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,#20-27 MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START #28-2f ) # To be accurate, the length of class 6 can be either 2 or 4. # But it is not necessary to discriminate between the two since # it is used for frequency analysis only, and we are validating # each code range there as well. So it is safe to set it to be # 2 here. GB2312_CHAR_LEN_TABLE = (0, 1, 1, 1, 1, 1, 2) GB2312_SM_MODEL = {'class_table': GB2312_CLS, 'class_factor': 7, 'state_table': GB2312_ST, 'char_len_table': GB2312_CHAR_LEN_TABLE, 'name': 'GB2312'} # Shift_JIS SJIS_CLS = ( 1,1,1,1,1,1,1,1, # 00 - 07 1,1,1,1,1,1,0,0, # 08 - 0f 1,1,1,1,1,1,1,1, # 10 - 17 1,1,1,0,1,1,1,1, # 18 - 1f 1,1,1,1,1,1,1,1, # 20 - 27 1,1,1,1,1,1,1,1, # 28 - 2f 1,1,1,1,1,1,1,1, # 30 - 37 1,1,1,1,1,1,1,1, # 38 - 3f 2,2,2,2,2,2,2,2, # 40 - 47 2,2,2,2,2,2,2,2, # 48 - 4f 2,2,2,2,2,2,2,2, # 50 - 57 2,2,2,2,2,2,2,2, # 58 - 5f 2,2,2,2,2,2,2,2, # 60 - 67 2,2,2,2,2,2,2,2, # 68 - 6f 2,2,2,2,2,2,2,2, # 70 - 77 2,2,2,2,2,2,2,1, # 78 - 7f 3,3,3,3,3,2,2,3, # 80 - 87 3,3,3,3,3,3,3,3, # 88 - 8f 3,3,3,3,3,3,3,3, # 90 - 97 3,3,3,3,3,3,3,3, # 98 - 9f #0xa0 is illegal in sjis encoding, but some pages does #contain such byte. We need to be more error forgiven. 2,2,2,2,2,2,2,2, # a0 - a7 2,2,2,2,2,2,2,2, # a8 - af 2,2,2,2,2,2,2,2, # b0 - b7 2,2,2,2,2,2,2,2, # b8 - bf 2,2,2,2,2,2,2,2, # c0 - c7 2,2,2,2,2,2,2,2, # c8 - cf 2,2,2,2,2,2,2,2, # d0 - d7 2,2,2,2,2,2,2,2, # d8 - df 3,3,3,3,3,3,3,3, # e0 - e7 3,3,3,3,3,4,4,4, # e8 - ef 3,3,3,3,3,3,3,3, # f0 - f7 3,3,3,3,3,0,0,0) # f8 - ff SJIS_ST = ( MachineState.ERROR,MachineState.START,MachineState.START, 3,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START #10-17 ) SJIS_CHAR_LEN_TABLE = (0, 1, 1, 2, 0, 0) SJIS_SM_MODEL = {'class_table': SJIS_CLS, 'class_factor': 6, 'state_table': SJIS_ST, 'char_len_table': SJIS_CHAR_LEN_TABLE, 'name': 'Shift_JIS'} # UCS2-BE UCS2BE_CLS = ( 0,0,0,0,0,0,0,0, # 00 - 07 0,0,1,0,0,2,0,0, # 08 - 0f 0,0,0,0,0,0,0,0, # 10 - 17 0,0,0,3,0,0,0,0, # 18 - 1f 0,0,0,0,0,0,0,0, # 20 - 27 0,3,3,3,3,3,0,0, # 28 - 2f 0,0,0,0,0,0,0,0, # 30 - 37 0,0,0,0,0,0,0,0, # 38 - 3f 0,0,0,0,0,0,0,0, # 40 - 47 0,0,0,0,0,0,0,0, # 48 - 4f 0,0,0,0,0,0,0,0, # 50 - 57 0,0,0,0,0,0,0,0, # 58 - 5f 0,0,0,0,0,0,0,0, # 60 - 67 0,0,0,0,0,0,0,0, # 68 - 6f 0,0,0,0,0,0,0,0, # 70 - 77 0,0,0,0,0,0,0,0, # 78 - 7f 0,0,0,0,0,0,0,0, # 80 - 87 0,0,0,0,0,0,0,0, # 88 - 8f 0,0,0,0,0,0,0,0, # 90 - 97 0,0,0,0,0,0,0,0, # 98 - 9f 0,0,0,0,0,0,0,0, # a0 - a7 0,0,0,0,0,0,0,0, # a8 - af 0,0,0,0,0,0,0,0, # b0 - b7 0,0,0,0,0,0,0,0, # b8 - bf 0,0,0,0,0,0,0,0, # c0 - c7 0,0,0,0,0,0,0,0, # c8 - cf 0,0,0,0,0,0,0,0, # d0 - d7 0,0,0,0,0,0,0,0, # d8 - df 0,0,0,0,0,0,0,0, # e0 - e7 0,0,0,0,0,0,0,0, # e8 - ef 0,0,0,0,0,0,0,0, # f0 - f7 0,0,0,0,0,0,4,5 # f8 - ff ) UCS2BE_ST = ( 5, 7, 7,MachineState.ERROR, 4, 3,MachineState.ERROR,MachineState.ERROR,#00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f MachineState.ITS_ME,MachineState.ITS_ME, 6, 6, 6, 6,MachineState.ERROR,MachineState.ERROR,#10-17 6, 6, 6, 6, 6,MachineState.ITS_ME, 6, 6,#18-1f 6, 6, 6, 6, 5, 7, 7,MachineState.ERROR,#20-27 5, 8, 6, 6,MachineState.ERROR, 6, 6, 6,#28-2f 6, 6, 6, 6,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START #30-37 ) UCS2BE_CHAR_LEN_TABLE = (2, 2, 2, 0, 2, 2) UCS2BE_SM_MODEL = {'class_table': UCS2BE_CLS, 'class_factor': 6, 'state_table': UCS2BE_ST, 'char_len_table': UCS2BE_CHAR_LEN_TABLE, 'name': 'UTF-16BE'} # UCS2-LE UCS2LE_CLS = ( 0,0,0,0,0,0,0,0, # 00 - 07 0,0,1,0,0,2,0,0, # 08 - 0f 0,0,0,0,0,0,0,0, # 10 - 17 0,0,0,3,0,0,0,0, # 18 - 1f 0,0,0,0,0,0,0,0, # 20 - 27 0,3,3,3,3,3,0,0, # 28 - 2f 0,0,0,0,0,0,0,0, # 30 - 37 0,0,0,0,0,0,0,0, # 38 - 3f 0,0,0,0,0,0,0,0, # 40 - 47 0,0,0,0,0,0,0,0, # 48 - 4f 0,0,0,0,0,0,0,0, # 50 - 57 0,0,0,0,0,0,0,0, # 58 - 5f 0,0,0,0,0,0,0,0, # 60 - 67 0,0,0,0,0,0,0,0, # 68 - 6f 0,0,0,0,0,0,0,0, # 70 - 77 0,0,0,0,0,0,0,0, # 78 - 7f 0,0,0,0,0,0,0,0, # 80 - 87 0,0,0,0,0,0,0,0, # 88 - 8f 0,0,0,0,0,0,0,0, # 90 - 97 0,0,0,0,0,0,0,0, # 98 - 9f 0,0,0,0,0,0,0,0, # a0 - a7 0,0,0,0,0,0,0,0, # a8 - af 0,0,0,0,0,0,0,0, # b0 - b7 0,0,0,0,0,0,0,0, # b8 - bf 0,0,0,0,0,0,0,0, # c0 - c7 0,0,0,0,0,0,0,0, # c8 - cf 0,0,0,0,0,0,0,0, # d0 - d7 0,0,0,0,0,0,0,0, # d8 - df 0,0,0,0,0,0,0,0, # e0 - e7 0,0,0,0,0,0,0,0, # e8 - ef 0,0,0,0,0,0,0,0, # f0 - f7 0,0,0,0,0,0,4,5 # f8 - ff ) UCS2LE_ST = ( 6, 6, 7, 6, 4, 3,MachineState.ERROR,MachineState.ERROR,#00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f MachineState.ITS_ME,MachineState.ITS_ME, 5, 5, 5,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,#10-17 5, 5, 5,MachineState.ERROR, 5,MachineState.ERROR, 6, 6,#18-1f 7, 6, 8, 8, 5, 5, 5,MachineState.ERROR,#20-27 5, 5, 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 5, 5,#28-2f 5, 5, 5,MachineState.ERROR, 5,MachineState.ERROR,MachineState.START,MachineState.START #30-37 ) UCS2LE_CHAR_LEN_TABLE = (2, 2, 2, 2, 2, 2) UCS2LE_SM_MODEL = {'class_table': UCS2LE_CLS, 'class_factor': 6, 'state_table': UCS2LE_ST, 'char_len_table': UCS2LE_CHAR_LEN_TABLE, 'name': 'UTF-16LE'} # UTF-8 UTF8_CLS = ( 1,1,1,1,1,1,1,1, # 00 - 07 #allow 0x00 as a legal value 1,1,1,1,1,1,0,0, # 08 - 0f 1,1,1,1,1,1,1,1, # 10 - 17 1,1,1,0,1,1,1,1, # 18 - 1f 1,1,1,1,1,1,1,1, # 20 - 27 1,1,1,1,1,1,1,1, # 28 - 2f 1,1,1,1,1,1,1,1, # 30 - 37 1,1,1,1,1,1,1,1, # 38 - 3f 1,1,1,1,1,1,1,1, # 40 - 47 1,1,1,1,1,1,1,1, # 48 - 4f 1,1,1,1,1,1,1,1, # 50 - 57 1,1,1,1,1,1,1,1, # 58 - 5f 1,1,1,1,1,1,1,1, # 60 - 67 1,1,1,1,1,1,1,1, # 68 - 6f 1,1,1,1,1,1,1,1, # 70 - 77 1,1,1,1,1,1,1,1, # 78 - 7f 2,2,2,2,3,3,3,3, # 80 - 87 4,4,4,4,4,4,4,4, # 88 - 8f 4,4,4,4,4,4,4,4, # 90 - 97 4,4,4,4,4,4,4,4, # 98 - 9f 5,5,5,5,5,5,5,5, # a0 - a7 5,5,5,5,5,5,5,5, # a8 - af 5,5,5,5,5,5,5,5, # b0 - b7 5,5,5,5,5,5,5,5, # b8 - bf 0,0,6,6,6,6,6,6, # c0 - c7 6,6,6,6,6,6,6,6, # c8 - cf 6,6,6,6,6,6,6,6, # d0 - d7 6,6,6,6,6,6,6,6, # d8 - df 7,8,8,8,8,8,8,8, # e0 - e7 8,8,8,8,8,9,8,8, # e8 - ef 10,11,11,11,11,11,11,11, # f0 - f7 12,13,13,13,14,15,0,0 # f8 - ff ) UTF8_ST = ( MachineState.ERROR,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 12, 10,#00-07 9, 11, 8, 7, 6, 5, 4, 3,#08-0f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#10-17 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#18-1f MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#20-27 MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#28-2f MachineState.ERROR,MachineState.ERROR, 5, 5, 5, 5,MachineState.ERROR,MachineState.ERROR,#30-37 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#38-3f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 5, 5, 5,MachineState.ERROR,MachineState.ERROR,#40-47 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#48-4f MachineState.ERROR,MachineState.ERROR, 7, 7, 7, 7,MachineState.ERROR,MachineState.ERROR,#50-57 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#58-5f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 7, 7,MachineState.ERROR,MachineState.ERROR,#60-67 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#68-6f MachineState.ERROR,MachineState.ERROR, 9, 9, 9, 9,MachineState.ERROR,MachineState.ERROR,#70-77 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#78-7f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 9,MachineState.ERROR,MachineState.ERROR,#80-87 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#88-8f MachineState.ERROR,MachineState.ERROR, 12, 12, 12, 12,MachineState.ERROR,MachineState.ERROR,#90-97 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#98-9f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 12,MachineState.ERROR,MachineState.ERROR,#a0-a7 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#a8-af MachineState.ERROR,MachineState.ERROR, 12, 12, 12,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#b0-b7 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#b8-bf MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,#c0-c7 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR #c8-cf ) UTF8_CHAR_LEN_TABLE = (0, 1, 0, 0, 0, 0, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6) UTF8_SM_MODEL = {'class_table': UTF8_CLS, 'class_factor': 16, 'state_table': UTF8_ST, 'char_len_table': UTF8_CHAR_LEN_TABLE, 'name': 'UTF-8'} site-packages/pip/_vendor/chardet/sbcharsetprober.py000064400000013031147204247350016672 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetprober import CharSetProber from .enums import CharacterCategory, ProbingState, SequenceLikelihood class SingleByteCharSetProber(CharSetProber): SAMPLE_SIZE = 64 SB_ENOUGH_REL_THRESHOLD = 1024 # 0.25 * SAMPLE_SIZE^2 POSITIVE_SHORTCUT_THRESHOLD = 0.95 NEGATIVE_SHORTCUT_THRESHOLD = 0.05 def __init__(self, model, reversed=False, name_prober=None): super(SingleByteCharSetProber, self).__init__() self._model = model # TRUE if we need to reverse every pair in the model lookup self._reversed = reversed # Optional auxiliary prober for name decision self._name_prober = name_prober self._last_order = None self._seq_counters = None self._total_seqs = None self._total_char = None self._freq_char = None self.reset() def reset(self): super(SingleByteCharSetProber, self).reset() # char order of last character self._last_order = 255 self._seq_counters = [0] * SequenceLikelihood.get_num_categories() self._total_seqs = 0 self._total_char = 0 # characters that fall in our sampling range self._freq_char = 0 @property def charset_name(self): if self._name_prober: return self._name_prober.charset_name else: return self._model['charset_name'] @property def language(self): if self._name_prober: return self._name_prober.language else: return self._model.get('language') def feed(self, byte_str): if not self._model['keep_english_letter']: byte_str = self.filter_international_words(byte_str) if not byte_str: return self.state char_to_order_map = self._model['char_to_order_map'] for i, c in enumerate(byte_str): # XXX: Order is in range 1-64, so one would think we want 0-63 here, # but that leads to 27 more test failures than before. order = char_to_order_map[c] # XXX: This was SYMBOL_CAT_ORDER before, with a value of 250, but # CharacterCategory.SYMBOL is actually 253, so we use CONTROL # to make it closer to the original intent. The only difference # is whether or not we count digits and control characters for # _total_char purposes. if order < CharacterCategory.CONTROL: self._total_char += 1 if order < self.SAMPLE_SIZE: self._freq_char += 1 if self._last_order < self.SAMPLE_SIZE: self._total_seqs += 1 if not self._reversed: i = (self._last_order * self.SAMPLE_SIZE) + order model = self._model['precedence_matrix'][i] else: # reverse the order of the letters in the lookup i = (order * self.SAMPLE_SIZE) + self._last_order model = self._model['precedence_matrix'][i] self._seq_counters[model] += 1 self._last_order = order charset_name = self._model['charset_name'] if self.state == ProbingState.DETECTING: if self._total_seqs > self.SB_ENOUGH_REL_THRESHOLD: confidence = self.get_confidence() if confidence > self.POSITIVE_SHORTCUT_THRESHOLD: self.logger.debug('%s confidence = %s, we have a winner', charset_name, confidence) self._state = ProbingState.FOUND_IT elif confidence < self.NEGATIVE_SHORTCUT_THRESHOLD: self.logger.debug('%s confidence = %s, below negative ' 'shortcut threshhold %s', charset_name, confidence, self.NEGATIVE_SHORTCUT_THRESHOLD) self._state = ProbingState.NOT_ME return self.state def get_confidence(self): r = 0.01 if self._total_seqs > 0: r = ((1.0 * self._seq_counters[SequenceLikelihood.POSITIVE]) / self._total_seqs / self._model['typical_positive_ratio']) r = r * self._freq_char / self._total_char if r >= 1.0: r = 0.99 return r site-packages/pip/_vendor/chardet/sbcsgroupprober.pyo000064400000003611147204247350017105 0ustar00 abc@sddlmZddlmZddlmZmZmZmZm Z m Z ddl m Z m Z ddlmZmZddlmZddlmZddlmZdd lmZd efd YZd S( i(tCharSetGroupProber(tSingleByteCharSetProber(tWin1251CyrillicModelt Koi8rModeltLatin5CyrillicModeltMacCyrillicModelt Ibm866Modelt Ibm855Model(tLatin7GreekModeltWin1253GreekModel(tLatin5BulgarianModeltWin1251BulgarianModel(tTIS620ThaiModel(tWin1255HebrewModel(t HebrewProber(tLatin5TurkishModeltSBCSGroupProbercBseZdZRS(c Cstt|jtttttttttttt tt tt tt tt ttttg |_t}ttt|}ttt|}|j|||jj|||g|jdS(N(tsuperRt__init__RRRRRRRRR R R R RtprobersRR tFalsetTruetset_model_proberstextendtreset(tselft hebrew_probertlogical_hebrew_probertvisual_hebrew_prober((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sbcsgroupprober.pyR,s,                (t__name__t __module__R(((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sbcsgroupprober.pyR+sN(tcharsetgroupproberRtsbcharsetproberRtlangcyrillicmodelRRRRRRtlanggreekmodelRR tlangbulgarianmodelR R t langthaimodelR tlanghebrewmodelR t hebrewproberRtlangturkishmodelRR(((sG/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sbcsgroupprober.pyts.site-packages/pip/_vendor/chardet/sjisprober.pyo000064400000005773147204247350016061 0ustar00 abc@sddlmZddlmZddlmZddlmZddlm Z ddl m Z m Z defdYZ d S( i(tMultiByteCharSetProber(tCodingStateMachine(tSJISDistributionAnalysis(tSJISContextAnalysis(t SJIS_SM_MODEL(t ProbingStatet MachineStatet SJISProbercBsJeZdZdZedZedZdZdZRS(cCsHtt|jtt|_t|_t|_ |j dS(N( tsuperRt__init__RRt coding_smRtdistribution_analyzerRtcontext_analyzertreset(tself((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pyR %s   cCs$tt|j|jjdS(N(RRR R (R((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pyR ,scCs |jjS(N(R t charset_name(R((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pyR0scCsdS(NtJapanese((R((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pytlanguage4scCsxNtt|D]:}|jj||}|tjkrm|jjd|j|j |t j |_ Pq|tj krt j|_ Pq|tjkr|jj}|dkr|d|jd<|jj|jd|||jj|j|qM|jj||d||d|!||jj||d|d!|qqW|d|jd<|jt jkr|jjr|j|jkrt j|_ qn|jS(Ns!%s %s prober hit error at byte %siiiii(trangetlenR t next_stateRtERRORtloggertdebugRRRtNOT_MEt_statetITS_MEtFOUND_ITtSTARTtget_current_charlent _last_charR tfeedR tstatet DETECTINGtgot_enough_datatget_confidencetSHORTCUT_THRESHOLD(Rtbyte_strtit coding_statetchar_len((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pyR8s6    cCs+|jj}|jj}t||S(N(R R#R tmax(Rt context_conft distrib_conf((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pyR#Ys( t__name__t __module__R R tpropertyRRRR#(((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pyR$s    !N(tmbcharsetproberRtcodingstatemachineRtchardistributionRtjpcntxRtmbcssmRtenumsRRR(((sB/usr/lib/python2.7/site-packages/pip/_vendor/chardet/sjisprober.pyts site-packages/pip/_vendor/chardet/universaldetector.pyo000064400000015721147204247350017433 0ustar00 abc@sdZddlZddlZddlZddlmZddlmZmZm Z ddl m Z ddl m Z ddlmZdd lmZd efd YZdS( s Module containing the UniversalDetector detector class, which is the primary class a user of ``chardet`` should use. :author: Mark Pilgrim (initial port to Python) :author: Shy Shalom (original C code) :author: Dan Blanchard (major refactoring for 3.0) :author: Ian Cordasco iNi(tCharSetGroupProber(t InputStatetLanguageFiltert ProbingState(tEscCharSetProber(t Latin1Prober(tMBCSGroupProber(tSBCSGroupProbertUniversalDetectorcBseZdZdZejdZejdZejdZidd6dd6d d 6d d 6d d6dd6dd6dd6Z e j dZ dZ dZdZRS(sq The ``UniversalDetector`` class underlies the ``chardet.detect`` function and coordinates all of the different charset probers. To get a ``dict`` containing an encoding and its confidence, you can simply run: .. code:: u = UniversalDetector() u.feed(some_bytes) u.close() detected = u.result g?s[-]s(|~{)s[-]s Windows-1252s iso-8859-1s Windows-1250s iso-8859-2s Windows-1251s iso-8859-5s Windows-1256s iso-8859-6s Windows-1253s iso-8859-7s Windows-1255s iso-8859-8s Windows-1254s iso-8859-9s Windows-1257s iso-8859-13cCsqd|_g|_d|_d|_d|_d|_d|_||_t j t |_ d|_ |jdS(N(tNonet_esc_charset_probert_charset_proberstresulttdonet _got_datat _input_statet _last_chart lang_filtertloggingt getLoggert__name__tloggert_has_win_bytestreset(tselfR((sI/usr/lib/python2.7/site-packages/pip/_vendor/chardet/universaldetector.pyt__init__Qs         cCsidd6dd6dd6|_t|_t|_t|_tj|_d|_ |j rg|j j nx|j D]}|j qqWdS(s Reset the UniversalDetector and all of its probers back to their initial states. This is called by ``__init__``, so you only need to call this directly in between analyses of different documents. tencodinggt confidencetlanguagetN( R R tFalseR RRRt PURE_ASCIIRRR RR (Rtprober((sI/usr/lib/python2.7/site-packages/pip/_vendor/chardet/universaldetector.pyR^s      cCsy|jr dSt|sdSt|ts;t|}n|js{|jtjrwidd6dd6dd6|_n|jtj tj fridd6dd6dd6|_n|jd rid d6dd6dd6|_nl|jd rid d6dd6dd6|_n<|jtj tj frOid d6dd6dd6|_nt |_|jddk r{t |_dSn|jtjkr|jj|rtj|_q|jtjkr|jj|j|rtj|_qn|d|_|jtjkr|js(t|j|_n|jj|tjkrui|jjd6|jjd6|jj d6|_t |_qun|jtjkru|j!st"|jg|_!|jt#j$@r|j!j%t&n|j!j%t'nx`|j!D]U}|j|tjkri|jd6|jd6|j d6|_t |_PqqW|j(j|rut |_)qundS(s Takes a chunk of a document and feeds it through all of the relevant charset probers. After calling ``feed``, you can check the value of the ``done`` attribute to see if you need to continue feeding the ``UniversalDetector`` more data, or if it has made a prediction (in the ``result`` attribute). .. note:: You should always call ``close`` when you're done feeding in your document if ``done`` is not already ``True``. Ns UTF-8-SIGRg?RRRsUTF-32ssX-ISO-10646-UCS-4-3412ssX-ISO-10646-UCS-4-2143sUTF-16i(*R tlent isinstancet bytearrayRt startswithtcodecstBOM_UTF8R t BOM_UTF32_LEt BOM_UTF32_BEtBOM_LEtBOM_BEtTrueR RRRtHIGH_BYTE_DETECTORtsearcht HIGH_BYTEt ESC_DETECTORRt ESC_ASCIIR RRtfeedRtFOUND_ITt charset_nametget_confidenceRR RRtNON_CJKtappendRRtWIN_BYTE_DETECTORR(Rtbyte_strR ((sI/usr/lib/python2.7/site-packages/pip/_vendor/chardet/universaldetector.pyR1os~                  c Cs>|jr|jSt|_|js5|jjdn1|jtjkrhidd6dd6dd6|_n|jtj krfd }d}d }xD|j D]9}|sqn|j }||kr|}|}qqW|rf||j krf|j}|jj}|j }|jd r?|jr?|jj||}q?ni|d6|d6|jd6|_qfn|jjtjkr7|jdd kr7|jjd x|j D]}|sqnt|trx^|jD]+}|jjd |j|j|j qWq|jjd |j|j|j qWq7n|jS( s Stop analyzing the current document and come up with a final prediction. :returns: The ``result`` attribute, a ``dict`` with the keys `encoding`, `confidence`, and `language`. sno data received!tasciiRg?RRRgsiso-8859s no probers hit minimum thresholds%s %s confidence = %sN(R R R+RRtdebugRRRR.R R R4tMINIMUM_THRESHOLDR3tlowerR$Rt ISO_WIN_MAPtgetRtgetEffectiveLevelRtDEBUGR"Rtprobers( Rtprober_confidencetmax_prober_confidencet max_proberR R3tlower_charset_nameRt group_prober((sI/usr/lib/python2.7/site-packages/pip/_vendor/chardet/universaldetector.pytcloses`              (Rt __module__t__doc__R;tretcompileR,R/R7R=RtALLRRR1RG(((sI/usr/lib/python2.7/site-packages/pip/_vendor/chardet/universaldetector.pyR3s"    m(RIR%RRJtcharsetgroupproberRtenumsRRRt escproberRt latin1proberRtmbcsgroupproberRtsbcsgroupproberRtobjectR(((sI/usr/lib/python2.7/site-packages/pip/_vendor/chardet/universaldetector.pyt$s   site-packages/pip/_vendor/chardet/version.py000064400000000362147204247350015172 0ustar00""" This module exists only to simplify retrieving the version number of chardet from within setup.py and from chardet subpackages. :author: Dan Blanchard (dan.blanchard@gmail.com) """ __version__ = "3.0.4" VERSION = __version__.split('.') site-packages/pip/_vendor/chardet/__init__.py000064400000003027147204247350015245 0ustar00######################## BEGIN LICENSE BLOCK ######################## # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .compat import PY2, PY3 from .universaldetector import UniversalDetector from .version import __version__, VERSION def detect(byte_str): """ Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` """ if not isinstance(byte_str, bytearray): if not isinstance(byte_str, bytes): raise TypeError('Expected object of type bytes or bytearray, got: ' '{0}'.format(type(byte_str))) else: byte_str = bytearray(byte_str) detector = UniversalDetector() detector.feed(byte_str) return detector.close() site-packages/pip/_vendor/colorama/__init__.py000064400000000360147204247350015425 0ustar00# 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' site-packages/pip/_vendor/colorama/__init__.pyc000064400000000743147204247350015575 0ustar00 abc@s^ddlmZmZmZmZddlmZmZmZm Z ddl m Z dZ dS(i(tinittdeinittreinitt colorama_text(tForetBacktStyletCursor(t AnsiToWin32s0.3.7N( t initialiseRRRRtansiRRRRt ansitowin32Rt __version__(((sA/usr/lib/python2.7/site-packages/pip/_vendor/colorama/__init__.pyts""site-packages/pip/_vendor/colorama/__init__.pyo000064400000000743147204247350015611 0ustar00 abc@s^ddlmZmZmZmZddlmZmZmZm Z ddl m Z dZ dS(i(tinittdeinittreinitt colorama_text(tForetBacktStyletCursor(t AnsiToWin32s0.3.7N( t initialiseRRRRtansiRRRRt ansitowin32Rt __version__(((sA/usr/lib/python2.7/site-packages/pip/_vendor/colorama/__init__.pyts""site-packages/pip/_vendor/colorama/ansi.py000064400000004734147204247350014631 0ustar00# 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() site-packages/pip/_vendor/colorama/ansi.pyc000064400000010520147204247350014762 0ustar00 abc@sdZdZdZdZdZdZddZddZd efd YZ d efd YZ d e fdYZ de fdYZ de fdYZ e Ze Ze Ze ZdS(s This module generates ANSI character codes to printing colors to terminals. See: http://en.wikipedia.org/wiki/ANSI_escape_code s]scCstt|dS(Ntm(tCSItstr(tcode((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyt code_to_chars scCstd|tS(Ns2;(tOSCtBEL(ttitle((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyt set_titlesicCstt|dS(NtJ(RR(tmode((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyt clear_screenscCstt|dS(NtK(RR(R ((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyt clear_linest AnsiCodescBseZdZRS(cCsRxKt|D]=}|jds t||}t||t|q q WdS(Nt_(tdirt startswithtgetattrtsetattrR(tselftnametvalue((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyt__init__s(t__name__t __module__R(((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyRst AnsiCursorcBsGeZddZddZddZddZdddZRS(icCstt|dS(NtA(RR(Rtn((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pytUP%scCstt|dS(NtB(RR(RR((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pytDOWN'scCstt|dS(NtC(RR(RR((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pytFORWARD)scCstt|dS(NtD(RR(RR((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pytBACK+scCs tt|dt|dS(Nt;tH(RR(Rtxty((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pytPOS-s(RRRRR!R#R((((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyR$s     tAnsiForecBsneZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZRS(iii i!i"i#i$i%i'iZi[i\i]i^i_i`ia(RRtBLACKtREDtGREENtYELLOWtBLUEtMAGENTAtCYANtWHITEtRESETt LIGHTBLACK_EXt LIGHTRED_EXt LIGHTGREEN_EXtLIGHTYELLOW_EXt LIGHTBLUE_EXtLIGHTMAGENTA_EXt LIGHTCYAN_EXt LIGHTWHITE_EX(((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyR)1s"tAnsiBackcBsneZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZRS(i(i)i*i+i,i-i.i/i1idieifigihiiijik(RRR*R+R,R-R.R/R0R1R2R3R4R5R6R7R8R9R:(((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyR;Gs"t AnsiStylecBs eZdZdZdZdZRS(iiii(RRtBRIGHTtDIMtNORMALt RESET_ALL(((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyR<]sN(t__doc__RRRRRR R tobjectRRR)R;R<tForetBacktStyletCursor(((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyts          site-packages/pip/_vendor/colorama/ansi.pyo000064400000010520147204247350014776 0ustar00 abc@sdZdZdZdZdZdZddZddZd efd YZ d efd YZ d e fdYZ de fdYZ de fdYZ e Ze Ze Ze ZdS(s This module generates ANSI character codes to printing colors to terminals. See: http://en.wikipedia.org/wiki/ANSI_escape_code s]scCstt|dS(Ntm(tCSItstr(tcode((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyt code_to_chars scCstd|tS(Ns2;(tOSCtBEL(ttitle((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyt set_titlesicCstt|dS(NtJ(RR(tmode((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyt clear_screenscCstt|dS(NtK(RR(R ((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyt clear_linest AnsiCodescBseZdZRS(cCsRxKt|D]=}|jds t||}t||t|q q WdS(Nt_(tdirt startswithtgetattrtsetattrR(tselftnametvalue((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyt__init__s(t__name__t __module__R(((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyRst AnsiCursorcBsGeZddZddZddZddZdddZRS(icCstt|dS(NtA(RR(Rtn((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pytUP%scCstt|dS(NtB(RR(RR((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pytDOWN'scCstt|dS(NtC(RR(RR((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pytFORWARD)scCstt|dS(NtD(RR(RR((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pytBACK+scCs tt|dt|dS(Nt;tH(RR(Rtxty((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pytPOS-s(RRRRR!R#R((((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyR$s     tAnsiForecBsneZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZRS(iii i!i"i#i$i%i'iZi[i\i]i^i_i`ia(RRtBLACKtREDtGREENtYELLOWtBLUEtMAGENTAtCYANtWHITEtRESETt LIGHTBLACK_EXt LIGHTRED_EXt LIGHTGREEN_EXtLIGHTYELLOW_EXt LIGHTBLUE_EXtLIGHTMAGENTA_EXt LIGHTCYAN_EXt LIGHTWHITE_EX(((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyR)1s"tAnsiBackcBsneZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZRS(i(i)i*i+i,i-i.i/i1idieifigihiiijik(RRR*R+R,R-R.R/R0R1R2R3R4R5R6R7R8R9R:(((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyR;Gs"t AnsiStylecBs eZdZdZdZdZRS(iiii(RRtBRIGHTtDIMtNORMALt RESET_ALL(((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyR<]sN(t__doc__RRRRRR R tobjectRRR)R;R<tForetBacktStyletCursor(((s=/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.pyts          site-packages/pip/_vendor/colorama/ansitowin32.py000064400000022704147204247350016054 0ustar00# 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 site-packages/pip/_vendor/colorama/ansitowin32.pyc000064400000022211147204247350016210 0ustar00 abc@sddlZddlZddlZddlmZmZmZmZddlm Z m Z m Z ddl m Z mZdZe dk re ZndZdZdefd YZd efd YZdS( iNi(tAnsiForetAnsiBackt AnsiStyletStyle(tWinTermtWinColortWinStyle(twindllt winapi_testcCst|d p|jS(Ntclosed(thasattrR (tstream((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pytis_stream_closedscCst|do|jS(Ntisatty(R R (R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pytis_a_ttyst StreamWrappercBs)eZdZdZdZdZRS(s 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. cCs||_||_dS(N(t_StreamWrapper__wrappedt_StreamWrapper__convertor(tselftwrappedt converter((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyt__init__s cCst|j|S(N(tgetattrR(Rtname((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyt __getattr__$scCs|jj|dS(N(Rtwrite(Rttext((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyR's(t__name__t __module__t__doc__RRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRs  t AnsiToWin32cBseZdZejdZejdZddedZ dZ dZ dZ dZ dZd Zd Zd Zd Zd ZRS(s 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. s?\[((?:\d|;)*)([a-zA-Z])?s?\]((?:.|;)*?)()?cCs||_||_t|||_tjdk}|o?t}|dkrq|pkt| okt | }n||_ |dkr|ot| ot |}n||_ |j |_ |jtjk|_dS(Ntnt(Rt autoresetRR tosRRtNoneR Rtstriptconverttget_win32_callst win32_callstsyststderrt on_stderr(RRR$R#R t on_windowstconversion_supported((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyR4s   #  " cCs|jp|jp|jS(sj 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() (R$R#R (R((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyt should_wrapUscCs||jrutrui&tjftj6tjtjftj6tjtjftj 6tjtjftj6tj t j ft j 6tj t jft j6tj t jft j6tj t jft j6tj t jft j6tj t jft j6tj t jft j6tj t jft j6tj ft j6tj t j tft j6tj t jtft j6tj t jtft j6tj t jtft j6tj t jtft j6tj t jtft j6tj t jtft j6tj t jtft j6tj t j ft!j 6tj t jft!j6tj t jft!j6tj t jft!j6tj t jft!j6tj t jft!j6tj t jft!j6tj t jft!j6tj ft!j6tj t j tft!j6tj t jtft!j6tj t jtft!j6tj t jtft!j6tj t jtft!j6tj t jtft!j6tj t jtft!j6tj t jtft!j6St"S(N(#R$twintermt reset_allRt RESET_ALLtstyleRtBRIGHTtNORMALtDIMtforeRtBLACKRtREDtGREENtYELLOWtBLUEtMAGENTAtCYANtGREYtWHITEtRESETtTruet LIGHTBLACK_EXt LIGHTRED_EXt LIGHTGREEN_EXtLIGHTYELLOW_EXt LIGHTBLUE_EXtLIGHTMAGENTA_EXt LIGHTCYAN_EXt LIGHTWHITE_EXtbackRtdict(R((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyR%_sRcCsY|js|jr"|j|n|jj||jj|jrU|jndS(N(R#R$twrite_and_convertRRtflushR R.(RR((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRs   cCsP|jr|jddn0|j rLt|j rL|jjtjndS(Ntmi(i(R$t call_win32R#R RRRR/(R((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyR.s cCsd}|j|}xX|jj|D]D}|j\}}|j||||j|j|}q(W|j||t|dS(s Write the given text to our wrapped stream, stripping any ANSI sequences from the text, and optionally converting them into win32 calls. iN(t convert_osct ANSI_CSI_REtfinditertspantwrite_plain_textt convert_ansitgroupstlen(RRtcursortmatchtstarttend((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRJs cCs7||kr3|jj|||!|jjndS(N(RRRK(RRRXRY((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRRs cCs2|jr.|j||}|j||ndS(N(R$textract_paramsRM(Rt paramstringtcommandtparams((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRSs cCs|dkrQtd|jdD}xt|dkrM|d }q.Wn^td|jdD}t|dkr|dkrd }q|d krd }qn|S( NtHfcss3|])}t|dkr't|ndVqdS(iiN(RUtint(t.0tp((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pys st;iicss-|]#}t|dkrt|VqdS(iN(RUR_(R`Ra((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pys sitJKmtABCD(i(i(i(ttupletsplitRU(RR\R[R]((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRZs     c Cse|dkrrxR|D]X}||jkr|j|}|d}|d}td|j}|||qqWn|dkrtj|dd|jn|dkrtj|dd|jn|dkrtj|d|jnx|dkra|d}id| fd 6d|fd 6|dfd 6| dfd 6|\} } tj| | d|jndS( NRLiiR)tJtKR^RdtAtBtCtD(R&RIR)R-t erase_screent erase_linetset_cursor_positiont cursor_adjust( RR\R]tparamt func_argstfunctargstkwargstntxty((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRMs$          FcCsx|jj|D]~}|j\}}|| ||}|j\}}|dkr|jd}|ddkrtj|dqqqW|S(NsRbit02i(t ANSI_OSC_RERPRQRTRfR-t set_title(RRRWRXRYR[R\R]((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRNs N(RRRtretcompileRORzR"tFalseRR,R%RR.RJRRRSRZRMRN(((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyR+s! ,      (R|R'R!tansiRRRRR-RRRtwin32RRR"R RtobjectRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyts   "    site-packages/pip/_vendor/colorama/ansitowin32.pyo000064400000022211147204247350016224 0ustar00 abc@sddlZddlZddlZddlmZmZmZmZddlm Z m Z m Z ddl m Z mZdZe dk re ZndZdZdefd YZd efd YZdS( iNi(tAnsiForetAnsiBackt AnsiStyletStyle(tWinTermtWinColortWinStyle(twindllt winapi_testcCst|d p|jS(Ntclosed(thasattrR (tstream((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pytis_stream_closedscCst|do|jS(Ntisatty(R R (R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pytis_a_ttyst StreamWrappercBs)eZdZdZdZdZRS(s 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. cCs||_||_dS(N(t_StreamWrapper__wrappedt_StreamWrapper__convertor(tselftwrappedt converter((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyt__init__s cCst|j|S(N(tgetattrR(Rtname((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyt __getattr__$scCs|jj|dS(N(Rtwrite(Rttext((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyR's(t__name__t __module__t__doc__RRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRs  t AnsiToWin32cBseZdZejdZejdZddedZ dZ dZ dZ dZ dZd Zd Zd Zd Zd ZRS(s 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. s?\[((?:\d|;)*)([a-zA-Z])?s?\]((?:.|;)*?)()?cCs||_||_t|||_tjdk}|o?t}|dkrq|pkt| okt | }n||_ |dkr|ot| ot |}n||_ |j |_ |jtjk|_dS(Ntnt(Rt autoresetRR tosRRtNoneR Rtstriptconverttget_win32_callst win32_callstsyststderrt on_stderr(RRR$R#R t on_windowstconversion_supported((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyR4s   #  " cCs|jp|jp|jS(sj 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() (R$R#R (R((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyt should_wrapUscCs||jrutrui&tjftj6tjtjftj6tjtjftj 6tjtjftj6tj t j ft j 6tj t jft j6tj t jft j6tj t jft j6tj t jft j6tj t jft j6tj t jft j6tj t jft j6tj ft j6tj t j tft j6tj t jtft j6tj t jtft j6tj t jtft j6tj t jtft j6tj t jtft j6tj t jtft j6tj t jtft j6tj t j ft!j 6tj t jft!j6tj t jft!j6tj t jft!j6tj t jft!j6tj t jft!j6tj t jft!j6tj t jft!j6tj ft!j6tj t j tft!j6tj t jtft!j6tj t jtft!j6tj t jtft!j6tj t jtft!j6tj t jtft!j6tj t jtft!j6tj t jtft!j6St"S(N(#R$twintermt reset_allRt RESET_ALLtstyleRtBRIGHTtNORMALtDIMtforeRtBLACKRtREDtGREENtYELLOWtBLUEtMAGENTAtCYANtGREYtWHITEtRESETtTruet LIGHTBLACK_EXt LIGHTRED_EXt LIGHTGREEN_EXtLIGHTYELLOW_EXt LIGHTBLUE_EXtLIGHTMAGENTA_EXt LIGHTCYAN_EXt LIGHTWHITE_EXtbackRtdict(R((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyR%_sRcCsY|js|jr"|j|n|jj||jj|jrU|jndS(N(R#R$twrite_and_convertRRtflushR R.(RR((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRs   cCsP|jr|jddn0|j rLt|j rL|jjtjndS(Ntmi(i(R$t call_win32R#R RRRR/(R((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyR.s cCsd}|j|}xX|jj|D]D}|j\}}|j||||j|j|}q(W|j||t|dS(s Write the given text to our wrapped stream, stripping any ANSI sequences from the text, and optionally converting them into win32 calls. iN(t convert_osct ANSI_CSI_REtfinditertspantwrite_plain_textt convert_ansitgroupstlen(RRtcursortmatchtstarttend((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRJs cCs7||kr3|jj|||!|jjndS(N(RRRK(RRRXRY((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRRs cCs2|jr.|j||}|j||ndS(N(R$textract_paramsRM(Rt paramstringtcommandtparams((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRSs cCs|dkrQtd|jdD}xt|dkrM|d }q.Wn^td|jdD}t|dkr|dkrd }q|d krd }qn|S( NtHfcss3|])}t|dkr't|ndVqdS(iiN(RUtint(t.0tp((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pys st;iicss-|]#}t|dkrt|VqdS(iN(RUR_(R`Ra((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pys sitJKmtABCD(i(i(i(ttupletsplitRU(RR\R[R]((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRZs     c Cse|dkrrxR|D]X}||jkr|j|}|d}|d}td|j}|||qqWn|dkrtj|dd|jn|dkrtj|dd|jn|dkrtj|d|jnx|dkra|d}id| fd 6d|fd 6|dfd 6| dfd 6|\} } tj| | d|jndS( NRLiiR)tJtKR^RdtAtBtCtD(R&RIR)R-t erase_screent erase_linetset_cursor_positiont cursor_adjust( RR\R]tparamt func_argstfunctargstkwargstntxty((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRMs$          FcCsx|jj|D]~}|j\}}|| ||}|j\}}|dkr|jd}|ddkrtj|dqqqW|S(NsRbit02i(t ANSI_OSC_RERPRQRTRfR-t set_title(RRRWRXRYR[R\R]((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRNs N(RRRtretcompileRORzR"tFalseRR,R%RR.RJRRRSRZRMRN(((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyR+s! ,      (R|R'R!tansiRRRRR-RRRtwin32RRR"R RtobjectRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyts   "    site-packages/pip/_vendor/colorama/initialise.py000064400000003575147204247350016033 0ustar00# 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 site-packages/pip/_vendor/colorama/initialise.pyc000064400000004462147204247350016172 0ustar00 abc@sddlZddlZddlZddlmZdadadada e a dZ e dde dZdZejdZdZd ZdS( iNi(t AnsiToWin32cCs#tdk rttjndS(N(RtNonet orig_stdoutt reset_all(((sC/usr/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.pyRs cCs| r+t|||gr+tdntjatjatjdkrUdant t||||t_atjdkrda nt t||||t_a t st j tta ndS(Ns,wrap=False conflicts with any other arg=True(tanyt ValueErrortsyststdoutRtstderrt orig_stderrRtwrapped_stdoutt wrap_streamtwrapped_stderrt atexit_donetatexittregisterRtTrue(t autoresettconverttstriptwrap((sC/usr/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.pytinits     cCs4tdk rtt_ntdk r0tt_ndS(N(RRRRR R(((sC/usr/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.pytdeinit3s   cos%t||z dVWdtXdS(N(RR(targstkwargs((sC/usr/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.pyt colorama_text:s  cCs4tdk rtt_ntdk r0tt_ndS(N(R RRRR R(((sC/usr/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.pytreinitCs   cCsC|r?t|d|d|d|}|jr?|j}q?n|S(NRRR(Rt should_wraptstream(RRRRRtwrapper((sC/usr/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.pyR Js   (Rt contextlibRt ansitowin32RRRR R R tFalseR RRRRtcontextmanagerRRR (((sC/usr/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.pyts      site-packages/pip/_vendor/colorama/initialise.pyo000064400000004462147204247350016206 0ustar00 abc@sddlZddlZddlZddlmZdadadada e a dZ e dde dZdZejdZdZd ZdS( iNi(t AnsiToWin32cCs#tdk rttjndS(N(RtNonet orig_stdoutt reset_all(((sC/usr/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.pyRs cCs| r+t|||gr+tdntjatjatjdkrUdant t||||t_atjdkrda nt t||||t_a t st j tta ndS(Ns,wrap=False conflicts with any other arg=True(tanyt ValueErrortsyststdoutRtstderrt orig_stderrRtwrapped_stdoutt wrap_streamtwrapped_stderrt atexit_donetatexittregisterRtTrue(t autoresettconverttstriptwrap((sC/usr/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.pytinits     cCs4tdk rtt_ntdk r0tt_ndS(N(RRRRR R(((sC/usr/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.pytdeinit3s   cos%t||z dVWdtXdS(N(RR(targstkwargs((sC/usr/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.pyt colorama_text:s  cCs4tdk rtt_ntdk r0tt_ndS(N(R RRRR R(((sC/usr/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.pytreinitCs   cCsC|r?t|d|d|d|}|jr?|j}q?n|S(NRRR(Rt should_wraptstream(RRRRRtwrapper((sC/usr/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.pyR Js   (Rt contextlibRt ansitowin32RRRR R R tFalseR RRRRtcontextmanagerRRR (((sC/usr/lib/python2.7/site-packages/pip/_vendor/colorama/initialise.pyts      site-packages/pip/_vendor/colorama/win32.py000064400000012365147204247350014640 0ustar00# 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) site-packages/pip/_vendor/colorama/win32.pyc000064400000011372147204247350015000 0ustar00 abc@s}dZdZy?ddlZddlmZeejZddlmZWn/eefk r|dZdZ dZ nXddlm Z m Z mZmZejZd e fd YZejjZejge_eje_ejjZejeege_eje_ejj Zejejge_eje_ejjZ ejege _eje _ejj!Z"ejeejeeejge"_eje"_ejj#Z$ejejejeeejge$_eje$_ejj%Z&ej'ge&_eje&_ieee6eee6Z(d Z ed Zd Z e)dZdZ*dZ#dZ+dS(iiiN(t LibraryLoader(twintypescGsdS(N(tNone(t_((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pyttcGsdS(N(R(R((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pyRR(tbyreft Structuretc_chartPOINTERtCONSOLE_SCREEN_BUFFER_INFOcBsPeZdZdefdefdejfdejfdefgZdZRS(sstruct in wincon.h.tdwSizetdwCursorPositiont wAttributestsrWindowtdwMaximumWindowSizec Cshd|jj|jj|jj|jj|j|jj|jj|jj|jj |j j|j jf S(Ns"(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)( R tYtXR R RtToptLefttBottomtRightR(tself((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pyt__str__s $( t__name__t __module__t__doc__tCOORDRtWORDt SMALL_RECTt_fields_R(((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pyR s    cCs2tt}t}t|t|}t|S(N(thandlestSTDOUTR t_GetConsoleScreenBufferInfoRtbool(thandletcsbitsuccess((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pyt winapi_testas   cCs,t|}t}t|t|}|S(N(RR R!R(t stream_idR#R$R%((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pytGetConsoleScreenBufferInfohs   cCst|}t||S(N(Rt_SetConsoleTextAttribute(R'tattrsR#((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pytSetConsoleTextAttributeos cCst|}|jdks*|jdkr.dSt|jd|jd}|rttj}|j|j7_|j|j7_nt|}t ||S(Nii( RRRR(R RRRRt_SetConsoleCursorPosition(R'tpositiontadjusttadjusted_positiontsrR#((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pytSetConsoleCursorPositionss  cCs_t|}t|j}tj|}tjd}t||||t|}|jS(Ni(RRtencodeRtDWORDt_FillConsoleOutputCharacterARtvalue(R'tchartlengthtstartR#t num_writtenR%((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pytFillConsoleOutputCharacters cCsSt|}tj|}tj|}tjd}t||||t|S(sa FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )i(RRRR3t_FillConsoleOutputAttributeR(R'tattrR7R8R#t attributeR9((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pytFillConsoleOutputAttributes  cCs t|S(N(t_SetConsoleTitleW(ttitle((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pytSetConsoleTitles(,R tSTDERRtctypesRtWinDLLtwindllRtAttributeErrort ImportErrorRR+R&RRRR t_COORDRR tkernel32t GetStdHandlet _GetStdHandleR3targtypestHANDLEtrestypeR(R!tBOOLR)RR1R,tFillConsoleOutputCharacterAR4R>R;tSetConsoleTitleAR?tLPCSTRRtTrueR:RA(((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pytsn   "                      site-packages/pip/_vendor/colorama/win32.pyo000064400000011372147204247350015014 0ustar00 abc@s}dZdZy?ddlZddlmZeejZddlmZWn/eefk r|dZdZ dZ nXddlm Z m Z mZmZejZd e fd YZejjZejge_eje_ejjZejeege_eje_ejj Zejejge_eje_ejjZ ejege _eje _ejj!Z"ejeejeeejge"_eje"_ejj#Z$ejejejeeejge$_eje$_ejj%Z&ej'ge&_eje&_ieee6eee6Z(d Z ed Zd Z e)dZdZ*dZ#dZ+dS(iiiN(t LibraryLoader(twintypescGsdS(N(tNone(t_((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pyttcGsdS(N(R(R((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pyRR(tbyreft Structuretc_chartPOINTERtCONSOLE_SCREEN_BUFFER_INFOcBsPeZdZdefdefdejfdejfdefgZdZRS(sstruct in wincon.h.tdwSizetdwCursorPositiont wAttributestsrWindowtdwMaximumWindowSizec Cshd|jj|jj|jj|jj|j|jj|jj|jj|jj |j j|j jf S(Ns"(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)( R tYtXR R RtToptLefttBottomtRightR(tself((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pyt__str__s $( t__name__t __module__t__doc__tCOORDRtWORDt SMALL_RECTt_fields_R(((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pyR s    cCs2tt}t}t|t|}t|S(N(thandlestSTDOUTR t_GetConsoleScreenBufferInfoRtbool(thandletcsbitsuccess((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pyt winapi_testas   cCs,t|}t}t|t|}|S(N(RR R!R(t stream_idR#R$R%((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pytGetConsoleScreenBufferInfohs   cCst|}t||S(N(Rt_SetConsoleTextAttribute(R'tattrsR#((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pytSetConsoleTextAttributeos cCst|}|jdks*|jdkr.dSt|jd|jd}|rttj}|j|j7_|j|j7_nt|}t ||S(Nii( RRRR(R RRRRt_SetConsoleCursorPosition(R'tpositiontadjusttadjusted_positiontsrR#((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pytSetConsoleCursorPositionss  cCs_t|}t|j}tj|}tjd}t||||t|}|jS(Ni(RRtencodeRtDWORDt_FillConsoleOutputCharacterARtvalue(R'tchartlengthtstartR#t num_writtenR%((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pytFillConsoleOutputCharacters cCsSt|}tj|}tj|}tjd}t||||t|S(sa FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )i(RRRR3t_FillConsoleOutputAttributeR(R'tattrR7R8R#t attributeR9((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pytFillConsoleOutputAttributes  cCs t|S(N(t_SetConsoleTitleW(ttitle((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pytSetConsoleTitles(,R tSTDERRtctypesRtWinDLLtwindllRtAttributeErrort ImportErrorRR+R&RRRR t_COORDRR tkernel32t GetStdHandlet _GetStdHandleR3targtypestHANDLEtrestypeR(R!tBOOLR)RR1R,tFillConsoleOutputCharacterAR4R>R;tSetConsoleTitleAR?tLPCSTRRtTrueR:RA(((s>/usr/lib/python2.7/site-packages/pip/_vendor/colorama/win32.pytsn   "                      site-packages/pip/_vendor/colorama/winterm.py000064400000014222147204247350015355 0ustar00# 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) site-packages/pip/_vendor/colorama/winterm.pyc000064400000013650147204247350015524 0ustar00 abc@sVddlmZdefdYZdefdYZdefdYZdS( i(twin32tWinColorcBs8eZdZdZdZdZdZdZdZdZ RS(iiiiiiii( t__name__t __module__tBLACKtBLUEtGREENtCYANtREDtMAGENTAtYELLOWtGREY(((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyRstWinStylecBseZdZdZdZRS(iii(RRtNORMALtBRIGHTtBRIGHT_BACKGROUND(((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyR stWinTermcBseZdZdZdZddZdeedZdeedZ dedZ dedZ dZ ded Z ed Zd ed Zd ed ZdZRS(cCsYtjtjj|_|j|j|j|_|j|_ |j |_ d|_ dS(Ni( RtGetConsoleScreenBufferInfotSTDOUTt wAttributest_defaultt set_attrst_foret _default_foret_backt _default_backt_stylet_default_stylet_light(tself((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt__init__s    cCs |j|jd|j|jBS(Ni(RRRR(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt get_attrs$scCs9|d@|_|d?d@|_|tjtjB@|_dS(Nii(RRR RRR(Rtvalue((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyR's cCs'|j|j|jd|jdS(Ntattrs(RRt set_console(Rt on_stderr((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt reset_all,scCsc|dkr|j}n||_|r<|jtjO_n|jtjM_|jd|dS(NR#(tNoneRRRR RR"(RtforetlightR#((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyR&0s   cCsc|dkr|j}n||_|r<|jtjO_n|jtjM_|jd|dS(NR#(R%RRRR RR"(RtbackR'R#((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyR(;s   cCs5|dkr|j}n||_|jd|dS(NR#(R%RRR"(RtstyleR#((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyR)Fs   cCsJ|dkr|j}ntj}|r6tj}ntj||dS(N(R%RRRtSTDERRtSetConsoleTextAttribute(RR!R#thandle((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyR"Ls    cCs4tj|j}|jd7_|jd7_|S(Ni(RRtdwCursorPositiontXtY(RR,tposition((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt get_positionTscCs?|dkrdStj}|r+tj}ntj||dS(N(R%RRR*tSetConsoleCursorPosition(RR0R#R,((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pytset_cursor_position\s    cCs^tj}|rtj}n|j|}|j||j|f}tj||dtdS(Ntadjust(RRR*R1R/R.R2tFalse(RtxtyR#R,R0tadjusted_position((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt cursor_adjustfs   ic Cs%tj}|rtj}ntj|}|jj|jj}|jj|jj|jj}|dkr|j}||}n|dkrtjdd}|}n'|dkrtjdd}|}ntj |d||tj ||j |||dkr!tj |dndS(Niiit (ii( RRR*RtdwSizeR.R/R-tCOORDtFillConsoleOutputCharactertFillConsoleOutputAttributeRR2( RtmodeR#R,tcsbitcells_in_screentcells_before_cursort from_coordtcells_to_erase((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt erase_screenns&           cCstj}|rtj}ntj|}|dkrX|j}|jj|jj}n|dkrtjd|jj}|jj}n3|dkrtjd|jj}|jj}ntj |d||tj ||j ||dS(NiiiR:( RRR*RR-R;R.R<R/R=R>R(RR?R#R,R@RCRD((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt erase_lines      cCstj|dS(N(RtSetConsoleTitle(Rttitle((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt set_titlesN(RRRRRR%R$R5R&R(R)R"R1R3R9RERFRI(((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyRs       N(tRtobjectRR R(((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyts site-packages/pip/_vendor/colorama/winterm.pyo000064400000013650147204247350015540 0ustar00 abc@sVddlmZdefdYZdefdYZdefdYZdS( i(twin32tWinColorcBs8eZdZdZdZdZdZdZdZdZ RS(iiiiiiii( t__name__t __module__tBLACKtBLUEtGREENtCYANtREDtMAGENTAtYELLOWtGREY(((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyRstWinStylecBseZdZdZdZRS(iii(RRtNORMALtBRIGHTtBRIGHT_BACKGROUND(((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyR stWinTermcBseZdZdZdZddZdeedZdeedZ dedZ dedZ dZ ded Z ed Zd ed Zd ed ZdZRS(cCsYtjtjj|_|j|j|j|_|j|_ |j |_ d|_ dS(Ni( RtGetConsoleScreenBufferInfotSTDOUTt wAttributest_defaultt set_attrst_foret _default_foret_backt _default_backt_stylet_default_stylet_light(tself((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt__init__s    cCs |j|jd|j|jBS(Ni(RRRR(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt get_attrs$scCs9|d@|_|d?d@|_|tjtjB@|_dS(Nii(RRR RRR(Rtvalue((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyR's cCs'|j|j|jd|jdS(Ntattrs(RRt set_console(Rt on_stderr((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt reset_all,scCsc|dkr|j}n||_|r<|jtjO_n|jtjM_|jd|dS(NR#(tNoneRRRR RR"(RtforetlightR#((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyR&0s   cCsc|dkr|j}n||_|r<|jtjO_n|jtjM_|jd|dS(NR#(R%RRRR RR"(RtbackR'R#((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyR(;s   cCs5|dkr|j}n||_|jd|dS(NR#(R%RRR"(RtstyleR#((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyR)Fs   cCsJ|dkr|j}ntj}|r6tj}ntj||dS(N(R%RRRtSTDERRtSetConsoleTextAttribute(RR!R#thandle((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyR"Ls    cCs4tj|j}|jd7_|jd7_|S(Ni(RRtdwCursorPositiontXtY(RR,tposition((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt get_positionTscCs?|dkrdStj}|r+tj}ntj||dS(N(R%RRR*tSetConsoleCursorPosition(RR0R#R,((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pytset_cursor_position\s    cCs^tj}|rtj}n|j|}|j||j|f}tj||dtdS(Ntadjust(RRR*R1R/R.R2tFalse(RtxtyR#R,R0tadjusted_position((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt cursor_adjustfs   ic Cs%tj}|rtj}ntj|}|jj|jj}|jj|jj|jj}|dkr|j}||}n|dkrtjdd}|}n'|dkrtjdd}|}ntj |d||tj ||j |||dkr!tj |dndS(Niiit (ii( RRR*RtdwSizeR.R/R-tCOORDtFillConsoleOutputCharactertFillConsoleOutputAttributeRR2( RtmodeR#R,tcsbitcells_in_screentcells_before_cursort from_coordtcells_to_erase((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt erase_screenns&           cCstj}|rtj}ntj|}|dkrX|j}|jj|jj}n|dkrtjd|jj}|jj}n3|dkrtjd|jj}|jj}ntj |d||tj ||j ||dS(NiiiR:( RRR*RR-R;R.R<R/R=R>R(RR?R#R,R@RCRD((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt erase_lines      cCstj|dS(N(RtSetConsoleTitle(Rttitle((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyt set_titlesN(RRRRRR%R$R5R&R(R)R"R1R3R9RERFRI(((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyRs       N(tRtobjectRR R(((s@/usr/lib/python2.7/site-packages/pip/_vendor/colorama/winterm.pyts site-packages/pip/_vendor/distlib/_backport/__init__.py000064400000000422147204247350017225 0ustar00"""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. """ site-packages/pip/_vendor/distlib/_backport/__init__.pyc000064400000000703147204247350017372 0ustar00 abc@s dZdS(s 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. N(t__doc__(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/__init__.pyttsite-packages/pip/_vendor/distlib/_backport/__init__.pyo000064400000000703147204247350017406 0ustar00 abc@s dZdS(s 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. N(t__doc__(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/__init__.pyttsite-packages/pip/_vendor/distlib/_backport/misc.py000064400000001713147204247350016425 0ustar00# -*- 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__) site-packages/pip/_vendor/distlib/_backport/misc.pyc000064400000002624147204247350016572 0ustar00 abc@sdZddlZddlZdddgZyddlmZWnek r`edZnXy eZWn*e k rddl m Z d ZnXy ej Z Wne k rd Z nXdS( s/Backports for individual classes and functions.iNtcache_from_sourcetcallabletfsencode(RcCs|r dpd}||S(Ntcto((tpy_filetdebugtext((sF/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/misc.pyRs(tCallablecCs t|tS(N(t isinstanceR(tobj((sF/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/misc.pyRscCsRt|tr|St|tr5|jtjStdt|jdS(Nsexpect bytes or str, not %s( R tbyteststrtencodetsystgetfilesystemencodingt TypeErrorttypet__name__(tfilename((sF/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/misc.pyR"s (t__doc__tosRt__all__timpRt ImportErrort __debug__Rt NameErrort collectionsRRtAttributeError(((sF/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/misc.pyts         site-packages/pip/_vendor/distlib/_backport/misc.pyo000064400000002624147204247350016606 0ustar00 abc@sdZddlZddlZdddgZyddlmZWnek r`edZnXy eZWn*e k rddl m Z d ZnXy ej Z Wne k rd Z nXdS( s/Backports for individual classes and functions.iNtcache_from_sourcetcallabletfsencode(RcCs|r dpd}||S(Ntcto((tpy_filetdebugtext((sF/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/misc.pyRs(tCallablecCs t|tS(N(t isinstanceR(tobj((sF/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/misc.pyRscCsRt|tr|St|tr5|jtjStdt|jdS(Nsexpect bytes or str, not %s( R tbyteststrtencodetsystgetfilesystemencodingt TypeErrorttypet__name__(tfilename((sF/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/misc.pyR"s (t__doc__tosRt__all__timpRt ImportErrort __debug__Rt NameErrort collectionsRRtAttributeError(((sF/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/misc.pyts         site-packages/pip/_vendor/distlib/_backport/shutil.py000064400000062057147204247350017012 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # """Utility functions for copying and archiving files and directory trees. XXX The functions here don't copy the resource fork or other metadata on Mac. """ import os import sys import stat from os.path import abspath import fnmatch import collections import errno from . import tarfile try: import bz2 _BZ2_SUPPORTED = True except ImportError: _BZ2_SUPPORTED = False try: from pwd import getpwnam except ImportError: getpwnam = None try: from grp import getgrnam except ImportError: getgrnam = None __all__ = ["copyfileobj", "copyfile", "copymode", "copystat", "copy", "copy2", "copytree", "move", "rmtree", "Error", "SpecialFileError", "ExecError", "make_archive", "get_archive_formats", "register_archive_format", "unregister_archive_format", "get_unpack_formats", "register_unpack_format", "unregister_unpack_format", "unpack_archive", "ignore_patterns"] class Error(EnvironmentError): pass class SpecialFileError(EnvironmentError): """Raised when trying to do a kind of operation (e.g. copying) which is not supported on a special file (e.g. a named pipe)""" class ExecError(EnvironmentError): """Raised when a command could not be executed""" class ReadError(EnvironmentError): """Raised when an archive cannot be read""" class RegistryError(Exception): """Raised when a registry operation with the archiving and unpacking registries fails""" try: WindowsError except NameError: WindowsError = None def copyfileobj(fsrc, fdst, length=16*1024): """copy data from file-like object fsrc to file-like object fdst""" while 1: buf = fsrc.read(length) if not buf: break fdst.write(buf) def _samefile(src, dst): # Macintosh, Unix. if hasattr(os.path, 'samefile'): try: return os.path.samefile(src, dst) except OSError: return False # All other platforms: check for same pathname. return (os.path.normcase(os.path.abspath(src)) == os.path.normcase(os.path.abspath(dst))) def copyfile(src, dst): """Copy data from src to dst""" if _samefile(src, dst): raise Error("`%s` and `%s` are the same file" % (src, dst)) for fn in [src, dst]: try: st = os.stat(fn) except OSError: # File most likely does not exist pass else: # XXX What about other special files? (sockets, devices...) if stat.S_ISFIFO(st.st_mode): raise SpecialFileError("`%s` is a named pipe" % fn) with open(src, 'rb') as fsrc: with open(dst, 'wb') as fdst: copyfileobj(fsrc, fdst) def copymode(src, dst): """Copy mode bits from src to dst""" if hasattr(os, 'chmod'): st = os.stat(src) mode = stat.S_IMODE(st.st_mode) os.chmod(dst, mode) def copystat(src, dst): """Copy all stat info (mode bits, atime, mtime, flags) from src to dst""" st = os.stat(src) mode = stat.S_IMODE(st.st_mode) if hasattr(os, 'utime'): os.utime(dst, (st.st_atime, st.st_mtime)) if hasattr(os, 'chmod'): os.chmod(dst, mode) if hasattr(os, 'chflags') and hasattr(st, 'st_flags'): try: os.chflags(dst, st.st_flags) except OSError as why: if (not hasattr(errno, 'EOPNOTSUPP') or why.errno != errno.EOPNOTSUPP): raise def copy(src, dst): """Copy data and mode bits ("cp src dst"). The destination may be a directory. """ if os.path.isdir(dst): dst = os.path.join(dst, os.path.basename(src)) copyfile(src, dst) copymode(src, dst) def copy2(src, dst): """Copy data and all stat info ("cp -p src dst"). The destination may be a directory. """ if os.path.isdir(dst): dst = os.path.join(dst, os.path.basename(src)) copyfile(src, dst) copystat(src, dst) def ignore_patterns(*patterns): """Function that can be used as copytree() ignore parameter. Patterns is a sequence of glob-style patterns that are used to exclude files""" def _ignore_patterns(path, names): ignored_names = [] for pattern in patterns: ignored_names.extend(fnmatch.filter(names, pattern)) return set(ignored_names) return _ignore_patterns def copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2, ignore_dangling_symlinks=False): """Recursively copy a directory tree. The destination directory must not already exist. If exception(s) occur, an Error is raised with a list of reasons. If the optional symlinks flag is true, symbolic links in the source tree result in symbolic links in the destination tree; if it is false, the contents of the files pointed to by symbolic links are copied. If the file pointed by the symlink doesn't exist, an exception will be added in the list of errors raised in an Error exception at the end of the copy process. You can set the optional ignore_dangling_symlinks flag to true if you want to silence this exception. Notice that this has no effect on platforms that don't support os.symlink. The optional ignore argument is a callable. If given, it is called with the `src` parameter, which is the directory being visited by copytree(), and `names` which is the list of `src` contents, as returned by os.listdir(): callable(src, names) -> ignored_names Since copytree() is called recursively, the callable will be called once for each directory that is copied. It returns a list of names relative to the `src` directory that should not be copied. The optional copy_function argument is a callable that will be used to copy each file. It will be called with the source path and the destination path as arguments. By default, copy2() is used, but any function that supports the same signature (like copy()) can be used. """ names = os.listdir(src) if ignore is not None: ignored_names = ignore(src, names) else: ignored_names = set() os.makedirs(dst) errors = [] for name in names: if name in ignored_names: continue srcname = os.path.join(src, name) dstname = os.path.join(dst, name) try: if os.path.islink(srcname): linkto = os.readlink(srcname) if symlinks: os.symlink(linkto, dstname) else: # ignore dangling symlink if the flag is on if not os.path.exists(linkto) and ignore_dangling_symlinks: continue # otherwise let the copy occurs. copy2 will raise an error copy_function(srcname, dstname) elif os.path.isdir(srcname): copytree(srcname, dstname, symlinks, ignore, copy_function) else: # Will raise a SpecialFileError for unsupported file types copy_function(srcname, dstname) # catch the Error from the recursive copytree so that we can # continue with other files except Error as err: errors.extend(err.args[0]) except EnvironmentError as why: errors.append((srcname, dstname, str(why))) try: copystat(src, dst) except OSError as why: if WindowsError is not None and isinstance(why, WindowsError): # Copying file access times may fail on Windows pass else: errors.extend((src, dst, str(why))) if errors: raise Error(errors) def rmtree(path, ignore_errors=False, onerror=None): """Recursively delete a directory tree. If ignore_errors is set, errors are ignored; otherwise, if onerror is set, it is called to handle the error with arguments (func, path, exc_info) where func is os.listdir, os.remove, or os.rmdir; path is the argument to that function that caused it to fail; and exc_info is a tuple returned by sys.exc_info(). If ignore_errors is false and onerror is None, an exception is raised. """ if ignore_errors: def onerror(*args): pass elif onerror is None: def onerror(*args): raise try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 raise OSError("Cannot call rmtree on a symbolic link") except OSError: onerror(os.path.islink, path, sys.exc_info()) # can't continue even if onerror hook returns return names = [] try: names = os.listdir(path) except os.error: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except os.error: mode = 0 if stat.S_ISDIR(mode): rmtree(fullname, ignore_errors, onerror) else: try: os.remove(fullname) except os.error: onerror(os.remove, fullname, sys.exc_info()) try: os.rmdir(path) except os.error: onerror(os.rmdir, path, sys.exc_info()) def _basename(path): # A basename() variant which first strips the trailing slash, if present. # Thus we always get the last component of the path, even for directories. return os.path.basename(path.rstrip(os.path.sep)) def move(src, dst): """Recursively move a file or directory to another location. This is similar to the Unix "mv" command. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already exists but is not a directory, it may be overwritten depending on os.rename() semantics. If the destination is on our current filesystem, then rename() is used. Otherwise, src is copied to the destination and then removed. A lot more could be done here... A look at a mv.c shows a lot of the issues this implementation glosses over. """ real_dst = dst if os.path.isdir(dst): if _samefile(src, dst): # We might be on a case insensitive filesystem, # perform the rename anyway. os.rename(src, dst) return real_dst = os.path.join(dst, _basename(src)) if os.path.exists(real_dst): raise Error("Destination path '%s' already exists" % real_dst) try: os.rename(src, real_dst) except OSError: if os.path.isdir(src): if _destinsrc(src, dst): raise Error("Cannot move a directory '%s' into itself '%s'." % (src, dst)) copytree(src, real_dst, symlinks=True) rmtree(src) else: copy2(src, real_dst) os.unlink(src) def _destinsrc(src, dst): src = abspath(src) dst = abspath(dst) if not src.endswith(os.path.sep): src += os.path.sep if not dst.endswith(os.path.sep): dst += os.path.sep return dst.startswith(src) def _get_gid(name): """Returns a gid, given a group name.""" if getgrnam is None or name is None: return None try: result = getgrnam(name) except KeyError: result = None if result is not None: return result[2] return None def _get_uid(name): """Returns an uid, given a user name.""" if getpwnam is None or name is None: return None try: result = getpwnam(name) except KeyError: result = None if result is not None: return result[2] return None def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0, owner=None, group=None, logger=None): """Create a (possibly compressed) tar file from all the files under 'base_dir'. 'compress' must be "gzip" (the default), "bzip2", or None. 'owner' and 'group' can be used to define an owner and a group for the archive that is being built. If not provided, the current owner and group will be used. The output tar file will be named 'base_name' + ".tar", possibly plus the appropriate compression extension (".gz", or ".bz2"). Returns the output filename. """ tar_compression = {'gzip': 'gz', None: ''} compress_ext = {'gzip': '.gz'} if _BZ2_SUPPORTED: tar_compression['bzip2'] = 'bz2' compress_ext['bzip2'] = '.bz2' # flags for compression program, each element of list will be an argument if compress is not None and compress not in compress_ext: raise ValueError("bad value for 'compress', or compression format not " "supported : {0}".format(compress)) archive_name = base_name + '.tar' + compress_ext.get(compress, '') archive_dir = os.path.dirname(archive_name) if not os.path.exists(archive_dir): if logger is not None: logger.info("creating %s", archive_dir) if not dry_run: os.makedirs(archive_dir) # creating the tarball if logger is not None: logger.info('Creating tar archive') uid = _get_uid(owner) gid = _get_gid(group) def _set_uid_gid(tarinfo): if gid is not None: tarinfo.gid = gid tarinfo.gname = group if uid is not None: tarinfo.uid = uid tarinfo.uname = owner return tarinfo if not dry_run: tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress]) try: tar.add(base_dir, filter=_set_uid_gid) finally: tar.close() return archive_name def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False): # XXX see if we want to keep an external call here if verbose: zipoptions = "-r" else: zipoptions = "-rq" from distutils.errors import DistutilsExecError from distutils.spawn import spawn try: spawn(["zip", zipoptions, zip_filename, base_dir], dry_run=dry_run) except DistutilsExecError: # XXX really should distinguish between "couldn't find # external 'zip' command" and "zip failed". raise ExecError("unable to create zip file '%s': " "could neither import the 'zipfile' module nor " "find a standalone zip utility") % zip_filename def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_name' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises ExecError. Returns the name of the output zip file. """ zip_filename = base_name + ".zip" archive_dir = os.path.dirname(base_name) if not os.path.exists(archive_dir): if logger is not None: logger.info("creating %s", archive_dir) if not dry_run: os.makedirs(archive_dir) # If zipfile module is not available, try spawning an external 'zip' # command. try: import zipfile except ImportError: zipfile = None if zipfile is None: _call_external_zip(base_dir, zip_filename, verbose, dry_run) else: if logger is not None: logger.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) if not dry_run: zip = zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_DEFLATED) for dirpath, dirnames, filenames in os.walk(base_dir): for name in filenames: path = os.path.normpath(os.path.join(dirpath, name)) if os.path.isfile(path): zip.write(path, path) if logger is not None: logger.info("adding '%s'", path) zip.close() return zip_filename _ARCHIVE_FORMATS = { 'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), 'bztar': (_make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"), 'tar': (_make_tarball, [('compress', None)], "uncompressed tar file"), 'zip': (_make_zipfile, [], "ZIP file"), } if _BZ2_SUPPORTED: _ARCHIVE_FORMATS['bztar'] = (_make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file") def get_archive_formats(): """Returns a list of supported formats for archiving and unarchiving. Each element of the returned sequence is a tuple (name, description) """ formats = [(name, registry[2]) for name, registry in _ARCHIVE_FORMATS.items()] formats.sort() return formats def register_archive_format(name, function, extra_args=None, description=''): """Registers an archive format. name is the name of the format. function is the callable that will be used to create archives. If provided, extra_args is a sequence of (name, value) tuples that will be passed as arguments to the callable. description can be provided to describe the format, and will be returned by the get_archive_formats() function. """ if extra_args is None: extra_args = [] if not isinstance(function, collections.Callable): raise TypeError('The %s object is not callable' % function) if not isinstance(extra_args, (tuple, list)): raise TypeError('extra_args needs to be a sequence') for element in extra_args: if not isinstance(element, (tuple, list)) or len(element) !=2: raise TypeError('extra_args elements are : (arg_name, value)') _ARCHIVE_FORMATS[name] = (function, extra_args, description) def unregister_archive_format(name): del _ARCHIVE_FORMATS[name] def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0, dry_run=0, owner=None, group=None, logger=None): """Create an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific extension; 'format' is the archive format: one of "zip", "tar", "bztar" or "gztar". 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir into 'root_dir' before creating the archive. 'base_dir' is the directory where we start archiving from; ie. 'base_dir' will be the common prefix of all files and directories in the archive. 'root_dir' and 'base_dir' both default to the current directory. Returns the name of the archive file. 'owner' and 'group' are used when creating a tar archive. By default, uses the current owner and group. """ save_cwd = os.getcwd() if root_dir is not None: if logger is not None: logger.debug("changing into '%s'", root_dir) base_name = os.path.abspath(base_name) if not dry_run: os.chdir(root_dir) if base_dir is None: base_dir = os.curdir kwargs = {'dry_run': dry_run, 'logger': logger} try: format_info = _ARCHIVE_FORMATS[format] except KeyError: raise ValueError("unknown archive format '%s'" % format) func = format_info[0] for arg, val in format_info[1]: kwargs[arg] = val if format != 'zip': kwargs['owner'] = owner kwargs['group'] = group try: filename = func(base_name, base_dir, **kwargs) finally: if root_dir is not None: if logger is not None: logger.debug("changing back to '%s'", save_cwd) os.chdir(save_cwd) return filename def get_unpack_formats(): """Returns a list of supported formats for unpacking. Each element of the returned sequence is a tuple (name, extensions, description) """ formats = [(name, info[0], info[3]) for name, info in _UNPACK_FORMATS.items()] formats.sort() return formats def _check_unpack_options(extensions, function, extra_args): """Checks what gets registered as an unpacker.""" # first make sure no other unpacker is registered for this extension existing_extensions = {} for name, info in _UNPACK_FORMATS.items(): for ext in info[0]: existing_extensions[ext] = name for extension in extensions: if extension in existing_extensions: msg = '%s is already registered for "%s"' raise RegistryError(msg % (extension, existing_extensions[extension])) if not isinstance(function, collections.Callable): raise TypeError('The registered function must be a callable') def register_unpack_format(name, extensions, function, extra_args=None, description=''): """Registers an unpack format. `name` is the name of the format. `extensions` is a list of extensions corresponding to the format. `function` is the callable that will be used to unpack archives. The callable will receive archives to unpack. If it's unable to handle an archive, it needs to raise a ReadError exception. If provided, `extra_args` is a sequence of (name, value) tuples that will be passed as arguments to the callable. description can be provided to describe the format, and will be returned by the get_unpack_formats() function. """ if extra_args is None: extra_args = [] _check_unpack_options(extensions, function, extra_args) _UNPACK_FORMATS[name] = extensions, function, extra_args, description def unregister_unpack_format(name): """Removes the pack format from the registry.""" del _UNPACK_FORMATS[name] def _ensure_directory(path): """Ensure that the parent directory of `path` exists""" dirname = os.path.dirname(path) if not os.path.isdir(dirname): os.makedirs(dirname) def _unpack_zipfile(filename, extract_dir): """Unpack zip `filename` to `extract_dir` """ try: import zipfile except ImportError: raise ReadError('zlib not supported, cannot unpack this archive.') if not zipfile.is_zipfile(filename): raise ReadError("%s is not a zip file" % filename) zip = zipfile.ZipFile(filename) try: for info in zip.infolist(): name = info.filename # don't extract absolute paths or ones with .. in them if name.startswith('/') or '..' in name: continue target = os.path.join(extract_dir, *name.split('/')) if not target: continue _ensure_directory(target) if not name.endswith('/'): # file data = zip.read(info.filename) f = open(target, 'wb') try: f.write(data) finally: f.close() del data finally: zip.close() def _unpack_tarfile(filename, extract_dir): """Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir` """ try: tarobj = tarfile.open(filename) except tarfile.TarError: raise ReadError( "%s is not a compressed or uncompressed tar file" % filename) try: tarobj.extractall(extract_dir) finally: tarobj.close() _UNPACK_FORMATS = { 'gztar': (['.tar.gz', '.tgz'], _unpack_tarfile, [], "gzip'ed tar-file"), 'tar': (['.tar'], _unpack_tarfile, [], "uncompressed tar file"), 'zip': (['.zip'], _unpack_zipfile, [], "ZIP file") } if _BZ2_SUPPORTED: _UNPACK_FORMATS['bztar'] = (['.bz2'], _unpack_tarfile, [], "bzip2'ed tar-file") def _find_unpack_format(filename): for name, info in _UNPACK_FORMATS.items(): for extension in info[0]: if filename.endswith(extension): return name return None def unpack_archive(filename, extract_dir=None, format=None): """Unpack an archive. `filename` is the name of the archive. `extract_dir` is the name of the target directory, where the archive is unpacked. If not provided, the current working directory is used. `format` is the archive format: one of "zip", "tar", or "gztar". Or any other registered format. If not provided, unpack_archive will use the filename extension and see if an unpacker was registered for that extension. In case none is found, a ValueError is raised. """ if extract_dir is None: extract_dir = os.getcwd() if format is not None: try: format_info = _UNPACK_FORMATS[format] except KeyError: raise ValueError("Unknown unpack format '{0}'".format(format)) func = format_info[1] func(filename, extract_dir, **dict(format_info[2])) else: # we need to look at the registered unpackers supported extensions format = _find_unpack_format(filename) if format is None: raise ReadError("Unknown archive format '{0}'".format(filename)) func = _UNPACK_FORMATS[format][1] kwargs = dict(_UNPACK_FORMATS[format][2]) func(filename, extract_dir, **kwargs) site-packages/pip/_vendor/distlib/_backport/shutil.pyc000064400000063526147204247350017157 0ustar00 abc@s"dZddlZddlZddlZddlmZddlZddlZddlZddl m Z yddl Z e Z Wnek reZ nXyddlmZWnek rdZnXyddlmZWnek rdZnXdd d d d d dddddddddddddddgZdefdYZdefdYZdefdYZd efd!YZd"efd#YZyeWnek rdZnXdWd&Zd'Z d(Z!d)Z"d*Z#d+Z$d,Z%d-Z&ede%ed.Z'edd/Z(d0Z)d1Z*d2Z+d3Z,d4Z-d5d6d6dddd7Z.eed8Z/d6d6dd9Z0ie.dXgd;fd<6e.dYgd>fd?6e.dZgd@fdA6e0gdBfdC6Z1e re.d[gd>fe1d?fe=d?dddVZ?dS(\sUtility functions for copying and archiving files and directory trees. XXX The functions here don't copy the resource fork or other metadata on Mac. iN(tabspathi(ttarfile(tgetpwnam(tgetgrnamt copyfileobjtcopyfiletcopymodetcopystattcopytcopy2tcopytreetmovetrmtreetErrortSpecialFileErrort ExecErrort make_archivetget_archive_formatstregister_archive_formattunregister_archive_formattget_unpack_formatstregister_unpack_formattunregister_unpack_formattunpack_archivetignore_patternscBseZRS((t__name__t __module__(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR ,scBseZdZRS(s|Raised when trying to do a kind of operation (e.g. copying) which is not supported on a special file (e.g. a named pipe)(RRt__doc__(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR/scBseZdZRS(s+Raised when a command could not be executed(RRR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR3st ReadErrorcBseZdZRS(s%Raised when an archive cannot be read(RRR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR6st RegistryErrorcBseZdZRS(sVRaised when a registry operation with the archiving and unpacking registries fails(RRR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR9siicCs1x*|j|}|sPn|j|qWdS(s=copy data from file-like object fsrc to file-like object fdstN(treadtwrite(tfsrctfdsttlengthtbuf((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRCs cCs{ttjdrAytjj||SWqAtk r=tSXntjjtjj|tjjtjj|kS(Ntsamefile(thasattrtostpathR$tOSErrortFalsetnormcaseR(tsrctdst((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt _samefileKs c Cst||r(td||fnx`||gD]R}ytj|}Wntk raq5Xtj|jr5td|q5q5Wt|d,}t|d}t ||WdQXWdQXdS(sCopy data from src to dsts`%s` and `%s` are the same files`%s` is a named pipetrbtwbN( R-R R&tstatR(tS_ISFIFOtst_modeRtopenR(R+R,tfntstR R!((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRWs cCsGttdrCtj|}tj|j}tj||ndS(sCopy mode bits from src to dsttchmodN(R%R&R0tS_IMODER2R6(R+R,R5tmode((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRkscCstj|}tj|j}ttdrOtj||j|jfnttdrqtj||nttdrt|drytj ||j Wqt k r}tt d s|j t j krqqXndS(sCCopy all stat info (mode bits, atime, mtime, flags) from src to dsttutimeR6tchflagstst_flagst EOPNOTSUPPN(R&R0R7R2R%R9tst_atimetst_mtimeR6R:R;R(terrnoR<(R+R,R5R8twhy((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRrscCsTtjj|r6tjj|tjj|}nt||t||dS(sVCopy data and mode bits ("cp src dst"). The destination may be a directory. N(R&R'tisdirtjointbasenameRR(R+R,((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRs$ cCsTtjj|r6tjj|tjj|}nt||t||dS(s]Copy data and all stat info ("cp -p src dst"). The destination may be a directory. N(R&R'RARBRCRR(R+R,((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR s$ csfd}|S(sFunction that can be used as copytree() ignore parameter. Patterns is a sequence of glob-style patterns that are used to exclude filescs:g}x'D]}|jtj||q Wt|S(N(textendtfnmatchtfiltertset(R'tnamest ignored_namestpattern(tpatterns(sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_ignore_patternss ((RKRL((RKsH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRscCs tj|}|dk r-|||}n t}tj|g}xG|D]?} | |krhqPntjj|| } tjj|| } ytjj| rtj| } |rtj | | q6tjj |  r|rwPn|| | n8tjj | r)t | | |||n || | WqPt k r`} |j| jdqPtk r}|j| | t|fqPXqPWyt||WnMtk r}tdk rt|trq|j||t|fnX|r t |ndS(sRecursively copy a directory tree. The destination directory must not already exist. If exception(s) occur, an Error is raised with a list of reasons. If the optional symlinks flag is true, symbolic links in the source tree result in symbolic links in the destination tree; if it is false, the contents of the files pointed to by symbolic links are copied. If the file pointed by the symlink doesn't exist, an exception will be added in the list of errors raised in an Error exception at the end of the copy process. You can set the optional ignore_dangling_symlinks flag to true if you want to silence this exception. Notice that this has no effect on platforms that don't support os.symlink. The optional ignore argument is a callable. If given, it is called with the `src` parameter, which is the directory being visited by copytree(), and `names` which is the list of `src` contents, as returned by os.listdir(): callable(src, names) -> ignored_names Since copytree() is called recursively, the callable will be called once for each directory that is copied. It returns a list of names relative to the `src` directory that should not be copied. The optional copy_function argument is a callable that will be used to copy each file. It will be called with the source path and the destination path as arguments. By default, copy2() is used, but any function that supports the same signature (like copy()) can be used. iN(R&tlistdirtNoneRGtmakedirsR'RBtislinktreadlinktsymlinktexistsRAR R RDtargstEnvironmentErrortappendtstrRR(t WindowsErrort isinstance(R+R,tsymlinkstignoret copy_functiontignore_dangling_symlinksRHRIterrorstnametsrcnametdstnametlinktoterrR@((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR sD$     $ cCs|rd}n|dkr*d}ny%tjj|rNtdnWn.tk r|tjj|tjdSXg}ytj|}Wn-tjk r|tj|tjnXx|D]}tjj ||}ytj |j }Wntjk rd}nXt j |r@t|||qytj|Wqtjk r|tj|tjqXqWytj|Wn-tjk r|tj|tjnXdS(sRecursively delete a directory tree. If ignore_errors is set, errors are ignored; otherwise, if onerror is set, it is called to handle the error with arguments (func, path, exc_info) where func is os.listdir, os.remove, or os.rmdir; path is the argument to that function that caused it to fail; and exc_info is a tuple returned by sys.exc_info(). If ignore_errors is false and onerror is None, an exception is raised. cWsdS(N((RT((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pytonerrorscWsdS(N((RT((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRdss%Cannot call rmtree on a symbolic linkNi(RNR&R'RPR(tsystexc_infoRMterrorRBtlstatR2R0tS_ISDIRR tremovetrmdir(R't ignore_errorsRdRHR_tfullnameR8((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR s>       !cCstjj|jtjjS(N(R&R'RCtrstriptsep(R'((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt _basename'scCs|}tjj|r~t||r;tj||dStjj|t|}tjj|r~td|q~nytj||Wnt k rtjj|rt ||rtd||fnt ||dt t |qt||tj|nXdS(sRecursively move a file or directory to another location. This is similar to the Unix "mv" command. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already exists but is not a directory, it may be overwritten depending on os.rename() semantics. If the destination is on our current filesystem, then rename() is used. Otherwise, src is copied to the destination and then removed. A lot more could be done here... A look at a mv.c shows a lot of the issues this implementation glosses over. Ns$Destination path '%s' already existss.Cannot move a directory '%s' into itself '%s'.RZ(R&R'RAR-trenameRBRpRSR R(t _destinsrcR tTrueR R tunlink(R+R,treal_dst((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR ,s$   cCsut|}t|}|jtjjs@|tjj7}n|jtjjsh|tjj7}n|j|S(N(RtendswithR&R'Rot startswith(R+R,((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRrTs  cCs^tdks|dkrdSyt|}Wntk rEd}nX|dk rZ|dSdS(s"Returns a gid, given a group name.iN(RRNtKeyError(R_tresult((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_get_gid]s   cCs^tdks|dkrdSyt|}Wntk rEd}nX|dk rZ|dSdS(s"Returns an uid, given a user name.iN(RRNRx(R_Ry((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_get_uidis   tgzipics|idd6dd6}idd6} tr>d|d s                       Q1  ( =/    6     %   site-packages/pip/_vendor/distlib/_backport/shutil.pyo000064400000063526147204247350017173 0ustar00 abc@s"dZddlZddlZddlZddlmZddlZddlZddlZddl m Z yddl Z e Z Wnek reZ nXyddlmZWnek rdZnXyddlmZWnek rdZnXdd d d d d dddddddddddddddgZdefdYZdefdYZdefdYZd efd!YZd"efd#YZyeWnek rdZnXdWd&Zd'Z d(Z!d)Z"d*Z#d+Z$d,Z%d-Z&ede%ed.Z'edd/Z(d0Z)d1Z*d2Z+d3Z,d4Z-d5d6d6dddd7Z.eed8Z/d6d6dd9Z0ie.dXgd;fd<6e.dYgd>fd?6e.dZgd@fdA6e0gdBfdC6Z1e re.d[gd>fe1d?fe=d?dddVZ?dS(\sUtility functions for copying and archiving files and directory trees. XXX The functions here don't copy the resource fork or other metadata on Mac. iN(tabspathi(ttarfile(tgetpwnam(tgetgrnamt copyfileobjtcopyfiletcopymodetcopystattcopytcopy2tcopytreetmovetrmtreetErrortSpecialFileErrort ExecErrort make_archivetget_archive_formatstregister_archive_formattunregister_archive_formattget_unpack_formatstregister_unpack_formattunregister_unpack_formattunpack_archivetignore_patternscBseZRS((t__name__t __module__(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR ,scBseZdZRS(s|Raised when trying to do a kind of operation (e.g. copying) which is not supported on a special file (e.g. a named pipe)(RRt__doc__(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR/scBseZdZRS(s+Raised when a command could not be executed(RRR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR3st ReadErrorcBseZdZRS(s%Raised when an archive cannot be read(RRR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR6st RegistryErrorcBseZdZRS(sVRaised when a registry operation with the archiving and unpacking registries fails(RRR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR9siicCs1x*|j|}|sPn|j|qWdS(s=copy data from file-like object fsrc to file-like object fdstN(treadtwrite(tfsrctfdsttlengthtbuf((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRCs cCs{ttjdrAytjj||SWqAtk r=tSXntjjtjj|tjjtjj|kS(Ntsamefile(thasattrtostpathR$tOSErrortFalsetnormcaseR(tsrctdst((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt _samefileKs c Cst||r(td||fnx`||gD]R}ytj|}Wntk raq5Xtj|jr5td|q5q5Wt|d,}t|d}t ||WdQXWdQXdS(sCopy data from src to dsts`%s` and `%s` are the same files`%s` is a named pipetrbtwbN( R-R R&tstatR(tS_ISFIFOtst_modeRtopenR(R+R,tfntstR R!((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRWs cCsGttdrCtj|}tj|j}tj||ndS(sCopy mode bits from src to dsttchmodN(R%R&R0tS_IMODER2R6(R+R,R5tmode((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRkscCstj|}tj|j}ttdrOtj||j|jfnttdrqtj||nttdrt|drytj ||j Wqt k r}tt d s|j t j krqqXndS(sCCopy all stat info (mode bits, atime, mtime, flags) from src to dsttutimeR6tchflagstst_flagst EOPNOTSUPPN(R&R0R7R2R%R9tst_atimetst_mtimeR6R:R;R(terrnoR<(R+R,R5R8twhy((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRrscCsTtjj|r6tjj|tjj|}nt||t||dS(sVCopy data and mode bits ("cp src dst"). The destination may be a directory. N(R&R'tisdirtjointbasenameRR(R+R,((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRs$ cCsTtjj|r6tjj|tjj|}nt||t||dS(s]Copy data and all stat info ("cp -p src dst"). The destination may be a directory. N(R&R'RARBRCRR(R+R,((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR s$ csfd}|S(sFunction that can be used as copytree() ignore parameter. Patterns is a sequence of glob-style patterns that are used to exclude filescs:g}x'D]}|jtj||q Wt|S(N(textendtfnmatchtfiltertset(R'tnamest ignored_namestpattern(tpatterns(sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_ignore_patternss ((RKRL((RKsH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRscCs tj|}|dk r-|||}n t}tj|g}xG|D]?} | |krhqPntjj|| } tjj|| } ytjj| rtj| } |rtj | | q6tjj |  r|rwPn|| | n8tjj | r)t | | |||n || | WqPt k r`} |j| jdqPtk r}|j| | t|fqPXqPWyt||WnMtk r}tdk rt|trq|j||t|fnX|r t |ndS(sRecursively copy a directory tree. The destination directory must not already exist. If exception(s) occur, an Error is raised with a list of reasons. If the optional symlinks flag is true, symbolic links in the source tree result in symbolic links in the destination tree; if it is false, the contents of the files pointed to by symbolic links are copied. If the file pointed by the symlink doesn't exist, an exception will be added in the list of errors raised in an Error exception at the end of the copy process. You can set the optional ignore_dangling_symlinks flag to true if you want to silence this exception. Notice that this has no effect on platforms that don't support os.symlink. The optional ignore argument is a callable. If given, it is called with the `src` parameter, which is the directory being visited by copytree(), and `names` which is the list of `src` contents, as returned by os.listdir(): callable(src, names) -> ignored_names Since copytree() is called recursively, the callable will be called once for each directory that is copied. It returns a list of names relative to the `src` directory that should not be copied. The optional copy_function argument is a callable that will be used to copy each file. It will be called with the source path and the destination path as arguments. By default, copy2() is used, but any function that supports the same signature (like copy()) can be used. iN(R&tlistdirtNoneRGtmakedirsR'RBtislinktreadlinktsymlinktexistsRAR R RDtargstEnvironmentErrortappendtstrRR(t WindowsErrort isinstance(R+R,tsymlinkstignoret copy_functiontignore_dangling_symlinksRHRIterrorstnametsrcnametdstnametlinktoterrR@((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR sD$     $ cCs|rd}n|dkr*d}ny%tjj|rNtdnWn.tk r|tjj|tjdSXg}ytj|}Wn-tjk r|tj|tjnXx|D]}tjj ||}ytj |j }Wntjk rd}nXt j |r@t|||qytj|Wqtjk r|tj|tjqXqWytj|Wn-tjk r|tj|tjnXdS(sRecursively delete a directory tree. If ignore_errors is set, errors are ignored; otherwise, if onerror is set, it is called to handle the error with arguments (func, path, exc_info) where func is os.listdir, os.remove, or os.rmdir; path is the argument to that function that caused it to fail; and exc_info is a tuple returned by sys.exc_info(). If ignore_errors is false and onerror is None, an exception is raised. cWsdS(N((RT((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pytonerrorscWsdS(N((RT((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRdss%Cannot call rmtree on a symbolic linkNi(RNR&R'RPR(tsystexc_infoRMterrorRBtlstatR2R0tS_ISDIRR tremovetrmdir(R't ignore_errorsRdRHR_tfullnameR8((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR s>       !cCstjj|jtjjS(N(R&R'RCtrstriptsep(R'((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt _basename'scCs|}tjj|r~t||r;tj||dStjj|t|}tjj|r~td|q~nytj||Wnt k rtjj|rt ||rtd||fnt ||dt t |qt||tj|nXdS(sRecursively move a file or directory to another location. This is similar to the Unix "mv" command. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already exists but is not a directory, it may be overwritten depending on os.rename() semantics. If the destination is on our current filesystem, then rename() is used. Otherwise, src is copied to the destination and then removed. A lot more could be done here... A look at a mv.c shows a lot of the issues this implementation glosses over. Ns$Destination path '%s' already existss.Cannot move a directory '%s' into itself '%s'.RZ(R&R'RAR-trenameRBRpRSR R(t _destinsrcR tTrueR R tunlink(R+R,treal_dst((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR ,s$   cCsut|}t|}|jtjjs@|tjj7}n|jtjjsh|tjj7}n|j|S(N(RtendswithR&R'Rot startswith(R+R,((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRrTs  cCs^tdks|dkrdSyt|}Wntk rEd}nX|dk rZ|dSdS(s"Returns a gid, given a group name.iN(RRNtKeyError(R_tresult((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_get_gid]s   cCs^tdks|dkrdSyt|}Wntk rEd}nX|dk rZ|dSdS(s"Returns an uid, given a user name.iN(RRNRx(R_Ry((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_get_uidis   tgzipics|idd6dd6}idd6} tr>d|d s                       Q1  ( =/    6     %   site-packages/pip/_vendor/distlib/_backport/sysconfig.cfg000064400000005071147204247350017606 0ustar00[posix_prefix] # Configuration directories. Some of these come straight out of the # configure script. They are for implementing the other variables, not to # be used directly in [resource_locations]. confdir = /etc datadir = /usr/share libdir = /usr/lib statedir = /var # User resource directory local = ~/.local/{distribution.name} stdlib = {base}/lib/python{py_version_short} platstdlib = {platbase}/lib/python{py_version_short} purelib = {base}/lib/python{py_version_short}/site-packages platlib = {platbase}/lib/python{py_version_short}/site-packages include = {base}/include/python{py_version_short}{abiflags} platinclude = {platbase}/include/python{py_version_short}{abiflags} data = {base} [posix_home] stdlib = {base}/lib/python platstdlib = {base}/lib/python purelib = {base}/lib/python platlib = {base}/lib/python include = {base}/include/python platinclude = {base}/include/python scripts = {base}/bin data = {base} [nt] stdlib = {base}/Lib platstdlib = {base}/Lib purelib = {base}/Lib/site-packages platlib = {base}/Lib/site-packages include = {base}/Include platinclude = {base}/Include scripts = {base}/Scripts data = {base} [os2] stdlib = {base}/Lib platstdlib = {base}/Lib purelib = {base}/Lib/site-packages platlib = {base}/Lib/site-packages include = {base}/Include platinclude = {base}/Include scripts = {base}/Scripts data = {base} [os2_home] stdlib = {userbase}/lib/python{py_version_short} platstdlib = {userbase}/lib/python{py_version_short} purelib = {userbase}/lib/python{py_version_short}/site-packages platlib = {userbase}/lib/python{py_version_short}/site-packages include = {userbase}/include/python{py_version_short} scripts = {userbase}/bin data = {userbase} [nt_user] stdlib = {userbase}/Python{py_version_nodot} platstdlib = {userbase}/Python{py_version_nodot} purelib = {userbase}/Python{py_version_nodot}/site-packages platlib = {userbase}/Python{py_version_nodot}/site-packages include = {userbase}/Python{py_version_nodot}/Include scripts = {userbase}/Scripts data = {userbase} [posix_user] stdlib = {userbase}/lib/python{py_version_short} platstdlib = {userbase}/lib/python{py_version_short} purelib = {userbase}/lib/python{py_version_short}/site-packages platlib = {userbase}/lib/python{py_version_short}/site-packages include = {userbase}/include/python{py_version_short} scripts = {userbase}/bin data = {userbase} [osx_framework_user] stdlib = {userbase}/lib/python platstdlib = {userbase}/lib/python purelib = {userbase}/lib/python/site-packages platlib = {userbase}/lib/python/site-packages include = {userbase}/include scripts = {userbase}/bin data = {userbase} site-packages/pip/_vendor/distlib/_backport/sysconfig.py000064400000064513147204247350017505 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # """Access to Python's configuration information.""" import codecs import os import re import sys from os.path import pardir, realpath try: import configparser except ImportError: import ConfigParser as configparser __all__ = [ 'get_config_h_filename', 'get_config_var', 'get_config_vars', 'get_makefile_filename', 'get_path', 'get_path_names', 'get_paths', 'get_platform', 'get_python_version', 'get_scheme_names', 'parse_config_h', ] def _safe_realpath(path): try: return realpath(path) except OSError: return path if sys.executable: _PROJECT_BASE = os.path.dirname(_safe_realpath(sys.executable)) else: # sys.executable can be empty if argv[0] has been changed and Python is # unable to retrieve the real program name _PROJECT_BASE = _safe_realpath(os.getcwd()) if os.name == "nt" and "pcbuild" in _PROJECT_BASE[-8:].lower(): _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir)) # PC/VS7.1 if os.name == "nt" and "\\pc\\v" in _PROJECT_BASE[-10:].lower(): _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir)) # PC/AMD64 if os.name == "nt" and "\\pcbuild\\amd64" in _PROJECT_BASE[-14:].lower(): _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir)) def is_python_build(): for fn in ("Setup.dist", "Setup.local"): if os.path.isfile(os.path.join(_PROJECT_BASE, "Modules", fn)): return True return False _PYTHON_BUILD = is_python_build() _cfg_read = False def _ensure_cfg_read(): global _cfg_read if not _cfg_read: from ..resources import finder backport_package = __name__.rsplit('.', 1)[0] _finder = finder(backport_package) _cfgfile = _finder.find('sysconfig.cfg') assert _cfgfile, 'sysconfig.cfg exists' with _cfgfile.as_stream() as s: _SCHEMES.readfp(s) if _PYTHON_BUILD: for scheme in ('posix_prefix', 'posix_home'): _SCHEMES.set(scheme, 'include', '{srcdir}/Include') _SCHEMES.set(scheme, 'platinclude', '{projectbase}/.') _cfg_read = True _SCHEMES = configparser.RawConfigParser() _VAR_REPL = re.compile(r'\{([^{]*?)\}') def _expand_globals(config): _ensure_cfg_read() if config.has_section('globals'): globals = config.items('globals') else: globals = tuple() sections = config.sections() for section in sections: if section == 'globals': continue for option, value in globals: if config.has_option(section, option): continue config.set(section, option, value) config.remove_section('globals') # now expanding local variables defined in the cfg file # for section in config.sections(): variables = dict(config.items(section)) def _replacer(matchobj): name = matchobj.group(1) if name in variables: return variables[name] return matchobj.group(0) for option, value in config.items(section): config.set(section, option, _VAR_REPL.sub(_replacer, value)) #_expand_globals(_SCHEMES) # FIXME don't rely on sys.version here, its format is an implementation detail # of CPython, use sys.version_info or sys.hexversion _PY_VERSION = sys.version.split()[0] _PY_VERSION_SHORT = sys.version[:3] _PY_VERSION_SHORT_NO_DOT = _PY_VERSION[0] + _PY_VERSION[2] _PREFIX = os.path.normpath(sys.prefix) _EXEC_PREFIX = os.path.normpath(sys.exec_prefix) _CONFIG_VARS = None _USER_BASE = None def _subst_vars(path, local_vars): """In the string `path`, replace tokens like {some.thing} with the corresponding value from the map `local_vars`. If there is no corresponding value, leave the token unchanged. """ def _replacer(matchobj): name = matchobj.group(1) if name in local_vars: return local_vars[name] elif name in os.environ: return os.environ[name] return matchobj.group(0) return _VAR_REPL.sub(_replacer, path) def _extend_dict(target_dict, other_dict): target_keys = target_dict.keys() for key, value in other_dict.items(): if key in target_keys: continue target_dict[key] = value def _expand_vars(scheme, vars): res = {} if vars is None: vars = {} _extend_dict(vars, get_config_vars()) for key, value in _SCHEMES.items(scheme): if os.name in ('posix', 'nt'): value = os.path.expanduser(value) res[key] = os.path.normpath(_subst_vars(value, vars)) return res def format_value(value, vars): def _replacer(matchobj): name = matchobj.group(1) if name in vars: return vars[name] return matchobj.group(0) return _VAR_REPL.sub(_replacer, value) def _get_default_scheme(): if os.name == 'posix': # the default scheme for posix is posix_prefix return 'posix_prefix' return os.name def _getuserbase(): env_base = os.environ.get("PYTHONUSERBASE", None) def joinuser(*args): return os.path.expanduser(os.path.join(*args)) # what about 'os2emx', 'riscos' ? if os.name == "nt": base = os.environ.get("APPDATA") or "~" if env_base: return env_base else: return joinuser(base, "Python") if sys.platform == "darwin": framework = get_config_var("PYTHONFRAMEWORK") if framework: if env_base: return env_base else: return joinuser("~", "Library", framework, "%d.%d" % sys.version_info[:2]) if env_base: return env_base else: return joinuser("~", ".local") def _parse_makefile(filename, vars=None): """Parse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. """ # Regexes needed for parsing Makefile (and similar syntaxes, # like old-style Setup files). _variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)") _findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)") _findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}") if vars is None: vars = {} done = {} notdone = {} with codecs.open(filename, encoding='utf-8', errors="surrogateescape") as f: lines = f.readlines() for line in lines: if line.startswith('#') or line.strip() == '': continue m = _variable_rx.match(line) if m: n, v = m.group(1, 2) v = v.strip() # `$$' is a literal `$' in make tmpv = v.replace('$$', '') if "$" in tmpv: notdone[n] = v else: try: v = int(v) except ValueError: # insert literal `$' done[n] = v.replace('$$', '$') else: done[n] = v # do variable interpolation here variables = list(notdone.keys()) # Variables with a 'PY_' prefix in the makefile. These need to # be made available without that prefix through sysconfig. # Special care is needed to ensure that variable expansion works, even # if the expansion uses the name without a prefix. renamed_variables = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS') while len(variables) > 0: for name in tuple(variables): value = notdone[name] m = _findvar1_rx.search(value) or _findvar2_rx.search(value) if m is not None: n = m.group(1) found = True if n in done: item = str(done[n]) elif n in notdone: # get it on a subsequent round found = False elif n in os.environ: # do it like make: fall back to environment item = os.environ[n] elif n in renamed_variables: if (name.startswith('PY_') and name[3:] in renamed_variables): item = "" elif 'PY_' + n in notdone: found = False else: item = str(done['PY_' + n]) else: done[n] = item = "" if found: after = value[m.end():] value = value[:m.start()] + item + after if "$" in after: notdone[name] = value else: try: value = int(value) except ValueError: done[name] = value.strip() else: done[name] = value variables.remove(name) if (name.startswith('PY_') and name[3:] in renamed_variables): name = name[3:] if name not in done: done[name] = value else: # bogus variable reference (e.g. "prefix=$/opt/python"); # just drop it since we can't deal done[name] = value variables.remove(name) # strip spurious spaces for k, v in done.items(): if isinstance(v, str): done[k] = v.strip() # save the results in the global dictionary vars.update(done) return vars def get_makefile_filename(): """Return the path of the Makefile.""" if _PYTHON_BUILD: return os.path.join(_PROJECT_BASE, "Makefile") if hasattr(sys, 'abiflags'): config_dir_name = 'config-%s%s' % (_PY_VERSION_SHORT, sys.abiflags) else: config_dir_name = 'config' return os.path.join(get_path('stdlib'), config_dir_name, 'Makefile') def _init_posix(vars): """Initialize the module as appropriate for POSIX systems.""" # load the installed Makefile: makefile = get_makefile_filename() try: _parse_makefile(makefile, vars) except IOError as e: msg = "invalid Python installation: unable to open %s" % makefile if hasattr(e, "strerror"): msg = msg + " (%s)" % e.strerror raise IOError(msg) # load the installed pyconfig.h: config_h = get_config_h_filename() try: with open(config_h) as f: parse_config_h(f, vars) except IOError as e: msg = "invalid Python installation: unable to open %s" % config_h if hasattr(e, "strerror"): msg = msg + " (%s)" % e.strerror raise IOError(msg) # On AIX, there are wrong paths to the linker scripts in the Makefile # -- these paths are relative to the Python source, but when installed # the scripts are in another directory. if _PYTHON_BUILD: vars['LDSHARED'] = vars['BLDSHARED'] def _init_non_posix(vars): """Initialize the module as appropriate for NT""" # set basic install directories vars['LIBDEST'] = get_path('stdlib') vars['BINLIBDEST'] = get_path('platstdlib') vars['INCLUDEPY'] = get_path('include') vars['SO'] = '.pyd' vars['EXE'] = '.exe' vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable)) # # public APIs # def parse_config_h(fp, vars=None): """Parse a config.h-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. """ if vars is None: vars = {} define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n") undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n") while True: line = fp.readline() if not line: break m = define_rx.match(line) if m: n, v = m.group(1, 2) try: v = int(v) except ValueError: pass vars[n] = v else: m = undef_rx.match(line) if m: vars[m.group(1)] = 0 return vars def get_config_h_filename(): """Return the path of pyconfig.h.""" if _PYTHON_BUILD: if os.name == "nt": inc_dir = os.path.join(_PROJECT_BASE, "PC") else: inc_dir = _PROJECT_BASE else: inc_dir = get_path('platinclude') return os.path.join(inc_dir, 'pyconfig.h') def get_scheme_names(): """Return a tuple containing the schemes names.""" return tuple(sorted(_SCHEMES.sections())) def get_path_names(): """Return a tuple containing the paths names.""" # xxx see if we want a static list return _SCHEMES.options('posix_prefix') def get_paths(scheme=_get_default_scheme(), vars=None, expand=True): """Return a mapping containing an install scheme. ``scheme`` is the install scheme name. If not provided, it will return the default scheme for the current platform. """ _ensure_cfg_read() if expand: return _expand_vars(scheme, vars) else: return dict(_SCHEMES.items(scheme)) def get_path(name, scheme=_get_default_scheme(), vars=None, expand=True): """Return a path corresponding to the scheme. ``scheme`` is the install scheme name. """ return get_paths(scheme, vars, expand)[name] def get_config_vars(*args): """With no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows and Mac OS it's a much smaller set. With arguments, return a list of values that result from looking up each argument in the configuration variable dictionary. """ global _CONFIG_VARS if _CONFIG_VARS is None: _CONFIG_VARS = {} # Normalized versions of prefix and exec_prefix are handy to have; # in fact, these are the standard versions used most places in the # distutils2 module. _CONFIG_VARS['prefix'] = _PREFIX _CONFIG_VARS['exec_prefix'] = _EXEC_PREFIX _CONFIG_VARS['py_version'] = _PY_VERSION _CONFIG_VARS['py_version_short'] = _PY_VERSION_SHORT _CONFIG_VARS['py_version_nodot'] = _PY_VERSION[0] + _PY_VERSION[2] _CONFIG_VARS['base'] = _PREFIX _CONFIG_VARS['platbase'] = _EXEC_PREFIX _CONFIG_VARS['projectbase'] = _PROJECT_BASE try: _CONFIG_VARS['abiflags'] = sys.abiflags except AttributeError: # sys.abiflags may not be defined on all platforms. _CONFIG_VARS['abiflags'] = '' if os.name in ('nt', 'os2'): _init_non_posix(_CONFIG_VARS) if os.name == 'posix': _init_posix(_CONFIG_VARS) # Setting 'userbase' is done below the call to the # init function to enable using 'get_config_var' in # the init-function. if sys.version >= '2.6': _CONFIG_VARS['userbase'] = _getuserbase() if 'srcdir' not in _CONFIG_VARS: _CONFIG_VARS['srcdir'] = _PROJECT_BASE else: _CONFIG_VARS['srcdir'] = _safe_realpath(_CONFIG_VARS['srcdir']) # Convert srcdir into an absolute path if it appears necessary. # Normally it is relative to the build directory. However, during # testing, for example, we might be running a non-installed python # from a different directory. if _PYTHON_BUILD and os.name == "posix": base = _PROJECT_BASE try: cwd = os.getcwd() except OSError: cwd = None if (not os.path.isabs(_CONFIG_VARS['srcdir']) and base != cwd): # srcdir is relative and we are not in the same directory # as the executable. Assume executable is in the build # directory and make srcdir absolute. srcdir = os.path.join(base, _CONFIG_VARS['srcdir']) _CONFIG_VARS['srcdir'] = os.path.normpath(srcdir) if sys.platform == 'darwin': kernel_version = os.uname()[2] # Kernel version (8.4.3) major_version = int(kernel_version.split('.')[0]) if major_version < 8: # On macOS before 10.4, check if -arch and -isysroot # are in CFLAGS or LDFLAGS and remove them if they are. # This is needed when building extensions on a 10.3 system # using a universal build of python. for key in ('LDFLAGS', 'BASECFLAGS', # a number of derived variables. These need to be # patched up as well. 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): flags = _CONFIG_VARS[key] flags = re.sub('-arch\s+\w+\s', ' ', flags) flags = re.sub('-isysroot [^ \t]*', ' ', flags) _CONFIG_VARS[key] = flags else: # Allow the user to override the architecture flags using # an environment variable. # NOTE: This name was introduced by Apple in OSX 10.5 and # is used by several scripting languages distributed with # that OS release. if 'ARCHFLAGS' in os.environ: arch = os.environ['ARCHFLAGS'] for key in ('LDFLAGS', 'BASECFLAGS', # a number of derived variables. These need to be # patched up as well. 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): flags = _CONFIG_VARS[key] flags = re.sub('-arch\s+\w+\s', ' ', flags) flags = flags + ' ' + arch _CONFIG_VARS[key] = flags # If we're on OSX 10.5 or later and the user tries to # compiles an extension using an SDK that is not present # on the current machine it is better to not use an SDK # than to fail. # # The major usecase for this is users using a Python.org # binary installer on OSX 10.6: that installer uses # the 10.4u SDK, but that SDK is not installed by default # when you install Xcode. # CFLAGS = _CONFIG_VARS.get('CFLAGS', '') m = re.search('-isysroot\s+(\S+)', CFLAGS) if m is not None: sdk = m.group(1) if not os.path.exists(sdk): for key in ('LDFLAGS', 'BASECFLAGS', # a number of derived variables. These need to be # patched up as well. 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): flags = _CONFIG_VARS[key] flags = re.sub('-isysroot\s+\S+(\s|$)', ' ', flags) _CONFIG_VARS[key] = flags if args: vals = [] for name in args: vals.append(_CONFIG_VARS.get(name)) return vals else: return _CONFIG_VARS def get_config_var(name): """Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name) """ return get_config_vars().get(name) def get_platform(): """Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information included depends on the OS; eg. for IRIX the architecture isn't particularly important (IRIX only runs on SGI hardware), but for Linux the kernel version isn't particularly important. Examples of returned values: linux-i586 linux-alpha (?) solaris-2.6-sun4u irix-5.3 irix64-6.2 Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) win-ia64 (64bit Windows on Itanium) win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. """ if os.name == 'nt': # sniff sys.version for architecture. prefix = " bit (" i = sys.version.find(prefix) if i == -1: return sys.platform j = sys.version.find(")", i) look = sys.version[i+len(prefix):j].lower() if look == 'amd64': return 'win-amd64' if look == 'itanium': return 'win-ia64' return sys.platform if os.name != "posix" or not hasattr(os, 'uname'): # XXX what about the architecture? NT is Intel or Alpha, # Mac OS is M68k or PPC, etc. return sys.platform # Try to distinguish various flavours of Unix osname, host, release, version, machine = os.uname() # Convert the OS name to lowercase, remove '/' characters # (to accommodate BSD/OS), and translate spaces (for "Power Macintosh") osname = osname.lower().replace('/', '') machine = machine.replace(' ', '_') machine = machine.replace('/', '-') if osname[:5] == "linux": # At least on Linux/Intel, 'machine' is the processor -- # i386, etc. # XXX what about Alpha, SPARC, etc? return "%s-%s" % (osname, machine) elif osname[:5] == "sunos": if release[0] >= "5": # SunOS 5 == Solaris 2 osname = "solaris" release = "%d.%s" % (int(release[0]) - 3, release[2:]) # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) elif osname[:3] == "aix": return "%s-%s.%s" % (osname, version, release) elif osname[:6] == "cygwin": osname = "cygwin" rel_re = re.compile(r'[\d.]+') m = rel_re.match(release) if m: release = m.group() elif osname[:6] == "darwin": # # For our purposes, we'll assume that the system version from # distutils' perspective is what MACOSX_DEPLOYMENT_TARGET is set # to. This makes the compatibility story a bit more sane because the # machine is going to compile and link as if it were # MACOSX_DEPLOYMENT_TARGET. cfgvars = get_config_vars() macver = cfgvars.get('MACOSX_DEPLOYMENT_TARGET') if True: # Always calculate the release of the running machine, # needed to determine if we can build fat binaries or not. macrelease = macver # Get the system version. Reading this plist is a documented # way to get the system version (see the documentation for # the Gestalt Manager) try: f = open('/System/Library/CoreServices/SystemVersion.plist') except IOError: # We're on a plain darwin box, fall back to the default # behaviour. pass else: try: m = re.search(r'ProductUserVisibleVersion\s*' r'(.*?)', f.read()) finally: f.close() if m is not None: macrelease = '.'.join(m.group(1).split('.')[:2]) # else: fall back to the default behaviour if not macver: macver = macrelease if macver: release = macver osname = "macosx" if ((macrelease + '.') >= '10.4.' and '-arch' in get_config_vars().get('CFLAGS', '').strip()): # The universal build will build fat binaries, but not on # systems before 10.4 # # Try to detect 4-way universal builds, those have machine-type # 'universal' instead of 'fat'. machine = 'fat' cflags = get_config_vars().get('CFLAGS') archs = re.findall('-arch\s+(\S+)', cflags) archs = tuple(sorted(set(archs))) if len(archs) == 1: machine = archs[0] elif archs == ('i386', 'ppc'): machine = 'fat' elif archs == ('i386', 'x86_64'): machine = 'intel' elif archs == ('i386', 'ppc', 'x86_64'): machine = 'fat3' elif archs == ('ppc64', 'x86_64'): machine = 'fat64' elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'): machine = 'universal' else: raise ValueError( "Don't know machine value for archs=%r" % (archs,)) elif machine == 'i386': # On OSX the machine type returned by uname is always the # 32-bit variant, even if the executable architecture is # the 64-bit variant if sys.maxsize >= 2**32: machine = 'x86_64' elif machine in ('PowerPC', 'Power_Macintosh'): # Pick a sane name for the PPC architecture. # See 'i386' case if sys.maxsize >= 2**32: machine = 'ppc64' else: machine = 'ppc' return "%s-%s-%s" % (osname, release, machine) def get_python_version(): return _PY_VERSION_SHORT def _print_dict(title, data): for index, (key, value) in enumerate(sorted(data.items())): if index == 0: print('%s: ' % (title)) print('\t%s = "%s"' % (key, value)) def _main(): """Display all information sysconfig detains.""" print('Platform: "%s"' % get_platform()) print('Python version: "%s"' % get_python_version()) print('Current installation scheme: "%s"' % _get_default_scheme()) print() _print_dict('Paths', get_paths()) print() _print_dict('Variables', get_config_vars()) if __name__ == '__main__': _main() site-packages/pip/_vendor/distlib/_backport/sysconfig.pyc000064400000050502147204247350017641 0ustar00 abc @s_dZddlZddlZddlZddlZddlmZmZyddlZWne k r{ddl ZnXdddddd d d d d dg Z dZ ej rejje ej Zne ejZejdkr(dedjkr(e ejjeeZnejdkrndedjkrne ejjeeeZnejdkrdedjkre ejjeeeZndZeZeadZejZejdZdZejj dZ!ejd Z"e!de!dZ#ejj$ej%Z&ejj$ej'Z(da*dZ+dZ,dZ-d Z.d!Z/d"Z0d#Z1dd$Z2d%Z3d&Z4d'Z5dd(Z6d)Z7d*Z8d+Z9e0de:d,Z;e0de:d-Z<d.Z=d/Z>d0Z?d1Z@d2ZAd3ZBeCd4kr[eBndS(5s-Access to Python's configuration information.iN(tpardirtrealpathtget_config_h_filenametget_config_vartget_config_varstget_makefile_filenametget_pathtget_path_namest get_pathst get_platformtget_python_versiontget_scheme_namestparse_config_hcCs'yt|SWntk r"|SXdS(N(RtOSError(tpath((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt_safe_realpath"s tnttpcbuildis\pc\vis\pcbuild\amd64icCs=x6dD].}tjjtjjtd|rtSqWtS(Ns Setup.dists Setup.localtModules(s Setup.dists Setup.local(tosRtisfiletjoint _PROJECT_BASEtTruetFalse(tfn((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pytis_python_build:s $cCstsddlm}tjddd}||}|jd}|sYtd|j}tj |WdQXt rx7dD],}tj |d d tj |d d qWnt andS(Ni(tfindert.iis sysconfig.cfgssysconfig.cfg existst posix_prefixt posix_hometincludes{srcdir}/Includet platincludes{projectbase}/.(RR( t _cfg_readt resourcesRt__name__trsplittfindtAssertionErrort as_streamt_SCHEMEStreadfpt _PYTHON_BUILDtsetR(Rtbackport_packaget_findert_cfgfiletstscheme((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt_ensure_cfg_readDs  s \{([^{]*?)\}cs-t|jdr(|jd}n t}|j}xb|D]Z}|dkr\qDnx?|D]7\}}|j||rqcn|j|||qcWqDW|jdxw|jD]i}t|j|fd}x<|j|D]+\}}|j||t j ||qWqWdS(Ntglobalscs0|jd}|kr#|S|jdS(Nii(tgroup(tmatchobjtname(t variables(sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt _replaceros ( R1t has_sectiontitemsttupletsectionst has_optionR+tremove_sectiontdictt _VAR_REPLtsub(tconfigR2R;tsectiontoptiontvalueR7((R6sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt_expand_globalsYs$     iiicsfd}tj||S(sIn the string `path`, replace tokens like {some.thing} with the corresponding value from the map `local_vars`. If there is no corresponding value, leave the token unchanged. csJ|jd}|kr#|S|tjkr=tj|S|jdS(Nii(R3Rtenviron(R4R5(t local_vars(sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyR7s   (R?R@(RRGR7((RGsK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt _subst_varsscCsI|j}x6|jD](\}}||kr7qn|||dttjf}nd}tjjt d|dS(s Return the path of the Makefile.tMakefiletabiflagss config-%s%sRAtstdlib( R*RRRRthasattrRbt_PY_VERSION_SHORTRR(tconfig_dir_name((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyRMs cCst}yt||WnLtk rh}d|}t|drY|d|j}nt|nXt}y&t|}t||WdQXWnLtk r}d|}t|dr|d|j}nt|nXtr|d|dR(R9(R0RStexpand((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyRs cCst||||S(s[Return a path corresponding to the scheme. ``scheme`` is the install scheme name. (R(R5R0RSR((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyRscGstd"krRiattdkrd4}qI|d?krd5}qIt d6|fqL|d.krtj!d@krId0}qIqL|dAkrLtj!dBkr@d3}qId/}qLqOnd:|||fS(CsReturn a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information included depends on the OS; eg. for IRIX the architecture isn't particularly important (IRIX only runs on SGI hardware), but for Linux the kernel version isn't particularly important. Examples of returned values: linux-i586 linux-alpha (?) solaris-2.6-sun4u irix-5.3 irix64-6.2 Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) win-ia64 (64bit Windows on Itanium) win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. Rs bit (it)tamd64s win-amd64titaniumswin-ia64RORt/RmRt_t-itlinuxs%s-%stsunosit5tsolariss%d.%siiitirixtaixs%s-%s.%sitcygwins[\d.]+R^tMACOSX_DEPLOYMENT_TARGETs0/System/Library/CoreServices/SystemVersion.plists=ProductUserVisibleVersion\s*(.*?)NRitmacosxs10.4.s-archRotfats -arch\s+(\S+)ti386tppctx86_64tinteltfat3tppc64tfat64t universals%Don't know machine value for archs=%ri tPowerPCtPower_Macintoshs%s-%s-%s(RR(RR(RRR(RR(RRRRI(RRI("RR5RbRR%RcRtlowerRRR{R|RsRtRzR3RRaRRvRRtreadtcloseRPRRRytfindallR:RR+R}tmaxsize(RtitjtlooktosnamethosttreleaseRtmachinetrel_reRtcfgvarstmacvert macreleaseRtcflagstarchs((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyR [s    (     + !               cCstS(N(R(((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyR scCsZxStt|jD]9\}\}}|dkrCd|GHnd||fGHqWdS(Nis%s: s %s = "%s"(t enumerateRR9(ttitletdatatindexRMRD((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt _print_dicts+  cCsRdtGHdtGHdtGHdGHtdtdGHtdtdS( s*Display all information sysconfig detains.sPlatform: "%s"sPython version: "%s"s!Current installation scheme: "%s"tPathst VariablesN(((R R RWRRR(((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt_mains   t__main__(Dt__doc__RuRRsRbtos.pathRRt configparsert ImportErrort ConfigParsert__all__RRRRRRR5RRRR*RR!R1tRawConfigParserR(RtR?RERRRRRRRRRRRRPRt _USER_BASERHRNRURVRWRhRRRRR RR RRRRRRR R RRR#(((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyts        %%!%!     #      v         site-packages/pip/_vendor/distlib/_backport/sysconfig.pyo000064400000050402147204247350017654 0ustar00 abc @s_dZddlZddlZddlZddlZddlmZmZyddlZWne k r{ddl ZnXdddddd d d d d dg Z dZ ej rejje ej Zne ejZejdkr(dedjkr(e ejjeeZnejdkrndedjkrne ejjeeeZnejdkrdedjkre ejjeeeZndZeZeadZejZejdZdZejj dZ!ejd Z"e!de!dZ#ejj$ej%Z&ejj$ej'Z(da*dZ+dZ,dZ-d Z.d!Z/d"Z0d#Z1dd$Z2d%Z3d&Z4d'Z5dd(Z6d)Z7d*Z8d+Z9e0de:d,Z;e0de:d-Z<d.Z=d/Z>d0Z?d1Z@d2ZAd3ZBeCd4kr[eBndS(5s-Access to Python's configuration information.iN(tpardirtrealpathtget_config_h_filenametget_config_vartget_config_varstget_makefile_filenametget_pathtget_path_namest get_pathst get_platformtget_python_versiontget_scheme_namestparse_config_hcCs'yt|SWntk r"|SXdS(N(RtOSError(tpath((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt_safe_realpath"s tnttpcbuildis\pc\vis\pcbuild\amd64icCs=x6dD].}tjjtjjtd|rtSqWtS(Ns Setup.dists Setup.localtModules(s Setup.dists Setup.local(tosRtisfiletjoint _PROJECT_BASEtTruetFalse(tfn((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pytis_python_build:s $cCstsddlm}tjddd}||}|jd}|j}tj|WdQXt rx7d D],}tj |d d tj |d d qvWnt andS(Ni(tfindert.iis sysconfig.cfgt posix_prefixt posix_hometincludes{srcdir}/Includet platincludes{projectbase}/.(RR( t _cfg_readt resourcesRt__name__trsplittfindt as_streamt_SCHEMEStreadfpt _PYTHON_BUILDtsetR(Rtbackport_packaget_findert_cfgfiletstscheme((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt_ensure_cfg_readDs  s \{([^{]*?)\}cs-t|jdr(|jd}n t}|j}xb|D]Z}|dkr\qDnx?|D]7\}}|j||rqcn|j|||qcWqDW|jdxw|jD]i}t|j|fd}x<|j|D]+\}}|j||t j ||qWqWdS(Ntglobalscs0|jd}|kr#|S|jdS(Nii(tgroup(tmatchobjtname(t variables(sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt _replaceros ( R0t has_sectiontitemsttupletsectionst has_optionR*tremove_sectiontdictt _VAR_REPLtsub(tconfigR1R:tsectiontoptiontvalueR6((R5sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt_expand_globalsYs$     iiicsfd}tj||S(sIn the string `path`, replace tokens like {some.thing} with the corresponding value from the map `local_vars`. If there is no corresponding value, leave the token unchanged. csJ|jd}|kr#|S|tjkr=tj|S|jdS(Nii(R2Rtenviron(R3R4(t local_vars(sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyR6s   (R>R?(RRFR6((RFsK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt _subst_varsscCsI|j}x6|jD](\}}||kr7qn|||R?(RCRRR6((RRsK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt format_valuescCstjdkrdStjS(NRNR(RR4(((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt_get_default_schemescCstjjdd}d}tjdkr_tjjdpBd}|rO|S||dSntjdkrtd}|r|r|S|dd |d tjd Sqn|r|S|dd SdS( NtPYTHONUSERBASEcWstjjtjj|S(N(RRRPR(targs((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pytjoinusersRtAPPDATAt~tPythontdarwintPYTHONFRAMEWORKtLibrarys%d.%dis.local( RREtgetROR4tsystplatformRt version_info(tenv_baseRYtbaset framework((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt _getuserbases"  cCstjd}tjd}tjd}|dkrBi}ni}i}tj|dddd}|j}WdQXx|D]} | jd s| jd krqn|j| } | r| j d d \} } | j} | j d d } d| kr| || dttjf}nd}tjjt d|dS(s Return the path of the Makefile.tMakefiletabiflagss config-%s%sR@tstdlib( R)RRRRthasattrRat_PY_VERSION_SHORTRR(tconfig_dir_name((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyRMs cCst}yt||WnLtk rh}d|}t|drY|d|j}nt|nXt}y&t|}t||WdQXWnLtk r}d|}t|dr|d|j}nt|nXtr|d|dkrd4}qI|d?krd5}qIt d6|fqL|d.krtj!d@krId0}qIqL|dAkrLtj!dBkr@d3}qId/}qLqOnd:|||fS(CsReturn a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information included depends on the OS; eg. for IRIX the architecture isn't particularly important (IRIX only runs on SGI hardware), but for Linux the kernel version isn't particularly important. Examples of returned values: linux-i586 linux-alpha (?) solaris-2.6-sun4u irix-5.3 irix64-6.2 Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) win-ia64 (64bit Windows on Itanium) win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. Rs bit (it)tamd64s win-amd64titaniumswin-ia64RNRt/RlRt_t-itlinuxs%s-%stsunosit5tsolariss%d.%siiitirixtaixs%s-%s.%sitcygwins[\d.]+R]tMACOSX_DEPLOYMENT_TARGETs0/System/Library/CoreServices/SystemVersion.plists=ProductUserVisibleVersion\s*(.*?)NRitmacosxs10.4.s-archRntfats -arch\s+(\S+)ti386tppctx86_64tinteltfat3tppc64tfat64t universals%Don't know machine value for archs=%ri tPowerPCtPower_Macintoshs%s-%s-%s(RR(RR(RRR(RR(RRRRI(RRI("RR4RaRR%RbR~tlowerRRRzR{RrRsRyR2RR`RRuRRtreadtcloseRORRRxtfindallR9RR*R|tmaxsize(RtitjtlooktosnamethosttreleaseRtmachinetrel_reRtcfgvarstmacvert macreleaseRtcflagstarchs((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyR [s    (     + !               cCstS(N(R(((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyR scCsZxStt|jD]9\}\}}|dkrCd|GHnd||fGHqWdS(Nis%s: s %s = "%s"(t enumerateRR8(ttitletdatatindexRLRC((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt _print_dicts+  cCsRdtGHdtGHdtGHdGHtdtdGHtdtdS( s*Display all information sysconfig detains.sPlatform: "%s"sPython version: "%s"s!Current installation scheme: "%s"tPathst VariablesN(((R R RVRRR(((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyt_mains   t__main__(Dt__doc__RtRRrRatos.pathRRt configparsert ImportErrort ConfigParsert__all__RRRRRRR4RRRR)RR!R0tRawConfigParserR'RsR>RDRRRRRRQRRRRRORt _USER_BASERGRMRTRURVRgRRRRR RR RRRRRRR R RRR#(((sK/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyts        %%!%!     #      v         site-packages/pip/_vendor/distlib/_backport/tarfile.py000064400000264724147204247350017135 0ustar00#------------------------------------------------------------------- # tarfile.py #------------------------------------------------------------------- # Copyright (C) 2002 Lars Gustaebel # All rights reserved. # # 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: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # 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. # from __future__ import print_function """Read from and write to tar format archives. """ __version__ = "$Revision$" version = "0.9.0" __author__ = "Lars Gust\u00e4bel (lars@gustaebel.de)" __date__ = "$Date: 2011-02-25 17:42:01 +0200 (Fri, 25 Feb 2011) $" __cvsid__ = "$Id: tarfile.py 88586 2011-02-25 15:42:01Z marc-andre.lemburg $" __credits__ = "Gustavo Niemeyer, Niels Gust\u00e4bel, Richard Townsend." #--------- # Imports #--------- import sys import os import stat import errno import time import struct import copy import re try: import grp, pwd except ImportError: grp = pwd = None # os.symlink on Windows prior to 6.0 raises NotImplementedError symlink_exception = (AttributeError, NotImplementedError) try: # WindowsError (1314) will be raised if the caller does not hold the # SeCreateSymbolicLinkPrivilege privilege symlink_exception += (WindowsError,) except NameError: pass # from tarfile import * __all__ = ["TarFile", "TarInfo", "is_tarfile", "TarError"] if sys.version_info[0] < 3: import __builtin__ as builtins else: import builtins _open = builtins.open # Since 'open' is TarFile.open #--------------------------------------------------------- # tar constants #--------------------------------------------------------- NUL = b"\0" # the null character BLOCKSIZE = 512 # length of processing blocks RECORDSIZE = BLOCKSIZE * 20 # length of records GNU_MAGIC = b"ustar \0" # magic gnu tar string POSIX_MAGIC = b"ustar\x0000" # magic posix tar string LENGTH_NAME = 100 # maximum length of a filename LENGTH_LINK = 100 # maximum length of a linkname LENGTH_PREFIX = 155 # maximum length of the prefix field REGTYPE = b"0" # regular file AREGTYPE = b"\0" # regular file LNKTYPE = b"1" # link (inside tarfile) SYMTYPE = b"2" # symbolic link CHRTYPE = b"3" # character special device BLKTYPE = b"4" # block special device DIRTYPE = b"5" # directory FIFOTYPE = b"6" # fifo special device CONTTYPE = b"7" # contiguous file GNUTYPE_LONGNAME = b"L" # GNU tar longname GNUTYPE_LONGLINK = b"K" # GNU tar longlink GNUTYPE_SPARSE = b"S" # GNU tar sparse file XHDTYPE = b"x" # POSIX.1-2001 extended header XGLTYPE = b"g" # POSIX.1-2001 global header SOLARIS_XHDTYPE = b"X" # Solaris extended header USTAR_FORMAT = 0 # POSIX.1-1988 (ustar) format GNU_FORMAT = 1 # GNU tar format PAX_FORMAT = 2 # POSIX.1-2001 (pax) format DEFAULT_FORMAT = GNU_FORMAT #--------------------------------------------------------- # tarfile constants #--------------------------------------------------------- # File types that tarfile supports: SUPPORTED_TYPES = (REGTYPE, AREGTYPE, LNKTYPE, SYMTYPE, DIRTYPE, FIFOTYPE, CONTTYPE, CHRTYPE, BLKTYPE, GNUTYPE_LONGNAME, GNUTYPE_LONGLINK, GNUTYPE_SPARSE) # File types that will be treated as a regular file. REGULAR_TYPES = (REGTYPE, AREGTYPE, CONTTYPE, GNUTYPE_SPARSE) # File types that are part of the GNU tar format. GNU_TYPES = (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK, GNUTYPE_SPARSE) # Fields from a pax header that override a TarInfo attribute. PAX_FIELDS = ("path", "linkpath", "size", "mtime", "uid", "gid", "uname", "gname") # Fields from a pax header that are affected by hdrcharset. PAX_NAME_FIELDS = set(("path", "linkpath", "uname", "gname")) # Fields in a pax header that are numbers, all other fields # are treated as strings. PAX_NUMBER_FIELDS = { "atime": float, "ctime": float, "mtime": float, "uid": int, "gid": int, "size": int } #--------------------------------------------------------- # Bits used in the mode field, values in octal. #--------------------------------------------------------- S_IFLNK = 0o120000 # symbolic link S_IFREG = 0o100000 # regular file S_IFBLK = 0o060000 # block device S_IFDIR = 0o040000 # directory S_IFCHR = 0o020000 # character device S_IFIFO = 0o010000 # fifo TSUID = 0o4000 # set UID on execution TSGID = 0o2000 # set GID on execution TSVTX = 0o1000 # reserved TUREAD = 0o400 # read by owner TUWRITE = 0o200 # write by owner TUEXEC = 0o100 # execute/search by owner TGREAD = 0o040 # read by group TGWRITE = 0o020 # write by group TGEXEC = 0o010 # execute/search by group TOREAD = 0o004 # read by other TOWRITE = 0o002 # write by other TOEXEC = 0o001 # execute/search by other #--------------------------------------------------------- # initialization #--------------------------------------------------------- if os.name in ("nt", "ce"): ENCODING = "utf-8" else: ENCODING = sys.getfilesystemencoding() #--------------------------------------------------------- # Some useful functions #--------------------------------------------------------- def stn(s, length, encoding, errors): """Convert a string to a null-terminated bytes object. """ s = s.encode(encoding, errors) return s[:length] + (length - len(s)) * NUL def nts(s, encoding, errors): """Convert a null-terminated bytes object to a string. """ p = s.find(b"\0") if p != -1: s = s[:p] return s.decode(encoding, errors) def nti(s): """Convert a number field to a python number. """ # There are two possible encodings for a number field, see # itn() below. if s[0] != chr(0o200): try: n = int(nts(s, "ascii", "strict") or "0", 8) except ValueError: raise InvalidHeaderError("invalid header") else: n = 0 for i in range(len(s) - 1): n <<= 8 n += ord(s[i + 1]) return n def itn(n, digits=8, format=DEFAULT_FORMAT): """Convert a python number to a number field. """ # POSIX 1003.1-1988 requires numbers to be encoded as a string of # octal digits followed by a null-byte, this allows values up to # (8**(digits-1))-1. GNU tar allows storing numbers greater than # that if necessary. A leading 0o200 byte indicates this particular # encoding, the following digits-1 bytes are a big-endian # representation. This allows values up to (256**(digits-1))-1. if 0 <= n < 8 ** (digits - 1): s = ("%0*o" % (digits - 1, n)).encode("ascii") + NUL else: if format != GNU_FORMAT or n >= 256 ** (digits - 1): raise ValueError("overflow in number field") if n < 0: # XXX We mimic GNU tar's behaviour with negative numbers, # this could raise OverflowError. n = struct.unpack("L", struct.pack("l", n))[0] s = bytearray() for i in range(digits - 1): s.insert(0, n & 0o377) n >>= 8 s.insert(0, 0o200) return s def calc_chksums(buf): """Calculate the checksum for a member's header by summing up all characters except for the chksum field which is treated as if it was filled with spaces. According to the GNU tar sources, some tars (Sun and NeXT) calculate chksum with signed char, which will be different if there are chars in the buffer with the high bit set. So we calculate two checksums, unsigned and signed. """ unsigned_chksum = 256 + sum(struct.unpack("148B", buf[:148]) + struct.unpack("356B", buf[156:512])) signed_chksum = 256 + sum(struct.unpack("148b", buf[:148]) + struct.unpack("356b", buf[156:512])) return unsigned_chksum, signed_chksum def copyfileobj(src, dst, length=None): """Copy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content. """ if length == 0: return if length is None: while True: buf = src.read(16*1024) if not buf: break dst.write(buf) return BUFSIZE = 16 * 1024 blocks, remainder = divmod(length, BUFSIZE) for b in range(blocks): buf = src.read(BUFSIZE) if len(buf) < BUFSIZE: raise IOError("end of file reached") dst.write(buf) if remainder != 0: buf = src.read(remainder) if len(buf) < remainder: raise IOError("end of file reached") dst.write(buf) return filemode_table = ( ((S_IFLNK, "l"), (S_IFREG, "-"), (S_IFBLK, "b"), (S_IFDIR, "d"), (S_IFCHR, "c"), (S_IFIFO, "p")), ((TUREAD, "r"),), ((TUWRITE, "w"),), ((TUEXEC|TSUID, "s"), (TSUID, "S"), (TUEXEC, "x")), ((TGREAD, "r"),), ((TGWRITE, "w"),), ((TGEXEC|TSGID, "s"), (TSGID, "S"), (TGEXEC, "x")), ((TOREAD, "r"),), ((TOWRITE, "w"),), ((TOEXEC|TSVTX, "t"), (TSVTX, "T"), (TOEXEC, "x")) ) def filemode(mode): """Convert a file's mode to a string of the form -rwxrwxrwx. Used by TarFile.list() """ perm = [] for table in filemode_table: for bit, char in table: if mode & bit == bit: perm.append(char) break else: perm.append("-") return "".join(perm) class TarError(Exception): """Base exception.""" pass class ExtractError(TarError): """General exception for extract errors.""" pass class ReadError(TarError): """Exception for unreadable tar archives.""" pass class CompressionError(TarError): """Exception for unavailable compression methods.""" pass class StreamError(TarError): """Exception for unsupported operations on stream-like TarFiles.""" pass class HeaderError(TarError): """Base exception for header errors.""" pass class EmptyHeaderError(HeaderError): """Exception for empty headers.""" pass class TruncatedHeaderError(HeaderError): """Exception for truncated headers.""" pass class EOFHeaderError(HeaderError): """Exception for end of file headers.""" pass class InvalidHeaderError(HeaderError): """Exception for invalid headers.""" pass class SubsequentHeaderError(HeaderError): """Exception for missing and invalid extended headers.""" pass #--------------------------- # internal stream interface #--------------------------- class _LowLevelFile(object): """Low-level file object. Supports reading and writing. It is used instead of a regular file object for streaming access. """ def __init__(self, name, mode): mode = { "r": os.O_RDONLY, "w": os.O_WRONLY | os.O_CREAT | os.O_TRUNC, }[mode] if hasattr(os, "O_BINARY"): mode |= os.O_BINARY self.fd = os.open(name, mode, 0o666) def close(self): os.close(self.fd) def read(self, size): return os.read(self.fd, size) def write(self, s): os.write(self.fd, s) class _Stream(object): """Class that serves as an adapter between TarFile and a stream-like object. The stream-like object only needs to have a read() or write() method and is accessed blockwise. Use of gzip or bzip2 compression is possible. A stream-like object could be for example: sys.stdin, sys.stdout, a socket, a tape device etc. _Stream is intended to be used only internally. """ def __init__(self, name, mode, comptype, fileobj, bufsize): """Construct a _Stream object. """ self._extfileobj = True if fileobj is None: fileobj = _LowLevelFile(name, mode) self._extfileobj = False if comptype == '*': # Enable transparent compression detection for the # stream interface fileobj = _StreamProxy(fileobj) comptype = fileobj.getcomptype() self.name = name or "" self.mode = mode self.comptype = comptype self.fileobj = fileobj self.bufsize = bufsize self.buf = b"" self.pos = 0 self.closed = False try: if comptype == "gz": try: import zlib except ImportError: raise CompressionError("zlib module is not available") self.zlib = zlib self.crc = zlib.crc32(b"") if mode == "r": self._init_read_gz() else: self._init_write_gz() if comptype == "bz2": try: import bz2 except ImportError: raise CompressionError("bz2 module is not available") if mode == "r": self.dbuf = b"" self.cmp = bz2.BZ2Decompressor() else: self.cmp = bz2.BZ2Compressor() except: if not self._extfileobj: self.fileobj.close() self.closed = True raise def __del__(self): if hasattr(self, "closed") and not self.closed: self.close() def _init_write_gz(self): """Initialize for writing with gzip compression. """ self.cmp = self.zlib.compressobj(9, self.zlib.DEFLATED, -self.zlib.MAX_WBITS, self.zlib.DEF_MEM_LEVEL, 0) timestamp = struct.pack(" self.bufsize: self.fileobj.write(self.buf[:self.bufsize]) self.buf = self.buf[self.bufsize:] def close(self): """Close the _Stream object. No operation should be done on it afterwards. """ if self.closed: return if self.mode == "w" and self.comptype != "tar": self.buf += self.cmp.flush() if self.mode == "w" and self.buf: self.fileobj.write(self.buf) self.buf = b"" if self.comptype == "gz": # The native zlib crc is an unsigned 32-bit integer, but # the Python wrapper implicitly casts that to a signed C # long. So, on a 32-bit box self.crc may "look negative", # while the same crc on a 64-bit box may "look positive". # To avoid irksome warnings from the `struct` module, force # it to look positive on all boxes. self.fileobj.write(struct.pack("= 0: blocks, remainder = divmod(pos - self.pos, self.bufsize) for i in range(blocks): self.read(self.bufsize) self.read(remainder) else: raise StreamError("seeking backwards is not allowed") return self.pos def read(self, size=None): """Return the next size number of bytes from the stream. If size is not defined, return all bytes of the stream up to EOF. """ if size is None: t = [] while True: buf = self._read(self.bufsize) if not buf: break t.append(buf) buf = "".join(t) else: buf = self._read(size) self.pos += len(buf) return buf def _read(self, size): """Return size bytes from the stream. """ if self.comptype == "tar": return self.__read(size) c = len(self.dbuf) while c < size: buf = self.__read(self.bufsize) if not buf: break try: buf = self.cmp.decompress(buf) except IOError: raise ReadError("invalid compressed data") self.dbuf += buf c += len(buf) buf = self.dbuf[:size] self.dbuf = self.dbuf[size:] return buf def __read(self, size): """Return size bytes from stream. If internal buffer is empty, read another block from the stream. """ c = len(self.buf) while c < size: buf = self.fileobj.read(self.bufsize) if not buf: break self.buf += buf c += len(buf) buf = self.buf[:size] self.buf = self.buf[size:] return buf # class _Stream class _StreamProxy(object): """Small proxy class that enables transparent compression detection for the Stream interface (mode 'r|*'). """ def __init__(self, fileobj): self.fileobj = fileobj self.buf = self.fileobj.read(BLOCKSIZE) def read(self, size): self.read = self.fileobj.read return self.buf def getcomptype(self): if self.buf.startswith(b"\037\213\010"): return "gz" if self.buf.startswith(b"BZh91"): return "bz2" return "tar" def close(self): self.fileobj.close() # class StreamProxy class _BZ2Proxy(object): """Small proxy class that enables external file object support for "r:bz2" and "w:bz2" modes. This is actually a workaround for a limitation in bz2 module's BZ2File class which (unlike gzip.GzipFile) has no support for a file object argument. """ blocksize = 16 * 1024 def __init__(self, fileobj, mode): self.fileobj = fileobj self.mode = mode self.name = getattr(self.fileobj, "name", None) self.init() def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor() def read(self, size): x = len(self.buf) while x < size: raw = self.fileobj.read(self.blocksize) if not raw: break data = self.bz2obj.decompress(raw) self.buf += data x += len(data) buf = self.buf[:size] self.buf = self.buf[size:] self.pos += len(buf) return buf def seek(self, pos): if pos < self.pos: self.init() self.read(pos - self.pos) def tell(self): return self.pos def write(self, data): self.pos += len(data) raw = self.bz2obj.compress(data) self.fileobj.write(raw) def close(self): if self.mode == "w": raw = self.bz2obj.flush() self.fileobj.write(raw) # class _BZ2Proxy #------------------------ # Extraction file object #------------------------ class _FileInFile(object): """A thin wrapper around an existing file object that provides a part of its data as an individual file object. """ def __init__(self, fileobj, offset, size, blockinfo=None): self.fileobj = fileobj self.offset = offset self.size = size self.position = 0 if blockinfo is None: blockinfo = [(0, size)] # Construct a map with data and zero blocks. self.map_index = 0 self.map = [] lastpos = 0 realpos = self.offset for offset, size in blockinfo: if offset > lastpos: self.map.append((False, lastpos, offset, None)) self.map.append((True, offset, offset + size, realpos)) realpos += size lastpos = offset + size if lastpos < self.size: self.map.append((False, lastpos, self.size, None)) def seekable(self): if not hasattr(self.fileobj, "seekable"): # XXX gzip.GzipFile and bz2.BZ2File return True return self.fileobj.seekable() def tell(self): """Return the current file position. """ return self.position def seek(self, position): """Seek to a position in the file. """ self.position = position def read(self, size=None): """Read data from the file. """ if size is None: size = self.size - self.position else: size = min(size, self.size - self.position) buf = b"" while size > 0: while True: data, start, stop, offset = self.map[self.map_index] if start <= self.position < stop: break else: self.map_index += 1 if self.map_index == len(self.map): self.map_index = 0 length = min(size, stop - self.position) if data: self.fileobj.seek(offset + (self.position - start)) buf += self.fileobj.read(length) else: buf += NUL * length size -= length self.position += length return buf #class _FileInFile class ExFileObject(object): """File-like object for reading an archive member. Is returned by TarFile.extractfile(). """ blocksize = 1024 def __init__(self, tarfile, tarinfo): self.fileobj = _FileInFile(tarfile.fileobj, tarinfo.offset_data, tarinfo.size, tarinfo.sparse) self.name = tarinfo.name self.mode = "r" self.closed = False self.size = tarinfo.size self.position = 0 self.buffer = b"" def readable(self): return True def writable(self): return False def seekable(self): return self.fileobj.seekable() def read(self, size=None): """Read at most size bytes from the file. If size is not present or None, read all data until EOF is reached. """ if self.closed: raise ValueError("I/O operation on closed file") buf = b"" if self.buffer: if size is None: buf = self.buffer self.buffer = b"" else: buf = self.buffer[:size] self.buffer = self.buffer[size:] if size is None: buf += self.fileobj.read() else: buf += self.fileobj.read(size - len(buf)) self.position += len(buf) return buf # XXX TextIOWrapper uses the read1() method. read1 = read def readline(self, size=-1): """Read one entire line from the file. If size is present and non-negative, return a string with at most that size, which may be an incomplete line. """ if self.closed: raise ValueError("I/O operation on closed file") pos = self.buffer.find(b"\n") + 1 if pos == 0: # no newline found. while True: buf = self.fileobj.read(self.blocksize) self.buffer += buf if not buf or b"\n" in buf: pos = self.buffer.find(b"\n") + 1 if pos == 0: # no newline found. pos = len(self.buffer) break if size != -1: pos = min(size, pos) buf = self.buffer[:pos] self.buffer = self.buffer[pos:] self.position += len(buf) return buf def readlines(self): """Return a list with all remaining lines. """ result = [] while True: line = self.readline() if not line: break result.append(line) return result def tell(self): """Return the current file position. """ if self.closed: raise ValueError("I/O operation on closed file") return self.position def seek(self, pos, whence=os.SEEK_SET): """Seek to a position in the file. """ if self.closed: raise ValueError("I/O operation on closed file") if whence == os.SEEK_SET: self.position = min(max(pos, 0), self.size) elif whence == os.SEEK_CUR: if pos < 0: self.position = max(self.position + pos, 0) else: self.position = min(self.position + pos, self.size) elif whence == os.SEEK_END: self.position = max(min(self.size + pos, self.size), 0) else: raise ValueError("Invalid argument") self.buffer = b"" self.fileobj.seek(self.position) def close(self): """Close the file object. """ self.closed = True def __iter__(self): """Get an iterator over the file's lines. """ while True: line = self.readline() if not line: break yield line #class ExFileObject #------------------ # Exported Classes #------------------ class TarInfo(object): """Informational class which holds the details about an archive member given by a tar header block. TarInfo objects are returned by TarFile.getmember(), TarFile.getmembers() and TarFile.gettarinfo() and are usually created internally. """ __slots__ = ("name", "mode", "uid", "gid", "size", "mtime", "chksum", "type", "linkname", "uname", "gname", "devmajor", "devminor", "offset", "offset_data", "pax_headers", "sparse", "tarfile", "_sparse_structs", "_link_target") def __init__(self, name=""): """Construct a TarInfo object. name is the optional name of the member. """ self.name = name # member name self.mode = 0o644 # file permissions self.uid = 0 # user id self.gid = 0 # group id self.size = 0 # file size self.mtime = 0 # modification time self.chksum = 0 # header checksum self.type = REGTYPE # member type self.linkname = "" # link name self.uname = "" # user name self.gname = "" # group name self.devmajor = 0 # device major number self.devminor = 0 # device minor number self.offset = 0 # the tar header starts here self.offset_data = 0 # the file's data starts here self.sparse = None # sparse member information self.pax_headers = {} # pax header information # In pax headers the "name" and "linkname" field are called # "path" and "linkpath". def _getpath(self): return self.name def _setpath(self, name): self.name = name path = property(_getpath, _setpath) def _getlinkpath(self): return self.linkname def _setlinkpath(self, linkname): self.linkname = linkname linkpath = property(_getlinkpath, _setlinkpath) def __repr__(self): return "<%s %r at %#x>" % (self.__class__.__name__,self.name,id(self)) def get_info(self): """Return the TarInfo's attributes as a dictionary. """ info = { "name": self.name, "mode": self.mode & 0o7777, "uid": self.uid, "gid": self.gid, "size": self.size, "mtime": self.mtime, "chksum": self.chksum, "type": self.type, "linkname": self.linkname, "uname": self.uname, "gname": self.gname, "devmajor": self.devmajor, "devminor": self.devminor } if info["type"] == DIRTYPE and not info["name"].endswith("/"): info["name"] += "/" return info def tobuf(self, format=DEFAULT_FORMAT, encoding=ENCODING, errors="surrogateescape"): """Return a tar header as a string of 512 byte blocks. """ info = self.get_info() if format == USTAR_FORMAT: return self.create_ustar_header(info, encoding, errors) elif format == GNU_FORMAT: return self.create_gnu_header(info, encoding, errors) elif format == PAX_FORMAT: return self.create_pax_header(info, encoding) else: raise ValueError("invalid format") def create_ustar_header(self, info, encoding, errors): """Return the object as a ustar header block. """ info["magic"] = POSIX_MAGIC if len(info["linkname"]) > LENGTH_LINK: raise ValueError("linkname is too long") if len(info["name"]) > LENGTH_NAME: info["prefix"], info["name"] = self._posix_split_name(info["name"]) return self._create_header(info, USTAR_FORMAT, encoding, errors) def create_gnu_header(self, info, encoding, errors): """Return the object as a GNU header block sequence. """ info["magic"] = GNU_MAGIC buf = b"" if len(info["linkname"]) > LENGTH_LINK: buf += self._create_gnu_long_header(info["linkname"], GNUTYPE_LONGLINK, encoding, errors) if len(info["name"]) > LENGTH_NAME: buf += self._create_gnu_long_header(info["name"], GNUTYPE_LONGNAME, encoding, errors) return buf + self._create_header(info, GNU_FORMAT, encoding, errors) def create_pax_header(self, info, encoding): """Return the object as a ustar header block. If it cannot be represented this way, prepend a pax extended header sequence with supplement information. """ info["magic"] = POSIX_MAGIC pax_headers = self.pax_headers.copy() # Test string fields for values that exceed the field length or cannot # be represented in ASCII encoding. for name, hname, length in ( ("name", "path", LENGTH_NAME), ("linkname", "linkpath", LENGTH_LINK), ("uname", "uname", 32), ("gname", "gname", 32)): if hname in pax_headers: # The pax header has priority. continue # Try to encode the string as ASCII. try: info[name].encode("ascii", "strict") except UnicodeEncodeError: pax_headers[hname] = info[name] continue if len(info[name]) > length: pax_headers[hname] = info[name] # Test number fields for values that exceed the field limit or values # that like to be stored as float. for name, digits in (("uid", 8), ("gid", 8), ("size", 12), ("mtime", 12)): if name in pax_headers: # The pax header has priority. Avoid overflow. info[name] = 0 continue val = info[name] if not 0 <= val < 8 ** (digits - 1) or isinstance(val, float): pax_headers[name] = str(val) info[name] = 0 # Create a pax extended header if necessary. if pax_headers: buf = self._create_pax_generic_header(pax_headers, XHDTYPE, encoding) else: buf = b"" return buf + self._create_header(info, USTAR_FORMAT, "ascii", "replace") @classmethod def create_pax_global_header(cls, pax_headers): """Return the object as a pax global header block sequence. """ return cls._create_pax_generic_header(pax_headers, XGLTYPE, "utf8") def _posix_split_name(self, name): """Split a name longer than 100 chars into a prefix and a name part. """ prefix = name[:LENGTH_PREFIX + 1] while prefix and prefix[-1] != "/": prefix = prefix[:-1] name = name[len(prefix):] prefix = prefix[:-1] if not prefix or len(name) > LENGTH_NAME: raise ValueError("name is too long") return prefix, name @staticmethod def _create_header(info, format, encoding, errors): """Return a header block. info is a dictionary with file information, format must be one of the *_FORMAT constants. """ parts = [ stn(info.get("name", ""), 100, encoding, errors), itn(info.get("mode", 0) & 0o7777, 8, format), itn(info.get("uid", 0), 8, format), itn(info.get("gid", 0), 8, format), itn(info.get("size", 0), 12, format), itn(info.get("mtime", 0), 12, format), b" ", # checksum field info.get("type", REGTYPE), stn(info.get("linkname", ""), 100, encoding, errors), info.get("magic", POSIX_MAGIC), stn(info.get("uname", ""), 32, encoding, errors), stn(info.get("gname", ""), 32, encoding, errors), itn(info.get("devmajor", 0), 8, format), itn(info.get("devminor", 0), 8, format), stn(info.get("prefix", ""), 155, encoding, errors) ] buf = struct.pack("%ds" % BLOCKSIZE, b"".join(parts)) chksum = calc_chksums(buf[-BLOCKSIZE:])[0] buf = buf[:-364] + ("%06o\0" % chksum).encode("ascii") + buf[-357:] return buf @staticmethod def _create_payload(payload): """Return the string payload filled with zero bytes up to the next 512 byte border. """ blocks, remainder = divmod(len(payload), BLOCKSIZE) if remainder > 0: payload += (BLOCKSIZE - remainder) * NUL return payload @classmethod def _create_gnu_long_header(cls, name, type, encoding, errors): """Return a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence for name. """ name = name.encode(encoding, errors) + NUL info = {} info["name"] = "././@LongLink" info["type"] = type info["size"] = len(name) info["magic"] = GNU_MAGIC # create extended header + name blocks. return cls._create_header(info, USTAR_FORMAT, encoding, errors) + \ cls._create_payload(name) @classmethod def _create_pax_generic_header(cls, pax_headers, type, encoding): """Return a POSIX.1-2008 extended or global header sequence that contains a list of keyword, value pairs. The values must be strings. """ # Check if one of the fields contains surrogate characters and thereby # forces hdrcharset=BINARY, see _proc_pax() for more information. binary = False for keyword, value in pax_headers.items(): try: value.encode("utf8", "strict") except UnicodeEncodeError: binary = True break records = b"" if binary: # Put the hdrcharset field at the beginning of the header. records += b"21 hdrcharset=BINARY\n" for keyword, value in pax_headers.items(): keyword = keyword.encode("utf8") if binary: # Try to restore the original byte representation of `value'. # Needless to say, that the encoding must match the string. value = value.encode(encoding, "surrogateescape") else: value = value.encode("utf8") l = len(keyword) + len(value) + 3 # ' ' + '=' + '\n' n = p = 0 while True: n = l + len(str(p)) if n == p: break p = n records += bytes(str(p), "ascii") + b" " + keyword + b"=" + value + b"\n" # We use a hardcoded "././@PaxHeader" name like star does # instead of the one that POSIX recommends. info = {} info["name"] = "././@PaxHeader" info["type"] = type info["size"] = len(records) info["magic"] = POSIX_MAGIC # Create pax header + record blocks. return cls._create_header(info, USTAR_FORMAT, "ascii", "replace") + \ cls._create_payload(records) @classmethod def frombuf(cls, buf, encoding, errors): """Construct a TarInfo object from a 512 byte bytes object. """ if len(buf) == 0: raise EmptyHeaderError("empty header") if len(buf) != BLOCKSIZE: raise TruncatedHeaderError("truncated header") if buf.count(NUL) == BLOCKSIZE: raise EOFHeaderError("end of file header") chksum = nti(buf[148:156]) if chksum not in calc_chksums(buf): raise InvalidHeaderError("bad checksum") obj = cls() obj.name = nts(buf[0:100], encoding, errors) obj.mode = nti(buf[100:108]) obj.uid = nti(buf[108:116]) obj.gid = nti(buf[116:124]) obj.size = nti(buf[124:136]) obj.mtime = nti(buf[136:148]) obj.chksum = chksum obj.type = buf[156:157] obj.linkname = nts(buf[157:257], encoding, errors) obj.uname = nts(buf[265:297], encoding, errors) obj.gname = nts(buf[297:329], encoding, errors) obj.devmajor = nti(buf[329:337]) obj.devminor = nti(buf[337:345]) prefix = nts(buf[345:500], encoding, errors) # Old V7 tar format represents a directory as a regular # file with a trailing slash. if obj.type == AREGTYPE and obj.name.endswith("/"): obj.type = DIRTYPE # The old GNU sparse format occupies some of the unused # space in the buffer for up to 4 sparse structures. # Save the them for later processing in _proc_sparse(). if obj.type == GNUTYPE_SPARSE: pos = 386 structs = [] for i in range(4): try: offset = nti(buf[pos:pos + 12]) numbytes = nti(buf[pos + 12:pos + 24]) except ValueError: break structs.append((offset, numbytes)) pos += 24 isextended = bool(buf[482]) origsize = nti(buf[483:495]) obj._sparse_structs = (structs, isextended, origsize) # Remove redundant slashes from directories. if obj.isdir(): obj.name = obj.name.rstrip("/") # Reconstruct a ustar longname. if prefix and obj.type not in GNU_TYPES: obj.name = prefix + "/" + obj.name return obj @classmethod def fromtarfile(cls, tarfile): """Return the next TarInfo object from TarFile object tarfile. """ buf = tarfile.fileobj.read(BLOCKSIZE) obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors) obj.offset = tarfile.fileobj.tell() - BLOCKSIZE return obj._proc_member(tarfile) #-------------------------------------------------------------------------- # The following are methods that are called depending on the type of a # member. The entry point is _proc_member() which can be overridden in a # subclass to add custom _proc_*() methods. A _proc_*() method MUST # implement the following # operations: # 1. Set self.offset_data to the position where the data blocks begin, # if there is data that follows. # 2. Set tarfile.offset to the position where the next member's header will # begin. # 3. Return self or another valid TarInfo object. def _proc_member(self, tarfile): """Choose the right processing method depending on the type and call it. """ if self.type in (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK): return self._proc_gnulong(tarfile) elif self.type == GNUTYPE_SPARSE: return self._proc_sparse(tarfile) elif self.type in (XHDTYPE, XGLTYPE, SOLARIS_XHDTYPE): return self._proc_pax(tarfile) else: return self._proc_builtin(tarfile) def _proc_builtin(self, tarfile): """Process a builtin type or an unknown type which will be treated as a regular file. """ self.offset_data = tarfile.fileobj.tell() offset = self.offset_data if self.isreg() or self.type not in SUPPORTED_TYPES: # Skip the following data blocks. offset += self._block(self.size) tarfile.offset = offset # Patch the TarInfo object with saved global # header information. self._apply_pax_info(tarfile.pax_headers, tarfile.encoding, tarfile.errors) return self def _proc_gnulong(self, tarfile): """Process the blocks that hold a GNU longname or longlink member. """ buf = tarfile.fileobj.read(self._block(self.size)) # Fetch the next header and process it. try: next = self.fromtarfile(tarfile) except HeaderError: raise SubsequentHeaderError("missing or bad subsequent header") # Patch the TarInfo object from the next header with # the longname information. next.offset = self.offset if self.type == GNUTYPE_LONGNAME: next.name = nts(buf, tarfile.encoding, tarfile.errors) elif self.type == GNUTYPE_LONGLINK: next.linkname = nts(buf, tarfile.encoding, tarfile.errors) return next def _proc_sparse(self, tarfile): """Process a GNU sparse header plus extra headers. """ # We already collected some sparse structures in frombuf(). structs, isextended, origsize = self._sparse_structs del self._sparse_structs # Collect sparse structures from extended header blocks. while isextended: buf = tarfile.fileobj.read(BLOCKSIZE) pos = 0 for i in range(21): try: offset = nti(buf[pos:pos + 12]) numbytes = nti(buf[pos + 12:pos + 24]) except ValueError: break if offset and numbytes: structs.append((offset, numbytes)) pos += 24 isextended = bool(buf[504]) self.sparse = structs self.offset_data = tarfile.fileobj.tell() tarfile.offset = self.offset_data + self._block(self.size) self.size = origsize return self def _proc_pax(self, tarfile): """Process an extended or global header as described in POSIX.1-2008. """ # Read the header information. buf = tarfile.fileobj.read(self._block(self.size)) # A pax header stores supplemental information for either # the following file (extended) or all following files # (global). if self.type == XGLTYPE: pax_headers = tarfile.pax_headers else: pax_headers = tarfile.pax_headers.copy() # Check if the pax header contains a hdrcharset field. This tells us # the encoding of the path, linkpath, uname and gname fields. Normally, # these fields are UTF-8 encoded but since POSIX.1-2008 tar # implementations are allowed to store them as raw binary strings if # the translation to UTF-8 fails. match = re.search(br"\d+ hdrcharset=([^\n]+)\n", buf) if match is not None: pax_headers["hdrcharset"] = match.group(1).decode("utf8") # For the time being, we don't care about anything other than "BINARY". # The only other value that is currently allowed by the standard is # "ISO-IR 10646 2000 UTF-8" in other words UTF-8. hdrcharset = pax_headers.get("hdrcharset") if hdrcharset == "BINARY": encoding = tarfile.encoding else: encoding = "utf8" # Parse pax header information. A record looks like that: # "%d %s=%s\n" % (length, keyword, value). length is the size # of the complete record including the length field itself and # the newline. keyword and value are both UTF-8 encoded strings. regex = re.compile(br"(\d+) ([^=]+)=") pos = 0 while True: match = regex.match(buf, pos) if not match: break length, keyword = match.groups() length = int(length) value = buf[match.end(2) + 1:match.start(1) + length - 1] # Normally, we could just use "utf8" as the encoding and "strict" # as the error handler, but we better not take the risk. For # example, GNU tar <= 1.23 is known to store filenames it cannot # translate to UTF-8 as raw strings (unfortunately without a # hdrcharset=BINARY header). # We first try the strict standard encoding, and if that fails we # fall back on the user's encoding and error handler. keyword = self._decode_pax_field(keyword, "utf8", "utf8", tarfile.errors) if keyword in PAX_NAME_FIELDS: value = self._decode_pax_field(value, encoding, tarfile.encoding, tarfile.errors) else: value = self._decode_pax_field(value, "utf8", "utf8", tarfile.errors) pax_headers[keyword] = value pos += length # Fetch the next header. try: next = self.fromtarfile(tarfile) except HeaderError: raise SubsequentHeaderError("missing or bad subsequent header") # Process GNU sparse information. if "GNU.sparse.map" in pax_headers: # GNU extended sparse format version 0.1. self._proc_gnusparse_01(next, pax_headers) elif "GNU.sparse.size" in pax_headers: # GNU extended sparse format version 0.0. self._proc_gnusparse_00(next, pax_headers, buf) elif pax_headers.get("GNU.sparse.major") == "1" and pax_headers.get("GNU.sparse.minor") == "0": # GNU extended sparse format version 1.0. self._proc_gnusparse_10(next, pax_headers, tarfile) if self.type in (XHDTYPE, SOLARIS_XHDTYPE): # Patch the TarInfo object with the extended header info. next._apply_pax_info(pax_headers, tarfile.encoding, tarfile.errors) next.offset = self.offset if "size" in pax_headers: # If the extended header replaces the size field, # we need to recalculate the offset where the next # header starts. offset = next.offset_data if next.isreg() or next.type not in SUPPORTED_TYPES: offset += next._block(next.size) tarfile.offset = offset return next def _proc_gnusparse_00(self, next, pax_headers, buf): """Process a GNU tar extended sparse header, version 0.0. """ offsets = [] for match in re.finditer(br"\d+ GNU.sparse.offset=(\d+)\n", buf): offsets.append(int(match.group(1))) numbytes = [] for match in re.finditer(br"\d+ GNU.sparse.numbytes=(\d+)\n", buf): numbytes.append(int(match.group(1))) next.sparse = list(zip(offsets, numbytes)) def _proc_gnusparse_01(self, next, pax_headers): """Process a GNU tar extended sparse header, version 0.1. """ sparse = [int(x) for x in pax_headers["GNU.sparse.map"].split(",")] next.sparse = list(zip(sparse[::2], sparse[1::2])) def _proc_gnusparse_10(self, next, pax_headers, tarfile): """Process a GNU tar extended sparse header, version 1.0. """ fields = None sparse = [] buf = tarfile.fileobj.read(BLOCKSIZE) fields, buf = buf.split(b"\n", 1) fields = int(fields) while len(sparse) < fields * 2: if b"\n" not in buf: buf += tarfile.fileobj.read(BLOCKSIZE) number, buf = buf.split(b"\n", 1) sparse.append(int(number)) next.offset_data = tarfile.fileobj.tell() next.sparse = list(zip(sparse[::2], sparse[1::2])) def _apply_pax_info(self, pax_headers, encoding, errors): """Replace fields with supplemental information from a previous pax extended or global header. """ for keyword, value in pax_headers.items(): if keyword == "GNU.sparse.name": setattr(self, "path", value) elif keyword == "GNU.sparse.size": setattr(self, "size", int(value)) elif keyword == "GNU.sparse.realsize": setattr(self, "size", int(value)) elif keyword in PAX_FIELDS: if keyword in PAX_NUMBER_FIELDS: try: value = PAX_NUMBER_FIELDS[keyword](value) except ValueError: value = 0 if keyword == "path": value = value.rstrip("/") setattr(self, keyword, value) self.pax_headers = pax_headers.copy() def _decode_pax_field(self, value, encoding, fallback_encoding, fallback_errors): """Decode a single field from a pax record. """ try: return value.decode(encoding, "strict") except UnicodeDecodeError: return value.decode(fallback_encoding, fallback_errors) def _block(self, count): """Round up a byte count by BLOCKSIZE and return it, e.g. _block(834) => 1024. """ blocks, remainder = divmod(count, BLOCKSIZE) if remainder: blocks += 1 return blocks * BLOCKSIZE def isreg(self): return self.type in REGULAR_TYPES def isfile(self): return self.isreg() def isdir(self): return self.type == DIRTYPE def issym(self): return self.type == SYMTYPE def islnk(self): return self.type == LNKTYPE def ischr(self): return self.type == CHRTYPE def isblk(self): return self.type == BLKTYPE def isfifo(self): return self.type == FIFOTYPE def issparse(self): return self.sparse is not None def isdev(self): return self.type in (CHRTYPE, BLKTYPE, FIFOTYPE) # class TarInfo class TarFile(object): """The TarFile Class provides an interface to tar archives. """ debug = 0 # May be set from 0 (no msgs) to 3 (all msgs) dereference = False # If true, add content of linked file to the # tar file, else the link. ignore_zeros = False # If true, skips empty or invalid blocks and # continues processing. errorlevel = 1 # If 0, fatal errors only appear in debug # messages (if debug >= 0). If > 0, errors # are passed to the caller as exceptions. format = DEFAULT_FORMAT # The format to use when creating an archive. encoding = ENCODING # Encoding for 8-bit character strings. errors = None # Error handler for unicode conversion. tarinfo = TarInfo # The default TarInfo class to use. fileobject = ExFileObject # The default ExFileObject class to use. def __init__(self, name=None, mode="r", fileobj=None, format=None, tarinfo=None, dereference=None, ignore_zeros=None, encoding=None, errors="surrogateescape", pax_headers=None, debug=None, errorlevel=None): """Open an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' defaults to 'r'. If `fileobj' is given, it is used for reading or writing data. If it can be determined, `mode' is overridden by `fileobj's mode. `fileobj' is not closed, when TarFile is closed. """ if len(mode) > 1 or mode not in "raw": raise ValueError("mode must be 'r', 'a' or 'w'") self.mode = mode self._mode = {"r": "rb", "a": "r+b", "w": "wb"}[mode] if not fileobj: if self.mode == "a" and not os.path.exists(name): # Create nonexistent files in append mode. self.mode = "w" self._mode = "wb" fileobj = bltn_open(name, self._mode) self._extfileobj = False else: if name is None and hasattr(fileobj, "name"): name = fileobj.name if hasattr(fileobj, "mode"): self._mode = fileobj.mode self._extfileobj = True self.name = os.path.abspath(name) if name else None self.fileobj = fileobj # Init attributes. if format is not None: self.format = format if tarinfo is not None: self.tarinfo = tarinfo if dereference is not None: self.dereference = dereference if ignore_zeros is not None: self.ignore_zeros = ignore_zeros if encoding is not None: self.encoding = encoding self.errors = errors if pax_headers is not None and self.format == PAX_FORMAT: self.pax_headers = pax_headers else: self.pax_headers = {} if debug is not None: self.debug = debug if errorlevel is not None: self.errorlevel = errorlevel # Init datastructures. self.closed = False self.members = [] # list of members as TarInfo objects self._loaded = False # flag if all members have been read self.offset = self.fileobj.tell() # current position in the archive file self.inodes = {} # dictionary caching the inodes of # archive members already added try: if self.mode == "r": self.firstmember = None self.firstmember = self.next() if self.mode == "a": # Move to the end of the archive, # before the first empty block. while True: self.fileobj.seek(self.offset) try: tarinfo = self.tarinfo.fromtarfile(self) self.members.append(tarinfo) except EOFHeaderError: self.fileobj.seek(self.offset) break except HeaderError as e: raise ReadError(str(e)) if self.mode in "aw": self._loaded = True if self.pax_headers: buf = self.tarinfo.create_pax_global_header(self.pax_headers.copy()) self.fileobj.write(buf) self.offset += len(buf) except: if not self._extfileobj: self.fileobj.close() self.closed = True raise #-------------------------------------------------------------------------- # Below are the classmethods which act as alternate constructors to the # TarFile class. The open() method is the only one that is needed for # public use; it is the "super"-constructor and is able to select an # adequate "sub"-constructor for a particular compression using the mapping # from OPEN_METH. # # This concept allows one to subclass TarFile without losing the comfort of # the super-constructor. A sub-constructor is registered and made available # by adding it to the mapping in OPEN_METH. @classmethod def open(cls, name=None, mode="r", fileobj=None, bufsize=RECORDSIZE, **kwargs): """Open a tar archive for reading, writing or appending. Return an appropriate TarFile class. mode: 'r' or 'r:*' open for reading with transparent compression 'r:' open for reading exclusively uncompressed 'r:gz' open for reading with gzip compression 'r:bz2' open for reading with bzip2 compression 'a' or 'a:' open for appending, creating the file if necessary 'w' or 'w:' open for writing without compression 'w:gz' open for writing with gzip compression 'w:bz2' open for writing with bzip2 compression 'r|*' open a stream of tar blocks with transparent compression 'r|' open an uncompressed stream of tar blocks for reading 'r|gz' open a gzip compressed stream of tar blocks 'r|bz2' open a bzip2 compressed stream of tar blocks 'w|' open an uncompressed stream for writing 'w|gz' open a gzip compressed stream for writing 'w|bz2' open a bzip2 compressed stream for writing """ if not name and not fileobj: raise ValueError("nothing to open") if mode in ("r", "r:*"): # Find out which *open() is appropriate for opening the file. for comptype in cls.OPEN_METH: func = getattr(cls, cls.OPEN_METH[comptype]) if fileobj is not None: saved_pos = fileobj.tell() try: return func(name, "r", fileobj, **kwargs) except (ReadError, CompressionError) as e: if fileobj is not None: fileobj.seek(saved_pos) continue raise ReadError("file could not be opened successfully") elif ":" in mode: filemode, comptype = mode.split(":", 1) filemode = filemode or "r" comptype = comptype or "tar" # Select the *open() function according to # given compression. if comptype in cls.OPEN_METH: func = getattr(cls, cls.OPEN_METH[comptype]) else: raise CompressionError("unknown compression type %r" % comptype) return func(name, filemode, fileobj, **kwargs) elif "|" in mode: filemode, comptype = mode.split("|", 1) filemode = filemode or "r" comptype = comptype or "tar" if filemode not in "rw": raise ValueError("mode must be 'r' or 'w'") stream = _Stream(name, filemode, comptype, fileobj, bufsize) try: t = cls(name, filemode, stream, **kwargs) except: stream.close() raise t._extfileobj = False return t elif mode in "aw": return cls.taropen(name, mode, fileobj, **kwargs) raise ValueError("undiscernible mode") @classmethod def taropen(cls, name, mode="r", fileobj=None, **kwargs): """Open uncompressed tar archive name for reading or writing. """ if len(mode) > 1 or mode not in "raw": raise ValueError("mode must be 'r', 'a' or 'w'") return cls(name, mode, fileobj, **kwargs) @classmethod def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError("mode must be 'r' or 'w'") try: import gzip gzip.GzipFile except (ImportError, AttributeError): raise CompressionError("gzip module is not available") extfileobj = fileobj is not None try: fileobj = gzip.GzipFile(name, mode + "b", compresslevel, fileobj) t = cls.taropen(name, mode, fileobj, **kwargs) except IOError: if not extfileobj and fileobj is not None: fileobj.close() if fileobj is None: raise raise ReadError("not a gzip file") except: if not extfileobj and fileobj is not None: fileobj.close() raise t._extfileobj = extfileobj return t @classmethod def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs): """Open bzip2 compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError("mode must be 'r' or 'w'.") try: import bz2 except ImportError: raise CompressionError("bz2 module is not available") if fileobj is not None: fileobj = _BZ2Proxy(fileobj, mode) else: fileobj = bz2.BZ2File(name, mode, compresslevel=compresslevel) try: t = cls.taropen(name, mode, fileobj, **kwargs) except (IOError, EOFError): fileobj.close() raise ReadError("not a bzip2 file") t._extfileobj = False return t # All *open() methods are registered here. OPEN_METH = { "tar": "taropen", # uncompressed tar "gz": "gzopen", # gzip compressed tar "bz2": "bz2open" # bzip2 compressed tar } #-------------------------------------------------------------------------- # The public methods which TarFile provides: def close(self): """Close the TarFile. In write-mode, two finishing zero blocks are appended to the archive. """ if self.closed: return if self.mode in "aw": self.fileobj.write(NUL * (BLOCKSIZE * 2)) self.offset += (BLOCKSIZE * 2) # fill up the end with zero-blocks # (like option -b20 for tar does) blocks, remainder = divmod(self.offset, RECORDSIZE) if remainder > 0: self.fileobj.write(NUL * (RECORDSIZE - remainder)) if not self._extfileobj: self.fileobj.close() self.closed = True def getmember(self, name): """Return a TarInfo object for member `name'. If `name' can not be found in the archive, KeyError is raised. If a member occurs more than once in the archive, its last occurrence is assumed to be the most up-to-date version. """ tarinfo = self._getmember(name) if tarinfo is None: raise KeyError("filename %r not found" % name) return tarinfo def getmembers(self): """Return the members of the archive as a list of TarInfo objects. The list has the same order as the members in the archive. """ self._check() if not self._loaded: # if we want to obtain a list of self._load() # all members, we first have to # scan the whole archive. return self.members def getnames(self): """Return the members of the archive as a list of their names. It has the same order as the list returned by getmembers(). """ return [tarinfo.name for tarinfo in self.getmembers()] def gettarinfo(self, name=None, arcname=None, fileobj=None): """Create a TarInfo object for either the file `name' or the file object `fileobj' (using os.fstat on its file descriptor). You can modify some of the TarInfo's attributes before you add it using addfile(). If given, `arcname' specifies an alternative name for the file in the archive. """ self._check("aw") # When fileobj is given, replace name by # fileobj's real name. if fileobj is not None: name = fileobj.name # Building the name of the member in the archive. # Backward slashes are converted to forward slashes, # Absolute paths are turned to relative paths. if arcname is None: arcname = name drv, arcname = os.path.splitdrive(arcname) arcname = arcname.replace(os.sep, "/") arcname = arcname.lstrip("/") # Now, fill the TarInfo object with # information specific for the file. tarinfo = self.tarinfo() tarinfo.tarfile = self # Use os.stat or os.lstat, depending on platform # and if symlinks shall be resolved. if fileobj is None: if hasattr(os, "lstat") and not self.dereference: statres = os.lstat(name) else: statres = os.stat(name) else: statres = os.fstat(fileobj.fileno()) linkname = "" stmd = statres.st_mode if stat.S_ISREG(stmd): inode = (statres.st_ino, statres.st_dev) if not self.dereference and statres.st_nlink > 1 and \ inode in self.inodes and arcname != self.inodes[inode]: # Is it a hardlink to an already # archived file? type = LNKTYPE linkname = self.inodes[inode] else: # The inode is added only if its valid. # For win32 it is always 0. type = REGTYPE if inode[0]: self.inodes[inode] = arcname elif stat.S_ISDIR(stmd): type = DIRTYPE elif stat.S_ISFIFO(stmd): type = FIFOTYPE elif stat.S_ISLNK(stmd): type = SYMTYPE linkname = os.readlink(name) elif stat.S_ISCHR(stmd): type = CHRTYPE elif stat.S_ISBLK(stmd): type = BLKTYPE else: return None # Fill the TarInfo object with all # information we can get. tarinfo.name = arcname tarinfo.mode = stmd tarinfo.uid = statres.st_uid tarinfo.gid = statres.st_gid if type == REGTYPE: tarinfo.size = statres.st_size else: tarinfo.size = 0 tarinfo.mtime = statres.st_mtime tarinfo.type = type tarinfo.linkname = linkname if pwd: try: tarinfo.uname = pwd.getpwuid(tarinfo.uid)[0] except KeyError: pass if grp: try: tarinfo.gname = grp.getgrgid(tarinfo.gid)[0] except KeyError: pass if type in (CHRTYPE, BLKTYPE): if hasattr(os, "major") and hasattr(os, "minor"): tarinfo.devmajor = os.major(statres.st_rdev) tarinfo.devminor = os.minor(statres.st_rdev) return tarinfo def list(self, verbose=True): """Print a table of contents to sys.stdout. If `verbose' is False, only the names of the members are printed. If it is True, an `ls -l'-like output is produced. """ self._check() for tarinfo in self: if verbose: print(filemode(tarinfo.mode), end=' ') print("%s/%s" % (tarinfo.uname or tarinfo.uid, tarinfo.gname or tarinfo.gid), end=' ') if tarinfo.ischr() or tarinfo.isblk(): print("%10s" % ("%d,%d" \ % (tarinfo.devmajor, tarinfo.devminor)), end=' ') else: print("%10d" % tarinfo.size, end=' ') print("%d-%02d-%02d %02d:%02d:%02d" \ % time.localtime(tarinfo.mtime)[:6], end=' ') print(tarinfo.name + ("/" if tarinfo.isdir() else ""), end=' ') if verbose: if tarinfo.issym(): print("->", tarinfo.linkname, end=' ') if tarinfo.islnk(): print("link to", tarinfo.linkname, end=' ') print() def add(self, name, arcname=None, recursive=True, exclude=None, filter=None): """Add the file `name' to the archive. `name' may be any type of file (directory, fifo, symbolic link, etc.). If given, `arcname' specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by setting `recursive' to False. `exclude' is a function that should return True for each filename to be excluded. `filter' is a function that expects a TarInfo object argument and returns the changed TarInfo object, if it returns None the TarInfo object will be excluded from the archive. """ self._check("aw") if arcname is None: arcname = name # Exclude pathnames. if exclude is not None: import warnings warnings.warn("use the filter argument instead", DeprecationWarning, 2) if exclude(name): self._dbg(2, "tarfile: Excluded %r" % name) return # Skip if somebody tries to archive the archive... if self.name is not None and os.path.abspath(name) == self.name: self._dbg(2, "tarfile: Skipped %r" % name) return self._dbg(1, name) # Create a TarInfo object from the file. tarinfo = self.gettarinfo(name, arcname) if tarinfo is None: self._dbg(1, "tarfile: Unsupported type %r" % name) return # Change or exclude the TarInfo object. if filter is not None: tarinfo = filter(tarinfo) if tarinfo is None: self._dbg(2, "tarfile: Excluded %r" % name) return # Append the tar header and data to the archive. if tarinfo.isreg(): f = bltn_open(name, "rb") self.addfile(tarinfo, f) f.close() elif tarinfo.isdir(): self.addfile(tarinfo) if recursive: for f in os.listdir(name): self.add(os.path.join(name, f), os.path.join(arcname, f), recursive, exclude, filter=filter) else: self.addfile(tarinfo) def addfile(self, tarinfo, fileobj=None): """Add the TarInfo object `tarinfo' to the archive. If `fileobj' is given, tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects using gettarinfo(). On Windows platforms, `fileobj' should always be opened with mode 'rb' to avoid irritation about the file size. """ self._check("aw") tarinfo = copy.copy(tarinfo) buf = tarinfo.tobuf(self.format, self.encoding, self.errors) self.fileobj.write(buf) self.offset += len(buf) # If there's data to follow, append it. if fileobj is not None: copyfileobj(fileobj, self.fileobj, tarinfo.size) blocks, remainder = divmod(tarinfo.size, BLOCKSIZE) if remainder > 0: self.fileobj.write(NUL * (BLOCKSIZE - remainder)) blocks += 1 self.offset += blocks * BLOCKSIZE self.members.append(tarinfo) def extractall(self, path=".", members=None): """Extract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by getmembers(). """ directories = [] if members is None: members = self for tarinfo in members: if tarinfo.isdir(): # Extract directories with a safe mode. directories.append(tarinfo) tarinfo = copy.copy(tarinfo) tarinfo.mode = 0o700 # Do not set_attrs directories, as we will do that further down self.extract(tarinfo, path, set_attrs=not tarinfo.isdir()) # Reverse sort directories. directories.sort(key=lambda a: a.name) directories.reverse() # Set correct owner, mtime and filemode on directories. for tarinfo in directories: dirpath = os.path.join(path, tarinfo.name) try: self.chown(tarinfo, dirpath) self.utime(tarinfo, dirpath) self.chmod(tarinfo, dirpath) except ExtractError as e: if self.errorlevel > 1: raise else: self._dbg(1, "tarfile: %s" % e) def extract(self, member, path="", set_attrs=True): """Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a TarInfo object. You can specify a different directory using `path'. File attributes (owner, mtime, mode) are set unless `set_attrs' is False. """ self._check("r") if isinstance(member, str): tarinfo = self.getmember(member) else: tarinfo = member # Prepare the link target for makelink(). if tarinfo.islnk(): tarinfo._link_target = os.path.join(path, tarinfo.linkname) try: self._extract_member(tarinfo, os.path.join(path, tarinfo.name), set_attrs=set_attrs) except EnvironmentError as e: if self.errorlevel > 0: raise else: if e.filename is None: self._dbg(1, "tarfile: %s" % e.strerror) else: self._dbg(1, "tarfile: %s %r" % (e.strerror, e.filename)) except ExtractError as e: if self.errorlevel > 1: raise else: self._dbg(1, "tarfile: %s" % e) def extractfile(self, member): """Extract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file, a file-like object is returned. If `member' is a link, a file-like object is constructed from the link's target. If `member' is none of the above, None is returned. The file-like object is read-only and provides the following methods: read(), readline(), readlines(), seek() and tell() """ self._check("r") if isinstance(member, str): tarinfo = self.getmember(member) else: tarinfo = member if tarinfo.isreg(): return self.fileobject(self, tarinfo) elif tarinfo.type not in SUPPORTED_TYPES: # If a member's type is unknown, it is treated as a # regular file. return self.fileobject(self, tarinfo) elif tarinfo.islnk() or tarinfo.issym(): if isinstance(self.fileobj, _Stream): # A small but ugly workaround for the case that someone tries # to extract a (sym)link as a file-object from a non-seekable # stream of tar blocks. raise StreamError("cannot extract (sym)link as file object") else: # A (sym)link's file object is its target's file object. return self.extractfile(self._find_link_target(tarinfo)) else: # If there's no data associated with the member (directory, chrdev, # blkdev, etc.), return None instead of a file object. return None def _extract_member(self, tarinfo, targetpath, set_attrs=True): """Extract the TarInfo object tarinfo to a physical file called targetpath. """ # Fetch the TarInfo object for the given name # and build the destination pathname, replacing # forward slashes to platform specific separators. targetpath = targetpath.rstrip("/") targetpath = targetpath.replace("/", os.sep) # Create all upper directories. upperdirs = os.path.dirname(targetpath) if upperdirs and not os.path.exists(upperdirs): # Create directories that are not part of the archive with # default permissions. os.makedirs(upperdirs) if tarinfo.islnk() or tarinfo.issym(): self._dbg(1, "%s -> %s" % (tarinfo.name, tarinfo.linkname)) else: self._dbg(1, tarinfo.name) if tarinfo.isreg(): self.makefile(tarinfo, targetpath) elif tarinfo.isdir(): self.makedir(tarinfo, targetpath) elif tarinfo.isfifo(): self.makefifo(tarinfo, targetpath) elif tarinfo.ischr() or tarinfo.isblk(): self.makedev(tarinfo, targetpath) elif tarinfo.islnk() or tarinfo.issym(): self.makelink(tarinfo, targetpath) elif tarinfo.type not in SUPPORTED_TYPES: self.makeunknown(tarinfo, targetpath) else: self.makefile(tarinfo, targetpath) if set_attrs: self.chown(tarinfo, targetpath) if not tarinfo.issym(): self.chmod(tarinfo, targetpath) self.utime(tarinfo, targetpath) #-------------------------------------------------------------------------- # Below are the different file methods. They are called via # _extract_member() when extract() is called. They can be replaced in a # subclass to implement other functionality. def makedir(self, tarinfo, targetpath): """Make a directory called targetpath. """ try: # Use a safe mode for the directory, the real mode is set # later in _extract_member(). os.mkdir(targetpath, 0o700) except EnvironmentError as e: if e.errno != errno.EEXIST: raise def makefile(self, tarinfo, targetpath): """Make a file called targetpath. """ source = self.fileobj source.seek(tarinfo.offset_data) target = bltn_open(targetpath, "wb") if tarinfo.sparse is not None: for offset, size in tarinfo.sparse: target.seek(offset) copyfileobj(source, target, size) else: copyfileobj(source, target, tarinfo.size) target.seek(tarinfo.size) target.truncate() target.close() def makeunknown(self, tarinfo, targetpath): """Make a file from a TarInfo object with an unknown type at targetpath. """ self.makefile(tarinfo, targetpath) self._dbg(1, "tarfile: Unknown file type %r, " \ "extracted as regular file." % tarinfo.type) def makefifo(self, tarinfo, targetpath): """Make a fifo called targetpath. """ if hasattr(os, "mkfifo"): os.mkfifo(targetpath) else: raise ExtractError("fifo not supported by system") def makedev(self, tarinfo, targetpath): """Make a character or block device called targetpath. """ if not hasattr(os, "mknod") or not hasattr(os, "makedev"): raise ExtractError("special devices not supported by system") mode = tarinfo.mode if tarinfo.isblk(): mode |= stat.S_IFBLK else: mode |= stat.S_IFCHR os.mknod(targetpath, mode, os.makedev(tarinfo.devmajor, tarinfo.devminor)) def makelink(self, tarinfo, targetpath): """Make a (symbolic) link called targetpath. If it cannot be created (platform limitation), we try to make a copy of the referenced file instead of a link. """ try: # For systems that support symbolic and hard links. if tarinfo.issym(): os.symlink(tarinfo.linkname, targetpath) else: # See extract(). if os.path.exists(tarinfo._link_target): os.link(tarinfo._link_target, targetpath) else: self._extract_member(self._find_link_target(tarinfo), targetpath) except symlink_exception: if tarinfo.issym(): linkpath = os.path.join(os.path.dirname(tarinfo.name), tarinfo.linkname) else: linkpath = tarinfo.linkname else: try: self._extract_member(self._find_link_target(tarinfo), targetpath) except KeyError: raise ExtractError("unable to resolve link inside archive") def chown(self, tarinfo, targetpath): """Set owner of targetpath according to tarinfo. """ if pwd and hasattr(os, "geteuid") and os.geteuid() == 0: # We have to be root to do so. try: g = grp.getgrnam(tarinfo.gname)[2] except KeyError: g = tarinfo.gid try: u = pwd.getpwnam(tarinfo.uname)[2] except KeyError: u = tarinfo.uid try: if tarinfo.issym() and hasattr(os, "lchown"): os.lchown(targetpath, u, g) else: if sys.platform != "os2emx": os.chown(targetpath, u, g) except EnvironmentError as e: raise ExtractError("could not change owner") def chmod(self, tarinfo, targetpath): """Set file permissions of targetpath according to tarinfo. """ if hasattr(os, 'chmod'): try: os.chmod(targetpath, tarinfo.mode) except EnvironmentError as e: raise ExtractError("could not change mode") def utime(self, tarinfo, targetpath): """Set modification time of targetpath according to tarinfo. """ if not hasattr(os, 'utime'): return try: os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime)) except EnvironmentError as e: raise ExtractError("could not change modification time") #-------------------------------------------------------------------------- def next(self): """Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. """ self._check("ra") if self.firstmember is not None: m = self.firstmember self.firstmember = None return m # Read the next block. self.fileobj.seek(self.offset) tarinfo = None while True: try: tarinfo = self.tarinfo.fromtarfile(self) except EOFHeaderError as e: if self.ignore_zeros: self._dbg(2, "0x%X: %s" % (self.offset, e)) self.offset += BLOCKSIZE continue except InvalidHeaderError as e: if self.ignore_zeros: self._dbg(2, "0x%X: %s" % (self.offset, e)) self.offset += BLOCKSIZE continue elif self.offset == 0: raise ReadError(str(e)) except EmptyHeaderError: if self.offset == 0: raise ReadError("empty file") except TruncatedHeaderError as e: if self.offset == 0: raise ReadError(str(e)) except SubsequentHeaderError as e: raise ReadError(str(e)) break if tarinfo is not None: self.members.append(tarinfo) else: self._loaded = True return tarinfo #-------------------------------------------------------------------------- # Little helper methods: def _getmember(self, name, tarinfo=None, normalize=False): """Find an archive member by name from bottom to top. If tarinfo is given, it is used as the starting point. """ # Ensure that all members have been loaded. members = self.getmembers() # Limit the member search list up to tarinfo. if tarinfo is not None: members = members[:members.index(tarinfo)] if normalize: name = os.path.normpath(name) for member in reversed(members): if normalize: member_name = os.path.normpath(member.name) else: member_name = member.name if name == member_name: return member def _load(self): """Read through the entire archive file and look for readable members. """ while True: tarinfo = self.next() if tarinfo is None: break self._loaded = True def _check(self, mode=None): """Check if TarFile is still open, and if the operation's mode corresponds to TarFile's mode. """ if self.closed: raise IOError("%s is closed" % self.__class__.__name__) if mode is not None and self.mode not in mode: raise IOError("bad operation for mode %r" % self.mode) def _find_link_target(self, tarinfo): """Find the target member of a symlink or hardlink member in the archive. """ if tarinfo.issym(): # Always search the entire archive. linkname = os.path.dirname(tarinfo.name) + "/" + tarinfo.linkname limit = None else: # Search the archive before the link, because a hard link is # just a reference to an already archived file. linkname = tarinfo.linkname limit = tarinfo member = self._getmember(linkname, tarinfo=limit, normalize=True) if member is None: raise KeyError("linkname %r not found" % linkname) return member def __iter__(self): """Provide an iterator object. """ if self._loaded: return iter(self.members) else: return TarIter(self) def _dbg(self, level, msg): """Write debugging output to sys.stderr. """ if level <= self.debug: print(msg, file=sys.stderr) def __enter__(self): self._check() return self def __exit__(self, type, value, traceback): if type is None: self.close() else: # An exception occurred. We must not call close() because # it would try to write end-of-archive blocks and padding. if not self._extfileobj: self.fileobj.close() self.closed = True # class TarFile class TarIter(object): """Iterator Class. for tarinfo in TarFile(...): suite... """ def __init__(self, tarfile): """Construct a TarIter object. """ self.tarfile = tarfile self.index = 0 def __iter__(self): """Return iterator object. """ return self def __next__(self): """Return the next item using TarFile's next() method. When all members have been read, set TarFile as _loaded. """ # Fix for SF #1100429: Under rare circumstances it can # happen that getmembers() is called during iteration, # which will cause TarIter to stop prematurely. if not self.tarfile._loaded: tarinfo = self.tarfile.next() if not tarinfo: self.tarfile._loaded = True raise StopIteration else: try: tarinfo = self.tarfile.members[self.index] except IndexError: raise StopIteration self.index += 1 return tarinfo next = __next__ # for Python 2.x #-------------------- # exported functions #-------------------- def is_tarfile(name): """Return True if name points to a tar archive that we are able to handle, else return False. """ try: t = open(name) t.close() return True except TarError: return False bltn_open = open open = TarFile.open site-packages/pip/_vendor/distlib/_backport/tarfile.pyc000064400000233504147204247350017270 0ustar00 abc @s>ddlmZdZdZdZdZdZdZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZyddlZddlZWnek reZZnXeefZyeef7ZWnek rnXd d d d gZejd dkr3ddlZn ddlZejZdZdZ e dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1d Z2d!Z3d"Z4d#Z5d Z6d$Z7d%Z8e7Z9e'e(e)e*e-e.e/e+e,e0e1e2f Z:e'e(e/e2fZ;e0e1e2fZ<d&d'd(d)d*d+d,d-fZ=e>d&d'd,d-fZ?ie@d.6e@d/6e@d)6eAd*6eAd+6eAd(6ZBd0ZCd1ZDd2ZEd3ZFd4ZGd5ZHd6ZId7ZJdZKd8ZLd9ZMd:ZNd;ZOd<ZPd=ZQd>ZRd%ZSd$ZTe jUd?d@fkr)dAZVn ejWZVdBZXdCZYdDZZd=e9dEZ[dFZ\edGZ]eCdHfeDdIfeEdJfeFdKfeGdLfeHdMffeLdNffeMdOffeNeIBdPfeId feNd!ffeOdNffePdOffeQeJBdPfeJd feQd!ffeRdNffeSdOffeTeKBdQfeKdRfeTd!fff Z^dSZ_d e`fdTYZadUeafdVYZbdWeafdXYZcdYeafdZYZdd[eafd\YZed]eafd^YZfd_effd`YZgdaeffdbYZhdceffddYZideeffdfYZjdgeffdhYZkdielfdjYZmdkelfdlYZndmelfdnYZodoelfdpYZpdqelfdrYZqdselfdtYZrd elfduYZsd elfdvYZtdwelfdxYZudyZveZwetjZdS(zi(tprint_functions $Revision$s0.9.0s&Lars Gust\u00e4bel (lars@gustaebel.de)s5$Date: 2011-02-25 17:42:01 +0200 (Fri, 25 Feb 2011) $s?$Id: tarfile.py 88586 2011-02-25 15:42:01Z marc-andre.lemburg $s8Gustavo Niemeyer, Niels Gust\u00e4bel, Richard Townsend.NtTarFiletTarInfot is_tarfiletTarErroriisiisustar sustar00idit0t1t2t3t4t5t6t7tLtKtStxtgtXiitpathtlinkpathtsizetmtimetuidtgidtunametgnametatimetctimeiii`i@i iiiiii@i iiitnttcesutf-8cCs,|j||}|| |t|tS(s8Convert a string to a null-terminated bytes object. (tencodetlentNUL(tstlengthtencodingterrors((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytstnscCs8|jd}|dkr(|| }n|j||S(s8Convert a null-terminated bytes object to a string. si(tfindtdecode(R"R$R%tp((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytntss  cCs|dtdkr^y%tt|ddp1dd}Wqtk rZtdqXnId}x@tt|dD](}|dK}|t||d7}q{W|S( s/Convert a number field to a python number. iitasciitstrictRisinvalid headeri(tchrtintR*t ValueErrortInvalidHeaderErrortrangeR tord(R"tnti((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytntis%  cCsd|kod|dknrHd|d|fjdt}n|tksh|d|dkrwtdn|dkrtjdtjd |d}nt}x6t|dD]$}|j d|d @|dL}qW|j dd |S( s/Convert a python number to a number field. iiis%0*oR+isoverflow in number fieldR tlii( RR!t GNU_FORMATR/tstructtunpacktpackt bytearrayR1tinsert(R3tdigitstformatR"R4((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytitns $$  % cCsxdttjd|d tjd|dd!}dttjd|d tjd|dd!}||fS( sCalculate the checksum for a member's header by summing up all characters except for the chksum field which is treated as if it was filled with spaces. According to the GNU tar sources, some tars (Sun and NeXT) calculate chksum with signed char, which will be different if there are chars in the buffer with the high bit set. So we calculate two checksums, unsigned and signed. it148Bit356Biit148bt356b(tsumR8R9(tbuftunsigned_chksumt signed_chksum((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt calc_chksumss 77cCs|dkrdS|dkrSx0trN|jd}|s>Pn|j|qWdSd}t||\}}xQt|D]C}|j|}t||krtdn|j|q{W|dkr|j|}t||krtdn|j|ndS(sjCopy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content. iNiisend of file reachedi@i@(tNonetTruetreadtwritetdivmodR1R tIOError(tsrctdstR#REtBUFSIZEtblockst remaindertb((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt copyfileobjs,    R6t-RTtdtcR)trtwR"tttTcCsig}xStD]K}xB|D]-\}}||@|kr|j|PqqW|jdq Wdj|S(scConvert a file's mode to a string of the form -rwxrwxrwx. Used by TarFile.list() RVt(tfilemode_tabletappendtjoin(tmodetpermttabletbittchar((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytfilemode8s  cBseZdZRS(sBase exception.(t__name__t __module__t__doc__(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRGst ExtractErrorcBseZdZRS(s%General exception for extract errors.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRjJst ReadErrorcBseZdZRS(s&Exception for unreadable tar archives.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRkMstCompressionErrorcBseZdZRS(s.Exception for unavailable compression methods.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRlPst StreamErrorcBseZdZRS(s=Exception for unsupported operations on stream-like TarFiles.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRmSst HeaderErrorcBseZdZRS(s!Base exception for header errors.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRnVstEmptyHeaderErrorcBseZdZRS(sException for empty headers.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRoYstTruncatedHeaderErrorcBseZdZRS(s Exception for truncated headers.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRp\stEOFHeaderErrorcBseZdZRS(s"Exception for end of file headers.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRq_sR0cBseZdZRS(sException for invalid headers.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR0bstSubsequentHeaderErrorcBseZdZRS(s3Exception for missing and invalid extended headers.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRrest _LowLevelFilecBs2eZdZdZdZdZdZRS(sLow-level file object. Supports reading and writing. It is used instead of a regular file object for streaming access. cCsgitjd6tjtjBtjBd6|}ttdrK|tjO}ntj||d|_dS(NRYRZtO_BINARYi( tostO_RDONLYtO_WRONLYtO_CREATtO_TRUNCthasattrRttopentfd(tselftnameRa((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__init__rs cCstj|jdS(N(RutcloseR|(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR{scCstj|j|S(N(RuRKR|(R}R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRK~scCstj|j|dS(N(RuRLR|(R}R"((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRLs(RgRhRiRRRKRL(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRsls   t_StreamcBseZdZdZdZdZdZdZdZdZ dZ d d Z dd Z d Zd ZRS(sClass that serves as an adapter between TarFile and a stream-like object. The stream-like object only needs to have a read() or write() method and is accessed blockwise. Use of gzip or bzip2 compression is possible. A stream-like object could be for example: sys.stdin, sys.stdout, a socket, a tape device etc. _Stream is intended to be used only internally. cCst|_|dkr0t||}t|_n|dkrWt|}|j}n|p`d|_||_||_ ||_ ||_ d|_ d|_ t|_y|dkr%yddl}Wntk rtdnX||_|jd|_|dkr|jq%|jn|d kryddl}Wntk r`td nX|dkrd|_|j|_q|j|_nWn,|js|j jnt|_nXdS( s$Construct a _Stream object. t*R]itgziNszlib module is not availableRYtbz2sbz2 module is not available(RJt _extfileobjRIRstFalset _StreamProxyt getcomptypeR~RatcomptypetfileobjtbufsizeREtpostclosedtzlibt ImportErrorRltcrc32tcrct _init_read_gzt_init_write_gzRtdbuftBZ2Decompressortcmpt BZ2CompressorR(R}R~RaRRRRR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRsP                        cCs*t|dr&|j r&|jndS(NR(RzRR(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__del__scCs|jjd|jj|jj |jjd|_tjdtt j }|j d|d|j j dr|j d |_ n|j |j j dd td S( s6Initialize for writing with gzip compression. i isZ2RS(@sInformational class which holds the details about an archive member given by a tar header block. TarInfo objects are returned by TarFile.getmember(), TarFile.getmembers() and TarFile.gettarinfo() and are usually created internally. R~RaRRRRtchksumttypetlinknameRRtdevmajortdevminorRRt pax_headersRRt_sparse_structst _link_targetR]cCs||_d|_d|_d|_d|_d|_d|_t|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_i|_dS(sXConstruct a TarInfo object. name is the optional name of the member. iiR]N(R~RaRRRRRtREGTYPERRRRRRRRRIRR(R}R~((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRs"                cCs|jS(N(R~(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt_getpathscCs ||_dS(N(R~(R}R~((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt_setpathscCs|jS(N(R(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt _getlinkpathscCs ||_dS(N(R(R}R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt _setlinkpathscCs d|jj|jt|fS(Ns<%s %r at %#x>(t __class__RgR~tid(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__repr__scCsi |jd6|jd@d6|jd6|jd6|jd6|jd6|jd6|jd 6|jd 6|j d 6|j d 6|j d 6|j d6}|d t kr|djd r|dcd7R$R%R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyttobufs    cCst|dny||jd d Wn"tk r||||nXt|||kr>||||q>WxddddfD]\}}||krd||R$R%tpartsRER((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRYs&$#cCs@tt|t\}}|dkr<|t|t7}n|S(sdReturn the string payload filled with zero bytes up to the next 512 byte border. i(RMR RR!(tpayloadRRRS((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt_create_payloadus cCsm|j||t}i}d|d<||d|j|S|jtttfkrc|j |S|j |SdS(sYChoose the right processing method depending on the type and call it. N( RRRt _proc_gnulongRt _proc_sparseRRtSOLARIS_XHDTYPEt _proc_paxt _proc_builtin(R}R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR%s   cCsx|jj|_|j}|js6|jtkrO||j|j7}n||_|j |j |j |j |S(sfProcess a builtin type or an unknown type which will be treated as a regular file. ( RRRtisregRtSUPPORTED_TYPESt_blockRRt_apply_pax_infoRR$R%(R}RR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR+$s  cCs|jj|j|j}y|j|}Wntk rPtdnX|j|_|jt krt ||j |j |_ n-|jtkrt ||j |j |_n|S(sSProcess the blocks that hold a GNU longname or longlink member. s missing or bad subsequent header(RRKR.RR&RnRrRRRR*R$R%R~RR(R}RREtnext((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR'5s  c Cs|j\}}}|`x|r|jjt}d}xtdD]}}y6t|||d!}t||d|d!} Wntk rPnX|r| r|j|| fn|d7}qFWt|d}qW||_ |jj |_ |j |j |j |_||_ |S(s8Process a GNU sparse header plus extra headers. iii ii(RRRKRR1R5R/R_RRRRR.RR( R}RR R"R#RERR4RR!((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR(Ks(     cCs|jj|j|j}|jtkr9|j}n|jj}tj d|}|dk r|j dj d|ds  cCsx|jD]\}}|dkr8t|d|q |dkr]t|dt|q |dkrt|dt|q |tkr |tkryt||}Wqtk rd}qXn|dkr|jd}nt|||q q W|j|_dS( soReplace fields with supplemental information from a previous pax extended or global header. sGNU.sparse.nameRsGNU.sparse.sizeRsGNU.sparse.realsizeiRN( RtsetattrR.t PAX_FIELDStPAX_NUMBER_FIELDSR/RRR(R}RR$R%RR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR/s"        cCs9y|j|dSWntk r4|j||SXdS(s1Decode a single field from a pax record. R,N(R(tUnicodeDecodeError(R}RR$tfallback_encodingtfallback_errors((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR:s cCs0t|t\}}|r(|d7}n|tS(s_Round up a byte count by BLOCKSIZE and return it, e.g. _block(834) => 1024. i(RMR(R}RRRRS((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR. s cCs |jtkS(N(Rt REGULAR_TYPES(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR,scCs |jS(N(R,(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytisfilescCs |jtkS(N(RR(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRscCs |jtkS(N(RtSYMTYPE(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytissymscCs |jtkS(N(RtLNKTYPE(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytislnkscCs |jtkS(N(RtCHRTYPE(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytischr scCs |jtkS(N(RtBLKTYPE(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytisblk"scCs |jtkS(N(RtFIFOTYPE(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytisfifo$scCs |jdk S(N(RRI(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytissparse&scCs|jtttfkS(N(RRTRVRX(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytisdev(s(R~RaRRRRRRRRRRRRRRRRRR(3RgRhRit __slots__RRRtpropertyRRRRRRtDEFAULT_FORMATtENCODINGRRRRt classmethodR Rt staticmethodRRRRR$R&R%R+R'R(R*R=R<R>R/R:R.R,RORRQRSRURWRYRZR[(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRs`         1  3?    f             c Bs-eZdZdZeZeZdZeZ e Z d1Z eZeZd1dd1d1d1d1d1d1dd1d1d1d Zed1dd1edZedd1dZedd1dd Zedd1dd Zid d 6d d6dd6ZdZdZdZdZd1d1d1dZedZ d1ed1d1dZ!d1dZ"dd1dZ#dedZ$dZ%edZ&dZ'd Z(d!Z)d"Z*d#Z+d$Z,d%Z-d&Z.d'Z/d(Z0d1ed)Z1d*Z2d1d+Z3d,Z4d-Z5d.Z6d/Z7d0Z8RS(2s=The TarFile Class provides an interface to tar archives. iiRYRc Cst|dks|dkr-tdn||_idd6dd6dd 6||_|s|jdkrtjj| rd |_d|_nt||j}t|_ nN|d krt |d r|j }nt |d r|j|_nt |_ |rtjj|nd |_ ||_|d k rC||_n|d k r[||_n|d k rs||_n|d k r||_n|d k r||_n| |_| d k r|jtkr| |_n i|_| d k r| |_n| d k r | |_nt|_g|_t|_|jj|_i|_y9|jdkrod |_ |j!|_ n|jdkrxt r|jj"|jy&|jj#|}|jj$|Wqt%k r|jj"|jPqt&k r } t't(| qXqWn|jd krzt |_|jrz|jj)|jj*}|jj+||jt|7_qznWn,|j s|jj,nt |_nXd S(sOpen an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' defaults to 'r'. If `fileobj' is given, it is used for reading or writing data. If it can be determined, `mode' is overridden by `fileobj's mode. `fileobj' is not closed, when TarFile is closed. iRsmode must be 'r', 'a' or 'w'trbRYsr+btatwbRZR~RatawN(-R R/Rat_modeRuRtexistst bltn_openRRRIRzR~RJtabspathRR>Rt dereferencet ignore_zerosR$R%RRtdebugt errorlevelRtmemberst_loadedRRtinodest firstmemberR0RR&R_RqRnRkRR RRLR(R}R~RaRR>RRjRkR$R%RRlRmteRE((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRFs  ""     !                             c Ks4| r| rtdn|dkrx|jD]}t||j|}|dk rj|j}ny||d||SWq3ttfk r} |dk r3|j|q3q3q3Xq3WtdnUd|krV|jdd\} }| pd} |pd}||jkr3t||j|}ntd|||| ||Sd |kr|jd d\} }| pd} |pd}| d krtd nt || |||} y||| | |} Wn| j nXt | _ | S|d kr$|j ||||Std dS(s|Open a tar archive for reading, writing or appending. Return an appropriate TarFile class. mode: 'r' or 'r:*' open for reading with transparent compression 'r:' open for reading exclusively uncompressed 'r:gz' open for reading with gzip compression 'r:bz2' open for reading with bzip2 compression 'a' or 'a:' open for appending, creating the file if necessary 'w' or 'w:' open for writing without compression 'w:gz' open for writing with gzip compression 'w:bz2' open for writing with bzip2 compression 'r|*' open a stream of tar blocks with transparent compression 'r|' open an uncompressed stream of tar blocks for reading 'r|gz' open a gzip compressed stream of tar blocks 'r|bz2' open a bzip2 compressed stream of tar blocks 'w|' open an uncompressed stream for writing 'w|gz' open a gzip compressed stream for writing 'w|bz2' open a bzip2 compressed stream for writing snothing to openRYsr:*s%file could not be opened successfullyt:iRsunknown compression type %rt|trwsmode must be 'r' or 'w'Resundiscernible modeN(RYsr:*(R/t OPEN_METHRRIRRkRlRRERRRRttaropen( R R~RaRRtkwargsRtfunct saved_posRrRftstreamR[((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR{sN              cKs@t|dks|dkr-tdn|||||S(sCOpen uncompressed tar archive name for reading or writing. iRsmode must be 'r', 'a' or 'w'(R R/(R R~RaRRx((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRwsi c Ks6t|dks|dkr-tdnyddl}|jWn#ttfk ritdnX|dk }y8|j||d||}|j||||}Wnxt k r| r|dk r|j n|dkrnt dn*| r"|dk r"|j nnX||_ |S( skOpen gzip compressed tar archive name for reading or writing. Appending is not allowed. iRusmode must be 'r' or 'w'iNsgzip module is not availableRTsnot a gzip file( R R/tgziptGzipFileRtAttributeErrorRlRIRwRNRRkR( R R~RaRt compresslevelRxR|t extfileobjR[((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytgzopens.        cKst|dks|dkr-tdnyddl}Wntk r\tdnX|dk r{t||}n|j||d|}y|j||||}Wn-t t fk r|j t dnXt |_|S( slOpen bzip2 compressed tar archive name for reading or writing. Appending is not allowed. iRusmode must be 'r' or 'w'.iNsbz2 module is not availableRsnot a bzip2 file(R R/RRRlRIRtBZ2FileRwRNtEOFErrorRRkRR(R R~RaRRRxRR[((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytbz2open$s     RwRRRRRcCs|jr dS|jdkr|jjttd|jtd7_t|jt\}}|dkr|jjtt|qn|j s|jj nt |_dS(slClose the TarFile. In write-mode, two finishing zero blocks are appended to the archive. NReii( RRaRRLR!RRRMt RECORDSIZERRRJ(R}RRRS((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRHs   cCs2|j|}|dkr.td|n|S(sReturn a TarInfo object for member `name'. If `name' can not be found in the archive, KeyError is raised. If a member occurs more than once in the archive, its last occurrence is assumed to be the most up-to-date version. sfilename %r not foundN(t _getmemberRItKeyError(R}R~R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt getmember\s cCs'|j|js |jn|jS(sReturn the members of the archive as a list of TarInfo objects. The list has the same order as the members in the archive. (t_checkRot_loadRn(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt getmembersgs   cCs g|jD]}|j^q S(sReturn the members of the archive as a list of their names. It has the same order as the list returned by getmembers(). (RR~(R}R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytgetnamesqsc Cs\|jd|d k r%|j}n|d kr:|}ntjj|\}}|jtjd}|jd}|j }||_ |d krt tdr|j rtj |}qtj|}ntj|j}d}|j}tj|r|j|jf} |j rj|jdkrj| |jkrj||j| krjt} |j| }qt} | dr||j| slink toN(RtprintRfRaRRRRRURWRRRRt localtimeRR~RRQRRS(R}tverboseR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRAs&   !)  c Cs|jd|dkr"|}n|dk rtddl}|jdtd||rt|jdd|dSn|jdk rtjj ||jkr|jdd|dS|jd||j ||}|dkr|jdd |dS|dk r;||}|dkr;|jdd|dSn|j rst |d }|j |||jn|jr|j ||rxTtj|D]@}|jtjj||tjj||||d |qWqn |j |dS( s~Add the file `name' to the archive. `name' may be any type of file (directory, fifo, symbolic link, etc.). If given, `arcname' specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by setting `recursive' to False. `exclude' is a function that should return True for each filename to be excluded. `filter' is a function that expects a TarInfo object argument and returns the changed TarInfo object, if it returns None the TarInfo object will be excluded from the archive. ReiNsuse the filter argument insteadistarfile: Excluded %rstarfile: Skipped %ristarfile: Unsupported type %rRbtfilter(RRItwarningstwarntDeprecationWarningt_dbgR~RuRRiRR,RhtaddfileRRtlistdirtaddR`( R}R~Rt recursivetexcludeRRRtf((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRsD        *        *cCs|jdtj|}|j|j|j|j}|jj||jt |7_|dk rt ||j|j t |j t\}}|dkr|jjtt||d7}n|j|t7_n|jj|dS(s]Add the TarInfo object `tarinfo' to the archive. If `fileobj' is given, tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects using gettarinfo(). On Windows platforms, `fileobj' should always be opened with mode 'rb' to avoid irritation about the file size. ReiiN(RRRR>R$R%RRLRR RIRURRMRR!RnR_(R}RRRERRRS((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR4s    t.cCs:g}|dkr|}nx_|D]W}|jr\|j|tj|}d|_n|j||d|j q"W|jdd|jx|D]}tj j ||j }y4|j |||j |||j||Wqtk r1}|jdkrq2|jdd|qXqWdS(sMExtract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by getmembers(). it set_attrstkeycSs|jS(N(R~(Rc((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytdR]is tarfile: %sN(RIRR_RRatextracttsorttreverseRuRR`R~tchowntutimetchmodRjRmR(R}RRnt directoriesRtdirpathRr((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt extractallNs*      !  R]cCs=|jdt|tr.|j|}n|}|jr^tjj||j|_ ny,|j |tjj||j d|Wnt k r}|j dkrq9|jdkr|jdd|jq9|jdd|j|jfn<tk r8}|j dkr!q9|jdd|nXdS(sxExtract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a TarInfo object. You can specify a different directory using `path'. File attributes (owner, mtime, mode) are set unless `set_attrs' is False. RYRiis tarfile: %sstarfile: %s %rN(RRRRRSRuRR`RRt_extract_memberR~tEnvironmentErrorRmtfilenameRIRtstrerrorRj(R}tmemberRRRRr((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRts&  ! #cCs|jdt|tr.|j|}n|}|jrP|j||S|jtkro|j||S|js|j rt|j t rt dq|j |j|SndSdS(sExtract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file, a file-like object is returned. If `member' is a link, a file-like object is constructed from the link's target. If `member' is none of the above, None is returned. The file-like object is read-only and provides the following methods: read(), readline(), readlines(), seek() and tell() RYs'cannot extract (sym)link as file objectN(RRRRR,t fileobjectRR-RSRQRRRmt extractfilet_find_link_targetRI(R}RR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRs  cCs|jd}|jdtj}tjj|}|r_tjj| r_tj|n|jsw|j r|j dd|j |j fn|j d|j |j r|j||n|jr|j||n|jr |j||n|js"|jr5|j||n]|jsM|j r`|j||n2|jtkr|j||n|j|||r|j|||j s|j|||j||qndS(s\Extract the TarInfo object tarinfo to a physical file called targetpath. Ris%s -> %sN(RRRuRRtdirnameRgtmakedirsRSRQRR~RR,tmakefileRtmakedirRYtmakefifoRURWtmakedevtmakelinkRR-t makeunknownRRR(R}Rt targetpathRt upperdirs((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRs4#    cCsFytj|dWn+tk rA}|jtjkrBqBnXdS(s,Make a directory called targetpath. iN(RutmkdirRterrnotEEXIST(R}RRRr((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRs cCs|j}|j|jt|d}|jdk rqxJ|jD])\}}|j|t|||qAWnt|||j|j|j|j|j dS(s'Make a file called targetpath. RdN( RRRRhRRIRURttruncateR(R}RRtsourcettargetRR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRs   cCs+|j|||jdd|jdS(sYMake a file from a TarInfo object with an unknown type at targetpath. is9tarfile: Unknown file type %r, extracted as regular file.N(RRR(R}RR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s cCs/ttdrtj|n tddS(s'Make a fifo called targetpath. tmkfifosfifo not supported by systemN(RzRuRRj(R}RR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR scCsttd s ttd r/tdn|j}|jrT|tjO}n |tjO}tj||tj |j |j dS(s<Make a character or block device called targetpath. tmknodRs'special devices not supported by systemN( RzRuRjRaRWRtS_IFBLKtS_IFCHRRRRR(R}RRRa((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s     cCsyj|jr%tj|j|nDtjj|jrPtj|j|n|j|j ||WnPt k r|jrtjj tjj |j |j}q|j}n>Xy|j|j ||Wntk rtdnXdS(sMake a (symbolic) link called targetpath. If it cannot be created (platform limitation), we try to make a copy of the referenced file instead of a link. s%unable to resolve link inside archiveN(RQRutsymlinkRRRgRtlinkRRtsymlink_exceptionR`RR~RRj(R}RRR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR' s"       cCstrttdrtjdkrytj|jd}Wntk r]|j}nXytj |j d}Wntk r|j }nXyZ|j rttdrtj |||n%tjdkrtj|||nWqtk r}tdqXndS(s6Set owner of targetpath according to tarinfo. tgeteuidiitlchowntos2emxscould not change ownerN(RRzRuRRtgetgrnamRRRtgetpwnamRRRQRtsystplatformRRRj(R}RRRtuRr((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRD s '    cCsOttdrKytj||jWqKtk rG}tdqKXndS(sASet file permissions of targetpath according to tarinfo. Rscould not change modeN(RzRuRRaRRj(R}RRRr((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRZ s cCsYttdsdSy tj||j|jfWntk rT}tdnXdS(sBSet modification time of targetpath according to tarinfo. RNs"could not change modification time(RzRuRRRRj(R}RRRr((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRc s  cCs|jd|jdk r2|j}d|_|S|jj|jd}xktry|jj|}WnGt k r}|j r|j dd|j|f|jt 7_qNqnt k r+}|j r|j dd|j|f|jt 7_qNq|jdkrtt|qntk rY|jdkrtdqn[tk r}|jdkrtt|qn%tk r}tt|nXPqNW|dk r|jj|n t|_|S(sReturn the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. trais0x%X: %sis empty fileN(RRqRIRRRRJRR&RqRkRRR0RkRRoRpRrRnR_Ro(R}tmRRr((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR0n sF          cCs|j}|dk r.||j| }n|rItjj|}nxKt|D]=}|rztjj|j}n |j}||krV|SqVWdS(s}Find an archive member by name from bottom to top. If tarinfo is given, it is used as the starting point. N(RRItindexRuRtnormpathtreversedR~(R}R~Rt normalizeRnRt member_name((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s    cCs6x&tr(|j}|dkrPqqWt|_dS(sWRead through the entire archive file and look for readable members. N(RJR0RIRo(R}R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s    cCsW|jr"td|jjn|dk rS|j|krStd|jndS(snCheck if TarFile is still open, and if the operation's mode corresponds to TarFile's mode. s %s is closedsbad operation for mode %rN(RRNRRgRIRa(R}Ra((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s cCs|jr5tjj|jd|j}d}n|j}|}|j|d|dt}|dkr~t d|n|S(sZFind the target member of a symlink or hardlink member in the archive. RRRslinkname %r not foundN( RQRuRRR~RRIRRJR(R}RRtlimitR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s     cCs$|jrt|jSt|SdS(s$Provide an iterator object. N(RotiterRntTarIter(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s  cCs)||jkr%t|dtjndS(s.Write debugging output to sys.stderr. tfileN(RlRRtstderr(R}tleveltmsg((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR scCs|j|S(N(R(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt __enter__ s cCs?|dkr|jn"|js2|jjnt|_dS(N(RIRRRRJR(R}RRt traceback((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__exit__ s    N(9RgRhRiRlRRjRkRmR^R>R_R$RIR%RRRRRR`RR{RwRRRvRRRRRRJRARRRRRRRRRRRRRRRR0RRRRRRRR(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR,sn  iK   b > &# & 0       1    RcBs/eZdZdZdZdZeZRS(sMIterator Class. for tarinfo in TarFile(...): suite... cCs||_d|_dS(s$Construct a TarIter object. iN(RR(R}R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s cCs|S(s Return iterator object. ((R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR scCs}|jjs9|jj}|sjt|j_tqjn1y|jj|j}Wntk ritnX|jd7_|S(sReturn the next item using TarFile's next() method. When all members have been read, set TarFile as _loaded. i(RRoR0RJt StopIterationRnRt IndexError(R}R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__next__ s     (RgRhRiRRRR0(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s    cCs7yt|}|jtSWntk r2tSXdS(sfReturn True if name points to a tar archive that we are able to handle, else return False. N(R{RRJRR(R~R[((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR# s    (xt __future__Rt __version__tversiont __author__t__date__t __cvsid__t __credits__RRuRRRR8RR3RRRRIR~tNotImplementedErrorRt WindowsErrort NameErrort__all__t version_infot __builtin__tbuiltinsR{t_openR!RRRRRRR RRRRRPRTRVRRXtCONTTYPERRRRRR)RR7RR^R-RNRRItsetR;RR.RJtS_IFLNKtS_IFREGRtS_IFDIRRtS_IFIFOtTSUIDtTSGIDtTSVTXtTUREADtTUWRITEtTUEXECtTGREADtTGWRITEtTGEXECtTOREADtTOWRITEtTOEXECR~R_tgetfilesystemencodingR&R*R5R?RHRUR^Rft ExceptionRRjRkRlRmRnRoRpRqR0RrtobjectRsRRRRRRRRRRh(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyts.                                                 ?K* site-packages/pip/_vendor/distlib/_backport/tarfile.pyo000064400000233504147204247350017304 0ustar00 abc @s>ddlmZdZdZdZdZdZdZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZyddlZddlZWnek reZZnXeefZyeef7ZWnek rnXd d d d gZejd dkr3ddlZn ddlZejZdZdZ e dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1d Z2d!Z3d"Z4d#Z5d Z6d$Z7d%Z8e7Z9e'e(e)e*e-e.e/e+e,e0e1e2f Z:e'e(e/e2fZ;e0e1e2fZ<d&d'd(d)d*d+d,d-fZ=e>d&d'd,d-fZ?ie@d.6e@d/6e@d)6eAd*6eAd+6eAd(6ZBd0ZCd1ZDd2ZEd3ZFd4ZGd5ZHd6ZId7ZJdZKd8ZLd9ZMd:ZNd;ZOd<ZPd=ZQd>ZRd%ZSd$ZTe jUd?d@fkr)dAZVn ejWZVdBZXdCZYdDZZd=e9dEZ[dFZ\edGZ]eCdHfeDdIfeEdJfeFdKfeGdLfeHdMffeLdNffeMdOffeNeIBdPfeId feNd!ffeOdNffePdOffeQeJBdPfeJd feQd!ffeRdNffeSdOffeTeKBdQfeKdRfeTd!fff Z^dSZ_d e`fdTYZadUeafdVYZbdWeafdXYZcdYeafdZYZdd[eafd\YZed]eafd^YZfd_effd`YZgdaeffdbYZhdceffddYZideeffdfYZjdgeffdhYZkdielfdjYZmdkelfdlYZndmelfdnYZodoelfdpYZpdqelfdrYZqdselfdtYZrd elfduYZsd elfdvYZtdwelfdxYZudyZveZwetjZdS(zi(tprint_functions $Revision$s0.9.0s&Lars Gust\u00e4bel (lars@gustaebel.de)s5$Date: 2011-02-25 17:42:01 +0200 (Fri, 25 Feb 2011) $s?$Id: tarfile.py 88586 2011-02-25 15:42:01Z marc-andre.lemburg $s8Gustavo Niemeyer, Niels Gust\u00e4bel, Richard Townsend.NtTarFiletTarInfot is_tarfiletTarErroriisiisustar sustar00idit0t1t2t3t4t5t6t7tLtKtStxtgtXiitpathtlinkpathtsizetmtimetuidtgidtunametgnametatimetctimeiii`i@i iiiiii@i iiitnttcesutf-8cCs,|j||}|| |t|tS(s8Convert a string to a null-terminated bytes object. (tencodetlentNUL(tstlengthtencodingterrors((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytstnscCs8|jd}|dkr(|| }n|j||S(s8Convert a null-terminated bytes object to a string. si(tfindtdecode(R"R$R%tp((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytntss  cCs|dtdkr^y%tt|ddp1dd}Wqtk rZtdqXnId}x@tt|dD](}|dK}|t||d7}q{W|S( s/Convert a number field to a python number. iitasciitstrictRisinvalid headeri(tchrtintR*t ValueErrortInvalidHeaderErrortrangeR tord(R"tnti((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytntis%  cCsd|kod|dknrHd|d|fjdt}n|tksh|d|dkrwtdn|dkrtjdtjd |d}nt}x6t|dD]$}|j d|d @|dL}qW|j dd |S( s/Convert a python number to a number field. iiis%0*oR+isoverflow in number fieldR tlii( RR!t GNU_FORMATR/tstructtunpacktpackt bytearrayR1tinsert(R3tdigitstformatR"R4((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytitns $$  % cCsxdttjd|d tjd|dd!}dttjd|d tjd|dd!}||fS( sCalculate the checksum for a member's header by summing up all characters except for the chksum field which is treated as if it was filled with spaces. According to the GNU tar sources, some tars (Sun and NeXT) calculate chksum with signed char, which will be different if there are chars in the buffer with the high bit set. So we calculate two checksums, unsigned and signed. it148Bit356Biit148bt356b(tsumR8R9(tbuftunsigned_chksumt signed_chksum((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt calc_chksumss 77cCs|dkrdS|dkrSx0trN|jd}|s>Pn|j|qWdSd}t||\}}xQt|D]C}|j|}t||krtdn|j|q{W|dkr|j|}t||krtdn|j|ndS(sjCopy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content. iNiisend of file reachedi@i@(tNonetTruetreadtwritetdivmodR1R tIOError(tsrctdstR#REtBUFSIZEtblockst remaindertb((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt copyfileobjs,    R6t-RTtdtcR)trtwR"tttTcCsig}xStD]K}xB|D]-\}}||@|kr|j|PqqW|jdq Wdj|S(scConvert a file's mode to a string of the form -rwxrwxrwx. Used by TarFile.list() RVt(tfilemode_tabletappendtjoin(tmodetpermttabletbittchar((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytfilemode8s  cBseZdZRS(sBase exception.(t__name__t __module__t__doc__(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRGst ExtractErrorcBseZdZRS(s%General exception for extract errors.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRjJst ReadErrorcBseZdZRS(s&Exception for unreadable tar archives.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRkMstCompressionErrorcBseZdZRS(s.Exception for unavailable compression methods.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRlPst StreamErrorcBseZdZRS(s=Exception for unsupported operations on stream-like TarFiles.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRmSst HeaderErrorcBseZdZRS(s!Base exception for header errors.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRnVstEmptyHeaderErrorcBseZdZRS(sException for empty headers.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRoYstTruncatedHeaderErrorcBseZdZRS(s Exception for truncated headers.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRp\stEOFHeaderErrorcBseZdZRS(s"Exception for end of file headers.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRq_sR0cBseZdZRS(sException for invalid headers.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR0bstSubsequentHeaderErrorcBseZdZRS(s3Exception for missing and invalid extended headers.(RgRhRi(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRrest _LowLevelFilecBs2eZdZdZdZdZdZRS(sLow-level file object. Supports reading and writing. It is used instead of a regular file object for streaming access. cCsgitjd6tjtjBtjBd6|}ttdrK|tjO}ntj||d|_dS(NRYRZtO_BINARYi( tostO_RDONLYtO_WRONLYtO_CREATtO_TRUNCthasattrRttopentfd(tselftnameRa((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__init__rs cCstj|jdS(N(RutcloseR|(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR{scCstj|j|S(N(RuRKR|(R}R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRK~scCstj|j|dS(N(RuRLR|(R}R"((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRLs(RgRhRiRRRKRL(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRsls   t_StreamcBseZdZdZdZdZdZdZdZdZ dZ d d Z dd Z d Zd ZRS(sClass that serves as an adapter between TarFile and a stream-like object. The stream-like object only needs to have a read() or write() method and is accessed blockwise. Use of gzip or bzip2 compression is possible. A stream-like object could be for example: sys.stdin, sys.stdout, a socket, a tape device etc. _Stream is intended to be used only internally. cCst|_|dkr0t||}t|_n|dkrWt|}|j}n|p`d|_||_||_ ||_ ||_ d|_ d|_ t|_y|dkr%yddl}Wntk rtdnX||_|jd|_|dkr|jq%|jn|d kryddl}Wntk r`td nX|dkrd|_|j|_q|j|_nWn,|js|j jnt|_nXdS( s$Construct a _Stream object. t*R]itgziNszlib module is not availableRYtbz2sbz2 module is not available(RJt _extfileobjRIRstFalset _StreamProxyt getcomptypeR~RatcomptypetfileobjtbufsizeREtpostclosedtzlibt ImportErrorRltcrc32tcrct _init_read_gzt_init_write_gzRtdbuftBZ2Decompressortcmpt BZ2CompressorR(R}R~RaRRRRR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRsP                        cCs*t|dr&|j r&|jndS(NR(RzRR(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__del__scCs|jjd|jj|jj |jjd|_tjdtt j }|j d|d|j j dr|j d |_ n|j |j j dd td S( s6Initialize for writing with gzip compression. i isZ2RS(@sInformational class which holds the details about an archive member given by a tar header block. TarInfo objects are returned by TarFile.getmember(), TarFile.getmembers() and TarFile.gettarinfo() and are usually created internally. R~RaRRRRtchksumttypetlinknameRRtdevmajortdevminorRRt pax_headersRRt_sparse_structst _link_targetR]cCs||_d|_d|_d|_d|_d|_d|_t|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_i|_dS(sXConstruct a TarInfo object. name is the optional name of the member. iiR]N(R~RaRRRRRtREGTYPERRRRRRRRRIRR(R}R~((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRs"                cCs|jS(N(R~(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt_getpathscCs ||_dS(N(R~(R}R~((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt_setpathscCs|jS(N(R(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt _getlinkpathscCs ||_dS(N(R(R}R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt _setlinkpathscCs d|jj|jt|fS(Ns<%s %r at %#x>(t __class__RgR~tid(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__repr__scCsi |jd6|jd@d6|jd6|jd6|jd6|jd6|jd6|jd 6|jd 6|j d 6|j d 6|j d 6|j d6}|d t kr|djd r|dcd7R$R%R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyttobufs    cCst|dny||jd d Wn"tk r||||nXt|||kr>||||q>WxddddfD]\}}||krd||R$R%tpartsRER((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRYs&$#cCs@tt|t\}}|dkr<|t|t7}n|S(sdReturn the string payload filled with zero bytes up to the next 512 byte border. i(RMR RR!(tpayloadRRRS((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt_create_payloadus cCsm|j||t}i}d|d<||d|j|S|jtttfkrc|j |S|j |SdS(sYChoose the right processing method depending on the type and call it. N( RRRt _proc_gnulongRt _proc_sparseRRtSOLARIS_XHDTYPEt _proc_paxt _proc_builtin(R}R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR%s   cCsx|jj|_|j}|js6|jtkrO||j|j7}n||_|j |j |j |j |S(sfProcess a builtin type or an unknown type which will be treated as a regular file. ( RRRtisregRtSUPPORTED_TYPESt_blockRRt_apply_pax_infoRR$R%(R}RR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR+$s  cCs|jj|j|j}y|j|}Wntk rPtdnX|j|_|jt krt ||j |j |_ n-|jtkrt ||j |j |_n|S(sSProcess the blocks that hold a GNU longname or longlink member. s missing or bad subsequent header(RRKR.RR&RnRrRRRR*R$R%R~RR(R}RREtnext((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR'5s  c Cs|j\}}}|`x|r|jjt}d}xtdD]}}y6t|||d!}t||d|d!} Wntk rPnX|r| r|j|| fn|d7}qFWt|d}qW||_ |jj |_ |j |j |j |_||_ |S(s8Process a GNU sparse header plus extra headers. iii ii(RRRKRR1R5R/R_RRRRR.RR( R}RR R"R#RERR4RR!((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR(Ks(     cCs|jj|j|j}|jtkr9|j}n|jj}tj d|}|dk r|j dj d|ds  cCsx|jD]\}}|dkr8t|d|q |dkr]t|dt|q |dkrt|dt|q |tkr |tkryt||}Wqtk rd}qXn|dkr|jd}nt|||q q W|j|_dS( soReplace fields with supplemental information from a previous pax extended or global header. sGNU.sparse.nameRsGNU.sparse.sizeRsGNU.sparse.realsizeiRN( RtsetattrR.t PAX_FIELDStPAX_NUMBER_FIELDSR/RRR(R}RR$R%RR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR/s"        cCs9y|j|dSWntk r4|j||SXdS(s1Decode a single field from a pax record. R,N(R(tUnicodeDecodeError(R}RR$tfallback_encodingtfallback_errors((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR:s cCs0t|t\}}|r(|d7}n|tS(s_Round up a byte count by BLOCKSIZE and return it, e.g. _block(834) => 1024. i(RMR(R}RRRRS((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR. s cCs |jtkS(N(Rt REGULAR_TYPES(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR,scCs |jS(N(R,(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytisfilescCs |jtkS(N(RR(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRscCs |jtkS(N(RtSYMTYPE(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytissymscCs |jtkS(N(RtLNKTYPE(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytislnkscCs |jtkS(N(RtCHRTYPE(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytischr scCs |jtkS(N(RtBLKTYPE(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytisblk"scCs |jtkS(N(RtFIFOTYPE(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytisfifo$scCs |jdk S(N(RRI(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytissparse&scCs|jtttfkS(N(RRTRVRX(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytisdev(s(R~RaRRRRRRRRRRRRRRRRRR(3RgRhRit __slots__RRRtpropertyRRRRRRtDEFAULT_FORMATtENCODINGRRRRt classmethodR Rt staticmethodRRRRR$R&R%R+R'R(R*R=R<R>R/R:R.R,RORRQRSRURWRYRZR[(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRs`         1  3?    f             c Bs-eZdZdZeZeZdZeZ e Z d1Z eZeZd1dd1d1d1d1d1d1dd1d1d1d Zed1dd1edZedd1dZedd1dd Zedd1dd Zid d 6d d6dd6ZdZdZdZdZd1d1d1dZedZ d1ed1d1dZ!d1dZ"dd1dZ#dedZ$dZ%edZ&dZ'd Z(d!Z)d"Z*d#Z+d$Z,d%Z-d&Z.d'Z/d(Z0d1ed)Z1d*Z2d1d+Z3d,Z4d-Z5d.Z6d/Z7d0Z8RS(2s=The TarFile Class provides an interface to tar archives. iiRYRc Cst|dks|dkr-tdn||_idd6dd6dd 6||_|s|jdkrtjj| rd |_d|_nt||j}t|_ nN|d krt |d r|j }nt |d r|j|_nt |_ |rtjj|nd |_ ||_|d k rC||_n|d k r[||_n|d k rs||_n|d k r||_n|d k r||_n| |_| d k r|jtkr| |_n i|_| d k r| |_n| d k r | |_nt|_g|_t|_|jj|_i|_y9|jdkrod |_ |j!|_ n|jdkrxt r|jj"|jy&|jj#|}|jj$|Wqt%k r|jj"|jPqt&k r } t't(| qXqWn|jd krzt |_|jrz|jj)|jj*}|jj+||jt|7_qznWn,|j s|jj,nt |_nXd S(sOpen an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' defaults to 'r'. If `fileobj' is given, it is used for reading or writing data. If it can be determined, `mode' is overridden by `fileobj's mode. `fileobj' is not closed, when TarFile is closed. iRsmode must be 'r', 'a' or 'w'trbRYsr+btatwbRZR~RatawN(-R R/Rat_modeRuRtexistst bltn_openRRRIRzR~RJtabspathRR>Rt dereferencet ignore_zerosR$R%RRtdebugt errorlevelRtmemberst_loadedRRtinodest firstmemberR0RR&R_RqRnRkRR RRLR(R}R~RaRR>RRjRkR$R%RRlRmteRE((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRFs  ""     !                             c Ks4| r| rtdn|dkrx|jD]}t||j|}|dk rj|j}ny||d||SWq3ttfk r} |dk r3|j|q3q3q3Xq3WtdnUd|krV|jdd\} }| pd} |pd}||jkr3t||j|}ntd|||| ||Sd |kr|jd d\} }| pd} |pd}| d krtd nt || |||} y||| | |} Wn| j nXt | _ | S|d kr$|j ||||Std dS(s|Open a tar archive for reading, writing or appending. Return an appropriate TarFile class. mode: 'r' or 'r:*' open for reading with transparent compression 'r:' open for reading exclusively uncompressed 'r:gz' open for reading with gzip compression 'r:bz2' open for reading with bzip2 compression 'a' or 'a:' open for appending, creating the file if necessary 'w' or 'w:' open for writing without compression 'w:gz' open for writing with gzip compression 'w:bz2' open for writing with bzip2 compression 'r|*' open a stream of tar blocks with transparent compression 'r|' open an uncompressed stream of tar blocks for reading 'r|gz' open a gzip compressed stream of tar blocks 'r|bz2' open a bzip2 compressed stream of tar blocks 'w|' open an uncompressed stream for writing 'w|gz' open a gzip compressed stream for writing 'w|bz2' open a bzip2 compressed stream for writing snothing to openRYsr:*s%file could not be opened successfullyt:iRsunknown compression type %rt|trwsmode must be 'r' or 'w'Resundiscernible modeN(RYsr:*(R/t OPEN_METHRRIRRkRlRRERRRRttaropen( R R~RaRRtkwargsRtfunct saved_posRrRftstreamR[((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR{sN              cKs@t|dks|dkr-tdn|||||S(sCOpen uncompressed tar archive name for reading or writing. iRsmode must be 'r', 'a' or 'w'(R R/(R R~RaRRx((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRwsi c Ks6t|dks|dkr-tdnyddl}|jWn#ttfk ritdnX|dk }y8|j||d||}|j||||}Wnxt k r| r|dk r|j n|dkrnt dn*| r"|dk r"|j nnX||_ |S( skOpen gzip compressed tar archive name for reading or writing. Appending is not allowed. iRusmode must be 'r' or 'w'iNsgzip module is not availableRTsnot a gzip file( R R/tgziptGzipFileRtAttributeErrorRlRIRwRNRRkR( R R~RaRt compresslevelRxR|t extfileobjR[((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytgzopens.        cKst|dks|dkr-tdnyddl}Wntk r\tdnX|dk r{t||}n|j||d|}y|j||||}Wn-t t fk r|j t dnXt |_|S( slOpen bzip2 compressed tar archive name for reading or writing. Appending is not allowed. iRusmode must be 'r' or 'w'.iNsbz2 module is not availableRsnot a bzip2 file(R R/RRRlRIRtBZ2FileRwRNtEOFErrorRRkRR(R R~RaRRRxRR[((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytbz2open$s     RwRRRRRcCs|jr dS|jdkr|jjttd|jtd7_t|jt\}}|dkr|jjtt|qn|j s|jj nt |_dS(slClose the TarFile. In write-mode, two finishing zero blocks are appended to the archive. NReii( RRaRRLR!RRRMt RECORDSIZERRRJ(R}RRRS((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRHs   cCs2|j|}|dkr.td|n|S(sReturn a TarInfo object for member `name'. If `name' can not be found in the archive, KeyError is raised. If a member occurs more than once in the archive, its last occurrence is assumed to be the most up-to-date version. sfilename %r not foundN(t _getmemberRItKeyError(R}R~R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt getmember\s cCs'|j|js |jn|jS(sReturn the members of the archive as a list of TarInfo objects. The list has the same order as the members in the archive. (t_checkRot_loadRn(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt getmembersgs   cCs g|jD]}|j^q S(sReturn the members of the archive as a list of their names. It has the same order as the list returned by getmembers(). (RR~(R}R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytgetnamesqsc Cs\|jd|d k r%|j}n|d kr:|}ntjj|\}}|jtjd}|jd}|j }||_ |d krt tdr|j rtj |}qtj|}ntj|j}d}|j}tj|r|j|jf} |j rj|jdkrj| |jkrj||j| krjt} |j| }qt} | dr||j| slink toN(RtprintRfRaRRRRRURWRRRRt localtimeRR~RRQRRS(R}tverboseR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRAs&   !)  c Cs|jd|dkr"|}n|dk rtddl}|jdtd||rt|jdd|dSn|jdk rtjj ||jkr|jdd|dS|jd||j ||}|dkr|jdd |dS|dk r;||}|dkr;|jdd|dSn|j rst |d }|j |||jn|jr|j ||rxTtj|D]@}|jtjj||tjj||||d |qWqn |j |dS( s~Add the file `name' to the archive. `name' may be any type of file (directory, fifo, symbolic link, etc.). If given, `arcname' specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by setting `recursive' to False. `exclude' is a function that should return True for each filename to be excluded. `filter' is a function that expects a TarInfo object argument and returns the changed TarInfo object, if it returns None the TarInfo object will be excluded from the archive. ReiNsuse the filter argument insteadistarfile: Excluded %rstarfile: Skipped %ristarfile: Unsupported type %rRbtfilter(RRItwarningstwarntDeprecationWarningt_dbgR~RuRRiRR,RhtaddfileRRtlistdirtaddR`( R}R~Rt recursivetexcludeRRRtf((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRsD        *        *cCs|jdtj|}|j|j|j|j}|jj||jt |7_|dk rt ||j|j t |j t\}}|dkr|jjtt||d7}n|j|t7_n|jj|dS(s]Add the TarInfo object `tarinfo' to the archive. If `fileobj' is given, tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects using gettarinfo(). On Windows platforms, `fileobj' should always be opened with mode 'rb' to avoid irritation about the file size. ReiiN(RRRR>R$R%RRLRR RIRURRMRR!RnR_(R}RRRERRRS((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR4s    t.cCs:g}|dkr|}nx_|D]W}|jr\|j|tj|}d|_n|j||d|j q"W|jdd|jx|D]}tj j ||j }y4|j |||j |||j||Wqtk r1}|jdkrq2|jdd|qXqWdS(sMExtract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by getmembers(). it set_attrstkeycSs|jS(N(R~(Rc((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pytdR]is tarfile: %sN(RIRR_RRatextracttsorttreverseRuRR`R~tchowntutimetchmodRjRmR(R}RRnt directoriesRtdirpathRr((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt extractallNs*      !  R]cCs=|jdt|tr.|j|}n|}|jr^tjj||j|_ ny,|j |tjj||j d|Wnt k r}|j dkrq9|jdkr|jdd|jq9|jdd|j|jfn<tk r8}|j dkr!q9|jdd|nXdS(sxExtract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a TarInfo object. You can specify a different directory using `path'. File attributes (owner, mtime, mode) are set unless `set_attrs' is False. RYRiis tarfile: %sstarfile: %s %rN(RRRRRSRuRR`RRt_extract_memberR~tEnvironmentErrorRmtfilenameRIRtstrerrorRj(R}tmemberRRRRr((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRts&  ! #cCs|jdt|tr.|j|}n|}|jrP|j||S|jtkro|j||S|js|j rt|j t rt dq|j |j|SndSdS(sExtract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file, a file-like object is returned. If `member' is a link, a file-like object is constructed from the link's target. If `member' is none of the above, None is returned. The file-like object is read-only and provides the following methods: read(), readline(), readlines(), seek() and tell() RYs'cannot extract (sym)link as file objectN(RRRRR,t fileobjectRR-RSRQRRRmt extractfilet_find_link_targetRI(R}RR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRs  cCs|jd}|jdtj}tjj|}|r_tjj| r_tj|n|jsw|j r|j dd|j |j fn|j d|j |j r|j||n|jr|j||n|jr |j||n|js"|jr5|j||n]|jsM|j r`|j||n2|jtkr|j||n|j|||r|j|||j s|j|||j||qndS(s\Extract the TarInfo object tarinfo to a physical file called targetpath. Ris%s -> %sN(RRRuRRtdirnameRgtmakedirsRSRQRR~RR,tmakefileRtmakedirRYtmakefifoRURWtmakedevtmakelinkRR-t makeunknownRRR(R}Rt targetpathRt upperdirs((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRs4#    cCsFytj|dWn+tk rA}|jtjkrBqBnXdS(s,Make a directory called targetpath. iN(RutmkdirRterrnotEEXIST(R}RRRr((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRs cCs|j}|j|jt|d}|jdk rqxJ|jD])\}}|j|t|||qAWnt|||j|j|j|j|j dS(s'Make a file called targetpath. RdN( RRRRhRRIRURttruncateR(R}RRtsourcettargetRR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRs   cCs+|j|||jdd|jdS(sYMake a file from a TarInfo object with an unknown type at targetpath. is9tarfile: Unknown file type %r, extracted as regular file.N(RRR(R}RR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s cCs/ttdrtj|n tddS(s'Make a fifo called targetpath. tmkfifosfifo not supported by systemN(RzRuRRj(R}RR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR scCsttd s ttd r/tdn|j}|jrT|tjO}n |tjO}tj||tj |j |j dS(s<Make a character or block device called targetpath. tmknodRs'special devices not supported by systemN( RzRuRjRaRWRtS_IFBLKtS_IFCHRRRRR(R}RRRa((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s     cCsyj|jr%tj|j|nDtjj|jrPtj|j|n|j|j ||WnPt k r|jrtjj tjj |j |j}q|j}n>Xy|j|j ||Wntk rtdnXdS(sMake a (symbolic) link called targetpath. If it cannot be created (platform limitation), we try to make a copy of the referenced file instead of a link. s%unable to resolve link inside archiveN(RQRutsymlinkRRRgRtlinkRRtsymlink_exceptionR`RR~RRj(R}RRR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR' s"       cCstrttdrtjdkrytj|jd}Wntk r]|j}nXytj |j d}Wntk r|j }nXyZ|j rttdrtj |||n%tjdkrtj|||nWqtk r}tdqXndS(s6Set owner of targetpath according to tarinfo. tgeteuidiitlchowntos2emxscould not change ownerN(RRzRuRRtgetgrnamRRRtgetpwnamRRRQRtsystplatformRRRj(R}RRRtuRr((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRD s '    cCsOttdrKytj||jWqKtk rG}tdqKXndS(sASet file permissions of targetpath according to tarinfo. Rscould not change modeN(RzRuRRaRRj(R}RRRr((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRZ s cCsYttdsdSy tj||j|jfWntk rT}tdnXdS(sBSet modification time of targetpath according to tarinfo. RNs"could not change modification time(RzRuRRRRj(R}RRRr((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRc s  cCs|jd|jdk r2|j}d|_|S|jj|jd}xktry|jj|}WnGt k r}|j r|j dd|j|f|jt 7_qNqnt k r+}|j r|j dd|j|f|jt 7_qNq|jdkrtt|qntk rY|jdkrtdqn[tk r}|jdkrtt|qn%tk r}tt|nXPqNW|dk r|jj|n t|_|S(sReturn the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. trais0x%X: %sis empty fileN(RRqRIRRRRJRR&RqRkRRR0RkRRoRpRrRnR_Ro(R}tmRRr((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR0n sF          cCs|j}|dk r.||j| }n|rItjj|}nxKt|D]=}|rztjj|j}n |j}||krV|SqVWdS(s}Find an archive member by name from bottom to top. If tarinfo is given, it is used as the starting point. N(RRItindexRuRtnormpathtreversedR~(R}R~Rt normalizeRnRt member_name((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s    cCs6x&tr(|j}|dkrPqqWt|_dS(sWRead through the entire archive file and look for readable members. N(RJR0RIRo(R}R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s    cCsW|jr"td|jjn|dk rS|j|krStd|jndS(snCheck if TarFile is still open, and if the operation's mode corresponds to TarFile's mode. s %s is closedsbad operation for mode %rN(RRNRRgRIRa(R}Ra((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s cCs|jr5tjj|jd|j}d}n|j}|}|j|d|dt}|dkr~t d|n|S(sZFind the target member of a symlink or hardlink member in the archive. RRRslinkname %r not foundN( RQRuRRR~RRIRRJR(R}RRtlimitR((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s     cCs$|jrt|jSt|SdS(s$Provide an iterator object. N(RotiterRntTarIter(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s  cCs)||jkr%t|dtjndS(s.Write debugging output to sys.stderr. tfileN(RlRRtstderr(R}tleveltmsg((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR scCs|j|S(N(R(R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt __enter__ s cCs?|dkr|jn"|js2|jjnt|_dS(N(RIRRRRJR(R}RRt traceback((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__exit__ s    N(9RgRhRiRlRRjRkRmR^R>R_R$RIR%RRRRRR`RR{RwRRRvRRRRRRJRARRRRRRRRRRRRRRRR0RRRRRRRR(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR,sn  iK   b > &# & 0       1    RcBs/eZdZdZdZdZeZRS(sMIterator Class. for tarinfo in TarFile(...): suite... cCs||_d|_dS(s$Construct a TarIter object. iN(RR(R}R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s cCs|S(s Return iterator object. ((R}((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR scCs}|jjs9|jj}|sjt|j_tqjn1y|jj|j}Wntk ritnX|jd7_|S(sReturn the next item using TarFile's next() method. When all members have been read, set TarFile as _loaded. i(RRoR0RJt StopIterationRnRt IndexError(R}R((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__next__ s     (RgRhRiRRRR0(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR s    cCs7yt|}|jtSWntk r2tSXdS(sfReturn True if name points to a tar archive that we are able to handle, else return False. N(R{RRJRR(R~R[((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR# s    (xt __future__Rt __version__tversiont __author__t__date__t __cvsid__t __credits__RRuRRRR8RR3RRRRIR~tNotImplementedErrorRt WindowsErrort NameErrort__all__t version_infot __builtin__tbuiltinsR{t_openR!RRRRRRR RRRRRPRTRVRRXtCONTTYPERRRRRR)RR7RR^R-RNRRItsetR;RR.RJtS_IFLNKtS_IFREGRtS_IFDIRRtS_IFIFOtTSUIDtTSGIDtTSVTXtTUREADtTUWRITEtTUEXECtTGREADtTGWRITEtTGEXECtTOREADtTOWRITEtTOEXECR~R_tgetfilesystemencodingR&R*R5R?RHRUR^Rft ExceptionRRjRkRlRmRnRoRpRqR0RrtobjectRsRRRRRRRRRRh(((sI/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.pyts.                                                 ?K* site-packages/pip/_vendor/distlib/__init__.py000064400000001105147204247350015260 0ustar00# -*- 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()) site-packages/pip/_vendor/distlib/__init__.pyc000064400000002475147204247350015436 0ustar00 abc@sddlZdZdefdYZyddlmZWn*ek rhdejfdYZnXejeZ e j edS(iNs0.2.4tDistlibExceptioncBseZRS((t__name__t __module__(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.pyR s(t NullHandlerRcBs#eZdZdZdZRS(cCsdS(N((tselftrecord((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.pythandletcCsdS(N((RR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.pytemitRcCs d|_dS(N(tNonetlock(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.pyt createLockR(RRRRR (((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.pyRs  ( tloggingt __version__t ExceptionRRt ImportErrortHandlert getLoggerRtloggert addHandler(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.pyts  site-packages/pip/_vendor/distlib/__init__.pyo000064400000002475147204247350015452 0ustar00 abc@sddlZdZdefdYZyddlmZWn*ek rhdejfdYZnXejeZ e j edS(iNs0.2.4tDistlibExceptioncBseZRS((t__name__t __module__(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.pyR s(t NullHandlerRcBs#eZdZdZdZRS(cCsdS(N((tselftrecord((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.pythandletcCsdS(N((RR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.pytemitRcCs d|_dS(N(tNonetlock(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.pyt createLockR(RRRRR (((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.pyRs  ( tloggingt __version__t ExceptionRRt ImportErrortHandlert getLoggerRtloggert addHandler(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/__init__.pyts  site-packages/pip/_vendor/distlib/compat.py000064400000117541147204247350015020 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2013-2016 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # from __future__ import absolute_import import os import re import sys try: import ssl except ImportError: ssl = None if sys.version_info[0] < 3: # pragma: no cover from StringIO import StringIO string_types = basestring, text_type = unicode from types import FileType as file_type import __builtin__ as builtins import ConfigParser as configparser from ._backport import shutil from urlparse import urlparse, urlunparse, urljoin, urlsplit, urlunsplit from urllib import (urlretrieve, quote as _quote, unquote, url2pathname, pathname2url, ContentTooShortError, splittype) def quote(s): if isinstance(s, unicode): s = s.encode('utf-8') return _quote(s) import urllib2 from urllib2 import (Request, urlopen, URLError, HTTPError, HTTPBasicAuthHandler, HTTPPasswordMgr, HTTPHandler, HTTPRedirectHandler, build_opener) if ssl: from urllib2 import HTTPSHandler import httplib import xmlrpclib import Queue as queue from HTMLParser import HTMLParser import htmlentitydefs raw_input = raw_input from itertools import ifilter as filter from itertools import ifilterfalse as filterfalse _userprog = None def splituser(host): """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.""" global _userprog if _userprog is None: import re _userprog = re.compile('^(.*)@(.*)$') match = _userprog.match(host) if match: return match.group(1, 2) return None, host else: # pragma: no cover from io import StringIO string_types = str, text_type = str from io import TextIOWrapper as file_type import builtins import configparser import shutil from urllib.parse import (urlparse, urlunparse, urljoin, splituser, quote, unquote, urlsplit, urlunsplit, splittype) from urllib.request import (urlopen, urlretrieve, Request, url2pathname, pathname2url, HTTPBasicAuthHandler, HTTPPasswordMgr, HTTPHandler, HTTPRedirectHandler, build_opener) if ssl: from urllib.request import HTTPSHandler from urllib.error import HTTPError, URLError, ContentTooShortError import http.client as httplib import urllib.request as urllib2 import xmlrpc.client as xmlrpclib import queue from html.parser import HTMLParser import html.entities as htmlentitydefs raw_input = input from itertools import filterfalse filter = filter try: from ssl import match_hostname, CertificateError except ImportError: # pragma: no cover class CertificateError(ValueError): pass def _dnsname_match(dn, hostname, max_wildcards=1): """Matching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3 """ pats = [] if not dn: return False parts = dn.split('.') leftmost, remainder = parts[0], parts[1:] wildcards = leftmost.count('*') if wildcards > max_wildcards: # Issue #17980: avoid denials of service by refusing more # than one wildcard per fragment. A survey of established # policy among SSL implementations showed it to be a # reasonable choice. raise CertificateError( "too many wildcards in certificate DNS name: " + repr(dn)) # speed up common case w/o wildcards if not wildcards: return dn.lower() == hostname.lower() # RFC 6125, section 6.4.3, subitem 1. # The client SHOULD NOT attempt to match a presented identifier in which # the wildcard character comprises a label other than the left-most label. if leftmost == '*': # When '*' is a fragment by itself, it matches a non-empty dotless # fragment. pats.append('[^.]+') elif leftmost.startswith('xn--') or hostname.startswith('xn--'): # RFC 6125, section 6.4.3, subitem 3. # The client SHOULD NOT attempt to match a presented identifier # where the wildcard character is embedded within an A-label or # U-label of an internationalized domain name. pats.append(re.escape(leftmost)) else: # Otherwise, '*' matches any dotless string, e.g. www* pats.append(re.escape(leftmost).replace(r'\*', '[^.]*')) # add the remaining fragments, ignore any wildcards for frag in remainder: pats.append(re.escape(frag)) pat = re.compile(r'\A' + r'\.'.join(pats) + r'\Z', re.IGNORECASE) return pat.match(hostname) def match_hostname(cert, hostname): """Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function returns nothing. """ if not cert: raise ValueError("empty or no certificate, match_hostname needs a " "SSL socket or SSL context with either " "CERT_OPTIONAL or CERT_REQUIRED") dnsnames = [] san = cert.get('subjectAltName', ()) for key, value in san: if key == 'DNS': if _dnsname_match(value, hostname): return dnsnames.append(value) if not dnsnames: # The subject is only checked when there is no dNSName entry # in subjectAltName for sub in cert.get('subject', ()): for key, value in sub: # XXX according to RFC 2818, the most specific Common Name # must be used. if key == 'commonName': if _dnsname_match(value, hostname): return dnsnames.append(value) if len(dnsnames) > 1: raise CertificateError("hostname %r " "doesn't match either of %s" % (hostname, ', '.join(map(repr, dnsnames)))) elif len(dnsnames) == 1: raise CertificateError("hostname %r " "doesn't match %r" % (hostname, dnsnames[0])) else: raise CertificateError("no appropriate commonName or " "subjectAltName fields were found") try: from types import SimpleNamespace as Container except ImportError: # pragma: no cover class Container(object): """ A generic container for when multiple values need to be returned """ def __init__(self, **kwargs): self.__dict__.update(kwargs) try: from shutil import which except ImportError: # pragma: no cover # Implementation from Python 3.3 def which(cmd, mode=os.F_OK | os.X_OK, path=None): """Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. """ # Check that a given file can be accessed with the correct mode. # Additionally check that `file` is not a directory, as on Windows # directories pass the os.access check. def _access_check(fn, mode): return (os.path.exists(fn) and os.access(fn, mode) and not os.path.isdir(fn)) # If we're given a path with a directory part, look it up directly rather # than referring to PATH directories. This includes checking relative to the # current directory, e.g. ./script if os.path.dirname(cmd): if _access_check(cmd, mode): return cmd return None if path is None: path = os.environ.get("PATH", os.defpath) if not path: return None path = path.split(os.pathsep) if sys.platform == "win32": # The current directory takes precedence on Windows. if not os.curdir in path: path.insert(0, os.curdir) # PATHEXT is necessary to check on Windows. pathext = os.environ.get("PATHEXT", "").split(os.pathsep) # See if the given file matches any of the expected path extensions. # This will allow us to short circuit when given "python.exe". # If it does match, only test that one, otherwise we have to try # others. if any(cmd.lower().endswith(ext.lower()) for ext in pathext): files = [cmd] else: files = [cmd + ext for ext in pathext] else: # On other platforms you don't have things like PATHEXT to tell you # what file suffixes are executable, so just pass on cmd as-is. files = [cmd] seen = set() for dir in path: normdir = os.path.normcase(dir) if not normdir in seen: seen.add(normdir) for thefile in files: name = os.path.join(dir, thefile) if _access_check(name, mode): return name return None # ZipFile is a context manager in 2.7, but not in 2.6 from zipfile import ZipFile as BaseZipFile if hasattr(BaseZipFile, '__enter__'): # pragma: no cover ZipFile = BaseZipFile else: from zipfile import ZipExtFile as BaseZipExtFile class ZipExtFile(BaseZipExtFile): def __init__(self, base): self.__dict__.update(base.__dict__) def __enter__(self): return self def __exit__(self, *exc_info): self.close() # return None, so if an exception occurred, it will propagate class ZipFile(BaseZipFile): def __enter__(self): return self def __exit__(self, *exc_info): self.close() # return None, so if an exception occurred, it will propagate def open(self, *args, **kwargs): base = BaseZipFile.open(self, *args, **kwargs) return ZipExtFile(base) try: from platform import python_implementation except ImportError: # pragma: no cover def python_implementation(): """Return a string identifying the Python implementation.""" if 'PyPy' in sys.version: return 'PyPy' if os.name == 'java': return 'Jython' if sys.version.startswith('IronPython'): return 'IronPython' return 'CPython' try: import sysconfig except ImportError: # pragma: no cover from ._backport import sysconfig try: callable = callable except NameError: # pragma: no cover from collections import Callable def callable(obj): return isinstance(obj, Callable) try: fsencode = os.fsencode fsdecode = os.fsdecode except AttributeError: # pragma: no cover _fsencoding = sys.getfilesystemencoding() if _fsencoding == 'mbcs': _fserrors = 'strict' else: _fserrors = 'surrogateescape' def fsencode(filename): if isinstance(filename, bytes): return filename elif isinstance(filename, text_type): return filename.encode(_fsencoding, _fserrors) else: raise TypeError("expect bytes or str, not %s" % type(filename).__name__) def fsdecode(filename): if isinstance(filename, text_type): return filename elif isinstance(filename, bytes): return filename.decode(_fsencoding, _fserrors) else: raise TypeError("expect bytes or str, not %s" % type(filename).__name__) try: from tokenize import detect_encoding except ImportError: # pragma: no cover from codecs import BOM_UTF8, lookup import re cookie_re = re.compile("coding[:=]\s*([-\w.]+)") def _get_normal_name(orig_enc): """Imitates get_normal_name in tokenizer.c.""" # Only care about the first 12 characters. enc = orig_enc[:12].lower().replace("_", "-") if enc == "utf-8" or enc.startswith("utf-8-"): return "utf-8" if enc in ("latin-1", "iso-8859-1", "iso-latin-1") or \ enc.startswith(("latin-1-", "iso-8859-1-", "iso-latin-1-")): return "iso-8859-1" return orig_enc def detect_encoding(readline): """ The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. """ try: filename = readline.__self__.name except AttributeError: filename = None bom_found = False encoding = None default = 'utf-8' def read_or_stop(): try: return readline() except StopIteration: return b'' def find_cookie(line): try: # Decode as UTF-8. Either the line is an encoding declaration, # in which case it should be pure ASCII, or it must be UTF-8 # per default encoding. line_string = line.decode('utf-8') except UnicodeDecodeError: msg = "invalid or missing encoding declaration" if filename is not None: msg = '{} for {!r}'.format(msg, filename) raise SyntaxError(msg) matches = cookie_re.findall(line_string) if not matches: return None encoding = _get_normal_name(matches[0]) try: codec = lookup(encoding) except LookupError: # This behaviour mimics the Python interpreter if filename is None: msg = "unknown encoding: " + encoding else: msg = "unknown encoding for {!r}: {}".format(filename, encoding) raise SyntaxError(msg) if bom_found: if codec.name != 'utf-8': # This behaviour mimics the Python interpreter if filename is None: msg = 'encoding problem: utf-8' else: msg = 'encoding problem for {!r}: utf-8'.format(filename) raise SyntaxError(msg) encoding += '-sig' return encoding first = read_or_stop() if first.startswith(BOM_UTF8): bom_found = True first = first[3:] default = 'utf-8-sig' if not first: return default, [] encoding = find_cookie(first) if encoding: return encoding, [first] second = read_or_stop() if not second: return default, [first] encoding = find_cookie(second) if encoding: return encoding, [first, second] return default, [first, second] # For converting & <-> & etc. try: from html import escape except ImportError: from cgi import escape if sys.version_info[:2] < (3, 4): unescape = HTMLParser().unescape else: from html import unescape try: from collections import ChainMap except ImportError: # pragma: no cover from collections import MutableMapping try: from reprlib import recursive_repr as _recursive_repr except ImportError: def _recursive_repr(fillvalue='...'): ''' Decorator to make a repr function return fillvalue for a recursive call ''' def decorating_function(user_function): repr_running = set() def wrapper(self): key = id(self), get_ident() if key in repr_running: return fillvalue repr_running.add(key) try: result = user_function(self) finally: repr_running.discard(key) return result # Can't use functools.wraps() here because of bootstrap issues wrapper.__module__ = getattr(user_function, '__module__') wrapper.__doc__ = getattr(user_function, '__doc__') wrapper.__name__ = getattr(user_function, '__name__') wrapper.__annotations__ = getattr(user_function, '__annotations__', {}) return wrapper return decorating_function class ChainMap(MutableMapping): ''' A ChainMap groups multiple dicts (or other mappings) together to create a single, updateable view. The underlying mappings are stored in a list. That list is public and can accessed or updated using the *maps* attribute. There is no other state. Lookups search the underlying mappings successively until a key is found. In contrast, writes, updates, and deletions only operate on the first mapping. ''' def __init__(self, *maps): '''Initialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. ''' self.maps = list(maps) or [{}] # always at least one map def __missing__(self, key): raise KeyError(key) def __getitem__(self, key): for mapping in self.maps: try: return mapping[key] # can't use 'key in mapping' with defaultdict except KeyError: pass return self.__missing__(key) # support subclasses that define __missing__ def get(self, key, default=None): return self[key] if key in self else default def __len__(self): return len(set().union(*self.maps)) # reuses stored hash values if possible def __iter__(self): return iter(set().union(*self.maps)) def __contains__(self, key): return any(key in m for m in self.maps) def __bool__(self): return any(self.maps) @_recursive_repr() def __repr__(self): return '{0.__class__.__name__}({1})'.format( self, ', '.join(map(repr, self.maps))) @classmethod def fromkeys(cls, iterable, *args): 'Create a ChainMap with a single dict created from the iterable.' return cls(dict.fromkeys(iterable, *args)) def copy(self): 'New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]' return self.__class__(self.maps[0].copy(), *self.maps[1:]) __copy__ = copy def new_child(self): # like Django's Context.push() 'New ChainMap with a new dict followed by all previous maps.' return self.__class__({}, *self.maps) @property def parents(self): # like Django's Context.pop() 'New ChainMap from maps[1:].' return self.__class__(*self.maps[1:]) def __setitem__(self, key, value): self.maps[0][key] = value def __delitem__(self, key): try: del self.maps[0][key] except KeyError: raise KeyError('Key not found in the first mapping: {!r}'.format(key)) def popitem(self): 'Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.' try: return self.maps[0].popitem() except KeyError: raise KeyError('No keys found in the first mapping.') def pop(self, key, *args): 'Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].' try: return self.maps[0].pop(key, *args) except KeyError: raise KeyError('Key not found in the first mapping: {!r}'.format(key)) def clear(self): 'Clear maps[0], leaving maps[1:] intact.' self.maps[0].clear() try: from imp import cache_from_source except ImportError: # pragma: no cover def cache_from_source(path, debug_override=None): assert path.endswith('.py') if debug_override is None: debug_override = __debug__ if debug_override: suffix = 'c' else: suffix = 'o' return path + suffix try: from collections import OrderedDict except ImportError: # pragma: no cover ## {{{ http://code.activestate.com/recipes/576693/ (r9) # Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy. # Passes Python2.7's test suite and incorporates all the latest updates. try: from thread import get_ident as _get_ident except ImportError: from dummy_thread import get_ident as _get_ident try: from _abcoll import KeysView, ValuesView, ItemsView except ImportError: pass class OrderedDict(dict): 'Dictionary that remembers insertion order' # An inherited dict maps keys to values. # The inherited dict provides __getitem__, __len__, __contains__, and get. # The remaining methods are order-aware. # Big-O running times for all methods are the same as for regular dictionaries. # The internal self.__map dictionary maps keys to links in a doubly linked list. # The circular doubly linked list starts and ends with a sentinel element. # The sentinel element never gets deleted (this simplifies the algorithm). # Each link is stored as a list of length three: [PREV, NEXT, KEY]. def __init__(self, *args, **kwds): '''Initialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. ''' if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) try: self.__root except AttributeError: self.__root = root = [] # sentinel node root[:] = [root, root, None] self.__map = {} self.__update(*args, **kwds) def __setitem__(self, key, value, dict_setitem=dict.__setitem__): 'od.__setitem__(i, y) <==> od[i]=y' # Setting a new item creates a new link which goes at the end of the linked # list, and the inherited dictionary is updated with the new key/value pair. if key not in self: root = self.__root last = root[0] last[1] = root[0] = self.__map[key] = [last, root, key] dict_setitem(self, key, value) def __delitem__(self, key, dict_delitem=dict.__delitem__): 'od.__delitem__(y) <==> del od[y]' # Deleting an existing item uses self.__map to find the link which is # then removed by updating the links in the predecessor and successor nodes. dict_delitem(self, key) link_prev, link_next, key = self.__map.pop(key) link_prev[1] = link_next link_next[0] = link_prev def __iter__(self): 'od.__iter__() <==> iter(od)' root = self.__root curr = root[1] while curr is not root: yield curr[2] curr = curr[1] def __reversed__(self): 'od.__reversed__() <==> reversed(od)' root = self.__root curr = root[0] while curr is not root: yield curr[2] curr = curr[0] def clear(self): 'od.clear() -> None. Remove all items from od.' try: for node in self.__map.itervalues(): del node[:] root = self.__root root[:] = [root, root, None] self.__map.clear() except AttributeError: pass dict.clear(self) def popitem(self, last=True): '''od.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. ''' if not self: raise KeyError('dictionary is empty') root = self.__root if last: link = root[0] link_prev = link[0] link_prev[1] = root root[0] = link_prev else: link = root[1] link_next = link[1] root[1] = link_next link_next[0] = root key = link[2] del self.__map[key] value = dict.pop(self, key) return key, value # -- the following methods do not depend on the internal structure -- def keys(self): 'od.keys() -> list of keys in od' return list(self) def values(self): 'od.values() -> list of values in od' return [self[key] for key in self] def items(self): 'od.items() -> list of (key, value) pairs in od' return [(key, self[key]) for key in self] def iterkeys(self): 'od.iterkeys() -> an iterator over the keys in od' return iter(self) def itervalues(self): 'od.itervalues -> an iterator over the values in od' for k in self: yield self[k] def iteritems(self): 'od.iteritems -> an iterator over the (key, value) items in od' for k in self: yield (k, self[k]) def update(*args, **kwds): '''od.update(E, **F) -> None. Update od from dict/iterable E and F. If E is a dict instance, does: for k in E: od[k] = E[k] If E has a .keys() method, does: for k in E.keys(): od[k] = E[k] Or if E is an iterable of items, does: for k, v in E: od[k] = v In either case, this is followed by: for k, v in F.items(): od[k] = v ''' if len(args) > 2: raise TypeError('update() takes at most 2 positional ' 'arguments (%d given)' % (len(args),)) elif not args: raise TypeError('update() takes at least 1 argument (0 given)') self = args[0] # Make progressively weaker assumptions about "other" other = () if len(args) == 2: other = args[1] if isinstance(other, dict): for key in other: self[key] = other[key] elif hasattr(other, 'keys'): for key in other.keys(): self[key] = other[key] else: for key, value in other: self[key] = value for key, value in kwds.items(): self[key] = value __update = update # let subclasses override update without breaking __init__ __marker = object() def pop(self, key, default=__marker): '''od.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. ''' if key in self: result = self[key] del self[key] return result if default is self.__marker: raise KeyError(key) return default def setdefault(self, key, default=None): 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od' if key in self: return self[key] self[key] = default return default def __repr__(self, _repr_running=None): 'od.__repr__() <==> repr(od)' if not _repr_running: _repr_running = {} call_key = id(self), _get_ident() if call_key in _repr_running: return '...' _repr_running[call_key] = 1 try: if not self: return '%s()' % (self.__class__.__name__,) return '%s(%r)' % (self.__class__.__name__, self.items()) finally: del _repr_running[call_key] def __reduce__(self): 'Return state information for pickling' items = [[k, self[k]] for k in self] inst_dict = vars(self).copy() for k in vars(OrderedDict()): inst_dict.pop(k, None) if inst_dict: return (self.__class__, (items,), inst_dict) return self.__class__, (items,) def copy(self): 'od.copy() -> a shallow copy of od' return self.__class__(self) @classmethod def fromkeys(cls, iterable, value=None): '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S and values equal to v (which defaults to None). ''' d = cls() for key in iterable: d[key] = value return d def __eq__(self, other): '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. ''' if isinstance(other, OrderedDict): return len(self)==len(other) and self.items() == other.items() return dict.__eq__(self, other) def __ne__(self, other): return not self == other # -- the following methods are only used in Python 2.7 -- def viewkeys(self): "od.viewkeys() -> a set-like object providing a view on od's keys" return KeysView(self) def viewvalues(self): "od.viewvalues() -> an object providing a view on od's values" return ValuesView(self) def viewitems(self): "od.viewitems() -> a set-like object providing a view on od's items" return ItemsView(self) try: from logging.config import BaseConfigurator, valid_ident except ImportError: # pragma: no cover IDENTIFIER = re.compile('^[a-z_][a-z0-9_]*$', re.I) def valid_ident(s): m = IDENTIFIER.match(s) if not m: raise ValueError('Not a valid Python identifier: %r' % s) return True # The ConvertingXXX classes are wrappers around standard Python containers, # and they serve to convert any suitable values in the container. The # conversion converts base dicts, lists and tuples to their wrapped # equivalents, whereas strings which match a conversion format are converted # appropriately. # # Each wrapper should have a configurator attribute holding the actual # configurator to use for conversion. class ConvertingDict(dict): """A converting dictionary wrapper.""" def __getitem__(self, key): value = dict.__getitem__(self, key) result = self.configurator.convert(value) #If the converted value is different, save for next time if value is not result: self[key] = result if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result def get(self, key, default=None): value = dict.get(self, key, default) result = self.configurator.convert(value) #If the converted value is different, save for next time if value is not result: self[key] = result if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result def pop(self, key, default=None): value = dict.pop(self, key, default) result = self.configurator.convert(value) if value is not result: if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result class ConvertingList(list): """A converting list wrapper.""" def __getitem__(self, key): value = list.__getitem__(self, key) result = self.configurator.convert(value) #If the converted value is different, save for next time if value is not result: self[key] = result if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result def pop(self, idx=-1): value = list.pop(self, idx) result = self.configurator.convert(value) if value is not result: if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self return result class ConvertingTuple(tuple): """A converting tuple wrapper.""" def __getitem__(self, key): value = tuple.__getitem__(self, key) result = self.configurator.convert(value) if value is not result: if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result class BaseConfigurator(object): """ The configurator base class which defines some useful defaults. """ CONVERT_PATTERN = re.compile(r'^(?P[a-z]+)://(?P.*)$') WORD_PATTERN = re.compile(r'^\s*(\w+)\s*') DOT_PATTERN = re.compile(r'^\.\s*(\w+)\s*') INDEX_PATTERN = re.compile(r'^\[\s*(\w+)\s*\]\s*') DIGIT_PATTERN = re.compile(r'^\d+$') value_converters = { 'ext' : 'ext_convert', 'cfg' : 'cfg_convert', } # We might want to use a different one, e.g. importlib importer = staticmethod(__import__) def __init__(self, config): self.config = ConvertingDict(config) self.config.configurator = self def resolve(self, s): """ Resolve strings to objects using standard import and attribute syntax. """ name = s.split('.') used = name.pop(0) try: found = self.importer(used) for frag in name: used += '.' + frag try: found = getattr(found, frag) except AttributeError: self.importer(used) found = getattr(found, frag) return found except ImportError: e, tb = sys.exc_info()[1:] v = ValueError('Cannot resolve %r: %s' % (s, e)) v.__cause__, v.__traceback__ = e, tb raise v def ext_convert(self, value): """Default converter for the ext:// protocol.""" return self.resolve(value) def cfg_convert(self, value): """Default converter for the cfg:// protocol.""" rest = value m = self.WORD_PATTERN.match(rest) if m is None: raise ValueError("Unable to convert %r" % value) else: rest = rest[m.end():] d = self.config[m.groups()[0]] #print d, rest while rest: m = self.DOT_PATTERN.match(rest) if m: d = d[m.groups()[0]] else: m = self.INDEX_PATTERN.match(rest) if m: idx = m.groups()[0] if not self.DIGIT_PATTERN.match(idx): d = d[idx] else: try: n = int(idx) # try as number first (most likely) d = d[n] except TypeError: d = d[idx] if m: rest = rest[m.end():] else: raise ValueError('Unable to convert ' '%r at %r' % (value, rest)) #rest should be empty return d def convert(self, value): """ Convert values to an appropriate type. dicts, lists and tuples are replaced by their converting alternatives. Strings are checked to see if they have a conversion format and are converted if they do. """ if not isinstance(value, ConvertingDict) and isinstance(value, dict): value = ConvertingDict(value) value.configurator = self elif not isinstance(value, ConvertingList) and isinstance(value, list): value = ConvertingList(value) value.configurator = self elif not isinstance(value, ConvertingTuple) and\ isinstance(value, tuple): value = ConvertingTuple(value) value.configurator = self elif isinstance(value, string_types): m = self.CONVERT_PATTERN.match(value) if m: d = m.groupdict() prefix = d['prefix'] converter = self.value_converters.get(prefix, None) if converter: suffix = d['suffix'] converter = getattr(self, converter) value = converter(suffix) return value def configure_custom(self, config): """Configure an object with a user-supplied factory.""" c = config.pop('()') if not callable(c): c = self.resolve(c) props = config.pop('.', None) # Check for valid identifiers kwargs = dict([(k, config[k]) for k in config if valid_ident(k)]) result = c(**kwargs) if props: for name, value in props.items(): setattr(result, name, value) return result def as_tuple(self, value): """Utility function which converts lists to tuples.""" if isinstance(value, list): value = tuple(value) return value site-packages/pip/_vendor/distlib/compat.pyc000064400000115436147204247350015164 0ustar00 abc@@sddlmZddlZddlZddlZyddlZWnek r]dZn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lretrievetquotetunquotet url2pathnamet pathname2urltContentTooShortErrort splittypecC@s+t|tr!|jd}nt|S(Nsutf-8(t isinstancetunicodetencodet_quote(ts((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR s( tRequestturlopentURLErrort HTTPErrortHTTPBasicAuthHandlertHTTPPasswordMgrt HTTPHandlertHTTPRedirectHandlert build_opener(t HTTPSHandler(t HTMLParser(tifilter(t ifilterfalsecC@sYtdkr*ddl}|jdantj|}|rO|jddSd|fS(sJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.iNs ^(.*)@(.*)$ii(t _userprogtNonetretcompiletmatchtgroup(thostR$R&((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt splituser4s  (t TextIOWrapper( RRRR)R R RRR( RR RR R RRRRR(RRR(t filterfalse(tmatch_hostnametCertificateErrorR-cB@seZRS((t__name__t __module__(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR-^sc C@sSg}|stS|jd}|d|d}}|jd}||krhtdt|n|s|j|jkS|dkr|jdnY|jds|jdr|jtj |n"|jtj |j dd x$|D]}|jtj |qWtj d d j |d tj } | j|S( spMatching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3 t.iit*s,too many wildcards in certificate DNS name: s[^.]+sxn--s\*s[^.]*s\As\.s\Z(tFalsetsplittcountR-treprtlowertappendt startswithR$tescapetreplaceR%tjoint IGNORECASER&( tdnthostnamet max_wildcardstpatstpartstleftmostt remaindert wildcardstfragtpat((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt_dnsname_matchbs(  " &cC@s[|stdng}|jdd }xC|D];\}}|dkr4t||r_dS|j|q4q4W|sxc|jddD]L}xC|D];\}}|dkrt||rdS|j|qqWqWnt|dkrtd|d jtt|fn;t|dkrKtd ||d fn td dS(s=Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function returns nothing. stempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDtsubjectAltNametDNSNtsubjectt commonNameis&hostname %r doesn't match either of %ss, shostname %r doesn't match %ris=no appropriate commonName or subjectAltName fields were found((( t ValueErrortgetRGR7tlenR-R;tmapR5(tcertR>tdnsnamestsantkeytvaluetsub((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR,s.  %(tSimpleNamespacet ContainercB@seZdZdZRS(sR A generic container for when multiple values need to be returned cK@s|jj|dS(N(t__dict__tupdate(tselftkwargs((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt__init__s(R.R/t__doc__R\(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRWs(twhichc @sd}tjjr2||r.SdS|dkrYtjjdtj}n|scdS|jtj}t j dkrtj |kr|j dtj ntjjddjtj}t fd|Drg}qg|D]}|^q}n g}t}xu|D]m}tjj|} | |kr+|j| x9|D].} tjj|| } || |rc| SqcWq+q+WdS( sKGiven a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. cS@s5tjj|o4tj||o4tjj| S(N(tostpathtexiststaccesstisdir(tfntmode((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt _access_checks$tPATHtwin32itPATHEXTtc3@s*|] }jj|jVqdS(N(R6tendswith(t.0text(tcmd(s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pys sN(R_R`tdirnameR#tenvironRMtdefpathR3tpathseptsystplatformtcurdirtinserttanytsettnormcasetaddR;( RnReR`RftpathexttfilesRmtseentdirtnormdirtthefiletname((Rns>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR^s8  !        (tZipFilet __enter__(t ZipExtFileRcB@s#eZdZdZdZRS(cC@s|jj|jdS(N(RXRY(RZtbase((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR\scC@s|S(N((RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRscG@s|jdS(N(tclose(RZtexc_info((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt__exit__s(R.R/R\RR(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs  RcB@s#eZdZdZdZRS(cC@s|S(N((RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR"scG@s|jdS(N(R(RZR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR%scO@stj|||}t|S(N(t BaseZipFiletopenR(RZtargsR[R((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR)s(R.R/RRR(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR!s  (tpython_implementationcC@s@dtjkrdStjdkr&dStjjdr<dSdS(s6Return a string identifying the Python implementation.tPyPytjavatJythont IronPythontCPython(RstversionR_RR8(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR0s(t sysconfig(tCallablecC@s t|tS(N(RR(tobj((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytcallableDstmbcststricttsurrogateescapecC@sOt|tr|St|tr2|jttStdt|jdS(Nsexpect bytes or str, not %s( Rtbytest text_typeRt _fsencodingt _fserrorst TypeErrorttypeR.(tfilename((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytfsencodeRs cC@sOt|tr|St|tr2|jttStdt|jdS(Nsexpect bytes or str, not %s( RRRtdecodeRRRRR.(R((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytfsdecode[s (tdetect_encoding(tBOM_UTF8tlookupscoding[:=]\s*([-\w.]+)cC@s^|d jjdd}|dks7|jdr;dS|d ksV|jd rZdS|S(s(Imitates get_normal_name in tokenizer.c.i t_t-sutf-8sutf-8-slatin-1s iso-8859-1s iso-latin-1slatin-1-s iso-8859-1-s iso-latin-1-(slatin-1s iso-8859-1s iso-latin-1(slatin-1-s iso-8859-1-s iso-latin-1-(R6R:R8(torig_enctenc((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt_get_normal_namels c@s yjjWntk r)dnXtd}d}fd}fd}|}|jtrt|d}d}n|s|gfS||}|r||gfS|}|s||gfS||}|r|||gfS|||gfS(s? The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. sutf-8c@s$y SWntk rdSXdS(NRj(t StopIteration((treadline(s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt read_or_stops  c@s7y|jd}WnDtk rYd}dk rJdj|}nt|nXtj|}|ssdSt|d}yt|}WnHt k rdkrd|}ndj|}t|nXr3|j dkr&dkrd}ndj}t|n|d 7}n|S( Nsutf-8s'invalid or missing encoding declarations {} for {!r}isunknown encoding: sunknown encoding for {!r}: {}sencoding problem: utf-8s encoding problem for {!r}: utf-8s-sig( RtUnicodeDecodeErrorR#tformatt SyntaxErrort cookie_retfindallRRt LookupErrorR(tlinet line_stringtmsgtmatchestencodingtcodec(t bom_foundR(s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt find_cookies6          is utf-8-sigN(t__self__RtAttributeErrorR#R2R8RtTrue(RRtdefaultRRtfirsttsecond((RRRs>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRws4  &         (R9ii(tunescape(tChainMap(tMutableMapping(trecursive_reprs...c@sfd}|S(sm Decorator to make a repr function return fillvalue for a recursive call c@smtfd}td|_td|_td|_tdi|_|S(Nc@sWt|tf}|kr%Sj|z|}Wdj|X|S(N(tidt get_identRztdiscard(RZRStresult(t fillvaluet repr_runningt user_function(s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytwrappers  R/R]R.t__annotations__(RxtgetattrR/R]R.R(RR(R(RRs>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytdecorating_functions  ((RR((Rs>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt_recursive_reprsRcB@seZdZdZdZdZddZdZdZ dZ dZ e d Z ed Zd ZeZd Zed ZdZdZdZdZdZRS(s A ChainMap groups multiple dicts (or other mappings) together to create a single, updateable view. The underlying mappings are stored in a list. That list is public and can accessed or updated using the *maps* attribute. There is no other state. Lookups search the underlying mappings successively until a key is found. In contrast, writes, updates, and deletions only operate on the first mapping. cG@st|pig|_dS(sInitialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N(tlisttmaps(RZR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR\ scC@st|dS(N(tKeyError(RZRS((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt __missing__scC@sAx1|jD]&}y ||SWq tk r/q Xq W|j|S(N(RRR(RZRStmapping((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt __getitem__s   cC@s||kr||S|S(N((RZRSR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRMscC@sttj|jS(N(RNRxtunionR(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt__len__"scC@sttj|jS(N(titerRxRR(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt__iter__%sc@stfd|jDS(Nc3@s|]}|kVqdS(N((Rltm(RS(s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pys )s(RwR(RZRS((RSs>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt __contains__(scC@s t|jS(N(RwR(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt__bool__+scC@s%dj|djtt|jS(Ns{0.__class__.__name__}({1})s, (RR;ROR5R(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt__repr__.scG@s|tj||S(s?Create a ChainMap with a single dict created from the iterable.(tdicttfromkeys(tclstiterableR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR3scC@s$|j|jdj|jdS(sHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]ii(t __class__Rtcopy(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR8scC@s|ji|jS(s;New ChainMap with a new dict followed by all previous maps.(RR(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt new_child>scC@s|j|jdS(sNew ChainMap from maps[1:].i(RR(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytparentsBscC@s||jd|/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt __setitem__GscC@s?y|jd|=Wn&tk r:tdj|nXdS(Nis(Key not found in the first mapping: {!r}(RRR(RZRS((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt __delitem__Js cC@s9y|jdjSWntk r4tdnXdS(sPRemove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.is#No keys found in the first mapping.N(RtpopitemR(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRPs cG@sHy|jdj||SWn&tk rCtdj|nXdS(sWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].is(Key not found in the first mapping: {!r}N(RtpopRR(RZRSR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRWs cC@s|jdjdS(s'Clear maps[0], leaving maps[1:] intact.iN(Rtclear(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR^sN(R.R/R]R\RRR#RMRRRRRRt classmethodRRt__copy__RtpropertyRRRRRR(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs(               (tcache_from_sourcecC@sG|jdst|dkr*t}n|r9d}nd}||S(Ns.pytcto(RktAssertionErrorR#t __debug__(R`tdebug_overridetsuffix((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRes   (t OrderedDict(R(tKeysViewt ValuesViewt ItemsViewRcB@seZdZdZejdZejdZdZdZdZ e dZ dZ d Z d Zd Zd Zd ZdZeZeZedZddZddZdZdZeddZdZdZdZ dZ!dZ"RS(s)Dictionary that remembers insertion ordercO@st|dkr+tdt|ny |jWn7tk rog|_}||dg|(i|_nX|j||dS(sInitialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. is$expected at most 1 arguments, got %dN(RNRt_OrderedDict__rootRR#t_OrderedDict__mapt_OrderedDict__update(RZRtkwdstroot((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR\s    cC@s\||krH|j}|d}|||g|d<|d<|j| od[i]=yiiN(RR(RZRSRTt dict_setitemRtlast((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs    )cC@s@||||jj|\}}}||d<||d del od[y]iiN(RR(RZRSt dict_delitemt link_prevt link_next((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs  cc@s=|j}|d}x#||k r8|dV|d}qWdS(sod.__iter__() <==> iter(od)iiN(R(RZRtcurr((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs    cc@s=|j}|d}x#||k r8|dV|d}qWdS(s#od.__reversed__() <==> reversed(od)iiN(R(RZRR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt __reversed__s    cC@smyHx|jjD] }|2qW|j}||dg|(|jjWntk r[nXtj|dS(s.od.clear() -> None. Remove all items from od.N(Rt itervaluesRR#RRR(RZtnodeR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs  cC@s|stdn|j}|rO|d}|d}||d<||d (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. sdictionary is emptyiii(RRRRR(RZRRtlinkRRRSRT((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs            cC@s t|S(sod.keys() -> list of keys in od(R(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytkeysscC@sg|D]}||^qS(s#od.values() -> list of values in od((RZRS((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytvaluesscC@s!g|D]}|||f^qS(s.od.items() -> list of (key, value) pairs in od((RZRS((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytitemsscC@s t|S(s0od.iterkeys() -> an iterator over the keys in od(R(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytiterkeysscc@sx|D]}||VqWdS(s2od.itervalues -> an iterator over the values in odN((RZtk((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs cc@s$x|D]}|||fVqWdS(s=od.iteritems -> an iterator over the (key, value) items in odN((RZR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt iteritemss cO@s&t|dkr.tdt|fn|sCtdn|d}d}t|dkrr|d}nt|trxw|D]}|||| None. Update od from dict/iterable E and F. If E is a dict instance, does: for k in E: od[k] = E[k] If E has a .keys() method, does: for k in E.keys(): od[k] = E[k] Or if E is an iterable of items, does: for k, v in E: od[k] = v In either case, this is followed by: for k, v in F.items(): od[k] = v is8update() takes at most 2 positional arguments (%d given)s,update() takes at least 1 argument (0 given)iiR N((RNRRRthasattrR R (RRRZtotherRSRT((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRYs&    cC@sC||kr!||}||=|S||jkr?t|n|S(sod.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. (t_OrderedDict__markerR(RZRSRR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR!s  cC@s"||kr||S|||<|S(sDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od((RZRSR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt setdefault.s  cC@s|si}nt|tf}||kr4dSd|| repr(od)s...is%s()s%s(%r)N(Rt _get_identRR.R (RZt _repr_runningtcall_key((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR5s   cC@sg|D]}|||g^q}t|j}x'ttD]}|j|dqEW|rx|j|f|fS|j|ffS(s%Return state information for picklingN(tvarsRRRR#R(RZRR t inst_dict((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt __reduce__Cs#cC@s |j|S(s!od.copy() -> a shallow copy of od(R(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRMscC@s(|}x|D]}||| New ordered dictionary with keys from S and values equal to v (which defaults to None). ((RRRTtdRS((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRQs  cC@sMt|tr=t|t|ko<|j|jkStj||S(sod.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. (RRRNR Rt__eq__(RZR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR\s.cC@s ||k S(N((RZR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt__ne__escC@s t|S(s@od.viewkeys() -> a set-like object providing a view on od's keys(R(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytviewkeysjscC@s t|S(s<od.viewvalues() -> an object providing a view on od's values(R(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt viewvaluesnscC@s t|S(sBod.viewitems() -> a set-like object providing a view on od's items(R(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt viewitemsrsN(#R.R/R]R\RRRRRRRRR R R RRRRYRtobjectRRR#RRRRRRRRRRR (((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs:                   (tBaseConfiguratort valid_idents^[a-z_][a-z0-9_]*$cC@s,tj|}|s(td|ntS(Ns!Not a valid Python identifier: %r(t IDENTIFIERR&RLR(RR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR#|stConvertingDictcB@s#eZdZdZddZRS(s A converting dictionary wrapper.cC@sqtj||}|jj|}||k rm|||/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs    cC@sttj|||}|jj|}||k rp|||/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRMs    N(R.R/R]RR#RM(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR%s cC@sjtj|||}|jj|}||k rft|tttfkrf||_||_ qfn|S(N( RRR&R'RR%R(R)R*RS(RZRSRRTR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs   R(cB@s#eZdZdZddZRS(sA converting list wrapper.cC@sqtj||}|jj|}||k rm|||/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs    icC@s^tj||}|jj|}||k rZt|tttfkrZ||_qZn|S(N( RRR&R'RR%R(R)R*(RZtidxRTR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs  (R.R/R]RR(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR(s R)cB@seZdZdZRS(sA converting tuple wrapper.cC@sgtj||}|jj|}||k rct|tttfkrc||_||_ qcn|S(N( ttupleRR&R'RR%R(R)R*RS(RZRSRTR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs   (R.R/R]R(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR)sR"cB@seZdZejdZejdZejdZejdZejdZ idd6dd 6Z e e Z d Zd Zd Zd ZdZdZdZRS(sQ The configurator base class which defines some useful defaults. s%^(?P[a-z]+)://(?P.*)$s ^\s*(\w+)\s*s^\.\s*(\w+)\s*s^\[\s*(\w+)\s*\]\s*s^\d+$t ext_convertRmt cfg_converttcfgcC@st||_||j_dS(N(R%tconfigR&(RZR0((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR\sc C@s|jd}|jd}yy|j|}x_|D]W}|d|7}yt||}Wq7tk r|j|t||}q7Xq7W|SWnVtk rtjd\}}td||f}|||_ |_ |nXdS(sl Resolve strings to objects using standard import and attribute syntax. R0iisCannot resolve %r: %sN( R3RtimporterRRt ImportErrorRsRRLt __cause__t __traceback__( RZRRtusedtfoundREtettbtv((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytresolves"    cC@s |j|S(s*Default converter for the ext:// protocol.(R:(RZRT((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR-scC@sO|}|jj|}|dkr7td|n||j}|j|jd}x|rJ|jj|}|r||jd}n|jj|}|r|jd}|j j|s||}qyt |}||}Wqt k r||}qXn|r1||j}qatd||fqaW|S(s*Default converter for the cfg:// protocol.sUnable to convert %risUnable to convert %r at %rN( t WORD_PATTERNR&R#RLtendR0tgroupst DOT_PATTERNt INDEX_PATTERNt DIGIT_PATTERNtintR(RZRTtrestRRR+tn((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR.s2     cC@s/t|t r7t|tr7t|}||_nt|t rnt|trnt|}||_nt|t rt|trt|}||_nt|tr+|j j |}|r+|j }|d}|j j |d}|r(|d}t||}||}q(q+n|S(s Convert values to an appropriate type. dicts, lists and tuples are replaced by their converting alternatives. Strings are checked to see if they have a conversion format and are converted if they do. tprefixRN(RR%RR&R(RR)R,t string_typestCONVERT_PATTERNR&t groupdicttvalue_convertersRMR#R(RZRTRRRDt converterR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR')s*         c C@s|jd}t|s-|j|}n|jdd}tg|D]"}t|rI|||f^qI}||}|rx-|jD]\}}t|||qWn|S(s1Configure an object with a user-supplied factory.s()R0N(RRR:R#RR#R tsetattr( RZR0RtpropsRR[RRRT((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytconfigure_customEs 5 cC@s"t|trt|}n|S(s0Utility function which converts lists to tuples.(RRR,(RZRT((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytas_tupleSs(R.R/R]R$R%RFR;R>R?R@RHt staticmethodt __import__R1R\R:R-R.R'RLRM(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR"s"      "  (ii(t __future__RR_R$RstsslR2R#t version_infoRt basestringRERRttypesRt file_typet __builtin__tbuiltinst ConfigParsert configparsert _backportRRRRRRturllibR R RR R R RRturllib2RRRRRRRRRRthttplibt xmlrpclibtQueuetqueueRthtmlentitydefst raw_inputt itertoolsR tfilterR!R+R"R)tiotstrR*t urllib.parseturllib.requestt urllib.errort http.clienttclienttrequestt xmlrpc.clientt html.parsert html.entitiestentitiestinputR,R-RLRGRVRWR!R^tF_OKtX_OKtzipfileRRRRtBaseZipExtFileRtRRRt NameErrort collectionsRRRRtgetfilesystemencodingRRttokenizeRtcodecsRRR%RRthtmlR9tcgiRRRtreprlibRRtimpRRtthreadRRt dummy_threadt_abcollRRRRtlogging.configR"R#tIR$R%RRR(R,R)(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyts$        (4  @         @F   2 +  A                   [   b          site-packages/pip/_vendor/distlib/compat.pyo000064400000115347147204247350015201 0ustar00 abc@@sddlmZddlZddlZddlZyddlZWnek r]dZnXejddkr ddl m Z e fZ e Z ddlmZddlZddlZddlmZddlmZmZmZmZmZdd lmZmZm Z m!Z!m"Z"m#Z#m$Z$d Zddl%Z%dd l%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.erdd l%m/Z/nddl0Z0ddl1Z1ddl2Z3dd l4m4Z4ddl5Z5e6Z6ddl7m8Z9ddl7m:Z;da<dZ=nddl>m Z e?fZ e?Z ddl>m@ZddlZddlZddlZddlAmZmZmZm=Z=mZm Z mZmZm$Z$ddlBm'Z'mZm&Z&m!Z!m"Z"m*Z*m+Z+m,Z,m-Z-m.Z.erdd lBm/Z/nddlCm)Z)m(Z(m#Z#ddlDjEZ0ddlBjFZ%ddlGjEZ1ddl3Z3dd lHm4Z4ddlIjJZ5eKZ6ddl7m;Z;e9Z9yddlmLZLmMZMWn<ek rdeNfdYZMddZOdZLnXyddlmPZQWn'ek r"deRfdYZQnXyddlmSZSWn*ek rcejTejUBddZSnXdd lVmWZXeYeXd!reXZWn<dd"lVmZZ[d#e[fd$YZZd%eXfd&YZWydd'l\m]Z]Wnek rd(Z]nXyddl^Z^Wn!ek r,dd)lm^Z^nXy e_Z_Wn*e`k rcdd*lambZbd+Z_nXyejcZcejdZdWnJeek rejfZgegd,krd-Zhnd.Zhd/Zcd0ZdnXydd1limjZjWnTek r1dd2lkmlZlmmZmddlZejnd3Zod4Zpd5ZjnXydd6lqmrZrWn!ek ridd6lsmrZrnXejd7 dTkre4jtZtndd9lqmtZtydd:lamuZuWnkek rdd;lamvZvydd<lwmxZyWnek rd=d>ZynXd?evfd@YZunXyddAlzm{Z{Wnek rQddBZ{nXyddClam|Z|Wnek ryddDl}m~ZWn!ek rddDlm~ZnXy ddElmZmZmZWnek rnXdFefdGYZ|nXyddHlmZmZWnek rejndIejZdJZdKefdLYZddMZdNefdOYZdPefdQYZdReRfdSYZnXdS(Ui(tabsolute_importNi(tStringIO(tFileTypei(tshutil(turlparset urlunparseturljointurlsplitt urlunsplit(t urlretrievetquotetunquotet url2pathnamet pathname2urltContentTooShortErrort splittypecC@s+t|tr!|jd}nt|S(Nsutf-8(t isinstancetunicodetencodet_quote(ts((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR s( tRequestturlopentURLErrort HTTPErrortHTTPBasicAuthHandlertHTTPPasswordMgrt HTTPHandlertHTTPRedirectHandlert build_opener(t HTTPSHandler(t HTMLParser(tifilter(t ifilterfalsecC@sYtdkr*ddl}|jdantj|}|rO|jddSd|fS(sJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.iNs ^(.*)@(.*)$ii(t _userprogtNonetretcompiletmatchtgroup(thostR$R&((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt splituser4s  (t TextIOWrapper( RRRR)R R RRR( RR RR R RRRRR(RRR(t filterfalse(tmatch_hostnametCertificateErrorR-cB@seZRS((t__name__t __module__(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR-^sc C@sSg}|stS|jd}|d|d}}|jd}||krhtdt|n|s|j|jkS|dkr|jdnY|jds|jdr|jtj |n"|jtj |j dd x$|D]}|jtj |qWtj d d j |d tj } | j|S( spMatching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3 t.iit*s,too many wildcards in certificate DNS name: s[^.]+sxn--s\*s[^.]*s\As\.s\Z(tFalsetsplittcountR-treprtlowertappendt startswithR$tescapetreplaceR%tjoint IGNORECASER&( tdnthostnamet max_wildcardstpatstpartstleftmostt remaindert wildcardstfragtpat((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt_dnsname_matchbs(  " &cC@s[|stdng}|jdd }xC|D];\}}|dkr4t||r_dS|j|q4q4W|sxc|jddD]L}xC|D];\}}|dkrt||rdS|j|qqWqWnt|dkrtd|d jtt|fn;t|dkrKtd ||d fn td dS(s=Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function returns nothing. stempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDtsubjectAltNametDNSNtsubjectt commonNameis&hostname %r doesn't match either of %ss, shostname %r doesn't match %ris=no appropriate commonName or subjectAltName fields were found((( t ValueErrortgetRGR7tlenR-R;tmapR5(tcertR>tdnsnamestsantkeytvaluetsub((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR,s.  %(tSimpleNamespacet ContainercB@seZdZdZRS(sR A generic container for when multiple values need to be returned cK@s|jj|dS(N(t__dict__tupdate(tselftkwargs((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt__init__s(R.R/t__doc__R\(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRWs(twhichc @sd}tjjr2||r.SdS|dkrYtjjdtj}n|scdS|jtj}t j dkrtj |kr|j dtj ntjjddjtj}t fd|Drg}qg|D]}|^q}n g}t}xu|D]m}tjj|} | |kr+|j| x9|D].} tjj|| } || |rc| SqcWq+q+WdS( sKGiven a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. cS@s5tjj|o4tj||o4tjj| S(N(tostpathtexiststaccesstisdir(tfntmode((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt _access_checks$tPATHtwin32itPATHEXTtc3@s*|] }jj|jVqdS(N(R6tendswith(t.0text(tcmd(s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pys sN(R_R`tdirnameR#tenvironRMtdefpathR3tpathseptsystplatformtcurdirtinserttanytsettnormcasetaddR;( RnReR`RftpathexttfilesRmtseentdirtnormdirtthefiletname((Rns>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR^s8  !        (tZipFilet __enter__(t ZipExtFileRcB@s#eZdZdZdZRS(cC@s|jj|jdS(N(RXRY(RZtbase((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR\scC@s|S(N((RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRscG@s|jdS(N(tclose(RZtexc_info((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt__exit__s(R.R/R\RR(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs  RcB@s#eZdZdZdZRS(cC@s|S(N((RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR"scG@s|jdS(N(R(RZR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR%scO@stj|||}t|S(N(t BaseZipFiletopenR(RZtargsR[R((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR)s(R.R/RRR(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR!s  (tpython_implementationcC@s@dtjkrdStjdkr&dStjjdr<dSdS(s6Return a string identifying the Python implementation.tPyPytjavatJythont IronPythontCPython(RstversionR_RR8(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR0s(t sysconfig(tCallablecC@s t|tS(N(RR(tobj((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytcallableDstmbcststricttsurrogateescapecC@sOt|tr|St|tr2|jttStdt|jdS(Nsexpect bytes or str, not %s( Rtbytest text_typeRt _fsencodingt _fserrorst TypeErrorttypeR.(tfilename((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytfsencodeRs cC@sOt|tr|St|tr2|jttStdt|jdS(Nsexpect bytes or str, not %s( RRRtdecodeRRRRR.(R((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytfsdecode[s (tdetect_encoding(tBOM_UTF8tlookupscoding[:=]\s*([-\w.]+)cC@s^|d jjdd}|dks7|jdr;dS|d ksV|jd rZdS|S(s(Imitates get_normal_name in tokenizer.c.i t_t-sutf-8sutf-8-slatin-1s iso-8859-1s iso-latin-1slatin-1-s iso-8859-1-s iso-latin-1-(slatin-1s iso-8859-1s iso-latin-1(slatin-1-s iso-8859-1-s iso-latin-1-(R6R:R8(torig_enctenc((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt_get_normal_namels c@s yjjWntk r)dnXtd}d}fd}fd}|}|jtrt|d}d}n|s|gfS||}|r||gfS|}|s||gfS||}|r|||gfS|||gfS(s? The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. sutf-8c@s$y SWntk rdSXdS(NRj(t StopIteration((treadline(s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt read_or_stops  c@s7y|jd}WnDtk rYd}dk rJdj|}nt|nXtj|}|ssdSt|d}yt|}WnHt k rdkrd|}ndj|}t|nXr3|j dkr&dkrd}ndj}t|n|d 7}n|S( Nsutf-8s'invalid or missing encoding declarations {} for {!r}isunknown encoding: sunknown encoding for {!r}: {}sencoding problem: utf-8s encoding problem for {!r}: utf-8s-sig( RtUnicodeDecodeErrorR#tformatt SyntaxErrort cookie_retfindallRRt LookupErrorR(tlinet line_stringtmsgtmatchestencodingtcodec(t bom_foundR(s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt find_cookies6          is utf-8-sigN(t__self__RtAttributeErrorR#R2R8RtTrue(RRtdefaultRRtfirsttsecond((RRRs>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRws4  &         (R9ii(tunescape(tChainMap(tMutableMapping(trecursive_reprs...c@sfd}|S(sm Decorator to make a repr function return fillvalue for a recursive call c@smtfd}td|_td|_td|_tdi|_|S(Nc@sWt|tf}|kr%Sj|z|}Wdj|X|S(N(tidt get_identRztdiscard(RZRStresult(t fillvaluet repr_runningt user_function(s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytwrappers  R/R]R.t__annotations__(RxtgetattrR/R]R.R(RR(R(RRs>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytdecorating_functions  ((RR((Rs>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt_recursive_reprsRcB@seZdZdZdZdZddZdZdZ dZ dZ e d Z ed Zd ZeZd Zed ZdZdZdZdZdZRS(s A ChainMap groups multiple dicts (or other mappings) together to create a single, updateable view. The underlying mappings are stored in a list. That list is public and can accessed or updated using the *maps* attribute. There is no other state. Lookups search the underlying mappings successively until a key is found. In contrast, writes, updates, and deletions only operate on the first mapping. cG@st|pig|_dS(sInitialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N(tlisttmaps(RZR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR\ scC@st|dS(N(tKeyError(RZRS((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt __missing__scC@sAx1|jD]&}y ||SWq tk r/q Xq W|j|S(N(RRR(RZRStmapping((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt __getitem__s   cC@s||kr||S|S(N((RZRSR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRMscC@sttj|jS(N(RNRxtunionR(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt__len__"scC@sttj|jS(N(titerRxRR(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt__iter__%sc@stfd|jDS(Nc3@s|]}|kVqdS(N((Rltm(RS(s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pys )s(RwR(RZRS((RSs>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt __contains__(scC@s t|jS(N(RwR(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt__bool__+scC@s%dj|djtt|jS(Ns{0.__class__.__name__}({1})s, (RR;ROR5R(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt__repr__.scG@s|tj||S(s?Create a ChainMap with a single dict created from the iterable.(tdicttfromkeys(tclstiterableR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR3scC@s$|j|jdj|jdS(sHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]ii(t __class__Rtcopy(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR8scC@s|ji|jS(s;New ChainMap with a new dict followed by all previous maps.(RR(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt new_child>scC@s|j|jdS(sNew ChainMap from maps[1:].i(RR(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytparentsBscC@s||jd|/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt __setitem__GscC@s?y|jd|=Wn&tk r:tdj|nXdS(Nis(Key not found in the first mapping: {!r}(RRR(RZRS((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt __delitem__Js cC@s9y|jdjSWntk r4tdnXdS(sPRemove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.is#No keys found in the first mapping.N(RtpopitemR(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRPs cG@sHy|jdj||SWn&tk rCtdj|nXdS(sWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].is(Key not found in the first mapping: {!r}N(RtpopRR(RZRSR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRWs cC@s|jdjdS(s'Clear maps[0], leaving maps[1:] intact.iN(Rtclear(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR^sN(R.R/R]R\RRR#RMRRRRRRt classmethodRRt__copy__RtpropertyRRRRRR(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs(               (tcache_from_sourcecC@s2|dkrt}n|r$d}nd}||S(Ntcto(R#t __debug__(R`tdebug_overridetsuffix((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRes    (t OrderedDict(R(tKeysViewt ValuesViewt ItemsViewRcB@seZdZdZejdZejdZdZdZdZ e dZ dZ d Z d Zd Zd Zd ZdZeZeZedZddZddZdZdZeddZdZdZdZ dZ!dZ"RS(s)Dictionary that remembers insertion ordercO@st|dkr+tdt|ny |jWn7tk rog|_}||dg|(i|_nX|j||dS(sInitialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. is$expected at most 1 arguments, got %dN(RNRt_OrderedDict__rootRR#t_OrderedDict__mapt_OrderedDict__update(RZRtkwdstroot((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR\s    cC@s\||krH|j}|d}|||g|d<|d<|j| od[i]=yiiN(RR(RZRSRTt dict_setitemRtlast((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs    )cC@s@||||jj|\}}}||d<||d del od[y]iiN(RR(RZRSt dict_delitemt link_prevt link_next((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs  cc@s=|j}|d}x#||k r8|dV|d}qWdS(sod.__iter__() <==> iter(od)iiN(R(RZRtcurr((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs    cc@s=|j}|d}x#||k r8|dV|d}qWdS(s#od.__reversed__() <==> reversed(od)iiN(R(RZRR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt __reversed__s    cC@smyHx|jjD] }|2qW|j}||dg|(|jjWntk r[nXtj|dS(s.od.clear() -> None. Remove all items from od.N(Rt itervaluesRR#RRR(RZtnodeR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs  cC@s|stdn|j}|rO|d}|d}||d<||d (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. sdictionary is emptyiii(RRRRR(RZRRtlinkRRRSRT((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs            cC@s t|S(sod.keys() -> list of keys in od(R(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytkeysscC@sg|D]}||^qS(s#od.values() -> list of values in od((RZRS((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytvaluesscC@s!g|D]}|||f^qS(s.od.items() -> list of (key, value) pairs in od((RZRS((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytitemsscC@s t|S(s0od.iterkeys() -> an iterator over the keys in od(R(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytiterkeysscc@sx|D]}||VqWdS(s2od.itervalues -> an iterator over the values in odN((RZtk((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs cc@s$x|D]}|||fVqWdS(s=od.iteritems -> an iterator over the (key, value) items in odN((RZR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt iteritemss cO@s&t|dkr.tdt|fn|sCtdn|d}d}t|dkrr|d}nt|trxw|D]}|||| None. Update od from dict/iterable E and F. If E is a dict instance, does: for k in E: od[k] = E[k] If E has a .keys() method, does: for k in E.keys(): od[k] = E[k] Or if E is an iterable of items, does: for k, v in E: od[k] = v In either case, this is followed by: for k, v in F.items(): od[k] = v is8update() takes at most 2 positional arguments (%d given)s,update() takes at least 1 argument (0 given)iiR N((RNRRRthasattrR R (RRRZtotherRSRT((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRYs&    cC@sC||kr!||}||=|S||jkr?t|n|S(sod.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. (t_OrderedDict__markerR(RZRSRR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR!s  cC@s"||kr||S|||<|S(sDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od((RZRSR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt setdefault.s  cC@s|si}nt|tf}||kr4dSd|| repr(od)s...is%s()s%s(%r)N(Rt _get_identRR.R (RZt _repr_runningtcall_key((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR5s   cC@sg|D]}|||g^q}t|j}x'ttD]}|j|dqEW|rx|j|f|fS|j|ffS(s%Return state information for picklingN(tvarsRRRR#R(RZRR t inst_dict((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt __reduce__Cs#cC@s |j|S(s!od.copy() -> a shallow copy of od(R(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRMscC@s(|}x|D]}||| New ordered dictionary with keys from S and values equal to v (which defaults to None). ((RRRTtdRS((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRQs  cC@sMt|tr=t|t|ko<|j|jkStj||S(sod.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. (RRRNR Rt__eq__(RZR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR\s.cC@s ||k S(N((RZR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt__ne__escC@s t|S(s@od.viewkeys() -> a set-like object providing a view on od's keys(R(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytviewkeysjscC@s t|S(s<od.viewvalues() -> an object providing a view on od's values(R(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt viewvaluesnscC@s t|S(sBod.viewitems() -> a set-like object providing a view on od's items(R(RZ((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyt viewitemsrsN(#R.R/R]R\RRRRRRRRR R R R RRRYRtobjectRRR#RRRRRRRRRRR(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs:                   (tBaseConfiguratort valid_idents^[a-z_][a-z0-9_]*$cC@s,tj|}|s(td|ntS(Ns!Not a valid Python identifier: %r(t IDENTIFIERR&RLR(RR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR"|stConvertingDictcB@s#eZdZdZddZRS(s A converting dictionary wrapper.cC@sqtj||}|jj|}||k rm|||/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs    cC@sttj|||}|jj|}||k rp|||/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRMs    N(R.R/R]RR#RM(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR$s cC@sjtj|||}|jj|}||k rft|tttfkrf||_||_ qfn|S(N( RRR%R&RR$R'R(R)RS(RZRSRRTR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs   R'cB@s#eZdZdZddZRS(sA converting list wrapper.cC@sqtj||}|jj|}||k rm|||/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs    icC@s^tj||}|jj|}||k rZt|tttfkrZ||_qZn|S(N( RRR%R&RR$R'R(R)(RZtidxRTR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs  (R.R/R]RR(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR's R(cB@seZdZdZRS(sA converting tuple wrapper.cC@sgtj||}|jj|}||k rct|tttfkrc||_||_ qcn|S(N( ttupleRR%R&RR$R'R(R)RS(RZRSRTR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyRs   (R.R/R]R(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR(sR!cB@seZdZejdZejdZejdZejdZejdZ idd6dd 6Z e e Z d Zd Zd Zd ZdZdZdZRS(sQ The configurator base class which defines some useful defaults. s%^(?P[a-z]+)://(?P.*)$s ^\s*(\w+)\s*s^\.\s*(\w+)\s*s^\[\s*(\w+)\s*\]\s*s^\d+$t ext_convertRmt cfg_converttcfgcC@st||_||j_dS(N(R$tconfigR%(RZR/((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR\sc C@s|jd}|jd}yy|j|}x_|D]W}|d|7}yt||}Wq7tk r|j|t||}q7Xq7W|SWnVtk rtjd\}}td||f}|||_ |_ |nXdS(sl Resolve strings to objects using standard import and attribute syntax. R0iisCannot resolve %r: %sN( R3RtimporterRRt ImportErrorRsRRLt __cause__t __traceback__( RZRRtusedtfoundREtettbtv((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytresolves"    cC@s |j|S(s*Default converter for the ext:// protocol.(R9(RZRT((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR,scC@sO|}|jj|}|dkr7td|n||j}|j|jd}x|rJ|jj|}|r||jd}n|jj|}|r|jd}|j j|s||}qyt |}||}Wqt k r||}qXn|r1||j}qatd||fqaW|S(s*Default converter for the cfg:// protocol.sUnable to convert %risUnable to convert %r at %rN( t WORD_PATTERNR&R#RLtendR/tgroupst DOT_PATTERNt INDEX_PATTERNt DIGIT_PATTERNtintR(RZRTtrestRRR*tn((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR-s2     cC@s/t|t r7t|tr7t|}||_nt|t rnt|trnt|}||_nt|t rt|trt|}||_nt|tr+|j j |}|r+|j }|d}|j j |d}|r(|d}t||}||}q(q+n|S(s Convert values to an appropriate type. dicts, lists and tuples are replaced by their converting alternatives. Strings are checked to see if they have a conversion format and are converted if they do. tprefixRN(RR$RR%R'RR(R+t string_typestCONVERT_PATTERNR&t groupdicttvalue_convertersRMR#R(RZRTRRRCt converterR((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR&)s*         c C@s|jd}t|s-|j|}n|jdd}tg|D]"}t|rI|||f^qI}||}|rx-|jD]\}}t|||qWn|S(s1Configure an object with a user-supplied factory.s()R0N(RRR9R#RR"R tsetattr( RZR/RtpropsRR[RRRT((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytconfigure_customEs 5 cC@s"t|trt|}n|S(s0Utility function which converts lists to tuples.(RRR+(RZRT((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pytas_tupleSs(R.R/R]R$R%RER:R=R>R?RGt staticmethodt __import__R0R\R9R,R-R&RKRL(((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyR!s"      "  (ii(t __future__RR_R$RstsslR1R#t version_infoRt basestringRDRRttypesRt file_typet __builtin__tbuiltinst ConfigParsert configparsert _backportRRRRRRturllibR R RR R R RRturllib2RRRRRRRRRRthttplibt xmlrpclibtQueuetqueueRthtmlentitydefst raw_inputt itertoolsR tfilterR!R+R"R)tiotstrR*t urllib.parseturllib.requestt urllib.errort http.clienttclienttrequestt xmlrpc.clientt html.parsert html.entitiestentitiestinputR,R-RLRGRVRWR R^tF_OKtX_OKtzipfileRRRRtBaseZipExtFileRtRRRt NameErrort collectionsRRRRtgetfilesystemencodingRRttokenizeRtcodecsRRR%RRthtmlR9tcgiRRRtreprlibRRtimpRRtthreadRRt dummy_threadt_abcollRRRRtlogging.configR!R"tIR#R$RRR'R+R((((s>/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.pyts$        (4  @         @F   2 +  A                   [   b          site-packages/pip/_vendor/distlib/database.py000064400000141010147204247350015265 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012-2016 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # """PEP 376 implementation.""" from __future__ import unicode_literals import base64 import codecs import contextlib import hashlib import logging import os import posixpath import sys import zipimport from . import DistlibException, resources from .compat import StringIO from .version import get_scheme, UnsupportedVersionError from .metadata import Metadata, METADATA_FILENAME, WHEEL_METADATA_FILENAME from .util import (parse_requirement, cached_property, parse_name_and_version, read_exports, write_exports, CSVReader, CSVWriter) __all__ = ['Distribution', 'BaseInstalledDistribution', 'InstalledDistribution', 'EggInfoDistribution', 'DistributionPath'] logger = logging.getLogger(__name__) EXPORTS_FILENAME = 'pydist-exports.json' COMMANDS_FILENAME = 'pydist-commands.json' DIST_FILES = ('INSTALLER', METADATA_FILENAME, 'RECORD', 'REQUESTED', 'RESOURCES', EXPORTS_FILENAME, 'SHARED') DISTINFO_EXT = '.dist-info' class _Cache(object): """ A simple cache mapping names and .dist-info paths to distributions """ def __init__(self): """ Initialise an instance. There is normally one for each DistributionPath. """ self.name = {} self.path = {} self.generated = False def clear(self): """ Clear the cache, setting it to its initial state. """ self.name.clear() self.path.clear() self.generated = False def add(self, dist): """ Add a distribution to the cache. :param dist: The distribution to add. """ if dist.path not in self.path: self.path[dist.path] = dist self.name.setdefault(dist.key, []).append(dist) class DistributionPath(object): """ Represents a set of distributions installed on a path (typically sys.path). """ def __init__(self, path=None, include_egg=False): """ Create an instance from a path, optionally including legacy (distutils/ setuptools/distribute) distributions. :param path: The path to use, as a list of directories. If not specified, sys.path is used. :param include_egg: If True, this instance will look for and return legacy distributions as well as those based on PEP 376. """ if path is None: path = sys.path self.path = path self._include_dist = True self._include_egg = include_egg self._cache = _Cache() self._cache_egg = _Cache() self._cache_enabled = True self._scheme = get_scheme('default') def _get_cache_enabled(self): return self._cache_enabled def _set_cache_enabled(self, value): self._cache_enabled = value cache_enabled = property(_get_cache_enabled, _set_cache_enabled) def clear_cache(self): """ Clears the internal cache. """ self._cache.clear() self._cache_egg.clear() def _yield_distributions(self): """ Yield .dist-info and/or .egg(-info) distributions. """ # We need to check if we've seen some resources already, because on # some Linux systems (e.g. some Debian/Ubuntu variants) there are # symlinks which alias other files in the environment. seen = set() for path in self.path: finder = resources.finder_for_path(path) if finder is None: continue r = finder.find('') if not r or not r.is_container: continue rset = sorted(r.resources) for entry in rset: r = finder.find(entry) if not r or r.path in seen: continue if self._include_dist and entry.endswith(DISTINFO_EXT): possible_filenames = [METADATA_FILENAME, WHEEL_METADATA_FILENAME] for metadata_filename in possible_filenames: metadata_path = posixpath.join(entry, metadata_filename) pydist = finder.find(metadata_path) if pydist: break else: continue with contextlib.closing(pydist.as_stream()) as stream: metadata = Metadata(fileobj=stream, scheme='legacy') logger.debug('Found %s', r.path) seen.add(r.path) yield new_dist_class(r.path, metadata=metadata, env=self) elif self._include_egg and entry.endswith(('.egg-info', '.egg')): logger.debug('Found %s', r.path) seen.add(r.path) yield old_dist_class(r.path, self) def _generate_cache(self): """ Scan the path for distributions and populate the cache with those that are found. """ gen_dist = not self._cache.generated gen_egg = self._include_egg and not self._cache_egg.generated if gen_dist or gen_egg: for dist in self._yield_distributions(): if isinstance(dist, InstalledDistribution): self._cache.add(dist) else: self._cache_egg.add(dist) if gen_dist: self._cache.generated = True if gen_egg: self._cache_egg.generated = True @classmethod def distinfo_dirname(cls, name, version): """ The *name* and *version* parameters are converted into their filename-escaped form, i.e. any ``'-'`` characters are replaced with ``'_'`` other than the one in ``'dist-info'`` and the one separating the name from the version number. :parameter name: is converted to a standard distribution name by replacing any runs of non- alphanumeric characters with a single ``'-'``. :type name: string :parameter version: is converted to a standard version string. Spaces become dots, and all other non-alphanumeric characters (except dots) become dashes, with runs of multiple dashes condensed to a single dash. :type version: string :returns: directory name :rtype: string""" name = name.replace('-', '_') return '-'.join([name, version]) + DISTINFO_EXT def get_distributions(self): """ Provides an iterator that looks for distributions and returns :class:`InstalledDistribution` or :class:`EggInfoDistribution` instances for each one of them. :rtype: iterator of :class:`InstalledDistribution` and :class:`EggInfoDistribution` instances """ if not self._cache_enabled: for dist in self._yield_distributions(): yield dist else: self._generate_cache() for dist in self._cache.path.values(): yield dist if self._include_egg: for dist in self._cache_egg.path.values(): yield dist def get_distribution(self, name): """ Looks for a named distribution on the path. This function only returns the first result found, as no more than one value is expected. If nothing is found, ``None`` is returned. :rtype: :class:`InstalledDistribution`, :class:`EggInfoDistribution` or ``None`` """ result = None name = name.lower() if not self._cache_enabled: for dist in self._yield_distributions(): if dist.key == name: result = dist break else: self._generate_cache() if name in self._cache.name: result = self._cache.name[name][0] elif self._include_egg and name in self._cache_egg.name: result = self._cache_egg.name[name][0] return result def provides_distribution(self, name, version=None): """ Iterates over all distributions to find which distributions provide *name*. If a *version* is provided, it will be used to filter the results. This function only returns the first result found, since no more than one values are expected. If the directory is not found, returns ``None``. :parameter version: a version specifier that indicates the version required, conforming to the format in ``PEP-345`` :type name: string :type version: string """ matcher = None if not version is None: try: matcher = self._scheme.matcher('%s (%s)' % (name, version)) except ValueError: raise DistlibException('invalid name or version: %r, %r' % (name, version)) for dist in self.get_distributions(): provided = dist.provides for p in provided: p_name, p_ver = parse_name_and_version(p) if matcher is None: if p_name == name: yield dist break else: if p_name == name and matcher.match(p_ver): yield dist break def get_file_path(self, name, relative_path): """ Return the path to a resource file. """ dist = self.get_distribution(name) if dist is None: raise LookupError('no distribution named %r found' % name) return dist.get_resource_path(relative_path) def get_exported_entries(self, category, name=None): """ Return all of the exported entries in a particular category. :param category: The category to search for entries. :param name: If specified, only entries with that name are returned. """ for dist in self.get_distributions(): r = dist.exports if category in r: d = r[category] if name is not None: if name in d: yield d[name] else: for v in d.values(): yield v class Distribution(object): """ A base class for distributions, whether installed or from indexes. Either way, it must have some metadata, so that's all that's needed for construction. """ build_time_dependency = False """ Set to True if it's known to be only a build-time dependency (i.e. not needed after installation). """ requested = False """A boolean that indicates whether the ``REQUESTED`` metadata file is present (in other words, whether the package was installed by user request or it was installed as a dependency).""" def __init__(self, metadata): """ Initialise an instance. :param metadata: The instance of :class:`Metadata` describing this distribution. """ self.metadata = metadata self.name = metadata.name self.key = self.name.lower() # for case-insensitive comparisons self.version = metadata.version self.locator = None self.digest = None self.extras = None # additional features requested self.context = None # environment marker overrides self.download_urls = set() self.digests = {} @property def source_url(self): """ The source archive download URL for this distribution. """ return self.metadata.source_url download_url = source_url # Backward compatibility @property def name_and_version(self): """ A utility property which displays the name and version in parentheses. """ return '%s (%s)' % (self.name, self.version) @property def provides(self): """ A set of distribution names and versions provided by this distribution. :return: A set of "name (version)" strings. """ plist = self.metadata.provides s = '%s (%s)' % (self.name, self.version) if s not in plist: plist.append(s) return plist def _get_requirements(self, req_attr): md = self.metadata logger.debug('Getting requirements from metadata %r', md.todict()) reqts = getattr(md, req_attr) return set(md.get_requirements(reqts, extras=self.extras, env=self.context)) @property def run_requires(self): return self._get_requirements('run_requires') @property def meta_requires(self): return self._get_requirements('meta_requires') @property def build_requires(self): return self._get_requirements('build_requires') @property def test_requires(self): return self._get_requirements('test_requires') @property def dev_requires(self): return self._get_requirements('dev_requires') def matches_requirement(self, req): """ Say if this instance matches (fulfills) a requirement. :param req: The requirement to match. :rtype req: str :return: True if it matches, else False. """ # Requirement may contain extras - parse to lose those # from what's passed to the matcher r = parse_requirement(req) scheme = get_scheme(self.metadata.scheme) try: matcher = scheme.matcher(r.requirement) except UnsupportedVersionError: # XXX compat-mode if cannot read the version logger.warning('could not read version %r - using name only', req) name = req.split()[0] matcher = scheme.matcher(name) name = matcher.key # case-insensitive result = False for p in self.provides: p_name, p_ver = parse_name_and_version(p) if p_name != name: continue try: result = matcher.match(p_ver) break except UnsupportedVersionError: pass return result def __repr__(self): """ Return a textual representation of this instance, """ if self.source_url: suffix = ' [%s]' % self.source_url else: suffix = '' return '' % (self.name, self.version, suffix) def __eq__(self, other): """ See if this distribution is the same as another. :param other: The distribution to compare with. To be equal to one another. distributions must have the same type, name, version and source_url. :return: True if it is the same, else False. """ if type(other) is not type(self): result = False else: result = (self.name == other.name and self.version == other.version and self.source_url == other.source_url) return result def __hash__(self): """ Compute hash in a way which matches the equality test. """ return hash(self.name) + hash(self.version) + hash(self.source_url) class BaseInstalledDistribution(Distribution): """ This is the base class for installed distributions (whether PEP 376 or legacy). """ hasher = None def __init__(self, metadata, path, env=None): """ Initialise an instance. :param metadata: An instance of :class:`Metadata` which describes the distribution. This will normally have been initialised from a metadata file in the ``path``. :param path: The path of the ``.dist-info`` or ``.egg-info`` directory for the distribution. :param env: This is normally the :class:`DistributionPath` instance where this distribution was found. """ super(BaseInstalledDistribution, self).__init__(metadata) self.path = path self.dist_path = env def get_hash(self, data, hasher=None): """ Get the hash of some data, using a particular hash algorithm, if specified. :param data: The data to be hashed. :type data: bytes :param hasher: The name of a hash implementation, supported by hashlib, or ``None``. Examples of valid values are ``'sha1'``, ``'sha224'``, ``'sha384'``, '``sha256'``, ``'md5'`` and ``'sha512'``. If no hasher is specified, the ``hasher`` attribute of the :class:`InstalledDistribution` instance is used. If the hasher is determined to be ``None``, MD5 is used as the hashing algorithm. :returns: The hash of the data. If a hasher was explicitly specified, the returned hash will be prefixed with the specified hasher followed by '='. :rtype: str """ if hasher is None: hasher = self.hasher if hasher is None: hasher = hashlib.md5 prefix = '' else: hasher = getattr(hashlib, hasher) prefix = '%s=' % self.hasher digest = hasher(data).digest() digest = base64.urlsafe_b64encode(digest).rstrip(b'=').decode('ascii') return '%s%s' % (prefix, digest) class InstalledDistribution(BaseInstalledDistribution): """ Created with the *path* of the ``.dist-info`` directory provided to the constructor. It reads the metadata contained in ``pydist.json`` when it is instantiated., or uses a passed in Metadata instance (useful for when dry-run mode is being used). """ hasher = 'sha256' def __init__(self, path, metadata=None, env=None): self.finder = finder = resources.finder_for_path(path) if finder is None: import pdb; pdb.set_trace () if env and env._cache_enabled and path in env._cache.path: metadata = env._cache.path[path].metadata elif metadata is None: r = finder.find(METADATA_FILENAME) # Temporary - for Wheel 0.23 support if r is None: r = finder.find(WHEEL_METADATA_FILENAME) # Temporary - for legacy support if r is None: r = finder.find('METADATA') if r is None: raise ValueError('no %s found in %s' % (METADATA_FILENAME, path)) with contextlib.closing(r.as_stream()) as stream: metadata = Metadata(fileobj=stream, scheme='legacy') super(InstalledDistribution, self).__init__(metadata, path, env) if env and env._cache_enabled: env._cache.add(self) try: r = finder.find('REQUESTED') except AttributeError: import pdb; pdb.set_trace () self.requested = r is not None def __repr__(self): return '' % ( self.name, self.version, self.path) def __str__(self): return "%s %s" % (self.name, self.version) def _get_records(self): """ Get the list of installed files for the distribution :return: A list of tuples of path, hash and size. Note that hash and size might be ``None`` for some entries. The path is exactly as stored in the file (which is as in PEP 376). """ results = [] r = self.get_distinfo_resource('RECORD') with contextlib.closing(r.as_stream()) as stream: with CSVReader(stream=stream) as record_reader: # Base location is parent dir of .dist-info dir #base_location = os.path.dirname(self.path) #base_location = os.path.abspath(base_location) for row in record_reader: missing = [None for i in range(len(row), 3)] path, checksum, size = row + missing #if not os.path.isabs(path): # path = path.replace('/', os.sep) # path = os.path.join(base_location, path) results.append((path, checksum, size)) return results @cached_property def exports(self): """ Return the information exported by this distribution. :return: A dictionary of exports, mapping an export category to a dict of :class:`ExportEntry` instances describing the individual export entries, and keyed by name. """ result = {} r = self.get_distinfo_resource(EXPORTS_FILENAME) if r: result = self.read_exports() return result def read_exports(self): """ Read exports data from a file in .ini format. :return: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. """ result = {} r = self.get_distinfo_resource(EXPORTS_FILENAME) if r: with contextlib.closing(r.as_stream()) as stream: result = read_exports(stream) return result def write_exports(self, exports): """ Write a dictionary of exports to a file in .ini format. :param exports: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. """ rf = self.get_distinfo_file(EXPORTS_FILENAME) with open(rf, 'w') as f: write_exports(exports, f) def get_resource_path(self, relative_path): """ NOTE: This API may change in the future. Return the absolute path to a resource file with the given relative path. :param relative_path: The path, relative to .dist-info, of the resource of interest. :return: The absolute path where the resource is to be found. """ r = self.get_distinfo_resource('RESOURCES') with contextlib.closing(r.as_stream()) as stream: with CSVReader(stream=stream) as resources_reader: for relative, destination in resources_reader: if relative == relative_path: return destination raise KeyError('no resource file with relative path %r ' 'is installed' % relative_path) def list_installed_files(self): """ Iterates over the ``RECORD`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: iterator of (path, hash, size) """ for result in self._get_records(): yield result def write_installed_files(self, paths, prefix, dry_run=False): """ Writes the ``RECORD`` file, using the ``paths`` iterable passed in. Any existing ``RECORD`` file is silently overwritten. prefix is used to determine when to write absolute paths. """ prefix = os.path.join(prefix, '') base = os.path.dirname(self.path) base_under_prefix = base.startswith(prefix) base = os.path.join(base, '') record_path = self.get_distinfo_file('RECORD') logger.info('creating %s', record_path) if dry_run: return None with CSVWriter(record_path) as writer: for path in paths: if os.path.isdir(path) or path.endswith(('.pyc', '.pyo')): # do not put size and hash, as in PEP-376 hash_value = size = '' else: size = '%d' % os.path.getsize(path) with open(path, 'rb') as fp: hash_value = self.get_hash(fp.read()) if path.startswith(base) or (base_under_prefix and path.startswith(prefix)): path = os.path.relpath(path, base) writer.writerow((path, hash_value, size)) # add the RECORD file itself if record_path.startswith(base): record_path = os.path.relpath(record_path, base) writer.writerow((record_path, '', '')) return record_path def check_installed_files(self): """ Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is checked first, then size, then hash), the expected value and the actual value. """ mismatches = [] base = os.path.dirname(self.path) record_path = self.get_distinfo_file('RECORD') for path, hash_value, size in self.list_installed_files(): if not os.path.isabs(path): path = os.path.join(base, path) if path == record_path: continue if not os.path.exists(path): mismatches.append((path, 'exists', True, False)) elif os.path.isfile(path): actual_size = str(os.path.getsize(path)) if size and actual_size != size: mismatches.append((path, 'size', size, actual_size)) elif hash_value: if '=' in hash_value: hasher = hash_value.split('=', 1)[0] else: hasher = None with open(path, 'rb') as f: actual_hash = self.get_hash(f.read(), hasher) if actual_hash != hash_value: mismatches.append((path, 'hash', hash_value, actual_hash)) return mismatches @cached_property def shared_locations(self): """ A dictionary of shared locations whose keys are in the set 'prefix', 'purelib', 'platlib', 'scripts', 'headers', 'data' and 'namespace'. The corresponding value is the absolute path of that category for this distribution, and takes into account any paths selected by the user at installation time (e.g. via command-line arguments). In the case of the 'namespace' key, this would be a list of absolute paths for the roots of namespace packages in this distribution. The first time this property is accessed, the relevant information is read from the SHARED file in the .dist-info directory. """ result = {} shared_path = os.path.join(self.path, 'SHARED') if os.path.isfile(shared_path): with codecs.open(shared_path, 'r', encoding='utf-8') as f: lines = f.read().splitlines() for line in lines: key, value = line.split('=', 1) if key == 'namespace': result.setdefault(key, []).append(value) else: result[key] = value return result def write_shared_locations(self, paths, dry_run=False): """ Write shared location information to the SHARED file in .dist-info. :param paths: A dictionary as described in the documentation for :meth:`shared_locations`. :param dry_run: If True, the action is logged but no file is actually written. :return: The path of the file written to. """ shared_path = os.path.join(self.path, 'SHARED') logger.info('creating %s', shared_path) if dry_run: return None lines = [] for key in ('prefix', 'lib', 'headers', 'scripts', 'data'): path = paths[key] if os.path.isdir(paths[key]): lines.append('%s=%s' % (key, path)) for ns in paths.get('namespace', ()): lines.append('namespace=%s' % ns) with codecs.open(shared_path, 'w', encoding='utf-8') as f: f.write('\n'.join(lines)) return shared_path def get_distinfo_resource(self, path): if path not in DIST_FILES: raise DistlibException('invalid path for a dist-info file: ' '%r at %r' % (path, self.path)) finder = resources.finder_for_path(self.path) if finder is None: raise DistlibException('Unable to get a finder for %s' % self.path) return finder.find(path) def get_distinfo_file(self, path): """ Returns a path located under the ``.dist-info`` directory. Returns a string representing the path. :parameter path: a ``'/'``-separated path relative to the ``.dist-info`` directory or an absolute path; If *path* is an absolute path and doesn't start with the ``.dist-info`` directory path, a :class:`DistlibException` is raised :type path: str :rtype: str """ # Check if it is an absolute path # XXX use relpath, add tests if path.find(os.sep) >= 0: # it's an absolute path? distinfo_dirname, path = path.split(os.sep)[-2:] if distinfo_dirname != self.path.split(os.sep)[-1]: raise DistlibException( 'dist-info file %r does not belong to the %r %s ' 'distribution' % (path, self.name, self.version)) # The file must be relative if path not in DIST_FILES: raise DistlibException('invalid path for a dist-info file: ' '%r at %r' % (path, self.path)) return os.path.join(self.path, path) def list_distinfo_files(self): """ Iterates over the ``RECORD`` entries and returns paths for each line if the path is pointing to a file located in the ``.dist-info`` directory or one of its subdirectories. :returns: iterator of paths """ base = os.path.dirname(self.path) for path, checksum, size in self._get_records(): # XXX add separator or use real relpath algo if not os.path.isabs(path): path = os.path.join(base, path) if path.startswith(self.path): yield path def __eq__(self, other): return (isinstance(other, InstalledDistribution) and self.path == other.path) # See http://docs.python.org/reference/datamodel#object.__hash__ __hash__ = object.__hash__ class EggInfoDistribution(BaseInstalledDistribution): """Created with the *path* of the ``.egg-info`` directory or file provided to the constructor. It reads the metadata contained in the file itself, or if the given path happens to be a directory, the metadata is read from the file ``PKG-INFO`` under that directory.""" requested = True # as we have no way of knowing, assume it was shared_locations = {} def __init__(self, path, env=None): def set_name_and_version(s, n, v): s.name = n s.key = n.lower() # for case-insensitive comparisons s.version = v self.path = path self.dist_path = env if env and env._cache_enabled and path in env._cache_egg.path: metadata = env._cache_egg.path[path].metadata set_name_and_version(self, metadata.name, metadata.version) else: metadata = self._get_metadata(path) # Need to be set before caching set_name_and_version(self, metadata.name, metadata.version) if env and env._cache_enabled: env._cache_egg.add(self) super(EggInfoDistribution, self).__init__(metadata, path, env) def _get_metadata(self, path): requires = None def parse_requires_data(data): """Create a list of dependencies from a requires.txt file. *data*: the contents of a setuptools-produced requires.txt file. """ reqs = [] lines = data.splitlines() for line in lines: line = line.strip() if line.startswith('['): logger.warning('Unexpected line: quitting requirement scan: %r', line) break r = parse_requirement(line) if not r: logger.warning('Not recognised as a requirement: %r', line) continue if r.extras: logger.warning('extra requirements in requires.txt are ' 'not supported') if not r.constraints: reqs.append(r.name) else: cons = ', '.join('%s%s' % c for c in r.constraints) reqs.append('%s (%s)' % (r.name, cons)) return reqs def parse_requires_path(req_path): """Create a list of dependencies from a requires.txt file. *req_path*: the path to a setuptools-produced requires.txt file. """ reqs = [] try: with codecs.open(req_path, 'r', 'utf-8') as fp: reqs = parse_requires_data(fp.read()) except IOError: pass return reqs if path.endswith('.egg'): if os.path.isdir(path): meta_path = os.path.join(path, 'EGG-INFO', 'PKG-INFO') metadata = Metadata(path=meta_path, scheme='legacy') req_path = os.path.join(path, 'EGG-INFO', 'requires.txt') requires = parse_requires_path(req_path) else: # FIXME handle the case where zipfile is not available zipf = zipimport.zipimporter(path) fileobj = StringIO( zipf.get_data('EGG-INFO/PKG-INFO').decode('utf8')) metadata = Metadata(fileobj=fileobj, scheme='legacy') try: data = zipf.get_data('EGG-INFO/requires.txt') requires = parse_requires_data(data.decode('utf-8')) except IOError: requires = None elif path.endswith('.egg-info'): if os.path.isdir(path): req_path = os.path.join(path, 'requires.txt') requires = parse_requires_path(req_path) path = os.path.join(path, 'PKG-INFO') metadata = Metadata(path=path, scheme='legacy') else: raise DistlibException('path must end with .egg-info or .egg, ' 'got %r' % path) if requires: metadata.add_requirements(requires) return metadata def __repr__(self): return '' % ( self.name, self.version, self.path) def __str__(self): return "%s %s" % (self.name, self.version) def check_installed_files(self): """ Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is checked first, then size, then hash), the expected value and the actual value. """ mismatches = [] record_path = os.path.join(self.path, 'installed-files.txt') if os.path.exists(record_path): for path, _, _ in self.list_installed_files(): if path == record_path: continue if not os.path.exists(path): mismatches.append((path, 'exists', True, False)) return mismatches def list_installed_files(self): """ Iterates over the ``installed-files.txt`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: a list of (path, hash, size) """ def _md5(path): f = open(path, 'rb') try: content = f.read() finally: f.close() return hashlib.md5(content).hexdigest() def _size(path): return os.stat(path).st_size record_path = os.path.join(self.path, 'installed-files.txt') result = [] if os.path.exists(record_path): with codecs.open(record_path, 'r', encoding='utf-8') as f: for line in f: line = line.strip() p = os.path.normpath(os.path.join(self.path, line)) # "./" is present as a marker between installed files # and installation metadata files if not os.path.exists(p): logger.warning('Non-existent file: %s', p) if p.endswith(('.pyc', '.pyo')): continue #otherwise fall through and fail if not os.path.isdir(p): result.append((p, _md5(p), _size(p))) result.append((record_path, None, None)) return result def list_distinfo_files(self, absolute=False): """ Iterates over the ``installed-files.txt`` entries and returns paths for each line if the path is pointing to a file located in the ``.egg-info`` directory or one of its subdirectories. :parameter absolute: If *absolute* is ``True``, each returned path is transformed into a local absolute path. Otherwise the raw value from ``installed-files.txt`` is returned. :type absolute: boolean :returns: iterator of paths """ record_path = os.path.join(self.path, 'installed-files.txt') skip = True with codecs.open(record_path, 'r', encoding='utf-8') as f: for line in f: line = line.strip() if line == './': skip = False continue if not skip: p = os.path.normpath(os.path.join(self.path, line)) if p.startswith(self.path): if absolute: yield p else: yield line def __eq__(self, other): return (isinstance(other, EggInfoDistribution) and self.path == other.path) # See http://docs.python.org/reference/datamodel#object.__hash__ __hash__ = object.__hash__ new_dist_class = InstalledDistribution old_dist_class = EggInfoDistribution class DependencyGraph(object): """ Represents a dependency graph between distributions. The dependency relationships are stored in an ``adjacency_list`` that maps distributions to a list of ``(other, label)`` tuples where ``other`` is a distribution and the edge is labeled with ``label`` (i.e. the version specifier, if such was provided). Also, for more efficient traversal, for every distribution ``x``, a list of predecessors is kept in ``reverse_list[x]``. An edge from distribution ``a`` to distribution ``b`` means that ``a`` depends on ``b``. If any missing dependencies are found, they are stored in ``missing``, which is a dictionary that maps distributions to a list of requirements that were not provided by any other distributions. """ def __init__(self): self.adjacency_list = {} self.reverse_list = {} self.missing = {} def add_distribution(self, distribution): """Add the *distribution* to the graph. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` """ self.adjacency_list[distribution] = [] self.reverse_list[distribution] = [] #self.missing[distribution] = [] def add_edge(self, x, y, label=None): """Add an edge from distribution *x* to distribution *y* with the given *label*. :type x: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type y: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type label: ``str`` or ``None`` """ self.adjacency_list[x].append((y, label)) # multiple edges are allowed, so be careful if x not in self.reverse_list[y]: self.reverse_list[y].append(x) def add_missing(self, distribution, requirement): """ Add a missing *requirement* for the given *distribution*. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type requirement: ``str`` """ logger.debug('%s missing %r', distribution, requirement) self.missing.setdefault(distribution, []).append(requirement) def _repr_dist(self, dist): return '%s %s' % (dist.name, dist.version) def repr_node(self, dist, level=1): """Prints only a subgraph""" output = [self._repr_dist(dist)] for other, label in self.adjacency_list[dist]: dist = self._repr_dist(other) if label is not None: dist = '%s [%s]' % (dist, label) output.append(' ' * level + str(dist)) suboutput = self.repr_node(other, level + 1) subs = suboutput.split('\n') output.extend(subs[1:]) return '\n'.join(output) def to_dot(self, f, skip_disconnected=True): """Writes a DOT output for the graph to the provided file *f*. If *skip_disconnected* is set to ``True``, then all distributions that are not dependent on any other distribution are skipped. :type f: has to support ``file``-like operations :type skip_disconnected: ``bool`` """ disconnected = [] f.write("digraph dependencies {\n") for dist, adjs in self.adjacency_list.items(): if len(adjs) == 0 and not skip_disconnected: disconnected.append(dist) for other, label in adjs: if not label is None: f.write('"%s" -> "%s" [label="%s"]\n' % (dist.name, other.name, label)) else: f.write('"%s" -> "%s"\n' % (dist.name, other.name)) if not skip_disconnected and len(disconnected) > 0: f.write('subgraph disconnected {\n') f.write('label = "Disconnected"\n') f.write('bgcolor = red\n') for dist in disconnected: f.write('"%s"' % dist.name) f.write('\n') f.write('}\n') f.write('}\n') def topological_sort(self): """ Perform a topological sort of the graph. :return: A tuple, the first element of which is a topologically sorted list of distributions, and the second element of which is a list of distributions that cannot be sorted because they have circular dependencies and so form a cycle. """ result = [] # Make a shallow copy of the adjacency list alist = {} for k, v in self.adjacency_list.items(): alist[k] = v[:] while True: # See what we can remove in this run to_remove = [] for k, v in list(alist.items())[:]: if not v: to_remove.append(k) del alist[k] if not to_remove: # What's left in alist (if anything) is a cycle. break # Remove from the adjacency list of others for k, v in alist.items(): alist[k] = [(d, r) for d, r in v if d not in to_remove] logger.debug('Moving to result: %s', ['%s (%s)' % (d.name, d.version) for d in to_remove]) result.extend(to_remove) return result, list(alist.keys()) def __repr__(self): """Representation of the graph""" output = [] for dist, adjs in self.adjacency_list.items(): output.append(self.repr_node(dist)) return '\n'.join(output) def make_graph(dists, scheme='default'): """Makes a dependency graph from the given distributions. :parameter dists: a list of distributions :type dists: list of :class:`distutils2.database.InstalledDistribution` and :class:`distutils2.database.EggInfoDistribution` instances :rtype: a :class:`DependencyGraph` instance """ scheme = get_scheme(scheme) graph = DependencyGraph() provided = {} # maps names to lists of (version, dist) tuples # first, build the graph and find out what's provided for dist in dists: graph.add_distribution(dist) for p in dist.provides: name, version = parse_name_and_version(p) logger.debug('Add to provided: %s, %s, %s', name, version, dist) provided.setdefault(name, []).append((version, dist)) # now make the edges for dist in dists: requires = (dist.run_requires | dist.meta_requires | dist.build_requires | dist.dev_requires) for req in requires: try: matcher = scheme.matcher(req) except UnsupportedVersionError: # XXX compat-mode if cannot read the version logger.warning('could not read version %r - using name only', req) name = req.split()[0] matcher = scheme.matcher(name) name = matcher.key # case-insensitive matched = False if name in provided: for version, provider in provided[name]: try: match = matcher.match(version) except UnsupportedVersionError: match = False if match: graph.add_edge(dist, provider, req) matched = True break if not matched: graph.add_missing(dist, req) return graph def get_dependent_dists(dists, dist): """Recursively generate a list of distributions from *dists* that are dependent on *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested """ if dist not in dists: raise DistlibException('given distribution %r is not a member ' 'of the list' % dist.name) graph = make_graph(dists) dep = [dist] # dependent distributions todo = graph.reverse_list[dist] # list of nodes we should inspect while todo: d = todo.pop() dep.append(d) for succ in graph.reverse_list[d]: if succ not in dep: todo.append(succ) dep.pop(0) # remove dist from dep, was there to prevent infinite loops return dep def get_required_dists(dists, dist): """Recursively generate a list of distributions from *dists* that are required by *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested """ if dist not in dists: raise DistlibException('given distribution %r is not a member ' 'of the list' % dist.name) graph = make_graph(dists) req = [] # required distributions todo = graph.adjacency_list[dist] # list of nodes we should inspect while todo: d = todo.pop()[0] req.append(d) for pred in graph.adjacency_list[d]: if pred not in req: todo.append(pred) return req def make_dist(name, version, **kwargs): """ A convenience method for making a dist given just a name and version. """ summary = kwargs.pop('summary', 'Placeholder for summary') md = Metadata(**kwargs) md.name = name md.version = version md.summary = summary or 'Placeholder for summary' return Distribution(md) site-packages/pip/_vendor/distlib/database.pyc000064400000140306147204247350015437 0ustar00 abc@s0dZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z mZddlmZddlmZmZddlmZmZmZdd lmZmZmZmZmZmZmZd d d d dgZ ej!e"Z#dZ$dZ%deddde$dfZ&dZ'de(fdYZ)de(fdYZ*de(fdYZ+de+fdYZ,de,fd YZ-d!e,fd"YZ.e-Z/e.Z0d#e(fd$YZ1d%d&Z2d'Z3d(Z4d)Z5dS(*uPEP 376 implementation.i(tunicode_literalsNi(tDistlibExceptiont resources(tStringIO(t get_schemetUnsupportedVersionError(tMetadatatMETADATA_FILENAMEtWHEEL_METADATA_FILENAME(tparse_requirementtcached_propertytparse_name_and_versiont read_exportst write_exportst CSVReadert CSVWriteru DistributionuBaseInstalledDistributionuInstalledDistributionuEggInfoDistributionuDistributionPathupydist-exports.jsonupydist-commands.jsonu INSTALLERuRECORDu REQUESTEDu RESOURCESuSHAREDu .dist-infot_CachecBs)eZdZdZdZdZRS(uL A simple cache mapping names and .dist-info paths to distributions cCsi|_i|_t|_dS(uZ Initialise an instance. There is normally one for each DistributionPath. N(tnametpathtFalset generated(tself((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt__init__0s  cCs'|jj|jjt|_dS(uC Clear the cache, setting it to its initial state. N(RtclearRRR(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR8s  cCsH|j|jkrD||j|j<|jj|jgj|ndS(u` Add a distribution to the cache. :param dist: The distribution to add. N(RRt setdefaulttkeytappend(Rtdist((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytadd@s(t__name__t __module__t__doc__RRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR,s  tDistributionPathcBseZdZd edZdZdZeeeZ dZ dZ dZ e dZdZd Zd d Zd Zd d ZRS(uU Represents a set of distributions installed on a path (typically sys.path). cCsg|dkrtj}n||_t|_||_t|_t|_t|_ t d|_ dS(u Create an instance from a path, optionally including legacy (distutils/ setuptools/distribute) distributions. :param path: The path to use, as a list of directories. If not specified, sys.path is used. :param include_egg: If True, this instance will look for and return legacy distributions as well as those based on PEP 376. udefaultN( tNonetsysRtTruet _include_distt _include_eggRt_cachet _cache_eggt_cache_enabledRt_scheme(RRt include_egg((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRNs        cCs|jS(N(R((R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt_get_cache_enabledbscCs ||_dS(N(R((Rtvalue((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt_set_cache_enabledescCs|jj|jjdS(u, Clears the internal cache. N(R&RR'(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt clear_cachejs c cst}x|jD]}tj|}|dkr:qn|jd}| s|j r`qnt|j}x^|D]V}|j|}| sv|j|krqvn|jr}|j t r}t t g}x<|D]1}t j||} |j| } | rPqqWqvtj| j} td| dd} WdQXtjd|j|j|jt|jd| d|Vqv|jrv|j d rvtjd|j|j|jt|j|VqvqvWqWdS( uD Yield .dist-info and/or .egg(-info) distributions. utfileobjtschemeulegacyNuFound %stmetadatatenvu .egg-infou.egg(u .egg-infou.egg(tsetRRtfinder_for_pathR!tfindt is_containertsortedR$tendswitht DISTINFO_EXTRRt posixpathtjoint contextlibtclosingt as_streamRtloggertdebugRtnew_dist_classR%told_dist_class( RtseenRtfindertrtrsettentrytpossible_filenamestmetadata_filenamet metadata_pathtpydisttstreamR1((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt_yield_distributionsrs@       cCs|jj }|jo |jj }|s/|rxF|jD]8}t|trd|jj|q<|jj|q<W|rt|j_n|rt|j_qndS(uk Scan the path for distributions and populate the cache with those that are found. N( R&RR%R'RMt isinstancetInstalledDistributionRR#(Rtgen_disttgen_eggR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt_generate_caches  cCs)|jdd}dj||gtS(uo The *name* and *version* parameters are converted into their filename-escaped form, i.e. any ``'-'`` characters are replaced with ``'_'`` other than the one in ``'dist-info'`` and the one separating the name from the version number. :parameter name: is converted to a standard distribution name by replacing any runs of non- alphanumeric characters with a single ``'-'``. :type name: string :parameter version: is converted to a standard version string. Spaces become dots, and all other non-alphanumeric characters (except dots) become dashes, with runs of multiple dashes condensed to a single dash. :type version: string :returns: directory name :rtype: stringu-u_(treplaceR;R9(tclsRtversion((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytdistinfo_dirnamesccs|js(xv|jD] }|VqWnZ|jx|jjjD] }|VqEW|jrx"|jjjD] }|VqpWndS(u5 Provides an iterator that looks for distributions and returns :class:`InstalledDistribution` or :class:`EggInfoDistribution` instances for each one of them. :rtype: iterator of :class:`InstalledDistribution` and :class:`EggInfoDistribution` instances N(R(RMRRR&RtvaluesR%R'(RR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytget_distributionss     cCsd}|j}|jsNx|jD]}|j|kr(|}Pq(q(Wne|j||jjkr|jj|d}n2|jr||j jkr|j j|d}n|S(u= Looks for a named distribution on the path. This function only returns the first result found, as no more than one value is expected. If nothing is found, ``None`` is returned. :rtype: :class:`InstalledDistribution`, :class:`EggInfoDistribution` or ``None`` iN( R!tlowerR(RMRRRR&RR%R'(RRtresultR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytget_distributions     c csd}|dk r_y |jjd||f}Wq_tk r[td||fq_Xnx|jD]z}|j}xh|D]`}t|\}}|dkr||kr|VPqq||kr|j|r|VPqqWqlWdS(u Iterates over all distributions to find which distributions provide *name*. If a *version* is provided, it will be used to filter the results. This function only returns the first result found, since no more than one values are expected. If the directory is not found, returns ``None``. :parameter version: a version specifier that indicates the version required, conforming to the format in ``PEP-345`` :type name: string :type version: string u%s (%s)uinvalid name or version: %r, %rN( R!R)tmatchert ValueErrorRRXtprovidesR tmatch( RRRUR\Rtprovidedtptp_nametp_ver((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytprovides_distributions$       cCs;|j|}|dkr.td|n|j|S(u5 Return the path to a resource file. uno distribution named %r foundN(R[R!t LookupErrortget_resource_path(RRt relative_pathR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt get_file_paths ccsxy|jD]k}|j}||kr ||}|dk rY||kru||Vquqxx|jD] }|VqfWq q WdS(u Return all of the exported entries in a particular category. :param category: The category to search for entries. :param name: If specified, only entries with that name are returned. N(RXtexportsR!RW(RtcategoryRRREtdtv((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytget_exported_entries"s     N(RRRR!RRR+R-tpropertyt cache_enabledR.RMRRt classmethodRVRXR[RdRhRm(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR Js    *    $ t DistributioncBseZdZeZeZdZedZeZ edZ edZ dZ edZ edZedZed Zed Zd Zd Zd ZdZRS(u A base class for distributions, whether installed or from indexes. Either way, it must have some metadata, so that's all that's needed for construction. cCsp||_|j|_|jj|_|j|_d|_d|_d|_d|_ t |_ i|_ dS(u Initialise an instance. :param metadata: The instance of :class:`Metadata` describing this distribution. N( R1RRYRRUR!tlocatortdigesttextrastcontextR3t download_urlstdigests(RR1((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRGs        cCs |jjS(uH The source archive download URL for this distribution. (R1t source_url(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRxXscCsd|j|jfS(uX A utility property which displays the name and version in parentheses. u%s (%s)(RRU(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytname_and_versionascCsB|jj}d|j|jf}||kr>|j|n|S(u A set of distribution names and versions provided by this distribution. :return: A set of "name (version)" strings. u%s (%s)(R1R^RRUR(Rtplistts((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR^hs   cCsS|j}tjd|jt||}t|j|d|jd|jS(Nu%Getting requirements from metadata %rRtR2( R1R?R@ttodicttgetattrR3tget_requirementsRtRu(Rtreq_attrtmdtreqts((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt_get_requirementsts  cCs |jdS(Nu run_requires(R(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt run_requires{scCs |jdS(Nu meta_requires(R(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt meta_requiresscCs |jdS(Nubuild_requires(R(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytbuild_requiresscCs |jdS(Nu test_requires(R(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt test_requiresscCs |jdS(Nu dev_requires(R(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt dev_requiressc Cst|}t|jj}y|j|j}Wn@tk rvtjd||j d}|j|}nX|j }t }x]|j D]R}t |\}} ||krqny|j| }PWqtk rqXqW|S(u Say if this instance matches (fulfills) a requirement. :param req: The requirement to match. :rtype req: str :return: True if it matches, else False. u+could not read version %r - using name onlyi(R RR1R0R\t requirementRR?twarningtsplitRRR^R R_( RtreqRER0R\RRZRaRbRc((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytmatches_requirements*      cCs6|jrd|j}nd}d|j|j|fS(uC Return a textual representation of this instance, u [%s]uu(RxRRU(Rtsuffix((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt__repr__s cCs[t|t|k r!t}n6|j|jkoT|j|jkoT|j|jk}|S(u< See if this distribution is the same as another. :param other: The distribution to compare with. To be equal to one another. distributions must have the same type, name, version and source_url. :return: True if it is the same, else False. (ttypeRRRURx(RtotherRZ((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt__eq__s  cCs't|jt|jt|jS(uH Compute hash in a way which matches the equality test. (thashRRURx(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt__hash__s(RRRRtbuild_time_dependencyt requestedRRnRxt download_urlRyR^RRRRRRRRRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRq5s$   " tBaseInstalledDistributioncBs,eZdZdZddZddZRS(u] This is the base class for installed distributions (whether PEP 376 or legacy). cCs,tt|j|||_||_dS(u Initialise an instance. :param metadata: An instance of :class:`Metadata` which describes the distribution. This will normally have been initialised from a metadata file in the ``path``. :param path: The path of the ``.dist-info`` or ``.egg-info`` directory for the distribution. :param env: This is normally the :class:`DistributionPath` instance where this distribution was found. N(tsuperRRRt dist_path(RR1RR2((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRs  cCs|dkr|j}n|dkr6tj}d}ntt|}d|j}||j}tj|jdj d}d||fS(u Get the hash of some data, using a particular hash algorithm, if specified. :param data: The data to be hashed. :type data: bytes :param hasher: The name of a hash implementation, supported by hashlib, or ``None``. Examples of valid values are ``'sha1'``, ``'sha224'``, ``'sha384'``, '``sha256'``, ``'md5'`` and ``'sha512'``. If no hasher is specified, the ``hasher`` attribute of the :class:`InstalledDistribution` instance is used. If the hasher is determined to be ``None``, MD5 is used as the hashing algorithm. :returns: The hash of the data. If a hasher was explicitly specified, the returned hash will be prefixed with the specified hasher followed by '='. :rtype: str uu%s=t=uasciiu%s%sN( R!thasherthashlibtmd5R}Rstbase64turlsafe_b64encodetrstriptdecode(RtdataRtprefixRs((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytget_hashs      !N(RRRR!RRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRs ROcBseZdZdZdddZdZdZdZe dZ dZ dZ d Z d Zed Zd Ze d ZedZdZdZdZdZejZRS(u  Created with the *path* of the ``.dist-info`` directory provided to the constructor. It reads the metadata contained in ``pydist.json`` when it is instantiated., or uses a passed in Metadata instance (useful for when dry-run mode is being used). usha256c Cstj||_}|dkr;ddl}|jn|rr|jrr||jjkrr|jj|j }n|dkr$|j t }|dkr|j t }n|dkr|j d}n|dkrt dt |fntj|j}td|dd}WdQXntt|j||||rb|jrb|jj|ny|j d}Wn'tk rddl}|jnX|dk |_dS(NiuMETADATAuno %s found in %sR/R0ulegacyu REQUESTED(RR4RDR!tpdbt set_traceR(R&RR1R5RRR]R<R=R>RRRORRtAttributeErrorR(RRR1R2RDRRERL((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRs4  !       cCsd|j|j|jfS(Nu#(RRUR(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR2scCsd|j|jfS(Nu%s %s(RRU(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt__str__6sc Csg}|jd}tj|j}td|i}x_|D]W}gtt|dD] }d^qb}||\}} } |j|| | fqFWWdQXWdQX|S(u" Get the list of installed files for the distribution :return: A list of tuples of path, hash and size. Note that hash and size might be ``None`` for some entries. The path is exactly as stored in the file (which is as in PEP 376). uRECORDRLiN( tget_distinfo_resourceR<R=R>RtrangetlenR!R( RtresultsRERLt record_readertrowtitmissingRtchecksumtsize((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt _get_records9s (&cCs.i}|jt}|r*|j}n|S(u Return the information exported by this distribution. :return: A dictionary of exports, mapping an export category to a dict of :class:`ExportEntry` instances describing the individual export entries, and keyed by name. (RtEXPORTS_FILENAMER (RRZRE((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRiPs cCsLi}|jt}|rHtj|j}t|}WdQXn|S(u Read exports data from a file in .ini format. :return: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. N(RRR<R=R>R (RRZRERL((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR ^s cCs8|jt}t|d}t||WdQXdS(u Write a dictionary of exports to a file in .ini format. :param exports: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. uwN(tget_distinfo_fileRtopenR (RRitrftf((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR msc Cs|jd}tj|jF}td|.}x$|D]\}}||kr@|Sq@WWdQXWdQXtd|dS(uW NOTE: This API may change in the future. Return the absolute path to a resource file with the given relative path. :param relative_path: The path, relative to .dist-info, of the resource of interest. :return: The absolute path where the resource is to be found. u RESOURCESRLNu3no resource file with relative path %r is installed(RR<R=R>RtKeyError(RRgRERLtresources_readertrelativet destination((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRfxs  ccs x|jD] }|Vq WdS(u Iterates over the ``RECORD`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: iterator of (path, hash, size) N(R(RRZ((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytlist_installed_filessc Cstjj|d}tjj|j}|j|}tjj|d}|jd}tjd||rwdSt |}x|D]}tjj |s|j d rd} } nCdtjj |} t |d} |j| j} WdQX|j|s(|r@|j|r@tjj||}n|j|| | fqW|j|rtjj||}n|j|ddfWdQX|S( u Writes the ``RECORD`` file, using the ``paths`` iterable passed in. Any existing ``RECORD`` file is silently overwritten. prefix is used to determine when to write absolute paths. uuRECORDu creating %su.pycu.pyou%durbN(u.pycu.pyo(tosRR;tdirnamet startswithRR?tinfoR!RtisdirR8tgetsizeRRtreadtrelpathtwriterow( RtpathsRtdry_runtbasetbase_under_prefixt record_pathtwriterRt hash_valueRtfp((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytwrite_installed_filess. ! c Csg}tjj|j}|jd}xn|jD]`\}}}tjj|sptjj||}n||krq7ntjj|s|j|dt t fq7tjj |r7t tjj |}|r||kr|j|d||fq|rd|kr3|jddd}nd }t|dG} |j| j|} | |kr|j|d|| fnWd QXqq7q7W|S( u Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is checked first, then size, then hash), the expected value and the actual value. uRECORDuexistsusizeu=iiurbuhashN(RRRRRtisabsR;texistsRR#RtisfiletstrRRR!RRR( Rt mismatchesRRRRRt actual_sizeRRt actual_hash((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytcheck_installed_filess.    ,cCsi}tjj|jd}tjj|rtj|ddd}|jj}WdQXx[|D]P}|jdd\}}|dkr|j |gj |qj|||su%s (%s)( RtstripRR?RR Rtt constraintsRRR;(RtreqsRRREtcons((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytparse_requires_dataos&       csRg}y4tj|dd}|j}WdQXWntk rMnX|S(uCreate a list of dependencies from a requires.txt file. *req_path*: the path to a setuptools-produced requires.txt file. uruutf-8N(RRRtIOError(treq_pathRR(R(s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytparse_requires_paths u.egguEGG-INFOuPKG-INFORR0ulegacyu requires.txtuEGG-INFO/PKG-INFOuutf8R/uEGG-INFO/requires.txtuutf-8u .egg-infou,path must end with .egg-info or .egg, got %r(R!R8RRRR;Rt zipimportt zipimporterRtget_dataRRRtadd_requirements( RRtrequiresRt meta_pathR1RtzipfR/R((Rs@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRls:     cCsd|j|j|jfS(Nu!(RRUR(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRscCsd|j|jfS(Nu%s %s(RRU(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRscCsg}tjj|jd}tjj|rx`|jD]O\}}}||kr^q=ntjj|s=|j|dttfq=q=Wn|S(u Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is checked first, then size, then hash), the expected value and the actual value. uinstalled-files.txtuexists(RRR;RRRR#R(RRRRt_((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRs  #c Cs2d}d}tjj|jd}g}tjj|r.tj|ddd}x|D]}|j}tjjtjj|j|}tjj|stj d||j d rqdqntjj |sd|j |||||fqdqdWWd QX|j |d d fn|S( u Iterates over the ``installed-files.txt`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: a list of (path, hash, size) cSs@t|d}z|j}Wd|jXtj|jS(Nurb(RRtcloseRRt hexdigest(RRtcontent((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt_md5s  cSstj|jS(N(Rtstattst_size(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt_sizesuinstalled-files.txturRuutf-8uNon-existent file: %su.pycu.pyoN(u.pycu.pyo(RRR;RRRRtnormpathR?RR8RRR!(RRRRRZRRRa((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRs"    $ /c cstjj|jd}t}tj|ddd}x|D]}|j}|dkrjt}q@n|s@tjjtjj|j|}|j |jr|r|Vq|Vqq@q@WWdQXdS(u  Iterates over the ``installed-files.txt`` entries and returns paths for each line if the path is pointing to a file located in the ``.egg-info`` directory or one of its subdirectories. :parameter absolute: If *absolute* is ``True``, each returned path is transformed into a local absolute path. Otherwise the raw value from ``installed-files.txt`` is returned. :type absolute: boolean :returns: iterator of paths uinstalled-files.txturRuutf-8u./N( RRR;R#RRRRRR(RtabsoluteRtskipRRRa((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRs    $cCst|to|j|jkS(N(RNRR(RR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRsN(RRRR#RRR!RRRRRRRRRRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRNs  K    &  tDependencyGraphcBsheZdZdZdZd dZdZdZddZ e dZ d Z d Z RS( u Represents a dependency graph between distributions. The dependency relationships are stored in an ``adjacency_list`` that maps distributions to a list of ``(other, label)`` tuples where ``other`` is a distribution and the edge is labeled with ``label`` (i.e. the version specifier, if such was provided). Also, for more efficient traversal, for every distribution ``x``, a list of predecessors is kept in ``reverse_list[x]``. An edge from distribution ``a`` to distribution ``b`` means that ``a`` depends on ``b``. If any missing dependencies are found, they are stored in ``missing``, which is a dictionary that maps distributions to a list of requirements that were not provided by any other distributions. cCsi|_i|_i|_dS(N(tadjacency_listt reverse_listR(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR.s  cCsg|j| "%s" [label="%s"] u "%s" -> "%s" usubgraph disconnected { ulabel = "Disconnected" ubgcolor = red u"%s"u u} N(RRtitemsRRR!R(RRtskip_disconnectedt disconnectedRtadjsRR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytto_dotgs&    %    cCs=g}i}x(|jjD]\}}|||t|jD])\}}|sZ|j|||=qZqZW|sPnxO|jD]A\}}g|D]$\}}||kr||f^q||sL         4  7F 6  site-packages/pip/_vendor/distlib/database.pyo000064400000140306147204247350015453 0ustar00 abc@s0dZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z mZddlmZddlmZmZddlmZmZmZdd lmZmZmZmZmZmZmZd d d d dgZ ej!e"Z#dZ$dZ%deddde$dfZ&dZ'de(fdYZ)de(fdYZ*de(fdYZ+de+fdYZ,de,fd YZ-d!e,fd"YZ.e-Z/e.Z0d#e(fd$YZ1d%d&Z2d'Z3d(Z4d)Z5dS(*uPEP 376 implementation.i(tunicode_literalsNi(tDistlibExceptiont resources(tStringIO(t get_schemetUnsupportedVersionError(tMetadatatMETADATA_FILENAMEtWHEEL_METADATA_FILENAME(tparse_requirementtcached_propertytparse_name_and_versiont read_exportst write_exportst CSVReadert CSVWriteru DistributionuBaseInstalledDistributionuInstalledDistributionuEggInfoDistributionuDistributionPathupydist-exports.jsonupydist-commands.jsonu INSTALLERuRECORDu REQUESTEDu RESOURCESuSHAREDu .dist-infot_CachecBs)eZdZdZdZdZRS(uL A simple cache mapping names and .dist-info paths to distributions cCsi|_i|_t|_dS(uZ Initialise an instance. There is normally one for each DistributionPath. N(tnametpathtFalset generated(tself((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt__init__0s  cCs'|jj|jjt|_dS(uC Clear the cache, setting it to its initial state. N(RtclearRRR(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR8s  cCsH|j|jkrD||j|j<|jj|jgj|ndS(u` Add a distribution to the cache. :param dist: The distribution to add. N(RRt setdefaulttkeytappend(Rtdist((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytadd@s(t__name__t __module__t__doc__RRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR,s  tDistributionPathcBseZdZd edZdZdZeeeZ dZ dZ dZ e dZdZd Zd d Zd Zd d ZRS(uU Represents a set of distributions installed on a path (typically sys.path). cCsg|dkrtj}n||_t|_||_t|_t|_t|_ t d|_ dS(u Create an instance from a path, optionally including legacy (distutils/ setuptools/distribute) distributions. :param path: The path to use, as a list of directories. If not specified, sys.path is used. :param include_egg: If True, this instance will look for and return legacy distributions as well as those based on PEP 376. udefaultN( tNonetsysRtTruet _include_distt _include_eggRt_cachet _cache_eggt_cache_enabledRt_scheme(RRt include_egg((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRNs        cCs|jS(N(R((R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt_get_cache_enabledbscCs ||_dS(N(R((Rtvalue((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt_set_cache_enabledescCs|jj|jjdS(u, Clears the internal cache. N(R&RR'(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt clear_cachejs c cst}x|jD]}tj|}|dkr:qn|jd}| s|j r`qnt|j}x^|D]V}|j|}| sv|j|krqvn|jr}|j t r}t t g}x<|D]1}t j||} |j| } | rPqqWqvtj| j} td| dd} WdQXtjd|j|j|jt|jd| d|Vqv|jrv|j d rvtjd|j|j|jt|j|VqvqvWqWdS( uD Yield .dist-info and/or .egg(-info) distributions. utfileobjtschemeulegacyNuFound %stmetadatatenvu .egg-infou.egg(u .egg-infou.egg(tsetRRtfinder_for_pathR!tfindt is_containertsortedR$tendswitht DISTINFO_EXTRRt posixpathtjoint contextlibtclosingt as_streamRtloggertdebugRtnew_dist_classR%told_dist_class( RtseenRtfindertrtrsettentrytpossible_filenamestmetadata_filenamet metadata_pathtpydisttstreamR1((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt_yield_distributionsrs@       cCs|jj }|jo |jj }|s/|rxF|jD]8}t|trd|jj|q<|jj|q<W|rt|j_n|rt|j_qndS(uk Scan the path for distributions and populate the cache with those that are found. N( R&RR%R'RMt isinstancetInstalledDistributionRR#(Rtgen_disttgen_eggR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt_generate_caches  cCs)|jdd}dj||gtS(uo The *name* and *version* parameters are converted into their filename-escaped form, i.e. any ``'-'`` characters are replaced with ``'_'`` other than the one in ``'dist-info'`` and the one separating the name from the version number. :parameter name: is converted to a standard distribution name by replacing any runs of non- alphanumeric characters with a single ``'-'``. :type name: string :parameter version: is converted to a standard version string. Spaces become dots, and all other non-alphanumeric characters (except dots) become dashes, with runs of multiple dashes condensed to a single dash. :type version: string :returns: directory name :rtype: stringu-u_(treplaceR;R9(tclsRtversion((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytdistinfo_dirnamesccs|js(xv|jD] }|VqWnZ|jx|jjjD] }|VqEW|jrx"|jjjD] }|VqpWndS(u5 Provides an iterator that looks for distributions and returns :class:`InstalledDistribution` or :class:`EggInfoDistribution` instances for each one of them. :rtype: iterator of :class:`InstalledDistribution` and :class:`EggInfoDistribution` instances N(R(RMRRR&RtvaluesR%R'(RR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytget_distributionss     cCsd}|j}|jsNx|jD]}|j|kr(|}Pq(q(Wne|j||jjkr|jj|d}n2|jr||j jkr|j j|d}n|S(u= Looks for a named distribution on the path. This function only returns the first result found, as no more than one value is expected. If nothing is found, ``None`` is returned. :rtype: :class:`InstalledDistribution`, :class:`EggInfoDistribution` or ``None`` iN( R!tlowerR(RMRRRR&RR%R'(RRtresultR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytget_distributions     c csd}|dk r_y |jjd||f}Wq_tk r[td||fq_Xnx|jD]z}|j}xh|D]`}t|\}}|dkr||kr|VPqq||kr|j|r|VPqqWqlWdS(u Iterates over all distributions to find which distributions provide *name*. If a *version* is provided, it will be used to filter the results. This function only returns the first result found, since no more than one values are expected. If the directory is not found, returns ``None``. :parameter version: a version specifier that indicates the version required, conforming to the format in ``PEP-345`` :type name: string :type version: string u%s (%s)uinvalid name or version: %r, %rN( R!R)tmatchert ValueErrorRRXtprovidesR tmatch( RRRUR\Rtprovidedtptp_nametp_ver((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytprovides_distributions$       cCs;|j|}|dkr.td|n|j|S(u5 Return the path to a resource file. uno distribution named %r foundN(R[R!t LookupErrortget_resource_path(RRt relative_pathR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt get_file_paths ccsxy|jD]k}|j}||kr ||}|dk rY||kru||Vquqxx|jD] }|VqfWq q WdS(u Return all of the exported entries in a particular category. :param category: The category to search for entries. :param name: If specified, only entries with that name are returned. N(RXtexportsR!RW(RtcategoryRRREtdtv((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytget_exported_entries"s     N(RRRR!RRR+R-tpropertyt cache_enabledR.RMRRt classmethodRVRXR[RdRhRm(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR Js    *    $ t DistributioncBseZdZeZeZdZedZeZ edZ edZ dZ edZ edZedZed Zed Zd Zd Zd ZdZRS(u A base class for distributions, whether installed or from indexes. Either way, it must have some metadata, so that's all that's needed for construction. cCsp||_|j|_|jj|_|j|_d|_d|_d|_d|_ t |_ i|_ dS(u Initialise an instance. :param metadata: The instance of :class:`Metadata` describing this distribution. N( R1RRYRRUR!tlocatortdigesttextrastcontextR3t download_urlstdigests(RR1((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRGs        cCs |jjS(uH The source archive download URL for this distribution. (R1t source_url(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRxXscCsd|j|jfS(uX A utility property which displays the name and version in parentheses. u%s (%s)(RRU(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytname_and_versionascCsB|jj}d|j|jf}||kr>|j|n|S(u A set of distribution names and versions provided by this distribution. :return: A set of "name (version)" strings. u%s (%s)(R1R^RRUR(Rtplistts((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR^hs   cCsS|j}tjd|jt||}t|j|d|jd|jS(Nu%Getting requirements from metadata %rRtR2( R1R?R@ttodicttgetattrR3tget_requirementsRtRu(Rtreq_attrtmdtreqts((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt_get_requirementsts  cCs |jdS(Nu run_requires(R(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt run_requires{scCs |jdS(Nu meta_requires(R(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt meta_requiresscCs |jdS(Nubuild_requires(R(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytbuild_requiresscCs |jdS(Nu test_requires(R(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt test_requiresscCs |jdS(Nu dev_requires(R(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt dev_requiressc Cst|}t|jj}y|j|j}Wn@tk rvtjd||j d}|j|}nX|j }t }x]|j D]R}t |\}} ||krqny|j| }PWqtk rqXqW|S(u Say if this instance matches (fulfills) a requirement. :param req: The requirement to match. :rtype req: str :return: True if it matches, else False. u+could not read version %r - using name onlyi(R RR1R0R\t requirementRR?twarningtsplitRRR^R R_( RtreqRER0R\RRZRaRbRc((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytmatches_requirements*      cCs6|jrd|j}nd}d|j|j|fS(uC Return a textual representation of this instance, u [%s]uu(RxRRU(Rtsuffix((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt__repr__s cCs[t|t|k r!t}n6|j|jkoT|j|jkoT|j|jk}|S(u< See if this distribution is the same as another. :param other: The distribution to compare with. To be equal to one another. distributions must have the same type, name, version and source_url. :return: True if it is the same, else False. (ttypeRRRURx(RtotherRZ((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt__eq__s  cCs't|jt|jt|jS(uH Compute hash in a way which matches the equality test. (thashRRURx(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt__hash__s(RRRRtbuild_time_dependencyt requestedRRnRxt download_urlRyR^RRRRRRRRRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRq5s$   " tBaseInstalledDistributioncBs,eZdZdZddZddZRS(u] This is the base class for installed distributions (whether PEP 376 or legacy). cCs,tt|j|||_||_dS(u Initialise an instance. :param metadata: An instance of :class:`Metadata` which describes the distribution. This will normally have been initialised from a metadata file in the ``path``. :param path: The path of the ``.dist-info`` or ``.egg-info`` directory for the distribution. :param env: This is normally the :class:`DistributionPath` instance where this distribution was found. N(tsuperRRRt dist_path(RR1RR2((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRs  cCs|dkr|j}n|dkr6tj}d}ntt|}d|j}||j}tj|jdj d}d||fS(u Get the hash of some data, using a particular hash algorithm, if specified. :param data: The data to be hashed. :type data: bytes :param hasher: The name of a hash implementation, supported by hashlib, or ``None``. Examples of valid values are ``'sha1'``, ``'sha224'``, ``'sha384'``, '``sha256'``, ``'md5'`` and ``'sha512'``. If no hasher is specified, the ``hasher`` attribute of the :class:`InstalledDistribution` instance is used. If the hasher is determined to be ``None``, MD5 is used as the hashing algorithm. :returns: The hash of the data. If a hasher was explicitly specified, the returned hash will be prefixed with the specified hasher followed by '='. :rtype: str uu%s=t=uasciiu%s%sN( R!thasherthashlibtmd5R}Rstbase64turlsafe_b64encodetrstriptdecode(RtdataRtprefixRs((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytget_hashs      !N(RRRR!RRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRs ROcBseZdZdZdddZdZdZdZe dZ dZ dZ d Z d Zed Zd Ze d ZedZdZdZdZdZejZRS(u  Created with the *path* of the ``.dist-info`` directory provided to the constructor. It reads the metadata contained in ``pydist.json`` when it is instantiated., or uses a passed in Metadata instance (useful for when dry-run mode is being used). usha256c Cstj||_}|dkr;ddl}|jn|rr|jrr||jjkrr|jj|j }n|dkr$|j t }|dkr|j t }n|dkr|j d}n|dkrt dt |fntj|j}td|dd}WdQXntt|j||||rb|jrb|jj|ny|j d}Wn'tk rddl}|jnX|dk |_dS(NiuMETADATAuno %s found in %sR/R0ulegacyu REQUESTED(RR4RDR!tpdbt set_traceR(R&RR1R5RRR]R<R=R>RRRORRtAttributeErrorR(RRR1R2RDRRERL((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRs4  !       cCsd|j|j|jfS(Nu#(RRUR(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR2scCsd|j|jfS(Nu%s %s(RRU(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt__str__6sc Csg}|jd}tj|j}td|i}x_|D]W}gtt|dD] }d^qb}||\}} } |j|| | fqFWWdQXWdQX|S(u" Get the list of installed files for the distribution :return: A list of tuples of path, hash and size. Note that hash and size might be ``None`` for some entries. The path is exactly as stored in the file (which is as in PEP 376). uRECORDRLiN( tget_distinfo_resourceR<R=R>RtrangetlenR!R( RtresultsRERLt record_readertrowtitmissingRtchecksumtsize((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt _get_records9s (&cCs.i}|jt}|r*|j}n|S(u Return the information exported by this distribution. :return: A dictionary of exports, mapping an export category to a dict of :class:`ExportEntry` instances describing the individual export entries, and keyed by name. (RtEXPORTS_FILENAMER (RRZRE((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRiPs cCsLi}|jt}|rHtj|j}t|}WdQXn|S(u Read exports data from a file in .ini format. :return: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. N(RRR<R=R>R (RRZRERL((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR ^s cCs8|jt}t|d}t||WdQXdS(u Write a dictionary of exports to a file in .ini format. :param exports: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. uwN(tget_distinfo_fileRtopenR (RRitrftf((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR msc Cs|jd}tj|jF}td|.}x$|D]\}}||kr@|Sq@WWdQXWdQXtd|dS(uW NOTE: This API may change in the future. Return the absolute path to a resource file with the given relative path. :param relative_path: The path, relative to .dist-info, of the resource of interest. :return: The absolute path where the resource is to be found. u RESOURCESRLNu3no resource file with relative path %r is installed(RR<R=R>RtKeyError(RRgRERLtresources_readertrelativet destination((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRfxs  ccs x|jD] }|Vq WdS(u Iterates over the ``RECORD`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: iterator of (path, hash, size) N(R(RRZ((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytlist_installed_filessc Cstjj|d}tjj|j}|j|}tjj|d}|jd}tjd||rwdSt |}x|D]}tjj |s|j d rd} } nCdtjj |} t |d} |j| j} WdQX|j|s(|r@|j|r@tjj||}n|j|| | fqW|j|rtjj||}n|j|ddfWdQX|S( u Writes the ``RECORD`` file, using the ``paths`` iterable passed in. Any existing ``RECORD`` file is silently overwritten. prefix is used to determine when to write absolute paths. uuRECORDu creating %su.pycu.pyou%durbN(u.pycu.pyo(tosRR;tdirnamet startswithRR?tinfoR!RtisdirR8tgetsizeRRtreadtrelpathtwriterow( RtpathsRtdry_runtbasetbase_under_prefixt record_pathtwriterRt hash_valueRtfp((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytwrite_installed_filess. ! c Csg}tjj|j}|jd}xn|jD]`\}}}tjj|sptjj||}n||krq7ntjj|s|j|dt t fq7tjj |r7t tjj |}|r||kr|j|d||fq|rd|kr3|jddd}nd }t|dG} |j| j|} | |kr|j|d|| fnWd QXqq7q7W|S( u Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is checked first, then size, then hash), the expected value and the actual value. uRECORDuexistsusizeu=iiurbuhashN(RRRRRtisabsR;texistsRR#RtisfiletstrRRR!RRR( Rt mismatchesRRRRRt actual_sizeRRt actual_hash((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytcheck_installed_filess.    ,cCsi}tjj|jd}tjj|rtj|ddd}|jj}WdQXx[|D]P}|jdd\}}|dkr|j |gj |qj|||su%s (%s)( RtstripRR?RR Rtt constraintsRRR;(RtreqsRRREtcons((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytparse_requires_dataos&       csRg}y4tj|dd}|j}WdQXWntk rMnX|S(uCreate a list of dependencies from a requires.txt file. *req_path*: the path to a setuptools-produced requires.txt file. uruutf-8N(RRRtIOError(treq_pathRR(R(s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytparse_requires_paths u.egguEGG-INFOuPKG-INFORR0ulegacyu requires.txtuEGG-INFO/PKG-INFOuutf8R/uEGG-INFO/requires.txtuutf-8u .egg-infou,path must end with .egg-info or .egg, got %r(R!R8RRRR;Rt zipimportt zipimporterRtget_dataRRRtadd_requirements( RRtrequiresRt meta_pathR1RtzipfR/R((Rs@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRls:     cCsd|j|j|jfS(Nu!(RRUR(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRscCsd|j|jfS(Nu%s %s(RRU(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRscCsg}tjj|jd}tjj|rx`|jD]O\}}}||kr^q=ntjj|s=|j|dttfq=q=Wn|S(u Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is checked first, then size, then hash), the expected value and the actual value. uinstalled-files.txtuexists(RRR;RRRR#R(RRRRt_((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRs  #c Cs2d}d}tjj|jd}g}tjj|r.tj|ddd}x|D]}|j}tjjtjj|j|}tjj|stj d||j d rqdqntjj |sd|j |||||fqdqdWWd QX|j |d d fn|S( u Iterates over the ``installed-files.txt`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: a list of (path, hash, size) cSs@t|d}z|j}Wd|jXtj|jS(Nurb(RRtcloseRRt hexdigest(RRtcontent((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt_md5s  cSstj|jS(N(Rtstattst_size(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyt_sizesuinstalled-files.txturRuutf-8uNon-existent file: %su.pycu.pyoN(u.pycu.pyo(RRR;RRRRtnormpathR?RR8RRR!(RRRRRZRRRa((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRs"    $ /c cstjj|jd}t}tj|ddd}x|D]}|j}|dkrjt}q@n|s@tjjtjj|j|}|j |jr|r|Vq|Vqq@q@WWdQXdS(u  Iterates over the ``installed-files.txt`` entries and returns paths for each line if the path is pointing to a file located in the ``.egg-info`` directory or one of its subdirectories. :parameter absolute: If *absolute* is ``True``, each returned path is transformed into a local absolute path. Otherwise the raw value from ``installed-files.txt`` is returned. :type absolute: boolean :returns: iterator of paths uinstalled-files.txturRuutf-8u./N( RRR;R#RRRRRR(RtabsoluteRtskipRRRa((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRs    $cCst|to|j|jkS(N(RNRR(RR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRsN(RRRR#RRR!RRRRRRRRRRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyRNs  K    &  tDependencyGraphcBsheZdZdZdZd dZdZdZddZ e dZ d Z d Z RS( u Represents a dependency graph between distributions. The dependency relationships are stored in an ``adjacency_list`` that maps distributions to a list of ``(other, label)`` tuples where ``other`` is a distribution and the edge is labeled with ``label`` (i.e. the version specifier, if such was provided). Also, for more efficient traversal, for every distribution ``x``, a list of predecessors is kept in ``reverse_list[x]``. An edge from distribution ``a`` to distribution ``b`` means that ``a`` depends on ``b``. If any missing dependencies are found, they are stored in ``missing``, which is a dictionary that maps distributions to a list of requirements that were not provided by any other distributions. cCsi|_i|_i|_dS(N(tadjacency_listt reverse_listR(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pyR.s  cCsg|j| "%s" [label="%s"] u "%s" -> "%s" usubgraph disconnected { ulabel = "Disconnected" ubgcolor = red u"%s"u u} N(RRtitemsRRR!R(RRtskip_disconnectedt disconnectedRtadjsRR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/database.pytto_dotgs&    %    cCs=g}i}x(|jjD]\}}|||t|jD])\}}|sZ|j|||=qZqZW|sPnxO|jD]A\}}g|D]$\}}||kr||f^q||sL         4  7F 6  site-packages/pip/_vendor/distlib/index.py000064400000051135147204247350014640 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2013 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import hashlib import logging import os import shutil import subprocess import tempfile try: from threading import Thread except ImportError: from dummy_threading import Thread from . import DistlibException from .compat import (HTTPBasicAuthHandler, Request, HTTPPasswordMgr, urlparse, build_opener, string_types) from .util import cached_property, zip_dir, ServerProxy logger = logging.getLogger(__name__) DEFAULT_INDEX = 'https://pypi.python.org/pypi' DEFAULT_REALM = 'pypi' class PackageIndex(object): """ This class represents a package index compatible with PyPI, the Python Package Index. """ boundary = b'----------ThIs_Is_tHe_distlib_index_bouNdaRY_$' def __init__(self, url=None): """ Initialise an instance. :param url: The URL of the index. If not specified, the URL for PyPI is used. """ self.url = url or DEFAULT_INDEX self.read_configuration() scheme, netloc, path, params, query, frag = urlparse(self.url) if params or query or frag or scheme not in ('http', 'https'): raise DistlibException('invalid repository: %s' % self.url) self.password_handler = None self.ssl_verifier = None self.gpg = None self.gpg_home = None self.rpc_proxy = None with open(os.devnull, 'w') as sink: # Use gpg by default rather than gpg2, as gpg2 insists on # prompting for passwords for s in ('gpg', 'gpg2'): try: rc = subprocess.check_call([s, '--version'], stdout=sink, stderr=sink) if rc == 0: self.gpg = s break except OSError: pass def _get_pypirc_command(self): """ Get the distutils command for interacting with PyPI configurations. :return: the command. """ from distutils.core import Distribution from distutils.config import PyPIRCCommand d = Distribution() return PyPIRCCommand(d) def read_configuration(self): """ Read the PyPI access configuration as supported by distutils, getting PyPI to do the actual work. This populates ``username``, ``password``, ``realm`` and ``url`` attributes from the configuration. """ # get distutils to do the work c = self._get_pypirc_command() c.repository = self.url cfg = c._read_pypirc() self.username = cfg.get('username') self.password = cfg.get('password') self.realm = cfg.get('realm', 'pypi') self.url = cfg.get('repository', self.url) def save_configuration(self): """ Save the PyPI access configuration. You must have set ``username`` and ``password`` attributes before calling this method. Again, distutils is used to do the actual work. """ self.check_credentials() # get distutils to do the work c = self._get_pypirc_command() c._store_pypirc(self.username, self.password) def check_credentials(self): """ Check that ``username`` and ``password`` have been set, and raise an exception if not. """ if self.username is None or self.password is None: raise DistlibException('username and password must be set') pm = HTTPPasswordMgr() _, netloc, _, _, _, _ = urlparse(self.url) pm.add_password(self.realm, netloc, self.username, self.password) self.password_handler = HTTPBasicAuthHandler(pm) def register(self, metadata): """ Register a distribution on PyPI, using the provided metadata. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the distribution to be registered. :return: The HTTP response received from PyPI upon submission of the request. """ self.check_credentials() metadata.validate() d = metadata.todict() d[':action'] = 'verify' request = self.encode_request(d.items(), []) response = self.send_request(request) d[':action'] = 'submit' request = self.encode_request(d.items(), []) return self.send_request(request) def _reader(self, name, stream, outbuf): """ Thread runner for reading lines of from a subprocess into a buffer. :param name: The logical name of the stream (used for logging only). :param stream: The stream to read from. This will typically a pipe connected to the output stream of a subprocess. :param outbuf: The list to append the read lines to. """ while True: s = stream.readline() if not s: break s = s.decode('utf-8').rstrip() outbuf.append(s) logger.debug('%s: %s' % (name, s)) stream.close() def get_sign_command(self, filename, signer, sign_password, keystore=None): """ Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The signing command as a list suitable to be passed to :class:`subprocess.Popen`. """ cmd = [self.gpg, '--status-fd', '2', '--no-tty'] if keystore is None: keystore = self.gpg_home if keystore: cmd.extend(['--homedir', keystore]) if sign_password is not None: cmd.extend(['--batch', '--passphrase-fd', '0']) td = tempfile.mkdtemp() sf = os.path.join(td, os.path.basename(filename) + '.asc') cmd.extend(['--detach-sign', '--armor', '--local-user', signer, '--output', sf, filename]) logger.debug('invoking: %s', ' '.join(cmd)) return cmd, sf def run_command(self, cmd, input_data=None): """ Run a command in a child process , passing it any input data specified. :param cmd: The command to run. :param input_data: If specified, this must be a byte string containing data to be sent to the child process. :return: A tuple consisting of the subprocess' exit code, a list of lines read from the subprocess' ``stdout``, and a list of lines read from the subprocess' ``stderr``. """ kwargs = { 'stdout': subprocess.PIPE, 'stderr': subprocess.PIPE, } if input_data is not None: kwargs['stdin'] = subprocess.PIPE stdout = [] stderr = [] p = subprocess.Popen(cmd, **kwargs) # We don't use communicate() here because we may need to # get clever with interacting with the command t1 = Thread(target=self._reader, args=('stdout', p.stdout, stdout)) t1.start() t2 = Thread(target=self._reader, args=('stderr', p.stderr, stderr)) t2.start() if input_data is not None: p.stdin.write(input_data) p.stdin.close() p.wait() t1.join() t2.join() return p.returncode, stdout, stderr def sign_file(self, filename, signer, sign_password, keystore=None): """ Sign a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystore: The path to a directory which contains the keys used in signing. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The absolute pathname of the file where the signature is stored. """ cmd, sig_file = self.get_sign_command(filename, signer, sign_password, keystore) rc, stdout, stderr = self.run_command(cmd, sign_password.encode('utf-8')) if rc != 0: raise DistlibException('sign command failed with error ' 'code %s' % rc) return sig_file def upload_file(self, metadata, filename, signer=None, sign_password=None, filetype='sdist', pyversion='source', keystore=None): """ Upload a release file to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the file to be uploaded. :param filename: The pathname of the file to be uploaded. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param filetype: The type of the file being uploaded. This is the distutils command which produced that file, e.g. ``sdist`` or ``bdist_wheel``. :param pyversion: The version of Python which the release relates to. For code compatible with any Python, this would be ``source``, otherwise it would be e.g. ``3.2``. :param keystore: The path to a directory which contains the keys used in signing. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The HTTP response received from PyPI upon submission of the request. """ self.check_credentials() if not os.path.exists(filename): raise DistlibException('not found: %s' % filename) metadata.validate() d = metadata.todict() sig_file = None if signer: if not self.gpg: logger.warning('no signing program available - not signed') else: sig_file = self.sign_file(filename, signer, sign_password, keystore) with open(filename, 'rb') as f: file_data = f.read() md5_digest = hashlib.md5(file_data).hexdigest() sha256_digest = hashlib.sha256(file_data).hexdigest() d.update({ ':action': 'file_upload', 'protocol_version': '1', 'filetype': filetype, 'pyversion': pyversion, 'md5_digest': md5_digest, 'sha256_digest': sha256_digest, }) files = [('content', os.path.basename(filename), file_data)] if sig_file: with open(sig_file, 'rb') as f: sig_data = f.read() files.append(('gpg_signature', os.path.basename(sig_file), sig_data)) shutil.rmtree(os.path.dirname(sig_file)) request = self.encode_request(d.items(), files) return self.send_request(request) def upload_documentation(self, metadata, doc_dir): """ Upload documentation to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the documentation to be uploaded. :param doc_dir: The pathname of the directory which contains the documentation. This should be the directory that contains the ``index.html`` for the documentation. :return: The HTTP response received from PyPI upon submission of the request. """ self.check_credentials() if not os.path.isdir(doc_dir): raise DistlibException('not a directory: %r' % doc_dir) fn = os.path.join(doc_dir, 'index.html') if not os.path.exists(fn): raise DistlibException('not found: %r' % fn) metadata.validate() name, version = metadata.name, metadata.version zip_data = zip_dir(doc_dir).getvalue() fields = [(':action', 'doc_upload'), ('name', name), ('version', version)] files = [('content', name, zip_data)] request = self.encode_request(fields, files) return self.send_request(request) def get_verify_command(self, signature_filename, data_filename, keystore=None): """ Return a suitable command for verifying a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The verifying command as a list suitable to be passed to :class:`subprocess.Popen`. """ cmd = [self.gpg, '--status-fd', '2', '--no-tty'] if keystore is None: keystore = self.gpg_home if keystore: cmd.extend(['--homedir', keystore]) cmd.extend(['--verify', signature_filename, data_filename]) logger.debug('invoking: %s', ' '.join(cmd)) return cmd def verify_signature(self, signature_filename, data_filename, keystore=None): """ Verify a signature for a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: True if the signature was verified, else False. """ if not self.gpg: raise DistlibException('verification unavailable because gpg ' 'unavailable') cmd = self.get_verify_command(signature_filename, data_filename, keystore) rc, stdout, stderr = self.run_command(cmd) if rc not in (0, 1): raise DistlibException('verify command failed with error ' 'code %s' % rc) return rc == 0 def download_file(self, url, destfile, digest=None, reporthook=None): """ This is a convenience method for downloading a file from an URL. Normally, this will be a file from the index, though currently no check is made for this (i.e. a file can be downloaded from anywhere). The method is just like the :func:`urlretrieve` function in the standard library, except that it allows digest computation to be done during download and checking that the downloaded data matched any expected value. :param url: The URL of the file to be downloaded (assumed to be available via an HTTP GET request). :param destfile: The pathname where the downloaded file is to be saved. :param digest: If specified, this must be a (hasher, value) tuple, where hasher is the algorithm used (e.g. ``'md5'``) and ``value`` is the expected value. :param reporthook: The same as for :func:`urlretrieve` in the standard library. """ if digest is None: digester = None logger.debug('No digest specified') else: if isinstance(digest, (list, tuple)): hasher, digest = digest else: hasher = 'md5' digester = getattr(hashlib, hasher)() logger.debug('Digest specified: %s' % digest) # The following code is equivalent to urlretrieve. # We need to do it this way so that we can compute the # digest of the file as we go. with open(destfile, 'wb') as dfp: # addinfourl is not a context manager on 2.x # so we have to use try/finally sfp = self.send_request(Request(url)) try: headers = sfp.info() blocksize = 8192 size = -1 read = 0 blocknum = 0 if "content-length" in headers: size = int(headers["Content-Length"]) if reporthook: reporthook(blocknum, blocksize, size) while True: block = sfp.read(blocksize) if not block: break read += len(block) dfp.write(block) if digester: digester.update(block) blocknum += 1 if reporthook: reporthook(blocknum, blocksize, size) finally: sfp.close() # check that we got the whole file, if we can if size >= 0 and read < size: raise DistlibException( 'retrieval incomplete: got only %d out of %d bytes' % (read, size)) # if we have a digest, it must match. if digester: actual = digester.hexdigest() if digest != actual: raise DistlibException('%s digest mismatch for %s: expected ' '%s, got %s' % (hasher, destfile, digest, actual)) logger.debug('Digest verified: %s', digest) def send_request(self, req): """ Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse). """ handlers = [] if self.password_handler: handlers.append(self.password_handler) if self.ssl_verifier: handlers.append(self.ssl_verifier) opener = build_opener(*handlers) return opener.open(req) def encode_request(self, fields, files): """ Encode fields and files for posting to an HTTP server. :param fields: The fields to send as a list of (fieldname, value) tuples. :param files: The files to send as a list of (fieldname, filename, file_bytes) tuple. """ # Adapted from packaging, which in turn was adapted from # http://code.activestate.com/recipes/146306 parts = [] boundary = self.boundary for k, values in fields: if not isinstance(values, (list, tuple)): values = [values] for v in values: parts.extend(( b'--' + boundary, ('Content-Disposition: form-data; name="%s"' % k).encode('utf-8'), b'', v.encode('utf-8'))) for key, filename, value in files: parts.extend(( b'--' + boundary, ('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, filename)).encode('utf-8'), b'', value)) parts.extend((b'--' + boundary + b'--', b'')) body = b'\r\n'.join(parts) ct = b'multipart/form-data; boundary=' + boundary headers = { 'Content-type': ct, 'Content-length': str(len(body)) } return Request(self.url, body, headers) def search(self, terms, operator=None): if isinstance(terms, string_types): terms = {'name': terms} if self.rpc_proxy is None: self.rpc_proxy = ServerProxy(self.url, timeout=3.0) return self.rpc_proxy.search(terms, operator or 'and') site-packages/pip/_vendor/distlib/index.pyc000064400000047134147204247350015007 0ustar00 abc@sddlZddlZddlZddlZddlZddlZyddlmZWn!ek rddl mZnXddl m Z ddl m Z mZmZmZmZmZddlmZmZmZejeZdZdZd efd YZdS( iN(tThreadi(tDistlibException(tHTTPBasicAuthHandlertRequesttHTTPPasswordMgrturlparset build_openert string_types(tcached_propertytzip_dirt ServerProxyshttps://pypi.python.org/pypitpypit PackageIndexcBseZdZdZddZdZdZdZdZ dZ dZ dd Z dd Z dd Zddd d ddZdZddZddZdddZdZdZddZRS(sc This class represents a package index compatible with PyPI, the Python Package Index. s.----------ThIs_Is_tHe_distlib_index_bouNdaRY_$c Cs|p t|_|jt|j\}}}}}}|sX|sX|sX|d krntd|jnd |_d |_d |_d |_ d |_ t t j dj}x`d D]X} y>tj| dgd|d |} | d kr| |_PnWqtk rqXqWWd QXd S(s Initialise an instance. :param url: The URL of the index. If not specified, the URL for PyPI is used. thttpthttpssinvalid repository: %stwtgpgtgpg2s --versiontstdouttstderriN(R R(RR(t DEFAULT_INDEXturltread_configurationRRtNonetpassword_handlert ssl_verifierRtgpg_homet rpc_proxytopentostdevnullt subprocesst check_calltOSError( tselfRtschemetnetloctpathtparamstquerytfragtsinktstrc((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyt__init__$s( !          cCs3ddlm}ddlm}|}||S(ss Get the distutils command for interacting with PyPI configurations. :return: the command. i(t Distribution(t PyPIRCCommand(tdistutils.coreR-tdistutils.configR.(R"R-R.td((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyt_get_pypirc_commandBs cCsy|j}|j|_|j}|jd|_|jd|_|jdd|_|jd|j|_dS(s Read the PyPI access configuration as supported by distutils, getting PyPI to do the actual work. This populates ``username``, ``password``, ``realm`` and ``url`` attributes from the configuration. tusernametpasswordtrealmR t repositoryN(R2RR6t _read_pypirctgetR3R4R5(R"tctcfg((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyRLs   cCs0|j|j}|j|j|jdS(s Save the PyPI access configuration. You must have set ``username`` and ``password`` attributes before calling this method. Again, distutils is used to do the actual work. N(tcheck_credentialsR2t _store_pypircR3R4(R"R9((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pytsave_configuration[s  cCs|jdks|jdkr-tdnt}t|j\}}}}}}|j|j||j|jt ||_ dS(sp Check that ``username`` and ``password`` have been set, and raise an exception if not. s!username and password must be setN( R3RR4RRRRt add_passwordR5RR(R"tpmt_R$((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyR;gs  !cCs|j|j|j}d|d<|j|jg}|j|}d|d<|j|jg}|j|S(sq Register a distribution on PyPI, using the provided metadata. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the distribution to be registered. :return: The HTTP response received from PyPI upon submission of the request. tverifys:actiontsubmit(R;tvalidatettodicttencode_requesttitemst send_request(R"tmetadataR1trequesttresponse((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pytregisterss     cCsjxYtr[|j}|sPn|jdj}|j|tjd||fqW|jdS(sr Thread runner for reading lines of from a subprocess into a buffer. :param name: The logical name of the stream (used for logging only). :param stream: The stream to read from. This will typically a pipe connected to the output stream of a subprocess. :param outbuf: The list to append the read lines to. sutf-8s%s: %sN(tTruetreadlinetdecodetrstriptappendtloggertdebugtclose(R"tnametstreamtoutbufR*((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyt_readers   cCs|jdddg}|dkr-|j}n|rI|jd|gn|dk rn|jdddgntj}tjj|tjj |d}|jd d d |d ||gt j d dj|||fS(s Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The signing command as a list suitable to be passed to :class:`subprocess.Popen`. s --status-fdt2s--no-ttys --homedirs--batchs--passphrase-fdt0s.ascs --detach-signs--armors --local-users--outputs invoking: %st N( RRRtextendttempfiletmkdtempRR%tjointbasenameRQRR(R"tfilenametsignert sign_passwordtkeystoretcmdttdtsf((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pytget_sign_commands    %c Cs itjd6tjd6}|dk r6tj|d        c Cs|jtjj|s/td|ntjj|d}tjj|sitd|n|j|j|j }}t |j }d d|fd|fg}d||fg}|j ||} |j | S( s2 Upload documentation to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the documentation to be uploaded. :param doc_dir: The pathname of the directory which contains the documentation. This should be the directory that contains the ``index.html`` for the documentation. :return: The HTTP response received from PyPI upon submission of the request. snot a directory: %rs index.htmls not found: %rs:actiont doc_uploadRTtversionR(s:actionR(R;RR%tisdirRR^RRCRTRR tgetvalueRERG( R"RHtdoc_dirtfnRTRtzip_datatfieldsRRI((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pytupload_documentation)s  cCs||jdddg}|dkr-|j}n|rI|jd|gn|jd||gtjddj||S( s| Return a suitable command for verifying a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The verifying command as a list suitable to be passed to :class:`subprocess.Popen`. s --status-fdRXs--no-ttys --homedirs--verifys invoking: %sRZN(RRRR[RQRRR^(R"tsignature_filenamet data_filenameRcRd((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pytget_verify_commandEs  cCsn|jstdn|j|||}|j|\}}}|dkrdtd|n|dkS(s6 Verify a signature for a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: True if the signature was verified, else False. s0verification unavailable because gpg unavailableiis(verify command failed with error code %s(ii(RRRRv(R"RRRcRdR+RR((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pytverify_signature]s     cCs |d kr"d }tjdnMt|ttfrF|\}}nd}tt|}tjd|t|d}|j t |}z|j } d} d} d} d} d| krt | d } n|r|| | | nxyt rp|j| }|sPn| t|7} |j||rJ|j|n| d 7} |r|| | | qqWWd |jXWd QX| dkr| | krtd | | fn|r|j}||krtd ||||fntjd|nd S(s This is a convenience method for downloading a file from an URL. Normally, this will be a file from the index, though currently no check is made for this (i.e. a file can be downloaded from anywhere). The method is just like the :func:`urlretrieve` function in the standard library, except that it allows digest computation to be done during download and checking that the downloaded data matched any expected value. :param url: The URL of the file to be downloaded (assumed to be available via an HTTP GET request). :param destfile: The pathname where the downloaded file is to be saved. :param digest: If specified, this must be a (hasher, value) tuple, where hasher is the algorithm used (e.g. ``'md5'``) and ``value`` is the expected value. :param reporthook: The same as for :func:`urlretrieve` in the standard library. sNo digest specifiedRsDigest specified: %stwbi iiscontent-lengthsContent-LengthiNs1retrieval incomplete: got only %d out of %d bytess.%s digest mismatch for %s: expected %s, got %ssDigest verified: %s(RRQRRt isinstancetlistttupletgetattrRRRGRtinfotintRLRtlenRnRRSRR(R"Rtdestfiletdigestt reporthooktdigesterthashertdfptsfptheaderst blocksizetsizeRtblocknumtblocktactual((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyt download_filevsV        cCsWg}|jr"|j|jn|jr>|j|jnt|}|j|S(s Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse). (RRPRRR(R"treqthandlerstopener((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyRGs   cCs<g}|j}xy|D]q\}}t|ttfsC|g}nxA|D]9}|jd|d|jdd|jdfqJWqWxG|D]?\}} } |jd|d|| fjdd| fqW|jd|ddfdj|} d|} i| d6tt| d 6} t |j | | S( s& Encode fields and files for posting to an HTTP server. :param fields: The fields to send as a list of (fieldname, value) tuples. :param files: The files to send as a list of (fieldname, filename, file_bytes) tuple. s--s)Content-Disposition: form-data; name="%s"sutf-8ts8Content-Disposition: form-data; name="%s"; filename="%s"s smultipart/form-data; boundary=s Content-typesContent-length( tboundaryRRRR[RwR^tstrRRR(R"RRtpartsRtktvaluestvtkeyR`tvaluetbodytctR((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyREs4      cCsbt|tri|d6}n|jdkrIt|jdd|_n|jj||p^dS(NRTttimeoutg@tand(RRRRR Rtsearch(R"ttermstoperator((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyRs N(t__name__t __module__t__doc__RRR,R2RR=R;RKRWRgRvRyRRRRRRGRER(((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyR s*      # 8   M  +(RtloggingRRRR\t threadingRt ImportErrortdummy_threadingRRtcompatRRRRRRtutilRR R t getLoggerRRQRt DEFAULT_REALMtobjectR (((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyts       .site-packages/pip/_vendor/distlib/index.pyo000064400000047134147204247350015023 0ustar00 abc@sddlZddlZddlZddlZddlZddlZyddlmZWn!ek rddl mZnXddl m Z ddl m Z mZmZmZmZmZddlmZmZmZejeZdZdZd efd YZdS( iN(tThreadi(tDistlibException(tHTTPBasicAuthHandlertRequesttHTTPPasswordMgrturlparset build_openert string_types(tcached_propertytzip_dirt ServerProxyshttps://pypi.python.org/pypitpypit PackageIndexcBseZdZdZddZdZdZdZdZ dZ dZ dd Z dd Z dd Zddd d ddZdZddZddZdddZdZdZddZRS(sc This class represents a package index compatible with PyPI, the Python Package Index. s.----------ThIs_Is_tHe_distlib_index_bouNdaRY_$c Cs|p t|_|jt|j\}}}}}}|sX|sX|sX|d krntd|jnd |_d |_d |_d |_ d |_ t t j dj}x`d D]X} y>tj| dgd|d |} | d kr| |_PnWqtk rqXqWWd QXd S(s Initialise an instance. :param url: The URL of the index. If not specified, the URL for PyPI is used. thttpthttpssinvalid repository: %stwtgpgtgpg2s --versiontstdouttstderriN(R R(RR(t DEFAULT_INDEXturltread_configurationRRtNonetpassword_handlert ssl_verifierRtgpg_homet rpc_proxytopentostdevnullt subprocesst check_calltOSError( tselfRtschemetnetloctpathtparamstquerytfragtsinktstrc((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyt__init__$s( !          cCs3ddlm}ddlm}|}||S(ss Get the distutils command for interacting with PyPI configurations. :return: the command. i(t Distribution(t PyPIRCCommand(tdistutils.coreR-tdistutils.configR.(R"R-R.td((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyt_get_pypirc_commandBs cCsy|j}|j|_|j}|jd|_|jd|_|jdd|_|jd|j|_dS(s Read the PyPI access configuration as supported by distutils, getting PyPI to do the actual work. This populates ``username``, ``password``, ``realm`` and ``url`` attributes from the configuration. tusernametpasswordtrealmR t repositoryN(R2RR6t _read_pypirctgetR3R4R5(R"tctcfg((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyRLs   cCs0|j|j}|j|j|jdS(s Save the PyPI access configuration. You must have set ``username`` and ``password`` attributes before calling this method. Again, distutils is used to do the actual work. N(tcheck_credentialsR2t _store_pypircR3R4(R"R9((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pytsave_configuration[s  cCs|jdks|jdkr-tdnt}t|j\}}}}}}|j|j||j|jt ||_ dS(sp Check that ``username`` and ``password`` have been set, and raise an exception if not. s!username and password must be setN( R3RR4RRRRt add_passwordR5RR(R"tpmt_R$((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyR;gs  !cCs|j|j|j}d|d<|j|jg}|j|}d|d<|j|jg}|j|S(sq Register a distribution on PyPI, using the provided metadata. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the distribution to be registered. :return: The HTTP response received from PyPI upon submission of the request. tverifys:actiontsubmit(R;tvalidatettodicttencode_requesttitemst send_request(R"tmetadataR1trequesttresponse((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pytregisterss     cCsjxYtr[|j}|sPn|jdj}|j|tjd||fqW|jdS(sr Thread runner for reading lines of from a subprocess into a buffer. :param name: The logical name of the stream (used for logging only). :param stream: The stream to read from. This will typically a pipe connected to the output stream of a subprocess. :param outbuf: The list to append the read lines to. sutf-8s%s: %sN(tTruetreadlinetdecodetrstriptappendtloggertdebugtclose(R"tnametstreamtoutbufR*((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyt_readers   cCs|jdddg}|dkr-|j}n|rI|jd|gn|dk rn|jdddgntj}tjj|tjj |d}|jd d d |d ||gt j d dj|||fS(s Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The signing command as a list suitable to be passed to :class:`subprocess.Popen`. s --status-fdt2s--no-ttys --homedirs--batchs--passphrase-fdt0s.ascs --detach-signs--armors --local-users--outputs invoking: %st N( RRRtextendttempfiletmkdtempRR%tjointbasenameRQRR(R"tfilenametsignert sign_passwordtkeystoretcmdttdtsf((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pytget_sign_commands    %c Cs itjd6tjd6}|dk r6tj|d        c Cs|jtjj|s/td|ntjj|d}tjj|sitd|n|j|j|j }}t |j }d d|fd|fg}d||fg}|j ||} |j | S( s2 Upload documentation to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the documentation to be uploaded. :param doc_dir: The pathname of the directory which contains the documentation. This should be the directory that contains the ``index.html`` for the documentation. :return: The HTTP response received from PyPI upon submission of the request. snot a directory: %rs index.htmls not found: %rs:actiont doc_uploadRTtversionR(s:actionR(R;RR%tisdirRR^RRCRTRR tgetvalueRERG( R"RHtdoc_dirtfnRTRtzip_datatfieldsRRI((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pytupload_documentation)s  cCs||jdddg}|dkr-|j}n|rI|jd|gn|jd||gtjddj||S( s| Return a suitable command for verifying a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The verifying command as a list suitable to be passed to :class:`subprocess.Popen`. s --status-fdRXs--no-ttys --homedirs--verifys invoking: %sRZN(RRRR[RQRRR^(R"tsignature_filenamet data_filenameRcRd((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pytget_verify_commandEs  cCsn|jstdn|j|||}|j|\}}}|dkrdtd|n|dkS(s6 Verify a signature for a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: True if the signature was verified, else False. s0verification unavailable because gpg unavailableiis(verify command failed with error code %s(ii(RRRRv(R"RRRcRdR+RR((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pytverify_signature]s     cCs |d kr"d }tjdnMt|ttfrF|\}}nd}tt|}tjd|t|d}|j t |}z|j } d} d} d} d} d| krt | d } n|r|| | | nxyt rp|j| }|sPn| t|7} |j||rJ|j|n| d 7} |r|| | | qqWWd |jXWd QX| dkr| | krtd | | fn|r|j}||krtd ||||fntjd|nd S(s This is a convenience method for downloading a file from an URL. Normally, this will be a file from the index, though currently no check is made for this (i.e. a file can be downloaded from anywhere). The method is just like the :func:`urlretrieve` function in the standard library, except that it allows digest computation to be done during download and checking that the downloaded data matched any expected value. :param url: The URL of the file to be downloaded (assumed to be available via an HTTP GET request). :param destfile: The pathname where the downloaded file is to be saved. :param digest: If specified, this must be a (hasher, value) tuple, where hasher is the algorithm used (e.g. ``'md5'``) and ``value`` is the expected value. :param reporthook: The same as for :func:`urlretrieve` in the standard library. sNo digest specifiedRsDigest specified: %stwbi iiscontent-lengthsContent-LengthiNs1retrieval incomplete: got only %d out of %d bytess.%s digest mismatch for %s: expected %s, got %ssDigest verified: %s(RRQRRt isinstancetlistttupletgetattrRRRGRtinfotintRLRtlenRnRRSRR(R"Rtdestfiletdigestt reporthooktdigesterthashertdfptsfptheaderst blocksizetsizeRtblocknumtblocktactual((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyt download_filevsV        cCsWg}|jr"|j|jn|jr>|j|jnt|}|j|S(s Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse). (RRPRRR(R"treqthandlerstopener((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyRGs   cCs<g}|j}xy|D]q\}}t|ttfsC|g}nxA|D]9}|jd|d|jdd|jdfqJWqWxG|D]?\}} } |jd|d|| fjdd| fqW|jd|ddfdj|} d|} i| d6tt| d 6} t |j | | S( s& Encode fields and files for posting to an HTTP server. :param fields: The fields to send as a list of (fieldname, value) tuples. :param files: The files to send as a list of (fieldname, filename, file_bytes) tuple. s--s)Content-Disposition: form-data; name="%s"sutf-8ts8Content-Disposition: form-data; name="%s"; filename="%s"s smultipart/form-data; boundary=s Content-typesContent-length( tboundaryRRRR[RwR^tstrRRR(R"RRtpartsRtktvaluestvtkeyR`tvaluetbodytctR((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyREs4      cCsbt|tri|d6}n|jdkrIt|jdd|_n|jj||p^dS(NRTttimeoutg@tand(RRRRR Rtsearch(R"ttermstoperator((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyRs N(t__name__t __module__t__doc__RRR,R2RR=R;RKRWRgRvRyRRRRRRGRER(((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyR s*      # 8   M  +(RtloggingRRRR\t threadingRt ImportErrortdummy_threadingRRtcompatRRRRRRtutilRR R t getLoggerRRQRt DEFAULT_REALMtobjectR (((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/index.pyts       .site-packages/pip/_vendor/distlib/locators.py000064400000143505147204247350015362 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012-2015 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import gzip from io import BytesIO import json import logging import os import posixpath import re try: import threading except ImportError: # pragma: no cover import dummy_threading as threading import zlib from . import DistlibException from .compat import (urljoin, urlparse, urlunparse, url2pathname, pathname2url, queue, quote, unescape, string_types, build_opener, HTTPRedirectHandler as BaseRedirectHandler, text_type, Request, HTTPError, URLError) from .database import Distribution, DistributionPath, make_dist from .metadata import Metadata from .util import (cached_property, parse_credentials, ensure_slash, split_filename, get_project_data, parse_requirement, parse_name_and_version, ServerProxy, normalize_name) from .version import get_scheme, UnsupportedVersionError from .wheel import Wheel, is_compatible logger = logging.getLogger(__name__) HASHER_HASH = re.compile('^(\w+)=([a-f0-9]+)') CHARSET = re.compile(r';\s*charset\s*=\s*(.*)\s*$', re.I) HTML_CONTENT_TYPE = re.compile('text/html|application/x(ht)?ml') DEFAULT_INDEX = 'https://pypi.python.org/pypi' def get_all_distribution_names(url=None): """ Return all distribution names known by an index. :param url: The URL of the index. :return: A list of all known distribution names. """ if url is None: url = DEFAULT_INDEX client = ServerProxy(url, timeout=3.0) return client.list_packages() class RedirectHandler(BaseRedirectHandler): """ A class to work around a bug in some Python 3.2.x releases. """ # There's a bug in the base version for some 3.2.x # (e.g. 3.2.2 on Ubuntu Oneiric). If a Location header # returns e.g. /abc, it bails because it says the scheme '' # is bogus, when actually it should use the request's # URL for the scheme. See Python issue #13696. def http_error_302(self, req, fp, code, msg, headers): # Some servers (incorrectly) return multiple Location headers # (so probably same goes for URI). Use first header. newurl = None for key in ('location', 'uri'): if key in headers: newurl = headers[key] break if newurl is None: return urlparts = urlparse(newurl) if urlparts.scheme == '': newurl = urljoin(req.get_full_url(), newurl) if hasattr(headers, 'replace_header'): headers.replace_header(key, newurl) else: headers[key] = newurl return BaseRedirectHandler.http_error_302(self, req, fp, code, msg, headers) http_error_301 = http_error_303 = http_error_307 = http_error_302 class Locator(object): """ A base class for locators - things that locate distributions. """ source_extensions = ('.tar.gz', '.tar.bz2', '.tar', '.zip', '.tgz', '.tbz') binary_extensions = ('.egg', '.exe', '.whl') excluded_extensions = ('.pdf',) # A list of tags indicating which wheels you want to match. The default # value of None matches against the tags compatible with the running # Python. If you want to match other values, set wheel_tags on a locator # instance to a list of tuples (pyver, abi, arch) which you want to match. wheel_tags = None downloadable_extensions = source_extensions + ('.whl',) def __init__(self, scheme='default'): """ Initialise an instance. :param scheme: Because locators look for most recent versions, they need to know the version scheme to use. This specifies the current PEP-recommended scheme - use ``'legacy'`` if you need to support existing distributions on PyPI. """ self._cache = {} self.scheme = scheme # Because of bugs in some of the handlers on some of the platforms, # we use our own opener rather than just using urlopen. self.opener = build_opener(RedirectHandler()) # If get_project() is called from locate(), the matcher instance # is set from the requirement passed to locate(). See issue #18 for # why this can be useful to know. self.matcher = None self.errors = queue.Queue() def get_errors(self): """ Return any errors which have occurred. """ result = [] while not self.errors.empty(): # pragma: no cover try: e = self.errors.get(False) result.append(e) except self.errors.Empty: continue self.errors.task_done() return result def clear_errors(self): """ Clear any errors which may have been logged. """ # Just get the errors and throw them away self.get_errors() def clear_cache(self): self._cache.clear() def _get_scheme(self): return self._scheme def _set_scheme(self, value): self._scheme = value scheme = property(_get_scheme, _set_scheme) def _get_project(self, name): """ For a given project, get a dictionary mapping available versions to Distribution instances. This should be implemented in subclasses. If called from a locate() request, self.matcher will be set to a matcher for the requirement to satisfy, otherwise it will be None. """ raise NotImplementedError('Please implement in the subclass') def get_distribution_names(self): """ Return all the distribution names known to this locator. """ raise NotImplementedError('Please implement in the subclass') def get_project(self, name): """ For a given project, get a dictionary mapping available versions to Distribution instances. This calls _get_project to do all the work, and just implements a caching layer on top. """ if self._cache is None: result = self._get_project(name) elif name in self._cache: result = self._cache[name] else: self.clear_errors() result = self._get_project(name) self._cache[name] = result return result def score_url(self, url): """ Give an url a score which can be used to choose preferred URLs for a given project release. """ t = urlparse(url) basename = posixpath.basename(t.path) compatible = True is_wheel = basename.endswith('.whl') if is_wheel: compatible = is_compatible(Wheel(basename), self.wheel_tags) return (t.scheme != 'https', 'pypi.python.org' in t.netloc, is_wheel, compatible, basename) def prefer_url(self, url1, url2): """ Choose one of two URLs where both are candidates for distribution archives for the same version of a distribution (for example, .tar.gz vs. zip). The current implementation favours https:// URLs over http://, archives from PyPI over those from other locations, wheel compatibility (if a wheel) and then the archive name. """ result = url2 if url1: s1 = self.score_url(url1) s2 = self.score_url(url2) if s1 > s2: result = url1 if result != url2: logger.debug('Not replacing %r with %r', url1, url2) else: logger.debug('Replacing %r with %r', url1, url2) return result def split_filename(self, filename, project_name): """ Attempt to split a filename in project name, version and Python version. """ return split_filename(filename, project_name) def convert_url_to_download_info(self, url, project_name): """ See if a URL is a candidate for a download URL for a project (the URL has typically been scraped from an HTML page). If it is, a dictionary is returned with keys "name", "version", "filename" and "url"; otherwise, None is returned. """ def same_project(name1, name2): return normalize_name(name1) == normalize_name(name2) result = None scheme, netloc, path, params, query, frag = urlparse(url) if frag.lower().startswith('egg='): logger.debug('%s: version hint in fragment: %r', project_name, frag) m = HASHER_HASH.match(frag) if m: algo, digest = m.groups() else: algo, digest = None, None origpath = path if path and path[-1] == '/': path = path[:-1] if path.endswith('.whl'): try: wheel = Wheel(path) if is_compatible(wheel, self.wheel_tags): if project_name is None: include = True else: include = same_project(wheel.name, project_name) if include: result = { 'name': wheel.name, 'version': wheel.version, 'filename': wheel.filename, 'url': urlunparse((scheme, netloc, origpath, params, query, '')), 'python-version': ', '.join( ['.'.join(list(v[2:])) for v in wheel.pyver]), } except Exception as e: # pragma: no cover logger.warning('invalid path for wheel: %s', path) elif path.endswith(self.downloadable_extensions): path = filename = posixpath.basename(path) for ext in self.downloadable_extensions: if path.endswith(ext): path = path[:-len(ext)] t = self.split_filename(path, project_name) if not t: logger.debug('No match for project/version: %s', path) else: name, version, pyver = t if not project_name or same_project(project_name, name): result = { 'name': name, 'version': version, 'filename': filename, 'url': urlunparse((scheme, netloc, origpath, params, query, '')), #'packagetype': 'sdist', } if pyver: result['python-version'] = pyver break if result and algo: result['%s_digest' % algo] = digest return result def _get_digest(self, info): """ Get a digest from a dictionary by looking at keys of the form 'algo_digest'. Returns a 2-tuple (algo, digest) if found, else None. Currently looks only for SHA256, then MD5. """ result = None for algo in ('sha256', 'md5'): key = '%s_digest' % algo if key in info: result = (algo, info[key]) break return result def _update_version_data(self, result, info): """ Update a result dictionary (the final result from _get_project) with a dictionary for a specific version, which typically holds information gleaned from a filename or URL for an archive for the distribution. """ name = info.pop('name') version = info.pop('version') if version in result: dist = result[version] md = dist.metadata else: dist = make_dist(name, version, scheme=self.scheme) md = dist.metadata dist.digest = digest = self._get_digest(info) url = info['url'] result['digests'][url] = digest if md.source_url != info['url']: md.source_url = self.prefer_url(md.source_url, url) result['urls'].setdefault(version, set()).add(url) dist.locator = self result[version] = dist def locate(self, requirement, prereleases=False): """ Find the most recent distribution which matches the given requirement. :param requirement: A requirement of the form 'foo (1.0)' or perhaps 'foo (>= 1.0, < 2.0, != 1.3)' :param prereleases: If ``True``, allow pre-release versions to be located. Otherwise, pre-release versions are not returned. :return: A :class:`Distribution` instance, or ``None`` if no such distribution could be located. """ result = None r = parse_requirement(requirement) if r is None: raise DistlibException('Not a valid requirement: %r' % requirement) scheme = get_scheme(self.scheme) self.matcher = matcher = scheme.matcher(r.requirement) logger.debug('matcher: %s (%s)', matcher, type(matcher).__name__) versions = self.get_project(r.name) if len(versions) > 2: # urls and digests keys are present # sometimes, versions are invalid slist = [] vcls = matcher.version_class for k in versions: if k in ('urls', 'digests'): continue try: if not matcher.match(k): logger.debug('%s did not match %r', matcher, k) else: if prereleases or not vcls(k).is_prerelease: slist.append(k) else: logger.debug('skipping pre-release ' 'version %s of %s', k, matcher.name) except Exception: # pragma: no cover logger.warning('error matching %s with %r', matcher, k) pass # slist.append(k) if len(slist) > 1: slist = sorted(slist, key=scheme.key) if slist: logger.debug('sorted list: %s', slist) version = slist[-1] result = versions[version] if result: if r.extras: result.extras = r.extras result.download_urls = versions.get('urls', {}).get(version, set()) d = {} sd = versions.get('digests', {}) for url in result.download_urls: if url in sd: d[url] = sd[url] result.digests = d self.matcher = None return result class PyPIRPCLocator(Locator): """ This locator uses XML-RPC to locate distributions. It therefore cannot be used with simple mirrors (that only mirror file content). """ def __init__(self, url, **kwargs): """ Initialise an instance. :param url: The URL to use for XML-RPC. :param kwargs: Passed to the superclass constructor. """ super(PyPIRPCLocator, self).__init__(**kwargs) self.base_url = url self.client = ServerProxy(url, timeout=3.0) def get_distribution_names(self): """ Return all the distribution names known to this locator. """ return set(self.client.list_packages()) def _get_project(self, name): result = {'urls': {}, 'digests': {}} versions = self.client.package_releases(name, True) for v in versions: urls = self.client.release_urls(name, v) data = self.client.release_data(name, v) metadata = Metadata(scheme=self.scheme) metadata.name = data['name'] metadata.version = data['version'] metadata.license = data.get('license') metadata.keywords = data.get('keywords', []) metadata.summary = data.get('summary') dist = Distribution(metadata) if urls: info = urls[0] metadata.source_url = info['url'] dist.digest = self._get_digest(info) dist.locator = self result[v] = dist for info in urls: url = info['url'] digest = self._get_digest(info) result['urls'].setdefault(v, set()).add(url) result['digests'][url] = digest return result class PyPIJSONLocator(Locator): """ This locator uses PyPI's JSON interface. It's very limited in functionality and probably not worth using. """ def __init__(self, url, **kwargs): super(PyPIJSONLocator, self).__init__(**kwargs) self.base_url = ensure_slash(url) def get_distribution_names(self): """ Return all the distribution names known to this locator. """ raise NotImplementedError('Not available from this locator') def _get_project(self, name): result = {'urls': {}, 'digests': {}} url = urljoin(self.base_url, '%s/json' % quote(name)) try: resp = self.opener.open(url) data = resp.read().decode() # for now d = json.loads(data) md = Metadata(scheme=self.scheme) data = d['info'] md.name = data['name'] md.version = data['version'] md.license = data.get('license') md.keywords = data.get('keywords', []) md.summary = data.get('summary') dist = Distribution(md) dist.locator = self urls = d['urls'] result[md.version] = dist for info in d['urls']: url = info['url'] dist.download_urls.add(url) dist.digests[url] = self._get_digest(info) result['urls'].setdefault(md.version, set()).add(url) result['digests'][url] = self._get_digest(info) # Now get other releases for version, infos in d['releases'].items(): if version == md.version: continue # already done omd = Metadata(scheme=self.scheme) omd.name = md.name omd.version = version odist = Distribution(omd) odist.locator = self result[version] = odist for info in infos: url = info['url'] odist.download_urls.add(url) odist.digests[url] = self._get_digest(info) result['urls'].setdefault(version, set()).add(url) result['digests'][url] = self._get_digest(info) # for info in urls: # md.source_url = info['url'] # dist.digest = self._get_digest(info) # dist.locator = self # for info in urls: # url = info['url'] # result['urls'].setdefault(md.version, set()).add(url) # result['digests'][url] = self._get_digest(info) except Exception as e: self.errors.put(text_type(e)) logger.exception('JSON fetch failed: %s', e) return result class Page(object): """ This class represents a scraped HTML page. """ # The following slightly hairy-looking regex just looks for the contents of # an anchor link, which has an attribute "href" either immediately preceded # or immediately followed by a "rel" attribute. The attribute values can be # declared with double quotes, single quotes or no quotes - which leads to # the length of the expression. _href = re.compile(""" (rel\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s\n]*))\s+)? href\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s\n]*)) (\s+rel\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s\n]*)))? """, re.I | re.S | re.X) _base = re.compile(r"""]+)""", re.I | re.S) def __init__(self, data, url): """ Initialise an instance with the Unicode page contents and the URL they came from. """ self.data = data self.base_url = self.url = url m = self._base.search(self.data) if m: self.base_url = m.group(1) _clean_re = re.compile(r'[^a-z0-9$&+,/:;=?@.#%_\\|-]', re.I) @cached_property def links(self): """ Return the URLs of all the links on a page together with information about their "rel" attribute, for determining which ones to treat as downloads and which ones to queue for further scraping. """ def clean(url): "Tidy up an URL." scheme, netloc, path, params, query, frag = urlparse(url) return urlunparse((scheme, netloc, quote(path), params, query, frag)) result = set() for match in self._href.finditer(self.data): d = match.groupdict('') rel = (d['rel1'] or d['rel2'] or d['rel3'] or d['rel4'] or d['rel5'] or d['rel6']) url = d['url1'] or d['url2'] or d['url3'] url = urljoin(self.base_url, url) url = unescape(url) url = self._clean_re.sub(lambda m: '%%%2x' % ord(m.group(0)), url) result.add((url, rel)) # We sort the result, hoping to bring the most recent versions # to the front result = sorted(result, key=lambda t: t[0], reverse=True) return result class SimpleScrapingLocator(Locator): """ A locator which scrapes HTML pages to locate downloads for a distribution. This runs multiple threads to do the I/O; performance is at least as good as pip's PackageFinder, which works in an analogous fashion. """ # These are used to deal with various Content-Encoding schemes. decoders = { 'deflate': zlib.decompress, 'gzip': lambda b: gzip.GzipFile(fileobj=BytesIO(d)).read(), 'none': lambda b: b, } def __init__(self, url, timeout=None, num_workers=10, **kwargs): """ Initialise an instance. :param url: The root URL to use for scraping. :param timeout: The timeout, in seconds, to be applied to requests. This defaults to ``None`` (no timeout specified). :param num_workers: The number of worker threads you want to do I/O, This defaults to 10. :param kwargs: Passed to the superclass. """ super(SimpleScrapingLocator, self).__init__(**kwargs) self.base_url = ensure_slash(url) self.timeout = timeout self._page_cache = {} self._seen = set() self._to_fetch = queue.Queue() self._bad_hosts = set() self.skip_externals = False self.num_workers = num_workers self._lock = threading.RLock() # See issue #45: we need to be resilient when the locator is used # in a thread, e.g. with concurrent.futures. We can't use self._lock # as it is for coordinating our internal threads - the ones created # in _prepare_threads. self._gplock = threading.RLock() def _prepare_threads(self): """ Threads are created only when get_project is called, and terminate before it returns. They are there primarily to parallelise I/O (i.e. fetching web pages). """ self._threads = [] for i in range(self.num_workers): t = threading.Thread(target=self._fetch) t.setDaemon(True) t.start() self._threads.append(t) def _wait_threads(self): """ Tell all the threads to terminate (by sending a sentinel value) and wait for them to do so. """ # Note that you need two loops, since you can't say which # thread will get each sentinel for t in self._threads: self._to_fetch.put(None) # sentinel for t in self._threads: t.join() self._threads = [] def _get_project(self, name): result = {'urls': {}, 'digests': {}} with self._gplock: self.result = result self.project_name = name url = urljoin(self.base_url, '%s/' % quote(name)) self._seen.clear() self._page_cache.clear() self._prepare_threads() try: logger.debug('Queueing %s', url) self._to_fetch.put(url) self._to_fetch.join() finally: self._wait_threads() del self.result return result platform_dependent = re.compile(r'\b(linux-(i\d86|x86_64|arm\w+)|' r'win(32|-amd64)|macosx-?\d+)\b', re.I) def _is_platform_dependent(self, url): """ Does an URL refer to a platform-specific download? """ return self.platform_dependent.search(url) def _process_download(self, url): """ See if an URL is a suitable download for a project. If it is, register information in the result dictionary (for _get_project) about the specific version it's for. Note that the return value isn't actually used other than as a boolean value. """ if self._is_platform_dependent(url): info = None else: info = self.convert_url_to_download_info(url, self.project_name) logger.debug('process_download: %s -> %s', url, info) if info: with self._lock: # needed because self.result is shared self._update_version_data(self.result, info) return info def _should_queue(self, link, referrer, rel): """ Determine whether a link URL from a referring page and with a particular "rel" attribute should be queued for scraping. """ scheme, netloc, path, _, _, _ = urlparse(link) if path.endswith(self.source_extensions + self.binary_extensions + self.excluded_extensions): result = False elif self.skip_externals and not link.startswith(self.base_url): result = False elif not referrer.startswith(self.base_url): result = False elif rel not in ('homepage', 'download'): result = False elif scheme not in ('http', 'https', 'ftp'): result = False elif self._is_platform_dependent(link): result = False else: host = netloc.split(':', 1)[0] if host.lower() == 'localhost': result = False else: result = True logger.debug('should_queue: %s (%s) from %s -> %s', link, rel, referrer, result) return result def _fetch(self): """ Get a URL to fetch from the work queue, get the HTML page, examine its links for download candidates and candidates for further scraping. This is a handy method to run in a thread. """ while True: url = self._to_fetch.get() try: if url: page = self.get_page(url) if page is None: # e.g. after an error continue for link, rel in page.links: if link not in self._seen: self._seen.add(link) if (not self._process_download(link) and self._should_queue(link, url, rel)): logger.debug('Queueing %s from %s', link, url) self._to_fetch.put(link) except Exception as e: # pragma: no cover self.errors.put(text_type(e)) finally: # always do this, to avoid hangs :-) self._to_fetch.task_done() if not url: #logger.debug('Sentinel seen, quitting.') break def get_page(self, url): """ Get the HTML for an URL, possibly from an in-memory cache. XXX TODO Note: this cache is never actually cleared. It's assumed that the data won't get stale over the lifetime of a locator instance (not necessarily true for the default_locator). """ # http://peak.telecommunity.com/DevCenter/EasyInstall#package-index-api scheme, netloc, path, _, _, _ = urlparse(url) if scheme == 'file' and os.path.isdir(url2pathname(path)): url = urljoin(ensure_slash(url), 'index.html') if url in self._page_cache: result = self._page_cache[url] logger.debug('Returning %s from cache: %s', url, result) else: host = netloc.split(':', 1)[0] result = None if host in self._bad_hosts: logger.debug('Skipping %s due to bad host %s', url, host) else: req = Request(url, headers={'Accept-encoding': 'identity'}) try: logger.debug('Fetching %s', url) resp = self.opener.open(req, timeout=self.timeout) logger.debug('Fetched %s', url) headers = resp.info() content_type = headers.get('Content-Type', '') if HTML_CONTENT_TYPE.match(content_type): final_url = resp.geturl() data = resp.read() encoding = headers.get('Content-Encoding') if encoding: decoder = self.decoders[encoding] # fail if not found data = decoder(data) encoding = 'utf-8' m = CHARSET.search(content_type) if m: encoding = m.group(1) try: data = data.decode(encoding) except UnicodeError: # pragma: no cover data = data.decode('latin-1') # fallback result = Page(data, final_url) self._page_cache[final_url] = result except HTTPError as e: if e.code != 404: logger.exception('Fetch failed: %s: %s', url, e) except URLError as e: # pragma: no cover logger.exception('Fetch failed: %s: %s', url, e) with self._lock: self._bad_hosts.add(host) except Exception as e: # pragma: no cover logger.exception('Fetch failed: %s: %s', url, e) finally: self._page_cache[url] = result # even if None (failure) return result _distname_re = re.compile(']*>([^<]+)<') def get_distribution_names(self): """ Return all the distribution names known to this locator. """ result = set() page = self.get_page(self.base_url) if not page: raise DistlibException('Unable to get %s' % self.base_url) for match in self._distname_re.finditer(page.data): result.add(match.group(1)) return result class DirectoryLocator(Locator): """ This class locates distributions in a directory tree. """ def __init__(self, path, **kwargs): """ Initialise an instance. :param path: The root of the directory tree to search. :param kwargs: Passed to the superclass constructor, except for: * recursive - if True (the default), subdirectories are recursed into. If False, only the top-level directory is searched, """ self.recursive = kwargs.pop('recursive', True) super(DirectoryLocator, self).__init__(**kwargs) path = os.path.abspath(path) if not os.path.isdir(path): # pragma: no cover raise DistlibException('Not a directory: %r' % path) self.base_dir = path def should_include(self, filename, parent): """ Should a filename be considered as a candidate for a distribution archive? As well as the filename, the directory which contains it is provided, though not used by the current implementation. """ return filename.endswith(self.downloadable_extensions) def _get_project(self, name): result = {'urls': {}, 'digests': {}} for root, dirs, files in os.walk(self.base_dir): for fn in files: if self.should_include(fn, root): fn = os.path.join(root, fn) url = urlunparse(('file', '', pathname2url(os.path.abspath(fn)), '', '', '')) info = self.convert_url_to_download_info(url, name) if info: self._update_version_data(result, info) if not self.recursive: break return result def get_distribution_names(self): """ Return all the distribution names known to this locator. """ result = set() for root, dirs, files in os.walk(self.base_dir): for fn in files: if self.should_include(fn, root): fn = os.path.join(root, fn) url = urlunparse(('file', '', pathname2url(os.path.abspath(fn)), '', '', '')) info = self.convert_url_to_download_info(url, None) if info: result.add(info['name']) if not self.recursive: break return result class JSONLocator(Locator): """ This locator uses special extended metadata (not available on PyPI) and is the basis of performant dependency resolution in distlib. Other locators require archive downloads before dependencies can be determined! As you might imagine, that can be slow. """ def get_distribution_names(self): """ Return all the distribution names known to this locator. """ raise NotImplementedError('Not available from this locator') def _get_project(self, name): result = {'urls': {}, 'digests': {}} data = get_project_data(name) if data: for info in data.get('files', []): if info['ptype'] != 'sdist' or info['pyversion'] != 'source': continue # We don't store summary in project metadata as it makes # the data bigger for no benefit during dependency # resolution dist = make_dist(data['name'], info['version'], summary=data.get('summary', 'Placeholder for summary'), scheme=self.scheme) md = dist.metadata md.source_url = info['url'] # TODO SHA256 digest if 'digest' in info and info['digest']: dist.digest = ('md5', info['digest']) md.dependencies = info.get('requirements', {}) dist.exports = info.get('exports', {}) result[dist.version] = dist result['urls'].setdefault(dist.version, set()).add(info['url']) return result class DistPathLocator(Locator): """ This locator finds installed distributions in a path. It can be useful for adding to an :class:`AggregatingLocator`. """ def __init__(self, distpath, **kwargs): """ Initialise an instance. :param distpath: A :class:`DistributionPath` instance to search. """ super(DistPathLocator, self).__init__(**kwargs) assert isinstance(distpath, DistributionPath) self.distpath = distpath def _get_project(self, name): dist = self.distpath.get_distribution(name) if dist is None: result = {'urls': {}, 'digests': {}} else: result = { dist.version: dist, 'urls': {dist.version: set([dist.source_url])}, 'digests': {dist.version: set([None])} } return result class AggregatingLocator(Locator): """ This class allows you to chain and/or merge a list of locators. """ def __init__(self, *locators, **kwargs): """ Initialise an instance. :param locators: The list of locators to search. :param kwargs: Passed to the superclass constructor, except for: * merge - if False (the default), the first successful search from any of the locators is returned. If True, the results from all locators are merged (this can be slow). """ self.merge = kwargs.pop('merge', False) self.locators = locators super(AggregatingLocator, self).__init__(**kwargs) def clear_cache(self): super(AggregatingLocator, self).clear_cache() for locator in self.locators: locator.clear_cache() def _set_scheme(self, value): self._scheme = value for locator in self.locators: locator.scheme = value scheme = property(Locator.scheme.fget, _set_scheme) def _get_project(self, name): result = {} for locator in self.locators: d = locator.get_project(name) if d: if self.merge: files = result.get('urls', {}) digests = result.get('digests', {}) # next line could overwrite result['urls'], result['digests'] result.update(d) df = result.get('urls') if files and df: for k, v in files.items(): if k in df: df[k] |= v else: df[k] = v dd = result.get('digests') if digests and dd: dd.update(digests) else: # See issue #18. If any dists are found and we're looking # for specific constraints, we only return something if # a match is found. For example, if a DirectoryLocator # returns just foo (1.0) while we're looking for # foo (>= 2.0), we'll pretend there was nothing there so # that subsequent locators can be queried. Otherwise we # would just return foo (1.0) which would then lead to a # failure to find foo (>= 2.0), because other locators # weren't searched. Note that this only matters when # merge=False. if self.matcher is None: found = True else: found = False for k in d: if self.matcher.match(k): found = True break if found: result = d break return result def get_distribution_names(self): """ Return all the distribution names known to this locator. """ result = set() for locator in self.locators: try: result |= locator.get_distribution_names() except NotImplementedError: pass return result # We use a legacy scheme simply because most of the dists on PyPI use legacy # versions which don't conform to PEP 426 / PEP 440. default_locator = AggregatingLocator( JSONLocator(), SimpleScrapingLocator('https://pypi.python.org/simple/', timeout=3.0), scheme='legacy') locate = default_locator.locate NAME_VERSION_RE = re.compile(r'(?P[\w-]+)\s*' r'\(\s*(==\s*)?(?P[^)]+)\)$') class DependencyFinder(object): """ Locate dependencies for distributions. """ def __init__(self, locator=None): """ Initialise an instance, using the specified locator to locate distributions. """ self.locator = locator or default_locator self.scheme = get_scheme(self.locator.scheme) def add_distribution(self, dist): """ Add a distribution to the finder. This will update internal information about who provides what. :param dist: The distribution to add. """ logger.debug('adding distribution %s', dist) name = dist.key self.dists_by_name[name] = dist self.dists[(name, dist.version)] = dist for p in dist.provides: name, version = parse_name_and_version(p) logger.debug('Add to provided: %s, %s, %s', name, version, dist) self.provided.setdefault(name, set()).add((version, dist)) def remove_distribution(self, dist): """ Remove a distribution from the finder. This will update internal information about who provides what. :param dist: The distribution to remove. """ logger.debug('removing distribution %s', dist) name = dist.key del self.dists_by_name[name] del self.dists[(name, dist.version)] for p in dist.provides: name, version = parse_name_and_version(p) logger.debug('Remove from provided: %s, %s, %s', name, version, dist) s = self.provided[name] s.remove((version, dist)) if not s: del self.provided[name] def get_matcher(self, reqt): """ Get a version matcher for a requirement. :param reqt: The requirement :type reqt: str :return: A version matcher (an instance of :class:`distlib.version.Matcher`). """ try: matcher = self.scheme.matcher(reqt) except UnsupportedVersionError: # pragma: no cover # XXX compat-mode if cannot read the version name = reqt.split()[0] matcher = self.scheme.matcher(name) return matcher def find_providers(self, reqt): """ Find the distributions which can fulfill a requirement. :param reqt: The requirement. :type reqt: str :return: A set of distribution which can fulfill the requirement. """ matcher = self.get_matcher(reqt) name = matcher.key # case-insensitive result = set() provided = self.provided if name in provided: for version, provider in provided[name]: try: match = matcher.match(version) except UnsupportedVersionError: match = False if match: result.add(provider) break return result def try_to_replace(self, provider, other, problems): """ Attempt to replace one provider with another. This is typically used when resolving dependencies from multiple sources, e.g. A requires (B >= 1.0) while C requires (B >= 1.1). For successful replacement, ``provider`` must meet all the requirements which ``other`` fulfills. :param provider: The provider we are trying to replace with. :param other: The provider we're trying to replace. :param problems: If False is returned, this will contain what problems prevented replacement. This is currently a tuple of the literal string 'cantreplace', ``provider``, ``other`` and the set of requirements that ``provider`` couldn't fulfill. :return: True if we can replace ``other`` with ``provider``, else False. """ rlist = self.reqts[other] unmatched = set() for s in rlist: matcher = self.get_matcher(s) if not matcher.match(provider.version): unmatched.add(s) if unmatched: # can't replace other with provider problems.add(('cantreplace', provider, other, frozenset(unmatched))) result = False else: # can replace other with provider self.remove_distribution(other) del self.reqts[other] for s in rlist: self.reqts.setdefault(provider, set()).add(s) self.add_distribution(provider) result = True return result def find(self, requirement, meta_extras=None, prereleases=False): """ Find a distribution and all distributions it depends on. :param requirement: The requirement specifying the distribution to find, or a Distribution instance. :param meta_extras: A list of meta extras such as :test:, :build: and so on. :param prereleases: If ``True``, allow pre-release versions to be returned - otherwise, don't return prereleases unless they're all that's available. Return a set of :class:`Distribution` instances and a set of problems. The distributions returned should be such that they have the :attr:`required` attribute set to ``True`` if they were from the ``requirement`` passed to ``find()``, and they have the :attr:`build_time_dependency` attribute set to ``True`` unless they are post-installation dependencies of the ``requirement``. The problems should be a tuple consisting of the string ``'unsatisfied'`` and the requirement which couldn't be satisfied by any distribution known to the locator. """ self.provided = {} self.dists = {} self.dists_by_name = {} self.reqts = {} meta_extras = set(meta_extras or []) if ':*:' in meta_extras: meta_extras.remove(':*:') # :meta: and :run: are implicitly included meta_extras |= set([':test:', ':build:', ':dev:']) if isinstance(requirement, Distribution): dist = odist = requirement logger.debug('passed %s as requirement', odist) else: dist = odist = self.locator.locate(requirement, prereleases=prereleases) if dist is None: raise DistlibException('Unable to locate %r' % requirement) logger.debug('located %s', odist) dist.requested = True problems = set() todo = set([dist]) install_dists = set([odist]) while todo: dist = todo.pop() name = dist.key # case-insensitive if name not in self.dists_by_name: self.add_distribution(dist) else: #import pdb; pdb.set_trace() other = self.dists_by_name[name] if other != dist: self.try_to_replace(dist, other, problems) ireqts = dist.run_requires | dist.meta_requires sreqts = dist.build_requires ereqts = set() if dist in install_dists: for key in ('test', 'build', 'dev'): e = ':%s:' % key if e in meta_extras: ereqts |= getattr(dist, '%s_requires' % key) all_reqts = ireqts | sreqts | ereqts for r in all_reqts: providers = self.find_providers(r) if not providers: logger.debug('No providers found for %r', r) provider = self.locator.locate(r, prereleases=prereleases) # If no provider is found and we didn't consider # prereleases, consider them now. if provider is None and not prereleases: provider = self.locator.locate(r, prereleases=True) if provider is None: logger.debug('Cannot satisfy %r', r) problems.add(('unsatisfied', r)) else: n, v = provider.key, provider.version if (n, v) not in self.dists: todo.add(provider) providers.add(provider) if r in ireqts and dist in install_dists: install_dists.add(provider) logger.debug('Adding %s to install_dists', provider.name_and_version) for p in providers: name = p.key if name not in self.dists_by_name: self.reqts.setdefault(p, set()).add(r) else: other = self.dists_by_name[name] if other != p: # see if other can be replaced by p self.try_to_replace(p, other, problems) dists = set(self.dists.values()) for dist in dists: dist.build_time_dependency = dist not in install_dists if dist.build_time_dependency: logger.debug('%s is a build-time dependency only.', dist.name_and_version) logger.debug('find done for %s', odist) return dists, problems site-packages/pip/_vendor/distlib/locators.pyc000064400000131632147204247350015523 0ustar00 abc@s&ddlZddlmZddlZddlZddlZddlZddlZyddlZWne k rddl ZnXddl Z ddl m Z ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZddlm Z m!Z!m"Z"ddl#m$Z$ddl%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.dd l/m0Z0m1Z1dd l2m3Z3m4Z4ej5e6Z7ej8d Z9ej8d ej:Z;ej8d Z<dZ=e>dZ?defdYZ@deAfdYZBdeBfdYZCdeBfdYZDdeAfdYZEdeBfdYZFdeBfdYZGdeBfdYZHd eBfd!YZId"eBfd#YZJeJeHeFd$d%d&d'd(ZKeKjLZLej8d)ZMd*eAfd+YZNdS(,iN(tBytesIOi(tDistlibException(turljointurlparset urlunparset url2pathnamet pathname2urltqueuetquotetunescapet string_typest build_openertHTTPRedirectHandlert text_typetRequestt HTTPErrortURLError(t DistributiontDistributionPatht make_dist(tMetadata( tcached_propertytparse_credentialst ensure_slashtsplit_filenametget_project_datatparse_requirementtparse_name_and_versiont ServerProxytnormalize_name(t get_schemetUnsupportedVersionError(tWheelt is_compatibles^(\w+)=([a-f0-9]+)s;\s*charset\s*=\s*(.*)\s*$stext/html|application/x(ht)?mlshttps://pypi.python.org/pypicCs1|dkrt}nt|dd}|jS(s Return all distribution names known by an index. :param url: The URL of the index. :return: A list of all known distribution names. ttimeoutg@N(tNonet DEFAULT_INDEXRt list_packages(turltclient((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytget_all_distribution_names)s  tRedirectHandlercBs%eZdZdZeZZZRS(sE A class to work around a bug in some Python 3.2.x releases. c Csd}x(dD] }||kr ||}Pq q W|dkrAdSt|}|jdkrt|j|}t|dr|j||q||| Clear any errors which may have been logged. N(RR(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt clear_errorsscCs|jjdS(N(RDtclear(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt clear_cachescCs|jS(N(t_scheme(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt _get_schemescCs ||_dS(N(RV(R3tvalue((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt _set_schemescCstddS(s= For a given project, get a dictionary mapping available versions to Distribution instances. This should be implemented in subclasses. If called from a locate() request, self.matcher will be set to a matcher for the requirement to satisfy, otherwise it will be None. s Please implement in the subclassN(tNotImplementedError(R3tname((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt _get_projects cCstddS(sJ Return all the distribution names known to this locator. s Please implement in the subclassN(RZ(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytget_distribution_namesscCsj|jdkr!|j|}nE||jkr@|j|}n&|j|j|}||j|<|S(s For a given project, get a dictionary mapping available versions to Distribution instances. This calls _get_project to do all the work, and just implements a caching layer on top. N(RDR#R\RS(R3R[RP((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt get_projects  cCsyt|}tj|j}t}|jd}|rTtt||j}n|j dkd|j k|||fS(su Give an url a score which can be used to choose preferred URLs for a given project release. s.whlthttpsspypi.python.org( Rt posixpathtbasenametpathtTruetendswithR!R t wheel_tagsR.tnetloc(R3R&ttRat compatibletis_wheel((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt score_urls cCs{|}|rw|j|}|j|}||kr?|}n||kratjd||qwtjd||n|S(s{ Choose one of two URLs where both are candidates for distribution archives for the same version of a distribution (for example, .tar.gz vs. zip). The current implementation favours https:// URLs over http://, archives from PyPI over those from other locations, wheel compatibility (if a wheel) and then the archive name. sNot replacing %r with %rsReplacing %r with %r(Rjtloggertdebug(R3turl1turl2RPts1ts2((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt prefer_urls    cCs t||S(sZ Attempt to split a filename in project name, version and Python version. (R(R3tfilenamet project_name((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRsc Csd}d}t|\}}}}} } | jjdrXtjd|| ntj| } | r| j\} } n d\} } |}|r|ddkr|d }n|j dryt |}t ||j r|dkrt }n||j|}|ri|jd6|jd6|jd 6t||||| d fd 6d jg|jD]}d jt|d^qdd6}qnWqtk r}tjd|qXn|j |jrtj|}}x|jD]}|j |r|t| }|j||}|s@tjd|nu|\}}}| se|||ri|d6|d6|d 6t||||| d fd 6}|r||d= 1.0, < 2.0, != 1.3)' :param prereleases: If ``True``, allow pre-release versions to be located. Otherwise, pre-release versions are not returned. :return: A :class:`Distribution` instance, or ``None`` if no such distribution could be located. sNot a valid requirement: %rsmatcher: %s (%s)iRRs%s did not match %rs%skipping pre-release version %s of %sserror matching %s with %riR:ssorted list: %siN(RR(R#RRRR.RFt requirementRkRlttypeR<R^R[Rt version_classR}t is_prereleaseRMRRtsortedR:textrasRKRt download_urlsR(R3Rt prereleasesRPtrR.RFtversionstslisttvclstkRxtdtsdR&((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytlocatePsT          $   (s.tar.gzs.tar.bz2s.tars.zips.tgzs.tbz(s.eggs.exes.whl(s.pdfN(s.whl(R<R=R>tsource_extensionstbinary_extensionstexcluded_extensionsR#ReRRIRRRSRURWRYtpropertyR.R\R]R^RjRqRRRRRLR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRBSs.             F  tPyPIRPCLocatorcBs)eZdZdZdZdZRS(s This locator uses XML-RPC to locate distributions. It therefore cannot be used with simple mirrors (that only mirror file content). cKs8tt|j|||_t|dd|_dS(s Initialise an instance. :param url: The URL to use for XML-RPC. :param kwargs: Passed to the superclass constructor. R"g@N(tsuperRRItbase_urlRR'(R3R&tkwargs((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIs cCst|jjS(sJ Return all the distribution names known to this locator. (RR'R%(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR]sc Csviid6id6}|jj|t}xF|D]>}|jj||}|jj||}td|j}|d|_|d|_|j d|_ |j dg|_ |j d|_ t |}|r0|d } | d |_|j| |_||_|||RIR]R\(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRs tPyPIJSONLocatorcBs)eZdZdZdZdZRS(sw This locator uses PyPI's JSON interface. It's very limited in functionality and probably not worth using. cKs)tt|j|t||_dS(N(RRRIRR(R3R&R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIscCstddS(sJ Return all the distribution names known to this locator. sNot available from this locatorN(RZ(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR]scCsiid6id6}t|jdt|}yE|jj|}|jj}tj|}t d|j }|d}|d|_ |d|_ |j d|_|j d g|_|j d |_t|}||_|d} |||j RIR]R\(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRs  tPagecBszeZdZejdejejBejBZejdejejBZ dZ ejdejZ e dZ RS(s4 This class represents a scraped HTML page. s (rel\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s ]*))\s+)? href\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s ]*)) (\s+rel\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s ]*)))? s!]+)cCsM||_||_|_|jj|j}|rI|jd|_ndS(sk Initialise an instance with the Unicode page contents and the URL they came from. iN(RRR&t_basetsearchtgroup(R3RR&R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIs  s[^a-z0-9$&+,/:;=?@.#%_\\|-]cCsd}t}x|jj|jD]}|jd}|dpv|dpv|dpv|dpv|dpv|d}|d p|d p|d }t|j|}t|}|jj d |}|j ||fq(Wt |d ddt }|S(s Return the URLs of all the links on a page together with information about their "rel" attribute, for determining which ones to treat as downloads and which ones to queue for further scraping. cSs@t|\}}}}}}t||t||||fS(sTidy up an URL.(RRR(R&R.RfRbRRR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytclean%sR,trel1trel2trel3trel4trel5trel6RmRnturl3cSsdt|jdS(Ns%%%2xi(tordR(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt3R,R:cSs|dS(Ni((Rg((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR7R,treverse( Rt_hreftfinditerRt groupdictRRR t _clean_retsubRRRc(R3RRPR}RtrelR&((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytlinkss   (R<R=R>tretcompiletItStXRRRIRRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRs tSimpleScrapingLocatorcBseZdZiejd6dd6dd6ZdddZdZd Z d Z e j d e j Zd Zd ZdZdZdZe j dZdZRS(s A locator which scrapes HTML pages to locate downloads for a distribution. This runs multiple threads to do the I/O; performance is at least as good as pip's PackageFinder, which works in an analogous fashion. tdeflatecCstjdttjS(Ntfileobj(tgziptGzipFileRRR(tb((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRER,RcCs|S(N((R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRFR,tnonei cKstt|j|t||_||_i|_t|_t j |_ t|_ t |_||_tj|_tj|_dS(s Initialise an instance. :param url: The root URL to use for scraping. :param timeout: The timeout, in seconds, to be applied to requests. This defaults to ``None`` (no timeout specified). :param num_workers: The number of worker threads you want to do I/O, This defaults to 10. :param kwargs: Passed to the superclass. N(RRRIRRR"t _page_cacheRt_seenRRGt _to_fetcht _bad_hostsRLtskip_externalst num_workerst threadingtRLockt_lockt_gplock(R3R&R"RR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIIs       cCscg|_xSt|jD]B}tjd|j}|jt|j|jj |qWdS(s Threads are created only when get_project is called, and terminate before it returns. They are there primarily to parallelise I/O (i.e. fetching web pages). ttargetN( t_threadstrangeRRtThreadt_fetcht setDaemonRctstartRM(R3tiRg((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt_prepare_threadscs    cCsOx!|jD]}|jjdq Wx|jD]}|jq.Wg|_dS(su Tell all the threads to terminate (by sending a sentinel value) and wait for them to do so. N(RRRR#R(R3Rg((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt _wait_threadsps c Csiid6id6}|j||_||_t|jdt|}|jj|jj|j z1t j d||j j ||j jWd|jX|`WdQX|S(NRRs%s/s Queueing %s(RRPRsRRRRRTRRRkRlRRRR(R3R[RPR&((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\}s        s<\b(linux-(i\d86|x86_64|arm\w+)|win(32|-amd64)|macosx-?\d+)\bcCs|jj|S(sD Does an URL refer to a platform-specific download? (tplatform_dependentR(R3R&((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt_is_platform_dependentscCsp|j|rd}n|j||j}tjd|||rl|j|j|j|WdQXn|S(s% See if an URL is a suitable download for a project. If it is, register information in the result dictionary (for _get_project) about the specific version it's for. Note that the return value isn't actually used other than as a boolean value. sprocess_download: %s -> %sN( RR#RRsRkRlRRRP(R3R&R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt_process_downloads   c Cst|\}}}}}}|j|j|j|jrGt}n|jrl|j|j rlt}n|j|jst}ny|d krt}nd|d krt}nO|j |rt}n7|j ddd} | j d krt}nt }t jd |||||S( s Determine whether a link URL from a referring page and with a particular "rel" attribute should be queued for scraping. thomepagetdownloadthttpR_tftpt:iit localhosts#should_queue: %s (%s) from %s -> %s(RR (R R_R (RRdRRRRLRR{RRtsplitRzRcRkRl( R3tlinktreferrerRR.RfRbt_RPthost((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt _should_queues*           cCs xtr|jj}zy|r|j|}|dkrEwnx|jD]y\}}||jkrO|jj||j| r|j |||rt j d|||jj |qqOqOWnWn)t k r}|jj t|nXWd|jjX|sPqqWdS(s Get a URL to fetch from the work queue, get the HTML page, examine its links for download candidates and candidates for further scraping. This is a handy method to run in a thread. sQueueing %s from %sN(RcRRKtget_pageR#RRRRRRkRlRRRHR RO(R3R&tpageRRRQ((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRs(  !cCst|\}}}}}}|dkrZtjjt|rZtt|d}n||jkr|j|}tj d||nK|j ddd}d}||j krtj d||n t |did d 6}zy7tj d ||jj|d |j} tj d || j} | jdd} tj| r| j} | j} | jd}|r|j|}|| } nd}tj| }|r|jd}ny| j|} Wn tk r| jd} nXt| | }||j| ]*>([^<]+)tzlibt decompressRR#RIRRR\RRRRRRRRRR#R](((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR;s$           ;tDirectoryLocatorcBs2eZdZdZdZdZdZRS(s? This class locates distributions in a directory tree. cKso|jdt|_tt|j|tjj|}tjj |sbt d|n||_ dS(s Initialise an instance. :param path: The root of the directory tree to search. :param kwargs: Passed to the superclass constructor, except for: * recursive - if True (the default), subdirectories are recursed into. If False, only the top-level directory is searched, t recursivesNot a directory: %rN( RRcR'RR&RIRRbtabspathRRtbase_dir(R3RbR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRI5s cCs|j|jS(s Should a filename be considered as a candidate for a distribution archive? As well as the filename, the directory which contains it is provided, though not used by the current implementation. (RdR(R3Rrtparent((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytshould_includeFsc Csiid6id6}xtj|jD]\}}}x|D]}|j||r=tjj||}tddttjj|dddf}|j ||}|r|j ||qq=q=W|j s'Pq'q'W|S(NRRRR,( RtwalkR)R+RbRRRR(RRR'( R3R[RPtroottdirstfilestfnR&R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\Ns"   c Cst}xtj|jD]\}}}x|D]}|j||r2tjj||}tddttjj |dddf}|j |d}|r|j |dqq2q2W|j sPqqW|S(sJ Return all the distribution names known to this locator. RR,R[N(RRR,R)R+RbRRRR(RR#RR'(R3RPR-R.R/R0R&R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR]^s "   (R<R=R>RIR+R\R](((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR&0s    t JSONLocatorcBs eZdZdZdZRS(s This locator uses special extended metadata (not available on PyPI) and is the basis of performant dependency resolution in distlib. Other locators require archive downloads before dependencies can be determined! As you might imagine, that can be slow. cCstddS(sJ Return all the distribution names known to this locator. sNot available from this locatorN(RZ(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR]xscCsBiid6id6}t|}|r>x|jdgD]}|ddks9|ddkreq9nt|d|d d |jd d d |j}|j}|d |_d|kr|drd|df|_n|jdi|_|jdi|_|||j <|dj |j t j |d q9Wn|S(NRRR/tptypetsdistt pyversiontsourceR[RxRsPlaceholder for summaryR.R&RRt requirementstexports( RRKRR.RRRt dependenciesR7RxRRR(R3R[RPRRRR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\~s&        .(R<R=R>R]R\(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR1qs tDistPathLocatorcBs eZdZdZdZRS(s This locator finds installed distributions in a path. It can be useful for adding to an :class:`AggregatingLocator`. cKs8tt|j|t|ts+t||_dS(ss Initialise an instance. :param distpath: A :class:`DistributionPath` instance to search. N(RR9RIt isinstanceRtAssertionErrortdistpath(R3R<R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIscCs|jj|}|dkr5iid6id6}nGi||j6it|jg|j6d6itdg|j6d6}|S(NRR(R<tget_distributionR#RxRR(R3R[RRP((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\s  (R<R=R>RIR\(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR9s tAggregatingLocatorcBsPeZdZdZdZdZeejj eZdZ dZ RS(sI This class allows you to chain and/or merge a list of locators. cOs8|jdt|_||_tt|j|dS(s Initialise an instance. :param locators: The list of locators to search. :param kwargs: Passed to the superclass constructor, except for: * merge - if False (the default), the first successful search from any of the locators is returned. If True, the results from all locators are merged (this can be slow). tmergeN(RRLR?tlocatorsRR>RI(R3R@R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIs  cCs5tt|jx|jD]}|jqWdS(N(RR>RUR@(R3R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRUscCs*||_x|jD]}||_qWdS(N(RVR@R.(R3RXR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRYs c Cs]i}xP|jD]E}|j|}|r|jr|jdi}|jdi}|j||jd}|r|rxF|jD]5\}} ||kr||c| ORIRURYRRBR.tfgetR\R](((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR>s    ,shttps://pypi.python.org/simple/R"g@R.tlegacys1(?P[\w-]+)\s*\(\s*(==\s*)?(?P[^)]+)\)$tDependencyFindercBsVeZdZddZdZdZdZdZdZ de dZ RS( s0 Locate dependencies for distributions. cCs(|p t|_t|jj|_dS(sf Initialise an instance, using the specified locator to locate distributions. N(tdefault_locatorRRR.(R3R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIscCstjd||j}||j|<||j||jf= 1.0) while C requires (B >= 1.1). For successful replacement, ``provider`` must meet all the requirements which ``other`` fulfills. :param provider: The provider we are trying to replace with. :param other: The provider we're trying to replace. :param problems: If False is returned, this will contain what problems prevented replacement. This is currently a tuple of the literal string 'cantreplace', ``provider``, ``other`` and the set of requirements that ``provider`` couldn't fulfill. :return: True if we can replace ``other`` with ``provider``, else False. t cantreplace( treqtsRRSR}RxRt frozensetRLRQRRNRc( R3RTtothertproblemstrlistt unmatchedRPRFRP((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyttry_to_replaceos"       # cCsi|_i|_i|_i|_t|p0g}d|krk|jd|tdddgO}nt|tr|}}tj d|nK|j j |d|}}|dkrt d|ntj d|t|_t}t|g}t|g}x|r|j}|j} | |jkrO|j|n/|j| } | |kr~|j|| |n|j|jB} |j} t} ||krxAdD]6}d |}||kr| t|d |O} qqWn| | B| B}x|D]}|j|}|s+tj d||j j |d|}|dkrv| rv|j j |dt}n|dkrtj d||jd|fq+|j|j}}||f|jkr|j|n|j||| kr+||kr+|j|tj d|jq+nxw|D]o}|j} | |jkrr|jj|tj|q2|j| } | |kr2|j|| |q2q2WqWqWt|jj}x<|D]4}||k|_|jrtj d|jqqWtj d|||fS(s Find a distribution and all distributions it depends on. :param requirement: The requirement specifying the distribution to find, or a Distribution instance. :param meta_extras: A list of meta extras such as :test:, :build: and so on. :param prereleases: If ``True``, allow pre-release versions to be returned - otherwise, don't return prereleases unless they're all that's available. Return a set of :class:`Distribution` instances and a set of problems. The distributions returned should be such that they have the :attr:`required` attribute set to ``True`` if they were from the ``requirement`` passed to ``find()``, and they have the :attr:`build_time_dependency` attribute set to ``True`` unless they are post-installation dependencies of the ``requirement``. The problems should be a tuple consisting of the string ``'unsatisfied'`` and the requirement which couldn't be satisfied by any distribution known to the locator. s:*:s:test:s:build:s:dev:spassed %s as requirementRsUnable to locate %rs located %sttesttbuildtdevs:%s:s %s_requiressNo providers found for %rsCannot satisfy %rt unsatisfiedsAdding %s to install_distss#%s is a build-time dependency only.sfind done for %sN(R^R_R`(RLRJRIRWRROR:RRkRlRRR#RRct requestedRR:RNR]t run_requirest meta_requirestbuild_requirestgetattrRURRxtname_and_versionRtvaluestbuild_time_dependency(R3Rt meta_extrasRRRRZttodot install_distsR[RYtireqtstsreqtstereqtsR:RQt all_reqtsRt providersRTtnRRMRJ((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytfinds                      !       "  "   N( R<R=R>R#RIRNRQRSRUR]RLRs(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRGs      ((ORtioRRtloggingRR`RRt ImportErrortdummy_threadingR$R,RtcompatRRRRRRRR R R R R1R RRRtdatabaseRRRRRtutilRRRRRRRRRRxRRRR R!t getLoggerR<RkRR|RRRR$R#R(R)tobjectRBRRRRR&R1R9R>RHRtNAME_VERSION_RERG(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytsV        d@ :0E:A&[    site-packages/pip/_vendor/distlib/locators.pyo000064400000131546147204247350015543 0ustar00 abc@s&ddlZddlmZddlZddlZddlZddlZddlZyddlZWne k rddl ZnXddl Z ddl m Z ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZddlm Z m!Z!m"Z"ddl#m$Z$ddl%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.dd l/m0Z0m1Z1dd l2m3Z3m4Z4ej5e6Z7ej8d Z9ej8d ej:Z;ej8d Z<dZ=e>dZ?defdYZ@deAfdYZBdeBfdYZCdeBfdYZDdeAfdYZEdeBfdYZFdeBfdYZGdeBfdYZHd eBfd!YZId"eBfd#YZJeJeHeFd$d%d&d'd(ZKeKjLZLej8d)ZMd*eAfd+YZNdS(,iN(tBytesIOi(tDistlibException(turljointurlparset urlunparset url2pathnamet pathname2urltqueuetquotetunescapet string_typest build_openertHTTPRedirectHandlert text_typetRequestt HTTPErrortURLError(t DistributiontDistributionPatht make_dist(tMetadata( tcached_propertytparse_credentialst ensure_slashtsplit_filenametget_project_datatparse_requirementtparse_name_and_versiont ServerProxytnormalize_name(t get_schemetUnsupportedVersionError(tWheelt is_compatibles^(\w+)=([a-f0-9]+)s;\s*charset\s*=\s*(.*)\s*$stext/html|application/x(ht)?mlshttps://pypi.python.org/pypicCs1|dkrt}nt|dd}|jS(s Return all distribution names known by an index. :param url: The URL of the index. :return: A list of all known distribution names. ttimeoutg@N(tNonet DEFAULT_INDEXRt list_packages(turltclient((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytget_all_distribution_names)s  tRedirectHandlercBs%eZdZdZeZZZRS(sE A class to work around a bug in some Python 3.2.x releases. c Csd}x(dD] }||kr ||}Pq q W|dkrAdSt|}|jdkrt|j|}t|dr|j||q||| Clear any errors which may have been logged. N(RR(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt clear_errorsscCs|jjdS(N(RDtclear(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt clear_cachescCs|jS(N(t_scheme(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt _get_schemescCs ||_dS(N(RV(R3tvalue((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt _set_schemescCstddS(s= For a given project, get a dictionary mapping available versions to Distribution instances. This should be implemented in subclasses. If called from a locate() request, self.matcher will be set to a matcher for the requirement to satisfy, otherwise it will be None. s Please implement in the subclassN(tNotImplementedError(R3tname((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt _get_projects cCstddS(sJ Return all the distribution names known to this locator. s Please implement in the subclassN(RZ(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytget_distribution_namesscCsj|jdkr!|j|}nE||jkr@|j|}n&|j|j|}||j|<|S(s For a given project, get a dictionary mapping available versions to Distribution instances. This calls _get_project to do all the work, and just implements a caching layer on top. N(RDR#R\RS(R3R[RP((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt get_projects  cCsyt|}tj|j}t}|jd}|rTtt||j}n|j dkd|j k|||fS(su Give an url a score which can be used to choose preferred URLs for a given project release. s.whlthttpsspypi.python.org( Rt posixpathtbasenametpathtTruetendswithR!R t wheel_tagsR.tnetloc(R3R&ttRat compatibletis_wheel((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt score_urls cCs{|}|rw|j|}|j|}||kr?|}n||kratjd||qwtjd||n|S(s{ Choose one of two URLs where both are candidates for distribution archives for the same version of a distribution (for example, .tar.gz vs. zip). The current implementation favours https:// URLs over http://, archives from PyPI over those from other locations, wheel compatibility (if a wheel) and then the archive name. sNot replacing %r with %rsReplacing %r with %r(Rjtloggertdebug(R3turl1turl2RPts1ts2((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt prefer_urls    cCs t||S(sZ Attempt to split a filename in project name, version and Python version. (R(R3tfilenamet project_name((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRsc Csd}d}t|\}}}}} } | jjdrXtjd|| ntj| } | r| j\} } n d\} } |}|r|ddkr|d }n|j dryt |}t ||j r|dkrt }n||j|}|ri|jd6|jd6|jd 6t||||| d fd 6d jg|jD]}d jt|d^qdd6}qnWqtk r}tjd|qXn|j |jrtj|}}x|jD]}|j |r|t| }|j||}|s@tjd|nu|\}}}| se|||ri|d6|d6|d 6t||||| d fd 6}|r||d= 1.0, < 2.0, != 1.3)' :param prereleases: If ``True``, allow pre-release versions to be located. Otherwise, pre-release versions are not returned. :return: A :class:`Distribution` instance, or ``None`` if no such distribution could be located. sNot a valid requirement: %rsmatcher: %s (%s)iRRs%s did not match %rs%skipping pre-release version %s of %sserror matching %s with %riR:ssorted list: %siN(RR(R#RRRR.RFt requirementRkRlttypeR<R^R[Rt version_classR}t is_prereleaseRMRRtsortedR:textrasRKRt download_urlsR(R3Rt prereleasesRPtrR.RFtversionstslisttvclstkRxtdtsdR&((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytlocatePsT          $   (s.tar.gzs.tar.bz2s.tars.zips.tgzs.tbz(s.eggs.exes.whl(s.pdfN(s.whl(R<R=R>tsource_extensionstbinary_extensionstexcluded_extensionsR#ReRRIRRRSRURWRYtpropertyR.R\R]R^RjRqRRRRRLR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRBSs.             F  tPyPIRPCLocatorcBs)eZdZdZdZdZRS(s This locator uses XML-RPC to locate distributions. It therefore cannot be used with simple mirrors (that only mirror file content). cKs8tt|j|||_t|dd|_dS(s Initialise an instance. :param url: The URL to use for XML-RPC. :param kwargs: Passed to the superclass constructor. R"g@N(tsuperRRItbase_urlRR'(R3R&tkwargs((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIs cCst|jjS(sJ Return all the distribution names known to this locator. (RR'R%(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR]sc Csviid6id6}|jj|t}xF|D]>}|jj||}|jj||}td|j}|d|_|d|_|j d|_ |j dg|_ |j d|_ t |}|r0|d } | d |_|j| |_||_|||RIR]R\(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRs tPyPIJSONLocatorcBs)eZdZdZdZdZRS(sw This locator uses PyPI's JSON interface. It's very limited in functionality and probably not worth using. cKs)tt|j|t||_dS(N(RRRIRR(R3R&R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIscCstddS(sJ Return all the distribution names known to this locator. sNot available from this locatorN(RZ(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR]scCsiid6id6}t|jdt|}yE|jj|}|jj}tj|}t d|j }|d}|d|_ |d|_ |j d|_|j d g|_|j d |_t|}||_|d} |||j RIR]R\(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRs  tPagecBszeZdZejdejejBejBZejdejejBZ dZ ejdejZ e dZ RS(s4 This class represents a scraped HTML page. s (rel\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s ]*))\s+)? href\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s ]*)) (\s+rel\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s ]*)))? s!]+)cCsM||_||_|_|jj|j}|rI|jd|_ndS(sk Initialise an instance with the Unicode page contents and the URL they came from. iN(RRR&t_basetsearchtgroup(R3RR&R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIs  s[^a-z0-9$&+,/:;=?@.#%_\\|-]cCsd}t}x|jj|jD]}|jd}|dpv|dpv|dpv|dpv|dpv|d}|d p|d p|d }t|j|}t|}|jj d |}|j ||fq(Wt |d ddt }|S(s Return the URLs of all the links on a page together with information about their "rel" attribute, for determining which ones to treat as downloads and which ones to queue for further scraping. cSs@t|\}}}}}}t||t||||fS(sTidy up an URL.(RRR(R&R.RfRbRRR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytclean%sR,trel1trel2trel3trel4trel5trel6RmRnturl3cSsdt|jdS(Ns%%%2xi(tordR(R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt3R,R:cSs|dS(Ni((Rg((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR7R,treverse( Rt_hreftfinditerRt groupdictRRR t _clean_retsubRRRc(R3RRPR}RtrelR&((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytlinkss   (R<R=R>tretcompiletItStXRRRIRRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRs tSimpleScrapingLocatorcBseZdZiejd6dd6dd6ZdddZdZd Z d Z e j d e j Zd Zd ZdZdZdZe j dZdZRS(s A locator which scrapes HTML pages to locate downloads for a distribution. This runs multiple threads to do the I/O; performance is at least as good as pip's PackageFinder, which works in an analogous fashion. tdeflatecCstjdttjS(Ntfileobj(tgziptGzipFileRRR(tb((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRER,RcCs|S(N((R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRFR,tnonei cKstt|j|t||_||_i|_t|_t j |_ t|_ t |_||_tj|_tj|_dS(s Initialise an instance. :param url: The root URL to use for scraping. :param timeout: The timeout, in seconds, to be applied to requests. This defaults to ``None`` (no timeout specified). :param num_workers: The number of worker threads you want to do I/O, This defaults to 10. :param kwargs: Passed to the superclass. N(RRRIRRR"t _page_cacheRt_seenRRGt _to_fetcht _bad_hostsRLtskip_externalst num_workerst threadingtRLockt_lockt_gplock(R3R&R"RR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIIs       cCscg|_xSt|jD]B}tjd|j}|jt|j|jj |qWdS(s Threads are created only when get_project is called, and terminate before it returns. They are there primarily to parallelise I/O (i.e. fetching web pages). ttargetN( t_threadstrangeRRtThreadt_fetcht setDaemonRctstartRM(R3tiRg((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt_prepare_threadscs    cCsOx!|jD]}|jjdq Wx|jD]}|jq.Wg|_dS(su Tell all the threads to terminate (by sending a sentinel value) and wait for them to do so. N(RRRR#R(R3Rg((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt _wait_threadsps c Csiid6id6}|j||_||_t|jdt|}|jj|jj|j z1t j d||j j ||j jWd|jX|`WdQX|S(NRRs%s/s Queueing %s(RRPRsRRRRRTRRRkRlRRRR(R3R[RPR&((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\}s        s<\b(linux-(i\d86|x86_64|arm\w+)|win(32|-amd64)|macosx-?\d+)\bcCs|jj|S(sD Does an URL refer to a platform-specific download? (tplatform_dependentR(R3R&((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt_is_platform_dependentscCsp|j|rd}n|j||j}tjd|||rl|j|j|j|WdQXn|S(s% See if an URL is a suitable download for a project. If it is, register information in the result dictionary (for _get_project) about the specific version it's for. Note that the return value isn't actually used other than as a boolean value. sprocess_download: %s -> %sN( RR#RRsRkRlRRRP(R3R&R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt_process_downloads   c Cst|\}}}}}}|j|j|j|jrGt}n|jrl|j|j rlt}n|j|jst}ny|d krt}nd|d krt}nO|j |rt}n7|j ddd} | j d krt}nt }t jd |||||S( s Determine whether a link URL from a referring page and with a particular "rel" attribute should be queued for scraping. thomepagetdownloadthttpR_tftpt:iit localhosts#should_queue: %s (%s) from %s -> %s(RR (R R_R (RRdRRRRLRR{RRtsplitRzRcRkRl( R3tlinktreferrerRR.RfRbt_RPthost((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt _should_queues*           cCs xtr|jj}zy|r|j|}|dkrEwnx|jD]y\}}||jkrO|jj||j| r|j |||rt j d|||jj |qqOqOWnWn)t k r}|jj t|nXWd|jjX|sPqqWdS(s Get a URL to fetch from the work queue, get the HTML page, examine its links for download candidates and candidates for further scraping. This is a handy method to run in a thread. sQueueing %s from %sN(RcRRKtget_pageR#RRRRRRkRlRRRHR RO(R3R&tpageRRRQ((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRs(  !cCst|\}}}}}}|dkrZtjjt|rZtt|d}n||jkr|j|}tj d||nK|j ddd}d}||j krtj d||n t |did d 6}zy7tj d ||jj|d |j} tj d || j} | jdd} tj| r| j} | j} | jd}|r|j|}|| } nd}tj| }|r|jd}ny| j|} Wn tk r| jd} nXt| | }||j| ]*>([^<]+)tzlibt decompressRR#RIRRR\RRRRRRRRRR#R](((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR;s$           ;tDirectoryLocatorcBs2eZdZdZdZdZdZRS(s? This class locates distributions in a directory tree. cKso|jdt|_tt|j|tjj|}tjj |sbt d|n||_ dS(s Initialise an instance. :param path: The root of the directory tree to search. :param kwargs: Passed to the superclass constructor, except for: * recursive - if True (the default), subdirectories are recursed into. If False, only the top-level directory is searched, t recursivesNot a directory: %rN( RRcR'RR&RIRRbtabspathRRtbase_dir(R3RbR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRI5s cCs|j|jS(s Should a filename be considered as a candidate for a distribution archive? As well as the filename, the directory which contains it is provided, though not used by the current implementation. (RdR(R3Rrtparent((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytshould_includeFsc Csiid6id6}xtj|jD]\}}}x|D]}|j||r=tjj||}tddttjj|dddf}|j ||}|r|j ||qq=q=W|j s'Pq'q'W|S(NRRRR,( RtwalkR)R+RbRRRR(RRR'( R3R[RPtroottdirstfilestfnR&R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\Ns"   c Cst}xtj|jD]\}}}x|D]}|j||r2tjj||}tddttjj |dddf}|j |d}|r|j |dqq2q2W|j sPqqW|S(sJ Return all the distribution names known to this locator. RR,R[N(RRR,R)R+RbRRRR(RR#RR'(R3RPR-R.R/R0R&R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR]^s "   (R<R=R>RIR+R\R](((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR&0s    t JSONLocatorcBs eZdZdZdZRS(s This locator uses special extended metadata (not available on PyPI) and is the basis of performant dependency resolution in distlib. Other locators require archive downloads before dependencies can be determined! As you might imagine, that can be slow. cCstddS(sJ Return all the distribution names known to this locator. sNot available from this locatorN(RZ(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR]xscCsBiid6id6}t|}|r>x|jdgD]}|ddks9|ddkreq9nt|d|d d |jd d d |j}|j}|d |_d|kr|drd|df|_n|jdi|_|jdi|_|||j <|dj |j t j |d q9Wn|S(NRRR/tptypetsdistt pyversiontsourceR[RxRsPlaceholder for summaryR.R&RRt requirementstexports( RRKRR.RRRt dependenciesR7RxRRR(R3R[RPRRRR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\~s&        .(R<R=R>R]R\(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR1qs tDistPathLocatorcBs eZdZdZdZRS(s This locator finds installed distributions in a path. It can be useful for adding to an :class:`AggregatingLocator`. cKs#tt|j|||_dS(ss Initialise an instance. :param distpath: A :class:`DistributionPath` instance to search. N(RR9RItdistpath(R3R:R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIscCs|jj|}|dkr5iid6id6}nGi||j6it|jg|j6d6itdg|j6d6}|S(NRR(R:tget_distributionR#RxRR(R3R[RRP((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\s  (R<R=R>RIR\(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR9s tAggregatingLocatorcBsPeZdZdZdZdZeejj eZdZ dZ RS(sI This class allows you to chain and/or merge a list of locators. cOs8|jdt|_||_tt|j|dS(s Initialise an instance. :param locators: The list of locators to search. :param kwargs: Passed to the superclass constructor, except for: * merge - if False (the default), the first successful search from any of the locators is returned. If True, the results from all locators are merged (this can be slow). tmergeN(RRLR=tlocatorsRR<RI(R3R>R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIs  cCs5tt|jx|jD]}|jqWdS(N(RR<RUR>(R3R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRUscCs*||_x|jD]}||_qWdS(N(RVR>R.(R3RXR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRYs c Cs]i}xP|jD]E}|j|}|r|jr|jdi}|jdi}|j||jd}|r|rxF|jD]5\}} ||kr||c| OR^R=RKtupdateRRFR#RcRLR}( R3R[RPRRR/RtdfRRtddtfound((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\s8         cCsIt}x9|jD].}y||jO}Wqtk r@qXqW|S(sJ Return all the distribution names known to this locator. (RR>R]RZ(R3RPR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR]s  ( R<R=R>RIRURYRRBR.tfgetR\R](((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR<s    ,shttps://pypi.python.org/simple/R"g@R.tlegacys1(?P[\w-]+)\s*\(\s*(==\s*)?(?P[^)]+)\)$tDependencyFindercBsVeZdZddZdZdZdZdZdZ de dZ RS( s0 Locate dependencies for distributions. cCs(|p t|_t|jj|_dS(sf Initialise an instance, using the specified locator to locate distributions. N(tdefault_locatorRRR.(R3R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIscCstjd||j}||j|<||j||jf= 1.0) while C requires (B >= 1.1). For successful replacement, ``provider`` must meet all the requirements which ``other`` fulfills. :param provider: The provider we are trying to replace with. :param other: The provider we're trying to replace. :param problems: If False is returned, this will contain what problems prevented replacement. This is currently a tuple of the literal string 'cantreplace', ``provider``, ``other`` and the set of requirements that ``provider`` couldn't fulfill. :return: True if we can replace ``other`` with ``provider``, else False. t cantreplace( treqtsRRQR}RxRt frozensetRLRORRLRc( R3RRtothertproblemstrlistt unmatchedRNRFRP((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyttry_to_replaceos"       # cCsi|_i|_i|_i|_t|p0g}d|krk|jd|tdddgO}nt|tr|}}tj d|nK|j j |d|}}|dkrt d|ntj d|t|_t}t|g}t|g}x|r|j}|j} | |jkrO|j|n/|j| } | |kr~|j|| |n|j|jB} |j} t} ||krxAdD]6}d |}||kr| t|d |O} qqWn| | B| B}x|D]}|j|}|s+tj d||j j |d|}|dkrv| rv|j j |dt}n|dkrtj d||jd|fq+|j|j}}||f|jkr|j|n|j||| kr+||kr+|j|tj d|jq+nxw|D]o}|j} | |jkrr|jj|tj|q2|j| } | |kr2|j|| |q2q2WqWqWt|jj}x<|D]4}||k|_|jrtj d|jqqWtj d|||fS(s Find a distribution and all distributions it depends on. :param requirement: The requirement specifying the distribution to find, or a Distribution instance. :param meta_extras: A list of meta extras such as :test:, :build: and so on. :param prereleases: If ``True``, allow pre-release versions to be returned - otherwise, don't return prereleases unless they're all that's available. Return a set of :class:`Distribution` instances and a set of problems. The distributions returned should be such that they have the :attr:`required` attribute set to ``True`` if they were from the ``requirement`` passed to ``find()``, and they have the :attr:`build_time_dependency` attribute set to ``True`` unless they are post-installation dependencies of the ``requirement``. The problems should be a tuple consisting of the string ``'unsatisfied'`` and the requirement which couldn't be satisfied by any distribution known to the locator. s:*:s:test:s:build:s:dev:spassed %s as requirementRsUnable to locate %rs located %sttesttbuildtdevs:%s:s %s_requiressNo providers found for %rsCannot satisfy %rt unsatisfiedsAdding %s to install_distss#%s is a build-time dependency only.sfind done for %sN(R\R]R^(RJRHRGRURRMt isinstanceRRkRlRRR#RRct requestedRR:RLR[t run_requirest meta_requirestbuild_requirestgetattrRSRRxtname_and_versionRtvaluestbuild_time_dependency(R3Rt meta_extrasRRRRXttodot install_distsR[RWtireqtstsreqtstereqtsR:RQt all_reqtsRt providersRRtnRRKRH((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytfinds                      !       "  "   N( R<R=R>R#RIRLRORQRSR[RLRr(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyREs      ((ORtioRRtloggingRR`RRt ImportErrortdummy_threadingR$R,RtcompatRRRRRRRR R R R R1R RRRtdatabaseRRRRRtutilRRRRRRRRRRxRRRR R!t getLoggerR<RkRR|RRRR$R#R(R)tobjectRBRRRRR&R1R9R<RFRtNAME_VERSION_RERE(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytsV        d@ :0E:A&[    site-packages/pip/_vendor/distlib/manifest.py000064400000034732147204247350015343 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012-2013 Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # """ Class representing the list of files in a distribution. Equivalent to distutils.filelist, but fixes some problems. """ import fnmatch import logging import os import re import sys from . import DistlibException from .compat import fsdecode from .util import convert_path __all__ = ['Manifest'] logger = logging.getLogger(__name__) # a \ followed by some spaces + EOL _COLLAPSE_PATTERN = re.compile('\\\w*\n', re.M) _COMMENTED_LINE = re.compile('#.*?(?=\n)|\n(?=$)', re.M | re.S) # # Due to the different results returned by fnmatch.translate, we need # to do slightly different processing for Python 2.7 and 3.2 ... this needed # to be brought in for Python 3.6 onwards. # _PYTHON_VERSION = sys.version_info[:2] class Manifest(object): """A list of files built by on exploring the filesystem and filtered by applying various patterns to what we find there. """ def __init__(self, base=None): """ Initialise an instance. :param base: The base directory to explore under. """ self.base = os.path.abspath(os.path.normpath(base or os.getcwd())) self.prefix = self.base + os.sep self.allfiles = None self.files = set() # # Public API # def findall(self): """Find all files under the base and set ``allfiles`` to the absolute pathnames of files found. """ from stat import S_ISREG, S_ISDIR, S_ISLNK self.allfiles = allfiles = [] root = self.base stack = [root] pop = stack.pop push = stack.append while stack: root = pop() names = os.listdir(root) for name in names: fullname = os.path.join(root, name) # Avoid excess stat calls -- just one will do, thank you! stat = os.stat(fullname) mode = stat.st_mode if S_ISREG(mode): allfiles.append(fsdecode(fullname)) elif S_ISDIR(mode) and not S_ISLNK(mode): push(fullname) def add(self, item): """ Add a file to the manifest. :param item: The pathname to add. This can be relative to the base. """ if not item.startswith(self.prefix): item = os.path.join(self.base, item) self.files.add(os.path.normpath(item)) def add_many(self, items): """ Add a list of files to the manifest. :param items: The pathnames to add. These can be relative to the base. """ for item in items: self.add(item) def sorted(self, wantdirs=False): """ Return sorted files in directory order """ def add_dir(dirs, d): dirs.add(d) logger.debug('add_dir added %s', d) if d != self.base: parent, _ = os.path.split(d) assert parent not in ('', '/') add_dir(dirs, parent) result = set(self.files) # make a copy! if wantdirs: dirs = set() for f in result: add_dir(dirs, os.path.dirname(f)) result |= dirs return [os.path.join(*path_tuple) for path_tuple in sorted(os.path.split(path) for path in result)] def clear(self): """Clear all collected files.""" self.files = set() self.allfiles = [] def process_directive(self, directive): """ Process a directive which either adds some files from ``allfiles`` to ``files``, or removes some files from ``files``. :param directive: The directive to process. This should be in a format compatible with distutils ``MANIFEST.in`` files: http://docs.python.org/distutils/sourcedist.html#commands """ # Parse the line: split it up, make sure the right number of words # is there, and return the relevant words. 'action' is always # defined: it's the first word of the line. Which of the other # three are defined depends on the action; it'll be either # patterns, (dir and patterns), or (dirpattern). action, patterns, thedir, dirpattern = self._parse_directive(directive) # OK, now we know that the action is valid and we have the # right number of words on the line for that action -- so we # can proceed with minimal error-checking. if action == 'include': for pattern in patterns: if not self._include_pattern(pattern, anchor=True): logger.warning('no files found matching %r', pattern) elif action == 'exclude': for pattern in patterns: found = self._exclude_pattern(pattern, anchor=True) #if not found: # logger.warning('no previously-included files ' # 'found matching %r', pattern) elif action == 'global-include': for pattern in patterns: if not self._include_pattern(pattern, anchor=False): logger.warning('no files found matching %r ' 'anywhere in distribution', pattern) elif action == 'global-exclude': for pattern in patterns: found = self._exclude_pattern(pattern, anchor=False) #if not found: # logger.warning('no previously-included files ' # 'matching %r found anywhere in ' # 'distribution', pattern) elif action == 'recursive-include': for pattern in patterns: if not self._include_pattern(pattern, prefix=thedir): logger.warning('no files found matching %r ' 'under directory %r', pattern, thedir) elif action == 'recursive-exclude': for pattern in patterns: found = self._exclude_pattern(pattern, prefix=thedir) #if not found: # logger.warning('no previously-included files ' # 'matching %r found under directory %r', # pattern, thedir) elif action == 'graft': if not self._include_pattern(None, prefix=dirpattern): logger.warning('no directories found matching %r', dirpattern) elif action == 'prune': if not self._exclude_pattern(None, prefix=dirpattern): logger.warning('no previously-included directories found ' 'matching %r', dirpattern) else: # pragma: no cover # This should never happen, as it should be caught in # _parse_template_line raise DistlibException( 'invalid action %r' % action) # # Private API # def _parse_directive(self, directive): """ Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns """ words = directive.split() if len(words) == 1 and words[0] not in ('include', 'exclude', 'global-include', 'global-exclude', 'recursive-include', 'recursive-exclude', 'graft', 'prune'): # no action given, let's use the default 'include' words.insert(0, 'include') action = words[0] patterns = thedir = dir_pattern = None if action in ('include', 'exclude', 'global-include', 'global-exclude'): if len(words) < 2: raise DistlibException( '%r expects ...' % action) patterns = [convert_path(word) for word in words[1:]] elif action in ('recursive-include', 'recursive-exclude'): if len(words) < 3: raise DistlibException( '%r expects ...' % action) thedir = convert_path(words[1]) patterns = [convert_path(word) for word in words[2:]] elif action in ('graft', 'prune'): if len(words) != 2: raise DistlibException( '%r expects a single ' % action) dir_pattern = convert_path(words[1]) else: raise DistlibException('unknown action %r' % action) return action, patterns, thedir, dir_pattern def _include_pattern(self, pattern, anchor=True, prefix=None, is_regex=False): """Select strings (presumably filenames) from 'self.files' that match 'pattern', a Unix-style wildcard (glob) pattern. Patterns are not quite the same as implemented by the 'fnmatch' module: '*' and '?' match non-special characters, where "special" is platform-dependent: slash on Unix; colon, slash, and backslash on DOS/Windows; and colon on Mac OS. If 'anchor' is true (the default), then the pattern match is more stringent: "*.py" will match "foo.py" but not "foo/bar.py". If 'anchor' is false, both of these will match. If 'prefix' is supplied, then only filenames starting with 'prefix' (itself a pattern) and ending with 'pattern', with anything in between them, will match. 'anchor' is ignored in this case. If 'is_regex' is true, 'anchor' and 'prefix' are ignored, and 'pattern' is assumed to be either a string containing a regex or a regex object -- no translation is done, the regex is just compiled and used as-is. Selected strings will be added to self.files. Return True if files are found. """ # XXX docstring lying about what the special chars are? found = False pattern_re = self._translate_pattern(pattern, anchor, prefix, is_regex) # delayed loading of allfiles list if self.allfiles is None: self.findall() for name in self.allfiles: if pattern_re.search(name): self.files.add(name) found = True return found def _exclude_pattern(self, pattern, anchor=True, prefix=None, is_regex=False): """Remove strings (presumably filenames) from 'files' that match 'pattern'. Other parameters are the same as for 'include_pattern()', above. The list 'self.files' is modified in place. Return True if files are found. This API is public to allow e.g. exclusion of SCM subdirs, e.g. when packaging source distributions """ found = False pattern_re = self._translate_pattern(pattern, anchor, prefix, is_regex) for f in list(self.files): if pattern_re.search(f): self.files.remove(f) found = True return found def _translate_pattern(self, pattern, anchor=True, prefix=None, is_regex=False): """Translate a shell-like wildcard pattern to a compiled regular expression. Return the compiled regex. If 'is_regex' true, then 'pattern' is directly compiled to a regex (if it's a string) or just returned as-is (assumes it's a regex object). """ if is_regex: if isinstance(pattern, str): return re.compile(pattern) else: return pattern if _PYTHON_VERSION > (3, 2): # ditch start and end characters start, _, end = self._glob_to_re('_').partition('_') if pattern: pattern_re = self._glob_to_re(pattern) if _PYTHON_VERSION > (3, 2): assert pattern_re.startswith(start) and pattern_re.endswith(end) else: pattern_re = '' base = re.escape(os.path.join(self.base, '')) if prefix is not None: # ditch end of pattern character if _PYTHON_VERSION <= (3, 2): empty_pattern = self._glob_to_re('') prefix_re = self._glob_to_re(prefix)[:-len(empty_pattern)] else: prefix_re = self._glob_to_re(prefix) assert prefix_re.startswith(start) and prefix_re.endswith(end) prefix_re = prefix_re[len(start): len(prefix_re) - len(end)] sep = os.sep if os.sep == '\\': sep = r'\\' if _PYTHON_VERSION <= (3, 2): pattern_re = '^' + base + sep.join((prefix_re, '.*' + pattern_re)) else: pattern_re = pattern_re[len(start): len(pattern_re) - len(end)] pattern_re = r'%s%s%s%s.*%s%s' % (start, base, prefix_re, sep, pattern_re, end) else: # no prefix -- respect anchor flag if anchor: if _PYTHON_VERSION <= (3, 2): pattern_re = '^' + base + pattern_re else: pattern_re = r'%s%s%s' % (start, base, pattern_re[len(start):]) return re.compile(pattern_re) def _glob_to_re(self, pattern): """Translate a shell-like glob pattern to a regular expression. Return a string containing the regex. Differs from 'fnmatch.translate()' in that '*' does not match "special characters" (which are platform-specific). """ pattern_re = fnmatch.translate(pattern) # '?' and '*' in the glob pattern become '.' and '.*' in the RE, which # IMHO is wrong -- '?' and '*' aren't supposed to match slash in Unix, # and by extension they shouldn't match such "special characters" under # any OS. So change all non-escaped dots in the RE to match any # character except the special characters (currently: just os.sep). sep = os.sep if os.sep == '\\': # we're using a regex to manipulate a regex, so we need # to escape the backslash twice sep = r'\\\\' escaped = r'\1[^%s]' % sep pattern_re = re.sub(r'((?{s(RRRRtdirnametsortedR(RtwantdirstresultR.tft path_tuple((R2Rs@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pyR5gs   cCst|_g|_dS(sClear all collected files.N(RRR (R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pytclear}s cCs|j|\}}}}|dkrcx|D].}|j|dts.tjd|q.q.Wn|dkrx|D]}|j|dt}qvWn{|dkrxl|D].}|j|dtstjd|qqWn3|dkrx$|D]}|j|dt}qWn|dkr`x|D]1}|j|d |s(tjd ||q(q(Wn|d krx|D]}|j|d |}qsWn~|d kr|jdd |stjd |qnG|dkr|jdd |stjd|qntd|dS(sv Process a directive which either adds some files from ``allfiles`` to ``files``, or removes some files from ``files``. :param directive: The directive to process. This should be in a format compatible with distutils ``MANIFEST.in`` files: http://docs.python.org/distutils/sourcedist.html#commands tincludetanchorsno files found matching %rtexcludesglobal-includes3no files found matching %r anywhere in distributionsglobal-excludesrecursive-includeR s-no files found matching %r under directory %rsrecursive-excludetgrafts no directories found matching %rtprunes4no previously-included directories found matching %rsinvalid action %rN( t_parse_directivet_include_patterntTrueR*twarningt_exclude_patterntFalseR R(Rt directivetactiontpatternstthedirt dirpatterntpatterntfound((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pytprocess_directivesD                    c Cs{|j}t|dkrA|ddkrA|jddn|d}d}}}|dkrt|d krtd |ng|dD]}t|^q}n|dkrt|d krtd|nt|d}g|d D]}t|^q}nT|dkr[t|d krHtd|nt|d}ntd|||||fS(s Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns iiR;R=sglobal-includesglobal-excludesrecursive-includesrecursive-excludeR>R?is$%r expects ...is*%r expects ...s!%r expects a single sunknown action %r(R;R=sglobal-includesglobal-excludesrecursive-includesrecursive-excludeR>R?N(R;R=sglobal-includesglobal-exclude(srecursive-includesrecursive-exclude(R>R?(R,tlentinsertR RR(RRFtwordsRGRHRIt dir_patterntword((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pyR@s:    & & cCszt}|j||||}|jdkr:|jnx9|jD].}|j|rD|jj|t}qDqDW|S(sSelect strings (presumably filenames) from 'self.files' that match 'pattern', a Unix-style wildcard (glob) pattern. Patterns are not quite the same as implemented by the 'fnmatch' module: '*' and '?' match non-special characters, where "special" is platform-dependent: slash on Unix; colon, slash, and backslash on DOS/Windows; and colon on Mac OS. If 'anchor' is true (the default), then the pattern match is more stringent: "*.py" will match "foo.py" but not "foo/bar.py". If 'anchor' is false, both of these will match. If 'prefix' is supplied, then only filenames starting with 'prefix' (itself a pattern) and ending with 'pattern', with anything in between them, will match. 'anchor' is ignored in this case. If 'is_regex' is true, 'anchor' and 'prefix' are ignored, and 'pattern' is assumed to be either a string containing a regex or a regex object -- no translation is done, the regex is just compiled and used as-is. Selected strings will be added to self.files. Return True if files are found. N( REt_translate_patternR R R"tsearchRR$RB(RRKR<R tis_regexRLt pattern_reR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pyRAs  cCsdt}|j||||}x?t|jD].}|j|r.|jj|t}q.q.W|S(stRemove strings (presumably filenames) from 'files' that match 'pattern'. Other parameters are the same as for 'include_pattern()', above. The list 'self.files' is modified in place. Return True if files are found. This API is public to allow e.g. exclusion of SCM subdirs, e.g. when packaging source distributions (RERStlistRRTtremoveRB(RRKR<R RURLRVR8((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pyRD)s  c CsH|r)t|tr"tj|S|Sntd krY|jdjd\}}}n|r|j|}td kr|j|r|j|st qnd}tj t j j |jd} |d k rtdkr|jd} |j|t|  } nV|j|} | j|r<| j|sBt | t|t| t|!} t j} t jdkrd} ntdkrd| | j | d|f}q;|t|t|t|!}d || | | ||f}nC|r;tdkrd| |}q;d || |t|f}ntj|S(sTranslate a shell-like wildcard pattern to a compiled regular expression. Return the compiled regex. If 'is_regex' true, then 'pattern' is directly compiled to a regex (if it's a string) or just returned as-is (assumes it's a regex object). iiR1R(s\s\\t^s.*s%s%s%s%s.*%s%ss%s%s%s(ii(iiN(ii(ii(ii(t isinstancetstrtretcompilet_PYTHON_VERSIONt _glob_to_ret partitionR#tendswithR-tescapeRRRR R RNR ( RRKR<R RUtstartR1tendRVR t empty_patternt prefix_reR ((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pyRS=sB   $ *!  $#   #  cCsStj|}tj}tjdkr0d}nd|}tjd||}|S(sTranslate a shell-like glob pattern to a regular expression. Return a string containing the regex. Differs from 'fnmatch.translate()' in that '*' does not match "special characters" (which are platform-specific). s\s\\\\s\1[^%s]s((? s       site-packages/pip/_vendor/distlib/manifest.pyo000064400000027330147204247350015516 0ustar00 abc@sdZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z dgZ ej eZejdejZejd ejejBZejd Zdefd YZdS( su Class representing the list of files in a distribution. Equivalent to distutils.filelist, but fixes some problems. iNi(tDistlibException(tfsdecode(t convert_pathtManifests\\w* s#.*?(?= )| (?=$)icBseZdZd dZdZdZdZedZ dZ dZ dZ e d ed Ze d ed Ze d ed Zd ZRS(s~A list of files built by on exploring the filesystem and filtered by applying various patterns to what we find there. cCsYtjjtjj|p!tj|_|jtj|_d|_ t |_ dS(sd Initialise an instance. :param base: The base directory to explore under. N( tostpathtabspathtnormpathtgetcwdtbasetseptprefixtNonetallfilestsettfiles(tselfR ((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pyt__init__*s- cCsddlm}m}m}g|_}|j}|g}|j}|j}x|r|}tj |} x| D]{} tj j || } tj| } | j } || r|jt | qu|| ru||  ru|| ququWqPWdS(smFind all files under the base and set ``allfiles`` to the absolute pathnames of files found. i(tS_ISREGtS_ISDIRtS_ISLNKN(tstatRRRR R tpoptappendRtlistdirRtjointst_modeR(RRRRR troottstackRtpushtnamestnametfullnameRtmode((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pytfindall9s"          cCsM|j|js-tjj|j|}n|jjtjj|dS(sz Add a file to the manifest. :param item: The pathname to add. This can be relative to the base. N( t startswithR RRRR RtaddR(Rtitem((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pyR$TscCs"x|D]}|j|qWdS(s Add a list of files to the manifest. :param items: The pathnames to add. These can be relative to the base. N(R$(RtitemsR%((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pytadd_many^s csfdtj}|rgt}x'|D]}|tjj|q7W||O}ngtd|DD]}tjj|^q~S(s8 Return sorted files in directory order csX|j|tjd||jkrTtjj|\}}||ndS(Nsadd_dir added %s(R$tloggertdebugR RRtsplit(tdirstdtparentt_(tadd_dirR(s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pyR/ls  css!|]}tjj|VqdS(N(RRR*(t.0R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pys {s(RRRRtdirnametsortedR(RtwantdirstresultR+tft path_tuple((R/Rs@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pyR2gs   cCst|_g|_dS(sClear all collected files.N(RRR (R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pytclear}s cCs|j|\}}}}|dkrcx|D].}|j|dts.tjd|q.q.Wn|dkrx|D]}|j|dt}qvWn{|dkrxl|D].}|j|dtstjd|qqWn3|dkrx$|D]}|j|dt}qWn|dkr`x|D]1}|j|d |s(tjd ||q(q(Wn|d krx|D]}|j|d |}qsWn~|d kr|jdd |stjd |qnG|dkr|jdd |stjd|qntd|dS(sv Process a directive which either adds some files from ``allfiles`` to ``files``, or removes some files from ``files``. :param directive: The directive to process. This should be in a format compatible with distutils ``MANIFEST.in`` files: http://docs.python.org/distutils/sourcedist.html#commands tincludetanchorsno files found matching %rtexcludesglobal-includes3no files found matching %r anywhere in distributionsglobal-excludesrecursive-includeR s-no files found matching %r under directory %rsrecursive-excludetgrafts no directories found matching %rtprunes4no previously-included directories found matching %rsinvalid action %rN( t_parse_directivet_include_patterntTrueR(twarningt_exclude_patterntFalseR R(Rt directivetactiontpatternstthedirt dirpatterntpatterntfound((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pytprocess_directivesD                    c Cs{|j}t|dkrA|ddkrA|jddn|d}d}}}|dkrt|d krtd |ng|dD]}t|^q}n|dkrt|d krtd|nt|d}g|d D]}t|^q}nT|dkr[t|d krHtd|nt|d}ntd|||||fS(s Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns iiR8R:sglobal-includesglobal-excludesrecursive-includesrecursive-excludeR;R<is$%r expects ...is*%r expects ...s!%r expects a single sunknown action %r(R8R:sglobal-includesglobal-excludesrecursive-includesrecursive-excludeR;R<N(R8R:sglobal-includesglobal-exclude(srecursive-includesrecursive-exclude(R;R<(R*tlentinsertR RR(RRCtwordsRDRERFt dir_patterntword((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pyR=s:    & & cCszt}|j||||}|jdkr:|jnx9|jD].}|j|rD|jj|t}qDqDW|S(sSelect strings (presumably filenames) from 'self.files' that match 'pattern', a Unix-style wildcard (glob) pattern. Patterns are not quite the same as implemented by the 'fnmatch' module: '*' and '?' match non-special characters, where "special" is platform-dependent: slash on Unix; colon, slash, and backslash on DOS/Windows; and colon on Mac OS. If 'anchor' is true (the default), then the pattern match is more stringent: "*.py" will match "foo.py" but not "foo/bar.py". If 'anchor' is false, both of these will match. If 'prefix' is supplied, then only filenames starting with 'prefix' (itself a pattern) and ending with 'pattern', with anything in between them, will match. 'anchor' is ignored in this case. If 'is_regex' is true, 'anchor' and 'prefix' are ignored, and 'pattern' is assumed to be either a string containing a regex or a regex object -- no translation is done, the regex is just compiled and used as-is. Selected strings will be added to self.files. Return True if files are found. N( RBt_translate_patternR R R"tsearchRR$R?(RRHR9R tis_regexRIt pattern_reR((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pyR>s  cCsdt}|j||||}x?t|jD].}|j|r.|jj|t}q.q.W|S(stRemove strings (presumably filenames) from 'files' that match 'pattern'. Other parameters are the same as for 'include_pattern()', above. The list 'self.files' is modified in place. Return True if files are found. This API is public to allow e.g. exclusion of SCM subdirs, e.g. when packaging source distributions (RBRPtlistRRQtremoveR?(RRHR9R RRRIRSR5((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pyRA)s  c Cs|r)t|tr"tj|S|Sntd krY|jdjd\}}}n|r|j|}td krqnd}tjtj j |j d} |d k rtdkr|jd} |j|t |  } n2|j|} | t |t | t |!} tj} tjdkr>d} ntdkrnd| | j | d|f}q|t |t |t |!}d || | | ||f}nC|rtdkrd| |}qd || |t |f}ntj|S(sTranslate a shell-like wildcard pattern to a compiled regular expression. Return the compiled regex. If 'is_regex' true, then 'pattern' is directly compiled to a regex (if it's a string) or just returned as-is (assumes it's a regex object). iiR.ts\s\\t^s.*s%s%s%s%s.*%s%ss%s%s%s(ii(iiN(ii(ii(ii(t isinstancetstrtretcompilet_PYTHON_VERSIONt _glob_to_ret partitiontescapeRRRR R RKR ( RRHR9R RRtstartR.tendRSR t empty_patternt prefix_reR ((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pyRP=s@   $ !  #   #  cCsStj|}tj}tjdkr0d}nd|}tjd||}|S(sTranslate a shell-like glob pattern to a regular expression. Return a string containing the regex. Differs from 'fnmatch.translate()' in that '*' does not match "special characters" (which are platform-specific). s\s\\\\s\1[^%s]s((?RARPR](((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pyR%s      O / (  6(RjRdtloggingRRZtsysRVRtcompatRtutilRt__all__t getLoggerRhR(R[tMt_COLLAPSE_PATTERNtSt_COMMENTED_LINEt version_infoR\tobjectR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.pyt s       site-packages/pip/_vendor/distlib/markers.py000064400000014212147204247350015170 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012-2013 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # """Parser for the environment markers micro-language defined in PEP 345.""" import ast import os import sys import platform from .compat import python_implementation, string_types from .util import in_venv __all__ = ['interpret'] class Evaluator(object): """ A limited evaluator for Python expressions. """ operators = { 'eq': lambda x, y: x == y, 'gt': lambda x, y: x > y, 'gte': lambda x, y: x >= y, 'in': lambda x, y: x in y, 'lt': lambda x, y: x < y, 'lte': lambda x, y: x <= y, 'not': lambda x: not x, 'noteq': lambda x, y: x != y, 'notin': lambda x, y: x not in y, } allowed_values = { 'sys_platform': sys.platform, 'python_version': '%s.%s' % sys.version_info[:2], # parsing sys.platform is not reliable, but there is no other # way to get e.g. 2.7.2+, and the PEP is defined with sys.version 'python_full_version': sys.version.split(' ', 1)[0], 'os_name': os.name, 'platform_in_venv': str(in_venv()), 'platform_release': platform.release(), 'platform_version': platform.version(), 'platform_machine': platform.machine(), 'platform_python_implementation': python_implementation(), } def __init__(self, context=None): """ Initialise an instance. :param context: If specified, names are looked up in this mapping. """ self.context = context or {} self.source = None def get_fragment(self, offset): """ Get the part of the source which is causing a problem. """ fragment_len = 10 s = '%r' % (self.source[offset:offset + fragment_len]) if offset + fragment_len < len(self.source): s += '...' return s def get_handler(self, node_type): """ Get a handler for the specified AST node type. """ return getattr(self, 'do_%s' % node_type, None) def evaluate(self, node, filename=None): """ Evaluate a source string or node, using ``filename`` when displaying errors. """ if isinstance(node, string_types): self.source = node kwargs = {'mode': 'eval'} if filename: kwargs['filename'] = filename try: node = ast.parse(node, **kwargs) except SyntaxError as e: s = self.get_fragment(e.offset) raise SyntaxError('syntax error %s' % s) node_type = node.__class__.__name__.lower() handler = self.get_handler(node_type) if handler is None: if self.source is None: s = '(source not available)' else: s = self.get_fragment(node.col_offset) raise SyntaxError("don't know how to evaluate %r %s" % ( node_type, s)) return handler(node) def get_attr_key(self, node): assert isinstance(node, ast.Attribute), 'attribute node expected' return '%s.%s' % (node.value.id, node.attr) def do_attribute(self, node): if not isinstance(node.value, ast.Name): valid = False else: key = self.get_attr_key(node) valid = key in self.context or key in self.allowed_values if not valid: raise SyntaxError('invalid expression: %s' % key) if key in self.context: result = self.context[key] else: result = self.allowed_values[key] return result def do_boolop(self, node): result = self.evaluate(node.values[0]) is_or = node.op.__class__ is ast.Or is_and = node.op.__class__ is ast.And assert is_or or is_and if (is_and and result) or (is_or and not result): for n in node.values[1:]: result = self.evaluate(n) if (is_or and result) or (is_and and not result): break return result def do_compare(self, node): def sanity_check(lhsnode, rhsnode): valid = True if isinstance(lhsnode, ast.Str) and isinstance(rhsnode, ast.Str): valid = False #elif (isinstance(lhsnode, ast.Attribute) # and isinstance(rhsnode, ast.Attribute)): # klhs = self.get_attr_key(lhsnode) # krhs = self.get_attr_key(rhsnode) # valid = klhs != krhs if not valid: s = self.get_fragment(node.col_offset) raise SyntaxError('Invalid comparison: %s' % s) lhsnode = node.left lhs = self.evaluate(lhsnode) result = True for op, rhsnode in zip(node.ops, node.comparators): sanity_check(lhsnode, rhsnode) op = op.__class__.__name__.lower() if op not in self.operators: raise SyntaxError('unsupported operation: %r' % op) rhs = self.evaluate(rhsnode) result = self.operators[op](lhs, rhs) if not result: break lhs = rhs lhsnode = rhsnode return result def do_expression(self, node): return self.evaluate(node.body) def do_name(self, node): valid = False if node.id in self.context: valid = True result = self.context[node.id] elif node.id in self.allowed_values: valid = True result = self.allowed_values[node.id] if not valid: raise SyntaxError('invalid expression: %s' % node.id) return result def do_str(self, node): return node.s def interpret(marker, execution_context=None): """ Interpret a marker and return a result depending on environment. :param marker: The marker to interpret. :type marker: str :param execution_context: The context used for name lookup. :type execution_context: mapping """ return Evaluator(execution_context).evaluate(marker.strip()) site-packages/pip/_vendor/distlib/markers.pyc000064400000017757147204247350015354 0ustar00 abc@sdZddlZddlZddlZddlZddlmZmZddlm Z dgZ de fdYZ dd ZdS( sEParser for the environment markers micro-language defined in PEP 345.iNi(tpython_implementationt string_types(tin_venvt interprett EvaluatorcBs^eZdZi dd6dd6dd6dd6d d 6d d 6d d6dd6dd6Zi ejd6dejd d6ejjdddd6e j d6e e d6ej d6ejd6ejd6ed 6Zd,d!Zd"Zd#Zd,d$Zd%Zd&Zd'Zd(Zd)Zd*Zd+ZRS(-s5 A limited evaluator for Python expressions. cCs ||kS(N((txty((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyttteqcCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRRtgtcCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRRtgtecCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRRtincCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRRtltcCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRRtltecCs| S(N((R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyR RtnotcCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyR!RtnoteqcCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyR"Rtnotint sys_platforms%s.%sitpython_versiont iitpython_full_versiontos_nametplatform_in_venvtplatform_releasetplatform_versiontplatform_machinetplatform_python_implementationcCs|p i|_d|_dS(su Initialise an instance. :param context: If specified, names are looked up in this mapping. N(tcontexttNonetsource(tselfR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt__init__3scCsHd}d|j|||!}||t|jkrD|d7}n|S(sH Get the part of the source which is causing a problem. i s%rs...(Rtlen(Rtoffsett fragment_lents((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt get_fragment<s  cCst|d|dS(s@ Get a handler for the specified AST node type. sdo_%sN(tgetattrR(Rt node_type((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt get_handlerFscCst|tr||_idd6}|r8||dRtallowed_valuesR/(RR4tvalidtkeytresult((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt do_attributejs  cCs|j|jd}|jjtjk}|jjtjk}|sR|sRt|r^|sk|r| rxD|jdD]2}|j|}|r|s|ry| ryPqyqyWn|S(Nii(R8tvaluestopR0R-tOrtAndR:(RR4RDtis_ortis_andtn((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt do_boolopxs c sfd}j}j|}t}xtjjD]\}}||||jjj}|j krt d|nj|}j |||}|sPn|}|}qFW|S(Ncsbt}t|tjr3t|tjr3t}n|s^jj}td|ndS(NsInvalid comparison: %s(tTrueR,R-tStrR@R%R3R/(tlhsnodetrhsnodeRBR$(R4R(s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt sanity_checks $ sunsupported operation: %r( tleftR8RNtziptopst comparatorsR0R1R2t operatorsR/( RR4RRRPtlhsRDRGRQtrhs((R4Rs?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt do_compares  "  cCs|j|jS(N(R8tbody(RR4((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt do_expressionscCs|t}|j|jkr1t}|j|j}n+|j|jkr\t}|j|j}n|sxtd|jn|S(Nsinvalid expression: %s(R@R<RRNRAR/(RR4RBRD((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pytdo_namescCs|jS(N(R$(RR4((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pytdo_strsN(R1t __module__t__doc__RWtsystplatformt version_infotversiontsplittostnametstrRtreleasetmachineRRARR R%R(R8R>RERMRZR\R]R^(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRs@                      cCst|j|jS(s Interpret a marker and return a result depending on environment. :param marker: The marker to interpret. :type marker: str :param execution_context: The context used for name lookup. :type execution_context: mapping (RR8tstrip(tmarkertexecution_context((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRs (R`R-RfRaRbtcompatRRtutilRt__all__tobjectRRR(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyts     site-packages/pip/_vendor/distlib/markers.pyo000064400000017557147204247350015366 0ustar00 abc@sdZddlZddlZddlZddlZddlmZmZddlm Z dgZ de fdYZ dd ZdS( sEParser for the environment markers micro-language defined in PEP 345.iNi(tpython_implementationt string_types(tin_venvt interprett EvaluatorcBs^eZdZi dd6dd6dd6dd6d d 6d d 6d d6dd6dd6Zi ejd6dejd d6ejjdddd6e j d6e e d6ej d6ejd6ejd6ed 6Zd,d!Zd"Zd#Zd,d$Zd%Zd&Zd'Zd(Zd)Zd*Zd+ZRS(-s5 A limited evaluator for Python expressions. cCs ||kS(N((txty((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyttteqcCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRRtgtcCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRRtgtecCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRRtincCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRRtltcCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRRtltecCs| S(N((R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyR RtnotcCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyR!RtnoteqcCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyR"Rtnotint sys_platforms%s.%sitpython_versiont iitpython_full_versiontos_nametplatform_in_venvtplatform_releasetplatform_versiontplatform_machinetplatform_python_implementationcCs|p i|_d|_dS(su Initialise an instance. :param context: If specified, names are looked up in this mapping. N(tcontexttNonetsource(tselfR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt__init__3scCsHd}d|j|||!}||t|jkrD|d7}n|S(sH Get the part of the source which is causing a problem. i s%rs...(Rtlen(Rtoffsett fragment_lents((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt get_fragment<s  cCst|d|dS(s@ Get a handler for the specified AST node type. sdo_%sN(tgetattrR(Rt node_type((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt get_handlerFscCst|tr||_idd6}|r8||dR%R3R/(tlhsnodetrhsnodeR@R$(R4R(s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt sanity_checks $ sunsupported operation: %r( tleftR8RLtziptopst comparatorsR0R1R2t operatorsR/( RR4RPRNtlhsRBREROtrhs((R4Rs?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt do_compares  "  cCs|j|jS(N(R8tbody(RR4((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt do_expressionscCs|t}|j|jkr1t}|j|j}n+|j|jkr\t}|j|j}n|sxtd|jn|S(Nsinvalid expression: %s(R>R:RRLR?R/(RR4R@RB((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pytdo_namescCs|jS(N(R$(RR4((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pytdo_strsN(R1t __module__t__doc__RUtsystplatformt version_infotversiontsplittostnametstrRtreleasetmachineRR?RR R%R(R8R<RCRKRXRZR[R\(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRs@                      cCst|j|jS(s Interpret a marker and return a result depending on environment. :param marker: The marker to interpret. :type marker: str :param execution_context: The context used for name lookup. :type execution_context: mapping (RR8tstrip(tmarkertexecution_context((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRs (R^R-RdR_R`tcompatRRtutilRt__all__tobjectRRR(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyts     site-packages/pip/_vendor/distlib/metadata.py000064400000113661147204247350015314 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # """Implementation of the Metadata for Python packages PEPs. Supports all metadata formats (1.0, 1.1, 1.2, and 2.0 experimental). """ from __future__ import unicode_literals import codecs from email import message_from_file import json import logging import re from . import DistlibException, __version__ from .compat import StringIO, string_types, text_type from .markers import interpret from .util import extract_by_key, get_extras from .version import get_scheme, PEP440_VERSION_RE logger = logging.getLogger(__name__) class MetadataMissingError(DistlibException): """A required metadata is missing""" class MetadataConflictError(DistlibException): """Attempt to read or write metadata fields that are conflictual.""" class MetadataUnrecognizedVersionError(DistlibException): """Unknown metadata version number.""" class MetadataInvalidError(DistlibException): """A metadata value is invalid""" # public API of this module __all__ = ['Metadata', 'PKG_INFO_ENCODING', 'PKG_INFO_PREFERRED_VERSION'] # Encoding used for the PKG-INFO files PKG_INFO_ENCODING = 'utf-8' # preferred version. Hopefully will be changed # to 1.2 once PEP 345 is supported everywhere PKG_INFO_PREFERRED_VERSION = '1.1' _LINE_PREFIX_1_2 = re.compile('\n \|') _LINE_PREFIX_PRE_1_2 = re.compile('\n ') _241_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', 'Summary', 'Description', 'Keywords', 'Home-page', 'Author', 'Author-email', 'License') _314_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', 'Supported-Platform', 'Summary', 'Description', 'Keywords', 'Home-page', 'Author', 'Author-email', 'License', 'Classifier', 'Download-URL', 'Obsoletes', 'Provides', 'Requires') _314_MARKERS = ('Obsoletes', 'Provides', 'Requires', 'Classifier', 'Download-URL') _345_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', 'Supported-Platform', 'Summary', 'Description', 'Keywords', 'Home-page', 'Author', 'Author-email', 'Maintainer', 'Maintainer-email', 'License', 'Classifier', 'Download-URL', 'Obsoletes-Dist', 'Project-URL', 'Provides-Dist', 'Requires-Dist', 'Requires-Python', 'Requires-External') _345_MARKERS = ('Provides-Dist', 'Requires-Dist', 'Requires-Python', 'Obsoletes-Dist', 'Requires-External', 'Maintainer', 'Maintainer-email', 'Project-URL') _426_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', 'Supported-Platform', 'Summary', 'Description', 'Keywords', 'Home-page', 'Author', 'Author-email', 'Maintainer', 'Maintainer-email', 'License', 'Classifier', 'Download-URL', 'Obsoletes-Dist', 'Project-URL', 'Provides-Dist', 'Requires-Dist', 'Requires-Python', 'Requires-External', 'Private-Version', 'Obsoleted-By', 'Setup-Requires-Dist', 'Extension', 'Provides-Extra') _426_MARKERS = ('Private-Version', 'Provides-Extra', 'Obsoleted-By', 'Setup-Requires-Dist', 'Extension') _ALL_FIELDS = set() _ALL_FIELDS.update(_241_FIELDS) _ALL_FIELDS.update(_314_FIELDS) _ALL_FIELDS.update(_345_FIELDS) _ALL_FIELDS.update(_426_FIELDS) EXTRA_RE = re.compile(r'''extra\s*==\s*("([^"]+)"|'([^']+)')''') def _version2fieldlist(version): if version == '1.0': return _241_FIELDS elif version == '1.1': return _314_FIELDS elif version == '1.2': return _345_FIELDS elif version == '2.0': return _426_FIELDS raise MetadataUnrecognizedVersionError(version) def _best_version(fields): """Detect the best version depending on the fields used.""" def _has_marker(keys, markers): for marker in markers: if marker in keys: return True return False keys = [] for key, value in fields.items(): if value in ([], 'UNKNOWN', None): continue keys.append(key) possible_versions = ['1.0', '1.1', '1.2', '2.0'] # first let's try to see if a field is not part of one of the version for key in keys: if key not in _241_FIELDS and '1.0' in possible_versions: possible_versions.remove('1.0') if key not in _314_FIELDS and '1.1' in possible_versions: possible_versions.remove('1.1') if key not in _345_FIELDS and '1.2' in possible_versions: possible_versions.remove('1.2') if key not in _426_FIELDS and '2.0' in possible_versions: possible_versions.remove('2.0') # possible_version contains qualified versions if len(possible_versions) == 1: return possible_versions[0] # found ! elif len(possible_versions) == 0: raise MetadataConflictError('Unknown metadata set') # let's see if one unique marker is found is_1_1 = '1.1' in possible_versions and _has_marker(keys, _314_MARKERS) is_1_2 = '1.2' in possible_versions and _has_marker(keys, _345_MARKERS) is_2_0 = '2.0' in possible_versions and _has_marker(keys, _426_MARKERS) if int(is_1_1) + int(is_1_2) + int(is_2_0) > 1: raise MetadataConflictError('You used incompatible 1.1/1.2/2.0 fields') # we have the choice, 1.0, or 1.2, or 2.0 # - 1.0 has a broken Summary field but works with all tools # - 1.1 is to avoid # - 1.2 fixes Summary but has little adoption # - 2.0 adds more features and is very new if not is_1_1 and not is_1_2 and not is_2_0: # we couldn't find any specific marker if PKG_INFO_PREFERRED_VERSION in possible_versions: return PKG_INFO_PREFERRED_VERSION if is_1_1: return '1.1' if is_1_2: return '1.2' return '2.0' _ATTR2FIELD = { 'metadata_version': 'Metadata-Version', 'name': 'Name', 'version': 'Version', 'platform': 'Platform', 'supported_platform': 'Supported-Platform', 'summary': 'Summary', 'description': 'Description', 'keywords': 'Keywords', 'home_page': 'Home-page', 'author': 'Author', 'author_email': 'Author-email', 'maintainer': 'Maintainer', 'maintainer_email': 'Maintainer-email', 'license': 'License', 'classifier': 'Classifier', 'download_url': 'Download-URL', 'obsoletes_dist': 'Obsoletes-Dist', 'provides_dist': 'Provides-Dist', 'requires_dist': 'Requires-Dist', 'setup_requires_dist': 'Setup-Requires-Dist', 'requires_python': 'Requires-Python', 'requires_external': 'Requires-External', 'requires': 'Requires', 'provides': 'Provides', 'obsoletes': 'Obsoletes', 'project_url': 'Project-URL', 'private_version': 'Private-Version', 'obsoleted_by': 'Obsoleted-By', 'extension': 'Extension', 'provides_extra': 'Provides-Extra', } _PREDICATE_FIELDS = ('Requires-Dist', 'Obsoletes-Dist', 'Provides-Dist') _VERSIONS_FIELDS = ('Requires-Python',) _VERSION_FIELDS = ('Version',) _LISTFIELDS = ('Platform', 'Classifier', 'Obsoletes', 'Requires', 'Provides', 'Obsoletes-Dist', 'Provides-Dist', 'Requires-Dist', 'Requires-External', 'Project-URL', 'Supported-Platform', 'Setup-Requires-Dist', 'Provides-Extra', 'Extension') _LISTTUPLEFIELDS = ('Project-URL',) _ELEMENTSFIELD = ('Keywords',) _UNICODEFIELDS = ('Author', 'Maintainer', 'Summary', 'Description') _MISSING = object() _FILESAFE = re.compile('[^A-Za-z0-9.]+') def _get_name_and_version(name, version, for_filename=False): """Return the distribution name with version. If for_filename is true, return a filename-escaped form.""" if for_filename: # For both name and version any runs of non-alphanumeric or '.' # characters are replaced with a single '-'. Additionally any # spaces in the version string become '.' name = _FILESAFE.sub('-', name) version = _FILESAFE.sub('-', version.replace(' ', '.')) return '%s-%s' % (name, version) class LegacyMetadata(object): """The legacy metadata of a release. Supports versions 1.0, 1.1 and 1.2 (auto-detected). You can instantiate the class with one of these arguments (or none): - *path*, the path to a metadata file - *fileobj* give a file-like object with metadata as content - *mapping* is a dict-like object - *scheme* is a version scheme name """ # TODO document the mapping API and UNKNOWN default key def __init__(self, path=None, fileobj=None, mapping=None, scheme='default'): if [path, fileobj, mapping].count(None) < 2: raise TypeError('path, fileobj and mapping are exclusive') self._fields = {} self.requires_files = [] self._dependencies = None self.scheme = scheme if path is not None: self.read(path) elif fileobj is not None: self.read_file(fileobj) elif mapping is not None: self.update(mapping) self.set_metadata_version() def set_metadata_version(self): self._fields['Metadata-Version'] = _best_version(self._fields) def _write_field(self, fileobj, name, value): fileobj.write('%s: %s\n' % (name, value)) def __getitem__(self, name): return self.get(name) def __setitem__(self, name, value): return self.set(name, value) def __delitem__(self, name): field_name = self._convert_name(name) try: del self._fields[field_name] except KeyError: raise KeyError(name) def __contains__(self, name): return (name in self._fields or self._convert_name(name) in self._fields) def _convert_name(self, name): if name in _ALL_FIELDS: return name name = name.replace('-', '_').lower() return _ATTR2FIELD.get(name, name) def _default_value(self, name): if name in _LISTFIELDS or name in _ELEMENTSFIELD: return [] return 'UNKNOWN' def _remove_line_prefix(self, value): if self.metadata_version in ('1.0', '1.1'): return _LINE_PREFIX_PRE_1_2.sub('\n', value) else: return _LINE_PREFIX_1_2.sub('\n', value) def __getattr__(self, name): if name in _ATTR2FIELD: return self[name] raise AttributeError(name) # # Public API # # dependencies = property(_get_dependencies, _set_dependencies) def get_fullname(self, filesafe=False): """Return the distribution name with version. If filesafe is true, return a filename-escaped form.""" return _get_name_and_version(self['Name'], self['Version'], filesafe) def is_field(self, name): """return True if name is a valid metadata key""" name = self._convert_name(name) return name in _ALL_FIELDS def is_multi_field(self, name): name = self._convert_name(name) return name in _LISTFIELDS def read(self, filepath): """Read the metadata values from a file path.""" fp = codecs.open(filepath, 'r', encoding='utf-8') try: self.read_file(fp) finally: fp.close() def read_file(self, fileob): """Read the metadata values from a file object.""" msg = message_from_file(fileob) self._fields['Metadata-Version'] = msg['metadata-version'] # When reading, get all the fields we can for field in _ALL_FIELDS: if field not in msg: continue if field in _LISTFIELDS: # we can have multiple lines values = msg.get_all(field) if field in _LISTTUPLEFIELDS and values is not None: values = [tuple(value.split(',')) for value in values] self.set(field, values) else: # single line value = msg[field] if value is not None and value != 'UNKNOWN': self.set(field, value) self.set_metadata_version() def write(self, filepath, skip_unknown=False): """Write the metadata fields to filepath.""" fp = codecs.open(filepath, 'w', encoding='utf-8') try: self.write_file(fp, skip_unknown) finally: fp.close() def write_file(self, fileobject, skip_unknown=False): """Write the PKG-INFO format data to a file object.""" self.set_metadata_version() for field in _version2fieldlist(self['Metadata-Version']): values = self.get(field) if skip_unknown and values in ('UNKNOWN', [], ['UNKNOWN']): continue if field in _ELEMENTSFIELD: self._write_field(fileobject, field, ','.join(values)) continue if field not in _LISTFIELDS: if field == 'Description': if self.metadata_version in ('1.0', '1.1'): values = values.replace('\n', '\n ') else: values = values.replace('\n', '\n |') values = [values] if field in _LISTTUPLEFIELDS: values = [','.join(value) for value in values] for value in values: self._write_field(fileobject, field, value) def update(self, other=None, **kwargs): """Set metadata values from the given iterable `other` and kwargs. Behavior is like `dict.update`: If `other` has a ``keys`` method, they are looped over and ``self[key]`` is assigned ``other[key]``. Else, ``other`` is an iterable of ``(key, value)`` iterables. Keys that don't match a metadata field or that have an empty value are dropped. """ def _set(key, value): if key in _ATTR2FIELD and value: self.set(self._convert_name(key), value) if not other: # other is None or empty container pass elif hasattr(other, 'keys'): for k in other.keys(): _set(k, other[k]) else: for k, v in other: _set(k, v) if kwargs: for k, v in kwargs.items(): _set(k, v) def set(self, name, value): """Control then set a metadata field.""" name = self._convert_name(name) if ((name in _ELEMENTSFIELD or name == 'Platform') and not isinstance(value, (list, tuple))): if isinstance(value, string_types): value = [v.strip() for v in value.split(',')] else: value = [] elif (name in _LISTFIELDS and not isinstance(value, (list, tuple))): if isinstance(value, string_types): value = [value] else: value = [] if logger.isEnabledFor(logging.WARNING): project_name = self['Name'] scheme = get_scheme(self.scheme) if name in _PREDICATE_FIELDS and value is not None: for v in value: # check that the values are valid if not scheme.is_valid_matcher(v.split(';')[0]): logger.warning( "'%s': '%s' is not valid (field '%s')", project_name, v, name) # FIXME this rejects UNKNOWN, is that right? elif name in _VERSIONS_FIELDS and value is not None: if not scheme.is_valid_constraint_list(value): logger.warning("'%s': '%s' is not a valid version (field '%s')", project_name, value, name) elif name in _VERSION_FIELDS and value is not None: if not scheme.is_valid_version(value): logger.warning("'%s': '%s' is not a valid version (field '%s')", project_name, value, name) if name in _UNICODEFIELDS: if name == 'Description': value = self._remove_line_prefix(value) self._fields[name] = value def get(self, name, default=_MISSING): """Get a metadata field.""" name = self._convert_name(name) if name not in self._fields: if default is _MISSING: default = self._default_value(name) return default if name in _UNICODEFIELDS: value = self._fields[name] return value elif name in _LISTFIELDS: value = self._fields[name] if value is None: return [] res = [] for val in value: if name not in _LISTTUPLEFIELDS: res.append(val) else: # That's for Project-URL res.append((val[0], val[1])) return res elif name in _ELEMENTSFIELD: value = self._fields[name] if isinstance(value, string_types): return value.split(',') return self._fields[name] def check(self, strict=False): """Check if the metadata is compliant. If strict is True then raise if no Name or Version are provided""" self.set_metadata_version() # XXX should check the versions (if the file was loaded) missing, warnings = [], [] for attr in ('Name', 'Version'): # required by PEP 345 if attr not in self: missing.append(attr) if strict and missing != []: msg = 'missing required metadata: %s' % ', '.join(missing) raise MetadataMissingError(msg) for attr in ('Home-page', 'Author'): if attr not in self: missing.append(attr) # checking metadata 1.2 (XXX needs to check 1.1, 1.0) if self['Metadata-Version'] != '1.2': return missing, warnings scheme = get_scheme(self.scheme) def are_valid_constraints(value): for v in value: if not scheme.is_valid_matcher(v.split(';')[0]): return False return True for fields, controller in ((_PREDICATE_FIELDS, are_valid_constraints), (_VERSIONS_FIELDS, scheme.is_valid_constraint_list), (_VERSION_FIELDS, scheme.is_valid_version)): for field in fields: value = self.get(field, None) if value is not None and not controller(value): warnings.append("Wrong value for '%s': %s" % (field, value)) return missing, warnings def todict(self, skip_missing=False): """Return fields as a dict. Field names will be converted to use the underscore-lowercase style instead of hyphen-mixed case (i.e. home_page instead of Home-page). """ self.set_metadata_version() mapping_1_0 = ( ('metadata_version', 'Metadata-Version'), ('name', 'Name'), ('version', 'Version'), ('summary', 'Summary'), ('home_page', 'Home-page'), ('author', 'Author'), ('author_email', 'Author-email'), ('license', 'License'), ('description', 'Description'), ('keywords', 'Keywords'), ('platform', 'Platform'), ('classifiers', 'Classifier'), ('download_url', 'Download-URL'), ) data = {} for key, field_name in mapping_1_0: if not skip_missing or field_name in self._fields: data[key] = self[field_name] if self['Metadata-Version'] == '1.2': mapping_1_2 = ( ('requires_dist', 'Requires-Dist'), ('requires_python', 'Requires-Python'), ('requires_external', 'Requires-External'), ('provides_dist', 'Provides-Dist'), ('obsoletes_dist', 'Obsoletes-Dist'), ('project_url', 'Project-URL'), ('maintainer', 'Maintainer'), ('maintainer_email', 'Maintainer-email'), ) for key, field_name in mapping_1_2: if not skip_missing or field_name in self._fields: if key != 'project_url': data[key] = self[field_name] else: data[key] = [','.join(u) for u in self[field_name]] elif self['Metadata-Version'] == '1.1': mapping_1_1 = ( ('provides', 'Provides'), ('requires', 'Requires'), ('obsoletes', 'Obsoletes'), ) for key, field_name in mapping_1_1: if not skip_missing or field_name in self._fields: data[key] = self[field_name] return data def add_requirements(self, requirements): if self['Metadata-Version'] == '1.1': # we can't have 1.1 metadata *and* Setuptools requires for field in ('Obsoletes', 'Requires', 'Provides'): if field in self: del self[field] self['Requires-Dist'] += requirements # Mapping API # TODO could add iter* variants def keys(self): return list(_version2fieldlist(self['Metadata-Version'])) def __iter__(self): for key in self.keys(): yield key def values(self): return [self[key] for key in self.keys()] def items(self): return [(key, self[key]) for key in self.keys()] def __repr__(self): return '<%s %s %s>' % (self.__class__.__name__, self.name, self.version) METADATA_FILENAME = 'pydist.json' WHEEL_METADATA_FILENAME = 'metadata.json' class Metadata(object): """ The metadata of a release. This implementation uses 2.0 (JSON) metadata where possible. If not possible, it wraps a LegacyMetadata instance which handles the key-value metadata format. """ METADATA_VERSION_MATCHER = re.compile('^\d+(\.\d+)*$') NAME_MATCHER = re.compile('^[0-9A-Z]([0-9A-Z_.-]*[0-9A-Z])?$', re.I) VERSION_MATCHER = PEP440_VERSION_RE SUMMARY_MATCHER = re.compile('.{1,2047}') METADATA_VERSION = '2.0' GENERATOR = 'distlib (%s)' % __version__ MANDATORY_KEYS = { 'name': (), 'version': (), 'summary': ('legacy',), } INDEX_KEYS = ('name version license summary description author ' 'author_email keywords platform home_page classifiers ' 'download_url') DEPENDENCY_KEYS = ('extras run_requires test_requires build_requires ' 'dev_requires provides meta_requires obsoleted_by ' 'supports_environments') SYNTAX_VALIDATORS = { 'metadata_version': (METADATA_VERSION_MATCHER, ()), 'name': (NAME_MATCHER, ('legacy',)), 'version': (VERSION_MATCHER, ('legacy',)), 'summary': (SUMMARY_MATCHER, ('legacy',)), } __slots__ = ('_legacy', '_data', 'scheme') def __init__(self, path=None, fileobj=None, mapping=None, scheme='default'): if [path, fileobj, mapping].count(None) < 2: raise TypeError('path, fileobj and mapping are exclusive') self._legacy = None self._data = None self.scheme = scheme #import pdb; pdb.set_trace() if mapping is not None: try: self._validate_mapping(mapping, scheme) self._data = mapping except MetadataUnrecognizedVersionError: self._legacy = LegacyMetadata(mapping=mapping, scheme=scheme) self.validate() else: data = None if path: with open(path, 'rb') as f: data = f.read() elif fileobj: data = fileobj.read() if data is None: # Initialised with no args - to be added self._data = { 'metadata_version': self.METADATA_VERSION, 'generator': self.GENERATOR, } else: if not isinstance(data, text_type): data = data.decode('utf-8') try: self._data = json.loads(data) self._validate_mapping(self._data, scheme) except ValueError: # Note: MetadataUnrecognizedVersionError does not # inherit from ValueError (it's a DistlibException, # which should not inherit from ValueError). # The ValueError comes from the json.load - if that # succeeds and we get a validation error, we want # that to propagate self._legacy = LegacyMetadata(fileobj=StringIO(data), scheme=scheme) self.validate() common_keys = set(('name', 'version', 'license', 'keywords', 'summary')) none_list = (None, list) none_dict = (None, dict) mapped_keys = { 'run_requires': ('Requires-Dist', list), 'build_requires': ('Setup-Requires-Dist', list), 'dev_requires': none_list, 'test_requires': none_list, 'meta_requires': none_list, 'extras': ('Provides-Extra', list), 'modules': none_list, 'namespaces': none_list, 'exports': none_dict, 'commands': none_dict, 'classifiers': ('Classifier', list), 'source_url': ('Download-URL', None), 'metadata_version': ('Metadata-Version', None), } del none_list, none_dict def __getattribute__(self, key): common = object.__getattribute__(self, 'common_keys') mapped = object.__getattribute__(self, 'mapped_keys') if key in mapped: lk, maker = mapped[key] if self._legacy: if lk is None: result = None if maker is None else maker() else: result = self._legacy.get(lk) else: value = None if maker is None else maker() if key not in ('commands', 'exports', 'modules', 'namespaces', 'classifiers'): result = self._data.get(key, value) else: # special cases for PEP 459 sentinel = object() result = sentinel d = self._data.get('extensions') if d: if key == 'commands': result = d.get('python.commands', value) elif key == 'classifiers': d = d.get('python.details') if d: result = d.get(key, value) else: d = d.get('python.exports') if not d: d = self._data.get('python.exports') if d: result = d.get(key, value) if result is sentinel: result = value elif key not in common: result = object.__getattribute__(self, key) elif self._legacy: result = self._legacy.get(key) else: result = self._data.get(key) return result def _validate_value(self, key, value, scheme=None): if key in self.SYNTAX_VALIDATORS: pattern, exclusions = self.SYNTAX_VALIDATORS[key] if (scheme or self.scheme) not in exclusions: m = pattern.match(value) if not m: raise MetadataInvalidError("'%s' is an invalid value for " "the '%s' property" % (value, key)) def __setattr__(self, key, value): self._validate_value(key, value) common = object.__getattribute__(self, 'common_keys') mapped = object.__getattribute__(self, 'mapped_keys') if key in mapped: lk, _ = mapped[key] if self._legacy: if lk is None: raise NotImplementedError self._legacy[lk] = value elif key not in ('commands', 'exports', 'modules', 'namespaces', 'classifiers'): self._data[key] = value else: # special cases for PEP 459 d = self._data.setdefault('extensions', {}) if key == 'commands': d['python.commands'] = value elif key == 'classifiers': d = d.setdefault('python.details', {}) d[key] = value else: d = d.setdefault('python.exports', {}) d[key] = value elif key not in common: object.__setattr__(self, key, value) else: if key == 'keywords': if isinstance(value, string_types): value = value.strip() if value: value = value.split() else: value = [] if self._legacy: self._legacy[key] = value else: self._data[key] = value @property def name_and_version(self): return _get_name_and_version(self.name, self.version, True) @property def provides(self): if self._legacy: result = self._legacy['Provides-Dist'] else: result = self._data.setdefault('provides', []) s = '%s (%s)' % (self.name, self.version) if s not in result: result.append(s) return result @provides.setter def provides(self, value): if self._legacy: self._legacy['Provides-Dist'] = value else: self._data['provides'] = value def get_requirements(self, reqts, extras=None, env=None): """ Base method to get dependencies, given a set of extras to satisfy and an optional environment context. :param reqts: A list of sometimes-wanted dependencies, perhaps dependent on extras and environment. :param extras: A list of optional components being requested. :param env: An optional environment for marker evaluation. """ if self._legacy: result = reqts else: result = [] extras = get_extras(extras or [], self.extras) for d in reqts: if 'extra' not in d and 'environment' not in d: # unconditional include = True else: if 'extra' not in d: # Not extra-dependent - only environment-dependent include = True else: include = d.get('extra') in extras if include: # Not excluded because of extras, check environment marker = d.get('environment') if marker: include = interpret(marker, env) if include: result.extend(d['requires']) for key in ('build', 'dev', 'test'): e = ':%s:' % key if e in extras: extras.remove(e) # A recursive call, but it should terminate since 'test' # has been removed from the extras reqts = self._data.get('%s_requires' % key, []) result.extend(self.get_requirements(reqts, extras=extras, env=env)) return result @property def dictionary(self): if self._legacy: return self._from_legacy() return self._data @property def dependencies(self): if self._legacy: raise NotImplementedError else: return extract_by_key(self._data, self.DEPENDENCY_KEYS) @dependencies.setter def dependencies(self, value): if self._legacy: raise NotImplementedError else: self._data.update(value) def _validate_mapping(self, mapping, scheme): if mapping.get('metadata_version') != self.METADATA_VERSION: raise MetadataUnrecognizedVersionError() missing = [] for key, exclusions in self.MANDATORY_KEYS.items(): if key not in mapping: if scheme not in exclusions: missing.append(key) if missing: msg = 'Missing metadata items: %s' % ', '.join(missing) raise MetadataMissingError(msg) for k, v in mapping.items(): self._validate_value(k, v, scheme) def validate(self): if self._legacy: missing, warnings = self._legacy.check(True) if missing or warnings: logger.warning('Metadata: missing: %s, warnings: %s', missing, warnings) else: self._validate_mapping(self._data, self.scheme) def todict(self): if self._legacy: return self._legacy.todict(True) else: result = extract_by_key(self._data, self.INDEX_KEYS) return result def _from_legacy(self): assert self._legacy and not self._data result = { 'metadata_version': self.METADATA_VERSION, 'generator': self.GENERATOR, } lmd = self._legacy.todict(True) # skip missing ones for k in ('name', 'version', 'license', 'summary', 'description', 'classifier'): if k in lmd: if k == 'classifier': nk = 'classifiers' else: nk = k result[nk] = lmd[k] kw = lmd.get('Keywords', []) if kw == ['']: kw = [] result['keywords'] = kw keys = (('requires_dist', 'run_requires'), ('setup_requires_dist', 'build_requires')) for ok, nk in keys: if ok in lmd and lmd[ok]: result[nk] = [{'requires': lmd[ok]}] result['provides'] = self.provides author = {} maintainer = {} return result LEGACY_MAPPING = { 'name': 'Name', 'version': 'Version', 'license': 'License', 'summary': 'Summary', 'description': 'Description', 'classifiers': 'Classifier', } def _to_legacy(self): def process_entries(entries): reqts = set() for e in entries: extra = e.get('extra') env = e.get('environment') rlist = e['requires'] for r in rlist: if not env and not extra: reqts.add(r) else: marker = '' if extra: marker = 'extra == "%s"' % extra if env: if marker: marker = '(%s) and %s' % (env, marker) else: marker = env reqts.add(';'.join((r, marker))) return reqts assert self._data and not self._legacy result = LegacyMetadata() nmd = self._data for nk, ok in self.LEGACY_MAPPING.items(): if nk in nmd: result[ok] = nmd[nk] r1 = process_entries(self.run_requires + self.meta_requires) r2 = process_entries(self.build_requires + self.dev_requires) if self.extras: result['Provides-Extra'] = sorted(self.extras) result['Requires-Dist'] = sorted(r1) result['Setup-Requires-Dist'] = sorted(r2) # TODO: other fields such as contacts return result def write(self, path=None, fileobj=None, legacy=False, skip_unknown=True): if [path, fileobj].count(None) != 1: raise ValueError('Exactly one of path and fileobj is needed') self.validate() if legacy: if self._legacy: legacy_md = self._legacy else: legacy_md = self._to_legacy() if path: legacy_md.write(path, skip_unknown=skip_unknown) else: legacy_md.write_file(fileobj, skip_unknown=skip_unknown) else: if self._legacy: d = self._from_legacy() else: d = self._data if fileobj: json.dump(d, fileobj, ensure_ascii=True, indent=2, sort_keys=True) else: with codecs.open(path, 'w', 'utf-8') as f: json.dump(d, f, ensure_ascii=True, indent=2, sort_keys=True) def add_requirements(self, requirements): if self._legacy: self._legacy.add_requirements(requirements) else: run_requires = self._data.setdefault('run_requires', []) always = None for entry in run_requires: if 'environment' not in entry and 'extra' not in entry: always = entry break if always is None: always = { 'requires': requirements } run_requires.insert(0, always) else: rset = set(always['requires']) | set(requirements) always['requires'] = sorted(rset) def __repr__(self): name = self.name or '(no name)' version = self.version or 'no version' return '<%s %s %s (%s)>' % (self.__class__.__name__, self.metadata_version, name, version) site-packages/pip/_vendor/distlib/metadata.pyc000064400000104512147204247350015452 0ustar00 abc@sdZddlmZddlZddlmZddlZddlZddlZddl m Z m Z ddl m Z mZmZddlmZdd lmZmZdd lmZmZejeZd e fd YZd e fdYZde fdYZde fdYZdddgZdZ dZ!ej"dZ#ej"dZ$ddddddd d!d"d#d$f Z%ddddd%ddd d!d"d#d$d&d'd(d)d*fZ&d(d)d*d&d'fZ'ddddd%ddd d!d"d#d+d,d$d&d'd-d.d/d0d1d2fZ(d/d0d1d-d2d+d,d.fZ)ddddd%ddd d!d"d#d+d,d$d&d'd-d.d/d0d1d2d3d4d5d6d7fZ*d3d7d4d5d6fZ+e,Z-e-j.e%e-j.e&e-j.e(e-j.e*ej"d8Z/d9Z0d:Z1idd;6dd<6dd=6dd>6d%d?6dd@6ddA6d dB6d!dC6d"dD6d#dE6d+dF6d,dG6d$dH6d&dI6d'dJ6d-dK6d/dL6d0dM6d5dN6d1dO6d2dP6d*dQ6d)dR6d(dS6d.dT6d3dU6d4dV6d6dW6d7dX6Z2d0d-d/fZ3d1fZ4dfZ5dd&d(d*d)d-d/d0d2d.d%d5d7d6fZ6d.fZ7d fZ8d"d+ddfZ9e:Z;ej"dYZ<e=dZZ>d[e:fd\YZ?d]Z@d^ZAd_e:fd`YZBdS(auImplementation of the Metadata for Python packages PEPs. Supports all metadata formats (1.0, 1.1, 1.2, and 2.0 experimental). i(tunicode_literalsN(tmessage_from_filei(tDistlibExceptiont __version__(tStringIOt string_typest text_type(t interpret(textract_by_keyt get_extras(t get_schemetPEP440_VERSION_REtMetadataMissingErrorcBseZdZRS(uA required metadata is missing(t__name__t __module__t__doc__(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyR stMetadataConflictErrorcBseZdZRS(u>Attempt to read or write metadata fields that are conflictual.(R RR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyR st MetadataUnrecognizedVersionErrorcBseZdZRS(u Unknown metadata version number.(R RR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyR$stMetadataInvalidErrorcBseZdZRS(uA metadata value is invalid(R RR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyR(suMetadatauPKG_INFO_ENCODINGuPKG_INFO_PREFERRED_VERSIONuutf-8u1.1u \|u uMetadata-VersionuNameuVersionuPlatformuSummaryu DescriptionuKeywordsu Home-pageuAuthoru Author-emailuLicenseuSupported-Platformu Classifieru Download-URLu ObsoletesuProvidesuRequiresu MaintaineruMaintainer-emailuObsoletes-Distu Project-URLu Provides-Distu Requires-DistuRequires-PythonuRequires-ExternaluPrivate-Versionu Obsoleted-ByuSetup-Requires-Distu ExtensionuProvides-Extrau"extra\s*==\s*("([^"]+)"|'([^']+)')cCsP|dkrtS|dkr tS|dkr0tS|dkr@tSt|dS(Nu1.0u1.1u1.2u2.0(t _241_FIELDSt _314_FIELDSt _345_FIELDSt _426_FIELDSR(tversion((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt_version2fieldlistgs    c Csd}g}xB|jD]4\}}|gdd fkrCqn|j|qWddddg}x|D]}|tkrd|kr|jdn|tkrd|kr|jdn|tkrd|kr|jdn|tkrmd|krm|jdqmqmWt|dkr1|dSt|dkrRt d nd|koj||t }d|ko||t }d|ko||t }t |t |t |dkrt d n| r| r| rt|krtSn|r dS|rdSdS( u5Detect the best version depending on the fields used.cSs%x|D]}||krtSqWtS(N(tTruetFalse(tkeystmarkerstmarker((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt _has_markerus  uUNKNOWNu1.0u1.1u1.2u2.0iiuUnknown metadata setu(You used incompatible 1.1/1.2/2.0 fieldsN(titemstNonetappendRtremoveRRRtlenRt _314_MARKERSt _345_MARKERSt _426_MARKERStinttPKG_INFO_PREFERRED_VERSION( tfieldsRRtkeytvaluetpossible_versionstis_1_1tis_1_2tis_2_0((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt _best_versionssB  & umetadata_versionunameuversionuplatformusupported_platformusummaryu descriptionukeywordsu home_pageuauthoru author_emailu maintainerumaintainer_emailulicenseu classifieru download_urluobsoletes_distu provides_distu requires_distusetup_requires_disturequires_pythonurequires_externalurequiresuprovidesu obsoletesu project_urluprivate_versionu obsoleted_byu extensionuprovides_extrau[^A-Za-z0-9.]+cCsG|r9tjd|}tjd|jdd}nd||fS(uhReturn the distribution name with version. If for_filename is true, return a filename-escaped form.u-u u.u%s-%s(t _FILESAFEtsubtreplace(tnameRt for_filename((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt_get_name_and_versions!tLegacyMetadatacBs4eZdZdddddZdZdZdZdZdZ dZ d Z d Z d Z d Zed ZdZdZdZdZedZedZddZdZedZedZedZdZdZdZdZ dZ!dZ"RS( uaThe legacy metadata of a release. Supports versions 1.0, 1.1 and 1.2 (auto-detected). You can instantiate the class with one of these arguments (or none): - *path*, the path to a metadata file - *fileobj* give a file-like object with metadata as content - *mapping* is a dict-like object - *scheme* is a version scheme name udefaultcCs|||gjddkr-tdni|_g|_d|_||_|dk rm|j|nB|dk r|j|n&|dk r|j ||j ndS(Niu'path, fileobj and mapping are exclusive( tcountR t TypeErrort_fieldstrequires_filest _dependenciestschemetreadt read_filetupdatetset_metadata_version(tselftpathtfileobjtmappingR=((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt__init__s        cCst|j|jdJscCst|}|d|jdtj|ddd}z|j||Wd|jXdS(u&Write the metadata fields to filepath.uwRbuutf-8N(RcRdt write_fileRe(RBRft skip_unknownRg((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyRGhscCs<|jx+t|dD]}|j|}|rT|dgdgfkrTqn|tkr|j||dj|qn|tkr|dkr|jd kr|jdd}q|jdd }n|g}n|t krg|D]}dj|^q}nx!|D]}|j|||qWqWd S( u0Write the PKG-INFO format data to a file object.uMetadata-VersionuUNKNOWNu,u Descriptionu1.0u1.1u u u |N(u1.0u1.1( RARRIRVRHtjoinRURXR3Ri(RBt fileobjectRqRnRoR+((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyRpps$      % c sfd}|sn^t|drRxL|jD]}||||q4Wn$x!|D]\}}|||qYW|rx*|jD]\}}|||qWndS(uSet metadata values from the given iterable `other` and kwargs. Behavior is like `dict.update`: If `other` has a ``keys`` method, they are looped over and ``self[key]`` is assigned ``other[key]``. Else, ``other`` is an iterable of ``(key, value)`` iterables. Keys that don't match a metadata field or that have an empty value are dropped. cs2|tkr.|r.jj||ndS(N(RTRKRM(R*R+(RB(s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt_setsukeysN(thasattrRR(RBtothertkwargsRttktv((RBs@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyR@s cCs|j|}|tks'|dkrt|ttf rt|trwg|jdD]}|j^q\}qg}nF|tkrt|ttf rt|tr|g}qg}nt j t j r|d}t |j}|tkrR|d k rRx|D];}|j|jddst jd|||qqWq|tkr|d k r|j|st jd|||qq|tkr|d k r|j|st jd|||qqn|tkr|dkr|j|}qn||j|d?d@f }i}x;|D]3\}}| sf||jkrD|||||D]3\}}| sk||jkrI||||(t __class__R R4R(RB((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt__repr__msN(#R RRR RFRARHRJRLRPRQRMRWR[R]RR_R`RaR>R?RGRpR@RKRRIRRRRRRoRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyR7s>                     ,  , ;    u pydist.jsonu metadata.jsontMetadatacBseZdZejdZejdejZeZ ejdZ dZ de Z id>d6d?d6d@d 6Zd Zd ZiedAfd 6edBfd6e dCfd6e dDfd 6ZdEZdFdFdFddZedGZdFefZdFefZi defd6defd6ed6ed6ed6defd6ed6ed6ed6ed 6d!efd"6dHd$6dId 6Z[[d&ZdFd'Zd(Zed)Z ed*Z!e!j"d+Z!dFdFd,Z#ed-Z$ed.Z%e%j"d/Z%d0Z&d1Z'd2Z(d3Z)id4d6d5d6d6d6d7d 6d8d96d!d"6Z*d:Z+dFdFe,e-d;Z.d<Z/d=Z0RS(Ju The metadata of a release. This implementation uses 2.0 (JSON) metadata where possible. If not possible, it wraps a LegacyMetadata instance which handles the key-value metadata format. u ^\d+(\.\d+)*$u!^[0-9A-Z]([0-9A-Z_.-]*[0-9A-Z])?$u .{1,2047}u2.0u distlib (%s)unameuversionulegacyusummaryuqname version license summary description author author_email keywords platform home_page classifiers download_urluwextras run_requires test_requires build_requires dev_requires provides meta_requires obsoleted_by supports_environmentsumetadata_versionu_legacyu_datauschemeudefaultcCs|||gjddkr-tdnd|_d|_||_|dk ry|j||||_Wqtk rtd|d||_|j qXnd}|rt |d}|j }WdQXn|r|j }n|dkri|j d6|j d6|_nt|ts?|jd}ny)tj||_|j|j|Wn9tk rtd t|d||_|j nXdS( Niu'path, fileobj and mapping are exclusiveRER=urbumetadata_versionu generatoruutf-8RD(R8R R9t_legacyt_dataR=t_validate_mappingRR7tvalidateRdR>tMETADATA_VERSIONt GENERATORRzRtdecodetjsontloadst ValueErrorR(RBRCRDRER=Rtf((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyRFs>          ulicenseukeywordsu Requires-Distu run_requiresuSetup-Requires-Distubuild_requiresu dev_requiresu test_requiresu meta_requiresuProvides-Extrauextrasumodulesu namespacesuexportsucommandsu Classifieru classifiersu Download-URLu source_urluMetadata-Versionc Cstj|d}tj|d}||kr||\}}|jr|dkrs|dkrgdn|}q|jj|}q|dkrdn|}|d kr|jj||}qt}|}|jjd} | r|dkr| jd |}q|dkrH| jd } | r| j||}qq| jd } | sr|jjd } n| r| j||}qn||kr|}qnQ||krtj||}n0|jr|jj|}n|jj|}|S( Nu common_keysu mapped_keysucommandsuexportsumodulesu namespacesu classifiersu extensionsupython.commandsupython.detailsupython.exports(ucommandsuexportsumodulesu namespacesu classifiers(tobjectt__getattribute__RR RIR( RBR*tcommontmappedtlktmakertresultR+tsentineltd((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyRsF           cCso||jkrk|j|\}}|p.|j|krk|j|}|shtd||fqhqkndS(Nu.'%s' is an invalid value for the '%s' property(tSYNTAX_VALIDATORSR=tmatchR(RBR*R+R=tpatternt exclusionstm((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt_validate_valuescCs|j||tj|d}tj|d}||kr||\}}|jr~|dkrntn||j|               cCst|j|jtS(N(R6R4RR(RB((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pytname_and_version@scCsd|jr|jd}n|jjdg}d|j|jf}||kr`|j|n|S(Nu Provides-Distuprovidesu%s (%s)(RRRR4RR!(RBRts((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pytprovidesDs  cCs*|jr||jd}||krL|dkrsd }n|}||||d|kr>|}Pq>q>W|dkri|d6}|jd|n*t|dt|B}t||d(R4RRR RX(RBR4R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyR(s (((ulegacy((ulegacy(ulegacy(ulegacy(u_legacyu_datauschemeN(unameuversionulicenseukeywordsusummary(u Download-URLN(uMetadata-VersionN(1R RRtretcompiletMETADATA_VERSION_MATCHERtIt NAME_MATCHERR tVERSION_MATCHERtSUMMARY_MATCHERRRRRRRRt __slots__R RFRKt common_keysR{t none_listtdictt none_dictt mapped_keysRRRtpropertyRRtsetterRRRRRRRRRRRRGRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyRvs       ,         + ' *     % (CRt __future__RRctemailRRRRtRRtcompatRRRRRtutilRR RR R t getLoggerR R}R RRRt__all__tPKG_INFO_ENCODINGR(RRZRYRRR$RR%RR&RKRRR@tEXTRA_RERR0RTRRRRURiRVRRRR1RR6R7tMETADATA_FILENAMEtWHEEL_METADATA_FILENAMER(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt s                                         8            site-packages/pip/_vendor/distlib/metadata.pyo000064400000104362147204247350015471 0ustar00 abc@sdZddlmZddlZddlmZddlZddlZddlZddl m Z m Z ddl m Z mZmZddlmZdd lmZmZdd lmZmZejeZd e fd YZd e fdYZde fdYZde fdYZdddgZdZ dZ!ej"dZ#ej"dZ$ddddddd d!d"d#d$f Z%ddddd%ddd d!d"d#d$d&d'd(d)d*fZ&d(d)d*d&d'fZ'ddddd%ddd d!d"d#d+d,d$d&d'd-d.d/d0d1d2fZ(d/d0d1d-d2d+d,d.fZ)ddddd%ddd d!d"d#d+d,d$d&d'd-d.d/d0d1d2d3d4d5d6d7fZ*d3d7d4d5d6fZ+e,Z-e-j.e%e-j.e&e-j.e(e-j.e*ej"d8Z/d9Z0d:Z1idd;6dd<6dd=6dd>6d%d?6dd@6ddA6d dB6d!dC6d"dD6d#dE6d+dF6d,dG6d$dH6d&dI6d'dJ6d-dK6d/dL6d0dM6d5dN6d1dO6d2dP6d*dQ6d)dR6d(dS6d.dT6d3dU6d4dV6d6dW6d7dX6Z2d0d-d/fZ3d1fZ4dfZ5dd&d(d*d)d-d/d0d2d.d%d5d7d6fZ6d.fZ7d fZ8d"d+ddfZ9e:Z;ej"dYZ<e=dZZ>d[e:fd\YZ?d]Z@d^ZAd_e:fd`YZBdS(auImplementation of the Metadata for Python packages PEPs. Supports all metadata formats (1.0, 1.1, 1.2, and 2.0 experimental). i(tunicode_literalsN(tmessage_from_filei(tDistlibExceptiont __version__(tStringIOt string_typest text_type(t interpret(textract_by_keyt get_extras(t get_schemetPEP440_VERSION_REtMetadataMissingErrorcBseZdZRS(uA required metadata is missing(t__name__t __module__t__doc__(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyR stMetadataConflictErrorcBseZdZRS(u>Attempt to read or write metadata fields that are conflictual.(R RR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyR st MetadataUnrecognizedVersionErrorcBseZdZRS(u Unknown metadata version number.(R RR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyR$stMetadataInvalidErrorcBseZdZRS(uA metadata value is invalid(R RR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyR(suMetadatauPKG_INFO_ENCODINGuPKG_INFO_PREFERRED_VERSIONuutf-8u1.1u \|u uMetadata-VersionuNameuVersionuPlatformuSummaryu DescriptionuKeywordsu Home-pageuAuthoru Author-emailuLicenseuSupported-Platformu Classifieru Download-URLu ObsoletesuProvidesuRequiresu MaintaineruMaintainer-emailuObsoletes-Distu Project-URLu Provides-Distu Requires-DistuRequires-PythonuRequires-ExternaluPrivate-Versionu Obsoleted-ByuSetup-Requires-Distu ExtensionuProvides-Extrau"extra\s*==\s*("([^"]+)"|'([^']+)')cCsP|dkrtS|dkr tS|dkr0tS|dkr@tSt|dS(Nu1.0u1.1u1.2u2.0(t _241_FIELDSt _314_FIELDSt _345_FIELDSt _426_FIELDSR(tversion((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt_version2fieldlistgs    c Csd}g}xB|jD]4\}}|gdd fkrCqn|j|qWddddg}x|D]}|tkrd|kr|jdn|tkrd|kr|jdn|tkrd|kr|jdn|tkrmd|krm|jdqmqmWt|dkr1|dSt|dkrRt d nd|koj||t }d|ko||t }d|ko||t }t |t |t |dkrt d n| r| r| rt|krtSn|r dS|rdSdS( u5Detect the best version depending on the fields used.cSs%x|D]}||krtSqWtS(N(tTruetFalse(tkeystmarkerstmarker((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt _has_markerus  uUNKNOWNu1.0u1.1u1.2u2.0iiuUnknown metadata setu(You used incompatible 1.1/1.2/2.0 fieldsN(titemstNonetappendRtremoveRRRtlenRt _314_MARKERSt _345_MARKERSt _426_MARKERStinttPKG_INFO_PREFERRED_VERSION( tfieldsRRtkeytvaluetpossible_versionstis_1_1tis_1_2tis_2_0((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt _best_versionssB  & umetadata_versionunameuversionuplatformusupported_platformusummaryu descriptionukeywordsu home_pageuauthoru author_emailu maintainerumaintainer_emailulicenseu classifieru download_urluobsoletes_distu provides_distu requires_distusetup_requires_disturequires_pythonurequires_externalurequiresuprovidesu obsoletesu project_urluprivate_versionu obsoleted_byu extensionuprovides_extrau[^A-Za-z0-9.]+cCsG|r9tjd|}tjd|jdd}nd||fS(uhReturn the distribution name with version. If for_filename is true, return a filename-escaped form.u-u u.u%s-%s(t _FILESAFEtsubtreplace(tnameRt for_filename((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt_get_name_and_versions!tLegacyMetadatacBs4eZdZdddddZdZdZdZdZdZ dZ d Z d Z d Z d Zed ZdZdZdZdZedZedZddZdZedZedZedZdZdZdZdZ dZ!dZ"RS( uaThe legacy metadata of a release. Supports versions 1.0, 1.1 and 1.2 (auto-detected). You can instantiate the class with one of these arguments (or none): - *path*, the path to a metadata file - *fileobj* give a file-like object with metadata as content - *mapping* is a dict-like object - *scheme* is a version scheme name udefaultcCs|||gjddkr-tdni|_g|_d|_||_|dk rm|j|nB|dk r|j|n&|dk r|j ||j ndS(Niu'path, fileobj and mapping are exclusive( tcountR t TypeErrort_fieldstrequires_filest _dependenciestschemetreadt read_filetupdatetset_metadata_version(tselftpathtfileobjtmappingR=((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt__init__s        cCst|j|jdJscCst|}|d|jdtj|ddd}z|j||Wd|jXdS(u&Write the metadata fields to filepath.uwRbuutf-8N(RcRdt write_fileRe(RBRft skip_unknownRg((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyRGhscCs<|jx+t|dD]}|j|}|rT|dgdgfkrTqn|tkr|j||dj|qn|tkr|dkr|jd kr|jdd}q|jdd }n|g}n|t krg|D]}dj|^q}nx!|D]}|j|||qWqWd S( u0Write the PKG-INFO format data to a file object.uMetadata-VersionuUNKNOWNu,u Descriptionu1.0u1.1u u u |N(u1.0u1.1( RARRIRVRHtjoinRURXR3Ri(RBt fileobjectRqRnRoR+((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyRpps$      % c sfd}|sn^t|drRxL|jD]}||||q4Wn$x!|D]\}}|||qYW|rx*|jD]\}}|||qWndS(uSet metadata values from the given iterable `other` and kwargs. Behavior is like `dict.update`: If `other` has a ``keys`` method, they are looped over and ``self[key]`` is assigned ``other[key]``. Else, ``other`` is an iterable of ``(key, value)`` iterables. Keys that don't match a metadata field or that have an empty value are dropped. cs2|tkr.|r.jj||ndS(N(RTRKRM(R*R+(RB(s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt_setsukeysN(thasattrRR(RBtothertkwargsRttktv((RBs@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyR@s cCs|j|}|tks'|dkrt|ttf rt|trwg|jdD]}|j^q\}qg}nF|tkrt|ttf rt|tr|g}qg}nt j t j r|d}t |j}|tkrR|d k rRx|D];}|j|jddst jd|||qqWq|tkr|d k r|j|st jd|||qq|tkr|d k r|j|st jd|||qqn|tkr|dkr|j|}qn||j|d?d@f }i}x;|D]3\}}| sf||jkrD|||||D]3\}}| sk||jkrI||||(t __class__R R4R(RB((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt__repr__msN(#R RRR RFRARHRJRLRPRQRMRWR[R]RR_R`RaR>R?RGRpR@RKRRIRRRRRRoRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyR7s>                     ,  , ;    u pydist.jsonu metadata.jsontMetadatacBseZdZejdZejdejZeZ ejdZ dZ de Z id>d6d?d6d@d 6Zd Zd ZiedAfd 6edBfd6e dCfd6e dDfd 6ZdEZdFdFdFddZedGZdFefZdFefZi defd6defd6ed6ed6ed6defd6ed6ed6ed6ed 6d!efd"6dHd$6dId 6Z[[d&ZdFd'Zd(Zed)Z ed*Z!e!j"d+Z!dFdFd,Z#ed-Z$ed.Z%e%j"d/Z%d0Z&d1Z'd2Z(d3Z)id4d6d5d6d6d6d7d 6d8d96d!d"6Z*d:Z+dFdFe,e-d;Z.d<Z/d=Z0RS(Ju The metadata of a release. This implementation uses 2.0 (JSON) metadata where possible. If not possible, it wraps a LegacyMetadata instance which handles the key-value metadata format. u ^\d+(\.\d+)*$u!^[0-9A-Z]([0-9A-Z_.-]*[0-9A-Z])?$u .{1,2047}u2.0u distlib (%s)unameuversionulegacyusummaryuqname version license summary description author author_email keywords platform home_page classifiers download_urluwextras run_requires test_requires build_requires dev_requires provides meta_requires obsoleted_by supports_environmentsumetadata_versionu_legacyu_datauschemeudefaultcCs|||gjddkr-tdnd|_d|_||_|dk ry|j||||_Wqtk rtd|d||_|j qXnd}|rt |d}|j }WdQXn|r|j }n|dkri|j d6|j d6|_nt|ts?|jd}ny)tj||_|j|j|Wn9tk rtd t|d||_|j nXdS( Niu'path, fileobj and mapping are exclusiveRER=urbumetadata_versionu generatoruutf-8RD(R8R R9t_legacyt_dataR=t_validate_mappingRR7tvalidateRdR>tMETADATA_VERSIONt GENERATORRzRtdecodetjsontloadst ValueErrorR(RBRCRDRER=Rtf((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyRFs>          ulicenseukeywordsu Requires-Distu run_requiresuSetup-Requires-Distubuild_requiresu dev_requiresu test_requiresu meta_requiresuProvides-Extrauextrasumodulesu namespacesuexportsucommandsu Classifieru classifiersu Download-URLu source_urluMetadata-Versionc Cstj|d}tj|d}||kr||\}}|jr|dkrs|dkrgdn|}q|jj|}q|dkrdn|}|d kr|jj||}qt}|}|jjd} | r|dkr| jd |}q|dkrH| jd } | r| j||}qq| jd } | sr|jjd } n| r| j||}qn||kr|}qnQ||krtj||}n0|jr|jj|}n|jj|}|S( Nu common_keysu mapped_keysucommandsuexportsumodulesu namespacesu classifiersu extensionsupython.commandsupython.detailsupython.exports(ucommandsuexportsumodulesu namespacesu classifiers(tobjectt__getattribute__RR RIR( RBR*tcommontmappedtlktmakertresultR+tsentineltd((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyRsF           cCso||jkrk|j|\}}|p.|j|krk|j|}|shtd||fqhqkndS(Nu.'%s' is an invalid value for the '%s' property(tSYNTAX_VALIDATORSR=tmatchR(RBR*R+R=tpatternt exclusionstm((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt_validate_valuescCs|j||tj|d}tj|d}||kr||\}}|jr~|dkrntn||j|               cCst|j|jtS(N(R6R4RR(RB((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pytname_and_version@scCsd|jr|jd}n|jjdg}d|j|jf}||kr`|j|n|S(Nu Provides-Distuprovidesu%s (%s)(RRRR4RR!(RBRts((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pytprovidesDs  cCs*|jr||jd}||kr3|dkrZd }n|}||||d|kr>|}Pq>q>W|dkri|d6}|jd|n*t|dt|B}t||d(R4RRR RX(RBR4R((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyR(s (((ulegacy((ulegacy(ulegacy(ulegacy(u_legacyu_datauschemeN(unameuversionulicenseukeywordsusummary(u Download-URLN(uMetadata-VersionN(1R RRtretcompiletMETADATA_VERSION_MATCHERtIt NAME_MATCHERR tVERSION_MATCHERtSUMMARY_MATCHERRRRRRRRt __slots__R RFRKt common_keysR{t none_listtdictt none_dictt mapped_keysRRRtpropertyRRtsetterRRRRRRRRRRRRGRR(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyRvs       ,         + ' *     % (CRt __future__RRctemailRRRRtRRtcompatRRRRRtutilRR RR R t getLoggerR R}R RRRt__all__tPKG_INFO_ENCODINGR(RRZRYRRR$RR%RR&RKRRR@tEXTRA_RERR0RTRRRRURiRVRRRR1RR6R7tMETADATA_FILENAMEtWHEEL_METADATA_FILENAMER(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.pyt s                                         8            site-packages/pip/_vendor/distlib/resources.py000064400000025016147204247350015542 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2013-2016 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # from __future__ import unicode_literals import bisect import io import logging import os import pkgutil import shutil import sys import types import zipimport from . import DistlibException from .util import cached_property, get_cache_base, path_to_cache_dir, Cache logger = logging.getLogger(__name__) cache = None # created when needed class ResourceCache(Cache): def __init__(self, base=None): if base is None: # Use native string to avoid issues on 2.x: see Python #20140. base = os.path.join(get_cache_base(), str('resource-cache')) super(ResourceCache, self).__init__(base) def is_stale(self, resource, path): """ Is the cache stale for the given resource? :param resource: The :class:`Resource` being cached. :param path: The path of the resource in the cache. :return: True if the cache is stale. """ # Cache invalidation is a hard problem :-) return True def get(self, resource): """ Get a resource into the cache, :param resource: A :class:`Resource` instance. :return: The pathname of the resource in the cache. """ prefix, path = resource.finder.get_cache_info(resource) if prefix is None: result = path else: result = os.path.join(self.base, self.prefix_to_dir(prefix), path) dirname = os.path.dirname(result) if not os.path.isdir(dirname): os.makedirs(dirname) if not os.path.exists(result): stale = True else: stale = self.is_stale(resource, path) if stale: # write the bytes of the resource to the cache location with open(result, 'wb') as f: f.write(resource.bytes) return result class ResourceBase(object): def __init__(self, finder, name): self.finder = finder self.name = name class Resource(ResourceBase): """ A class representing an in-package resource, such as a data file. This is not normally instantiated by user code, but rather by a :class:`ResourceFinder` which manages the resource. """ is_container = False # Backwards compatibility def as_stream(self): """ Get the resource as a stream. This is not a property to make it obvious that it returns a new stream each time. """ return self.finder.get_stream(self) @cached_property def file_path(self): global cache if cache is None: cache = ResourceCache() return cache.get(self) @cached_property def bytes(self): return self.finder.get_bytes(self) @cached_property def size(self): return self.finder.get_size(self) class ResourceContainer(ResourceBase): is_container = True # Backwards compatibility @cached_property def resources(self): return self.finder.get_resources(self) class ResourceFinder(object): """ Resource finder for file system resources. """ if sys.platform.startswith('java'): skipped_extensions = ('.pyc', '.pyo', '.class') else: skipped_extensions = ('.pyc', '.pyo') def __init__(self, module): self.module = module self.loader = getattr(module, '__loader__', None) self.base = os.path.dirname(getattr(module, '__file__', '')) def _adjust_path(self, path): return os.path.realpath(path) def _make_path(self, resource_name): # Issue #50: need to preserve type of path on Python 2.x # like os.path._get_sep if isinstance(resource_name, bytes): # should only happen on 2.x sep = b'/' else: sep = '/' parts = resource_name.split(sep) parts.insert(0, self.base) result = os.path.join(*parts) return self._adjust_path(result) def _find(self, path): return os.path.exists(path) def get_cache_info(self, resource): return None, resource.path def find(self, resource_name): path = self._make_path(resource_name) if not self._find(path): result = None else: if self._is_directory(path): result = ResourceContainer(self, resource_name) else: result = Resource(self, resource_name) result.path = path return result def get_stream(self, resource): return open(resource.path, 'rb') def get_bytes(self, resource): with open(resource.path, 'rb') as f: return f.read() def get_size(self, resource): return os.path.getsize(resource.path) def get_resources(self, resource): def allowed(f): return (f != '__pycache__' and not f.endswith(self.skipped_extensions)) return set([f for f in os.listdir(resource.path) if allowed(f)]) def is_container(self, resource): return self._is_directory(resource.path) _is_directory = staticmethod(os.path.isdir) def iterator(self, resource_name): resource = self.find(resource_name) if resource is not None: todo = [resource] while todo: resource = todo.pop(0) yield resource if resource.is_container: rname = resource.name for name in resource.resources: if not rname: new_name = name else: new_name = '/'.join([rname, name]) child = self.find(new_name) if child.is_container: todo.append(child) else: yield child class ZipResourceFinder(ResourceFinder): """ Resource finder for resources in .zip files. """ def __init__(self, module): super(ZipResourceFinder, self).__init__(module) archive = self.loader.archive self.prefix_len = 1 + len(archive) # PyPy doesn't have a _files attr on zipimporter, and you can't set one if hasattr(self.loader, '_files'): self._files = self.loader._files else: self._files = zipimport._zip_directory_cache[archive] self.index = sorted(self._files) def _adjust_path(self, path): return path def _find(self, path): path = path[self.prefix_len:] if path in self._files: result = True else: if path and path[-1] != os.sep: path = path + os.sep i = bisect.bisect(self.index, path) try: result = self.index[i].startswith(path) except IndexError: result = False if not result: logger.debug('_find failed: %r %r', path, self.loader.prefix) else: logger.debug('_find worked: %r %r', path, self.loader.prefix) return result def get_cache_info(self, resource): prefix = self.loader.archive path = resource.path[1 + len(prefix):] return prefix, path def get_bytes(self, resource): return self.loader.get_data(resource.path) def get_stream(self, resource): return io.BytesIO(self.get_bytes(resource)) def get_size(self, resource): path = resource.path[self.prefix_len:] return self._files[path][3] def get_resources(self, resource): path = resource.path[self.prefix_len:] if path and path[-1] != os.sep: path += os.sep plen = len(path) result = set() i = bisect.bisect(self.index, path) while i < len(self.index): if not self.index[i].startswith(path): break s = self.index[i][plen:] result.add(s.split(os.sep, 1)[0]) # only immediate children i += 1 return result def _is_directory(self, path): path = path[self.prefix_len:] if path and path[-1] != os.sep: path += os.sep i = bisect.bisect(self.index, path) try: result = self.index[i].startswith(path) except IndexError: result = False return result _finder_registry = { type(None): ResourceFinder, zipimport.zipimporter: ZipResourceFinder } try: # In Python 3.6, _frozen_importlib -> _frozen_importlib_external try: import _frozen_importlib_external as _fi except ImportError: import _frozen_importlib as _fi _finder_registry[_fi.SourceFileLoader] = ResourceFinder _finder_registry[_fi.FileFinder] = ResourceFinder del _fi except (ImportError, AttributeError): pass def register_finder(loader, finder_maker): _finder_registry[type(loader)] = finder_maker _finder_cache = {} def finder(package): """ Return a resource finder for a package. :param package: The name of the package. :return: A :class:`ResourceFinder` instance for the package. """ if package in _finder_cache: result = _finder_cache[package] else: if package not in sys.modules: __import__(package) module = sys.modules[package] path = getattr(module, '__path__', None) if path is None: raise DistlibException('You cannot get a finder for a module, ' 'only for a package') loader = getattr(module, '__loader__', None) finder_maker = _finder_registry.get(type(loader)) if finder_maker is None: raise DistlibException('Unable to locate finder for %r' % package) result = finder_maker(module) _finder_cache[package] = result return result _dummy_module = types.ModuleType(str('__dummy__')) def finder_for_path(path): """ Return a resource finder for a path, which should represent a container. :param path: The path. :return: A :class:`ResourceFinder` instance for the path. """ result = None # calls any path hooks, gets importer into cache pkgutil.get_importer(path) loader = sys.path_importer_cache.get(path) finder = _finder_registry.get(type(loader)) if finder: module = _dummy_module module.__file__ = os.path.join(path, '') module.__loader__ = loader result = finder(module) return result site-packages/pip/_vendor/distlib/resources.pyc000064400000033221147204247350015702 0ustar00 abc@s ddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZmZmZmZejeZdadefdYZdefd YZd efd YZd efd YZdefdYZdefdYZieed6ee j6Z yQyddl!Z"Wne#k rddl$Z"nXee e"j%R R((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pytfinds  cCst|jdS(Nurb(RR (RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR'scCs)t|jd}|jSWdQXdS(Nurb(RR tread(RRR ((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR+scCstjj|jS(N(RR tgetsize(RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR,scsDfd}tgtj|jD]}||r%|^q%S(Ncs|dko|jj S(Nu __pycache__(tendswithtskipped_extensions(R (R(sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pytalloweds (tsetRtlistdirR (RRRIR ((RsA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR2scCs|j|jS(N(RCR (RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR0sccs|j|}|dk r|g}x|r|jd}|V|jr'|j}xe|jD]W}|sr|}ndj||g}|j|}|jr|j|q]|Vq]Wq'q'WndS(Niu/(RDRtpopR0R%R3R tappend(RR>RttodotrnameR%tnew_nametchild((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pytiterators        (u.pycu.pyou.class(u.pycu.pyo(R"R#R.tsystplatformt startswithRHR R9RARBRRDR'R+R,R2R0t staticmethodRR RRCRR(((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR4ws"          tZipResourceFindercBs_eZdZdZdZdZdZdZdZdZ dZ d Z RS( u6 Resource finder for resources in .zip files. cCstt|j||jj}dt||_t|jdrY|jj|_nt j ||_t |j|_ dS(Niu_files( R RWR R7tarchivetlent prefix_lenthasattrt_filest zipimportt_zip_directory_cachetsortedtindex(RR5RX((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR s cCs|S(N((RR ((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR9scCs||j}||jkr%t}nr|rN|dtjkrN|tj}ntj|j|}y|j|j|}Wntk rt }nX|st j d||j j nt j d||j j |S(Niu_find failed: %r %ru_find worked: %r %r(RZR\RRR?tbisectR`RUt IndexErrorR/tloggertdebugR7R(RR Rti((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyRBs    cCs-|jj}|jdt|}||fS(Ni(R7RXR RY(RRRR ((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyRs cCs|jj|jS(N(R7tget_dataR (RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR+scCstj|j|S(N(tiotBytesIOR+(RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR'scCs|j|j}|j|dS(Ni(R RZR\(RRR ((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR,scCs|j|j}|r9|dtjkr9|tj7}nt|}t}tj|j|}xn|t|jkr|j|j|sPn|j||}|j |j tjdd|d7}qfW|S(Niii( R RZRR?RYRJRaR`RUtaddR<(RRR tplenRRets((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR2s   cCs||j}|r6|dtjkr6|tj7}ntj|j|}y|j|j|}Wntk r~t}nX|S(Ni(RZRR?RaR`RURbR/(RR ReR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyRCs   ( R"R#R.R R9RBRR+R'R,R2RC(((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyRWs       cCs|tt|sJ         ",!ZM       site-packages/pip/_vendor/distlib/resources.pyo000064400000033221147204247350015716 0ustar00 abc@s ddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZmZmZmZejeZdadefdYZdefd YZd efd YZd efd YZdefdYZdefdYZieed6ee j6Z yQyddl!Z"Wne#k rddl$Z"nXee e"j%R R((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pytfinds  cCst|jdS(Nurb(RR (RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR'scCs)t|jd}|jSWdQXdS(Nurb(RR tread(RRR ((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR+scCstjj|jS(N(RR tgetsize(RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR,scsDfd}tgtj|jD]}||r%|^q%S(Ncs|dko|jj S(Nu __pycache__(tendswithtskipped_extensions(R (R(sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pytalloweds (tsetRtlistdirR (RRRIR ((RsA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR2scCs|j|jS(N(RCR (RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR0sccs|j|}|dk r|g}x|r|jd}|V|jr'|j}xe|jD]W}|sr|}ndj||g}|j|}|jr|j|q]|Vq]Wq'q'WndS(Niu/(RDRtpopR0R%R3R tappend(RR>RttodotrnameR%tnew_nametchild((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pytiterators        (u.pycu.pyou.class(u.pycu.pyo(R"R#R.tsystplatformt startswithRHR R9RARBRRDR'R+R,R2R0t staticmethodRR RRCRR(((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR4ws"          tZipResourceFindercBs_eZdZdZdZdZdZdZdZdZ dZ d Z RS( u6 Resource finder for resources in .zip files. cCstt|j||jj}dt||_t|jdrY|jj|_nt j ||_t |j|_ dS(Niu_files( R RWR R7tarchivetlent prefix_lenthasattrt_filest zipimportt_zip_directory_cachetsortedtindex(RR5RX((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR s cCs|S(N((RR ((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR9scCs||j}||jkr%t}nr|rN|dtjkrN|tj}ntj|j|}y|j|j|}Wntk rt }nX|st j d||j j nt j d||j j |S(Niu_find failed: %r %ru_find worked: %r %r(RZR\RRR?tbisectR`RUt IndexErrorR/tloggertdebugR7R(RR Rti((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyRBs    cCs-|jj}|jdt|}||fS(Ni(R7RXR RY(RRRR ((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyRs cCs|jj|jS(N(R7tget_dataR (RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR+scCstj|j|S(N(tiotBytesIOR+(RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR'scCs|j|j}|j|dS(Ni(R RZR\(RRR ((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR,scCs|j|j}|r9|dtjkr9|tj7}nt|}t}tj|j|}xn|t|jkr|j|j|sPn|j||}|j |j tjdd|d7}qfW|S(Niii( R RZRR?RYRJRaR`RUtaddR<(RRR tplenRRets((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR2s   cCs||j}|r6|dtjkr6|tj7}ntj|j|}y|j|j|}Wntk r~t}nX|S(Ni(RZRR?RaR`RURbR/(RR ReR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyRCs   ( R"R#R.R R9RBRR+R'R,R2RC(((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyRWs       cCs|tt|sJ         ",!ZM       site-packages/pip/_vendor/distlib/scripts.py000064400000035570147204247350015225 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2013-2015 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # from io import BytesIO import logging import os import re import struct import sys from .compat import sysconfig, detect_encoding, ZipFile from .resources import finder from .util import (FileOperator, get_export_entry, convert_path, get_executable, in_venv) logger = logging.getLogger(__name__) _DEFAULT_MANIFEST = ''' '''.strip() # check if Python is called on the first line with this expression FIRST_LINE_RE = re.compile(b'^#!.*pythonw?[0-9.]*([ \t].*)?$') SCRIPT_TEMPLATE = '''# -*- coding: utf-8 -*- if __name__ == '__main__': import sys, re def _resolve(module, func): __import__(module) mod = sys.modules[module] parts = func.split('.') result = getattr(mod, parts.pop(0)) for p in parts: result = getattr(result, p) return result try: sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) func = _resolve('%(module)s', '%(func)s') rc = func() # None interpreted as 0 except Exception as e: # only supporting Python >= 2.6 sys.stderr.write('%%s\\n' %% e) rc = 1 sys.exit(rc) ''' def _enquote_executable(executable): if ' ' in executable: # make sure we quote only the executable in case of env # for example /usr/bin/env "/dir with spaces/bin/jython" # instead of "/usr/bin/env /dir with spaces/bin/jython" # otherwise whole if executable.startswith('/usr/bin/env '): env, _executable = executable.split(' ', 1) if ' ' in _executable and not _executable.startswith('"'): executable = '%s "%s"' % (env, _executable) else: if not executable.startswith('"'): executable = '"%s"' % executable return executable class ScriptMaker(object): """ A class to copy or create scripts from source scripts or callable specifications. """ script_template = SCRIPT_TEMPLATE executable = None # for shebangs def __init__(self, source_dir, target_dir, add_launchers=True, dry_run=False, fileop=None): self.source_dir = source_dir self.target_dir = target_dir self.add_launchers = add_launchers self.force = False self.clobber = False # It only makes sense to set mode bits on POSIX. self.set_mode = (os.name == 'posix') or (os.name == 'java' and os._name == 'posix') self.variants = set(('', 'X.Y')) self._fileop = fileop or FileOperator(dry_run) self._is_nt = os.name == 'nt' or ( os.name == 'java' and os._name == 'nt') def _get_alternate_executable(self, executable, options): if options.get('gui', False) and self._is_nt: # pragma: no cover dn, fn = os.path.split(executable) fn = fn.replace('python', 'pythonw') executable = os.path.join(dn, fn) return executable if sys.platform.startswith('java'): # pragma: no cover def _is_shell(self, executable): """ Determine if the specified executable is a script (contains a #! line) """ try: with open(executable) as fp: return fp.read(2) == '#!' except (OSError, IOError): logger.warning('Failed to open %s', executable) return False def _fix_jython_executable(self, executable): if self._is_shell(executable): # Workaround for Jython is not needed on Linux systems. import java if java.lang.System.getProperty('os.name') == 'Linux': return executable elif executable.lower().endswith('jython.exe'): # Use wrapper exe for Jython on Windows return executable return '/usr/bin/env %s' % executable def _get_shebang(self, encoding, post_interp=b'', options=None): enquote = True if self.executable: executable = self.executable enquote = False # assume this will be taken care of elif not sysconfig.is_python_build(): executable = get_executable() elif in_venv(): # pragma: no cover executable = os.path.join(sysconfig.get_path('scripts'), 'python%s' % sysconfig.get_config_var('EXE')) else: # pragma: no cover executable = os.path.join( sysconfig.get_config_var('BINDIR'), 'python%s%s' % (sysconfig.get_config_var('VERSION'), sysconfig.get_config_var('EXE'))) if options: executable = self._get_alternate_executable(executable, options) if sys.platform.startswith('java'): # pragma: no cover executable = self._fix_jython_executable(executable) # Normalise case for Windows executable = os.path.normcase(executable) # If the user didn't specify an executable, it may be necessary to # cater for executable paths with spaces (not uncommon on Windows) if enquote: executable = _enquote_executable(executable) # Issue #51: don't use fsencode, since we later try to # check that the shebang is decodable using utf-8. executable = executable.encode('utf-8') # in case of IronPython, play safe and enable frames support if (sys.platform == 'cli' and '-X:Frames' not in post_interp and '-X:FullFrames' not in post_interp): # pragma: no cover post_interp += b' -X:Frames' shebang = b'#!' + executable + post_interp + b'\n' # Python parser starts to read a script using UTF-8 until # it gets a #coding:xxx cookie. The shebang has to be the # first line of a file, the #coding:xxx cookie cannot be # written before. So the shebang has to be decodable from # UTF-8. try: shebang.decode('utf-8') except UnicodeDecodeError: # pragma: no cover raise ValueError( 'The shebang (%r) is not decodable from utf-8' % shebang) # If the script is encoded to a custom encoding (use a # #coding:xxx cookie), the shebang has to be decodable from # the script encoding too. if encoding != 'utf-8': try: shebang.decode(encoding) except UnicodeDecodeError: # pragma: no cover raise ValueError( 'The shebang (%r) is not decodable ' 'from the script encoding (%r)' % (shebang, encoding)) return shebang def _get_script_text(self, entry): return self.script_template % dict(module=entry.prefix, func=entry.suffix) manifest = _DEFAULT_MANIFEST def get_manifest(self, exename): base = os.path.basename(exename) return self.manifest % base def _write_script(self, names, shebang, script_bytes, filenames, ext): use_launcher = self.add_launchers and self._is_nt linesep = os.linesep.encode('utf-8') if not use_launcher: script_bytes = shebang + linesep + script_bytes else: # pragma: no cover if ext == 'py': launcher = self._get_launcher('t') else: launcher = self._get_launcher('w') stream = BytesIO() with ZipFile(stream, 'w') as zf: zf.writestr('__main__.py', script_bytes) zip_data = stream.getvalue() script_bytes = launcher + shebang + linesep + zip_data for name in names: outname = os.path.join(self.target_dir, name) if use_launcher: # pragma: no cover n, e = os.path.splitext(outname) if e.startswith('.py'): outname = n outname = '%s.exe' % outname try: self._fileop.write_binary_file(outname, script_bytes) except Exception: # Failed writing an executable - it might be in use. logger.warning('Failed to write executable - trying to ' 'use .deleteme logic') dfname = '%s.deleteme' % outname if os.path.exists(dfname): os.remove(dfname) # Not allowed to fail here os.rename(outname, dfname) # nor here self._fileop.write_binary_file(outname, script_bytes) logger.debug('Able to replace executable using ' '.deleteme logic') try: os.remove(dfname) except Exception: pass # still in use - ignore error else: if self._is_nt and not outname.endswith('.' + ext): # pragma: no cover outname = '%s.%s' % (outname, ext) if os.path.exists(outname) and not self.clobber: logger.warning('Skipping existing file %s', outname) continue self._fileop.write_binary_file(outname, script_bytes) if self.set_mode: self._fileop.set_executable_mode([outname]) filenames.append(outname) def _make_script(self, entry, filenames, options=None): post_interp = b'' if options: args = options.get('interpreter_args', []) if args: args = ' %s' % ' '.join(args) post_interp = args.encode('utf-8') shebang = self._get_shebang('utf-8', post_interp, options=options) script = self._get_script_text(entry).encode('utf-8') name = entry.name scriptnames = set() if '' in self.variants: scriptnames.add(name) if 'X' in self.variants: scriptnames.add('%s%s' % (name, sys.version[0])) if 'X.Y' in self.variants: scriptnames.add('%s-%s' % (name, sys.version[:3])) if options and options.get('gui', False): ext = 'pyw' else: ext = 'py' self._write_script(scriptnames, shebang, script, filenames, ext) def _copy_script(self, script, filenames): adjust = False script = os.path.join(self.source_dir, convert_path(script)) outname = os.path.join(self.target_dir, os.path.basename(script)) if not self.force and not self._fileop.newer(script, outname): logger.debug('not copying %s (up-to-date)', script) return # Always open the file, but ignore failures in dry-run mode -- # that way, we'll get accurate feedback if we can read the # script. try: f = open(script, 'rb') except IOError: # pragma: no cover if not self.dry_run: raise f = None else: first_line = f.readline() if not first_line: # pragma: no cover logger.warning('%s: %s is an empty file (skipping)', self.get_command_name(), script) return match = FIRST_LINE_RE.match(first_line.replace(b'\r\n', b'\n')) if match: adjust = True post_interp = match.group(1) or b'' if not adjust: if f: f.close() self._fileop.copy_file(script, outname) if self.set_mode: self._fileop.set_executable_mode([outname]) filenames.append(outname) else: logger.info('copying and adjusting %s -> %s', script, self.target_dir) if not self._fileop.dry_run: encoding, lines = detect_encoding(f.readline) f.seek(0) shebang = self._get_shebang(encoding, post_interp) if b'pythonw' in first_line: # pragma: no cover ext = 'pyw' else: ext = 'py' n = os.path.basename(outname) self._write_script([n], shebang, f.read(), filenames, ext) if f: f.close() @property def dry_run(self): return self._fileop.dry_run @dry_run.setter def dry_run(self, value): self._fileop.dry_run = value if os.name == 'nt' or (os.name == 'java' and os._name == 'nt'): # pragma: no cover # Executable launcher support. # Launchers are from https://bitbucket.org/vinay.sajip/simple_launcher/ def _get_launcher(self, kind): if struct.calcsize('P') == 8: # 64-bit bits = '64' else: bits = '32' name = '%s%s.exe' % (kind, bits) # Issue 31: don't hardcode an absolute package name, but # determine it relative to the current package distlib_package = __name__.rsplit('.', 1)[0] result = finder(distlib_package).find(name).bytes return result # Public API follows def make(self, specification, options=None): """ Make a script. :param specification: The specification, which is either a valid export entry specification (to make a script from a callable) or a filename (to make a script by copying from a source location). :param options: A dictionary of options controlling script generation. :return: A list of all absolute pathnames written to. """ filenames = [] entry = get_export_entry(specification) if entry is None: self._copy_script(specification, filenames) else: self._make_script(entry, filenames, options=options) return filenames def make_multiple(self, specifications, options=None): """ Take a list of specifications and make scripts from them, :param specifications: A list of specifications. :return: A list of all absolute pathnames written to, """ filenames = [] for specification in specifications: filenames.extend(self.make(specification, options)) return filenames site-packages/pip/_vendor/distlib/scripts.pyc000064400000030260147204247350015357 0ustar00 abc@sddlmZddlZddlZddlZddlZddlZddlmZm Z m Z ddl m Z ddl mZmZmZmZmZejeZdjZejdZd Zd Zd efd YZdS( i(tBytesIONi(t sysconfigtdetect_encodingtZipFile(tfinder(t FileOperatortget_export_entryt convert_pathtget_executabletin_venvs s^#!.*pythonw?[0-9.]*([ ].*)?$s|# -*- coding: utf-8 -*- if __name__ == '__main__': import sys, re def _resolve(module, func): __import__(module) mod = sys.modules[module] parts = func.split('.') result = getattr(mod, parts.pop(0)) for p in parts: result = getattr(result, p) return result try: sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) func = _resolve('%(module)s', '%(func)s') rc = func() # None interpreted as 0 except Exception as e: # only supporting Python >= 2.6 sys.stderr.write('%%s\n' %% e) rc = 1 sys.exit(rc) cCsd|kr|jdre|jdd\}}d|kr|jd rd||f}qq|jdsd|}qn|S(Nt s /usr/bin/env it"s%s "%s"s"%s"(t startswithtsplit(t executabletenvt _executable((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt_enquote_executableBs t ScriptMakercBseZdZeZdZeeddZ dZ e j j drZdZdZndddZdZeZd Zd Zdd Zd Zed ZejdZejdksejdkrejdkrdZnddZddZ RS(s_ A class to copy or create scripts from source scripts or callable specifications. cCs||_||_||_t|_t|_tjdkpWtjdkoWtjdk|_ t d|_ |p{t ||_ tjdkptjdkotjdk|_dS(NtposixtjavatsX.Ytnt(RsX.Y(t source_dirt target_dirt add_launcherstFalsetforcetclobbertostnamet_nametset_modetsettvariantsRt_fileopt_is_nt(tselfRRRtdry_runtfileop((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt__init__[s     cCsa|jdtr]|jr]tjj|\}}|jdd}tjj||}n|S(Ntguitpythontpythonw(tgetRR$RtpathR treplacetjoin(R%Rtoptionstdntfn((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt_get_alternate_executableks RcCs[y,t|}|jddkSWdQXWn(ttfk rVtjd|tSXdS(sl Determine if the specified executable is a script (contains a #! line) is#!NsFailed to open %s(topentreadtOSErrortIOErrortloggertwarningR(R%Rtfp((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt _is_shellss cCs^|j|r=ddl}|jjjddkrV|Sn|jjdrV|Sd|S(Nisos.nametLinuxs jython.exes/usr/bin/env %s(R;RtlangtSystemt getPropertytlowertendswith(R%RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt_fix_jython_executables RcCst}|jr!|j}t}ntjs9t}nqtrptjj tj ddtj d}n:tjj tj ddtj dtj df}|r|j ||}nt jjdr|j|}ntjj|}|rt|}n|jd}t jd krSd |krSd |krS|d 7}nd ||d}y|jdWn!tk rtd|nX|dkry|j|Wqtk rtd||fqXn|S(Ntscriptsspython%stEXEtBINDIRs python%s%stVERSIONRsutf-8tclis -X:Framess -X:FullFramess -X:Framess#!s s,The shebang (%r) is not decodable from utf-8s?The shebang (%r) is not decodable from the script encoding (%r)(tTrueRRRtis_python_buildRR RR-R/tget_pathtget_config_varR3tsystplatformR RBtnormcaseRtencodetdecodetUnicodeDecodeErrort ValueError(R%tencodingt post_interpR0tenquoteRtshebang((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt _get_shebangsL             cCs |jtd|jd|jS(Ntmoduletfunc(tscript_templatetdicttprefixtsuffix(R%tentry((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt_get_script_textscCstjj|}|j|S(N(RR-tbasenametmanifest(R%texenametbase((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt get_manifestscCs|jo|j}tjjd}|s;|||}n||dkrY|jd}n|jd}t} t| d} | jd|WdQX| j } |||| }x|D]} tj j |j | } |rtj j | \}}|jdr|} nd| } y|jj| |Wqltk rtjdd | }tj j|r|tj|ntj| ||jj| |tjd ytj|Wqtk rqXqlXn|jr| jd | rd | |f} ntj j| r:|j r:tjd | qn|jj| ||jrl|jj| gn|j| qWdS(Nsutf-8tpytttws __main__.pys.pys%s.exes:Failed to write executable - trying to use .deleteme logics %s.deletemes0Able to replace executable using .deleteme logict.s%s.%ssSkipping existing file %s(RR$RtlinesepROt _get_launcherRRtwritestrtgetvalueR-R/RtsplitextR R#twrite_binary_filet ExceptionR8R9texiststremovetrenametdebugRARR tset_executable_modetappend(R%tnamesRVt script_bytest filenamestextt use_launcherRitlaunchertstreamtzftzip_dataRtoutnametntetdfname((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt _write_scriptsT             c CsQd}|rL|jdg}|rLddj|}|jd}qLn|jd|d|}|j|jd}|j}t} d|jkr| j|nd|jkr| jd|t j d fnd |jkr | jd |t j d fn|r.|jd t r.d} nd} |j | |||| dS(NRtinterpreter_argss %sR sutf-8R0tXs%s%sisX.Ys%s-%siR)tpywRe( R,R/RORWR_RR!R"taddRLtversionRR( R%R^RxR0RTtargsRVtscriptRt scriptnamesRy((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt _make_scripts(  !! cCs@t}tjj|jt|}tjj|jtjj|}|j r||j j || r|t j d|dSyt |d}Wn&tk r|jsnd}noX|j}|st jd|j|dStj|jdd}|r&t}|jdp d}n|s|r?|jn|j j|||jrq|j j|gn|j|nt jd||j|j js)t|j\} } |j d |j!| |} d |krd } nd } tjj|} |j"| g| |j#|| n|r<|jndS( Nsnot copying %s (up-to-date)trbs"%s: %s is an empty file (skipping)s s iRscopying and adjusting %s -> %siR+RRe($RRR-R/RRRR`RR#tnewerR8RsR4R7R&tNonetreadlineR9tget_command_namet FIRST_LINE_REtmatchR.RHtgrouptcloset copy_fileR RtRutinfoRtseekRWRR5(R%RRxtadjustRtft first_lineRRTRStlinesRVRyR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt _copy_scriptsR$              %cCs |jjS(N(R#R&(R%((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyR&JscCs||j_dS(N(R#R&(R%tvalue((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyR&NsRcCsftjddkrd}nd}d||f}tjddd}t|j|j}|S( NtPit64t32s%s%s.exeRhii(tstructtcalcsizet__name__trsplitRtfindtbytes(R%tkindtbitsRtdistlib_packagetresult((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyRjVs cCsKg}t|}|dkr1|j||n|j||d||S(s Make a script. :param specification: The specification, which is either a valid export entry specification (to make a script from a callable) or a filename (to make a script by copying from a source location). :param options: A dictionary of options controlling script generation. :return: A list of all absolute pathnames written to. R0N(RRRR(R%t specificationR0RxR^((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pytmakeds   cCs4g}x'|D]}|j|j||q W|S(s Take a list of specifications and make scripts from them, :param specifications: A list of specifications. :return: A list of all absolute pathnames written to, (textendR(R%tspecificationsR0RxR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt make_multiplews N(!Rt __module__t__doc__tSCRIPT_TEMPLATERZRRRHRR(R3RLRMR R;RBRWR_t_DEFAULT_MANIFESTRaRdRRRtpropertyR&tsetterRRRRjRR(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyRRs,  8   2  4-  (tioRtloggingRtreRRLtcompatRRRt resourcesRtutilRRRRR t getLoggerRR8tstripRtcompileRRRtobjectR(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyts     (  site-packages/pip/_vendor/distlib/scripts.pyo000064400000030260147204247350015373 0ustar00 abc@sddlmZddlZddlZddlZddlZddlZddlmZm Z m Z ddl m Z ddl mZmZmZmZmZejeZdjZejdZd Zd Zd efd YZdS( i(tBytesIONi(t sysconfigtdetect_encodingtZipFile(tfinder(t FileOperatortget_export_entryt convert_pathtget_executabletin_venvs s^#!.*pythonw?[0-9.]*([ ].*)?$s|# -*- coding: utf-8 -*- if __name__ == '__main__': import sys, re def _resolve(module, func): __import__(module) mod = sys.modules[module] parts = func.split('.') result = getattr(mod, parts.pop(0)) for p in parts: result = getattr(result, p) return result try: sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) func = _resolve('%(module)s', '%(func)s') rc = func() # None interpreted as 0 except Exception as e: # only supporting Python >= 2.6 sys.stderr.write('%%s\n' %% e) rc = 1 sys.exit(rc) cCsd|kr|jdre|jdd\}}d|kr|jd rd||f}qq|jdsd|}qn|S(Nt s /usr/bin/env it"s%s "%s"s"%s"(t startswithtsplit(t executabletenvt _executable((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt_enquote_executableBs t ScriptMakercBseZdZeZdZeeddZ dZ e j j drZdZdZndddZdZeZd Zd Zdd Zd Zed ZejdZejdksejdkrejdkrdZnddZddZ RS(s_ A class to copy or create scripts from source scripts or callable specifications. cCs||_||_||_t|_t|_tjdkpWtjdkoWtjdk|_ t d|_ |p{t ||_ tjdkptjdkotjdk|_dS(NtposixtjavatsX.Ytnt(RsX.Y(t source_dirt target_dirt add_launcherstFalsetforcetclobbertostnamet_nametset_modetsettvariantsRt_fileopt_is_nt(tselfRRRtdry_runtfileop((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt__init__[s     cCsa|jdtr]|jr]tjj|\}}|jdd}tjj||}n|S(Ntguitpythontpythonw(tgetRR$RtpathR treplacetjoin(R%Rtoptionstdntfn((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt_get_alternate_executableks RcCs[y,t|}|jddkSWdQXWn(ttfk rVtjd|tSXdS(sl Determine if the specified executable is a script (contains a #! line) is#!NsFailed to open %s(topentreadtOSErrortIOErrortloggertwarningR(R%Rtfp((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt _is_shellss cCs^|j|r=ddl}|jjjddkrV|Sn|jjdrV|Sd|S(Nisos.nametLinuxs jython.exes/usr/bin/env %s(R;RtlangtSystemt getPropertytlowertendswith(R%RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt_fix_jython_executables RcCst}|jr!|j}t}ntjs9t}nqtrptjj tj ddtj d}n:tjj tj ddtj dtj df}|r|j ||}nt jjdr|j|}ntjj|}|rt|}n|jd}t jd krSd |krSd |krS|d 7}nd ||d}y|jdWn!tk rtd|nX|dkry|j|Wqtk rtd||fqXn|S(Ntscriptsspython%stEXEtBINDIRs python%s%stVERSIONRsutf-8tclis -X:Framess -X:FullFramess -X:Framess#!s s,The shebang (%r) is not decodable from utf-8s?The shebang (%r) is not decodable from the script encoding (%r)(tTrueRRRtis_python_buildRR RR-R/tget_pathtget_config_varR3tsystplatformR RBtnormcaseRtencodetdecodetUnicodeDecodeErrort ValueError(R%tencodingt post_interpR0tenquoteRtshebang((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt _get_shebangsL             cCs |jtd|jd|jS(Ntmoduletfunc(tscript_templatetdicttprefixtsuffix(R%tentry((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt_get_script_textscCstjj|}|j|S(N(RR-tbasenametmanifest(R%texenametbase((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt get_manifestscCs|jo|j}tjjd}|s;|||}n||dkrY|jd}n|jd}t} t| d} | jd|WdQX| j } |||| }x|D]} tj j |j | } |rtj j | \}}|jdr|} nd| } y|jj| |Wqltk rtjdd | }tj j|r|tj|ntj| ||jj| |tjd ytj|Wqtk rqXqlXn|jr| jd | rd | |f} ntj j| r:|j r:tjd | qn|jj| ||jrl|jj| gn|j| qWdS(Nsutf-8tpytttws __main__.pys.pys%s.exes:Failed to write executable - trying to use .deleteme logics %s.deletemes0Able to replace executable using .deleteme logict.s%s.%ssSkipping existing file %s(RR$RtlinesepROt _get_launcherRRtwritestrtgetvalueR-R/RtsplitextR R#twrite_binary_filet ExceptionR8R9texiststremovetrenametdebugRARR tset_executable_modetappend(R%tnamesRVt script_bytest filenamestextt use_launcherRitlaunchertstreamtzftzip_dataRtoutnametntetdfname((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt _write_scriptsT             c CsQd}|rL|jdg}|rLddj|}|jd}qLn|jd|d|}|j|jd}|j}t} d|jkr| j|nd|jkr| jd|t j d fnd |jkr | jd |t j d fn|r.|jd t r.d} nd} |j | |||| dS(NRtinterpreter_argss %sR sutf-8R0tXs%s%sisX.Ys%s-%siR)tpywRe( R,R/RORWR_RR!R"taddRLtversionRR( R%R^RxR0RTtargsRVtscriptRt scriptnamesRy((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt _make_scripts(  !! cCs@t}tjj|jt|}tjj|jtjj|}|j r||j j || r|t j d|dSyt |d}Wn&tk r|jsnd}noX|j}|st jd|j|dStj|jdd}|r&t}|jdp d}n|s|r?|jn|j j|||jrq|j j|gn|j|nt jd||j|j js)t|j\} } |j d |j!| |} d |krd } nd } tjj|} |j"| g| |j#|| n|r<|jndS( Nsnot copying %s (up-to-date)trbs"%s: %s is an empty file (skipping)s s iRscopying and adjusting %s -> %siR+RRe($RRR-R/RRRR`RR#tnewerR8RsR4R7R&tNonetreadlineR9tget_command_namet FIRST_LINE_REtmatchR.RHtgrouptcloset copy_fileR RtRutinfoRtseekRWRR5(R%RRxtadjustRtft first_lineRRTRStlinesRVRyR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt _copy_scriptsR$              %cCs |jjS(N(R#R&(R%((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyR&JscCs||j_dS(N(R#R&(R%tvalue((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyR&NsRcCsftjddkrd}nd}d||f}tjddd}t|j|j}|S( NtPit64t32s%s%s.exeRhii(tstructtcalcsizet__name__trsplitRtfindtbytes(R%tkindtbitsRtdistlib_packagetresult((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyRjVs cCsKg}t|}|dkr1|j||n|j||d||S(s Make a script. :param specification: The specification, which is either a valid export entry specification (to make a script from a callable) or a filename (to make a script by copying from a source location). :param options: A dictionary of options controlling script generation. :return: A list of all absolute pathnames written to. R0N(RRRR(R%t specificationR0RxR^((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pytmakeds   cCs4g}x'|D]}|j|j||q W|S(s Take a list of specifications and make scripts from them, :param specifications: A list of specifications. :return: A list of all absolute pathnames written to, (textendR(R%tspecificationsR0RxR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt make_multiplews N(!Rt __module__t__doc__tSCRIPT_TEMPLATERZRRRHRR(R3RLRMR R;RBRWR_t_DEFAULT_MANIFESTRaRdRRRtpropertyR&tsetterRRRRjRR(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyRRs,  8   2  4-  (tioRtloggingRtreRRLtcompatRRRt resourcesRtutilRRRRR t getLoggerRR8tstripRtcompileRRRtobjectR(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyts     (  site-packages/pip/_vendor/distlib/util.py000064400000147377147204247350014524 0ustar00# # Copyright (C) 2012-2016 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import shutil import socket try: import ssl except ImportError: # pragma: no cover ssl = None import subprocess import sys import tarfile import tempfile import textwrap try: import threading except ImportError: # pragma: no cover import dummy_threading as threading import time from . import DistlibException from .compat import (string_types, text_type, shutil, raw_input, StringIO, cache_from_source, urlopen, urljoin, httplib, xmlrpclib, splittype, HTTPHandler, BaseConfigurator, valid_ident, Container, configparser, URLError, ZipFile, fsdecode, unquote) logger = logging.getLogger(__name__) # # Requirement parsing code for name + optional constraints + optional extras # # e.g. 'foo >= 1.2, < 2.0 [bar, baz]' # # The regex can seem a bit hairy, so we build it up out of smaller pieces # which are manageable. # COMMA = r'\s*,\s*' COMMA_RE = re.compile(COMMA) IDENT = r'(\w|[.-])+' EXTRA_IDENT = r'(\*|:(\*|\w+):|' + IDENT + ')' VERSPEC = IDENT + r'\*?' RELOP = '([<>=!~]=)|[<>]' # # The first relop is optional - if absent, will be taken as '~=' # BARE_CONSTRAINTS = ('(' + RELOP + r')?\s*(' + VERSPEC + ')(' + COMMA + '(' + RELOP + r')\s*(' + VERSPEC + '))*') DIRECT_REF = '(from\s+(?P.*))' # # Either the bare constraints or the bare constraints in parentheses # CONSTRAINTS = (r'\(\s*(?P' + BARE_CONSTRAINTS + '|' + DIRECT_REF + r')\s*\)|(?P' + BARE_CONSTRAINTS + '\s*)') EXTRA_LIST = EXTRA_IDENT + '(' + COMMA + EXTRA_IDENT + ')*' EXTRAS = r'\[\s*(?P' + EXTRA_LIST + r')?\s*\]' REQUIREMENT = ('(?P' + IDENT + r')\s*(' + EXTRAS + r'\s*)?(\s*' + CONSTRAINTS + ')?$') REQUIREMENT_RE = re.compile(REQUIREMENT) # # Used to scan through the constraints # RELOP_IDENT = '(?P' + RELOP + r')\s*(?P' + VERSPEC + ')' RELOP_IDENT_RE = re.compile(RELOP_IDENT) def parse_requirement(s): def get_constraint(m): d = m.groupdict() return d['op'], d['vn'] result = None m = REQUIREMENT_RE.match(s) if m: d = m.groupdict() name = d['dn'] cons = d['c1'] or d['c2'] if not d['diref']: url = None else: # direct reference cons = None url = d['diref'].strip() if not cons: cons = None constr = '' rs = d['dn'] else: if cons[0] not in '<>!=': cons = '~=' + cons iterator = RELOP_IDENT_RE.finditer(cons) cons = [get_constraint(m) for m in iterator] rs = '%s (%s)' % (name, ', '.join(['%s %s' % con for con in cons])) if not d['ex']: extras = None else: extras = COMMA_RE.split(d['ex']) result = Container(name=name, constraints=cons, extras=extras, requirement=rs, source=s, url=url) return result def get_resources_dests(resources_root, rules): """Find destinations for resources files""" def get_rel_path(base, path): # normalizes and returns a lstripped-/-separated path base = base.replace(os.path.sep, '/') path = path.replace(os.path.sep, '/') assert path.startswith(base) return path[len(base):].lstrip('/') destinations = {} for base, suffix, dest in rules: prefix = os.path.join(resources_root, base) for abs_base in iglob(prefix): abs_glob = os.path.join(abs_base, suffix) for abs_path in iglob(abs_glob): resource_file = get_rel_path(resources_root, abs_path) if dest is None: # remove the entry if it was here destinations.pop(resource_file, None) else: rel_path = get_rel_path(abs_base, abs_path) rel_dest = dest.replace(os.path.sep, '/').rstrip('/') destinations[resource_file] = rel_dest + '/' + rel_path return destinations def in_venv(): if hasattr(sys, 'real_prefix'): # virtualenv venvs result = True else: # PEP 405 venvs result = sys.prefix != getattr(sys, 'base_prefix', sys.prefix) return result def get_executable(): # The __PYVENV_LAUNCHER__ dance is apparently no longer needed, as # changes to the stub launcher mean that sys.executable always points # to the stub on macOS # if sys.platform == 'darwin' and ('__PYVENV_LAUNCHER__' # in os.environ): # result = os.environ['__PYVENV_LAUNCHER__'] # else: # result = sys.executable # return result result = os.path.normcase(sys.executable) if not isinstance(result, text_type): result = fsdecode(result) return result def proceed(prompt, allowed_chars, error_prompt=None, default=None): p = prompt while True: s = raw_input(p) p = prompt if not s and default: s = default if s: c = s[0].lower() if c in allowed_chars: break if error_prompt: p = '%c: %s\n%s' % (c, error_prompt, prompt) return c def extract_by_key(d, keys): if isinstance(keys, string_types): keys = keys.split() result = {} for key in keys: if key in d: result[key] = d[key] return result def read_exports(stream): if sys.version_info[0] >= 3: # needs to be a text stream stream = codecs.getreader('utf-8')(stream) # Try to load as JSON, falling back on legacy format data = stream.read() stream = StringIO(data) try: jdata = json.load(stream) result = jdata['extensions']['python.exports']['exports'] for group, entries in result.items(): for k, v in entries.items(): s = '%s = %s' % (k, v) entry = get_export_entry(s) assert entry is not None entries[k] = entry return result except Exception: stream.seek(0, 0) def read_stream(cp, stream): if hasattr(cp, 'read_file'): cp.read_file(stream) else: cp.readfp(stream) cp = configparser.ConfigParser() try: read_stream(cp, stream) except configparser.MissingSectionHeaderError: stream.close() data = textwrap.dedent(data) stream = StringIO(data) read_stream(cp, stream) result = {} for key in cp.sections(): result[key] = entries = {} for name, value in cp.items(key): s = '%s = %s' % (name, value) entry = get_export_entry(s) assert entry is not None #entry.dist = self entries[name] = entry return result def write_exports(exports, stream): if sys.version_info[0] >= 3: # needs to be a text stream stream = codecs.getwriter('utf-8')(stream) cp = configparser.ConfigParser() for k, v in exports.items(): # TODO check k, v for valid values cp.add_section(k) for entry in v.values(): if entry.suffix is None: s = entry.prefix else: s = '%s:%s' % (entry.prefix, entry.suffix) if entry.flags: s = '%s [%s]' % (s, ', '.join(entry.flags)) cp.set(k, entry.name, s) cp.write(stream) @contextlib.contextmanager def tempdir(): td = tempfile.mkdtemp() try: yield td finally: shutil.rmtree(td) @contextlib.contextmanager def chdir(d): cwd = os.getcwd() try: os.chdir(d) yield finally: os.chdir(cwd) @contextlib.contextmanager def socket_timeout(seconds=15): cto = socket.getdefaulttimeout() try: socket.setdefaulttimeout(seconds) yield finally: socket.setdefaulttimeout(cto) class cached_property(object): def __init__(self, func): self.func = func #for attr in ('__name__', '__module__', '__doc__'): # setattr(self, attr, getattr(func, attr, None)) def __get__(self, obj, cls=None): if obj is None: return self value = self.func(obj) object.__setattr__(obj, self.func.__name__, value) #obj.__dict__[self.func.__name__] = value = self.func(obj) return value def convert_path(pathname): """Return 'pathname' as a name that will work on the native filesystem. The path is split on '/' and put back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. """ if os.sep == '/': return pathname if not pathname: return pathname if pathname[0] == '/': raise ValueError("path '%s' cannot be absolute" % pathname) if pathname[-1] == '/': raise ValueError("path '%s' cannot end with '/'" % pathname) paths = pathname.split('/') while os.curdir in paths: paths.remove(os.curdir) if not paths: return os.curdir return os.path.join(*paths) class FileOperator(object): def __init__(self, dry_run=False): self.dry_run = dry_run self.ensured = set() self._init_record() def _init_record(self): self.record = False self.files_written = set() self.dirs_created = set() def record_as_written(self, path): if self.record: self.files_written.add(path) def newer(self, source, target): """Tell if the target is newer than the source. Returns true if 'source' exists and is more recently modified than 'target', or if 'source' exists and 'target' doesn't. Returns false if both exist and 'target' is the same age or younger than 'source'. Raise PackagingFileError if 'source' does not exist. Note that this test is not very accurate: files created in the same second will have the same "age". """ if not os.path.exists(source): raise DistlibException("file '%r' does not exist" % os.path.abspath(source)) if not os.path.exists(target): return True return os.stat(source).st_mtime > os.stat(target).st_mtime def copy_file(self, infile, outfile, check=True): """Copy a file respecting dry-run and force flags. """ self.ensure_dir(os.path.dirname(outfile)) logger.info('Copying %s to %s', infile, outfile) if not self.dry_run: msg = None if check: if os.path.islink(outfile): msg = '%s is a symlink' % outfile elif os.path.exists(outfile) and not os.path.isfile(outfile): msg = '%s is a non-regular file' % outfile if msg: raise ValueError(msg + ' which would be overwritten') shutil.copyfile(infile, outfile) self.record_as_written(outfile) def copy_stream(self, instream, outfile, encoding=None): assert not os.path.isdir(outfile) self.ensure_dir(os.path.dirname(outfile)) logger.info('Copying stream %s to %s', instream, outfile) if not self.dry_run: if encoding is None: outstream = open(outfile, 'wb') else: outstream = codecs.open(outfile, 'w', encoding=encoding) try: shutil.copyfileobj(instream, outstream) finally: outstream.close() self.record_as_written(outfile) def write_binary_file(self, path, data): self.ensure_dir(os.path.dirname(path)) if not self.dry_run: with open(path, 'wb') as f: f.write(data) self.record_as_written(path) def write_text_file(self, path, data, encoding): self.ensure_dir(os.path.dirname(path)) if not self.dry_run: with open(path, 'wb') as f: f.write(data.encode(encoding)) self.record_as_written(path) def set_mode(self, bits, mask, files): if os.name == 'posix' or (os.name == 'java' and os._name == 'posix'): # Set the executable bits (owner, group, and world) on # all the files specified. for f in files: if self.dry_run: logger.info("changing mode of %s", f) else: mode = (os.stat(f).st_mode | bits) & mask logger.info("changing mode of %s to %o", f, mode) os.chmod(f, mode) set_executable_mode = lambda s, f: s.set_mode(0o555, 0o7777, f) def ensure_dir(self, path): path = os.path.abspath(path) if path not in self.ensured and not os.path.exists(path): self.ensured.add(path) d, f = os.path.split(path) self.ensure_dir(d) logger.info('Creating %s' % path) if not self.dry_run: os.mkdir(path) if self.record: self.dirs_created.add(path) def byte_compile(self, path, optimize=False, force=False, prefix=None): dpath = cache_from_source(path, not optimize) logger.info('Byte-compiling %s to %s', path, dpath) if not self.dry_run: if force or self.newer(path, dpath): if not prefix: diagpath = None else: assert path.startswith(prefix) diagpath = path[len(prefix):] py_compile.compile(path, dpath, diagpath, True) # raise error self.record_as_written(dpath) return dpath def ensure_removed(self, path): if os.path.exists(path): if os.path.isdir(path) and not os.path.islink(path): logger.debug('Removing directory tree at %s', path) if not self.dry_run: shutil.rmtree(path) if self.record: if path in self.dirs_created: self.dirs_created.remove(path) else: if os.path.islink(path): s = 'link' else: s = 'file' logger.debug('Removing %s %s', s, path) if not self.dry_run: os.remove(path) if self.record: if path in self.files_written: self.files_written.remove(path) def is_writable(self, path): result = False while not result: if os.path.exists(path): result = os.access(path, os.W_OK) break parent = os.path.dirname(path) if parent == path: break path = parent return result def commit(self): """ Commit recorded changes, turn off recording, return changes. """ assert self.record result = self.files_written, self.dirs_created self._init_record() return result def rollback(self): if not self.dry_run: for f in list(self.files_written): if os.path.exists(f): os.remove(f) # dirs should all be empty now, except perhaps for # __pycache__ subdirs # reverse so that subdirs appear before their parents dirs = sorted(self.dirs_created, reverse=True) for d in dirs: flist = os.listdir(d) if flist: assert flist == ['__pycache__'] sd = os.path.join(d, flist[0]) os.rmdir(sd) os.rmdir(d) # should fail if non-empty self._init_record() def resolve(module_name, dotted_path): if module_name in sys.modules: mod = sys.modules[module_name] else: mod = __import__(module_name) if dotted_path is None: result = mod else: parts = dotted_path.split('.') result = getattr(mod, parts.pop(0)) for p in parts: result = getattr(result, p) return result class ExportEntry(object): def __init__(self, name, prefix, suffix, flags): self.name = name self.prefix = prefix self.suffix = suffix self.flags = flags @cached_property def value(self): return resolve(self.prefix, self.suffix) def __repr__(self): # pragma: no cover return '' % (self.name, self.prefix, self.suffix, self.flags) def __eq__(self, other): if not isinstance(other, ExportEntry): result = False else: result = (self.name == other.name and self.prefix == other.prefix and self.suffix == other.suffix and self.flags == other.flags) return result __hash__ = object.__hash__ ENTRY_RE = re.compile(r'''(?P(\w|[-.+])+) \s*=\s*(?P(\w+)([:\.]\w+)*) \s*(\[\s*(?P\w+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])? ''', re.VERBOSE) def get_export_entry(specification): m = ENTRY_RE.search(specification) if not m: result = None if '[' in specification or ']' in specification: raise DistlibException("Invalid specification " "'%s'" % specification) else: d = m.groupdict() name = d['name'] path = d['callable'] colons = path.count(':') if colons == 0: prefix, suffix = path, None else: if colons != 1: raise DistlibException("Invalid specification " "'%s'" % specification) prefix, suffix = path.split(':') flags = d['flags'] if flags is None: if '[' in specification or ']' in specification: raise DistlibException("Invalid specification " "'%s'" % specification) flags = [] else: flags = [f.strip() for f in flags.split(',')] result = ExportEntry(name, prefix, suffix, flags) return result def get_cache_base(suffix=None): """ Return the default base location for distlib caches. If the directory does not exist, it is created. Use the suffix provided for the base directory, and default to '.distlib' if it isn't provided. On Windows, if LOCALAPPDATA is defined in the environment, then it is assumed to be a directory, and will be the parent directory of the result. On POSIX, and on Windows if LOCALAPPDATA is not defined, the user's home directory - using os.expanduser('~') - will be the parent directory of the result. The result is just the directory '.distlib' in the parent directory as determined above, or with the name specified with ``suffix``. """ if suffix is None: suffix = '.distlib' if os.name == 'nt' and 'LOCALAPPDATA' in os.environ: result = os.path.expandvars('$localappdata') else: # Assume posix, or old Windows result = os.path.expanduser('~') # we use 'isdir' instead of 'exists', because we want to # fail if there's a file with that name if os.path.isdir(result): usable = os.access(result, os.W_OK) if not usable: logger.warning('Directory exists but is not writable: %s', result) else: try: os.makedirs(result) usable = True except OSError: logger.warning('Unable to create %s', result, exc_info=True) usable = False if not usable: result = tempfile.mkdtemp() logger.warning('Default location unusable, using %s', result) return os.path.join(result, suffix) def path_to_cache_dir(path): """ Convert an absolute path to a directory name for use in a cache. The algorithm used is: #. On Windows, any ``':'`` in the drive is replaced with ``'---'``. #. Any occurrence of ``os.sep`` is replaced with ``'--'``. #. ``'.cache'`` is appended. """ d, p = os.path.splitdrive(os.path.abspath(path)) if d: d = d.replace(':', '---') p = p.replace(os.sep, '--') return d + p + '.cache' def ensure_slash(s): if not s.endswith('/'): return s + '/' return s def parse_credentials(netloc): username = password = None if '@' in netloc: prefix, netloc = netloc.split('@', 1) if ':' not in prefix: username = prefix else: username, password = prefix.split(':', 1) return username, password, netloc def get_process_umask(): result = os.umask(0o22) os.umask(result) return result def is_string_sequence(seq): result = True i = None for i, s in enumerate(seq): if not isinstance(s, string_types): result = False break assert i is not None return result PROJECT_NAME_AND_VERSION = re.compile('([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-' '([a-z0-9_.+-]+)', re.I) PYTHON_VERSION = re.compile(r'-py(\d\.?\d?)') def split_filename(filename, project_name=None): """ Extract name, version, python version from a filename (no extension) Return name, version, pyver or None """ result = None pyver = None filename = unquote(filename).replace(' ', '-') m = PYTHON_VERSION.search(filename) if m: pyver = m.group(1) filename = filename[:m.start()] if project_name and len(filename) > len(project_name) + 1: m = re.match(re.escape(project_name) + r'\b', filename) if m: n = m.end() result = filename[:n], filename[n + 1:], pyver if result is None: m = PROJECT_NAME_AND_VERSION.match(filename) if m: result = m.group(1), m.group(3), pyver return result # Allow spaces in name because of legacy dists like "Twisted Core" NAME_VERSION_RE = re.compile(r'(?P[\w .-]+)\s*' r'\(\s*(?P[^\s)]+)\)$') def parse_name_and_version(p): """ A utility method used to get name and version from a string. From e.g. a Provides-Dist value. :param p: A value in a form 'foo (1.0)' :return: The name and version as a tuple. """ m = NAME_VERSION_RE.match(p) if not m: raise DistlibException('Ill-formed name/version string: \'%s\'' % p) d = m.groupdict() return d['name'].strip().lower(), d['ver'] def get_extras(requested, available): result = set() requested = set(requested or []) available = set(available or []) if '*' in requested: requested.remove('*') result |= available for r in requested: if r == '-': result.add(r) elif r.startswith('-'): unwanted = r[1:] if unwanted not in available: logger.warning('undeclared extra: %s' % unwanted) if unwanted in result: result.remove(unwanted) else: if r not in available: logger.warning('undeclared extra: %s' % r) result.add(r) return result # # Extended metadata functionality # def _get_external_data(url): result = {} try: # urlopen might fail if it runs into redirections, # because of Python issue #13696. Fixed in locators # using a custom redirect handler. resp = urlopen(url) headers = resp.info() ct = headers.get('Content-Type') if not ct.startswith('application/json'): logger.debug('Unexpected response for JSON request: %s', ct) else: reader = codecs.getreader('utf-8')(resp) #data = reader.read().decode('utf-8') #result = json.loads(data) result = json.load(reader) except Exception as e: logger.exception('Failed to get external data for %s: %s', url, e) return result _external_data_base_url = 'https://www.red-dove.com/pypi/projects/' def get_project_data(name): url = '%s/%s/project.json' % (name[0].upper(), name) url = urljoin(_external_data_base_url, url) result = _get_external_data(url) return result def get_package_data(name, version): url = '%s/%s/package-%s.json' % (name[0].upper(), name, version) url = urljoin(_external_data_base_url, url) return _get_external_data(url) class Cache(object): """ A class implementing a cache for resources that need to live in the file system e.g. shared libraries. This class was moved from resources to here because it could be used by other modules, e.g. the wheel module. """ def __init__(self, base): """ Initialise an instance. :param base: The base directory where the cache should be located. """ # we use 'isdir' instead of 'exists', because we want to # fail if there's a file with that name if not os.path.isdir(base): # pragma: no cover os.makedirs(base) if (os.stat(base).st_mode & 0o77) != 0: logger.warning('Directory \'%s\' is not private', base) self.base = os.path.abspath(os.path.normpath(base)) def prefix_to_dir(self, prefix): """ Converts a resource prefix to a directory name in the cache. """ return path_to_cache_dir(prefix) def clear(self): """ Clear the cache. """ not_removed = [] for fn in os.listdir(self.base): fn = os.path.join(self.base, fn) try: if os.path.islink(fn) or os.path.isfile(fn): os.remove(fn) elif os.path.isdir(fn): shutil.rmtree(fn) except Exception: not_removed.append(fn) return not_removed class EventMixin(object): """ A very simple publish/subscribe system. """ def __init__(self): self._subscribers = {} def add(self, event, subscriber, append=True): """ Add a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be added (and called when the event is published). :param append: Whether to append or prepend the subscriber to an existing subscriber list for the event. """ subs = self._subscribers if event not in subs: subs[event] = deque([subscriber]) else: sq = subs[event] if append: sq.append(subscriber) else: sq.appendleft(subscriber) def remove(self, event, subscriber): """ Remove a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be removed. """ subs = self._subscribers if event not in subs: raise ValueError('No subscribers: %r' % event) subs[event].remove(subscriber) def get_subscribers(self, event): """ Return an iterator for the subscribers for an event. :param event: The event to return subscribers for. """ return iter(self._subscribers.get(event, ())) def publish(self, event, *args, **kwargs): """ Publish a event and return a list of values returned by its subscribers. :param event: The event to publish. :param args: The positional arguments to pass to the event's subscribers. :param kwargs: The keyword arguments to pass to the event's subscribers. """ result = [] for subscriber in self.get_subscribers(event): try: value = subscriber(event, *args, **kwargs) except Exception: logger.exception('Exception during event publication') value = None result.append(value) logger.debug('publish %s: args = %s, kwargs = %s, result = %s', event, args, kwargs, result) return result # # Simple sequencing # class Sequencer(object): def __init__(self): self._preds = {} self._succs = {} self._nodes = set() # nodes with no preds/succs def add_node(self, node): self._nodes.add(node) def remove_node(self, node, edges=False): if node in self._nodes: self._nodes.remove(node) if edges: for p in set(self._preds.get(node, ())): self.remove(p, node) for s in set(self._succs.get(node, ())): self.remove(node, s) # Remove empties for k, v in list(self._preds.items()): if not v: del self._preds[k] for k, v in list(self._succs.items()): if not v: del self._succs[k] def add(self, pred, succ): assert pred != succ self._preds.setdefault(succ, set()).add(pred) self._succs.setdefault(pred, set()).add(succ) def remove(self, pred, succ): assert pred != succ try: preds = self._preds[succ] succs = self._succs[pred] except KeyError: # pragma: no cover raise ValueError('%r not a successor of anything' % succ) try: preds.remove(pred) succs.remove(succ) except KeyError: # pragma: no cover raise ValueError('%r not a successor of %r' % (succ, pred)) def is_step(self, step): return (step in self._preds or step in self._succs or step in self._nodes) def get_steps(self, final): if not self.is_step(final): raise ValueError('Unknown: %r' % final) result = [] todo = [] seen = set() todo.append(final) while todo: step = todo.pop(0) if step in seen: # if a step was already seen, # move it to the end (so it will appear earlier # when reversed on return) ... but not for the # final step, as that would be confusing for # users if step != final: result.remove(step) result.append(step) else: seen.add(step) result.append(step) preds = self._preds.get(step, ()) todo.extend(preds) return reversed(result) @property def strong_connections(self): #http://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm index_counter = [0] stack = [] lowlinks = {} index = {} result = [] graph = self._succs def strongconnect(node): # set the depth index for this node to the smallest unused index index[node] = index_counter[0] lowlinks[node] = index_counter[0] index_counter[0] += 1 stack.append(node) # Consider successors try: successors = graph[node] except Exception: successors = [] for successor in successors: if successor not in lowlinks: # Successor has not yet been visited strongconnect(successor) lowlinks[node] = min(lowlinks[node],lowlinks[successor]) elif successor in stack: # the successor is in the stack and hence in the current # strongly connected component (SCC) lowlinks[node] = min(lowlinks[node],index[successor]) # If `node` is a root node, pop the stack and generate an SCC if lowlinks[node] == index[node]: connected_component = [] while True: successor = stack.pop() connected_component.append(successor) if successor == node: break component = tuple(connected_component) # storing the result result.append(component) for node in graph: if node not in lowlinks: strongconnect(node) return result @property def dot(self): result = ['digraph G {'] for succ in self._preds: preds = self._preds[succ] for pred in preds: result.append(' %s -> %s;' % (pred, succ)) for node in self._nodes: result.append(' %s;' % node) result.append('}') return '\n'.join(result) # # Unarchiving functionality for zip, tar, tgz, tbz, whl # ARCHIVE_EXTENSIONS = ('.tar.gz', '.tar.bz2', '.tar', '.zip', '.tgz', '.tbz', '.whl') def unarchive(archive_filename, dest_dir, format=None, check=True): def check_path(path): if not isinstance(path, text_type): path = path.decode('utf-8') p = os.path.abspath(os.path.join(dest_dir, path)) if not p.startswith(dest_dir) or p[plen] != os.sep: raise ValueError('path outside destination: %r' % p) dest_dir = os.path.abspath(dest_dir) plen = len(dest_dir) archive = None if format is None: if archive_filename.endswith(('.zip', '.whl')): format = 'zip' elif archive_filename.endswith(('.tar.gz', '.tgz')): format = 'tgz' mode = 'r:gz' elif archive_filename.endswith(('.tar.bz2', '.tbz')): format = 'tbz' mode = 'r:bz2' elif archive_filename.endswith('.tar'): format = 'tar' mode = 'r' else: # pragma: no cover raise ValueError('Unknown format for %r' % archive_filename) try: if format == 'zip': archive = ZipFile(archive_filename, 'r') if check: names = archive.namelist() for name in names: check_path(name) else: archive = tarfile.open(archive_filename, mode) if check: names = archive.getnames() for name in names: check_path(name) if format != 'zip' and sys.version_info[0] < 3: # See Python issue 17153. If the dest path contains Unicode, # tarfile extraction fails on Python 2.x if a member path name # contains non-ASCII characters - it leads to an implicit # bytes -> unicode conversion using ASCII to decode. for tarinfo in archive.getmembers(): if not isinstance(tarinfo.name, text_type): tarinfo.name = tarinfo.name.decode('utf-8') archive.extractall(dest_dir) finally: if archive: archive.close() def zip_dir(directory): """zip a directory tree into a BytesIO object""" result = io.BytesIO() dlen = len(directory) with ZipFile(result, "w") as zf: for root, dirs, files in os.walk(directory): for name in files: full = os.path.join(root, name) rel = root[dlen:] dest = os.path.join(rel, name) zf.write(full, dest) return result # # Simple progress bar # UNITS = ('', 'K', 'M', 'G','T','P') class Progress(object): unknown = 'UNKNOWN' def __init__(self, minval=0, maxval=100): assert maxval is None or maxval >= minval self.min = self.cur = minval self.max = maxval self.started = None self.elapsed = 0 self.done = False def update(self, curval): assert self.min <= curval assert self.max is None or curval <= self.max self.cur = curval now = time.time() if self.started is None: self.started = now else: self.elapsed = now - self.started def increment(self, incr): assert incr >= 0 self.update(self.cur + incr) def start(self): self.update(self.min) return self def stop(self): if self.max is not None: self.update(self.max) self.done = True @property def maximum(self): return self.unknown if self.max is None else self.max @property def percentage(self): if self.done: result = '100 %' elif self.max is None: result = ' ?? %' else: v = 100.0 * (self.cur - self.min) / (self.max - self.min) result = '%3d %%' % v return result def format_duration(self, duration): if (duration <= 0) and self.max is None or self.cur == self.min: result = '??:??:??' #elif duration < 1: # result = '--:--:--' else: result = time.strftime('%H:%M:%S', time.gmtime(duration)) return result @property def ETA(self): if self.done: prefix = 'Done' t = self.elapsed #import pdb; pdb.set_trace() else: prefix = 'ETA ' if self.max is None: t = -1 elif self.elapsed == 0 or (self.cur == self.min): t = 0 else: #import pdb; pdb.set_trace() t = float(self.max - self.min) t /= self.cur - self.min t = (t - 1) * self.elapsed return '%s: %s' % (prefix, self.format_duration(t)) @property def speed(self): if self.elapsed == 0: result = 0.0 else: result = (self.cur - self.min) / self.elapsed for unit in UNITS: if result < 1000: break result /= 1000.0 return '%d %sB/s' % (result, unit) # # Glob functionality # RICH_GLOB = re.compile(r'\{([^}]*)\}') _CHECK_RECURSIVE_GLOB = re.compile(r'[^/\\,{]\*\*|\*\*[^/\\,}]') _CHECK_MISMATCH_SET = re.compile(r'^[^{]*\}|\{[^}]*$') def iglob(path_glob): """Extended globbing function that supports ** and {opt1,opt2,opt3}.""" if _CHECK_RECURSIVE_GLOB.search(path_glob): msg = """invalid glob %r: recursive glob "**" must be used alone""" raise ValueError(msg % path_glob) if _CHECK_MISMATCH_SET.search(path_glob): msg = """invalid glob %r: mismatching set marker '{' or '}'""" raise ValueError(msg % path_glob) return _iglob(path_glob) def _iglob(path_glob): rich_path_glob = RICH_GLOB.split(path_glob, 1) if len(rich_path_glob) > 1: assert len(rich_path_glob) == 3, rich_path_glob prefix, set, suffix = rich_path_glob for item in set.split(','): for path in _iglob(''.join((prefix, item, suffix))): yield path else: if '**' not in path_glob: for item in std_iglob(path_glob): yield item else: prefix, radical = path_glob.split('**', 1) if prefix == '': prefix = '.' if radical == '': radical = '*' else: # we support both radical = radical.lstrip('/') radical = radical.lstrip('\\') for path, dir, files in os.walk(prefix): path = os.path.normpath(path) for fn in _iglob(os.path.join(path, radical)): yield fn if ssl: from .compat import (HTTPSHandler as BaseHTTPSHandler, match_hostname, CertificateError) # # HTTPSConnection which verifies certificates/matches domains # class HTTPSConnection(httplib.HTTPSConnection): ca_certs = None # set this to the path to the certs file (.pem) check_domain = True # only used if ca_certs is not None # noinspection PyPropertyAccess def connect(self): sock = socket.create_connection((self.host, self.port), self.timeout) if getattr(self, '_tunnel_host', False): self.sock = sock self._tunnel() if not hasattr(ssl, 'SSLContext'): # For 2.x if self.ca_certs: cert_reqs = ssl.CERT_REQUIRED else: cert_reqs = ssl.CERT_NONE self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, cert_reqs=cert_reqs, ssl_version=ssl.PROTOCOL_SSLv23, ca_certs=self.ca_certs) else: # pragma: no cover context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) context.options |= ssl.OP_NO_SSLv2 if self.cert_file: context.load_cert_chain(self.cert_file, self.key_file) kwargs = {} if self.ca_certs: context.verify_mode = ssl.CERT_REQUIRED context.load_verify_locations(cafile=self.ca_certs) if getattr(ssl, 'HAS_SNI', False): kwargs['server_hostname'] = self.host self.sock = context.wrap_socket(sock, **kwargs) if self.ca_certs and self.check_domain: try: match_hostname(self.sock.getpeercert(), self.host) logger.debug('Host verified: %s', self.host) except CertificateError: # pragma: no cover self.sock.shutdown(socket.SHUT_RDWR) self.sock.close() raise class HTTPSHandler(BaseHTTPSHandler): def __init__(self, ca_certs, check_domain=True): BaseHTTPSHandler.__init__(self) self.ca_certs = ca_certs self.check_domain = check_domain def _conn_maker(self, *args, **kwargs): """ This is called to create a connection instance. Normally you'd pass a connection class to do_open, but it doesn't actually check for a class, and just expects a callable. As long as we behave just as a constructor would have, we should be OK. If it ever changes so that we *must* pass a class, we'll create an UnsafeHTTPSConnection class which just sets check_domain to False in the class definition, and choose which one to pass to do_open. """ result = HTTPSConnection(*args, **kwargs) if self.ca_certs: result.ca_certs = self.ca_certs result.check_domain = self.check_domain return result def https_open(self, req): try: return self.do_open(self._conn_maker, req) except URLError as e: if 'certificate verify failed' in str(e.reason): raise CertificateError('Unable to verify server certificate ' 'for %s' % req.host) else: raise # # To prevent against mixing HTTP traffic with HTTPS (examples: A Man-In-The- # Middle proxy using HTTP listens on port 443, or an index mistakenly serves # HTML containing a http://xyz link when it should be https://xyz), # you can use the following handler class, which does not allow HTTP traffic. # # It works by inheriting from HTTPHandler - so build_opener won't add a # handler for HTTP itself. # class HTTPSOnlyHandler(HTTPSHandler, HTTPHandler): def http_open(self, req): raise URLError('Unexpected HTTP request on what should be a secure ' 'connection: %s' % req) # # XML-RPC with timeouts # _ver_info = sys.version_info[:2] if _ver_info == (2, 6): class HTTP(httplib.HTTP): def __init__(self, host='', port=None, **kwargs): if port == 0: # 0 means use port 0, not the default port port = None self._setup(self._connection_class(host, port, **kwargs)) if ssl: class HTTPS(httplib.HTTPS): def __init__(self, host='', port=None, **kwargs): if port == 0: # 0 means use port 0, not the default port port = None self._setup(self._connection_class(host, port, **kwargs)) class Transport(xmlrpclib.Transport): def __init__(self, timeout, use_datetime=0): self.timeout = timeout xmlrpclib.Transport.__init__(self, use_datetime) def make_connection(self, host): h, eh, x509 = self.get_host_info(host) if _ver_info == (2, 6): result = HTTP(h, timeout=self.timeout) else: if not self._connection or host != self._connection[0]: self._extra_headers = eh self._connection = host, httplib.HTTPConnection(h) result = self._connection[1] return result if ssl: class SafeTransport(xmlrpclib.SafeTransport): def __init__(self, timeout, use_datetime=0): self.timeout = timeout xmlrpclib.SafeTransport.__init__(self, use_datetime) def make_connection(self, host): h, eh, kwargs = self.get_host_info(host) if not kwargs: kwargs = {} kwargs['timeout'] = self.timeout if _ver_info == (2, 6): result = HTTPS(host, None, **kwargs) else: if not self._connection or host != self._connection[0]: self._extra_headers = eh self._connection = host, httplib.HTTPSConnection(h, None, **kwargs) result = self._connection[1] return result class ServerProxy(xmlrpclib.ServerProxy): def __init__(self, uri, **kwargs): self.timeout = timeout = kwargs.pop('timeout', None) # The above classes only come into play if a timeout # is specified if timeout is not None: scheme, _ = splittype(uri) use_datetime = kwargs.get('use_datetime', 0) if scheme == 'https': tcls = SafeTransport else: tcls = Transport kwargs['transport'] = t = tcls(timeout, use_datetime=use_datetime) self.transport = t xmlrpclib.ServerProxy.__init__(self, uri, **kwargs) # # CSV functionality. This is provided because on 2.x, the csv module can't # handle Unicode. However, we need to deal with Unicode in e.g. RECORD files. # def _csv_open(fn, mode, **kwargs): if sys.version_info[0] < 3: mode += 'b' else: kwargs['newline'] = '' return open(fn, mode, **kwargs) class CSVBase(object): defaults = { 'delimiter': str(','), # The strs are used because we need native 'quotechar': str('"'), # str in the csv API (2.x won't take 'lineterminator': str('\n') # Unicode) } def __enter__(self): return self def __exit__(self, *exc_info): self.stream.close() class CSVReader(CSVBase): def __init__(self, **kwargs): if 'stream' in kwargs: stream = kwargs['stream'] if sys.version_info[0] >= 3: # needs to be a text stream stream = codecs.getreader('utf-8')(stream) self.stream = stream else: self.stream = _csv_open(kwargs['path'], 'r') self.reader = csv.reader(self.stream, **self.defaults) def __iter__(self): return self def next(self): result = next(self.reader) if sys.version_info[0] < 3: for i, item in enumerate(result): if not isinstance(item, text_type): result[i] = item.decode('utf-8') return result __next__ = next class CSVWriter(CSVBase): def __init__(self, fn, **kwargs): self.stream = _csv_open(fn, 'w') self.writer = csv.writer(self.stream, **self.defaults) def writerow(self, row): if sys.version_info[0] < 3: r = [] for item in row: if isinstance(item, text_type): item = item.encode('utf-8') r.append(item) row = r self.writer.writerow(row) # # Configurator functionality # class Configurator(BaseConfigurator): value_converters = dict(BaseConfigurator.value_converters) value_converters['inc'] = 'inc_convert' def __init__(self, config, base=None): super(Configurator, self).__init__(config) self.base = base or os.getcwd() def configure_custom(self, config): def convert(o): if isinstance(o, (list, tuple)): result = type(o)([convert(i) for i in o]) elif isinstance(o, dict): if '()' in o: result = self.configure_custom(o) else: result = {} for k in o: result[k] = convert(o[k]) else: result = self.convert(o) return result c = config.pop('()') if not callable(c): c = self.resolve(c) props = config.pop('.', None) # Check for valid identifiers args = config.pop('[]', ()) if args: args = tuple([convert(o) for o in args]) items = [(k, convert(config[k])) for k in config if valid_ident(k)] kwargs = dict(items) result = c(*args, **kwargs) if props: for n, v in props.items(): setattr(result, n, convert(v)) return result def __getitem__(self, key): result = self.config[key] if isinstance(result, dict) and '()' in result: self.config[key] = result = self.configure_custom(result) return result def inc_convert(self, value): """Default converter for the inc:// protocol.""" if not os.path.isabs(value): value = os.path.join(self.base, value) with codecs.open(value, 'r', encoding='utf-8') as f: result = json.load(f) return result # # Mixin for running subprocesses and capturing their output # class SubprocessMixin(object): def __init__(self, verbose=False, progress=None): self.verbose = verbose self.progress = progress def reader(self, stream, context): """ Read lines from a subprocess' output stream and either pass to a progress callable (if specified) or write progress information to sys.stderr. """ progress = self.progress verbose = self.verbose while True: s = stream.readline() if not s: break if progress is not None: progress(s, context) else: if not verbose: sys.stderr.write('.') else: sys.stderr.write(s.decode('utf-8')) sys.stderr.flush() stream.close() def run_command(self, cmd, **kwargs): p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs) t1 = threading.Thread(target=self.reader, args=(p.stdout, 'stdout')) t1.start() t2 = threading.Thread(target=self.reader, args=(p.stderr, 'stderr')) t2.start() p.wait() t1.join() t2.join() if self.progress is not None: self.progress('done.', 'main') elif self.verbose: sys.stderr.write('done.\n') return p def normalize_name(name): """Normalize a python package name a la PEP 503""" # https://www.python.org/dev/peps/pep-0503/#normalized-names return re.sub('[-_.]+', '-', name).lower() site-packages/pip/_vendor/distlib/util.pyc000064400000157044147204247350014657 0ustar00 abc@sddlZddlmZddlZddlZddlmZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZyddlZWnek rdZnXddlZddlZddlZddlZddlZyddlZWnek r9ddlZnXddlZddlmZddlmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0e j1e2Z3dZ4e j5e4Z6dZ7d e7d Z8e7d Z9d Z:d e:de9de4d e:de9dZ;dZ<de;de<de;dZ=e8d e4e8dZ>de>dZ?de7de?de=dZ@e j5e@ZAde:de9d ZBe j5eBZCdZDd ZEd!ZFd"ZGddd#ZHd$ZId%ZJd&ZKejLd'ZMejLd(ZNejLd)d*ZOd+ePfd,YZQd-ZRd.ePfd/YZSd0ZTd1ePfd2YZUe j5d3e jVZWd4ZXdd5ZYd6ZZd7Z[d8Z\d9Z]d:Z^e j5d;e j_Z`e j5d<Zadd=Zbe j5d>Zcd?Zdd@ZedAZfdBZgdCZhdDZidEePfdFYZjdGePfdHYZkdIePfdJYZldZmdendRZodSZpdZqdZePfd[YZre j5d\Zse j5d]Zte j5d^Zud_Zd`ZverddalmwZxmyZymzZzdbe%j{fdcYZ{ddexfdeYZwdfewe(fdgYZ|nej}dh Z~e~dkr dje%jfdkYZer dle%jfdmYZq ndne&jfdoYZerFdpe&jfdqYZndre&jfdsYZdtZduePfdvYZdwefdxYZdyefdzYZd{e)fd|YZd}ePfd~YZdZdS(iN(tdeque(tiglobi(tDistlibException(t string_typest text_typetshutilt raw_inputtStringIOtcache_from_sourceturlopenturljointhttplibt xmlrpclibt splittypet HTTPHandlertBaseConfiguratort valid_identt Containert configparsertURLErrortZipFiletfsdecodetunquotes\s*,\s*s (\w|[.-])+s(\*|:(\*|\w+):|t)s\*?s([<>=!~]=)|[<>]t(s)?\s*(s)(s)\s*(s))*s(from\s+(?P.*))s \(\s*(?Pt|s)\s*\)|(?Ps\s*)s)*s \[\s*(?Ps)?\s*\]s(?Ps \s*)?(\s*s)?$s(?Ps )\s*(?Pc Cskd}d}tj|}|rg|j}|d}|dpK|d}|dsad}nd}|dj}|sd}d}|d} n{|ddkrd |}ntj|} g| D]}||^q}d |d jg|D]} d | ^qf} |d s$d} ntj |d } t d|d|d| d| d|d|}n|S(NcSs|j}|d|dfS(Ntoptvn(t groupdict(tmtd((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytget_constraintYs tdntc1tc2tdireftis<>!=s~=s%s (%s)s, s%s %stextnamet constraintstextrast requirementtsourceturl( tNonetREQUIREMENT_REtmatchRtstriptRELOP_IDENT_REtfinditertjointCOMMA_REtsplitR( tsRtresultRRR&tconsR+tconstrtrstiteratortconR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytparse_requirementWs4       0  cCsd}i}x|D]\}}}tjj||}xt|D]}tjj||} xt| D]v} ||| } |dkr|j| dqo||| } |jtjjdjd} | d| || RAtrstrip(tresources_roottrulesRGt destinationsRFtsuffixtdesttprefixtabs_basetabs_globtabs_patht resource_filetrel_pathtrel_dest((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytget_resources_dests|s  !cCs:ttdrt}ntjttdtjk}|S(Nt real_prefixt base_prefix(thasattrtsystTrueROtgetattr(R6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytin_venvs cCs7tjjtj}t|ts3t|}n|S(N(R?R@tnormcaseRZt executablet isinstanceRR(R6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytget_executables cCs|}xwtrt|}|}| r7|r7|}n|r |dj}||kr]Pn|r|d|||f}q|q q W|S(Nis %c: %s %s(R[Rtlower(tpromptt allowed_charst error_prompttdefaulttpR5tc((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytproceeds     cCsVt|tr|j}ni}x+|D]#}||kr+||||R$cCstjj|}||jkrtjj| r|jj|tjj|\}}|j|tj d||j stj |n|j r|j j|qndS(Ns Creating %s(R?R@RRRRR4RRRRtmkdirRR(RR@RR((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRs"   cCst|| }tjd|||js|sD|j||r{|sSd}q{|j|sht|t|}nt j |||t n|j ||S(NsByte-compiling %s to %s( RRRRRR,RBRCRDt py_compiletcompileR[R(RR@toptimizetforceROtdpathtdiagpath((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt byte_compiles   cCstjj|rtjj|rtjj| rtjd||js`tj |n|j r ||j kr|j j |qq qtjj|rd}nd}tjd|||jstj |n|j r||j kr |j j |q qndS(NsRemoving directory tree at %stlinktfilesRemoving %s %s(R?R@RRRRtdebugRRRRRRR(RR@R5((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytensure_removeds"%     cCsjt}x]|setjj|r:tj|tj}Pntjj|}||kr\Pn|}q W|S(N(RR?R@RtaccesstW_OKR(RR@R6tparent((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt is_writables   cCs/|jst|j|jf}|j|S(sV Commit recorded changes, turn off recording, return changes. (RRCRRR(RR6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytcommits cCs|jsx9t|jD](}tjj|rtj|qqWt|jdt }xq|D]f}tj |}|r|dgkst tjj ||d}tj |ntj |qaWn|jdS(Ntreverset __pycache__i(RtlistRR?R@RRtsortedRR[tlistdirRCR2trmdirR(RRtdirsRtflisttsd((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytrollbacks  N(RRRRRRRR[RR,RRRRtset_executable_modeRRRRRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRQs             cCs|tjkrtj|}n t|}|dkr@|}nG|jd}t||jd}x|D]}t||}qnW|S(Nt.i(RZtmodulest __import__R,R4R\RH(t module_namet dotted_pathtmodR6tpartsRg((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytresolves    t ExportEntrycBs;eZdZedZdZdZejZRS(cCs(||_||_||_||_dS(N(R&RORMR(RR&RORMR((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRs   cCst|j|jS(N(R RORM(R((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRscCs d|j|j|j|jfS(Ns(R&RORMR(R((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt__repr__!scCsdt|tst}nH|j|jko]|j|jko]|j|jko]|j|jk}|S(N(R`R RR&RORMR(RtotherR6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt__eq__%s ( RRRRRR RRt__hash__(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR s    s(?P(\w|[-.+])+) \s*=\s*(?P(\w+)([:\.]\w+)*) \s*(\[\s*(?P\w+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])? c CsStj|}|sId}d|ks3d|krOtd|qOn|j}|d}|d}|jd}|dkr|d}}n4|dkrtd|n|jd\}}|d } | dkrd|ksd|kr td|ng} n(g| jd D]} | j^q"} t|||| }|S( Nt[t]sInvalid specification '%s'R&tcallablet:iiRt,( tENTRY_REtsearchR,RRtcountR4R/R ( t specificationRR6RR&R@tcolonsRORMRR((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR{7s2          (cCs|d krd}ntjdkrHdtjkrHtjjd}ntjjd}tjj|rtj|tj }|st j d|qnGytj |t }Wn-tk rt j d|dt t}nX|s tj}t j d |ntjj||S( s Return the default base location for distlib caches. If the directory does not exist, it is created. Use the suffix provided for the base directory, and default to '.distlib' if it isn't provided. On Windows, if LOCALAPPDATA is defined in the environment, then it is assumed to be a directory, and will be the parent directory of the result. On POSIX, and on Windows if LOCALAPPDATA is not defined, the user's home directory - using os.expanduser('~') - will be the parent directory of the result. The result is just the directory '.distlib' in the parent directory as determined above, or with the name specified with ``suffix``. s.distlibtntt LOCALAPPDATAs $localappdatat~s(Directory exists but is not writable: %ssUnable to create %stexc_infos#Default location unusable, using %sN(R,R?R&tenvironR@t expandvarst expanduserRRRRtwarningtmakedirsR[tOSErrorRRRR2(RMR6tusable((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytget_cache_baseVs&       cCs`tjjtjj|\}}|r?|jdd}n|jtjd}||dS(s Convert an absolute path to a directory name for use in a cache. The algorithm used is: #. On Windows, any ``':'`` in the drive is replaced with ``'---'``. #. Any occurrence of ``os.sep`` is replaced with ``'--'``. #. ``'.cache'`` is appended. Rs---s--s.cache(R?R@t splitdriveRR>RA(R@RRg((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytpath_to_cache_dirs $cCs|jds|dS|S(NR=(tendswith(R5((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt ensure_slashscCskd}}d|kr^|jdd\}}d|krC|}q^|jdd\}}n|||fS(Nt@iR(R,R4(tnetloctusernametpasswordRO((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytparse_credentialss    cCs tjd}tj||S(Ni(R?tumask(R6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytget_process_umasks cCsXt}d}x3t|D]%\}}t|tst}PqqW|dk sTt|S(N(R[R,t enumerateR`RRRC(tseqR6tiR5((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytis_string_sequencess3([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-([a-z0-9_.+-]+)s -py(\d\.?\d?)cCsd}d}t|jdd}tj|}|r[|jd}||j }n|rt|t|dkrtj tj |d|}|r|j }|| ||d|f}qn|dkrt j |}|r|jd|jd|f}qn|S(sw Extract name, version, python version from a filename (no extension) Return name, version, pyver or None t t-is\biN( R,RR>tPYTHON_VERSIONRRtstartRDtreR.tescapetendtPROJECT_NAME_AND_VERSION(tfilenamet project_nameR6tpyverRtn((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytsplit_filenames"" ! 's-(?P[\w .-]+)\s*\(\s*(?P[^\s)]+)\)$cCsRtj|}|s(td|n|j}|djj|dfS(s A utility method used to get name and version from a string. From e.g. a Provides-Dist value. :param p: A value in a form 'foo (1.0)' :return: The name and version as a tuple. s$Ill-formed name/version string: '%s'R&tver(tNAME_VERSION_RER.RRR/Rb(RgRR((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytparse_name_and_versions  cCs t}t|pg}t|p'g}d|krS|jd||O}nx|D]}|dkr||j|qZ|jdr|d}||krtjd|n||kr|j|qqZ||krtjd|n|j|qZW|S(Nt*R6isundeclared extra: %s(RRRRBRR!(t requestedt availableR6trtunwanted((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt get_extrass&          cCsi}yqt|}|j}|jd}|jdsRtjd|n$tjd|}tj |}Wn&t k r}tj d||nX|S(Ns Content-Typesapplication/jsons(Unexpected response for JSON request: %ssutf-8s&Failed to get external data for %s: %s( R RtgetRBRRRuRvRxRyR|t exception(R+R6tresptheaderstcttreaderte((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt_get_external_datas  s'https://www.red-dove.com/pypi/projects/cCs9d|dj|f}tt|}t|}|S(Ns%s/%s/project.jsoni(tupperR t_external_data_base_urlRR(R&R+R6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytget_project_datas cCs6d|dj||f}tt|}t|S(Ns%s/%s/package-%s.jsoni(RSR RTRR(R&tversionR+((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytget_package_datastCachecBs)eZdZdZdZdZRS(s A class implementing a cache for resources that need to live in the file system e.g. shared libraries. This class was moved from resources to here because it could be used by other modules, e.g. the wheel module. cCsvtjj|s"tj|ntj|jd@dkrQtjd|ntjjtjj ||_ dS(su Initialise an instance. :param base: The base directory where the cache should be located. i?isDirectory '%s' is not privateN( R?R@RR"RRRR!RtnormpathRF(RRF((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR"s cCs t|S(sN Converts a resource prefix to a directory name in the cache. (R'(RRO((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt prefix_to_dir0scCsg}xtj|jD]}tjj|j|}yZtjj|s^tjj|rntj|n"tjj|rt j |nWqt k r|j |qXqW|S(s" Clear the cache. ( R?RRFR@R2RRRRRRR|tappend(Rt not_removedtfn((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytclear6s$ (RRt__doc__RRZR^(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRXs  t EventMixincBs>eZdZdZedZdZdZdZRS(s1 A very simple publish/subscribe system. cCs i|_dS(N(t _subscribers(R((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRKscCs\|j}||kr+t|g|| %s;s %s;t}s (RmR[RoR2(RR6RvRxRuRp((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytdot s    ( RRRRqRRsRRR{RtpropertyRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRls      3s.tar.gzs.tar.bz2s.tars.zips.tgzs.tbzs.whlc sfd}tjjtd}|dkr|jdrZd}q|jdrxd}d}q|jdrd }d }q|jd rd}d}qtd|nz|dkrt|d}|rZ|j}x|D]}||qWqZnBt j ||}|rZ|j }x|D]}||qCWn|dkrt j ddkrxA|jD]0} t| jts| jjd| _qqWn|jWd|r|jnXdS(Ncs|t|ts!|jd}ntjjtjj|}|j se|tjkrxt d|ndS(Nsutf-8spath outside destination: %r( R`RtdecodeR?R@RR2RBRAR(R@Rg(tdest_dirtplen(s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt check_paths !#s.zips.whltzips.tar.gzs.tgzttgzsr:gzs.tar.bz2s.tbzttbzsr:bz2s.tarttarRHsUnknown format for %riisutf-8(s.zips.whl(s.tar.gzs.tgz(s.tar.bz2s.tbz(R?R@RRDR,R(RRtnamelistttarfileRtgetnamesRZRtt getmembersR`R&RRt extractallR( tarchive_filenameRtformatRRtarchiveRtnamesR&ttarinfo((RRs</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt unarchivesH           c Cstj}t|}t|d}xutj|D]d\}}}xR|D]J}tjj||}||} tjj| |} |j|| qPWq:WWdQX|S(s*zip a directory tree into a BytesIO objectRN( tiotBytesIORDRR?twalkR@R2R( t directoryR6tdlentzftrootRRR&tfulltrelRN((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytzip_dirSs    R$tKtMtGtTtPtProgresscBseZdZdddZdZdZdZdZedZ ed Z d Z ed Z ed Z RS( tUNKNOWNiidcCsV|dks||kst||_|_||_d|_d|_t|_dS(Ni( R,RCRtcurtmaxtstartedtelapsedRtdone(Rtminvaltmaxval((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRjs    cCs}|j|kst|jdks9||jks9t||_tj}|jdkri||_n||j|_dS(N(RRCRR,RttimeRR(Rtcurvaltnow((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytupdaters$   cCs*|dkst|j|j|dS(Ni(RCRR(Rtincr((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt increment|scCs|j|j|S(N(RR(R((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR8scCs/|jdk r"|j|jnt|_dS(N(RR,RR[R(R((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytstopscCs|jdkr|jS|jS(N(RR,tunknown(R((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytmaximumscCsZ|jrd}nD|jdkr*d}n,d|j|j|j|j}d|}|S(Ns100 %s ?? %gY@s%3d %%(RRR,RR(RR6R((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt percentages   " cCsU|dkr|jdks-|j|jkr6d}ntjdtj|}|S(Nis??:??:??s%H:%M:%S(RR,RRRtstrftimetgmtime(RtdurationR6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytformat_durations- cCs|jrd}|j}nd}|jdkr9d}ne|jdksZ|j|jkrcd}n;t|j|j}||j|j:}|d|j}d||j|fS(NtDonesETA iiis%s: %s(RRRR,RRtfloatR(RROtt((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytETAs   ! cCsh|jdkrd}n|j|j|j}x(tD] }|dkrLPn|d:}q6Wd||fS(Nigig@@s%d %sB/s(RRRtUNITS(RR6tunit((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytspeeds   (RRRRRRR8RRRRRRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRgs    s \{([^}]*)\}s[^/\\,{]\*\*|\*\*[^/\\,}]s^[^{]*\}|\{[^}]*$cCsZtj|r(d}t||ntj|rPd}t||nt|S(sAExtended globbing function that supports ** and {opt1,opt2,opt3}.s7invalid glob %r: recursive glob "**" must be used alones2invalid glob %r: mismatching set marker '{' or '}'(t_CHECK_RECURSIVE_GLOBRRt_CHECK_MISMATCH_SETt_iglob(t path_globR((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRsc cstj|d}t|dkrt|dksBt||\}}}x3|jdD]4}x+tdj|||fD] }|VqWqaWnd|krxt|D] }|VqWn|jdd\}}|dkrd}n|dkr d}n|jd}|jd }x]tj |D]L\}}} tj j |}x(ttj j||D] } | VqtWq7WdS( NiiRR$s**RRER=s\( t RICH_GLOBR4RDRCRR2t std_iglobRER?RR@RY( Rtrich_path_globRORRMtitemR@tradicaltdirRR]((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRs*%      "(t HTTPSHandlertmatch_hostnametCertificateErrortHTTPSConnectioncBseZdZeZdZRS(c Cstj|j|jf|j}t|dtrI||_|jnt t ds|j rmt j }n t j }t j||j|jd|dt jd|j |_nt jt j}|jt jO_|jr|j|j|jni}|j rHt j |_|jd|j tt dtrH|j|d!           N(RRR,RR[RR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRsRcBs&eZedZdZdZRS(cCs#tj|||_||_dS(N(tBaseHTTPSHandlerRRR(RRR((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR#s  cOs7t||}|jr3|j|_|j|_n|S(s This is called to create a connection instance. Normally you'd pass a connection class to do_open, but it doesn't actually check for a class, and just expects a callable. As long as we behave just as a constructor would have, we should be OK. If it ever changes so that we *must* pass a class, we'll create an UnsafeHTTPSConnection class which just sets check_domain to False in the class definition, and choose which one to pass to do_open. (RRR(RRiRjR6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt _conn_maker(s   cCs_y|j|j|SWnAtk rZ}dt|jkrTtd|jq[nXdS(Nscertificate verify faileds*Unable to verify server certificate for %s(tdo_openRRtstrtreasonRR(RtreqRQ((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt https_open8s(RRR[RRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR"s  tHTTPSOnlyHandlercBseZdZRS(cCstd|dS(NsAUnexpected HTTP request on what should be a secure connection: %s(R(RR((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt http_openLs(RRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRKsiitHTTPcBseZdddZRS(R$cKs5|dkrd}n|j|j|||dS(Ni(R,t_setupt_connection_class(RRRRj((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRXs  N(RRR,R(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR WstHTTPScBseZdddZRS(R$cKs5|dkrd}n|j|j|||dS(Ni(R,R R (RRRRj((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR`s  N(RRR,R(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR _st TransportcBseZddZdZRS(icCs ||_tjj||dS(N(RR R R(RRt use_datetime((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRgs cCs|j|\}}}tdkr<t|d|j}nN|j sY||jdkr}||_|tj|f|_n|jd}|S(NiiRii(ii(t get_host_infot _ver_infoR Rt _connectiont_extra_headersR tHTTPConnection(RRthtehtx509R6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytmake_connectionks   (RRRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR fs t SafeTransportcBseZddZdZRS(icCs ||_tjj||dS(N(RR RR(RRR((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRxs cCs|j|\}}}|s'i}n|j|ds                      . %   /       )           ,H6 ] *)   :+site-packages/pip/_vendor/distlib/util.pyo000064400000156062147204247350014672 0ustar00 abc@sddlZddlmZddlZddlZddlmZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZyddlZWnek rdZnXddlZddlZddlZddlZddlZyddlZWnek r9ddlZnXddlZddlmZddlmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0e j1e2Z3dZ4e j5e4Z6dZ7d e7d Z8e7d Z9d Z:d e:de9de4d e:de9dZ;dZ<de;de<de;dZ=e8d e4e8dZ>de>dZ?de7de?de=dZ@e j5e@ZAde:de9d ZBe j5eBZCdZDd ZEd!ZFd"ZGddd#ZHd$ZId%ZJd&ZKejLd'ZMejLd(ZNejLd)d*ZOd+ePfd,YZQd-ZRd.ePfd/YZSd0ZTd1ePfd2YZUe j5d3e jVZWd4ZXdd5ZYd6ZZd7Z[d8Z\d9Z]d:Z^e j5d;e j_Z`e j5d<Zadd=Zbe j5d>Zcd?Zdd@ZedAZfdBZgdCZhdDZidEePfdFYZjdGePfdHYZkdIePfdJYZldZmdendRZodSZpdZqdZePfd[YZre j5d\Zse j5d]Zte j5d^Zud_Zd`ZverddalmwZxmyZymzZzdbe%j{fdcYZ{ddexfdeYZwdfewe(fdgYZ|nej}dh Z~e~dkr dje%jfdkYZer dle%jfdmYZq ndne&jfdoYZerFdpe&jfdqYZndre&jfdsYZdtZduePfdvYZdwefdxYZdyefdzYZd{e)fd|YZd}ePfd~YZdZdS(iN(tdeque(tiglobi(tDistlibException(t string_typest text_typetshutilt raw_inputtStringIOtcache_from_sourceturlopenturljointhttplibt xmlrpclibt splittypet HTTPHandlertBaseConfiguratort valid_identt Containert configparsertURLErrortZipFiletfsdecodetunquotes\s*,\s*s (\w|[.-])+s(\*|:(\*|\w+):|t)s\*?s([<>=!~]=)|[<>]t(s)?\s*(s)(s)\s*(s))*s(from\s+(?P.*))s \(\s*(?Pt|s)\s*\)|(?Ps\s*)s)*s \[\s*(?Ps)?\s*\]s(?Ps \s*)?(\s*s)?$s(?Ps )\s*(?Pc Cskd}d}tj|}|rg|j}|d}|dpK|d}|dsad}nd}|dj}|sd}d}|d} n{|ddkrd |}ntj|} g| D]}||^q}d |d jg|D]} d | ^qf} |d s$d} ntj |d } t d|d|d| d| d|d|}n|S(NcSs|j}|d|dfS(Ntoptvn(t groupdict(tmtd((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytget_constraintYs tdntc1tc2tdireftis<>!=s~=s%s (%s)s, s%s %stextnamet constraintstextrast requirementtsourceturl( tNonetREQUIREMENT_REtmatchRtstriptRELOP_IDENT_REtfinditertjointCOMMA_REtsplitR( tsRtresultRRR&tconsR+tconstrtrstiteratortconR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytparse_requirementWs4       0  cCsd}i}x|D]\}}}tjj||}xt|D]}tjj||} xt| D]v} ||| } |dkr|j| dqo||| } |jtjjdjd} | d| || RAtrstrip(tresources_roottrulesREt destinationsRDtsuffixtdesttprefixtabs_basetabs_globtabs_patht resource_filetrel_pathtrel_dest((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytget_resources_dests|s  !cCs:ttdrt}ntjttdtjk}|S(Nt real_prefixt base_prefix(thasattrtsystTrueRMtgetattr(R6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytin_venvs cCs7tjjtj}t|ts3t|}n|S(N(R?R@tnormcaseRXt executablet isinstanceRR(R6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytget_executables cCs|}xwtrt|}|}| r7|r7|}n|r |dj}||kr]Pn|r|d|||f}q|q q W|S(Nis %c: %s %s(RYRtlower(tpromptt allowed_charst error_prompttdefaulttpR5tc((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytproceeds     cCsVt|tr|j}ni}x+|D]#}||kr+||||R$cCstjj|}||jkrtjj| r|jj|tjj|\}}|j|tj d||j stj |n|j r|j j|qndS(Ns Creating %s(R?R@RRRRR4RRRRtmkdirRR(RR@RR((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRs"   cCst|| }tjd|||js|sD|j||rf|sSd}qf|t|}ntj|||t n|j ||S(NsByte-compiling %s to %s( RRRRRR,RBt py_compiletcompileRYR(RR@toptimizetforceRMtdpathtdiagpath((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt byte_compiles   cCstjj|rtjj|rtjj| rtjd||js`tj |n|j r ||j kr|j j |qq qtjj|rd}nd}tjd|||jstj |n|j r||j kr |j j |q qndS(NsRemoving directory tree at %stlinktfilesRemoving %s %s(R?R@RtisdirRRtdebugRRRRRRR(RR@R5((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytensure_removeds"%     cCsjt}x]|setjj|r:tj|tj}Pntjj|}||kr\Pn|}q W|S(N(RR?R@RtaccesstW_OKR(RR@R6tparent((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt is_writables   cCs |j|jf}|j|S(sV Commit recorded changes, turn off recording, return changes. (RRR(RR6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytcommits cCs|jsx9t|jD](}tjj|rtj|qqWt|jdt }x\|D]Q}tj |}|rtjj ||d}tj |ntj |qaWn|j dS(Ntreversei(RtlistRR?R@RRtsortedRRYtlistdirR2trmdirR(RRtdirsRtflisttsd((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytrollbacks  N(RRRRRRRRYRR,RRRRtset_executable_modeRRRRRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRQs             cCs|tjkrtj|}n t|}|dkr@|}nG|jd}t||jd}x|D]}t||}qnW|S(Nt.i(RXtmodulest __import__R,R4RZRF(t module_namet dotted_pathtmodR6tpartsRe((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytresolves    t ExportEntrycBs;eZdZedZdZdZejZRS(cCs(||_||_||_||_dS(N(R&RMRKR(RR&RMRKR((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRs   cCst|j|jS(N(RRMRK(R((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRscCs d|j|j|j|jfS(Ns(R&RMRKR(R((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt__repr__!scCsdt|tst}nH|j|jko]|j|jko]|j|jko]|j|jk}|S(N(R^RRR&RMRKR(RtotherR6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt__eq__%s ( RRRRRR R Rt__hash__(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRs    s(?P(\w|[-.+])+) \s*=\s*(?P(\w+)([:\.]\w+)*) \s*(\[\s*(?P\w+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])? c CsStj|}|sId}d|ks3d|krOtd|qOn|j}|d}|d}|jd}|dkr|d}}n4|dkrtd|n|jd\}}|d } | dkrd|ksd|kr td|ng} n(g| jd D]} | j^q"} t|||| }|S( Nt[t]sInvalid specification '%s'R&tcallablet:iiRt,( tENTRY_REtsearchR,RRtcountR4R/R( t specificationRR6RR&R@tcolonsRMRKRR((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRy7s2          (cCs|d krd}ntjdkrHdtjkrHtjjd}ntjjd}tjj|rtj|tj }|st j d|qnGytj |t }Wn-tk rt j d|dt t}nX|s tj}t j d |ntjj||S( s Return the default base location for distlib caches. If the directory does not exist, it is created. Use the suffix provided for the base directory, and default to '.distlib' if it isn't provided. On Windows, if LOCALAPPDATA is defined in the environment, then it is assumed to be a directory, and will be the parent directory of the result. On POSIX, and on Windows if LOCALAPPDATA is not defined, the user's home directory - using os.expanduser('~') - will be the parent directory of the result. The result is just the directory '.distlib' in the parent directory as determined above, or with the name specified with ``suffix``. s.distlibtntt LOCALAPPDATAs $localappdatat~s(Directory exists but is not writable: %ssUnable to create %stexc_infos#Default location unusable, using %sN(R,R?R&tenvironR@t expandvarst expanduserRRRRtwarningtmakedirsRYtOSErrorRRRR2(RKR6tusable((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytget_cache_baseVs&       cCs`tjjtjj|\}}|r?|jdd}n|jtjd}||dS(s Convert an absolute path to a directory name for use in a cache. The algorithm used is: #. On Windows, any ``':'`` in the drive is replaced with ``'---'``. #. Any occurrence of ``os.sep`` is replaced with ``'--'``. #. ``'.cache'`` is appended. Rs---s--s.cache(R?R@t splitdriveRR>RA(R@RRe((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytpath_to_cache_dirs $cCs|jds|dS|S(NR=(tendswith(R5((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt ensure_slashscCskd}}d|kr^|jdd\}}d|krC|}q^|jdd\}}n|||fS(Nt@iR(R,R4(tnetloctusernametpasswordRM((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytparse_credentialss    cCs tjd}tj||S(Ni(R?tumask(R6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytget_process_umasks cCsFt}d}x3t|D]%\}}t|tst}PqqW|S(N(RYR,t enumerateR^RR(tseqR6tiR5((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytis_string_sequencess3([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-([a-z0-9_.+-]+)s -py(\d\.?\d?)cCsd}d}t|jdd}tj|}|r[|jd}||j }n|rt|t|dkrtj tj |d|}|r|j }|| ||d|f}qn|dkrt j |}|r|jd|jd|f}qn|S(sw Extract name, version, python version from a filename (no extension) Return name, version, pyver or None t t-is\biN( R,RR>tPYTHON_VERSIONRRtstartRBtreR.tescapetendtPROJECT_NAME_AND_VERSION(tfilenamet project_nameR6tpyverRtn((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytsplit_filenames"" ! 's-(?P[\w .-]+)\s*\(\s*(?P[^\s)]+)\)$cCsRtj|}|s(td|n|j}|djj|dfS(s A utility method used to get name and version from a string. From e.g. a Provides-Dist value. :param p: A value in a form 'foo (1.0)' :return: The name and version as a tuple. s$Ill-formed name/version string: '%s'R&tver(tNAME_VERSION_RER.RRR/R`(ReRR((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytparse_name_and_versions  cCs t}t|pg}t|p'g}d|krS|jd||O}nx|D]}|dkr||j|qZ|jdr|d}||krtjd|n||kr|j|qqZ||krtjd|n|j|qZW|S(Nt*R3isundeclared extra: %s(RRRt startswithRR(t requestedt availableR6trtunwanted((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt get_extrass&          cCsi}yqt|}|j}|jd}|jdsRtjd|n$tjd|}tj |}Wn&t k r}tj d||nX|S(Ns Content-Typesapplication/jsons(Unexpected response for JSON request: %ssutf-8s&Failed to get external data for %s: %s( R RtgetRCRRRsRtRvRwRzt exception(R+R6tresptheaderstcttreaderte((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt_get_external_datas  s'https://www.red-dove.com/pypi/projects/cCs9d|dj|f}tt|}t|}|S(Ns%s/%s/project.jsoni(tupperR t_external_data_base_urlRP(R&R+R6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytget_project_datas cCs6d|dj||f}tt|}t|S(Ns%s/%s/package-%s.jsoni(RQR RRRP(R&tversionR+((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytget_package_datastCachecBs)eZdZdZdZdZRS(s A class implementing a cache for resources that need to live in the file system e.g. shared libraries. This class was moved from resources to here because it could be used by other modules, e.g. the wheel module. cCsvtjj|s"tj|ntj|jd@dkrQtjd|ntjjtjj ||_ dS(su Initialise an instance. :param base: The base directory where the cache should be located. i?isDirectory '%s' is not privateN( R?R@RRRRRRRtnormpathRD(RRD((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR"s cCs t|S(sN Converts a resource prefix to a directory name in the cache. (R$(RRM((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt prefix_to_dir0scCsg}xtj|jD]}tjj|j|}yZtjj|s^tjj|rntj|n"tjj|rt j |nWqt k r|j |qXqW|S(s" Clear the cache. ( R?RRDR@R2RRRRRRRztappend(Rt not_removedtfn((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytclear6s$ (RRt__doc__RRXR\(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRVs  t EventMixincBs>eZdZdZedZdZdZdZRS(s1 A very simple publish/subscribe system. cCs i|_dS(N(t _subscribers(R((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRKscCs\|j}||kr+t|g|| %s;s %s;t}s (RkRYRmR2(RR6RtRvRsRn((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytdot s    ( RRRRoRRqRRRyRtpropertyRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRjs      3s.tar.gzs.tar.bz2s.tars.zips.tgzs.tbzs.whlc sfd}tjjtd}|dkr|jdrZd}q|jdrxd}d}q|jdrd }d }q|jd rd}d}qtd|nz|dkrt|d}|rZ|j}x|D]}||qWqZnBt j ||}|rZ|j }x|D]}||qCWn|dkrt j ddkrxA|jD]0} t| jts| jjd| _qqWn|jWd|r|jnXdS(Ncs|t|ts!|jd}ntjjtjj|}|j se|tjkrxt d|ndS(Nsutf-8spath outside destination: %r( R^RtdecodeR?R@RR2RCRAR(R@Re(tdest_dirtplen(s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt check_paths !#s.zips.whltzips.tar.gzs.tgzttgzsr:gzs.tar.bz2s.tbzttbzsr:bz2s.tarttarRFsUnknown format for %riisutf-8(s.zips.whl(s.tar.gzs.tgz(s.tar.bz2s.tbz(R?R@RRBR,R%RRtnamelistttarfileRtgetnamesRXRrt getmembersR^R&RRt extractallR~( tarchive_filenameRtformatRRtarchiveRtnamesR&ttarinfo((RRs</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt unarchivesH           c Cstj}t|}t|d}xutj|D]d\}}}xR|D]J}tjj||}||} tjj| |} |j|| qPWq:WWdQX|S(s*zip a directory tree into a BytesIO objectRN( tiotBytesIORBRR?twalkR@R2R( t directoryR6tdlentzftrootRRR&tfulltrelRL((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytzip_dirSs    R$tKtMtGtTtPtProgresscBseZdZdddZdZdZdZdZedZ ed Z d Z ed Z ed Z RS( tUNKNOWNiidcCs8||_|_||_d|_d|_t|_dS(Ni(RtcurtmaxR,tstartedtelapsedRtdone(Rtminvaltmaxval((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRjs    cCsD||_tj}|jdkr0||_n||j|_dS(N(RttimeRR,R(Rtcurvaltnow((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytupdaters    cCs|j|j|dS(N(RR(Rtincr((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt increment|scCs|j|j|S(N(RR(R((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR5scCs/|jdk r"|j|jnt|_dS(N(RR,RRYR(R((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytstopscCs|jdkr|jS|jS(N(RR,tunknown(R((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytmaximumscCsZ|jrd}nD|jdkr*d}n,d|j|j|j|j}d|}|S(Ns100 %s ?? %gY@s%3d %%(RRR,RR(RR6R((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt percentages   " cCsU|dkr|jdks-|j|jkr6d}ntjdtj|}|S(Nis??:??:??s%H:%M:%S(RR,RRRtstrftimetgmtime(RtdurationR6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytformat_durations- cCs|jrd}|j}nd}|jdkr9d}ne|jdksZ|j|jkrcd}n;t|j|j}||j|j:}|d|j}d||j|fS(NtDonesETA iiis%s: %s(RRRR,RRtfloatR(RRMtt((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytETAs   ! cCsh|jdkrd}n|j|j|j}x(tD] }|dkrLPn|d:}q6Wd||fS(Nigig@@s%d %sB/s(RRRtUNITS(RR6tunit((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytspeeds   (RRRRRRR5RRRRRRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRgs    s \{([^}]*)\}s[^/\\,{]\*\*|\*\*[^/\\,}]s^[^{]*\}|\{[^}]*$cCsZtj|r(d}t||ntj|rPd}t||nt|S(sAExtended globbing function that supports ** and {opt1,opt2,opt3}.s7invalid glob %r: recursive glob "**" must be used alones2invalid glob %r: mismatching set marker '{' or '}'(t_CHECK_RECURSIVE_GLOBRRt_CHECK_MISMATCH_SETt_iglob(t path_globR((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRsc csmtj|d}t|dkr~|\}}}x3|jdD]4}x+tdj|||fD] }|VqhWqCWnd|krxt|D] }|VqWn|jdd\}}|dkrd}n|dkrd}n|jd}|jd}x]tj|D]L\}}} tj j |}x(ttj j||D] } | VqVWqWdS( NiRR$s**RRBR=s\( t RICH_GLOBR4RBRR2t std_iglobRCR?RR@RW( Rtrich_path_globRMRRKtitemR@tradicaltdirRR[((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRs(%      "(t HTTPSHandlertmatch_hostnametCertificateErrortHTTPSConnectioncBseZdZeZdZRS(c Cstj|j|jf|j}t|dtrI||_|jnt t ds|j rmt j }n t j }t j||j|jd|dt jd|j |_nt jt j}|jt jO_|jr|j|j|jni}|j rHt j |_|jd|j tt dtrH|j|d!           N(RRR,RRYRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRsRcBs&eZedZdZdZRS(cCs#tj|||_||_dS(N(tBaseHTTPSHandlerRRR(RRR((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR#s  cOs7t||}|jr3|j|_|j|_n|S(s This is called to create a connection instance. Normally you'd pass a connection class to do_open, but it doesn't actually check for a class, and just expects a callable. As long as we behave just as a constructor would have, we should be OK. If it ever changes so that we *must* pass a class, we'll create an UnsafeHTTPSConnection class which just sets check_domain to False in the class definition, and choose which one to pass to do_open. (RRR(RRgRhR6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt _conn_maker(s   cCs_y|j|j|SWnAtk rZ}dt|jkrTtd|jq[nXdS(Nscertificate verify faileds*Unable to verify server certificate for %s(tdo_openRRtstrtreasonRR(RtreqRO((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt https_open8s(RRRYRRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR"s  tHTTPSOnlyHandlercBseZdZRS(cCstd|dS(NsAUnexpected HTTP request on what should be a secure connection: %s(R(RR((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt http_openLs(RRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRKsiitHTTPcBseZdddZRS(R$cKs5|dkrd}n|j|j|||dS(Ni(R,t_setupt_connection_class(RRRRh((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRXs  N(RRR,R(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRWstHTTPScBseZdddZRS(R$cKs5|dkrd}n|j|j|||dS(Ni(R,RR (RRRRh((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR`s  N(RRR,R(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR _st TransportcBseZddZdZRS(icCs ||_tjj||dS(N(RR R R(RRt use_datetime((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRgs cCs|j|\}}}tdkr<t|d|j}nN|j sY||jdkr}||_|tj|f|_n|jd}|S(NiiRii(ii(t get_host_infot _ver_infoRRt _connectiont_extra_headersR tHTTPConnection(RRthtehtx509R6((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytmake_connectionks   (RRRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR fs t SafeTransportcBseZddZdZRS(icCs ||_tjj||dS(N(RR RR(RRR ((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRxs cCs|j|\}}}|s'i}n|j|dR3(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR2s     tSubprocessMixincBs)eZeddZdZdZRS(cCs||_||_dS(N(tverbosetprogress(RRBRC((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRs cCs|j}|j}x{tr|j}|s1Pn|dk rM|||q|sftjjdntjj|jdtjj qW|j dS(s Read lines from a subprocess' output stream and either pass to a progress callable (if specified) or write progress information to sys.stderr. Rsutf-8N( RCRBRYtreadlineR,RXtstderrRRtflushR~(RRpRRCRBR5((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRN"s     cKstj|dtjdtj|}tjd|jd|jdf}|jtjd|jd|jdf}|j|j |j |j |j dk r|j ddn|j rtjjdn|S(NtstdoutRERRgsdone.tmainsdone. (t subprocesstPopentPIPEt threadingtThreadRNRGR5REtwaitR2RCR,RBRXR(RtcmdRhRett1tt2((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt run_command7s$ $     N(RRRR,RRNRR(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRAs cCstjdd|jS(s,Normalize a python package name a la PEP 503s[-_.]+R3(R6tsubR`(R&((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pytnormalize_nameHs(s.tar.gzs.tar.bz2s.tars.zips.tgzs.tbzs.whl(R$RRRRR(ii(Rst collectionsRt contextlibR*tglobRRRRvtloggingR?RR6RRRt ImportErrorR,RIRXRRRRLtdummy_threadingRR$RtcompatRRRRRR R R R R RRRRRRRRRt getLoggerRRtCOMMARR3tIDENTt EXTRA_IDENTtVERSPECtRELOPtBARE_CONSTRAINTSt DIRECT_REFt CONSTRAINTSt EXTRA_LISTtEXTRASt REQUIREMENTR-t RELOP_IDENTR0R<RTR[R_RgRjRRtcontextmanagerRRRRRRRRRtVERBOSERRyR"R$R&R+R-R1tIR9R4R>R@RARHRPRRRSRURVR^RjtARCHIVE_EXTENSIONSRYRRRRRRRRRRRRRRRrRRR R RRR R!R)R.R2RART(((s</usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyts                      . %   /       )           ,H6 ] *)   :+site-packages/pip/_vendor/distlib/version.py000064400000056237147204247350015226 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012-2016 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # """ Implementation of a flexible versioning scheme providing support for PEP-440, setuptools-compatible and semantic versioning. """ import logging import re from .compat import string_types __all__ = ['NormalizedVersion', 'NormalizedMatcher', 'LegacyVersion', 'LegacyMatcher', 'SemanticVersion', 'SemanticMatcher', 'UnsupportedVersionError', 'get_scheme'] logger = logging.getLogger(__name__) class UnsupportedVersionError(ValueError): """This is an unsupported version.""" pass class Version(object): def __init__(self, s): self._string = s = s.strip() self._parts = parts = self.parse(s) assert isinstance(parts, tuple) assert len(parts) > 0 def parse(self, s): raise NotImplementedError('please implement in a subclass') def _check_compatible(self, other): if type(self) != type(other): raise TypeError('cannot compare %r and %r' % (self, other)) def __eq__(self, other): self._check_compatible(other) return self._parts == other._parts def __ne__(self, other): return not self.__eq__(other) def __lt__(self, other): self._check_compatible(other) return self._parts < other._parts def __gt__(self, other): return not (self.__lt__(other) or self.__eq__(other)) def __le__(self, other): return self.__lt__(other) or self.__eq__(other) def __ge__(self, other): return self.__gt__(other) or self.__eq__(other) # See http://docs.python.org/reference/datamodel#object.__hash__ def __hash__(self): return hash(self._parts) def __repr__(self): return "%s('%s')" % (self.__class__.__name__, self._string) def __str__(self): return self._string @property def is_prerelease(self): raise NotImplementedError('Please implement in subclasses.') class Matcher(object): version_class = None dist_re = re.compile(r"^(\w[\s\w'.-]*)(\((.*)\))?") comp_re = re.compile(r'^(<=|>=|<|>|!=|={2,3}|~=)?\s*([^\s,]+)$') num_re = re.compile(r'^\d+(\.\d+)*$') # value is either a callable or the name of a method _operators = { '<': lambda v, c, p: v < c, '>': lambda v, c, p: v > c, '<=': lambda v, c, p: v == c or v < c, '>=': lambda v, c, p: v == c or v > c, '==': lambda v, c, p: v == c, '===': lambda v, c, p: v == c, # by default, compatible => >=. '~=': lambda v, c, p: v == c or v > c, '!=': lambda v, c, p: v != c, } def __init__(self, s): if self.version_class is None: raise ValueError('Please specify a version class') self._string = s = s.strip() m = self.dist_re.match(s) if not m: raise ValueError('Not valid: %r' % s) groups = m.groups('') self.name = groups[0].strip() self.key = self.name.lower() # for case-insensitive comparisons clist = [] if groups[2]: constraints = [c.strip() for c in groups[2].split(',')] for c in constraints: m = self.comp_re.match(c) if not m: raise ValueError('Invalid %r in %r' % (c, s)) groups = m.groups() op = groups[0] or '~=' s = groups[1] if s.endswith('.*'): if op not in ('==', '!='): raise ValueError('\'.*\' not allowed for ' '%r constraints' % op) # Could be a partial version (e.g. for '2.*') which # won't parse as a version, so keep it as a string vn, prefix = s[:-2], True if not self.num_re.match(vn): # Just to check that vn is a valid version self.version_class(vn) else: # Should parse as a version, so we can create an # instance for the comparison vn, prefix = self.version_class(s), False clist.append((op, vn, prefix)) self._parts = tuple(clist) def match(self, version): """ Check if the provided version matches the constraints. :param version: The version to match against this instance. :type version: String or :class:`Version` instance. """ if isinstance(version, string_types): version = self.version_class(version) for operator, constraint, prefix in self._parts: f = self._operators.get(operator) if isinstance(f, string_types): f = getattr(self, f) if not f: msg = ('%r not implemented ' 'for %s' % (operator, self.__class__.__name__)) raise NotImplementedError(msg) if not f(version, constraint, prefix): return False return True @property def exact_version(self): result = None if len(self._parts) == 1 and self._parts[0][0] in ('==', '==='): result = self._parts[0][1] return result def _check_compatible(self, other): if type(self) != type(other) or self.name != other.name: raise TypeError('cannot compare %s and %s' % (self, other)) def __eq__(self, other): self._check_compatible(other) return self.key == other.key and self._parts == other._parts def __ne__(self, other): return not self.__eq__(other) # See http://docs.python.org/reference/datamodel#object.__hash__ def __hash__(self): return hash(self.key) + hash(self._parts) def __repr__(self): return "%s(%r)" % (self.__class__.__name__, self._string) def __str__(self): return self._string PEP440_VERSION_RE = re.compile(r'^v?(\d+!)?(\d+(\.\d+)*)((a|b|c|rc)(\d+))?' r'(\.(post)(\d+))?(\.(dev)(\d+))?' r'(\+([a-zA-Z\d]+(\.[a-zA-Z\d]+)?))?$') def _pep_440_key(s): s = s.strip() m = PEP440_VERSION_RE.match(s) if not m: raise UnsupportedVersionError('Not a valid version: %s' % s) groups = m.groups() nums = tuple(int(v) for v in groups[1].split('.')) while len(nums) > 1 and nums[-1] == 0: nums = nums[:-1] if not groups[0]: epoch = 0 else: epoch = int(groups[0]) pre = groups[4:6] post = groups[7:9] dev = groups[10:12] local = groups[13] if pre == (None, None): pre = () else: pre = pre[0], int(pre[1]) if post == (None, None): post = () else: post = post[0], int(post[1]) if dev == (None, None): dev = () else: dev = dev[0], int(dev[1]) if local is None: local = () else: parts = [] for part in local.split('.'): # to ensure that numeric compares as > lexicographic, avoid # comparing them directly, but encode a tuple which ensures # correct sorting if part.isdigit(): part = (1, int(part)) else: part = (0, part) parts.append(part) local = tuple(parts) if not pre: # either before pre-release, or final release and after if not post and dev: # before pre-release pre = ('a', -1) # to sort before a0 else: pre = ('z',) # to sort after all pre-releases # now look at the state of post and dev. if not post: post = ('_',) # sort before 'a' if not dev: dev = ('final',) #print('%s -> %s' % (s, m.groups())) return epoch, nums, pre, post, dev, local _normalized_key = _pep_440_key class NormalizedVersion(Version): """A rational version. Good: 1.2 # equivalent to "1.2.0" 1.2.0 1.2a1 1.2.3a2 1.2.3b1 1.2.3c1 1.2.3.4 TODO: fill this out Bad: 1 # minimum two numbers 1.2a # release level must have a release serial 1.2.3b """ def parse(self, s): result = _normalized_key(s) # _normalized_key loses trailing zeroes in the release # clause, since that's needed to ensure that X.Y == X.Y.0 == X.Y.0.0 # However, PEP 440 prefix matching needs it: for example, # (~= 1.4.5.0) matches differently to (~= 1.4.5.0.0). m = PEP440_VERSION_RE.match(s) # must succeed groups = m.groups() self._release_clause = tuple(int(v) for v in groups[1].split('.')) return result PREREL_TAGS = set(['a', 'b', 'c', 'rc', 'dev']) @property def is_prerelease(self): return any(t[0] in self.PREREL_TAGS for t in self._parts if t) def _match_prefix(x, y): x = str(x) y = str(y) if x == y: return True if not x.startswith(y): return False n = len(y) return x[n] == '.' class NormalizedMatcher(Matcher): version_class = NormalizedVersion # value is either a callable or the name of a method _operators = { '~=': '_match_compatible', '<': '_match_lt', '>': '_match_gt', '<=': '_match_le', '>=': '_match_ge', '==': '_match_eq', '===': '_match_arbitrary', '!=': '_match_ne', } def _adjust_local(self, version, constraint, prefix): if prefix: strip_local = '+' not in constraint and version._parts[-1] else: # both constraint and version are # NormalizedVersion instances. # If constraint does not have a local component, # ensure the version doesn't, either. strip_local = not constraint._parts[-1] and version._parts[-1] if strip_local: s = version._string.split('+', 1)[0] version = self.version_class(s) return version, constraint def _match_lt(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) if version >= constraint: return False release_clause = constraint._release_clause pfx = '.'.join([str(i) for i in release_clause]) return not _match_prefix(version, pfx) def _match_gt(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) if version <= constraint: return False release_clause = constraint._release_clause pfx = '.'.join([str(i) for i in release_clause]) return not _match_prefix(version, pfx) def _match_le(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) return version <= constraint def _match_ge(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) return version >= constraint def _match_eq(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) if not prefix: result = (version == constraint) else: result = _match_prefix(version, constraint) return result def _match_arbitrary(self, version, constraint, prefix): return str(version) == str(constraint) def _match_ne(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) if not prefix: result = (version != constraint) else: result = not _match_prefix(version, constraint) return result def _match_compatible(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) if version == constraint: return True if version < constraint: return False # if not prefix: # return True release_clause = constraint._release_clause if len(release_clause) > 1: release_clause = release_clause[:-1] pfx = '.'.join([str(i) for i in release_clause]) return _match_prefix(version, pfx) _REPLACEMENTS = ( (re.compile('[.+-]$'), ''), # remove trailing puncts (re.compile(r'^[.](\d)'), r'0.\1'), # .N -> 0.N at start (re.compile('^[.-]'), ''), # remove leading puncts (re.compile(r'^\((.*)\)$'), r'\1'), # remove parentheses (re.compile(r'^v(ersion)?\s*(\d+)'), r'\2'), # remove leading v(ersion) (re.compile(r'^r(ev)?\s*(\d+)'), r'\2'), # remove leading v(ersion) (re.compile('[.]{2,}'), '.'), # multiple runs of '.' (re.compile(r'\b(alfa|apha)\b'), 'alpha'), # misspelt alpha (re.compile(r'\b(pre-alpha|prealpha)\b'), 'pre.alpha'), # standardise (re.compile(r'\(beta\)$'), 'beta'), # remove parentheses ) _SUFFIX_REPLACEMENTS = ( (re.compile('^[:~._+-]+'), ''), # remove leading puncts (re.compile('[,*")([\]]'), ''), # remove unwanted chars (re.compile('[~:+_ -]'), '.'), # replace illegal chars (re.compile('[.]{2,}'), '.'), # multiple runs of '.' (re.compile(r'\.$'), ''), # trailing '.' ) _NUMERIC_PREFIX = re.compile(r'(\d+(\.\d+)*)') def _suggest_semantic_version(s): """ Try to suggest a semantic form for a version for which _suggest_normalized_version couldn't come up with anything. """ result = s.strip().lower() for pat, repl in _REPLACEMENTS: result = pat.sub(repl, result) if not result: result = '0.0.0' # Now look for numeric prefix, and separate it out from # the rest. #import pdb; pdb.set_trace() m = _NUMERIC_PREFIX.match(result) if not m: prefix = '0.0.0' suffix = result else: prefix = m.groups()[0].split('.') prefix = [int(i) for i in prefix] while len(prefix) < 3: prefix.append(0) if len(prefix) == 3: suffix = result[m.end():] else: suffix = '.'.join([str(i) for i in prefix[3:]]) + result[m.end():] prefix = prefix[:3] prefix = '.'.join([str(i) for i in prefix]) suffix = suffix.strip() if suffix: #import pdb; pdb.set_trace() # massage the suffix. for pat, repl in _SUFFIX_REPLACEMENTS: suffix = pat.sub(repl, suffix) if not suffix: result = prefix else: sep = '-' if 'dev' in suffix else '+' result = prefix + sep + suffix if not is_semver(result): result = None return result def _suggest_normalized_version(s): """Suggest a normalized version close to the given version string. If you have a version string that isn't rational (i.e. NormalizedVersion doesn't like it) then you might be able to get an equivalent (or close) rational version from this function. This does a number of simple normalizations to the given string, based on observation of versions currently in use on PyPI. Given a dump of those version during PyCon 2009, 4287 of them: - 2312 (53.93%) match NormalizedVersion without change with the automatic suggestion - 3474 (81.04%) match when using this suggestion method @param s {str} An irrational version string. @returns A rational version string, or None, if couldn't determine one. """ try: _normalized_key(s) return s # already rational except UnsupportedVersionError: pass rs = s.lower() # part of this could use maketrans for orig, repl in (('-alpha', 'a'), ('-beta', 'b'), ('alpha', 'a'), ('beta', 'b'), ('rc', 'c'), ('-final', ''), ('-pre', 'c'), ('-release', ''), ('.release', ''), ('-stable', ''), ('+', '.'), ('_', '.'), (' ', ''), ('.final', ''), ('final', '')): rs = rs.replace(orig, repl) # if something ends with dev or pre, we add a 0 rs = re.sub(r"pre$", r"pre0", rs) rs = re.sub(r"dev$", r"dev0", rs) # if we have something like "b-2" or "a.2" at the end of the # version, that is probably beta, alpha, etc # let's remove the dash or dot rs = re.sub(r"([abc]|rc)[\-\.](\d+)$", r"\1\2", rs) # 1.0-dev-r371 -> 1.0.dev371 # 0.1-dev-r79 -> 0.1.dev79 rs = re.sub(r"[\-\.](dev)[\-\.]?r?(\d+)$", r".\1\2", rs) # Clean: 2.0.a.3, 2.0.b1, 0.9.0~c1 rs = re.sub(r"[.~]?([abc])\.?", r"\1", rs) # Clean: v0.3, v1.0 if rs.startswith('v'): rs = rs[1:] # Clean leading '0's on numbers. #TODO: unintended side-effect on, e.g., "2003.05.09" # PyPI stats: 77 (~2%) better rs = re.sub(r"\b0+(\d+)(?!\d)", r"\1", rs) # Clean a/b/c with no version. E.g. "1.0a" -> "1.0a0". Setuptools infers # zero. # PyPI stats: 245 (7.56%) better rs = re.sub(r"(\d+[abc])$", r"\g<1>0", rs) # the 'dev-rNNN' tag is a dev tag rs = re.sub(r"\.?(dev-r|dev\.r)\.?(\d+)$", r".dev\2", rs) # clean the - when used as a pre delimiter rs = re.sub(r"-(a|b|c)(\d+)$", r"\1\2", rs) # a terminal "dev" or "devel" can be changed into ".dev0" rs = re.sub(r"[\.\-](dev|devel)$", r".dev0", rs) # a terminal "dev" can be changed into ".dev0" rs = re.sub(r"(?![\.\-])dev$", r".dev0", rs) # a terminal "final" or "stable" can be removed rs = re.sub(r"(final|stable)$", "", rs) # The 'r' and the '-' tags are post release tags # 0.4a1.r10 -> 0.4a1.post10 # 0.9.33-17222 -> 0.9.33.post17222 # 0.9.33-r17222 -> 0.9.33.post17222 rs = re.sub(r"\.?(r|-|-r)\.?(\d+)$", r".post\2", rs) # Clean 'r' instead of 'dev' usage: # 0.9.33+r17222 -> 0.9.33.dev17222 # 1.0dev123 -> 1.0.dev123 # 1.0.git123 -> 1.0.dev123 # 1.0.bzr123 -> 1.0.dev123 # 0.1a0dev.123 -> 0.1a0.dev123 # PyPI stats: ~150 (~4%) better rs = re.sub(r"\.?(dev|git|bzr)\.?(\d+)$", r".dev\2", rs) # Clean '.pre' (normalized from '-pre' above) instead of 'c' usage: # 0.2.pre1 -> 0.2c1 # 0.2-c1 -> 0.2c1 # 1.0preview123 -> 1.0c123 # PyPI stats: ~21 (0.62%) better rs = re.sub(r"\.?(pre|preview|-c)(\d+)$", r"c\g<2>", rs) # Tcl/Tk uses "px" for their post release markers rs = re.sub(r"p(\d+)$", r".post\1", rs) try: _normalized_key(rs) except UnsupportedVersionError: rs = None return rs # # Legacy version processing (distribute-compatible) # _VERSION_PART = re.compile(r'([a-z]+|\d+|[\.-])', re.I) _VERSION_REPLACE = { 'pre': 'c', 'preview': 'c', '-': 'final-', 'rc': 'c', 'dev': '@', '': None, '.': None, } def _legacy_key(s): def get_parts(s): result = [] for p in _VERSION_PART.split(s.lower()): p = _VERSION_REPLACE.get(p, p) if p: if '0' <= p[:1] <= '9': p = p.zfill(8) else: p = '*' + p result.append(p) result.append('*final') return result result = [] for p in get_parts(s): if p.startswith('*'): if p < '*final': while result and result[-1] == '*final-': result.pop() while result and result[-1] == '00000000': result.pop() result.append(p) return tuple(result) class LegacyVersion(Version): def parse(self, s): return _legacy_key(s) @property def is_prerelease(self): result = False for x in self._parts: if (isinstance(x, string_types) and x.startswith('*') and x < '*final'): result = True break return result class LegacyMatcher(Matcher): version_class = LegacyVersion _operators = dict(Matcher._operators) _operators['~='] = '_match_compatible' numeric_re = re.compile('^(\d+(\.\d+)*)') def _match_compatible(self, version, constraint, prefix): if version < constraint: return False m = self.numeric_re.match(str(constraint)) if not m: logger.warning('Cannot compute compatible match for version %s ' ' and constraint %s', version, constraint) return True s = m.groups()[0] if '.' in s: s = s.rsplit('.', 1)[0] return _match_prefix(version, s) # # Semantic versioning # _SEMVER_RE = re.compile(r'^(\d+)\.(\d+)\.(\d+)' r'(-[a-z0-9]+(\.[a-z0-9-]+)*)?' r'(\+[a-z0-9]+(\.[a-z0-9-]+)*)?$', re.I) def is_semver(s): return _SEMVER_RE.match(s) def _semantic_key(s): def make_tuple(s, absent): if s is None: result = (absent,) else: parts = s[1:].split('.') # We can't compare ints and strings on Python 3, so fudge it # by zero-filling numeric values so simulate a numeric comparison result = tuple([p.zfill(8) if p.isdigit() else p for p in parts]) return result m = is_semver(s) if not m: raise UnsupportedVersionError(s) groups = m.groups() major, minor, patch = [int(i) for i in groups[:3]] # choose the '|' and '*' so that versions sort correctly pre, build = make_tuple(groups[3], '|'), make_tuple(groups[5], '*') return (major, minor, patch), pre, build class SemanticVersion(Version): def parse(self, s): return _semantic_key(s) @property def is_prerelease(self): return self._parts[1][0] != '|' class SemanticMatcher(Matcher): version_class = SemanticVersion class VersionScheme(object): def __init__(self, key, matcher, suggester=None): self.key = key self.matcher = matcher self.suggester = suggester def is_valid_version(self, s): try: self.matcher.version_class(s) result = True except UnsupportedVersionError: result = False return result def is_valid_matcher(self, s): try: self.matcher(s) result = True except UnsupportedVersionError: result = False return result def is_valid_constraint_list(self, s): """ Used for processing some metadata fields """ return self.is_valid_matcher('dummy_name (%s)' % s) def suggest(self, s): if self.suggester is None: result = None else: result = self.suggester(s) return result _SCHEMES = { 'normalized': VersionScheme(_normalized_key, NormalizedMatcher, _suggest_normalized_version), 'legacy': VersionScheme(_legacy_key, LegacyMatcher, lambda self, s: s), 'semantic': VersionScheme(_semantic_key, SemanticMatcher, _suggest_semantic_version), } _SCHEMES['default'] = _SCHEMES['normalized'] def get_scheme(name): if name not in _SCHEMES: raise ValueError('unknown scheme name: %r' % name) return _SCHEMES[name] site-packages/pip/_vendor/distlib/version.pyc000064400000063434147204247350015366 0ustar00 abc @srdZddlZddlZddlmZddddd d d d gZejeZd e fd YZ de fdYZ de fdYZ ejdZdZeZde fdYZdZde fdYZejddfejddfejddfejddfejddfejd dfejd!d"fejd#d$fejd%d&fejd'd(ff Zejd)dfejd*dfejd+d"fejd!d"fejd,dffZejd-Zd.Zd/Zejd0ejZid1d26d1d36d4d56d1d66d7d86dd6dd"6Zd9Zde fd:YZde fd;YZ ejd<ejZ!d=Z"d>Z#d e fd?YZ$d e fd@YZ%dAe fdBYZ&ie&eeedC6e&ee dDdE6e&e#e%edF6Z'e'dCe'dGtt|dksVtdS(Ni(tstript_stringtparset_partst isinstancettupletAssertionErrortlen(tselftstparts((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__init__scCstddS(Nsplease implement in a subclass(tNotImplementedError(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR$scCs5t|t|kr1td||fndS(Nscannot compare %r and %r(ttypet TypeError(Rtother((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt_check_compatible'scCs|j||j|jkS(N(RR(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__eq__+s cCs|j| S(N(R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__ne__/scCs|j||j|jkS(N(RR(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__lt__2s cCs|j|p|j| S(N(R R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__gt__6scCs|j|p|j|S(N(R R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__le__9scCs|j|p|j|S(N(R!R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__ge__<scCs t|jS(N(thashR(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__hash__@scCsd|jj|jfS(Ns%s('%s')(t __class__R R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__repr__CscCs|jS(N(R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__str__FscCstddS(NsPlease implement in subclasses.(R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt is_prereleaseIs(R R RRRRRR R!R"R#R%R'R(tpropertyR)(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR s            tMatchercBseZdZejdZejdZejdZidd6dd6dd6d d 6d d 6d d6dd6dd6Z dZ dZ e dZ dZdZdZdZdZdZRS(s^(\w[\s\w'.-]*)(\((.*)\))?s'^(<=|>=|<|>|!=|={2,3}|~=)?\s*([^\s,]+)$s ^\d+(\.\d+)*$cCs ||kS(N((tvtctp((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pytWttcCs||kp||kS(N((R,R-R.((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR/YR0s<=cCs||kp||kS(N((R,R-R.((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR/ZR0s>=cCs ||kS(N((R,R-R.((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR/[R0s==cCs ||kS(N((R,R-R.((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR/\R0s===cCs||kp||kS(N((R,R-R.((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR/^R0s~=cCs ||kS(N((R,R-R.((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR/_R0s!=c Cs|jdkrtdn|j|_}|jj|}|s\td|n|jd}|dj|_|jj |_ g}|drg|dj dD]}|j^q}x|D]}|j j|}|s td||fn|j}|dp#d}|d }|j d r|dkr^td |n|d t}} |jj|s|j|qn|j|t}} |j||| fqWnt||_dS(NsPlease specify a version classs Not valid: %rR0iit,sInvalid %r in %rs~=is.*s==s!=s#'.*' not allowed for %r constraintsi(s==s!=(t version_classtNonet ValueErrorR Rtdist_retmatchtgroupstnametlowertkeytsplittcomp_retendswithtTruetnum_retFalsetappendRR( RRtmR9tclistR-t constraintstoptvntprefix((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRbs: ,     cCst|tr!|j|}nx|jD]\}}}|jj|}t|trmt||}n|sd||jjf}t |n||||s+t Sq+Wt S(s Check if the provided version matches the constraints. :param version: The version to match against this instance. :type version: String or :class:`Version` instance. s%r not implemented for %s( RRR4Rt _operatorstgettgetattrR&R RRBR@(Rtversiontoperatort constraintRItftmsg((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR8scCsJd}t|jdkrF|jdddkrF|jdd}n|S(Niis==s===(s==s===(R5RR(Rtresult((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt exact_versions,cCsGt|t|ks*|j|jkrCtd||fndS(Nscannot compare %s and %s(RR:R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRs*cCs/|j||j|jko.|j|jkS(N(RR<R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRs cCs|j| S(N(R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRscCst|jt|jS(N(R$R<R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR%scCsd|jj|jfS(Ns%s(%r)(R&R R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR'scCs|jS(N(R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR(sN(R R R5R4tretcompileR7R>RARJRR8R*RSRRRR%R'R((((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+Ns,         %      sk^v?(\d+!)?(\d+(\.\d+)*)((a|b|c|rc)(\d+))?(\.(post)(\d+))?(\.(dev)(\d+))?(\+([a-zA-Z\d]+(\.[a-zA-Z\d]+)?))?$c CsK|j}tj|}|s4td|n|j}td|djdD}x0t|dkr|ddkr|d }qfW|dsd}nt|d}|dd!}|d d !}|d d !}|d }|dkrd}n|dt|df}|dkr.d}n|dt|df}|dkr]d}n|dt|df}|dkrd}nfg} xQ|jdD]@} | j rdt| f} n d| f} | j | qWt| }|s| r|rd}qd}n|s&d}n|s5d}n||||||fS(NsNot a valid version: %scss|]}t|VqdS(N(tint(t.0R,((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pys sit.iiiiii i i i tatzt_tfinal(NN((NN((NN(((RYi(RZ(R[(R\( R tPEP440_VERSION_RER8RR9RR=RRVR5tisdigitRC( RRDR9tnumstepochtpretposttdevtlocalRtpart((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt _pep_440_keysT  #%                      cBsAeZdZdZedddddgZedZRS(sIA rational version. Good: 1.2 # equivalent to "1.2.0" 1.2.0 1.2a1 1.2.3a2 1.2.3b1 1.2.3c1 1.2.3.4 TODO: fill this out Bad: 1 # minimum two numbers 1.2a # release level must have a release serial 1.2.3b cCsQt|}tj|}|j}td|djdD|_|S(Ncss|]}t|VqdS(N(RV(RWR,((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pys siRX(t_normalized_keyR]R8R9RR=t_release_clause(RRRRRDR9((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRs   &RYtbR-trcRccstfdjDS(Nc3s(|]}|r|djkVqdS(iN(t PREREL_TAGS(RWtt(R(s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pys s(tanyR(R((Rs?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR)s(R R R RtsetRkR*R)(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRs cCsUt|}t|}||kr(tS|j|s;tSt|}||dkS(NRX(tstrR@t startswithRBR(txtytn((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt _match_prefix"s    cBseZeZidd6dd6dd6dd6dd 6d d 6d d 6dd6ZdZdZdZdZdZ dZ dZ dZ dZ RS(t_match_compatibles~=t _match_ltR1t _match_gtR2t _match_les<=t _match_ges>=t _match_eqs==t_match_arbitrarys===t _match_nes!=cCsx|r"d|ko|jd}n|jd o:|jd}|rn|jjddd}|j|}n||fS(Nt+iii(RRR=R4(RRMRORIt strip_localR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt _adjust_local<scCsj|j|||\}}||kr+tS|j}djg|D]}t|^qA}t|| S(NRX(RRBRhtjoinRoRt(RRMRORItrelease_clausetitpfx((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRvJs   (cCsj|j|||\}}||kr+tS|j}djg|D]}t|^qA}t|| S(NRX(RRBRhRRoRt(RRMRORIRRR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRwRs   (cCs%|j|||\}}||kS(N(R(RRMRORI((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRxZscCs%|j|||\}}||kS(N(R(RRMRORI((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRy^scCsC|j|||\}}|s0||k}nt||}|S(N(RRt(RRMRORIRR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRzbs cCst|t|kS(N(Ro(RRMRORI((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR{jscCsD|j|||\}}|s0||k}nt|| }|S(N(RRt(RRMRORIRR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR|ms cCs|j|||\}}||kr+tS||kr;tS|j}t|dkrc|d }ndjg|D]}t|^qp}t||S(NiiRX(RR@RBRhRRRoRt(RRMRORIRRR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRuus    ((R R RR4RJRRvRwRxRyRzR{R|Ru(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR-s&         s[.+-]$R0s^[.](\d)s0.\1s^[.-]s ^\((.*)\)$s\1s^v(ersion)?\s*(\d+)s\2s^r(ev)?\s*(\d+)s[.]{2,}RXs\b(alfa|apha)\btalphas\b(pre-alpha|prealpha)\bs pre.alphas \(beta\)$tbetas ^[:~._+-]+s [,*")([\]]s[~:+_ -]s\.$s (\d+(\.\d+)*)c Cs|jj}x&tD]\}}|j||}qW|sJd}ntj|}|snd}|}n|jdjd}g|D]}t|^q}x#t |dkr|j dqWt |dkr||j }nDdj g|dD]}t |^q||j }|d }dj g|D]}t |^qB}|j}|rx)tD]\}}|j||}qvWn|s|}n&d|krdnd}|||}t|sd}n|S( s Try to suggest a semantic form for a version for which _suggest_normalized_version couldn't come up with anything. s0.0.0iRXiRct-R}N(R R;t _REPLACEMENTStsubt_NUMERIC_PREFIXR8R9R=RVRRCtendRRot_SUFFIX_REPLACEMENTSt is_semverR5( RRRtpattreplRDRItsuffixRtsep((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt_suggest_semantic_versions:  : (    cCs yt||SWntk r%nX|j}xSd2d3d4d5d6d7d8d9d:d;d<d=d>d?d@fD]\}}|j||}qfWtjdd|}tjdd|}tjdd|}tjdd|}tjdd|}|jdr |d }ntjd!d|}tjd"d#|}tjd$d%|}tjd&d|}tjd'd(|}tjd)d(|}tjd*d |}tjd+d,|}tjd-d%|}tjd.d/|}tjd0d1|}yt|Wntk rdA}nX|S(BsSuggest a normalized version close to the given version string. If you have a version string that isn't rational (i.e. NormalizedVersion doesn't like it) then you might be able to get an equivalent (or close) rational version from this function. This does a number of simple normalizations to the given string, based on observation of versions currently in use on PyPI. Given a dump of those version during PyCon 2009, 4287 of them: - 2312 (53.93%) match NormalizedVersion without change with the automatic suggestion - 3474 (81.04%) match when using this suggestion method @param s {str} An irrational version string. @returns A rational version string, or None, if couldn't determine one. s-alphaRYs-betaRiRRRjR-s-finalR0s-pres-releases.releases-stableR}RXR[t s.finalR\spre$tpre0sdev$tdev0s([abc]|rc)[\-\.](\d+)$s\1\2s[\-\.](dev)[\-\.]?r?(\d+)$s.\1\2s[.~]?([abc])\.?s\1R,is\b0+(\d+)(?!\d)s (\d+[abc])$s\g<1>0s\.?(dev-r|dev\.r)\.?(\d+)$s.dev\2s-(a|b|c)(\d+)$s[\.\-](dev|devel)$s.dev0s(?![\.\-])dev$s(final|stable)$s\.?(r|-|-r)\.?(\d+)$s.post\2s\.?(dev|git|bzr)\.?(\d+)$s\.?(pre|preview|-c)(\d+)$sc\g<2>sp(\d+)$s.post\1(s-alphaRY(s-betaRi(RRY(RRi(RjR-(s-finalR0(s-preR-(s-releaseR0(s.releaseR0(s-stableR0(R}RX(R[RX(RR0(s.finalR0(R\R0N(RgRR;treplaceRTRRpR5(RtrstorigR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt_suggest_normalized_versionsH           s([a-z]+|\d+|[\.-])R-Ratpreviewsfinal-RRjt@RccCsd}g}x||D]}|jdr|dkrgx'|rc|ddkrc|jq@Wnx'|r|ddkr|jqjWn|j|qWt|S(NcSsg}xtj|jD]j}tj||}|rd|d koUdknrl|jd}n d|}|j|qqW|jd|S(Nt0it9it*s*final(t _VERSION_PARTR=R;t_VERSION_REPLACERKtzfillRC(RRRR.((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt get_partsIs   Rs*finalis*final-t00000000(RptpopRCR(RRRRR.((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt _legacy_keyHs  cBs eZdZedZRS(cCs t|S(N(R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRcscCsRt}xE|jD]:}t|tr|jdr|dkrt}PqqW|S(NRs*final(RBRRRRpR@(RRRRq((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR)fs (R R RR*R)(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRbs cBs?eZeZeejZded s~   1k =$ W  . r       #    site-packages/pip/_vendor/distlib/version.pyo000064400000063306147204247350015400 0ustar00 abc @srdZddlZddlZddlmZddddd d d d gZejeZd e fd YZ de fdYZ de fdYZ ejdZdZeZde fdYZdZde fdYZejddfejddfejddfejddfejddfejd dfejd!d"fejd#d$fejd%d&fejd'd(ff Zejd)dfejd*dfejd+d"fejd!d"fejd,dffZejd-Zd.Zd/Zejd0ejZid1d26d1d36d4d56d1d66d7d86dd6dd"6Zd9Zde fd:YZde fd;YZ ejd<ejZ!d=Z"d>Z#d e fd?YZ$d e fd@YZ%dAe fdBYZ&ie&eeedC6e&ee dDdE6e&e#e%edF6Z'e'dCe'dG=|<|>|!=|={2,3}|~=)?\s*([^\s,]+)$s ^\d+(\.\d+)*$cCs ||kS(N((tvtctp((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pytWttcCs||kp||kS(N((R(R)R*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+YR,s<=cCs||kp||kS(N((R(R)R*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+ZR,s>=cCs ||kS(N((R(R)R*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+[R,s==cCs ||kS(N((R(R)R*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+\R,s===cCs||kp||kS(N((R(R)R*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+^R,s~=cCs ||kS(N((R(R)R*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+_R,s!=c Cs|jdkrtdn|j|_}|jj|}|s\td|n|jd}|dj|_|jj |_ g}|drg|dj dD]}|j^q}x|D]}|j j|}|s td||fn|j}|dp#d}|d }|j d r|dkr^td |n|d t}} |jj|s|j|qn|j|t}} |j||| fqWnt||_dS(NsPlease specify a version classs Not valid: %rR,iit,sInvalid %r in %rs~=is.*s==s!=s#'.*' not allowed for %r constraintsi(s==s!=(t version_classtNonet ValueErrorR Rtdist_retmatchtgroupstnametlowertkeytsplittcomp_retendswithtTruetnum_retFalsetappendttupleR( RRtmR5tclistR)t constraintstoptvntprefix((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRbs: ,     cCst|tr!|j|}nx|jD]\}}}|jj|}t|trmt||}n|sd||jjf}t |n||||s+t Sq+Wt S(s Check if the provided version matches the constraints. :param version: The version to match against this instance. :type version: String or :class:`Version` instance. s%r not implemented for %s( t isinstanceRR0Rt _operatorstgettgetattrR"R RR>R<(Rtversiontoperatort constraintRFtftmsg((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR4scCsJd}t|jdkrF|jdddkrF|jdd}n|S(Niis==s===(s==s===(R1tlenR(Rtresult((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt exact_versions,cCsGt|t|ks*|j|jkrCtd||fndS(Nscannot compare %s and %s(RR6R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRs*cCs/|j||j|jko.|j|jkS(N(RR8R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRs cCs|j| S(N(R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRscCst|jt|jS(N(R R8R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR!scCsd|jj|jfS(Ns%s(%r)(R"R R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR#scCs|jS(N(R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR$sN(R R R1R0tretcompileR3R:R=RHRR4R&RRRRRR!R#R$(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR'Ns,         %      sk^v?(\d+!)?(\d+(\.\d+)*)((a|b|c|rc)(\d+))?(\.(post)(\d+))?(\.(dev)(\d+))?(\+([a-zA-Z\d]+(\.[a-zA-Z\d]+)?))?$c CsK|j}tj|}|s4td|n|j}td|djdD}x0t|dkr|ddkr|d }qfW|dsd}nt|d}|dd!}|d d !}|d d !}|d }|dkrd}n|dt|df}|dkr.d}n|dt|df}|dkr]d}n|dt|df}|dkrd}nfg} xQ|jdD]@} | j rdt| f} n d| f} | j | qWt| }|s| r|rd}qd}n|s&d}n|s5d}n||||||fS(NsNot a valid version: %scss|]}t|VqdS(N(tint(t.0R(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pys sit.iiiiii i i i tatzt_tfinal(NN((NN((NN(((RXi(RY(RZ(R[( R tPEP440_VERSION_RER4RR5R@R9RPRUR1tisdigitR?( RRAR5tnumstepochtpretposttdevtlocalRtpart((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt _pep_440_keysT  #%                      cBsAeZdZdZedddddgZedZRS(sIA rational version. Good: 1.2 # equivalent to "1.2.0" 1.2.0 1.2a1 1.2.3a2 1.2.3b1 1.2.3c1 1.2.3.4 TODO: fill this out Bad: 1 # minimum two numbers 1.2a # release level must have a release serial 1.2.3b cCsQt|}tj|}|j}td|djdD|_|S(Ncss|]}t|VqdS(N(RU(RVR(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pys siRW(t_normalized_keyR\R4R5R@R9t_release_clause(RRRQRAR5((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRs   &RXtbR)trcRbcstfdjDS(Nc3s(|]}|r|djkVqdS(iN(t PREREL_TAGS(RVtt(R(s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pys s(tanyR(R((Rs?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR%s(R R R RtsetRjR&R%(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRs cCsUt|}t|}||kr(tS|j|s;tSt|}||dkS(NRW(tstrR<t startswithR>RP(txtytn((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt _match_prefix"s    cBseZeZidd6dd6dd6dd6dd 6d d 6d d 6dd6ZdZdZdZdZdZ dZ dZ dZ dZ RS(t_match_compatibles~=t _match_ltR-t _match_gtR.t _match_les<=t _match_ges>=t _match_eqs==t_match_arbitrarys===t _match_nes!=cCsx|r"d|ko|jd}n|jd o:|jd}|rn|jjddd}|j|}n||fS(Nt+iii(RRR9R0(RRKRMRFt strip_localR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt _adjust_local<scCsj|j|||\}}||kr+tS|j}djg|D]}t|^qA}t|| S(NRW(R~R>RgtjoinRnRs(RRKRMRFtrelease_clausetitpfx((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRuJs   (cCsj|j|||\}}||kr+tS|j}djg|D]}t|^qA}t|| S(NRW(R~R>RgRRnRs(RRKRMRFRRR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRvRs   (cCs%|j|||\}}||kS(N(R~(RRKRMRF((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRwZscCs%|j|||\}}||kS(N(R~(RRKRMRF((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRx^scCsC|j|||\}}|s0||k}nt||}|S(N(R~Rs(RRKRMRFRQ((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRybs cCst|t|kS(N(Rn(RRKRMRF((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRzjscCsD|j|||\}}|s0||k}nt|| }|S(N(R~Rs(RRKRMRFRQ((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR{ms cCs|j|||\}}||kr+tS||kr;tS|j}t|dkrc|d }ndjg|D]}t|^qp}t||S(NiiRW(R~R<R>RgRPRRnRs(RRKRMRFRRR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRtus    ((R R RR0RHR~RuRvRwRxRyRzR{Rt(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR-s&         s[.+-]$R,s^[.](\d)s0.\1s^[.-]s ^\((.*)\)$s\1s^v(ersion)?\s*(\d+)s\2s^r(ev)?\s*(\d+)s[.]{2,}RWs\b(alfa|apha)\btalphas\b(pre-alpha|prealpha)\bs pre.alphas \(beta\)$tbetas ^[:~._+-]+s [,*")([\]]s[~:+_ -]s\.$s (\d+(\.\d+)*)c Cs|jj}x&tD]\}}|j||}qW|sJd}ntj|}|snd}|}n|jdjd}g|D]}t|^q}x#t |dkr|j dqWt |dkr||j }nDdj g|dD]}t |^q||j }|d }dj g|D]}t |^qB}|j}|rx)tD]\}}|j||}qvWn|s|}n&d|krdnd}|||}t|sd}n|S( s Try to suggest a semantic form for a version for which _suggest_normalized_version couldn't come up with anything. s0.0.0iRWiRbt-R|N(R R7t _REPLACEMENTStsubt_NUMERIC_PREFIXR4R5R9RURPR?tendRRnt_SUFFIX_REPLACEMENTSt is_semverR1( RRQtpattreplRARFtsuffixRtsep((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt_suggest_semantic_versions:  : (    cCs yt||SWntk r%nX|j}xSd2d3d4d5d6d7d8d9d:d;d<d=d>d?d@fD]\}}|j||}qfWtjdd|}tjdd|}tjdd|}tjdd|}tjdd|}|jdr |d }ntjd!d|}tjd"d#|}tjd$d%|}tjd&d|}tjd'd(|}tjd)d(|}tjd*d |}tjd+d,|}tjd-d%|}tjd.d/|}tjd0d1|}yt|Wntk rdA}nX|S(BsSuggest a normalized version close to the given version string. If you have a version string that isn't rational (i.e. NormalizedVersion doesn't like it) then you might be able to get an equivalent (or close) rational version from this function. This does a number of simple normalizations to the given string, based on observation of versions currently in use on PyPI. Given a dump of those version during PyCon 2009, 4287 of them: - 2312 (53.93%) match NormalizedVersion without change with the automatic suggestion - 3474 (81.04%) match when using this suggestion method @param s {str} An irrational version string. @returns A rational version string, or None, if couldn't determine one. s-alphaRXs-betaRhRRRiR)s-finalR,s-pres-releases.releases-stableR|RWRZt s.finalR[spre$tpre0sdev$tdev0s([abc]|rc)[\-\.](\d+)$s\1\2s[\-\.](dev)[\-\.]?r?(\d+)$s.\1\2s[.~]?([abc])\.?s\1R(is\b0+(\d+)(?!\d)s (\d+[abc])$s\g<1>0s\.?(dev-r|dev\.r)\.?(\d+)$s.dev\2s-(a|b|c)(\d+)$s[\.\-](dev|devel)$s.dev0s(?![\.\-])dev$s(final|stable)$s\.?(r|-|-r)\.?(\d+)$s.post\2s\.?(dev|git|bzr)\.?(\d+)$s\.?(pre|preview|-c)(\d+)$sc\g<2>sp(\d+)$s.post\1(s-alphaRX(s-betaRh(RRX(RRh(RiR)(s-finalR,(s-preR)(s-releaseR,(s.releaseR,(s-stableR,(R|RW(RZRW(RR,(s.finalR,(R[R,N(RfRR7treplaceRSRRoR1(RtrstorigR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt_suggest_normalized_versionsH           s([a-z]+|\d+|[\.-])R)R`tpreviewsfinal-RRit@RbcCsd}g}x||D]}|jdr|dkrgx'|rc|ddkrc|jq@Wnx'|r|ddkr|jqjWn|j|qWt|S(NcSsg}xtj|jD]j}tj||}|rd|d koUdknrl|jd}n d|}|j|qqW|jd|S(Nt0it9it*s*final(t _VERSION_PARTR9R7t_VERSION_REPLACERItzfillR?(RRQR*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt get_partsIs   Rs*finalis*final-t00000000(RotpopR?R@(RRRQR*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt _legacy_keyHs  cBs eZdZedZRS(cCs t|S(N(R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRcscCsRt}xE|jD]:}t|tr|jdr|dkrt}PqqW|S(NRs*final(R>RRGRRoR<(RRQRp((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR%fs (R R RR&R%(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRbs cBs?eZeZeejZdedt numeric_reR4RntloggertwarningR<R5trsplitRs(RRKRMRFRAR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRtys    ( R R RR0tdictR'RHRSRTRRt(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRqs  sN^(\d+)\.(\d+)\.(\d+)(-[a-z0-9]+(\.[a-z0-9-]+)*)?(\+[a-z0-9]+(\.[a-z0-9-]+)*)?$cCs tj|S(N(t _SEMVER_RER4(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRsc Csd}t|}|s*t|n|j}g|d D]}t|^qA\}}}||dd||dd}} |||f|| fS(NcSsi|dkr|f}nM|djd}tg|D]'}|jrV|jdn|^q5}|S(NiRWi(R1R9R@R]R(RtabsentRQRR*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt make_tuples   :it|iR(RRR5RU( RRRAR5RtmajortminortpatchR`tbuild((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt _semantic_keys  ,'cBs eZdZedZRS(cCs t|S(N(R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRscCs|jdddkS(NiiR(R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR%s(R R RR&R%(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRs cBseZeZRS((R R RR0(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRst VersionSchemecBs8eZddZdZdZdZdZRS(cCs||_||_||_dS(N(R8tmatchert suggester(RR8RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRs  cCs8y|jj|t}Wntk r3t}nX|S(N(RR0R<RR>(RRRQ((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pytis_valid_versions    cCs5y|j|t}Wntk r0t}nX|S(N(RR<RR>(RRRQ((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pytis_valid_matchers     cCs|jd|S(s: Used for processing some metadata fields sdummy_name (%s)(R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pytis_valid_constraint_listscCs+|jdkrd}n|j|}|S(N(RR1(RRRQ((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pytsuggests N(R R R1RRRRR(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRs     t normalizedcCs|S(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+R,tlegacytsemantictdefaultcCs'|tkrtd|nt|S(Nsunknown scheme name: %r(t_SCHEMESR2(R6((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRs ()R tloggingRStcompatRt__all__t getLoggerR RR2RtobjectR R'RTR\ReRfRRsRRRRRRtIRR1RRRRRRRRRRRR(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt s~   1k =$ W  . r       #    site-packages/pip/_vendor/distlib/wheel.py000064400000114313147204247350014633 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2013-2016 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # from __future__ import unicode_literals import base64 import codecs import datetime import distutils.util from email import message_from_file import hashlib import imp import json import logging import os import posixpath import re import shutil import sys import tempfile import zipfile from . import __version__, DistlibException from .compat import sysconfig, ZipFile, fsdecode, text_type, filter from .database import InstalledDistribution from .metadata import Metadata, METADATA_FILENAME from .util import (FileOperator, convert_path, CSVReader, CSVWriter, Cache, cached_property, get_cache_base, read_exports, tempdir) from .version import NormalizedVersion, UnsupportedVersionError logger = logging.getLogger(__name__) cache = None # created when needed if hasattr(sys, 'pypy_version_info'): IMP_PREFIX = 'pp' elif sys.platform.startswith('java'): IMP_PREFIX = 'jy' elif sys.platform == 'cli': IMP_PREFIX = 'ip' else: IMP_PREFIX = 'cp' VER_SUFFIX = sysconfig.get_config_var('py_version_nodot') if not VER_SUFFIX: # pragma: no cover VER_SUFFIX = '%s%s' % sys.version_info[:2] PYVER = 'py' + VER_SUFFIX IMPVER = IMP_PREFIX + VER_SUFFIX ARCH = distutils.util.get_platform().replace('-', '_').replace('.', '_') ABI = sysconfig.get_config_var('SOABI') if ABI and ABI.startswith('cpython-'): ABI = ABI.replace('cpython-', 'cp') else: def _derive_abi(): parts = ['cp', VER_SUFFIX] if sysconfig.get_config_var('Py_DEBUG'): parts.append('d') if sysconfig.get_config_var('WITH_PYMALLOC'): parts.append('m') if sysconfig.get_config_var('Py_UNICODE_SIZE') == 4: parts.append('u') return ''.join(parts) ABI = _derive_abi() del _derive_abi FILENAME_RE = re.compile(r''' (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))? -(?P\w+\d+(\.\w+\d+)*) -(?P\w+) -(?P\w+(\.\w+)*) \.whl$ ''', re.IGNORECASE | re.VERBOSE) NAME_VERSION_RE = re.compile(r''' (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))?$ ''', re.IGNORECASE | re.VERBOSE) SHEBANG_RE = re.compile(br'\s*#![^\r\n]*') SHEBANG_DETAIL_RE = re.compile(br'^(\s*#!("[^"]+"|\S+))\s+(.*)$') SHEBANG_PYTHON = b'#!python' SHEBANG_PYTHONW = b'#!pythonw' if os.sep == '/': to_posix = lambda o: o else: to_posix = lambda o: o.replace(os.sep, '/') class Mounter(object): def __init__(self): self.impure_wheels = {} self.libs = {} def add(self, pathname, extensions): self.impure_wheels[pathname] = extensions self.libs.update(extensions) def remove(self, pathname): extensions = self.impure_wheels.pop(pathname) for k, v in extensions: if k in self.libs: del self.libs[k] def find_module(self, fullname, path=None): if fullname in self.libs: result = self else: result = None return result def load_module(self, fullname): if fullname in sys.modules: result = sys.modules[fullname] else: if fullname not in self.libs: raise ImportError('unable to find extension for %s' % fullname) result = imp.load_dynamic(fullname, self.libs[fullname]) result.__loader__ = self parts = fullname.rsplit('.', 1) if len(parts) > 1: result.__package__ = parts[0] return result _hook = Mounter() class Wheel(object): """ Class to build and install from Wheel files (PEP 427). """ wheel_version = (1, 1) hash_kind = 'sha256' def __init__(self, filename=None, sign=False, verify=False): """ Initialise an instance using a (valid) filename. """ self.sign = sign self.should_verify = verify self.buildver = '' self.pyver = [PYVER] self.abi = ['none'] self.arch = ['any'] self.dirname = os.getcwd() if filename is None: self.name = 'dummy' self.version = '0.1' self._filename = self.filename else: m = NAME_VERSION_RE.match(filename) if m: info = m.groupdict('') self.name = info['nm'] # Reinstate the local version separator self.version = info['vn'].replace('_', '-') self.buildver = info['bn'] self._filename = self.filename else: dirname, filename = os.path.split(filename) m = FILENAME_RE.match(filename) if not m: raise DistlibException('Invalid name or ' 'filename: %r' % filename) if dirname: self.dirname = os.path.abspath(dirname) self._filename = filename info = m.groupdict('') self.name = info['nm'] self.version = info['vn'] self.buildver = info['bn'] self.pyver = info['py'].split('.') self.abi = info['bi'].split('.') self.arch = info['ar'].split('.') @property def filename(self): """ Build and return a filename from the various components. """ if self.buildver: buildver = '-' + self.buildver else: buildver = '' pyver = '.'.join(self.pyver) abi = '.'.join(self.abi) arch = '.'.join(self.arch) # replace - with _ as a local version separator version = self.version.replace('-', '_') return '%s-%s%s-%s-%s-%s.whl' % (self.name, version, buildver, pyver, abi, arch) @property def exists(self): path = os.path.join(self.dirname, self.filename) return os.path.isfile(path) @property def tags(self): for pyver in self.pyver: for abi in self.abi: for arch in self.arch: yield pyver, abi, arch @cached_property def metadata(self): pathname = os.path.join(self.dirname, self.filename) name_ver = '%s-%s' % (self.name, self.version) info_dir = '%s.dist-info' % name_ver wrapper = codecs.getreader('utf-8') with ZipFile(pathname, 'r') as zf: wheel_metadata = self.get_wheel_metadata(zf) wv = wheel_metadata['Wheel-Version'].split('.', 1) file_version = tuple([int(i) for i in wv]) if file_version < (1, 1): fn = 'METADATA' else: fn = METADATA_FILENAME try: metadata_filename = posixpath.join(info_dir, fn) with zf.open(metadata_filename) as bf: wf = wrapper(bf) result = Metadata(fileobj=wf) except KeyError: raise ValueError('Invalid wheel, because %s is ' 'missing' % fn) return result def get_wheel_metadata(self, zf): name_ver = '%s-%s' % (self.name, self.version) info_dir = '%s.dist-info' % name_ver metadata_filename = posixpath.join(info_dir, 'WHEEL') with zf.open(metadata_filename) as bf: wf = codecs.getreader('utf-8')(bf) message = message_from_file(wf) return dict(message) @cached_property def info(self): pathname = os.path.join(self.dirname, self.filename) with ZipFile(pathname, 'r') as zf: result = self.get_wheel_metadata(zf) return result def process_shebang(self, data): m = SHEBANG_RE.match(data) if m: end = m.end() shebang, data_after_shebang = data[:end], data[end:] # Preserve any arguments after the interpreter if b'pythonw' in shebang.lower(): shebang_python = SHEBANG_PYTHONW else: shebang_python = SHEBANG_PYTHON m = SHEBANG_DETAIL_RE.match(shebang) if m: args = b' ' + m.groups()[-1] else: args = b'' shebang = shebang_python + args data = shebang + data_after_shebang else: cr = data.find(b'\r') lf = data.find(b'\n') if cr < 0 or cr > lf: term = b'\n' else: if data[cr:cr + 2] == b'\r\n': term = b'\r\n' else: term = b'\r' data = SHEBANG_PYTHON + term + data return data def get_hash(self, data, hash_kind=None): if hash_kind is None: hash_kind = self.hash_kind try: hasher = getattr(hashlib, hash_kind) except AttributeError: raise DistlibException('Unsupported hash algorithm: %r' % hash_kind) result = hasher(data).digest() result = base64.urlsafe_b64encode(result).rstrip(b'=').decode('ascii') return hash_kind, result def write_record(self, records, record_path, base): records = list(records) # make a copy for sorting p = to_posix(os.path.relpath(record_path, base)) records.append((p, '', '')) records.sort() with CSVWriter(record_path) as writer: for row in records: writer.writerow(row) def write_records(self, info, libdir, archive_paths): records = [] distinfo, info_dir = info hasher = getattr(hashlib, self.hash_kind) for ap, p in archive_paths: with open(p, 'rb') as f: data = f.read() digest = '%s=%s' % self.get_hash(data) size = os.path.getsize(p) records.append((ap, digest, size)) p = os.path.join(distinfo, 'RECORD') self.write_record(records, p, libdir) ap = to_posix(os.path.join(info_dir, 'RECORD')) archive_paths.append((ap, p)) def build_zip(self, pathname, archive_paths): with ZipFile(pathname, 'w', zipfile.ZIP_DEFLATED) as zf: for ap, p in archive_paths: logger.debug('Wrote %s to %s in wheel', p, ap) zf.write(p, ap) def build(self, paths, tags=None, wheel_version=None): """ Build a wheel from files in specified paths, and use any specified tags when determining the name of the wheel. """ if tags is None: tags = {} libkey = list(filter(lambda o: o in paths, ('purelib', 'platlib')))[0] if libkey == 'platlib': is_pure = 'false' default_pyver = [IMPVER] default_abi = [ABI] default_arch = [ARCH] else: is_pure = 'true' default_pyver = [PYVER] default_abi = ['none'] default_arch = ['any'] self.pyver = tags.get('pyver', default_pyver) self.abi = tags.get('abi', default_abi) self.arch = tags.get('arch', default_arch) libdir = paths[libkey] name_ver = '%s-%s' % (self.name, self.version) data_dir = '%s.data' % name_ver info_dir = '%s.dist-info' % name_ver archive_paths = [] # First, stuff which is not in site-packages for key in ('data', 'headers', 'scripts'): if key not in paths: continue path = paths[key] if os.path.isdir(path): for root, dirs, files in os.walk(path): for fn in files: p = fsdecode(os.path.join(root, fn)) rp = os.path.relpath(p, path) ap = to_posix(os.path.join(data_dir, key, rp)) archive_paths.append((ap, p)) if key == 'scripts' and not p.endswith('.exe'): with open(p, 'rb') as f: data = f.read() data = self.process_shebang(data) with open(p, 'wb') as f: f.write(data) # Now, stuff which is in site-packages, other than the # distinfo stuff. path = libdir distinfo = None for root, dirs, files in os.walk(path): if root == path: # At the top level only, save distinfo for later # and skip it for now for i, dn in enumerate(dirs): dn = fsdecode(dn) if dn.endswith('.dist-info'): distinfo = os.path.join(root, dn) del dirs[i] break assert distinfo, '.dist-info directory expected, not found' for fn in files: # comment out next suite to leave .pyc files in if fsdecode(fn).endswith(('.pyc', '.pyo')): continue p = os.path.join(root, fn) rp = to_posix(os.path.relpath(p, path)) archive_paths.append((rp, p)) # Now distinfo. Assumed to be flat, i.e. os.listdir is enough. files = os.listdir(distinfo) for fn in files: if fn not in ('RECORD', 'INSTALLER', 'SHARED', 'WHEEL'): p = fsdecode(os.path.join(distinfo, fn)) ap = to_posix(os.path.join(info_dir, fn)) archive_paths.append((ap, p)) wheel_metadata = [ 'Wheel-Version: %d.%d' % (wheel_version or self.wheel_version), 'Generator: distlib %s' % __version__, 'Root-Is-Purelib: %s' % is_pure, ] for pyver, abi, arch in self.tags: wheel_metadata.append('Tag: %s-%s-%s' % (pyver, abi, arch)) p = os.path.join(distinfo, 'WHEEL') with open(p, 'w') as f: f.write('\n'.join(wheel_metadata)) ap = to_posix(os.path.join(info_dir, 'WHEEL')) archive_paths.append((ap, p)) # Now, at last, RECORD. # Paths in here are archive paths - nothing else makes sense. self.write_records((distinfo, info_dir), libdir, archive_paths) # Now, ready to build the zip file pathname = os.path.join(self.dirname, self.filename) self.build_zip(pathname, archive_paths) return pathname def install(self, paths, maker, **kwargs): """ Install a wheel to the specified paths. If kwarg ``warner`` is specified, it should be a callable, which will be called with two tuples indicating the wheel version of this software and the wheel version in the file, if there is a discrepancy in the versions. This can be used to issue any warnings to raise any exceptions. If kwarg ``lib_only`` is True, only the purelib/platlib files are installed, and the headers, scripts, data and dist-info metadata are not written. The return value is a :class:`InstalledDistribution` instance unless ``options.lib_only`` is True, in which case the return value is ``None``. """ dry_run = maker.dry_run warner = kwargs.get('warner') lib_only = kwargs.get('lib_only', False) pathname = os.path.join(self.dirname, self.filename) name_ver = '%s-%s' % (self.name, self.version) data_dir = '%s.data' % name_ver info_dir = '%s.dist-info' % name_ver metadata_name = posixpath.join(info_dir, METADATA_FILENAME) wheel_metadata_name = posixpath.join(info_dir, 'WHEEL') record_name = posixpath.join(info_dir, 'RECORD') wrapper = codecs.getreader('utf-8') with ZipFile(pathname, 'r') as zf: with zf.open(wheel_metadata_name) as bwf: wf = wrapper(bwf) message = message_from_file(wf) wv = message['Wheel-Version'].split('.', 1) file_version = tuple([int(i) for i in wv]) if (file_version != self.wheel_version) and warner: warner(self.wheel_version, file_version) if message['Root-Is-Purelib'] == 'true': libdir = paths['purelib'] else: libdir = paths['platlib'] records = {} with zf.open(record_name) as bf: with CSVReader(stream=bf) as reader: for row in reader: p = row[0] records[p] = row data_pfx = posixpath.join(data_dir, '') info_pfx = posixpath.join(info_dir, '') script_pfx = posixpath.join(data_dir, 'scripts', '') # make a new instance rather than a copy of maker's, # as we mutate it fileop = FileOperator(dry_run=dry_run) fileop.record = True # so we can rollback if needed bc = not sys.dont_write_bytecode # Double negatives. Lovely! outfiles = [] # for RECORD writing # for script copying/shebang processing workdir = tempfile.mkdtemp() # set target dir later # we default add_launchers to False, as the # Python Launcher should be used instead maker.source_dir = workdir maker.target_dir = None try: for zinfo in zf.infolist(): arcname = zinfo.filename if isinstance(arcname, text_type): u_arcname = arcname else: u_arcname = arcname.decode('utf-8') # The signature file won't be in RECORD, # and we don't currently don't do anything with it if u_arcname.endswith('/RECORD.jws'): continue row = records[u_arcname] if row[2] and str(zinfo.file_size) != row[2]: raise DistlibException('size mismatch for ' '%s' % u_arcname) if row[1]: kind, value = row[1].split('=', 1) with zf.open(arcname) as bf: data = bf.read() _, digest = self.get_hash(data, kind) if digest != value: raise DistlibException('digest mismatch for ' '%s' % arcname) if lib_only and u_arcname.startswith((info_pfx, data_pfx)): logger.debug('lib_only: skipping %s', u_arcname) continue is_script = (u_arcname.startswith(script_pfx) and not u_arcname.endswith('.exe')) if u_arcname.startswith(data_pfx): _, where, rp = u_arcname.split('/', 2) outfile = os.path.join(paths[where], convert_path(rp)) else: # meant for site-packages. if u_arcname in (wheel_metadata_name, record_name): continue outfile = os.path.join(libdir, convert_path(u_arcname)) if not is_script: with zf.open(arcname) as bf: fileop.copy_stream(bf, outfile) outfiles.append(outfile) # Double check the digest of the written file if not dry_run and row[1]: with open(outfile, 'rb') as bf: data = bf.read() _, newdigest = self.get_hash(data, kind) if newdigest != digest: raise DistlibException('digest mismatch ' 'on write for ' '%s' % outfile) if bc and outfile.endswith('.py'): try: pyc = fileop.byte_compile(outfile) outfiles.append(pyc) except Exception: # Don't give up if byte-compilation fails, # but log it and perhaps warn the user logger.warning('Byte-compilation failed', exc_info=True) else: fn = os.path.basename(convert_path(arcname)) workname = os.path.join(workdir, fn) with zf.open(arcname) as bf: fileop.copy_stream(bf, workname) dn, fn = os.path.split(outfile) maker.target_dir = dn filenames = maker.make(fn) fileop.set_executable_mode(filenames) outfiles.extend(filenames) if lib_only: logger.debug('lib_only: returning None') dist = None else: # Generate scripts # Try to get pydist.json so we can see if there are # any commands to generate. If this fails (e.g. because # of a legacy wheel), log a warning but don't give up. commands = None file_version = self.info['Wheel-Version'] if file_version == '1.0': # Use legacy info ep = posixpath.join(info_dir, 'entry_points.txt') try: with zf.open(ep) as bwf: epdata = read_exports(bwf) commands = {} for key in ('console', 'gui'): k = '%s_scripts' % key if k in epdata: commands['wrap_%s' % key] = d = {} for v in epdata[k].values(): s = '%s:%s' % (v.prefix, v.suffix) if v.flags: s += ' %s' % v.flags d[v.name] = s except Exception: logger.warning('Unable to read legacy script ' 'metadata, so cannot generate ' 'scripts') else: try: with zf.open(metadata_name) as bwf: wf = wrapper(bwf) commands = json.load(wf).get('extensions') if commands: commands = commands.get('python.commands') except Exception: logger.warning('Unable to read JSON metadata, so ' 'cannot generate scripts') if commands: console_scripts = commands.get('wrap_console', {}) gui_scripts = commands.get('wrap_gui', {}) if console_scripts or gui_scripts: script_dir = paths.get('scripts', '') if not os.path.isdir(script_dir): raise ValueError('Valid script path not ' 'specified') maker.target_dir = script_dir for k, v in console_scripts.items(): script = '%s = %s' % (k, v) filenames = maker.make(script) fileop.set_executable_mode(filenames) if gui_scripts: options = {'gui': True } for k, v in gui_scripts.items(): script = '%s = %s' % (k, v) filenames = maker.make(script, options) fileop.set_executable_mode(filenames) p = os.path.join(libdir, info_dir) dist = InstalledDistribution(p) # Write SHARED paths = dict(paths) # don't change passed in dict del paths['purelib'] del paths['platlib'] paths['lib'] = libdir p = dist.write_shared_locations(paths, dry_run) if p: outfiles.append(p) # Write RECORD dist.write_installed_files(outfiles, paths['prefix'], dry_run) return dist except Exception: # pragma: no cover logger.exception('installation failed.') fileop.rollback() raise finally: shutil.rmtree(workdir) def _get_dylib_cache(self): global cache if cache is None: # Use native string to avoid issues on 2.x: see Python #20140. base = os.path.join(get_cache_base(), str('dylib-cache'), sys.version[:3]) cache = Cache(base) return cache def _get_extensions(self): pathname = os.path.join(self.dirname, self.filename) name_ver = '%s-%s' % (self.name, self.version) info_dir = '%s.dist-info' % name_ver arcname = posixpath.join(info_dir, 'EXTENSIONS') wrapper = codecs.getreader('utf-8') result = [] with ZipFile(pathname, 'r') as zf: try: with zf.open(arcname) as bf: wf = wrapper(bf) extensions = json.load(wf) cache = self._get_dylib_cache() prefix = cache.prefix_to_dir(pathname) cache_base = os.path.join(cache.base, prefix) if not os.path.isdir(cache_base): os.makedirs(cache_base) for name, relpath in extensions.items(): dest = os.path.join(cache_base, convert_path(relpath)) if not os.path.exists(dest): extract = True else: file_time = os.stat(dest).st_mtime file_time = datetime.datetime.fromtimestamp(file_time) info = zf.getinfo(relpath) wheel_time = datetime.datetime(*info.date_time) extract = wheel_time > file_time if extract: zf.extract(relpath, cache_base) result.append((name, dest)) except KeyError: pass return result def is_compatible(self): """ Determine if a wheel is compatible with the running system. """ return is_compatible(self) def is_mountable(self): """ Determine if a wheel is asserted as mountable by its metadata. """ return True # for now - metadata details TBD def mount(self, append=False): pathname = os.path.abspath(os.path.join(self.dirname, self.filename)) if not self.is_compatible(): msg = 'Wheel %s not compatible with this Python.' % pathname raise DistlibException(msg) if not self.is_mountable(): msg = 'Wheel %s is marked as not mountable.' % pathname raise DistlibException(msg) if pathname in sys.path: logger.debug('%s already in path', pathname) else: if append: sys.path.append(pathname) else: sys.path.insert(0, pathname) extensions = self._get_extensions() if extensions: if _hook not in sys.meta_path: sys.meta_path.append(_hook) _hook.add(pathname, extensions) def unmount(self): pathname = os.path.abspath(os.path.join(self.dirname, self.filename)) if pathname not in sys.path: logger.debug('%s not in path', pathname) else: sys.path.remove(pathname) if pathname in _hook.impure_wheels: _hook.remove(pathname) if not _hook.impure_wheels: if _hook in sys.meta_path: sys.meta_path.remove(_hook) def verify(self): pathname = os.path.join(self.dirname, self.filename) name_ver = '%s-%s' % (self.name, self.version) data_dir = '%s.data' % name_ver info_dir = '%s.dist-info' % name_ver metadata_name = posixpath.join(info_dir, METADATA_FILENAME) wheel_metadata_name = posixpath.join(info_dir, 'WHEEL') record_name = posixpath.join(info_dir, 'RECORD') wrapper = codecs.getreader('utf-8') with ZipFile(pathname, 'r') as zf: with zf.open(wheel_metadata_name) as bwf: wf = wrapper(bwf) message = message_from_file(wf) wv = message['Wheel-Version'].split('.', 1) file_version = tuple([int(i) for i in wv]) # TODO version verification records = {} with zf.open(record_name) as bf: with CSVReader(stream=bf) as reader: for row in reader: p = row[0] records[p] = row for zinfo in zf.infolist(): arcname = zinfo.filename if isinstance(arcname, text_type): u_arcname = arcname else: u_arcname = arcname.decode('utf-8') if '..' in u_arcname: raise DistlibException('invalid entry in ' 'wheel: %r' % u_arcname) # The signature file won't be in RECORD, # and we don't currently don't do anything with it if u_arcname.endswith('/RECORD.jws'): continue row = records[u_arcname] if row[2] and str(zinfo.file_size) != row[2]: raise DistlibException('size mismatch for ' '%s' % u_arcname) if row[1]: kind, value = row[1].split('=', 1) with zf.open(arcname) as bf: data = bf.read() _, digest = self.get_hash(data, kind) if digest != value: raise DistlibException('digest mismatch for ' '%s' % arcname) def update(self, modifier, dest_dir=None, **kwargs): """ Update the contents of a wheel in a generic way. The modifier should be a callable which expects a dictionary argument: its keys are archive-entry paths, and its values are absolute filesystem paths where the contents the corresponding archive entries can be found. The modifier is free to change the contents of the files pointed to, add new entries and remove entries, before returning. This method will extract the entire contents of the wheel to a temporary location, call the modifier, and then use the passed (and possibly updated) dictionary to write a new wheel. If ``dest_dir`` is specified, the new wheel is written there -- otherwise, the original wheel is overwritten. The modifier should return True if it updated the wheel, else False. This method returns the same value the modifier returns. """ def get_version(path_map, info_dir): version = path = None key = '%s/%s' % (info_dir, METADATA_FILENAME) if key not in path_map: key = '%s/PKG-INFO' % info_dir if key in path_map: path = path_map[key] version = Metadata(path=path).version return version, path def update_version(version, path): updated = None try: v = NormalizedVersion(version) i = version.find('-') if i < 0: updated = '%s+1' % version else: parts = [int(s) for s in version[i + 1:].split('.')] parts[-1] += 1 updated = '%s+%s' % (version[:i], '.'.join(str(i) for i in parts)) except UnsupportedVersionError: logger.debug('Cannot update non-compliant (PEP-440) ' 'version %r', version) if updated: md = Metadata(path=path) md.version = updated legacy = not path.endswith(METADATA_FILENAME) md.write(path=path, legacy=legacy) logger.debug('Version updated from %r to %r', version, updated) pathname = os.path.join(self.dirname, self.filename) name_ver = '%s-%s' % (self.name, self.version) info_dir = '%s.dist-info' % name_ver record_name = posixpath.join(info_dir, 'RECORD') with tempdir() as workdir: with ZipFile(pathname, 'r') as zf: path_map = {} for zinfo in zf.infolist(): arcname = zinfo.filename if isinstance(arcname, text_type): u_arcname = arcname else: u_arcname = arcname.decode('utf-8') if u_arcname == record_name: continue if '..' in u_arcname: raise DistlibException('invalid entry in ' 'wheel: %r' % u_arcname) zf.extract(zinfo, workdir) path = os.path.join(workdir, convert_path(u_arcname)) path_map[u_arcname] = path # Remember the version. original_version, _ = get_version(path_map, info_dir) # Files extracted. Call the modifier. modified = modifier(path_map, **kwargs) if modified: # Something changed - need to build a new wheel. current_version, path = get_version(path_map, info_dir) if current_version and (current_version == original_version): # Add or update local version to signify changes. update_version(current_version, path) # Decide where the new wheel goes. if dest_dir is None: fd, newpath = tempfile.mkstemp(suffix='.whl', prefix='wheel-update-', dir=workdir) os.close(fd) else: if not os.path.isdir(dest_dir): raise DistlibException('Not a directory: %r' % dest_dir) newpath = os.path.join(dest_dir, self.filename) archive_paths = list(path_map.items()) distinfo = os.path.join(workdir, info_dir) info = distinfo, info_dir self.write_records(info, workdir, archive_paths) self.build_zip(newpath, archive_paths) if dest_dir is None: shutil.copyfile(newpath, pathname) return modified def compatible_tags(): """ Return (pyver, abi, arch) tuples compatible with this Python. """ versions = [VER_SUFFIX] major = VER_SUFFIX[0] for minor in range(sys.version_info[1] - 1, - 1, -1): versions.append(''.join([major, str(minor)])) abis = [] for suffix, _, _ in imp.get_suffixes(): if suffix.startswith('.abi'): abis.append(suffix.split('.', 2)[1]) abis.sort() if ABI != 'none': abis.insert(0, ABI) abis.append('none') result = [] arches = [ARCH] if sys.platform == 'darwin': m = re.match('(\w+)_(\d+)_(\d+)_(\w+)$', ARCH) if m: name, major, minor, arch = m.groups() minor = int(minor) matches = [arch] if arch in ('i386', 'ppc'): matches.append('fat') if arch in ('i386', 'ppc', 'x86_64'): matches.append('fat3') if arch in ('ppc64', 'x86_64'): matches.append('fat64') if arch in ('i386', 'x86_64'): matches.append('intel') if arch in ('i386', 'x86_64', 'intel', 'ppc', 'ppc64'): matches.append('universal') while minor >= 0: for match in matches: s = '%s_%s_%s_%s' % (name, major, minor, match) if s != ARCH: # already there arches.append(s) minor -= 1 # Most specific - our Python version, ABI and arch for abi in abis: for arch in arches: result.append((''.join((IMP_PREFIX, versions[0])), abi, arch)) # where no ABI / arch dependency, but IMP_PREFIX dependency for i, version in enumerate(versions): result.append((''.join((IMP_PREFIX, version)), 'none', 'any')) if i == 0: result.append((''.join((IMP_PREFIX, version[0])), 'none', 'any')) # no IMP_PREFIX, ABI or arch dependency for i, version in enumerate(versions): result.append((''.join(('py', version)), 'none', 'any')) if i == 0: result.append((''.join(('py', version[0])), 'none', 'any')) return set(result) COMPATIBLE_TAGS = compatible_tags() del compatible_tags def is_compatible(wheel, tags=None): if not isinstance(wheel, Wheel): wheel = Wheel(wheel) # assume it's a filename result = False if tags is None: tags = COMPATIBLE_TAGS for ver, abi, arch in tags: if ver in wheel.pyver and abi in wheel.abi and arch in wheel.arch: result = True break return result site-packages/pip/_vendor/distlib/wheel.pyc000064400000074665147204247350015015 0ustar00 abc@sddlmZddlZddlZddlZddlZddlmZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlmZmZddlmZmZmZmZmZddlmZddlm Z m!Z!dd l"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+dd l,m-Z-m.Z.e j/e0Z1e2a3e4ed rd Z5n9ej6j7d rdZ5nej6dkrdZ5ndZ5ej8dZ9e9 rdej:d Z9nde9Z;e5e9Z<ej"j=j>ddj>ddZ?ej8dZ@e@oze@j7dre@j>ddZ@ndZAeAZ@[AejBdejCejDBZEejBdejCejDBZFejBdZGejBdZHd ZId!ZJe jKd"kr$d#ZLn d$ZLd%eMfd&YZNeNZOd'eMfd(YZPd)ZQeQZR[Qe2d*ZSdS(+i(tunicode_literalsN(tmessage_from_filei(t __version__tDistlibException(t sysconfigtZipFiletfsdecodet text_typetfilter(tInstalledDistribution(tMetadatatMETADATA_FILENAME( t FileOperatort convert_patht CSVReadert CSVWritertCachetcached_propertytget_cache_baset read_exportsttempdir(tNormalizedVersiontUnsupportedVersionErrorupypy_version_infouppujavaujyucliuipucpupy_version_nodotu%s%siupyu-u_u.uSOABIucpython-cCs|dtg}tjdr+|jdntjdrJ|jdntjddkro|jdnd j|S( NucpuPy_DEBUGudu WITH_PYMALLOCumuPy_UNICODE_SIZEiuuu(t VER_SUFFIXRtget_config_vartappendtjoin(tparts((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt _derive_abi;s uz (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))? -(?P\w+\d+(\.\w+\d+)*) -(?P\w+) -(?P\w+(\.\w+)*) \.whl$ u7 (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))?$ s \s*#![^\r\n]*s^(\s*#!("[^"]+"|\S+))\s+(.*)$s#!pythons #!pythonwu/cCs|S(N((to((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt]tcCs|jtjdS(Nu/(treplacetostsep(R((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyR_RtMountercBs8eZdZdZdZddZdZRS(cCsi|_i|_dS(N(t impure_wheelstlibs(tself((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt__init__cs cCs!||j|<|jj|dS(N(R$R%tupdate(R&tpathnamet extensions((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytaddgs cCsI|jj|}x0|D](\}}||jkr|j|=qqWdS(N(R$tpopR%(R&R)R*tktv((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytremovekscCs"||jkr|}nd}|S(N(R%tNone(R&tfullnametpathtresult((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt find_moduleqs cCs|tjkrtj|}nx||jkrAtd|ntj||j|}||_|jdd}t|dkr|d|_ n|S(Nuunable to find extension for %su.ii( tsystmodulesR%t ImportErrortimpt load_dynamict __loader__trsplittlent __package__(R&R1R3R((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt load_modulexs N(t__name__t __module__R'R+R/R0R4R>(((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyR#bs     tWheelcBseZdZdZdZdeedZedZ edZ edZ e dZ dZe d Zd Zdd Zd Zd ZdZdddZdZdZdZdZdZedZdZdZddZRS(u@ Class to build and install from Wheel files (PEP 427). iusha256cCs||_||_d|_tg|_dg|_dg|_tj|_ |dkr{d|_ d|_ |j |_nEtj|}|r|jd}|d|_ |djdd |_ |d |_|j |_ntjj|\}}tj|}|s!td |n|r?tjj||_ n||_|jd}|d|_ |d|_ |d |_|d jd |_|djd |_|djd |_dS(uB Initialise an instance using a (valid) filename. uunoneuanyudummyu0.1unmuvnu_u-ubnuInvalid name or filename: %rupyu.ubiuarN(tsignt should_verifytbuildvertPYVERtpyvertabitarchR!tgetcwdtdirnameR0tnametversiontfilenamet _filenametNAME_VERSION_REtmatcht groupdictR R2tsplitt FILENAME_RERtabspath(R&RMRBtverifytmtinfoRJ((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyR'sB                cCs|jrd|j}nd}dj|j}dj|j}dj|j}|jjdd}d|j|||||fS(uJ Build and return a filename from the various components. u-uu.u_u%s-%s%s-%s-%s-%s.whl(RDRRFRGRHRLR RK(R&RDRFRGRHRL((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyRMs cCs+tjj|j|j}tjj|S(N(R!R2RRJRMtisfile(R&R2((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytexistssccsNxG|jD]<}x3|jD](}x|jD]}|||fVq*WqWq WdS(N(RFRGRH(R&RFRGRH((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyttagssc Cs8tjj|j|j}d|j|jf}d|}tjd}t |d}|j |}|dj dd}t g|D]}t |^q} | d krd} nt} yItj|| } |j| "} || } td | }WdQXWn!tk r-td | nXWdQX|S( Nu%s-%su %s.dist-infouutf-8uru Wheel-Versionu.iuMETADATAtfileobju$Invalid wheel, because %s is missing(ii(R!R2RRJRMRKRLtcodecst getreaderRtget_wheel_metadataRRttupletintR t posixpathtopenR tKeyErrort ValueError(R&R)tname_vertinfo_dirtwrappertzftwheel_metadatatwvtit file_versiontfntmetadata_filenametbftwfR3((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytmetadatas( %    cCsud|j|jf}d|}tj|d}|j|(}tjd|}t|}WdQXt|S(Nu%s-%su %s.dist-infouWHEELuutf-8( RKRLRaRRbR\R]Rtdict(R&RhReRfRnRoRptmessage((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyR^s cCsFtjj|j|j}t|d}|j|}WdQX|S(Nur(R!R2RRJRMRR^(R&R)RhR3((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyRWsc Cstj|}|r|j}|| ||}}d|jkrQt}nt}tj|}|rd|jd}nd}||}||}ns|jd}|jd} |dks|| krd} n&|||d!d krd } nd} t| |}|S( Ntpythonwt iRs s iis ( t SHEBANG_RERPtendtlowertSHEBANG_PYTHONWtSHEBANG_PYTHONtSHEBANG_DETAIL_REtgroupstfind( R&tdataRVRwtshebangtdata_after_shebangtshebang_pythontargstcrtlftterm((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytprocess_shebangs,      cCs|dkr|j}nytt|}Wn!tk rNtd|nX||j}tj|j dj d}||fS(NuUnsupported hash algorithm: %rt=uascii( R0t hash_kindtgetattrthashlibtAttributeErrorRtdigesttbase64turlsafe_b64encodetrstriptdecode(R&R~RthasherR3((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytget_hashs   !cCs~t|}ttjj||}|j|ddf|jt|%}x|D]}|j|q]WWdQXdS(Nu( tlisttto_posixR!R2trelpathRtsortRtwriterow(R&trecordst record_pathtbasetptwritertrow((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt write_record's   cCsg}|\}}tt|j}xs|D]k\}} t| d} | j} WdQXd|j| } tjj| } |j || | fq+Wtjj |d} |j || |t tjj |d}|j || fdS(Nurbu%s=%suRECORD( RRRRbtreadRR!R2tgetsizeRRRR(R&RWtlibdirt archive_pathsRtdistinfoRfRtapRtfR~Rtsize((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt write_records0s c Cs\t|dtjA}x7|D]/\}}tjd|||j||qWWdQXdS(NuwuWrote %s to %s in wheel(Rtzipfilet ZIP_DEFLATEDtloggertdebugtwrite(R&R)RRhRR((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt build_zip@sc! s|dkri}nttfdd$d}|dkrgd}tg}tg}tg}n!d}tg}dg}dg}|jd ||_|jd ||_ |jd ||_ |} d |j |j f} d | } d| } g} xKd%D]C}|kr qn|}t jj|rx t j|D]\}}}x|D]}tt jj||}t jj||}tt jj| ||}| j||f|dkrb|jd rbt|d}|j}WdQX|j|}t|d}|j|WdQXqbqbWqLWqqW| }d}xt j|D]\}}}||krxUt|D]G\}}t|}|jdrt jj||}||=PqqW|stdnxl|D]d}t|jd&rqnt jj||}tt jj||}| j||fqWqkWt j|}xf|D]^}|d'kr|tt jj||}tt jj| |}| j||fq|q|Wd|p|jdtd |g}x4|j D])\}}}|jd!|||fq Wt jj|d}t|d"}|jd#j|WdQXtt jj| d}| j||f|j!|| f| | t jj|j"|j#} |j$| | | S((u Build a wheel from files in specified paths, and use any specified tags when determining the name of the wheel. cs |kS(N((R(tpaths(s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyRNRupurelibuplatlibiufalseutrueunoneuanyupyveruabiuarchu%s-%su%s.datau %s.dist-infoudatauheadersuscriptsu.exeurbNuwbu .dist-infou(.dist-info directory expected, not foundu.pycu.pyouRECORDu INSTALLERuSHAREDuWHEELuWheel-Version: %d.%duGenerator: distlib %suRoot-Is-Purelib: %su Tag: %s-%s-%suwu (upurelibuplatlib(udatauheadersuscripts(u.pycu.pyo(uRECORDu INSTALLERuSHAREDuWHEEL(%R0RRtIMPVERtABItARCHREtgetRFRGRHRKRLR!R2tisdirtwalkRRRRRtendswithRbRRRt enumeratetAssertionErrortlistdirt wheel_versionRRZRRJRMR(!R&RRZRtlibkeytis_puret default_pyvert default_abit default_archRRetdata_dirRfRtkeyR2troottdirstfilesRmRtrpRRR~RRktdnRiRFRGRHR)((Rs=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytbuildFs  "              %      cCKs |j}|jd}|jdt}tjj|j|j}d|j|j f}d|} d|} t j| t } t j| d} t j| d} t j d}t|d }|j| }||}t|}Wd QX|d jd d }tg|D]}t|^q}||jkrY|rY||j|n|ddkrv|d}n |d}i}|j| D}td|,}x"|D]}|d}||||jd.}6|6r|6jd/}6nWd QXWnt1k rt+j2d0nX|6r|6jd1i}>|6jd2i}?|>s|?r|jdd}@tjj?|@st@d3n|@|_xF|>jAD]8\}:}<d4|:|<f}A|j4|A}4|j5|4q(W|?ritd(6}BxL|?jAD];\}:}<d4|:|<f}A|j4|A|B}4|j5|4qWqqntjj|| }tB|}5tC|}|d=|d=||d5<|5jD||}|r9 |!j/|n|5jE|!|d6||5SWn+t1k r t+jFd7|jGnXWd tHjI|"XWd QXd S(9u Install a wheel to the specified paths. If kwarg ``warner`` is specified, it should be a callable, which will be called with two tuples indicating the wheel version of this software and the wheel version in the file, if there is a discrepancy in the versions. This can be used to issue any warnings to raise any exceptions. If kwarg ``lib_only`` is True, only the purelib/platlib files are installed, and the headers, scripts, data and dist-info metadata are not written. The return value is a :class:`InstalledDistribution` instance unless ``options.lib_only`` is True, in which case the return value is ``None``. uwarnerulib_onlyu%s-%su%s.datau %s.dist-infouWHEELuRECORDuutf-8urNu Wheel-Versionu.iuRoot-Is-Purelibutrueupurelibuplatlibtstreamiuuscriptstdry_runu /RECORD.jwsiusize mismatch for %su=udigest mismatch for %sulib_only: skipping %su.exeu/urbudigest mismatch on write for %su.pyuByte-compilation failedtexc_infoulib_only: returning Noneu1.0uentry_points.txtuconsoleuguiu %s_scriptsuwrap_%su%s:%su %suAUnable to read legacy script metadata, so cannot generate scriptsu extensionsupython.commandsu8Unable to read JSON metadata, so cannot generate scriptsu wrap_consoleuwrap_guiuValid script path not specifiedu%s = %sulibuprefixuinstallation failed.(uconsoleugui(JRRtFalseR!R2RRJRMRKRLRaR R\R]RRbRRRR_R`RRR tTruetrecordR5tdont_write_bytecodettempfiletmkdtempt source_dirR0t target_dirtinfolistt isinstanceRRRtstrt file_sizeRRRt startswithRRR t copy_streamRt byte_compilet Exceptiontwarningtbasenametmaketset_executable_modetextendRWRtvaluestprefixtsuffixtflagstjsontloadRRdtitemsR Rrtwrite_shared_locationstwrite_installed_filest exceptiontrollbacktshutiltrmtree(CR&RtmakertkwargsRtwarnertlib_onlyR)ReRRft metadata_nametwheel_metadata_namet record_nameRgRhtbwfRpRsRjRkRlRRRotreaderRRtdata_pfxtinfo_pfxt script_pfxtfileoptbctoutfilestworkdirtzinfotarcnamet u_arcnametkindtvalueR~t_Rt is_scripttwhereRtoutfilet newdigesttpycRmtworknameRt filenamestdisttcommandsteptepdataRR-tdR.tstconsole_scriptst gui_scriptst script_dirtscripttoptions((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytinstallsD    %            #   "                            cCsGtdkrCtjjttdtjd }t |antS(Nu dylib-cachei( tcacheR0R!R2RRRR5RLR(R&R((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt_get_dylib_caches  c Cstjj|j|j}d|j|jf}d|}tj|d}tj d}g}t |dw}y\|j |G}||} t j | } |j} | j|} tjj| j| } tjj| stj| nx| jD]\}}tjj| t|}tjj|sHt}nQtj|j}tjj|}|j|}tj|j}||k}|r|j|| n|j||fqWWdQXWntk rnXWdQX|S(Nu%s-%su %s.dist-infou EXTENSIONSuutf-8ur( R!R2RRJRMRKRLRaR\R]RRbRRRt prefix_to_dirRRtmakedirsRR RYRtstattst_mtimetdatetimet fromtimestamptgetinfot date_timetextractRRc(R&R)ReRfRRgR3RhRoRpR*RRt cache_baseRKRtdestRt file_timeRWt wheel_time((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt_get_extensionss>     !  cCs t|S(uM Determine if a wheel is compatible with the running system. (t is_compatible(R&((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyR%scCstS(uP Determine if a wheel is asserted as mountable by its metadata. (R(R&((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt is_mountablescCs tjjtjj|j|j}|jsLd|}t|n|jsqd|}t|n|t jkrt j d|ns|rt jj |nt jj d||j}|rtt jkrt jj tntj||ndS(Nu)Wheel %s not compatible with this Python.u$Wheel %s is marked as not mountable.u%s already in pathi(R!R2RTRRJRMR%RR&R5RRRtinsertR$t_hookt meta_pathR+(R&RR)tmsgR*((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytmounts"'     cCstjjtjj|j|j}|tjkrItjd|n]tjj ||t j krxt j |nt j st tj krtj j t qndS(Nu%s not in path( R!R2RTRRJRMR5RRR/R(R$R)(R&R)((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytunmounts' cCstjj|j|j}d|j|jf}d|}d|}tj|t}tj|d}tj|d}t j d}t |d } | j |} || } t | } WdQX| djd d } tg| D]}t|^q}i}| j |D}td |,}x"|D]}|d }|||Fsu0Cannot update non-compliant (PEP-440) version %rR2tlegacyuVersion updated from %r to %r(R0RR}RRR`RRRRR RLRR R( RLR2tupdatedR.RkRRtmdR0((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytupdate_version;s(   0 !     u%s-%su %s.dist-infouRECORDuruutf-8u..uinvalid entry in wheel: %rNRu.whlRu wheel-update-tdiruNot a directory: %r(R!R2RRJRMRKRLRaRRRRRRRRR R0RtmkstemptcloseRRRRRRtcopyfile(R&tmodifiertdest_dirRR.R3R)ReRfRRRhR-RRRR2toriginal_versionRtmodifiedtcurrent_versiontfdtnewpathRRRW((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyR( sX           (iiN(R?R@t__doc__RRR0RR'tpropertyRMRYRZRRqR^RWRRRRRRRRR$R%R&R+R,RUR((((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyRAs2)    h "    6cCstg}td}xGttjddddD](}|jdj|t|gq1Wg}xLtjD]>\}}}|j drp|j|j dddqpqpW|j t dkr|j dt n|jdg}tg}tjd kr=tjd t}|r=|j\} }}} t|}| g} | dkrg| jd n| dkr| jdn| dkr| jdn| dkr| jdn| dkr| jdnx`|dkr6x@| D]8} d| ||| f} | tkr|j| qqW|d8}qWq=nxH|D]@}x7|D]/} |jdjt|df|| fqQWqDWxwt|D]i\}}|jdjt|fddf|dkr|jdjt|dfddfqqWxwt|D]i\}}|jdjd|fddf|dkr|jdjd|dfddfqqWt|S(uG Return (pyver, abi, arch) tuples compatible with this Python. iiiuu.abiu.iunoneudarwinu(\w+)_(\d+)_(\d+)_(\w+)$ui386uppcufatux86_64ufat3uppc64ufat64uintelu universalu %s_%s_%s_%suanyupy(ui386uppc(ui386uppcux86_64(uppc64ux86_64(ui386ux86_64(ui386ux86_64uinteluppcuppc64(RtrangeR5t version_infoRRRR8t get_suffixesRRRRRR'RtplatformtreRPR|R`t IMP_PREFIXRtset(tversionstmajortminortabisRRR3tarchesRVRKRHtmatchesRPRRGRkRL((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytcompatible_tagss`  $&$               1% 0% 0cCst|tst|}nt}|dkr9t}nxN|D]F\}}}||jkr@||jkr@||jkr@t}Pq@q@W|S(N( RRARR0tCOMPATIBLE_TAGSRFRGRHR(twheelRZR3tverRGRH((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyR%s  -(Tt __future__RRR\Rtdistutils.utilt distutilstemailRRR8RtloggingR!RaRERR5RRRRRtcompatRRRRRtdatabaseR RqR R tutilR R RRRRRRRRLRRt getLoggerR?RR0RthasattrRFRDRRRRBRERt get_platformR RRRtcompilet IGNORECASEtVERBOSERSRORvR{RzRyR"RtobjectR#R(RARNROR%(((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyts               (@     '   #  > site-packages/pip/_vendor/distlib/wheel.pyo000064400000074543147204247350015024 0ustar00 abc@sddlmZddlZddlZddlZddlZddlmZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlmZmZddlmZmZmZmZmZddlmZddlm Z m!Z!dd l"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+dd l,m-Z-m.Z.e j/e0Z1e2a3e4ed rd Z5n9ej6j7d rdZ5nej6dkrdZ5ndZ5ej8dZ9e9 rdej:d Z9nde9Z;e5e9Z<ej"j=j>ddj>ddZ?ej8dZ@e@oze@j7dre@j>ddZ@ndZAeAZ@[AejBdejCejDBZEejBdejCejDBZFejBdZGejBdZHd ZId!ZJe jKd"kr$d#ZLn d$ZLd%eMfd&YZNeNZOd'eMfd(YZPd)ZQeQZR[Qe2d*ZSdS(+i(tunicode_literalsN(tmessage_from_filei(t __version__tDistlibException(t sysconfigtZipFiletfsdecodet text_typetfilter(tInstalledDistribution(tMetadatatMETADATA_FILENAME( t FileOperatort convert_patht CSVReadert CSVWritertCachetcached_propertytget_cache_baset read_exportsttempdir(tNormalizedVersiontUnsupportedVersionErrorupypy_version_infouppujavaujyucliuipucpupy_version_nodotu%s%siupyu-u_u.uSOABIucpython-cCs|dtg}tjdr+|jdntjdrJ|jdntjddkro|jdnd j|S( NucpuPy_DEBUGudu WITH_PYMALLOCumuPy_UNICODE_SIZEiuuu(t VER_SUFFIXRtget_config_vartappendtjoin(tparts((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt _derive_abi;s uz (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))? -(?P\w+\d+(\.\w+\d+)*) -(?P\w+) -(?P\w+(\.\w+)*) \.whl$ u7 (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))?$ s \s*#![^\r\n]*s^(\s*#!("[^"]+"|\S+))\s+(.*)$s#!pythons #!pythonwu/cCs|S(N((to((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt]tcCs|jtjdS(Nu/(treplacetostsep(R((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyR_RtMountercBs8eZdZdZdZddZdZRS(cCsi|_i|_dS(N(t impure_wheelstlibs(tself((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt__init__cs cCs!||j|<|jj|dS(N(R$R%tupdate(R&tpathnamet extensions((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytaddgs cCsI|jj|}x0|D](\}}||jkr|j|=qqWdS(N(R$tpopR%(R&R)R*tktv((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytremovekscCs"||jkr|}nd}|S(N(R%tNone(R&tfullnametpathtresult((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt find_moduleqs cCs|tjkrtj|}nx||jkrAtd|ntj||j|}||_|jdd}t|dkr|d|_ n|S(Nuunable to find extension for %su.ii( tsystmodulesR%t ImportErrortimpt load_dynamict __loader__trsplittlent __package__(R&R1R3R((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt load_modulexs N(t__name__t __module__R'R+R/R0R4R>(((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyR#bs     tWheelcBseZdZdZdZdeedZedZ edZ edZ e dZ dZe d Zd Zdd Zd Zd ZdZdddZdZdZdZdZdZedZdZdZddZRS(u@ Class to build and install from Wheel files (PEP 427). iusha256cCs||_||_d|_tg|_dg|_dg|_tj|_ |dkr{d|_ d|_ |j |_nEtj|}|r|jd}|d|_ |djdd |_ |d |_|j |_ntjj|\}}tj|}|s!td |n|r?tjj||_ n||_|jd}|d|_ |d|_ |d |_|d jd |_|djd |_|djd |_dS(uB Initialise an instance using a (valid) filename. uunoneuanyudummyu0.1unmuvnu_u-ubnuInvalid name or filename: %rupyu.ubiuarN(tsignt should_verifytbuildvertPYVERtpyvertabitarchR!tgetcwdtdirnameR0tnametversiontfilenamet _filenametNAME_VERSION_REtmatcht groupdictR R2tsplitt FILENAME_RERtabspath(R&RMRBtverifytmtinfoRJ((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyR'sB                cCs|jrd|j}nd}dj|j}dj|j}dj|j}|jjdd}d|j|||||fS(uJ Build and return a filename from the various components. u-uu.u_u%s-%s%s-%s-%s-%s.whl(RDRRFRGRHRLR RK(R&RDRFRGRHRL((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyRMs cCs+tjj|j|j}tjj|S(N(R!R2RRJRMtisfile(R&R2((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytexistssccsNxG|jD]<}x3|jD](}x|jD]}|||fVq*WqWq WdS(N(RFRGRH(R&RFRGRH((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyttagssc Cs8tjj|j|j}d|j|jf}d|}tjd}t |d}|j |}|dj dd}t g|D]}t |^q} | d krd} nt} yItj|| } |j| "} || } td | }WdQXWn!tk r-td | nXWdQX|S( Nu%s-%su %s.dist-infouutf-8uru Wheel-Versionu.iuMETADATAtfileobju$Invalid wheel, because %s is missing(ii(R!R2RRJRMRKRLtcodecst getreaderRtget_wheel_metadataRRttupletintR t posixpathtopenR tKeyErrort ValueError(R&R)tname_vertinfo_dirtwrappertzftwheel_metadatatwvtit file_versiontfntmetadata_filenametbftwfR3((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytmetadatas( %    cCsud|j|jf}d|}tj|d}|j|(}tjd|}t|}WdQXt|S(Nu%s-%su %s.dist-infouWHEELuutf-8( RKRLRaRRbR\R]Rtdict(R&RhReRfRnRoRptmessage((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyR^s cCsFtjj|j|j}t|d}|j|}WdQX|S(Nur(R!R2RRJRMRR^(R&R)RhR3((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyRWsc Cstj|}|r|j}|| ||}}d|jkrQt}nt}tj|}|rd|jd}nd}||}||}ns|jd}|jd} |dks|| krd} n&|||d!d krd } nd} t| |}|S( Ntpythonwt iRs s iis ( t SHEBANG_RERPtendtlowertSHEBANG_PYTHONWtSHEBANG_PYTHONtSHEBANG_DETAIL_REtgroupstfind( R&tdataRVRwtshebangtdata_after_shebangtshebang_pythontargstcrtlftterm((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytprocess_shebangs,      cCs|dkr|j}nytt|}Wn!tk rNtd|nX||j}tj|j dj d}||fS(NuUnsupported hash algorithm: %rt=uascii( R0t hash_kindtgetattrthashlibtAttributeErrorRtdigesttbase64turlsafe_b64encodetrstriptdecode(R&R~RthasherR3((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytget_hashs   !cCs~t|}ttjj||}|j|ddf|jt|%}x|D]}|j|q]WWdQXdS(Nu( tlisttto_posixR!R2trelpathRtsortRtwriterow(R&trecordst record_pathtbasetptwritertrow((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt write_record's   cCsg}|\}}tt|j}xs|D]k\}} t| d} | j} WdQXd|j| } tjj| } |j || | fq+Wtjj |d} |j || |t tjj |d}|j || fdS(Nurbu%s=%suRECORD( RRRRbtreadRR!R2tgetsizeRRRR(R&RWtlibdirt archive_pathsRtdistinfoRfRtapRtfR~Rtsize((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt write_records0s c Cs\t|dtjA}x7|D]/\}}tjd|||j||qWWdQXdS(NuwuWrote %s to %s in wheel(Rtzipfilet ZIP_DEFLATEDtloggertdebugtwrite(R&R)RRhRR((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt build_zip@sc! s|dkri}nttfdd#d}|dkrgd}tg}tg}tg}n!d}tg}dg}dg}|jd ||_|jd ||_ |jd ||_ |} d |j |j f} d | } d| } g} xKd$D]C}|kr qn|}t jj|rx t j|D]\}}}x|D]}tt jj||}t jj||}tt jj| ||}| j||f|dkrb|jd rbt|d}|j}WdQX|j|}t|d}|j|WdQXqbqbWqLWqqW| }d}xt j|D]\}}}||krxXt|D]G\}}t|}|jdrt jj||}||=PqqWnxl|D]d}t|jd%r qnt jj||}tt jj||}| j||fqWqkWt j|}xf|D]^}|d&krjtt jj||}tt jj| |}| j||fqjqjWd|p|jdtd|g}x4|jD])\}}}|jd |||fqWt jj|d}t|d!}|jd"j|WdQXtt jj| d}| j||f|j || f| | t jj|j!|j"} |j#| | | S('u Build a wheel from files in specified paths, and use any specified tags when determining the name of the wheel. cs |kS(N((R(tpaths(s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyRNRupurelibuplatlibiufalseutrueunoneuanyupyveruabiuarchu%s-%su%s.datau %s.dist-infoudatauheadersuscriptsu.exeurbNuwbu .dist-infou.pycu.pyouRECORDu INSTALLERuSHAREDuWHEELuWheel-Version: %d.%duGenerator: distlib %suRoot-Is-Purelib: %su Tag: %s-%s-%suwu (upurelibuplatlib(udatauheadersuscripts(u.pycu.pyo(uRECORDu INSTALLERuSHAREDuWHEEL($R0RRtIMPVERtABItARCHREtgetRFRGRHRKRLR!R2tisdirtwalkRRRRRtendswithRbRRRt enumeratetlistdirt wheel_versionRRZRRJRMR(!R&RRZRtlibkeytis_puret default_pyvert default_abit default_archRRetdata_dirRfRtkeyR2troottdirstfilesRmRtrpRRR~RRktdnRiRFRGRHR)((Rs=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytbuildFs  "              %      cCKs |j}|jd}|jdt}tjj|j|j}d|j|j f}d|} d|} t j| t } t j| d} t j| d} t j d}t|d }|j| }||}t|}Wd QX|d jd d }tg|D]}t|^q}||jkrY|rY||j|n|ddkrv|d}n |d}i}|j| D}td|,}x"|D]}|d}||||jd.}6|6r|6jd/}6nWd QXWnt1k rt+j2d0nX|6r|6jd1i}>|6jd2i}?|>s|?r|jdd}@tjj?|@st@d3n|@|_xF|>jAD]8\}:}<d4|:|<f}A|j4|A}4|j5|4q(W|?ritd(6}BxL|?jAD];\}:}<d4|:|<f}A|j4|A|B}4|j5|4qWqqntjj|| }tB|}5tC|}|d=|d=||d5<|5jD||}|r9 |!j/|n|5jE|!|d6||5SWn+t1k r t+jFd7|jGnXWd tHjI|"XWd QXd S(9u Install a wheel to the specified paths. If kwarg ``warner`` is specified, it should be a callable, which will be called with two tuples indicating the wheel version of this software and the wheel version in the file, if there is a discrepancy in the versions. This can be used to issue any warnings to raise any exceptions. If kwarg ``lib_only`` is True, only the purelib/platlib files are installed, and the headers, scripts, data and dist-info metadata are not written. The return value is a :class:`InstalledDistribution` instance unless ``options.lib_only`` is True, in which case the return value is ``None``. uwarnerulib_onlyu%s-%su%s.datau %s.dist-infouWHEELuRECORDuutf-8urNu Wheel-Versionu.iuRoot-Is-Purelibutrueupurelibuplatlibtstreamiuuscriptstdry_runu /RECORD.jwsiusize mismatch for %su=udigest mismatch for %sulib_only: skipping %su.exeu/urbudigest mismatch on write for %su.pyuByte-compilation failedtexc_infoulib_only: returning Noneu1.0uentry_points.txtuconsoleuguiu %s_scriptsuwrap_%su%s:%su %suAUnable to read legacy script metadata, so cannot generate scriptsu extensionsupython.commandsu8Unable to read JSON metadata, so cannot generate scriptsu wrap_consoleuwrap_guiuValid script path not specifiedu%s = %sulibuprefixuinstallation failed.(uconsoleugui(JRRtFalseR!R2RRJRMRKRLRaR R\R]RRbRRRR_R`RRR tTruetrecordR5tdont_write_bytecodettempfiletmkdtempt source_dirR0t target_dirtinfolistt isinstanceRRRtstrt file_sizeRRRt startswithRRR t copy_streamRt byte_compilet Exceptiontwarningtbasenametmaketset_executable_modetextendRWRtvaluestprefixtsuffixtflagstjsontloadRRdtitemsR Rrtwrite_shared_locationstwrite_installed_filest exceptiontrollbacktshutiltrmtree(CR&RtmakertkwargsRtwarnertlib_onlyR)ReRRft metadata_nametwheel_metadata_namet record_nameRgRhtbwfRpRsRjRkRlRRRotreaderRRtdata_pfxtinfo_pfxt script_pfxtfileoptbctoutfilestworkdirtzinfotarcnamet u_arcnametkindtvalueR~t_Rt is_scripttwhereRtoutfilet newdigesttpycRmtworknameRt filenamestdisttcommandsteptepdataRR-tdR.tstconsole_scriptst gui_scriptst script_dirtscripttoptions((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytinstallsD    %            #   "                            cCsGtdkrCtjjttdtjd }t |antS(Nu dylib-cachei( tcacheR0R!R2RRRR5RLR(R&R((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt_get_dylib_caches  c Cstjj|j|j}d|j|jf}d|}tj|d}tj d}g}t |dw}y\|j |G}||} t j | } |j} | j|} tjj| j| } tjj| stj| nx| jD]\}}tjj| t|}tjj|sHt}nQtj|j}tjj|}|j|}tj|j}||k}|r|j|| n|j||fqWWdQXWntk rnXWdQX|S(Nu%s-%su %s.dist-infou EXTENSIONSuutf-8ur( R!R2RRJRMRKRLRaR\R]RRbRRRt prefix_to_dirRRtmakedirsRR RYRtstattst_mtimetdatetimet fromtimestamptgetinfot date_timetextractRRc(R&R)ReRfRRgR3RhRoRpR*RRt cache_baseRKRtdestRt file_timeRWt wheel_time((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt_get_extensionss>     !  cCs t|S(uM Determine if a wheel is compatible with the running system. (t is_compatible(R&((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyR$scCstS(uP Determine if a wheel is asserted as mountable by its metadata. (R(R&((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyt is_mountablescCs tjjtjj|j|j}|jsLd|}t|n|jsqd|}t|n|t jkrt j d|ns|rt jj |nt jj d||j}|rtt jkrt jj tntj||ndS(Nu)Wheel %s not compatible with this Python.u$Wheel %s is marked as not mountable.u%s already in pathi(R!R2RTRRJRMR$RR%R5RRRtinsertR#t_hookt meta_pathR+(R&RR)tmsgR*((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytmounts"'     cCstjjtjj|j|j}|tjkrItjd|n]tjj ||t j krxt j |nt j st tj krtj j t qndS(Nu%s not in path( R!R2RTRRJRMR5RRR/R'R$R((R&R)((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytunmounts' cCstjj|j|j}d|j|jf}d|}d|}tj|t}tj|d}tj|d}t j d}t |d } | j |} || } t | } WdQX| djd d } tg| D]}t|^q}i}| j |D}td |,}x"|D]}|d }|||Fsu0Cannot update non-compliant (PEP-440) version %rR2tlegacyuVersion updated from %r to %r(R0RR}RRR`RRRRR RLRR R( RLR2tupdatedR.RkR RtmdR/((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytupdate_version;s(   0 !     u%s-%su %s.dist-infouRECORDuruutf-8u..uinvalid entry in wheel: %rNRu.whlRu wheel-update-tdiruNot a directory: %r(R!R2RRJRMRKRLRaRRRRRRRRR R0RtmkstemptcloseRRRRRRtcopyfile(R&tmodifiertdest_dirRR-R2R)ReRfRRRhR,RRRR2toriginal_versionRtmodifiedtcurrent_versiontfdtnewpathRRRW((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyR( sX           (iiN(R?R@t__doc__RRR0RR'tpropertyRMRYRZRRqR^RWRRRRRRRRR#R$R%R*R+RUR((((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyRAs2)    h "    6cCstg}td}xGttjddddD](}|jdj|t|gq1Wg}xLtjD]>\}}}|j drp|j|j dddqpqpW|j t dkr|j dt n|jdg}tg}tjd kr=tjd t}|r=|j\} }}} t|}| g} | dkrg| jd n| dkr| jdn| dkr| jdn| dkr| jdn| dkr| jdnx`|dkr6x@| D]8} d| ||| f} | tkr|j| qqW|d8}qWq=nxH|D]@}x7|D]/} |jdjt|df|| fqQWqDWxwt|D]i\}}|jdjt|fddf|dkr|jdjt|dfddfqqWxwt|D]i\}}|jdjd|fddf|dkr|jdjd|dfddfqqWt|S(uG Return (pyver, abi, arch) tuples compatible with this Python. iiiuu.abiu.iunoneudarwinu(\w+)_(\d+)_(\d+)_(\w+)$ui386uppcufatux86_64ufat3uppc64ufat64uintelu universalu %s_%s_%s_%suanyupy(ui386uppc(ui386uppcux86_64(uppc64ux86_64(ui386ux86_64(ui386ux86_64uinteluppcuppc64(RtrangeR5t version_infoRRRR8t get_suffixesRRRRRR&RtplatformtreRPR|R`t IMP_PREFIXRtset(tversionstmajortminortabisRRR3tarchesRVRKRHtmatchesRPR RGRkRL((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pytcompatible_tagss`  $&$               1% 0% 0cCst|tst|}nt}|dkr9t}nxN|D]F\}}}||jkr@||jkr@||jkr@t}Pq@q@W|S(N( RRARR0tCOMPATIBLE_TAGSRFRGRHR(twheelRZR3tverRGRH((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyR$s  -(Tt __future__RRR\Rtdistutils.utilt distutilstemailRRR8RtloggingR!RaRDRR5RRRRRtcompatRRRRRtdatabaseR RqR R tutilR R RRRRRRRRLRRt getLoggerR?RR0RthasattrRERCRRRRARERt get_platformR RRRtcompilet IGNORECASEtVERBOSERSRORvR{RzRyR"RtobjectR#R'RARMRNR$(((s=/usr/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.pyts               (@     '   #  > site-packages/pip/_vendor/html5lib/_trie/__init__.py000064400000000441147204247350016452 0ustar00from __future__ import absolute_import, division, unicode_literals from .py import Trie as PyTrie Trie = PyTrie # pylint:disable=wrong-import-position try: from .datrie import Trie as DATrie except ImportError: pass else: Trie = DATrie # pylint:enable=wrong-import-position site-packages/pip/_vendor/html5lib/_trie/__init__.pyc000064400000000672147204247350016623 0ustar00 abc@`sdddlmZmZmZddlmZeZyddlmZWne k rYnXeZdS(i(tabsolute_importtdivisiontunicode_literalsi(tTrieN( t __future__RRRtpyRtPyTrietdatrietDATriet ImportError(((sG/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/__init__.pyts site-packages/pip/_vendor/html5lib/_trie/__init__.pyo000064400000000672147204247350016637 0ustar00 abc@`sdddlmZmZmZddlmZeZyddlmZWne k rYnXeZdS(i(tabsolute_importtdivisiontunicode_literalsi(tTrieN( t __future__RRRtpyRtPyTrietdatrietDATriet ImportError(((sG/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/__init__.pyts site-packages/pip/_vendor/html5lib/_trie/_base.py000064400000001723147204247350015770 0ustar00from __future__ import absolute_import, division, unicode_literals from collections import Mapping class Trie(Mapping): """Abstract base class for tries""" def keys(self, prefix=None): # pylint:disable=arguments-differ keys = super(Trie, self).keys() if prefix is None: return set(keys) # Python 2.6: no set comprehensions return set([x for x in keys if x.startswith(prefix)]) def has_keys_with_prefix(self, prefix): for key in self.keys(): if key.startswith(prefix): return True return False def longest_prefix(self, prefix): if prefix in self: return prefix for i in range(1, len(prefix) + 1): if prefix[:-i] in self: return prefix[:-i] raise KeyError(prefix) def longest_prefix_item(self, prefix): lprefix = self.longest_prefix(prefix) return (lprefix, self[lprefix]) site-packages/pip/_vendor/html5lib/_trie/_base.pyc000064400000003342147204247350016132 0ustar00 abc@`sFddlmZmZmZddlmZdefdYZdS(i(tabsolute_importtdivisiontunicode_literals(tMappingtTriecB`s5eZdZddZdZdZdZRS(uAbstract base class for triescC`sWtt|j}|dkr+t|Stg|D]}|j|r5|^q5S(N(tsuperRtkeystNonetsett startswith(tselftprefixRtx((sD/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/_base.pyR s  cC`s.x'|jD]}|j|r tSq WtS(N(RR tTruetFalse(R R tkey((sD/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/_base.pythas_keys_with_prefixscC`s^||kr|Sx;tdt|dD] }|| |kr*|| Sq*Wt|dS(Ni(trangetlentKeyError(R R ti((sD/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/_base.pytlongest_prefixs    cC`s|j|}|||fS(N(R(R R tlprefix((sD/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/_base.pytlongest_prefix_item$sN(t__name__t __module__t__doc__RRRRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/_base.pyRs   N(t __future__RRRt collectionsRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/_base.pytssite-packages/pip/_vendor/html5lib/_trie/_base.pyo000064400000003342147204247350016146 0ustar00 abc@`sFddlmZmZmZddlmZdefdYZdS(i(tabsolute_importtdivisiontunicode_literals(tMappingtTriecB`s5eZdZddZdZdZdZRS(uAbstract base class for triescC`sWtt|j}|dkr+t|Stg|D]}|j|r5|^q5S(N(tsuperRtkeystNonetsett startswith(tselftprefixRtx((sD/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/_base.pyR s  cC`s.x'|jD]}|j|r tSq WtS(N(RR tTruetFalse(R R tkey((sD/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/_base.pythas_keys_with_prefixscC`s^||kr|Sx;tdt|dD] }|| |kr*|| Sq*Wt|dS(Ni(trangetlentKeyError(R R ti((sD/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/_base.pytlongest_prefixs    cC`s|j|}|||fS(N(R(R R tlprefix((sD/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/_base.pytlongest_prefix_item$sN(t__name__t __module__t__doc__RRRRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/_base.pyRs   N(t __future__RRRt collectionsRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/_base.pytssite-packages/pip/_vendor/html5lib/_trie/datrie.py000064400000002232147204247350016163 0ustar00from __future__ import absolute_import, division, unicode_literals from datrie import Trie as DATrie from pip._vendor.six import text_type from ._base import Trie as ABCTrie class Trie(ABCTrie): def __init__(self, data): chars = set() for key in data.keys(): if not isinstance(key, text_type): raise TypeError("All keys must be strings") for char in key: chars.add(char) self._data = DATrie("".join(chars)) for key, value in data.items(): self._data[key] = value def __contains__(self, key): return key in self._data def __len__(self): return len(self._data) def __iter__(self): raise NotImplementedError() def __getitem__(self, key): return self._data[key] def keys(self, prefix=None): return self._data.keys(prefix) def has_keys_with_prefix(self, prefix): return self._data.has_keys_with_prefix(prefix) def longest_prefix(self, prefix): return self._data.longest_prefix(prefix) def longest_prefix_item(self, prefix): return self._data.longest_prefix_item(prefix) site-packages/pip/_vendor/html5lib/_trie/datrie.pyc000064400000005333147204247350016333 0ustar00 abc@`sfddlmZmZmZddlmZddlmZddl mZ de fdYZdS(i(tabsolute_importtdivisiontunicode_literals(tTrie(t text_typeiRcB`s\eZdZdZdZdZdZd dZdZ dZ dZ RS( cC`st}xP|jD]B}t|ts:tdnx|D]}|j|qAWqWtdj||_x'|j D]\}}||j|ssite-packages/pip/_vendor/html5lib/_trie/datrie.pyo000064400000005333147204247350016347 0ustar00 abc@`sfddlmZmZmZddlmZddlmZddl mZ de fdYZdS(i(tabsolute_importtdivisiontunicode_literals(tTrie(t text_typeiRcB`s\eZdZdZdZdZdZd dZdZ dZ dZ RS( cC`st}xP|jD]B}t|ts:tdnx|D]}|j|qAWqWtdj||_x'|j D]\}}||j|ssite-packages/pip/_vendor/html5lib/_trie/py.py000064400000003357147204247350015354 0ustar00from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type from bisect import bisect_left from ._base import Trie as ABCTrie class Trie(ABCTrie): def __init__(self, data): if not all(isinstance(x, text_type) for x in data.keys()): raise TypeError("All keys must be strings") self._data = data self._keys = sorted(data.keys()) self._cachestr = "" self._cachepoints = (0, len(data)) def __contains__(self, key): return key in self._data def __len__(self): return len(self._data) def __iter__(self): return iter(self._data) def __getitem__(self, key): return self._data[key] def keys(self, prefix=None): if prefix is None or prefix == "" or not self._keys: return set(self._keys) if prefix.startswith(self._cachestr): lo, hi = self._cachepoints start = i = bisect_left(self._keys, prefix, lo, hi) else: start = i = bisect_left(self._keys, prefix) keys = set() if start == len(self._keys): return keys while self._keys[i].startswith(prefix): keys.add(self._keys[i]) i += 1 self._cachestr = prefix self._cachepoints = (start, i) return keys def has_keys_with_prefix(self, prefix): if prefix in self._data: return True if prefix.startswith(self._cachestr): lo, hi = self._cachepoints i = bisect_left(self._keys, prefix, lo, hi) else: i = bisect_left(self._keys, prefix) if i == len(self._keys): return False return self._keys[i].startswith(prefix) site-packages/pip/_vendor/html5lib/_trie/py.pyc000064400000005713147204247350015515 0ustar00 abc@`sfddlmZmZmZddlmZddlmZddlm Z de fdYZ dS( i(tabsolute_importtdivisiontunicode_literals(t text_type(t bisect_lefti(tTrieRcB`sJeZdZdZdZdZdZddZdZ RS(cC`sktd|jDs+tdn||_t|j|_d|_dt|f|_dS(Ncs`s|]}t|tVqdS(N(t isinstanceR(t.0tx((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pys suAll keys must be stringsui( talltkeyst TypeErrort_datatsortedt_keyst _cachestrtlent _cachepoints(tselftdata((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pyt__init__ s   cC`s ||jkS(N(R (Rtkey((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pyt __contains__scC`s t|jS(N(RR (R((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pyt__len__scC`s t|jS(N(titerR (R((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pyt__iter__scC`s |j|S(N(R (RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pyt __getitem__scC`s|dks"|dks"|j r/t|jS|j|jro|j\}}t|j|||}}nt|j|}}t}|t|jkr|Sx8|j|j|r|j|j||d7}qW||_||f|_|S(Nui( tNoneRtsett startswithRRRRtadd(RtprefixtlothitstarttiR ((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pyR s"   cC`s||jkrtS|j|jrO|j\}}t|j|||}nt|j|}|t|jkrztS|j|j|S(N( R tTrueRRRRRRtFalse(RRR R!R#((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pythas_keys_with_prefix6sN( t__name__t __module__RRRRRRR R&(((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pyR s     N( t __future__RRRtpip._vendor.sixRtbisectRt_baseRtABCTrie(((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pytssite-packages/pip/_vendor/html5lib/_trie/py.pyo000064400000005713147204247350015531 0ustar00 abc@`sfddlmZmZmZddlmZddlmZddlm Z de fdYZ dS( i(tabsolute_importtdivisiontunicode_literals(t text_type(t bisect_lefti(tTrieRcB`sJeZdZdZdZdZdZddZdZ RS(cC`sktd|jDs+tdn||_t|j|_d|_dt|f|_dS(Ncs`s|]}t|tVqdS(N(t isinstanceR(t.0tx((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pys suAll keys must be stringsui( talltkeyst TypeErrort_datatsortedt_keyst _cachestrtlent _cachepoints(tselftdata((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pyt__init__ s   cC`s ||jkS(N(R (Rtkey((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pyt __contains__scC`s t|jS(N(RR (R((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pyt__len__scC`s t|jS(N(titerR (R((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pyt__iter__scC`s |j|S(N(R (RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pyt __getitem__scC`s|dks"|dks"|j r/t|jS|j|jro|j\}}t|j|||}}nt|j|}}t}|t|jkr|Sx8|j|j|r|j|j||d7}qW||_||f|_|S(Nui( tNoneRtsett startswithRRRRtadd(RtprefixtlothitstarttiR ((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pyR s"   cC`s||jkrtS|j|jrO|j\}}t|j|||}nt|j|}|t|jkrztS|j|j|S(N( R tTrueRRRRRRtFalse(RRR R!R#((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pythas_keys_with_prefix6sN( t__name__t __module__RRRRRRR R&(((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pyR s     N( t __future__RRRtpip._vendor.sixRtbisectRt_baseRtABCTrie(((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_trie/py.pytssite-packages/pip/_vendor/html5lib/filters/__init__.py000064400000000000147204247350017007 0ustar00site-packages/pip/_vendor/html5lib/filters/__init__.pyc000064400000000240147204247350017160 0ustar00 abc@sdS(N((((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/__init__.pyttsite-packages/pip/_vendor/html5lib/filters/__init__.pyo000064400000000240147204247350017174 0ustar00 abc@sdS(N((((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/__init__.pyttsite-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.py000064400000001155147204247350022004 0ustar00from __future__ import absolute_import, division, unicode_literals from . import base try: from collections import OrderedDict except ImportError: from ordereddict import OrderedDict class Filter(base.Filter): def __iter__(self): for token in base.Filter.__iter__(self): if token["type"] in ("StartTag", "EmptyTag"): attrs = OrderedDict() for name, value in sorted(token["data"].items(), key=lambda x: x[0]): attrs[name] = value token["data"] = attrs yield token site-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.pyc000064400000002562147204247350022152 0ustar00 abc@`sddlmZmZmZddlmZyddlmZWn!ek rcddl mZnXdej fdYZ dS(i(tabsolute_importtdivisiontunicode_literalsi(tbase(t OrderedDicttFiltercB`seZdZRS(cc`sxtjj|D]k}|ddkryt}x7t|djddD]\}}|||t(uStartTaguEmptyTag(RRt__iter__Rtsortedtitems(tselfttokentattrstnametvalue((sW/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.pyR s  (t__name__t __module__R (((sW/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.pyR sN( t __future__RRRR Rt collectionsRt ImportErrort ordereddictR(((sW/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.pyts  site-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.pyo000064400000002562147204247350022166 0ustar00 abc@`sddlmZmZmZddlmZyddlmZWn!ek rcddl mZnXdej fdYZ dS(i(tabsolute_importtdivisiontunicode_literalsi(tbase(t OrderedDicttFiltercB`seZdZRS(cc`sxtjj|D]k}|ddkryt}x7t|djddD]\}}|||t(uStartTaguEmptyTag(RRt__iter__Rtsortedtitems(tselfttokentattrstnametvalue((sW/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.pyR s  (t__name__t __module__R (((sW/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.pyR sN( t __future__RRRR Rt collectionsRt ImportErrort ordereddictR(((sW/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.pyts  site-packages/pip/_vendor/html5lib/filters/base.py000064400000000436147204247350016177 0ustar00from __future__ import absolute_import, division, unicode_literals class Filter(object): def __init__(self, source): self.source = source def __iter__(self): return iter(self.source) def __getattr__(self, name): return getattr(self.source, name) site-packages/pip/_vendor/html5lib/filters/base.pyc000064400000002122147204247350016334 0ustar00 abc@`s6ddlmZmZmZdefdYZdS(i(tabsolute_importtdivisiontunicode_literalstFiltercB`s#eZdZdZdZRS(cC`s ||_dS(N(tsource(tselfR((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/base.pyt__init__scC`s t|jS(N(titerR(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/base.pyt__iter__scC`st|j|S(N(tgetattrR(Rtname((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/base.pyt __getattr__ s(t__name__t __module__RRR (((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/base.pyRs  N(t __future__RRRtobjectR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/base.pytssite-packages/pip/_vendor/html5lib/filters/base.pyo000064400000002122147204247350016350 0ustar00 abc@`s6ddlmZmZmZdefdYZdS(i(tabsolute_importtdivisiontunicode_literalstFiltercB`s#eZdZdZdZRS(cC`s ||_dS(N(tsource(tselfR((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/base.pyt__init__scC`s t|jS(N(titerR(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/base.pyt__iter__scC`st|j|S(N(tgetattrR(Rtname((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/base.pyt __getattr__ s(t__name__t __module__RRR (((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/base.pyRs  N(t __future__RRRtobjectR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/base.pytssite-packages/pip/_vendor/html5lib/filters/inject_meta_charset.py000064400000005266147204247350021266 0ustar00from __future__ import absolute_import, division, unicode_literals from . import base class Filter(base.Filter): def __init__(self, source, encoding): base.Filter.__init__(self, source) self.encoding = encoding def __iter__(self): state = "pre_head" meta_found = (self.encoding is None) pending = [] for token in base.Filter.__iter__(self): type = token["type"] if type == "StartTag": if token["name"].lower() == "head": state = "in_head" elif type == "EmptyTag": if token["name"].lower() == "meta": # replace charset with actual encoding has_http_equiv_content_type = False for (namespace, name), value in token["data"].items(): if namespace is not None: continue elif name.lower() == 'charset': token["data"][(namespace, name)] = self.encoding meta_found = True break elif name == 'http-equiv' and value.lower() == 'content-type': has_http_equiv_content_type = True else: if has_http_equiv_content_type and (None, "content") in token["data"]: token["data"][(None, "content")] = 'text/html; charset=%s' % self.encoding meta_found = True elif token["name"].lower() == "head" and not meta_found: # insert meta into empty head yield {"type": "StartTag", "name": "head", "data": token["data"]} yield {"type": "EmptyTag", "name": "meta", "data": {(None, "charset"): self.encoding}} yield {"type": "EndTag", "name": "head"} meta_found = True continue elif type == "EndTag": if token["name"].lower() == "head" and pending: # insert meta into head (if necessary) and flush pending queue yield pending.pop(0) if not meta_found: yield {"type": "EmptyTag", "name": "meta", "data": {(None, "charset"): self.encoding}} while pending: yield pending.pop(0) meta_found = True state = "post_head" if state == "in_head": pending.append(token) else: yield token site-packages/pip/_vendor/html5lib/filters/inject_meta_charset.pyc000064400000004315147204247350021423 0ustar00 abc@`sIddlmZmZmZddlmZdejfdYZdS(i(tabsolute_importtdivisiontunicode_literalsi(tbasetFiltercB`seZdZdZRS(cC`s tjj||||_dS(N(RRt__init__tencoding(tselftsourceR((sT/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/inject_meta_charset.pyRsc c`sd}|jdk}g}xvtjj|D]b}|d}|dkrl|djdkrod}qon|dkr|djdkr^t}xE|d jD]~\\}}} |dk rqq|jd kr|j|d ||fssite-packages/pip/_vendor/html5lib/filters/inject_meta_charset.pyo000064400000004315147204247350021437 0ustar00 abc@`sIddlmZmZmZddlmZdejfdYZdS(i(tabsolute_importtdivisiontunicode_literalsi(tbasetFiltercB`seZdZdZRS(cC`s tjj||||_dS(N(RRt__init__tencoding(tselftsourceR((sT/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/inject_meta_charset.pyRsc c`sd}|jdk}g}xvtjj|D]b}|d}|dkrl|djdkrod}qon|dkr|djdkr^t}xE|d jD]~\\}}} |dk rqq|jd kr|j|d ||fssite-packages/pip/_vendor/html5lib/filters/lint.py000064400000006445147204247350016241 0ustar00from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type from . import base from ..constants import namespaces, voidElements from ..constants import spaceCharacters spaceCharacters = "".join(spaceCharacters) class Filter(base.Filter): def __init__(self, source, require_matching_tags=True): super(Filter, self).__init__(source) self.require_matching_tags = require_matching_tags def __iter__(self): open_elements = [] for token in base.Filter.__iter__(self): type = token["type"] if type in ("StartTag", "EmptyTag"): namespace = token["namespace"] name = token["name"] assert namespace is None or isinstance(namespace, text_type) assert namespace != "" assert isinstance(name, text_type) assert name != "" assert isinstance(token["data"], dict) if (not namespace or namespace == namespaces["html"]) and name in voidElements: assert type == "EmptyTag" else: assert type == "StartTag" if type == "StartTag" and self.require_matching_tags: open_elements.append((namespace, name)) for (namespace, name), value in token["data"].items(): assert namespace is None or isinstance(namespace, text_type) assert namespace != "" assert isinstance(name, text_type) assert name != "" assert isinstance(value, text_type) elif type == "EndTag": namespace = token["namespace"] name = token["name"] assert namespace is None or isinstance(namespace, text_type) assert namespace != "" assert isinstance(name, text_type) assert name != "" if (not namespace or namespace == namespaces["html"]) and name in voidElements: assert False, "Void element reported as EndTag token: %(tag)s" % {"tag": name} elif self.require_matching_tags: start = open_elements.pop() assert start == (namespace, name) elif type == "Comment": data = token["data"] assert isinstance(data, text_type) elif type in ("Characters", "SpaceCharacters"): data = token["data"] assert isinstance(data, text_type) assert data != "" if type == "SpaceCharacters": assert data.strip(spaceCharacters) == "" elif type == "Doctype": name = token["name"] assert name is None or isinstance(name, text_type) assert token["publicId"] is None or isinstance(name, text_type) assert token["systemId"] is None or isinstance(name, text_type) elif type == "Entity": assert isinstance(token["name"], text_type) elif type == "SerializerError": assert isinstance(token["data"], text_type) else: assert False, "Unknown token type: %(type)s" % {"type": type} yield token site-packages/pip/_vendor/html5lib/filters/lint.pyc000064400000005726147204247350016405 0ustar00 abc@`sddlmZmZmZddlmZddlmZddlm Z m Z ddlm Z dj e Z d ej fd YZ d S( i(tabsolute_importtdivisiontunicode_literals(t text_typei(tbasei(t namespacest voidElements(tspaceCharactersutFiltercB`seZedZdZRS(cC`s#tt|j|||_dS(N(tsuperRt__init__trequire_matching_tags(tselftsourceR ((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/lint.pyR sc c`sPg}xCtjj|D]/}|d}|dkr|d}|d}|dksjt|tsjt|dks|tt|tst|dkstt|dtst| s|tdkr|t kr|dkstn|dkst|dkr1|j r1|j ||fnx|dj D]\\}}}|dksut|tsut|dkstt|tst|dkstt|tsBtqBWny|d kr|d}|d}|dks t|ts t|dkstt|ts2t|dksDt| s[|tdkr|t krt std i|d 6qC|j rC|j}|||fkstqCn|d kr|d}t|tsCtn[|dkrR|d}t|tst|dks%t|dkrC|jtdksOtqCn|dkr|d}|dkst|tst|ddkst|tst|ddksCt|tsCtnm|dkrt|dtsCtnE|dkr&t|dtsCtnt sCtdi|d6|VqWdS(NutypeuStartTaguEmptyTagu namespaceunameuudatauhtmluEndTagu.Void element reported as EndTag token: %(tag)sutaguCommentu CharactersuSpaceCharactersuDoctypeupublicIdusystemIduEntityuSerializerErroruUnknown token type: %(type)s(uStartTaguEmptyTag(u CharactersuSpaceCharacters(RRt__iter__tNonet isinstanceRtAssertionErrortdictRRR tappendtitemstFalsetpoptstripR( R t open_elementsttokenttypet namespacetnametvaluetstarttdata((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/lint.pyRsl    !##!   !#        !  !%(  (t__name__t __module__tTrueR R(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/lint.pyR s N(t __future__RRRtpip._vendor.sixRtRt constantsRRRtjoinR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/lint.pyts site-packages/pip/_vendor/html5lib/filters/lint.pyo000064400000004075147204247350016415 0ustar00 abc@`sddlmZmZmZddlmZddlmZddlm Z m Z ddlm Z dj e Z d ej fd YZ d S( i(tabsolute_importtdivisiontunicode_literals(t text_typei(tbasei(t namespacest voidElements(tspaceCharactersutFiltercB`seZedZdZRS(cC`s#tt|j|||_dS(N(tsuperRt__init__trequire_matching_tags(tselftsourceR ((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/lint.pyR sc c`sg}xtjj|D]}|d}|dkr|d}|d}| s`|tdkro|tkron|dkr|jr|j||fnx|djD]\\}}}qWn|dkr%|d}|d}| s|tdkr |tkr q|jr|j}qnx|d kr>|d}n_|dkrf|d}|d krqn7|d kr|d}n|d krn|dkrn|VqWdS(NutypeuStartTaguEmptyTagu namespaceunameuhtmludatauEndTaguCommentu CharactersuSpaceCharactersuDoctypeuEntityuSerializerError(uStartTaguEmptyTag(u CharactersuSpaceCharacters( RRt__iter__RRR tappendtitemstpop( R t open_elementsttokenttypet namespacetnametvaluetstarttdata((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/lint.pyRsF    ##   #           (t__name__t __module__tTrueR R(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/lint.pyR s N(t __future__RRRtpip._vendor.sixRtRt constantsRRRtjoinR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/lint.pyts site-packages/pip/_vendor/html5lib/filters/optionaltags.py000064400000024446147204247350020000 0ustar00from __future__ import absolute_import, division, unicode_literals from . import base class Filter(base.Filter): def slider(self): previous1 = previous2 = None for token in self.source: if previous1 is not None: yield previous2, previous1, token previous2 = previous1 previous1 = token if previous1 is not None: yield previous2, previous1, None def __iter__(self): for previous, token, next in self.slider(): type = token["type"] if type == "StartTag": if (token["data"] or not self.is_optional_start(token["name"], previous, next)): yield token elif type == "EndTag": if not self.is_optional_end(token["name"], next): yield token else: yield token def is_optional_start(self, tagname, previous, next): type = next and next["type"] or None if tagname in 'html': # An html element's start tag may be omitted if the first thing # inside the html element is not a space character or a comment. return type not in ("Comment", "SpaceCharacters") elif tagname == 'head': # A head element's start tag may be omitted if the first thing # inside the head element is an element. # XXX: we also omit the start tag if the head element is empty if type in ("StartTag", "EmptyTag"): return True elif type == "EndTag": return next["name"] == "head" elif tagname == 'body': # A body element's start tag may be omitted if the first thing # inside the body element is not a space character or a comment, # except if the first thing inside the body element is a script # or style element and the node immediately preceding the body # element is a head element whose end tag has been omitted. if type in ("Comment", "SpaceCharacters"): return False elif type == "StartTag": # XXX: we do not look at the preceding event, so we never omit # the body element's start tag if it's followed by a script or # a style element. return next["name"] not in ('script', 'style') else: return True elif tagname == 'colgroup': # A colgroup element's start tag may be omitted if the first thing # inside the colgroup element is a col element, and if the element # is not immediately preceded by another colgroup element whose # end tag has been omitted. if type in ("StartTag", "EmptyTag"): # XXX: we do not look at the preceding event, so instead we never # omit the colgroup element's end tag when it is immediately # followed by another colgroup element. See is_optional_end. return next["name"] == "col" else: return False elif tagname == 'tbody': # A tbody element's start tag may be omitted if the first thing # inside the tbody element is a tr element, and if the element is # not immediately preceded by a tbody, thead, or tfoot element # whose end tag has been omitted. if type == "StartTag": # omit the thead and tfoot elements' end tag when they are # immediately followed by a tbody element. See is_optional_end. if previous and previous['type'] == 'EndTag' and \ previous['name'] in ('tbody', 'thead', 'tfoot'): return False return next["name"] == 'tr' else: return False return False def is_optional_end(self, tagname, next): type = next and next["type"] or None if tagname in ('html', 'head', 'body'): # An html element's end tag may be omitted if the html element # is not immediately followed by a space character or a comment. return type not in ("Comment", "SpaceCharacters") elif tagname in ('li', 'optgroup', 'tr'): # A li element's end tag may be omitted if the li element is # immediately followed by another li element or if there is # no more content in the parent element. # An optgroup element's end tag may be omitted if the optgroup # element is immediately followed by another optgroup element, # or if there is no more content in the parent element. # A tr element's end tag may be omitted if the tr element is # immediately followed by another tr element, or if there is # no more content in the parent element. if type == "StartTag": return next["name"] == tagname else: return type == "EndTag" or type is None elif tagname in ('dt', 'dd'): # A dt element's end tag may be omitted if the dt element is # immediately followed by another dt element or a dd element. # A dd element's end tag may be omitted if the dd element is # immediately followed by another dd element or a dt element, # or if there is no more content in the parent element. if type == "StartTag": return next["name"] in ('dt', 'dd') elif tagname == 'dd': return type == "EndTag" or type is None else: return False elif tagname == 'p': # A p element's end tag may be omitted if the p element is # immediately followed by an address, article, aside, # blockquote, datagrid, dialog, dir, div, dl, fieldset, # footer, form, h1, h2, h3, h4, h5, h6, header, hr, menu, # nav, ol, p, pre, section, table, or ul, element, or if # there is no more content in the parent element. if type in ("StartTag", "EmptyTag"): return next["name"] in ('address', 'article', 'aside', 'blockquote', 'datagrid', 'dialog', 'dir', 'div', 'dl', 'fieldset', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'menu', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul') else: return type == "EndTag" or type is None elif tagname == 'option': # An option element's end tag may be omitted if the option # element is immediately followed by another option element, # or if it is immediately followed by an optgroup # element, or if there is no more content in the parent # element. if type == "StartTag": return next["name"] in ('option', 'optgroup') else: return type == "EndTag" or type is None elif tagname in ('rt', 'rp'): # An rt element's end tag may be omitted if the rt element is # immediately followed by an rt or rp element, or if there is # no more content in the parent element. # An rp element's end tag may be omitted if the rp element is # immediately followed by an rt or rp element, or if there is # no more content in the parent element. if type == "StartTag": return next["name"] in ('rt', 'rp') else: return type == "EndTag" or type is None elif tagname == 'colgroup': # A colgroup element's end tag may be omitted if the colgroup # element is not immediately followed by a space character or # a comment. if type in ("Comment", "SpaceCharacters"): return False elif type == "StartTag": # XXX: we also look for an immediately following colgroup # element. See is_optional_start. return next["name"] != 'colgroup' else: return True elif tagname in ('thead', 'tbody'): # A thead element's end tag may be omitted if the thead element # is immediately followed by a tbody or tfoot element. # A tbody element's end tag may be omitted if the tbody element # is immediately followed by a tbody or tfoot element, or if # there is no more content in the parent element. # A tfoot element's end tag may be omitted if the tfoot element # is immediately followed by a tbody element, or if there is no # more content in the parent element. # XXX: we never omit the end tag when the following element is # a tbody. See is_optional_start. if type == "StartTag": return next["name"] in ['tbody', 'tfoot'] elif tagname == 'tbody': return type == "EndTag" or type is None else: return False elif tagname == 'tfoot': # A tfoot element's end tag may be omitted if the tfoot element # is immediately followed by a tbody element, or if there is no # more content in the parent element. # XXX: we never omit the end tag when the following element is # a tbody. See is_optional_start. if type == "StartTag": return next["name"] == 'tbody' else: return type == "EndTag" or type is None elif tagname in ('td', 'th'): # A td element's end tag may be omitted if the td element is # immediately followed by a td or th element, or if there is # no more content in the parent element. # A th element's end tag may be omitted if the th element is # immediately followed by a td or th element, or if there is # no more content in the parent element. if type == "StartTag": return next["name"] in ('td', 'th') else: return type == "EndTag" or type is None return False site-packages/pip/_vendor/html5lib/filters/optionaltags.pyc000064400000010464147204247350020136 0ustar00 abc@`sIddlmZmZmZddlmZdejfdYZdS(i(tabsolute_importtdivisiontunicode_literalsi(tbasetFiltercB`s,eZdZdZdZdZRS(cc`shd}}x:|jD]/}|dk r7|||fVn|}|}qW|dk rd||dfVndS(N(tNonetsource(tselft previous1t previous2ttoken((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/optionaltags.pytsliders    cc`sx|jD]\}}}|d}|dkra|dsV|j|d|| r|Vqq |dkr|j|d|s|Vqq |Vq WdS(NutypeuStartTagudataunameuEndTag(R tis_optional_starttis_optional_end(RtpreviousR tnextttype((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/optionaltags.pyt__iter__s      cC`s*|r|dpd}|dkr,|dkS|dkre|dkrHtS|dkr&|d dkSn|d kr|dkrtS|dkr|d dkStSn|d kr|dkr|d dkStSnW|dkr&|dkr|r|ddkr|d dkrtS|d dkStSntS(NutypeuhtmluCommentuSpaceCharactersuheaduStartTaguEmptyTaguEndTagunameubodyuscriptustyleucolgroupucolutbodyutheadutfootutr(uCommentuSpaceCharacters(uStartTaguEmptyTag(uCommentuSpaceCharacters(uscriptustyle(uStartTaguEmptyTag(utbodyutheadutfoot(RtTruetFalse(RttagnameRRR((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/optionaltags.pyR s4            cC`s|r|dpd}|d5kr,|d6kS|d7krk|d krR|d |kS|d kpg|dkSn|d8kr|d kr|d d9kS|dkr|d kp|dkStSn|dkr|d:kr|d d;kS|d kp|dkSn|d,kr8|d kr|d d<kS|d kp4|dkSnI|d=krw|d kr^|d d>kS|d kps|dkSn |d/kr|d?krtS|d kr|d d/kStSn|d@kr|d kr|d dAkS|d1kr|d kp|dkStSn~|d2krB|d kr)|d d1kS|d kp>|dkSn?|dBkr|d krh|d dCkS|d kp}|dkSntS(DNutypeuhtmluheadubodyuCommentuSpaceCharactersuliuoptgrouputruStartTagunameuEndTagudtuddupuEmptyTaguaddressuarticleuasideu blockquoteudatagridudialogudirudivudlufieldsetufooteruformuh1uh2uh3uh4uh5uh6uheaderuhrumenuunavuolupreusectionutableuuluoptionurturpucolgrouputheadutbodyutfootutduth(uhtmluheadubody(uCommentuSpaceCharacters(uliuoptgrouputr(udtudd(udtudd(uStartTaguEmptyTag(uaddressuarticleuasideu blockquoteudatagridudialogudirudivudlufieldsetufooteruformuh1uh2uh3uh4uh5uh6uheaderuhrumenuunavuolupupreusectionutableuul(uoptionuoptgroup(urturp(urturp(uCommentuSpaceCharacters(utheadutbody(utbodyutfoot(utduth(utduth(RRR(RRRR((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/optionaltags.pyR Wsf                     (t__name__t __module__R RR R (((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/optionaltags.pyRs 9N(t __future__RRRtRR(((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/optionaltags.pytssite-packages/pip/_vendor/html5lib/filters/optionaltags.pyo000064400000010464147204247350020152 0ustar00 abc@`sIddlmZmZmZddlmZdejfdYZdS(i(tabsolute_importtdivisiontunicode_literalsi(tbasetFiltercB`s,eZdZdZdZdZRS(cc`shd}}x:|jD]/}|dk r7|||fVn|}|}qW|dk rd||dfVndS(N(tNonetsource(tselft previous1t previous2ttoken((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/optionaltags.pytsliders    cc`sx|jD]\}}}|d}|dkra|dsV|j|d|| r|Vqq |dkr|j|d|s|Vqq |Vq WdS(NutypeuStartTagudataunameuEndTag(R tis_optional_starttis_optional_end(RtpreviousR tnextttype((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/optionaltags.pyt__iter__s      cC`s*|r|dpd}|dkr,|dkS|dkre|dkrHtS|dkr&|d dkSn|d kr|dkrtS|dkr|d dkStSn|d kr|dkr|d dkStSnW|dkr&|dkr|r|ddkr|d dkrtS|d dkStSntS(NutypeuhtmluCommentuSpaceCharactersuheaduStartTaguEmptyTaguEndTagunameubodyuscriptustyleucolgroupucolutbodyutheadutfootutr(uCommentuSpaceCharacters(uStartTaguEmptyTag(uCommentuSpaceCharacters(uscriptustyle(uStartTaguEmptyTag(utbodyutheadutfoot(RtTruetFalse(RttagnameRRR((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/optionaltags.pyR s4            cC`s|r|dpd}|d5kr,|d6kS|d7krk|d krR|d |kS|d kpg|dkSn|d8kr|d kr|d d9kS|dkr|d kp|dkStSn|dkr|d:kr|d d;kS|d kp|dkSn|d,kr8|d kr|d d<kS|d kp4|dkSnI|d=krw|d kr^|d d>kS|d kps|dkSn |d/kr|d?krtS|d kr|d d/kStSn|d@kr|d kr|d dAkS|d1kr|d kp|dkStSn~|d2krB|d kr)|d d1kS|d kp>|dkSn?|dBkr|d krh|d dCkS|d kp}|dkSntS(DNutypeuhtmluheadubodyuCommentuSpaceCharactersuliuoptgrouputruStartTagunameuEndTagudtuddupuEmptyTaguaddressuarticleuasideu blockquoteudatagridudialogudirudivudlufieldsetufooteruformuh1uh2uh3uh4uh5uh6uheaderuhrumenuunavuolupreusectionutableuuluoptionurturpucolgrouputheadutbodyutfootutduth(uhtmluheadubody(uCommentuSpaceCharacters(uliuoptgrouputr(udtudd(udtudd(uStartTaguEmptyTag(uaddressuarticleuasideu blockquoteudatagridudialogudirudivudlufieldsetufooteruformuh1uh2uh3uh4uh5uh6uheaderuhrumenuunavuolupupreusectionutableuul(uoptionuoptgroup(urturp(urturp(uCommentuSpaceCharacters(utheadutbody(utbodyutfoot(utduth(utduth(RRR(RRRR((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/optionaltags.pyR Wsf                     (t__name__t __module__R RR R (((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/optionaltags.pyRs 9N(t __future__RRRtRR(((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/optionaltags.pytssite-packages/pip/_vendor/html5lib/filters/sanitizer.py000064400000061030147204247350017272 0ustar00from __future__ import absolute_import, division, unicode_literals import re from xml.sax.saxutils import escape, unescape from pip._vendor.six.moves import urllib_parse as urlparse from . import base from ..constants import namespaces, prefixes __all__ = ["Filter"] allowed_elements = frozenset(( (namespaces['html'], 'a'), (namespaces['html'], 'abbr'), (namespaces['html'], 'acronym'), (namespaces['html'], 'address'), (namespaces['html'], 'area'), (namespaces['html'], 'article'), (namespaces['html'], 'aside'), (namespaces['html'], 'audio'), (namespaces['html'], 'b'), (namespaces['html'], 'big'), (namespaces['html'], 'blockquote'), (namespaces['html'], 'br'), (namespaces['html'], 'button'), (namespaces['html'], 'canvas'), (namespaces['html'], 'caption'), (namespaces['html'], 'center'), (namespaces['html'], 'cite'), (namespaces['html'], 'code'), (namespaces['html'], 'col'), (namespaces['html'], 'colgroup'), (namespaces['html'], 'command'), (namespaces['html'], 'datagrid'), (namespaces['html'], 'datalist'), (namespaces['html'], 'dd'), (namespaces['html'], 'del'), (namespaces['html'], 'details'), (namespaces['html'], 'dfn'), (namespaces['html'], 'dialog'), (namespaces['html'], 'dir'), (namespaces['html'], 'div'), (namespaces['html'], 'dl'), (namespaces['html'], 'dt'), (namespaces['html'], 'em'), (namespaces['html'], 'event-source'), (namespaces['html'], 'fieldset'), (namespaces['html'], 'figcaption'), (namespaces['html'], 'figure'), (namespaces['html'], 'footer'), (namespaces['html'], 'font'), (namespaces['html'], 'form'), (namespaces['html'], 'header'), (namespaces['html'], 'h1'), (namespaces['html'], 'h2'), (namespaces['html'], 'h3'), (namespaces['html'], 'h4'), (namespaces['html'], 'h5'), (namespaces['html'], 'h6'), (namespaces['html'], 'hr'), (namespaces['html'], 'i'), (namespaces['html'], 'img'), (namespaces['html'], 'input'), (namespaces['html'], 'ins'), (namespaces['html'], 'keygen'), (namespaces['html'], 'kbd'), (namespaces['html'], 'label'), (namespaces['html'], 'legend'), (namespaces['html'], 'li'), (namespaces['html'], 'm'), (namespaces['html'], 'map'), (namespaces['html'], 'menu'), (namespaces['html'], 'meter'), (namespaces['html'], 'multicol'), (namespaces['html'], 'nav'), (namespaces['html'], 'nextid'), (namespaces['html'], 'ol'), (namespaces['html'], 'output'), (namespaces['html'], 'optgroup'), (namespaces['html'], 'option'), (namespaces['html'], 'p'), (namespaces['html'], 'pre'), (namespaces['html'], 'progress'), (namespaces['html'], 'q'), (namespaces['html'], 's'), (namespaces['html'], 'samp'), (namespaces['html'], 'section'), (namespaces['html'], 'select'), (namespaces['html'], 'small'), (namespaces['html'], 'sound'), (namespaces['html'], 'source'), (namespaces['html'], 'spacer'), (namespaces['html'], 'span'), (namespaces['html'], 'strike'), (namespaces['html'], 'strong'), (namespaces['html'], 'sub'), (namespaces['html'], 'sup'), (namespaces['html'], 'table'), (namespaces['html'], 'tbody'), (namespaces['html'], 'td'), (namespaces['html'], 'textarea'), (namespaces['html'], 'time'), (namespaces['html'], 'tfoot'), (namespaces['html'], 'th'), (namespaces['html'], 'thead'), (namespaces['html'], 'tr'), (namespaces['html'], 'tt'), (namespaces['html'], 'u'), (namespaces['html'], 'ul'), (namespaces['html'], 'var'), (namespaces['html'], 'video'), (namespaces['mathml'], 'maction'), (namespaces['mathml'], 'math'), (namespaces['mathml'], 'merror'), (namespaces['mathml'], 'mfrac'), (namespaces['mathml'], 'mi'), (namespaces['mathml'], 'mmultiscripts'), (namespaces['mathml'], 'mn'), (namespaces['mathml'], 'mo'), (namespaces['mathml'], 'mover'), (namespaces['mathml'], 'mpadded'), (namespaces['mathml'], 'mphantom'), (namespaces['mathml'], 'mprescripts'), (namespaces['mathml'], 'mroot'), (namespaces['mathml'], 'mrow'), (namespaces['mathml'], 'mspace'), (namespaces['mathml'], 'msqrt'), (namespaces['mathml'], 'mstyle'), (namespaces['mathml'], 'msub'), (namespaces['mathml'], 'msubsup'), (namespaces['mathml'], 'msup'), (namespaces['mathml'], 'mtable'), (namespaces['mathml'], 'mtd'), (namespaces['mathml'], 'mtext'), (namespaces['mathml'], 'mtr'), (namespaces['mathml'], 'munder'), (namespaces['mathml'], 'munderover'), (namespaces['mathml'], 'none'), (namespaces['svg'], 'a'), (namespaces['svg'], 'animate'), (namespaces['svg'], 'animateColor'), (namespaces['svg'], 'animateMotion'), (namespaces['svg'], 'animateTransform'), (namespaces['svg'], 'clipPath'), (namespaces['svg'], 'circle'), (namespaces['svg'], 'defs'), (namespaces['svg'], 'desc'), (namespaces['svg'], 'ellipse'), (namespaces['svg'], 'font-face'), (namespaces['svg'], 'font-face-name'), (namespaces['svg'], 'font-face-src'), (namespaces['svg'], 'g'), (namespaces['svg'], 'glyph'), (namespaces['svg'], 'hkern'), (namespaces['svg'], 'linearGradient'), (namespaces['svg'], 'line'), (namespaces['svg'], 'marker'), (namespaces['svg'], 'metadata'), (namespaces['svg'], 'missing-glyph'), (namespaces['svg'], 'mpath'), (namespaces['svg'], 'path'), (namespaces['svg'], 'polygon'), (namespaces['svg'], 'polyline'), (namespaces['svg'], 'radialGradient'), (namespaces['svg'], 'rect'), (namespaces['svg'], 'set'), (namespaces['svg'], 'stop'), (namespaces['svg'], 'svg'), (namespaces['svg'], 'switch'), (namespaces['svg'], 'text'), (namespaces['svg'], 'title'), (namespaces['svg'], 'tspan'), (namespaces['svg'], 'use'), )) allowed_attributes = frozenset(( # HTML attributes (None, 'abbr'), (None, 'accept'), (None, 'accept-charset'), (None, 'accesskey'), (None, 'action'), (None, 'align'), (None, 'alt'), (None, 'autocomplete'), (None, 'autofocus'), (None, 'axis'), (None, 'background'), (None, 'balance'), (None, 'bgcolor'), (None, 'bgproperties'), (None, 'border'), (None, 'bordercolor'), (None, 'bordercolordark'), (None, 'bordercolorlight'), (None, 'bottompadding'), (None, 'cellpadding'), (None, 'cellspacing'), (None, 'ch'), (None, 'challenge'), (None, 'char'), (None, 'charoff'), (None, 'choff'), (None, 'charset'), (None, 'checked'), (None, 'cite'), (None, 'class'), (None, 'clear'), (None, 'color'), (None, 'cols'), (None, 'colspan'), (None, 'compact'), (None, 'contenteditable'), (None, 'controls'), (None, 'coords'), (None, 'data'), (None, 'datafld'), (None, 'datapagesize'), (None, 'datasrc'), (None, 'datetime'), (None, 'default'), (None, 'delay'), (None, 'dir'), (None, 'disabled'), (None, 'draggable'), (None, 'dynsrc'), (None, 'enctype'), (None, 'end'), (None, 'face'), (None, 'for'), (None, 'form'), (None, 'frame'), (None, 'galleryimg'), (None, 'gutter'), (None, 'headers'), (None, 'height'), (None, 'hidefocus'), (None, 'hidden'), (None, 'high'), (None, 'href'), (None, 'hreflang'), (None, 'hspace'), (None, 'icon'), (None, 'id'), (None, 'inputmode'), (None, 'ismap'), (None, 'keytype'), (None, 'label'), (None, 'leftspacing'), (None, 'lang'), (None, 'list'), (None, 'longdesc'), (None, 'loop'), (None, 'loopcount'), (None, 'loopend'), (None, 'loopstart'), (None, 'low'), (None, 'lowsrc'), (None, 'max'), (None, 'maxlength'), (None, 'media'), (None, 'method'), (None, 'min'), (None, 'multiple'), (None, 'name'), (None, 'nohref'), (None, 'noshade'), (None, 'nowrap'), (None, 'open'), (None, 'optimum'), (None, 'pattern'), (None, 'ping'), (None, 'point-size'), (None, 'poster'), (None, 'pqg'), (None, 'preload'), (None, 'prompt'), (None, 'radiogroup'), (None, 'readonly'), (None, 'rel'), (None, 'repeat-max'), (None, 'repeat-min'), (None, 'replace'), (None, 'required'), (None, 'rev'), (None, 'rightspacing'), (None, 'rows'), (None, 'rowspan'), (None, 'rules'), (None, 'scope'), (None, 'selected'), (None, 'shape'), (None, 'size'), (None, 'span'), (None, 'src'), (None, 'start'), (None, 'step'), (None, 'style'), (None, 'summary'), (None, 'suppress'), (None, 'tabindex'), (None, 'target'), (None, 'template'), (None, 'title'), (None, 'toppadding'), (None, 'type'), (None, 'unselectable'), (None, 'usemap'), (None, 'urn'), (None, 'valign'), (None, 'value'), (None, 'variable'), (None, 'volume'), (None, 'vspace'), (None, 'vrml'), (None, 'width'), (None, 'wrap'), (namespaces['xml'], 'lang'), # MathML attributes (None, 'actiontype'), (None, 'align'), (None, 'columnalign'), (None, 'columnalign'), (None, 'columnalign'), (None, 'columnlines'), (None, 'columnspacing'), (None, 'columnspan'), (None, 'depth'), (None, 'display'), (None, 'displaystyle'), (None, 'equalcolumns'), (None, 'equalrows'), (None, 'fence'), (None, 'fontstyle'), (None, 'fontweight'), (None, 'frame'), (None, 'height'), (None, 'linethickness'), (None, 'lspace'), (None, 'mathbackground'), (None, 'mathcolor'), (None, 'mathvariant'), (None, 'mathvariant'), (None, 'maxsize'), (None, 'minsize'), (None, 'other'), (None, 'rowalign'), (None, 'rowalign'), (None, 'rowalign'), (None, 'rowlines'), (None, 'rowspacing'), (None, 'rowspan'), (None, 'rspace'), (None, 'scriptlevel'), (None, 'selection'), (None, 'separator'), (None, 'stretchy'), (None, 'width'), (None, 'width'), (namespaces['xlink'], 'href'), (namespaces['xlink'], 'show'), (namespaces['xlink'], 'type'), # SVG attributes (None, 'accent-height'), (None, 'accumulate'), (None, 'additive'), (None, 'alphabetic'), (None, 'arabic-form'), (None, 'ascent'), (None, 'attributeName'), (None, 'attributeType'), (None, 'baseProfile'), (None, 'bbox'), (None, 'begin'), (None, 'by'), (None, 'calcMode'), (None, 'cap-height'), (None, 'class'), (None, 'clip-path'), (None, 'color'), (None, 'color-rendering'), (None, 'content'), (None, 'cx'), (None, 'cy'), (None, 'd'), (None, 'dx'), (None, 'dy'), (None, 'descent'), (None, 'display'), (None, 'dur'), (None, 'end'), (None, 'fill'), (None, 'fill-opacity'), (None, 'fill-rule'), (None, 'font-family'), (None, 'font-size'), (None, 'font-stretch'), (None, 'font-style'), (None, 'font-variant'), (None, 'font-weight'), (None, 'from'), (None, 'fx'), (None, 'fy'), (None, 'g1'), (None, 'g2'), (None, 'glyph-name'), (None, 'gradientUnits'), (None, 'hanging'), (None, 'height'), (None, 'horiz-adv-x'), (None, 'horiz-origin-x'), (None, 'id'), (None, 'ideographic'), (None, 'k'), (None, 'keyPoints'), (None, 'keySplines'), (None, 'keyTimes'), (None, 'lang'), (None, 'marker-end'), (None, 'marker-mid'), (None, 'marker-start'), (None, 'markerHeight'), (None, 'markerUnits'), (None, 'markerWidth'), (None, 'mathematical'), (None, 'max'), (None, 'min'), (None, 'name'), (None, 'offset'), (None, 'opacity'), (None, 'orient'), (None, 'origin'), (None, 'overline-position'), (None, 'overline-thickness'), (None, 'panose-1'), (None, 'path'), (None, 'pathLength'), (None, 'points'), (None, 'preserveAspectRatio'), (None, 'r'), (None, 'refX'), (None, 'refY'), (None, 'repeatCount'), (None, 'repeatDur'), (None, 'requiredExtensions'), (None, 'requiredFeatures'), (None, 'restart'), (None, 'rotate'), (None, 'rx'), (None, 'ry'), (None, 'slope'), (None, 'stemh'), (None, 'stemv'), (None, 'stop-color'), (None, 'stop-opacity'), (None, 'strikethrough-position'), (None, 'strikethrough-thickness'), (None, 'stroke'), (None, 'stroke-dasharray'), (None, 'stroke-dashoffset'), (None, 'stroke-linecap'), (None, 'stroke-linejoin'), (None, 'stroke-miterlimit'), (None, 'stroke-opacity'), (None, 'stroke-width'), (None, 'systemLanguage'), (None, 'target'), (None, 'text-anchor'), (None, 'to'), (None, 'transform'), (None, 'type'), (None, 'u1'), (None, 'u2'), (None, 'underline-position'), (None, 'underline-thickness'), (None, 'unicode'), (None, 'unicode-range'), (None, 'units-per-em'), (None, 'values'), (None, 'version'), (None, 'viewBox'), (None, 'visibility'), (None, 'width'), (None, 'widths'), (None, 'x'), (None, 'x-height'), (None, 'x1'), (None, 'x2'), (namespaces['xlink'], 'actuate'), (namespaces['xlink'], 'arcrole'), (namespaces['xlink'], 'href'), (namespaces['xlink'], 'role'), (namespaces['xlink'], 'show'), (namespaces['xlink'], 'title'), (namespaces['xlink'], 'type'), (namespaces['xml'], 'base'), (namespaces['xml'], 'lang'), (namespaces['xml'], 'space'), (None, 'y'), (None, 'y1'), (None, 'y2'), (None, 'zoomAndPan'), )) attr_val_is_uri = frozenset(( (None, 'href'), (None, 'src'), (None, 'cite'), (None, 'action'), (None, 'longdesc'), (None, 'poster'), (None, 'background'), (None, 'datasrc'), (None, 'dynsrc'), (None, 'lowsrc'), (None, 'ping'), (namespaces['xlink'], 'href'), (namespaces['xml'], 'base'), )) svg_attr_val_allows_ref = frozenset(( (None, 'clip-path'), (None, 'color-profile'), (None, 'cursor'), (None, 'fill'), (None, 'filter'), (None, 'marker'), (None, 'marker-start'), (None, 'marker-mid'), (None, 'marker-end'), (None, 'mask'), (None, 'stroke'), )) svg_allow_local_href = frozenset(( (None, 'altGlyph'), (None, 'animate'), (None, 'animateColor'), (None, 'animateMotion'), (None, 'animateTransform'), (None, 'cursor'), (None, 'feImage'), (None, 'filter'), (None, 'linearGradient'), (None, 'pattern'), (None, 'radialGradient'), (None, 'textpath'), (None, 'tref'), (None, 'set'), (None, 'use') )) allowed_css_properties = frozenset(( 'azimuth', 'background-color', 'border-bottom-color', 'border-collapse', 'border-color', 'border-left-color', 'border-right-color', 'border-top-color', 'clear', 'color', 'cursor', 'direction', 'display', 'elevation', 'float', 'font', 'font-family', 'font-size', 'font-style', 'font-variant', 'font-weight', 'height', 'letter-spacing', 'line-height', 'overflow', 'pause', 'pause-after', 'pause-before', 'pitch', 'pitch-range', 'richness', 'speak', 'speak-header', 'speak-numeral', 'speak-punctuation', 'speech-rate', 'stress', 'text-align', 'text-decoration', 'text-indent', 'unicode-bidi', 'vertical-align', 'voice-family', 'volume', 'white-space', 'width', )) allowed_css_keywords = frozenset(( 'auto', 'aqua', 'black', 'block', 'blue', 'bold', 'both', 'bottom', 'brown', 'center', 'collapse', 'dashed', 'dotted', 'fuchsia', 'gray', 'green', '!important', 'italic', 'left', 'lime', 'maroon', 'medium', 'none', 'navy', 'normal', 'nowrap', 'olive', 'pointer', 'purple', 'red', 'right', 'solid', 'silver', 'teal', 'top', 'transparent', 'underline', 'white', 'yellow', )) allowed_svg_properties = frozenset(( 'fill', 'fill-opacity', 'fill-rule', 'stroke', 'stroke-width', 'stroke-linecap', 'stroke-linejoin', 'stroke-opacity', )) allowed_protocols = frozenset(( 'ed2k', 'ftp', 'http', 'https', 'irc', 'mailto', 'news', 'gopher', 'nntp', 'telnet', 'webcal', 'xmpp', 'callto', 'feed', 'urn', 'aim', 'rsync', 'tag', 'ssh', 'sftp', 'rtsp', 'afs', 'data', )) allowed_content_types = frozenset(( 'image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/bmp', 'text/plain', )) data_content_type = re.compile(r''' ^ # Match a content type / (?P[-a-zA-Z0-9.]+/[-a-zA-Z0-9.]+) # Match any character set and encoding (?:(?:;charset=(?:[-a-zA-Z0-9]+)(?:;(?:base64))?) |(?:;(?:base64))?(?:;charset=(?:[-a-zA-Z0-9]+))?) # Assume the rest is data ,.* $ ''', re.VERBOSE) class Filter(base.Filter): """ sanitization of XHTML+MathML+SVG and of inline style attributes.""" def __init__(self, source, allowed_elements=allowed_elements, allowed_attributes=allowed_attributes, allowed_css_properties=allowed_css_properties, allowed_css_keywords=allowed_css_keywords, allowed_svg_properties=allowed_svg_properties, allowed_protocols=allowed_protocols, allowed_content_types=allowed_content_types, attr_val_is_uri=attr_val_is_uri, svg_attr_val_allows_ref=svg_attr_val_allows_ref, svg_allow_local_href=svg_allow_local_href): super(Filter, self).__init__(source) self.allowed_elements = allowed_elements self.allowed_attributes = allowed_attributes self.allowed_css_properties = allowed_css_properties self.allowed_css_keywords = allowed_css_keywords self.allowed_svg_properties = allowed_svg_properties self.allowed_protocols = allowed_protocols self.allowed_content_types = allowed_content_types self.attr_val_is_uri = attr_val_is_uri self.svg_attr_val_allows_ref = svg_attr_val_allows_ref self.svg_allow_local_href = svg_allow_local_href def __iter__(self): for token in base.Filter.__iter__(self): token = self.sanitize_token(token) if token: yield token # Sanitize the +html+, escaping all elements not in ALLOWED_ELEMENTS, and # stripping out all # attributes not in ALLOWED_ATTRIBUTES. Style # attributes are parsed, and a restricted set, # specified by # ALLOWED_CSS_PROPERTIES and ALLOWED_CSS_KEYWORDS, are allowed through. # attributes in ATTR_VAL_IS_URI are scanned, and only URI schemes specified # in ALLOWED_PROTOCOLS are allowed. # # sanitize_html('') # => <script> do_nasty_stuff() </script> # sanitize_html('Click here for $100') # => Click here for $100 def sanitize_token(self, token): # accommodate filters which use token_type differently token_type = token["type"] if token_type in ("StartTag", "EndTag", "EmptyTag"): name = token["name"] namespace = token["namespace"] if ((namespace, name) in self.allowed_elements or (namespace is None and (namespaces["html"], name) in self.allowed_elements)): return self.allowed_token(token) else: return self.disallowed_token(token) elif token_type == "Comment": pass else: return token def allowed_token(self, token): if "data" in token: attrs = token["data"] attr_names = set(attrs.keys()) # Remove forbidden attributes for to_remove in (attr_names - self.allowed_attributes): del token["data"][to_remove] attr_names.remove(to_remove) # Remove attributes with disallowed URL values for attr in (attr_names & self.attr_val_is_uri): assert attr in attrs # I don't have a clue where this regexp comes from or why it matches those # characters, nor why we call unescape. I just know it's always been here. # Should you be worried by this comment in a sanitizer? Yes. On the other hand, all # this will do is remove *more* than it otherwise would. val_unescaped = re.sub("[`\x00-\x20\x7f-\xa0\s]+", '', unescape(attrs[attr])).lower() # remove replacement characters from unescaped characters val_unescaped = val_unescaped.replace("\ufffd", "") try: uri = urlparse.urlparse(val_unescaped) except ValueError: uri = None del attrs[attr] if uri and uri.scheme: if uri.scheme not in self.allowed_protocols: del attrs[attr] if uri.scheme == 'data': m = data_content_type.match(uri.path) if not m: del attrs[attr] elif m.group('content_type') not in self.allowed_content_types: del attrs[attr] for attr in self.svg_attr_val_allows_ref: if attr in attrs: attrs[attr] = re.sub(r'url\s*\(\s*[^#\s][^)]+?\)', ' ', unescape(attrs[attr])) if (token["name"] in self.svg_allow_local_href and (namespaces['xlink'], 'href') in attrs and re.search('^\s*[^#\s].*', attrs[(namespaces['xlink'], 'href')])): del attrs[(namespaces['xlink'], 'href')] if (None, 'style') in attrs: attrs[(None, 'style')] = self.sanitize_css(attrs[(None, 'style')]) token["data"] = attrs return token def disallowed_token(self, token): token_type = token["type"] if token_type == "EndTag": token["data"] = "" % token["name"] elif token["data"]: assert token_type in ("StartTag", "EmptyTag") attrs = [] for (ns, name), v in token["data"].items(): attrs.append(' %s="%s"' % (name if ns is None else "%s:%s" % (prefixes[ns], name), escape(v))) token["data"] = "<%s%s>" % (token["name"], ''.join(attrs)) else: token["data"] = "<%s>" % token["name"] if token.get("selfClosing"): token["data"] = token["data"][:-1] + "/>" token["type"] = "Characters" del token["name"] return token def sanitize_css(self, style): # disallow urls style = re.compile('url\s*\(\s*[^\s)]+?\s*\)\s*').sub(' ', style) # gauntlet if not re.match("""^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$""", style): return '' if not re.match("^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$", style): return '' clean = [] for prop, value in re.findall("([-\w]+)\s*:\s*([^:;]*)", style): if not value: continue if prop.lower() in self.allowed_css_properties: clean.append(prop + ': ' + value + ';') elif prop.split('-')[0].lower() in ['background', 'border', 'margin', 'padding']: for keyword in value.split(): if keyword not in self.allowed_css_keywords and \ not re.match("^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword): # noqa break else: clean.append(prop + ': ' + value + ';') elif prop.lower() in self.allowed_svg_properties: clean.append(prop + ': ' + value + ';') return ' '.join(clean) site-packages/pip/_vendor/html5lib/filters/sanitizer.pyc000064400000062253147204247350017445 0ustar00 abcE@`s2ddlmZmZmZddlZddlmZmZddlm Z ddl m Z ddl mZmZd gZeed d fed d fed d fed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed d fed d!fed d"fed d#fed d$fed d%fed d&fed d'fed d(fed d)fed d*fed d+fed d,fed d-fed d.fed d/fed d0fed d1fed d2fed d3fed d4fed d5fed d6fed d7fed d8fed d9fed d:fed d;fed d<fed d=fed d>fed d?fed d@fed dAfed dBfed dCfed dDfed dEfed dFfed dGfed dHfed dIfed dJfed dKfed dLfed dMfed dNfed dOfed dPfed dQfed dRfed dSfed dTfed dUfed dVfed dWfed dXfed dYfed dZfed d[fed d\fed d]fed d^fed d_fed d`fed dafed dbfed dcfed ddfed defed dffed dgfed dhfed difed djfed dkfed dlfed dmfedndofedndpfedndqfedndrfedndsfedndtfedndufedndvfedndwfedndxfedndyfedndzfednd{fednd|fednd}fednd~fedndfedndfedndfedndfedndfedndfedndfedndfedndfedndfedndfedd feddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddffZed4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddded1dfddddddddddddddddddddddddddddddddddddddddedOdfedOdPfedOd%fdddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcddedOdfedOdfedOdfedOdfedOdPfedOdfedOd%fed1dfed1dfed1dfdedfdgdhfCZedidjdkdldmdndodpdqdrdsedOdfed1dff Zedtdudvdwdxdydzd{d|d}d~f ZedddddddddddddddfZedZedZedZedZedZejd1ejZd2e j fd3YZ dS(i(tabsolute_importtdivisiontunicode_literalsN(tescapetunescape(t urllib_parsei(tbasei(t namespacestprefixesuFilteruhtmluauabbruacronymuaddressuareauarticleuasideuaudioububigu blockquoteubrubuttonucanvasucaptionucenteruciteucodeucolucolgroupucommandudatagridudatalistuddudeludetailsudfnudialogudirudivudludtuemu event-sourceufieldsetu figcaptionufigureufooterufontuformuheaderuh1uh2uh3uh4uh5uh6uhruiuimguinputuinsukeygenukbdulabelulegenduliumumapumenuumeterumulticolunavunextiduoluoutputuoptgroupuoptionupupreuprogressuqususampusectionuselectusmallusoundusourceuspaceruspanustrikeustrongusubusuputableutbodyutdutextareautimeutfootuthutheadutruttuuuuluvaruvideoumathmlumactionumathumerrorumfracumiu mmultiscriptsumnumoumoverumpaddedumphantomu mprescriptsumrootumrowumspaceumsqrtumstyleumsubumsubsupumsupumtableumtdumtextumtrumunderu munderoverunoneusvguanimateu animateColoru animateMotionuanimateTransformuclipPathucircleudefsudescuellipseu font-faceufont-face-nameu font-face-srcuguglyphuhkernulinearGradientulineumarkerumetadatau missing-glyphumpathupathupolygonupolylineuradialGradienturectusetustopuswitchutextutitleutspanuuseuacceptuaccept-charsetu accesskeyuactionualignualtu autocompleteu autofocusuaxisu backgroundubalanceubgcoloru bgpropertiesuborderu bordercolorubordercolordarkubordercolorlightu bottompaddingu cellpaddingu cellspacinguchu challengeucharucharoffuchoffucharsetucheckeduclassuclearucolorucolsucolspanucompactucontenteditableucontrolsucoordsudataudatafldu datapagesizeudatasrcudatetimeudefaultudelayudisabledu draggableudynsrcuenctypeuendufaceuforuframeu galleryimgugutteruheadersuheightu hidefocusuhiddenuhighuhrefuhreflanguhspaceuiconuidu inputmodeuismapukeytypeu leftspacingulangulistulongdesculoopu loopcountuloopendu loopstartulowulowsrcumaxu maxlengthumediaumethoduminumultipleunameunohrefunoshadeunowrapuopenuoptimumupatternupingu point-sizeuposterupqgupreloadupromptu radiogroupureadonlyurelu repeat-maxu repeat-minureplaceurequiredurevu rightspacingurowsurowspanurulesuscopeuselectedushapeusizeusrcustartustepustyleusummaryusuppressutabindexutargetutemplateu toppaddingutypeu unselectableuusemapuurnuvalignuvalueuvariableuvolumeuvspaceuvrmluwidthuwrapuxmlu actiontypeu columnalignu columnlinesu columnspacingu columnspanudepthudisplayu displaystyleu equalcolumnsu equalrowsufenceu fontstyleu fontweightu linethicknessulspaceumathbackgroundu mathcoloru mathvariantumaxsizeuminsizeuotherurowalignurowlinesu rowspacingurspaceu scriptlevelu selectionu separatorustretchyuxlinkushowu accent-heightu accumulateuadditiveu alphabeticu arabic-formuascentu attributeNameu attributeTypeu baseProfileubboxubeginubyucalcModeu cap-heightu clip-pathucolor-renderingucontentucxucyududxudyudescentudurufillu fill-opacityu fill-ruleu font-familyu font-sizeu font-stretchu font-styleu font-variantu font-weightufromufxufyug1ug2u glyph-nameu gradientUnitsuhangingu horiz-adv-xuhoriz-origin-xu ideographicuku keyPointsu keySplinesukeyTimesu marker-endu marker-midu marker-startu markerHeightu markerUnitsu markerWidthu mathematicaluoffsetuopacityuorientuoriginuoverline-positionuoverline-thicknessupanose-1u pathLengthupointsupreserveAspectRatioururefXurefYu repeatCountu repeatDururequiredExtensionsurequiredFeaturesurestarturotateurxuryuslopeustemhustemvu stop-coloru stop-opacityustrikethrough-positionustrikethrough-thicknessustrokeustroke-dasharrayustroke-dashoffsetustroke-linecapustroke-linejoinustroke-miterlimitustroke-opacityu stroke-widthusystemLanguageu text-anchorutou transformuu1uu2uunderline-positionuunderline-thicknessuunicodeu unicode-rangeu units-per-emuvaluesuversionuviewBoxu visibilityuwidthsuxux-heightux1ux2uactuateuarcroleuroleubaseuspaceuyuy1uy2u zoomAndPanu color-profileucursorufilterumaskualtGlyphufeImageutextpathutrefuazimuthubackground-coloruborder-bottom-coloruborder-collapseu border-coloruborder-left-coloruborder-right-coloruborder-top-coloru directionu elevationufloatuletter-spacingu line-heightuoverflowupauseu pause-afteru pause-beforeupitchu pitch-rangeurichnessuspeaku speak-headeru speak-numeraluspeak-punctuationu speech-rateustressu text-alignutext-decorationu text-indentu unicode-bidiuvertical-alignu voice-familyu white-spaceuautouaquaublackublockublueuboldubothubottomubrownucollapseudashedudottedufuchsiaugrayugreenu !importantuitaliculeftulimeumaroonumediumunavyunormaluoliveupointerupurpleuredurightusolidusilverutealutopu transparentu underlineuwhiteuyellowued2kuftpuhttpuhttpsuircumailtounewsugopherunntputelnetuwebcaluxmppucalltoufeeduaimursyncutagusshusftpurtspuafsu image/pngu image/jpegu image/gifu image/webpu image/bmpu text/plainuL ^ # Match a content type / (?P[-a-zA-Z0-9.]+/[-a-zA-Z0-9.]+) # Match any character set and encoding (?:(?:;charset=(?:[-a-zA-Z0-9]+)(?:;(?:base64))?) |(?:;(?:base64))?(?:;charset=(?:[-a-zA-Z0-9]+))?) # Assume the rest is data ,.* $ tFilterc B`sbeZdZeeeeeee e e e d Z dZdZdZdZdZRS(uA sanitization of XHTML+MathML+SVG and of inline style attributes.c C`sttt|j|||_||_||_||_||_||_||_ | |_ | |_ | |_ dS(N( tsuperR t__init__tallowed_elementstallowed_attributestallowed_css_propertiestallowed_css_keywordstallowed_svg_propertiestallowed_protocolstallowed_content_typestattr_val_is_uritsvg_attr_val_allows_reftsvg_allow_local_href( tselftsourceR R RRRRRRRR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyR s          cc`s>x7tjj|D]#}|j|}|r|VqqWdS(N(RR t__iter__tsanitize_token(Rttoken((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyRscC`s|d}|d kr|d}|d}||f|jksd|dkrqtd|f|jkrq|j|S|j|Sn|dkrn|SdS( NutypeuStartTaguEndTaguEmptyTagunameu namespaceuhtmluComment(uStartTaguEndTaguEmptyTag(R tNoneRt allowed_tokentdisallowed_token(RRt token_typetnamet namespace((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyRs       c C`sKd|krG|d}t|j}x-||jD]}|d|=|j|q6Wx||j@D]}||ks~ttjddt||j }|j dd}yt j |}Wnt k rd}||=nX|rf|jrf|j|jkr||=n|jdkrmtj|j}|sE||=qj|jd|jkrj||=qjqmqfqfWxC|jD]8}||kr{tjddt||||unameudatauStartTaguEmptyTagu %s="%s"u%s:%su<%s%s>uu<%s>u selfClosingiu/>u Characters(uStartTaguEmptyTag(R$titemstappendRRRtjointget(RRRR2tnsRtv((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyR2s   #A$ cC`sctjdjd|}tjd|s1dStjd|sGdSg}xtjd|D]\}}|sxq`n|j|jkr|j|d|dq`|jd d jdkr!x|jD],}||j krtjd| rPqqW|j|d|dq`|j|j kr`|j|d|dq`q`Wdj |S(Nuurl\s*\(\s*[^\s)]+?\s*\)\s*u u@^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$uu ^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$u([-\w]+)\s*:\s*([^:;]*)u: u;u-iu backgrounduborderumarginupaddingu\^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$(u backgrounduborderumarginupadding( R%tcompileR&R-tfindallR'RR:tsplitRRR;(Rtstyletcleantproptvaluetkeyword((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyR1Fs*  (t__name__t __module__t__doc__R R RRRRRRRRR RRRRR1(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyR s    2 (Nuabbr(Nuaccept(Nuaccept-charset(Nu accesskey(Nuaction(Nualign(Nualt(Nu autocomplete(Nu autofocus(Nuaxis(Nu background(Nubalance(Nubgcolor(Nu bgproperties(Nuborder(Nu bordercolor(Nubordercolordark(Nubordercolorlight(Nu bottompadding(Nu cellpadding(Nu cellspacing(Nuch(Nu challenge(Nuchar(Nucharoff(Nuchoff(Nucharset(Nuchecked(Nucite(Nuclass(Nuclear(Nucolor(Nucols(Nucolspan(Nucompact(Nucontenteditable(Nucontrols(Nucoords(Nudata(Nudatafld(Nu datapagesize(Nudatasrc(Nudatetime(Nudefault(Nudelay(Nudir(Nudisabled(Nu draggable(Nudynsrc(Nuenctype(Nuend(Nuface(Nufor(Nuform(Nuframe(Nu galleryimg(Nugutter(Nuheaders(Nuheight(Nu hidefocus(Nuhidden(Nuhigh(Nuhref(Nuhreflang(Nuhspace(Nuicon(Nuid(Nu inputmode(Nuismap(Nukeytype(Nulabel(Nu leftspacing(Nulang(Nulist(Nulongdesc(Nuloop(Nu loopcount(Nuloopend(Nu loopstart(Nulow(Nulowsrc(Numax(Nu maxlength(Numedia(Numethod(Numin(Numultiple(Nuname(Nunohref(Nunoshade(Nunowrap(Nuopen(Nuoptimum(Nupattern(Nuping(Nu point-size(Nuposter(Nupqg(Nupreload(Nuprompt(Nu radiogroup(Nureadonly(Nurel(Nu repeat-max(Nu repeat-min(Nureplace(Nurequired(Nurev(Nu rightspacing(Nurows(Nurowspan(Nurules(Nuscope(Nuselected(Nushape(Nusize(Nuspan(Nusrc(Nustart(Nustep(Nustyle(Nusummary(Nusuppress(Nutabindex(Nutarget(Nutemplate(Nutitle(Nu toppadding(Nutype(Nu unselectable(Nuusemap(Nuurn(Nuvalign(Nuvalue(Nuvariable(Nuvolume(Nuvspace(Nuvrml(Nuwidth(Nuwrap(Nu actiontype(Nualign(Nu columnalign(Nu columnalign(Nu columnalign(Nu columnlines(Nu columnspacing(Nu columnspan(Nudepth(Nudisplay(Nu displaystyle(Nu equalcolumns(Nu equalrows(Nufence(Nu fontstyle(Nu fontweight(Nuframe(Nuheight(Nu linethickness(Nulspace(Numathbackground(Nu mathcolor(Nu mathvariant(Nu mathvariant(Numaxsize(Numinsize(Nuother(Nurowalign(Nurowalign(Nurowalign(Nurowlines(Nu rowspacing(Nurowspan(Nurspace(Nu scriptlevel(Nu selection(Nu separator(Nustretchy(Nuwidth(Nuwidth(Nu accent-height(Nu accumulate(Nuadditive(Nu alphabetic(Nu arabic-form(Nuascent(Nu attributeName(Nu attributeType(Nu baseProfile(Nubbox(Nubegin(Nuby(NucalcMode(Nu cap-height(Nuclass(Nu clip-path(Nucolor(Nucolor-rendering(Nucontent(Nucx(Nucy(Nud(Nudx(Nudy(Nudescent(Nudisplay(Nudur(Nuend(Nufill(Nu fill-opacity(Nu fill-rule(Nu font-family(Nu font-size(Nu font-stretch(Nu font-style(Nu font-variant(Nu font-weight(Nufrom(Nufx(Nufy(Nug1(Nug2(Nu glyph-name(Nu gradientUnits(Nuhanging(Nuheight(Nu horiz-adv-x(Nuhoriz-origin-x(Nuid(Nu ideographic(Nuk(Nu keyPoints(Nu keySplines(NukeyTimes(Nulang(Nu marker-end(Nu marker-mid(Nu marker-start(Nu markerHeight(Nu markerUnits(Nu markerWidth(Nu mathematical(Numax(Numin(Nuname(Nuoffset(Nuopacity(Nuorient(Nuorigin(Nuoverline-position(Nuoverline-thickness(Nupanose-1(Nupath(Nu pathLength(Nupoints(NupreserveAspectRatio(Nur(NurefX(NurefY(Nu repeatCount(Nu repeatDur(NurequiredExtensions(NurequiredFeatures(Nurestart(Nurotate(Nurx(Nury(Nuslope(Nustemh(Nustemv(Nu stop-color(Nu stop-opacity(Nustrikethrough-position(Nustrikethrough-thickness(Nustroke(Nustroke-dasharray(Nustroke-dashoffset(Nustroke-linecap(Nustroke-linejoin(Nustroke-miterlimit(Nustroke-opacity(Nu stroke-width(NusystemLanguage(Nutarget(Nu text-anchor(Nuto(Nu transform(Nutype(Nuu1(Nuu2(Nuunderline-position(Nuunderline-thickness(Nuunicode(Nu unicode-range(Nu units-per-em(Nuvalues(Nuversion(NuviewBox(Nu visibility(Nuwidth(Nuwidths(Nux(Nux-height(Nux1(Nux2(Nuy(Nuy1(Nuy2(Nu zoomAndPan(Nuhref(Nusrc(Nucite(Nuaction(Nulongdesc(Nuposter(Nu background(Nudatasrc(Nudynsrc(Nulowsrc(Nuping(Nu clip-path(Nu color-profile(Nucursor(Nufill(Nufilter(Numarker(Nu marker-start(Nu marker-mid(Nu marker-end(Numask(Nustroke(NualtGlyph(Nuanimate(Nu animateColor(Nu animateMotion(NuanimateTransform(Nucursor(NufeImage(Nufilter(NulinearGradient(Nupattern(NuradialGradient(Nutextpath(Nutref(Nuset(Nuuse(.uazimuthubackground-coloruborder-bottom-coloruborder-collapseu border-coloruborder-left-coloruborder-right-coloruborder-top-coloruclearucolorucursoru directionudisplayu elevationufloatufontu font-familyu font-sizeu font-styleu font-variantu font-weightuheightuletter-spacingu line-heightuoverflowupauseu pause-afteru pause-beforeupitchu pitch-rangeurichnessuspeaku speak-headeru speak-numeraluspeak-punctuationu speech-rateustressu text-alignutext-decorationu text-indentu unicode-bidiuvertical-alignu voice-familyuvolumeu white-spaceuwidth('uautouaquaublackublockublueuboldubothubottomubrownucenterucollapseudashedudottedufuchsiaugrayugreenu !importantuitaliculeftulimeumaroonumediumunoneunavyunormalunowrapuoliveupointerupurpleuredurightusolidusilverutealutopu transparentu underlineuwhiteuyellow(ufillu fill-opacityu fill-ruleustrokeu stroke-widthustroke-linecapustroke-linejoinustroke-opacity(ued2kuftpuhttpuhttpsuircumailtounewsugopherunntputelnetuwebcaluxmppucalltoufeeduurnuaimursyncutagusshusftpurtspuafsudata(u image/pngu image/jpegu image/gifu image/webpu image/bmpu text/plain(!t __future__RRRR%txml.sax.saxutilsRRtpip._vendor.six.movesRR)tRt constantsRRt__all__t frozensetR RR RRRRRRRRR?tVERBOSER,R (((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyts2                                                                                                                                                                                           site-packages/pip/_vendor/html5lib/filters/sanitizer.pyo000064400000062062147204247350017457 0ustar00 abcE@`s2ddlmZmZmZddlZddlmZmZddlm Z ddl m Z ddl mZmZd gZeed d fed d fed d fed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed dfed d fed d!fed d"fed d#fed d$fed d%fed d&fed d'fed d(fed d)fed d*fed d+fed d,fed d-fed d.fed d/fed d0fed d1fed d2fed d3fed d4fed d5fed d6fed d7fed d8fed d9fed d:fed d;fed d<fed d=fed d>fed d?fed d@fed dAfed dBfed dCfed dDfed dEfed dFfed dGfed dHfed dIfed dJfed dKfed dLfed dMfed dNfed dOfed dPfed dQfed dRfed dSfed dTfed dUfed dVfed dWfed dXfed dYfed dZfed d[fed d\fed d]fed d^fed d_fed d`fed dafed dbfed dcfed ddfed defed dffed dgfed dhfed difed djfed dkfed dlfed dmfedndofedndpfedndqfedndrfedndsfedndtfedndufedndvfedndwfedndxfedndyfedndzfednd{fednd|fednd}fednd~fedndfedndfedndfedndfedndfedndfedndfedndfedndfedndfedndfedd feddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddffZed4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddded1dfddddddddddddddddddddddddddddddddddddddddedOdfedOdPfedOd%fdddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcddedOdfedOdfedOdfedOdfedOdPfedOdfedOd%fed1dfed1dfed1dfdedfdgdhfCZedidjdkdldmdndodpdqdrdsedOdfed1dff Zedtdudvdwdxdydzd{d|d}d~f ZedddddddddddddddfZedZedZedZedZedZejd1ejZd2e j fd3YZ dS(i(tabsolute_importtdivisiontunicode_literalsN(tescapetunescape(t urllib_parsei(tbasei(t namespacestprefixesuFilteruhtmluauabbruacronymuaddressuareauarticleuasideuaudioububigu blockquoteubrubuttonucanvasucaptionucenteruciteucodeucolucolgroupucommandudatagridudatalistuddudeludetailsudfnudialogudirudivudludtuemu event-sourceufieldsetu figcaptionufigureufooterufontuformuheaderuh1uh2uh3uh4uh5uh6uhruiuimguinputuinsukeygenukbdulabelulegenduliumumapumenuumeterumulticolunavunextiduoluoutputuoptgroupuoptionupupreuprogressuqususampusectionuselectusmallusoundusourceuspaceruspanustrikeustrongusubusuputableutbodyutdutextareautimeutfootuthutheadutruttuuuuluvaruvideoumathmlumactionumathumerrorumfracumiu mmultiscriptsumnumoumoverumpaddedumphantomu mprescriptsumrootumrowumspaceumsqrtumstyleumsubumsubsupumsupumtableumtdumtextumtrumunderu munderoverunoneusvguanimateu animateColoru animateMotionuanimateTransformuclipPathucircleudefsudescuellipseu font-faceufont-face-nameu font-face-srcuguglyphuhkernulinearGradientulineumarkerumetadatau missing-glyphumpathupathupolygonupolylineuradialGradienturectusetustopuswitchutextutitleutspanuuseuacceptuaccept-charsetu accesskeyuactionualignualtu autocompleteu autofocusuaxisu backgroundubalanceubgcoloru bgpropertiesuborderu bordercolorubordercolordarkubordercolorlightu bottompaddingu cellpaddingu cellspacinguchu challengeucharucharoffuchoffucharsetucheckeduclassuclearucolorucolsucolspanucompactucontenteditableucontrolsucoordsudataudatafldu datapagesizeudatasrcudatetimeudefaultudelayudisabledu draggableudynsrcuenctypeuendufaceuforuframeu galleryimgugutteruheadersuheightu hidefocusuhiddenuhighuhrefuhreflanguhspaceuiconuidu inputmodeuismapukeytypeu leftspacingulangulistulongdesculoopu loopcountuloopendu loopstartulowulowsrcumaxu maxlengthumediaumethoduminumultipleunameunohrefunoshadeunowrapuopenuoptimumupatternupingu point-sizeuposterupqgupreloadupromptu radiogroupureadonlyurelu repeat-maxu repeat-minureplaceurequiredurevu rightspacingurowsurowspanurulesuscopeuselectedushapeusizeusrcustartustepustyleusummaryusuppressutabindexutargetutemplateu toppaddingutypeu unselectableuusemapuurnuvalignuvalueuvariableuvolumeuvspaceuvrmluwidthuwrapuxmlu actiontypeu columnalignu columnlinesu columnspacingu columnspanudepthudisplayu displaystyleu equalcolumnsu equalrowsufenceu fontstyleu fontweightu linethicknessulspaceumathbackgroundu mathcoloru mathvariantumaxsizeuminsizeuotherurowalignurowlinesu rowspacingurspaceu scriptlevelu selectionu separatorustretchyuxlinkushowu accent-heightu accumulateuadditiveu alphabeticu arabic-formuascentu attributeNameu attributeTypeu baseProfileubboxubeginubyucalcModeu cap-heightu clip-pathucolor-renderingucontentucxucyududxudyudescentudurufillu fill-opacityu fill-ruleu font-familyu font-sizeu font-stretchu font-styleu font-variantu font-weightufromufxufyug1ug2u glyph-nameu gradientUnitsuhangingu horiz-adv-xuhoriz-origin-xu ideographicuku keyPointsu keySplinesukeyTimesu marker-endu marker-midu marker-startu markerHeightu markerUnitsu markerWidthu mathematicaluoffsetuopacityuorientuoriginuoverline-positionuoverline-thicknessupanose-1u pathLengthupointsupreserveAspectRatioururefXurefYu repeatCountu repeatDururequiredExtensionsurequiredFeaturesurestarturotateurxuryuslopeustemhustemvu stop-coloru stop-opacityustrikethrough-positionustrikethrough-thicknessustrokeustroke-dasharrayustroke-dashoffsetustroke-linecapustroke-linejoinustroke-miterlimitustroke-opacityu stroke-widthusystemLanguageu text-anchorutou transformuu1uu2uunderline-positionuunderline-thicknessuunicodeu unicode-rangeu units-per-emuvaluesuversionuviewBoxu visibilityuwidthsuxux-heightux1ux2uactuateuarcroleuroleubaseuspaceuyuy1uy2u zoomAndPanu color-profileucursorufilterumaskualtGlyphufeImageutextpathutrefuazimuthubackground-coloruborder-bottom-coloruborder-collapseu border-coloruborder-left-coloruborder-right-coloruborder-top-coloru directionu elevationufloatuletter-spacingu line-heightuoverflowupauseu pause-afteru pause-beforeupitchu pitch-rangeurichnessuspeaku speak-headeru speak-numeraluspeak-punctuationu speech-rateustressu text-alignutext-decorationu text-indentu unicode-bidiuvertical-alignu voice-familyu white-spaceuautouaquaublackublockublueuboldubothubottomubrownucollapseudashedudottedufuchsiaugrayugreenu !importantuitaliculeftulimeumaroonumediumunavyunormaluoliveupointerupurpleuredurightusolidusilverutealutopu transparentu underlineuwhiteuyellowued2kuftpuhttpuhttpsuircumailtounewsugopherunntputelnetuwebcaluxmppucalltoufeeduaimursyncutagusshusftpurtspuafsu image/pngu image/jpegu image/gifu image/webpu image/bmpu text/plainuL ^ # Match a content type / (?P[-a-zA-Z0-9.]+/[-a-zA-Z0-9.]+) # Match any character set and encoding (?:(?:;charset=(?:[-a-zA-Z0-9]+)(?:;(?:base64))?) |(?:;(?:base64))?(?:;charset=(?:[-a-zA-Z0-9]+))?) # Assume the rest is data ,.* $ tFilterc B`sbeZdZeeeeeee e e e d Z dZdZdZdZdZRS(uA sanitization of XHTML+MathML+SVG and of inline style attributes.c C`sttt|j|||_||_||_||_||_||_||_ | |_ | |_ | |_ dS(N( tsuperR t__init__tallowed_elementstallowed_attributestallowed_css_propertiestallowed_css_keywordstallowed_svg_propertiestallowed_protocolstallowed_content_typestattr_val_is_uritsvg_attr_val_allows_reftsvg_allow_local_href( tselftsourceR R RRRRRRRR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyR s          cc`s>x7tjj|D]#}|j|}|r|VqqWdS(N(RR t__iter__tsanitize_token(Rttoken((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyRscC`s|d}|d kr|d}|d}||f|jksd|dkrqtd|f|jkrq|j|S|j|Sn|dkrn|SdS( NutypeuStartTaguEndTaguEmptyTagunameu namespaceuhtmluComment(uStartTaguEndTaguEmptyTag(R tNoneRt allowed_tokentdisallowed_token(RRt token_typetnamet namespace((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyRs       c C`s9d|kr5|d}t|j}x-||jD]}|d|=|j|q6Wx||j@D]}tjddt||j}|j dd}yt j |}Wnt k rd}||=nX|rf|j rf|j |jkr||=n|j dkr[tj|j}|s3||=qX|jd|jkrX||=qXq[qfqfWxC|jD]8}||kritjddt||||unameudatau %s="%s"u%s:%su<%s%s>uu<%s>u selfClosingiu/>u Characters(titemstappendRRRtjointget(RRRR1tnsRtv((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyR2s   #A$ cC`sctjdjd|}tjd|s1dStjd|sGdSg}xtjd|D]\}}|sxq`n|j|jkr|j|d|dq`|jd d jdkr!x|jD],}||j krtjd| rPqqW|j|d|dq`|j|j kr`|j|d|dq`q`Wdj |S(Nuurl\s*\(\s*[^\s)]+?\s*\)\s*u u@^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$uu ^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$u([-\w]+)\s*:\s*([^:;]*)u: u;u-iu backgrounduborderumarginupaddingu\^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$(u backgrounduborderumarginupadding( R$tcompileR%R,tfindallR&RR9tsplitRRR:(Rtstyletcleantproptvaluetkeyword((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyR0Fs*  (t__name__t __module__t__doc__R R RRRRRRRRR RRRRR0(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyR s    2 (Nuabbr(Nuaccept(Nuaccept-charset(Nu accesskey(Nuaction(Nualign(Nualt(Nu autocomplete(Nu autofocus(Nuaxis(Nu background(Nubalance(Nubgcolor(Nu bgproperties(Nuborder(Nu bordercolor(Nubordercolordark(Nubordercolorlight(Nu bottompadding(Nu cellpadding(Nu cellspacing(Nuch(Nu challenge(Nuchar(Nucharoff(Nuchoff(Nucharset(Nuchecked(Nucite(Nuclass(Nuclear(Nucolor(Nucols(Nucolspan(Nucompact(Nucontenteditable(Nucontrols(Nucoords(Nudata(Nudatafld(Nu datapagesize(Nudatasrc(Nudatetime(Nudefault(Nudelay(Nudir(Nudisabled(Nu draggable(Nudynsrc(Nuenctype(Nuend(Nuface(Nufor(Nuform(Nuframe(Nu galleryimg(Nugutter(Nuheaders(Nuheight(Nu hidefocus(Nuhidden(Nuhigh(Nuhref(Nuhreflang(Nuhspace(Nuicon(Nuid(Nu inputmode(Nuismap(Nukeytype(Nulabel(Nu leftspacing(Nulang(Nulist(Nulongdesc(Nuloop(Nu loopcount(Nuloopend(Nu loopstart(Nulow(Nulowsrc(Numax(Nu maxlength(Numedia(Numethod(Numin(Numultiple(Nuname(Nunohref(Nunoshade(Nunowrap(Nuopen(Nuoptimum(Nupattern(Nuping(Nu point-size(Nuposter(Nupqg(Nupreload(Nuprompt(Nu radiogroup(Nureadonly(Nurel(Nu repeat-max(Nu repeat-min(Nureplace(Nurequired(Nurev(Nu rightspacing(Nurows(Nurowspan(Nurules(Nuscope(Nuselected(Nushape(Nusize(Nuspan(Nusrc(Nustart(Nustep(Nustyle(Nusummary(Nusuppress(Nutabindex(Nutarget(Nutemplate(Nutitle(Nu toppadding(Nutype(Nu unselectable(Nuusemap(Nuurn(Nuvalign(Nuvalue(Nuvariable(Nuvolume(Nuvspace(Nuvrml(Nuwidth(Nuwrap(Nu actiontype(Nualign(Nu columnalign(Nu columnalign(Nu columnalign(Nu columnlines(Nu columnspacing(Nu columnspan(Nudepth(Nudisplay(Nu displaystyle(Nu equalcolumns(Nu equalrows(Nufence(Nu fontstyle(Nu fontweight(Nuframe(Nuheight(Nu linethickness(Nulspace(Numathbackground(Nu mathcolor(Nu mathvariant(Nu mathvariant(Numaxsize(Numinsize(Nuother(Nurowalign(Nurowalign(Nurowalign(Nurowlines(Nu rowspacing(Nurowspan(Nurspace(Nu scriptlevel(Nu selection(Nu separator(Nustretchy(Nuwidth(Nuwidth(Nu accent-height(Nu accumulate(Nuadditive(Nu alphabetic(Nu arabic-form(Nuascent(Nu attributeName(Nu attributeType(Nu baseProfile(Nubbox(Nubegin(Nuby(NucalcMode(Nu cap-height(Nuclass(Nu clip-path(Nucolor(Nucolor-rendering(Nucontent(Nucx(Nucy(Nud(Nudx(Nudy(Nudescent(Nudisplay(Nudur(Nuend(Nufill(Nu fill-opacity(Nu fill-rule(Nu font-family(Nu font-size(Nu font-stretch(Nu font-style(Nu font-variant(Nu font-weight(Nufrom(Nufx(Nufy(Nug1(Nug2(Nu glyph-name(Nu gradientUnits(Nuhanging(Nuheight(Nu horiz-adv-x(Nuhoriz-origin-x(Nuid(Nu ideographic(Nuk(Nu keyPoints(Nu keySplines(NukeyTimes(Nulang(Nu marker-end(Nu marker-mid(Nu marker-start(Nu markerHeight(Nu markerUnits(Nu markerWidth(Nu mathematical(Numax(Numin(Nuname(Nuoffset(Nuopacity(Nuorient(Nuorigin(Nuoverline-position(Nuoverline-thickness(Nupanose-1(Nupath(Nu pathLength(Nupoints(NupreserveAspectRatio(Nur(NurefX(NurefY(Nu repeatCount(Nu repeatDur(NurequiredExtensions(NurequiredFeatures(Nurestart(Nurotate(Nurx(Nury(Nuslope(Nustemh(Nustemv(Nu stop-color(Nu stop-opacity(Nustrikethrough-position(Nustrikethrough-thickness(Nustroke(Nustroke-dasharray(Nustroke-dashoffset(Nustroke-linecap(Nustroke-linejoin(Nustroke-miterlimit(Nustroke-opacity(Nu stroke-width(NusystemLanguage(Nutarget(Nu text-anchor(Nuto(Nu transform(Nutype(Nuu1(Nuu2(Nuunderline-position(Nuunderline-thickness(Nuunicode(Nu unicode-range(Nu units-per-em(Nuvalues(Nuversion(NuviewBox(Nu visibility(Nuwidth(Nuwidths(Nux(Nux-height(Nux1(Nux2(Nuy(Nuy1(Nuy2(Nu zoomAndPan(Nuhref(Nusrc(Nucite(Nuaction(Nulongdesc(Nuposter(Nu background(Nudatasrc(Nudynsrc(Nulowsrc(Nuping(Nu clip-path(Nu color-profile(Nucursor(Nufill(Nufilter(Numarker(Nu marker-start(Nu marker-mid(Nu marker-end(Numask(Nustroke(NualtGlyph(Nuanimate(Nu animateColor(Nu animateMotion(NuanimateTransform(Nucursor(NufeImage(Nufilter(NulinearGradient(Nupattern(NuradialGradient(Nutextpath(Nutref(Nuset(Nuuse(.uazimuthubackground-coloruborder-bottom-coloruborder-collapseu border-coloruborder-left-coloruborder-right-coloruborder-top-coloruclearucolorucursoru directionudisplayu elevationufloatufontu font-familyu font-sizeu font-styleu font-variantu font-weightuheightuletter-spacingu line-heightuoverflowupauseu pause-afteru pause-beforeupitchu pitch-rangeurichnessuspeaku speak-headeru speak-numeraluspeak-punctuationu speech-rateustressu text-alignutext-decorationu text-indentu unicode-bidiuvertical-alignu voice-familyuvolumeu white-spaceuwidth('uautouaquaublackublockublueuboldubothubottomubrownucenterucollapseudashedudottedufuchsiaugrayugreenu !importantuitaliculeftulimeumaroonumediumunoneunavyunormalunowrapuoliveupointerupurpleuredurightusolidusilverutealutopu transparentu underlineuwhiteuyellow(ufillu fill-opacityu fill-ruleustrokeu stroke-widthustroke-linecapustroke-linejoinustroke-opacity(ued2kuftpuhttpuhttpsuircumailtounewsugopherunntputelnetuwebcaluxmppucalltoufeeduurnuaimursyncutagusshusftpurtspuafsudata(u image/pngu image/jpegu image/gifu image/webpu image/bmpu text/plain(!t __future__RRRR$txml.sax.saxutilsRRtpip._vendor.six.movesRR(tRt constantsRRt__all__t frozensetR RR RRRRRRRRR>tVERBOSER+R (((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyts2                                                                                                                                                                                           site-packages/pip/_vendor/html5lib/filters/whitespace.py000064400000002163147204247350017420 0ustar00from __future__ import absolute_import, division, unicode_literals import re from . import base from ..constants import rcdataElements, spaceCharacters spaceCharacters = "".join(spaceCharacters) SPACES_REGEX = re.compile("[%s]+" % spaceCharacters) class Filter(base.Filter): spacePreserveElements = frozenset(["pre", "textarea"] + list(rcdataElements)) def __iter__(self): preserve = 0 for token in base.Filter.__iter__(self): type = token["type"] if type == "StartTag" \ and (preserve or token["name"] in self.spacePreserveElements): preserve += 1 elif type == "EndTag" and preserve: preserve -= 1 elif not preserve and type == "SpaceCharacters" and token["data"]: # Test on token["data"] above to not introduce spaces where there were not token["data"] = " " elif not preserve and type == "Characters": token["data"] = collapse_spaces(token["data"]) yield token def collapse_spaces(text): return SPACES_REGEX.sub(' ', text) site-packages/pip/_vendor/html5lib/filters/whitespace.pyc000064400000003177147204247350017571 0ustar00 abc@`sddlmZmZmZddlZddlmZddlmZm Z dj e Z ej de Z d ej fd YZ d ZdS( i(tabsolute_importtdivisiontunicode_literalsNi(tbasei(trcdataElementstspaceCharactersuu[%s]+tFiltercB`s-eZeddgeeZdZRS(upreutextareacc`sd}xtjj|D]}|d}|dkr[|sN|d|jkr[|d7}ns|dkrz|rz|d8}nT| r|dkr|drd |ds site-packages/pip/_vendor/html5lib/filters/whitespace.pyo000064400000003177147204247350017605 0ustar00 abc@`sddlmZmZmZddlZddlmZddlmZm Z dj e Z ej de Z d ej fd YZ d ZdS( i(tabsolute_importtdivisiontunicode_literalsNi(tbasei(trcdataElementstspaceCharactersuu[%s]+tFiltercB`s-eZeddgeeZdZRS(upreutextareacc`sd}xtjj|D]}|d}|dkr[|sN|d|jkr[|d7}ns|dkrz|rz|d8}nT| r|dkr|drd |ds site-packages/pip/_vendor/html5lib/treeadapters/__init__.py000064400000000320147204247350020027 0ustar00from __future__ import absolute_import, division, unicode_literals from . import sax __all__ = ["sax"] try: from . import genshi # noqa except ImportError: pass else: __all__.append("genshi") site-packages/pip/_vendor/html5lib/treeadapters/__init__.pyc000064400000000746147204247350020206 0ustar00 abc@`snddlmZmZmZddlmZdgZyddlmZWnek r\nXej ddS(i(tabsolute_importtdivisiontunicode_literalsi(tsaxusax(tgenshiugenshiN( t __future__RRRtRt__all__Rt ImportErrortappend(((sN/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treeadapters/__init__.pyts  site-packages/pip/_vendor/html5lib/treeadapters/__init__.pyo000064400000000746147204247350020222 0ustar00 abc@`snddlmZmZmZddlmZdgZyddlmZWnek r\nXej ddS(i(tabsolute_importtdivisiontunicode_literalsi(tsaxusax(tgenshiugenshiN( t __future__RRRtRt__all__Rt ImportErrortappend(((sN/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treeadapters/__init__.pyts  site-packages/pip/_vendor/html5lib/treeadapters/genshi.py000064400000003023147204247350017550 0ustar00from __future__ import absolute_import, division, unicode_literals from genshi.core import QName, Attrs from genshi.core import START, END, TEXT, COMMENT, DOCTYPE def to_genshi(walker): text = [] for token in walker: type = token["type"] if type in ("Characters", "SpaceCharacters"): text.append(token["data"]) elif text: yield TEXT, "".join(text), (None, -1, -1) text = [] if type in ("StartTag", "EmptyTag"): if token["namespace"]: name = "{%s}%s" % (token["namespace"], token["name"]) else: name = token["name"] attrs = Attrs([(QName("{%s}%s" % attr if attr[0] is not None else attr[1]), value) for attr, value in token["data"].items()]) yield (START, (QName(name), attrs), (None, -1, -1)) if type == "EmptyTag": type = "EndTag" if type == "EndTag": if token["namespace"]: name = "{%s}%s" % (token["namespace"], token["name"]) else: name = token["name"] yield END, QName(name), (None, -1, -1) elif type == "Comment": yield COMMENT, token["data"], (None, -1, -1) elif type == "Doctype": yield DOCTYPE, (token["name"], token["publicId"], token["systemId"]), (None, -1, -1) else: pass # FIXME: What to do? if text: yield TEXT, "".join(text), (None, -1, -1) site-packages/pip/_vendor/html5lib/treeadapters/genshi.pyc000064400000003275147204247350017724 0ustar00 abc@`sgddlmZmZmZddlmZmZddlmZmZm Z m Z m Z dZ dS(i(tabsolute_importtdivisiontunicode_literals(tQNametAttrs(tSTARTtENDtTEXTtCOMMENTtDOCTYPEcc`sg}x|D]}|d}|dkr=|j|dn&|rctdj|dfVg}n|dkr)|d rd |d |d f}n |d }tg|djD]<\}}t|d dk rd |n|d |f^q}tt||fdfV|dkr)d}q)n|dkr{|d rZd |d |d f}n |d }tt|dfVq |dkrt |ddfVq |dkr t |d |d|dfdfVq q W|rtdj|dfVndS(Nutypeu CharactersuSpaceCharactersudatauiuStartTaguEmptyTagu namespaceu{%s}%sunameiiuEndTaguCommentuDoctypeupublicIdusystemId(u CharactersuSpaceCharacters(Nii(uStartTaguEmptyTag(Nii(Nii(Nii(Nii(Nii( tappendRtjointNoneRtitemsRRRRR (twalkerttextttokenttypetnametattrtvaluetattrs((sL/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treeadapters/genshi.pyt to_genshis<       S       N( t __future__RRRt genshi.coreRRRRRRR R(((sL/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treeadapters/genshi.pyts(site-packages/pip/_vendor/html5lib/treeadapters/genshi.pyo000064400000003275147204247350017740 0ustar00 abc@`sgddlmZmZmZddlmZmZddlmZmZm Z m Z m Z dZ dS(i(tabsolute_importtdivisiontunicode_literals(tQNametAttrs(tSTARTtENDtTEXTtCOMMENTtDOCTYPEcc`sg}x|D]}|d}|dkr=|j|dn&|rctdj|dfVg}n|dkr)|d rd |d |d f}n |d }tg|djD]<\}}t|d dk rd |n|d |f^q}tt||fdfV|dkr)d}q)n|dkr{|d rZd |d |d f}n |d }tt|dfVq |dkrt |ddfVq |dkr t |d |d|dfdfVq q W|rtdj|dfVndS(Nutypeu CharactersuSpaceCharactersudatauiuStartTaguEmptyTagu namespaceu{%s}%sunameiiuEndTaguCommentuDoctypeupublicIdusystemId(u CharactersuSpaceCharacters(Nii(uStartTaguEmptyTag(Nii(Nii(Nii(Nii(Nii( tappendRtjointNoneRtitemsRRRRR (twalkerttextttokenttypetnametattrtvaluetattrs((sL/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treeadapters/genshi.pyt to_genshis<       S       N( t __future__RRRt genshi.coreRRRRRRR R(((sL/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treeadapters/genshi.pyts(site-packages/pip/_vendor/html5lib/treeadapters/sax.py000064400000003175147204247350017076 0ustar00from __future__ import absolute_import, division, unicode_literals from xml.sax.xmlreader import AttributesNSImpl from ..constants import adjustForeignAttributes, unadjustForeignAttributes prefix_mapping = {} for prefix, localName, namespace in adjustForeignAttributes.values(): if prefix is not None: prefix_mapping[prefix] = namespace def to_sax(walker, handler): """Call SAX-like content handler based on treewalker walker""" handler.startDocument() for prefix, namespace in prefix_mapping.items(): handler.startPrefixMapping(prefix, namespace) for token in walker: type = token["type"] if type == "Doctype": continue elif type in ("StartTag", "EmptyTag"): attrs = AttributesNSImpl(token["data"], unadjustForeignAttributes) handler.startElementNS((token["namespace"], token["name"]), token["name"], attrs) if type == "EmptyTag": handler.endElementNS((token["namespace"], token["name"]), token["name"]) elif type == "EndTag": handler.endElementNS((token["namespace"], token["name"]), token["name"]) elif type in ("Characters", "SpaceCharacters"): handler.characters(token["data"]) elif type == "Comment": pass else: assert False, "Unknown token type" for prefix, namespace in prefix_mapping.items(): handler.endPrefixMapping(prefix) handler.endDocument() site-packages/pip/_vendor/html5lib/treeadapters/sax.pyc000064400000003341147204247350017234 0ustar00 abc@`sddlmZmZmZddlmZddlmZmZiZ x6ej D](\Z Z Z e dk rUe e e q>|dkrt|dt}|j|d|df|d||dkrJ|j|d|df|dqJq>|dkr |j|d|df|dq>|dkr)|j|dq>|d kr8q>t s>t d q>Wx'tjD]\}}|j |q[W|j d S(u8Call SAX-like content handler based on treewalker walkerutypeuDoctypeuStartTaguEmptyTagudatau namespaceunameuEndTagu CharactersuSpaceCharactersuCommentuUnknown token typeN(uStartTaguEmptyTag(u CharactersuSpaceCharacters( t startDocumenttprefix_mappingtitemststartPrefixMappingRRtstartElementNSt endElementNSt characterstFalsetAssertionErrortendPrefixMappingt endDocument(twalkerthandlertprefixt namespacettokenttypetattrs((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treeadapters/sax.pytto_sax s6           N(t __future__RRRtxml.sax.xmlreaderRt constantsRRRtvaluesRt localNameRtNoneR(((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treeadapters/sax.pyts site-packages/pip/_vendor/html5lib/treeadapters/sax.pyo000064400000003233147204247350017250 0ustar00 abc@`sddlmZmZmZddlmZddlmZmZiZ x6ej D](\Z Z Z e dk rUe e e q>|d krt|dt}|j|d|df|d||dkr8|j|d|df|dq8q>|dkr |j|d|df|dq>|dkr)|j|dq>|d kr>q>q>Wx'tjD]\}}|j |qIW|j d S(u8Call SAX-like content handler based on treewalker walkerutypeuDoctypeuStartTaguEmptyTagudatau namespaceunameuEndTagu CharactersuSpaceCharactersuCommentN(uStartTaguEmptyTag(u CharactersuSpaceCharacters( t startDocumenttprefix_mappingtitemststartPrefixMappingRRtstartElementNSt endElementNSt characterstendPrefixMappingt endDocument(twalkerthandlertprefixt namespacettokenttypetattrs((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treeadapters/sax.pytto_sax s6           N(t __future__RRRtxml.sax.xmlreaderRt constantsRRRtvaluesRt localNameRtNoneR(((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treeadapters/sax.pyts site-packages/pip/_vendor/html5lib/treebuilders/__init__.py000064400000006516147204247350020052 0ustar00"""A collection of modules for building different kinds of tree from HTML documents. To create a treebuilder for a new type of tree, you need to do implement several things: 1) A set of classes for various types of elements: Document, Doctype, Comment, Element. These must implement the interface of _base.treebuilders.Node (although comment nodes have a different signature for their constructor, see treebuilders.etree.Comment) Textual content may also be implemented as another node type, or not, as your tree implementation requires. 2) A treebuilder object (called TreeBuilder by convention) that inherits from treebuilders._base.TreeBuilder. This has 4 required attributes: documentClass - the class to use for the bottommost node of a document elementClass - the class to use for HTML Elements commentClass - the class to use for comments doctypeClass - the class to use for doctypes It also has one required method: getDocument - Returns the root node of the complete document tree 3) If you wish to run the unit tests, you must also create a testSerializer method on your treebuilder which accepts a node and returns a string containing Node and its children serialized according to the format used in the unittests """ from __future__ import absolute_import, division, unicode_literals from .._utils import default_etree treeBuilderCache = {} def getTreeBuilder(treeType, implementation=None, **kwargs): """Get a TreeBuilder class for various types of tree with built-in support treeType - the name of the tree type required (case-insensitive). Supported values are: "dom" - A generic builder for DOM implementations, defaulting to a xml.dom.minidom based implementation. "etree" - A generic builder for tree implementations exposing an ElementTree-like interface, defaulting to xml.etree.cElementTree if available and xml.etree.ElementTree if not. "lxml" - A etree-based builder for lxml.etree, handling limitations of lxml's implementation. implementation - (Currently applies to the "etree" and "dom" tree types). A module implementing the tree type e.g. xml.etree.ElementTree or xml.etree.cElementTree.""" treeType = treeType.lower() if treeType not in treeBuilderCache: if treeType == "dom": from . import dom # Come up with a sane default (pref. from the stdlib) if implementation is None: from xml.dom import minidom implementation = minidom # NEVER cache here, caching is done in the dom submodule return dom.getDomModule(implementation, **kwargs).TreeBuilder elif treeType == "lxml": from . import etree_lxml treeBuilderCache[treeType] = etree_lxml.TreeBuilder elif treeType == "etree": from . import etree if implementation is None: implementation = default_etree # NEVER cache here, caching is done in the etree submodule return etree.getETreeModule(implementation, **kwargs).TreeBuilder else: raise ValueError("""Unrecognised treebuilder "%s" """ % treeType) return treeBuilderCache.get(treeType) site-packages/pip/_vendor/html5lib/treebuilders/__init__.pyc000064400000006466147204247350020221 0ustar00 abc@`sHdZddlmZmZmZddlmZiZddZ dS(uA collection of modules for building different kinds of tree from HTML documents. To create a treebuilder for a new type of tree, you need to do implement several things: 1) A set of classes for various types of elements: Document, Doctype, Comment, Element. These must implement the interface of _base.treebuilders.Node (although comment nodes have a different signature for their constructor, see treebuilders.etree.Comment) Textual content may also be implemented as another node type, or not, as your tree implementation requires. 2) A treebuilder object (called TreeBuilder by convention) that inherits from treebuilders._base.TreeBuilder. This has 4 required attributes: documentClass - the class to use for the bottommost node of a document elementClass - the class to use for HTML Elements commentClass - the class to use for comments doctypeClass - the class to use for doctypes It also has one required method: getDocument - Returns the root node of the complete document tree 3) If you wish to run the unit tests, you must also create a testSerializer method on your treebuilder which accepts a node and returns a string containing Node and its children serialized according to the format used in the unittests i(tabsolute_importtdivisiontunicode_literalsi(t default_etreecK`s|j}|tkr|dkrlddlm}|d krYddlm}|}n|j||jS|dkrddlm }|jt|ssite-packages/pip/_vendor/html5lib/treebuilders/__init__.pyo000064400000006466147204247350020235 0ustar00 abc@`sHdZddlmZmZmZddlmZiZddZ dS(uA collection of modules for building different kinds of tree from HTML documents. To create a treebuilder for a new type of tree, you need to do implement several things: 1) A set of classes for various types of elements: Document, Doctype, Comment, Element. These must implement the interface of _base.treebuilders.Node (although comment nodes have a different signature for their constructor, see treebuilders.etree.Comment) Textual content may also be implemented as another node type, or not, as your tree implementation requires. 2) A treebuilder object (called TreeBuilder by convention) that inherits from treebuilders._base.TreeBuilder. This has 4 required attributes: documentClass - the class to use for the bottommost node of a document elementClass - the class to use for HTML Elements commentClass - the class to use for comments doctypeClass - the class to use for doctypes It also has one required method: getDocument - Returns the root node of the complete document tree 3) If you wish to run the unit tests, you must also create a testSerializer method on your treebuilder which accepts a node and returns a string containing Node and its children serialized according to the format used in the unittests i(tabsolute_importtdivisiontunicode_literalsi(t default_etreecK`s|j}|tkr|dkrlddlm}|d krYddlm}|}n|j||jS|dkrddlm }|jt|ssite-packages/pip/_vendor/html5lib/treebuilders/base.py000064400000033166147204247350017226 0ustar00from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type from ..constants import scopingElements, tableInsertModeElements, namespaces # The scope markers are inserted when entering object elements, # marquees, table cells, and table captions, and are used to prevent formatting # from "leaking" into tables, object elements, and marquees. Marker = None listElementsMap = { None: (frozenset(scopingElements), False), "button": (frozenset(scopingElements | set([(namespaces["html"], "button")])), False), "list": (frozenset(scopingElements | set([(namespaces["html"], "ol"), (namespaces["html"], "ul")])), False), "table": (frozenset([(namespaces["html"], "html"), (namespaces["html"], "table")]), False), "select": (frozenset([(namespaces["html"], "optgroup"), (namespaces["html"], "option")]), True) } class Node(object): def __init__(self, name): """Node representing an item in the tree. name - The tag name associated with the node parent - The parent of the current node (or None for the document node) value - The value of the current node (applies to text nodes and comments attributes - a dict holding name, value pairs for attributes of the node childNodes - a list of child nodes of the current node. This must include all elements but not necessarily other node types _flags - A list of miscellaneous flags that can be set on the node """ self.name = name self.parent = None self.value = None self.attributes = {} self.childNodes = [] self._flags = [] def __str__(self): attributesStr = " ".join(["%s=\"%s\"" % (name, value) for name, value in self.attributes.items()]) if attributesStr: return "<%s %s>" % (self.name, attributesStr) else: return "<%s>" % (self.name) def __repr__(self): return "<%s>" % (self.name) def appendChild(self, node): """Insert node as a child of the current node """ raise NotImplementedError def insertText(self, data, insertBefore=None): """Insert data as text in the current node, positioned before the start of node insertBefore or to the end of the node's text. """ raise NotImplementedError def insertBefore(self, node, refNode): """Insert node as a child of the current node, before refNode in the list of child nodes. Raises ValueError if refNode is not a child of the current node""" raise NotImplementedError def removeChild(self, node): """Remove node from the children of the current node """ raise NotImplementedError def reparentChildren(self, newParent): """Move all the children of the current node to newParent. This is needed so that trees that don't store text as nodes move the text in the correct way """ # XXX - should this method be made more general? for child in self.childNodes: newParent.appendChild(child) self.childNodes = [] def cloneNode(self): """Return a shallow copy of the current node i.e. a node with the same name and attributes but with no parent or child nodes """ raise NotImplementedError def hasContent(self): """Return true if the node has children or text, false otherwise """ raise NotImplementedError class ActiveFormattingElements(list): def append(self, node): equalCount = 0 if node != Marker: for element in self[::-1]: if element == Marker: break if self.nodesEqual(element, node): equalCount += 1 if equalCount == 3: self.remove(element) break list.append(self, node) def nodesEqual(self, node1, node2): if not node1.nameTuple == node2.nameTuple: return False if not node1.attributes == node2.attributes: return False return True class TreeBuilder(object): """Base treebuilder implementation documentClass - the class to use for the bottommost node of a document elementClass - the class to use for HTML Elements commentClass - the class to use for comments doctypeClass - the class to use for doctypes """ # pylint:disable=not-callable # Document class documentClass = None # The class to use for creating a node elementClass = None # The class to use for creating comments commentClass = None # The class to use for creating doctypes doctypeClass = None # Fragment class fragmentClass = None def __init__(self, namespaceHTMLElements): if namespaceHTMLElements: self.defaultNamespace = "http://www.w3.org/1999/xhtml" else: self.defaultNamespace = None self.reset() def reset(self): self.openElements = [] self.activeFormattingElements = ActiveFormattingElements() # XXX - rename these to headElement, formElement self.headPointer = None self.formPointer = None self.insertFromTable = False self.document = self.documentClass() def elementInScope(self, target, variant=None): # If we pass a node in we match that. if we pass a string # match any node with that name exactNode = hasattr(target, "nameTuple") if not exactNode: if isinstance(target, text_type): target = (namespaces["html"], target) assert isinstance(target, tuple) listElements, invert = listElementsMap[variant] for node in reversed(self.openElements): if exactNode and node == target: return True elif not exactNode and node.nameTuple == target: return True elif (invert ^ (node.nameTuple in listElements)): return False assert False # We should never reach this point def reconstructActiveFormattingElements(self): # Within this algorithm the order of steps described in the # specification is not quite the same as the order of steps in the # code. It should still do the same though. # Step 1: stop the algorithm when there's nothing to do. if not self.activeFormattingElements: return # Step 2 and step 3: we start with the last element. So i is -1. i = len(self.activeFormattingElements) - 1 entry = self.activeFormattingElements[i] if entry == Marker or entry in self.openElements: return # Step 6 while entry != Marker and entry not in self.openElements: if i == 0: # This will be reset to 0 below i = -1 break i -= 1 # Step 5: let entry be one earlier in the list. entry = self.activeFormattingElements[i] while True: # Step 7 i += 1 # Step 8 entry = self.activeFormattingElements[i] clone = entry.cloneNode() # Mainly to get a new copy of the attributes # Step 9 element = self.insertElement({"type": "StartTag", "name": clone.name, "namespace": clone.namespace, "data": clone.attributes}) # Step 10 self.activeFormattingElements[i] = element # Step 11 if element == self.activeFormattingElements[-1]: break def clearActiveFormattingElements(self): entry = self.activeFormattingElements.pop() while self.activeFormattingElements and entry != Marker: entry = self.activeFormattingElements.pop() def elementInActiveFormattingElements(self, name): """Check if an element exists between the end of the active formatting elements and the last marker. If it does, return it, else return false""" for item in self.activeFormattingElements[::-1]: # Check for Marker first because if it's a Marker it doesn't have a # name attribute. if item == Marker: break elif item.name == name: return item return False def insertRoot(self, token): element = self.createElement(token) self.openElements.append(element) self.document.appendChild(element) def insertDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] doctype = self.doctypeClass(name, publicId, systemId) self.document.appendChild(doctype) def insertComment(self, token, parent=None): if parent is None: parent = self.openElements[-1] parent.appendChild(self.commentClass(token["data"])) def createElement(self, token): """Create an element but don't insert it anywhere""" name = token["name"] namespace = token.get("namespace", self.defaultNamespace) element = self.elementClass(name, namespace) element.attributes = token["data"] return element def _getInsertFromTable(self): return self._insertFromTable def _setInsertFromTable(self, value): """Switch the function used to insert an element from the normal one to the misnested table one and back again""" self._insertFromTable = value if value: self.insertElement = self.insertElementTable else: self.insertElement = self.insertElementNormal insertFromTable = property(_getInsertFromTable, _setInsertFromTable) def insertElementNormal(self, token): name = token["name"] assert isinstance(name, text_type), "Element %s not unicode" % name namespace = token.get("namespace", self.defaultNamespace) element = self.elementClass(name, namespace) element.attributes = token["data"] self.openElements[-1].appendChild(element) self.openElements.append(element) return element def insertElementTable(self, token): """Create an element and insert it into the tree""" element = self.createElement(token) if self.openElements[-1].name not in tableInsertModeElements: return self.insertElementNormal(token) else: # We should be in the InTable mode. This means we want to do # special magic element rearranging parent, insertBefore = self.getTableMisnestedNodePosition() if insertBefore is None: parent.appendChild(element) else: parent.insertBefore(element, insertBefore) self.openElements.append(element) return element def insertText(self, data, parent=None): """Insert text data.""" if parent is None: parent = self.openElements[-1] if (not self.insertFromTable or (self.insertFromTable and self.openElements[-1].name not in tableInsertModeElements)): parent.insertText(data) else: # We should be in the InTable mode. This means we want to do # special magic element rearranging parent, insertBefore = self.getTableMisnestedNodePosition() parent.insertText(data, insertBefore) def getTableMisnestedNodePosition(self): """Get the foster parent element, and sibling to insert before (or None) when inserting a misnested table node""" # The foster parent element is the one which comes before the most # recently opened table element # XXX - this is really inelegant lastTable = None fosterParent = None insertBefore = None for elm in self.openElements[::-1]: if elm.name == "table": lastTable = elm break if lastTable: # XXX - we should really check that this parent is actually a # node here if lastTable.parent: fosterParent = lastTable.parent insertBefore = lastTable else: fosterParent = self.openElements[ self.openElements.index(lastTable) - 1] else: fosterParent = self.openElements[0] return fosterParent, insertBefore def generateImpliedEndTags(self, exclude=None): name = self.openElements[-1].name # XXX td, th and tr are not actually needed if (name in frozenset(("dd", "dt", "li", "option", "optgroup", "p", "rp", "rt")) and name != exclude): self.openElements.pop() # XXX This is not entirely what the specification says. We should # investigate it more closely. self.generateImpliedEndTags(exclude) def getDocument(self): "Return the final tree" return self.document def getFragment(self): "Return the final fragment" # assert self.innerHTML fragment = self.fragmentClass() self.openElements[0].reparentChildren(fragment) return fragment def testSerializer(self, node): """Serialize the subtree of node in the format required by unit tests node - the node from which to start serializing""" raise NotImplementedError site-packages/pip/_vendor/html5lib/treebuilders/base.pyc000064400000033704147204247350017367 0ustar00 abc@`shddlmZmZmZddlmZddlmZmZm Z dZ ie ee fd6e eee ddfgBe fd6e eee ddfe ddfgBe fd 6e e ddfe dd fge fd 6e e dd fe dd fgefd 6ZdefdYZdefdYZdefdYZdS(i(tabsolute_importtdivisiontunicode_literals(t text_typei(tscopingElementsttableInsertModeElementst namespacesuhtmlubuttonuoluululistutableuoptgroupuoptionuselecttNodecB`seeZdZdZdZdZd dZdZdZ dZ dZ d Z RS( cC`s:||_d|_d|_i|_g|_g|_dS(u6Node representing an item in the tree. name - The tag name associated with the node parent - The parent of the current node (or None for the document node) value - The value of the current node (applies to text nodes and comments attributes - a dict holding name, value pairs for attributes of the node childNodes - a list of child nodes of the current node. This must include all elements but not necessarily other node types _flags - A list of miscellaneous flags that can be set on the node N(tnametNonetparenttvaluet attributest childNodest_flags(tselfR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt__init__s     cC`sadjg|jjD]\}}d||f^q}|rRd|j|fSd|jSdS(Nu u%s="%s"u<%s %s>u<%s>(tjoinR titemsR(RRR t attributesStr((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt__str__*s  2cC`s d|jS(Nu<%s>(R(R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt__repr__3scC`s tdS(u3Insert node as a child of the current node N(tNotImplementedError(Rtnode((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt appendChild6scC`s tdS(uInsert data as text in the current node, positioned before the start of node insertBefore or to the end of the node's text. N(R(Rtdatat insertBefore((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt insertText;scC`s tdS(uInsert node as a child of the current node, before refNode in the list of child nodes. Raises ValueError if refNode is not a child of the current nodeN(R(RRtrefNode((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyRAscC`s tdS(u:Remove node from the children of the current node N(R(RR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt removeChildGscC`s.x|jD]}|j|q Wg|_dS(uMove all the children of the current node to newParent. This is needed so that trees that don't store text as nodes move the text in the correct way N(R R(Rt newParenttchild((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pytreparentChildrenLscC`s tdS(uReturn a shallow copy of the current node i.e. a node with the same name and attributes but with no parent or child nodes N(R(R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt cloneNodeVscC`s tdS(uFReturn true if the node has children or text, false otherwise N(R(R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt hasContent\sN( t__name__t __module__RRRRR RRRR R!R"(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyRs       tActiveFormattingElementscB`seZdZdZRS(cC`sd}|tkrxj|dddD]R}|tkr<Pn|j||r[|d7}n|dkr&|j|Pq&q&Wntj||dS(Niiii(tMarkert nodesEqualtremovetlisttappend(RRt equalCounttelement((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyR*cs      cC`s0|j|jkstS|j|jks,tStS(N(t nameTupletFalseR tTrue(Rtnode1tnode2((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyR'ps (R#R$R*R'(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyR%bs t TreeBuildercB`seZdZdZdZdZdZdZdZ dZ ddZ dZ dZ dZdZdZdd Zd Zd Zd ZeeeZd ZdZddZdZddZdZdZdZRS(uBase treebuilder implementation documentClass - the class to use for the bottommost node of a document elementClass - the class to use for HTML Elements commentClass - the class to use for comments doctypeClass - the class to use for doctypes cC`s)|rd|_n d|_|jdS(Nuhttp://www.w3.org/1999/xhtml(tdefaultNamespaceR treset(RtnamespaceHTMLElements((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyRs  cC`sCg|_t|_d|_d|_t|_|j|_ dS(N( t openElementsR%tactiveFormattingElementsR t headPointert formPointerR.tinsertFromTablet documentClasstdocument(R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyR4s      cC`st|d}|sOt|tr7td|f}nt|tsOtnt|\}}x^t|jD]M}|r||krt S| r|j |krt S||j |kArot SqoWt stdS(Nu nameTupleuhtml( thasattrt isinstanceRRttupletAssertionErrortlistElementsMaptreversedR6R/R-R.(Rttargettvariantt exactNodet listElementstinvertR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pytelementInScopescC`s'|js dSt|jd}|j|}|tksH||jkrLdSxL|tkr||jkr|dkrd}Pn|d8}|j|}qOWxtr"|d7}|j|}|j}|jidd6|jd6|jd6|j d6}||j|<||jdkrPqqWdS( NiiiuStartTagutypeunameu namespaceudata( R7tlenR&R6R/R!t insertElementRt namespaceR (RtitentrytcloneR,((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt#reconstructActiveFormattingElementss.           cC`s>|jj}x(|jr9|tkr9|jj}qWdS(N(R7tpopR&(RRM((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pytclearActiveFormattingElementsscC`sHxA|jdddD])}|tkr-Pq|j|kr|SqWtS(uCheck if an element exists between the end of the active formatting elements and the last marker. If it does, return it, else return falseNi(R7R&RR.(RRtitem((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt!elementInActiveFormattingElementss  cC`s3|j|}|jj||jj|dS(N(t createElementR6R*R<R(RttokenR,((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt insertRootscC`sG|d}|d}|d}|j|||}|jj|dS(NunameupublicIdusystemId(t doctypeClassR<R(RRURtpublicIdtsystemIdtdoctype((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt insertDoctypes    cC`s:|dkr|jd}n|j|j|ddS(Niudata(R R6Rt commentClass(RRUR ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt insertComment s cC`sB|d}|jd|j}|j||}|d|_|S(u.Create an element but don't insert it anywhereunameu namespaceudata(tgetR3t elementClassR (RRURRKR,((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyRTs   cC`s|jS(N(t_insertFromTable(R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt_getInsertFromTablescC`s.||_|r|j|_n |j|_dS(usSwitch the function used to insert an element from the normal one to the misnested table one and back againN(R`tinsertElementTableRJtinsertElementNormal(RR ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt_setInsertFromTables cC`s|d}t|ts)td||jd|j}|j||}|d|_|jdj||jj ||S(NunameuElement %s not unicodeu namespaceudatai( R>RR@R^R3R_R R6RR*(RRURRKR,((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyRc$s  cC`s|j|}|jdjtkr2|j|S|j\}}|dkr`|j|n|j|||jj ||S(u-Create an element and insert it into the treeiN( RTR6RRRctgetTableMisnestedNodePositionR RRR*(RRUR,R R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyRb.s  cC`s{|dkr|jd}n|j sE|jrU|jdjtkrU|j|n"|j\}}|j||dS(uInsert text data.iN(R R6R:RRRRe(RRR R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyR>s   cC`sd}d}d}x7|jdddD]}|jdkr)|}Pq)q)W|r|jrm|j}|}q|j|jj|d}n |jd}||fS(usGet the foster parent element, and sibling to insert before (or None) when inserting a misnested table nodeNiutableii(R R6RR tindex(Rt lastTablet fosterParentRtelm((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyReMs    c C`sO|jdj}|td krK||krK|jj|j|ndS( Niuddudtuliuoptionuoptgroupupurpurt(uddudtuliuoptionuoptgroupupurpurt(R6Rt frozensetRPtgenerateImpliedEndTags(RtexcludeR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyRkgs   cC`s|jS(uReturn the final tree(R<(R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt getDocumentqscC`s$|j}|jdj||S(uReturn the final fragmenti(t fragmentClassR6R (Rtfragment((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt getFragmentus cC`s tdS(uzSerialize the subtree of node in the format required by unit tests node - the node from which to start serializingN(R(RR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyttestSerializer|sN(R#R$t__doc__R R;R_R\RWRnRR4RHRORQRSRVR[R]RTRaRdtpropertyR:RcRbRReRkRmRpRq(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyR2zs6   .             N(t __future__RRRtpip._vendor.sixRt constantsRRRR R&RjR.tsetR/RAtobjectRR)R%R2(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyts*! Ksite-packages/pip/_vendor/html5lib/treebuilders/base.pyo000064400000033473147204247350017406 0ustar00 abc@`shddlmZmZmZddlmZddlmZmZm Z dZ ie ee fd6e eee ddfgBe fd6e eee ddfe ddfgBe fd 6e e ddfe dd fge fd 6e e dd fe dd fgefd 6ZdefdYZdefdYZdefdYZdS(i(tabsolute_importtdivisiontunicode_literals(t text_typei(tscopingElementsttableInsertModeElementst namespacesuhtmlubuttonuoluululistutableuoptgroupuoptionuselecttNodecB`seeZdZdZdZdZd dZdZdZ dZ dZ d Z RS( cC`s:||_d|_d|_i|_g|_g|_dS(u6Node representing an item in the tree. name - The tag name associated with the node parent - The parent of the current node (or None for the document node) value - The value of the current node (applies to text nodes and comments attributes - a dict holding name, value pairs for attributes of the node childNodes - a list of child nodes of the current node. This must include all elements but not necessarily other node types _flags - A list of miscellaneous flags that can be set on the node N(tnametNonetparenttvaluet attributest childNodest_flags(tselfR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt__init__s     cC`sadjg|jjD]\}}d||f^q}|rRd|j|fSd|jSdS(Nu u%s="%s"u<%s %s>u<%s>(tjoinR titemsR(RRR t attributesStr((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt__str__*s  2cC`s d|jS(Nu<%s>(R(R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt__repr__3scC`s tdS(u3Insert node as a child of the current node N(tNotImplementedError(Rtnode((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt appendChild6scC`s tdS(uInsert data as text in the current node, positioned before the start of node insertBefore or to the end of the node's text. N(R(Rtdatat insertBefore((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt insertText;scC`s tdS(uInsert node as a child of the current node, before refNode in the list of child nodes. Raises ValueError if refNode is not a child of the current nodeN(R(RRtrefNode((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyRAscC`s tdS(u:Remove node from the children of the current node N(R(RR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt removeChildGscC`s.x|jD]}|j|q Wg|_dS(uMove all the children of the current node to newParent. This is needed so that trees that don't store text as nodes move the text in the correct way N(R R(Rt newParenttchild((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pytreparentChildrenLscC`s tdS(uReturn a shallow copy of the current node i.e. a node with the same name and attributes but with no parent or child nodes N(R(R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt cloneNodeVscC`s tdS(uFReturn true if the node has children or text, false otherwise N(R(R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt hasContent\sN( t__name__t __module__RRRRR RRRR R!R"(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyRs       tActiveFormattingElementscB`seZdZdZRS(cC`sd}|tkrxj|dddD]R}|tkr<Pn|j||r[|d7}n|dkr&|j|Pq&q&Wntj||dS(Niiii(tMarkert nodesEqualtremovetlisttappend(RRt equalCounttelement((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyR*cs      cC`s0|j|jkstS|j|jks,tStS(N(t nameTupletFalseR tTrue(Rtnode1tnode2((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyR'ps (R#R$R*R'(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyR%bs t TreeBuildercB`seZdZdZdZdZdZdZdZ dZ ddZ dZ dZ dZdZdZdd Zd Zd Zd ZeeeZd ZdZddZdZddZdZdZdZRS(uBase treebuilder implementation documentClass - the class to use for the bottommost node of a document elementClass - the class to use for HTML Elements commentClass - the class to use for comments doctypeClass - the class to use for doctypes cC`s)|rd|_n d|_|jdS(Nuhttp://www.w3.org/1999/xhtml(tdefaultNamespaceR treset(RtnamespaceHTMLElements((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyRs  cC`sCg|_t|_d|_d|_t|_|j|_ dS(N( t openElementsR%tactiveFormattingElementsR t headPointert formPointerR.tinsertFromTablet documentClasstdocument(R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyR4s      cC`st|d}|s:t|tr:td|f}q:nt|\}}x^t|jD]M}|rv||krvtS| r|j|krtS||j|kArZt SqZWdS(Nu nameTupleuhtml( thasattrt isinstanceRRtlistElementsMaptreversedR6R/R-R.(Rttargettvariantt exactNodet listElementstinvertR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pytelementInScopescC`s'|js dSt|jd}|j|}|tksH||jkrLdSxL|tkr||jkr|dkrd}Pn|d8}|j|}qOWxtr"|d7}|j|}|j}|jidd6|jd6|jd6|j d6}||j|<||jdkrPqqWdS( NiiiuStartTagutypeunameu namespaceudata( R7tlenR&R6R/R!t insertElementRt namespaceR (RtitentrytcloneR,((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt#reconstructActiveFormattingElementss.           cC`s>|jj}x(|jr9|tkr9|jj}qWdS(N(R7tpopR&(RRK((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pytclearActiveFormattingElementsscC`sHxA|jdddD])}|tkr-Pq|j|kr|SqWtS(uCheck if an element exists between the end of the active formatting elements and the last marker. If it does, return it, else return falseNi(R7R&RR.(RRtitem((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt!elementInActiveFormattingElementss  cC`s3|j|}|jj||jj|dS(N(t createElementR6R*R<R(RttokenR,((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt insertRootscC`sG|d}|d}|d}|j|||}|jj|dS(NunameupublicIdusystemId(t doctypeClassR<R(RRSRtpublicIdtsystemIdtdoctype((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt insertDoctypes    cC`s:|dkr|jd}n|j|j|ddS(Niudata(R R6Rt commentClass(RRSR ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt insertComment s cC`sB|d}|jd|j}|j||}|d|_|S(u.Create an element but don't insert it anywhereunameu namespaceudata(tgetR3t elementClassR (RRSRRIR,((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyRRs   cC`s|jS(N(t_insertFromTable(R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt_getInsertFromTablescC`s.||_|r|j|_n |j|_dS(usSwitch the function used to insert an element from the normal one to the misnested table one and back againN(R^tinsertElementTableRHtinsertElementNormal(RR ((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt_setInsertFromTables cC`sf|d}|jd|j}|j||}|d|_|jdj||jj||S(Nunameu namespaceudatai(R\R3R]R R6RR*(RRSRRIR,((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyRa$s  cC`s|j|}|jdjtkr2|j|S|j\}}|dkr`|j|n|j|||jj ||S(u-Create an element and insert it into the treeiN( RRR6RRRatgetTableMisnestedNodePositionR RRR*(RRSR,R R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyR`.s  cC`s{|dkr|jd}n|j sE|jrU|jdjtkrU|j|n"|j\}}|j||dS(uInsert text data.iN(R R6R:RRRRc(RRR R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyR>s   cC`sd}d}d}x7|jdddD]}|jdkr)|}Pq)q)W|r|jrm|j}|}q|j|jj|d}n |jd}||fS(usGet the foster parent element, and sibling to insert before (or None) when inserting a misnested table nodeNiutableii(R R6RR tindex(Rt lastTablet fosterParentRtelm((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyRcMs    c C`sO|jdj}|td krK||krK|jj|j|ndS( Niuddudtuliuoptionuoptgroupupurpurt(uddudtuliuoptionuoptgroupupurpurt(R6Rt frozensetRNtgenerateImpliedEndTags(RtexcludeR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyRigs   cC`s|jS(uReturn the final tree(R<(R((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt getDocumentqscC`s$|j}|jdj||S(uReturn the final fragmenti(t fragmentClassR6R (Rtfragment((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyt getFragmentus cC`s tdS(uzSerialize the subtree of node in the format required by unit tests node - the node from which to start serializingN(R(RR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyttestSerializer|sN(R#R$t__doc__R R;R]RZRURlRR4RFRMRORQRTRYR[RRR_RbtpropertyR:RaR`RRcRiRkRnRo(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyR2zs6   .             N(t __future__RRRtpip._vendor.sixRt constantsRRRR R&RhR.tsetR/R?tobjectRR)R%R2(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.pyts*! Ksite-packages/pip/_vendor/html5lib/treebuilders/dom.py000064400000021203147204247350017060 0ustar00from __future__ import absolute_import, division, unicode_literals from collections import MutableMapping from xml.dom import minidom, Node import weakref from . import base from .. import constants from ..constants import namespaces from .._utils import moduleFactoryFactory def getDomBuilder(DomImplementation): Dom = DomImplementation class AttrList(MutableMapping): def __init__(self, element): self.element = element def __iter__(self): return iter(self.element.attributes.keys()) def __setitem__(self, name, value): if isinstance(name, tuple): raise NotImplementedError else: attr = self.element.ownerDocument.createAttribute(name) attr.value = value self.element.attributes[name] = attr def __len__(self): return len(self.element.attributes) def items(self): return list(self.element.attributes.items()) def values(self): return list(self.element.attributes.values()) def __getitem__(self, name): if isinstance(name, tuple): raise NotImplementedError else: return self.element.attributes[name].value def __delitem__(self, name): if isinstance(name, tuple): raise NotImplementedError else: del self.element.attributes[name] class NodeBuilder(base.Node): def __init__(self, element): base.Node.__init__(self, element.nodeName) self.element = element namespace = property(lambda self: hasattr(self.element, "namespaceURI") and self.element.namespaceURI or None) def appendChild(self, node): node.parent = self self.element.appendChild(node.element) def insertText(self, data, insertBefore=None): text = self.element.ownerDocument.createTextNode(data) if insertBefore: self.element.insertBefore(text, insertBefore.element) else: self.element.appendChild(text) def insertBefore(self, node, refNode): self.element.insertBefore(node.element, refNode.element) node.parent = self def removeChild(self, node): if node.element.parentNode == self.element: self.element.removeChild(node.element) node.parent = None def reparentChildren(self, newParent): while self.element.hasChildNodes(): child = self.element.firstChild self.element.removeChild(child) newParent.element.appendChild(child) self.childNodes = [] def getAttributes(self): return AttrList(self.element) def setAttributes(self, attributes): if attributes: for name, value in list(attributes.items()): if isinstance(name, tuple): if name[0] is not None: qualifiedName = (name[0] + ":" + name[1]) else: qualifiedName = name[1] self.element.setAttributeNS(name[2], qualifiedName, value) else: self.element.setAttribute( name, value) attributes = property(getAttributes, setAttributes) def cloneNode(self): return NodeBuilder(self.element.cloneNode(False)) def hasContent(self): return self.element.hasChildNodes() def getNameTuple(self): if self.namespace is None: return namespaces["html"], self.name else: return self.namespace, self.name nameTuple = property(getNameTuple) class TreeBuilder(base.TreeBuilder): # pylint:disable=unused-variable def documentClass(self): self.dom = Dom.getDOMImplementation().createDocument(None, None, None) return weakref.proxy(self) def insertDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] domimpl = Dom.getDOMImplementation() doctype = domimpl.createDocumentType(name, publicId, systemId) self.document.appendChild(NodeBuilder(doctype)) if Dom == minidom: doctype.ownerDocument = self.dom def elementClass(self, name, namespace=None): if namespace is None and self.defaultNamespace is None: node = self.dom.createElement(name) else: node = self.dom.createElementNS(namespace, name) return NodeBuilder(node) def commentClass(self, data): return NodeBuilder(self.dom.createComment(data)) def fragmentClass(self): return NodeBuilder(self.dom.createDocumentFragment()) def appendChild(self, node): self.dom.appendChild(node.element) def testSerializer(self, element): return testSerializer(element) def getDocument(self): return self.dom def getFragment(self): return base.TreeBuilder.getFragment(self).element def insertText(self, data, parent=None): data = data if parent != self: base.TreeBuilder.insertText(self, data, parent) else: # HACK: allow text nodes as children of the document node if hasattr(self.dom, '_child_node_types'): # pylint:disable=protected-access if Node.TEXT_NODE not in self.dom._child_node_types: self.dom._child_node_types = list(self.dom._child_node_types) self.dom._child_node_types.append(Node.TEXT_NODE) self.dom.appendChild(self.dom.createTextNode(data)) implementation = DomImplementation name = None def testSerializer(element): element.normalize() rv = [] def serializeElement(element, indent=0): if element.nodeType == Node.DOCUMENT_TYPE_NODE: if element.name: if element.publicId or element.systemId: publicId = element.publicId or "" systemId = element.systemId or "" rv.append("""|%s""" % (' ' * indent, element.name, publicId, systemId)) else: rv.append("|%s" % (' ' * indent, element.name)) else: rv.append("|%s" % (' ' * indent,)) elif element.nodeType == Node.DOCUMENT_NODE: rv.append("#document") elif element.nodeType == Node.DOCUMENT_FRAGMENT_NODE: rv.append("#document-fragment") elif element.nodeType == Node.COMMENT_NODE: rv.append("|%s" % (' ' * indent, element.nodeValue)) elif element.nodeType == Node.TEXT_NODE: rv.append("|%s\"%s\"" % (' ' * indent, element.nodeValue)) else: if (hasattr(element, "namespaceURI") and element.namespaceURI is not None): name = "%s %s" % (constants.prefixes[element.namespaceURI], element.nodeName) else: name = element.nodeName rv.append("|%s<%s>" % (' ' * indent, name)) if element.hasAttributes(): attributes = [] for i in range(len(element.attributes)): attr = element.attributes.item(i) name = attr.nodeName value = attr.value ns = attr.namespaceURI if ns: name = "%s %s" % (constants.prefixes[ns], attr.localName) else: name = attr.nodeName attributes.append((name, value)) for name, value in sorted(attributes): rv.append('|%s%s="%s"' % (' ' * (indent + 2), name, value)) indent += 2 for child in element.childNodes: serializeElement(child, indent) serializeElement(element, 0) return "\n".join(rv) return locals() # The actual means to get a module! getDomModule = moduleFactoryFactory(getDomBuilder) site-packages/pip/_vendor/html5lib/treebuilders/dom.pyc000064400000026615147204247350017237 0ustar00 abc@`sddlmZmZmZddlmZddlmZmZddl Z ddl m Z ddl m Z dd l m Z dd lmZd ZeeZdS( i(tabsolute_importtdivisiontunicode_literals(tMutableMapping(tminidomtNodeNi(tbasei(t constants(t namespaces(tmoduleFactoryFactoryc`svdtfdYdtjffdYdtjffdY}dtS(NtAttrListcB`sPeZdZdZdZdZdZdZdZdZ RS(cS`s ||_dS(N(telement(tselfR ((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt__init__scS`st|jjjS(N(titerR t attributestkeys(R ((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt__iter__scS`sJt|trtn.|jjj|}||_||jj|:scS`s ||_|jj|jdS(N(tparentR t appendChild(R tnode((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR+=s cS`sH|jjj|}|r4|jj||jn|jj|dS(N(R RtcreateTextNodet insertBeforeR+(R tdataR.ttext((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt insertTextAscS`s&|jj|j|j||_dS(N(R R.R*(R R,trefNode((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR.HscS`s8|jj|jkr+|jj|jnd|_dS(N(R t parentNodet removeChildR(R*(R R,((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR4LscS`sOx?|jjrA|jj}|jj||jj|qWg|_dS(N(R t hasChildNodest firstChildR4R+t childNodes(R t newParenttchild((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pytreparentChildrenQs  c`s |jS(N(R (R (R (sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt getAttributesXscS`s|rxt|jD]~\}}t|tr|ddk r]|dd|d}n |d}|jj|d||q|jj||qWndS(Niu:ii(RRRRR(R tsetAttributeNSt setAttribute(R RRRt qualifiedName((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt setAttributes[s   c`s|jjtS(N(R t cloneNodetFalse(R (R$(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR@jscS`s |jjS(N(R R5(R ((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt hasContentmscS`s4|jdkr td|jfS|j|jfSdS(Nuhtml(t namespaceR(RR(R ((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt getNameTuplepsN(R"R#R tpropertyRCR+R(R1R.R4R:R;R?RR@RBRDt nameTuple((R R$(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR$5s         t TreeBuilderc`seZfdZfdZd fdZfdZfdZdZfdZ dZ dZ d d Z Z d ZRS( c`s+jjddd|_tj|S(N(tgetDOMImplementationtcreateDocumentR(tdomtweakreftproxy(R (tDom(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt documentClassysc`st|d}|d}|d}j}|j|||}|jj|tkrp|j|_ndS(NunameupublicIdusystemId(RHtcreateDocumentTypetdocumentR+RRJR(R ttokenRtpublicIdtsystemIdtdomimpltdoctype(RMR$(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt insertDoctype}s     c`sO|dkr0|jdkr0|jj|}n|jj||}|S(N(R(tdefaultNamespaceRJt createElementtcreateElementNS(R RRCR,(R$(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt elementClasssc`s|jj|S(N(RJt createComment(R R/(R$(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt commentClasssc`s|jjS(N(RJtcreateDocumentFragment(R (R$(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt fragmentClassscS`s|jj|jdS(N(RJR+R (R R,((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR+sc`s |S(N((R R (ttestSerializer(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR_scS`s|jS(N(RJ(R ((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt getDocumentscS`stjj|jS(N(RRGt getFragmentR (R ((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyRascS`s|}||kr+tjj|||nwt|jdrtj|jjkrt|jj|j_|jjj tjqn|jj |jj |dS(Nu_child_node_types( RRGR1R&RJRt TEXT_NODEt_child_node_typesRtappendR+R-(R R/R*((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR1s N(R"R#RNRVR(RZR\R^R+R_R`RaR1timplementationR((RMtDomImplementationR$R_(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyRGxs     c`s?|jgdfd|ddjS(Nic `s|jtjkr|jr|js-|jrr|jp9d}|jpHd}jdd||j||fqjdd||jfqjdd|fn|jtjkrjdn|jtjkrjdn|jtj kr%jdd||j fnu|jtj krXjd d||j fnBt |d r|j dk rd tj|j |jf}n |j}jd d||f|jrg}xtt|jD]r}|jj|}|j}|j}|j } | r8d tj| |jf}n |j}|j||fqWx?t|D].\}}jd d|d||fqeWn|d7}x|jD]} | |qWdS(Nuu|%su u|%su|%su #documentu#document-fragmentu|%su|%s"%s"u namespaceURIu%s %su|%s<%s>u |%s%s="%s"i(tnodeTypeRtDOCUMENT_TYPE_NODERRRRSRdt DOCUMENT_NODEtDOCUMENT_FRAGMENT_NODEt COMMENT_NODEt nodeValueRbR&R'R(RtprefixesR%t hasAttributestrangeRRtitemRt localNametsortedR7( R tindentRRRSRRtiRRtnsR9(trvtserializeElement(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyRwsN  !!!      ) u (t normalizetjoin(R ((RvRwsI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR_s  . (RRRRGtlocals(RfRG((R RMRfR$R_sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt getDomBuilders $"C(: 6(t __future__RRRt collectionsRtxml.domRRRKtRRRt_utilsR R{t getDomModule(((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyts  site-packages/pip/_vendor/html5lib/treebuilders/dom.pyo000064400000026615147204247350017253 0ustar00 abc@`sddlmZmZmZddlmZddlmZmZddl Z ddl m Z ddl m Z dd l m Z dd lmZd ZeeZdS( i(tabsolute_importtdivisiontunicode_literals(tMutableMapping(tminidomtNodeNi(tbasei(t constants(t namespaces(tmoduleFactoryFactoryc`svdtfdYdtjffdYdtjffdY}dtS(NtAttrListcB`sPeZdZdZdZdZdZdZdZdZ RS(cS`s ||_dS(N(telement(tselfR ((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt__init__scS`st|jjjS(N(titerR t attributestkeys(R ((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt__iter__scS`sJt|trtn.|jjj|}||_||jj|:scS`s ||_|jj|jdS(N(tparentR t appendChild(R tnode((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR+=s cS`sH|jjj|}|r4|jj||jn|jj|dS(N(R RtcreateTextNodet insertBeforeR+(R tdataR.ttext((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt insertTextAscS`s&|jj|j|j||_dS(N(R R.R*(R R,trefNode((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR.HscS`s8|jj|jkr+|jj|jnd|_dS(N(R t parentNodet removeChildR(R*(R R,((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR4LscS`sOx?|jjrA|jj}|jj||jj|qWg|_dS(N(R t hasChildNodest firstChildR4R+t childNodes(R t newParenttchild((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pytreparentChildrenQs  c`s |jS(N(R (R (R (sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt getAttributesXscS`s|rxt|jD]~\}}t|tr|ddk r]|dd|d}n |d}|jj|d||q|jj||qWndS(Niu:ii(RRRRR(R tsetAttributeNSt setAttribute(R RRRt qualifiedName((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt setAttributes[s   c`s|jjtS(N(R t cloneNodetFalse(R (R$(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR@jscS`s |jjS(N(R R5(R ((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt hasContentmscS`s4|jdkr td|jfS|j|jfSdS(Nuhtml(t namespaceR(RR(R ((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt getNameTuplepsN(R"R#R tpropertyRCR+R(R1R.R4R:R;R?RR@RBRDt nameTuple((R R$(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR$5s         t TreeBuilderc`seZfdZfdZd fdZfdZfdZdZfdZ dZ dZ d d Z Z d ZRS( c`s+jjddd|_tj|S(N(tgetDOMImplementationtcreateDocumentR(tdomtweakreftproxy(R (tDom(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt documentClassysc`st|d}|d}|d}j}|j|||}|jj|tkrp|j|_ndS(NunameupublicIdusystemId(RHtcreateDocumentTypetdocumentR+RRJR(R ttokenRtpublicIdtsystemIdtdomimpltdoctype(RMR$(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt insertDoctype}s     c`sO|dkr0|jdkr0|jj|}n|jj||}|S(N(R(tdefaultNamespaceRJt createElementtcreateElementNS(R RRCR,(R$(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt elementClasssc`s|jj|S(N(RJt createComment(R R/(R$(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt commentClasssc`s|jjS(N(RJtcreateDocumentFragment(R (R$(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt fragmentClassscS`s|jj|jdS(N(RJR+R (R R,((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR+sc`s |S(N((R R (ttestSerializer(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR_scS`s|jS(N(RJ(R ((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt getDocumentscS`stjj|jS(N(RRGt getFragmentR (R ((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyRascS`s|}||kr+tjj|||nwt|jdrtj|jjkrt|jj|j_|jjj tjqn|jj |jj |dS(Nu_child_node_types( RRGR1R&RJRt TEXT_NODEt_child_node_typesRtappendR+R-(R R/R*((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR1s N(R"R#RNRVR(RZR\R^R+R_R`RaR1timplementationR((RMtDomImplementationR$R_(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyRGxs     c`s?|jgdfd|ddjS(Nic `s|jtjkr|jr|js-|jrr|jp9d}|jpHd}jdd||j||fqjdd||jfqjdd|fn|jtjkrjdn|jtjkrjdn|jtj kr%jdd||j fnu|jtj krXjd d||j fnBt |d r|j dk rd tj|j |jf}n |j}jd d||f|jrg}xtt|jD]r}|jj|}|j}|j}|j } | r8d tj| |jf}n |j}|j||fqWx?t|D].\}}jd d|d||fqeWn|d7}x|jD]} | |qWdS(Nuu|%su u|%su|%su #documentu#document-fragmentu|%su|%s"%s"u namespaceURIu%s %su|%s<%s>u |%s%s="%s"i(tnodeTypeRtDOCUMENT_TYPE_NODERRRRSRdt DOCUMENT_NODEtDOCUMENT_FRAGMENT_NODEt COMMENT_NODEt nodeValueRbR&R'R(RtprefixesR%t hasAttributestrangeRRtitemRt localNametsortedR7( R tindentRRRSRRtiRRtnsR9(trvtserializeElement(sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyRwsN  !!!      ) u (t normalizetjoin(R ((RvRwsI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyR_s  . (RRRRGtlocals(RfRG((R RMRfR$R_sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyt getDomBuilders $"C(: 6(t __future__RRRt collectionsRtxml.domRRRKtRRRt_utilsR R{t getDomModule(((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.pyts  site-packages/pip/_vendor/html5lib/treebuilders/etree.py000064400000030734147204247350017416 0ustar00from __future__ import absolute_import, division, unicode_literals # pylint:disable=protected-access from pip._vendor.six import text_type import re from . import base from .. import _ihatexml from .. import constants from ..constants import namespaces from .._utils import moduleFactoryFactory tag_regexp = re.compile("{([^}]*)}(.*)") def getETreeBuilder(ElementTreeImplementation, fullTree=False): ElementTree = ElementTreeImplementation ElementTreeCommentType = ElementTree.Comment("asd").tag class Element(base.Node): def __init__(self, name, namespace=None): self._name = name self._namespace = namespace self._element = ElementTree.Element(self._getETreeTag(name, namespace)) if namespace is None: self.nameTuple = namespaces["html"], self._name else: self.nameTuple = self._namespace, self._name self.parent = None self._childNodes = [] self._flags = [] def _getETreeTag(self, name, namespace): if namespace is None: etree_tag = name else: etree_tag = "{%s}%s" % (namespace, name) return etree_tag def _setName(self, name): self._name = name self._element.tag = self._getETreeTag(self._name, self._namespace) def _getName(self): return self._name name = property(_getName, _setName) def _setNamespace(self, namespace): self._namespace = namespace self._element.tag = self._getETreeTag(self._name, self._namespace) def _getNamespace(self): return self._namespace namespace = property(_getNamespace, _setNamespace) def _getAttributes(self): return self._element.attrib def _setAttributes(self, attributes): # Delete existing attributes first # XXX - there may be a better way to do this... for key in list(self._element.attrib.keys()): del self._element.attrib[key] for key, value in attributes.items(): if isinstance(key, tuple): name = "{%s}%s" % (key[2], key[1]) else: name = key self._element.set(name, value) attributes = property(_getAttributes, _setAttributes) def _getChildNodes(self): return self._childNodes def _setChildNodes(self, value): del self._element[:] self._childNodes = [] for element in value: self.insertChild(element) childNodes = property(_getChildNodes, _setChildNodes) def hasContent(self): """Return true if the node has children or text""" return bool(self._element.text or len(self._element)) def appendChild(self, node): self._childNodes.append(node) self._element.append(node._element) node.parent = self def insertBefore(self, node, refNode): index = list(self._element).index(refNode._element) self._element.insert(index, node._element) node.parent = self def removeChild(self, node): self._childNodes.remove(node) self._element.remove(node._element) node.parent = None def insertText(self, data, insertBefore=None): if not(len(self._element)): if not self._element.text: self._element.text = "" self._element.text += data elif insertBefore is None: # Insert the text as the tail of the last child element if not self._element[-1].tail: self._element[-1].tail = "" self._element[-1].tail += data else: # Insert the text before the specified node children = list(self._element) index = children.index(insertBefore._element) if index > 0: if not self._element[index - 1].tail: self._element[index - 1].tail = "" self._element[index - 1].tail += data else: if not self._element.text: self._element.text = "" self._element.text += data def cloneNode(self): element = type(self)(self.name, self.namespace) for name, value in self.attributes.items(): element.attributes[name] = value return element def reparentChildren(self, newParent): if newParent.childNodes: newParent.childNodes[-1]._element.tail += self._element.text else: if not newParent._element.text: newParent._element.text = "" if self._element.text is not None: newParent._element.text += self._element.text self._element.text = "" base.Node.reparentChildren(self, newParent) class Comment(Element): def __init__(self, data): # Use the superclass constructor to set all properties on the # wrapper element self._element = ElementTree.Comment(data) self.parent = None self._childNodes = [] self._flags = [] def _getData(self): return self._element.text def _setData(self, value): self._element.text = value data = property(_getData, _setData) class DocumentType(Element): def __init__(self, name, publicId, systemId): Element.__init__(self, "") self._element.text = name self.publicId = publicId self.systemId = systemId def _getPublicId(self): return self._element.get("publicId", "") def _setPublicId(self, value): if value is not None: self._element.set("publicId", value) publicId = property(_getPublicId, _setPublicId) def _getSystemId(self): return self._element.get("systemId", "") def _setSystemId(self, value): if value is not None: self._element.set("systemId", value) systemId = property(_getSystemId, _setSystemId) class Document(Element): def __init__(self): Element.__init__(self, "DOCUMENT_ROOT") class DocumentFragment(Element): def __init__(self): Element.__init__(self, "DOCUMENT_FRAGMENT") def testSerializer(element): rv = [] def serializeElement(element, indent=0): if not(hasattr(element, "tag")): element = element.getroot() if element.tag == "": if element.get("publicId") or element.get("systemId"): publicId = element.get("publicId") or "" systemId = element.get("systemId") or "" rv.append("""""" % (element.text, publicId, systemId)) else: rv.append("" % (element.text,)) elif element.tag == "DOCUMENT_ROOT": rv.append("#document") if element.text is not None: rv.append("|%s\"%s\"" % (' ' * (indent + 2), element.text)) if element.tail is not None: raise TypeError("Document node cannot have tail") if hasattr(element, "attrib") and len(element.attrib): raise TypeError("Document node cannot have attributes") elif element.tag == ElementTreeCommentType: rv.append("|%s" % (' ' * indent, element.text)) else: assert isinstance(element.tag, text_type), \ "Expected unicode, got %s, %s" % (type(element.tag), element.tag) nsmatch = tag_regexp.match(element.tag) if nsmatch is None: name = element.tag else: ns, name = nsmatch.groups() prefix = constants.prefixes[ns] name = "%s %s" % (prefix, name) rv.append("|%s<%s>" % (' ' * indent, name)) if hasattr(element, "attrib"): attributes = [] for name, value in element.attrib.items(): nsmatch = tag_regexp.match(name) if nsmatch is not None: ns, name = nsmatch.groups() prefix = constants.prefixes[ns] attr_string = "%s %s" % (prefix, name) else: attr_string = name attributes.append((attr_string, value)) for name, value in sorted(attributes): rv.append('|%s%s="%s"' % (' ' * (indent + 2), name, value)) if element.text: rv.append("|%s\"%s\"" % (' ' * (indent + 2), element.text)) indent += 2 for child in element: serializeElement(child, indent) if element.tail: rv.append("|%s\"%s\"" % (' ' * (indent - 2), element.tail)) serializeElement(element, 0) return "\n".join(rv) def tostring(element): # pylint:disable=unused-variable """Serialize an element and its child nodes to a string""" rv = [] filter = _ihatexml.InfosetFilter() def serializeElement(element): if isinstance(element, ElementTree.ElementTree): element = element.getroot() if element.tag == "": if element.get("publicId") or element.get("systemId"): publicId = element.get("publicId") or "" systemId = element.get("systemId") or "" rv.append("""""" % (element.text, publicId, systemId)) else: rv.append("" % (element.text,)) elif element.tag == "DOCUMENT_ROOT": if element.text is not None: rv.append(element.text) if element.tail is not None: raise TypeError("Document node cannot have tail") if hasattr(element, "attrib") and len(element.attrib): raise TypeError("Document node cannot have attributes") for child in element: serializeElement(child) elif element.tag == ElementTreeCommentType: rv.append("" % (element.text,)) else: # This is assumed to be an ordinary element if not element.attrib: rv.append("<%s>" % (filter.fromXmlName(element.tag),)) else: attr = " ".join(["%s=\"%s\"" % ( filter.fromXmlName(name), value) for name, value in element.attrib.items()]) rv.append("<%s %s>" % (element.tag, attr)) if element.text: rv.append(element.text) for child in element: serializeElement(child) rv.append("" % (element.tag,)) if element.tail: rv.append(element.tail) serializeElement(element) return "".join(rv) class TreeBuilder(base.TreeBuilder): # pylint:disable=unused-variable documentClass = Document doctypeClass = DocumentType elementClass = Element commentClass = Comment fragmentClass = DocumentFragment implementation = ElementTreeImplementation def testSerializer(self, element): return testSerializer(element) def getDocument(self): if fullTree: return self.document._element else: if self.defaultNamespace is not None: return self.document._element.find( "{%s}html" % self.defaultNamespace) else: return self.document._element.find("html") def getFragment(self): return base.TreeBuilder.getFragment(self)._element return locals() getETreeModule = moduleFactoryFactory(getETreeBuilder) site-packages/pip/_vendor/html5lib/treebuilders/etree.pyc000064400000034705147204247350017563 0ustar00 abc@`sddlmZmZmZddlmZddlZddlmZddlm Z ddlm Z dd l m Z dd l m Z ejd Zed Ze eZdS( i(tabsolute_importtdivisiontunicode_literals(t text_typeNi(tbasei(t _ihatexml(t constants(t namespaces(tmoduleFactoryFactoryu {([^}]*)}(.*)c `sjdjdtjffdYdffdYdffdYdffd Yd ffd Yfd fd }dtjf fdY}tS(NuasdtElementc`seZdfdZdZdZdZeeeZdZ dZ ee e Z dZ dZ ee e ZdZd ZeeeZd Zd Zd Zd ZddZdZdZRS(c`s||_||_j|j|||_|dkrUtd|jf|_n|j|jf|_d|_g|_ g|_ dS(Nuhtml( t_namet _namespaceR t _getETreeTagt_elementtNoneRt nameTupletparentt _childNodest_flags(tselftnamet namespace(t ElementTree(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt__init__s     cS`s)|dkr|}nd||f}|S(Nu{%s}%s(R(RRRt etree_tag((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyR #s  cS`s+||_|j|j|j|j_dS(N(R R R R ttag(RR((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_setName*s cS`s|jS(N(R (R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_getName.scS`s+||_|j|j|j|j_dS(N(R R R R R(RR((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _setNamespace3s cS`s|jS(N(R (R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _getNamespace7scS`s |jjS(N(R tattrib(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_getAttributes<scS`sx-t|jjjD]}|jj|=qWx]|jD]O\}}t|trsd|d|df}n|}|jj||q=WdS(Nu{%s}%sii(tlistR Rtkeystitemst isinstancettupletset(Rt attributestkeytvalueR((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_setAttributes?scS`s|jS(N(R(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_getChildNodesMscS`s2|j2g|_x|D]}|j|qWdS(N(R Rt insertChild(RR(telement((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_setChildNodesPs  cS`st|jjpt|jS(u,Return true if the node has children or text(tboolR ttexttlen(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt hasContentXscS`s0|jj||jj|j||_dS(N(RtappendR R(Rtnode((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt appendChild\scS`s>t|jj|j}|jj||j||_dS(N(R R tindextinsertR(RR3trefNodeR5((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt insertBeforeascS`s0|jj||jj|jd|_dS(N(RtremoveR RR(RR3((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt removeChildfscS`s-t|js?|jjs*d|j_n|jj|7_n|dkr|jdjsnd|jd_n|jdj|7_nt|j}|j|j}|dkr|j|djsd|j|d_n|j|dj|7_n-|jjsd|j_n|jj|7_dS(Nuiii(R0R R/RttailR R5(RtdataR8tchildrenR5((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt insertTextks"    cS`sLt||j|j}x*|jjD]\}}||j|R@RC((R(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyR s*               tCommentc`s8eZfdZdZdZeeeZRS(c`s1j||_d|_g|_g|_dS(N(RHR RRRR(RR<(R(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRs  cS`s |jjS(N(R R/(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_getDatascS`s||j_dS(N(R R/(RR(((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_setDatas(RERFRRIRJRGR<((R(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRHs  t DocumentTypec`sYeZfdZdZdZeeeZdZdZeeeZ RS(c`s2j|d||j_||_||_dS(Nu (RR R/tpublicIdtsystemId(RRRLRM(R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRs  cS`s|jjddS(NupublicIdu(R tget(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _getPublicIdscS`s&|dk r"|jjd|ndS(NupublicId(RR R%(RR(((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _setPublicIds cS`s|jjddS(NusystemIdu(R RN(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _getSystemIdscS`s&|dk r"|jjd|ndS(NusystemId(RR R%(RR(((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _setSystemIds ( RERFRRORPRGRLRQRRRM((R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRKs    tDocumentc`seZfdZRS(c`sj|ddS(Nu DOCUMENT_ROOT(R(R(R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRs(RERFR((R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRSstDocumentFragmentc`seZfdZRS(c`sj|ddS(NuDOCUMENT_FRAGMENT(R(R(R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRs(RERFR((R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRTsc`s8gdfd|ddjS(Nic `st|ds|j}n|jdkr|jdsK|jdr|jdp]d}|jdprd}jd|j||fq0jd|jfn|jdkrMjd |jdk rjd d |d |jfn|jdk rtd nt|dr0t |j r0tdq0n|jkr}jdd ||jfnt |jt st dt|j|jftj|j}|dkr|j}n/|j\}}tj|}d||f}jdd ||ft|drg}x|j jD]r\}} tj|}|dk r|j\}}tj|}d||f} n|} |j| | fqJWx?t|D].\}} jdd |d || fqWn|jr0jd d |d |jfn|d 7}x|D]} | |qAW|jrjd d |d |jfndS(Nutagu upublicIdusystemIduuu u DOCUMENT_ROOTu #documentu|%s"%s"u iuDocument node cannot have tailuattribu$Document node cannot have attributesu|%suExpected unicode, got %s, %su%s %su|%s<%s>u |%s%s="%s"(thasattrtgetrootRRNR2R/RR;t TypeErrorR0RR#RtAssertionErrorR?t tag_regexptmatchtgroupsRtprefixesR"tsorted( R,tindentRLRMtnsmatchRtnstprefixR&R(t attr_stringtchild(tElementTreeCommentTypetrvtserializeElement(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRfs^  %!     ) %   u (tjoin(R,(Rd(ReRfsK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyttestSerializers7 c`sDgtjfd|djS(u4Serialize an element and its child nodes to a stringc`smt|jr!|j}n|jdkr|jdsN|jdr|jdp`d}|jdpud}jd|j||fqMjd|jfn|jdkrL|jdk rj|jn|jdk rt dnt |d r.t |j r.t d nx|D]}|q5Wn|jkrujd |jfn|j sjd j |jfn^d jg|j jD]%\}}dj ||f^q}jd|j|f|jrj|jnx|D]}|q"Wjd|jf|jrij|jndS(Nu upublicIdusystemIduuu u DOCUMENT_ROOTuDocument node cannot have tailuattribu$Document node cannot have attributesu u<%s>u u%s="%s"u<%s %s>u(R#RRVRRNR2R/RR;RWRUR0Rt fromXmlNameRgR"(R,RLRMRcRR(tattr(RRdtfilterReRf(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRfs@   # ;   u(Rt InfosetFilterRg(R,(RRd(RkReRfsK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyttostrings  - t TreeBuilderc`sSeZZZZZZZfdZfdZ dZ RS(c`s |S(N((RR,(Rh(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRhAsc`sPr|jjS|jdk r9|jjjd|jS|jjjdSdS(Nu{%s}htmluhtml(tdocumentR tdefaultNamespaceRtfind(R(tfullTree(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt getDocumentDs   cS`stjj|jS(N(RRnt getFragmentR (R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRtNs( RERFt documentClasst doctypeClasst elementClasst commentClasst fragmentClasstimplementationRhRsRt((RHRSRTRKR tElementTreeImplementationRrRh(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRn9s (RHRRRBRntlocals(R{RrRmRn(( RHRSRTRKR RRdR{RrRhsK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pytgetETreeBuilders~>64(t __future__RRRtpip._vendor.sixRtretRRRRt_utilsRtcompileRYtFalseR}tgetETreeModule(((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyts  Dsite-packages/pip/_vendor/html5lib/treebuilders/etree.pyo000064400000034512147204247350017573 0ustar00 abc@`sddlmZmZmZddlmZddlZddlmZddlm Z ddlm Z dd l m Z dd l m Z ejd Zed Ze eZdS( i(tabsolute_importtdivisiontunicode_literals(t text_typeNi(tbasei(t _ihatexml(t constants(t namespaces(tmoduleFactoryFactoryu {([^}]*)}(.*)c `sjdjdtjffdYdffdYdffdYdffd Yd ffd Yfd fd }dtjf fdY}tS(NuasdtElementc`seZdfdZdZdZdZeeeZdZ dZ ee e Z dZ dZ ee e ZdZd ZeeeZd Zd Zd Zd ZddZdZdZRS(c`s||_||_j|j|||_|dkrUtd|jf|_n|j|jf|_d|_g|_ g|_ dS(Nuhtml( t_namet _namespaceR t _getETreeTagt_elementtNoneRt nameTupletparentt _childNodest_flags(tselftnamet namespace(t ElementTree(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt__init__s     cS`s)|dkr|}nd||f}|S(Nu{%s}%s(R(RRRt etree_tag((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyR #s  cS`s+||_|j|j|j|j_dS(N(R R R R ttag(RR((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_setName*s cS`s|jS(N(R (R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_getName.scS`s+||_|j|j|j|j_dS(N(R R R R R(RR((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _setNamespace3s cS`s|jS(N(R (R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _getNamespace7scS`s |jjS(N(R tattrib(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_getAttributes<scS`sx-t|jjjD]}|jj|=qWx]|jD]O\}}t|trsd|d|df}n|}|jj||q=WdS(Nu{%s}%sii(tlistR Rtkeystitemst isinstancettupletset(Rt attributestkeytvalueR((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_setAttributes?scS`s|jS(N(R(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_getChildNodesMscS`s2|j2g|_x|D]}|j|qWdS(N(R Rt insertChild(RR(telement((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_setChildNodesPs  cS`st|jjpt|jS(u,Return true if the node has children or text(tboolR ttexttlen(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt hasContentXscS`s0|jj||jj|j||_dS(N(RtappendR R(Rtnode((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt appendChild\scS`s>t|jj|j}|jj||j||_dS(N(R R tindextinsertR(RR3trefNodeR5((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt insertBeforeascS`s0|jj||jj|jd|_dS(N(RtremoveR RR(RR3((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt removeChildfscS`s-t|js?|jjs*d|j_n|jj|7_n|dkr|jdjsnd|jd_n|jdj|7_nt|j}|j|j}|dkr|j|djsd|j|d_n|j|dj|7_n-|jjsd|j_n|jj|7_dS(Nuiii(R0R R/RttailR R5(RtdataR8tchildrenR5((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt insertTextks"    cS`sLt||j|j}x*|jjD]\}}||j|R@RC((R(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyR s*               tCommentc`s8eZfdZdZdZeeeZRS(c`s1j||_d|_g|_g|_dS(N(RHR RRRR(RR<(R(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRs  cS`s |jjS(N(R R/(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_getDatascS`s||j_dS(N(R R/(RR(((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_setDatas(RERFRRIRJRGR<((R(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRHs  t DocumentTypec`sYeZfdZdZdZeeeZdZdZeeeZ RS(c`s2j|d||j_||_||_dS(Nu (RR R/tpublicIdtsystemId(RRRLRM(R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRs  cS`s|jjddS(NupublicIdu(R tget(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _getPublicIdscS`s&|dk r"|jjd|ndS(NupublicId(RR R%(RR(((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _setPublicIds cS`s|jjddS(NusystemIdu(R RN(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _getSystemIdscS`s&|dk r"|jjd|ndS(NusystemId(RR R%(RR(((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _setSystemIds ( RERFRRORPRGRLRQRRRM((R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRKs    tDocumentc`seZfdZRS(c`sj|ddS(Nu DOCUMENT_ROOT(R(R(R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRs(RERFR((R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRSstDocumentFragmentc`seZfdZRS(c`sj|ddS(NuDOCUMENT_FRAGMENT(R(R(R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRs(RERFR((R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRTsc`s8gdfd|ddjS(Nic `sVt|ds|j}n|jdkr|jdsK|jdr|jdp]d}|jdprd}jd|j||fqjd|jfnM|jdkrMjd |jdk rjd d |d |jfn|jdk rtd nt|drt |j rtdqn|jkr}jdd ||jfnt j |j}|dkr|j}n/|j \}}tj|}d||f}jdd ||ft|drg}x|j jD]r\}} t j |}|dk ro|j \}}tj|}d||f} n|} |j| | fqWx?t|D].\}} jdd |d || fqWn|jrjd d |d |jfn|d 7}x|D]} | |q W|jrRjd d |d |jfndS(Nutagu upublicIdusystemIduuu u DOCUMENT_ROOTu #documentu|%s"%s"u iuDocument node cannot have tailuattribu$Document node cannot have attributesu|%su%s %su|%s<%s>u |%s%s="%s"(thasattrtgetrootRRNR2R/RR;t TypeErrorR0Rt tag_regexptmatchtgroupsRtprefixesR"tsorted( R,tindentRLRMtnsmatchRtnstprefixR&R(t attr_stringtchild(tElementTreeCommentTypetrvtserializeElement(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyResZ  %!     ) %   u (tjoin(R,(Rc(RdResK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyttestSerializers7 c`sDgtjfd|djS(u4Serialize an element and its child nodes to a stringc`smt|jr!|j}n|jdkr|jdsN|jdr|jdp`d}|jdpud}jd|j||fqMjd|jfn|jdkrL|jdk rj|jn|jdk rt dnt |d r.t |j r.t d nx|D]}|q5Wn|jkrujd |jfn|j sjd j |jfn^d jg|j jD]%\}}dj ||f^q}jd|j|f|jrj|jnx|D]}|q"Wjd|jf|jrij|jndS(Nu upublicIdusystemIduuu u DOCUMENT_ROOTuDocument node cannot have tailuattribu$Document node cannot have attributesu u<%s>u u%s="%s"u<%s %s>u(R#RRVRRNR2R/RR;RWRUR0Rt fromXmlNameRfR"(R,RLRMRbRR(tattr(RRctfilterRdRe(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRes@   # ;   u(Rt InfosetFilterRf(R,(RRc(RjRdResK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyttostrings  - t TreeBuilderc`sSeZZZZZZZfdZfdZ dZ RS(c`s |S(N((RR,(Rg(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRgAsc`sPr|jjS|jdk r9|jjjd|jS|jjjdSdS(Nu{%s}htmluhtml(tdocumentR tdefaultNamespaceRtfind(R(tfullTree(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt getDocumentDs   cS`stjj|jS(N(RRmt getFragmentR (R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRsNs( RERFt documentClasst doctypeClasst elementClasst commentClasst fragmentClasstimplementationRgRrRs((RHRSRTRKR tElementTreeImplementationRqRg(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRm9s (RHRRRBRmtlocals(RzRqRlRm(( RHRSRTRKR RRcRzRqRgsK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pytgetETreeBuilders~>64(t __future__RRRtpip._vendor.sixRtretRRRRt_utilsRtcompileRXtFalseR|tgetETreeModule(((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyts  Dsite-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.py000064400000033521147204247350020447 0ustar00"""Module for supporting the lxml.etree library. The idea here is to use as much of the native library as possible, without using fragile hacks like custom element names that break between releases. The downside of this is that we cannot represent all possible trees; specifically the following are known to cause problems: Text or comments as siblings of the root element Docypes with no name When any of these things occur, we emit a DataLossWarning """ from __future__ import absolute_import, division, unicode_literals # pylint:disable=protected-access import warnings import re import sys from . import base from ..constants import DataLossWarning from .. import constants from . import etree as etree_builders from .. import _ihatexml import lxml.etree as etree fullTree = True tag_regexp = re.compile("{([^}]*)}(.*)") comment_type = etree.Comment("asd").tag class DocumentType(object): def __init__(self, name, publicId, systemId): self.name = name self.publicId = publicId self.systemId = systemId class Document(object): def __init__(self): self._elementTree = None self._childNodes = [] def appendChild(self, element): self._elementTree.getroot().addnext(element._element) def _getChildNodes(self): return self._childNodes childNodes = property(_getChildNodes) def testSerializer(element): rv = [] infosetFilter = _ihatexml.InfosetFilter(preventDoubleDashComments=True) def serializeElement(element, indent=0): if not hasattr(element, "tag"): if hasattr(element, "getroot"): # Full tree case rv.append("#document") if element.docinfo.internalDTD: if not (element.docinfo.public_id or element.docinfo.system_url): dtd_str = "" % element.docinfo.root_name else: dtd_str = """""" % ( element.docinfo.root_name, element.docinfo.public_id, element.docinfo.system_url) rv.append("|%s%s" % (' ' * (indent + 2), dtd_str)) next_element = element.getroot() while next_element.getprevious() is not None: next_element = next_element.getprevious() while next_element is not None: serializeElement(next_element, indent + 2) next_element = next_element.getnext() elif isinstance(element, str) or isinstance(element, bytes): # Text in a fragment assert isinstance(element, str) or sys.version_info[0] == 2 rv.append("|%s\"%s\"" % (' ' * indent, element)) else: # Fragment case rv.append("#document-fragment") for next_element in element: serializeElement(next_element, indent + 2) elif element.tag == comment_type: rv.append("|%s" % (' ' * indent, element.text)) if hasattr(element, "tail") and element.tail: rv.append("|%s\"%s\"" % (' ' * indent, element.tail)) else: assert isinstance(element, etree._Element) nsmatch = etree_builders.tag_regexp.match(element.tag) if nsmatch is not None: ns = nsmatch.group(1) tag = nsmatch.group(2) prefix = constants.prefixes[ns] rv.append("|%s<%s %s>" % (' ' * indent, prefix, infosetFilter.fromXmlName(tag))) else: rv.append("|%s<%s>" % (' ' * indent, infosetFilter.fromXmlName(element.tag))) if hasattr(element, "attrib"): attributes = [] for name, value in element.attrib.items(): nsmatch = tag_regexp.match(name) if nsmatch is not None: ns, name = nsmatch.groups() name = infosetFilter.fromXmlName(name) prefix = constants.prefixes[ns] attr_string = "%s %s" % (prefix, name) else: attr_string = infosetFilter.fromXmlName(name) attributes.append((attr_string, value)) for name, value in sorted(attributes): rv.append('|%s%s="%s"' % (' ' * (indent + 2), name, value)) if element.text: rv.append("|%s\"%s\"" % (' ' * (indent + 2), element.text)) indent += 2 for child in element: serializeElement(child, indent) if hasattr(element, "tail") and element.tail: rv.append("|%s\"%s\"" % (' ' * (indent - 2), element.tail)) serializeElement(element, 0) return "\n".join(rv) def tostring(element): """Serialize an element and its child nodes to a string""" rv = [] def serializeElement(element): if not hasattr(element, "tag"): if element.docinfo.internalDTD: if element.docinfo.doctype: dtd_str = element.docinfo.doctype else: dtd_str = "" % element.docinfo.root_name rv.append(dtd_str) serializeElement(element.getroot()) elif element.tag == comment_type: rv.append("" % (element.text,)) else: # This is assumed to be an ordinary element if not element.attrib: rv.append("<%s>" % (element.tag,)) else: attr = " ".join(["%s=\"%s\"" % (name, value) for name, value in element.attrib.items()]) rv.append("<%s %s>" % (element.tag, attr)) if element.text: rv.append(element.text) for child in element: serializeElement(child) rv.append("" % (element.tag,)) if hasattr(element, "tail") and element.tail: rv.append(element.tail) serializeElement(element) return "".join(rv) class TreeBuilder(base.TreeBuilder): documentClass = Document doctypeClass = DocumentType elementClass = None commentClass = None fragmentClass = Document implementation = etree def __init__(self, namespaceHTMLElements, fullTree=False): builder = etree_builders.getETreeModule(etree, fullTree=fullTree) infosetFilter = self.infosetFilter = _ihatexml.InfosetFilter(preventDoubleDashComments=True) self.namespaceHTMLElements = namespaceHTMLElements class Attributes(dict): def __init__(self, element, value=None): if value is None: value = {} self._element = element dict.__init__(self, value) # pylint:disable=non-parent-init-called for key, value in self.items(): if isinstance(key, tuple): name = "{%s}%s" % (key[2], infosetFilter.coerceAttribute(key[1])) else: name = infosetFilter.coerceAttribute(key) self._element._element.attrib[name] = value def __setitem__(self, key, value): dict.__setitem__(self, key, value) if isinstance(key, tuple): name = "{%s}%s" % (key[2], infosetFilter.coerceAttribute(key[1])) else: name = infosetFilter.coerceAttribute(key) self._element._element.attrib[name] = value class Element(builder.Element): def __init__(self, name, namespace): name = infosetFilter.coerceElement(name) builder.Element.__init__(self, name, namespace=namespace) self._attributes = Attributes(self) def _setName(self, name): self._name = infosetFilter.coerceElement(name) self._element.tag = self._getETreeTag( self._name, self._namespace) def _getName(self): return infosetFilter.fromXmlName(self._name) name = property(_getName, _setName) def _getAttributes(self): return self._attributes def _setAttributes(self, attributes): self._attributes = Attributes(self, attributes) attributes = property(_getAttributes, _setAttributes) def insertText(self, data, insertBefore=None): data = infosetFilter.coerceCharacters(data) builder.Element.insertText(self, data, insertBefore) def appendChild(self, child): builder.Element.appendChild(self, child) class Comment(builder.Comment): def __init__(self, data): data = infosetFilter.coerceComment(data) builder.Comment.__init__(self, data) def _setData(self, data): data = infosetFilter.coerceComment(data) self._element.text = data def _getData(self): return self._element.text data = property(_getData, _setData) self.elementClass = Element self.commentClass = Comment # self.fragmentClass = builder.DocumentFragment base.TreeBuilder.__init__(self, namespaceHTMLElements) def reset(self): base.TreeBuilder.reset(self) self.insertComment = self.insertCommentInitial self.initial_comments = [] self.doctype = None def testSerializer(self, element): return testSerializer(element) def getDocument(self): if fullTree: return self.document._elementTree else: return self.document._elementTree.getroot() def getFragment(self): fragment = [] element = self.openElements[0]._element if element.text: fragment.append(element.text) fragment.extend(list(element)) if element.tail: fragment.append(element.tail) return fragment def insertDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] if not name: warnings.warn("lxml cannot represent empty doctype", DataLossWarning) self.doctype = None else: coercedName = self.infosetFilter.coerceElement(name) if coercedName != name: warnings.warn("lxml cannot represent non-xml doctype", DataLossWarning) doctype = self.doctypeClass(coercedName, publicId, systemId) self.doctype = doctype def insertCommentInitial(self, data, parent=None): assert parent is None or parent is self.document assert self.document._elementTree is None self.initial_comments.append(data) def insertCommentMain(self, data, parent=None): if (parent == self.document and self.document._elementTree.getroot()[-1].tag == comment_type): warnings.warn("lxml cannot represent adjacent comments beyond the root elements", DataLossWarning) super(TreeBuilder, self).insertComment(data, parent) def insertRoot(self, token): """Create the document root""" # Because of the way libxml2 works, it doesn't seem to be possible to # alter information like the doctype after the tree has been parsed. # Therefore we need to use the built-in parser to create our initial # tree, after which we can add elements like normal docStr = "" if self.doctype: assert self.doctype.name docStr += "= 0 and sysid.find('"') >= 0: warnings.warn("DOCTYPE system cannot contain single and double quotes", DataLossWarning) sysid = sysid.replace("'", 'U00027') if sysid.find("'") >= 0: docStr += '"%s"' % sysid else: docStr += "'%s'" % sysid else: docStr += "''" docStr += ">" if self.doctype.name != token["name"]: warnings.warn("lxml cannot represent doctype with a different name to the root element", DataLossWarning) docStr += "" root = etree.fromstring(docStr) # Append the initial comments: for comment_token in self.initial_comments: comment = self.commentClass(comment_token["data"]) root.addprevious(comment._element) # Create the root document and add the ElementTree to it self.document = self.documentClass() self.document._elementTree = root.getroottree() # Give the root element the right name name = token["name"] namespace = token.get("namespace", self.defaultNamespace) if namespace is None: etree_tag = name else: etree_tag = "{%s}%s" % (namespace, name) root.tag = etree_tag # Add the root element to the internal child/open data structures root_element = self.elementClass(name, namespace) root_element._element = root self.document._childNodes.append(root_element) self.openElements.append(root_element) # Reset to the default insert comment function self.insertComment = self.insertCommentMain site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyc000064400000035622147204247350020616 0ustar00 abc@`s'dZddlmZmZmZddlZddlZddlZddlm Z ddl m Z ddlm Z dd lm Z dd lmZddlj Z eZejd Ze jd jZd efdYZdefdYZdZdZde jfdYZdS(uModule for supporting the lxml.etree library. The idea here is to use as much of the native library as possible, without using fragile hacks like custom element names that break between releases. The downside of this is that we cannot represent all possible trees; specifically the following are known to cause problems: Text or comments as siblings of the root element Docypes with no name When any of these things occur, we emit a DataLossWarning i(tabsolute_importtdivisiontunicode_literalsNi(tbasei(tDataLossWarning(t constants(tetree(t _ihatexmlu {([^}]*)}(.*)uasdt DocumentTypecB`seZdZRS(cC`s||_||_||_dS(N(tnametpublicIdtsystemId(tselfR R R ((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt__init__#s  (t__name__t __module__R (((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR"stDocumentcB`s/eZdZdZdZeeZRS(cC`sd|_g|_dS(N(tNonet _elementTreet _childNodes(R ((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR *s cC`s|jjj|jdS(N(Rtgetroottaddnextt_element(R telement((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt appendChild.scC`s|jS(N(R(R ((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_getChildNodes1s(RRR RRtpropertyt childNodes(((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR)s   c`sJgtjdtdfd|ddjS(NtpreventDoubleDashCommentsic `sMt|dst|dr jd|jjr|jjpL|jjsbd|jj}n%d|jj|jj|jjf}jdd|d|fn|j}x"|jdk r|j}qWx|dk r ||d|j }qWqIt |t s+t |t rqt |t sStjd dksStjd d||fqIjd x|D]}||dqWn|jtkr jd d||jft|d rI|jrIjd d||jfqIn=t |tjs$ttjj|j}|dk r|jd}|jd}tj|}jdd||j|fn'jdd|j|jft|drg}x|jjD]\} } tj| }|dk rN|j \}} j| } tj|}d|| f} nj| } |j| | fqWx?t!|D].\} } jdd|d| | fqWn|jrjd d|d|jfn|d7}x|D]} | |qWt|d rI|jrIjd d|d|jfndS(Nutagugetrootu #documentu uu|%s%su iiu|%s"%s"u#document-fragmentu|%sutailiu |%s<%s %s>u|%s<%s>uattribu%s %su |%s%s="%s"("thasattrtappendtdocinfot internalDTDt public_idt system_urlt root_nameRt getpreviousRtgetnextt isinstancetstrtbytestsyst version_infotAssertionErrorttagt comment_typettextttailRt_Elementtetree_builderst tag_regexptmatchtgroupRtprefixest fromXmlNametattribtitemstgroupstsorted( Rtindenttdtd_strt next_elementtnsmatchtnsR,tprefixt attributesR tvaluet attr_stringtchild(t infosetFiltertrvtserializeElement(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRG;st      " (  $    ) %  u (Rt InfosetFiltertTruetjoin(R((RERFRGsP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyttestSerializer7s F c`s/gfd|djS(u4Serialize an element and its child nodes to a stringc`st|dsi|jjrV|jjr6|jj}nd|jj}j|n|jn|jtkrjd|j fn|j sjd|jfnUdj g|j j D]\}}d||f^q}jd|j|f|j r&j|j nx|D]}|q-Wjd|jft|d r|j rj|j ndS( Nutagu u u<%s>u u%s="%s"u<%s %s>uutail(RRR tdoctypeR#RRR,R-R.R7RJR8R/(RR<R RBtattrRD(RFRG(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRGs*    2  u(RJ(R((RFRGsP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyttostrings t TreeBuildercB`seZeZeZd Zd ZeZ e Z e dZ dZdZdZdZdZd dZd dZdZRS( c`stjtd|tjdt|_||_dtffdYdj ffdY}dj ffdY}||_ ||_ t jj||dS( NtfullTreeRt Attributesc`s)eZdfdZfdZRS(c`s|dkri}n||_tj||xo|jD]a\}}t|trzd|dj|df}nj|}||jjj|unameuGlxml cannot represent doctype with a different name to the root elementu$udatau namespaceu{%s}%sN( RLR R+R RR REt coercePubidtfindRzR{RtreplaceRt fromstringRrRnt addpreviousRt documentClassRst getroottreeRtgettdefaultNamespaceR,RmRRRuRRq( R R}tdocStrtsysidtroott comment_tokentcommentR RXt etree_tagt root_element((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt insertRoot7sL    *        N(RRRRRR|RRmRnt fragmentClassRtimplementationtFalseR RoRKRtRyRRpRR(((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyROs L      (t__doc__t __future__RRRRztreR)tRRRRR1Rt lxml.etreeRIRPtcompileR2RgR,R-tobjectRRRKRNRO(((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt s$    O )site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyo000064400000035244147204247350020632 0ustar00 abc@`s'dZddlmZmZmZddlZddlZddlZddlm Z ddl m Z ddlm Z dd lm Z dd lmZddlj Z eZejd Ze jd jZd efdYZdefdYZdZdZde jfdYZdS(uModule for supporting the lxml.etree library. The idea here is to use as much of the native library as possible, without using fragile hacks like custom element names that break between releases. The downside of this is that we cannot represent all possible trees; specifically the following are known to cause problems: Text or comments as siblings of the root element Docypes with no name When any of these things occur, we emit a DataLossWarning i(tabsolute_importtdivisiontunicode_literalsNi(tbasei(tDataLossWarning(t constants(tetree(t _ihatexmlu {([^}]*)}(.*)uasdt DocumentTypecB`seZdZRS(cC`s||_||_||_dS(N(tnametpublicIdtsystemId(tselfR R R ((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt__init__#s  (t__name__t __module__R (((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR"stDocumentcB`s/eZdZdZdZeeZRS(cC`sd|_g|_dS(N(tNonet _elementTreet _childNodes(R ((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR *s cC`s|jjj|jdS(N(Rtgetroottaddnextt_element(R telement((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt appendChild.scC`s|jS(N(R(R ((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_getChildNodes1s(RRR RRtpropertyt childNodes(((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR)s   c`sJgtjdtdfd|ddjS(NtpreventDoubleDashCommentsic `s t|ds{t|dr jd|jjr|jjpL|jjsbd|jj}n%d|jj|jj|jjf}jdd|d|fn|j}x"|jdk r|j}qWx|dk r ||d|j }qWq t |t s+t |t rIjd d||fq jd x|D]}||dq]Wn|jtkrjd d||jft|d r |jr jd d||jfq n%tjj|j}|dk rZ|jd }|jd}tj|}jdd||j|fn'jdd|j|jft|drvg}x|jjD]\} } tj| }|dk r|j\}} j| } tj|}d|| f} nj| } |j| | fqWx?t|D].\} } jdd|d| | fqAWn|jrjd d|d|jfn|d7}x|D]} | |qWt|d r |jr jd d|d|jfndS(Nutagugetrootu #documentu uu|%s%su iu|%s"%s"u#document-fragmentu|%sutailiu |%s<%s %s>u|%s<%s>uattribu%s %su |%s%s="%s"(thasattrtappendtdocinfot internalDTDt public_idt system_urlt root_nameRt getpreviousRtgetnextt isinstancetstrtbytesttagt comment_typettextttailtetree_builderst tag_regexptmatchtgroupRtprefixest fromXmlNametattribtitemstgroupstsorted( Rtindenttdtd_strt next_elementtnsmatchtnsR)tprefixt attributesR tvaluet attr_stringtchild(t infosetFiltertrvtserializeElement(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRC;sp      "   $    ) %  u (Rt InfosetFiltertTruetjoin(R((RARBRCsP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyttestSerializer7s F c`s/gfd|djS(u4Serialize an element and its child nodes to a stringc`st|dsi|jjrV|jjr6|jj}nd|jj}j|n|jn|jtkrjd|j fn|j sjd|jfnUdj g|j j D]\}}d||f^q}jd|j|f|j r&j|j nx|D]}|q-Wjd|jft|d r|j rj|j ndS( Nutagu u u<%s>u u%s="%s"u<%s %s>uutail(RRR tdoctypeR#RRR)R*R+R3RFR4R,(RR8R R>tattrR@(RBRC(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRCs*    2  u(RF(R((RBRCsP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyttostrings t TreeBuildercB`seZeZeZd Zd ZeZ e Z e dZ dZdZdZdZdZd dZd dZdZRS( c`stjtd|tjdt|_||_dtffdYdj ffdY}dj ffdY}||_ ||_ t jj||dS( NtfullTreeRt Attributesc`s)eZdfdZfdZRS(c`s|dkri}n||_tj||xo|jD]a\}}t|trzd|dj|df}nj|}||jjj|tkeyR (RA(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR s   $c`sltj|||t|trFd|dj|df}nj|}||jjj|R (RA(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRRs $N(RRRR RR((RA(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRMs tElementc`seZfdZfdZfdZeeeZdZfdZeeeZ dfdZ fdZ RS(c`s;j|}jj||d|||_dS(Nt namespace(t coerceElementRSR t _attributes(R R RT(RMtbuilderRA(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR sc`s4j||_|j|j|j|j_dS(N(RUt_namet _getETreeTagt _namespaceRR)(R R (RA(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_setNamesc`sj|jS(N(R2RX(R (RA(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_getNamescS`s|jS(N(RV(R ((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_getAttributessc`s|||_dS(N(RV(R R=(RM(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_setAttributessc`s)j|}jj|||dS(N(tcoerceCharactersRSt insertText(R tdatat insertBefore(RWRA(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR`sc`sjj||dS(N(RSR(R R@(RW(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRsN( RRR R[R\RR R]R^R=RR`R((RMRWRA(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRSs tCommentc`sAeZfdZfdZdZeeeZRS(c`s&j|}jj||dS(N(t coerceCommentRcR (R Ra(RWRA(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR sc`sj|}||j_dS(N(RdRR+(R Ra(RA(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_setDatascS`s |jjS(N(RR+(R ((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_getDatas(RRR ReRfRRa((RWRA(sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRcs (R-tgetETreeModuleRRRDRERAtnamespaceHTMLElementsRNRSRct elementClasst commentClassRRKR (R RhRLRSRc((RMRWRAsP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR s %"  cC`s2tjj||j|_g|_d|_dS(N(RRKtresettinsertCommentInitialt insertCommenttinitial_commentsRRH(R ((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRks  cC`s t|S(N(RG(R R((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRG scC`s$tr|jjS|jjjSdS(N(RLtdocumentRR(R ((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt getDocument s cC`seg}|jdj}|jr2|j|jn|jt||jra|j|jn|S(Ni(t openElementsRR+RtextendtlistR,(R tfragmentR((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt getFragments  cC`s|d}|d}|d}|s@tjdtd|_nO|jj|}||krqtjdtn|j|||}||_dS(NunameupublicIdusystemIdu#lxml cannot represent empty doctypeu%lxml cannot represent non-xml doctype(twarningstwarnRRRHRARUt doctypeClass(R ttokenR R R t coercedNameRH((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt insertDoctypes     cC`s|jj|dS(N(RnR(R Ratparent((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRl,scC`s^||jkrA|jjjdjtkrAtjdtntt |j ||dS(Niu@lxml cannot represent adjacent comments beyond the root elements( RoRRR)R*RvRwRtsuperRKRm(R RaR|((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pytinsertCommentMain1sc C`sZd}|jrN|d|jj7}|jjdk sG|jjdk r|d|jj|jjped7}|jjr |jj}|jddkr|jddkrtj dt |j dd}n|jddkr|d |7}q|d |7}q|d 7}n|d 7}|jj|d krNtj dt qNn|d7}t j |}x4|jD])}|j|d}|j|jqqW|j|_|j|j_|d }|jd|j}|dkr|} nd||f} | |_|j||} || _|jjj| |jj| |j|_dS(uCreate the document rootuu unameuGlxml cannot represent doctype with a different name to the root elementu$udatau namespaceu{%s}%sN(RHR R RR RAt coercePubidtfindRvRwRtreplaceRt fromstringRnRjt addpreviousRt documentClassRot getroottreeRtgettdefaultNamespaceR)RiRRRqR~Rm( R RytdocStrtsysidtroott comment_tokentcommentR RTt etree_tagt root_element((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt insertRoot7sJ    *        N(RRRRRRxRRiRjt fragmentClassRtimplementationtFalseR RkRGRpRuR{RlR~R(((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRKs L      (t__doc__t __future__RRRRvtretsystRRRRR-Rt lxml.etreeRERLtcompileR.RcR)R*tobjectRRRGRJRK(((sP/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt s$    O )site-packages/pip/_vendor/html5lib/treewalkers/__init__.py000064400000012650147204247350017705 0ustar00"""A collection of modules for iterating through different kinds of tree, generating tokens identical to those produced by the tokenizer module. To create a tree walker for a new type of tree, you need to do implement a tree walker object (called TreeWalker by convention) that implements a 'serialize' method taking a tree as sole argument and returning an iterator generating tokens. """ from __future__ import absolute_import, division, unicode_literals from .. import constants from .._utils import default_etree __all__ = ["getTreeWalker", "pprint", "dom", "etree", "genshi", "etree_lxml"] treeWalkerCache = {} def getTreeWalker(treeType, implementation=None, **kwargs): """Get a TreeWalker class for various types of tree with built-in support Args: treeType (str): the name of the tree type required (case-insensitive). Supported values are: - "dom": The xml.dom.minidom DOM implementation - "etree": A generic walker for tree implementations exposing an elementtree-like interface (known to work with ElementTree, cElementTree and lxml.etree). - "lxml": Optimized walker for lxml.etree - "genshi": a Genshi stream Implementation: A module implementing the tree type e.g. xml.etree.ElementTree or cElementTree (Currently applies to the "etree" tree type only). """ treeType = treeType.lower() if treeType not in treeWalkerCache: if treeType == "dom": from . import dom treeWalkerCache[treeType] = dom.TreeWalker elif treeType == "genshi": from . import genshi treeWalkerCache[treeType] = genshi.TreeWalker elif treeType == "lxml": from . import etree_lxml treeWalkerCache[treeType] = etree_lxml.TreeWalker elif treeType == "etree": from . import etree if implementation is None: implementation = default_etree # XXX: NEVER cache here, caching is done in the etree submodule return etree.getETreeModule(implementation, **kwargs).TreeWalker return treeWalkerCache.get(treeType) def concatenateCharacterTokens(tokens): pendingCharacters = [] for token in tokens: type = token["type"] if type in ("Characters", "SpaceCharacters"): pendingCharacters.append(token["data"]) else: if pendingCharacters: yield {"type": "Characters", "data": "".join(pendingCharacters)} pendingCharacters = [] yield token if pendingCharacters: yield {"type": "Characters", "data": "".join(pendingCharacters)} def pprint(walker): """Pretty printer for tree walkers""" output = [] indent = 0 for token in concatenateCharacterTokens(walker): type = token["type"] if type in ("StartTag", "EmptyTag"): # tag name if token["namespace"] and token["namespace"] != constants.namespaces["html"]: if token["namespace"] in constants.prefixes: ns = constants.prefixes[token["namespace"]] else: ns = token["namespace"] name = "%s %s" % (ns, token["name"]) else: name = token["name"] output.append("%s<%s>" % (" " * indent, name)) indent += 2 # attributes (sorted for consistent ordering) attrs = token["data"] for (namespace, localname), value in sorted(attrs.items()): if namespace: if namespace in constants.prefixes: ns = constants.prefixes[namespace] else: ns = namespace name = "%s %s" % (ns, localname) else: name = localname output.append("%s%s=\"%s\"" % (" " * indent, name, value)) # self-closing if type == "EmptyTag": indent -= 2 elif type == "EndTag": indent -= 2 elif type == "Comment": output.append("%s" % (" " * indent, token["data"])) elif type == "Doctype": if token["name"]: if token["publicId"]: output.append("""%s""" % (" " * indent, token["name"], token["publicId"], token["systemId"] if token["systemId"] else "")) elif token["systemId"]: output.append("""%s""" % (" " * indent, token["name"], token["systemId"])) else: output.append("%s" % (" " * indent, token["name"])) else: output.append("%s" % (" " * indent,)) elif type == "Characters": output.append("%s\"%s\"" % (" " * indent, token["data"])) elif type == "SpaceCharacters": assert False, "concatenateCharacterTokens should have got rid of all Space tokens" else: raise ValueError("Unknown token type, %s" % type) return "\n".join(output) site-packages/pip/_vendor/html5lib/treewalkers/__init__.pyc000064400000011171147204247350020045 0ustar00 abc@`sdZddlmZmZmZddlmZddlmZdddd d d gZ iZ dd Z d Z dZdS(uA collection of modules for iterating through different kinds of tree, generating tokens identical to those produced by the tokenizer module. To create a tree walker for a new type of tree, you need to do implement a tree walker object (called TreeWalker by convention) that implements a 'serialize' method taking a tree as sole argument and returning an iterator generating tokens. i(tabsolute_importtdivisiontunicode_literalsi(t constants(t default_etreeu getTreeWalkerupprintudomuetreeugenshiu etree_lxmlcK`s|j}|tkr|dkrDddlm}|jt|u iudatau %s%s="%s"uEndTaguCommentu %suDoctypeupublicIdu%susystemIduu%su%su %su Charactersu%s"%s"uSpaceCharactersuBconcatenateCharacterTokens should have got rid of all Space tokensuUnknown token type, %su (uStartTaguEmptyTag( RRt namespacestprefixesRtsortedtitemstFalsetAssertionErrort ValueErrorR( twalkertoutputtindentRRtnstnametattrst namespacet localnametvalue((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/__init__.pytpprintKsd  !    %"    "    "   " N(t__doc__t __future__RRRR Rt_utilsRt__all__R R RRR+(((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/__init__.pyt s ' site-packages/pip/_vendor/html5lib/treewalkers/__init__.pyo000064400000011003147204247350020053 0ustar00 abc@`sdZddlmZmZmZddlmZddlmZdddd d d gZ iZ dd Z d Z dZdS(uA collection of modules for iterating through different kinds of tree, generating tokens identical to those produced by the tokenizer module. To create a tree walker for a new type of tree, you need to do implement a tree walker object (called TreeWalker by convention) that implements a 'serialize' method taking a tree as sole argument and returning an iterator generating tokens. i(tabsolute_importtdivisiontunicode_literalsi(t constants(t default_etreeu getTreeWalkerupprintudomuetreeugenshiu etree_lxmlcK`s|j}|tkr|dkrDddlm}|jt|u iudatau %s%s="%s"uEndTaguCommentu %suDoctypeupublicIdu%susystemIduu%su%su %su Charactersu%s"%s"uSpaceCharactersuUnknown token type, %su (uStartTaguEmptyTag( RRt namespacestprefixesRtsortedtitemst ValueErrorR( twalkertoutputtindentRRtnstnametattrst namespacet localnametvalue((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/__init__.pytpprintKsd  !    %"    "    "   " N(t__doc__t __future__RRRR Rt_utilsRt__all__R R RRR)(((sM/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/__init__.pyt s ' site-packages/pip/_vendor/html5lib/treewalkers/base.py000064400000011513147204247350017055 0ustar00from __future__ import absolute_import, division, unicode_literals from xml.dom import Node from ..constants import namespaces, voidElements, spaceCharacters __all__ = ["DOCUMENT", "DOCTYPE", "TEXT", "ELEMENT", "COMMENT", "ENTITY", "UNKNOWN", "TreeWalker", "NonRecursiveTreeWalker"] DOCUMENT = Node.DOCUMENT_NODE DOCTYPE = Node.DOCUMENT_TYPE_NODE TEXT = Node.TEXT_NODE ELEMENT = Node.ELEMENT_NODE COMMENT = Node.COMMENT_NODE ENTITY = Node.ENTITY_NODE UNKNOWN = "<#UNKNOWN#>" spaceCharacters = "".join(spaceCharacters) class TreeWalker(object): def __init__(self, tree): self.tree = tree def __iter__(self): raise NotImplementedError def error(self, msg): return {"type": "SerializeError", "data": msg} def emptyTag(self, namespace, name, attrs, hasChildren=False): yield {"type": "EmptyTag", "name": name, "namespace": namespace, "data": attrs} if hasChildren: yield self.error("Void element has children") def startTag(self, namespace, name, attrs): return {"type": "StartTag", "name": name, "namespace": namespace, "data": attrs} def endTag(self, namespace, name): return {"type": "EndTag", "name": name, "namespace": namespace} def text(self, data): data = data middle = data.lstrip(spaceCharacters) left = data[:len(data) - len(middle)] if left: yield {"type": "SpaceCharacters", "data": left} data = middle middle = data.rstrip(spaceCharacters) right = data[len(middle):] if middle: yield {"type": "Characters", "data": middle} if right: yield {"type": "SpaceCharacters", "data": right} def comment(self, data): return {"type": "Comment", "data": data} def doctype(self, name, publicId=None, systemId=None): return {"type": "Doctype", "name": name, "publicId": publicId, "systemId": systemId} def entity(self, name): return {"type": "Entity", "name": name} def unknown(self, nodeType): return self.error("Unknown node type: " + nodeType) class NonRecursiveTreeWalker(TreeWalker): def getNodeDetails(self, node): raise NotImplementedError def getFirstChild(self, node): raise NotImplementedError def getNextSibling(self, node): raise NotImplementedError def getParentNode(self, node): raise NotImplementedError def __iter__(self): currentNode = self.tree while currentNode is not None: details = self.getNodeDetails(currentNode) type, details = details[0], details[1:] hasChildren = False if type == DOCTYPE: yield self.doctype(*details) elif type == TEXT: for token in self.text(*details): yield token elif type == ELEMENT: namespace, name, attributes, hasChildren = details if (not namespace or namespace == namespaces["html"]) and name in voidElements: for token in self.emptyTag(namespace, name, attributes, hasChildren): yield token hasChildren = False else: yield self.startTag(namespace, name, attributes) elif type == COMMENT: yield self.comment(details[0]) elif type == ENTITY: yield self.entity(details[0]) elif type == DOCUMENT: hasChildren = True else: yield self.unknown(details[0]) if hasChildren: firstChild = self.getFirstChild(currentNode) else: firstChild = None if firstChild is not None: currentNode = firstChild else: while currentNode is not None: details = self.getNodeDetails(currentNode) type, details = details[0], details[1:] if type == ELEMENT: namespace, name, attributes, hasChildren = details if (namespace and namespace != namespaces["html"]) or name not in voidElements: yield self.endTag(namespace, name) if self.tree is currentNode: currentNode = None break nextSibling = self.getNextSibling(currentNode) if nextSibling is not None: currentNode = nextSibling break else: currentNode = self.getParentNode(currentNode) site-packages/pip/_vendor/html5lib/treewalkers/base.pyc000064400000014324147204247350017223 0ustar00 abc @`sddlmZmZmZddlmZddlmZmZm Z ddddd d d d d g Z ej Z ej ZejZejZejZejZdZdje Z defdYZdefdYZdS(i(tabsolute_importtdivisiontunicode_literals(tNodei(t namespacest voidElementstspaceCharactersuDOCUMENTuDOCTYPEuTEXTuELEMENTuCOMMENTuENTITYuUNKNOWNu TreeWalkeruNonRecursiveTreeWalkeru <#UNKNOWN#>ut TreeWalkercB`steZdZdZdZedZdZdZdZ dZ d d dZ d Z d ZRS( cC`s ||_dS(N(ttree(tselfR((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyt__init__scC`s tdS(N(tNotImplementedError(R ((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyt__iter__scC`sidd6|d6S(NuSerializeErrorutypeudata((R tmsg((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyterrorscc`s<idd6|d6|d6|d6V|r8|jdVndS(NuEmptyTagutypeunameu namespaceudatauVoid element has children(R(R t namespacetnametattrst hasChildren((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytemptyTags  cC`s idd6|d6|d6|d6S(NuStartTagutypeunameu namespaceudata((R RRR((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytstartTag%s cC`sidd6|d6|d6S(NuEndTagutypeunameu namespace((R RR((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytendTag+s cc`s|}|jt}|t|t| }|rKidd6|d6Vn|}|jt}|t|}|ridd6|d6Vn|ridd6|d6VndS(NuSpaceCharactersutypeudatau Characters(tlstripRtlentrstrip(R tdatatmiddletlefttright((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyttext0scC`sidd6|d6S(NuCommentutypeudata((R R((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytcomment>scC`s idd6|d6|d6|d6S(NuDoctypeutypeunameupublicIdusystemId((R RtpublicIdtsystemId((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytdoctypeAs cC`sidd6|d6S(NuEntityutypeuname((R R((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytentityGscC`s|jd|S(NuUnknown node type: (R(R tnodeType((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytunknownJsN(t__name__t __module__R R RtFalseRRRRRtNoneR!R"R$(((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyRs         tNonRecursiveTreeWalkercB`s5eZdZdZdZdZdZRS(cC`s tdS(N(R (R tnode((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytgetNodeDetailsOscC`s tdS(N(R (R R*((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyt getFirstChildRscC`s tdS(N(R (R R*((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytgetNextSiblingUscC`s tdS(N(R (R R*((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyt getParentNodeXsc c`s|j}x|dk r|j|}|d|d}}t}|tkr_|j|Vn |tkrx|j|D] }|Vq{Wn|tkr|\}}}}| s|t dkr|t krx%|j ||||D] }|VqWt}q|j |||Vni|t kr7|j|dVnH|tkrX|j|dVn'|tkrmt}n|j|dV|r|j|} nd} | dk r| }q x|dk r|j|}|d|d}}|tkr<|\}}}}|r|t dks%|t kr<|j||Vq<n|j|krUd}Pn|j|} | dk rz| }Pq|j|}qWq WdS(Niiuhtml(RR(R+R'tDOCTYPER!tTEXTRtELEMENTRRRRtCOMMENTRtENTITYR"tDOCUMENTtTrueR$R,RR-R.( R t currentNodetdetailsttypeRttokenRRt attributest firstChildt nextSibling((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyR [sZ     #          " (R%R&R+R,R-R.R (((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyR)Ns     N(t __future__RRRtxml.domRt constantsRRRt__all__t DOCUMENT_NODER4tDOCUMENT_TYPE_NODER/t TEXT_NODER0t ELEMENT_NODER1t COMMENT_NODER2t ENTITY_NODER3tUNKNOWNtjointobjectRR)(((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyts       :site-packages/pip/_vendor/html5lib/treewalkers/base.pyo000064400000014324147204247350017237 0ustar00 abc @`sddlmZmZmZddlmZddlmZmZm Z ddddd d d d d g Z ej Z ej ZejZejZejZejZdZdje Z defdYZdefdYZdS(i(tabsolute_importtdivisiontunicode_literals(tNodei(t namespacest voidElementstspaceCharactersuDOCUMENTuDOCTYPEuTEXTuELEMENTuCOMMENTuENTITYuUNKNOWNu TreeWalkeruNonRecursiveTreeWalkeru <#UNKNOWN#>ut TreeWalkercB`steZdZdZdZedZdZdZdZ dZ d d dZ d Z d ZRS( cC`s ||_dS(N(ttree(tselfR((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyt__init__scC`s tdS(N(tNotImplementedError(R ((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyt__iter__scC`sidd6|d6S(NuSerializeErrorutypeudata((R tmsg((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyterrorscc`s<idd6|d6|d6|d6V|r8|jdVndS(NuEmptyTagutypeunameu namespaceudatauVoid element has children(R(R t namespacetnametattrst hasChildren((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytemptyTags  cC`s idd6|d6|d6|d6S(NuStartTagutypeunameu namespaceudata((R RRR((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytstartTag%s cC`sidd6|d6|d6S(NuEndTagutypeunameu namespace((R RR((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytendTag+s cc`s|}|jt}|t|t| }|rKidd6|d6Vn|}|jt}|t|}|ridd6|d6Vn|ridd6|d6VndS(NuSpaceCharactersutypeudatau Characters(tlstripRtlentrstrip(R tdatatmiddletlefttright((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyttext0scC`sidd6|d6S(NuCommentutypeudata((R R((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytcomment>scC`s idd6|d6|d6|d6S(NuDoctypeutypeunameupublicIdusystemId((R RtpublicIdtsystemId((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytdoctypeAs cC`sidd6|d6S(NuEntityutypeuname((R R((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytentityGscC`s|jd|S(NuUnknown node type: (R(R tnodeType((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytunknownJsN(t__name__t __module__R R RtFalseRRRRRtNoneR!R"R$(((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyRs         tNonRecursiveTreeWalkercB`s5eZdZdZdZdZdZRS(cC`s tdS(N(R (R tnode((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytgetNodeDetailsOscC`s tdS(N(R (R R*((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyt getFirstChildRscC`s tdS(N(R (R R*((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pytgetNextSiblingUscC`s tdS(N(R (R R*((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyt getParentNodeXsc c`s|j}x|dk r|j|}|d|d}}t}|tkr_|j|Vn |tkrx|j|D] }|Vq{Wn|tkr|\}}}}| s|t dkr|t krx%|j ||||D] }|VqWt}q|j |||Vni|t kr7|j|dVnH|tkrX|j|dVn'|tkrmt}n|j|dV|r|j|} nd} | dk r| }q x|dk r|j|}|d|d}}|tkr<|\}}}}|r|t dks%|t kr<|j||Vq<n|j|krUd}Pn|j|} | dk rz| }Pq|j|}qWq WdS(Niiuhtml(RR(R+R'tDOCTYPER!tTEXTRtELEMENTRRRRtCOMMENTRtENTITYR"tDOCUMENTtTrueR$R,RR-R.( R t currentNodetdetailsttypeRttokenRRt attributest firstChildt nextSibling((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyR [sZ     #          " (R%R&R+R,R-R.R (((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyR)Ns     N(t __future__RRRtxml.domRt constantsRRRt__all__t DOCUMENT_NODER4tDOCUMENT_TYPE_NODER/t TEXT_NODER0t ELEMENT_NODER1t COMMENT_NODER2t ENTITY_NODER3tUNKNOWNtjointobjectRR)(((sI/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/base.pyts       :site-packages/pip/_vendor/html5lib/treewalkers/dom.py000064400000002605147204247350016724 0ustar00from __future__ import absolute_import, division, unicode_literals from xml.dom import Node from . import base class TreeWalker(base.NonRecursiveTreeWalker): def getNodeDetails(self, node): if node.nodeType == Node.DOCUMENT_TYPE_NODE: return base.DOCTYPE, node.name, node.publicId, node.systemId elif node.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE): return base.TEXT, node.nodeValue elif node.nodeType == Node.ELEMENT_NODE: attrs = {} for attr in list(node.attributes.keys()): attr = node.getAttributeNode(attr) if attr.namespaceURI: attrs[(attr.namespaceURI, attr.localName)] = attr.value else: attrs[(None, attr.name)] = attr.value return (base.ELEMENT, node.namespaceURI, node.nodeName, attrs, node.hasChildNodes()) elif node.nodeType == Node.COMMENT_NODE: return base.COMMENT, node.nodeValue elif node.nodeType in (Node.DOCUMENT_NODE, Node.DOCUMENT_FRAGMENT_NODE): return (base.DOCUMENT,) else: return base.UNKNOWN, node.nodeType def getFirstChild(self, node): return node.firstChild def getNextSibling(self, node): return node.nextSibling def getParentNode(self, node): return node.parentNode site-packages/pip/_vendor/html5lib/treewalkers/dom.pyc000064400000004273147204247350017072 0ustar00 abc@`sYddlmZmZmZddlmZddlmZdejfdYZ dS(i(tabsolute_importtdivisiontunicode_literals(tNodei(tbaset TreeWalkercB`s,eZdZdZdZdZRS(cC`sX|jtjkr.tj|j|j|jfS|jtjtj fkrYtj |j fS|jtj kri}xgt |jjD]P}|j|}|jr|j||j|jfssite-packages/pip/_vendor/html5lib/treewalkers/dom.pyo000064400000004273147204247350017106 0ustar00 abc@`sYddlmZmZmZddlmZddlmZdejfdYZ dS(i(tabsolute_importtdivisiontunicode_literals(tNodei(tbaset TreeWalkercB`s,eZdZdZdZdZRS(cC`sX|jtjkr.tj|j|j|jfS|jtjtj fkrYtj |j fS|jtj kri}xgt |jjD]P}|j|}|jr|j||j|jfssite-packages/pip/_vendor/html5lib/treewalkers/etree.py000064400000011114147204247350017244 0ustar00from __future__ import absolute_import, division, unicode_literals try: from collections import OrderedDict except ImportError: try: from ordereddict import OrderedDict except ImportError: OrderedDict = dict import re from pip._vendor.six import string_types from . import base from .._utils import moduleFactoryFactory tag_regexp = re.compile("{([^}]*)}(.*)") def getETreeBuilder(ElementTreeImplementation): ElementTree = ElementTreeImplementation ElementTreeCommentType = ElementTree.Comment("asd").tag class TreeWalker(base.NonRecursiveTreeWalker): # pylint:disable=unused-variable """Given the particular ElementTree representation, this implementation, to avoid using recursion, returns "nodes" as tuples with the following content: 1. The current element 2. The index of the element relative to its parent 3. A stack of ancestor elements 4. A flag "text", "tail" or None to indicate if the current node is a text node; either the text or tail of the current element (1) """ def getNodeDetails(self, node): if isinstance(node, tuple): # It might be the root Element elt, _, _, flag = node if flag in ("text", "tail"): return base.TEXT, getattr(elt, flag) else: node = elt if not(hasattr(node, "tag")): node = node.getroot() if node.tag in ("DOCUMENT_ROOT", "DOCUMENT_FRAGMENT"): return (base.DOCUMENT,) elif node.tag == "": return (base.DOCTYPE, node.text, node.get("publicId"), node.get("systemId")) elif node.tag == ElementTreeCommentType: return base.COMMENT, node.text else: assert isinstance(node.tag, string_types), type(node.tag) # This is assumed to be an ordinary element match = tag_regexp.match(node.tag) if match: namespace, tag = match.groups() else: namespace = None tag = node.tag attrs = OrderedDict() for name, value in list(node.attrib.items()): match = tag_regexp.match(name) if match: attrs[(match.group(1), match.group(2))] = value else: attrs[(None, name)] = value return (base.ELEMENT, namespace, tag, attrs, len(node) or node.text) def getFirstChild(self, node): if isinstance(node, tuple): element, key, parents, flag = node else: element, key, parents, flag = node, None, [], None if flag in ("text", "tail"): return None else: if element.text: return element, key, parents, "text" elif len(element): parents.append(element) return element[0], 0, parents, None else: return None def getNextSibling(self, node): if isinstance(node, tuple): element, key, parents, flag = node else: return None if flag == "text": if len(element): parents.append(element) return element[0], 0, parents, None else: return None else: if element.tail and flag != "tail": return element, key, parents, "tail" elif key < len(parents[-1]) - 1: return parents[-1][key + 1], key + 1, parents, None else: return None def getParentNode(self, node): if isinstance(node, tuple): element, key, parents, flag = node else: return None if flag == "text": if not parents: return element else: return element, key, parents, None else: parent = parents.pop() if not parents: return parent else: assert list(parents[-1]).count(parent) == 1 return parent, list(parents[-1]).index(parent), parents, None return locals() getETreeModule = moduleFactoryFactory(getETreeBuilder) site-packages/pip/_vendor/html5lib/treewalkers/etree.pyc000064400000010724147204247350017415 0ustar00 abc@`sddlmZmZmZyddlmZWn?ek rqyddlmZWqrek rmeZqrXnXddl Z ddl m Z ddl m Z ddlmZe jd Zd ZeeZdS( i(tabsolute_importtdivisiontunicode_literals(t OrderedDictN(t string_typesi(tbasei(tmoduleFactoryFactoryu {([^}]*)}(.*)c`s>|}|jdjdtjffdY}tS(Nuasdt TreeWalkerc`s8eZdZfdZdZdZdZRS(uGiven the particular ElementTree representation, this implementation, to avoid using recursion, returns "nodes" as tuples with the following content: 1. The current element 2. The index of the element relative to its parent 3. A stack of ancestor elements 4. A flag "text", "tail" or None to indicate if the current node is a text node; either the text or tail of the current element (1) c `st|trL|\}}}}|d krCtjt||fS|}nt|dsj|j}n|jd krtjfS|jdkrtj |j |j d|j dfS|jkrtj |j fSt|jt stt|jtj|j}|r-|j\}}nd}|j}t}xmt|jjD]V\} } tj| }|r| ||jd |jd fupublicIdusystemIdii(utextutail(u DOCUMENT_ROOTuDOCUMENT_FRAGMENT(t isinstancettupleRtTEXTtgetattrthasattrtgetrootttagtDOCUMENTtDOCTYPEttexttgettCOMMENTRtAssertionErrorttypet tag_regexptmatchtgroupstNoneRtlisttattribtitemstgrouptELEMENTtlen( tselftnodeteltt_tflagRt namespaceRtattrstnametvalue(tElementTreeCommentType(sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pytgetNodeDetails's8    '  "% cS`st|tr$|\}}}}n|dgdf\}}}}|dkrRdS|jrk|||dfSt|r|j||dd|dfSdSdS(Nutextutaili(utextutail(RR RRRtappend(R R!telementtkeytparentsR$((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pyt getFirstChildOs    cS`st|tr$|\}}}}ndS|dkrht|ra|j||dd|dfSdSnc|jr|dkr|||dfS|t|ddkr|d|d|d|dfSdSdS(Nutextiutailii(RR RRR+ttail(R R!R,R-R.R$((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pytgetNextSibling`s    cS`st|tr$|\}}}}ndS|dkrQ|s>|S|||dfSn^|j}|sg|St|dj|dkst|t|dj||dfSdS(Nutextii(RR RtpopRtcountRtindex(R R!R,R-R.R$tparent((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pyt getParentNodets  %(t__name__t __module__t__doc__R*R/R1R6((R)(sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pyRs  (  (tCommentRRtNonRecursiveTreeWalkertlocals(tElementTreeImplementationt ElementTreeR((R)sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pytgetETreeBuildersn(t __future__RRRt collectionsRt ImportErrort ordereddicttdicttretpip._vendor.sixRtRt_utilsRtcompileRR?tgetETreeModule(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pyts    tsite-packages/pip/_vendor/html5lib/treewalkers/etree.pyo000064400000010517147204247350017431 0ustar00 abc@`sddlmZmZmZyddlmZWn?ek rqyddlmZWqrek rmeZqrXnXddl Z ddl m Z ddl m Z ddlmZe jd Zd ZeeZdS( i(tabsolute_importtdivisiontunicode_literals(t OrderedDictN(t string_typesi(tbasei(tmoduleFactoryFactoryu {([^}]*)}(.*)c`s>|}|jdjdtjffdY}tS(Nuasdt TreeWalkerc`s8eZdZfdZdZdZdZRS(uGiven the particular ElementTree representation, this implementation, to avoid using recursion, returns "nodes" as tuples with the following content: 1. The current element 2. The index of the element relative to its parent 3. A stack of ancestor elements 4. A flag "text", "tail" or None to indicate if the current node is a text node; either the text or tail of the current element (1) c `st|trL|\}}}}|d krCtjt||fS|}nt|dsj|j}n|jd krtjfS|jdkrtj |j |j d|j dfS|jkrtj |j fSt j|j}|r|j\}}nd}|j}t}xmt|jjD]V\} } t j| }|rz| ||jd |jd fupublicIdusystemIdii(utextutail(u DOCUMENT_ROOTuDOCUMENT_FRAGMENT(t isinstancettupleRtTEXTtgetattrthasattrtgetrootttagtDOCUMENTtDOCTYPEttexttgettCOMMENTt tag_regexptmatchtgroupstNoneRtlisttattribtitemstgrouptELEMENTtlen( tselftnodeteltt_tflagRt namespaceRtattrstnametvalue(tElementTreeCommentType(sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pytgetNodeDetails's6      "% cS`st|tr$|\}}}}n|dgdf\}}}}|dkrRdS|jrk|||dfSt|r|j||dd|dfSdSdS(Nutextutaili(utextutail(RR RRRtappend(RRtelementtkeytparentsR"((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pyt getFirstChildOs    cS`st|tr$|\}}}}ndS|dkrht|ra|j||dd|dfSdSnc|jr|dkr|||dfS|t|ddkr|d|d|d|dfSdSdS(Nutextiutailii(RR RRR)ttail(RRR*R+R,R"((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pytgetNextSibling`s    cS`st|tr$|\}}}}ndS|dkrQ|s>|S|||dfSn9|j}|sg|S|t|dj||dfSdS(Nutexti(RR RtpopRtindex(RRR*R+R,R"tparent((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pyt getParentNodets  (t__name__t __module__t__doc__R(R-R/R3((R'(sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pyRs  (  (tCommentRRtNonRecursiveTreeWalkertlocals(tElementTreeImplementationt ElementTreeR((R'sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pytgetETreeBuildersn(t __future__RRRt collectionsRt ImportErrort ordereddicttdicttretpip._vendor.sixRtRt_utilsRtcompileRR<tgetETreeModule(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pyts    tsite-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.py000064400000014245147204247350020310 0ustar00from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type from lxml import etree from ..treebuilders.etree import tag_regexp from . import base from .. import _ihatexml def ensure_str(s): if s is None: return None elif isinstance(s, text_type): return s else: return s.decode("ascii", "strict") class Root(object): def __init__(self, et): self.elementtree = et self.children = [] try: if et.docinfo.internalDTD: self.children.append(Doctype(self, ensure_str(et.docinfo.root_name), ensure_str(et.docinfo.public_id), ensure_str(et.docinfo.system_url))) except AttributeError: pass try: node = et.getroot() except AttributeError: node = et while node.getprevious() is not None: node = node.getprevious() while node is not None: self.children.append(node) node = node.getnext() self.text = None self.tail = None def __getitem__(self, key): return self.children[key] def getnext(self): return None def __len__(self): return 1 class Doctype(object): def __init__(self, root_node, name, public_id, system_id): self.root_node = root_node self.name = name self.public_id = public_id self.system_id = system_id self.text = None self.tail = None def getnext(self): return self.root_node.children[1] class FragmentRoot(Root): def __init__(self, children): self.children = [FragmentWrapper(self, child) for child in children] self.text = self.tail = None def getnext(self): return None class FragmentWrapper(object): def __init__(self, fragment_root, obj): self.root_node = fragment_root self.obj = obj if hasattr(self.obj, 'text'): self.text = ensure_str(self.obj.text) else: self.text = None if hasattr(self.obj, 'tail'): self.tail = ensure_str(self.obj.tail) else: self.tail = None def __getattr__(self, name): return getattr(self.obj, name) def getnext(self): siblings = self.root_node.children idx = siblings.index(self) if idx < len(siblings) - 1: return siblings[idx + 1] else: return None def __getitem__(self, key): return self.obj[key] def __bool__(self): return bool(self.obj) def getparent(self): return None def __str__(self): return str(self.obj) def __unicode__(self): return str(self.obj) def __len__(self): return len(self.obj) class TreeWalker(base.NonRecursiveTreeWalker): def __init__(self, tree): # pylint:disable=redefined-variable-type if isinstance(tree, list): self.fragmentChildren = set(tree) tree = FragmentRoot(tree) else: self.fragmentChildren = set() tree = Root(tree) base.NonRecursiveTreeWalker.__init__(self, tree) self.filter = _ihatexml.InfosetFilter() def getNodeDetails(self, node): if isinstance(node, tuple): # Text node node, key = node assert key in ("text", "tail"), "Text nodes are text or tail, found %s" % key return base.TEXT, ensure_str(getattr(node, key)) elif isinstance(node, Root): return (base.DOCUMENT,) elif isinstance(node, Doctype): return base.DOCTYPE, node.name, node.public_id, node.system_id elif isinstance(node, FragmentWrapper) and not hasattr(node, "tag"): return base.TEXT, ensure_str(node.obj) elif node.tag == etree.Comment: return base.COMMENT, ensure_str(node.text) elif node.tag == etree.Entity: return base.ENTITY, ensure_str(node.text)[1:-1] # strip &; else: # This is assumed to be an ordinary element match = tag_regexp.match(ensure_str(node.tag)) if match: namespace, tag = match.groups() else: namespace = None tag = ensure_str(node.tag) attrs = {} for name, value in list(node.attrib.items()): name = ensure_str(name) value = ensure_str(value) match = tag_regexp.match(name) if match: attrs[(match.group(1), match.group(2))] = value else: attrs[(None, name)] = value return (base.ELEMENT, namespace, self.filter.fromXmlName(tag), attrs, len(node) > 0 or node.text) def getFirstChild(self, node): assert not isinstance(node, tuple), "Text nodes have no children" assert len(node) or node.text, "Node has no children" if node.text: return (node, "text") else: return node[0] def getNextSibling(self, node): if isinstance(node, tuple): # Text node node, key = node assert key in ("text", "tail"), "Text nodes are text or tail, found %s" % key if key == "text": # XXX: we cannot use a "bool(node) and node[0] or None" construct here # because node[0] might evaluate to False if it has no child element if len(node): return node[0] else: return None else: # tail return node.getnext() return (node, "tail") if node.tail else node.getnext() def getParentNode(self, node): if isinstance(node, tuple): # Text node node, key = node assert key in ("text", "tail"), "Text nodes are text or tail, found %s" % key if key == "text": return node # else: fallback to "normal" processing elif node in self.fragmentChildren: return None return node.getparent() site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyc000064400000022005147204247350020444 0ustar00 abc@`sddlmZmZmZddlmZddlmZddlm Z ddl m Z ddl m Z d Z d efd YZd efd YZdefdYZdefdYZde jfdYZdS(i(tabsolute_importtdivisiontunicode_literals(t text_type(tetreei(t tag_regexpi(tbase(t _ihatexmlcC`s7|dkrdSt|tr#|S|jddSdS(Nuasciiustrict(tNonet isinstanceRtdecode(ts((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt ensure_str s  tRootcB`s,eZdZdZdZdZRS(cC`s||_g|_yV|jjrg|jjt|t|jjt|jjt|jj nWnt k r{nXy|j }Wnt k r|}nXx"|j dk r|j }qWx,|dk r|jj||j}qWd|_d|_dS(N(t elementtreetchildrentdocinfot internalDTDtappendtDoctypeR t root_namet public_idt system_urltAttributeErrortgetroott getpreviousRtgetnextttextttail(tselftettnode((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt__init__s*       cC`s |j|S(N(R(Rtkey((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt __getitem__1scC`sdS(N(R(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR4scC`sdS(Ni((R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt__len__7s(t__name__t __module__R R"RR#(((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR s   RcB`seZdZdZRS(cC`s:||_||_||_||_d|_d|_dS(N(t root_nodetnameRt system_idRRR(RR&R'RR(((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR <s      cC`s|jjdS(Ni(R&R(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyREs(R$R%R R(((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR;s t FragmentRootcB`seZdZdZRS(cC`s9g|D]}t||^q|_d|_|_dS(N(tFragmentWrapperRRRR(RRtchild((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR Js%cC`sdS(N(R(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyRNs(R$R%R R(((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR)Is R*cB`sYeZdZdZdZdZdZdZdZdZ dZ RS( cC`s|||_||_t|jdr<t|jj|_n d|_t|jdrot|jj|_n d|_dS(Nutextutail(R&tobjthasattrR RRR(Rt fragment_rootR,((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR Ss   cC`st|j|S(N(tgetattrR,(RR'((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt __getattr___scC`sE|jj}|j|}|t|dkr=||dSdSdS(Ni(R&RtindextlenR(Rtsiblingstidx((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyRbs   cC`s |j|S(N(R,(RR!((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR"jscC`s t|jS(N(tboolR,(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt__bool__mscC`sdS(N(R(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt getparentpscC`s t|jS(N(tstrR,(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt__str__sscC`s t|jS(N(R8R,(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt __unicode__vscC`s t|jS(N(R2R,(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR#ys( R$R%R R0RR"R6R7R9R:R#(((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR*Rs       t TreeWalkercB`s5eZdZdZdZdZdZRS(cC`skt|tr-t||_t|}nt|_t|}tjj||t j |_ dS(N( R tlisttsettfragmentChildrenR)R RtNonRecursiveTreeWalkerR Rt InfosetFiltertfilter(Rttree((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR ~s  c C`s4t|trS|\}}|d ks7td|tjtt||fSt|trltjfSt|t rtj |j |j |j fSt|trt|d rtjt|jfS|jtjkrtjt|jfS|jtjkr#tjt|jdd!fStjt|j}|rV|j\}}nd}t|j}i}xt|jjD]n\}}t|}t|}tj|}|r|||jd|jdfRR7(RRR!((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt getParentNodes  (R$R%R RWRXRYRZ(((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR;}s  ) N(t __future__RRRtpip._vendor.sixRtlxmlRttreebuilders.etreeRtRRR tobjectR RR)R*R?R;(((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyts & +site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyo000064400000021042147204247350020460 0ustar00 abc@`sddlmZmZmZddlmZddlmZddlm Z ddl m Z ddl m Z d Z d efd YZd efd YZdefdYZdefdYZde jfdYZdS(i(tabsolute_importtdivisiontunicode_literals(t text_type(tetreei(t tag_regexpi(tbase(t _ihatexmlcC`s7|dkrdSt|tr#|S|jddSdS(Nuasciiustrict(tNonet isinstanceRtdecode(ts((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt ensure_str s  tRootcB`s,eZdZdZdZdZRS(cC`s||_g|_yV|jjrg|jjt|t|jjt|jjt|jj nWnt k r{nXy|j }Wnt k r|}nXx"|j dk r|j }qWx,|dk r|jj||j}qWd|_d|_dS(N(t elementtreetchildrentdocinfot internalDTDtappendtDoctypeR t root_namet public_idt system_urltAttributeErrortgetroott getpreviousRtgetnextttextttail(tselftettnode((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt__init__s*       cC`s |j|S(N(R(Rtkey((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt __getitem__1scC`sdS(N(R(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR4scC`sdS(Ni((R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt__len__7s(t__name__t __module__R R"RR#(((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR s   RcB`seZdZdZRS(cC`s:||_||_||_||_d|_d|_dS(N(t root_nodetnameRt system_idRRR(RR&R'RR(((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR <s      cC`s|jjdS(Ni(R&R(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyREs(R$R%R R(((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR;s t FragmentRootcB`seZdZdZRS(cC`s9g|D]}t||^q|_d|_|_dS(N(tFragmentWrapperRRRR(RRtchild((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR Js%cC`sdS(N(R(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyRNs(R$R%R R(((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR)Is R*cB`sYeZdZdZdZdZdZdZdZdZ dZ RS( cC`s|||_||_t|jdr<t|jj|_n d|_t|jdrot|jj|_n d|_dS(Nutextutail(R&tobjthasattrR RRR(Rt fragment_rootR,((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR Ss   cC`st|j|S(N(tgetattrR,(RR'((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt __getattr___scC`sE|jj}|j|}|t|dkr=||dSdSdS(Ni(R&RtindextlenR(Rtsiblingstidx((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyRbs   cC`s |j|S(N(R,(RR!((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR"jscC`s t|jS(N(tboolR,(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt__bool__mscC`sdS(N(R(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt getparentpscC`s t|jS(N(tstrR,(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt__str__sscC`s t|jS(N(R8R,(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt __unicode__vscC`s t|jS(N(R2R,(R((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR#ys( R$R%R R0RR"R6R7R9R:R#(((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR*Rs       t TreeWalkercB`s5eZdZdZdZdZdZRS(cC`skt|tr-t||_t|}nt|_t|}tjj||t j |_ dS(N( R tlisttsettfragmentChildrenR)R RtNonRecursiveTreeWalkerR Rt InfosetFiltertfilter(Rttree((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR ~s  c C`st|tr7|\}}tjtt||fSt|trPtjfSt|tr{tj |j |j |j fSt|t rt|d rtjt|jfS|jtjkrtjt|jfS|jtjkrtjt|jdd!fStjt|j}|r:|j\}}nd}t|j}i}xt|jjD]n\}}t|}t|}tj|}|r|||jd|jdfRR7(RRR!((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyt getParentNodes  (R$R%R RVRWRXRY(((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyR;}s  ) N(t __future__RRRtpip._vendor.sixRtlxmlRttreebuilders.etreeRtRRR tobjectR RR)R*R?R;(((sO/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.pyts & +site-packages/pip/_vendor/html5lib/treewalkers/genshi.py000064400000004405147204247350017422 0ustar00from __future__ import absolute_import, division, unicode_literals from genshi.core import QName from genshi.core import START, END, XML_NAMESPACE, DOCTYPE, TEXT from genshi.core import START_NS, END_NS, START_CDATA, END_CDATA, PI, COMMENT from . import base from ..constants import voidElements, namespaces class TreeWalker(base.TreeWalker): def __iter__(self): # Buffer the events so we can pass in the following one previous = None for event in self.tree: if previous is not None: for token in self.tokens(previous, event): yield token previous = event # Don't forget the final event! if previous is not None: for token in self.tokens(previous, None): yield token def tokens(self, event, next): kind, data, _ = event if kind == START: tag, attribs = data name = tag.localname namespace = tag.namespace converted_attribs = {} for k, v in attribs: if isinstance(k, QName): converted_attribs[(k.namespace, k.localname)] = v else: converted_attribs[(None, k)] = v if namespace == namespaces["html"] and name in voidElements: for token in self.emptyTag(namespace, name, converted_attribs, not next or next[0] != END or next[1] != tag): yield token else: yield self.startTag(namespace, name, converted_attribs) elif kind == END: name = data.localname namespace = data.namespace if namespace != namespaces["html"] or name not in voidElements: yield self.endTag(namespace, name) elif kind == COMMENT: yield self.comment(data) elif kind == TEXT: for token in self.text(data): yield token elif kind == DOCTYPE: yield self.doctype(*data) elif kind in (XML_NAMESPACE, DOCTYPE, START_NS, END_NS, START_CDATA, END_CDATA, PI): pass else: yield self.unknown(kind) site-packages/pip/_vendor/html5lib/treewalkers/genshi.pyc000064400000004606147204247350017570 0ustar00 abc@`sddlmZmZmZddlmZddlmZmZmZm Z m Z ddlm Z m Z m Z mZmZmZddlmZddlmZmZd ejfd YZd S( i(tabsolute_importtdivisiontunicode_literals(tQName(tSTARTtENDt XML_NAMESPACEtDOCTYPEtTEXT(tSTART_NStEND_NSt START_CDATAt END_CDATAtPItCOMMENTi(tbasei(t voidElementst namespacest TreeWalkercB`seZdZdZRS(cc`sd}xH|jD]=}|dk rGx"|j||D] }|Vq5Wn|}qW|dk rx"|j|dD] }|VqpWndS(N(tNonettreettokens(tselftpreviousteventttoken((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/genshi.pyt__iter__ s    cc`s|\}}}|tkr |\}}|j}|j} i} xL|D]D\} } t| trz| | | j| jfs (.site-packages/pip/_vendor/html5lib/treewalkers/genshi.pyo000064400000004606147204247350017604 0ustar00 abc@`sddlmZmZmZddlmZddlmZmZmZm Z m Z ddlm Z m Z m Z mZmZmZddlmZddlmZmZd ejfd YZd S( i(tabsolute_importtdivisiontunicode_literals(tQName(tSTARTtENDt XML_NAMESPACEtDOCTYPEtTEXT(tSTART_NStEND_NSt START_CDATAt END_CDATAtPItCOMMENTi(tbasei(t voidElementst namespacest TreeWalkercB`seZdZdZRS(cc`sd}xH|jD]=}|dk rGx"|j||D] }|Vq5Wn|}qW|dk rx"|j|dD] }|VqpWndS(N(tNonettreettokens(tselftpreviousteventttoken((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/genshi.pyt__iter__ s    cc`s|\}}}|tkr |\}}|j}|j} i} xL|D]D\} } t| trz| | | j| jfs (.site-packages/pip/_vendor/html5lib/__init__.py000064400000001414147204247350015351 0ustar00""" HTML parsing library based on the WHATWG "HTML5" specification. The parser is designed to be compatible with existing HTML found in the wild and implements well-defined error recovery that is largely compatible with modern desktop web browsers. Example usage: import html5lib f = open("my_document.html") tree = html5lib.parse(f) """ from __future__ import absolute_import, division, unicode_literals from .html5parser import HTMLParser, parse, parseFragment from .treebuilders import getTreeBuilder from .treewalkers import getTreeWalker from .serializer import serialize __all__ = ["HTMLParser", "parse", "parseFragment", "getTreeBuilder", "getTreeWalker", "serialize"] # this has to be at the top level, see how setup.py parses this __version__ = "1.0b10" site-packages/pip/_vendor/html5lib/__init__.pyc000064400000002112147204247350015510 0ustar00 abc@`sdZddlmZmZmZddlmZmZmZddl m Z ddl m Z ddl mZdd d d d d gZdZdS(uM HTML parsing library based on the WHATWG "HTML5" specification. The parser is designed to be compatible with existing HTML found in the wild and implements well-defined error recovery that is largely compatible with modern desktop web browsers. Example usage: import html5lib f = open("my_document.html") tree = html5lib.parse(f) i(tabsolute_importtdivisiontunicode_literalsi(t HTMLParsertparset parseFragment(tgetTreeBuilder(t getTreeWalker(t serializeu HTMLParseruparseu parseFragmentugetTreeBuilderu getTreeWalkeru serializeu1.0b10N(t__doc__t __future__RRRt html5parserRRRt treebuildersRt treewalkersRt serializerRt__all__t __version__(((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/__init__.pyt s  site-packages/pip/_vendor/html5lib/__init__.pyo000064400000002112147204247350015524 0ustar00 abc@`sdZddlmZmZmZddlmZmZmZddl m Z ddl m Z ddl mZdd d d d d gZdZdS(uM HTML parsing library based on the WHATWG "HTML5" specification. The parser is designed to be compatible with existing HTML found in the wild and implements well-defined error recovery that is largely compatible with modern desktop web browsers. Example usage: import html5lib f = open("my_document.html") tree = html5lib.parse(f) i(tabsolute_importtdivisiontunicode_literalsi(t HTMLParsertparset parseFragment(tgetTreeBuilder(t getTreeWalker(t serializeu HTMLParseruparseu parseFragmentugetTreeBuilderu getTreeWalkeru serializeu1.0b10N(t__doc__t __future__RRRt html5parserRRRt treebuildersRt treewalkersRt serializerRt__all__t __version__(((sA/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/__init__.pyt s  site-packages/pip/_vendor/html5lib/_ihatexml.py000064400000040501147204247350015564 0ustar00from __future__ import absolute_import, division, unicode_literals import re import warnings from .constants import DataLossWarning baseChar = """ [#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x00FF] | [#x0100-#x0131] | [#x0134-#x013E] | [#x0141-#x0148] | [#x014A-#x017E] | [#x0180-#x01C3] | [#x01CD-#x01F0] | [#x01F4-#x01F5] | [#x01FA-#x0217] | [#x0250-#x02A8] | [#x02BB-#x02C1] | #x0386 | [#x0388-#x038A] | #x038C | [#x038E-#x03A1] | [#x03A3-#x03CE] | [#x03D0-#x03D6] | #x03DA | #x03DC | #x03DE | #x03E0 | [#x03E2-#x03F3] | [#x0401-#x040C] | [#x040E-#x044F] | [#x0451-#x045C] | [#x045E-#x0481] | [#x0490-#x04C4] | [#x04C7-#x04C8] | [#x04CB-#x04CC] | [#x04D0-#x04EB] | [#x04EE-#x04F5] | [#x04F8-#x04F9] | [#x0531-#x0556] | #x0559 | [#x0561-#x0586] | [#x05D0-#x05EA] | [#x05F0-#x05F2] | [#x0621-#x063A] | [#x0641-#x064A] | [#x0671-#x06B7] | [#x06BA-#x06BE] | [#x06C0-#x06CE] | [#x06D0-#x06D3] | #x06D5 | [#x06E5-#x06E6] | [#x0905-#x0939] | #x093D | [#x0958-#x0961] | [#x0985-#x098C] | [#x098F-#x0990] | [#x0993-#x09A8] | [#x09AA-#x09B0] | #x09B2 | [#x09B6-#x09B9] | [#x09DC-#x09DD] | [#x09DF-#x09E1] | [#x09F0-#x09F1] | [#x0A05-#x0A0A] | [#x0A0F-#x0A10] | [#x0A13-#x0A28] | [#x0A2A-#x0A30] | [#x0A32-#x0A33] | [#x0A35-#x0A36] | [#x0A38-#x0A39] | [#x0A59-#x0A5C] | #x0A5E | [#x0A72-#x0A74] | [#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | [#x0A93-#x0AA8] | [#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | #x0ABD | #x0AE0 | [#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28] | [#x0B2A-#x0B30] | [#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D | [#x0B5C-#x0B5D] | [#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90] | [#x0B92-#x0B95] | [#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F] | [#x0BA3-#x0BA4] | [#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9] | [#x0C05-#x0C0C] | [#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33] | [#x0C35-#x0C39] | [#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90] | [#x0C92-#x0CA8] | [#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE | [#x0CE0-#x0CE1] | [#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28] | [#x0D2A-#x0D39] | [#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30 | [#x0E32-#x0E33] | [#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84 | [#x0E87-#x0E88] | #x0E8A | #x0E8D | [#x0E94-#x0E97] | [#x0E99-#x0E9F] | [#x0EA1-#x0EA3] | #x0EA5 | #x0EA7 | [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] | #x0EB0 | [#x0EB2-#x0EB3] | #x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] | [#x0F49-#x0F69] | [#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 | [#x1102-#x1103] | [#x1105-#x1107] | #x1109 | [#x110B-#x110C] | [#x110E-#x1112] | #x113C | #x113E | #x1140 | #x114C | #x114E | #x1150 | [#x1154-#x1155] | #x1159 | [#x115F-#x1161] | #x1163 | #x1165 | #x1167 | #x1169 | [#x116D-#x116E] | [#x1172-#x1173] | #x1175 | #x119E | #x11A8 | #x11AB | [#x11AE-#x11AF] | [#x11B7-#x11B8] | #x11BA | [#x11BC-#x11C2] | #x11EB | #x11F0 | #x11F9 | [#x1E00-#x1E9B] | [#x1EA0-#x1EF9] | [#x1F00-#x1F15] | [#x1F18-#x1F1D] | [#x1F20-#x1F45] | [#x1F48-#x1F4D] | [#x1F50-#x1F57] | #x1F59 | #x1F5B | #x1F5D | [#x1F5F-#x1F7D] | [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE | [#x1FC2-#x1FC4] | [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] | [#x1FE0-#x1FEC] | [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 | [#x212A-#x212B] | #x212E | [#x2180-#x2182] | [#x3041-#x3094] | [#x30A1-#x30FA] | [#x3105-#x312C] | [#xAC00-#xD7A3]""" ideographic = """[#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]""" combiningCharacter = """ [#x0300-#x0345] | [#x0360-#x0361] | [#x0483-#x0486] | [#x0591-#x05A1] | [#x05A3-#x05B9] | [#x05BB-#x05BD] | #x05BF | [#x05C1-#x05C2] | #x05C4 | [#x064B-#x0652] | #x0670 | [#x06D6-#x06DC] | [#x06DD-#x06DF] | [#x06E0-#x06E4] | [#x06E7-#x06E8] | [#x06EA-#x06ED] | [#x0901-#x0903] | #x093C | [#x093E-#x094C] | #x094D | [#x0951-#x0954] | [#x0962-#x0963] | [#x0981-#x0983] | #x09BC | #x09BE | #x09BF | [#x09C0-#x09C4] | [#x09C7-#x09C8] | [#x09CB-#x09CD] | #x09D7 | [#x09E2-#x09E3] | #x0A02 | #x0A3C | #x0A3E | #x0A3F | [#x0A40-#x0A42] | [#x0A47-#x0A48] | [#x0A4B-#x0A4D] | [#x0A70-#x0A71] | [#x0A81-#x0A83] | #x0ABC | [#x0ABE-#x0AC5] | [#x0AC7-#x0AC9] | [#x0ACB-#x0ACD] | [#x0B01-#x0B03] | #x0B3C | [#x0B3E-#x0B43] | [#x0B47-#x0B48] | [#x0B4B-#x0B4D] | [#x0B56-#x0B57] | [#x0B82-#x0B83] | [#x0BBE-#x0BC2] | [#x0BC6-#x0BC8] | [#x0BCA-#x0BCD] | #x0BD7 | [#x0C01-#x0C03] | [#x0C3E-#x0C44] | [#x0C46-#x0C48] | [#x0C4A-#x0C4D] | [#x0C55-#x0C56] | [#x0C82-#x0C83] | [#x0CBE-#x0CC4] | [#x0CC6-#x0CC8] | [#x0CCA-#x0CCD] | [#x0CD5-#x0CD6] | [#x0D02-#x0D03] | [#x0D3E-#x0D43] | [#x0D46-#x0D48] | [#x0D4A-#x0D4D] | #x0D57 | #x0E31 | [#x0E34-#x0E3A] | [#x0E47-#x0E4E] | #x0EB1 | [#x0EB4-#x0EB9] | [#x0EBB-#x0EBC] | [#x0EC8-#x0ECD] | [#x0F18-#x0F19] | #x0F35 | #x0F37 | #x0F39 | #x0F3E | #x0F3F | [#x0F71-#x0F84] | [#x0F86-#x0F8B] | [#x0F90-#x0F95] | #x0F97 | [#x0F99-#x0FAD] | [#x0FB1-#x0FB7] | #x0FB9 | [#x20D0-#x20DC] | #x20E1 | [#x302A-#x302F] | #x3099 | #x309A""" digit = """ [#x0030-#x0039] | [#x0660-#x0669] | [#x06F0-#x06F9] | [#x0966-#x096F] | [#x09E6-#x09EF] | [#x0A66-#x0A6F] | [#x0AE6-#x0AEF] | [#x0B66-#x0B6F] | [#x0BE7-#x0BEF] | [#x0C66-#x0C6F] | [#x0CE6-#x0CEF] | [#x0D66-#x0D6F] | [#x0E50-#x0E59] | [#x0ED0-#x0ED9] | [#x0F20-#x0F29]""" extender = """ #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | #x0E46 | #x0EC6 | #x3005 | #[#x3031-#x3035] | [#x309D-#x309E] | [#x30FC-#x30FE]""" letter = " | ".join([baseChar, ideographic]) # Without the name = " | ".join([letter, digit, ".", "-", "_", combiningCharacter, extender]) nameFirst = " | ".join([letter, "_"]) reChar = re.compile(r"#x([\d|A-F]{4,4})") reCharRange = re.compile(r"\[#x([\d|A-F]{4,4})-#x([\d|A-F]{4,4})\]") def charStringToList(chars): charRanges = [item.strip() for item in chars.split(" | ")] rv = [] for item in charRanges: foundMatch = False for regexp in (reChar, reCharRange): match = regexp.match(item) if match is not None: rv.append([hexToInt(item) for item in match.groups()]) if len(rv[-1]) == 1: rv[-1] = rv[-1] * 2 foundMatch = True break if not foundMatch: assert len(item) == 1 rv.append([ord(item)] * 2) rv = normaliseCharList(rv) return rv def normaliseCharList(charList): charList = sorted(charList) for item in charList: assert item[1] >= item[0] rv = [] i = 0 while i < len(charList): j = 1 rv.append(charList[i]) while i + j < len(charList) and charList[i + j][0] <= rv[-1][1] + 1: rv[-1][1] = charList[i + j][1] j += 1 i += j return rv # We don't really support characters above the BMP :( max_unicode = int("FFFF", 16) def missingRanges(charList): rv = [] if charList[0] != 0: rv.append([0, charList[0][0] - 1]) for i, item in enumerate(charList[:-1]): rv.append([item[1] + 1, charList[i + 1][0] - 1]) if charList[-1][1] != max_unicode: rv.append([charList[-1][1] + 1, max_unicode]) return rv def listToRegexpStr(charList): rv = [] for item in charList: if item[0] == item[1]: rv.append(escapeRegexp(chr(item[0]))) else: rv.append(escapeRegexp(chr(item[0])) + "-" + escapeRegexp(chr(item[1]))) return "[%s]" % "".join(rv) def hexToInt(hex_str): return int(hex_str, 16) def escapeRegexp(string): specialCharacters = (".", "^", "$", "*", "+", "?", "{", "}", "[", "]", "|", "(", ")", "-") for char in specialCharacters: string = string.replace(char, "\\" + char) return string # output from the above nonXmlNameBMPRegexp = re.compile('[\x00-,/:-@\\[-\\^`\\{-\xb6\xb8-\xbf\xd7\xf7\u0132-\u0133\u013f-\u0140\u0149\u017f\u01c4-\u01cc\u01f1-\u01f3\u01f6-\u01f9\u0218-\u024f\u02a9-\u02ba\u02c2-\u02cf\u02d2-\u02ff\u0346-\u035f\u0362-\u0385\u038b\u038d\u03a2\u03cf\u03d7-\u03d9\u03db\u03dd\u03df\u03e1\u03f4-\u0400\u040d\u0450\u045d\u0482\u0487-\u048f\u04c5-\u04c6\u04c9-\u04ca\u04cd-\u04cf\u04ec-\u04ed\u04f6-\u04f7\u04fa-\u0530\u0557-\u0558\u055a-\u0560\u0587-\u0590\u05a2\u05ba\u05be\u05c0\u05c3\u05c5-\u05cf\u05eb-\u05ef\u05f3-\u0620\u063b-\u063f\u0653-\u065f\u066a-\u066f\u06b8-\u06b9\u06bf\u06cf\u06d4\u06e9\u06ee-\u06ef\u06fa-\u0900\u0904\u093a-\u093b\u094e-\u0950\u0955-\u0957\u0964-\u0965\u0970-\u0980\u0984\u098d-\u098e\u0991-\u0992\u09a9\u09b1\u09b3-\u09b5\u09ba-\u09bb\u09bd\u09c5-\u09c6\u09c9-\u09ca\u09ce-\u09d6\u09d8-\u09db\u09de\u09e4-\u09e5\u09f2-\u0a01\u0a03-\u0a04\u0a0b-\u0a0e\u0a11-\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a-\u0a3b\u0a3d\u0a43-\u0a46\u0a49-\u0a4a\u0a4e-\u0a58\u0a5d\u0a5f-\u0a65\u0a75-\u0a80\u0a84\u0a8c\u0a8e\u0a92\u0aa9\u0ab1\u0ab4\u0aba-\u0abb\u0ac6\u0aca\u0ace-\u0adf\u0ae1-\u0ae5\u0af0-\u0b00\u0b04\u0b0d-\u0b0e\u0b11-\u0b12\u0b29\u0b31\u0b34-\u0b35\u0b3a-\u0b3b\u0b44-\u0b46\u0b49-\u0b4a\u0b4e-\u0b55\u0b58-\u0b5b\u0b5e\u0b62-\u0b65\u0b70-\u0b81\u0b84\u0b8b-\u0b8d\u0b91\u0b96-\u0b98\u0b9b\u0b9d\u0ba0-\u0ba2\u0ba5-\u0ba7\u0bab-\u0bad\u0bb6\u0bba-\u0bbd\u0bc3-\u0bc5\u0bc9\u0bce-\u0bd6\u0bd8-\u0be6\u0bf0-\u0c00\u0c04\u0c0d\u0c11\u0c29\u0c34\u0c3a-\u0c3d\u0c45\u0c49\u0c4e-\u0c54\u0c57-\u0c5f\u0c62-\u0c65\u0c70-\u0c81\u0c84\u0c8d\u0c91\u0ca9\u0cb4\u0cba-\u0cbd\u0cc5\u0cc9\u0cce-\u0cd4\u0cd7-\u0cdd\u0cdf\u0ce2-\u0ce5\u0cf0-\u0d01\u0d04\u0d0d\u0d11\u0d29\u0d3a-\u0d3d\u0d44-\u0d45\u0d49\u0d4e-\u0d56\u0d58-\u0d5f\u0d62-\u0d65\u0d70-\u0e00\u0e2f\u0e3b-\u0e3f\u0e4f\u0e5a-\u0e80\u0e83\u0e85-\u0e86\u0e89\u0e8b-\u0e8c\u0e8e-\u0e93\u0e98\u0ea0\u0ea4\u0ea6\u0ea8-\u0ea9\u0eac\u0eaf\u0eba\u0ebe-\u0ebf\u0ec5\u0ec7\u0ece-\u0ecf\u0eda-\u0f17\u0f1a-\u0f1f\u0f2a-\u0f34\u0f36\u0f38\u0f3a-\u0f3d\u0f48\u0f6a-\u0f70\u0f85\u0f8c-\u0f8f\u0f96\u0f98\u0fae-\u0fb0\u0fb8\u0fba-\u109f\u10c6-\u10cf\u10f7-\u10ff\u1101\u1104\u1108\u110a\u110d\u1113-\u113b\u113d\u113f\u1141-\u114b\u114d\u114f\u1151-\u1153\u1156-\u1158\u115a-\u115e\u1162\u1164\u1166\u1168\u116a-\u116c\u116f-\u1171\u1174\u1176-\u119d\u119f-\u11a7\u11a9-\u11aa\u11ac-\u11ad\u11b0-\u11b6\u11b9\u11bb\u11c3-\u11ea\u11ec-\u11ef\u11f1-\u11f8\u11fa-\u1dff\u1e9c-\u1e9f\u1efa-\u1eff\u1f16-\u1f17\u1f1e-\u1f1f\u1f46-\u1f47\u1f4e-\u1f4f\u1f58\u1f5a\u1f5c\u1f5e\u1f7e-\u1f7f\u1fb5\u1fbd\u1fbf-\u1fc1\u1fc5\u1fcd-\u1fcf\u1fd4-\u1fd5\u1fdc-\u1fdf\u1fed-\u1ff1\u1ff5\u1ffd-\u20cf\u20dd-\u20e0\u20e2-\u2125\u2127-\u2129\u212c-\u212d\u212f-\u217f\u2183-\u3004\u3006\u3008-\u3020\u3030\u3036-\u3040\u3095-\u3098\u309b-\u309c\u309f-\u30a0\u30fb\u30ff-\u3104\u312d-\u4dff\u9fa6-\uabff\ud7a4-\uffff]') # noqa nonXmlNameFirstBMPRegexp = re.compile('[\x00-@\\[-\\^`\\{-\xbf\xd7\xf7\u0132-\u0133\u013f-\u0140\u0149\u017f\u01c4-\u01cc\u01f1-\u01f3\u01f6-\u01f9\u0218-\u024f\u02a9-\u02ba\u02c2-\u0385\u0387\u038b\u038d\u03a2\u03cf\u03d7-\u03d9\u03db\u03dd\u03df\u03e1\u03f4-\u0400\u040d\u0450\u045d\u0482-\u048f\u04c5-\u04c6\u04c9-\u04ca\u04cd-\u04cf\u04ec-\u04ed\u04f6-\u04f7\u04fa-\u0530\u0557-\u0558\u055a-\u0560\u0587-\u05cf\u05eb-\u05ef\u05f3-\u0620\u063b-\u0640\u064b-\u0670\u06b8-\u06b9\u06bf\u06cf\u06d4\u06d6-\u06e4\u06e7-\u0904\u093a-\u093c\u093e-\u0957\u0962-\u0984\u098d-\u098e\u0991-\u0992\u09a9\u09b1\u09b3-\u09b5\u09ba-\u09db\u09de\u09e2-\u09ef\u09f2-\u0a04\u0a0b-\u0a0e\u0a11-\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a-\u0a58\u0a5d\u0a5f-\u0a71\u0a75-\u0a84\u0a8c\u0a8e\u0a92\u0aa9\u0ab1\u0ab4\u0aba-\u0abc\u0abe-\u0adf\u0ae1-\u0b04\u0b0d-\u0b0e\u0b11-\u0b12\u0b29\u0b31\u0b34-\u0b35\u0b3a-\u0b3c\u0b3e-\u0b5b\u0b5e\u0b62-\u0b84\u0b8b-\u0b8d\u0b91\u0b96-\u0b98\u0b9b\u0b9d\u0ba0-\u0ba2\u0ba5-\u0ba7\u0bab-\u0bad\u0bb6\u0bba-\u0c04\u0c0d\u0c11\u0c29\u0c34\u0c3a-\u0c5f\u0c62-\u0c84\u0c8d\u0c91\u0ca9\u0cb4\u0cba-\u0cdd\u0cdf\u0ce2-\u0d04\u0d0d\u0d11\u0d29\u0d3a-\u0d5f\u0d62-\u0e00\u0e2f\u0e31\u0e34-\u0e3f\u0e46-\u0e80\u0e83\u0e85-\u0e86\u0e89\u0e8b-\u0e8c\u0e8e-\u0e93\u0e98\u0ea0\u0ea4\u0ea6\u0ea8-\u0ea9\u0eac\u0eaf\u0eb1\u0eb4-\u0ebc\u0ebe-\u0ebf\u0ec5-\u0f3f\u0f48\u0f6a-\u109f\u10c6-\u10cf\u10f7-\u10ff\u1101\u1104\u1108\u110a\u110d\u1113-\u113b\u113d\u113f\u1141-\u114b\u114d\u114f\u1151-\u1153\u1156-\u1158\u115a-\u115e\u1162\u1164\u1166\u1168\u116a-\u116c\u116f-\u1171\u1174\u1176-\u119d\u119f-\u11a7\u11a9-\u11aa\u11ac-\u11ad\u11b0-\u11b6\u11b9\u11bb\u11c3-\u11ea\u11ec-\u11ef\u11f1-\u11f8\u11fa-\u1dff\u1e9c-\u1e9f\u1efa-\u1eff\u1f16-\u1f17\u1f1e-\u1f1f\u1f46-\u1f47\u1f4e-\u1f4f\u1f58\u1f5a\u1f5c\u1f5e\u1f7e-\u1f7f\u1fb5\u1fbd\u1fbf-\u1fc1\u1fc5\u1fcd-\u1fcf\u1fd4-\u1fd5\u1fdc-\u1fdf\u1fed-\u1ff1\u1ff5\u1ffd-\u2125\u2127-\u2129\u212c-\u212d\u212f-\u217f\u2183-\u3006\u3008-\u3020\u302a-\u3040\u3095-\u30a0\u30fb-\u3104\u312d-\u4dff\u9fa6-\uabff\ud7a4-\uffff]') # noqa # Simpler things nonPubidCharRegexp = re.compile("[^\x20\x0D\x0Aa-zA-Z0-9\-\'()+,./:=?;!*#@$_%]") class InfosetFilter(object): replacementRegexp = re.compile(r"U[\dA-F]{5,5}") def __init__(self, dropXmlnsLocalName=False, dropXmlnsAttrNs=False, preventDoubleDashComments=False, preventDashAtCommentEnd=False, replaceFormFeedCharacters=True, preventSingleQuotePubid=False): self.dropXmlnsLocalName = dropXmlnsLocalName self.dropXmlnsAttrNs = dropXmlnsAttrNs self.preventDoubleDashComments = preventDoubleDashComments self.preventDashAtCommentEnd = preventDashAtCommentEnd self.replaceFormFeedCharacters = replaceFormFeedCharacters self.preventSingleQuotePubid = preventSingleQuotePubid self.replaceCache = {} def coerceAttribute(self, name, namespace=None): if self.dropXmlnsLocalName and name.startswith("xmlns:"): warnings.warn("Attributes cannot begin with xmlns", DataLossWarning) return None elif (self.dropXmlnsAttrNs and namespace == "http://www.w3.org/2000/xmlns/"): warnings.warn("Attributes cannot be in the xml namespace", DataLossWarning) return None else: return self.toXmlName(name) def coerceElement(self, name): return self.toXmlName(name) def coerceComment(self, data): if self.preventDoubleDashComments: while "--" in data: warnings.warn("Comments cannot contain adjacent dashes", DataLossWarning) data = data.replace("--", "- -") if data.endswith("-"): warnings.warn("Comments cannot end in a dash", DataLossWarning) data += " " return data def coerceCharacters(self, data): if self.replaceFormFeedCharacters: for _ in range(data.count("\x0C")): warnings.warn("Text cannot contain U+000C", DataLossWarning) data = data.replace("\x0C", " ") # Other non-xml characters return data def coercePubid(self, data): dataOutput = data for char in nonPubidCharRegexp.findall(data): warnings.warn("Coercing non-XML pubid", DataLossWarning) replacement = self.getReplacementCharacter(char) dataOutput = dataOutput.replace(char, replacement) if self.preventSingleQuotePubid and dataOutput.find("'") >= 0: warnings.warn("Pubid cannot contain single quote", DataLossWarning) dataOutput = dataOutput.replace("'", self.getReplacementCharacter("'")) return dataOutput def toXmlName(self, name): nameFirst = name[0] nameRest = name[1:] m = nonXmlNameFirstBMPRegexp.match(nameFirst) if m: warnings.warn("Coercing non-XML name", DataLossWarning) nameFirstOutput = self.getReplacementCharacter(nameFirst) else: nameFirstOutput = nameFirst nameRestOutput = nameRest replaceChars = set(nonXmlNameBMPRegexp.findall(nameRest)) for char in replaceChars: warnings.warn("Coercing non-XML name", DataLossWarning) replacement = self.getReplacementCharacter(char) nameRestOutput = nameRestOutput.replace(char, replacement) return nameFirstOutput + nameRestOutput def getReplacementCharacter(self, char): if char in self.replaceCache: replacement = self.replaceCache[char] else: replacement = self.escapeChar(char) return replacement def fromXmlName(self, name): for item in set(self.replacementRegexp.findall(name)): name = name.replace(item, self.unescapeChar(item)) return name def escapeChar(self, char): replacement = "U%05X" % ord(char) self.replaceCache[char] = replacement return replacement def unescapeChar(self, charcode): return chr(int(charcode[1:], 16)) site-packages/pip/_vendor/html5lib/_ihatexml.pyc000064400000036273147204247350015742 0ustar00 abc@`sZddlmZmZmZddlZddlZddlmZdZdZ dZ dZ d Z d j ee gZd j ee d d d e e gZd j ed gZejdZejdZdZdZeddZdZdZdZdZejdZejdZejdZdefdYZ dS(i(tabsolute_importtdivisiontunicode_literalsNi(tDataLossWarningu^ [#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x00FF] | [#x0100-#x0131] | [#x0134-#x013E] | [#x0141-#x0148] | [#x014A-#x017E] | [#x0180-#x01C3] | [#x01CD-#x01F0] | [#x01F4-#x01F5] | [#x01FA-#x0217] | [#x0250-#x02A8] | [#x02BB-#x02C1] | #x0386 | [#x0388-#x038A] | #x038C | [#x038E-#x03A1] | [#x03A3-#x03CE] | [#x03D0-#x03D6] | #x03DA | #x03DC | #x03DE | #x03E0 | [#x03E2-#x03F3] | [#x0401-#x040C] | [#x040E-#x044F] | [#x0451-#x045C] | [#x045E-#x0481] | [#x0490-#x04C4] | [#x04C7-#x04C8] | [#x04CB-#x04CC] | [#x04D0-#x04EB] | [#x04EE-#x04F5] | [#x04F8-#x04F9] | [#x0531-#x0556] | #x0559 | [#x0561-#x0586] | [#x05D0-#x05EA] | [#x05F0-#x05F2] | [#x0621-#x063A] | [#x0641-#x064A] | [#x0671-#x06B7] | [#x06BA-#x06BE] | [#x06C0-#x06CE] | [#x06D0-#x06D3] | #x06D5 | [#x06E5-#x06E6] | [#x0905-#x0939] | #x093D | [#x0958-#x0961] | [#x0985-#x098C] | [#x098F-#x0990] | [#x0993-#x09A8] | [#x09AA-#x09B0] | #x09B2 | [#x09B6-#x09B9] | [#x09DC-#x09DD] | [#x09DF-#x09E1] | [#x09F0-#x09F1] | [#x0A05-#x0A0A] | [#x0A0F-#x0A10] | [#x0A13-#x0A28] | [#x0A2A-#x0A30] | [#x0A32-#x0A33] | [#x0A35-#x0A36] | [#x0A38-#x0A39] | [#x0A59-#x0A5C] | #x0A5E | [#x0A72-#x0A74] | [#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | [#x0A93-#x0AA8] | [#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | #x0ABD | #x0AE0 | [#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28] | [#x0B2A-#x0B30] | [#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D | [#x0B5C-#x0B5D] | [#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90] | [#x0B92-#x0B95] | [#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F] | [#x0BA3-#x0BA4] | [#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9] | [#x0C05-#x0C0C] | [#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33] | [#x0C35-#x0C39] | [#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90] | [#x0C92-#x0CA8] | [#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE | [#x0CE0-#x0CE1] | [#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28] | [#x0D2A-#x0D39] | [#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30 | [#x0E32-#x0E33] | [#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84 | [#x0E87-#x0E88] | #x0E8A | #x0E8D | [#x0E94-#x0E97] | [#x0E99-#x0E9F] | [#x0EA1-#x0EA3] | #x0EA5 | #x0EA7 | [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] | #x0EB0 | [#x0EB2-#x0EB3] | #x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] | [#x0F49-#x0F69] | [#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 | [#x1102-#x1103] | [#x1105-#x1107] | #x1109 | [#x110B-#x110C] | [#x110E-#x1112] | #x113C | #x113E | #x1140 | #x114C | #x114E | #x1150 | [#x1154-#x1155] | #x1159 | [#x115F-#x1161] | #x1163 | #x1165 | #x1167 | #x1169 | [#x116D-#x116E] | [#x1172-#x1173] | #x1175 | #x119E | #x11A8 | #x11AB | [#x11AE-#x11AF] | [#x11B7-#x11B8] | #x11BA | [#x11BC-#x11C2] | #x11EB | #x11F0 | #x11F9 | [#x1E00-#x1E9B] | [#x1EA0-#x1EF9] | [#x1F00-#x1F15] | [#x1F18-#x1F1D] | [#x1F20-#x1F45] | [#x1F48-#x1F4D] | [#x1F50-#x1F57] | #x1F59 | #x1F5B | #x1F5D | [#x1F5F-#x1F7D] | [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE | [#x1FC2-#x1FC4] | [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] | [#x1FE0-#x1FEC] | [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 | [#x212A-#x212B] | #x212E | [#x2180-#x2182] | [#x3041-#x3094] | [#x30A1-#x30FA] | [#x3105-#x312C] | [#xAC00-#xD7A3]u*[#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]u [#x0300-#x0345] | [#x0360-#x0361] | [#x0483-#x0486] | [#x0591-#x05A1] | [#x05A3-#x05B9] | [#x05BB-#x05BD] | #x05BF | [#x05C1-#x05C2] | #x05C4 | [#x064B-#x0652] | #x0670 | [#x06D6-#x06DC] | [#x06DD-#x06DF] | [#x06E0-#x06E4] | [#x06E7-#x06E8] | [#x06EA-#x06ED] | [#x0901-#x0903] | #x093C | [#x093E-#x094C] | #x094D | [#x0951-#x0954] | [#x0962-#x0963] | [#x0981-#x0983] | #x09BC | #x09BE | #x09BF | [#x09C0-#x09C4] | [#x09C7-#x09C8] | [#x09CB-#x09CD] | #x09D7 | [#x09E2-#x09E3] | #x0A02 | #x0A3C | #x0A3E | #x0A3F | [#x0A40-#x0A42] | [#x0A47-#x0A48] | [#x0A4B-#x0A4D] | [#x0A70-#x0A71] | [#x0A81-#x0A83] | #x0ABC | [#x0ABE-#x0AC5] | [#x0AC7-#x0AC9] | [#x0ACB-#x0ACD] | [#x0B01-#x0B03] | #x0B3C | [#x0B3E-#x0B43] | [#x0B47-#x0B48] | [#x0B4B-#x0B4D] | [#x0B56-#x0B57] | [#x0B82-#x0B83] | [#x0BBE-#x0BC2] | [#x0BC6-#x0BC8] | [#x0BCA-#x0BCD] | #x0BD7 | [#x0C01-#x0C03] | [#x0C3E-#x0C44] | [#x0C46-#x0C48] | [#x0C4A-#x0C4D] | [#x0C55-#x0C56] | [#x0C82-#x0C83] | [#x0CBE-#x0CC4] | [#x0CC6-#x0CC8] | [#x0CCA-#x0CCD] | [#x0CD5-#x0CD6] | [#x0D02-#x0D03] | [#x0D3E-#x0D43] | [#x0D46-#x0D48] | [#x0D4A-#x0D4D] | #x0D57 | #x0E31 | [#x0E34-#x0E3A] | [#x0E47-#x0E4E] | #x0EB1 | [#x0EB4-#x0EB9] | [#x0EBB-#x0EBC] | [#x0EC8-#x0ECD] | [#x0F18-#x0F19] | #x0F35 | #x0F37 | #x0F39 | #x0F3E | #x0F3F | [#x0F71-#x0F84] | [#x0F86-#x0F8B] | [#x0F90-#x0F95] | #x0F97 | [#x0F99-#x0FAD] | [#x0FB1-#x0FB7] | #x0FB9 | [#x20D0-#x20DC] | #x20E1 | [#x302A-#x302F] | #x3099 | #x309Au  [#x0030-#x0039] | [#x0660-#x0669] | [#x06F0-#x06F9] | [#x0966-#x096F] | [#x09E6-#x09EF] | [#x0A66-#x0A6F] | [#x0AE6-#x0AEF] | [#x0B66-#x0B6F] | [#x0BE7-#x0BEF] | [#x0C66-#x0C6F] | [#x0CE6-#x0CEF] | [#x0D66-#x0D6F] | [#x0E50-#x0E59] | [#x0ED0-#x0ED9] | [#x0F20-#x0F29]u} #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | #x0E46 | #x0EC6 | #x3005 | #[#x3031-#x3035] | [#x309D-#x309E] | [#x30FC-#x30FE]u | u.u-u_u#x([\d|A-F]{4,4})u'\[#x([\d|A-F]{4,4})-#x([\d|A-F]{4,4})\]cC`s#g|jdD]}|j^q}g}x|D]}t}xttfD]}|j|}|dk rN|jg|jD]}t |^qt |ddkr|dd|dt_((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_ihatexml.pytcoerceCharacterss  cC`s|}xHtj|D]7}tjdt|j|}|j||}qW|jr|jddkrtjdt|jd|jd}n|S(NuCoercing non-XML pubidu'iu!Pubid cannot contain single quote( tnonPubidCharRegexptfindallR6R7RtgetReplacementCharacterR'R1tfind(R3R>t dataOutputR*t replacement((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_ihatexml.pyt coercePubidsc C`s|d}|d}tj|}|rKtjdt|j|}n|}|}ttj|}x?|D]7}tjdt|j|} |j || }qsW||S(NiiuCoercing non-XML name( tnonXmlNameFirstBMPRegexpR R6R7RRFtsettnonXmlNameBMPRegexpRER'( R3R9t nameFirsttnameResttmtnameFirstOutputtnameRestOutputt replaceCharsR*RI((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_ihatexml.pyR8s   cC`s2||jkr|j|}n|j|}|S(N(R2t escapeChar(R3R*RI((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_ihatexml.pyRFscC`sBx;t|jj|D]!}|j||j|}qW|S(N(RLtreplacementRegexpRER't unescapeChar(R3R9R((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_ihatexml.pyt fromXmlNamescC`s!dt|}||j|<|S(NuU%05X(RR2(R3R*RI((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_ihatexml.pyRTs cC`stt|ddS(Nii(R"R%(R3tcharcode((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_ihatexml.pyRVsN(t__name__t __module__tretcompileRURRR4R R;R<R?RCRJR8RFRWRTRV(((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_ihatexml.pyR+s"       (!t __future__RRRR[R6t constantsRtbaseChart ideographictcombiningCharactertdigittextenderR#tletterR9RNR\RRRRR%RR R$R R!RMRKRDtobjectR+(((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_ihatexml.pyts2  0     site-packages/pip/_vendor/html5lib/_ihatexml.pyo000064400000036157147204247350015757 0ustar00 abc@`sZddlmZmZmZddlZddlZddlmZdZdZ dZ dZ d Z d j ee gZd j ee d d d e e gZd j ed gZejdZejdZdZdZeddZdZdZdZdZejdZejdZejdZdefdYZ dS(i(tabsolute_importtdivisiontunicode_literalsNi(tDataLossWarningu^ [#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x00FF] | [#x0100-#x0131] | [#x0134-#x013E] | [#x0141-#x0148] | [#x014A-#x017E] | [#x0180-#x01C3] | [#x01CD-#x01F0] | [#x01F4-#x01F5] | [#x01FA-#x0217] | [#x0250-#x02A8] | [#x02BB-#x02C1] | #x0386 | [#x0388-#x038A] | #x038C | [#x038E-#x03A1] | [#x03A3-#x03CE] | [#x03D0-#x03D6] | #x03DA | #x03DC | #x03DE | #x03E0 | [#x03E2-#x03F3] | [#x0401-#x040C] | [#x040E-#x044F] | [#x0451-#x045C] | [#x045E-#x0481] | [#x0490-#x04C4] | [#x04C7-#x04C8] | [#x04CB-#x04CC] | [#x04D0-#x04EB] | [#x04EE-#x04F5] | [#x04F8-#x04F9] | [#x0531-#x0556] | #x0559 | [#x0561-#x0586] | [#x05D0-#x05EA] | [#x05F0-#x05F2] | [#x0621-#x063A] | [#x0641-#x064A] | [#x0671-#x06B7] | [#x06BA-#x06BE] | [#x06C0-#x06CE] | [#x06D0-#x06D3] | #x06D5 | [#x06E5-#x06E6] | [#x0905-#x0939] | #x093D | [#x0958-#x0961] | [#x0985-#x098C] | [#x098F-#x0990] | [#x0993-#x09A8] | [#x09AA-#x09B0] | #x09B2 | [#x09B6-#x09B9] | [#x09DC-#x09DD] | [#x09DF-#x09E1] | [#x09F0-#x09F1] | [#x0A05-#x0A0A] | [#x0A0F-#x0A10] | [#x0A13-#x0A28] | [#x0A2A-#x0A30] | [#x0A32-#x0A33] | [#x0A35-#x0A36] | [#x0A38-#x0A39] | [#x0A59-#x0A5C] | #x0A5E | [#x0A72-#x0A74] | [#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | [#x0A93-#x0AA8] | [#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | #x0ABD | #x0AE0 | [#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28] | [#x0B2A-#x0B30] | [#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D | [#x0B5C-#x0B5D] | [#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90] | [#x0B92-#x0B95] | [#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F] | [#x0BA3-#x0BA4] | [#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9] | [#x0C05-#x0C0C] | [#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33] | [#x0C35-#x0C39] | [#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90] | [#x0C92-#x0CA8] | [#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE | [#x0CE0-#x0CE1] | [#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28] | [#x0D2A-#x0D39] | [#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30 | [#x0E32-#x0E33] | [#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84 | [#x0E87-#x0E88] | #x0E8A | #x0E8D | [#x0E94-#x0E97] | [#x0E99-#x0E9F] | [#x0EA1-#x0EA3] | #x0EA5 | #x0EA7 | [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] | #x0EB0 | [#x0EB2-#x0EB3] | #x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] | [#x0F49-#x0F69] | [#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 | [#x1102-#x1103] | [#x1105-#x1107] | #x1109 | [#x110B-#x110C] | [#x110E-#x1112] | #x113C | #x113E | #x1140 | #x114C | #x114E | #x1150 | [#x1154-#x1155] | #x1159 | [#x115F-#x1161] | #x1163 | #x1165 | #x1167 | #x1169 | [#x116D-#x116E] | [#x1172-#x1173] | #x1175 | #x119E | #x11A8 | #x11AB | [#x11AE-#x11AF] | [#x11B7-#x11B8] | #x11BA | [#x11BC-#x11C2] | #x11EB | #x11F0 | #x11F9 | [#x1E00-#x1E9B] | [#x1EA0-#x1EF9] | [#x1F00-#x1F15] | [#x1F18-#x1F1D] | [#x1F20-#x1F45] | [#x1F48-#x1F4D] | [#x1F50-#x1F57] | #x1F59 | #x1F5B | #x1F5D | [#x1F5F-#x1F7D] | [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE | [#x1FC2-#x1FC4] | [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] | [#x1FE0-#x1FEC] | [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 | [#x212A-#x212B] | #x212E | [#x2180-#x2182] | [#x3041-#x3094] | [#x30A1-#x30FA] | [#x3105-#x312C] | [#xAC00-#xD7A3]u*[#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]u [#x0300-#x0345] | [#x0360-#x0361] | [#x0483-#x0486] | [#x0591-#x05A1] | [#x05A3-#x05B9] | [#x05BB-#x05BD] | #x05BF | [#x05C1-#x05C2] | #x05C4 | [#x064B-#x0652] | #x0670 | [#x06D6-#x06DC] | [#x06DD-#x06DF] | [#x06E0-#x06E4] | [#x06E7-#x06E8] | [#x06EA-#x06ED] | [#x0901-#x0903] | #x093C | [#x093E-#x094C] | #x094D | [#x0951-#x0954] | [#x0962-#x0963] | [#x0981-#x0983] | #x09BC | #x09BE | #x09BF | [#x09C0-#x09C4] | [#x09C7-#x09C8] | [#x09CB-#x09CD] | #x09D7 | [#x09E2-#x09E3] | #x0A02 | #x0A3C | #x0A3E | #x0A3F | [#x0A40-#x0A42] | [#x0A47-#x0A48] | [#x0A4B-#x0A4D] | [#x0A70-#x0A71] | [#x0A81-#x0A83] | #x0ABC | [#x0ABE-#x0AC5] | [#x0AC7-#x0AC9] | [#x0ACB-#x0ACD] | [#x0B01-#x0B03] | #x0B3C | [#x0B3E-#x0B43] | [#x0B47-#x0B48] | [#x0B4B-#x0B4D] | [#x0B56-#x0B57] | [#x0B82-#x0B83] | [#x0BBE-#x0BC2] | [#x0BC6-#x0BC8] | [#x0BCA-#x0BCD] | #x0BD7 | [#x0C01-#x0C03] | [#x0C3E-#x0C44] | [#x0C46-#x0C48] | [#x0C4A-#x0C4D] | [#x0C55-#x0C56] | [#x0C82-#x0C83] | [#x0CBE-#x0CC4] | [#x0CC6-#x0CC8] | [#x0CCA-#x0CCD] | [#x0CD5-#x0CD6] | [#x0D02-#x0D03] | [#x0D3E-#x0D43] | [#x0D46-#x0D48] | [#x0D4A-#x0D4D] | #x0D57 | #x0E31 | [#x0E34-#x0E3A] | [#x0E47-#x0E4E] | #x0EB1 | [#x0EB4-#x0EB9] | [#x0EBB-#x0EBC] | [#x0EC8-#x0ECD] | [#x0F18-#x0F19] | #x0F35 | #x0F37 | #x0F39 | #x0F3E | #x0F3F | [#x0F71-#x0F84] | [#x0F86-#x0F8B] | [#x0F90-#x0F95] | #x0F97 | [#x0F99-#x0FAD] | [#x0FB1-#x0FB7] | #x0FB9 | [#x20D0-#x20DC] | #x20E1 | [#x302A-#x302F] | #x3099 | #x309Au  [#x0030-#x0039] | [#x0660-#x0669] | [#x06F0-#x06F9] | [#x0966-#x096F] | [#x09E6-#x09EF] | [#x0A66-#x0A6F] | [#x0AE6-#x0AEF] | [#x0B66-#x0B6F] | [#x0BE7-#x0BEF] | [#x0C66-#x0C6F] | [#x0CE6-#x0CEF] | [#x0D66-#x0D6F] | [#x0E50-#x0E59] | [#x0ED0-#x0ED9] | [#x0F20-#x0F29]u} #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | #x0E46 | #x0EC6 | #x3005 | #[#x3031-#x3035] | [#x309D-#x309E] | [#x30FC-#x30FE]u | u.u-u_u#x([\d|A-F]{4,4})u'\[#x([\d|A-F]{4,4})-#x([\d|A-F]{4,4})\]cC`s g|jdD]}|j^q}g}x|D]}t}xttfD]}|j|}|dk rN|jg|jD]}t |^qt |ddkr|dd|dRBRIR7RERVRSRU(((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_ihatexml.pyR*s"       (!t __future__RRRRZR5t constantsRtbaseChart ideographictcombiningCharactertdigittextenderR"tletterR8RMR[RRRRR$RRR#R R RLRJRCtobjectR*(((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_ihatexml.pyts2  0     site-packages/pip/_vendor/html5lib/_inputstream.py000064400000077424147204247350016342 0ustar00from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type, binary_type from pip._vendor.six.moves import http_client, urllib import codecs import re from pip._vendor import webencodings from .constants import EOF, spaceCharacters, asciiLetters, asciiUppercase from .constants import ReparseException from . import _utils from io import StringIO try: from io import BytesIO except ImportError: BytesIO = StringIO # Non-unicode versions of constants for use in the pre-parser spaceCharactersBytes = frozenset([item.encode("ascii") for item in spaceCharacters]) asciiLettersBytes = frozenset([item.encode("ascii") for item in asciiLetters]) asciiUppercaseBytes = frozenset([item.encode("ascii") for item in asciiUppercase]) spacesAngleBrackets = spaceCharactersBytes | frozenset([b">", b"<"]) invalid_unicode_no_surrogate = "[\u0001-\u0008\u000B\u000E-\u001F\u007F-\u009F\uFDD0-\uFDEF\uFFFE\uFFFF\U0001FFFE\U0001FFFF\U0002FFFE\U0002FFFF\U0003FFFE\U0003FFFF\U0004FFFE\U0004FFFF\U0005FFFE\U0005FFFF\U0006FFFE\U0006FFFF\U0007FFFE\U0007FFFF\U0008FFFE\U0008FFFF\U0009FFFE\U0009FFFF\U000AFFFE\U000AFFFF\U000BFFFE\U000BFFFF\U000CFFFE\U000CFFFF\U000DFFFE\U000DFFFF\U000EFFFE\U000EFFFF\U000FFFFE\U000FFFFF\U0010FFFE\U0010FFFF]" # noqa if _utils.supports_lone_surrogates: # Use one extra step of indirection and create surrogates with # eval. Not using this indirection would introduce an illegal # unicode literal on platforms not supporting such lone # surrogates. assert invalid_unicode_no_surrogate[-1] == "]" and invalid_unicode_no_surrogate.count("]") == 1 invalid_unicode_re = re.compile(invalid_unicode_no_surrogate[:-1] + eval('"\\uD800-\\uDFFF"') + # pylint:disable=eval-used "]") else: invalid_unicode_re = re.compile(invalid_unicode_no_surrogate) non_bmp_invalid_codepoints = set([0x1FFFE, 0x1FFFF, 0x2FFFE, 0x2FFFF, 0x3FFFE, 0x3FFFF, 0x4FFFE, 0x4FFFF, 0x5FFFE, 0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE, 0x8FFFF, 0x9FFFE, 0x9FFFF, 0xAFFFE, 0xAFFFF, 0xBFFFE, 0xBFFFF, 0xCFFFE, 0xCFFFF, 0xDFFFE, 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE, 0xFFFFF, 0x10FFFE, 0x10FFFF]) ascii_punctuation_re = re.compile("[\u0009-\u000D\u0020-\u002F\u003A-\u0040\u005B-\u0060\u007B-\u007E]") # Cache for charsUntil() charsUntilRegEx = {} class BufferedStream(object): """Buffering for streams that do not have buffering of their own The buffer is implemented as a list of chunks on the assumption that joining many strings will be slow since it is O(n**2) """ def __init__(self, stream): self.stream = stream self.buffer = [] self.position = [-1, 0] # chunk number, offset def tell(self): pos = 0 for chunk in self.buffer[:self.position[0]]: pos += len(chunk) pos += self.position[1] return pos def seek(self, pos): assert pos <= self._bufferedBytes() offset = pos i = 0 while len(self.buffer[i]) < offset: offset -= len(self.buffer[i]) i += 1 self.position = [i, offset] def read(self, bytes): if not self.buffer: return self._readStream(bytes) elif (self.position[0] == len(self.buffer) and self.position[1] == len(self.buffer[-1])): return self._readStream(bytes) else: return self._readFromBuffer(bytes) def _bufferedBytes(self): return sum([len(item) for item in self.buffer]) def _readStream(self, bytes): data = self.stream.read(bytes) self.buffer.append(data) self.position[0] += 1 self.position[1] = len(data) return data def _readFromBuffer(self, bytes): remainingBytes = bytes rv = [] bufferIndex = self.position[0] bufferOffset = self.position[1] while bufferIndex < len(self.buffer) and remainingBytes != 0: assert remainingBytes > 0 bufferedData = self.buffer[bufferIndex] if remainingBytes <= len(bufferedData) - bufferOffset: bytesToRead = remainingBytes self.position = [bufferIndex, bufferOffset + bytesToRead] else: bytesToRead = len(bufferedData) - bufferOffset self.position = [bufferIndex, len(bufferedData)] bufferIndex += 1 rv.append(bufferedData[bufferOffset:bufferOffset + bytesToRead]) remainingBytes -= bytesToRead bufferOffset = 0 if remainingBytes: rv.append(self._readStream(remainingBytes)) return b"".join(rv) def HTMLInputStream(source, **kwargs): # Work around Python bug #20007: read(0) closes the connection. # http://bugs.python.org/issue20007 if (isinstance(source, http_client.HTTPResponse) or # Also check for addinfourl wrapping HTTPResponse (isinstance(source, urllib.response.addbase) and isinstance(source.fp, http_client.HTTPResponse))): isUnicode = False elif hasattr(source, "read"): isUnicode = isinstance(source.read(0), text_type) else: isUnicode = isinstance(source, text_type) if isUnicode: encodings = [x for x in kwargs if x.endswith("_encoding")] if encodings: raise TypeError("Cannot set an encoding with a unicode input, set %r" % encodings) return HTMLUnicodeInputStream(source, **kwargs) else: return HTMLBinaryInputStream(source, **kwargs) class HTMLUnicodeInputStream(object): """Provides a unicode stream of characters to the HTMLTokenizer. This class takes care of character encoding and removing or replacing incorrect byte-sequences and also provides column and line tracking. """ _defaultChunkSize = 10240 def __init__(self, source): """Initialises the HTMLInputStream. HTMLInputStream(source, [encoding]) -> Normalized stream from source for use by html5lib. source can be either a file-object, local filename or a string. The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) """ if not _utils.supports_lone_surrogates: # Such platforms will have already checked for such # surrogate errors, so no need to do this checking. self.reportCharacterErrors = None elif len("\U0010FFFF") == 1: self.reportCharacterErrors = self.characterErrorsUCS4 else: self.reportCharacterErrors = self.characterErrorsUCS2 # List of where new lines occur self.newLines = [0] self.charEncoding = (lookupEncoding("utf-8"), "certain") self.dataStream = self.openStream(source) self.reset() def reset(self): self.chunk = "" self.chunkSize = 0 self.chunkOffset = 0 self.errors = [] # number of (complete) lines in previous chunks self.prevNumLines = 0 # number of columns in the last line of the previous chunk self.prevNumCols = 0 # Deal with CR LF and surrogates split over chunk boundaries self._bufferedCharacter = None def openStream(self, source): """Produces a file object from source. source can be either a file object, local filename or a string. """ # Already a file object if hasattr(source, 'read'): stream = source else: stream = StringIO(source) return stream def _position(self, offset): chunk = self.chunk nLines = chunk.count('\n', 0, offset) positionLine = self.prevNumLines + nLines lastLinePos = chunk.rfind('\n', 0, offset) if lastLinePos == -1: positionColumn = self.prevNumCols + offset else: positionColumn = offset - (lastLinePos + 1) return (positionLine, positionColumn) def position(self): """Returns (line, col) of the current position in the stream.""" line, col = self._position(self.chunkOffset) return (line + 1, col) def char(self): """ Read one character from the stream or queue if available. Return EOF when EOF is reached. """ # Read a new chunk from the input stream if necessary if self.chunkOffset >= self.chunkSize: if not self.readChunk(): return EOF chunkOffset = self.chunkOffset char = self.chunk[chunkOffset] self.chunkOffset = chunkOffset + 1 return char def readChunk(self, chunkSize=None): if chunkSize is None: chunkSize = self._defaultChunkSize self.prevNumLines, self.prevNumCols = self._position(self.chunkSize) self.chunk = "" self.chunkSize = 0 self.chunkOffset = 0 data = self.dataStream.read(chunkSize) # Deal with CR LF and surrogates broken across chunks if self._bufferedCharacter: data = self._bufferedCharacter + data self._bufferedCharacter = None elif not data: # We have no more data, bye-bye stream return False if len(data) > 1: lastv = ord(data[-1]) if lastv == 0x0D or 0xD800 <= lastv <= 0xDBFF: self._bufferedCharacter = data[-1] data = data[:-1] if self.reportCharacterErrors: self.reportCharacterErrors(data) # Replace invalid characters data = data.replace("\r\n", "\n") data = data.replace("\r", "\n") self.chunk = data self.chunkSize = len(data) return True def characterErrorsUCS4(self, data): for _ in range(len(invalid_unicode_re.findall(data))): self.errors.append("invalid-codepoint") def characterErrorsUCS2(self, data): # Someone picked the wrong compile option # You lose skip = False for match in invalid_unicode_re.finditer(data): if skip: continue codepoint = ord(match.group()) pos = match.start() # Pretty sure there should be endianness issues here if _utils.isSurrogatePair(data[pos:pos + 2]): # We have a surrogate pair! char_val = _utils.surrogatePairToCodepoint(data[pos:pos + 2]) if char_val in non_bmp_invalid_codepoints: self.errors.append("invalid-codepoint") skip = True elif (codepoint >= 0xD800 and codepoint <= 0xDFFF and pos == len(data) - 1): self.errors.append("invalid-codepoint") else: skip = False self.errors.append("invalid-codepoint") def charsUntil(self, characters, opposite=False): """ Returns a string of characters from the stream up to but not including any character in 'characters' or EOF. 'characters' must be a container that supports the 'in' method and iteration over its characters. """ # Use a cache of regexps to find the required characters try: chars = charsUntilRegEx[(characters, opposite)] except KeyError: if __debug__: for c in characters: assert(ord(c) < 128) regex = "".join(["\\x%02x" % ord(c) for c in characters]) if not opposite: regex = "^%s" % regex chars = charsUntilRegEx[(characters, opposite)] = re.compile("[%s]+" % regex) rv = [] while True: # Find the longest matching prefix m = chars.match(self.chunk, self.chunkOffset) if m is None: # If nothing matched, and it wasn't because we ran out of chunk, # then stop if self.chunkOffset != self.chunkSize: break else: end = m.end() # If not the whole chunk matched, return everything # up to the part that didn't match if end != self.chunkSize: rv.append(self.chunk[self.chunkOffset:end]) self.chunkOffset = end break # If the whole remainder of the chunk matched, # use it all and read the next chunk rv.append(self.chunk[self.chunkOffset:]) if not self.readChunk(): # Reached EOF break r = "".join(rv) return r def unget(self, char): # Only one character is allowed to be ungotten at once - it must # be consumed again before any further call to unget if char is not None: if self.chunkOffset == 0: # unget is called quite rarely, so it's a good idea to do # more work here if it saves a bit of work in the frequently # called char and charsUntil. # So, just prepend the ungotten character onto the current # chunk: self.chunk = char + self.chunk self.chunkSize += 1 else: self.chunkOffset -= 1 assert self.chunk[self.chunkOffset] == char class HTMLBinaryInputStream(HTMLUnicodeInputStream): """Provides a unicode stream of characters to the HTMLTokenizer. This class takes care of character encoding and removing or replacing incorrect byte-sequences and also provides column and line tracking. """ def __init__(self, source, override_encoding=None, transport_encoding=None, same_origin_parent_encoding=None, likely_encoding=None, default_encoding="windows-1252", useChardet=True): """Initialises the HTMLInputStream. HTMLInputStream(source, [encoding]) -> Normalized stream from source for use by html5lib. source can be either a file-object, local filename or a string. The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) """ # Raw Stream - for unicode objects this will encode to utf-8 and set # self.charEncoding as appropriate self.rawStream = self.openStream(source) HTMLUnicodeInputStream.__init__(self, self.rawStream) # Encoding Information # Number of bytes to use when looking for a meta element with # encoding information self.numBytesMeta = 1024 # Number of bytes to use when using detecting encoding using chardet self.numBytesChardet = 100 # Things from args self.override_encoding = override_encoding self.transport_encoding = transport_encoding self.same_origin_parent_encoding = same_origin_parent_encoding self.likely_encoding = likely_encoding self.default_encoding = default_encoding # Determine encoding self.charEncoding = self.determineEncoding(useChardet) assert self.charEncoding[0] is not None # Call superclass self.reset() def reset(self): self.dataStream = self.charEncoding[0].codec_info.streamreader(self.rawStream, 'replace') HTMLUnicodeInputStream.reset(self) def openStream(self, source): """Produces a file object from source. source can be either a file object, local filename or a string. """ # Already a file object if hasattr(source, 'read'): stream = source else: stream = BytesIO(source) try: stream.seek(stream.tell()) except: # pylint:disable=bare-except stream = BufferedStream(stream) return stream def determineEncoding(self, chardet=True): # BOMs take precedence over everything # This will also read past the BOM if present charEncoding = self.detectBOM(), "certain" if charEncoding[0] is not None: return charEncoding # If we've been overriden, we've been overriden charEncoding = lookupEncoding(self.override_encoding), "certain" if charEncoding[0] is not None: return charEncoding # Now check the transport layer charEncoding = lookupEncoding(self.transport_encoding), "certain" if charEncoding[0] is not None: return charEncoding # Look for meta elements with encoding information charEncoding = self.detectEncodingMeta(), "tentative" if charEncoding[0] is not None: return charEncoding # Parent document encoding charEncoding = lookupEncoding(self.same_origin_parent_encoding), "tentative" if charEncoding[0] is not None and not charEncoding[0].name.startswith("utf-16"): return charEncoding # "likely" encoding charEncoding = lookupEncoding(self.likely_encoding), "tentative" if charEncoding[0] is not None: return charEncoding # Guess with chardet, if available if chardet: try: from chardet.universaldetector import UniversalDetector except ImportError: pass else: buffers = [] detector = UniversalDetector() while not detector.done: buffer = self.rawStream.read(self.numBytesChardet) assert isinstance(buffer, bytes) if not buffer: break buffers.append(buffer) detector.feed(buffer) detector.close() encoding = lookupEncoding(detector.result['encoding']) self.rawStream.seek(0) if encoding is not None: return encoding, "tentative" # Try the default encoding charEncoding = lookupEncoding(self.default_encoding), "tentative" if charEncoding[0] is not None: return charEncoding # Fallback to html5lib's default if even that hasn't worked return lookupEncoding("windows-1252"), "tentative" def changeEncoding(self, newEncoding): assert self.charEncoding[1] != "certain" newEncoding = lookupEncoding(newEncoding) if newEncoding is None: return if newEncoding.name in ("utf-16be", "utf-16le"): newEncoding = lookupEncoding("utf-8") assert newEncoding is not None elif newEncoding == self.charEncoding[0]: self.charEncoding = (self.charEncoding[0], "certain") else: self.rawStream.seek(0) self.charEncoding = (newEncoding, "certain") self.reset() raise ReparseException("Encoding changed from %s to %s" % (self.charEncoding[0], newEncoding)) def detectBOM(self): """Attempts to detect at BOM at the start of the stream. If an encoding can be determined from the BOM return the name of the encoding otherwise return None""" bomDict = { codecs.BOM_UTF8: 'utf-8', codecs.BOM_UTF16_LE: 'utf-16le', codecs.BOM_UTF16_BE: 'utf-16be', codecs.BOM_UTF32_LE: 'utf-32le', codecs.BOM_UTF32_BE: 'utf-32be' } # Go to beginning of file and read in 4 bytes string = self.rawStream.read(4) assert isinstance(string, bytes) # Try detecting the BOM using bytes from the string encoding = bomDict.get(string[:3]) # UTF-8 seek = 3 if not encoding: # Need to detect UTF-32 before UTF-16 encoding = bomDict.get(string) # UTF-32 seek = 4 if not encoding: encoding = bomDict.get(string[:2]) # UTF-16 seek = 2 # Set the read position past the BOM if one was found, otherwise # set it to the start of the stream if encoding: self.rawStream.seek(seek) return lookupEncoding(encoding) else: self.rawStream.seek(0) return None def detectEncodingMeta(self): """Report the encoding declared by the meta element """ buffer = self.rawStream.read(self.numBytesMeta) assert isinstance(buffer, bytes) parser = EncodingParser(buffer) self.rawStream.seek(0) encoding = parser.getEncoding() if encoding is not None and encoding.name in ("utf-16be", "utf-16le"): encoding = lookupEncoding("utf-8") return encoding class EncodingBytes(bytes): """String-like object with an associated position and various extra methods If the position is ever greater than the string length then an exception is raised""" def __new__(self, value): assert isinstance(value, bytes) return bytes.__new__(self, value.lower()) def __init__(self, value): # pylint:disable=unused-argument self._position = -1 def __iter__(self): return self def __next__(self): p = self._position = self._position + 1 if p >= len(self): raise StopIteration elif p < 0: raise TypeError return self[p:p + 1] def next(self): # Py2 compat return self.__next__() def previous(self): p = self._position if p >= len(self): raise StopIteration elif p < 0: raise TypeError self._position = p = p - 1 return self[p:p + 1] def setPosition(self, position): if self._position >= len(self): raise StopIteration self._position = position def getPosition(self): if self._position >= len(self): raise StopIteration if self._position >= 0: return self._position else: return None position = property(getPosition, setPosition) def getCurrentByte(self): return self[self.position:self.position + 1] currentByte = property(getCurrentByte) def skip(self, chars=spaceCharactersBytes): """Skip past a list of characters""" p = self.position # use property for the error-checking while p < len(self): c = self[p:p + 1] if c not in chars: self._position = p return c p += 1 self._position = p return None def skipUntil(self, chars): p = self.position while p < len(self): c = self[p:p + 1] if c in chars: self._position = p return c p += 1 self._position = p return None def matchBytes(self, bytes): """Look for a sequence of bytes at the start of a string. If the bytes are found return True and advance the position to the byte after the match. Otherwise return False and leave the position alone""" p = self.position data = self[p:p + len(bytes)] rv = data.startswith(bytes) if rv: self.position += len(bytes) return rv def jumpTo(self, bytes): """Look for the next sequence of bytes matching a given sequence. If a match is found advance the position to the last byte of the match""" newPosition = self[self.position:].find(bytes) if newPosition > -1: # XXX: This is ugly, but I can't see a nicer way to fix this. if self._position == -1: self._position = 0 self._position += (newPosition + len(bytes) - 1) return True else: raise StopIteration class EncodingParser(object): """Mini parser for detecting character encoding from meta elements""" def __init__(self, data): """string - the data to work on for encoding detection""" self.data = EncodingBytes(data) self.encoding = None def getEncoding(self): methodDispatch = ( (b"") def handleMeta(self): if self.data.currentByte not in spaceCharactersBytes: # if we have ") def getAttribute(self): """Return a name,value pair for the next attribute in the stream, if one is found, or None""" data = self.data # Step 1 (skip chars) c = data.skip(spaceCharactersBytes | frozenset([b"/"])) assert c is None or len(c) == 1 # Step 2 if c in (b">", None): return None # Step 3 attrName = [] attrValue = [] # Step 4 attribute name while True: if c == b"=" and attrName: break elif c in spaceCharactersBytes: # Step 6! c = data.skip() break elif c in (b"/", b">"): return b"".join(attrName), b"" elif c in asciiUppercaseBytes: attrName.append(c.lower()) elif c is None: return None else: attrName.append(c) # Step 5 c = next(data) # Step 7 if c != b"=": data.previous() return b"".join(attrName), b"" # Step 8 next(data) # Step 9 c = data.skip() # Step 10 if c in (b"'", b'"'): # 10.1 quoteChar = c while True: # 10.2 c = next(data) # 10.3 if c == quoteChar: next(data) return b"".join(attrName), b"".join(attrValue) # 10.4 elif c in asciiUppercaseBytes: attrValue.append(c.lower()) # 10.5 else: attrValue.append(c) elif c == b">": return b"".join(attrName), b"" elif c in asciiUppercaseBytes: attrValue.append(c.lower()) elif c is None: return None else: attrValue.append(c) # Step 11 while True: c = next(data) if c in spacesAngleBrackets: return b"".join(attrName), b"".join(attrValue) elif c in asciiUppercaseBytes: attrValue.append(c.lower()) elif c is None: return None else: attrValue.append(c) class ContentAttrParser(object): def __init__(self, data): assert isinstance(data, bytes) self.data = data def parse(self): try: # Check if the attr name is charset # otherwise return self.data.jumpTo(b"charset") self.data.position += 1 self.data.skip() if not self.data.currentByte == b"=": # If there is no = sign keep looking for attrs return None self.data.position += 1 self.data.skip() # Look for an encoding between matching quote marks if self.data.currentByte in (b'"', b"'"): quoteMark = self.data.currentByte self.data.position += 1 oldPosition = self.data.position if self.data.jumpTo(quoteMark): return self.data[oldPosition:self.data.position] else: return None else: # Unquoted value oldPosition = self.data.position try: self.data.skipUntil(spaceCharactersBytes) return self.data[oldPosition:self.data.position] except StopIteration: # Return the whole remaining value return self.data[oldPosition:] except StopIteration: return None def lookupEncoding(encoding): """Return the python codec name corresponding to an encoding or None if the string doesn't correspond to a valid encoding.""" if isinstance(encoding, binary_type): try: encoding = encoding.decode("ascii") except UnicodeDecodeError: return None if encoding is not None: try: return webencodings.lookup(encoding) except AttributeError: return None else: return None site-packages/pip/_vendor/html5lib/_inputstream.pyc000064400000066206147204247350016501 0ustar00 abc!@`sddlmZmZmZddlmZmZddlmZm Z ddl Z ddl Z ddl m Z ddlmZmZmZmZddlmZdd lmZdd lmZydd lmZWnek reZnXegeD]Zejd ^qZegeD]Zejd ^q"ZegeD]Zejd ^qJZeed dgBZ dZ!ej"re!ddkre!j#ddkst$e j%e!d e&ddZ'ne j%e!Z'e(dddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2g Z)e j%d3Z*iZ+d4e,fd5YZ-d6Z.d7e,fd8YZ/d9e/fd:YZ0d;e1fd<YZ2d=e,fd>YZ3d?e,fd@YZ4dAZ5dS(Bi(tabsolute_importtdivisiontunicode_literals(t text_typet binary_type(t http_clientturllibN(t webencodingsi(tEOFtspaceCharacterst asciiLetterstasciiUppercase(tReparseException(t_utils(tStringIO(tBytesIOuasciit>tt|j||krd|t|j|8}|d7}q'W||g|_dS(Nii(t_bufferedBytestAssertionErrorRRR(RRtoffsetti((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytseekLscC`sp|js|j|S|jdt|jkr_|jdt|jdkr_|j|S|j|SdS(Niii(Rt _readStreamRRt_readFromBuffer(Rtbytes((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytreadUs     cC`s&tg|jD]}t|^q S(N(tsumRR(Rtitem((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR^scC`sL|jj|}|jj||jdcd7 Normalized stream from source for use by html5lib. source can be either a file-object, local filename or a string. The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) u􏿿iiuutf-8ucertainN( R tsupports_lone_surrogatestNonetreportCharacterErrorsRtcharacterErrorsUCS4tcharacterErrorsUCS2tnewLinestlookupEncodingt charEncodingt openStreamt dataStreamtreset(RR?((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRs    cC`sCd|_d|_d|_g|_d|_d|_d|_dS(Nui(Rt chunkSizet chunkOffsetterrorst prevNumLinest prevNumColsRFt_bufferedCharacter(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyROs      cC`s(t|dr|}n t|}|S(uvProduces a file object from source. source can be either a file object, local filename or a string. uread(R:R(RR?R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRMs  cC`st|j}|jdd|}|j|}|jdd|}|dkr\|j|}n||d}||fS(Nu iii(RtcountRStrfindRT(RRRtnLinest positionLinet lastLinePostpositionColumn((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt _positions   cC`s&|j|j\}}|d|fS(u:Returns (line, col) of the current position in the stream.i(R\RQ(Rtlinetcol((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRscC`sL|j|jkr%|js%tSn|j}|j|}|d|_|S(uo Read one character from the stream or queue if available. Return EOF when EOF is reached. i(RQRPt readChunkRR(RRQtchar((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR`s    cC`sO|dkr|j}n|j|j\|_|_d|_d|_d|_|jj |}|j r|j |}d|_ n |st St |dkrt |d}|dksd|kodknr|d|_ |d }qn|jr|j|n|jdd }|jd d }||_t ||_tS( Nuiiii iiu u u (RFt_defaultChunkSizeR\RPRSRTRRQRNR$RUR9RtordRGtreplacetTrue(RRPR(tlastv((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR_s0        (   cC`s:x3tttj|D]}|jjdqWdS(Nuinvalid-codepoint(trangeRtinvalid_unicode_retfindallRRR'(RR(t_((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRH%s"cC`st}xtj|D]}|r(qnt|j}|j}tj|||d!rtj|||d!}|t kr|j j dnt }q|dkr|dkr|t |dkr|j j dqt}|j j dqWdS(Niuinvalid-codepointiii(R9RgtfinditerRbtgrouptstartR tisSurrogatePairtsurrogatePairToCodepointtnon_bmp_invalid_codepointsRRR'RdR(RR(tskiptmatcht codepointRtchar_val((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRI)s    c C`s}yt||f}Wntk rx&|D]}t|dks+tq+Wdjg|D]}dt|^qZ}|sd|}ntjd|}t||fcB`sbeZdZd d d d dedZdZdZedZdZ dZ dZ RS( uProvides a unicode stream of characters to the HTMLTokenizer. This class takes care of character encoding and removing or replacing incorrect byte-sequences and also provides column and line tracking. u windows-1252cC`s|j||_tj||jd|_d|_||_||_||_||_ ||_ |j ||_ |j ddk st|jdS(uInitialises the HTMLInputStream. HTMLInputStream(source, [encoding]) -> Normalized stream from source for use by html5lib. source can be either a file-object, local filename or a string. The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) iidiN(RMt rawStreamR=Rt numBytesMetatnumBytesChardettoverride_encodingttransport_encodingtsame_origin_parent_encodingtlikely_encodingtdefault_encodingtdetermineEncodingRLRFRRO(RR?RRRRRt useChardet((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRs       cC`s3|jdjj|jd|_tj|dS(Niureplace(RLt codec_infot streamreaderRRNR=RO(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyROs"cC`sUt|dr|}n t|}y|j|jWnt|}nX|S(uvProduces a file object from source. source can be either a file object, local filename or a string. uread(R:RR RR(RR?R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRMs  cC`s!|jdf}|ddk r&|St|jdf}|ddk rO|St|jdf}|ddk rx|S|jdf}|ddk r|St|jdf}|ddk r|djjd r|St|j df}|ddk r|S|ryddl m }Wnt k r4qXg}|}x[|j s|jj|j}t|tszt|sPn|j||j|qGW|jt|jd}|jjd|dk r|dfSnt|jdf}|ddk r|StddfS(Nucertainiu tentativeuutf-16(tUniversalDetectoruencodingu windows-1252(t detectBOMRFRKRRtdetectEncodingMetaRtnamet startswithRtchardet.universaldetectorRt ImportErrortdoneRR$RR4R#RR'tfeedtclosetresultR R(RtchardetRLRtbufferstdetectorRtencoding((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRsR'       cC`s|jddkstt|}|dkr5dS|jdkretd}|dk stnr||jdkr|jddf|_nF|jjd|df|_|jtd|jd|fdS( Niucertainuutf-16beuutf-16leuutf-8iuEncoding changed from %s to %s(uutf-16beuutf-16le( RLRRKRFRRR ROR (Rt newEncoding((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytchangeEncodings    cC`sidtj6dtj6dtj6dtj6dtj6}|jjd}t|t s_t |j |d }d}|s|j |}d}|s|j |d }d}qn|r|jj |t |S|jj d d Sd S( uAttempts to detect at BOM at the start of the stream. If an encoding can be determined from the BOM return the name of the encoding otherwise return Noneuutf-8uutf-16leuutf-16beuutf-32leuutf-32beiiiiN(tcodecstBOM_UTF8t BOM_UTF16_LEt BOM_UTF16_BEt BOM_UTF32_LEt BOM_UTF32_BERR$R4R#RtgetR RKRF(RtbomDicttstringRR ((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRs&   cC`s|jj|j}t|ts*tt|}|jjd|j}|dk r||j dkr|t d}n|S(u9Report the encoding declared by the meta element iuutf-16beuutf-16leuutf-8N(uutf-16beuutf-16le( RR$RR4R#RtEncodingParserR t getEncodingRFRRK(RRtparserR((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR9s  N( R1R2R3RFRdRRORMRRRR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR>s(   >  "t EncodingBytescB`seZdZdZdZdZdZdZdZdZ dZ e e e Z d Z e e Zed Zd Zd Zd ZRS(uString-like object with an associated position and various extra methods If the position is ever greater than the string length then an exception is raisedcC`s+t|tsttj||jS(N(R4R#Rt__new__tlower(Rtvalue((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRLscC`s d|_dS(Ni(R\(RR((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRPscC`s|S(N((R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt__iter__TscC`sS|jd}|_|t|kr/tn|dkrDtn|||d!S(Nii(R\Rt StopIterationR<(Rtp((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt__next__Ws    cC`s |jS(N(R(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytnext_scC`sY|j}|t|kr$tn|dkr9tn|d|_}|||d!S(Nii(R\RRR<(RR((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytpreviouscs    cC`s+|jt|krtn||_dS(N(R\RR(RR((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt setPositionls cC`s<|jt|krtn|jdkr4|jSdSdS(Ni(R\RRRF(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt getPositionqs  cC`s||j|jd!S(Ni(R(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytgetCurrentByte{scC`sc|j}xJ|t|krU|||d!}||krH||_|S|d7}q W||_dS(uSkip past a list of charactersiN(RRR\RF(RR{RR|((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRps    cC`sc|j}xJ|t|krU|||d!}||krH||_|S|d7}q W||_dS(Ni(RRR\RF(RR{RR|((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt skipUntils    cC`sQ|j}|||t|!}|j|}|rM|jt|7_n|S(uLook for a sequence of bytes at the start of a string. If the bytes are found return True and advance the position to the byte after the match. Otherwise return False and leave the position alone(RRR(RR#RR(R,((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt matchBytess  cC`sh||jj|}|dkr^|jdkr=d|_n|j|t|d7_tStdS(uLook for the next sequence of bytes matching a given sequence. If a match is found advance the position to the last byte of the matchiiiN(RtfindR\RRdR(RR#t newPosition((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytjumpTos  (R1R2R3RRRRRRRRtpropertyRRt currentBytetspaceCharactersBytesRpRRR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRHs           RcB`s_eZdZdZdZdZdZdZdZdZ dZ d Z RS( u?Mini parser for detecting character encoding from meta elementscC`st||_d|_dS(u3string - the data to work on for encoding detectionN(RR(RFR(RR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRscC`sd|jfd|jfd|jfd|jfd|jfd|jff}xv|jD]k}t}xR|D]J\}}|jj|rky|}PWqtk rt }PqXqkqkW|sXPqXqXW|j S(Ns(R(R(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRscC`sK|jjtkrtSt}d}x"trF|j}|dkrGtS|ddkr|ddk}|rC|dk rC||_tSq%|ddkr|d}t|}|dk rC||_tSq%|ddkr%t t |d}|j }|dk rCt|}|dk r@|r4||_tS|}q@qCq%q%WdS(Nis http-equivis content-typetcharsettcontent( R(RRRdR9RFt getAttributeRRKtContentAttrParserRtparse(Rt hasPragmatpendingEncodingtattrttentativeEncodingtcodect contentParser((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRs:             cC`s |jtS(N(thandlePossibleTagR9(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRscC`st|j|jtS(N(RR(RRd(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRs cC`s|j}|jtkr9|r5|j|jntS|jt}|dkra|jn+|j}x|dk r|j}qpWtS(NR( R(RtasciiLettersBytesRRRdRtspacesAngleBracketsRRF(RtendTagR(R|R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRs      cC`s|jjdS(NR(R(R(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRscC`s|j}|jttdgB}|dksIt|dksIt|d krYdSg}g}xtr |dkr|rPnz|tkr|j}Pn^|d krdj|dfS|t kr|j |j n|dkrdS|j |t |}qhW|dkr7|j dj|dfSt ||j}|d kr|}xtrt |}||krt |dj|dj|fS|t kr|j |j qb|j |qbWn^|dkrdj|dfS|t kr|j |j n|dkr-dS|j |x}trt |}|tkrwdj|dj|fS|t kr|j |j q=|dkrdS|j |q=WdS( u_Return a name,value pair for the next attribute in the stream, if one is found, or Nonet/iRt=R)t't"N(RN(RR(RR(R(RpRt frozensetRFRRRdR*tasciiUppercaseBytesR'RRRR(RR(R|tattrNamet attrValuet quoteChar((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRsh $                           ( R1R2R3RRRRRRRRR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRs    $    RcB`seZdZdZRS(cC`s"t|tst||_dS(N(R4R#RR((RR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRfscC`s:y!|jjd|jjd7_|jj|jjdksHdS|jjd7_|jj|jjdkr|jj}|jjd7_|jj}|jj|r|j||jj!SdSnP|jj}y(|jjt|j||jj!SWntk r|j|SXWntk r5dSXdS(NRiRRR(RR( R(RRRpRRFRRR(Rt quoteMarkt oldPosition((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRjs.       (R1R2RR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRes cC`swt|tr:y|jd}Wq:tk r6dSXn|dk roytj|SWqstk rkdSXndSdS(u{Return the python codec name corresponding to an encoding or None if the string doesn't correspond to a valid encoding.uasciiN(R4RtdecodetUnicodeDecodeErrorRFRtlookuptAttributeError(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRKs   (6t __future__RRRtpip._vendor.sixRRtpip._vendor.six.movesRRRRvt pip._vendorRt constantsRR R R R R)R tioRRRRR&tencodeRRRRtinvalid_unicode_no_surrogateRERVRRwtevalRgtsetRotascii_punctuation_reRttobjectRRDR=R>R#RRRRK(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytsR  "  ((( + J h'site-packages/pip/_vendor/html5lib/_inputstream.pyo000064400000065135147204247350016515 0ustar00 abc!@`sddlmZmZmZddlmZmZddlmZm Z ddl Z ddl Z ddl m Z ddlmZmZmZmZddlmZdd lmZdd lmZydd lmZWnek reZnXegeD]Zejd ^qZegeD]Zejd ^q"ZegeD]Zejd ^qJZeed dgBZ dZ!ej"re j#e!d e$ddZ%ne j#e!Z%e&dddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2g Z'e j#d3Z(iZ)d4e*fd5YZ+d6Z,d7e*fd8YZ-d9e-fd:YZ.d;e/fd<YZ0d=e*fd>YZ1d?e*fd@YZ2dAZ3dS(Bi(tabsolute_importtdivisiontunicode_literals(t text_typet binary_type(t http_clientturllibN(t webencodingsi(tEOFtspaceCharacterst asciiLetterstasciiUppercase(tReparseException(t_utils(tStringIO(tBytesIOuasciit>tt|j||krL|t|j|8}|d7}qW||g|_dS(Nii(RRR(RRtoffsetti((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytseekLs cC`sp|js|j|S|jdt|jkr_|jdt|jdkr_|j|S|j|SdS(Niii(Rt _readStreamRRt_readFromBuffer(Rtbytes((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytreadUs     cC`s&tg|jD]}t|^q S(N(tsumRR(Rtitem((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt_bufferedBytes^scC`sL|jj|}|jj||jdcd7 Normalized stream from source for use by html5lib. source can be either a file-object, local filename or a string. The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) u􏿿iiuutf-8ucertainN( R tsupports_lone_surrogatestNonetreportCharacterErrorsRtcharacterErrorsUCS4tcharacterErrorsUCS2tnewLinestlookupEncodingt charEncodingt openStreamt dataStreamtreset(RR>((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRs    cC`sCd|_d|_d|_g|_d|_d|_d|_dS(Nui(Rt chunkSizet chunkOffsetterrorst prevNumLinest prevNumColsREt_bufferedCharacter(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRNs      cC`s(t|dr|}n t|}|S(uvProduces a file object from source. source can be either a file object, local filename or a string. uread(R9R(RR>R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRLs  cC`st|j}|jdd|}|j|}|jdd|}|dkr\|j|}n||d}||fS(Nu iii(RtcountRRtrfindRS(RRRtnLinest positionLinet lastLinePostpositionColumn((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt _positions   cC`s&|j|j\}}|d|fS(u:Returns (line, col) of the current position in the stream.i(R[RP(Rtlinetcol((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRscC`sL|j|jkr%|js%tSn|j}|j|}|d|_|S(uo Read one character from the stream or queue if available. Return EOF when EOF is reached. i(RPROt readChunkRR(RRPtchar((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR_s    cC`sO|dkr|j}n|j|j\|_|_d|_d|_d|_|jj |}|j r|j |}d|_ n |st St |dkrt |d}|dksd|kodknr|d|_ |d }qn|jr|j|n|jdd }|jd d }||_t ||_tS( Nuiiii iiu u u (REt_defaultChunkSizeR[RORRRSRRPRMR"RTR8RtordRFtreplacetTrue(RROR'tlastv((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR^s0        (   cC`s:x3tttj|D]}|jjdqWdS(Nuinvalid-codepoint(trangeRtinvalid_unicode_retfindallRQR&(RR't_((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRG%s"cC`st}xtj|D]}|r(qnt|j}|j}tj|||d!rtj|||d!}|t kr|j j dnt }q|dkr|dkr|t |dkr|j j dqt}|j j dqWdS(Niuinvalid-codepointiii(R8RftfinditerRatgrouptstartR tisSurrogatePairtsurrogatePairToCodepointtnon_bmp_invalid_codepointsRQR&RcR(RR'tskiptmatcht codepointRtchar_val((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRH)s    c C`sTyt||f}Wnqtk rdjg|D]}dt|^q1}|scd|}ntjd|}t||f Normalized stream from source for use by html5lib. source can be either a file-object, local filename or a string. The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) iidN(RLt rawStreamR<Rt numBytesMetatnumBytesChardettoverride_encodingttransport_encodingtsame_origin_parent_encodingtlikely_encodingtdefault_encodingtdetermineEncodingRKRN(RR>RRRRRt useChardet((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRs       cC`s3|jdjj|jd|_tj|dS(Niureplace(RKt codec_infot streamreaderRRMR<RN(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRNs"cC`sUt|dr|}n t|}y|j|jWnt|}nX|S(uvProduces a file object from source. source can be either a file object, local filename or a string. uread(R9RRRR(RR>R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRLs  cC`s |jdf}|ddk r&|St|jdf}|ddk rO|St|jdf}|ddk rx|S|jdf}|ddk r|St|jdf}|ddk r|djjd r|St|j df}|ddk r|S|ryddl m }Wnt k r4qXg}|}xF|j s|jj|j}|soPn|j||j|qGW|jt|jd}|jjd|dk r|dfSnt|jdf}|ddk r|StddfS(Nucertainiu tentativeuutf-16(tUniversalDetectoruencodingu windows-1252(t detectBOMRERJRRtdetectEncodingMetaRtnamet startswithRtchardet.universaldetectorRt ImportErrortdoneRR"RR&tfeedtclosetresultRR(RtchardetRKRtbufferstdetectorRtencoding((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRsP'       cC`st|}|dkrdS|jdkr:td}nr||jdkrf|jddf|_nF|jjd|df|_|jtd|jd|fdS(Nuutf-16beuutf-16leuutf-8iucertainuEncoding changed from %s to %s(uutf-16beuutf-16le(RJRERRKRRRNR (Rt newEncoding((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytchangeEncodings    cC`sidtj6dtj6dtj6dtj6dtj6}|jjd}|j|d }d}|s|j|}d}|s|j|d }d}qn|r|jj |t |S|jj d d Sd S( uAttempts to detect at BOM at the start of the stream. If an encoding can be determined from the BOM return the name of the encoding otherwise return Noneuutf-8uutf-16leuutf-16beuutf-32leuutf-32beiiiiN( tcodecstBOM_UTF8t BOM_UTF16_LEt BOM_UTF16_BEt BOM_UTF32_LEt BOM_UTF32_BERR"tgetRRJRE(RtbomDicttstringRR((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRs$   cC`sk|jj|j}t|}|jjd|j}|dk rg|jdkrgtd}n|S(u9Report the encoding declared by the meta element iuutf-16beuutf-16leuutf-8N(uutf-16beuutf-16le( RR"RtEncodingParserRt getEncodingRERRJ(RRtparserR((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR9s  N( R0R1R2RERcRRNRLRRRR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR=s(   >  "t EncodingBytescB`seZdZdZdZdZdZdZdZdZ dZ e e e Z d Z e e Zed Zd Zd Zd ZRS(uString-like object with an associated position and various extra methods If the position is ever greater than the string length then an exception is raisedcC`stj||jS(N(R!t__new__tlower(Rtvalue((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRLscC`s d|_dS(Ni(R[(RR((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRPscC`s|S(N((R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt__iter__TscC`sS|jd}|_|t|kr/tn|dkrDtn|||d!S(Nii(R[Rt StopIterationR;(Rtp((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt__next__Ws    cC`s |jS(N(R(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytnext_scC`sY|j}|t|kr$tn|dkr9tn|d|_}|||d!S(Nii(R[RRR;(RR((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytpreviouscs    cC`s+|jt|krtn||_dS(N(R[RR(RR((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt setPositionls cC`s<|jt|krtn|jdkr4|jSdSdS(Ni(R[RRRE(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt getPositionqs  cC`s||j|jd!S(Ni(R(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytgetCurrentByte{scC`sc|j}xJ|t|krU|||d!}||krH||_|S|d7}q W||_dS(uSkip past a list of charactersiN(RRR[RE(RRzRR{((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRos    cC`sc|j}xJ|t|krU|||d!}||krH||_|S|d7}q W||_dS(Ni(RRR[RE(RRzRR{((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt skipUntils    cC`sQ|j}|||t|!}|j|}|rM|jt|7_n|S(uLook for a sequence of bytes at the start of a string. If the bytes are found return True and advance the position to the byte after the match. Otherwise return False and leave the position alone(RRR(RR!RR'R+((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt matchBytess  cC`sh||jj|}|dkr^|jdkr=d|_n|j|t|d7_tStdS(uLook for the next sequence of bytes matching a given sequence. If a match is found advance the position to the last byte of the matchiiiN(RtfindR[RRcR(RR!t newPosition((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytjumpTos  (R0R1R2RRRRRRRRtpropertyRRt currentBytetspaceCharactersBytesRoRRR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRHs           RcB`s_eZdZdZdZdZdZdZdZdZ dZ d Z RS( u?Mini parser for detecting character encoding from meta elementscC`st||_d|_dS(u3string - the data to work on for encoding detectionN(RR'RER(RR'((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRscC`sd|jfd|jfd|jfd|jfd|jfd|jff}xv|jD]k}t}xR|D]J\}}|jj|rky|}PWqtk rt }PqXqkqkW|sXPqXqXW|j S(Ns(R'R(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRscC`sK|jjtkrtSt}d}x"trF|j}|dkrGtS|ddkr|ddk}|rC|dk rC||_tSq%|ddkr|d}t|}|dk rC||_tSq%|ddkr%t t |d}|j }|dk rCt|}|dk r@|r4||_tS|}q@qCq%q%WdS(Nis http-equivis content-typetcharsettcontent( R'RRRcR8REt getAttributeRRJtContentAttrParserRtparse(Rt hasPragmatpendingEncodingtattrttentativeEncodingtcodect contentParser((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRs:             cC`s |jtS(N(thandlePossibleTagR8(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRscC`st|j|jtS(N(RR'RRc(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRs cC`s|j}|jtkr9|r5|j|jntS|jt}|dkra|jn+|j}x|dk r|j}qpWtS(NR( R'RtasciiLettersBytesRRRcRtspacesAngleBracketsRRE(RtendTagR'R{R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRs      cC`s|jjdS(NR(R'R(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRscC`s|j}|jttdgB}|dkr5dSg}g}xtr|dkr`|r`Pnz|tkr||j}Pn^|d krdj|dfS|tkr|j|j n|dkrdS|j|t |}qDW|dkr|j dj|dfSt ||j}|d kr|}xtrt |}||krt |dj|dj|fS|tkr|j|j q>|j|q>Wn^|dkrdj|dfS|tkr|j|j n|dkr dS|j|x}trt |}|t krSdj|dj|fS|tkru|j|j q|dkrdS|j|qWdS( u_Return a name,value pair for the next attribute in the stream, if one is found, or Nonet/Rt=R(t't"N(RN(RR(RR( R'RoRt frozensetRERcR)tasciiUppercaseBytesR&RRRR(RR'R{tattrNamet attrValuet quoteChar((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRsf                            ( R0R1R2RRRRRRRRR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRs    $    RcB`seZdZdZRS(cC`s ||_dS(N(R'(RR'((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRfscC`s:y!|jjd|jjd7_|jj|jjdksHdS|jjd7_|jj|jjdkr|jj}|jjd7_|jj}|jj|r|j||jj!SdSnP|jj}y(|jjt|j||jj!SWntk r|j|SXWntk r5dSXdS(NRiRRR(RR( R'RRRoRRERRR(Rt quoteMarkt oldPosition((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRjs.       (R0R1RR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRes cC`swt|tr:y|jd}Wq:tk r6dSXn|dk roytj|SWqstk rkdSXndSdS(u{Return the python codec name corresponding to an encoding or None if the string doesn't correspond to a valid encoding.uasciiN(R3RtdecodetUnicodeDecodeErrorRERtlookuptAttributeError(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRJs   (4t __future__RRRtpip._vendor.sixRRtpip._vendor.six.movesRRRRut pip._vendorRt constantsRR R R R R(R tioRRRRR$tencodeRRRRtinvalid_unicode_no_surrogateRDRvtevalRftsetRntascii_punctuation_reRstobjectRRCR<R=R!RRRRJ(((sE/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pytsP  "  (((  J h'site-packages/pip/_vendor/html5lib/_tokenizer.py000064400000225444147204247350015776 0ustar00from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import unichr as chr from collections import deque from .constants import spaceCharacters from .constants import entities from .constants import asciiLetters, asciiUpper2Lower from .constants import digits, hexDigits, EOF from .constants import tokenTypes, tagTokenTypes from .constants import replacementCharacters from ._inputstream import HTMLInputStream from ._trie import Trie entitiesTrie = Trie(entities) class HTMLTokenizer(object): """ This class takes care of tokenizing HTML. * self.currentToken Holds the token that is currently being processed. * self.state Holds a reference to the method to be invoked... XXX * self.stream Points to HTMLInputStream object. """ def __init__(self, stream, parser=None, **kwargs): self.stream = HTMLInputStream(stream, **kwargs) self.parser = parser # Setup the initial tokenizer state self.escapeFlag = False self.lastFourChars = [] self.state = self.dataState self.escape = False # The current token being created self.currentToken = None super(HTMLTokenizer, self).__init__() def __iter__(self): """ This is where the magic happens. We do our usually processing through the states and when we have a token to return we yield the token which pauses processing until the next token is requested. """ self.tokenQueue = deque([]) # Start processing. When EOF is reached self.state will return False # instead of True and the loop will terminate. while self.state(): while self.stream.errors: yield {"type": tokenTypes["ParseError"], "data": self.stream.errors.pop(0)} while self.tokenQueue: yield self.tokenQueue.popleft() def consumeNumberEntity(self, isHex): """This function returns either U+FFFD or the character based on the decimal or hexadecimal representation. It also discards ";" if present. If not present self.tokenQueue.append({"type": tokenTypes["ParseError"]}) is invoked. """ allowed = digits radix = 10 if isHex: allowed = hexDigits radix = 16 charStack = [] # Consume all the characters that are in range while making sure we # don't hit an EOF. c = self.stream.char() while c in allowed and c is not EOF: charStack.append(c) c = self.stream.char() # Convert the set of characters consumed to an int. charAsInt = int("".join(charStack), radix) # Certain characters get replaced with others if charAsInt in replacementCharacters: char = replacementCharacters[charAsInt] self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "illegal-codepoint-for-numeric-entity", "datavars": {"charAsInt": charAsInt}}) elif ((0xD800 <= charAsInt <= 0xDFFF) or (charAsInt > 0x10FFFF)): char = "\uFFFD" self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "illegal-codepoint-for-numeric-entity", "datavars": {"charAsInt": charAsInt}}) else: # Should speed up this check somehow (e.g. move the set to a constant) if ((0x0001 <= charAsInt <= 0x0008) or (0x000E <= charAsInt <= 0x001F) or (0x007F <= charAsInt <= 0x009F) or (0xFDD0 <= charAsInt <= 0xFDEF) or charAsInt in frozenset([0x000B, 0xFFFE, 0xFFFF, 0x1FFFE, 0x1FFFF, 0x2FFFE, 0x2FFFF, 0x3FFFE, 0x3FFFF, 0x4FFFE, 0x4FFFF, 0x5FFFE, 0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE, 0x8FFFF, 0x9FFFE, 0x9FFFF, 0xAFFFE, 0xAFFFF, 0xBFFFE, 0xBFFFF, 0xCFFFE, 0xCFFFF, 0xDFFFE, 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE, 0xFFFFF, 0x10FFFE, 0x10FFFF])): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "illegal-codepoint-for-numeric-entity", "datavars": {"charAsInt": charAsInt}}) try: # Try/except needed as UCS-2 Python builds' unichar only works # within the BMP. char = chr(charAsInt) except ValueError: v = charAsInt - 0x10000 char = chr(0xD800 | (v >> 10)) + chr(0xDC00 | (v & 0x3FF)) # Discard the ; if present. Otherwise, put it back on the queue and # invoke parseError on parser. if c != ";": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "numeric-entity-without-semicolon"}) self.stream.unget(c) return char def consumeEntity(self, allowedChar=None, fromAttribute=False): # Initialise to the default output for when no entity is matched output = "&" charStack = [self.stream.char()] if (charStack[0] in spaceCharacters or charStack[0] in (EOF, "<", "&") or (allowedChar is not None and allowedChar == charStack[0])): self.stream.unget(charStack[0]) elif charStack[0] == "#": # Read the next character to see if it's hex or decimal hex = False charStack.append(self.stream.char()) if charStack[-1] in ("x", "X"): hex = True charStack.append(self.stream.char()) # charStack[-1] should be the first digit if (hex and charStack[-1] in hexDigits) \ or (not hex and charStack[-1] in digits): # At least one digit found, so consume the whole number self.stream.unget(charStack[-1]) output = self.consumeNumberEntity(hex) else: # No digits found self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-numeric-entity"}) self.stream.unget(charStack.pop()) output = "&" + "".join(charStack) else: # At this point in the process might have named entity. Entities # are stored in the global variable "entities". # # Consume characters and compare to these to a substring of the # entity names in the list until the substring no longer matches. while (charStack[-1] is not EOF): if not entitiesTrie.has_keys_with_prefix("".join(charStack)): break charStack.append(self.stream.char()) # At this point we have a string that starts with some characters # that may match an entity # Try to find the longest entity the string will match to take care # of ¬i for instance. try: entityName = entitiesTrie.longest_prefix("".join(charStack[:-1])) entityLength = len(entityName) except KeyError: entityName = None if entityName is not None: if entityName[-1] != ";": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "named-entity-without-semicolon"}) if (entityName[-1] != ";" and fromAttribute and (charStack[entityLength] in asciiLetters or charStack[entityLength] in digits or charStack[entityLength] == "=")): self.stream.unget(charStack.pop()) output = "&" + "".join(charStack) else: output = entities[entityName] self.stream.unget(charStack.pop()) output += "".join(charStack[entityLength:]) else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-named-entity"}) self.stream.unget(charStack.pop()) output = "&" + "".join(charStack) if fromAttribute: self.currentToken["data"][-1][1] += output else: if output in spaceCharacters: tokenType = "SpaceCharacters" else: tokenType = "Characters" self.tokenQueue.append({"type": tokenTypes[tokenType], "data": output}) def processEntityInAttribute(self, allowedChar): """This method replaces the need for "entityInAttributeValueState". """ self.consumeEntity(allowedChar=allowedChar, fromAttribute=True) def emitCurrentToken(self): """This method is a generic handler for emitting the tags. It also sets the state to "data" because that's what's needed after a token has been emitted. """ token = self.currentToken # Add token to the queue to be yielded if (token["type"] in tagTokenTypes): token["name"] = token["name"].translate(asciiUpper2Lower) if token["type"] == tokenTypes["EndTag"]: if token["data"]: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "attributes-in-end-tag"}) if token["selfClosing"]: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "self-closing-flag-on-end-tag"}) self.tokenQueue.append(token) self.state = self.dataState # Below are the various tokenizer states worked out. def dataState(self): data = self.stream.char() if data == "&": self.state = self.entityDataState elif data == "<": self.state = self.tagOpenState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\u0000"}) elif data is EOF: # Tokenization ends. return False elif data in spaceCharacters: # Directly after emitting a token you switch back to the "data # state". At that point spaceCharacters are important so they are # emitted separately. self.tokenQueue.append({"type": tokenTypes["SpaceCharacters"], "data": data + self.stream.charsUntil(spaceCharacters, True)}) # No need to update lastFourChars here, since the first space will # have already been appended to lastFourChars and will have broken # any sequences else: chars = self.stream.charsUntil(("&", "<", "\u0000")) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data + chars}) return True def entityDataState(self): self.consumeEntity() self.state = self.dataState return True def rcdataState(self): data = self.stream.char() if data == "&": self.state = self.characterReferenceInRcdata elif data == "<": self.state = self.rcdataLessThanSignState elif data == EOF: # Tokenization ends. return False elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) elif data in spaceCharacters: # Directly after emitting a token you switch back to the "data # state". At that point spaceCharacters are important so they are # emitted separately. self.tokenQueue.append({"type": tokenTypes["SpaceCharacters"], "data": data + self.stream.charsUntil(spaceCharacters, True)}) # No need to update lastFourChars here, since the first space will # have already been appended to lastFourChars and will have broken # any sequences else: chars = self.stream.charsUntil(("&", "<", "\u0000")) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data + chars}) return True def characterReferenceInRcdata(self): self.consumeEntity() self.state = self.rcdataState return True def rawtextState(self): data = self.stream.char() if data == "<": self.state = self.rawtextLessThanSignState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) elif data == EOF: # Tokenization ends. return False else: chars = self.stream.charsUntil(("<", "\u0000")) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data + chars}) return True def scriptDataState(self): data = self.stream.char() if data == "<": self.state = self.scriptDataLessThanSignState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) elif data == EOF: # Tokenization ends. return False else: chars = self.stream.charsUntil(("<", "\u0000")) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data + chars}) return True def plaintextState(self): data = self.stream.char() if data == EOF: # Tokenization ends. return False elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data + self.stream.charsUntil("\u0000")}) return True def tagOpenState(self): data = self.stream.char() if data == "!": self.state = self.markupDeclarationOpenState elif data == "/": self.state = self.closeTagOpenState elif data in asciiLetters: self.currentToken = {"type": tokenTypes["StartTag"], "name": data, "data": [], "selfClosing": False, "selfClosingAcknowledged": False} self.state = self.tagNameState elif data == ">": # XXX In theory it could be something besides a tag name. But # do we really care? self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-tag-name-but-got-right-bracket"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<>"}) self.state = self.dataState elif data == "?": # XXX In theory it could be something besides a tag name. But # do we really care? self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-tag-name-but-got-question-mark"}) self.stream.unget(data) self.state = self.bogusCommentState else: # XXX self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-tag-name"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"}) self.stream.unget(data) self.state = self.dataState return True def closeTagOpenState(self): data = self.stream.char() if data in asciiLetters: self.currentToken = {"type": tokenTypes["EndTag"], "name": data, "data": [], "selfClosing": False} self.state = self.tagNameState elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-closing-tag-but-got-right-bracket"}) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-closing-tag-but-got-eof"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "": self.emitCurrentToken() elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-tag-name"}) self.state = self.dataState elif data == "/": self.state = self.selfClosingStartTagState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["name"] += "\uFFFD" else: self.currentToken["name"] += data # (Don't use charsUntil here, because tag names are # very short and it's faster to not do anything fancy) return True def rcdataLessThanSignState(self): data = self.stream.char() if data == "/": self.temporaryBuffer = "" self.state = self.rcdataEndTagOpenState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"}) self.stream.unget(data) self.state = self.rcdataState return True def rcdataEndTagOpenState(self): data = self.stream.char() if data in asciiLetters: self.temporaryBuffer += data self.state = self.rcdataEndTagNameState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "" and appropriate: self.currentToken = {"type": tokenTypes["EndTag"], "name": self.temporaryBuffer, "data": [], "selfClosing": False} self.emitCurrentToken() self.state = self.dataState elif data in asciiLetters: self.temporaryBuffer += data else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "" and appropriate: self.currentToken = {"type": tokenTypes["EndTag"], "name": self.temporaryBuffer, "data": [], "selfClosing": False} self.emitCurrentToken() self.state = self.dataState elif data in asciiLetters: self.temporaryBuffer += data else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "" and appropriate: self.currentToken = {"type": tokenTypes["EndTag"], "name": self.temporaryBuffer, "data": [], "selfClosing": False} self.emitCurrentToken() self.state = self.dataState elif data in asciiLetters: self.temporaryBuffer += data else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": ">"}) self.state = self.scriptDataState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) self.state = self.scriptDataEscapedState elif data == EOF: self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) self.state = self.scriptDataEscapedState return True def scriptDataEscapedLessThanSignState(self): data = self.stream.char() if data == "/": self.temporaryBuffer = "" self.state = self.scriptDataEscapedEndTagOpenState elif data in asciiLetters: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<" + data}) self.temporaryBuffer = data self.state = self.scriptDataDoubleEscapeStartState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"}) self.stream.unget(data) self.state = self.scriptDataEscapedState return True def scriptDataEscapedEndTagOpenState(self): data = self.stream.char() if data in asciiLetters: self.temporaryBuffer = data self.state = self.scriptDataEscapedEndTagNameState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "" and appropriate: self.currentToken = {"type": tokenTypes["EndTag"], "name": self.temporaryBuffer, "data": [], "selfClosing": False} self.emitCurrentToken() self.state = self.dataState elif data in asciiLetters: self.temporaryBuffer += data else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": ""))): self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) if self.temporaryBuffer.lower() == "script": self.state = self.scriptDataDoubleEscapedState else: self.state = self.scriptDataEscapedState elif data in asciiLetters: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) self.temporaryBuffer += data else: self.stream.unget(data) self.state = self.scriptDataEscapedState return True def scriptDataDoubleEscapedState(self): data = self.stream.char() if data == "-": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "-"}) self.state = self.scriptDataDoubleEscapedDashState elif data == "<": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"}) self.state = self.scriptDataDoubleEscapedLessThanSignState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) elif data == EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-script-in-script"}) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) return True def scriptDataDoubleEscapedDashState(self): data = self.stream.char() if data == "-": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "-"}) self.state = self.scriptDataDoubleEscapedDashDashState elif data == "<": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"}) self.state = self.scriptDataDoubleEscapedLessThanSignState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) self.state = self.scriptDataDoubleEscapedState elif data == EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-script-in-script"}) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) self.state = self.scriptDataDoubleEscapedState return True def scriptDataDoubleEscapedDashDashState(self): data = self.stream.char() if data == "-": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "-"}) elif data == "<": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"}) self.state = self.scriptDataDoubleEscapedLessThanSignState elif data == ">": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": ">"}) self.state = self.scriptDataState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) self.state = self.scriptDataDoubleEscapedState elif data == EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-script-in-script"}) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) self.state = self.scriptDataDoubleEscapedState return True def scriptDataDoubleEscapedLessThanSignState(self): data = self.stream.char() if data == "/": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "/"}) self.temporaryBuffer = "" self.state = self.scriptDataDoubleEscapeEndState else: self.stream.unget(data) self.state = self.scriptDataDoubleEscapedState return True def scriptDataDoubleEscapeEndState(self): data = self.stream.char() if data in (spaceCharacters | frozenset(("/", ">"))): self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) if self.temporaryBuffer.lower() == "script": self.state = self.scriptDataEscapedState else: self.state = self.scriptDataDoubleEscapedState elif data in asciiLetters: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) self.temporaryBuffer += data else: self.stream.unget(data) self.state = self.scriptDataDoubleEscapedState return True def beforeAttributeNameState(self): data = self.stream.char() if data in spaceCharacters: self.stream.charsUntil(spaceCharacters, True) elif data in asciiLetters: self.currentToken["data"].append([data, ""]) self.state = self.attributeNameState elif data == ">": self.emitCurrentToken() elif data == "/": self.state = self.selfClosingStartTagState elif data in ("'", '"', "=", "<"): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-character-in-attribute-name"}) self.currentToken["data"].append([data, ""]) self.state = self.attributeNameState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"].append(["\uFFFD", ""]) self.state = self.attributeNameState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-attribute-name-but-got-eof"}) self.state = self.dataState else: self.currentToken["data"].append([data, ""]) self.state = self.attributeNameState return True def attributeNameState(self): data = self.stream.char() leavingThisState = True emitToken = False if data == "=": self.state = self.beforeAttributeValueState elif data in asciiLetters: self.currentToken["data"][-1][0] += data +\ self.stream.charsUntil(asciiLetters, True) leavingThisState = False elif data == ">": # XXX If we emit here the attributes are converted to a dict # without being checked and when the code below runs we error # because data is a dict not a list emitToken = True elif data in spaceCharacters: self.state = self.afterAttributeNameState elif data == "/": self.state = self.selfClosingStartTagState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"][-1][0] += "\uFFFD" leavingThisState = False elif data in ("'", '"', "<"): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-character-in-attribute-name"}) self.currentToken["data"][-1][0] += data leavingThisState = False elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-attribute-name"}) self.state = self.dataState else: self.currentToken["data"][-1][0] += data leavingThisState = False if leavingThisState: # Attributes are not dropped at this stage. That happens when the # start tag token is emitted so values can still be safely appended # to attributes, but we do want to report the parse error in time. self.currentToken["data"][-1][0] = ( self.currentToken["data"][-1][0].translate(asciiUpper2Lower)) for name, _ in self.currentToken["data"][:-1]: if self.currentToken["data"][-1][0] == name: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "duplicate-attribute"}) break # XXX Fix for above XXX if emitToken: self.emitCurrentToken() return True def afterAttributeNameState(self): data = self.stream.char() if data in spaceCharacters: self.stream.charsUntil(spaceCharacters, True) elif data == "=": self.state = self.beforeAttributeValueState elif data == ">": self.emitCurrentToken() elif data in asciiLetters: self.currentToken["data"].append([data, ""]) self.state = self.attributeNameState elif data == "/": self.state = self.selfClosingStartTagState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"].append(["\uFFFD", ""]) self.state = self.attributeNameState elif data in ("'", '"', "<"): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-character-after-attribute-name"}) self.currentToken["data"].append([data, ""]) self.state = self.attributeNameState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-end-of-tag-but-got-eof"}) self.state = self.dataState else: self.currentToken["data"].append([data, ""]) self.state = self.attributeNameState return True def beforeAttributeValueState(self): data = self.stream.char() if data in spaceCharacters: self.stream.charsUntil(spaceCharacters, True) elif data == "\"": self.state = self.attributeValueDoubleQuotedState elif data == "&": self.state = self.attributeValueUnQuotedState self.stream.unget(data) elif data == "'": self.state = self.attributeValueSingleQuotedState elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-attribute-value-but-got-right-bracket"}) self.emitCurrentToken() elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"][-1][1] += "\uFFFD" self.state = self.attributeValueUnQuotedState elif data in ("=", "<", "`"): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "equals-in-unquoted-attribute-value"}) self.currentToken["data"][-1][1] += data self.state = self.attributeValueUnQuotedState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-attribute-value-but-got-eof"}) self.state = self.dataState else: self.currentToken["data"][-1][1] += data self.state = self.attributeValueUnQuotedState return True def attributeValueDoubleQuotedState(self): data = self.stream.char() if data == "\"": self.state = self.afterAttributeValueState elif data == "&": self.processEntityInAttribute('"') elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"][-1][1] += "\uFFFD" elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-attribute-value-double-quote"}) self.state = self.dataState else: self.currentToken["data"][-1][1] += data +\ self.stream.charsUntil(("\"", "&", "\u0000")) return True def attributeValueSingleQuotedState(self): data = self.stream.char() if data == "'": self.state = self.afterAttributeValueState elif data == "&": self.processEntityInAttribute("'") elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"][-1][1] += "\uFFFD" elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-attribute-value-single-quote"}) self.state = self.dataState else: self.currentToken["data"][-1][1] += data +\ self.stream.charsUntil(("'", "&", "\u0000")) return True def attributeValueUnQuotedState(self): data = self.stream.char() if data in spaceCharacters: self.state = self.beforeAttributeNameState elif data == "&": self.processEntityInAttribute(">") elif data == ">": self.emitCurrentToken() elif data in ('"', "'", "=", "<", "`"): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-character-in-unquoted-attribute-value"}) self.currentToken["data"][-1][1] += data elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"][-1][1] += "\uFFFD" elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-attribute-value-no-quotes"}) self.state = self.dataState else: self.currentToken["data"][-1][1] += data + self.stream.charsUntil( frozenset(("&", ">", '"', "'", "=", "<", "`", "\u0000")) | spaceCharacters) return True def afterAttributeValueState(self): data = self.stream.char() if data in spaceCharacters: self.state = self.beforeAttributeNameState elif data == ">": self.emitCurrentToken() elif data == "/": self.state = self.selfClosingStartTagState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-EOF-after-attribute-value"}) self.stream.unget(data) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-character-after-attribute-value"}) self.stream.unget(data) self.state = self.beforeAttributeNameState return True def selfClosingStartTagState(self): data = self.stream.char() if data == ">": self.currentToken["selfClosing"] = True self.emitCurrentToken() elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-EOF-after-solidus-in-tag"}) self.stream.unget(data) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-character-after-solidus-in-tag"}) self.stream.unget(data) self.state = self.beforeAttributeNameState return True def bogusCommentState(self): # Make a new comment token and give it as value all the characters # until the first > or EOF (charsUntil checks for EOF automatically) # and emit it. data = self.stream.charsUntil(">") data = data.replace("\u0000", "\uFFFD") self.tokenQueue.append( {"type": tokenTypes["Comment"], "data": data}) # Eat the character directly after the bogus comment which is either a # ">" or an EOF. self.stream.char() self.state = self.dataState return True def markupDeclarationOpenState(self): charStack = [self.stream.char()] if charStack[-1] == "-": charStack.append(self.stream.char()) if charStack[-1] == "-": self.currentToken = {"type": tokenTypes["Comment"], "data": ""} self.state = self.commentStartState return True elif charStack[-1] in ('d', 'D'): matched = True for expected in (('o', 'O'), ('c', 'C'), ('t', 'T'), ('y', 'Y'), ('p', 'P'), ('e', 'E')): charStack.append(self.stream.char()) if charStack[-1] not in expected: matched = False break if matched: self.currentToken = {"type": tokenTypes["Doctype"], "name": "", "publicId": None, "systemId": None, "correct": True} self.state = self.doctypeState return True elif (charStack[-1] == "[" and self.parser is not None and self.parser.tree.openElements and self.parser.tree.openElements[-1].namespace != self.parser.tree.defaultNamespace): matched = True for expected in ["C", "D", "A", "T", "A", "["]: charStack.append(self.stream.char()) if charStack[-1] != expected: matched = False break if matched: self.state = self.cdataSectionState return True self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-dashes-or-doctype"}) while charStack: self.stream.unget(charStack.pop()) self.state = self.bogusCommentState return True def commentStartState(self): data = self.stream.char() if data == "-": self.state = self.commentStartDashState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"] += "\uFFFD" elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "incorrect-comment"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-comment"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["data"] += data self.state = self.commentState return True def commentStartDashState(self): data = self.stream.char() if data == "-": self.state = self.commentEndState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"] += "-\uFFFD" elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "incorrect-comment"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-comment"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["data"] += "-" + data self.state = self.commentState return True def commentState(self): data = self.stream.char() if data == "-": self.state = self.commentEndDashState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"] += "\uFFFD" elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-comment"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["data"] += data + \ self.stream.charsUntil(("-", "\u0000")) return True def commentEndDashState(self): data = self.stream.char() if data == "-": self.state = self.commentEndState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"] += "-\uFFFD" self.state = self.commentState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-comment-end-dash"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["data"] += "-" + data self.state = self.commentState return True def commentEndState(self): data = self.stream.char() if data == ">": self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"] += "--\uFFFD" self.state = self.commentState elif data == "!": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-bang-after-double-dash-in-comment"}) self.state = self.commentEndBangState elif data == "-": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-dash-after-double-dash-in-comment"}) self.currentToken["data"] += data elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-comment-double-dash"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: # XXX self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-comment"}) self.currentToken["data"] += "--" + data self.state = self.commentState return True def commentEndBangState(self): data = self.stream.char() if data == ">": self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == "-": self.currentToken["data"] += "--!" self.state = self.commentEndDashState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"] += "--!\uFFFD" self.state = self.commentState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-comment-end-bang-state"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["data"] += "--!" + data self.state = self.commentState return True def doctypeState(self): data = self.stream.char() if data in spaceCharacters: self.state = self.beforeDoctypeNameState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-doctype-name-but-got-eof"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "need-space-after-doctype"}) self.stream.unget(data) self.state = self.beforeDoctypeNameState return True def beforeDoctypeNameState(self): data = self.stream.char() if data in spaceCharacters: pass elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-doctype-name-but-got-right-bracket"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["name"] = "\uFFFD" self.state = self.doctypeNameState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-doctype-name-but-got-eof"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["name"] = data self.state = self.doctypeNameState return True def doctypeNameState(self): data = self.stream.char() if data in spaceCharacters: self.currentToken["name"] = self.currentToken["name"].translate(asciiUpper2Lower) self.state = self.afterDoctypeNameState elif data == ">": self.currentToken["name"] = self.currentToken["name"].translate(asciiUpper2Lower) self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["name"] += "\uFFFD" self.state = self.doctypeNameState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype-name"}) self.currentToken["correct"] = False self.currentToken["name"] = self.currentToken["name"].translate(asciiUpper2Lower) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["name"] += data return True def afterDoctypeNameState(self): data = self.stream.char() if data in spaceCharacters: pass elif data == ">": self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.currentToken["correct"] = False self.stream.unget(data) self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: if data in ("p", "P"): matched = True for expected in (("u", "U"), ("b", "B"), ("l", "L"), ("i", "I"), ("c", "C")): data = self.stream.char() if data not in expected: matched = False break if matched: self.state = self.afterDoctypePublicKeywordState return True elif data in ("s", "S"): matched = True for expected in (("y", "Y"), ("s", "S"), ("t", "T"), ("e", "E"), ("m", "M")): data = self.stream.char() if data not in expected: matched = False break if matched: self.state = self.afterDoctypeSystemKeywordState return True # All the characters read before the current 'data' will be # [a-zA-Z], so they're garbage in the bogus doctype and can be # discarded; only the latest character might be '>' or EOF # and needs to be ungetted self.stream.unget(data) self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-space-or-right-bracket-in-doctype", "datavars": {"data": data}}) self.currentToken["correct"] = False self.state = self.bogusDoctypeState return True def afterDoctypePublicKeywordState(self): data = self.stream.char() if data in spaceCharacters: self.state = self.beforeDoctypePublicIdentifierState elif data in ("'", '"'): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.stream.unget(data) self.state = self.beforeDoctypePublicIdentifierState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.stream.unget(data) self.state = self.beforeDoctypePublicIdentifierState return True def beforeDoctypePublicIdentifierState(self): data = self.stream.char() if data in spaceCharacters: pass elif data == "\"": self.currentToken["publicId"] = "" self.state = self.doctypePublicIdentifierDoubleQuotedState elif data == "'": self.currentToken["publicId"] = "" self.state = self.doctypePublicIdentifierSingleQuotedState elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-end-of-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.currentToken["correct"] = False self.state = self.bogusDoctypeState return True def doctypePublicIdentifierDoubleQuotedState(self): data = self.stream.char() if data == "\"": self.state = self.afterDoctypePublicIdentifierState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["publicId"] += "\uFFFD" elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-end-of-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["publicId"] += data return True def doctypePublicIdentifierSingleQuotedState(self): data = self.stream.char() if data == "'": self.state = self.afterDoctypePublicIdentifierState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["publicId"] += "\uFFFD" elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-end-of-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["publicId"] += data return True def afterDoctypePublicIdentifierState(self): data = self.stream.char() if data in spaceCharacters: self.state = self.betweenDoctypePublicAndSystemIdentifiersState elif data == ">": self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == '"': self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierDoubleQuotedState elif data == "'": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierSingleQuotedState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.currentToken["correct"] = False self.state = self.bogusDoctypeState return True def betweenDoctypePublicAndSystemIdentifiersState(self): data = self.stream.char() if data in spaceCharacters: pass elif data == ">": self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == '"': self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierDoubleQuotedState elif data == "'": self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierSingleQuotedState elif data == EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.currentToken["correct"] = False self.state = self.bogusDoctypeState return True def afterDoctypeSystemKeywordState(self): data = self.stream.char() if data in spaceCharacters: self.state = self.beforeDoctypeSystemIdentifierState elif data in ("'", '"'): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.stream.unget(data) self.state = self.beforeDoctypeSystemIdentifierState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.stream.unget(data) self.state = self.beforeDoctypeSystemIdentifierState return True def beforeDoctypeSystemIdentifierState(self): data = self.stream.char() if data in spaceCharacters: pass elif data == "\"": self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierDoubleQuotedState elif data == "'": self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierSingleQuotedState elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.currentToken["correct"] = False self.state = self.bogusDoctypeState return True def doctypeSystemIdentifierDoubleQuotedState(self): data = self.stream.char() if data == "\"": self.state = self.afterDoctypeSystemIdentifierState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["systemId"] += "\uFFFD" elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-end-of-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["systemId"] += data return True def doctypeSystemIdentifierSingleQuotedState(self): data = self.stream.char() if data == "'": self.state = self.afterDoctypeSystemIdentifierState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["systemId"] += "\uFFFD" elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-end-of-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["systemId"] += data return True def afterDoctypeSystemIdentifierState(self): data = self.stream.char() if data in spaceCharacters: pass elif data == ">": self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.state = self.bogusDoctypeState return True def bogusDoctypeState(self): data = self.stream.char() if data == ">": self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: # XXX EMIT self.stream.unget(data) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: pass return True def cdataSectionState(self): data = [] while True: data.append(self.stream.charsUntil("]")) data.append(self.stream.charsUntil(">")) char = self.stream.char() if char == EOF: break else: assert char == ">" if data[-1][-2:] == "]]": data[-1] = data[-1][:-2] break else: data.append(char) data = "".join(data) # pylint:disable=redefined-variable-type # Deal with null here rather than in the parser nullCount = data.count("\u0000") if nullCount > 0: for _ in range(nullCount): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) data = data.replace("\u0000", "\uFFFD") if data: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) self.state = self.dataState return True site-packages/pip/_vendor/html5lib/_tokenizer.pyc000064400000151156147204247350016137 0ustar00 abc@`sddlmZmZmZddlmZddlmZddl m Z ddl m Z ddl m Z m Z ddl mZmZmZdd l mZmZdd l mZdd lmZdd lmZee Zd efdYZdS(i(tabsolute_importtdivisiontunicode_literals(tunichr(tdequei(tspaceCharacters(tentities(t asciiLetterstasciiUpper2Lower(tdigitst hexDigitstEOF(t tokenTypest tagTokenTypes(treplacementCharacters(tHTMLInputStream(tTriet HTMLTokenizercB`seZdZdJdZdZdZdJedZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d"Z&d#Z'd$Z(d%Z)d&Z*d'Z+d(Z,d)Z-d*Z.d+Z/d,Z0d-Z1d.Z2d/Z3d0Z4d1Z5d2Z6d3Z7d4Z8d5Z9d6Z:d7Z;d8Z<d9Z=d:Z>d;Z?d<Z@d=ZAd>ZBd?ZCd@ZDdAZEdBZFdCZGdDZHdEZIdFZJdGZKdHZLdIZMRS(Ku  This class takes care of tokenizing HTML. * self.currentToken Holds the token that is currently being processed. * self.state Holds a reference to the method to be invoked... XXX * self.stream Points to HTMLInputStream object. cK`sbt|||_||_t|_g|_|j|_t|_d|_ t t |j dS(N(RtstreamtparsertFalset escapeFlagt lastFourCharst dataStatetstatetescapetNonet currentTokentsuperRt__init__(tselfRRtkwargs((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyR"s      cc`s}tg|_xg|jrxx6|jjrVitdd6|jjjdd6Vq!Wx|jrt|jjVqZWqWdS(u This is where the magic happens. We do our usually processing through the states and when we have a token to return we yield the token which pauses processing until the next token is requested. u ParseErrorutypeiudataN(Rt tokenQueueRRterrorsR tpoptpopleft(R((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyt__iter__1s * c %C`st}d}|r!t}d}ng}|jj}x8||krp|tk rp|j||jj}q9Wtdj||}|tkrt|}|j jit dd6dd6i|d6d 6nd |kod kns|d kr3d }|j jit dd6dd6i|d6d 6nrd|koJdknsd|kofdknsd|kodknsd|kodkns|t ddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d g#krQ|j jit dd6dd6i|d6d 6nyt |}WnAt k r|d8}t d |d?Bt d9|d:@B}nX|d;kr|j jit dd6d<d6|jj|n|S(=uThis function returns either U+FFFD or the character based on the decimal or hexadecimal representation. It also discards ";" if present. If not present self.tokenQueue.append({"type": tokenTypes["ParseError"]}) is invoked. i iuu ParseErrorutypeu$illegal-codepoint-for-numeric-entityudatau charAsIntudatavarsiiiu�iiiiiiiii iiiiiiiiiiiiiiiiiii i i i i i i i i i iiiiiiiiu;u numeric-entity-without-semicolon(R R RtcharR tappendtinttjoinRR R t frozensettchrt ValueErrortunget( RtisHextallowedtradixt charStacktct charAsIntR%tv((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pytconsumeNumberEntityAs`              *  c C`sd}|jjg}|dtks]|dtddfks]|dk rt||dkrt|jj|dn|ddkrpt}|j|jj|ddkrt}|j|jjn|r|dt ks| r"|dt kr"|jj|d|j |}q7|j jit dd 6d d 6|jj|jdd j|}nxF|dtk rtjd j|sPn|j|jjqsWy,tjd j|d }t|}Wntk rd}nX|dk r|dd kr@|j jit dd 6dd 6n|dd kr|r||tks||t ks||dkr|jj|jdd j|}q7t|}|jj|j|d j||7}nK|j jit dd 6dd 6|jj|jdd j|}|r[|jd ddc|7u ParseErroru'expected-tag-name-but-got-right-bracketu Charactersu<>u?u'expected-tag-name-but-got-question-markuexpected-tag-nameu<(RR%tmarkupDeclarationOpenStateRtcloseTagOpenStateRR RRt tagNameStateR R&RR,tbogusCommentStateR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRHis6      "   " cC`s?|jj}|tkrSitdd6|d6gd6td6|_|j|_n|dkr|jj itdd6dd6|j |_n|t kr|jj itdd6d d6|jj itd d6d d6|j |_nL|jj itdd6d d6i|d6d 6|jj ||j |_tS(NuEndTagutypeunameudatau selfClosingu>u ParseErroru*expected-closing-tag-but-got-right-bracketu expected-closing-tag-but-got-eofu Charactersuu ParseErrorutypeueof-in-tag-nameudatau/uuinvalid-codepointunameu�(RR%RtbeforeAttributeNameStateRRFR R R&R RtselfClosingStartTagStateRR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRVs"        cC`su|jj}|dkr3d|_|j|_n>|jjitdd6dd6|jj||j |_t S(Nu/uu Charactersutypeu|jjitdd6dd6|jj ||j |_t S(Nu Charactersutypeuu Charactersu|jjitdd6dd6|jj||j |_t S(Nu/uu Charactersutypeu|jjitdd6dd6|jj ||j |_t S(Nu Charactersutypeuu Charactersu|jjitdd6dd6|jj ||j |_t S( Nu/uu!u Charactersutypeu|jjitdd6dd6|jj ||j |_t S(Nu Charactersutypeuu Charactersuuu ParseErroruinvalid-codepointu�( RR%R R&R RgRRRRhR RR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRes& %  "    " cC`s|jj}|dkr3d|_|j|_n|tkr}|jjitdd6d|d6||_|j |_n>|jjitdd6dd6|jj ||j |_t S(Nu/uu Charactersutypeu|jjitdd6dd6|jj ||j |_t S(Nu Charactersutypeuu Charactersuu Charactersutypeudatauscript(u/u>(RR%RR)R R&R RZR]tscriptDataDoubleEscapedStateRRhRR,R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRjs" " cC`s?|jj}|dkrL|jjitdd6dd6|j|_n|dkr|jjitdd6dd6|j|_n|dkr|jjitdd6dd6|jjitdd6d d6n_|tkr|jjitdd6d d6|j |_n"|jjitdd6|d6t S( Nu-u Charactersutypeudatauuu ParseErroruinvalid-codepointu�ueof-in-script-in-script( RR%R R&R RnRRRRlR RR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRos, % " "     " cC`su|jj}|dkrU|jjitdd6dd6d|_|j|_n|jj||j |_t S(Nu/u Charactersutypeudatau( RR%R R&R RZtscriptDataDoubleEscapeEndStateRR,RlR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRn0s "  cC`s|jj}|ttdBkrz|jjitdd6|d6|jjdkrk|j |_ q|j |_ n\|t kr|jjitdd6|d6|j|7_n|jj ||j |_ tS(Nu/u>u Charactersutypeudatauscript(u/u>(RR%RR)R R&R RZR]RhRRlRR,R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRp;s" " cC`s|jj}|tkr1|jjttnz|tkrf|jdj|dg|j|_ nE|dkr|j n,|dkr|j |_ n|dkr|j jit d d 6d d6|jdj|dg|j|_ n|d krH|j jit d d 6d d6|jdjddg|j|_ nc|tkr|j jit d d 6dd6|j|_ n&|jdj|dg|j|_ tS(Nudatauu>u/u'u"u=uu/uu ParseErrorutypeuinvalid-codepointu�u'u"uudatauu/uu ParseErrorutypeuinvalid-codepointu�u'u"uu ParseErrorutypeu.expected-attribute-value-but-got-right-bracketudatauuinvalid-codepointiiu�u=u               cC`s|jj}|dkr*|j|_n|dkrF|jdn|dkr|jjitdd6dd6|jddd cd 7u"u'u=uu"u'u=u|jj it dd6dd6|jj ||j|_t S(Nu>u/u ParseErrorutypeu$unexpected-EOF-after-attribute-valueudatau*unexpected-character-after-attribute-value(RR%RRXRRFRYR R R&R R,RR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyR{ s"        cC`s|jj}|dkr5t|jd<|jn|tkr|jjitdd6dd6|jj ||j |_ n>|jjitdd6dd6|jj ||j |_ tS(Nu>u selfClosingu ParseErrorutypeu#unexpected-EOF-after-solidus-in-tagudatau)unexpected-character-after-solidus-in-tag( RR%R5RRFR R R&R R,RRRX(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRY4s       cC`sc|jjd}|jdd}|jjitdd6|d6|jj|j|_t S(Nu>uu�uCommentutypeudata( RRItreplaceR R&R R%RRR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRWFs   cC`sB|jjg}|ddkrv|j|jj|ddkritdd6dd6|_|j|_tSnw|ddkr(t}xPdd d!d"d#d$fD]6}|j|jj|d|krt}PqqW|ritdd6dd6dd6dd6td6|_|j |_tSn|ddkr|j dk r|j j j r|j j j dj|j j jkrt}xPd dddddgD]6}|j|jj|d|krt}PqqW|r|j|_tSn|jjitdd6dd6x |r1|jj|jqW|j|_tS(%Niu-uCommentutypeuudatauduDuouOucuCutuTuyuYupuPueuEuDoctypeunameupublicIdusystemIducorrectu[uAu ParseErroruexpected-dashes-or-doctype(uduD(uouO(ucuC(utuT(uyuY(upuP(ueuE(RR%R&R RtcommentStartStateRR5RRt doctypeStateRttreet openElementst namespacetdefaultNamespacetcdataSectionStateR R,R"RW(RR0tmatchedtexpected((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRTUsR    %    cC`s1|jj}|dkr*|j|_n|dkrn|jjitdd6dd6|jdcd7uincorrect-commentueof-in-comment( RR%tcommentStartDashStateRR R&R RRR t commentStateR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyR}s(        cC`s5|jj}|dkr*|j|_n|dkrn|jjitdd6dd6|jdcd7uincorrect-commentueof-in-comment( RR%tcommentEndStateRR R&R RRR RR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs(        cC`s|jj}|dkr*|j|_n|dkrn|jjitdd6dd6|jdcd7uu ParseErrorutypeuinvalid-codepointudatau--�u!u,unexpected-bang-after-double-dash-in-commentu-u,unexpected-dash-after-double-dash-in-commentueof-in-comment-double-dashuunexpected-char-in-commentu--( RR%R R&RRRR RtcommentEndBangStateR R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs6           cC`s2|jj}|dkr=|jj|j|j|_n|dkrk|jdcd7<|j|_n|dkr|jjitdd6dd6|jdcd 7<|j |_ns|t kr |jjitdd6d d6|jj|j|j|_n#|jdcd|7<|j |_t S( Nu>u-udatau--!uu ParseErrorutypeuinvalid-codepointu--!�ueof-in-comment-end-bang-state( RR%R R&RRRRR RR R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs(       cC`s|jj}|tkr*|j|_n|tkr|jjitdd6dd6t |j d<|jj|j |j |_n>|jjitdd6dd6|jj ||j|_t S(Nu ParseErrorutypeu!expected-doctype-name-but-got-eofudataucorrectuneed-space-after-doctype(RR%RtbeforeDoctypeNameStateRR R R&R RRRR,R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyR~ s      cC`s?|jj}|tkrn|dkr{|jjitdd6dd6t|jd<|jj|j|j|_ n|dkr|jjitdd6dd6d |jd <|j |_ nv|t kr"|jjitdd6d d6t|jd<|jj|j|j|_ n||jd <|j |_ t S( Nu>u ParseErrorutypeu+expected-doctype-name-but-got-right-bracketudataucorrectuuinvalid-codepointu�unameu!expected-doctype-name-but-got-eof( RR%RR R&R RRRRtdoctypeNameStateR R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs.            cC`ss|jj}|tkrG|jdjt|jd<|j|_n(|dkr|jdjt|jd<|jj |j|j |_n|dkr|jj it dd6dd6|jdcd7<|j |_n|t kr\|jj it dd6d d6t|jd <|jdjt|jd<|jj |j|j |_n|jdc|7uu ParseErrorutypeuinvalid-codepointudatau�ueof-in-doctype-nameucorrect(RR%RRRDRtafterDoctypeNameStateRR R&RR RR RR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyR6s,       cC`s|jj}|tkrn|dkrL|jj|j|j|_n|tkrt |jd<|jj ||jjit dd6dd6|jj|j|j|_n9|dkr)t }xBd d!d"d#d$fD]+}|jj}||krt }PqqW|r|j |_t Snp|d%krt }xBd&d'd(d)d*fD]+}|jj}||krQt }PqQqQW|r|j|_t Sn|jj ||jjit dd6dd6i|d6d6t |jd<|j|_t S(+Nu>ucorrectu ParseErrorutypeueof-in-doctypeudataupuPuuuUubuBuluLuiuIucuCusuSuyuYutuTueuEumuMu*expected-space-or-right-bracket-in-doctypeudatavars(upuP(uuuU(ubuB(uluL(uiuI(ucuC(usuS(uyuY(usuS(utuT(ueuE(umuM(RR%RR R&RRRR RR,R R5tafterDoctypePublicKeywordStatetafterDoctypeSystemKeywordStatetbogusDoctypeState(RRJRR((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyROsT               cC`s|jj}|tkr*|j|_n|d krw|jjitdd6dd6|jj||j|_ny|t kr|jjitdd6dd6t |j d<|jj|j |j |_n|jj||j|_t S( Nu'u"u ParseErrorutypeuunexpected-char-in-doctypeudataueof-in-doctypeucorrect(u'u"(RR%Rt"beforeDoctypePublicIdentifierStateRR R&R R,R RRRR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs"       cC`sg|jj}|tkrnE|dkrFd|jd<|j|_n|dkrnd|jd<|j|_n|dkr|jjit dd6dd 6t |jd <|jj|j|j |_n|t kr(|jjit dd6d d 6t |jd <|jj|j|j |_n;|jjit dd6d d 6t |jd <|j |_tS( Nu"uupublicIdu'u>u ParseErrorutypeuunexpected-end-of-doctypeudataucorrectueof-in-doctypeuunexpected-char-in-doctype(RR%RRt(doctypePublicIdentifierDoubleQuotedStateRt(doctypePublicIdentifierSingleQuotedStateR R&R RRR RR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs4              cC`s?|jj}|dkr*|j|_n|dkrn|jjitdd6dd6|jdcd7uunexpected-end-of-doctypeucorrectueof-in-doctype( RR%t!afterDoctypePublicIdentifierStateRR R&R RRRR R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs*         cC`s?|jj}|dkr*|j|_n|dkrn|jjitdd6dd6|jdcd7uunexpected-end-of-doctypeucorrectueof-in-doctype( RR%RRR R&R RRRR R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs*         cC`s|jj}|tkr*|j|_nZ|dkrX|jj|j|j|_n,|dkr|jjit dd6dd6d|jd<|j |_n|d kr|jjit dd6dd6d|jd<|j |_n|t krI|jjit dd6d d6t |jd <|jj|j|j|_n;|jjit dd6dd6t |jd <|j|_tS( Nu>u"u ParseErrorutypeuunexpected-char-in-doctypeudatauusystemIdu'ueof-in-doctypeucorrect(RR%Rt-betweenDoctypePublicAndSystemIdentifiersStateRR R&RRR t(doctypeSystemIdentifierDoubleQuotedStatet(doctypeSystemIdentifierSingleQuotedStateR RRR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs6              cC`s8|jj}|tkrn|dkrL|jj|j|j|_n|dkrtd|jd<|j|_n|dkrd|jd<|j |_n|t kr|jjit dd6dd 6t |jd <|jj|j|j|_n;|jjit dd6d d 6t |jd <|j |_tS( Nu>u"uusystemIdu'u ParseErrorutypeueof-in-doctypeudataucorrectuunexpected-char-in-doctype(RR%RR R&RRRRRR R RRR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs.            cC`s|jj}|tkr*|j|_n|d krw|jjitdd6dd6|jj||j|_ny|t kr|jjitdd6dd6t |j d<|jj|j |j |_n|jj||j|_t S( Nu'u"u ParseErrorutypeuunexpected-char-in-doctypeudataueof-in-doctypeucorrect(u'u"(RR%Rt"beforeDoctypeSystemIdentifierStateRR R&R R,R RRRR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs"       cC`sg|jj}|tkrnE|dkrFd|jd<|j|_n|dkrnd|jd<|j|_n|dkr|jjit dd6dd 6t |jd <|jj|j|j |_n|t kr(|jjit dd6d d 6t |jd <|jj|j|j |_n;|jjit dd6dd 6t |jd <|j |_tS( Nu"uusystemIdu'u>u ParseErrorutypeuunexpected-char-in-doctypeudataucorrectueof-in-doctype(RR%RRRRRR R&R RRR RR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyR/s4              cC`s?|jj}|dkr*|j|_n|dkrn|jjitdd6dd6|jdcd7uunexpected-end-of-doctypeucorrectueof-in-doctype( RR%t!afterDoctypeSystemIdentifierStateRR R&R RRRR R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRLs*         cC`s?|jj}|dkr*|j|_n|dkrn|jjitdd6dd6|jdcd7uunexpected-end-of-doctypeucorrectueof-in-doctype( RR%RRR R&R RRRR R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRds*         cC`s|jj}|tkrn|dkrL|jj|j|j|_n|tkr|jjit dd6dd6t |jd<|jj|j|j|_n.|jjit dd6dd6|j |_t S(Nu>u ParseErrorutypeueof-in-doctypeudataucorrectuunexpected-char-in-doctype( RR%RR R&RRRR R RRR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyR|s        cC`s|jj}|dkr=|jj|j|j|_n>|tkr{|jj||jj|j|j|_nt S(Nu>( RR%R R&RRRR R,R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs  cC`s`g}xtr|j|jjd|j|jjd|jj}|tkr`Pq |dksrt|dddkr|dd |diiu]]uuiu ParseErrorutypeuinvalid-codepointudatau�u Characters(R5R&RRIR%R tAssertionErrorR(tcounttrangeR R R|RR(RRJR%t nullCountRw((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs0    N(Nt__name__t __module__t__doc__RRR$R4RRBRCRFRRGRNRLRPRRRSRHRURVRMR[R\ROR_R`RQRaRcRbRdRhRfReRgRiRkRjRlRmRoRnRpRXRqRsRrRxRzRyR{RYRWRTR}RRRRRR~RRRRRRRRRRRRRRRR(((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs    HP          #                  6 "       -          3            N(t __future__RRRtpip._vendor.sixRR*t collectionsRt constantsRRRRR R R R R Rt _inputstreamRt_trieRR6tobjectR(((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyts site-packages/pip/_vendor/html5lib/_tokenizer.pyo000064400000151107147204247350016147 0ustar00 abc@`sddlmZmZmZddlmZddlmZddl m Z ddl m Z ddl m Z m Z ddl mZmZmZdd l mZmZdd l mZdd lmZdd lmZee Zd efdYZdS(i(tabsolute_importtdivisiontunicode_literals(tunichr(tdequei(tspaceCharacters(tentities(t asciiLetterstasciiUpper2Lower(tdigitst hexDigitstEOF(t tokenTypest tagTokenTypes(treplacementCharacters(tHTMLInputStream(tTriet HTMLTokenizercB`seZdZdJdZdZdZdJedZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d"Z&d#Z'd$Z(d%Z)d&Z*d'Z+d(Z,d)Z-d*Z.d+Z/d,Z0d-Z1d.Z2d/Z3d0Z4d1Z5d2Z6d3Z7d4Z8d5Z9d6Z:d7Z;d8Z<d9Z=d:Z>d;Z?d<Z@d=ZAd>ZBd?ZCd@ZDdAZEdBZFdCZGdDZHdEZIdFZJdGZKdHZLdIZMRS(Ku  This class takes care of tokenizing HTML. * self.currentToken Holds the token that is currently being processed. * self.state Holds a reference to the method to be invoked... XXX * self.stream Points to HTMLInputStream object. cK`sbt|||_||_t|_g|_|j|_t|_d|_ t t |j dS(N(RtstreamtparsertFalset escapeFlagt lastFourCharst dataStatetstatetescapetNonet currentTokentsuperRt__init__(tselfRRtkwargs((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyR"s      cc`s}tg|_xg|jrxx6|jjrVitdd6|jjjdd6Vq!Wx|jrt|jjVqZWqWdS(u This is where the magic happens. We do our usually processing through the states and when we have a token to return we yield the token which pauses processing until the next token is requested. u ParseErrorutypeiudataN(Rt tokenQueueRRterrorsR tpoptpopleft(R((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyt__iter__1s * c %C`st}d}|r!t}d}ng}|jj}x8||krp|tk rp|j||jj}q9Wtdj||}|tkrt|}|j jit dd6dd6i|d6d 6nd |kod kns|d kr3d }|j jit dd6dd6i|d6d 6nrd|koJdknsd|kofdknsd|kodknsd|kodkns|t ddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d g#krQ|j jit dd6dd6i|d6d 6nyt |}WnAt k r|d8}t d |d?Bt d9|d:@B}nX|d;kr|j jit dd6d<d6|jj|n|S(=uThis function returns either U+FFFD or the character based on the decimal or hexadecimal representation. It also discards ";" if present. If not present self.tokenQueue.append({"type": tokenTypes["ParseError"]}) is invoked. i iuu ParseErrorutypeu$illegal-codepoint-for-numeric-entityudatau charAsIntudatavarsiiiu�iiiiiiiii iiiiiiiiiiiiiiiiiii i i i i i i i i i iiiiiiiiu;u numeric-entity-without-semicolon(R R RtcharR tappendtinttjoinRR R t frozensettchrt ValueErrortunget( RtisHextallowedtradixt charStacktct charAsIntR%tv((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pytconsumeNumberEntityAs`              *  c C`sd}|jjg}|dtks]|dtddfks]|dk rt||dkrt|jj|dn|ddkrpt}|j|jj|ddkrt}|j|jjn|r|dt ks| r"|dt kr"|jj|d|j |}q7|j jit dd 6d d 6|jj|jdd j|}nxF|dtk rtjd j|sPn|j|jjqsWy,tjd j|d }t|}Wntk rd}nX|dk r|dd kr@|j jit dd 6dd 6n|dd kr|r||tks||t ks||dkr|jj|jdd j|}q7t|}|jj|j|d j||7}nK|j jit dd 6dd 6|jj|jdd j|}|r[|jd ddc|7u ParseErroru'expected-tag-name-but-got-right-bracketu Charactersu<>u?u'expected-tag-name-but-got-question-markuexpected-tag-nameu<(RR%tmarkupDeclarationOpenStateRtcloseTagOpenStateRR RRt tagNameStateR R&RR,tbogusCommentStateR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRHis6      "   " cC`s?|jj}|tkrSitdd6|d6gd6td6|_|j|_n|dkr|jj itdd6dd6|j |_n|t kr|jj itdd6d d6|jj itd d6d d6|j |_nL|jj itdd6d d6i|d6d 6|jj ||j |_tS(NuEndTagutypeunameudatau selfClosingu>u ParseErroru*expected-closing-tag-but-got-right-bracketu expected-closing-tag-but-got-eofu Charactersuu ParseErrorutypeueof-in-tag-nameudatau/uuinvalid-codepointunameu�(RR%RtbeforeAttributeNameStateRRFR R R&R RtselfClosingStartTagStateRR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRVs"        cC`su|jj}|dkr3d|_|j|_n>|jjitdd6dd6|jj||j |_t S(Nu/uu Charactersutypeu|jjitdd6dd6|jj ||j |_t S(Nu Charactersutypeuu Charactersu|jjitdd6dd6|jj||j |_t S(Nu/uu Charactersutypeu|jjitdd6dd6|jj ||j |_t S(Nu Charactersutypeuu Charactersu|jjitdd6dd6|jj ||j |_t S( Nu/uu!u Charactersutypeu|jjitdd6dd6|jj ||j |_t S(Nu Charactersutypeuu Charactersuuu ParseErroruinvalid-codepointu�( RR%R R&R RgRRRRhR RR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRes& %  "    " cC`s|jj}|dkr3d|_|j|_n|tkr}|jjitdd6d|d6||_|j |_n>|jjitdd6dd6|jj ||j |_t S(Nu/uu Charactersutypeu|jjitdd6dd6|jj ||j |_t S(Nu Charactersutypeuu Charactersuu Charactersutypeudatauscript(u/u>(RR%RR)R R&R RZR]tscriptDataDoubleEscapedStateRRhRR,R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRjs" " cC`s?|jj}|dkrL|jjitdd6dd6|j|_n|dkr|jjitdd6dd6|j|_n|dkr|jjitdd6dd6|jjitdd6d d6n_|tkr|jjitdd6d d6|j |_n"|jjitdd6|d6t S( Nu-u Charactersutypeudatauuu ParseErroruinvalid-codepointu�ueof-in-script-in-script( RR%R R&R RnRRRRlR RR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRos, % " "     " cC`su|jj}|dkrU|jjitdd6dd6d|_|j|_n|jj||j |_t S(Nu/u Charactersutypeudatau( RR%R R&R RZtscriptDataDoubleEscapeEndStateRR,RlR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRn0s "  cC`s|jj}|ttdBkrz|jjitdd6|d6|jjdkrk|j |_ q|j |_ n\|t kr|jjitdd6|d6|j|7_n|jj ||j |_ tS(Nu/u>u Charactersutypeudatauscript(u/u>(RR%RR)R R&R RZR]RhRRlRR,R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRp;s" " cC`s|jj}|tkr1|jjttnz|tkrf|jdj|dg|j|_ nE|dkr|j n,|dkr|j |_ n|dkr|j jit d d 6d d6|jdj|dg|j|_ n|d krH|j jit d d 6d d6|jdjddg|j|_ nc|tkr|j jit d d 6dd6|j|_ n&|jdj|dg|j|_ tS(Nudatauu>u/u'u"u=uu/uu ParseErrorutypeuinvalid-codepointu�u'u"uudatauu/uu ParseErrorutypeuinvalid-codepointu�u'u"uu ParseErrorutypeu.expected-attribute-value-but-got-right-bracketudatauuinvalid-codepointiiu�u=u               cC`s|jj}|dkr*|j|_n|dkrF|jdn|dkr|jjitdd6dd6|jddd cd 7u"u'u=uu"u'u=u|jj it dd6dd6|jj ||j|_t S(Nu>u/u ParseErrorutypeu$unexpected-EOF-after-attribute-valueudatau*unexpected-character-after-attribute-value(RR%RRXRRFRYR R R&R R,RR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyR{ s"        cC`s|jj}|dkr5t|jd<|jn|tkr|jjitdd6dd6|jj ||j |_ n>|jjitdd6dd6|jj ||j |_ tS(Nu>u selfClosingu ParseErrorutypeu#unexpected-EOF-after-solidus-in-tagudatau)unexpected-character-after-solidus-in-tag( RR%R5RRFR R R&R R,RRRX(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRY4s       cC`sc|jjd}|jdd}|jjitdd6|d6|jj|j|_t S(Nu>uu�uCommentutypeudata( RRItreplaceR R&R R%RRR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRWFs   cC`sB|jjg}|ddkrv|j|jj|ddkritdd6dd6|_|j|_tSnw|ddkr(t}xPdd d!d"d#d$fD]6}|j|jj|d|krt}PqqW|ritdd6dd6dd6dd6td6|_|j |_tSn|ddkr|j dk r|j j j r|j j j dj|j j jkrt}xPd dddddgD]6}|j|jj|d|krt}PqqW|r|j|_tSn|jjitdd6dd6x |r1|jj|jqW|j|_tS(%Niu-uCommentutypeuudatauduDuouOucuCutuTuyuYupuPueuEuDoctypeunameupublicIdusystemIducorrectu[uAu ParseErroruexpected-dashes-or-doctype(uduD(uouO(ucuC(utuT(uyuY(upuP(ueuE(RR%R&R RtcommentStartStateRR5RRt doctypeStateRttreet openElementst namespacetdefaultNamespacetcdataSectionStateR R,R"RW(RR0tmatchedtexpected((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRTUsR    %    cC`s1|jj}|dkr*|j|_n|dkrn|jjitdd6dd6|jdcd7uincorrect-commentueof-in-comment( RR%tcommentStartDashStateRR R&R RRR t commentStateR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyR}s(        cC`s5|jj}|dkr*|j|_n|dkrn|jjitdd6dd6|jdcd7uincorrect-commentueof-in-comment( RR%tcommentEndStateRR R&R RRR RR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs(        cC`s|jj}|dkr*|j|_n|dkrn|jjitdd6dd6|jdcd7uu ParseErrorutypeuinvalid-codepointudatau--�u!u,unexpected-bang-after-double-dash-in-commentu-u,unexpected-dash-after-double-dash-in-commentueof-in-comment-double-dashuunexpected-char-in-commentu--( RR%R R&RRRR RtcommentEndBangStateR R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs6           cC`s2|jj}|dkr=|jj|j|j|_n|dkrk|jdcd7<|j|_n|dkr|jjitdd6dd6|jdcd 7<|j |_ns|t kr |jjitdd6d d6|jj|j|j|_n#|jdcd|7<|j |_t S( Nu>u-udatau--!uu ParseErrorutypeuinvalid-codepointu--!�ueof-in-comment-end-bang-state( RR%R R&RRRRR RR R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs(       cC`s|jj}|tkr*|j|_n|tkr|jjitdd6dd6t |j d<|jj|j |j |_n>|jjitdd6dd6|jj ||j|_t S(Nu ParseErrorutypeu!expected-doctype-name-but-got-eofudataucorrectuneed-space-after-doctype(RR%RtbeforeDoctypeNameStateRR R R&R RRRR,R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyR~ s      cC`s?|jj}|tkrn|dkr{|jjitdd6dd6t|jd<|jj|j|j|_ n|dkr|jjitdd6dd6d |jd <|j |_ nv|t kr"|jjitdd6d d6t|jd<|jj|j|j|_ n||jd <|j |_ t S( Nu>u ParseErrorutypeu+expected-doctype-name-but-got-right-bracketudataucorrectuuinvalid-codepointu�unameu!expected-doctype-name-but-got-eof( RR%RR R&R RRRRtdoctypeNameStateR R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs.            cC`ss|jj}|tkrG|jdjt|jd<|j|_n(|dkr|jdjt|jd<|jj |j|j |_n|dkr|jj it dd6dd6|jdcd7<|j |_n|t kr\|jj it dd6d d6t|jd <|jdjt|jd<|jj |j|j |_n|jdc|7uu ParseErrorutypeuinvalid-codepointudatau�ueof-in-doctype-nameucorrect(RR%RRRDRtafterDoctypeNameStateRR R&RR RR RR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyR6s,       cC`s|jj}|tkrn|dkrL|jj|j|j|_n|tkrt |jd<|jj ||jjit dd6dd6|jj|j|j|_n9|dkr)t }xBd d!d"d#d$fD]+}|jj}||krt }PqqW|r|j |_t Snp|d%krt }xBd&d'd(d)d*fD]+}|jj}||krQt }PqQqQW|r|j|_t Sn|jj ||jjit dd6dd6i|d6d6t |jd<|j|_t S(+Nu>ucorrectu ParseErrorutypeueof-in-doctypeudataupuPuuuUubuBuluLuiuIucuCusuSuyuYutuTueuEumuMu*expected-space-or-right-bracket-in-doctypeudatavars(upuP(uuuU(ubuB(uluL(uiuI(ucuC(usuS(uyuY(usuS(utuT(ueuE(umuM(RR%RR R&RRRR RR,R R5tafterDoctypePublicKeywordStatetafterDoctypeSystemKeywordStatetbogusDoctypeState(RRJRR((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyROsT               cC`s|jj}|tkr*|j|_n|d krw|jjitdd6dd6|jj||j|_ny|t kr|jjitdd6dd6t |j d<|jj|j |j |_n|jj||j|_t S( Nu'u"u ParseErrorutypeuunexpected-char-in-doctypeudataueof-in-doctypeucorrect(u'u"(RR%Rt"beforeDoctypePublicIdentifierStateRR R&R R,R RRRR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs"       cC`sg|jj}|tkrnE|dkrFd|jd<|j|_n|dkrnd|jd<|j|_n|dkr|jjit dd6dd 6t |jd <|jj|j|j |_n|t kr(|jjit dd6d d 6t |jd <|jj|j|j |_n;|jjit dd6d d 6t |jd <|j |_tS( Nu"uupublicIdu'u>u ParseErrorutypeuunexpected-end-of-doctypeudataucorrectueof-in-doctypeuunexpected-char-in-doctype(RR%RRt(doctypePublicIdentifierDoubleQuotedStateRt(doctypePublicIdentifierSingleQuotedStateR R&R RRR RR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs4              cC`s?|jj}|dkr*|j|_n|dkrn|jjitdd6dd6|jdcd7uunexpected-end-of-doctypeucorrectueof-in-doctype( RR%t!afterDoctypePublicIdentifierStateRR R&R RRRR R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs*         cC`s?|jj}|dkr*|j|_n|dkrn|jjitdd6dd6|jdcd7uunexpected-end-of-doctypeucorrectueof-in-doctype( RR%RRR R&R RRRR R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs*         cC`s|jj}|tkr*|j|_nZ|dkrX|jj|j|j|_n,|dkr|jjit dd6dd6d|jd<|j |_n|d kr|jjit dd6dd6d|jd<|j |_n|t krI|jjit dd6d d6t |jd <|jj|j|j|_n;|jjit dd6dd6t |jd <|j|_tS( Nu>u"u ParseErrorutypeuunexpected-char-in-doctypeudatauusystemIdu'ueof-in-doctypeucorrect(RR%Rt-betweenDoctypePublicAndSystemIdentifiersStateRR R&RRR t(doctypeSystemIdentifierDoubleQuotedStatet(doctypeSystemIdentifierSingleQuotedStateR RRR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs6              cC`s8|jj}|tkrn|dkrL|jj|j|j|_n|dkrtd|jd<|j|_n|dkrd|jd<|j |_n|t kr|jjit dd6dd 6t |jd <|jj|j|j|_n;|jjit dd6d d 6t |jd <|j |_tS( Nu>u"uusystemIdu'u ParseErrorutypeueof-in-doctypeudataucorrectuunexpected-char-in-doctype(RR%RR R&RRRRRR R RRR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs.            cC`s|jj}|tkr*|j|_n|d krw|jjitdd6dd6|jj||j|_ny|t kr|jjitdd6dd6t |j d<|jj|j |j |_n|jj||j|_t S( Nu'u"u ParseErrorutypeuunexpected-char-in-doctypeudataueof-in-doctypeucorrect(u'u"(RR%Rt"beforeDoctypeSystemIdentifierStateRR R&R R,R RRRR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs"       cC`sg|jj}|tkrnE|dkrFd|jd<|j|_n|dkrnd|jd<|j|_n|dkr|jjit dd6dd 6t |jd <|jj|j|j |_n|t kr(|jjit dd6d d 6t |jd <|jj|j|j |_n;|jjit dd6dd 6t |jd <|j |_tS( Nu"uusystemIdu'u>u ParseErrorutypeuunexpected-char-in-doctypeudataucorrectueof-in-doctype(RR%RRRRRR R&R RRR RR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyR/s4              cC`s?|jj}|dkr*|j|_n|dkrn|jjitdd6dd6|jdcd7uunexpected-end-of-doctypeucorrectueof-in-doctype( RR%t!afterDoctypeSystemIdentifierStateRR R&R RRRR R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRLs*         cC`s?|jj}|dkr*|j|_n|dkrn|jjitdd6dd6|jdcd7uunexpected-end-of-doctypeucorrectueof-in-doctype( RR%RRR R&R RRRR R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRds*         cC`s|jj}|tkrn|dkrL|jj|j|j|_n|tkr|jjit dd6dd6t |jd<|jj|j|j|_n.|jjit dd6dd6|j |_t S(Nu>u ParseErrorutypeueof-in-doctypeudataucorrectuunexpected-char-in-doctype( RR%RR R&RRRR R RRR5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyR|s        cC`s|jj}|dkr=|jj|j|j|_n>|tkr{|jj||jj|j|j|_nt S(Nu>( RR%R R&RRRR R,R5(RRJ((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs  cC`sNg}xtr|j|jjd|j|jjd|jj}|tkr`Pq |dddkr|dd |d|j jit dd 6|d 6n|j |_ tS(Nu]u>iiu]]uuiu ParseErrorutypeuinvalid-codepointudatau�u Characters(R5R&RRIR%R R(tcounttrangeR R R|RR(RRJR%t nullCountRw((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs.    N(Nt__name__t __module__t__doc__RRR$R4RRBRCRFRRGRNRLRPRRRSRHRURVRMR[R\ROR_R`RQRaRcRbRdRhRfReRgRiRkRjRlRmRoRnRpRXRqRsRrRxRzRyR{RYRWRTR}RRRRRR~RRRRRRRRRRRRRRRR(((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyRs    HP          #                  6 "       -          3            N(t __future__RRRtpip._vendor.sixRR*t collectionsRt constantsRRRRR R R R R Rt _inputstreamRt_trieRR6tobjectR(((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.pyts site-packages/pip/_vendor/html5lib/_utils.py000064400000010000147204247350015100 0ustar00from __future__ import absolute_import, division, unicode_literals import sys from types import ModuleType from pip._vendor.six import text_type try: import xml.etree.cElementTree as default_etree except ImportError: import xml.etree.ElementTree as default_etree __all__ = ["default_etree", "MethodDispatcher", "isSurrogatePair", "surrogatePairToCodepoint", "moduleFactoryFactory", "supports_lone_surrogates", "PY27"] PY27 = sys.version_info[0] == 2 and sys.version_info[1] >= 7 # Platforms not supporting lone surrogates (\uD800-\uDFFF) should be # caught by the below test. In general this would be any platform # using UTF-16 as its encoding of unicode strings, such as # Jython. This is because UTF-16 itself is based on the use of such # surrogates, and there is no mechanism to further escape such # escapes. try: _x = eval('"\\uD800"') # pylint:disable=eval-used if not isinstance(_x, text_type): # We need this with u"" because of http://bugs.jython.org/issue2039 _x = eval('u"\\uD800"') # pylint:disable=eval-used assert isinstance(_x, text_type) except: # pylint:disable=bare-except supports_lone_surrogates = False else: supports_lone_surrogates = True class MethodDispatcher(dict): """Dict with 2 special properties: On initiation, keys that are lists, sets or tuples are converted to multiple keys so accessing any one of the items in the original list-like object returns the matching value md = MethodDispatcher({("foo", "bar"):"baz"}) md["foo"] == "baz" A default value which can be set through the default attribute. """ def __init__(self, items=()): # Using _dictEntries instead of directly assigning to self is about # twice as fast. Please do careful performance testing before changing # anything here. _dictEntries = [] for name, value in items: if isinstance(name, (list, tuple, frozenset, set)): for item in name: _dictEntries.append((item, value)) else: _dictEntries.append((name, value)) dict.__init__(self, _dictEntries) assert len(self) == len(_dictEntries) self.default = None def __getitem__(self, key): return dict.get(self, key, self.default) # Some utility functions to deal with weirdness around UCS2 vs UCS4 # python builds def isSurrogatePair(data): return (len(data) == 2 and ord(data[0]) >= 0xD800 and ord(data[0]) <= 0xDBFF and ord(data[1]) >= 0xDC00 and ord(data[1]) <= 0xDFFF) def surrogatePairToCodepoint(data): char_val = (0x10000 + (ord(data[0]) - 0xD800) * 0x400 + (ord(data[1]) - 0xDC00)) return char_val # Module Factory Factory (no, this isn't Java, I know) # Here to stop this being duplicated all over the place. def moduleFactoryFactory(factory): moduleCache = {} def moduleFactory(baseModule, *args, **kwargs): if isinstance(ModuleType.__name__, type("")): name = "_%s_factory" % baseModule.__name__ else: name = b"_%s_factory" % baseModule.__name__ kwargs_tuple = tuple(kwargs.items()) try: return moduleCache[name][args][kwargs_tuple] except KeyError: mod = ModuleType(name) objs = factory(baseModule, *args, **kwargs) mod.__dict__.update(objs) if "name" not in moduleCache: moduleCache[name] = {} if "args" not in moduleCache[name]: moduleCache[name][args] = {} if "kwargs" not in moduleCache[name][args]: moduleCache[name][args][kwargs_tuple] = {} moduleCache[name][args][kwargs_tuple] = mod return mod return moduleFactory def memoize(func): cache = {} def wrapped(*args, **kwargs): key = (tuple(args), tuple(kwargs.items())) if key not in cache: cache[key] = func(*args, **kwargs) return cache[key] return wrapped site-packages/pip/_vendor/html5lib/_utils.pyc000064400000010545147204247350015261 0ustar00 abc@`s\ddlmZmZmZddlZddlmZddlmZyddl j j Z Wn#e k rddlj jZ nXddddd d d gZejdd koejd dkZyCedZeeesedZeeestnWn eZnXeZdefdYZdZdZdZdZdS(i(tabsolute_importtdivisiontunicode_literalsN(t ModuleType(t text_typeu default_etreeuMethodDispatcheruisSurrogatePairusurrogatePairToCodepointumoduleFactoryFactoryusupports_lone_surrogatesuPY27iiiu"\uD800"u u"\uD800"tMethodDispatchercB`s#eZdZddZdZRS(upDict with 2 special properties: On initiation, keys that are lists, sets or tuples are converted to multiple keys so accessing any one of the items in the original list-like object returns the matching value md = MethodDispatcher({("foo", "bar"):"baz"}) md["foo"] == "baz" A default value which can be set through the default attribute. cC`sg}xi|D]a\}}t|ttttfr[x7|D]}|j||fq;Wq |j||fq Wtj||t|t|kst d|_ dS(N( t isinstancetlistttuplet frozensettsettappendtdictt__init__tlentAssertionErrortNonetdefault(tselftitemst _dictEntriestnametvaluetitem((s?/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_utils.pyR 4s cC`stj|||jS(N(R tgetR(Rtkey((s?/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_utils.pyt __getitem__Cs((t__name__t __module__t__doc__R R(((s?/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_utils.pyR's  cC`sht|dkogt|ddkogt|ddkogt|ddkogt|ddkS(Niiiiiii(Rtord(tdata((s?/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_utils.pytisSurrogatePairJs,cC`s2dt|dddt|dd}|S(Niiiiii(R(Rtchar_val((s?/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_utils.pytsurrogatePairToCodepointPsc`sifd}|S(Nc`sttjtdr(d|j}n d|j}t|j}y|||SWntk rt|}|||}|jj|dkri|s0    &   #  site-packages/pip/_vendor/html5lib/_utils.pyo000064400000010423147204247350015270 0ustar00 abc@`sGddlmZmZmZddlZddlmZddlmZyddl j j Z Wn#e k rddlj jZ nXddddd d d gZejdd koejd dkZy.edZeeesedZnWn eZnXeZdefdYZdZdZdZdZdS(i(tabsolute_importtdivisiontunicode_literalsN(t ModuleType(t text_typeu default_etreeuMethodDispatcheruisSurrogatePairusurrogatePairToCodepointumoduleFactoryFactoryusupports_lone_surrogatesuPY27iiiu"\uD800"u u"\uD800"tMethodDispatchercB`s#eZdZddZdZRS(upDict with 2 special properties: On initiation, keys that are lists, sets or tuples are converted to multiple keys so accessing any one of the items in the original list-like object returns the matching value md = MethodDispatcher({("foo", "bar"):"baz"}) md["foo"] == "baz" A default value which can be set through the default attribute. cC`sg}xi|D]a\}}t|ttttfr[x7|D]}|j||fq;Wq |j||fq Wtj||d|_ dS(N( t isinstancetlistttuplet frozensettsettappendtdictt__init__tNonetdefault(tselftitemst _dictEntriestnametvaluetitem((s?/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_utils.pyR 4s cC`stj|||jS(N(R tgetR(Rtkey((s?/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_utils.pyt __getitem__Cs((t__name__t __module__t__doc__R R(((s?/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_utils.pyR's  cC`sht|dkogt|ddkogt|ddkogt|ddkogt|ddkS(Niiiiiii(tlentord(tdata((s?/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_utils.pytisSurrogatePairJs,cC`s2dt|dddt|dd}|S(Niiiiii(R(Rtchar_val((s?/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_utils.pytsurrogatePairToCodepointPsc`sifd}|S(Nc`sttjtdr(d|j}n d|j}t|j}y|||SWntk rt|}|||}|jj|dkri|s0    &   #  site-packages/pip/_vendor/html5lib/constants.py000064400000242673147204247350015644 0ustar00from __future__ import absolute_import, division, unicode_literals import string EOF = None E = { "null-character": "Null character in input stream, replaced with U+FFFD.", "invalid-codepoint": "Invalid codepoint in stream.", "incorrectly-placed-solidus": "Solidus (/) incorrectly placed in tag.", "incorrect-cr-newline-entity": "Incorrect CR newline entity, replaced with LF.", "illegal-windows-1252-entity": "Entity used with illegal number (windows-1252 reference).", "cant-convert-numeric-entity": "Numeric entity couldn't be converted to character " "(codepoint U+%(charAsInt)08x).", "illegal-codepoint-for-numeric-entity": "Numeric entity represents an illegal codepoint: " "U+%(charAsInt)08x.", "numeric-entity-without-semicolon": "Numeric entity didn't end with ';'.", "expected-numeric-entity-but-got-eof": "Numeric entity expected. Got end of file instead.", "expected-numeric-entity": "Numeric entity expected but none found.", "named-entity-without-semicolon": "Named entity didn't end with ';'.", "expected-named-entity": "Named entity expected. Got none.", "attributes-in-end-tag": "End tag contains unexpected attributes.", 'self-closing-flag-on-end-tag': "End tag contains unexpected self-closing flag.", "expected-tag-name-but-got-right-bracket": "Expected tag name. Got '>' instead.", "expected-tag-name-but-got-question-mark": "Expected tag name. Got '?' instead. (HTML doesn't " "support processing instructions.)", "expected-tag-name": "Expected tag name. Got something else instead", "expected-closing-tag-but-got-right-bracket": "Expected closing tag. Got '>' instead. Ignoring ''.", "expected-closing-tag-but-got-eof": "Expected closing tag. Unexpected end of file.", "expected-closing-tag-but-got-char": "Expected closing tag. Unexpected character '%(data)s' found.", "eof-in-tag-name": "Unexpected end of file in the tag name.", "expected-attribute-name-but-got-eof": "Unexpected end of file. Expected attribute name instead.", "eof-in-attribute-name": "Unexpected end of file in attribute name.", "invalid-character-in-attribute-name": "Invalid character in attribute name", "duplicate-attribute": "Dropped duplicate attribute on tag.", "expected-end-of-tag-name-but-got-eof": "Unexpected end of file. Expected = or end of tag.", "expected-attribute-value-but-got-eof": "Unexpected end of file. Expected attribute value.", "expected-attribute-value-but-got-right-bracket": "Expected attribute value. Got '>' instead.", 'equals-in-unquoted-attribute-value': "Unexpected = in unquoted attribute", 'unexpected-character-in-unquoted-attribute-value': "Unexpected character in unquoted attribute", "invalid-character-after-attribute-name": "Unexpected character after attribute name.", "unexpected-character-after-attribute-value": "Unexpected character after attribute value.", "eof-in-attribute-value-double-quote": "Unexpected end of file in attribute value (\").", "eof-in-attribute-value-single-quote": "Unexpected end of file in attribute value (').", "eof-in-attribute-value-no-quotes": "Unexpected end of file in attribute value.", "unexpected-EOF-after-solidus-in-tag": "Unexpected end of file in tag. Expected >", "unexpected-character-after-solidus-in-tag": "Unexpected character after / in tag. Expected >", "expected-dashes-or-doctype": "Expected '--' or 'DOCTYPE'. Not found.", "unexpected-bang-after-double-dash-in-comment": "Unexpected ! after -- in comment", "unexpected-space-after-double-dash-in-comment": "Unexpected space after -- in comment", "incorrect-comment": "Incorrect comment.", "eof-in-comment": "Unexpected end of file in comment.", "eof-in-comment-end-dash": "Unexpected end of file in comment (-)", "unexpected-dash-after-double-dash-in-comment": "Unexpected '-' after '--' found in comment.", "eof-in-comment-double-dash": "Unexpected end of file in comment (--).", "eof-in-comment-end-space-state": "Unexpected end of file in comment.", "eof-in-comment-end-bang-state": "Unexpected end of file in comment.", "unexpected-char-in-comment": "Unexpected character in comment found.", "need-space-after-doctype": "No space after literal string 'DOCTYPE'.", "expected-doctype-name-but-got-right-bracket": "Unexpected > character. Expected DOCTYPE name.", "expected-doctype-name-but-got-eof": "Unexpected end of file. Expected DOCTYPE name.", "eof-in-doctype-name": "Unexpected end of file in DOCTYPE name.", "eof-in-doctype": "Unexpected end of file in DOCTYPE.", "expected-space-or-right-bracket-in-doctype": "Expected space or '>'. Got '%(data)s'", "unexpected-end-of-doctype": "Unexpected end of DOCTYPE.", "unexpected-char-in-doctype": "Unexpected character in DOCTYPE.", "eof-in-innerhtml": "XXX innerHTML EOF", "unexpected-doctype": "Unexpected DOCTYPE. Ignored.", "non-html-root": "html needs to be the first start tag.", "expected-doctype-but-got-eof": "Unexpected End of file. Expected DOCTYPE.", "unknown-doctype": "Erroneous DOCTYPE.", "expected-doctype-but-got-chars": "Unexpected non-space characters. Expected DOCTYPE.", "expected-doctype-but-got-start-tag": "Unexpected start tag (%(name)s). Expected DOCTYPE.", "expected-doctype-but-got-end-tag": "Unexpected end tag (%(name)s). Expected DOCTYPE.", "end-tag-after-implied-root": "Unexpected end tag (%(name)s) after the (implied) root element.", "expected-named-closing-tag-but-got-eof": "Unexpected end of file. Expected end tag (%(name)s).", "two-heads-are-not-better-than-one": "Unexpected start tag head in existing head. Ignored.", "unexpected-end-tag": "Unexpected end tag (%(name)s). Ignored.", "unexpected-start-tag-out-of-my-head": "Unexpected start tag (%(name)s) that can be in head. Moved.", "unexpected-start-tag": "Unexpected start tag (%(name)s).", "missing-end-tag": "Missing end tag (%(name)s).", "missing-end-tags": "Missing end tags (%(name)s).", "unexpected-start-tag-implies-end-tag": "Unexpected start tag (%(startName)s) " "implies end tag (%(endName)s).", "unexpected-start-tag-treated-as": "Unexpected start tag (%(originalName)s). Treated as %(newName)s.", "deprecated-tag": "Unexpected start tag %(name)s. Don't use it!", "unexpected-start-tag-ignored": "Unexpected start tag %(name)s. Ignored.", "expected-one-end-tag-but-got-another": "Unexpected end tag (%(gotName)s). " "Missing end tag (%(expectedName)s).", "end-tag-too-early": "End tag (%(name)s) seen too early. Expected other end tag.", "end-tag-too-early-named": "Unexpected end tag (%(gotName)s). Expected end tag (%(expectedName)s).", "end-tag-too-early-ignored": "End tag (%(name)s) seen too early. Ignored.", "adoption-agency-1.1": "End tag (%(name)s) violates step 1, " "paragraph 1 of the adoption agency algorithm.", "adoption-agency-1.2": "End tag (%(name)s) violates step 1, " "paragraph 2 of the adoption agency algorithm.", "adoption-agency-1.3": "End tag (%(name)s) violates step 1, " "paragraph 3 of the adoption agency algorithm.", "adoption-agency-4.4": "End tag (%(name)s) violates step 4, " "paragraph 4 of the adoption agency algorithm.", "unexpected-end-tag-treated-as": "Unexpected end tag (%(originalName)s). Treated as %(newName)s.", "no-end-tag": "This element (%(name)s) has no end tag.", "unexpected-implied-end-tag-in-table": "Unexpected implied end tag (%(name)s) in the table phase.", "unexpected-implied-end-tag-in-table-body": "Unexpected implied end tag (%(name)s) in the table body phase.", "unexpected-char-implies-table-voodoo": "Unexpected non-space characters in " "table context caused voodoo mode.", "unexpected-hidden-input-in-table": "Unexpected input with type hidden in table context.", "unexpected-form-in-table": "Unexpected form in table context.", "unexpected-start-tag-implies-table-voodoo": "Unexpected start tag (%(name)s) in " "table context caused voodoo mode.", "unexpected-end-tag-implies-table-voodoo": "Unexpected end tag (%(name)s) in " "table context caused voodoo mode.", "unexpected-cell-in-table-body": "Unexpected table cell start tag (%(name)s) " "in the table body phase.", "unexpected-cell-end-tag": "Got table cell end tag (%(name)s) " "while required end tags are missing.", "unexpected-end-tag-in-table-body": "Unexpected end tag (%(name)s) in the table body phase. Ignored.", "unexpected-implied-end-tag-in-table-row": "Unexpected implied end tag (%(name)s) in the table row phase.", "unexpected-end-tag-in-table-row": "Unexpected end tag (%(name)s) in the table row phase. Ignored.", "unexpected-select-in-select": "Unexpected select start tag in the select phase " "treated as select end tag.", "unexpected-input-in-select": "Unexpected input start tag in the select phase.", "unexpected-start-tag-in-select": "Unexpected start tag token (%(name)s in the select phase. " "Ignored.", "unexpected-end-tag-in-select": "Unexpected end tag (%(name)s) in the select phase. Ignored.", "unexpected-table-element-start-tag-in-select-in-table": "Unexpected table element start tag (%(name)s) in the select in table phase.", "unexpected-table-element-end-tag-in-select-in-table": "Unexpected table element end tag (%(name)s) in the select in table phase.", "unexpected-char-after-body": "Unexpected non-space characters in the after body phase.", "unexpected-start-tag-after-body": "Unexpected start tag token (%(name)s)" " in the after body phase.", "unexpected-end-tag-after-body": "Unexpected end tag token (%(name)s)" " in the after body phase.", "unexpected-char-in-frameset": "Unexpected characters in the frameset phase. Characters ignored.", "unexpected-start-tag-in-frameset": "Unexpected start tag token (%(name)s)" " in the frameset phase. Ignored.", "unexpected-frameset-in-frameset-innerhtml": "Unexpected end tag token (frameset) " "in the frameset phase (innerHTML).", "unexpected-end-tag-in-frameset": "Unexpected end tag token (%(name)s)" " in the frameset phase. Ignored.", "unexpected-char-after-frameset": "Unexpected non-space characters in the " "after frameset phase. Ignored.", "unexpected-start-tag-after-frameset": "Unexpected start tag (%(name)s)" " in the after frameset phase. Ignored.", "unexpected-end-tag-after-frameset": "Unexpected end tag (%(name)s)" " in the after frameset phase. Ignored.", "unexpected-end-tag-after-body-innerhtml": "Unexpected end tag after body(innerHtml)", "expected-eof-but-got-char": "Unexpected non-space characters. Expected end of file.", "expected-eof-but-got-start-tag": "Unexpected start tag (%(name)s)" ". Expected end of file.", "expected-eof-but-got-end-tag": "Unexpected end tag (%(name)s)" ". Expected end of file.", "eof-in-table": "Unexpected end of file. Expected table content.", "eof-in-select": "Unexpected end of file. Expected select content.", "eof-in-frameset": "Unexpected end of file. Expected frameset content.", "eof-in-script-in-script": "Unexpected end of file. Expected script content.", "eof-in-foreign-lands": "Unexpected end of file. Expected foreign content", "non-void-element-with-trailing-solidus": "Trailing solidus not allowed on element %(name)s", "unexpected-html-element-in-foreign-content": "Element %(name)s not allowed in a non-html context", "unexpected-end-tag-before-html": "Unexpected end tag (%(name)s) before html.", "unexpected-inhead-noscript-tag": "Element %(name)s not allowed in a inhead-noscript context", "eof-in-head-noscript": "Unexpected end of file. Expected inhead-noscript content", "char-in-head-noscript": "Unexpected non-space character. Expected inhead-noscript content", "XXX-undefined-error": "Undefined error (this sucks and should be fixed)", } namespaces = { "html": "http://www.w3.org/1999/xhtml", "mathml": "http://www.w3.org/1998/Math/MathML", "svg": "http://www.w3.org/2000/svg", "xlink": "http://www.w3.org/1999/xlink", "xml": "http://www.w3.org/XML/1998/namespace", "xmlns": "http://www.w3.org/2000/xmlns/" } scopingElements = frozenset([ (namespaces["html"], "applet"), (namespaces["html"], "caption"), (namespaces["html"], "html"), (namespaces["html"], "marquee"), (namespaces["html"], "object"), (namespaces["html"], "table"), (namespaces["html"], "td"), (namespaces["html"], "th"), (namespaces["mathml"], "mi"), (namespaces["mathml"], "mo"), (namespaces["mathml"], "mn"), (namespaces["mathml"], "ms"), (namespaces["mathml"], "mtext"), (namespaces["mathml"], "annotation-xml"), (namespaces["svg"], "foreignObject"), (namespaces["svg"], "desc"), (namespaces["svg"], "title"), ]) formattingElements = frozenset([ (namespaces["html"], "a"), (namespaces["html"], "b"), (namespaces["html"], "big"), (namespaces["html"], "code"), (namespaces["html"], "em"), (namespaces["html"], "font"), (namespaces["html"], "i"), (namespaces["html"], "nobr"), (namespaces["html"], "s"), (namespaces["html"], "small"), (namespaces["html"], "strike"), (namespaces["html"], "strong"), (namespaces["html"], "tt"), (namespaces["html"], "u") ]) specialElements = frozenset([ (namespaces["html"], "address"), (namespaces["html"], "applet"), (namespaces["html"], "area"), (namespaces["html"], "article"), (namespaces["html"], "aside"), (namespaces["html"], "base"), (namespaces["html"], "basefont"), (namespaces["html"], "bgsound"), (namespaces["html"], "blockquote"), (namespaces["html"], "body"), (namespaces["html"], "br"), (namespaces["html"], "button"), (namespaces["html"], "caption"), (namespaces["html"], "center"), (namespaces["html"], "col"), (namespaces["html"], "colgroup"), (namespaces["html"], "command"), (namespaces["html"], "dd"), (namespaces["html"], "details"), (namespaces["html"], "dir"), (namespaces["html"], "div"), (namespaces["html"], "dl"), (namespaces["html"], "dt"), (namespaces["html"], "embed"), (namespaces["html"], "fieldset"), (namespaces["html"], "figure"), (namespaces["html"], "footer"), (namespaces["html"], "form"), (namespaces["html"], "frame"), (namespaces["html"], "frameset"), (namespaces["html"], "h1"), (namespaces["html"], "h2"), (namespaces["html"], "h3"), (namespaces["html"], "h4"), (namespaces["html"], "h5"), (namespaces["html"], "h6"), (namespaces["html"], "head"), (namespaces["html"], "header"), (namespaces["html"], "hr"), (namespaces["html"], "html"), (namespaces["html"], "iframe"), # Note that image is commented out in the spec as "this isn't an # element that can end up on the stack, so it doesn't matter," (namespaces["html"], "image"), (namespaces["html"], "img"), (namespaces["html"], "input"), (namespaces["html"], "isindex"), (namespaces["html"], "li"), (namespaces["html"], "link"), (namespaces["html"], "listing"), (namespaces["html"], "marquee"), (namespaces["html"], "menu"), (namespaces["html"], "meta"), (namespaces["html"], "nav"), (namespaces["html"], "noembed"), (namespaces["html"], "noframes"), (namespaces["html"], "noscript"), (namespaces["html"], "object"), (namespaces["html"], "ol"), (namespaces["html"], "p"), (namespaces["html"], "param"), (namespaces["html"], "plaintext"), (namespaces["html"], "pre"), (namespaces["html"], "script"), (namespaces["html"], "section"), (namespaces["html"], "select"), (namespaces["html"], "style"), (namespaces["html"], "table"), (namespaces["html"], "tbody"), (namespaces["html"], "td"), (namespaces["html"], "textarea"), (namespaces["html"], "tfoot"), (namespaces["html"], "th"), (namespaces["html"], "thead"), (namespaces["html"], "title"), (namespaces["html"], "tr"), (namespaces["html"], "ul"), (namespaces["html"], "wbr"), (namespaces["html"], "xmp"), (namespaces["svg"], "foreignObject") ]) htmlIntegrationPointElements = frozenset([ (namespaces["mathml"], "annotaion-xml"), (namespaces["svg"], "foreignObject"), (namespaces["svg"], "desc"), (namespaces["svg"], "title") ]) mathmlTextIntegrationPointElements = frozenset([ (namespaces["mathml"], "mi"), (namespaces["mathml"], "mo"), (namespaces["mathml"], "mn"), (namespaces["mathml"], "ms"), (namespaces["mathml"], "mtext") ]) adjustSVGAttributes = { "attributename": "attributeName", "attributetype": "attributeType", "basefrequency": "baseFrequency", "baseprofile": "baseProfile", "calcmode": "calcMode", "clippathunits": "clipPathUnits", "contentscripttype": "contentScriptType", "contentstyletype": "contentStyleType", "diffuseconstant": "diffuseConstant", "edgemode": "edgeMode", "externalresourcesrequired": "externalResourcesRequired", "filterres": "filterRes", "filterunits": "filterUnits", "glyphref": "glyphRef", "gradienttransform": "gradientTransform", "gradientunits": "gradientUnits", "kernelmatrix": "kernelMatrix", "kernelunitlength": "kernelUnitLength", "keypoints": "keyPoints", "keysplines": "keySplines", "keytimes": "keyTimes", "lengthadjust": "lengthAdjust", "limitingconeangle": "limitingConeAngle", "markerheight": "markerHeight", "markerunits": "markerUnits", "markerwidth": "markerWidth", "maskcontentunits": "maskContentUnits", "maskunits": "maskUnits", "numoctaves": "numOctaves", "pathlength": "pathLength", "patterncontentunits": "patternContentUnits", "patterntransform": "patternTransform", "patternunits": "patternUnits", "pointsatx": "pointsAtX", "pointsaty": "pointsAtY", "pointsatz": "pointsAtZ", "preservealpha": "preserveAlpha", "preserveaspectratio": "preserveAspectRatio", "primitiveunits": "primitiveUnits", "refx": "refX", "refy": "refY", "repeatcount": "repeatCount", "repeatdur": "repeatDur", "requiredextensions": "requiredExtensions", "requiredfeatures": "requiredFeatures", "specularconstant": "specularConstant", "specularexponent": "specularExponent", "spreadmethod": "spreadMethod", "startoffset": "startOffset", "stddeviation": "stdDeviation", "stitchtiles": "stitchTiles", "surfacescale": "surfaceScale", "systemlanguage": "systemLanguage", "tablevalues": "tableValues", "targetx": "targetX", "targety": "targetY", "textlength": "textLength", "viewbox": "viewBox", "viewtarget": "viewTarget", "xchannelselector": "xChannelSelector", "ychannelselector": "yChannelSelector", "zoomandpan": "zoomAndPan" } adjustMathMLAttributes = {"definitionurl": "definitionURL"} adjustForeignAttributes = { "xlink:actuate": ("xlink", "actuate", namespaces["xlink"]), "xlink:arcrole": ("xlink", "arcrole", namespaces["xlink"]), "xlink:href": ("xlink", "href", namespaces["xlink"]), "xlink:role": ("xlink", "role", namespaces["xlink"]), "xlink:show": ("xlink", "show", namespaces["xlink"]), "xlink:title": ("xlink", "title", namespaces["xlink"]), "xlink:type": ("xlink", "type", namespaces["xlink"]), "xml:base": ("xml", "base", namespaces["xml"]), "xml:lang": ("xml", "lang", namespaces["xml"]), "xml:space": ("xml", "space", namespaces["xml"]), "xmlns": (None, "xmlns", namespaces["xmlns"]), "xmlns:xlink": ("xmlns", "xlink", namespaces["xmlns"]) } unadjustForeignAttributes = dict([((ns, local), qname) for qname, (prefix, local, ns) in adjustForeignAttributes.items()]) spaceCharacters = frozenset([ "\t", "\n", "\u000C", " ", "\r" ]) tableInsertModeElements = frozenset([ "table", "tbody", "tfoot", "thead", "tr" ]) asciiLowercase = frozenset(string.ascii_lowercase) asciiUppercase = frozenset(string.ascii_uppercase) asciiLetters = frozenset(string.ascii_letters) digits = frozenset(string.digits) hexDigits = frozenset(string.hexdigits) asciiUpper2Lower = dict([(ord(c), ord(c.lower())) for c in string.ascii_uppercase]) # Heading elements need to be ordered headingElements = ( "h1", "h2", "h3", "h4", "h5", "h6" ) voidElements = frozenset([ "base", "command", "event-source", "link", "meta", "hr", "br", "img", "embed", "param", "area", "col", "input", "source", "track" ]) cdataElements = frozenset(['title', 'textarea']) rcdataElements = frozenset([ 'style', 'script', 'xmp', 'iframe', 'noembed', 'noframes', 'noscript' ]) booleanAttributes = { "": frozenset(["irrelevant"]), "style": frozenset(["scoped"]), "img": frozenset(["ismap"]), "audio": frozenset(["autoplay", "controls"]), "video": frozenset(["autoplay", "controls"]), "script": frozenset(["defer", "async"]), "details": frozenset(["open"]), "datagrid": frozenset(["multiple", "disabled"]), "command": frozenset(["hidden", "disabled", "checked", "default"]), "hr": frozenset(["noshade"]), "menu": frozenset(["autosubmit"]), "fieldset": frozenset(["disabled", "readonly"]), "option": frozenset(["disabled", "readonly", "selected"]), "optgroup": frozenset(["disabled", "readonly"]), "button": frozenset(["disabled", "autofocus"]), "input": frozenset(["disabled", "readonly", "required", "autofocus", "checked", "ismap"]), "select": frozenset(["disabled", "readonly", "autofocus", "multiple"]), "output": frozenset(["disabled", "readonly"]), } # entitiesWindows1252 has to be _ordered_ and needs to have an index. It # therefore can't be a frozenset. entitiesWindows1252 = ( 8364, # 0x80 0x20AC EURO SIGN 65533, # 0x81 UNDEFINED 8218, # 0x82 0x201A SINGLE LOW-9 QUOTATION MARK 402, # 0x83 0x0192 LATIN SMALL LETTER F WITH HOOK 8222, # 0x84 0x201E DOUBLE LOW-9 QUOTATION MARK 8230, # 0x85 0x2026 HORIZONTAL ELLIPSIS 8224, # 0x86 0x2020 DAGGER 8225, # 0x87 0x2021 DOUBLE DAGGER 710, # 0x88 0x02C6 MODIFIER LETTER CIRCUMFLEX ACCENT 8240, # 0x89 0x2030 PER MILLE SIGN 352, # 0x8A 0x0160 LATIN CAPITAL LETTER S WITH CARON 8249, # 0x8B 0x2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK 338, # 0x8C 0x0152 LATIN CAPITAL LIGATURE OE 65533, # 0x8D UNDEFINED 381, # 0x8E 0x017D LATIN CAPITAL LETTER Z WITH CARON 65533, # 0x8F UNDEFINED 65533, # 0x90 UNDEFINED 8216, # 0x91 0x2018 LEFT SINGLE QUOTATION MARK 8217, # 0x92 0x2019 RIGHT SINGLE QUOTATION MARK 8220, # 0x93 0x201C LEFT DOUBLE QUOTATION MARK 8221, # 0x94 0x201D RIGHT DOUBLE QUOTATION MARK 8226, # 0x95 0x2022 BULLET 8211, # 0x96 0x2013 EN DASH 8212, # 0x97 0x2014 EM DASH 732, # 0x98 0x02DC SMALL TILDE 8482, # 0x99 0x2122 TRADE MARK SIGN 353, # 0x9A 0x0161 LATIN SMALL LETTER S WITH CARON 8250, # 0x9B 0x203A SINGLE RIGHT-POINTING ANGLE QUOTATION MARK 339, # 0x9C 0x0153 LATIN SMALL LIGATURE OE 65533, # 0x9D UNDEFINED 382, # 0x9E 0x017E LATIN SMALL LETTER Z WITH CARON 376 # 0x9F 0x0178 LATIN CAPITAL LETTER Y WITH DIAERESIS ) xmlEntities = frozenset(['lt;', 'gt;', 'amp;', 'apos;', 'quot;']) entities = { "AElig": "\xc6", "AElig;": "\xc6", "AMP": "&", "AMP;": "&", "Aacute": "\xc1", "Aacute;": "\xc1", "Abreve;": "\u0102", "Acirc": "\xc2", "Acirc;": "\xc2", "Acy;": "\u0410", "Afr;": "\U0001d504", "Agrave": "\xc0", "Agrave;": "\xc0", "Alpha;": "\u0391", "Amacr;": "\u0100", "And;": "\u2a53", "Aogon;": "\u0104", "Aopf;": "\U0001d538", "ApplyFunction;": "\u2061", "Aring": "\xc5", "Aring;": "\xc5", "Ascr;": "\U0001d49c", "Assign;": "\u2254", "Atilde": "\xc3", "Atilde;": "\xc3", "Auml": "\xc4", "Auml;": "\xc4", "Backslash;": "\u2216", "Barv;": "\u2ae7", "Barwed;": "\u2306", "Bcy;": "\u0411", "Because;": "\u2235", "Bernoullis;": "\u212c", "Beta;": "\u0392", "Bfr;": "\U0001d505", "Bopf;": "\U0001d539", "Breve;": "\u02d8", "Bscr;": "\u212c", "Bumpeq;": "\u224e", "CHcy;": "\u0427", "COPY": "\xa9", "COPY;": "\xa9", "Cacute;": "\u0106", "Cap;": "\u22d2", "CapitalDifferentialD;": "\u2145", "Cayleys;": "\u212d", "Ccaron;": "\u010c", "Ccedil": "\xc7", "Ccedil;": "\xc7", "Ccirc;": "\u0108", "Cconint;": "\u2230", "Cdot;": "\u010a", "Cedilla;": "\xb8", "CenterDot;": "\xb7", "Cfr;": "\u212d", "Chi;": "\u03a7", "CircleDot;": "\u2299", "CircleMinus;": "\u2296", "CirclePlus;": "\u2295", "CircleTimes;": "\u2297", "ClockwiseContourIntegral;": "\u2232", "CloseCurlyDoubleQuote;": "\u201d", "CloseCurlyQuote;": "\u2019", "Colon;": "\u2237", "Colone;": "\u2a74", "Congruent;": "\u2261", "Conint;": "\u222f", "ContourIntegral;": "\u222e", "Copf;": "\u2102", "Coproduct;": "\u2210", "CounterClockwiseContourIntegral;": "\u2233", "Cross;": "\u2a2f", "Cscr;": "\U0001d49e", "Cup;": "\u22d3", "CupCap;": "\u224d", "DD;": "\u2145", "DDotrahd;": "\u2911", "DJcy;": "\u0402", "DScy;": "\u0405", "DZcy;": "\u040f", "Dagger;": "\u2021", "Darr;": "\u21a1", "Dashv;": "\u2ae4", "Dcaron;": "\u010e", "Dcy;": "\u0414", "Del;": "\u2207", "Delta;": "\u0394", "Dfr;": "\U0001d507", "DiacriticalAcute;": "\xb4", "DiacriticalDot;": "\u02d9", "DiacriticalDoubleAcute;": "\u02dd", "DiacriticalGrave;": "`", "DiacriticalTilde;": "\u02dc", "Diamond;": "\u22c4", "DifferentialD;": "\u2146", "Dopf;": "\U0001d53b", "Dot;": "\xa8", "DotDot;": "\u20dc", "DotEqual;": "\u2250", "DoubleContourIntegral;": "\u222f", "DoubleDot;": "\xa8", "DoubleDownArrow;": "\u21d3", "DoubleLeftArrow;": "\u21d0", "DoubleLeftRightArrow;": "\u21d4", "DoubleLeftTee;": "\u2ae4", "DoubleLongLeftArrow;": "\u27f8", "DoubleLongLeftRightArrow;": "\u27fa", "DoubleLongRightArrow;": "\u27f9", "DoubleRightArrow;": "\u21d2", "DoubleRightTee;": "\u22a8", "DoubleUpArrow;": "\u21d1", "DoubleUpDownArrow;": "\u21d5", "DoubleVerticalBar;": "\u2225", "DownArrow;": "\u2193", "DownArrowBar;": "\u2913", "DownArrowUpArrow;": "\u21f5", "DownBreve;": "\u0311", "DownLeftRightVector;": "\u2950", "DownLeftTeeVector;": "\u295e", "DownLeftVector;": "\u21bd", "DownLeftVectorBar;": "\u2956", "DownRightTeeVector;": "\u295f", "DownRightVector;": "\u21c1", "DownRightVectorBar;": "\u2957", "DownTee;": "\u22a4", "DownTeeArrow;": "\u21a7", "Downarrow;": "\u21d3", "Dscr;": "\U0001d49f", "Dstrok;": "\u0110", "ENG;": "\u014a", "ETH": "\xd0", "ETH;": "\xd0", "Eacute": "\xc9", "Eacute;": "\xc9", "Ecaron;": "\u011a", "Ecirc": "\xca", "Ecirc;": "\xca", "Ecy;": "\u042d", "Edot;": "\u0116", "Efr;": "\U0001d508", "Egrave": "\xc8", "Egrave;": "\xc8", "Element;": "\u2208", "Emacr;": "\u0112", "EmptySmallSquare;": "\u25fb", "EmptyVerySmallSquare;": "\u25ab", "Eogon;": "\u0118", "Eopf;": "\U0001d53c", "Epsilon;": "\u0395", "Equal;": "\u2a75", "EqualTilde;": "\u2242", "Equilibrium;": "\u21cc", "Escr;": "\u2130", "Esim;": "\u2a73", "Eta;": "\u0397", "Euml": "\xcb", "Euml;": "\xcb", "Exists;": "\u2203", "ExponentialE;": "\u2147", "Fcy;": "\u0424", "Ffr;": "\U0001d509", "FilledSmallSquare;": "\u25fc", "FilledVerySmallSquare;": "\u25aa", "Fopf;": "\U0001d53d", "ForAll;": "\u2200", "Fouriertrf;": "\u2131", "Fscr;": "\u2131", "GJcy;": "\u0403", "GT": ">", "GT;": ">", "Gamma;": "\u0393", "Gammad;": "\u03dc", "Gbreve;": "\u011e", "Gcedil;": "\u0122", "Gcirc;": "\u011c", "Gcy;": "\u0413", "Gdot;": "\u0120", "Gfr;": "\U0001d50a", "Gg;": "\u22d9", "Gopf;": "\U0001d53e", "GreaterEqual;": "\u2265", "GreaterEqualLess;": "\u22db", "GreaterFullEqual;": "\u2267", "GreaterGreater;": "\u2aa2", "GreaterLess;": "\u2277", "GreaterSlantEqual;": "\u2a7e", "GreaterTilde;": "\u2273", "Gscr;": "\U0001d4a2", "Gt;": "\u226b", "HARDcy;": "\u042a", "Hacek;": "\u02c7", "Hat;": "^", "Hcirc;": "\u0124", "Hfr;": "\u210c", "HilbertSpace;": "\u210b", "Hopf;": "\u210d", "HorizontalLine;": "\u2500", "Hscr;": "\u210b", "Hstrok;": "\u0126", "HumpDownHump;": "\u224e", "HumpEqual;": "\u224f", "IEcy;": "\u0415", "IJlig;": "\u0132", "IOcy;": "\u0401", "Iacute": "\xcd", "Iacute;": "\xcd", "Icirc": "\xce", "Icirc;": "\xce", "Icy;": "\u0418", "Idot;": "\u0130", "Ifr;": "\u2111", "Igrave": "\xcc", "Igrave;": "\xcc", "Im;": "\u2111", "Imacr;": "\u012a", "ImaginaryI;": "\u2148", "Implies;": "\u21d2", "Int;": "\u222c", "Integral;": "\u222b", "Intersection;": "\u22c2", "InvisibleComma;": "\u2063", "InvisibleTimes;": "\u2062", "Iogon;": "\u012e", "Iopf;": "\U0001d540", "Iota;": "\u0399", "Iscr;": "\u2110", "Itilde;": "\u0128", "Iukcy;": "\u0406", "Iuml": "\xcf", "Iuml;": "\xcf", "Jcirc;": "\u0134", "Jcy;": "\u0419", "Jfr;": "\U0001d50d", "Jopf;": "\U0001d541", "Jscr;": "\U0001d4a5", "Jsercy;": "\u0408", "Jukcy;": "\u0404", "KHcy;": "\u0425", "KJcy;": "\u040c", "Kappa;": "\u039a", "Kcedil;": "\u0136", "Kcy;": "\u041a", "Kfr;": "\U0001d50e", "Kopf;": "\U0001d542", "Kscr;": "\U0001d4a6", "LJcy;": "\u0409", "LT": "<", "LT;": "<", "Lacute;": "\u0139", "Lambda;": "\u039b", "Lang;": "\u27ea", "Laplacetrf;": "\u2112", "Larr;": "\u219e", "Lcaron;": "\u013d", "Lcedil;": "\u013b", "Lcy;": "\u041b", "LeftAngleBracket;": "\u27e8", "LeftArrow;": "\u2190", "LeftArrowBar;": "\u21e4", "LeftArrowRightArrow;": "\u21c6", "LeftCeiling;": "\u2308", "LeftDoubleBracket;": "\u27e6", "LeftDownTeeVector;": "\u2961", "LeftDownVector;": "\u21c3", "LeftDownVectorBar;": "\u2959", "LeftFloor;": "\u230a", "LeftRightArrow;": "\u2194", "LeftRightVector;": "\u294e", "LeftTee;": "\u22a3", "LeftTeeArrow;": "\u21a4", "LeftTeeVector;": "\u295a", "LeftTriangle;": "\u22b2", "LeftTriangleBar;": "\u29cf", "LeftTriangleEqual;": "\u22b4", "LeftUpDownVector;": "\u2951", "LeftUpTeeVector;": "\u2960", "LeftUpVector;": "\u21bf", "LeftUpVectorBar;": "\u2958", "LeftVector;": "\u21bc", "LeftVectorBar;": "\u2952", "Leftarrow;": "\u21d0", "Leftrightarrow;": "\u21d4", "LessEqualGreater;": "\u22da", "LessFullEqual;": "\u2266", "LessGreater;": "\u2276", "LessLess;": "\u2aa1", "LessSlantEqual;": "\u2a7d", "LessTilde;": "\u2272", "Lfr;": "\U0001d50f", "Ll;": "\u22d8", "Lleftarrow;": "\u21da", "Lmidot;": "\u013f", "LongLeftArrow;": "\u27f5", "LongLeftRightArrow;": "\u27f7", "LongRightArrow;": "\u27f6", "Longleftarrow;": "\u27f8", "Longleftrightarrow;": "\u27fa", "Longrightarrow;": "\u27f9", "Lopf;": "\U0001d543", "LowerLeftArrow;": "\u2199", "LowerRightArrow;": "\u2198", "Lscr;": "\u2112", "Lsh;": "\u21b0", "Lstrok;": "\u0141", "Lt;": "\u226a", "Map;": "\u2905", "Mcy;": "\u041c", "MediumSpace;": "\u205f", "Mellintrf;": "\u2133", "Mfr;": "\U0001d510", "MinusPlus;": "\u2213", "Mopf;": "\U0001d544", "Mscr;": "\u2133", "Mu;": "\u039c", "NJcy;": "\u040a", "Nacute;": "\u0143", "Ncaron;": "\u0147", "Ncedil;": "\u0145", "Ncy;": "\u041d", "NegativeMediumSpace;": "\u200b", "NegativeThickSpace;": "\u200b", "NegativeThinSpace;": "\u200b", "NegativeVeryThinSpace;": "\u200b", "NestedGreaterGreater;": "\u226b", "NestedLessLess;": "\u226a", "NewLine;": "\n", "Nfr;": "\U0001d511", "NoBreak;": "\u2060", "NonBreakingSpace;": "\xa0", "Nopf;": "\u2115", "Not;": "\u2aec", "NotCongruent;": "\u2262", "NotCupCap;": "\u226d", "NotDoubleVerticalBar;": "\u2226", "NotElement;": "\u2209", "NotEqual;": "\u2260", "NotEqualTilde;": "\u2242\u0338", "NotExists;": "\u2204", "NotGreater;": "\u226f", "NotGreaterEqual;": "\u2271", "NotGreaterFullEqual;": "\u2267\u0338", "NotGreaterGreater;": "\u226b\u0338", "NotGreaterLess;": "\u2279", "NotGreaterSlantEqual;": "\u2a7e\u0338", "NotGreaterTilde;": "\u2275", "NotHumpDownHump;": "\u224e\u0338", "NotHumpEqual;": "\u224f\u0338", "NotLeftTriangle;": "\u22ea", "NotLeftTriangleBar;": "\u29cf\u0338", "NotLeftTriangleEqual;": "\u22ec", "NotLess;": "\u226e", "NotLessEqual;": "\u2270", "NotLessGreater;": "\u2278", "NotLessLess;": "\u226a\u0338", "NotLessSlantEqual;": "\u2a7d\u0338", "NotLessTilde;": "\u2274", "NotNestedGreaterGreater;": "\u2aa2\u0338", "NotNestedLessLess;": "\u2aa1\u0338", "NotPrecedes;": "\u2280", "NotPrecedesEqual;": "\u2aaf\u0338", "NotPrecedesSlantEqual;": "\u22e0", "NotReverseElement;": "\u220c", "NotRightTriangle;": "\u22eb", "NotRightTriangleBar;": "\u29d0\u0338", "NotRightTriangleEqual;": "\u22ed", "NotSquareSubset;": "\u228f\u0338", "NotSquareSubsetEqual;": "\u22e2", "NotSquareSuperset;": "\u2290\u0338", "NotSquareSupersetEqual;": "\u22e3", "NotSubset;": "\u2282\u20d2", "NotSubsetEqual;": "\u2288", "NotSucceeds;": "\u2281", "NotSucceedsEqual;": "\u2ab0\u0338", "NotSucceedsSlantEqual;": "\u22e1", "NotSucceedsTilde;": "\u227f\u0338", "NotSuperset;": "\u2283\u20d2", "NotSupersetEqual;": "\u2289", "NotTilde;": "\u2241", "NotTildeEqual;": "\u2244", "NotTildeFullEqual;": "\u2247", "NotTildeTilde;": "\u2249", "NotVerticalBar;": "\u2224", "Nscr;": "\U0001d4a9", "Ntilde": "\xd1", "Ntilde;": "\xd1", "Nu;": "\u039d", "OElig;": "\u0152", "Oacute": "\xd3", "Oacute;": "\xd3", "Ocirc": "\xd4", "Ocirc;": "\xd4", "Ocy;": "\u041e", "Odblac;": "\u0150", "Ofr;": "\U0001d512", "Ograve": "\xd2", "Ograve;": "\xd2", "Omacr;": "\u014c", "Omega;": "\u03a9", "Omicron;": "\u039f", "Oopf;": "\U0001d546", "OpenCurlyDoubleQuote;": "\u201c", "OpenCurlyQuote;": "\u2018", "Or;": "\u2a54", "Oscr;": "\U0001d4aa", "Oslash": "\xd8", "Oslash;": "\xd8", "Otilde": "\xd5", "Otilde;": "\xd5", "Otimes;": "\u2a37", "Ouml": "\xd6", "Ouml;": "\xd6", "OverBar;": "\u203e", "OverBrace;": "\u23de", "OverBracket;": "\u23b4", "OverParenthesis;": "\u23dc", "PartialD;": "\u2202", "Pcy;": "\u041f", "Pfr;": "\U0001d513", "Phi;": "\u03a6", "Pi;": "\u03a0", "PlusMinus;": "\xb1", "Poincareplane;": "\u210c", "Popf;": "\u2119", "Pr;": "\u2abb", "Precedes;": "\u227a", "PrecedesEqual;": "\u2aaf", "PrecedesSlantEqual;": "\u227c", "PrecedesTilde;": "\u227e", "Prime;": "\u2033", "Product;": "\u220f", "Proportion;": "\u2237", "Proportional;": "\u221d", "Pscr;": "\U0001d4ab", "Psi;": "\u03a8", "QUOT": "\"", "QUOT;": "\"", "Qfr;": "\U0001d514", "Qopf;": "\u211a", "Qscr;": "\U0001d4ac", "RBarr;": "\u2910", "REG": "\xae", "REG;": "\xae", "Racute;": "\u0154", "Rang;": "\u27eb", "Rarr;": "\u21a0", "Rarrtl;": "\u2916", "Rcaron;": "\u0158", "Rcedil;": "\u0156", "Rcy;": "\u0420", "Re;": "\u211c", "ReverseElement;": "\u220b", "ReverseEquilibrium;": "\u21cb", "ReverseUpEquilibrium;": "\u296f", "Rfr;": "\u211c", "Rho;": "\u03a1", "RightAngleBracket;": "\u27e9", "RightArrow;": "\u2192", "RightArrowBar;": "\u21e5", "RightArrowLeftArrow;": "\u21c4", "RightCeiling;": "\u2309", "RightDoubleBracket;": "\u27e7", "RightDownTeeVector;": "\u295d", "RightDownVector;": "\u21c2", "RightDownVectorBar;": "\u2955", "RightFloor;": "\u230b", "RightTee;": "\u22a2", "RightTeeArrow;": "\u21a6", "RightTeeVector;": "\u295b", "RightTriangle;": "\u22b3", "RightTriangleBar;": "\u29d0", "RightTriangleEqual;": "\u22b5", "RightUpDownVector;": "\u294f", "RightUpTeeVector;": "\u295c", "RightUpVector;": "\u21be", "RightUpVectorBar;": "\u2954", "RightVector;": "\u21c0", "RightVectorBar;": "\u2953", "Rightarrow;": "\u21d2", "Ropf;": "\u211d", "RoundImplies;": "\u2970", "Rrightarrow;": "\u21db", "Rscr;": "\u211b", "Rsh;": "\u21b1", "RuleDelayed;": "\u29f4", "SHCHcy;": "\u0429", "SHcy;": "\u0428", "SOFTcy;": "\u042c", "Sacute;": "\u015a", "Sc;": "\u2abc", "Scaron;": "\u0160", "Scedil;": "\u015e", "Scirc;": "\u015c", "Scy;": "\u0421", "Sfr;": "\U0001d516", "ShortDownArrow;": "\u2193", "ShortLeftArrow;": "\u2190", "ShortRightArrow;": "\u2192", "ShortUpArrow;": "\u2191", "Sigma;": "\u03a3", "SmallCircle;": "\u2218", "Sopf;": "\U0001d54a", "Sqrt;": "\u221a", "Square;": "\u25a1", "SquareIntersection;": "\u2293", "SquareSubset;": "\u228f", "SquareSubsetEqual;": "\u2291", "SquareSuperset;": "\u2290", "SquareSupersetEqual;": "\u2292", "SquareUnion;": "\u2294", "Sscr;": "\U0001d4ae", "Star;": "\u22c6", "Sub;": "\u22d0", "Subset;": "\u22d0", "SubsetEqual;": "\u2286", "Succeeds;": "\u227b", "SucceedsEqual;": "\u2ab0", "SucceedsSlantEqual;": "\u227d", "SucceedsTilde;": "\u227f", "SuchThat;": "\u220b", "Sum;": "\u2211", "Sup;": "\u22d1", "Superset;": "\u2283", "SupersetEqual;": "\u2287", "Supset;": "\u22d1", "THORN": "\xde", "THORN;": "\xde", "TRADE;": "\u2122", "TSHcy;": "\u040b", "TScy;": "\u0426", "Tab;": "\t", "Tau;": "\u03a4", "Tcaron;": "\u0164", "Tcedil;": "\u0162", "Tcy;": "\u0422", "Tfr;": "\U0001d517", "Therefore;": "\u2234", "Theta;": "\u0398", "ThickSpace;": "\u205f\u200a", "ThinSpace;": "\u2009", "Tilde;": "\u223c", "TildeEqual;": "\u2243", "TildeFullEqual;": "\u2245", "TildeTilde;": "\u2248", "Topf;": "\U0001d54b", "TripleDot;": "\u20db", "Tscr;": "\U0001d4af", "Tstrok;": "\u0166", "Uacute": "\xda", "Uacute;": "\xda", "Uarr;": "\u219f", "Uarrocir;": "\u2949", "Ubrcy;": "\u040e", "Ubreve;": "\u016c", "Ucirc": "\xdb", "Ucirc;": "\xdb", "Ucy;": "\u0423", "Udblac;": "\u0170", "Ufr;": "\U0001d518", "Ugrave": "\xd9", "Ugrave;": "\xd9", "Umacr;": "\u016a", "UnderBar;": "_", "UnderBrace;": "\u23df", "UnderBracket;": "\u23b5", "UnderParenthesis;": "\u23dd", "Union;": "\u22c3", "UnionPlus;": "\u228e", "Uogon;": "\u0172", "Uopf;": "\U0001d54c", "UpArrow;": "\u2191", "UpArrowBar;": "\u2912", "UpArrowDownArrow;": "\u21c5", "UpDownArrow;": "\u2195", "UpEquilibrium;": "\u296e", "UpTee;": "\u22a5", "UpTeeArrow;": "\u21a5", "Uparrow;": "\u21d1", "Updownarrow;": "\u21d5", "UpperLeftArrow;": "\u2196", "UpperRightArrow;": "\u2197", "Upsi;": "\u03d2", "Upsilon;": "\u03a5", "Uring;": "\u016e", "Uscr;": "\U0001d4b0", "Utilde;": "\u0168", "Uuml": "\xdc", "Uuml;": "\xdc", "VDash;": "\u22ab", "Vbar;": "\u2aeb", "Vcy;": "\u0412", "Vdash;": "\u22a9", "Vdashl;": "\u2ae6", "Vee;": "\u22c1", "Verbar;": "\u2016", "Vert;": "\u2016", "VerticalBar;": "\u2223", "VerticalLine;": "|", "VerticalSeparator;": "\u2758", "VerticalTilde;": "\u2240", "VeryThinSpace;": "\u200a", "Vfr;": "\U0001d519", "Vopf;": "\U0001d54d", "Vscr;": "\U0001d4b1", "Vvdash;": "\u22aa", "Wcirc;": "\u0174", "Wedge;": "\u22c0", "Wfr;": "\U0001d51a", "Wopf;": "\U0001d54e", "Wscr;": "\U0001d4b2", "Xfr;": "\U0001d51b", "Xi;": "\u039e", "Xopf;": "\U0001d54f", "Xscr;": "\U0001d4b3", "YAcy;": "\u042f", "YIcy;": "\u0407", "YUcy;": "\u042e", "Yacute": "\xdd", "Yacute;": "\xdd", "Ycirc;": "\u0176", "Ycy;": "\u042b", "Yfr;": "\U0001d51c", "Yopf;": "\U0001d550", "Yscr;": "\U0001d4b4", "Yuml;": "\u0178", "ZHcy;": "\u0416", "Zacute;": "\u0179", "Zcaron;": "\u017d", "Zcy;": "\u0417", "Zdot;": "\u017b", "ZeroWidthSpace;": "\u200b", "Zeta;": "\u0396", "Zfr;": "\u2128", "Zopf;": "\u2124", "Zscr;": "\U0001d4b5", "aacute": "\xe1", "aacute;": "\xe1", "abreve;": "\u0103", "ac;": "\u223e", "acE;": "\u223e\u0333", "acd;": "\u223f", "acirc": "\xe2", "acirc;": "\xe2", "acute": "\xb4", "acute;": "\xb4", "acy;": "\u0430", "aelig": "\xe6", "aelig;": "\xe6", "af;": "\u2061", "afr;": "\U0001d51e", "agrave": "\xe0", "agrave;": "\xe0", "alefsym;": "\u2135", "aleph;": "\u2135", "alpha;": "\u03b1", "amacr;": "\u0101", "amalg;": "\u2a3f", "amp": "&", "amp;": "&", "and;": "\u2227", "andand;": "\u2a55", "andd;": "\u2a5c", "andslope;": "\u2a58", "andv;": "\u2a5a", "ang;": "\u2220", "ange;": "\u29a4", "angle;": "\u2220", "angmsd;": "\u2221", "angmsdaa;": "\u29a8", "angmsdab;": "\u29a9", "angmsdac;": "\u29aa", "angmsdad;": "\u29ab", "angmsdae;": "\u29ac", "angmsdaf;": "\u29ad", "angmsdag;": "\u29ae", "angmsdah;": "\u29af", "angrt;": "\u221f", "angrtvb;": "\u22be", "angrtvbd;": "\u299d", "angsph;": "\u2222", "angst;": "\xc5", "angzarr;": "\u237c", "aogon;": "\u0105", "aopf;": "\U0001d552", "ap;": "\u2248", "apE;": "\u2a70", "apacir;": "\u2a6f", "ape;": "\u224a", "apid;": "\u224b", "apos;": "'", "approx;": "\u2248", "approxeq;": "\u224a", "aring": "\xe5", "aring;": "\xe5", "ascr;": "\U0001d4b6", "ast;": "*", "asymp;": "\u2248", "asympeq;": "\u224d", "atilde": "\xe3", "atilde;": "\xe3", "auml": "\xe4", "auml;": "\xe4", "awconint;": "\u2233", "awint;": "\u2a11", "bNot;": "\u2aed", "backcong;": "\u224c", "backepsilon;": "\u03f6", "backprime;": "\u2035", "backsim;": "\u223d", "backsimeq;": "\u22cd", "barvee;": "\u22bd", "barwed;": "\u2305", "barwedge;": "\u2305", "bbrk;": "\u23b5", "bbrktbrk;": "\u23b6", "bcong;": "\u224c", "bcy;": "\u0431", "bdquo;": "\u201e", "becaus;": "\u2235", "because;": "\u2235", "bemptyv;": "\u29b0", "bepsi;": "\u03f6", "bernou;": "\u212c", "beta;": "\u03b2", "beth;": "\u2136", "between;": "\u226c", "bfr;": "\U0001d51f", "bigcap;": "\u22c2", "bigcirc;": "\u25ef", "bigcup;": "\u22c3", "bigodot;": "\u2a00", "bigoplus;": "\u2a01", "bigotimes;": "\u2a02", "bigsqcup;": "\u2a06", "bigstar;": "\u2605", "bigtriangledown;": "\u25bd", "bigtriangleup;": "\u25b3", "biguplus;": "\u2a04", "bigvee;": "\u22c1", "bigwedge;": "\u22c0", "bkarow;": "\u290d", "blacklozenge;": "\u29eb", "blacksquare;": "\u25aa", "blacktriangle;": "\u25b4", "blacktriangledown;": "\u25be", "blacktriangleleft;": "\u25c2", "blacktriangleright;": "\u25b8", "blank;": "\u2423", "blk12;": "\u2592", "blk14;": "\u2591", "blk34;": "\u2593", "block;": "\u2588", "bne;": "=\u20e5", "bnequiv;": "\u2261\u20e5", "bnot;": "\u2310", "bopf;": "\U0001d553", "bot;": "\u22a5", "bottom;": "\u22a5", "bowtie;": "\u22c8", "boxDL;": "\u2557", "boxDR;": "\u2554", "boxDl;": "\u2556", "boxDr;": "\u2553", "boxH;": "\u2550", "boxHD;": "\u2566", "boxHU;": "\u2569", "boxHd;": "\u2564", "boxHu;": "\u2567", "boxUL;": "\u255d", "boxUR;": "\u255a", "boxUl;": "\u255c", "boxUr;": "\u2559", "boxV;": "\u2551", "boxVH;": "\u256c", "boxVL;": "\u2563", "boxVR;": "\u2560", "boxVh;": "\u256b", "boxVl;": "\u2562", "boxVr;": "\u255f", "boxbox;": "\u29c9", "boxdL;": "\u2555", "boxdR;": "\u2552", "boxdl;": "\u2510", "boxdr;": "\u250c", "boxh;": "\u2500", "boxhD;": "\u2565", "boxhU;": "\u2568", "boxhd;": "\u252c", "boxhu;": "\u2534", "boxminus;": "\u229f", "boxplus;": "\u229e", "boxtimes;": "\u22a0", "boxuL;": "\u255b", "boxuR;": "\u2558", "boxul;": "\u2518", "boxur;": "\u2514", "boxv;": "\u2502", "boxvH;": "\u256a", "boxvL;": "\u2561", "boxvR;": "\u255e", "boxvh;": "\u253c", "boxvl;": "\u2524", "boxvr;": "\u251c", "bprime;": "\u2035", "breve;": "\u02d8", "brvbar": "\xa6", "brvbar;": "\xa6", "bscr;": "\U0001d4b7", "bsemi;": "\u204f", "bsim;": "\u223d", "bsime;": "\u22cd", "bsol;": "\\", "bsolb;": "\u29c5", "bsolhsub;": "\u27c8", "bull;": "\u2022", "bullet;": "\u2022", "bump;": "\u224e", "bumpE;": "\u2aae", "bumpe;": "\u224f", "bumpeq;": "\u224f", "cacute;": "\u0107", "cap;": "\u2229", "capand;": "\u2a44", "capbrcup;": "\u2a49", "capcap;": "\u2a4b", "capcup;": "\u2a47", "capdot;": "\u2a40", "caps;": "\u2229\ufe00", "caret;": "\u2041", "caron;": "\u02c7", "ccaps;": "\u2a4d", "ccaron;": "\u010d", "ccedil": "\xe7", "ccedil;": "\xe7", "ccirc;": "\u0109", "ccups;": "\u2a4c", "ccupssm;": "\u2a50", "cdot;": "\u010b", "cedil": "\xb8", "cedil;": "\xb8", "cemptyv;": "\u29b2", "cent": "\xa2", "cent;": "\xa2", "centerdot;": "\xb7", "cfr;": "\U0001d520", "chcy;": "\u0447", "check;": "\u2713", "checkmark;": "\u2713", "chi;": "\u03c7", "cir;": "\u25cb", "cirE;": "\u29c3", "circ;": "\u02c6", "circeq;": "\u2257", "circlearrowleft;": "\u21ba", "circlearrowright;": "\u21bb", "circledR;": "\xae", "circledS;": "\u24c8", "circledast;": "\u229b", "circledcirc;": "\u229a", "circleddash;": "\u229d", "cire;": "\u2257", "cirfnint;": "\u2a10", "cirmid;": "\u2aef", "cirscir;": "\u29c2", "clubs;": "\u2663", "clubsuit;": "\u2663", "colon;": ":", "colone;": "\u2254", "coloneq;": "\u2254", "comma;": ",", "commat;": "@", "comp;": "\u2201", "compfn;": "\u2218", "complement;": "\u2201", "complexes;": "\u2102", "cong;": "\u2245", "congdot;": "\u2a6d", "conint;": "\u222e", "copf;": "\U0001d554", "coprod;": "\u2210", "copy": "\xa9", "copy;": "\xa9", "copysr;": "\u2117", "crarr;": "\u21b5", "cross;": "\u2717", "cscr;": "\U0001d4b8", "csub;": "\u2acf", "csube;": "\u2ad1", "csup;": "\u2ad0", "csupe;": "\u2ad2", "ctdot;": "\u22ef", "cudarrl;": "\u2938", "cudarrr;": "\u2935", "cuepr;": "\u22de", "cuesc;": "\u22df", "cularr;": "\u21b6", "cularrp;": "\u293d", "cup;": "\u222a", "cupbrcap;": "\u2a48", "cupcap;": "\u2a46", "cupcup;": "\u2a4a", "cupdot;": "\u228d", "cupor;": "\u2a45", "cups;": "\u222a\ufe00", "curarr;": "\u21b7", "curarrm;": "\u293c", "curlyeqprec;": "\u22de", "curlyeqsucc;": "\u22df", "curlyvee;": "\u22ce", "curlywedge;": "\u22cf", "curren": "\xa4", "curren;": "\xa4", "curvearrowleft;": "\u21b6", "curvearrowright;": "\u21b7", "cuvee;": "\u22ce", "cuwed;": "\u22cf", "cwconint;": "\u2232", "cwint;": "\u2231", "cylcty;": "\u232d", "dArr;": "\u21d3", "dHar;": "\u2965", "dagger;": "\u2020", "daleth;": "\u2138", "darr;": "\u2193", "dash;": "\u2010", "dashv;": "\u22a3", "dbkarow;": "\u290f", "dblac;": "\u02dd", "dcaron;": "\u010f", "dcy;": "\u0434", "dd;": "\u2146", "ddagger;": "\u2021", "ddarr;": "\u21ca", "ddotseq;": "\u2a77", "deg": "\xb0", "deg;": "\xb0", "delta;": "\u03b4", "demptyv;": "\u29b1", "dfisht;": "\u297f", "dfr;": "\U0001d521", "dharl;": "\u21c3", "dharr;": "\u21c2", "diam;": "\u22c4", "diamond;": "\u22c4", "diamondsuit;": "\u2666", "diams;": "\u2666", "die;": "\xa8", "digamma;": "\u03dd", "disin;": "\u22f2", "div;": "\xf7", "divide": "\xf7", "divide;": "\xf7", "divideontimes;": "\u22c7", "divonx;": "\u22c7", "djcy;": "\u0452", "dlcorn;": "\u231e", "dlcrop;": "\u230d", "dollar;": "$", "dopf;": "\U0001d555", "dot;": "\u02d9", "doteq;": "\u2250", "doteqdot;": "\u2251", "dotminus;": "\u2238", "dotplus;": "\u2214", "dotsquare;": "\u22a1", "doublebarwedge;": "\u2306", "downarrow;": "\u2193", "downdownarrows;": "\u21ca", "downharpoonleft;": "\u21c3", "downharpoonright;": "\u21c2", "drbkarow;": "\u2910", "drcorn;": "\u231f", "drcrop;": "\u230c", "dscr;": "\U0001d4b9", "dscy;": "\u0455", "dsol;": "\u29f6", "dstrok;": "\u0111", "dtdot;": "\u22f1", "dtri;": "\u25bf", "dtrif;": "\u25be", "duarr;": "\u21f5", "duhar;": "\u296f", "dwangle;": "\u29a6", "dzcy;": "\u045f", "dzigrarr;": "\u27ff", "eDDot;": "\u2a77", "eDot;": "\u2251", "eacute": "\xe9", "eacute;": "\xe9", "easter;": "\u2a6e", "ecaron;": "\u011b", "ecir;": "\u2256", "ecirc": "\xea", "ecirc;": "\xea", "ecolon;": "\u2255", "ecy;": "\u044d", "edot;": "\u0117", "ee;": "\u2147", "efDot;": "\u2252", "efr;": "\U0001d522", "eg;": "\u2a9a", "egrave": "\xe8", "egrave;": "\xe8", "egs;": "\u2a96", "egsdot;": "\u2a98", "el;": "\u2a99", "elinters;": "\u23e7", "ell;": "\u2113", "els;": "\u2a95", "elsdot;": "\u2a97", "emacr;": "\u0113", "empty;": "\u2205", "emptyset;": "\u2205", "emptyv;": "\u2205", "emsp13;": "\u2004", "emsp14;": "\u2005", "emsp;": "\u2003", "eng;": "\u014b", "ensp;": "\u2002", "eogon;": "\u0119", "eopf;": "\U0001d556", "epar;": "\u22d5", "eparsl;": "\u29e3", "eplus;": "\u2a71", "epsi;": "\u03b5", "epsilon;": "\u03b5", "epsiv;": "\u03f5", "eqcirc;": "\u2256", "eqcolon;": "\u2255", "eqsim;": "\u2242", "eqslantgtr;": "\u2a96", "eqslantless;": "\u2a95", "equals;": "=", "equest;": "\u225f", "equiv;": "\u2261", "equivDD;": "\u2a78", "eqvparsl;": "\u29e5", "erDot;": "\u2253", "erarr;": "\u2971", "escr;": "\u212f", "esdot;": "\u2250", "esim;": "\u2242", "eta;": "\u03b7", "eth": "\xf0", "eth;": "\xf0", "euml": "\xeb", "euml;": "\xeb", "euro;": "\u20ac", "excl;": "!", "exist;": "\u2203", "expectation;": "\u2130", "exponentiale;": "\u2147", "fallingdotseq;": "\u2252", "fcy;": "\u0444", "female;": "\u2640", "ffilig;": "\ufb03", "fflig;": "\ufb00", "ffllig;": "\ufb04", "ffr;": "\U0001d523", "filig;": "\ufb01", "fjlig;": "fj", "flat;": "\u266d", "fllig;": "\ufb02", "fltns;": "\u25b1", "fnof;": "\u0192", "fopf;": "\U0001d557", "forall;": "\u2200", "fork;": "\u22d4", "forkv;": "\u2ad9", "fpartint;": "\u2a0d", "frac12": "\xbd", "frac12;": "\xbd", "frac13;": "\u2153", "frac14": "\xbc", "frac14;": "\xbc", "frac15;": "\u2155", "frac16;": "\u2159", "frac18;": "\u215b", "frac23;": "\u2154", "frac25;": "\u2156", "frac34": "\xbe", "frac34;": "\xbe", "frac35;": "\u2157", "frac38;": "\u215c", "frac45;": "\u2158", "frac56;": "\u215a", "frac58;": "\u215d", "frac78;": "\u215e", "frasl;": "\u2044", "frown;": "\u2322", "fscr;": "\U0001d4bb", "gE;": "\u2267", "gEl;": "\u2a8c", "gacute;": "\u01f5", "gamma;": "\u03b3", "gammad;": "\u03dd", "gap;": "\u2a86", "gbreve;": "\u011f", "gcirc;": "\u011d", "gcy;": "\u0433", "gdot;": "\u0121", "ge;": "\u2265", "gel;": "\u22db", "geq;": "\u2265", "geqq;": "\u2267", "geqslant;": "\u2a7e", "ges;": "\u2a7e", "gescc;": "\u2aa9", "gesdot;": "\u2a80", "gesdoto;": "\u2a82", "gesdotol;": "\u2a84", "gesl;": "\u22db\ufe00", "gesles;": "\u2a94", "gfr;": "\U0001d524", "gg;": "\u226b", "ggg;": "\u22d9", "gimel;": "\u2137", "gjcy;": "\u0453", "gl;": "\u2277", "glE;": "\u2a92", "gla;": "\u2aa5", "glj;": "\u2aa4", "gnE;": "\u2269", "gnap;": "\u2a8a", "gnapprox;": "\u2a8a", "gne;": "\u2a88", "gneq;": "\u2a88", "gneqq;": "\u2269", "gnsim;": "\u22e7", "gopf;": "\U0001d558", "grave;": "`", "gscr;": "\u210a", "gsim;": "\u2273", "gsime;": "\u2a8e", "gsiml;": "\u2a90", "gt": ">", "gt;": ">", "gtcc;": "\u2aa7", "gtcir;": "\u2a7a", "gtdot;": "\u22d7", "gtlPar;": "\u2995", "gtquest;": "\u2a7c", "gtrapprox;": "\u2a86", "gtrarr;": "\u2978", "gtrdot;": "\u22d7", "gtreqless;": "\u22db", "gtreqqless;": "\u2a8c", "gtrless;": "\u2277", "gtrsim;": "\u2273", "gvertneqq;": "\u2269\ufe00", "gvnE;": "\u2269\ufe00", "hArr;": "\u21d4", "hairsp;": "\u200a", "half;": "\xbd", "hamilt;": "\u210b", "hardcy;": "\u044a", "harr;": "\u2194", "harrcir;": "\u2948", "harrw;": "\u21ad", "hbar;": "\u210f", "hcirc;": "\u0125", "hearts;": "\u2665", "heartsuit;": "\u2665", "hellip;": "\u2026", "hercon;": "\u22b9", "hfr;": "\U0001d525", "hksearow;": "\u2925", "hkswarow;": "\u2926", "hoarr;": "\u21ff", "homtht;": "\u223b", "hookleftarrow;": "\u21a9", "hookrightarrow;": "\u21aa", "hopf;": "\U0001d559", "horbar;": "\u2015", "hscr;": "\U0001d4bd", "hslash;": "\u210f", "hstrok;": "\u0127", "hybull;": "\u2043", "hyphen;": "\u2010", "iacute": "\xed", "iacute;": "\xed", "ic;": "\u2063", "icirc": "\xee", "icirc;": "\xee", "icy;": "\u0438", "iecy;": "\u0435", "iexcl": "\xa1", "iexcl;": "\xa1", "iff;": "\u21d4", "ifr;": "\U0001d526", "igrave": "\xec", "igrave;": "\xec", "ii;": "\u2148", "iiiint;": "\u2a0c", "iiint;": "\u222d", "iinfin;": "\u29dc", "iiota;": "\u2129", "ijlig;": "\u0133", "imacr;": "\u012b", "image;": "\u2111", "imagline;": "\u2110", "imagpart;": "\u2111", "imath;": "\u0131", "imof;": "\u22b7", "imped;": "\u01b5", "in;": "\u2208", "incare;": "\u2105", "infin;": "\u221e", "infintie;": "\u29dd", "inodot;": "\u0131", "int;": "\u222b", "intcal;": "\u22ba", "integers;": "\u2124", "intercal;": "\u22ba", "intlarhk;": "\u2a17", "intprod;": "\u2a3c", "iocy;": "\u0451", "iogon;": "\u012f", "iopf;": "\U0001d55a", "iota;": "\u03b9", "iprod;": "\u2a3c", "iquest": "\xbf", "iquest;": "\xbf", "iscr;": "\U0001d4be", "isin;": "\u2208", "isinE;": "\u22f9", "isindot;": "\u22f5", "isins;": "\u22f4", "isinsv;": "\u22f3", "isinv;": "\u2208", "it;": "\u2062", "itilde;": "\u0129", "iukcy;": "\u0456", "iuml": "\xef", "iuml;": "\xef", "jcirc;": "\u0135", "jcy;": "\u0439", "jfr;": "\U0001d527", "jmath;": "\u0237", "jopf;": "\U0001d55b", "jscr;": "\U0001d4bf", "jsercy;": "\u0458", "jukcy;": "\u0454", "kappa;": "\u03ba", "kappav;": "\u03f0", "kcedil;": "\u0137", "kcy;": "\u043a", "kfr;": "\U0001d528", "kgreen;": "\u0138", "khcy;": "\u0445", "kjcy;": "\u045c", "kopf;": "\U0001d55c", "kscr;": "\U0001d4c0", "lAarr;": "\u21da", "lArr;": "\u21d0", "lAtail;": "\u291b", "lBarr;": "\u290e", "lE;": "\u2266", "lEg;": "\u2a8b", "lHar;": "\u2962", "lacute;": "\u013a", "laemptyv;": "\u29b4", "lagran;": "\u2112", "lambda;": "\u03bb", "lang;": "\u27e8", "langd;": "\u2991", "langle;": "\u27e8", "lap;": "\u2a85", "laquo": "\xab", "laquo;": "\xab", "larr;": "\u2190", "larrb;": "\u21e4", "larrbfs;": "\u291f", "larrfs;": "\u291d", "larrhk;": "\u21a9", "larrlp;": "\u21ab", "larrpl;": "\u2939", "larrsim;": "\u2973", "larrtl;": "\u21a2", "lat;": "\u2aab", "latail;": "\u2919", "late;": "\u2aad", "lates;": "\u2aad\ufe00", "lbarr;": "\u290c", "lbbrk;": "\u2772", "lbrace;": "{", "lbrack;": "[", "lbrke;": "\u298b", "lbrksld;": "\u298f", "lbrkslu;": "\u298d", "lcaron;": "\u013e", "lcedil;": "\u013c", "lceil;": "\u2308", "lcub;": "{", "lcy;": "\u043b", "ldca;": "\u2936", "ldquo;": "\u201c", "ldquor;": "\u201e", "ldrdhar;": "\u2967", "ldrushar;": "\u294b", "ldsh;": "\u21b2", "le;": "\u2264", "leftarrow;": "\u2190", "leftarrowtail;": "\u21a2", "leftharpoondown;": "\u21bd", "leftharpoonup;": "\u21bc", "leftleftarrows;": "\u21c7", "leftrightarrow;": "\u2194", "leftrightarrows;": "\u21c6", "leftrightharpoons;": "\u21cb", "leftrightsquigarrow;": "\u21ad", "leftthreetimes;": "\u22cb", "leg;": "\u22da", "leq;": "\u2264", "leqq;": "\u2266", "leqslant;": "\u2a7d", "les;": "\u2a7d", "lescc;": "\u2aa8", "lesdot;": "\u2a7f", "lesdoto;": "\u2a81", "lesdotor;": "\u2a83", "lesg;": "\u22da\ufe00", "lesges;": "\u2a93", "lessapprox;": "\u2a85", "lessdot;": "\u22d6", "lesseqgtr;": "\u22da", "lesseqqgtr;": "\u2a8b", "lessgtr;": "\u2276", "lesssim;": "\u2272", "lfisht;": "\u297c", "lfloor;": "\u230a", "lfr;": "\U0001d529", "lg;": "\u2276", "lgE;": "\u2a91", "lhard;": "\u21bd", "lharu;": "\u21bc", "lharul;": "\u296a", "lhblk;": "\u2584", "ljcy;": "\u0459", "ll;": "\u226a", "llarr;": "\u21c7", "llcorner;": "\u231e", "llhard;": "\u296b", "lltri;": "\u25fa", "lmidot;": "\u0140", "lmoust;": "\u23b0", "lmoustache;": "\u23b0", "lnE;": "\u2268", "lnap;": "\u2a89", "lnapprox;": "\u2a89", "lne;": "\u2a87", "lneq;": "\u2a87", "lneqq;": "\u2268", "lnsim;": "\u22e6", "loang;": "\u27ec", "loarr;": "\u21fd", "lobrk;": "\u27e6", "longleftarrow;": "\u27f5", "longleftrightarrow;": "\u27f7", "longmapsto;": "\u27fc", "longrightarrow;": "\u27f6", "looparrowleft;": "\u21ab", "looparrowright;": "\u21ac", "lopar;": "\u2985", "lopf;": "\U0001d55d", "loplus;": "\u2a2d", "lotimes;": "\u2a34", "lowast;": "\u2217", "lowbar;": "_", "loz;": "\u25ca", "lozenge;": "\u25ca", "lozf;": "\u29eb", "lpar;": "(", "lparlt;": "\u2993", "lrarr;": "\u21c6", "lrcorner;": "\u231f", "lrhar;": "\u21cb", "lrhard;": "\u296d", "lrm;": "\u200e", "lrtri;": "\u22bf", "lsaquo;": "\u2039", "lscr;": "\U0001d4c1", "lsh;": "\u21b0", "lsim;": "\u2272", "lsime;": "\u2a8d", "lsimg;": "\u2a8f", "lsqb;": "[", "lsquo;": "\u2018", "lsquor;": "\u201a", "lstrok;": "\u0142", "lt": "<", "lt;": "<", "ltcc;": "\u2aa6", "ltcir;": "\u2a79", "ltdot;": "\u22d6", "lthree;": "\u22cb", "ltimes;": "\u22c9", "ltlarr;": "\u2976", "ltquest;": "\u2a7b", "ltrPar;": "\u2996", "ltri;": "\u25c3", "ltrie;": "\u22b4", "ltrif;": "\u25c2", "lurdshar;": "\u294a", "luruhar;": "\u2966", "lvertneqq;": "\u2268\ufe00", "lvnE;": "\u2268\ufe00", "mDDot;": "\u223a", "macr": "\xaf", "macr;": "\xaf", "male;": "\u2642", "malt;": "\u2720", "maltese;": "\u2720", "map;": "\u21a6", "mapsto;": "\u21a6", "mapstodown;": "\u21a7", "mapstoleft;": "\u21a4", "mapstoup;": "\u21a5", "marker;": "\u25ae", "mcomma;": "\u2a29", "mcy;": "\u043c", "mdash;": "\u2014", "measuredangle;": "\u2221", "mfr;": "\U0001d52a", "mho;": "\u2127", "micro": "\xb5", "micro;": "\xb5", "mid;": "\u2223", "midast;": "*", "midcir;": "\u2af0", "middot": "\xb7", "middot;": "\xb7", "minus;": "\u2212", "minusb;": "\u229f", "minusd;": "\u2238", "minusdu;": "\u2a2a", "mlcp;": "\u2adb", "mldr;": "\u2026", "mnplus;": "\u2213", "models;": "\u22a7", "mopf;": "\U0001d55e", "mp;": "\u2213", "mscr;": "\U0001d4c2", "mstpos;": "\u223e", "mu;": "\u03bc", "multimap;": "\u22b8", "mumap;": "\u22b8", "nGg;": "\u22d9\u0338", "nGt;": "\u226b\u20d2", "nGtv;": "\u226b\u0338", "nLeftarrow;": "\u21cd", "nLeftrightarrow;": "\u21ce", "nLl;": "\u22d8\u0338", "nLt;": "\u226a\u20d2", "nLtv;": "\u226a\u0338", "nRightarrow;": "\u21cf", "nVDash;": "\u22af", "nVdash;": "\u22ae", "nabla;": "\u2207", "nacute;": "\u0144", "nang;": "\u2220\u20d2", "nap;": "\u2249", "napE;": "\u2a70\u0338", "napid;": "\u224b\u0338", "napos;": "\u0149", "napprox;": "\u2249", "natur;": "\u266e", "natural;": "\u266e", "naturals;": "\u2115", "nbsp": "\xa0", "nbsp;": "\xa0", "nbump;": "\u224e\u0338", "nbumpe;": "\u224f\u0338", "ncap;": "\u2a43", "ncaron;": "\u0148", "ncedil;": "\u0146", "ncong;": "\u2247", "ncongdot;": "\u2a6d\u0338", "ncup;": "\u2a42", "ncy;": "\u043d", "ndash;": "\u2013", "ne;": "\u2260", "neArr;": "\u21d7", "nearhk;": "\u2924", "nearr;": "\u2197", "nearrow;": "\u2197", "nedot;": "\u2250\u0338", "nequiv;": "\u2262", "nesear;": "\u2928", "nesim;": "\u2242\u0338", "nexist;": "\u2204", "nexists;": "\u2204", "nfr;": "\U0001d52b", "ngE;": "\u2267\u0338", "nge;": "\u2271", "ngeq;": "\u2271", "ngeqq;": "\u2267\u0338", "ngeqslant;": "\u2a7e\u0338", "nges;": "\u2a7e\u0338", "ngsim;": "\u2275", "ngt;": "\u226f", "ngtr;": "\u226f", "nhArr;": "\u21ce", "nharr;": "\u21ae", "nhpar;": "\u2af2", "ni;": "\u220b", "nis;": "\u22fc", "nisd;": "\u22fa", "niv;": "\u220b", "njcy;": "\u045a", "nlArr;": "\u21cd", "nlE;": "\u2266\u0338", "nlarr;": "\u219a", "nldr;": "\u2025", "nle;": "\u2270", "nleftarrow;": "\u219a", "nleftrightarrow;": "\u21ae", "nleq;": "\u2270", "nleqq;": "\u2266\u0338", "nleqslant;": "\u2a7d\u0338", "nles;": "\u2a7d\u0338", "nless;": "\u226e", "nlsim;": "\u2274", "nlt;": "\u226e", "nltri;": "\u22ea", "nltrie;": "\u22ec", "nmid;": "\u2224", "nopf;": "\U0001d55f", "not": "\xac", "not;": "\xac", "notin;": "\u2209", "notinE;": "\u22f9\u0338", "notindot;": "\u22f5\u0338", "notinva;": "\u2209", "notinvb;": "\u22f7", "notinvc;": "\u22f6", "notni;": "\u220c", "notniva;": "\u220c", "notnivb;": "\u22fe", "notnivc;": "\u22fd", "npar;": "\u2226", "nparallel;": "\u2226", "nparsl;": "\u2afd\u20e5", "npart;": "\u2202\u0338", "npolint;": "\u2a14", "npr;": "\u2280", "nprcue;": "\u22e0", "npre;": "\u2aaf\u0338", "nprec;": "\u2280", "npreceq;": "\u2aaf\u0338", "nrArr;": "\u21cf", "nrarr;": "\u219b", "nrarrc;": "\u2933\u0338", "nrarrw;": "\u219d\u0338", "nrightarrow;": "\u219b", "nrtri;": "\u22eb", "nrtrie;": "\u22ed", "nsc;": "\u2281", "nsccue;": "\u22e1", "nsce;": "\u2ab0\u0338", "nscr;": "\U0001d4c3", "nshortmid;": "\u2224", "nshortparallel;": "\u2226", "nsim;": "\u2241", "nsime;": "\u2244", "nsimeq;": "\u2244", "nsmid;": "\u2224", "nspar;": "\u2226", "nsqsube;": "\u22e2", "nsqsupe;": "\u22e3", "nsub;": "\u2284", "nsubE;": "\u2ac5\u0338", "nsube;": "\u2288", "nsubset;": "\u2282\u20d2", "nsubseteq;": "\u2288", "nsubseteqq;": "\u2ac5\u0338", "nsucc;": "\u2281", "nsucceq;": "\u2ab0\u0338", "nsup;": "\u2285", "nsupE;": "\u2ac6\u0338", "nsupe;": "\u2289", "nsupset;": "\u2283\u20d2", "nsupseteq;": "\u2289", "nsupseteqq;": "\u2ac6\u0338", "ntgl;": "\u2279", "ntilde": "\xf1", "ntilde;": "\xf1", "ntlg;": "\u2278", "ntriangleleft;": "\u22ea", "ntrianglelefteq;": "\u22ec", "ntriangleright;": "\u22eb", "ntrianglerighteq;": "\u22ed", "nu;": "\u03bd", "num;": "#", "numero;": "\u2116", "numsp;": "\u2007", "nvDash;": "\u22ad", "nvHarr;": "\u2904", "nvap;": "\u224d\u20d2", "nvdash;": "\u22ac", "nvge;": "\u2265\u20d2", "nvgt;": ">\u20d2", "nvinfin;": "\u29de", "nvlArr;": "\u2902", "nvle;": "\u2264\u20d2", "nvlt;": "<\u20d2", "nvltrie;": "\u22b4\u20d2", "nvrArr;": "\u2903", "nvrtrie;": "\u22b5\u20d2", "nvsim;": "\u223c\u20d2", "nwArr;": "\u21d6", "nwarhk;": "\u2923", "nwarr;": "\u2196", "nwarrow;": "\u2196", "nwnear;": "\u2927", "oS;": "\u24c8", "oacute": "\xf3", "oacute;": "\xf3", "oast;": "\u229b", "ocir;": "\u229a", "ocirc": "\xf4", "ocirc;": "\xf4", "ocy;": "\u043e", "odash;": "\u229d", "odblac;": "\u0151", "odiv;": "\u2a38", "odot;": "\u2299", "odsold;": "\u29bc", "oelig;": "\u0153", "ofcir;": "\u29bf", "ofr;": "\U0001d52c", "ogon;": "\u02db", "ograve": "\xf2", "ograve;": "\xf2", "ogt;": "\u29c1", "ohbar;": "\u29b5", "ohm;": "\u03a9", "oint;": "\u222e", "olarr;": "\u21ba", "olcir;": "\u29be", "olcross;": "\u29bb", "oline;": "\u203e", "olt;": "\u29c0", "omacr;": "\u014d", "omega;": "\u03c9", "omicron;": "\u03bf", "omid;": "\u29b6", "ominus;": "\u2296", "oopf;": "\U0001d560", "opar;": "\u29b7", "operp;": "\u29b9", "oplus;": "\u2295", "or;": "\u2228", "orarr;": "\u21bb", "ord;": "\u2a5d", "order;": "\u2134", "orderof;": "\u2134", "ordf": "\xaa", "ordf;": "\xaa", "ordm": "\xba", "ordm;": "\xba", "origof;": "\u22b6", "oror;": "\u2a56", "orslope;": "\u2a57", "orv;": "\u2a5b", "oscr;": "\u2134", "oslash": "\xf8", "oslash;": "\xf8", "osol;": "\u2298", "otilde": "\xf5", "otilde;": "\xf5", "otimes;": "\u2297", "otimesas;": "\u2a36", "ouml": "\xf6", "ouml;": "\xf6", "ovbar;": "\u233d", "par;": "\u2225", "para": "\xb6", "para;": "\xb6", "parallel;": "\u2225", "parsim;": "\u2af3", "parsl;": "\u2afd", "part;": "\u2202", "pcy;": "\u043f", "percnt;": "%", "period;": ".", "permil;": "\u2030", "perp;": "\u22a5", "pertenk;": "\u2031", "pfr;": "\U0001d52d", "phi;": "\u03c6", "phiv;": "\u03d5", "phmmat;": "\u2133", "phone;": "\u260e", "pi;": "\u03c0", "pitchfork;": "\u22d4", "piv;": "\u03d6", "planck;": "\u210f", "planckh;": "\u210e", "plankv;": "\u210f", "plus;": "+", "plusacir;": "\u2a23", "plusb;": "\u229e", "pluscir;": "\u2a22", "plusdo;": "\u2214", "plusdu;": "\u2a25", "pluse;": "\u2a72", "plusmn": "\xb1", "plusmn;": "\xb1", "plussim;": "\u2a26", "plustwo;": "\u2a27", "pm;": "\xb1", "pointint;": "\u2a15", "popf;": "\U0001d561", "pound": "\xa3", "pound;": "\xa3", "pr;": "\u227a", "prE;": "\u2ab3", "prap;": "\u2ab7", "prcue;": "\u227c", "pre;": "\u2aaf", "prec;": "\u227a", "precapprox;": "\u2ab7", "preccurlyeq;": "\u227c", "preceq;": "\u2aaf", "precnapprox;": "\u2ab9", "precneqq;": "\u2ab5", "precnsim;": "\u22e8", "precsim;": "\u227e", "prime;": "\u2032", "primes;": "\u2119", "prnE;": "\u2ab5", "prnap;": "\u2ab9", "prnsim;": "\u22e8", "prod;": "\u220f", "profalar;": "\u232e", "profline;": "\u2312", "profsurf;": "\u2313", "prop;": "\u221d", "propto;": "\u221d", "prsim;": "\u227e", "prurel;": "\u22b0", "pscr;": "\U0001d4c5", "psi;": "\u03c8", "puncsp;": "\u2008", "qfr;": "\U0001d52e", "qint;": "\u2a0c", "qopf;": "\U0001d562", "qprime;": "\u2057", "qscr;": "\U0001d4c6", "quaternions;": "\u210d", "quatint;": "\u2a16", "quest;": "?", "questeq;": "\u225f", "quot": "\"", "quot;": "\"", "rAarr;": "\u21db", "rArr;": "\u21d2", "rAtail;": "\u291c", "rBarr;": "\u290f", "rHar;": "\u2964", "race;": "\u223d\u0331", "racute;": "\u0155", "radic;": "\u221a", "raemptyv;": "\u29b3", "rang;": "\u27e9", "rangd;": "\u2992", "range;": "\u29a5", "rangle;": "\u27e9", "raquo": "\xbb", "raquo;": "\xbb", "rarr;": "\u2192", "rarrap;": "\u2975", "rarrb;": "\u21e5", "rarrbfs;": "\u2920", "rarrc;": "\u2933", "rarrfs;": "\u291e", "rarrhk;": "\u21aa", "rarrlp;": "\u21ac", "rarrpl;": "\u2945", "rarrsim;": "\u2974", "rarrtl;": "\u21a3", "rarrw;": "\u219d", "ratail;": "\u291a", "ratio;": "\u2236", "rationals;": "\u211a", "rbarr;": "\u290d", "rbbrk;": "\u2773", "rbrace;": "}", "rbrack;": "]", "rbrke;": "\u298c", "rbrksld;": "\u298e", "rbrkslu;": "\u2990", "rcaron;": "\u0159", "rcedil;": "\u0157", "rceil;": "\u2309", "rcub;": "}", "rcy;": "\u0440", "rdca;": "\u2937", "rdldhar;": "\u2969", "rdquo;": "\u201d", "rdquor;": "\u201d", "rdsh;": "\u21b3", "real;": "\u211c", "realine;": "\u211b", "realpart;": "\u211c", "reals;": "\u211d", "rect;": "\u25ad", "reg": "\xae", "reg;": "\xae", "rfisht;": "\u297d", "rfloor;": "\u230b", "rfr;": "\U0001d52f", "rhard;": "\u21c1", "rharu;": "\u21c0", "rharul;": "\u296c", "rho;": "\u03c1", "rhov;": "\u03f1", "rightarrow;": "\u2192", "rightarrowtail;": "\u21a3", "rightharpoondown;": "\u21c1", "rightharpoonup;": "\u21c0", "rightleftarrows;": "\u21c4", "rightleftharpoons;": "\u21cc", "rightrightarrows;": "\u21c9", "rightsquigarrow;": "\u219d", "rightthreetimes;": "\u22cc", "ring;": "\u02da", "risingdotseq;": "\u2253", "rlarr;": "\u21c4", "rlhar;": "\u21cc", "rlm;": "\u200f", "rmoust;": "\u23b1", "rmoustache;": "\u23b1", "rnmid;": "\u2aee", "roang;": "\u27ed", "roarr;": "\u21fe", "robrk;": "\u27e7", "ropar;": "\u2986", "ropf;": "\U0001d563", "roplus;": "\u2a2e", "rotimes;": "\u2a35", "rpar;": ")", "rpargt;": "\u2994", "rppolint;": "\u2a12", "rrarr;": "\u21c9", "rsaquo;": "\u203a", "rscr;": "\U0001d4c7", "rsh;": "\u21b1", "rsqb;": "]", "rsquo;": "\u2019", "rsquor;": "\u2019", "rthree;": "\u22cc", "rtimes;": "\u22ca", "rtri;": "\u25b9", "rtrie;": "\u22b5", "rtrif;": "\u25b8", "rtriltri;": "\u29ce", "ruluhar;": "\u2968", "rx;": "\u211e", "sacute;": "\u015b", "sbquo;": "\u201a", "sc;": "\u227b", "scE;": "\u2ab4", "scap;": "\u2ab8", "scaron;": "\u0161", "sccue;": "\u227d", "sce;": "\u2ab0", "scedil;": "\u015f", "scirc;": "\u015d", "scnE;": "\u2ab6", "scnap;": "\u2aba", "scnsim;": "\u22e9", "scpolint;": "\u2a13", "scsim;": "\u227f", "scy;": "\u0441", "sdot;": "\u22c5", "sdotb;": "\u22a1", "sdote;": "\u2a66", "seArr;": "\u21d8", "searhk;": "\u2925", "searr;": "\u2198", "searrow;": "\u2198", "sect": "\xa7", "sect;": "\xa7", "semi;": ";", "seswar;": "\u2929", "setminus;": "\u2216", "setmn;": "\u2216", "sext;": "\u2736", "sfr;": "\U0001d530", "sfrown;": "\u2322", "sharp;": "\u266f", "shchcy;": "\u0449", "shcy;": "\u0448", "shortmid;": "\u2223", "shortparallel;": "\u2225", "shy": "\xad", "shy;": "\xad", "sigma;": "\u03c3", "sigmaf;": "\u03c2", "sigmav;": "\u03c2", "sim;": "\u223c", "simdot;": "\u2a6a", "sime;": "\u2243", "simeq;": "\u2243", "simg;": "\u2a9e", "simgE;": "\u2aa0", "siml;": "\u2a9d", "simlE;": "\u2a9f", "simne;": "\u2246", "simplus;": "\u2a24", "simrarr;": "\u2972", "slarr;": "\u2190", "smallsetminus;": "\u2216", "smashp;": "\u2a33", "smeparsl;": "\u29e4", "smid;": "\u2223", "smile;": "\u2323", "smt;": "\u2aaa", "smte;": "\u2aac", "smtes;": "\u2aac\ufe00", "softcy;": "\u044c", "sol;": "/", "solb;": "\u29c4", "solbar;": "\u233f", "sopf;": "\U0001d564", "spades;": "\u2660", "spadesuit;": "\u2660", "spar;": "\u2225", "sqcap;": "\u2293", "sqcaps;": "\u2293\ufe00", "sqcup;": "\u2294", "sqcups;": "\u2294\ufe00", "sqsub;": "\u228f", "sqsube;": "\u2291", "sqsubset;": "\u228f", "sqsubseteq;": "\u2291", "sqsup;": "\u2290", "sqsupe;": "\u2292", "sqsupset;": "\u2290", "sqsupseteq;": "\u2292", "squ;": "\u25a1", "square;": "\u25a1", "squarf;": "\u25aa", "squf;": "\u25aa", "srarr;": "\u2192", "sscr;": "\U0001d4c8", "ssetmn;": "\u2216", "ssmile;": "\u2323", "sstarf;": "\u22c6", "star;": "\u2606", "starf;": "\u2605", "straightepsilon;": "\u03f5", "straightphi;": "\u03d5", "strns;": "\xaf", "sub;": "\u2282", "subE;": "\u2ac5", "subdot;": "\u2abd", "sube;": "\u2286", "subedot;": "\u2ac3", "submult;": "\u2ac1", "subnE;": "\u2acb", "subne;": "\u228a", "subplus;": "\u2abf", "subrarr;": "\u2979", "subset;": "\u2282", "subseteq;": "\u2286", "subseteqq;": "\u2ac5", "subsetneq;": "\u228a", "subsetneqq;": "\u2acb", "subsim;": "\u2ac7", "subsub;": "\u2ad5", "subsup;": "\u2ad3", "succ;": "\u227b", "succapprox;": "\u2ab8", "succcurlyeq;": "\u227d", "succeq;": "\u2ab0", "succnapprox;": "\u2aba", "succneqq;": "\u2ab6", "succnsim;": "\u22e9", "succsim;": "\u227f", "sum;": "\u2211", "sung;": "\u266a", "sup1": "\xb9", "sup1;": "\xb9", "sup2": "\xb2", "sup2;": "\xb2", "sup3": "\xb3", "sup3;": "\xb3", "sup;": "\u2283", "supE;": "\u2ac6", "supdot;": "\u2abe", "supdsub;": "\u2ad8", "supe;": "\u2287", "supedot;": "\u2ac4", "suphsol;": "\u27c9", "suphsub;": "\u2ad7", "suplarr;": "\u297b", "supmult;": "\u2ac2", "supnE;": "\u2acc", "supne;": "\u228b", "supplus;": "\u2ac0", "supset;": "\u2283", "supseteq;": "\u2287", "supseteqq;": "\u2ac6", "supsetneq;": "\u228b", "supsetneqq;": "\u2acc", "supsim;": "\u2ac8", "supsub;": "\u2ad4", "supsup;": "\u2ad6", "swArr;": "\u21d9", "swarhk;": "\u2926", "swarr;": "\u2199", "swarrow;": "\u2199", "swnwar;": "\u292a", "szlig": "\xdf", "szlig;": "\xdf", "target;": "\u2316", "tau;": "\u03c4", "tbrk;": "\u23b4", "tcaron;": "\u0165", "tcedil;": "\u0163", "tcy;": "\u0442", "tdot;": "\u20db", "telrec;": "\u2315", "tfr;": "\U0001d531", "there4;": "\u2234", "therefore;": "\u2234", "theta;": "\u03b8", "thetasym;": "\u03d1", "thetav;": "\u03d1", "thickapprox;": "\u2248", "thicksim;": "\u223c", "thinsp;": "\u2009", "thkap;": "\u2248", "thksim;": "\u223c", "thorn": "\xfe", "thorn;": "\xfe", "tilde;": "\u02dc", "times": "\xd7", "times;": "\xd7", "timesb;": "\u22a0", "timesbar;": "\u2a31", "timesd;": "\u2a30", "tint;": "\u222d", "toea;": "\u2928", "top;": "\u22a4", "topbot;": "\u2336", "topcir;": "\u2af1", "topf;": "\U0001d565", "topfork;": "\u2ada", "tosa;": "\u2929", "tprime;": "\u2034", "trade;": "\u2122", "triangle;": "\u25b5", "triangledown;": "\u25bf", "triangleleft;": "\u25c3", "trianglelefteq;": "\u22b4", "triangleq;": "\u225c", "triangleright;": "\u25b9", "trianglerighteq;": "\u22b5", "tridot;": "\u25ec", "trie;": "\u225c", "triminus;": "\u2a3a", "triplus;": "\u2a39", "trisb;": "\u29cd", "tritime;": "\u2a3b", "trpezium;": "\u23e2", "tscr;": "\U0001d4c9", "tscy;": "\u0446", "tshcy;": "\u045b", "tstrok;": "\u0167", "twixt;": "\u226c", "twoheadleftarrow;": "\u219e", "twoheadrightarrow;": "\u21a0", "uArr;": "\u21d1", "uHar;": "\u2963", "uacute": "\xfa", "uacute;": "\xfa", "uarr;": "\u2191", "ubrcy;": "\u045e", "ubreve;": "\u016d", "ucirc": "\xfb", "ucirc;": "\xfb", "ucy;": "\u0443", "udarr;": "\u21c5", "udblac;": "\u0171", "udhar;": "\u296e", "ufisht;": "\u297e", "ufr;": "\U0001d532", "ugrave": "\xf9", "ugrave;": "\xf9", "uharl;": "\u21bf", "uharr;": "\u21be", "uhblk;": "\u2580", "ulcorn;": "\u231c", "ulcorner;": "\u231c", "ulcrop;": "\u230f", "ultri;": "\u25f8", "umacr;": "\u016b", "uml": "\xa8", "uml;": "\xa8", "uogon;": "\u0173", "uopf;": "\U0001d566", "uparrow;": "\u2191", "updownarrow;": "\u2195", "upharpoonleft;": "\u21bf", "upharpoonright;": "\u21be", "uplus;": "\u228e", "upsi;": "\u03c5", "upsih;": "\u03d2", "upsilon;": "\u03c5", "upuparrows;": "\u21c8", "urcorn;": "\u231d", "urcorner;": "\u231d", "urcrop;": "\u230e", "uring;": "\u016f", "urtri;": "\u25f9", "uscr;": "\U0001d4ca", "utdot;": "\u22f0", "utilde;": "\u0169", "utri;": "\u25b5", "utrif;": "\u25b4", "uuarr;": "\u21c8", "uuml": "\xfc", "uuml;": "\xfc", "uwangle;": "\u29a7", "vArr;": "\u21d5", "vBar;": "\u2ae8", "vBarv;": "\u2ae9", "vDash;": "\u22a8", "vangrt;": "\u299c", "varepsilon;": "\u03f5", "varkappa;": "\u03f0", "varnothing;": "\u2205", "varphi;": "\u03d5", "varpi;": "\u03d6", "varpropto;": "\u221d", "varr;": "\u2195", "varrho;": "\u03f1", "varsigma;": "\u03c2", "varsubsetneq;": "\u228a\ufe00", "varsubsetneqq;": "\u2acb\ufe00", "varsupsetneq;": "\u228b\ufe00", "varsupsetneqq;": "\u2acc\ufe00", "vartheta;": "\u03d1", "vartriangleleft;": "\u22b2", "vartriangleright;": "\u22b3", "vcy;": "\u0432", "vdash;": "\u22a2", "vee;": "\u2228", "veebar;": "\u22bb", "veeeq;": "\u225a", "vellip;": "\u22ee", "verbar;": "|", "vert;": "|", "vfr;": "\U0001d533", "vltri;": "\u22b2", "vnsub;": "\u2282\u20d2", "vnsup;": "\u2283\u20d2", "vopf;": "\U0001d567", "vprop;": "\u221d", "vrtri;": "\u22b3", "vscr;": "\U0001d4cb", "vsubnE;": "\u2acb\ufe00", "vsubne;": "\u228a\ufe00", "vsupnE;": "\u2acc\ufe00", "vsupne;": "\u228b\ufe00", "vzigzag;": "\u299a", "wcirc;": "\u0175", "wedbar;": "\u2a5f", "wedge;": "\u2227", "wedgeq;": "\u2259", "weierp;": "\u2118", "wfr;": "\U0001d534", "wopf;": "\U0001d568", "wp;": "\u2118", "wr;": "\u2240", "wreath;": "\u2240", "wscr;": "\U0001d4cc", "xcap;": "\u22c2", "xcirc;": "\u25ef", "xcup;": "\u22c3", "xdtri;": "\u25bd", "xfr;": "\U0001d535", "xhArr;": "\u27fa", "xharr;": "\u27f7", "xi;": "\u03be", "xlArr;": "\u27f8", "xlarr;": "\u27f5", "xmap;": "\u27fc", "xnis;": "\u22fb", "xodot;": "\u2a00", "xopf;": "\U0001d569", "xoplus;": "\u2a01", "xotime;": "\u2a02", "xrArr;": "\u27f9", "xrarr;": "\u27f6", "xscr;": "\U0001d4cd", "xsqcup;": "\u2a06", "xuplus;": "\u2a04", "xutri;": "\u25b3", "xvee;": "\u22c1", "xwedge;": "\u22c0", "yacute": "\xfd", "yacute;": "\xfd", "yacy;": "\u044f", "ycirc;": "\u0177", "ycy;": "\u044b", "yen": "\xa5", "yen;": "\xa5", "yfr;": "\U0001d536", "yicy;": "\u0457", "yopf;": "\U0001d56a", "yscr;": "\U0001d4ce", "yucy;": "\u044e", "yuml": "\xff", "yuml;": "\xff", "zacute;": "\u017a", "zcaron;": "\u017e", "zcy;": "\u0437", "zdot;": "\u017c", "zeetrf;": "\u2128", "zeta;": "\u03b6", "zfr;": "\U0001d537", "zhcy;": "\u0436", "zigrarr;": "\u21dd", "zopf;": "\U0001d56b", "zscr;": "\U0001d4cf", "zwj;": "\u200d", "zwnj;": "\u200c", } replacementCharacters = { 0x0: "\uFFFD", 0x0d: "\u000D", 0x80: "\u20AC", 0x81: "\u0081", 0x82: "\u201A", 0x83: "\u0192", 0x84: "\u201E", 0x85: "\u2026", 0x86: "\u2020", 0x87: "\u2021", 0x88: "\u02C6", 0x89: "\u2030", 0x8A: "\u0160", 0x8B: "\u2039", 0x8C: "\u0152", 0x8D: "\u008D", 0x8E: "\u017D", 0x8F: "\u008F", 0x90: "\u0090", 0x91: "\u2018", 0x92: "\u2019", 0x93: "\u201C", 0x94: "\u201D", 0x95: "\u2022", 0x96: "\u2013", 0x97: "\u2014", 0x98: "\u02DC", 0x99: "\u2122", 0x9A: "\u0161", 0x9B: "\u203A", 0x9C: "\u0153", 0x9D: "\u009D", 0x9E: "\u017E", 0x9F: "\u0178", } tokenTypes = { "Doctype": 0, "Characters": 1, "SpaceCharacters": 2, "StartTag": 3, "EndTag": 4, "EmptyTag": 5, "Comment": 6, "ParseError": 7 } tagTokenTypes = frozenset([tokenTypes["StartTag"], tokenTypes["EndTag"], tokenTypes["EmptyTag"]]) prefixes = dict([(v, k) for k, v in namespaces.items()]) prefixes["http://www.w3.org/1998/Math/MathML"] = "math" class DataLossWarning(UserWarning): pass class ReparseException(Exception): pass site-packages/pip/_vendor/html5lib/constants.pyc000064400000242000147204247350015767 0ustar00 abcP@`sNddlmZmZmZddlZdZidd6dd6dd6d d 6d d 6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d'd(6d)d*6d+d,6d-d.6d/d06d1d26d3d46d5d66d7d86d9d:6d;d<6d=d>6d?d@6dAdB6dCdD6dEdF6dGdH6dIdJ6dKdL6dMdN6dOdP6dQdR6dSdT6dUdV6dWdX6dYdZ6d[d\6dUd]6dUd^6d_d`6dadb6dcdd6dedf6dgdh6didj6dkdl6dmdn6dodp6dqdr6dsdt6dudv6dwdx6dydz6d{d|6d}d~6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6Zidd6dd6d d 6d d 6d d6dd6Ze eddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfed dfed dfed d fgZ e edd!fedd"fedd#fedd$fedd%fedd&fedd'fedd(fedd)fedd*fedd+fedd,fedd-fedd.fgZ e edd/feddfedd0fedd1fedd2fedd3fedd4fedd5fedd6fedd7fedd8fedd9feddfedd:fedd;fedd<fedd=fedd>fedd?fedd@feddAfeddBfeddCfeddDfeddEfeddFfeddGfeddHfeddIfeddJfeddKfeddLfeddMfeddNfeddOfeddPfeddQfeddRfeddSfeddfeddTfeddUfeddVfeddWfeddXfeddYfeddZfedd[feddfedd\fedd]fedd^fedd_fedd`feddafeddfeddbfeddcfedddfeddefeddffeddgfeddhfeddifeddjfeddfeddkfeddfeddlfeddmfeddfeddnfedd feddofeddpfeddqfeddrfed dfgNZ e eddsfed dfed dfed d fgZ e eddfeddfeddfeddfeddfgZi>dtdu6dvdw6dxdy6dzd{6d|d}6d~d6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6Zidd6Zi d ded fd6d ded fd6d ded fd6d ded fd6d ded fd6d d ed fd6d ded fd6dd3edfd6ddedfd6ddedfd6ddedfd6dd edfd6ZegejD]'\Z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m dn 6do dp 6dq dr 6ds dt 6ds du 6ds dv 6dw dx 6dy dz 6d{ d| 6d} d~ 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dN d 6dS d 6d_d 6dc d 6dm d 6d d 6d d 6dd 6d d 6d d 6d d 6d d 6d d 6dd 6d_d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dld 6dcd 6dnd 6dZ d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dzd 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dd 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dd 6dd 6dd 6dd 6dd 6dd 6d d 6d d 6d d 6d d 6d d 6d d! 6d" d# 6dd$ 6dd% 6d& d' 6d( d) 6dd* 6d+ d, 6d- d. 6d/ d0 6d1 d2 6d3 d4 6d3 d5 6d6 d7 6d6 d8 6d1 d9 6d: d; 6d< d= 6dd> 6d? d@ 6ddA 6dB dC 6dD dE 6ddF 6ddD6dG dH 6dI dJ 6dK dL 6dM dN 6dO dP 6d dQ 6dR dS 6dK dT 6ddU 6d dV 6ddW 6ddX 6dY dZ 6dY d[ 6dd\ 6dd] 6d d^ 6dd_ 6d` da 6d;db 6dc dd 6de df 6dg dh 6di dj 6dk dl 6dk dm 6dn do 6dp dq 6dr ds 6dt du 6dv dw 6dx dy 6dz d{ 6d| d} 6d~ d 6d d 6d d 6d d 6dg d 6d d 6d d 6dd 6d d 6d d 6dd 6d d 6d d 6d d 6d d 6d d 6d d 6dd 6d d 6d d 6d d 6dd 6d d 6d d 6d d 6d d 6d d 6d d 6dd 6dd 6dd 6d d 6d d 6d d 6dOd 6d d 6d d 6d d 6d d 6dd 6d d 6dd 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dOd 6d d 6d d 6d d 6d d 6dOd 6dd 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6did 6dd 6d d 6d d 6d[d 6d d 6d d 6d d 6d d 6dd 6d d 6d'd 6d d 6d'd 6d! d" 6d# d$ 6d# d% 6d)d& 6d+d' 6d( d) 6d* d+ 6d| d, 6d- d. 6d/ d0 6d1 d2 6d3 d4 6d5 d6 6d7 d8 6d9 d: 6d; d< 6d= d> 6d? d@ 6dA dB 6dC dD 6dE dF 6dG dH 6dI dJ 6dK dL 6dM dN 6d/dO 6dA dP 6dQ dR 6dS dT 6d6dU 6dydV 6dW dX 6dY dZ 6d[ d\ 6d] d^ 6d)d_ 6d3 d` 6d&da 6dSdb 6dc dd 6d;de 6d-df 6ddg 6de dh 6di dj 6dYdk 6d] dl 6d[dm 6dadn 6dado 6dp dq 6dr ds 6dt du 6dv dw 6dx dy 6dz d{ 6d! d| 6d} d~ 6dYd 6d d 6d]d 6dcd 6d d 6d9d 6d d 6d]d 6d d 6d&d 6dSd 6d d 6d d 6d d 6dd 6dc d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d1d 6dmd 6dod 6d d 6dqd 6d- d 6d d 6d d 6d d 6d d 6d d 6d d 6ddd 6d d 6d d 6dd 6d d 6d d 6d-d 6d, d 6dd 6d d 6d d 6d d 6d d 6d d 6d}d 6dcd 6d d 6d d 6dC d 6d8d 6d d 6d d 6dd 6ddC6d d 6d d 6d} d 6di d 6d d 6d d 6d d 6d d 6d d 6dId 6dd 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dd 6dd 6d2d 6dAd 6dd 6d d 6d d 6d d 6d d 6d#d 6d d 6d d 6d d 6d d 6dd 6dUd 6d d 6dd 6dd! 6d" d# 6dd$ 6d d% 6d& d' 6d( d) 6dn d* 6dd+ 6d, d- 6d. d/ 6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dd6dd6dd6dd6dd6dd6dd6dd6dld6dd6dd6d d6dod6dd6d d6dmd6d d6dd6dd6dd6dd6dd6dd6dqd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6Z/i"dd6d d6d d6dd6d d6d d6dyd6dn d6dd6dd6did6d d6dd6d d6dd6dd6dd6dd6dd6d8d6dd6d6d6dd6d*d6do d6d d6dd6d"d6dd6dd6d@ d6dd6dd6dd6Z0idd6dd6d d 6d d 6d d6dd6dd6dd6Z1e e1d e1de1dgZ2egejD]\Z3Z4e4e3f^qDNZ5de5d' instead.u'expected-tag-name-but-got-right-bracketuSExpected tag name. Got '?' instead. (HTML doesn't support processing instructions.)u'expected-tag-name-but-got-question-marku-Expected tag name. Got something else insteaduexpected-tag-nameu6Expected closing tag. Got '>' instead. Ignoring ''.u*expected-closing-tag-but-got-right-bracketu-Expected closing tag. Unexpected end of file.u expected-closing-tag-but-got-eofu<Expected closing tag. Unexpected character '%(data)s' found.u!expected-closing-tag-but-got-charu'Unexpected end of file in the tag name.ueof-in-tag-nameu8Unexpected end of file. Expected attribute name instead.u#expected-attribute-name-but-got-eofu)Unexpected end of file in attribute name.ueof-in-attribute-nameu#Invalid character in attribute nameu#invalid-character-in-attribute-nameu#Dropped duplicate attribute on tag.uduplicate-attributeu1Unexpected end of file. Expected = or end of tag.u$expected-end-of-tag-name-but-got-eofu1Unexpected end of file. Expected attribute value.u$expected-attribute-value-but-got-eofu*Expected attribute value. Got '>' instead.u.expected-attribute-value-but-got-right-bracketu"Unexpected = in unquoted attributeu"equals-in-unquoted-attribute-valueu*Unexpected character in unquoted attributeu0unexpected-character-in-unquoted-attribute-valueu*Unexpected character after attribute name.u&invalid-character-after-attribute-nameu+Unexpected character after attribute value.u*unexpected-character-after-attribute-valueu.Unexpected end of file in attribute value (").u#eof-in-attribute-value-double-quoteu.Unexpected end of file in attribute value (').u#eof-in-attribute-value-single-quoteu*Unexpected end of file in attribute value.u eof-in-attribute-value-no-quotesu)Unexpected end of file in tag. Expected >u#unexpected-EOF-after-solidus-in-tagu/Unexpected character after / in tag. Expected >u)unexpected-character-after-solidus-in-tagu&Expected '--' or 'DOCTYPE'. Not found.uexpected-dashes-or-doctypeu Unexpected ! after -- in commentu,unexpected-bang-after-double-dash-in-commentu$Unexpected space after -- in commentu-unexpected-space-after-double-dash-in-commentuIncorrect comment.uincorrect-commentu"Unexpected end of file in comment.ueof-in-commentu%Unexpected end of file in comment (-)ueof-in-comment-end-dashu+Unexpected '-' after '--' found in comment.u,unexpected-dash-after-double-dash-in-commentu'Unexpected end of file in comment (--).ueof-in-comment-double-dashueof-in-comment-end-space-stateueof-in-comment-end-bang-stateu&Unexpected character in comment found.uunexpected-char-in-commentu(No space after literal string 'DOCTYPE'.uneed-space-after-doctypeu.Unexpected > character. Expected DOCTYPE name.u+expected-doctype-name-but-got-right-bracketu.Unexpected end of file. Expected DOCTYPE name.u!expected-doctype-name-but-got-eofu'Unexpected end of file in DOCTYPE name.ueof-in-doctype-nameu"Unexpected end of file in DOCTYPE.ueof-in-doctypeu%Expected space or '>'. Got '%(data)s'u*expected-space-or-right-bracket-in-doctypeuUnexpected end of DOCTYPE.uunexpected-end-of-doctypeu Unexpected character in DOCTYPE.uunexpected-char-in-doctypeuXXX innerHTML EOFueof-in-innerhtmluUnexpected DOCTYPE. Ignored.uunexpected-doctypeu%html needs to be the first start tag.u non-html-rootu)Unexpected End of file. Expected DOCTYPE.uexpected-doctype-but-got-eofuErroneous DOCTYPE.uunknown-doctypeu2Unexpected non-space characters. Expected DOCTYPE.uexpected-doctype-but-got-charsu2Unexpected start tag (%(name)s). Expected DOCTYPE.u"expected-doctype-but-got-start-tagu0Unexpected end tag (%(name)s). Expected DOCTYPE.u expected-doctype-but-got-end-tagu?Unexpected end tag (%(name)s) after the (implied) root element.uend-tag-after-implied-rootu4Unexpected end of file. Expected end tag (%(name)s).u&expected-named-closing-tag-but-got-eofu4Unexpected start tag head in existing head. Ignored.u!two-heads-are-not-better-than-oneu'Unexpected end tag (%(name)s). Ignored.uunexpected-end-tagu;Unexpected start tag (%(name)s) that can be in head. Moved.u#unexpected-start-tag-out-of-my-headu Unexpected start tag (%(name)s).uunexpected-start-taguMissing end tag (%(name)s).umissing-end-taguMissing end tags (%(name)s).umissing-end-tagsuCUnexpected start tag (%(startName)s) implies end tag (%(endName)s).u$unexpected-start-tag-implies-end-tagu@Unexpected start tag (%(originalName)s). Treated as %(newName)s.uunexpected-start-tag-treated-asu,Unexpected start tag %(name)s. Don't use it!udeprecated-tagu'Unexpected start tag %(name)s. Ignored.uunexpected-start-tag-ignoreduEUnexpected end tag (%(gotName)s). Missing end tag (%(expectedName)s).u$expected-one-end-tag-but-got-anotheru:End tag (%(name)s) seen too early. Expected other end tag.uend-tag-too-earlyuFUnexpected end tag (%(gotName)s). Expected end tag (%(expectedName)s).uend-tag-too-early-namedu+End tag (%(name)s) seen too early. Ignored.uend-tag-too-early-ignoreduQEnd tag (%(name)s) violates step 1, paragraph 1 of the adoption agency algorithm.uadoption-agency-1.1uQEnd tag (%(name)s) violates step 1, paragraph 2 of the adoption agency algorithm.uadoption-agency-1.2uQEnd tag (%(name)s) violates step 1, paragraph 3 of the adoption agency algorithm.uadoption-agency-1.3uQEnd tag (%(name)s) violates step 4, paragraph 4 of the adoption agency algorithm.uadoption-agency-4.4u>Unexpected end tag (%(originalName)s). Treated as %(newName)s.uunexpected-end-tag-treated-asu'This element (%(name)s) has no end tag.u no-end-tagu9Unexpected implied end tag (%(name)s) in the table phase.u#unexpected-implied-end-tag-in-tableu>Unexpected implied end tag (%(name)s) in the table body phase.u(unexpected-implied-end-tag-in-table-bodyuDUnexpected non-space characters in table context caused voodoo mode.u$unexpected-char-implies-table-voodoou3Unexpected input with type hidden in table context.u unexpected-hidden-input-in-tableu!Unexpected form in table context.uunexpected-form-in-tableuDUnexpected start tag (%(name)s) in table context caused voodoo mode.u)unexpected-start-tag-implies-table-voodoouBUnexpected end tag (%(name)s) in table context caused voodoo mode.u'unexpected-end-tag-implies-table-voodoouCUnexpected table cell start tag (%(name)s) in the table body phase.uunexpected-cell-in-table-bodyuFGot table cell end tag (%(name)s) while required end tags are missing.uunexpected-cell-end-tagu?Unexpected end tag (%(name)s) in the table body phase. Ignored.u unexpected-end-tag-in-table-bodyu=Unexpected implied end tag (%(name)s) in the table row phase.u'unexpected-implied-end-tag-in-table-rowu>Unexpected end tag (%(name)s) in the table row phase. Ignored.uunexpected-end-tag-in-table-rowuJUnexpected select start tag in the select phase treated as select end tag.uunexpected-select-in-selectu/Unexpected input start tag in the select phase.uunexpected-input-in-selectuBUnexpected start tag token (%(name)s in the select phase. Ignored.uunexpected-start-tag-in-selectu;Unexpected end tag (%(name)s) in the select phase. Ignored.uunexpected-end-tag-in-selectuKUnexpected table element start tag (%(name)s) in the select in table phase.u5unexpected-table-element-start-tag-in-select-in-tableuIUnexpected table element end tag (%(name)s) in the select in table phase.u3unexpected-table-element-end-tag-in-select-in-tableu8Unexpected non-space characters in the after body phase.uunexpected-char-after-bodyu>Unexpected start tag token (%(name)s) in the after body phase.uunexpected-start-tag-after-bodyu<Unexpected end tag token (%(name)s) in the after body phase.uunexpected-end-tag-after-bodyu@Unexpected characters in the frameset phase. Characters ignored.uunexpected-char-in-framesetuEUnexpected start tag token (%(name)s) in the frameset phase. Ignored.u unexpected-start-tag-in-framesetuFUnexpected end tag token (frameset) in the frameset phase (innerHTML).u)unexpected-frameset-in-frameset-innerhtmluCUnexpected end tag token (%(name)s) in the frameset phase. Ignored.uunexpected-end-tag-in-framesetuEUnexpected non-space characters in the after frameset phase. Ignored.uunexpected-char-after-framesetuEUnexpected start tag (%(name)s) in the after frameset phase. Ignored.u#unexpected-start-tag-after-framesetuCUnexpected end tag (%(name)s) in the after frameset phase. Ignored.u!unexpected-end-tag-after-framesetu(Unexpected end tag after body(innerHtml)u'unexpected-end-tag-after-body-innerhtmlu6Unexpected non-space characters. Expected end of file.uexpected-eof-but-got-charu6Unexpected start tag (%(name)s). Expected end of file.uexpected-eof-but-got-start-tagu4Unexpected end tag (%(name)s). Expected end of file.uexpected-eof-but-got-end-tagu/Unexpected end of file. Expected table content.u eof-in-tableu0Unexpected end of file. Expected select content.u eof-in-selectu2Unexpected end of file. Expected frameset content.ueof-in-framesetu0Unexpected end of file. Expected script content.ueof-in-script-in-scriptu0Unexpected end of file. Expected foreign contentueof-in-foreign-landsu0Trailing solidus not allowed on element %(name)su&non-void-element-with-trailing-solidusu2Element %(name)s not allowed in a non-html contextu*unexpected-html-element-in-foreign-contentu*Unexpected end tag (%(name)s) before html.uunexpected-end-tag-before-htmlu9Element %(name)s not allowed in a inhead-noscript contextuunexpected-inhead-noscript-tagu8Unexpected end of file. Expected inhead-noscript contentueof-in-head-noscriptu@Unexpected non-space character. Expected inhead-noscript contentuchar-in-head-noscriptu0Undefined error (this sucks and should be fixed)uXXX-undefined-erroruhttp://www.w3.org/1999/xhtmluhtmlu"http://www.w3.org/1998/Math/MathMLumathmluhttp://www.w3.org/2000/svgusvguhttp://www.w3.org/1999/xlinkuxlinku$http://www.w3.org/XML/1998/namespaceuxmluhttp://www.w3.org/2000/xmlns/uxmlnsuappletucaptionumarqueeuobjectutableutduthumiumoumnumsumtextuannotation-xmlu foreignObjectudescutitleuaububigucodeuemufontuiunobrususmallustrikeustronguttuuuaddressuareauarticleuasideubaseubasefontubgsoundu blockquoteubodyubrubuttonucenterucolucolgroupucommanduddudetailsudirudivudludtuembedufieldsetufigureufooteruformuframeuframesetuh1uh2uh3uh4uh5uh6uheaduheaderuhruiframeuimageuimguinputuisindexuliulinkulistingumenuumetaunavunoembedunoframesunoscriptuolupuparamu plaintextupreuscriptusectionuselectustyleutbodyutextareautfootutheadutruuluwbruxmpu annotaion-xmlu attributeNameu attributenameu attributeTypeu attributetypeu baseFrequencyu basefrequencyu baseProfileu baseprofileucalcModeucalcmodeu clipPathUnitsu clippathunitsucontentScriptTypeucontentscripttypeucontentStyleTypeucontentstyletypeudiffuseConstantudiffuseconstantuedgeModeuedgemodeuexternalResourcesRequireduexternalresourcesrequiredu filterResu filterresu filterUnitsu filterunitsuglyphRefuglyphrefugradientTransformugradienttransformu gradientUnitsu gradientunitsu kernelMatrixu kernelmatrixukernelUnitLengthukernelunitlengthu keyPointsu keypointsu keySplinesu keysplinesukeyTimesukeytimesu lengthAdjustu lengthadjustulimitingConeAngleulimitingconeangleu markerHeightu markerheightu markerUnitsu markerunitsu markerWidthu markerwidthumaskContentUnitsumaskcontentunitsu maskUnitsu maskunitsu numOctavesu numoctavesu pathLengthu pathlengthupatternContentUnitsupatterncontentunitsupatternTransformupatterntransformu patternUnitsu patternunitsu pointsAtXu pointsatxu pointsAtYu pointsatyu pointsAtZu pointsatzu preserveAlphau preservealphaupreserveAspectRatioupreserveaspectratiouprimitiveUnitsuprimitiveunitsurefXurefxurefYurefyu repeatCountu repeatcountu repeatDuru repeatdururequiredExtensionsurequiredextensionsurequiredFeaturesurequiredfeaturesuspecularConstantuspecularconstantuspecularExponentuspecularexponentu spreadMethodu spreadmethodu startOffsetu startoffsetu stdDeviationu stddeviationu stitchTilesu stitchtilesu surfaceScaleu surfacescaleusystemLanguageusystemlanguageu tableValuesu tablevaluesutargetXutargetxutargetYutargetyu textLengthu textlengthuviewBoxuviewboxu viewTargetu viewtargetuxChannelSelectoruxchannelselectoruyChannelSelectoruychannelselectoru zoomAndPanu zoomandpanu definitionURLu definitionurluactuateu xlink:actuateuarcroleu xlink:arcroleuhrefu xlink:hrefuroleu xlink:roleushowu xlink:showu xlink:titleutypeu xlink:typeuxml:baseulanguxml:languspaceu xml:spaceu xmlns:xlinku u u u u u event-sourceusourceutracku irrelevantuuscopeduismapuautoplayucontrolsuaudiouvideoudeferuasyncuopenumultipleudisabledudatagriduhiddenucheckedudefaultunoshadeu autosubmitureadonlyuselecteduoptionuoptgroupu autofocusurequireduoutputi ii ii i& i i! ii0 i`i9 iRi}i i i i i" i i ii"!iai: iSi~ixult;ugt;uamp;uapos;uquot;uÆuAEliguAElig;u&uAMPuAMP;uÁuAacuteuAacute;uĂuAbreve;uÂuAcircuAcirc;uАuAcy;u𝔄uAfr;uÀuAgraveuAgrave;uΑuAlpha;uĀuAmacr;u⩓uAnd;uĄuAogon;u𝔸uAopf;u⁡uApplyFunction;uÅuAringuAring;u𝒜uAscr;u≔uAssign;uÃuAtildeuAtilde;uÄuAumluAuml;u∖u Backslash;u⫧uBarv;u⌆uBarwed;uБuBcy;u∵uBecause;uℬu Bernoullis;uΒuBeta;u𝔅uBfr;u𝔹uBopf;u˘uBreve;uBscr;u≎uBumpeq;uЧuCHcy;u©uCOPYuCOPY;uĆuCacute;u⋒uCap;uⅅuCapitalDifferentialD;uℭuCayleys;uČuCcaron;uÇuCcediluCcedil;uĈuCcirc;u∰uCconint;uĊuCdot;u¸uCedilla;u·u CenterDot;uCfr;uΧuChi;u⊙u CircleDot;u⊖u CircleMinus;u⊕u CirclePlus;u⊗u CircleTimes;u∲uClockwiseContourIntegral;u”uCloseCurlyDoubleQuote;u’uCloseCurlyQuote;u∷uColon;u⩴uColone;u≡u Congruent;u∯uConint;u∮uContourIntegral;uℂuCopf;u∐u Coproduct;u∳u CounterClockwiseContourIntegral;u⨯uCross;u𝒞uCscr;u⋓uCup;u≍uCupCap;uDD;u⤑u DDotrahd;uЂuDJcy;uЅuDScy;uЏuDZcy;u‡uDagger;u↡uDarr;u⫤uDashv;uĎuDcaron;uДuDcy;u∇uDel;uΔuDelta;u𝔇uDfr;u´uDiacriticalAcute;u˙uDiacriticalDot;u˝uDiacriticalDoubleAcute;u`uDiacriticalGrave;u˜uDiacriticalTilde;u⋄uDiamond;uⅆuDifferentialD;u𝔻uDopf;u¨uDot;u⃜uDotDot;u≐u DotEqual;uDoubleContourIntegral;u DoubleDot;u⇓uDoubleDownArrow;u⇐uDoubleLeftArrow;u⇔uDoubleLeftRightArrow;uDoubleLeftTee;u⟸uDoubleLongLeftArrow;u⟺uDoubleLongLeftRightArrow;u⟹uDoubleLongRightArrow;u⇒uDoubleRightArrow;u⊨uDoubleRightTee;u⇑uDoubleUpArrow;u⇕uDoubleUpDownArrow;u∥uDoubleVerticalBar;u↓u DownArrow;u⤓u DownArrowBar;u⇵uDownArrowUpArrow;ȗu DownBreve;u⥐uDownLeftRightVector;u⥞uDownLeftTeeVector;u↽uDownLeftVector;u⥖uDownLeftVectorBar;u⥟uDownRightTeeVector;u⇁uDownRightVector;u⥗uDownRightVectorBar;u⊤uDownTee;u↧u DownTeeArrow;u Downarrow;u𝒟uDscr;uĐuDstrok;uŊuENG;uÐuETHuETH;uÉuEacuteuEacute;uĚuEcaron;uÊuEcircuEcirc;uЭuEcy;uĖuEdot;u𝔈uEfr;uÈuEgraveuEgrave;u∈uElement;uĒuEmacr;u◻uEmptySmallSquare;u▫uEmptyVerySmallSquare;uĘuEogon;u𝔼uEopf;uΕuEpsilon;u⩵uEqual;u≂u EqualTilde;u⇌u Equilibrium;uℰuEscr;u⩳uEsim;uΗuEta;uËuEumluEuml;u∃uExists;uⅇu ExponentialE;uФuFcy;u𝔉uFfr;u◼uFilledSmallSquare;u▪uFilledVerySmallSquare;u𝔽uFopf;u∀uForAll;uℱu Fouriertrf;uFscr;uЃuGJcy;u>uGTuGT;uΓuGamma;uϜuGammad;uĞuGbreve;uĢuGcedil;uĜuGcirc;uГuGcy;uĠuGdot;u𝔊uGfr;u⋙uGg;u𝔾uGopf;u≥u GreaterEqual;u⋛uGreaterEqualLess;u≧uGreaterFullEqual;u⪢uGreaterGreater;u≷u GreaterLess;u⩾uGreaterSlantEqual;u≳u GreaterTilde;u𝒢uGscr;u≫uGt;uЪuHARDcy;uˇuHacek;u^uHat;uĤuHcirc;uℌuHfr;uℋu HilbertSpace;uℍuHopf;u─uHorizontalLine;uHscr;uĦuHstrok;u HumpDownHump;u≏u HumpEqual;uЕuIEcy;uIJuIJlig;uЁuIOcy;uÍuIacuteuIacute;uÎuIcircuIcirc;uИuIcy;uİuIdot;uℑuIfr;uÌuIgraveuIgrave;uIm;uĪuImacr;uⅈu ImaginaryI;uImplies;u∬uInt;u∫u Integral;u⋂u Intersection;u⁣uInvisibleComma;u⁢uInvisibleTimes;uĮuIogon;u𝕀uIopf;uΙuIota;uℐuIscr;uĨuItilde;uІuIukcy;uÏuIumluIuml;uĴuJcirc;uЙuJcy;u𝔍uJfr;u𝕁uJopf;u𝒥uJscr;uЈuJsercy;uЄuJukcy;uХuKHcy;uЌuKJcy;uΚuKappa;uĶuKcedil;uКuKcy;u𝔎uKfr;u𝕂uKopf;u𝒦uKscr;uЉuLJcy;u⃒unvgt;u⧞unvinfin;u⤂unvlArr;u≤⃒unvle;u<⃒unvlt;u⊴⃒unvltrie;u⤃unvrArr;u⊵⃒unvrtrie;u∼⃒unvsim;u⇖unwArr;u⤣unwarhk;unwarr;unwarrow;u⤧unwnear;uoS;uóuoacuteuoacute;uoast;uocir;uôuocircuocirc;uоuocy;uodash;uőuodblac;u⨸uodiv;uodot;u⦼uodsold;uœuoelig;u⦿uofcir;u𝔬uofr;u˛uogon;uòuograveuograve;u⧁uogt;u⦵uohbar;uohm;uoint;uolarr;u⦾uolcir;u⦻uolcross;uoline;u⧀uolt;uōuomacr;uωuomega;uοuomicron;u⦶uomid;uominus;u𝕠uoopf;u⦷uopar;u⦹uoperp;uoplus;u∨uor;uorarr;u⩝uord;uℴuorder;uorderof;uªuordfuordf;uºuordmuordm;u⊶uorigof;u⩖uoror;u⩗uorslope;u⩛uorv;uoscr;uøuoslashuoslash;u⊘uosol;uõuotildeuotilde;uotimes;u⨶u otimesas;uöuoumluouml;u⌽uovbar;upar;u¶uparaupara;u parallel;u⫳uparsim;u⫽uparsl;upart;uпupcy;u%upercnt;u.uperiod;u‰upermil;uperp;u‱upertenk;u𝔭upfr;uφuphi;uϕuphiv;uphmmat;u☎uphone;uπupi;u pitchfork;uϖupiv;uplanck;uℎuplanckh;uplankv;u+uplus;u⨣u plusacir;uplusb;u⨢upluscir;uplusdo;u⨥uplusdu;u⩲upluse;uplusmnuplusmn;u⨦uplussim;u⨧uplustwo;upm;u⨕u pointint;u𝕡upopf;u£upoundupound;upr;u⪳uprE;u⪷uprap;uprcue;upre;uprec;u precapprox;u preccurlyeq;upreceq;u⪹u precnapprox;u⪵u precneqq;u⋨u precnsim;uprecsim;u′uprime;uprimes;uprnE;uprnap;uprnsim;uprod;u⌮u profalar;u⌒u profline;u⌓u profsurf;uprop;upropto;uprsim;u⊰uprurel;u𝓅upscr;uψupsi;u upuncsp;u𝔮uqfr;uqint;u𝕢uqopf;u⁗uqprime;u𝓆uqscr;u quaternions;u⨖uquatint;u?uquest;uquesteq;uquoturAarr;urArr;u⤜urAtail;urBarr;u⥤urHar;u∽̱urace;uŕuracute;uradic;u⦳u raemptyv;urang;u⦒urangd;u⦥urange;urangle;u»uraquouraquo;urarr;u⥵urarrap;urarrb;u⤠urarrbfs;u⤳urarrc;u⤞urarrfs;urarrhk;urarrlp;u⥅urarrpl;u⥴urarrsim;u↣urarrtl;u↝urarrw;u⤚uratail;u∶uratio;u rationals;urbarr;u❳urbbrk;u}urbrace;u]urbrack;u⦌urbrke;u⦎urbrksld;u⦐urbrkslu;uřurcaron;uŗurcedil;urceil;urcub;uрurcy;u⤷urdca;u⥩urdldhar;urdquo;urdquor;u↳urdsh;ureal;urealine;u realpart;ureals;u▭urect;uregureg;u⥽urfisht;urfloor;u𝔯urfr;urhard;urharu;u⥬urharul;uρurho;uϱurhov;u rightarrow;urightarrowtail;urightharpoondown;urightharpoonup;urightleftarrows;urightleftharpoons;u⇉urightrightarrows;urightsquigarrow;u⋌urightthreetimes;u˚uring;u risingdotseq;urlarr;urlhar;u‏urlm;u⎱urmoust;u rmoustache;u⫮urnmid;u⟭uroang;u⇾uroarr;urobrk;u⦆uropar;u𝕣uropf;u⨮uroplus;u⨵urotimes;u)urpar;u⦔urpargt;u⨒u rppolint;urrarr;u›ursaquo;u𝓇urscr;ursh;ursqb;ursquo;ursquor;urthree;u⋊urtimes;u▹urtri;urtrie;urtrif;u⧎u rtriltri;u⥨uruluhar;u℞urx;uśusacute;usbquo;usc;u⪴uscE;u⪸uscap;ušuscaron;usccue;usce;uşuscedil;uŝuscirc;u⪶uscnE;u⪺uscnap;u⋩uscnsim;u⨓u scpolint;uscsim;uсuscy;u⋅usdot;usdotb;u⩦usdote;u⇘useArr;usearhk;usearr;usearrow;u§usectusect;u;usemi;u⤩useswar;u setminus;usetmn;u✶usext;u𝔰usfr;usfrown;u♯usharp;uщushchcy;uшushcy;u shortmid;ushortparallel;u­ushyushy;uσusigma;uςusigmaf;usigmav;usim;u⩪usimdot;usime;usimeq;u⪞usimg;u⪠usimgE;u⪝usiml;u⪟usimlE;u≆usimne;u⨤usimplus;u⥲usimrarr;uslarr;usmallsetminus;u⨳usmashp;u⧤u smeparsl;usmid;u⌣usmile;u⪪usmt;u⪬usmte;u⪬︀usmtes;uьusoftcy;u/usol;u⧄usolb;u⌿usolbar;u𝕤usopf;u♠uspades;u spadesuit;uspar;usqcap;u⊓︀usqcaps;usqcup;u⊔︀usqcups;usqsub;usqsube;u sqsubset;u sqsubseteq;usqsup;usqsupe;u sqsupset;u sqsupseteq;usqu;usquare;usquarf;usquf;usrarr;u𝓈usscr;ussetmn;ussmile;usstarf;u☆ustar;ustarf;ustraightepsilon;u straightphi;ustrns;u⊂usub;u⫅usubE;u⪽usubdot;usube;u⫃usubedot;u⫁usubmult;u⫋usubnE;u⊊usubne;u⪿usubplus;u⥹usubrarr;usubset;u subseteq;u subseteqq;u subsetneq;u subsetneqq;u⫇usubsim;u⫕usubsub;u⫓usubsup;usucc;u succapprox;u succcurlyeq;usucceq;u succnapprox;u succneqq;u succnsim;usuccsim;usum;u♪usung;u¹usup1usup1;u²usup2usup2;u³usup3usup3;usup;u⫆usupE;u⪾usupdot;u⫘usupdsub;usupe;u⫄usupedot;u⟉usuphsol;u⫗usuphsub;u⥻usuplarr;u⫂usupmult;u⫌usupnE;u⊋usupne;u⫀usupplus;usupset;u supseteq;u supseteqq;u supsetneq;u supsetneqq;u⫈usupsim;u⫔usupsub;u⫖usupsup;u⇙uswArr;uswarhk;uswarr;uswarrow;u⤪uswnwar;ußuszliguszlig;u⌖utarget;uτutau;utbrk;uťutcaron;uţutcedil;uтutcy;utdot;u⌕utelrec;u𝔱utfr;uthere4;u therefore;uθutheta;uϑu thetasym;uthetav;u thickapprox;u thicksim;uthinsp;uthkap;uthksim;uþuthornuthorn;utilde;u×utimesutimes;utimesb;u⨱u timesbar;u⨰utimesd;utint;utoea;utop;u⌶utopbot;u⫱utopcir;u𝕥utopf;u⫚utopfork;utosa;u‴utprime;utrade;u▵u triangle;u triangledown;u triangleleft;utrianglelefteq;u≜u triangleq;utriangleright;utrianglerighteq;u◬utridot;utrie;u⨺u triminus;u⨹utriplus;u⧍utrisb;u⨻utritime;u⏢u trpezium;u𝓉utscr;uцutscy;uћutshcy;uŧutstrok;utwixt;utwoheadleftarrow;utwoheadrightarrow;uuArr;u⥣uuHar;uúuuacuteuuacute;uuarr;uўuubrcy;uŭuubreve;uûuucircuucirc;uуuucy;uudarr;uűuudblac;uudhar;u⥾uufisht;u𝔲uufr;uùuugraveuugrave;uuharl;uuharr;u▀uuhblk;u⌜uulcorn;u ulcorner;u⌏uulcrop;u◸uultri;uūuumacr;uumluuml;uųuuogon;u𝕦uuopf;uuparrow;u updownarrow;uupharpoonleft;uupharpoonright;uuplus;uυuupsi;uupsih;uupsilon;u⇈u upuparrows;u⌝uurcorn;u urcorner;u⌎uurcrop;uůuuring;u◹uurtri;u𝓊uuscr;u⋰uutdot;uũuutilde;uutri;uutrif;uuuarr;uüuuumluuuml;u⦧uuwangle;uvArr;u⫨uvBar;u⫩uvBarv;uvDash;u⦜uvangrt;u varepsilon;u varkappa;u varnothing;uvarphi;uvarpi;u varpropto;uvarr;uvarrho;u varsigma;u⊊︀u varsubsetneq;u⫋︀uvarsubsetneqq;u⊋︀u varsupsetneq;u⫌︀uvarsupsetneqq;u vartheta;uvartriangleleft;uvartriangleright;uвuvcy;uvdash;uvee;u⊻uveebar;u≚uveeeq;u⋮uvellip;uverbar;uvert;u𝔳uvfr;uvltri;uvnsub;uvnsup;u𝕧uvopf;uvprop;uvrtri;u𝓋uvscr;uvsubnE;uvsubne;uvsupnE;uvsupne;u⦚uvzigzag;uŵuwcirc;u⩟uwedbar;uwedge;u≙uwedgeq;u℘uweierp;u𝔴uwfr;u𝕨uwopf;uwp;uwr;uwreath;u𝓌uwscr;uxcap;uxcirc;uxcup;uxdtri;u𝔵uxfr;uxhArr;uxharr;uξuxi;uxlArr;uxlarr;uxmap;u⋻uxnis;uxodot;u𝕩uxopf;uxoplus;uxotime;uxrArr;uxrarr;u𝓍uxscr;uxsqcup;uxuplus;uxutri;uxvee;uxwedge;uýuyacuteuyacute;uяuyacy;uŷuycirc;uыuycy;u¥uyenuyen;u𝔶uyfr;uїuyicy;u𝕪uyopf;u𝓎uyscr;uюuyucy;uÿuyumluyuml;uźuzacute;užuzcaron;uзuzcy;użuzdot;uzeetrf;uζuzeta;u𝔷uzfr;uжuzhcy;u⇝uzigrarr;u𝕫uzopf;u𝓏uzscr;u‍uzwj;u‌uzwnj;u�i iuiiiiiiiiiiiiuiiuiuiiiiiiiiiiiiiuiiiuDoctypeiu CharactersiuSpaceCharactersiuStartTagiuEndTagiuEmptyTagiuCommentiu ParseErrorumathtDataLossWarningcB`seZRS((t__name__t __module__(((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/constants.pyR| stReparseExceptioncB`seZRS((RR(((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/constants.pyR s(uh1uh2uh3uh4uh5uh6( i ii ii i& i i! ii0 i`i9 iRii}iii i i i i" i i ii"!iai: iSii~ix(:t __future__RRRtstringtNonetEOFtEt namespacest frozensettscopingElementstformattingElementstspecialElementsthtmlIntegrationPointElementst"mathmlTextIntegrationPointElementstadjustSVGAttributestadjustMathMLAttributestadjustForeignAttributestdicttitemstqnametprefixtlocaltnstunadjustForeignAttributestspaceCharactersttableInsertModeElementstascii_lowercasetasciiLowercasetascii_uppercasetasciiUppercaset ascii_letterst asciiLetterstdigitst hexdigitst hexDigitstctordtlowertasciiUpper2LowertheadingElementst voidElementst cdataElementstrcdataElementstbooleanAttributestentitiesWindows1252t xmlEntitiestentitiestreplacementCharacterst tokenTypest tagTokenTypestktvtprefixest UserWarningRt ExceptionR(((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/constants.pytsL                                                                                                                      :  4     1 site-packages/pip/_vendor/html5lib/constants.pyo000064400000242000147204247350016003 0ustar00 abcP@`sNddlmZmZmZddlZdZidd6dd6dd6d d 6d d 6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d'd(6d)d*6d+d,6d-d.6d/d06d1d26d3d46d5d66d7d86d9d:6d;d<6d=d>6d?d@6dAdB6dCdD6dEdF6dGdH6dIdJ6dKdL6dMdN6dOdP6dQdR6dSdT6dUdV6dWdX6dYdZ6d[d\6dUd]6dUd^6d_d`6dadb6dcdd6dedf6dgdh6didj6dkdl6dmdn6dodp6dqdr6dsdt6dudv6dwdx6dydz6d{d|6d}d~6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6Zidd6dd6d d 6d d 6d d6dd6Ze eddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfed dfed dfed d fgZ e edd!fedd"fedd#fedd$fedd%fedd&fedd'fedd(fedd)fedd*fedd+fedd,fedd-fedd.fgZ e edd/feddfedd0fedd1fedd2fedd3fedd4fedd5fedd6fedd7fedd8fedd9feddfedd:fedd;fedd<fedd=fedd>fedd?fedd@feddAfeddBfeddCfeddDfeddEfeddFfeddGfeddHfeddIfeddJfeddKfeddLfeddMfeddNfeddOfeddPfeddQfeddRfeddSfeddfeddTfeddUfeddVfeddWfeddXfeddYfeddZfedd[feddfedd\fedd]fedd^fedd_fedd`feddafeddfeddbfeddcfedddfeddefeddffeddgfeddhfeddifeddjfeddfeddkfeddfeddlfeddmfeddfeddnfedd feddofeddpfeddqfeddrfed dfgNZ e eddsfed dfed dfed d fgZ e eddfeddfeddfeddfeddfgZi>dtdu6dvdw6dxdy6dzd{6d|d}6d~d6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6Zidd6Zi d ded fd6d ded fd6d ded fd6d ded fd6d ded fd6d d ed fd6d ded fd6dd3edfd6ddedfd6ddedfd6ddedfd6dd edfd6ZegejD]'\Z\ZZZeefef^q Ze ddddd gZe ddkdmdndogZe ejZe ejZe ejZ e ej!Z!e ej"Z#egejD]$Z$e%e$e%e$j&f^q Z'dZ(e d3d=d dZd]dSd8dVdDddd0d;dWd d gZ)e d dlgZ*e djdgdrdTd_d`dagZ+ie d gd6e dgdj6e dgdV6e ddgd6e ddgd6e ddgdg6e dgd?6e ddgd6e ddddgd=6e dgdS6e dgd\6e dd gdE6e dd d!gd"6e dd gd#6e dd$gd96e dd d%d$ddgdW6e dd d$dgdi6e dd gd&6Z,dZ-e dCdDdEdFdGgZ.idHdI6dHdJ6dKdL6dKdM6dNdO6dNdP6dQdR6dSdT6dSdU6dVdW6dXdY6dZd[6dZd\6d]d^6d_d`6dadb6dcdd6dedf6dgdh6didj6didk6dldm6dndo6dpdq6dpdr6dsdt6dsdu6dvdw6dxdy6dzd{6d|d}6d~d6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6d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dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6d?d6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6d5d6dd 6dd 6dd 6d d 6d d 6dd 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dd 6dd 6d d 6d d! 6d" d# 6d$ d% 6dzd& 6dd' 6dd( 6d5d) 6dd* 6d~d+ 6d, d- 6d. d/ 6d0 d1 6d2 d3 6d4 d5 6d6 d7 6d8 d9 6d: d; 6dd< 6dd= 6dd> 6d? d@ 6dA dB 6dC dD 6ddE 6d dF 6dG dH 6dG dI 6dJ dK 6dL dM 6dN dO 6dP dQ 6dP dR 6dS dT 6dU dV 6dW dX 6dndY 6dZ d[ 6d\ d] 6d^ d_ 6d` da 6d` db 6dc dd 6de df 6dg dh 6di dj 6dk dl 6dm dn 6do dp 6dq dr 6ds dt 6ds du 6ds dv 6dw dx 6dy dz 6d{ d| 6d} d~ 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dN d 6dS d 6d_d 6dc d 6dm d 6d d 6d d 6dd 6d d 6d d 6d d 6d d 6d d 6dd 6d_d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dld 6dcd 6dnd 6dZ d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dzd 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dd 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dd 6dd 6dd 6dd 6dd 6dd 6d d 6d d 6d d 6d d 6d d 6d d! 6d" d# 6dd$ 6dd% 6d& d' 6d( d) 6dd* 6d+ d, 6d- d. 6d/ d0 6d1 d2 6d3 d4 6d3 d5 6d6 d7 6d6 d8 6d1 d9 6d: d; 6d< d= 6dd> 6d? d@ 6ddA 6dB dC 6dD dE 6ddF 6ddD6dG dH 6dI dJ 6dK dL 6dM dN 6dO dP 6d dQ 6dR dS 6dK dT 6ddU 6d dV 6ddW 6ddX 6dY dZ 6dY d[ 6dd\ 6dd] 6d d^ 6dd_ 6d` da 6d;db 6dc dd 6de df 6dg dh 6di dj 6dk dl 6dk dm 6dn do 6dp dq 6dr ds 6dt du 6dv dw 6dx dy 6dz d{ 6d| d} 6d~ d 6d d 6d d 6d d 6dg d 6d d 6d d 6dd 6d d 6d d 6dd 6d d 6d d 6d d 6d d 6d d 6d d 6dd 6d d 6d d 6d d 6dd 6d d 6d d 6d d 6d d 6d d 6d d 6dd 6dd 6dd 6d d 6d d 6d d 6dOd 6d d 6d d 6d d 6d d 6dd 6d d 6dd 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dOd 6d d 6d d 6d d 6d d 6dOd 6dd 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6did 6dd 6d d 6d d 6d[d 6d d 6d d 6d d 6d d 6dd 6d d 6d'd 6d d 6d'd 6d! d" 6d# d$ 6d# d% 6d)d& 6d+d' 6d( d) 6d* d+ 6d| d, 6d- d. 6d/ d0 6d1 d2 6d3 d4 6d5 d6 6d7 d8 6d9 d: 6d; d< 6d= d> 6d? d@ 6dA dB 6dC dD 6dE dF 6dG dH 6dI dJ 6dK dL 6dM dN 6d/dO 6dA dP 6dQ dR 6dS dT 6d6dU 6dydV 6dW dX 6dY dZ 6d[ d\ 6d] d^ 6d)d_ 6d3 d` 6d&da 6dSdb 6dc dd 6d;de 6d-df 6ddg 6de dh 6di dj 6dYdk 6d] dl 6d[dm 6dadn 6dado 6dp dq 6dr ds 6dt du 6dv dw 6dx dy 6dz d{ 6d! d| 6d} d~ 6dYd 6d d 6d]d 6dcd 6d d 6d9d 6d d 6d]d 6d d 6d&d 6dSd 6d d 6d d 6d d 6dd 6dc d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d1d 6dmd 6dod 6d d 6dqd 6d- d 6d d 6d d 6d d 6d d 6d d 6d d 6ddd 6d d 6d d 6dd 6d d 6d d 6d-d 6d, d 6dd 6d d 6d d 6d d 6d d 6d d 6d}d 6dcd 6d d 6d d 6dC d 6d8d 6d d 6d d 6dd 6ddC6d d 6d d 6d} d 6di d 6d d 6d d 6d d 6d d 6d d 6dId 6dd 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dd 6dd 6d2d 6dAd 6dd 6d d 6d d 6d d 6d d 6d#d 6d d 6d d 6d d 6d d 6dd 6dUd 6d d 6dd 6dd! 6d" d# 6dd$ 6d d% 6d& d' 6d( d) 6dn d* 6dd+ 6d, d- 6d. d/ 6dd0 6d1 d2 6dd3 6d4 d5 6d6 d7 6d6 d8 6d9 d: 6d; d< 6dd= 6d> d? 6d@ dA 6dB dC 6dD dE 6ddF 6dG dH 6dI dJ 6dK dL 6ddM 6dN dO 6dP dQ 6ddR 6dS dT 6dU dV 6dW dX 6ddY 6dZ d[ 6dZ d\ 6dd] 6dd^ 6dd_ 6dd` 6dda 6db dc 6dd de 6df dg 6ddh 6di dj 6dk dl 6dm dn 6do dp 6ddq 6dr ds 6dt du 6ddv 6ddw 6dx dy 6ddz 6d{ d| 6dd} 6dd~ 6dd 6d d 6dd 6dd 6dd 6dd 6dd 6dd 6dd 6dd 6dd 6d@ d 6d d 6d d 6dd 6d d 6d d 6dd 6d d 6d> d 6d d 6d d 6d d 6dd 6d d 6d d 6dd 6d d 6dd 6dd 6dd 6dd 6dd 6dd 6dd 6dd 6d d 6d d 6d d 6dd 6d d 6d d 6dd 6d d 6d d 6dd 6dd 6d d 6d d 6dd 6dd 6d d 6d d 6d d 6dd 6dd 6dd 6dd 6dd 6dG d 6d d 6d d 6d d 6d d 6dd 6dd 6dd 6dd 6dd 6d d 6dd 6dd 6d d 6dd 6dd 6dd 6dd 6dd 6dd 6d d 6d d 6dd 6dd 6dd 6d d 6dd 6dd 6d d 6d d 6d d 6dd 6d d 6d d 6dd 6d d 6d d 6dd 6dd 6dd 6dd 6dd 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d! d" 6d# d$ 6d% d& 6d' d( 6dd) 6dd* 6d+ d, 6drd- 6d. d/ 6d. d0 6dtd1 6dvd2 6d3 d4 6d3 d5 6d6 d7 6dxd8 6d9 d: 6d; d< 6dd= 6d> d? 6d@ dA 6dB dC 6dD dE 6dF dG 6dH dI 6dH dJ 6dK dL 6dM dN 6d0dO 6ddP 6dmdQ 6dR dS 6dT dU 6dIdV 6dW dX 6dY dZ 6d[ d\ 6d] d^ 6d_ d` 6dda 6db dc 6dd de 6df dg 6ddh 6di dj 6dodk 6dl dm 6dn do 6dn dp 6dq dr 6dq ds 6dt du 6dt dv 6dw dx 6dy dz 6d{ d| 6d} d~ 6dn d 6d d 6d d 6d d 6d d 6d d 6dd 6d d 6d d 6d d 6d d 6dd 6d d 6d d 6dd 6d d 6d d 6dQd 6d d 6d d 6d d 6d d 6d}d 6d d 6d d 6d d 6d d 6dd 6d d 6d d 6d d 6d d 6dg d 6d d 6dg d 6d d 6d d 6dd 6d d 6d" d 6d d 6d d 6d[d 6d[d 6d d 6d d 6d[d 6d d 6d d 6d d 6d d 6dbd 6d d 6d d 6dfd 6ddd 6dbd 6d d 6dfd 6ddd 6d d 6d d 6d d 6dhd 6d d 6d^d 6d d 6d d 6d d 6dld 6d d 6d d 6d d 6dod 6dod 6dhd 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6dd6dd6dd6dd6dd6d d 6dud 6dudG6dd 6dd 6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd 6dd!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6dd6dd6dd6dd6dd6d d6d{ d6d0d6dd6dd6dd6dd6dd6dd6d"d6dd6d: d6d d6dId6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dwd6dd6d{d6d d 6d d 6d d6d d6dOd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6dd#6dyd$6dOd%6dd&6dnd'6d(d)6dd*6d(d+6d,d-6d.d/6d.d06d1d26d3d46d5d66d7d86d9d:6d;d<6dd=6dd>6d,d?6d@dA6d@dB6dCdD6ddE6dFdG6dHdI6ddJ6dKdL6d dM6d dN6ds dO6d dP6d dQ6dodR6dydS6dkdT6ddU6dVdW6dXdY6dZd[6d\d]6dd^6dEd_6dd`6dadb6ddc6di dd6dedf6dgdh6didj6ddk6ddl6dmdn6dEdo6ddp6ddq6drds6dodt6ddu6dvdw6dXdx6dVdy6d\dz6dZd{6d|d}6d~d6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dld6dd6dd6d d6dod6dd6d d6dmd6d d6dd6dd6dd6dd6dd6dd6dqd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6Z/i"dd6d d6d d6dd6d d6d d6dyd6dn d6dd6dd6did6d d6dd6d d6dd6dd6dd6dd6dd6d8d6dd6d6d6dd6d*d6do d6d d6dd6d"d6dd6dd6d@ d6dd6dd6dd6Z0idd6dd6d d 6d d 6d d6dd6dd6dd6Z1e e1d e1de1dgZ2egejD]\Z3Z4e4e3f^qDNZ5de5d' instead.u'expected-tag-name-but-got-right-bracketuSExpected tag name. Got '?' instead. (HTML doesn't support processing instructions.)u'expected-tag-name-but-got-question-marku-Expected tag name. Got something else insteaduexpected-tag-nameu6Expected closing tag. Got '>' instead. Ignoring ''.u*expected-closing-tag-but-got-right-bracketu-Expected closing tag. Unexpected end of file.u expected-closing-tag-but-got-eofu<Expected closing tag. Unexpected character '%(data)s' found.u!expected-closing-tag-but-got-charu'Unexpected end of file in the tag name.ueof-in-tag-nameu8Unexpected end of file. Expected attribute name instead.u#expected-attribute-name-but-got-eofu)Unexpected end of file in attribute name.ueof-in-attribute-nameu#Invalid character in attribute nameu#invalid-character-in-attribute-nameu#Dropped duplicate attribute on tag.uduplicate-attributeu1Unexpected end of file. Expected = or end of tag.u$expected-end-of-tag-name-but-got-eofu1Unexpected end of file. Expected attribute value.u$expected-attribute-value-but-got-eofu*Expected attribute value. Got '>' instead.u.expected-attribute-value-but-got-right-bracketu"Unexpected = in unquoted attributeu"equals-in-unquoted-attribute-valueu*Unexpected character in unquoted attributeu0unexpected-character-in-unquoted-attribute-valueu*Unexpected character after attribute name.u&invalid-character-after-attribute-nameu+Unexpected character after attribute value.u*unexpected-character-after-attribute-valueu.Unexpected end of file in attribute value (").u#eof-in-attribute-value-double-quoteu.Unexpected end of file in attribute value (').u#eof-in-attribute-value-single-quoteu*Unexpected end of file in attribute value.u eof-in-attribute-value-no-quotesu)Unexpected end of file in tag. Expected >u#unexpected-EOF-after-solidus-in-tagu/Unexpected character after / in tag. Expected >u)unexpected-character-after-solidus-in-tagu&Expected '--' or 'DOCTYPE'. Not found.uexpected-dashes-or-doctypeu Unexpected ! after -- in commentu,unexpected-bang-after-double-dash-in-commentu$Unexpected space after -- in commentu-unexpected-space-after-double-dash-in-commentuIncorrect comment.uincorrect-commentu"Unexpected end of file in comment.ueof-in-commentu%Unexpected end of file in comment (-)ueof-in-comment-end-dashu+Unexpected '-' after '--' found in comment.u,unexpected-dash-after-double-dash-in-commentu'Unexpected end of file in comment (--).ueof-in-comment-double-dashueof-in-comment-end-space-stateueof-in-comment-end-bang-stateu&Unexpected character in comment found.uunexpected-char-in-commentu(No space after literal string 'DOCTYPE'.uneed-space-after-doctypeu.Unexpected > character. Expected DOCTYPE name.u+expected-doctype-name-but-got-right-bracketu.Unexpected end of file. Expected DOCTYPE name.u!expected-doctype-name-but-got-eofu'Unexpected end of file in DOCTYPE name.ueof-in-doctype-nameu"Unexpected end of file in DOCTYPE.ueof-in-doctypeu%Expected space or '>'. Got '%(data)s'u*expected-space-or-right-bracket-in-doctypeuUnexpected end of DOCTYPE.uunexpected-end-of-doctypeu Unexpected character in DOCTYPE.uunexpected-char-in-doctypeuXXX innerHTML EOFueof-in-innerhtmluUnexpected DOCTYPE. Ignored.uunexpected-doctypeu%html needs to be the first start tag.u non-html-rootu)Unexpected End of file. Expected DOCTYPE.uexpected-doctype-but-got-eofuErroneous DOCTYPE.uunknown-doctypeu2Unexpected non-space characters. Expected DOCTYPE.uexpected-doctype-but-got-charsu2Unexpected start tag (%(name)s). Expected DOCTYPE.u"expected-doctype-but-got-start-tagu0Unexpected end tag (%(name)s). Expected DOCTYPE.u expected-doctype-but-got-end-tagu?Unexpected end tag (%(name)s) after the (implied) root element.uend-tag-after-implied-rootu4Unexpected end of file. Expected end tag (%(name)s).u&expected-named-closing-tag-but-got-eofu4Unexpected start tag head in existing head. Ignored.u!two-heads-are-not-better-than-oneu'Unexpected end tag (%(name)s). Ignored.uunexpected-end-tagu;Unexpected start tag (%(name)s) that can be in head. Moved.u#unexpected-start-tag-out-of-my-headu Unexpected start tag (%(name)s).uunexpected-start-taguMissing end tag (%(name)s).umissing-end-taguMissing end tags (%(name)s).umissing-end-tagsuCUnexpected start tag (%(startName)s) implies end tag (%(endName)s).u$unexpected-start-tag-implies-end-tagu@Unexpected start tag (%(originalName)s). Treated as %(newName)s.uunexpected-start-tag-treated-asu,Unexpected start tag %(name)s. Don't use it!udeprecated-tagu'Unexpected start tag %(name)s. Ignored.uunexpected-start-tag-ignoreduEUnexpected end tag (%(gotName)s). Missing end tag (%(expectedName)s).u$expected-one-end-tag-but-got-anotheru:End tag (%(name)s) seen too early. Expected other end tag.uend-tag-too-earlyuFUnexpected end tag (%(gotName)s). Expected end tag (%(expectedName)s).uend-tag-too-early-namedu+End tag (%(name)s) seen too early. Ignored.uend-tag-too-early-ignoreduQEnd tag (%(name)s) violates step 1, paragraph 1 of the adoption agency algorithm.uadoption-agency-1.1uQEnd tag (%(name)s) violates step 1, paragraph 2 of the adoption agency algorithm.uadoption-agency-1.2uQEnd tag (%(name)s) violates step 1, paragraph 3 of the adoption agency algorithm.uadoption-agency-1.3uQEnd tag (%(name)s) violates step 4, paragraph 4 of the adoption agency algorithm.uadoption-agency-4.4u>Unexpected end tag (%(originalName)s). Treated as %(newName)s.uunexpected-end-tag-treated-asu'This element (%(name)s) has no end tag.u no-end-tagu9Unexpected implied end tag (%(name)s) in the table phase.u#unexpected-implied-end-tag-in-tableu>Unexpected implied end tag (%(name)s) in the table body phase.u(unexpected-implied-end-tag-in-table-bodyuDUnexpected non-space characters in table context caused voodoo mode.u$unexpected-char-implies-table-voodoou3Unexpected input with type hidden in table context.u unexpected-hidden-input-in-tableu!Unexpected form in table context.uunexpected-form-in-tableuDUnexpected start tag (%(name)s) in table context caused voodoo mode.u)unexpected-start-tag-implies-table-voodoouBUnexpected end tag (%(name)s) in table context caused voodoo mode.u'unexpected-end-tag-implies-table-voodoouCUnexpected table cell start tag (%(name)s) in the table body phase.uunexpected-cell-in-table-bodyuFGot table cell end tag (%(name)s) while required end tags are missing.uunexpected-cell-end-tagu?Unexpected end tag (%(name)s) in the table body phase. Ignored.u unexpected-end-tag-in-table-bodyu=Unexpected implied end tag (%(name)s) in the table row phase.u'unexpected-implied-end-tag-in-table-rowu>Unexpected end tag (%(name)s) in the table row phase. Ignored.uunexpected-end-tag-in-table-rowuJUnexpected select start tag in the select phase treated as select end tag.uunexpected-select-in-selectu/Unexpected input start tag in the select phase.uunexpected-input-in-selectuBUnexpected start tag token (%(name)s in the select phase. Ignored.uunexpected-start-tag-in-selectu;Unexpected end tag (%(name)s) in the select phase. Ignored.uunexpected-end-tag-in-selectuKUnexpected table element start tag (%(name)s) in the select in table phase.u5unexpected-table-element-start-tag-in-select-in-tableuIUnexpected table element end tag (%(name)s) in the select in table phase.u3unexpected-table-element-end-tag-in-select-in-tableu8Unexpected non-space characters in the after body phase.uunexpected-char-after-bodyu>Unexpected start tag token (%(name)s) in the after body phase.uunexpected-start-tag-after-bodyu<Unexpected end tag token (%(name)s) in the after body phase.uunexpected-end-tag-after-bodyu@Unexpected characters in the frameset phase. Characters ignored.uunexpected-char-in-framesetuEUnexpected start tag token (%(name)s) in the frameset phase. Ignored.u unexpected-start-tag-in-framesetuFUnexpected end tag token (frameset) in the frameset phase (innerHTML).u)unexpected-frameset-in-frameset-innerhtmluCUnexpected end tag token (%(name)s) in the frameset phase. Ignored.uunexpected-end-tag-in-framesetuEUnexpected non-space characters in the after frameset phase. Ignored.uunexpected-char-after-framesetuEUnexpected start tag (%(name)s) in the after frameset phase. Ignored.u#unexpected-start-tag-after-framesetuCUnexpected end tag (%(name)s) in the after frameset phase. Ignored.u!unexpected-end-tag-after-framesetu(Unexpected end tag after body(innerHtml)u'unexpected-end-tag-after-body-innerhtmlu6Unexpected non-space characters. Expected end of file.uexpected-eof-but-got-charu6Unexpected start tag (%(name)s). Expected end of file.uexpected-eof-but-got-start-tagu4Unexpected end tag (%(name)s). Expected end of file.uexpected-eof-but-got-end-tagu/Unexpected end of file. Expected table content.u eof-in-tableu0Unexpected end of file. Expected select content.u eof-in-selectu2Unexpected end of file. Expected frameset content.ueof-in-framesetu0Unexpected end of file. Expected script content.ueof-in-script-in-scriptu0Unexpected end of file. Expected foreign contentueof-in-foreign-landsu0Trailing solidus not allowed on element %(name)su&non-void-element-with-trailing-solidusu2Element %(name)s not allowed in a non-html contextu*unexpected-html-element-in-foreign-contentu*Unexpected end tag (%(name)s) before html.uunexpected-end-tag-before-htmlu9Element %(name)s not allowed in a inhead-noscript contextuunexpected-inhead-noscript-tagu8Unexpected end of file. Expected inhead-noscript contentueof-in-head-noscriptu@Unexpected non-space character. Expected inhead-noscript contentuchar-in-head-noscriptu0Undefined error (this sucks and should be fixed)uXXX-undefined-erroruhttp://www.w3.org/1999/xhtmluhtmlu"http://www.w3.org/1998/Math/MathMLumathmluhttp://www.w3.org/2000/svgusvguhttp://www.w3.org/1999/xlinkuxlinku$http://www.w3.org/XML/1998/namespaceuxmluhttp://www.w3.org/2000/xmlns/uxmlnsuappletucaptionumarqueeuobjectutableutduthumiumoumnumsumtextuannotation-xmlu foreignObjectudescutitleuaububigucodeuemufontuiunobrususmallustrikeustronguttuuuaddressuareauarticleuasideubaseubasefontubgsoundu blockquoteubodyubrubuttonucenterucolucolgroupucommanduddudetailsudirudivudludtuembedufieldsetufigureufooteruformuframeuframesetuh1uh2uh3uh4uh5uh6uheaduheaderuhruiframeuimageuimguinputuisindexuliulinkulistingumenuumetaunavunoembedunoframesunoscriptuolupuparamu plaintextupreuscriptusectionuselectustyleutbodyutextareautfootutheadutruuluwbruxmpu annotaion-xmlu attributeNameu attributenameu attributeTypeu attributetypeu baseFrequencyu basefrequencyu baseProfileu baseprofileucalcModeucalcmodeu clipPathUnitsu clippathunitsucontentScriptTypeucontentscripttypeucontentStyleTypeucontentstyletypeudiffuseConstantudiffuseconstantuedgeModeuedgemodeuexternalResourcesRequireduexternalresourcesrequiredu filterResu filterresu filterUnitsu filterunitsuglyphRefuglyphrefugradientTransformugradienttransformu gradientUnitsu gradientunitsu kernelMatrixu kernelmatrixukernelUnitLengthukernelunitlengthu keyPointsu keypointsu keySplinesu keysplinesukeyTimesukeytimesu lengthAdjustu lengthadjustulimitingConeAngleulimitingconeangleu markerHeightu markerheightu markerUnitsu markerunitsu markerWidthu markerwidthumaskContentUnitsumaskcontentunitsu maskUnitsu maskunitsu numOctavesu numoctavesu pathLengthu pathlengthupatternContentUnitsupatterncontentunitsupatternTransformupatterntransformu patternUnitsu patternunitsu pointsAtXu pointsatxu pointsAtYu pointsatyu pointsAtZu pointsatzu preserveAlphau preservealphaupreserveAspectRatioupreserveaspectratiouprimitiveUnitsuprimitiveunitsurefXurefxurefYurefyu repeatCountu repeatcountu repeatDuru repeatdururequiredExtensionsurequiredextensionsurequiredFeaturesurequiredfeaturesuspecularConstantuspecularconstantuspecularExponentuspecularexponentu spreadMethodu spreadmethodu startOffsetu startoffsetu stdDeviationu stddeviationu stitchTilesu stitchtilesu surfaceScaleu surfacescaleusystemLanguageusystemlanguageu tableValuesu tablevaluesutargetXutargetxutargetYutargetyu textLengthu textlengthuviewBoxuviewboxu viewTargetu viewtargetuxChannelSelectoruxchannelselectoruyChannelSelectoruychannelselectoru zoomAndPanu zoomandpanu definitionURLu definitionurluactuateu xlink:actuateuarcroleu xlink:arcroleuhrefu xlink:hrefuroleu xlink:roleushowu xlink:showu xlink:titleutypeu xlink:typeuxml:baseulanguxml:languspaceu xml:spaceu xmlns:xlinku u u u u u event-sourceusourceutracku irrelevantuuscopeduismapuautoplayucontrolsuaudiouvideoudeferuasyncuopenumultipleudisabledudatagriduhiddenucheckedudefaultunoshadeu autosubmitureadonlyuselecteduoptionuoptgroupu autofocusurequireduoutputi ii ii i& i i! ii0 i`i9 iRi}i i i i i" i i ii"!iai: iSi~ixult;ugt;uamp;uapos;uquot;uÆuAEliguAElig;u&uAMPuAMP;uÁuAacuteuAacute;uĂuAbreve;uÂuAcircuAcirc;uАuAcy;u𝔄uAfr;uÀuAgraveuAgrave;uΑuAlpha;uĀuAmacr;u⩓uAnd;uĄuAogon;u𝔸uAopf;u⁡uApplyFunction;uÅuAringuAring;u𝒜uAscr;u≔uAssign;uÃuAtildeuAtilde;uÄuAumluAuml;u∖u Backslash;u⫧uBarv;u⌆uBarwed;uБuBcy;u∵uBecause;uℬu Bernoullis;uΒuBeta;u𝔅uBfr;u𝔹uBopf;u˘uBreve;uBscr;u≎uBumpeq;uЧuCHcy;u©uCOPYuCOPY;uĆuCacute;u⋒uCap;uⅅuCapitalDifferentialD;uℭuCayleys;uČuCcaron;uÇuCcediluCcedil;uĈuCcirc;u∰uCconint;uĊuCdot;u¸uCedilla;u·u CenterDot;uCfr;uΧuChi;u⊙u CircleDot;u⊖u CircleMinus;u⊕u CirclePlus;u⊗u CircleTimes;u∲uClockwiseContourIntegral;u”uCloseCurlyDoubleQuote;u’uCloseCurlyQuote;u∷uColon;u⩴uColone;u≡u Congruent;u∯uConint;u∮uContourIntegral;uℂuCopf;u∐u Coproduct;u∳u CounterClockwiseContourIntegral;u⨯uCross;u𝒞uCscr;u⋓uCup;u≍uCupCap;uDD;u⤑u DDotrahd;uЂuDJcy;uЅuDScy;uЏuDZcy;u‡uDagger;u↡uDarr;u⫤uDashv;uĎuDcaron;uДuDcy;u∇uDel;uΔuDelta;u𝔇uDfr;u´uDiacriticalAcute;u˙uDiacriticalDot;u˝uDiacriticalDoubleAcute;u`uDiacriticalGrave;u˜uDiacriticalTilde;u⋄uDiamond;uⅆuDifferentialD;u𝔻uDopf;u¨uDot;u⃜uDotDot;u≐u DotEqual;uDoubleContourIntegral;u DoubleDot;u⇓uDoubleDownArrow;u⇐uDoubleLeftArrow;u⇔uDoubleLeftRightArrow;uDoubleLeftTee;u⟸uDoubleLongLeftArrow;u⟺uDoubleLongLeftRightArrow;u⟹uDoubleLongRightArrow;u⇒uDoubleRightArrow;u⊨uDoubleRightTee;u⇑uDoubleUpArrow;u⇕uDoubleUpDownArrow;u∥uDoubleVerticalBar;u↓u DownArrow;u⤓u DownArrowBar;u⇵uDownArrowUpArrow;ȗu DownBreve;u⥐uDownLeftRightVector;u⥞uDownLeftTeeVector;u↽uDownLeftVector;u⥖uDownLeftVectorBar;u⥟uDownRightTeeVector;u⇁uDownRightVector;u⥗uDownRightVectorBar;u⊤uDownTee;u↧u DownTeeArrow;u Downarrow;u𝒟uDscr;uĐuDstrok;uŊuENG;uÐuETHuETH;uÉuEacuteuEacute;uĚuEcaron;uÊuEcircuEcirc;uЭuEcy;uĖuEdot;u𝔈uEfr;uÈuEgraveuEgrave;u∈uElement;uĒuEmacr;u◻uEmptySmallSquare;u▫uEmptyVerySmallSquare;uĘuEogon;u𝔼uEopf;uΕuEpsilon;u⩵uEqual;u≂u EqualTilde;u⇌u Equilibrium;uℰuEscr;u⩳uEsim;uΗuEta;uËuEumluEuml;u∃uExists;uⅇu ExponentialE;uФuFcy;u𝔉uFfr;u◼uFilledSmallSquare;u▪uFilledVerySmallSquare;u𝔽uFopf;u∀uForAll;uℱu Fouriertrf;uFscr;uЃuGJcy;u>uGTuGT;uΓuGamma;uϜuGammad;uĞuGbreve;uĢuGcedil;uĜuGcirc;uГuGcy;uĠuGdot;u𝔊uGfr;u⋙uGg;u𝔾uGopf;u≥u GreaterEqual;u⋛uGreaterEqualLess;u≧uGreaterFullEqual;u⪢uGreaterGreater;u≷u GreaterLess;u⩾uGreaterSlantEqual;u≳u GreaterTilde;u𝒢uGscr;u≫uGt;uЪuHARDcy;uˇuHacek;u^uHat;uĤuHcirc;uℌuHfr;uℋu HilbertSpace;uℍuHopf;u─uHorizontalLine;uHscr;uĦuHstrok;u HumpDownHump;u≏u HumpEqual;uЕuIEcy;uIJuIJlig;uЁuIOcy;uÍuIacuteuIacute;uÎuIcircuIcirc;uИuIcy;uİuIdot;uℑuIfr;uÌuIgraveuIgrave;uIm;uĪuImacr;uⅈu ImaginaryI;uImplies;u∬uInt;u∫u Integral;u⋂u Intersection;u⁣uInvisibleComma;u⁢uInvisibleTimes;uĮuIogon;u𝕀uIopf;uΙuIota;uℐuIscr;uĨuItilde;uІuIukcy;uÏuIumluIuml;uĴuJcirc;uЙuJcy;u𝔍uJfr;u𝕁uJopf;u𝒥uJscr;uЈuJsercy;uЄuJukcy;uХuKHcy;uЌuKJcy;uΚuKappa;uĶuKcedil;uКuKcy;u𝔎uKfr;u𝕂uKopf;u𝒦uKscr;uЉuLJcy;u⃒unvgt;u⧞unvinfin;u⤂unvlArr;u≤⃒unvle;u<⃒unvlt;u⊴⃒unvltrie;u⤃unvrArr;u⊵⃒unvrtrie;u∼⃒unvsim;u⇖unwArr;u⤣unwarhk;unwarr;unwarrow;u⤧unwnear;uoS;uóuoacuteuoacute;uoast;uocir;uôuocircuocirc;uоuocy;uodash;uőuodblac;u⨸uodiv;uodot;u⦼uodsold;uœuoelig;u⦿uofcir;u𝔬uofr;u˛uogon;uòuograveuograve;u⧁uogt;u⦵uohbar;uohm;uoint;uolarr;u⦾uolcir;u⦻uolcross;uoline;u⧀uolt;uōuomacr;uωuomega;uοuomicron;u⦶uomid;uominus;u𝕠uoopf;u⦷uopar;u⦹uoperp;uoplus;u∨uor;uorarr;u⩝uord;uℴuorder;uorderof;uªuordfuordf;uºuordmuordm;u⊶uorigof;u⩖uoror;u⩗uorslope;u⩛uorv;uoscr;uøuoslashuoslash;u⊘uosol;uõuotildeuotilde;uotimes;u⨶u otimesas;uöuoumluouml;u⌽uovbar;upar;u¶uparaupara;u parallel;u⫳uparsim;u⫽uparsl;upart;uпupcy;u%upercnt;u.uperiod;u‰upermil;uperp;u‱upertenk;u𝔭upfr;uφuphi;uϕuphiv;uphmmat;u☎uphone;uπupi;u pitchfork;uϖupiv;uplanck;uℎuplanckh;uplankv;u+uplus;u⨣u plusacir;uplusb;u⨢upluscir;uplusdo;u⨥uplusdu;u⩲upluse;uplusmnuplusmn;u⨦uplussim;u⨧uplustwo;upm;u⨕u pointint;u𝕡upopf;u£upoundupound;upr;u⪳uprE;u⪷uprap;uprcue;upre;uprec;u precapprox;u preccurlyeq;upreceq;u⪹u precnapprox;u⪵u precneqq;u⋨u precnsim;uprecsim;u′uprime;uprimes;uprnE;uprnap;uprnsim;uprod;u⌮u profalar;u⌒u profline;u⌓u profsurf;uprop;upropto;uprsim;u⊰uprurel;u𝓅upscr;uψupsi;u upuncsp;u𝔮uqfr;uqint;u𝕢uqopf;u⁗uqprime;u𝓆uqscr;u quaternions;u⨖uquatint;u?uquest;uquesteq;uquoturAarr;urArr;u⤜urAtail;urBarr;u⥤urHar;u∽̱urace;uŕuracute;uradic;u⦳u raemptyv;urang;u⦒urangd;u⦥urange;urangle;u»uraquouraquo;urarr;u⥵urarrap;urarrb;u⤠urarrbfs;u⤳urarrc;u⤞urarrfs;urarrhk;urarrlp;u⥅urarrpl;u⥴urarrsim;u↣urarrtl;u↝urarrw;u⤚uratail;u∶uratio;u rationals;urbarr;u❳urbbrk;u}urbrace;u]urbrack;u⦌urbrke;u⦎urbrksld;u⦐urbrkslu;uřurcaron;uŗurcedil;urceil;urcub;uрurcy;u⤷urdca;u⥩urdldhar;urdquo;urdquor;u↳urdsh;ureal;urealine;u realpart;ureals;u▭urect;uregureg;u⥽urfisht;urfloor;u𝔯urfr;urhard;urharu;u⥬urharul;uρurho;uϱurhov;u rightarrow;urightarrowtail;urightharpoondown;urightharpoonup;urightleftarrows;urightleftharpoons;u⇉urightrightarrows;urightsquigarrow;u⋌urightthreetimes;u˚uring;u risingdotseq;urlarr;urlhar;u‏urlm;u⎱urmoust;u rmoustache;u⫮urnmid;u⟭uroang;u⇾uroarr;urobrk;u⦆uropar;u𝕣uropf;u⨮uroplus;u⨵urotimes;u)urpar;u⦔urpargt;u⨒u rppolint;urrarr;u›ursaquo;u𝓇urscr;ursh;ursqb;ursquo;ursquor;urthree;u⋊urtimes;u▹urtri;urtrie;urtrif;u⧎u rtriltri;u⥨uruluhar;u℞urx;uśusacute;usbquo;usc;u⪴uscE;u⪸uscap;ušuscaron;usccue;usce;uşuscedil;uŝuscirc;u⪶uscnE;u⪺uscnap;u⋩uscnsim;u⨓u scpolint;uscsim;uсuscy;u⋅usdot;usdotb;u⩦usdote;u⇘useArr;usearhk;usearr;usearrow;u§usectusect;u;usemi;u⤩useswar;u setminus;usetmn;u✶usext;u𝔰usfr;usfrown;u♯usharp;uщushchcy;uшushcy;u shortmid;ushortparallel;u­ushyushy;uσusigma;uςusigmaf;usigmav;usim;u⩪usimdot;usime;usimeq;u⪞usimg;u⪠usimgE;u⪝usiml;u⪟usimlE;u≆usimne;u⨤usimplus;u⥲usimrarr;uslarr;usmallsetminus;u⨳usmashp;u⧤u smeparsl;usmid;u⌣usmile;u⪪usmt;u⪬usmte;u⪬︀usmtes;uьusoftcy;u/usol;u⧄usolb;u⌿usolbar;u𝕤usopf;u♠uspades;u spadesuit;uspar;usqcap;u⊓︀usqcaps;usqcup;u⊔︀usqcups;usqsub;usqsube;u sqsubset;u sqsubseteq;usqsup;usqsupe;u sqsupset;u sqsupseteq;usqu;usquare;usquarf;usquf;usrarr;u𝓈usscr;ussetmn;ussmile;usstarf;u☆ustar;ustarf;ustraightepsilon;u straightphi;ustrns;u⊂usub;u⫅usubE;u⪽usubdot;usube;u⫃usubedot;u⫁usubmult;u⫋usubnE;u⊊usubne;u⪿usubplus;u⥹usubrarr;usubset;u subseteq;u subseteqq;u subsetneq;u subsetneqq;u⫇usubsim;u⫕usubsub;u⫓usubsup;usucc;u succapprox;u succcurlyeq;usucceq;u succnapprox;u succneqq;u succnsim;usuccsim;usum;u♪usung;u¹usup1usup1;u²usup2usup2;u³usup3usup3;usup;u⫆usupE;u⪾usupdot;u⫘usupdsub;usupe;u⫄usupedot;u⟉usuphsol;u⫗usuphsub;u⥻usuplarr;u⫂usupmult;u⫌usupnE;u⊋usupne;u⫀usupplus;usupset;u supseteq;u supseteqq;u supsetneq;u supsetneqq;u⫈usupsim;u⫔usupsub;u⫖usupsup;u⇙uswArr;uswarhk;uswarr;uswarrow;u⤪uswnwar;ußuszliguszlig;u⌖utarget;uτutau;utbrk;uťutcaron;uţutcedil;uтutcy;utdot;u⌕utelrec;u𝔱utfr;uthere4;u therefore;uθutheta;uϑu thetasym;uthetav;u thickapprox;u thicksim;uthinsp;uthkap;uthksim;uþuthornuthorn;utilde;u×utimesutimes;utimesb;u⨱u timesbar;u⨰utimesd;utint;utoea;utop;u⌶utopbot;u⫱utopcir;u𝕥utopf;u⫚utopfork;utosa;u‴utprime;utrade;u▵u triangle;u triangledown;u triangleleft;utrianglelefteq;u≜u triangleq;utriangleright;utrianglerighteq;u◬utridot;utrie;u⨺u triminus;u⨹utriplus;u⧍utrisb;u⨻utritime;u⏢u trpezium;u𝓉utscr;uцutscy;uћutshcy;uŧutstrok;utwixt;utwoheadleftarrow;utwoheadrightarrow;uuArr;u⥣uuHar;uúuuacuteuuacute;uuarr;uўuubrcy;uŭuubreve;uûuucircuucirc;uуuucy;uudarr;uűuudblac;uudhar;u⥾uufisht;u𝔲uufr;uùuugraveuugrave;uuharl;uuharr;u▀uuhblk;u⌜uulcorn;u ulcorner;u⌏uulcrop;u◸uultri;uūuumacr;uumluuml;uųuuogon;u𝕦uuopf;uuparrow;u updownarrow;uupharpoonleft;uupharpoonright;uuplus;uυuupsi;uupsih;uupsilon;u⇈u upuparrows;u⌝uurcorn;u urcorner;u⌎uurcrop;uůuuring;u◹uurtri;u𝓊uuscr;u⋰uutdot;uũuutilde;uutri;uutrif;uuuarr;uüuuumluuuml;u⦧uuwangle;uvArr;u⫨uvBar;u⫩uvBarv;uvDash;u⦜uvangrt;u varepsilon;u varkappa;u varnothing;uvarphi;uvarpi;u varpropto;uvarr;uvarrho;u varsigma;u⊊︀u varsubsetneq;u⫋︀uvarsubsetneqq;u⊋︀u varsupsetneq;u⫌︀uvarsupsetneqq;u vartheta;uvartriangleleft;uvartriangleright;uвuvcy;uvdash;uvee;u⊻uveebar;u≚uveeeq;u⋮uvellip;uverbar;uvert;u𝔳uvfr;uvltri;uvnsub;uvnsup;u𝕧uvopf;uvprop;uvrtri;u𝓋uvscr;uvsubnE;uvsubne;uvsupnE;uvsupne;u⦚uvzigzag;uŵuwcirc;u⩟uwedbar;uwedge;u≙uwedgeq;u℘uweierp;u𝔴uwfr;u𝕨uwopf;uwp;uwr;uwreath;u𝓌uwscr;uxcap;uxcirc;uxcup;uxdtri;u𝔵uxfr;uxhArr;uxharr;uξuxi;uxlArr;uxlarr;uxmap;u⋻uxnis;uxodot;u𝕩uxopf;uxoplus;uxotime;uxrArr;uxrarr;u𝓍uxscr;uxsqcup;uxuplus;uxutri;uxvee;uxwedge;uýuyacuteuyacute;uяuyacy;uŷuycirc;uыuycy;u¥uyenuyen;u𝔶uyfr;uїuyicy;u𝕪uyopf;u𝓎uyscr;uюuyucy;uÿuyumluyuml;uźuzacute;užuzcaron;uзuzcy;użuzdot;uzeetrf;uζuzeta;u𝔷uzfr;uжuzhcy;u⇝uzigrarr;u𝕫uzopf;u𝓏uzscr;u‍uzwj;u‌uzwnj;u�i iuiiiiiiiiiiiiuiiuiuiiiiiiiiiiiiiuiiiuDoctypeiu CharactersiuSpaceCharactersiuStartTagiuEndTagiuEmptyTagiuCommentiu ParseErrorumathtDataLossWarningcB`seZRS((t__name__t __module__(((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/constants.pyR| stReparseExceptioncB`seZRS((RR(((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/constants.pyR s(uh1uh2uh3uh4uh5uh6( i ii ii i& i i! ii0 i`i9 iRii}iii i i i i" i i ii"!iai: iSii~ix(:t __future__RRRtstringtNonetEOFtEt namespacest frozensettscopingElementstformattingElementstspecialElementsthtmlIntegrationPointElementst"mathmlTextIntegrationPointElementstadjustSVGAttributestadjustMathMLAttributestadjustForeignAttributestdicttitemstqnametprefixtlocaltnstunadjustForeignAttributestspaceCharactersttableInsertModeElementstascii_lowercasetasciiLowercasetascii_uppercasetasciiUppercaset ascii_letterst asciiLetterstdigitst hexdigitst hexDigitstctordtlowertasciiUpper2LowertheadingElementst voidElementst cdataElementstrcdataElementstbooleanAttributestentitiesWindows1252t xmlEntitiestentitiestreplacementCharacterst tokenTypest tagTokenTypestktvtprefixest UserWarningRt ExceptionR(((sB/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/constants.pytsL                                                                                                                      :  4     1 site-packages/pip/_vendor/html5lib/html5parser.py000064400000344662147204247350016077 0ustar00from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import with_metaclass, viewkeys, PY3 import types try: from collections import OrderedDict except ImportError: from pip._vendor.ordereddict import OrderedDict from . import _inputstream from . import _tokenizer from . import treebuilders from .treebuilders.base import Marker from . import _utils from .constants import ( spaceCharacters, asciiUpper2Lower, specialElements, headingElements, cdataElements, rcdataElements, tokenTypes, tagTokenTypes, namespaces, htmlIntegrationPointElements, mathmlTextIntegrationPointElements, adjustForeignAttributes as adjustForeignAttributesMap, adjustMathMLAttributes, adjustSVGAttributes, E, ReparseException ) def parse(doc, treebuilder="etree", namespaceHTMLElements=True, **kwargs): """Parse a string or file-like object into a tree""" tb = treebuilders.getTreeBuilder(treebuilder) p = HTMLParser(tb, namespaceHTMLElements=namespaceHTMLElements) return p.parse(doc, **kwargs) def parseFragment(doc, container="div", treebuilder="etree", namespaceHTMLElements=True, **kwargs): tb = treebuilders.getTreeBuilder(treebuilder) p = HTMLParser(tb, namespaceHTMLElements=namespaceHTMLElements) return p.parseFragment(doc, container=container, **kwargs) def method_decorator_metaclass(function): class Decorated(type): def __new__(meta, classname, bases, classDict): for attributeName, attribute in classDict.items(): if isinstance(attribute, types.FunctionType): attribute = function(attribute) classDict[attributeName] = attribute return type.__new__(meta, classname, bases, classDict) return Decorated class HTMLParser(object): """HTML parser. Generates a tree structure from a stream of (possibly malformed) HTML""" def __init__(self, tree=None, strict=False, namespaceHTMLElements=True, debug=False): """ strict - raise an exception when a parse error is encountered tree - a treebuilder class controlling the type of tree that will be returned. Built in treebuilders can be accessed through html5lib.treebuilders.getTreeBuilder(treeType) """ # Raise an exception on the first error encountered self.strict = strict if tree is None: tree = treebuilders.getTreeBuilder("etree") self.tree = tree(namespaceHTMLElements) self.errors = [] self.phases = dict([(name, cls(self, self.tree)) for name, cls in getPhases(debug).items()]) def _parse(self, stream, innerHTML=False, container="div", scripting=False, **kwargs): self.innerHTMLMode = innerHTML self.container = container self.scripting = scripting self.tokenizer = _tokenizer.HTMLTokenizer(stream, parser=self, **kwargs) self.reset() try: self.mainLoop() except ReparseException: self.reset() self.mainLoop() def reset(self): self.tree.reset() self.firstStartTag = False self.errors = [] self.log = [] # only used with debug mode # "quirks" / "limited quirks" / "no quirks" self.compatMode = "no quirks" if self.innerHTMLMode: self.innerHTML = self.container.lower() if self.innerHTML in cdataElements: self.tokenizer.state = self.tokenizer.rcdataState elif self.innerHTML in rcdataElements: self.tokenizer.state = self.tokenizer.rawtextState elif self.innerHTML == 'plaintext': self.tokenizer.state = self.tokenizer.plaintextState else: # state already is data state # self.tokenizer.state = self.tokenizer.dataState pass self.phase = self.phases["beforeHtml"] self.phase.insertHtmlElement() self.resetInsertionMode() else: self.innerHTML = False # pylint:disable=redefined-variable-type self.phase = self.phases["initial"] self.lastPhase = None self.beforeRCDataPhase = None self.framesetOK = True @property def documentEncoding(self): """The name of the character encoding that was used to decode the input stream, or :obj:`None` if that is not determined yet. """ if not hasattr(self, 'tokenizer'): return None return self.tokenizer.stream.charEncoding[0].name def isHTMLIntegrationPoint(self, element): if (element.name == "annotation-xml" and element.namespace == namespaces["mathml"]): return ("encoding" in element.attributes and element.attributes["encoding"].translate( asciiUpper2Lower) in ("text/html", "application/xhtml+xml")) else: return (element.namespace, element.name) in htmlIntegrationPointElements def isMathMLTextIntegrationPoint(self, element): return (element.namespace, element.name) in mathmlTextIntegrationPointElements def mainLoop(self): CharactersToken = tokenTypes["Characters"] SpaceCharactersToken = tokenTypes["SpaceCharacters"] StartTagToken = tokenTypes["StartTag"] EndTagToken = tokenTypes["EndTag"] CommentToken = tokenTypes["Comment"] DoctypeToken = tokenTypes["Doctype"] ParseErrorToken = tokenTypes["ParseError"] for token in self.normalizedTokens(): prev_token = None new_token = token while new_token is not None: prev_token = new_token currentNode = self.tree.openElements[-1] if self.tree.openElements else None currentNodeNamespace = currentNode.namespace if currentNode else None currentNodeName = currentNode.name if currentNode else None type = new_token["type"] if type == ParseErrorToken: self.parseError(new_token["data"], new_token.get("datavars", {})) new_token = None else: if (len(self.tree.openElements) == 0 or currentNodeNamespace == self.tree.defaultNamespace or (self.isMathMLTextIntegrationPoint(currentNode) and ((type == StartTagToken and token["name"] not in frozenset(["mglyph", "malignmark"])) or type in (CharactersToken, SpaceCharactersToken))) or (currentNodeNamespace == namespaces["mathml"] and currentNodeName == "annotation-xml" and type == StartTagToken and token["name"] == "svg") or (self.isHTMLIntegrationPoint(currentNode) and type in (StartTagToken, CharactersToken, SpaceCharactersToken))): phase = self.phase else: phase = self.phases["inForeignContent"] if type == CharactersToken: new_token = phase.processCharacters(new_token) elif type == SpaceCharactersToken: new_token = phase.processSpaceCharacters(new_token) elif type == StartTagToken: new_token = phase.processStartTag(new_token) elif type == EndTagToken: new_token = phase.processEndTag(new_token) elif type == CommentToken: new_token = phase.processComment(new_token) elif type == DoctypeToken: new_token = phase.processDoctype(new_token) if (type == StartTagToken and prev_token["selfClosing"] and not prev_token["selfClosingAcknowledged"]): self.parseError("non-void-element-with-trailing-solidus", {"name": prev_token["name"]}) # When the loop finishes it's EOF reprocess = True phases = [] while reprocess: phases.append(self.phase) reprocess = self.phase.processEOF() if reprocess: assert self.phase not in phases def normalizedTokens(self): for token in self.tokenizer: yield self.normalizeToken(token) def parse(self, stream, *args, **kwargs): """Parse a HTML document into a well-formed tree stream - a filelike object or string containing the HTML to be parsed The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) scripting - treat noscript elements as if javascript was turned on """ self._parse(stream, False, None, *args, **kwargs) return self.tree.getDocument() def parseFragment(self, stream, *args, **kwargs): """Parse a HTML fragment into a well-formed tree fragment container - name of the element we're setting the innerHTML property if set to None, default to 'div' stream - a filelike object or string containing the HTML to be parsed The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) scripting - treat noscript elements as if javascript was turned on """ self._parse(stream, True, *args, **kwargs) return self.tree.getFragment() def parseError(self, errorcode="XXX-undefined-error", datavars=None): # XXX The idea is to make errorcode mandatory. if datavars is None: datavars = {} self.errors.append((self.tokenizer.stream.position(), errorcode, datavars)) if self.strict: raise ParseError(E[errorcode] % datavars) def normalizeToken(self, token): """ HTML5 specific normalizations to the token stream """ if token["type"] == tokenTypes["StartTag"]: raw = token["data"] token["data"] = OrderedDict(raw) if len(raw) > len(token["data"]): # we had some duplicated attribute, fix so first wins token["data"].update(raw[::-1]) return token def adjustMathMLAttributes(self, token): adjust_attributes(token, adjustMathMLAttributes) def adjustSVGAttributes(self, token): adjust_attributes(token, adjustSVGAttributes) def adjustForeignAttributes(self, token): adjust_attributes(token, adjustForeignAttributesMap) def reparseTokenNormal(self, token): # pylint:disable=unused-argument self.parser.phase() def resetInsertionMode(self): # The name of this method is mostly historical. (It's also used in the # specification.) last = False newModes = { "select": "inSelect", "td": "inCell", "th": "inCell", "tr": "inRow", "tbody": "inTableBody", "thead": "inTableBody", "tfoot": "inTableBody", "caption": "inCaption", "colgroup": "inColumnGroup", "table": "inTable", "head": "inBody", "body": "inBody", "frameset": "inFrameset", "html": "beforeHead" } for node in self.tree.openElements[::-1]: nodeName = node.name new_phase = None if node == self.tree.openElements[0]: assert self.innerHTML last = True nodeName = self.innerHTML # Check for conditions that should only happen in the innerHTML # case if nodeName in ("select", "colgroup", "head", "html"): assert self.innerHTML if not last and node.namespace != self.tree.defaultNamespace: continue if nodeName in newModes: new_phase = self.phases[newModes[nodeName]] break elif last: new_phase = self.phases["inBody"] break self.phase = new_phase def parseRCDataRawtext(self, token, contentType): """Generic RCDATA/RAWTEXT Parsing algorithm contentType - RCDATA or RAWTEXT """ assert contentType in ("RAWTEXT", "RCDATA") self.tree.insertElement(token) if contentType == "RAWTEXT": self.tokenizer.state = self.tokenizer.rawtextState else: self.tokenizer.state = self.tokenizer.rcdataState self.originalPhase = self.phase self.phase = self.phases["text"] @_utils.memoize def getPhases(debug): def log(function): """Logger that records which phase processes each token""" type_names = dict((value, key) for key, value in tokenTypes.items()) def wrapped(self, *args, **kwargs): if function.__name__.startswith("process") and len(args) > 0: token = args[0] try: info = {"type": type_names[token['type']]} except: raise if token['type'] in tagTokenTypes: info["name"] = token['name'] self.parser.log.append((self.parser.tokenizer.state.__name__, self.parser.phase.__class__.__name__, self.__class__.__name__, function.__name__, info)) return function(self, *args, **kwargs) else: return function(self, *args, **kwargs) return wrapped def getMetaclass(use_metaclass, metaclass_func): if use_metaclass: return method_decorator_metaclass(metaclass_func) else: return type # pylint:disable=unused-argument class Phase(with_metaclass(getMetaclass(debug, log))): """Base class for helper object that implements each phase of processing """ def __init__(self, parser, tree): self.parser = parser self.tree = tree def processEOF(self): raise NotImplementedError def processComment(self, token): # For most phases the following is correct. Where it's not it will be # overridden. self.tree.insertComment(token, self.tree.openElements[-1]) def processDoctype(self, token): self.parser.parseError("unexpected-doctype") def processCharacters(self, token): self.tree.insertText(token["data"]) def processSpaceCharacters(self, token): self.tree.insertText(token["data"]) def processStartTag(self, token): return self.startTagHandler[token["name"]](token) def startTagHtml(self, token): if not self.parser.firstStartTag and token["name"] == "html": self.parser.parseError("non-html-root") # XXX Need a check here to see if the first start tag token emitted is # this token... If it's not, invoke self.parser.parseError(). for attr, value in token["data"].items(): if attr not in self.tree.openElements[0].attributes: self.tree.openElements[0].attributes[attr] = value self.parser.firstStartTag = False def processEndTag(self, token): return self.endTagHandler[token["name"]](token) class InitialPhase(Phase): def processSpaceCharacters(self, token): pass def processComment(self, token): self.tree.insertComment(token, self.tree.document) def processDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] correct = token["correct"] if (name != "html" or publicId is not None or systemId is not None and systemId != "about:legacy-compat"): self.parser.parseError("unknown-doctype") if publicId is None: publicId = "" self.tree.insertDoctype(token) if publicId != "": publicId = publicId.translate(asciiUpper2Lower) if (not correct or token["name"] != "html" or publicId.startswith( ("+//silmaril//dtd html pro v0r11 19970101//", "-//advasoft ltd//dtd html 3.0 aswedit + extensions//", "-//as//dtd html 3.0 aswedit + extensions//", "-//ietf//dtd html 2.0 level 1//", "-//ietf//dtd html 2.0 level 2//", "-//ietf//dtd html 2.0 strict level 1//", "-//ietf//dtd html 2.0 strict level 2//", "-//ietf//dtd html 2.0 strict//", "-//ietf//dtd html 2.0//", "-//ietf//dtd html 2.1e//", "-//ietf//dtd html 3.0//", "-//ietf//dtd html 3.2 final//", "-//ietf//dtd html 3.2//", "-//ietf//dtd html 3//", "-//ietf//dtd html level 0//", "-//ietf//dtd html level 1//", "-//ietf//dtd html level 2//", "-//ietf//dtd html level 3//", "-//ietf//dtd html strict level 0//", "-//ietf//dtd html strict level 1//", "-//ietf//dtd html strict level 2//", "-//ietf//dtd html strict level 3//", "-//ietf//dtd html strict//", "-//ietf//dtd html//", "-//metrius//dtd metrius presentational//", "-//microsoft//dtd internet explorer 2.0 html strict//", "-//microsoft//dtd internet explorer 2.0 html//", "-//microsoft//dtd internet explorer 2.0 tables//", "-//microsoft//dtd internet explorer 3.0 html strict//", "-//microsoft//dtd internet explorer 3.0 html//", "-//microsoft//dtd internet explorer 3.0 tables//", "-//netscape comm. corp.//dtd html//", "-//netscape comm. corp.//dtd strict html//", "-//o'reilly and associates//dtd html 2.0//", "-//o'reilly and associates//dtd html extended 1.0//", "-//o'reilly and associates//dtd html extended relaxed 1.0//", "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//", "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//", "-//spyglass//dtd html 2.0 extended//", "-//sq//dtd html 2.0 hotmetal + extensions//", "-//sun microsystems corp.//dtd hotjava html//", "-//sun microsystems corp.//dtd hotjava strict html//", "-//w3c//dtd html 3 1995-03-24//", "-//w3c//dtd html 3.2 draft//", "-//w3c//dtd html 3.2 final//", "-//w3c//dtd html 3.2//", "-//w3c//dtd html 3.2s draft//", "-//w3c//dtd html 4.0 frameset//", "-//w3c//dtd html 4.0 transitional//", "-//w3c//dtd html experimental 19960712//", "-//w3c//dtd html experimental 970421//", "-//w3c//dtd w3 html//", "-//w3o//dtd w3 html 3.0//", "-//webtechs//dtd mozilla html 2.0//", "-//webtechs//dtd mozilla html//")) or publicId in ("-//w3o//dtd w3 html strict 3.0//en//", "-/w3c/dtd html 4.0 transitional/en", "html") or publicId.startswith( ("-//w3c//dtd html 4.01 frameset//", "-//w3c//dtd html 4.01 transitional//")) and systemId is None or systemId and systemId.lower() == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"): self.parser.compatMode = "quirks" elif (publicId.startswith( ("-//w3c//dtd xhtml 1.0 frameset//", "-//w3c//dtd xhtml 1.0 transitional//")) or publicId.startswith( ("-//w3c//dtd html 4.01 frameset//", "-//w3c//dtd html 4.01 transitional//")) and systemId is not None): self.parser.compatMode = "limited quirks" self.parser.phase = self.parser.phases["beforeHtml"] def anythingElse(self): self.parser.compatMode = "quirks" self.parser.phase = self.parser.phases["beforeHtml"] def processCharacters(self, token): self.parser.parseError("expected-doctype-but-got-chars") self.anythingElse() return token def processStartTag(self, token): self.parser.parseError("expected-doctype-but-got-start-tag", {"name": token["name"]}) self.anythingElse() return token def processEndTag(self, token): self.parser.parseError("expected-doctype-but-got-end-tag", {"name": token["name"]}) self.anythingElse() return token def processEOF(self): self.parser.parseError("expected-doctype-but-got-eof") self.anythingElse() return True class BeforeHtmlPhase(Phase): # helper methods def insertHtmlElement(self): self.tree.insertRoot(impliedTagToken("html", "StartTag")) self.parser.phase = self.parser.phases["beforeHead"] # other def processEOF(self): self.insertHtmlElement() return True def processComment(self, token): self.tree.insertComment(token, self.tree.document) def processSpaceCharacters(self, token): pass def processCharacters(self, token): self.insertHtmlElement() return token def processStartTag(self, token): if token["name"] == "html": self.parser.firstStartTag = True self.insertHtmlElement() return token def processEndTag(self, token): if token["name"] not in ("head", "body", "html", "br"): self.parser.parseError("unexpected-end-tag-before-html", {"name": token["name"]}) else: self.insertHtmlElement() return token class BeforeHeadPhase(Phase): def __init__(self, parser, tree): Phase.__init__(self, parser, tree) self.startTagHandler = _utils.MethodDispatcher([ ("html", self.startTagHtml), ("head", self.startTagHead) ]) self.startTagHandler.default = self.startTagOther self.endTagHandler = _utils.MethodDispatcher([ (("head", "body", "html", "br"), self.endTagImplyHead) ]) self.endTagHandler.default = self.endTagOther def processEOF(self): self.startTagHead(impliedTagToken("head", "StartTag")) return True def processSpaceCharacters(self, token): pass def processCharacters(self, token): self.startTagHead(impliedTagToken("head", "StartTag")) return token def startTagHtml(self, token): return self.parser.phases["inBody"].processStartTag(token) def startTagHead(self, token): self.tree.insertElement(token) self.tree.headPointer = self.tree.openElements[-1] self.parser.phase = self.parser.phases["inHead"] def startTagOther(self, token): self.startTagHead(impliedTagToken("head", "StartTag")) return token def endTagImplyHead(self, token): self.startTagHead(impliedTagToken("head", "StartTag")) return token def endTagOther(self, token): self.parser.parseError("end-tag-after-implied-root", {"name": token["name"]}) class InHeadPhase(Phase): def __init__(self, parser, tree): Phase.__init__(self, parser, tree) self.startTagHandler = _utils.MethodDispatcher([ ("html", self.startTagHtml), ("title", self.startTagTitle), (("noframes", "style"), self.startTagNoFramesStyle), ("noscript", self.startTagNoscript), ("script", self.startTagScript), (("base", "basefont", "bgsound", "command", "link"), self.startTagBaseLinkCommand), ("meta", self.startTagMeta), ("head", self.startTagHead) ]) self.startTagHandler.default = self.startTagOther self.endTagHandler = _utils.MethodDispatcher([ ("head", self.endTagHead), (("br", "html", "body"), self.endTagHtmlBodyBr) ]) self.endTagHandler.default = self.endTagOther # the real thing def processEOF(self): self.anythingElse() return True def processCharacters(self, token): self.anythingElse() return token def startTagHtml(self, token): return self.parser.phases["inBody"].processStartTag(token) def startTagHead(self, token): self.parser.parseError("two-heads-are-not-better-than-one") def startTagBaseLinkCommand(self, token): self.tree.insertElement(token) self.tree.openElements.pop() token["selfClosingAcknowledged"] = True def startTagMeta(self, token): self.tree.insertElement(token) self.tree.openElements.pop() token["selfClosingAcknowledged"] = True attributes = token["data"] if self.parser.tokenizer.stream.charEncoding[1] == "tentative": if "charset" in attributes: self.parser.tokenizer.stream.changeEncoding(attributes["charset"]) elif ("content" in attributes and "http-equiv" in attributes and attributes["http-equiv"].lower() == "content-type"): # Encoding it as UTF-8 here is a hack, as really we should pass # the abstract Unicode string, and just use the # ContentAttrParser on that, but using UTF-8 allows all chars # to be encoded and as a ASCII-superset works. data = _inputstream.EncodingBytes(attributes["content"].encode("utf-8")) parser = _inputstream.ContentAttrParser(data) codec = parser.parse() self.parser.tokenizer.stream.changeEncoding(codec) def startTagTitle(self, token): self.parser.parseRCDataRawtext(token, "RCDATA") def startTagNoFramesStyle(self, token): # Need to decide whether to implement the scripting-disabled case self.parser.parseRCDataRawtext(token, "RAWTEXT") def startTagNoscript(self, token): if self.parser.scripting: self.parser.parseRCDataRawtext(token, "RAWTEXT") else: self.tree.insertElement(token) self.parser.phase = self.parser.phases["inHeadNoscript"] def startTagScript(self, token): self.tree.insertElement(token) self.parser.tokenizer.state = self.parser.tokenizer.scriptDataState self.parser.originalPhase = self.parser.phase self.parser.phase = self.parser.phases["text"] def startTagOther(self, token): self.anythingElse() return token def endTagHead(self, token): node = self.parser.tree.openElements.pop() assert node.name == "head", "Expected head got %s" % node.name self.parser.phase = self.parser.phases["afterHead"] def endTagHtmlBodyBr(self, token): self.anythingElse() return token def endTagOther(self, token): self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) def anythingElse(self): self.endTagHead(impliedTagToken("head")) class InHeadNoscriptPhase(Phase): def __init__(self, parser, tree): Phase.__init__(self, parser, tree) self.startTagHandler = _utils.MethodDispatcher([ ("html", self.startTagHtml), (("basefont", "bgsound", "link", "meta", "noframes", "style"), self.startTagBaseLinkCommand), (("head", "noscript"), self.startTagHeadNoscript), ]) self.startTagHandler.default = self.startTagOther self.endTagHandler = _utils.MethodDispatcher([ ("noscript", self.endTagNoscript), ("br", self.endTagBr), ]) self.endTagHandler.default = self.endTagOther def processEOF(self): self.parser.parseError("eof-in-head-noscript") self.anythingElse() return True def processComment(self, token): return self.parser.phases["inHead"].processComment(token) def processCharacters(self, token): self.parser.parseError("char-in-head-noscript") self.anythingElse() return token def processSpaceCharacters(self, token): return self.parser.phases["inHead"].processSpaceCharacters(token) def startTagHtml(self, token): return self.parser.phases["inBody"].processStartTag(token) def startTagBaseLinkCommand(self, token): return self.parser.phases["inHead"].processStartTag(token) def startTagHeadNoscript(self, token): self.parser.parseError("unexpected-start-tag", {"name": token["name"]}) def startTagOther(self, token): self.parser.parseError("unexpected-inhead-noscript-tag", {"name": token["name"]}) self.anythingElse() return token def endTagNoscript(self, token): node = self.parser.tree.openElements.pop() assert node.name == "noscript", "Expected noscript got %s" % node.name self.parser.phase = self.parser.phases["inHead"] def endTagBr(self, token): self.parser.parseError("unexpected-inhead-noscript-tag", {"name": token["name"]}) self.anythingElse() return token def endTagOther(self, token): self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) def anythingElse(self): # Caller must raise parse error first! self.endTagNoscript(impliedTagToken("noscript")) class AfterHeadPhase(Phase): def __init__(self, parser, tree): Phase.__init__(self, parser, tree) self.startTagHandler = _utils.MethodDispatcher([ ("html", self.startTagHtml), ("body", self.startTagBody), ("frameset", self.startTagFrameset), (("base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "title"), self.startTagFromHead), ("head", self.startTagHead) ]) self.startTagHandler.default = self.startTagOther self.endTagHandler = _utils.MethodDispatcher([(("body", "html", "br"), self.endTagHtmlBodyBr)]) self.endTagHandler.default = self.endTagOther def processEOF(self): self.anythingElse() return True def processCharacters(self, token): self.anythingElse() return token def startTagHtml(self, token): return self.parser.phases["inBody"].processStartTag(token) def startTagBody(self, token): self.parser.framesetOK = False self.tree.insertElement(token) self.parser.phase = self.parser.phases["inBody"] def startTagFrameset(self, token): self.tree.insertElement(token) self.parser.phase = self.parser.phases["inFrameset"] def startTagFromHead(self, token): self.parser.parseError("unexpected-start-tag-out-of-my-head", {"name": token["name"]}) self.tree.openElements.append(self.tree.headPointer) self.parser.phases["inHead"].processStartTag(token) for node in self.tree.openElements[::-1]: if node.name == "head": self.tree.openElements.remove(node) break def startTagHead(self, token): self.parser.parseError("unexpected-start-tag", {"name": token["name"]}) def startTagOther(self, token): self.anythingElse() return token def endTagHtmlBodyBr(self, token): self.anythingElse() return token def endTagOther(self, token): self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) def anythingElse(self): self.tree.insertElement(impliedTagToken("body", "StartTag")) self.parser.phase = self.parser.phases["inBody"] self.parser.framesetOK = True class InBodyPhase(Phase): # http://www.whatwg.org/specs/web-apps/current-work/#parsing-main-inbody # the really-really-really-very crazy mode def __init__(self, parser, tree): Phase.__init__(self, parser, tree) # Set this to the default handler self.processSpaceCharacters = self.processSpaceCharactersNonPre self.startTagHandler = _utils.MethodDispatcher([ ("html", self.startTagHtml), (("base", "basefont", "bgsound", "command", "link", "meta", "script", "style", "title"), self.startTagProcessInHead), ("body", self.startTagBody), ("frameset", self.startTagFrameset), (("address", "article", "aside", "blockquote", "center", "details", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "main", "menu", "nav", "ol", "p", "section", "summary", "ul"), self.startTagCloseP), (headingElements, self.startTagHeading), (("pre", "listing"), self.startTagPreListing), ("form", self.startTagForm), (("li", "dd", "dt"), self.startTagListItem), ("plaintext", self.startTagPlaintext), ("a", self.startTagA), (("b", "big", "code", "em", "font", "i", "s", "small", "strike", "strong", "tt", "u"), self.startTagFormatting), ("nobr", self.startTagNobr), ("button", self.startTagButton), (("applet", "marquee", "object"), self.startTagAppletMarqueeObject), ("xmp", self.startTagXmp), ("table", self.startTagTable), (("area", "br", "embed", "img", "keygen", "wbr"), self.startTagVoidFormatting), (("param", "source", "track"), self.startTagParamSource), ("input", self.startTagInput), ("hr", self.startTagHr), ("image", self.startTagImage), ("isindex", self.startTagIsIndex), ("textarea", self.startTagTextarea), ("iframe", self.startTagIFrame), ("noscript", self.startTagNoscript), (("noembed", "noframes"), self.startTagRawtext), ("select", self.startTagSelect), (("rp", "rt"), self.startTagRpRt), (("option", "optgroup"), self.startTagOpt), (("math"), self.startTagMath), (("svg"), self.startTagSvg), (("caption", "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th", "thead", "tr"), self.startTagMisplaced) ]) self.startTagHandler.default = self.startTagOther self.endTagHandler = _utils.MethodDispatcher([ ("body", self.endTagBody), ("html", self.endTagHtml), (("address", "article", "aside", "blockquote", "button", "center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", "section", "summary", "ul"), self.endTagBlock), ("form", self.endTagForm), ("p", self.endTagP), (("dd", "dt", "li"), self.endTagListItem), (headingElements, self.endTagHeading), (("a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", "strike", "strong", "tt", "u"), self.endTagFormatting), (("applet", "marquee", "object"), self.endTagAppletMarqueeObject), ("br", self.endTagBr), ]) self.endTagHandler.default = self.endTagOther def isMatchingFormattingElement(self, node1, node2): return (node1.name == node2.name and node1.namespace == node2.namespace and node1.attributes == node2.attributes) # helper def addFormattingElement(self, token): self.tree.insertElement(token) element = self.tree.openElements[-1] matchingElements = [] for node in self.tree.activeFormattingElements[::-1]: if node is Marker: break elif self.isMatchingFormattingElement(node, element): matchingElements.append(node) assert len(matchingElements) <= 3 if len(matchingElements) == 3: self.tree.activeFormattingElements.remove(matchingElements[-1]) self.tree.activeFormattingElements.append(element) # the real deal def processEOF(self): allowed_elements = frozenset(("dd", "dt", "li", "p", "tbody", "td", "tfoot", "th", "thead", "tr", "body", "html")) for node in self.tree.openElements[::-1]: if node.name not in allowed_elements: self.parser.parseError("expected-closing-tag-but-got-eof") break # Stop parsing def processSpaceCharactersDropNewline(self, token): # Sometimes (start of
, , and