Mercurial > ~astiob > upreckon > hgweb
comparison compat.py @ 143:92f76baebcc6
Corrected mixed indentation (and a few line lengths) in compat.py
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Wed, 25 May 2011 22:20:56 +0100 |
parents | cd347cfca272 |
children |
comparison
equal
deleted
inserted
replaced
142:98bccf81db4d | 143:92f76baebcc6 |
---|---|
6 # A few notes regarding some compatibility-driven peculiarities | 6 # A few notes regarding some compatibility-driven peculiarities |
7 # in the use of the language that can be seen in all modules: | 7 # in the use of the language that can be seen in all modules: |
8 # | 8 # |
9 # * Except statements never specify target; instead, when needed, | 9 # * Except statements never specify target; instead, when needed, |
10 # the exception is taken from sys.exc_info(). Blame the incompatible | 10 # the exception is taken from sys.exc_info(). Blame the incompatible |
11 # syntaxes of the except clause in Python 2.5 and Python 3 and the lack | 11 # syntaxes of the except clause in Python 2.5 and Python 3 |
12 # of preprocessor macros in Python of any version ;P. | 12 # and the lack of preprocessor macros in Python of any version ;P. |
13 # | 13 # |
14 # * Keyword-only parameters are never used, even for parameters | 14 # * Keyword-only parameters are never used, even for parameters |
15 # that should never be given in as arguments. The reason is | 15 # that should never be given in as arguments. The reason is |
16 # the laziness of some Python developers who have failed to finish | 16 # the laziness of some Python developers who have failed to finish |
17 # implementing them in Python 2 even though they had several years | 17 # implementing them in Python 2 even though they had several years |
106 start_is_unc, start_prefix, start_list = _abspath_split(start) | 106 start_is_unc, start_prefix, start_list = _abspath_split(start) |
107 path_is_unc, path_prefix, path_list = _abspath_split(path) | 107 path_is_unc, path_prefix, path_list = _abspath_split(path) |
108 | 108 |
109 if path_is_unc ^ start_is_unc: | 109 if path_is_unc ^ start_is_unc: |
110 raise ValueError("Cannot mix UNC and non-UNC paths (%s and %s)" | 110 raise ValueError("Cannot mix UNC and non-UNC paths (%s and %s)" |
111 % (path, start)) | 111 % (path, start)) |
112 if path_prefix.lower() != start_prefix.lower(): | 112 if path_prefix.lower() != start_prefix.lower(): |
113 if path_is_unc: | 113 if path_is_unc: |
114 raise ValueError("path is on UNC root %s, start on UNC root %s" | 114 raise ValueError("path is on UNC root %s, start on UNC root %s" |
115 % (path_prefix, start_prefix)) | 115 % (path_prefix, start_prefix)) |
116 else: | 116 else: |
117 raise ValueError("path is on drive %s, start on drive %s" | 117 raise ValueError("path is on drive %s, start on drive %s" |
118 % (path_prefix, start_prefix)) | 118 % (path_prefix, start_prefix)) |
119 # Work out how much of the filepath is shared by start and path. | 119 # Work out how much of the filepath is shared by start and path. |
120 i = 0 | 120 i = 0 |
121 for e1, e2 in zip(start_list, path_list): | 121 for e1, e2 in zip(start_list, path_list): |
122 if e1.lower() != e2.lower(): | 122 if e1.lower() != e2.lower(): |
123 break | 123 break |