<s> from __future__ import unicode_literals <EOL> import re <EOL> from reviewboard . scmtools . core import HEAD <EOL> class Client ( object ) : <EOL> '''<STR_LIT>''' <EOL> AUTHOR_KEYWORDS = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> DATE_KEYWORDS = [ '<STR_LIT:date>' , '<STR_LIT>' ] <EOL> REVISION_KEYWORDS = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> URL_KEYWORDS = [ '<STR_LIT>' , '<STR_LIT:url>' ] <EOL> ID_KEYWORDS = [ '<STR_LIT:id>' ] <EOL> HEADER_KEYWORDS = [ '<STR_LIT>' ] <EOL> LOG_DEFAULT_START = '<STR_LIT>' <EOL> LOG_DEFAULT_END = '<STR_LIT:1>' <EOL> keywords = { <EOL> '<STR_LIT>' : AUTHOR_KEYWORDS , <EOL> '<STR_LIT:date>' : DATE_KEYWORDS , <EOL> '<STR_LIT>' : REVISION_KEYWORDS , <EOL> '<STR_LIT>' : URL_KEYWORDS , <EOL> '<STR_LIT:id>' : ID_KEYWORDS , <EOL> '<STR_LIT>' : HEADER_KEYWORDS , <EOL> '<STR_LIT>' : AUTHOR_KEYWORDS , <EOL> '<STR_LIT>' : DATE_KEYWORDS , <EOL> '<STR_LIT>' : REVISION_KEYWORDS , <EOL> '<STR_LIT>' : REVISION_KEYWORDS , <EOL> '<STR_LIT:url>' : URL_KEYWORDS , <EOL> } <EOL> def __init__ ( self , config_dir , repopath , username = None , password = None ) : <EOL> self . repopath = repopath <EOL> def set_ssl_server_trust_prompt ( self , cb ) : <EOL> raise NotImplementedError <EOL> def get_file ( self , path , revision = HEAD ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError <EOL> def get_keywords ( self , path , revision = HEAD ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError <EOL> def get_log ( self , path , start = None , end = None , limit = None , <EOL> discover_changed_paths = False , limit_to_path = False ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError <EOL> def list_dir ( self , path ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError <EOL> def diff ( self , revision1 , revision2 , path = None ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError <EOL> def collapse_keywords ( self , data , keyword_str ) : <EOL> """<STR_LIT>""" <EOL> def repl ( m ) : <EOL> if m . group ( <NUM_LIT:2> ) : <EOL> return b'<STR_LIT>' % ( m . group ( <NUM_LIT:1> ) , b'<STR_LIT:U+0020>' * len ( m . group ( <NUM_LIT:3> ) ) ) <EOL> return b'<STR_LIT>' % m . group ( <NUM_LIT:1> ) <EOL> keywords = [ re . escape ( keyword ) . encode ( '<STR_LIT:utf-8>' ) <EOL> for name in re . split ( r'<STR_LIT>' , keyword_str ) <EOL> for keyword in self . keywords . get ( name . lower ( ) , [ ] ) ] <EOL> regex = re . compile ( r"<STR_LIT>" % '<STR_LIT:|>' . join ( keywords ) , <EOL> re . IGNORECASE ) <EOL> return regex . sub ( repl , data ) <EOL> @ property <EOL> def repository_info ( self ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError <EOL> def normalize_path ( self , path ) : <EOL> if path . startswith ( self . repopath ) : <EOL> return path <EOL> elif path . startswith ( '<STR_LIT>' ) : <EOL> return self . repopath + path [ <NUM_LIT:1> : ] <EOL> elif path [ <NUM_LIT:0> ] == '<STR_LIT:/>' : <EOL> return self . repopath + path <EOL> else : <EOL> return self . repopath + "<STR_LIT:/>" + path <EOL> def accept_ssl_certificate ( self , path , on_failure = None ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError </s>
