__pycache__/__about__.cpython-36.opt-1.pyc000064400000001177147204766430014272 0ustar003 ]@sPddlmZmZmZdddddddd gZd Zd Zd Zd ZdZ dZ dZ de Z dS))absolute_importdivisionprint_function __title__ __summary____uri__ __version__ __author__ __email__ __license__ __copyright__Z packagingz"Core utilities for Python packagesz!https://github.com/pypa/packagingz16.8z)Donald Stufft and individual contributorszdonald@stufft.ioz"BSD or Apache License, Version 2.0zCopyright 2014-2016 %sN) Z __future__rrr__all__rrrrr r r r rr/usr/lib/python3.6/__about__.pys  __pycache__/__about__.cpython-36.pyc000064400000001177147204766430013333 0ustar003 ]@sPddlmZmZmZdddddddd gZd Zd Zd Zd ZdZ dZ dZ de Z dS))absolute_importdivisionprint_function __title__ __summary____uri__ __version__ __author__ __email__ __license__ __copyright__Z packagingz"Core utilities for Python packagesz!https://github.com/pypa/packagingz16.8z)Donald Stufft and individual contributorszdonald@stufft.ioz"BSD or Apache License, Version 2.0zCopyright 2014-2016 %sN) Z __future__rrr__all__rrrrr r r r rr/usr/lib/python3.6/__about__.pys  __pycache__/__init__.cpython-36.opt-1.pyc000064400000000735147204766430014122 0ustar003 ]@sTddlmZmZmZddlmZmZmZmZm Z m Z m Z m Z dddddd d d gZ d S) )absolute_importdivisionprint_function) __author__ __copyright__ __email__ __license__ __summary__ __title____uri__ __version__r r r r rrr rN)Z __future__rrr __about__rrrr r r r r __all__rr/usr/lib/python3.6/__init__.pys( __pycache__/__init__.cpython-36.pyc000064400000000735147204766430013163 0ustar003 ]@sTddlmZmZmZddlmZmZmZmZm Z m Z m Z m Z dddddd d d gZ d S) )absolute_importdivisionprint_function) __author__ __copyright__ __email__ __license__ __summary__ __title____uri__ __version__r r r r rrr rN)Z __future__rrr __about__rrrr r r r r __all__rr/usr/lib/python3.6/__init__.pys( __pycache__/_compat.cpython-36.opt-1.pyc000064400000001634147204766430014004 0ustar003 ]\@sVddlmZmZmZddlZejddkZejddkZerDefZ ne fZ ddZ dS))absolute_importdivisionprint_functionNcs&Gfddd}tj|dfiS)z/ Create a base class with a metaclass. cseZdZfddZdS)z!with_metaclass..metaclasscs ||S)N)clsnameZ this_basesd)basesmetar/usr/lib/python3.6/_compat.py__new__sz)with_metaclass..metaclass.__new__N)__name__ __module__ __qualname__rr)r r rr metaclasssrZtemporary_class)typer)r r rr)r r r with_metaclasssr) Z __future__rrrsys version_infoZPY2ZPY3strZ string_typesZ basestringrrrrr s__pycache__/_compat.cpython-36.pyc000064400000001634147204766430013045 0ustar003 ]\@sVddlmZmZmZddlZejddkZejddkZerDefZ ne fZ ddZ dS))absolute_importdivisionprint_functionNcs&Gfddd}tj|dfiS)z/ Create a base class with a metaclass. cseZdZfddZdS)z!with_metaclass..metaclasscs ||S)N)clsnameZ this_basesd)basesmetar/usr/lib/python3.6/_compat.py__new__sz)with_metaclass..metaclass.__new__N)__name__ __module__ __qualname__rr)r r rr metaclasssrZtemporary_class)typer)r r rr)r r r with_metaclasssr) Z __future__rrrsys version_infoZPY2ZPY3strZ string_typesZ basestringrrrrr s__pycache__/_structures.cpython-36.opt-1.pyc000064400000005335147204766430014746 0ustar003 ]@sDddlmZmZmZGdddeZeZGdddeZeZdS))absolute_importdivisionprint_functionc@sTeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)InfinitycCsdS)Nr)selfrr!/usr/lib/python3.6/_structures.py__repr__ szInfinity.__repr__cCs tt|S)N)hashrepr)rrrr__hash__ szInfinity.__hash__cCsdS)NFr)rotherrrr__lt__szInfinity.__lt__cCsdS)NFr)rr rrr__le__szInfinity.__le__cCs t||jS)N) isinstance __class__)rr rrr__eq__szInfinity.__eq__cCst||j S)N)rr)rr rrr__ne__szInfinity.__ne__cCsdS)NTr)rr rrr__gt__szInfinity.__gt__cCsdS)NTr)rr rrr__ge__szInfinity.__ge__cCstS)N)NegativeInfinity)rrrr__neg__!szInfinity.__neg__N) __name__ __module__ __qualname__r r rrrrrrrrrrrrsrc@sTeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)rcCsdS)Nz -Infinityr)rrrrr )szNegativeInfinity.__repr__cCs tt|S)N)r r )rrrrr ,szNegativeInfinity.__hash__cCsdS)NTr)rr rrrr/szNegativeInfinity.__lt__cCsdS)NTr)rr rrrr2szNegativeInfinity.__le__cCs t||jS)N)rr)rr rrrr5szNegativeInfinity.__eq__cCst||j S)N)rr)rr rrrr8szNegativeInfinity.__ne__cCsdS)NFr)rr rrrr;szNegativeInfinity.__gt__cCsdS)NFr)rr rrrr>szNegativeInfinity.__ge__cCstS)N)r)rrrrrAszNegativeInfinity.__neg__N) rrrr r rrrrrrrrrrrr'srN)Z __future__rrrobjectrrrrrrs__pycache__/_structures.cpython-36.pyc000064400000005335147204766430014007 0ustar003 ]@sDddlmZmZmZGdddeZeZGdddeZeZdS))absolute_importdivisionprint_functionc@sTeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)InfinitycCsdS)Nr)selfrr!/usr/lib/python3.6/_structures.py__repr__ szInfinity.__repr__cCs tt|S)N)hashrepr)rrrr__hash__ szInfinity.__hash__cCsdS)NFr)rotherrrr__lt__szInfinity.__lt__cCsdS)NFr)rr rrr__le__szInfinity.__le__cCs t||jS)N) isinstance __class__)rr rrr__eq__szInfinity.__eq__cCst||j S)N)rr)rr rrr__ne__szInfinity.__ne__cCsdS)NTr)rr rrr__gt__szInfinity.__gt__cCsdS)NTr)rr rrr__ge__szInfinity.__ge__cCstS)N)NegativeInfinity)rrrr__neg__!szInfinity.__neg__N) __name__ __module__ __qualname__r r rrrrrrrrrrrrsrc@sTeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)rcCsdS)Nz -Infinityr)rrrrr )szNegativeInfinity.__repr__cCs tt|S)N)r r )rrrrr ,szNegativeInfinity.__hash__cCsdS)NTr)rr rrrr/szNegativeInfinity.__lt__cCsdS)NTr)rr rrrr2szNegativeInfinity.__le__cCs t||jS)N)rr)rr rrrr5szNegativeInfinity.__eq__cCst||j S)N)rr)rr rrrr8szNegativeInfinity.__ne__cCsdS)NFr)rr rrrr;szNegativeInfinity.__gt__cCsdS)NFr)rr rrrr>szNegativeInfinity.__ge__cCstS)N)r)rrrrrAszNegativeInfinity.__neg__N) rrrr r rrrrrrrrrrrr'srN)Z __future__rrrobjectrrrrrrs__pycache__/markers.cpython-36.opt-1.pyc000064400000020745147204766430014032 0ustar003 ] @s@ddlmZmZmZddlZddlZddlZddlZddlm Z m Z m Z m Z ddlm Z mZmZmZddlmZddlmZddlmZmZd d d d d gZGdd d eZGdd d eZGdd d eZGdddeZGdddeZGdddeZ GdddeZ!ededBedBedBedBedBedBed Bed!Bed"Bed#Bed$Bed%Bed&Bed'Bed(Bed)Bed*BZ"d#d"ddddd+Z#e"j$d,d-ed.ed/Bed0Bed1Bed2Bed3Bed4Bed5BZ%e%ed6Bed7BZ&e&j$d8d-ed9ed:BZ'e'j$d;d-ed<ed=BZ(e"e'BZ)ee)e&e)Z*e*j$d>d-ed?j+Z,ed@j+Z-eZ.e*ee,e.e-BZ/e.e/e e(e.>e e.e Z0dAdBZ1dSdDdEZ2dFd-dGd-ej3ej4ej5ej6ej7ej8dHZ9dIdJZ:eZ;dKdLZdQd Z?GdRd d eZ@dS)T)absolute_importdivisionprint_functionN)ParseException ParseResults stringStart stringEnd) ZeroOrMoreGroupForward QuotedString)Literal) string_types) SpecifierInvalidSpecifier InvalidMarkerUndefinedComparisonUndefinedEnvironmentNameMarkerdefault_environmentc@seZdZdZdS)rzE An invalid marker was found, users should refer to PEP 508. N)__name__ __module__ __qualname____doc__rr/usr/lib/python3.6/markers.pyrsc@seZdZdZdS)rzP An invalid operation was attempted on a value that doesn't support it. N)rrrrrrrrrsc@seZdZdZdS)rz\ A name was attempted to be used that does not exist inside of the environment. N)rrrrrrrrr%sc@s,eZdZddZddZddZddZd S) NodecCs ||_dS)N)value)selfrrrr__init__.sz Node.__init__cCs t|jS)N)strr)rrrr__str__1sz Node.__str__cCsdj|jjt|S)Nz <{0}({1!r})>)format __class__rr!)rrrr__repr__4sz Node.__repr__cCstdS)N)NotImplementedError)rrrr serialize7szNode.serializeN)rrrr r"r%r'rrrrr,src@seZdZddZdS)VariablecCst|S)N)r!)rrrrr'=szVariable.serializeN)rrrr'rrrrr(;sr(c@seZdZddZdS)ValuecCs dj|S)Nz"{0}")r#)rrrrr'CszValue.serializeN)rrrr'rrrrr)Asr)c@seZdZddZdS)OpcCst|S)N)r!)rrrrr'Isz Op.serializeN)rrrr'rrrrr*Gsr*implementation_versionplatform_python_implementationimplementation_namepython_full_versionplatform_releaseplatform_versionplatform_machineplatform_systempython_version sys_platformos_namezos.namez sys.platformzplatform.versionzplatform.machinezplatform.python_implementationpython_implementationZextra)zos.namez sys.platformzplatform.versionzplatform.machinezplatform.python_implementationr6cCsttj|d|dS)Nr)r(ALIASESget)sltrrrisr<z===z==z>=z<=z!=z~=>sz(_coerce_parse_result..) isinstancer)resultsrrrrGs rGTcCst|tr4t|dkr4t|dttfr4t|dSt|trndd|D}|rZdj|Sddj|dSn"t|trdjdd |DS|SdS) Nrrcss|]}t|ddVqdS)F)firstN)_format_marker)rHmrrr sz!_format_marker.. rErFcSsg|] }|jqSr)r')rHrOrrrrJsz"_format_marker..)rKlistlenrDrNjoin)markerrMinnerrrrrNs    rNcCs||kS)Nr)lhsrhsrrrr<scCs||kS)Nr)rWrXrrrr<s)r?znot inr>z<=z==z!=z>=r=c Cslytdj|j|g}Wntk r.Yn X|j|Stj|j}|dkrbtdj||||||S)Nz#Undefined {0!r} on {1!r} and {2!r}.) rrTr'rcontains _operatorsr8rr#)rWoprXspecZoperrrr_eval_ops r^cCs&|j|t}|tkr"tdj||S)Nz/{0!r} does not exist in evaluation environment.)r8 _undefinedrr#) environmentnamerrrr_get_envs   rbc Csgg}x|D]}t|tr0|djt||q t|tr|\}}}t|trbt||j}|j}n|j}t||j}|djt|||q |dkr |jgq Wt dd|DS)NrrCcss|]}t|VqdS)N)all)rHitemrrrrPsz$_evaluate_markers..re) rKrRappend_evaluate_markersrDr(rbrr^any) Zmarkersr`groupsrUrWr\rXZ lhs_valueZ rhs_valuerrrrgs       rgcCs2dj|}|j}|dkr.||dt|j7}|S)Nz{0.major}.{0.minor}.{0.micro}finalr)r# releaselevelr!serial)infoversionZkindrrrformat_full_versions  roc Cslttdr ttjj}tjj}nd}d}||tjtjtj tj tjtj tj tj ddtjd S)Nimplementation0rY) r-r+r5r1r/r2r0r.r,r3r4) hasattrsysrorprnraosplatformmachinereleasesystemr3r6)Ziverr-rrrrs    c@s.eZdZddZddZddZd dd ZdS) rcCs`yttj||_WnFtk rZ}z*dj|||j|jd}t|WYdd}~XnXdS)Nz+Invalid marker: {0!r}, parse error at {1!r})rGMARKERZ parseString_markersrr#locr)rrUeZerr_strrrrr s zMarker.__init__cCs t|jS)N)rNr|)rrrrr"szMarker.__str__cCsdjt|S)Nz)r#r!)rrrrr%szMarker.__repr__NcCs$t}|dk r|j|t|j|S)a$Evaluate a marker. Return the boolean from evaluating the given marker against the environment. environment is an optional argument to override all or part of the determined environment. The environment is determined from the current Python process. N)rupdatergr|)rr`Zcurrent_environmentrrrevaluate s  zMarker.evaluate)N)rrrr r"r%rrrrrrs)T)AZ __future__rrroperatorrurvrtZ pyparsingrrrrr r r r r LZ_compatrZ specifiersrr__all__ ValueErrorrrrobjectrr(r)r*ZVARIABLEr7ZsetParseActionZ VERSION_CMPZ MARKER_OPZ MARKER_VALUEZBOOLOPZ MARKER_VARZ MARKER_ITEMsuppressZLPARENZRPARENZ MARKER_EXPRZ MARKER_ATOMr{rGrNltleeqnegegtr[r^r_rbrgrorrrrrrsx    6       __pycache__/markers.cpython-36.pyc000064400000021117147204766430013065 0ustar003 ] @s@ddlmZmZmZddlZddlZddlZddlZddlm Z m Z m Z m Z ddlm Z mZmZmZddlmZddlmZddlmZmZd d d d d gZGdd d eZGdd d eZGdd d eZGdddeZGdddeZGdddeZ GdddeZ!ededBedBedBedBedBedBed Bed!Bed"Bed#Bed$Bed%Bed&Bed'Bed(Bed)Bed*BZ"d#d"ddddd+Z#e"j$d,d-ed.ed/Bed0Bed1Bed2Bed3Bed4Bed5BZ%e%ed6Bed7BZ&e&j$d8d-ed9ed:BZ'e'j$d;d-ed<ed=BZ(e"e'BZ)ee)e&e)Z*e*j$d>d-ed?j+Z,ed@j+Z-eZ.e*ee,e.e-BZ/e.e/e e(e.>e e.e Z0dAdBZ1dSdDdEZ2dFd-dGd-ej3ej4ej5ej6ej7ej8dHZ9dIdJZ:eZ;dKdLZdQd Z?GdRd d eZ@dS)T)absolute_importdivisionprint_functionN)ParseException ParseResults stringStart stringEnd) ZeroOrMoreGroupForward QuotedString)Literal) string_types) SpecifierInvalidSpecifier InvalidMarkerUndefinedComparisonUndefinedEnvironmentNameMarkerdefault_environmentc@seZdZdZdS)rzE An invalid marker was found, users should refer to PEP 508. N)__name__ __module__ __qualname____doc__rr/usr/lib/python3.6/markers.pyrsc@seZdZdZdS)rzP An invalid operation was attempted on a value that doesn't support it. N)rrrrrrrrrsc@seZdZdZdS)rz\ A name was attempted to be used that does not exist inside of the environment. N)rrrrrrrrr%sc@s,eZdZddZddZddZddZd S) NodecCs ||_dS)N)value)selfrrrr__init__.sz Node.__init__cCs t|jS)N)strr)rrrr__str__1sz Node.__str__cCsdj|jjt|S)Nz <{0}({1!r})>)format __class__rr!)rrrr__repr__4sz Node.__repr__cCstdS)N)NotImplementedError)rrrr serialize7szNode.serializeN)rrrr r"r%r'rrrrr,src@seZdZddZdS)VariablecCst|S)N)r!)rrrrr'=szVariable.serializeN)rrrr'rrrrr(;sr(c@seZdZddZdS)ValuecCs dj|S)Nz"{0}")r#)rrrrr'CszValue.serializeN)rrrr'rrrrr)Asr)c@seZdZddZdS)OpcCst|S)N)r!)rrrrr'Isz Op.serializeN)rrrr'rrrrr*Gsr*implementation_versionplatform_python_implementationimplementation_namepython_full_versionplatform_releaseplatform_versionplatform_machineplatform_systempython_version sys_platformos_namezos.namez sys.platformzplatform.versionzplatform.machinezplatform.python_implementationpython_implementationZextra)zos.namez sys.platformzplatform.versionzplatform.machinezplatform.python_implementationr6cCsttj|d|dS)Nr)r(ALIASESget)sltrrrisr<z===z==z>=z<=z!=z~=>sz(_coerce_parse_result..) isinstancer)resultsrrrrGs rGTcCst|tttfstt|trHt|dkrHt|dttfrHt|dSt|trdd|D}|rndj|Sddj|dSn"t|trdjdd |DS|SdS) Nrrcss|]}t|ddVqdS)F)firstN)_format_marker)rHmrrr sz!_format_marker.. rErFcSsg|] }|jqSr)r')rHrOrrrrJsz"_format_marker..)rKlistrDrAssertionErrorlenrNjoin)markerrMinnerrrrrNs    rNcCs||kS)Nr)lhsrhsrrrr<scCs||kS)Nr)rXrYrrrr<s)r?znot inr>z<=z==z!=z>=r=c Cslytdj|j|g}Wntk r.Yn X|j|Stj|j}|dkrbtdj||||||S)Nz#Undefined {0!r} on {1!r} and {2!r}.) rrUr'rcontains _operatorsr8rr#)rXoprYspecZoperrrr_eval_ops r_cCs&|j|t}|tkr"tdj||S)Nz/{0!r} does not exist in evaluation environment.)r8 _undefinedrr#) environmentnamerrrr_get_envs   rcc Csgg}x|D]}t|tttfs$tt|trD|djt||q t|tr|\}}}t|trvt||j }|j }n|j }t||j }|djt |||q |dkst|dkr |jgq Wt dd|DS) NrrBrCcss|]}t|VqdS)N)all)rHitemrrrrPsz$_evaluate_markers..rf)rBrC) rKrRrDrrSappend_evaluate_markersr(rcrr_any) ZmarkersragroupsrVrXr]rYZ lhs_valueZ rhs_valuerrrrhs"        rhcCs2dj|}|j}|dkr.||dt|j7}|S)Nz{0.major}.{0.minor}.{0.micro}finalr)r# releaselevelr!serial)infoversionZkindrrrformat_full_versions  rpc Cslttdr ttjj}tjj}nd}d}||tjtjtj tj tjtj tj tj ddtjd S)Nimplementation0rZ) r-r+r5r1r/r2r0r.r,r3r4) hasattrsysrprqrorbosplatformmachinereleasesystemr3r6)Ziverr-rrrrs    c@s.eZdZddZddZddZd dd ZdS) rcCs`yttj||_WnFtk rZ}z*dj|||j|jd}t|WYdd}~XnXdS)Nz+Invalid marker: {0!r}, parse error at {1!r})rGMARKERZ parseString_markersrr#locr)rrVeZerr_strrrrr s zMarker.__init__cCs t|jS)N)rNr})rrrrr"szMarker.__str__cCsdjt|S)Nz)r#r!)rrrrr%szMarker.__repr__NcCs$t}|dk r|j|t|j|S)a$Evaluate a marker. Return the boolean from evaluating the given marker against the environment. environment is an optional argument to override all or part of the determined environment. The environment is determined from the current Python process. N)rupdaterhr})rraZcurrent_environmentrrrevaluate s  zMarker.evaluate)N)rrrr r"r%rrrrrrs)T)AZ __future__rrroperatorrvrwruZ pyparsingrrrrr r r r r LZ_compatrZ specifiersrr__all__ ValueErrorrrrobjectrr(r)r*ZVARIABLEr7ZsetParseActionZ VERSION_CMPZ MARKER_OPZ MARKER_VALUEZBOOLOPZ MARKER_VARZ MARKER_ITEMsuppressZLPARENZRPARENZ MARKER_EXPRZ MARKER_ATOMr|rGrNltleeqnegegtr\r_r`rcrhrprrrrrrsx    6       __pycache__/requirements.cpython-36.opt-1.pyc000064400000007256147204766430015113 0ustar003 ]@srddlmZmZmZddlZddlZddlmZmZm Z m Z ddlm Z m Z m Z mZmZddlmZddlmZddlmZmZdd lmZmZmZGd d d eZe ejejZ ed j!Z"ed j!Z#edj!Z$edj!Z%edj!Z&edj!Z'edj!Z(e dZ)e e e)e BZ*ee e e*Z+e+dZ,e+Z-eddZ.e(e.Z/e-e e&e-Z0e"e e0e#dZ1eej2ej3ej4BZ5eej2ej3ej4BZ6e5e6AZ7ee7e e&e7ddddZ8e e$e8e%e8BZ9e9j:dde e9dZ;e;j:dde edZej:d de'Ze/e e=Z?e,e e1e?e>BZ@ee@eZAGd!d"d"eBZCdS)#)absolute_importdivisionprint_functionN) stringStart stringEndoriginalTextForParseException) ZeroOrMoreWordOptionalRegexCombine)Literal)parse) MARKER_EXPRMarker)LegacySpecifier Specifier SpecifierSetc@seZdZdZdS)InvalidRequirementzJ An invalid requirement was found, users should refer to PEP 508. N)__name__ __module__ __qualname____doc__rr"/usr/lib/python3.6/requirements.pyrsr[](),;@z-_.namez[^ ]+urlextrasF)Z joinStringZadjacent _raw_speccCs |jpdS)N)r')sltrrr6sr, specifiercCs|dS)Nrr)r)r*r+rrrr,9smarkercCst||j|jS)N)rZ_original_startZ _original_end)r)r*r+rrrr,=sc@s(eZdZdZddZddZddZdS) RequirementzParse a requirement. Parse a given requirement string into its parts, such as name, specifier, URL, and extras. Raises InvalidRequirement on a badly-formed requirement string. cCsytj|}Wn@tk rN}z$tdj||j|jdWYdd}~XnX|j|_|jrtj|j}|j ot|j s|j r|j rtd|j|_nd|_t |j r|j j ng|_ t|j|_|jr|jnd|_dS)Nz+Invalid requirement, parse error at "{0!r}"zInvalid URL given) REQUIREMENTZ parseStringrrformatlocr$r%urlparseschemeZnetlocsetr&ZasListrr-r.)selfZrequirement_stringZreqeZ parsed_urlrrr__init__Xs"*   zRequirement.__init__cCsz|jg}|jr*|jdjdjt|j|jr@|jt|j|jrX|jdj|j|j rp|jdj|j dj|S)Nz[{0}]r!z@ {0}z; {0}r() r$r&appendr2joinsortedr-strr%r.)r7partsrrr__str__mszRequirement.__str__cCsdjt|S)Nz)r2r=)r7rrr__repr__~szRequirement.__repr__N)rrrrr9r?r@rrrrr/Ksr/)DZ __future__rrrstringreZ pyparsingrrrrr r r r r rLZsix.moves.urllibrr4ZmarkersrrZ specifiersrrr ValueErrorrZ ascii_lettersZdigitsZALPHANUMsuppressZLBRACKETZRBRACKETZLPARENZRPARENCOMMAZ SEMICOLONATZ PUNCTUATIONZIDENTIFIER_ENDZ IDENTIFIERNAMEZEXTRAZURIZURLZ EXTRAS_LISTZEXTRASZ _regex_strVERBOSE IGNORECASEZVERSION_PEP440ZVERSION_LEGACYZ VERSION_ONEZ VERSION_MANYZ _VERSION_SPECZsetParseActionZ VERSION_SPECZMARKER_SEPERATORZMARKERZVERSION_AND_MARKERZURL_AND_MARKERZNAMED_REQUIREMENTr1objectr/rrrrsZ               __pycache__/requirements.cpython-36.pyc000064400000007256147204766430014154 0ustar003 ]@srddlmZmZmZddlZddlZddlmZmZm Z m Z ddlm Z m Z m Z mZmZddlmZddlmZddlmZmZdd lmZmZmZGd d d eZe ejejZ ed j!Z"ed j!Z#edj!Z$edj!Z%edj!Z&edj!Z'edj!Z(e dZ)e e e)e BZ*ee e e*Z+e+dZ,e+Z-eddZ.e(e.Z/e-e e&e-Z0e"e e0e#dZ1eej2ej3ej4BZ5eej2ej3ej4BZ6e5e6AZ7ee7e e&e7ddddZ8e e$e8e%e8BZ9e9j:dde e9dZ;e;j:dde edZej:d de'Ze/e e=Z?e,e e1e?e>BZ@ee@eZAGd!d"d"eBZCdS)#)absolute_importdivisionprint_functionN) stringStart stringEndoriginalTextForParseException) ZeroOrMoreWordOptionalRegexCombine)Literal)parse) MARKER_EXPRMarker)LegacySpecifier Specifier SpecifierSetc@seZdZdZdS)InvalidRequirementzJ An invalid requirement was found, users should refer to PEP 508. N)__name__ __module__ __qualname____doc__rr"/usr/lib/python3.6/requirements.pyrsr[](),;@z-_.namez[^ ]+urlextrasF)Z joinStringZadjacent _raw_speccCs |jpdS)N)r')sltrrr6sr, specifiercCs|dS)Nrr)r)r*r+rrrr,9smarkercCst||j|jS)N)rZ_original_startZ _original_end)r)r*r+rrrr,=sc@s(eZdZdZddZddZddZdS) RequirementzParse a requirement. Parse a given requirement string into its parts, such as name, specifier, URL, and extras. Raises InvalidRequirement on a badly-formed requirement string. cCsytj|}Wn@tk rN}z$tdj||j|jdWYdd}~XnX|j|_|jrtj|j}|j ot|j s|j r|j rtd|j|_nd|_t |j r|j j ng|_ t|j|_|jr|jnd|_dS)Nz+Invalid requirement, parse error at "{0!r}"zInvalid URL given) REQUIREMENTZ parseStringrrformatlocr$r%urlparseschemeZnetlocsetr&ZasListrr-r.)selfZrequirement_stringZreqeZ parsed_urlrrr__init__Xs"*   zRequirement.__init__cCsz|jg}|jr*|jdjdjt|j|jr@|jt|j|jrX|jdj|j|j rp|jdj|j dj|S)Nz[{0}]r!z@ {0}z; {0}r() r$r&appendr2joinsortedr-strr%r.)r7partsrrr__str__mszRequirement.__str__cCsdjt|S)Nz)r2r=)r7rrr__repr__~szRequirement.__repr__N)rrrrr9r?r@rrrrr/Ksr/)DZ __future__rrrstringreZ pyparsingrrrrr r r r r rLZsix.moves.urllibrr4ZmarkersrrZ specifiersrrr ValueErrorrZ ascii_lettersZdigitsZALPHANUMsuppressZLBRACKETZRBRACKETZLPARENZRPARENCOMMAZ SEMICOLONATZ PUNCTUATIONZIDENTIFIER_ENDZ IDENTIFIERNAMEZEXTRAZURIZURLZ EXTRAS_LISTZEXTRASZ _regex_strVERBOSE IGNORECASEZVERSION_PEP440ZVERSION_LEGACYZ VERSION_ONEZ VERSION_MANYZ _VERSION_SPECZsetParseActionZ VERSION_SPECZMARKER_SEPERATORZMARKERZVERSION_AND_MARKERZURL_AND_MARKERZNAMED_REQUIREMENTr1objectr/rrrrsZ               __pycache__/specifiers.cpython-36.opt-1.pyc000064400000046437147204766430014530 0ustar003 ]ym@sddlmZmZmZddlZddlZddlZddlZddlm Z m Z ddl m Z m Z mZGdddeZGdd d e ejeZGd d d eZGd d d eZddZGdddeZejdZddZddZGdddeZdS))absolute_importdivisionprint_functionN) string_typeswith_metaclass)Version LegacyVersionparsec@seZdZdZdS)InvalidSpecifierzH An invalid specifier was found, users should refer to PEP 440. N)__name__ __module__ __qualname____doc__rr /usr/lib/python3.6/specifiers.pyr sr c@seZdZejddZejddZejddZejddZej d d Z e j d d Z ejdd dZ ejdddZ d S) BaseSpecifiercCsdS)z Returns the str representation of this Specifier like object. This should be representative of the Specifier itself. Nr)selfrrr__str__szBaseSpecifier.__str__cCsdS)zF Returns a hash value for this Specifier like object. Nr)rrrr__hash__szBaseSpecifier.__hash__cCsdS)zq Returns a boolean representing whether or not the two Specifier like objects are equal. Nr)rotherrrr__eq__$szBaseSpecifier.__eq__cCsdS)zu Returns a boolean representing whether or not the two Specifier like objects are not equal. Nr)rrrrr__ne__+szBaseSpecifier.__ne__cCsdS)zg Returns whether or not pre-releases as a whole are allowed by this specifier. Nr)rrrr prereleases2szBaseSpecifier.prereleasescCsdS)zd Sets whether or not pre-releases as a whole are allowed by this specifier. Nr)rvaluerrrr9sNcCsdS)zR Determines if the given item is contained within this specifier. Nr)ritemrrrrcontains@szBaseSpecifier.containscCsdS)z Takes an iterable of items and filters them so that only items which are contained within this specifier are allowed in it. Nr)riterablerrrrfilterFszBaseSpecifier.filter)N)N)r r rabcabstractmethodrrrrabstractpropertyrsetterrrrrrrrs rc@seZdZiZd ddZddZddZd d Zd d Zd dZ ddZ ddZ e ddZ e ddZe ddZejddZddZd!ddZd"ddZdS)#_IndividualSpecifierNcCsF|jj|}|stdj||jdj|jdjf|_||_dS)NzInvalid specifier: '{0}'operatorversion)_regexsearchr formatgroupstrip_spec _prereleases)rspecrmatchrrr__init__Rs   z_IndividualSpecifier.__init__cCs0|jdk rdj|jnd}dj|jjt||S)Nz, prereleases={0!r}r$z<{0}({1!r}{2})>)r-r)r __class__r str)rprerrr__repr___s z_IndividualSpecifier.__repr__cCs dj|jS)Nz{0}{1})r)r,)rrrrrlsz_IndividualSpecifier.__str__cCs t|jS)N)hashr,)rrrrrosz_IndividualSpecifier.__hash__c CsLt|tr0y|j|}Wq@tk r,tSXnt||js@tS|j|jkS)N) isinstancerr1r NotImplementedr,)rrrrrrrs  z_IndividualSpecifier.__eq__c CsLt|tr0y|j|}Wq@tk r,tSXnt||js@tS|j|jkS)N)r6rr1r r7r,)rrrrrr}s  z_IndividualSpecifier.__ne__cCst|dj|j|S)Nz _compare_{0})getattrr) _operators)roprrr _get_operatorsz"_IndividualSpecifier._get_operatorcCst|ttfst|}|S)N)r6r rr )rr&rrr_coerce_versionsz$_IndividualSpecifier._coerce_versioncCs |jdS)Nr)r,)rrrrr%sz_IndividualSpecifier.operatorcCs |jdS)Nr)r,)rrrrr&sz_IndividualSpecifier.versioncCs|jS)N)r-)rrrrrsz _IndividualSpecifier.prereleasescCs ||_dS)N)r-)rrrrrrscCs |j|S)N)r)rrrrr __contains__sz!_IndividualSpecifier.__contains__cCs<|dkr|j}|j|}|jr(| r(dS|j|j||jS)NF)rr< is_prereleaser;r%r&)rrrrrrrs   z_IndividualSpecifier.containsccsd}g}d|dk r|ndi}xL|D]D}|j|}|j|f|r"|jr\|pL|j r\|j|q"d}|Vq"W| r|rx|D] }|VqzWdS)NFrT)r<rr>rappend)rrrZyieldedfound_prereleaseskwr&parsed_versionrrrrs       z_IndividualSpecifier.filter)r$N)N)N)r r rr9r0r4rrrrr;r<propertyr%r&rr"r=rrrrrrr#Ns         r#c@sveZdZdZejdedejejBZdddddd d Z d d Z d dZ ddZ ddZ ddZddZddZdS)LegacySpecifiera (?P(==|!=|<=|>=|<|>)) \s* (?P [^,;\s)]* # Since this is a "legacy" specifier, and the version # string can be just about anything, we match everything # except for whitespace, a semi-colon for marker support, # a closing paren since versions can be enclosed in # them, and a comma since it's a version separator. ) z^\s*z\s*$equal not_equalless_than_equalgreater_than_equal less_than greater_than)z==z!=z<=z>=<>cCst|tstt|}|S)N)r6r r2)rr&rrrr<s  zLegacySpecifier._coerce_versioncCs||j|kS)N)r<)r prospectiver.rrr_compare_equalszLegacySpecifier._compare_equalcCs||j|kS)N)r<)rrMr.rrr_compare_not_equalsz"LegacySpecifier._compare_not_equalcCs||j|kS)N)r<)rrMr.rrr_compare_less_than_equalsz(LegacySpecifier._compare_less_than_equalcCs||j|kS)N)r<)rrMr.rrr_compare_greater_than_equalsz+LegacySpecifier._compare_greater_than_equalcCs||j|kS)N)r<)rrMr.rrr_compare_less_thansz"LegacySpecifier._compare_less_thancCs||j|kS)N)r<)rrMr.rrr_compare_greater_thansz%LegacySpecifier._compare_greater_thanN)r r r _regex_strrecompileVERBOSE IGNORECASEr'r9r<rNrOrPrQrRrSrrrrrDs  rDcstjfdd}|S)Ncst|tsdS|||S)NF)r6r)rrMr.)fnrrwrapped s z)_require_version_compare..wrapped) functoolswraps)rYrZr)rYr_require_version_compare sr]c @seZdZdZejdedejejBZdddddd d d d Z e d dZ e ddZ e ddZ e ddZe ddZe ddZe ddZddZeddZejddZd S)! Specifiera (?P(~=|==|!=|<=|>=|<|>|===)) (?P (?: # The identity operators allow for an escape hatch that will # do an exact string match of the version you wish to install. # This will not be parsed by PEP 440 and we cannot determine # any semantic meaning from it. This operator is discouraged # but included entirely as an escape hatch. (?<====) # Only match for the identity operator \s* [^\s]* # We just match everything, except for whitespace # since we are only testing for strict identity. ) | (?: # The (non)equality operators allow for wild card and local # versions to be specified so we have to define these two # operators separately to enable that. (?<===|!=) # Only match for equals and not equals \s* v? (?:[0-9]+!)? # epoch [0-9]+(?:\.[0-9]+)* # release (?: # pre release [-_\.]? (a|b|c|rc|alpha|beta|pre|preview) [-_\.]? [0-9]* )? (?: # post release (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) )? # You cannot use a wild card and a dev or local version # together so group them with a | and make them optional. (?: (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local | \.\* # Wild card syntax of .* )? ) | (?: # The compatible operator requires at least two digits in the # release segment. (?<=~=) # Only match for the compatible operator \s* v? (?:[0-9]+!)? # epoch [0-9]+(?:\.[0-9]+)+ # release (We have a + instead of a *) (?: # pre release [-_\.]? (a|b|c|rc|alpha|beta|pre|preview) [-_\.]? [0-9]* )? (?: # post release (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) )? (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release ) | (?: # All other operators only allow a sub set of what the # (non)equality operators do. Specifically they do not allow # local versions to be specified nor do they allow the prefix # matching wild cards. (?=rKrLz===cCsNdjttjddt|dd}|d7}|jd||oL|jd||S) N.cSs|jd o|jd S)NZpostZdev) startswith)xrrrs z/Specifier._compare_compatible..rz.*z>=z==)joinlist itertools takewhile_version_splitr;)rrMr.prefixrrr_compare_compatibles   zSpecifier._compare_compatiblecCsp|jdrPt|j}t|dd}tt|}|dt|}t||\}}nt|}|jsht|j}||kS)Nz.*)endswithrZpublicrhr2len _pad_versionlocal)rrMr.rrrrNs    zSpecifier._compare_equalcCs|j|| S)N)rN)rrMr.rrrrOszSpecifier._compare_not_equalcCs |t|kS)N)r)rrMr.rrrrPsz"Specifier._compare_less_than_equalcCs |t|kS)N)r)rrMr.rrrrQsz%Specifier._compare_greater_than_equalcCs>t|}||ksdS|j r:|jr:t|jt|jkr:dSdS)NFT)rr> base_version)rrMr.rrrrRszSpecifier._compare_less_thancCs`t|}||ksdS|j r:|jr:t|jt|jkr:dS|jdk r\t|jt|jkr\dSdS)NFT)rZis_postreleaserqrp)rrMr.rrrrSs zSpecifier._compare_greater_thancCst|jt|jkS)N)r2lower)rrMr.rrr_compare_arbitraryszSpecifier._compare_arbitrarycCsR|jdk r|jS|j\}}|d krN|dkr@|jdr@|dd }t|jrNdSd S) N==>=<=~====z.*rkTF)rtrurvrwrxrl)r-r,rmr r>)rr%r&rrrrs    zSpecifier.prereleasescCs ||_dS)N)r-)rrrrrrsN)r r rrTrUrVrWrXr'r9r]rjrNrOrPrQrRrSrsrCrr"rrrrr^s*^  #      r^z^([0-9]+)((?:a|b|c|rc)[0-9]+)$cCsDg}x:|jdD],}tj|}|r2|j|jq|j|qW|S)Nr_)split _prefix_regexr(extendgroupsr?)r&resultrr/rrrrh's rhc Csgg}}|jttjdd||jttjdd||j|t|dd|j|t|dd|jddgtdt|dt|d|jddgtdt|dt|dttj|ttj|fS)NcSs|jS)N)isdigit)rarrrrb6sz_pad_version..cSs|jS)N)r~)rarrrrb7srr0)r?rerfrgrninsertmaxchain)leftrightZ left_splitZ right_splitrrrro2s && roc@seZdZdddZddZddZd d Zd d Zd dZddZ ddZ ddZ e ddZ e jddZ ddZdddZd ddZdS)! SpecifierSetr$Nc Csrdd|jdD}t}xB|D]:}y|jt|Wq tk rX|jt|Yq Xq Wt||_||_dS)NcSsg|]}|jr|jqSr)r+).0srrr Rsz)SpecifierSet.__init__..,) rysetaddr^r rD frozenset_specsr-)rZ specifiersrZparsed specifierrrrr0Os  zSpecifierSet.__init__cCs*|jdk rdj|jnd}djt||S)Nz, prereleases={0!r}r$z)r-r)rr2)rr3rrrr4dszSpecifierSet.__repr__cCsdjtdd|jDS)Nrcss|]}t|VqdS)N)r2)rrrrr nsz'SpecifierSet.__str__..)rdsortedr)rrrrrmszSpecifierSet.__str__cCs t|jS)N)r5r)rrrrrpszSpecifierSet.__hash__cCst|trt|}nt|ts"tSt}t|j|jB|_|jdkrX|jdk rX|j|_n<|jdk rv|jdkrv|j|_n|j|jkr|j|_ntd|S)NzFCannot combine SpecifierSets with True and False prerelease overrides.)r6rrr7rrr- ValueError)rrrrrr__and__ss       zSpecifierSet.__and__cCsFt|trt|}n&t|tr,tt|}nt|ts:tS|j|jkS)N)r6rrr#r2r7r)rrrrrrs    zSpecifierSet.__eq__cCsFt|trt|}n&t|tr,tt|}nt|ts:tS|j|jkS)N)r6rrr#r2r7r)rrrrrrs    zSpecifierSet.__ne__cCs t|jS)N)rnr)rrrr__len__szSpecifierSet.__len__cCs t|jS)N)iterr)rrrr__iter__szSpecifierSet.__iter__cCs.|jdk r|jS|jsdStdd|jDS)Ncss|] }|jVqdS)N)r)rrrrrrsz+SpecifierSet.prereleases..)r-rany)rrrrrs  zSpecifierSet.prereleasescCs ||_dS)N)r-)rrrrrrscCs |j|S)N)r)rrrrrr=szSpecifierSet.__contains__csNtttfstdkr$|j r4jr4dStfdd|jDS)NFc3s|]}|jdVqdS))rN)r)rr)rrrrrsz(SpecifierSet.contains..)r6r rr rr>allr)rrrr)rrrrs  zSpecifierSet.containscCs|dkr|j}|jr:x |jD]}|j|t|d}qW|Sg}g}xZ|D]R}t|ttfsdt|}n|}t|trtqH|jr| r|s|j |qH|j |qHW| r|r|dkr|S|SdS)N)r) rrrboolr6r rr r>r?)rrrr.Zfilteredr@rrBrrrrs*      zSpecifierSet.filter)r$N)N)N)r r rr0r4rrrrrrrrCrr"r=rrrrrrrMs      r)Z __future__rrrrr[rfrUZ_compatrrr&rr r rr ABCMetaobjectrr#rDr]r^rVrzrhrorrrrrs&9 4   __pycache__/specifiers.cpython-36.pyc000064400000046437147204766430013571 0ustar003 ]ym@sddlmZmZmZddlZddlZddlZddlZddlm Z m Z ddl m Z m Z mZGdddeZGdd d e ejeZGd d d eZGd d d eZddZGdddeZejdZddZddZGdddeZdS))absolute_importdivisionprint_functionN) string_typeswith_metaclass)Version LegacyVersionparsec@seZdZdZdS)InvalidSpecifierzH An invalid specifier was found, users should refer to PEP 440. N)__name__ __module__ __qualname____doc__rr /usr/lib/python3.6/specifiers.pyr sr c@seZdZejddZejddZejddZejddZej d d Z e j d d Z ejdd dZ ejdddZ d S) BaseSpecifiercCsdS)z Returns the str representation of this Specifier like object. This should be representative of the Specifier itself. Nr)selfrrr__str__szBaseSpecifier.__str__cCsdS)zF Returns a hash value for this Specifier like object. Nr)rrrr__hash__szBaseSpecifier.__hash__cCsdS)zq Returns a boolean representing whether or not the two Specifier like objects are equal. Nr)rotherrrr__eq__$szBaseSpecifier.__eq__cCsdS)zu Returns a boolean representing whether or not the two Specifier like objects are not equal. Nr)rrrrr__ne__+szBaseSpecifier.__ne__cCsdS)zg Returns whether or not pre-releases as a whole are allowed by this specifier. Nr)rrrr prereleases2szBaseSpecifier.prereleasescCsdS)zd Sets whether or not pre-releases as a whole are allowed by this specifier. Nr)rvaluerrrr9sNcCsdS)zR Determines if the given item is contained within this specifier. Nr)ritemrrrrcontains@szBaseSpecifier.containscCsdS)z Takes an iterable of items and filters them so that only items which are contained within this specifier are allowed in it. Nr)riterablerrrrfilterFszBaseSpecifier.filter)N)N)r r rabcabstractmethodrrrrabstractpropertyrsetterrrrrrrrs rc@seZdZiZd ddZddZddZd d Zd d Zd dZ ddZ ddZ e ddZ e ddZe ddZejddZddZd!ddZd"ddZdS)#_IndividualSpecifierNcCsF|jj|}|stdj||jdj|jdjf|_||_dS)NzInvalid specifier: '{0}'operatorversion)_regexsearchr formatgroupstrip_spec _prereleases)rspecrmatchrrr__init__Rs   z_IndividualSpecifier.__init__cCs0|jdk rdj|jnd}dj|jjt||S)Nz, prereleases={0!r}r$z<{0}({1!r}{2})>)r-r)r __class__r str)rprerrr__repr___s z_IndividualSpecifier.__repr__cCs dj|jS)Nz{0}{1})r)r,)rrrrrlsz_IndividualSpecifier.__str__cCs t|jS)N)hashr,)rrrrrosz_IndividualSpecifier.__hash__c CsLt|tr0y|j|}Wq@tk r,tSXnt||js@tS|j|jkS)N) isinstancerr1r NotImplementedr,)rrrrrrrs  z_IndividualSpecifier.__eq__c CsLt|tr0y|j|}Wq@tk r,tSXnt||js@tS|j|jkS)N)r6rr1r r7r,)rrrrrr}s  z_IndividualSpecifier.__ne__cCst|dj|j|S)Nz _compare_{0})getattrr) _operators)roprrr _get_operatorsz"_IndividualSpecifier._get_operatorcCst|ttfst|}|S)N)r6r rr )rr&rrr_coerce_versionsz$_IndividualSpecifier._coerce_versioncCs |jdS)Nr)r,)rrrrr%sz_IndividualSpecifier.operatorcCs |jdS)Nr)r,)rrrrr&sz_IndividualSpecifier.versioncCs|jS)N)r-)rrrrrsz _IndividualSpecifier.prereleasescCs ||_dS)N)r-)rrrrrrscCs |j|S)N)r)rrrrr __contains__sz!_IndividualSpecifier.__contains__cCs<|dkr|j}|j|}|jr(| r(dS|j|j||jS)NF)rr< is_prereleaser;r%r&)rrrrrrrs   z_IndividualSpecifier.containsccsd}g}d|dk r|ndi}xL|D]D}|j|}|j|f|r"|jr\|pL|j r\|j|q"d}|Vq"W| r|rx|D] }|VqzWdS)NFrT)r<rr>rappend)rrrZyieldedfound_prereleaseskwr&parsed_versionrrrrs       z_IndividualSpecifier.filter)r$N)N)N)r r rr9r0r4rrrrr;r<propertyr%r&rr"r=rrrrrrr#Ns         r#c@sveZdZdZejdedejejBZdddddd d Z d d Z d dZ ddZ ddZ ddZddZddZdS)LegacySpecifiera (?P(==|!=|<=|>=|<|>)) \s* (?P [^,;\s)]* # Since this is a "legacy" specifier, and the version # string can be just about anything, we match everything # except for whitespace, a semi-colon for marker support, # a closing paren since versions can be enclosed in # them, and a comma since it's a version separator. ) z^\s*z\s*$equal not_equalless_than_equalgreater_than_equal less_than greater_than)z==z!=z<=z>=<>cCst|tstt|}|S)N)r6r r2)rr&rrrr<s  zLegacySpecifier._coerce_versioncCs||j|kS)N)r<)r prospectiver.rrr_compare_equalszLegacySpecifier._compare_equalcCs||j|kS)N)r<)rrMr.rrr_compare_not_equalsz"LegacySpecifier._compare_not_equalcCs||j|kS)N)r<)rrMr.rrr_compare_less_than_equalsz(LegacySpecifier._compare_less_than_equalcCs||j|kS)N)r<)rrMr.rrr_compare_greater_than_equalsz+LegacySpecifier._compare_greater_than_equalcCs||j|kS)N)r<)rrMr.rrr_compare_less_thansz"LegacySpecifier._compare_less_thancCs||j|kS)N)r<)rrMr.rrr_compare_greater_thansz%LegacySpecifier._compare_greater_thanN)r r r _regex_strrecompileVERBOSE IGNORECASEr'r9r<rNrOrPrQrRrSrrrrrDs  rDcstjfdd}|S)Ncst|tsdS|||S)NF)r6r)rrMr.)fnrrwrapped s z)_require_version_compare..wrapped) functoolswraps)rYrZr)rYr_require_version_compare sr]c @seZdZdZejdedejejBZdddddd d d d Z e d dZ e ddZ e ddZ e ddZe ddZe ddZe ddZddZeddZejddZd S)! Specifiera (?P(~=|==|!=|<=|>=|<|>|===)) (?P (?: # The identity operators allow for an escape hatch that will # do an exact string match of the version you wish to install. # This will not be parsed by PEP 440 and we cannot determine # any semantic meaning from it. This operator is discouraged # but included entirely as an escape hatch. (?<====) # Only match for the identity operator \s* [^\s]* # We just match everything, except for whitespace # since we are only testing for strict identity. ) | (?: # The (non)equality operators allow for wild card and local # versions to be specified so we have to define these two # operators separately to enable that. (?<===|!=) # Only match for equals and not equals \s* v? (?:[0-9]+!)? # epoch [0-9]+(?:\.[0-9]+)* # release (?: # pre release [-_\.]? (a|b|c|rc|alpha|beta|pre|preview) [-_\.]? [0-9]* )? (?: # post release (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) )? # You cannot use a wild card and a dev or local version # together so group them with a | and make them optional. (?: (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local | \.\* # Wild card syntax of .* )? ) | (?: # The compatible operator requires at least two digits in the # release segment. (?<=~=) # Only match for the compatible operator \s* v? (?:[0-9]+!)? # epoch [0-9]+(?:\.[0-9]+)+ # release (We have a + instead of a *) (?: # pre release [-_\.]? (a|b|c|rc|alpha|beta|pre|preview) [-_\.]? [0-9]* )? (?: # post release (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) )? (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release ) | (?: # All other operators only allow a sub set of what the # (non)equality operators do. Specifically they do not allow # local versions to be specified nor do they allow the prefix # matching wild cards. (?=rKrLz===cCsNdjttjddt|dd}|d7}|jd||oL|jd||S) N.cSs|jd o|jd S)NZpostZdev) startswith)xrrrs z/Specifier._compare_compatible..rz.*z>=z==)joinlist itertools takewhile_version_splitr;)rrMr.prefixrrr_compare_compatibles   zSpecifier._compare_compatiblecCsp|jdrPt|j}t|dd}tt|}|dt|}t||\}}nt|}|jsht|j}||kS)Nz.*)endswithrZpublicrhr2len _pad_versionlocal)rrMr.rrrrNs    zSpecifier._compare_equalcCs|j|| S)N)rN)rrMr.rrrrOszSpecifier._compare_not_equalcCs |t|kS)N)r)rrMr.rrrrPsz"Specifier._compare_less_than_equalcCs |t|kS)N)r)rrMr.rrrrQsz%Specifier._compare_greater_than_equalcCs>t|}||ksdS|j r:|jr:t|jt|jkr:dSdS)NFT)rr> base_version)rrMr.rrrrRszSpecifier._compare_less_thancCs`t|}||ksdS|j r:|jr:t|jt|jkr:dS|jdk r\t|jt|jkr\dSdS)NFT)rZis_postreleaserqrp)rrMr.rrrrSs zSpecifier._compare_greater_thancCst|jt|jkS)N)r2lower)rrMr.rrr_compare_arbitraryszSpecifier._compare_arbitrarycCsR|jdk r|jS|j\}}|d krN|dkr@|jdr@|dd }t|jrNdSd S) N==>=<=~====z.*rkTF)rtrurvrwrxrl)r-r,rmr r>)rr%r&rrrrs    zSpecifier.prereleasescCs ||_dS)N)r-)rrrrrrsN)r r rrTrUrVrWrXr'r9r]rjrNrOrPrQrRrSrsrCrr"rrrrr^s*^  #      r^z^([0-9]+)((?:a|b|c|rc)[0-9]+)$cCsDg}x:|jdD],}tj|}|r2|j|jq|j|qW|S)Nr_)split _prefix_regexr(extendgroupsr?)r&resultrr/rrrrh's rhc Csgg}}|jttjdd||jttjdd||j|t|dd|j|t|dd|jddgtdt|dt|d|jddgtdt|dt|dttj|ttj|fS)NcSs|jS)N)isdigit)rarrrrb6sz_pad_version..cSs|jS)N)r~)rarrrrb7srr0)r?rerfrgrninsertmaxchain)leftrightZ left_splitZ right_splitrrrro2s && roc@seZdZdddZddZddZd d Zd d Zd dZddZ ddZ ddZ e ddZ e jddZ ddZdddZd ddZdS)! SpecifierSetr$Nc Csrdd|jdD}t}xB|D]:}y|jt|Wq tk rX|jt|Yq Xq Wt||_||_dS)NcSsg|]}|jr|jqSr)r+).0srrr Rsz)SpecifierSet.__init__..,) rysetaddr^r rD frozenset_specsr-)rZ specifiersrZparsed specifierrrrr0Os  zSpecifierSet.__init__cCs*|jdk rdj|jnd}djt||S)Nz, prereleases={0!r}r$z)r-r)rr2)rr3rrrr4dszSpecifierSet.__repr__cCsdjtdd|jDS)Nrcss|]}t|VqdS)N)r2)rrrrr nsz'SpecifierSet.__str__..)rdsortedr)rrrrrmszSpecifierSet.__str__cCs t|jS)N)r5r)rrrrrpszSpecifierSet.__hash__cCst|trt|}nt|ts"tSt}t|j|jB|_|jdkrX|jdk rX|j|_n<|jdk rv|jdkrv|j|_n|j|jkr|j|_ntd|S)NzFCannot combine SpecifierSets with True and False prerelease overrides.)r6rrr7rrr- ValueError)rrrrrr__and__ss       zSpecifierSet.__and__cCsFt|trt|}n&t|tr,tt|}nt|ts:tS|j|jkS)N)r6rrr#r2r7r)rrrrrrs    zSpecifierSet.__eq__cCsFt|trt|}n&t|tr,tt|}nt|ts:tS|j|jkS)N)r6rrr#r2r7r)rrrrrrs    zSpecifierSet.__ne__cCs t|jS)N)rnr)rrrr__len__szSpecifierSet.__len__cCs t|jS)N)iterr)rrrr__iter__szSpecifierSet.__iter__cCs.|jdk r|jS|jsdStdd|jDS)Ncss|] }|jVqdS)N)r)rrrrrrsz+SpecifierSet.prereleases..)r-rany)rrrrrs  zSpecifierSet.prereleasescCs ||_dS)N)r-)rrrrrrscCs |j|S)N)r)rrrrrr=szSpecifierSet.__contains__csNtttfstdkr$|j r4jr4dStfdd|jDS)NFc3s|]}|jdVqdS))rN)r)rr)rrrrrsz(SpecifierSet.contains..)r6r rr rr>allr)rrrr)rrrrs  zSpecifierSet.containscCs|dkr|j}|jr:x |jD]}|j|t|d}qW|Sg}g}xZ|D]R}t|ttfsdt|}n|}t|trtqH|jr| r|s|j |qH|j |qHW| r|r|dkr|S|SdS)N)r) rrrboolr6r rr r>r?)rrrr.Zfilteredr@rrBrrrrs*      zSpecifierSet.filter)r$N)N)N)r r rr0r4rrrrrrrrCrr"r=rrrrrrrMs      r)Z __future__rrrrr[rfrUZ_compatrrr&rr r rr ABCMetaobjectrr#rDr]r^rVrzrhrorrrrrs&9 4   __pycache__/utils.cpython-36.opt-1.pyc000064400000000630147204766430013515 0ustar003 ]@s2ddlmZmZmZddlZejdZddZdS))absolute_importdivisionprint_functionNz[-_.]+cCstjd|jS)N-)_canonicalize_regexsublower)namer /usr/lib/python3.6/utils.pycanonicalize_name sr )Z __future__rrrrecompilerr r r r r s __pycache__/utils.cpython-36.pyc000064400000000630147204766430012556 0ustar003 ]@s2ddlmZmZmZddlZejdZddZdS))absolute_importdivisionprint_functionNz[-_.]+cCstjd|jS)N-)_canonicalize_regexsublower)namer /usr/lib/python3.6/utils.pycanonicalize_name sr )Z __future__rrrrecompilerr r r r r s __pycache__/version.cpython-36.opt-1.pyc000064400000024426147204766430014053 0ustar003 ]$-@sddlmZmZmZddlZddlZddlZddlmZddddd gZ ej d d d d dddgZ ddZ Gddde ZGdddeZGdddeZejdejZddddddZddZddZdZGd ddeZd!d"Zejd#Zd$d%Zd&d'ZdS)()absolute_importdivisionprint_functionN)InfinityparseVersion LegacyVersionInvalidVersionVERSION_PATTERN_Versionepochreleasedevprepostlocalc Cs&yt|Stk r t|SXdS)z Parse the given version string and return either a :class:`Version` object or a :class:`LegacyVersion` object depending on if the given version is a valid PEP 440 version or a legacy version. N)rr r )versionr/usr/lib/python3.6/version.pyrsc@seZdZdZdS)r zF An invalid version was found, users should refer to PEP 440. N)__name__ __module__ __qualname____doc__rrrrr $sc@sLeZdZddZddZddZddZd d Zd d Zd dZ ddZ dS) _BaseVersioncCs t|jS)N)hash_key)selfrrr__hash__,sz_BaseVersion.__hash__cCs|j|ddS)NcSs||kS)Nr)sorrr0sz%_BaseVersion.__lt__..)_compare)rotherrrr__lt__/sz_BaseVersion.__lt__cCs|j|ddS)NcSs||kS)Nr)rr rrrr!3sz%_BaseVersion.__le__..)r")rr#rrr__le__2sz_BaseVersion.__le__cCs|j|ddS)NcSs||kS)Nr)rr rrrr!6sz%_BaseVersion.__eq__..)r")rr#rrr__eq__5sz_BaseVersion.__eq__cCs|j|ddS)NcSs||kS)Nr)rr rrrr!9sz%_BaseVersion.__ge__..)r")rr#rrr__ge__8sz_BaseVersion.__ge__cCs|j|ddS)NcSs||kS)Nr)rr rrrr!<sz%_BaseVersion.__gt__..)r")rr#rrr__gt__;sz_BaseVersion.__gt__cCs|j|ddS)NcSs||kS)Nr)rr rrrr!?sz%_BaseVersion.__ne__..)r")rr#rrr__ne__>sz_BaseVersion.__ne__cCst|tstS||j|jS)N) isinstancerNotImplementedr)rr#methodrrrr"As z_BaseVersion._compareN) rrrrr$r%r&r'r(r)r"rrrrr*src@s`eZdZddZddZddZeddZed d Zed d Z ed dZ eddZ dS)r cCst||_t|j|_dS)N)str_version_legacy_cmpkeyr)rrrrr__init__Js zLegacyVersion.__init__cCs|jS)N)r.)rrrr__str__NszLegacyVersion.__str__cCsdjtt|S)Nz)formatreprr-)rrrr__repr__QszLegacyVersion.__repr__cCs|jS)N)r.)rrrrpublicTszLegacyVersion.publiccCs|jS)N)r.)rrrr base_versionXszLegacyVersion.base_versioncCsdS)Nr)rrrrr\szLegacyVersion.localcCsdS)NFr)rrrr is_prerelease`szLegacyVersion.is_prereleasecCsdS)NFr)rrrris_postreleasedszLegacyVersion.is_postreleaseN) rrrr0r1r4propertyr5r6rr7r8rrrrr Hs    z(\d+ | [a-z]+ | \.| -)czfinal-@)rpreview-rcrccsbxVtj|D]H}tj||}| s |dkr,q |dddkrJ|jdVq d|Vq WdVdS)N.r 0123456789*z*final)_legacy_version_component_resplit_legacy_version_replacement_mapgetzfill)rpartrrr_parse_version_partsrs rIcCsd}g}xlt|jD]\}|jdrh|dkrJx|rH|ddkrH|jq.Wx|rf|ddkrf|jqLW|j|qWt|}||fS) NrrBz*finalz*final-Z00000000rJrJ)rIlower startswithpopappendtuple)rr partsrHrrrr/s   r/a v? (?: (?:(?P[0-9]+)!)? # epoch (?P[0-9]+(?:\.[0-9]+)*) # release segment (?P
                                          # pre-release
            [-_\.]?
            (?P(a|b|c|rc|alpha|beta|pre|preview))
            [-_\.]?
            (?P[0-9]+)?
        )?
        (?P                                         # post release
            (?:-(?P[0-9]+))
            |
            (?:
                [-_\.]?
                (?Ppost|rev|r)
                [-_\.]?
                (?P[0-9]+)?
            )
        )?
        (?P                                          # dev release
            [-_\.]?
            (?Pdev)
            [-_\.]?
            (?P[0-9]+)?
        )?
    )
    (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
c@s|eZdZejdedejejBZddZ	ddZ
ddZed	d
Z
eddZed
dZeddZeddZdS)rz^\s*z\s*$c	Cs|jj|}|stdj|t|jdr8t|jdndtdd|jdjdDt	|jd|jd	t	|jd
|jdp|jdt	|jd
|jdt
|jdd|_t|jj
|jj|jj|jj|jj|jj|_dS)NzInvalid version: '{0}'r
rcss|]}t|VqdS)N)int).0irrr	sz#Version.__init__..rr?Zpre_lZpre_nZpost_lZpost_n1Zpost_n2Zdev_lZdev_nr)r
rrrrr)_regexsearchr
r2rgrouprQrOrD_parse_letter_version_parse_local_versionr._cmpkeyr
rrrrrr)rrmatchrrrr0s.

zVersion.__init__cCsdjtt|S)Nz)r2r3r-)rrrrr4szVersion.__repr__cCsg}|jjdkr$|jdj|jj|jdjdd|jjD|jjdk	rl|jdjdd|jjD|jjdk	r|jdj|jjd	|jjdk	r|jd
j|jjd	|jj	dk	r|jdjdjdd|jj	Ddj|S)
Nrz{0}!r?css|]}t|VqdS)N)r-)rRxrrrrTsz"Version.__str__..css|]}t|VqdS)N)r-)rRr\rrrrTsz.post{0}rz.dev{0}z+{0}css|]}t|VqdS)N)r-)rRr\rrrrTs)
r.r
rNr2joinrrrrr)rrPrrrr1s zVersion.__str__cCst|jdddS)N+rr)r-rD)rrrrr5
szVersion.publiccCsLg}|jjdkr$|jdj|jj|jdjdd|jjDdj|S)Nrz{0}!r?css|]}t|VqdS)N)r-)rRr\rrrrTsz'Version.base_version..r])r.r
rNr2r^r)rrPrrrr6s
zVersion.base_versioncCs$t|}d|kr |jdddSdS)Nr_r)r-rD)rZversion_stringrrrrsz
Version.localcCst|jjp|jjS)N)boolr.rr)rrrrr7!szVersion.is_prereleasecCst|jjS)N)r`r.r)rrrrr8%szVersion.is_postreleaseN)rrrrecompilerVERBOSE
IGNORECASErUr0r4r1r9r5r6rr7r8rrrrrs
#
cCsx|rZ|dkrd}|j}|dkr&d}n(|dkr4d}n|d
krBd	}n|dkrNd}|t|fS|rt|rtd}|t|fSdS)NrZalphaaZbetabr:rr<r>revrr)r:rr<)rgrh)rKrQ)ZletterZnumberrrrrX*s 
rXz[\._-]cCs$|dk	r tddtj|DSdS)zR
    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
    Ncss&|]}|js|jnt|VqdS)N)isdigitrKrQ)rRrHrrrrTRsz'_parse_local_version..)rO_local_version_seperatorsrD)rrrrrYLsrYcCsttttjddt|}|dkr@|dkr@|dk	r@t}n|dkrLt}|dkrZt}|dkrft}|dkrvt}ntdd|D}||||||fS)NcSs|dkS)Nrr)r\rrrr!`sz_cmpkey..css*|]"}t|tr|dfnt|fVqdS)r]N)r*rQr)rRrSrrrrTsz_cmpkey..)rOreversedlist	itertools	dropwhiler)r
rrrrrrrrrZWs&		
rZ)Z
__future__rrrcollectionsrmraZ_structuresr__all__
namedtuplerr
ValueErrorr
objectrr	rbrcrCrErIr/rrrXrjrYrZrrrrs.!
9k
__pycache__/version.cpython-36.pyc000064400000024426147204766430013114 0ustar003

]$-@sddlmZmZmZddlZddlZddlZddlmZddddd	gZ	ej
d
ddd
dddgZddZGddde
ZGdddeZGdddeZejdejZddddddZddZddZdZGd ddeZd!d"Zejd#Zd$d%Zd&d'ZdS)()absolute_importdivisionprint_functionN)InfinityparseVersion
LegacyVersionInvalidVersionVERSION_PATTERN_VersionepochreleasedevprepostlocalcCs&yt|Stk
r t|SXdS)z
    Parse the given version string and return either a :class:`Version` object
    or a :class:`LegacyVersion` object depending on if the given version is
    a valid PEP 440 version or a legacy version.
    N)rr
r	)versionr/usr/lib/python3.6/version.pyrsc@seZdZdZdS)r
zF
    An invalid version was found, users should refer to PEP 440.
    N)__name__
__module____qualname____doc__rrrrr
$sc@sLeZdZddZddZddZddZd	d
ZddZd
dZ	ddZ
dS)_BaseVersioncCs
t|jS)N)hash_key)selfrrr__hash__,sz_BaseVersion.__hash__cCs|j|ddS)NcSs||kS)Nr)sorrr0sz%_BaseVersion.__lt__..)_compare)rotherrrr__lt__/sz_BaseVersion.__lt__cCs|j|ddS)NcSs||kS)Nr)rr rrrr!3sz%_BaseVersion.__le__..)r")rr#rrr__le__2sz_BaseVersion.__le__cCs|j|ddS)NcSs||kS)Nr)rr rrrr!6sz%_BaseVersion.__eq__..)r")rr#rrr__eq__5sz_BaseVersion.__eq__cCs|j|ddS)NcSs||kS)Nr)rr rrrr!9sz%_BaseVersion.__ge__..)r")rr#rrr__ge__8sz_BaseVersion.__ge__cCs|j|ddS)NcSs||kS)Nr)rr rrrr!<sz%_BaseVersion.__gt__..)r")rr#rrr__gt__;sz_BaseVersion.__gt__cCs|j|ddS)NcSs||kS)Nr)rr rrrr!?sz%_BaseVersion.__ne__..)r")rr#rrr__ne__>sz_BaseVersion.__ne__cCst|tstS||j|jS)N)
isinstancerNotImplementedr)rr#methodrrrr"As
z_BaseVersion._compareN)rrrrr$r%r&r'r(r)r"rrrrr*src@s`eZdZddZddZddZeddZed	d
ZeddZ	ed
dZ
eddZdS)r	cCst||_t|j|_dS)N)str_version_legacy_cmpkeyr)rrrrr__init__Js
zLegacyVersion.__init__cCs|jS)N)r.)rrrr__str__NszLegacyVersion.__str__cCsdjtt|S)Nz)formatreprr-)rrrr__repr__QszLegacyVersion.__repr__cCs|jS)N)r.)rrrrpublicTszLegacyVersion.publiccCs|jS)N)r.)rrrrbase_versionXszLegacyVersion.base_versioncCsdS)Nr)rrrrr\szLegacyVersion.localcCsdS)NFr)rrrr
is_prerelease`szLegacyVersion.is_prereleasecCsdS)NFr)rrrris_postreleasedszLegacyVersion.is_postreleaseN)rrrr0r1r4propertyr5r6rr7r8rrrrr	Hsz(\d+ | [a-z]+ | \.| -)czfinal-@)rpreview-rcrccsbxVtj|D]H}tj||}|s|dkr,q|dddkrJ|jdVqd|VqWdVdS)N.r
0123456789*z*final)_legacy_version_component_resplit_legacy_version_replacement_mapgetzfill)rpartrrr_parse_version_partsrsrIcCsd}g}xlt|jD]\}|jdrh|dkrJx|rH|ddkrH|jq.Wx|rf|ddkrf|jqLW|j|qWt|}||fS)	NrrBz*finalz*final-Z00000000rJrJ)rIlower
startswithpopappendtuple)rr
partsrHrrrr/s
r/a
    v?
    (?:
        (?:(?P[0-9]+)!)?                           # epoch
        (?P[0-9]+(?:\.[0-9]+)*)                  # release segment
        (?P
                                          # pre-release
            [-_\.]?
            (?P(a|b|c|rc|alpha|beta|pre|preview))
            [-_\.]?
            (?P[0-9]+)?
        )?
        (?P                                         # post release
            (?:-(?P[0-9]+))
            |
            (?:
                [-_\.]?
                (?Ppost|rev|r)
                [-_\.]?
                (?P[0-9]+)?
            )
        )?
        (?P                                          # dev release
            [-_\.]?
            (?Pdev)
            [-_\.]?
            (?P[0-9]+)?
        )?
    )
    (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
c@s|eZdZejdedejejBZddZ	ddZ
ddZed	d
Z
eddZed
dZeddZeddZdS)rz^\s*z\s*$c	Cs|jj|}|stdj|t|jdr8t|jdndtdd|jdjdDt	|jd|jd	t	|jd
|jdp|jdt	|jd
|jdt
|jdd|_t|jj
|jj|jj|jj|jj|jj|_dS)NzInvalid version: '{0}'r
rcss|]}t|VqdS)N)int).0irrr	sz#Version.__init__..rr?Zpre_lZpre_nZpost_lZpost_n1Zpost_n2Zdev_lZdev_nr)r
rrrrr)_regexsearchr
r2rgrouprQrOrD_parse_letter_version_parse_local_versionr._cmpkeyr
rrrrrr)rrmatchrrrr0s.

zVersion.__init__cCsdjtt|S)Nz)r2r3r-)rrrrr4szVersion.__repr__cCsg}|jjdkr$|jdj|jj|jdjdd|jjD|jjdk	rl|jdjdd|jjD|jjdk	r|jdj|jjd	|jjdk	r|jd
j|jjd	|jj	dk	r|jdjdjdd|jj	Ddj|S)
Nrz{0}!r?css|]}t|VqdS)N)r-)rRxrrrrTsz"Version.__str__..css|]}t|VqdS)N)r-)rRr\rrrrTsz.post{0}rz.dev{0}z+{0}css|]}t|VqdS)N)r-)rRr\rrrrTs)
r.r
rNr2joinrrrrr)rrPrrrr1s zVersion.__str__cCst|jdddS)N+rr)r-rD)rrrrr5
szVersion.publiccCsLg}|jjdkr$|jdj|jj|jdjdd|jjDdj|S)Nrz{0}!r?css|]}t|VqdS)N)r-)rRr\rrrrTsz'Version.base_version..r])r.r
rNr2r^r)rrPrrrr6s
zVersion.base_versioncCs$t|}d|kr |jdddSdS)Nr_r)r-rD)rZversion_stringrrrrsz
Version.localcCst|jjp|jjS)N)boolr.rr)rrrrr7!szVersion.is_prereleasecCst|jjS)N)r`r.r)rrrrr8%szVersion.is_postreleaseN)rrrrecompilerVERBOSE
IGNORECASErUr0r4r1r9r5r6rr7r8rrrrrs
#
cCsx|rZ|dkrd}|j}|dkr&d}n(|dkr4d}n|d
krBd	}n|dkrNd}|t|fS|rt|rtd}|t|fSdS)NrZalphaaZbetabr:rr<r>revrr)r:rr<)rgrh)rKrQ)ZletterZnumberrrrrX*s 
rXz[\._-]cCs$|dk	r tddtj|DSdS)zR
    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
    Ncss&|]}|js|jnt|VqdS)N)isdigitrKrQ)rRrHrrrrTRsz'_parse_local_version..)rO_local_version_seperatorsrD)rrrrrYLsrYcCsttttjddt|}|dkr@|dkr@|dk	r@t}n|dkrLt}|dkrZt}|dkrft}|dkrvt}ntdd|D}||||||fS)NcSs|dkS)Nrr)r\rrrr!`sz_cmpkey..css*|]"}t|tr|dfnt|fVqdS)r]N)r*rQr)rRrSrrrrTsz_cmpkey..)rOreversedlist	itertools	dropwhiler)r
rrrrrrrrrZWs&		
rZ)Z
__future__rrrcollectionsrmraZ_structuresr__all__
namedtuplerr
ValueErrorr
objectrr	rbrcrCrErIr/rrrXrjrYrZrrrrs.!
9k
__about__.py000064400000001320147204766430007035 0ustar00# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function

__all__ = [
    "__title__", "__summary__", "__uri__", "__version__", "__author__",
    "__email__", "__license__", "__copyright__",
]

__title__ = "packaging"
__summary__ = "Core utilities for Python packages"
__uri__ = "https://github.com/pypa/packaging"

__version__ = "16.8"

__author__ = "Donald Stufft and individual contributors"
__email__ = "donald@stufft.io"

__license__ = "BSD or Apache License, Version 2.0"
__copyright__ = "Copyright 2014-2016 %s" % __author__
__init__.py000064400000001001147204766430006662 0ustar00# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function

from .__about__ import (
    __author__, __copyright__, __email__, __license__, __summary__, __title__,
    __uri__, __version__
)

__all__ = [
    "__title__", "__summary__", "__uri__", "__version__", "__author__",
    "__email__", "__license__", "__copyright__",
]
_compat.py000064400000001534147204766430006560 0ustar00# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function

import sys


PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3

# flake8: noqa

if PY3:
    string_types = str,
else:
    string_types = basestring,


def with_metaclass(meta, *bases):
    """
    Create a base class with a metaclass.
    """
    # This requires a bit of explanation: the basic idea is to make a dummy
    # metaclass for one level of class instantiation that replaces itself with
    # the actual metaclass.
    class metaclass(meta):
        def __new__(cls, name, this_bases, d):
            return meta(name, bases, d)
    return type.__new__(metaclass, 'temporary_class', (), {})
_structures.py000064400000002610147204766430007514 0ustar00# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function


class Infinity(object):

    def __repr__(self):
        return "Infinity"

    def __hash__(self):
        return hash(repr(self))

    def __lt__(self, other):
        return False

    def __le__(self, other):
        return False

    def __eq__(self, other):
        return isinstance(other, self.__class__)

    def __ne__(self, other):
        return not isinstance(other, self.__class__)

    def __gt__(self, other):
        return True

    def __ge__(self, other):
        return True

    def __neg__(self):
        return NegativeInfinity

Infinity = Infinity()


class NegativeInfinity(object):

    def __repr__(self):
        return "-Infinity"

    def __hash__(self):
        return hash(repr(self))

    def __lt__(self, other):
        return True

    def __le__(self, other):
        return True

    def __eq__(self, other):
        return isinstance(other, self.__class__)

    def __ne__(self, other):
        return not isinstance(other, self.__class__)

    def __gt__(self, other):
        return False

    def __ge__(self, other):
        return False

    def __neg__(self):
        return Infinity

NegativeInfinity = NegativeInfinity()
markers.py000064400000017771147204766430006614 0ustar00# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function

import operator
import os
import platform
import sys

from pyparsing import ParseException, ParseResults, stringStart, stringEnd
from pyparsing import ZeroOrMore, Group, Forward, QuotedString
from pyparsing import Literal as L  # noqa

from ._compat import string_types
from .specifiers import Specifier, InvalidSpecifier


__all__ = [
    "InvalidMarker", "UndefinedComparison", "UndefinedEnvironmentName",
    "Marker", "default_environment",
]


class InvalidMarker(ValueError):
    """
    An invalid marker was found, users should refer to PEP 508.
    """


class UndefinedComparison(ValueError):
    """
    An invalid operation was attempted on a value that doesn't support it.
    """


class UndefinedEnvironmentName(ValueError):
    """
    A name was attempted to be used that does not exist inside of the
    environment.
    """


class Node(object):

    def __init__(self, value):
        self.value = value

    def __str__(self):
        return str(self.value)

    def __repr__(self):
        return "<{0}({1!r})>".format(self.__class__.__name__, str(self))

    def serialize(self):
        raise NotImplementedError


class Variable(Node):

    def serialize(self):
        return str(self)


class Value(Node):

    def serialize(self):
        return '"{0}"'.format(self)


class Op(Node):

    def serialize(self):
        return str(self)


VARIABLE = (
    L("implementation_version") |
    L("platform_python_implementation") |
    L("implementation_name") |
    L("python_full_version") |
    L("platform_release") |
    L("platform_version") |
    L("platform_machine") |
    L("platform_system") |
    L("python_version") |
    L("sys_platform") |
    L("os_name") |
    L("os.name") |  # PEP-345
    L("sys.platform") |  # PEP-345
    L("platform.version") |  # PEP-345
    L("platform.machine") |  # PEP-345
    L("platform.python_implementation") |  # PEP-345
    L("python_implementation") |  # undocumented setuptools legacy
    L("extra")
)
ALIASES = {
    'os.name': 'os_name',
    'sys.platform': 'sys_platform',
    'platform.version': 'platform_version',
    'platform.machine': 'platform_machine',
    'platform.python_implementation': 'platform_python_implementation',
    'python_implementation': 'platform_python_implementation'
}
VARIABLE.setParseAction(lambda s, l, t: Variable(ALIASES.get(t[0], t[0])))

VERSION_CMP = (
    L("===") |
    L("==") |
    L(">=") |
    L("<=") |
    L("!=") |
    L("~=") |
    L(">") |
    L("<")
)

MARKER_OP = VERSION_CMP | L("not in") | L("in")
MARKER_OP.setParseAction(lambda s, l, t: Op(t[0]))

MARKER_VALUE = QuotedString("'") | QuotedString('"')
MARKER_VALUE.setParseAction(lambda s, l, t: Value(t[0]))

BOOLOP = L("and") | L("or")

MARKER_VAR = VARIABLE | MARKER_VALUE

MARKER_ITEM = Group(MARKER_VAR + MARKER_OP + MARKER_VAR)
MARKER_ITEM.setParseAction(lambda s, l, t: tuple(t[0]))

LPAREN = L("(").suppress()
RPAREN = L(")").suppress()

MARKER_EXPR = Forward()
MARKER_ATOM = MARKER_ITEM | Group(LPAREN + MARKER_EXPR + RPAREN)
MARKER_EXPR << MARKER_ATOM + ZeroOrMore(BOOLOP + MARKER_EXPR)

MARKER = stringStart + MARKER_EXPR + stringEnd


def _coerce_parse_result(results):
    if isinstance(results, ParseResults):
        return [_coerce_parse_result(i) for i in results]
    else:
        return results


def _format_marker(marker, first=True):
    assert isinstance(marker, (list, tuple, string_types))

    # Sometimes we have a structure like [[...]] which is a single item list
    # where the single item is itself it's own list. In that case we want skip
    # the rest of this function so that we don't get extraneous () on the
    # outside.
    if (isinstance(marker, list) and len(marker) == 1 and
            isinstance(marker[0], (list, tuple))):
        return _format_marker(marker[0])

    if isinstance(marker, list):
        inner = (_format_marker(m, first=False) for m in marker)
        if first:
            return " ".join(inner)
        else:
            return "(" + " ".join(inner) + ")"
    elif isinstance(marker, tuple):
        return " ".join([m.serialize() for m in marker])
    else:
        return marker


_operators = {
    "in": lambda lhs, rhs: lhs in rhs,
    "not in": lambda lhs, rhs: lhs not in rhs,
    "<": operator.lt,
    "<=": operator.le,
    "==": operator.eq,
    "!=": operator.ne,
    ">=": operator.ge,
    ">": operator.gt,
}


def _eval_op(lhs, op, rhs):
    try:
        spec = Specifier("".join([op.serialize(), rhs]))
    except InvalidSpecifier:
        pass
    else:
        return spec.contains(lhs)

    oper = _operators.get(op.serialize())
    if oper is None:
        raise UndefinedComparison(
            "Undefined {0!r} on {1!r} and {2!r}.".format(op, lhs, rhs)
        )

    return oper(lhs, rhs)


_undefined = object()


def _get_env(environment, name):
    value = environment.get(name, _undefined)

    if value is _undefined:
        raise UndefinedEnvironmentName(
            "{0!r} does not exist in evaluation environment.".format(name)
        )

    return value


def _evaluate_markers(markers, environment):
    groups = [[]]

    for marker in markers:
        assert isinstance(marker, (list, tuple, string_types))

        if isinstance(marker, list):
            groups[-1].append(_evaluate_markers(marker, environment))
        elif isinstance(marker, tuple):
            lhs, op, rhs = marker

            if isinstance(lhs, Variable):
                lhs_value = _get_env(environment, lhs.value)
                rhs_value = rhs.value
            else:
                lhs_value = lhs.value
                rhs_value = _get_env(environment, rhs.value)

            groups[-1].append(_eval_op(lhs_value, op, rhs_value))
        else:
            assert marker in ["and", "or"]
            if marker == "or":
                groups.append([])

    return any(all(item) for item in groups)


def format_full_version(info):
    version = '{0.major}.{0.minor}.{0.micro}'.format(info)
    kind = info.releaselevel
    if kind != 'final':
        version += kind[0] + str(info.serial)
    return version


def default_environment():
    if hasattr(sys, 'implementation'):
        iver = format_full_version(sys.implementation.version)
        implementation_name = sys.implementation.name
    else:
        iver = '0'
        implementation_name = ''

    return {
        "implementation_name": implementation_name,
        "implementation_version": iver,
        "os_name": os.name,
        "platform_machine": platform.machine(),
        "platform_release": platform.release(),
        "platform_system": platform.system(),
        "platform_version": platform.version(),
        "python_full_version": platform.python_version(),
        "platform_python_implementation": platform.python_implementation(),
        "python_version": platform.python_version()[:3],
        "sys_platform": sys.platform,
    }


class Marker(object):

    def __init__(self, marker):
        try:
            self._markers = _coerce_parse_result(MARKER.parseString(marker))
        except ParseException as e:
            err_str = "Invalid marker: {0!r}, parse error at {1!r}".format(
                marker, marker[e.loc:e.loc + 8])
            raise InvalidMarker(err_str)

    def __str__(self):
        return _format_marker(self._markers)

    def __repr__(self):
        return "".format(str(self))

    def evaluate(self, environment=None):
        """Evaluate a marker.

        Return the boolean from evaluating the given marker against the
        environment. environment is an optional argument to override all or
        part of the determined environment.

        The environment is determined from the current Python process.
        """
        current_environment = default_environment()
        if environment is not None:
            current_environment.update(environment)

        return _evaluate_markers(self._markers, current_environment)
requirements.py000064400000010257147204766430007663 0ustar00# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function

import string
import re

from pyparsing import stringStart, stringEnd, originalTextFor, ParseException
from pyparsing import ZeroOrMore, Word, Optional, Regex, Combine
from pyparsing import Literal as L  # noqa
from six.moves.urllib import parse as urlparse

from .markers import MARKER_EXPR, Marker
from .specifiers import LegacySpecifier, Specifier, SpecifierSet


class InvalidRequirement(ValueError):
    """
    An invalid requirement was found, users should refer to PEP 508.
    """


ALPHANUM = Word(string.ascii_letters + string.digits)

LBRACKET = L("[").suppress()
RBRACKET = L("]").suppress()
LPAREN = L("(").suppress()
RPAREN = L(")").suppress()
COMMA = L(",").suppress()
SEMICOLON = L(";").suppress()
AT = L("@").suppress()

PUNCTUATION = Word("-_.")
IDENTIFIER_END = ALPHANUM | (ZeroOrMore(PUNCTUATION) + ALPHANUM)
IDENTIFIER = Combine(ALPHANUM + ZeroOrMore(IDENTIFIER_END))

NAME = IDENTIFIER("name")
EXTRA = IDENTIFIER

URI = Regex(r'[^ ]+')("url")
URL = (AT + URI)

EXTRAS_LIST = EXTRA + ZeroOrMore(COMMA + EXTRA)
EXTRAS = (LBRACKET + Optional(EXTRAS_LIST) + RBRACKET)("extras")

VERSION_PEP440 = Regex(Specifier._regex_str, re.VERBOSE | re.IGNORECASE)
VERSION_LEGACY = Regex(LegacySpecifier._regex_str, re.VERBOSE | re.IGNORECASE)

VERSION_ONE = VERSION_PEP440 ^ VERSION_LEGACY
VERSION_MANY = Combine(VERSION_ONE + ZeroOrMore(COMMA + VERSION_ONE),
                       joinString=",", adjacent=False)("_raw_spec")
_VERSION_SPEC = Optional(((LPAREN + VERSION_MANY + RPAREN) | VERSION_MANY))
_VERSION_SPEC.setParseAction(lambda s, l, t: t._raw_spec or '')

VERSION_SPEC = originalTextFor(_VERSION_SPEC)("specifier")
VERSION_SPEC.setParseAction(lambda s, l, t: t[1])

MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
MARKER_EXPR.setParseAction(
    lambda s, l, t: Marker(s[t._original_start:t._original_end])
)
MARKER_SEPERATOR = SEMICOLON
MARKER = MARKER_SEPERATOR + MARKER_EXPR

VERSION_AND_MARKER = VERSION_SPEC + Optional(MARKER)
URL_AND_MARKER = URL + Optional(MARKER)

NAMED_REQUIREMENT = \
    NAME + Optional(EXTRAS) + (URL_AND_MARKER | VERSION_AND_MARKER)

REQUIREMENT = stringStart + NAMED_REQUIREMENT + stringEnd


class Requirement(object):
    """Parse a requirement.

    Parse a given requirement string into its parts, such as name, specifier,
    URL, and extras. Raises InvalidRequirement on a badly-formed requirement
    string.
    """

    # TODO: Can we test whether something is contained within a requirement?
    #       If so how do we do that? Do we need to test against the _name_ of
    #       the thing as well as the version? What about the markers?
    # TODO: Can we normalize the name and extra name?

    def __init__(self, requirement_string):
        try:
            req = REQUIREMENT.parseString(requirement_string)
        except ParseException as e:
            raise InvalidRequirement(
                "Invalid requirement, parse error at \"{0!r}\"".format(
                    requirement_string[e.loc:e.loc + 8]))

        self.name = req.name
        if req.url:
            parsed_url = urlparse.urlparse(req.url)
            if not (parsed_url.scheme and parsed_url.netloc) or (
                    not parsed_url.scheme and not parsed_url.netloc):
                raise InvalidRequirement("Invalid URL given")
            self.url = req.url
        else:
            self.url = None
        self.extras = set(req.extras.asList() if req.extras else [])
        self.specifier = SpecifierSet(req.specifier)
        self.marker = req.marker if req.marker else None

    def __str__(self):
        parts = [self.name]

        if self.extras:
            parts.append("[{0}]".format(",".join(sorted(self.extras))))

        if self.specifier:
            parts.append(str(self.specifier))

        if self.url:
            parts.append("@ {0}".format(self.url))

        if self.marker:
            parts.append("; {0}".format(self.marker))

        return "".join(parts)

    def __repr__(self):
        return "".format(str(self))
specifiers.py000064400000066571147204766430007306 0ustar00# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function

import abc
import functools
import itertools
import re

from ._compat import string_types, with_metaclass
from .version import Version, LegacyVersion, parse


class InvalidSpecifier(ValueError):
    """
    An invalid specifier was found, users should refer to PEP 440.
    """


class BaseSpecifier(with_metaclass(abc.ABCMeta, object)):

    @abc.abstractmethod
    def __str__(self):
        """
        Returns the str representation of this Specifier like object. This
        should be representative of the Specifier itself.
        """

    @abc.abstractmethod
    def __hash__(self):
        """
        Returns a hash value for this Specifier like object.
        """

    @abc.abstractmethod
    def __eq__(self, other):
        """
        Returns a boolean representing whether or not the two Specifier like
        objects are equal.
        """

    @abc.abstractmethod
    def __ne__(self, other):
        """
        Returns a boolean representing whether or not the two Specifier like
        objects are not equal.
        """

    @abc.abstractproperty
    def prereleases(self):
        """
        Returns whether or not pre-releases as a whole are allowed by this
        specifier.
        """

    @prereleases.setter
    def prereleases(self, value):
        """
        Sets whether or not pre-releases as a whole are allowed by this
        specifier.
        """

    @abc.abstractmethod
    def contains(self, item, prereleases=None):
        """
        Determines if the given item is contained within this specifier.
        """

    @abc.abstractmethod
    def filter(self, iterable, prereleases=None):
        """
        Takes an iterable of items and filters them so that only items which
        are contained within this specifier are allowed in it.
        """


class _IndividualSpecifier(BaseSpecifier):

    _operators = {}

    def __init__(self, spec="", prereleases=None):
        match = self._regex.search(spec)
        if not match:
            raise InvalidSpecifier("Invalid specifier: '{0}'".format(spec))

        self._spec = (
            match.group("operator").strip(),
            match.group("version").strip(),
        )

        # Store whether or not this Specifier should accept prereleases
        self._prereleases = prereleases

    def __repr__(self):
        pre = (
            ", prereleases={0!r}".format(self.prereleases)
            if self._prereleases is not None
            else ""
        )

        return "<{0}({1!r}{2})>".format(
            self.__class__.__name__,
            str(self),
            pre,
        )

    def __str__(self):
        return "{0}{1}".format(*self._spec)

    def __hash__(self):
        return hash(self._spec)

    def __eq__(self, other):
        if isinstance(other, string_types):
            try:
                other = self.__class__(other)
            except InvalidSpecifier:
                return NotImplemented
        elif not isinstance(other, self.__class__):
            return NotImplemented

        return self._spec == other._spec

    def __ne__(self, other):
        if isinstance(other, string_types):
            try:
                other = self.__class__(other)
            except InvalidSpecifier:
                return NotImplemented
        elif not isinstance(other, self.__class__):
            return NotImplemented

        return self._spec != other._spec

    def _get_operator(self, op):
        return getattr(self, "_compare_{0}".format(self._operators[op]))

    def _coerce_version(self, version):
        if not isinstance(version, (LegacyVersion, Version)):
            version = parse(version)
        return version

    @property
    def operator(self):
        return self._spec[0]

    @property
    def version(self):
        return self._spec[1]

    @property
    def prereleases(self):
        return self._prereleases

    @prereleases.setter
    def prereleases(self, value):
        self._prereleases = value

    def __contains__(self, item):
        return self.contains(item)

    def contains(self, item, prereleases=None):
        # Determine if prereleases are to be allowed or not.
        if prereleases is None:
            prereleases = self.prereleases

        # Normalize item to a Version or LegacyVersion, this allows us to have
        # a shortcut for ``"2.0" in Specifier(">=2")
        item = self._coerce_version(item)

        # Determine if we should be supporting prereleases in this specifier
        # or not, if we do not support prereleases than we can short circuit
        # logic if this version is a prereleases.
        if item.is_prerelease and not prereleases:
            return False

        # Actually do the comparison to determine if this item is contained
        # within this Specifier or not.
        return self._get_operator(self.operator)(item, self.version)

    def filter(self, iterable, prereleases=None):
        yielded = False
        found_prereleases = []

        kw = {"prereleases": prereleases if prereleases is not None else True}

        # Attempt to iterate over all the values in the iterable and if any of
        # them match, yield them.
        for version in iterable:
            parsed_version = self._coerce_version(version)

            if self.contains(parsed_version, **kw):
                # If our version is a prerelease, and we were not set to allow
                # prereleases, then we'll store it for later incase nothing
                # else matches this specifier.
                if (parsed_version.is_prerelease and not
                        (prereleases or self.prereleases)):
                    found_prereleases.append(version)
                # Either this is not a prerelease, or we should have been
                # accepting prereleases from the begining.
                else:
                    yielded = True
                    yield version

        # Now that we've iterated over everything, determine if we've yielded
        # any values, and if we have not and we have any prereleases stored up
        # then we will go ahead and yield the prereleases.
        if not yielded and found_prereleases:
            for version in found_prereleases:
                yield version


class LegacySpecifier(_IndividualSpecifier):

    _regex_str = (
        r"""
        (?P(==|!=|<=|>=|<|>))
        \s*
        (?P
            [^,;\s)]* # Since this is a "legacy" specifier, and the version
                      # string can be just about anything, we match everything
                      # except for whitespace, a semi-colon for marker support,
                      # a closing paren since versions can be enclosed in
                      # them, and a comma since it's a version separator.
        )
        """
    )

    _regex = re.compile(
        r"^\s*" + _regex_str + r"\s*$", re.VERBOSE | re.IGNORECASE)

    _operators = {
        "==": "equal",
        "!=": "not_equal",
        "<=": "less_than_equal",
        ">=": "greater_than_equal",
        "<": "less_than",
        ">": "greater_than",
    }

    def _coerce_version(self, version):
        if not isinstance(version, LegacyVersion):
            version = LegacyVersion(str(version))
        return version

    def _compare_equal(self, prospective, spec):
        return prospective == self._coerce_version(spec)

    def _compare_not_equal(self, prospective, spec):
        return prospective != self._coerce_version(spec)

    def _compare_less_than_equal(self, prospective, spec):
        return prospective <= self._coerce_version(spec)

    def _compare_greater_than_equal(self, prospective, spec):
        return prospective >= self._coerce_version(spec)

    def _compare_less_than(self, prospective, spec):
        return prospective < self._coerce_version(spec)

    def _compare_greater_than(self, prospective, spec):
        return prospective > self._coerce_version(spec)


def _require_version_compare(fn):
    @functools.wraps(fn)
    def wrapped(self, prospective, spec):
        if not isinstance(prospective, Version):
            return False
        return fn(self, prospective, spec)
    return wrapped


class Specifier(_IndividualSpecifier):

    _regex_str = (
        r"""
        (?P(~=|==|!=|<=|>=|<|>|===))
        (?P
            (?:
                # The identity operators allow for an escape hatch that will
                # do an exact string match of the version you wish to install.
                # This will not be parsed by PEP 440 and we cannot determine
                # any semantic meaning from it. This operator is discouraged
                # but included entirely as an escape hatch.
                (?<====)  # Only match for the identity operator
                \s*
                [^\s]*    # We just match everything, except for whitespace
                          # since we are only testing for strict identity.
            )
            |
            (?:
                # The (non)equality operators allow for wild card and local
                # versions to be specified so we have to define these two
                # operators separately to enable that.
                (?<===|!=)            # Only match for equals and not equals

                \s*
                v?
                (?:[0-9]+!)?          # epoch
                [0-9]+(?:\.[0-9]+)*   # release
                (?:                   # pre release
                    [-_\.]?
                    (a|b|c|rc|alpha|beta|pre|preview)
                    [-_\.]?
                    [0-9]*
                )?
                (?:                   # post release
                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
                )?

                # You cannot use a wild card and a dev or local version
                # together so group them with a | and make them optional.
                (?:
                    (?:[-_\.]?dev[-_\.]?[0-9]*)?         # dev release
                    (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local
                    |
                    \.\*  # Wild card syntax of .*
                )?
            )
            |
            (?:
                # The compatible operator requires at least two digits in the
                # release segment.
                (?<=~=)               # Only match for the compatible operator

                \s*
                v?
                (?:[0-9]+!)?          # epoch
                [0-9]+(?:\.[0-9]+)+   # release  (We have a + instead of a *)
                (?:                   # pre release
                    [-_\.]?
                    (a|b|c|rc|alpha|beta|pre|preview)
                    [-_\.]?
                    [0-9]*
                )?
                (?:                                   # post release
                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
                )?
                (?:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
            )
            |
            (?:
                # All other operators only allow a sub set of what the
                # (non)equality operators do. Specifically they do not allow
                # local versions to be specified nor do they allow the prefix
                # matching wild cards.
                (?=": "greater_than_equal",
        "<": "less_than",
        ">": "greater_than",
        "===": "arbitrary",
    }

    @_require_version_compare
    def _compare_compatible(self, prospective, spec):
        # Compatible releases have an equivalent combination of >= and ==. That
        # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to
        # implement this in terms of the other specifiers instead of
        # implementing it ourselves. The only thing we need to do is construct
        # the other specifiers.

        # We want everything but the last item in the version, but we want to
        # ignore post and dev releases and we want to treat the pre-release as
        # it's own separate segment.
        prefix = ".".join(
            list(
                itertools.takewhile(
                    lambda x: (not x.startswith("post") and not
                               x.startswith("dev")),
                    _version_split(spec),
                )
            )[:-1]
        )

        # Add the prefix notation to the end of our string
        prefix += ".*"

        return (self._get_operator(">=")(prospective, spec) and
                self._get_operator("==")(prospective, prefix))

    @_require_version_compare
    def _compare_equal(self, prospective, spec):
        # We need special logic to handle prefix matching
        if spec.endswith(".*"):
            # In the case of prefix matching we want to ignore local segment.
            prospective = Version(prospective.public)
            # Split the spec out by dots, and pretend that there is an implicit
            # dot in between a release segment and a pre-release segment.
            spec = _version_split(spec[:-2])  # Remove the trailing .*

            # Split the prospective version out by dots, and pretend that there
            # is an implicit dot in between a release segment and a pre-release
            # segment.
            prospective = _version_split(str(prospective))

            # Shorten the prospective version to be the same length as the spec
            # so that we can determine if the specifier is a prefix of the
            # prospective version or not.
            prospective = prospective[:len(spec)]

            # Pad out our two sides with zeros so that they both equal the same
            # length.
            spec, prospective = _pad_version(spec, prospective)
        else:
            # Convert our spec string into a Version
            spec = Version(spec)

            # If the specifier does not have a local segment, then we want to
            # act as if the prospective version also does not have a local
            # segment.
            if not spec.local:
                prospective = Version(prospective.public)

        return prospective == spec

    @_require_version_compare
    def _compare_not_equal(self, prospective, spec):
        return not self._compare_equal(prospective, spec)

    @_require_version_compare
    def _compare_less_than_equal(self, prospective, spec):
        return prospective <= Version(spec)

    @_require_version_compare
    def _compare_greater_than_equal(self, prospective, spec):
        return prospective >= Version(spec)

    @_require_version_compare
    def _compare_less_than(self, prospective, spec):
        # Convert our spec to a Version instance, since we'll want to work with
        # it as a version.
        spec = Version(spec)

        # Check to see if the prospective version is less than the spec
        # version. If it's not we can short circuit and just return False now
        # instead of doing extra unneeded work.
        if not prospective < spec:
            return False

        # This special case is here so that, unless the specifier itself
        # includes is a pre-release version, that we do not accept pre-release
        # versions for the version mentioned in the specifier (e.g. <3.1 should
        # not match 3.1.dev0, but should match 3.0.dev0).
        if not spec.is_prerelease and prospective.is_prerelease:
            if Version(prospective.base_version) == Version(spec.base_version):
                return False

        # If we've gotten to here, it means that prospective version is both
        # less than the spec version *and* it's not a pre-release of the same
        # version in the spec.
        return True

    @_require_version_compare
    def _compare_greater_than(self, prospective, spec):
        # Convert our spec to a Version instance, since we'll want to work with
        # it as a version.
        spec = Version(spec)

        # Check to see if the prospective version is greater than the spec
        # version. If it's not we can short circuit and just return False now
        # instead of doing extra unneeded work.
        if not prospective > spec:
            return False

        # This special case is here so that, unless the specifier itself
        # includes is a post-release version, that we do not accept
        # post-release versions for the version mentioned in the specifier
        # (e.g. >3.1 should not match 3.0.post0, but should match 3.2.post0).
        if not spec.is_postrelease and prospective.is_postrelease:
            if Version(prospective.base_version) == Version(spec.base_version):
                return False

        # Ensure that we do not allow a local version of the version mentioned
        # in the specifier, which is techincally greater than, to match.
        if prospective.local is not None:
            if Version(prospective.base_version) == Version(spec.base_version):
                return False

        # If we've gotten to here, it means that prospective version is both
        # greater than the spec version *and* it's not a pre-release of the
        # same version in the spec.
        return True

    def _compare_arbitrary(self, prospective, spec):
        return str(prospective).lower() == str(spec).lower()

    @property
    def prereleases(self):
        # If there is an explicit prereleases set for this, then we'll just
        # blindly use that.
        if self._prereleases is not None:
            return self._prereleases

        # Look at all of our specifiers and determine if they are inclusive
        # operators, and if they are if they are including an explicit
        # prerelease.
        operator, version = self._spec
        if operator in ["==", ">=", "<=", "~=", "==="]:
            # The == specifier can include a trailing .*, if it does we
            # want to remove before parsing.
            if operator == "==" and version.endswith(".*"):
                version = version[:-2]

            # Parse the version, and if it is a pre-release than this
            # specifier allows pre-releases.
            if parse(version).is_prerelease:
                return True

        return False

    @prereleases.setter
    def prereleases(self, value):
        self._prereleases = value


_prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$")


def _version_split(version):
    result = []
    for item in version.split("."):
        match = _prefix_regex.search(item)
        if match:
            result.extend(match.groups())
        else:
            result.append(item)
    return result


def _pad_version(left, right):
    left_split, right_split = [], []

    # Get the release segment of our versions
    left_split.append(list(itertools.takewhile(lambda x: x.isdigit(), left)))
    right_split.append(list(itertools.takewhile(lambda x: x.isdigit(), right)))

    # Get the rest of our versions
    left_split.append(left[len(left_split[0]):])
    right_split.append(right[len(right_split[0]):])

    # Insert our padding
    left_split.insert(
        1,
        ["0"] * max(0, len(right_split[0]) - len(left_split[0])),
    )
    right_split.insert(
        1,
        ["0"] * max(0, len(left_split[0]) - len(right_split[0])),
    )

    return (
        list(itertools.chain(*left_split)),
        list(itertools.chain(*right_split)),
    )


class SpecifierSet(BaseSpecifier):

    def __init__(self, specifiers="", prereleases=None):
        # Split on , to break each indidivual specifier into it's own item, and
        # strip each item to remove leading/trailing whitespace.
        specifiers = [s.strip() for s in specifiers.split(",") if s.strip()]

        # Parsed each individual specifier, attempting first to make it a
        # Specifier and falling back to a LegacySpecifier.
        parsed = set()
        for specifier in specifiers:
            try:
                parsed.add(Specifier(specifier))
            except InvalidSpecifier:
                parsed.add(LegacySpecifier(specifier))

        # Turn our parsed specifiers into a frozen set and save them for later.
        self._specs = frozenset(parsed)

        # Store our prereleases value so we can use it later to determine if
        # we accept prereleases or not.
        self._prereleases = prereleases

    def __repr__(self):
        pre = (
            ", prereleases={0!r}".format(self.prereleases)
            if self._prereleases is not None
            else ""
        )

        return "".format(str(self), pre)

    def __str__(self):
        return ",".join(sorted(str(s) for s in self._specs))

    def __hash__(self):
        return hash(self._specs)

    def __and__(self, other):
        if isinstance(other, string_types):
            other = SpecifierSet(other)
        elif not isinstance(other, SpecifierSet):
            return NotImplemented

        specifier = SpecifierSet()
        specifier._specs = frozenset(self._specs | other._specs)

        if self._prereleases is None and other._prereleases is not None:
            specifier._prereleases = other._prereleases
        elif self._prereleases is not None and other._prereleases is None:
            specifier._prereleases = self._prereleases
        elif self._prereleases == other._prereleases:
            specifier._prereleases = self._prereleases
        else:
            raise ValueError(
                "Cannot combine SpecifierSets with True and False prerelease "
                "overrides."
            )

        return specifier

    def __eq__(self, other):
        if isinstance(other, string_types):
            other = SpecifierSet(other)
        elif isinstance(other, _IndividualSpecifier):
            other = SpecifierSet(str(other))
        elif not isinstance(other, SpecifierSet):
            return NotImplemented

        return self._specs == other._specs

    def __ne__(self, other):
        if isinstance(other, string_types):
            other = SpecifierSet(other)
        elif isinstance(other, _IndividualSpecifier):
            other = SpecifierSet(str(other))
        elif not isinstance(other, SpecifierSet):
            return NotImplemented

        return self._specs != other._specs

    def __len__(self):
        return len(self._specs)

    def __iter__(self):
        return iter(self._specs)

    @property
    def prereleases(self):
        # If we have been given an explicit prerelease modifier, then we'll
        # pass that through here.
        if self._prereleases is not None:
            return self._prereleases

        # If we don't have any specifiers, and we don't have a forced value,
        # then we'll just return None since we don't know if this should have
        # pre-releases or not.
        if not self._specs:
            return None

        # Otherwise we'll see if any of the given specifiers accept
        # prereleases, if any of them do we'll return True, otherwise False.
        return any(s.prereleases for s in self._specs)

    @prereleases.setter
    def prereleases(self, value):
        self._prereleases = value

    def __contains__(self, item):
        return self.contains(item)

    def contains(self, item, prereleases=None):
        # Ensure that our item is a Version or LegacyVersion instance.
        if not isinstance(item, (LegacyVersion, Version)):
            item = parse(item)

        # Determine if we're forcing a prerelease or not, if we're not forcing
        # one for this particular filter call, then we'll use whatever the
        # SpecifierSet thinks for whether or not we should support prereleases.
        if prereleases is None:
            prereleases = self.prereleases

        # We can determine if we're going to allow pre-releases by looking to
        # see if any of the underlying items supports them. If none of them do
        # and this item is a pre-release then we do not allow it and we can
        # short circuit that here.
        # Note: This means that 1.0.dev1 would not be contained in something
        #       like >=1.0.devabc however it would be in >=1.0.debabc,>0.0.dev0
        if not prereleases and item.is_prerelease:
            return False

        # We simply dispatch to the underlying specs here to make sure that the
        # given version is contained within all of them.
        # Note: This use of all() here means that an empty set of specifiers
        #       will always return True, this is an explicit design decision.
        return all(
            s.contains(item, prereleases=prereleases)
            for s in self._specs
        )

    def filter(self, iterable, prereleases=None):
        # Determine if we're forcing a prerelease or not, if we're not forcing
        # one for this particular filter call, then we'll use whatever the
        # SpecifierSet thinks for whether or not we should support prereleases.
        if prereleases is None:
            prereleases = self.prereleases

        # If we have any specifiers, then we want to wrap our iterable in the
        # filter method for each one, this will act as a logical AND amongst
        # each specifier.
        if self._specs:
            for spec in self._specs:
                iterable = spec.filter(iterable, prereleases=bool(prereleases))
            return iterable
        # If we do not have any specifiers, then we need to have a rough filter
        # which will filter out any pre-releases, unless there are no final
        # releases, and which will filter out LegacyVersion in general.
        else:
            filtered = []
            found_prereleases = []

            for item in iterable:
                # Ensure that we some kind of Version class for this item.
                if not isinstance(item, (LegacyVersion, Version)):
                    parsed_version = parse(item)
                else:
                    parsed_version = item

                # Filter out any item which is parsed as a LegacyVersion
                if isinstance(parsed_version, LegacyVersion):
                    continue

                # Store any item which is a pre-release for later unless we've
                # already found a final version or we are accepting prereleases
                if parsed_version.is_prerelease and not prereleases:
                    if not filtered:
                        found_prereleases.append(item)
                else:
                    filtered.append(item)

            # If we've found no items except for pre-releases, then we'll go
            # ahead and use the pre-releases
            if not filtered and found_prereleases and prereleases is None:
                return found_prereleases

            return filtered
utils.py000064400000000645147204766430006300 0ustar00# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function

import re


_canonicalize_regex = re.compile(r"[-_.]+")


def canonicalize_name(name):
    # This is taken from PEP 503.
    return _canonicalize_regex.sub("-", name).lower()
version.py000064400000026444147204766430006632 0ustar00# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function

import collections
import itertools
import re

from ._structures import Infinity


__all__ = [
    "parse", "Version", "LegacyVersion", "InvalidVersion", "VERSION_PATTERN"
]


_Version = collections.namedtuple(
    "_Version",
    ["epoch", "release", "dev", "pre", "post", "local"],
)


def parse(version):
    """
    Parse the given version string and return either a :class:`Version` object
    or a :class:`LegacyVersion` object depending on if the given version is
    a valid PEP 440 version or a legacy version.
    """
    try:
        return Version(version)
    except InvalidVersion:
        return LegacyVersion(version)


class InvalidVersion(ValueError):
    """
    An invalid version was found, users should refer to PEP 440.
    """


class _BaseVersion(object):

    def __hash__(self):
        return hash(self._key)

    def __lt__(self, other):
        return self._compare(other, lambda s, o: s < o)

    def __le__(self, other):
        return self._compare(other, lambda s, o: s <= o)

    def __eq__(self, other):
        return self._compare(other, lambda s, o: s == o)

    def __ge__(self, other):
        return self._compare(other, lambda s, o: s >= o)

    def __gt__(self, other):
        return self._compare(other, lambda s, o: s > o)

    def __ne__(self, other):
        return self._compare(other, lambda s, o: s != o)

    def _compare(self, other, method):
        if not isinstance(other, _BaseVersion):
            return NotImplemented

        return method(self._key, other._key)


class LegacyVersion(_BaseVersion):

    def __init__(self, version):
        self._version = str(version)
        self._key = _legacy_cmpkey(self._version)

    def __str__(self):
        return self._version

    def __repr__(self):
        return "".format(repr(str(self)))

    @property
    def public(self):
        return self._version

    @property
    def base_version(self):
        return self._version

    @property
    def local(self):
        return None

    @property
    def is_prerelease(self):
        return False

    @property
    def is_postrelease(self):
        return False


_legacy_version_component_re = re.compile(
    r"(\d+ | [a-z]+ | \.| -)", re.VERBOSE,
)

_legacy_version_replacement_map = {
    "pre": "c", "preview": "c", "-": "final-", "rc": "c", "dev": "@",
}


def _parse_version_parts(s):
    for part in _legacy_version_component_re.split(s):
        part = _legacy_version_replacement_map.get(part, part)

        if not part or part == ".":
            continue

        if part[:1] in "0123456789":
            # pad for numeric comparison
            yield part.zfill(8)
        else:
            yield "*" + part

    # ensure that alpha/beta/candidate are before final
    yield "*final"


def _legacy_cmpkey(version):
    # We hardcode an epoch of -1 here. A PEP 440 version can only have a epoch
    # greater than or equal to 0. This will effectively put the LegacyVersion,
    # which uses the defacto standard originally implemented by setuptools,
    # as before all PEP 440 versions.
    epoch = -1

    # This scheme is taken from pkg_resources.parse_version setuptools prior to
    # it's adoption of the packaging library.
    parts = []
    for part in _parse_version_parts(version.lower()):
        if part.startswith("*"):
            # remove "-" before a prerelease tag
            if part < "*final":
                while parts and parts[-1] == "*final-":
                    parts.pop()

            # remove trailing zeros from each series of numeric parts
            while parts and parts[-1] == "00000000":
                parts.pop()

        parts.append(part)
    parts = tuple(parts)

    return epoch, parts

# Deliberately not anchored to the start and end of the string, to make it
# easier for 3rd party code to reuse
VERSION_PATTERN = r"""
    v?
    (?:
        (?:(?P[0-9]+)!)?                           # epoch
        (?P[0-9]+(?:\.[0-9]+)*)                  # release segment
        (?P
                                          # pre-release
            [-_\.]?
            (?P(a|b|c|rc|alpha|beta|pre|preview))
            [-_\.]?
            (?P[0-9]+)?
        )?
        (?P                                         # post release
            (?:-(?P[0-9]+))
            |
            (?:
                [-_\.]?
                (?Ppost|rev|r)
                [-_\.]?
                (?P[0-9]+)?
            )
        )?
        (?P                                          # dev release
            [-_\.]?
            (?Pdev)
            [-_\.]?
            (?P[0-9]+)?
        )?
    )
    (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
"""


class Version(_BaseVersion):

    _regex = re.compile(
        r"^\s*" + VERSION_PATTERN + r"\s*$",
        re.VERBOSE | re.IGNORECASE,
    )

    def __init__(self, version):
        # Validate the version and parse it into pieces
        match = self._regex.search(version)
        if not match:
            raise InvalidVersion("Invalid version: '{0}'".format(version))

        # Store the parsed out pieces of the version
        self._version = _Version(
            epoch=int(match.group("epoch")) if match.group("epoch") else 0,
            release=tuple(int(i) for i in match.group("release").split(".")),
            pre=_parse_letter_version(
                match.group("pre_l"),
                match.group("pre_n"),
            ),
            post=_parse_letter_version(
                match.group("post_l"),
                match.group("post_n1") or match.group("post_n2"),
            ),
            dev=_parse_letter_version(
                match.group("dev_l"),
                match.group("dev_n"),
            ),
            local=_parse_local_version(match.group("local")),
        )

        # Generate a key which will be used for sorting
        self._key = _cmpkey(
            self._version.epoch,
            self._version.release,
            self._version.pre,
            self._version.post,
            self._version.dev,
            self._version.local,
        )

    def __repr__(self):
        return "".format(repr(str(self)))

    def __str__(self):
        parts = []

        # Epoch
        if self._version.epoch != 0:
            parts.append("{0}!".format(self._version.epoch))

        # Release segment
        parts.append(".".join(str(x) for x in self._version.release))

        # Pre-release
        if self._version.pre is not None:
            parts.append("".join(str(x) for x in self._version.pre))

        # Post-release
        if self._version.post is not None:
            parts.append(".post{0}".format(self._version.post[1]))

        # Development release
        if self._version.dev is not None:
            parts.append(".dev{0}".format(self._version.dev[1]))

        # Local version segment
        if self._version.local is not None:
            parts.append(
                "+{0}".format(".".join(str(x) for x in self._version.local))
            )

        return "".join(parts)

    @property
    def public(self):
        return str(self).split("+", 1)[0]

    @property
    def base_version(self):
        parts = []

        # Epoch
        if self._version.epoch != 0:
            parts.append("{0}!".format(self._version.epoch))

        # Release segment
        parts.append(".".join(str(x) for x in self._version.release))

        return "".join(parts)

    @property
    def local(self):
        version_string = str(self)
        if "+" in version_string:
            return version_string.split("+", 1)[1]

    @property
    def is_prerelease(self):
        return bool(self._version.dev or self._version.pre)

    @property
    def is_postrelease(self):
        return bool(self._version.post)


def _parse_letter_version(letter, number):
    if letter:
        # We consider there to be an implicit 0 in a pre-release if there is
        # not a numeral associated with it.
        if number is None:
            number = 0

        # We normalize any letters to their lower case form
        letter = letter.lower()

        # We consider some words to be alternate spellings of other words and
        # in those cases we want to normalize the spellings to our preferred
        # spelling.
        if letter == "alpha":
            letter = "a"
        elif letter == "beta":
            letter = "b"
        elif letter in ["c", "pre", "preview"]:
            letter = "rc"
        elif letter in ["rev", "r"]:
            letter = "post"

        return letter, int(number)
    if not letter and number:
        # We assume if we are given a number, but we are not given a letter
        # then this is using the implicit post release syntax (e.g. 1.0-1)
        letter = "post"

        return letter, int(number)


_local_version_seperators = re.compile(r"[\._-]")


def _parse_local_version(local):
    """
    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
    """
    if local is not None:
        return tuple(
            part.lower() if not part.isdigit() else int(part)
            for part in _local_version_seperators.split(local)
        )


def _cmpkey(epoch, release, pre, post, dev, local):
    # When we compare a release version, we want to compare it with all of the
    # trailing zeros removed. So we'll use a reverse the list, drop all the now
    # leading zeros until we come to something non zero, then take the rest
    # re-reverse it back into the correct order and make it a tuple and use
    # that for our sorting key.
    release = tuple(
        reversed(list(
            itertools.dropwhile(
                lambda x: x == 0,
                reversed(release),
            )
        ))
    )

    # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
    # We'll do this by abusing the pre segment, but we _only_ want to do this
    # if there is not a pre or a post segment. If we have one of those then
    # the normal sorting rules will handle this case correctly.
    if pre is None and post is None and dev is not None:
        pre = -Infinity
    # Versions without a pre-release (except as noted above) should sort after
    # those with one.
    elif pre is None:
        pre = Infinity

    # Versions without a post segment should sort before those with one.
    if post is None:
        post = -Infinity

    # Versions without a development segment should sort after those with one.
    if dev is None:
        dev = Infinity

    if local is None:
        # Versions without a local segment should sort before those with one.
        local = -Infinity
    else:
        # Versions with a local segment need that segment parsed to implement
        # the sorting rules in PEP440.
        # - Alpha numeric segments sort before numeric segments
        # - Alpha numeric segments sort lexicographically
        # - Numeric segments sort numerically
        # - Shorter versions sort before longer versions when the prefixes
        #   match exactly
        local = tuple(
            (i, "") if isinstance(i, int) else (-Infinity, i)
            for i in local
        )

    return epoch, release, pre, post, dev, local