<s> import os <EOL> import sys <EOL> try : <EOL> from functools import wraps <EOL> except ImportError : <EOL> def wraps ( _ ) : <EOL> def _wraps ( func ) : <EOL> return func <EOL> return _wraps <EOL> __unittest = True <EOL> def _relpath_nt ( path , start = os . path . curdir ) : <EOL> """<STR_LIT>""" <EOL> if not path : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> start_list = os . path . abspath ( start ) . split ( os . path . sep ) <EOL> path_list = os . path . abspath ( path ) . split ( os . path . sep ) <EOL> if start_list [ <NUM_LIT:0> ] . lower ( ) != path_list [ <NUM_LIT:0> ] . lower ( ) : <EOL> unc_path , rest = os . path . splitunc ( path ) <EOL> unc_start , rest = os . path . splitunc ( start ) <EOL> if bool ( unc_path ) ^ bool ( unc_start ) : <EOL> raise ValueError ( "<STR_LIT>" <EOL> % ( path , start ) ) <EOL> else : <EOL> raise ValueError ( "<STR_LIT>" <EOL> % ( path_list [ <NUM_LIT:0> ] , start_list [ <NUM_LIT:0> ] ) ) <EOL> for i in range ( min ( len ( start_list ) , len ( path_list ) ) ) : <EOL> if start_list [ i ] . lower ( ) != path_list [ i ] . lower ( ) : <EOL> break <EOL> else : <EOL> i += <NUM_LIT:1> <EOL> rel_list = [ os . path . pardir ] * ( len ( start_list ) - i ) + path_list [ i : ] <EOL> if not rel_list : <EOL> return os . path . curdir <EOL> return os . path . join ( * rel_list ) <EOL> def _relpath_posix ( path , start = os . path . curdir ) : <EOL> """<STR_LIT>""" <EOL> if not path : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> start_list = os . path . abspath ( start ) . split ( os . path . sep ) <EOL> path_list = os . path . abspath ( path ) . split ( os . path . sep ) <EOL> i = len ( os . path . commonprefix ( [ start_list , path_list ] ) ) <EOL> rel_list = [ os . path . pardir ] * ( len ( start_list ) - i ) + path_list [ i : ] <EOL> if not rel_list : <EOL> return os . path . curdir <EOL> return os . path . join ( * rel_list ) <EOL> if os . path is sys . modules . get ( '<STR_LIT>' ) : <EOL> relpath = _relpath_nt <EOL> else : <EOL> relpath = _relpath_posix </s>
