#NEWLINE# @ classmethod #NEWLINE# def parse( cls , line , editable = False ) : #NEWLINE# #INDENT# '\n        Parses a Requirement from an "editable" requirement which is either\n        a local project path or a VCS project URI.\n\n        See: pip/req.py:from_editable()\n\n        :param line: an "editable" requirement\n        :returns: a Requirement instance for the given line\n        :raises: ValueError on an invalid requirement\n        ' #NEWLINE# if editable : #NEWLINE# #INDENT# req = cls ( '-e {0}' . format ( line ) ) #NEWLINE# req . is_editable = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# req = cls ( line ) #NEWLINE# #UNINDENT# url = urlparse ( line ) #NEWLINE# req . uri = None #NEWLINE# if url . scheme : #NEWLINE# #INDENT# req . scheme = url . scheme #NEWLINE# req . uri = ( ( ( url . scheme + '://' ) + url . netloc ) + url . path ) #NEWLINE# fragment = url . fragment . split ( ' ' ) [ 0 ] . strip ( ) #NEWLINE# req . name = ( fragment . split ( 'egg=' ) [ ( - 1 ) ] or None ) #NEWLINE# req . path = url . path #NEWLINE# if fragment : #NEWLINE# #INDENT# req . uri += '#{}' . format ( fragment ) #NEWLINE# #UNINDENT# if ( url . username or url . password ) : #NEWLINE# #INDENT# username = ( url . username or '' ) #NEWLINE# password = ( url . password or '' ) #NEWLINE# req . login = ( ( username + ':' ) + password ) #NEWLINE# #UNINDENT# if ( '@' in url . path ) : #NEWLINE# #INDENT# req . revision = url . path . split ( '@' ) [ ( - 1 ) ] #NEWLINE# #UNINDENT# for vcs in VCS : #NEWLINE# #INDENT# if req . uri . startswith ( vcs ) : #NEWLINE# #INDENT# req . vcs = vcs #NEWLINE# #UNINDENT# #UNINDENT# if req . scheme . startswith ( 'file://' ) : #NEWLINE# #INDENT# req . is_local_file = True #NEWLINE# #UNINDENT# #UNINDENT# if ( ( not req . vcs ) and ( not req . is_local_file ) and ( 'egg=' not in fragment ) ) : #NEWLINE# #INDENT# req . is_specifier = True #NEWLINE# pkg_req = Req . parse ( line ) #NEWLINE# req . name = pkg_req . unsafe_name #NEWLINE# req . extras = list ( pkg_req . extras ) #NEWLINE# req . specs = pkg_req . specs #NEWLINE# if req . specs : #NEWLINE# #INDENT# req . specs = sorted ( req . specs ) #NEWLINE# #UNINDENT# #UNINDENT# return req