src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.html

branch
eric7
changeset 10437
2f70ca07f0af
parent 10259
b51dfacef37f
child 10479
856476537696
equal deleted inserted replaced
10436:f6881d10e995 10437:2f70ca07f0af
347 <p> 347 <p>
348 Private method to check, if the code should be fixed. 348 Private method to check, if the code should be fixed.
349 </p> 349 </p>
350 <dl> 350 <dl>
351 351
352 <dt><i>code</i></dt> 352 <dt><i>code</i> (str)</dt>
353 <dd> 353 <dd>
354 to check (string) 354 to check
355 </dd> 355 </dd>
356 </dl> 356 </dl>
357 <dl> 357 <dl>
358 <dt>Return:</dt> 358 <dt>Return:</dt>
359 <dd> 359 <dd>
360 flag indicating it should be fixed (boolean) 360 flag indicating it should be fixed
361 </dd>
362 </dl>
363 <dl>
364 <dt>Return Type:</dt>
365 <dd>
366 bool
361 </dd> 367 </dd>
362 </dl> 368 </dl>
363 <a NAME="CodeStyleFixer.__findLogical" ID="CodeStyleFixer.__findLogical"></a> 369 <a NAME="CodeStyleFixer.__findLogical" ID="CodeStyleFixer.__findLogical"></a>
364 <h4>CodeStyleFixer.__findLogical</h4> 370 <h4>CodeStyleFixer.__findLogical</h4>
365 <b>__findLogical</b>(<i></i>) 371 <b>__findLogical</b>(<i></i>)
373 <dd> 379 <dd>
374 tuple containing two lists of integer with start and end tuples 380 tuple containing two lists of integer with start and end tuples
375 of lines 381 of lines
376 </dd> 382 </dd>
377 </dl> 383 </dl>
384 <dl>
385 <dt>Return Type:</dt>
386 <dd>
387 tuple of ([int, int], [int, int])
388 </dd>
389 </dl>
378 <a NAME="CodeStyleFixer.__fixBlankLinesBefore" ID="CodeStyleFixer.__fixBlankLinesBefore"></a> 390 <a NAME="CodeStyleFixer.__fixBlankLinesBefore" ID="CodeStyleFixer.__fixBlankLinesBefore"></a>
379 <h4>CodeStyleFixer.__fixBlankLinesBefore</h4> 391 <h4>CodeStyleFixer.__fixBlankLinesBefore</h4>
380 <b>__fixBlankLinesBefore</b>(<i>code, line, pos, apply=False</i>) 392 <b>__fixBlankLinesBefore</b>(<i>code, line, pos, apply=False</i>)
381 393
382 <p> 394 <p>
1903 <p> 1915 <p>
1904 This is done by adding or removing from its initial indent only. 1916 This is done by adding or removing from its initial indent only.
1905 </p> 1917 </p>
1906 <dl> 1918 <dl>
1907 1919
1908 <dt><i>line</i></dt> 1920 <dt><i>line</i> (int)</dt>
1909 <dd> 1921 <dd>
1910 line number of the issue (integer) 1922 line number of the issue
1911 </dd> 1923 </dd>
1912 <dt><i>pos</i></dt> 1924 <dt><i>pos</i> (int)</dt>
1913 <dd> 1925 <dd>
1914 position inside line (integer) 1926 position inside line
1915 </dd> 1927 </dd>
1916 <dt><i>logical</i></dt> 1928 <dt><i>logical</i> (str)</dt>
1917 <dd> 1929 <dd>
1918 logical line structure 1930 logical line structure
1919 </dd> 1931 </dd>
1920 </dl> 1932 </dl>
1921 <dl> 1933 <dl>
1922 <dt>Return:</dt> 1934 <dt>Return:</dt>
1923 <dd> 1935 <dd>
1924 flag indicating a change was done (boolean) 1936 flag indicating a change was done
1937 </dd>
1938 </dl>
1939 <dl>
1940 <dt>Return Type:</dt>
1941 <dd>
1942 bool
1925 </dd> 1943 </dd>
1926 </dl> 1944 </dl>
1927 <dl> 1945 <dl>
1928 1946
1929 <dt>Raises <b>ValueError</b>:</dt> 1947 <dt>Raises <b>ValueError</b>:</dt>
2094 <p> 2112 <p>
2095 Private method to correct whitespace at the given offset. 2113 Private method to correct whitespace at the given offset.
2096 </p> 2114 </p>
2097 <dl> 2115 <dl>
2098 2116
2099 <dt><i>line</i></dt> 2117 <dt><i>line</i> (str)</dt>
2100 <dd> 2118 <dd>
2101 line to be corrected (string) 2119 line to be corrected
2102 </dd> 2120 </dd>
2103 <dt><i>offset</i></dt> 2121 <dt><i>offset</i> (int)</dt>
2104 <dd> 2122 <dd>
2105 offset within line (integer) 2123 offset within line
2106 </dd> 2124 </dd>
2107 <dt><i>replacement</i></dt> 2125 <dt><i>replacement</i> (str)</dt>
2108 <dd> 2126 <dd>
2109 replacement string (string) 2127 replacement string
2110 </dd> 2128 </dd>
2111 </dl> 2129 </dl>
2112 <dl> 2130 <dl>
2113 <dt>Return:</dt> 2131 <dt>Return:</dt>
2114 <dd> 2132 <dd>
2115 corrected line 2133 corrected line
2134 </dd>
2135 </dl>
2136 <dl>
2137 <dt>Return Type:</dt>
2138 <dd>
2139 str
2116 </dd> 2140 </dd>
2117 </dl> 2141 </dl>
2118 <a NAME="CodeStyleFixer.__getID" ID="CodeStyleFixer.__getID"></a> 2142 <a NAME="CodeStyleFixer.__getID" ID="CodeStyleFixer.__getID"></a>
2119 <h4>CodeStyleFixer.__getID</h4> 2143 <h4>CodeStyleFixer.__getID</h4>
2120 <b>__getID</b>(<i></i>) 2144 <b>__getID</b>(<i></i>)
2123 Private method to get the ID for a deferred fix. 2147 Private method to get the ID for a deferred fix.
2124 </p> 2148 </p>
2125 <dl> 2149 <dl>
2126 <dt>Return:</dt> 2150 <dt>Return:</dt>
2127 <dd> 2151 <dd>
2128 ID for a deferred fix (integer) 2152 ID for a deferred fix
2153 </dd>
2154 </dl>
2155 <dl>
2156 <dt>Return Type:</dt>
2157 <dd>
2158 int
2129 </dd> 2159 </dd>
2130 </dl> 2160 </dl>
2131 <a NAME="CodeStyleFixer.__getIndent" ID="CodeStyleFixer.__getIndent"></a> 2161 <a NAME="CodeStyleFixer.__getIndent" ID="CodeStyleFixer.__getIndent"></a>
2132 <h4>CodeStyleFixer.__getIndent</h4> 2162 <h4>CodeStyleFixer.__getIndent</h4>
2133 <b>__getIndent</b>(<i>line</i>) 2163 <b>__getIndent</b>(<i>line</i>)
2135 <p> 2165 <p>
2136 Private method to get the indentation string. 2166 Private method to get the indentation string.
2137 </p> 2167 </p>
2138 <dl> 2168 <dl>
2139 2169
2140 <dt><i>line</i></dt> 2170 <dt><i>line</i> (str)</dt>
2141 <dd> 2171 <dd>
2142 line to determine the indentation string from (string) 2172 line to determine the indentation string from
2143 </dd> 2173 </dd>
2144 </dl> 2174 </dl>
2145 <dl> 2175 <dl>
2146 <dt>Return:</dt> 2176 <dt>Return:</dt>
2147 <dd> 2177 <dd>
2148 indentation string (string) 2178 indentation string
2179 </dd>
2180 </dl>
2181 <dl>
2182 <dt>Return Type:</dt>
2183 <dd>
2184 str
2149 </dd> 2185 </dd>
2150 </dl> 2186 </dl>
2151 <a NAME="CodeStyleFixer.__getIndentWord" ID="CodeStyleFixer.__getIndentWord"></a> 2187 <a NAME="CodeStyleFixer.__getIndentWord" ID="CodeStyleFixer.__getIndentWord"></a>
2152 <h4>CodeStyleFixer.__getIndentWord</h4> 2188 <h4>CodeStyleFixer.__getIndentWord</h4>
2153 <b>__getIndentWord</b>(<i></i>) 2189 <b>__getIndentWord</b>(<i></i>)
2156 Private method to determine the indentation type. 2192 Private method to determine the indentation type.
2157 </p> 2193 </p>
2158 <dl> 2194 <dl>
2159 <dt>Return:</dt> 2195 <dt>Return:</dt>
2160 <dd> 2196 <dd>
2161 string to be used for an indentation (string) 2197 string to be used for an indentation
2198 </dd>
2199 </dl>
2200 <dl>
2201 <dt>Return Type:</dt>
2202 <dd>
2203 str
2162 </dd> 2204 </dd>
2163 </dl> 2205 </dl>
2164 <a NAME="CodeStyleFixer.__getLogical" ID="CodeStyleFixer.__getLogical"></a> 2206 <a NAME="CodeStyleFixer.__getLogical" ID="CodeStyleFixer.__getLogical"></a>
2165 <h4>CodeStyleFixer.__getLogical</h4> 2207 <h4>CodeStyleFixer.__getLogical</h4>
2166 <b>__getLogical</b>(<i>line, pos</i>) 2208 <b>__getLogical</b>(<i>line, pos</i>)
2169 Private method to get the logical line corresponding to the given 2211 Private method to get the logical line corresponding to the given
2170 position. 2212 position.
2171 </p> 2213 </p>
2172 <dl> 2214 <dl>
2173 2215
2174 <dt><i>line</i></dt> 2216 <dt><i>line</i> (int)</dt>
2175 <dd> 2217 <dd>
2176 line number of the issue (integer) 2218 line number of the issue
2177 </dd> 2219 </dd>
2178 <dt><i>pos</i></dt> 2220 <dt><i>pos</i> (int)</dt>
2179 <dd> 2221 <dd>
2180 position inside line (integer) 2222 position inside line
2181 </dd> 2223 </dd>
2182 </dl> 2224 </dl>
2183 <dl> 2225 <dl>
2184 <dt>Return:</dt> 2226 <dt>Return:</dt>
2185 <dd> 2227 <dd>
2187 logical line, another tuple of two integers giving the end 2229 logical line, another tuple of two integers giving the end
2188 of the logical line and a list of strings with the original 2230 of the logical line and a list of strings with the original
2189 source lines 2231 source lines
2190 </dd> 2232 </dd>
2191 </dl> 2233 </dl>
2234 <dl>
2235 <dt>Return Type:</dt>
2236 <dd>
2237 tuple of ((int, int), (int, int), [str])
2238 </dd>
2239 </dl>
2192 <a NAME="CodeStyleFixer.__multilineStringLines" ID="CodeStyleFixer.__multilineStringLines"></a> 2240 <a NAME="CodeStyleFixer.__multilineStringLines" ID="CodeStyleFixer.__multilineStringLines"></a>
2193 <h4>CodeStyleFixer.__multilineStringLines</h4> 2241 <h4>CodeStyleFixer.__multilineStringLines</h4>
2194 <b>__multilineStringLines</b>(<i></i>) 2242 <b>__multilineStringLines</b>(<i></i>)
2195 2243
2196 <p> 2244 <p>
2200 <dl> 2248 <dl>
2201 <dt>Return:</dt> 2249 <dt>Return:</dt>
2202 <dd> 2250 <dd>
2203 tuple of a set of line numbers belonging to a multi line 2251 tuple of a set of line numbers belonging to a multi line
2204 string and a set of line numbers belonging to a multi line 2252 string and a set of line numbers belonging to a multi line
2205 documentation string (tuple of two set of integer) 2253 documentation string
2254 </dd>
2255 </dl>
2256 <dl>
2257 <dt>Return Type:</dt>
2258 <dd>
2259 tuple of (set of int, set of int)
2206 </dd> 2260 </dd>
2207 </dl> 2261 </dl>
2208 <a NAME="CodeStyleFixer.finalize" ID="CodeStyleFixer.finalize"></a> 2262 <a NAME="CodeStyleFixer.finalize" ID="CodeStyleFixer.finalize"></a>
2209 <h4>CodeStyleFixer.finalize</h4> 2263 <h4>CodeStyleFixer.finalize</h4>
2210 <b>finalize</b>(<i></i>) 2264 <b>finalize</b>(<i></i>)
2216 <dt>Return:</dt> 2270 <dt>Return:</dt>
2217 <dd> 2271 <dd>
2218 dictionary containing the fix results 2272 dictionary containing the fix results
2219 </dd> 2273 </dd>
2220 </dl> 2274 </dl>
2275 <dl>
2276 <dt>Return Type:</dt>
2277 <dd>
2278 dict
2279 </dd>
2280 </dl>
2221 <a NAME="CodeStyleFixer.fixIssue" ID="CodeStyleFixer.fixIssue"></a> 2281 <a NAME="CodeStyleFixer.fixIssue" ID="CodeStyleFixer.fixIssue"></a>
2222 <h4>CodeStyleFixer.fixIssue</h4> 2282 <h4>CodeStyleFixer.fixIssue</h4>
2223 <b>fixIssue</b>(<i>line, pos, code</i>) 2283 <b>fixIssue</b>(<i>line, pos, code</i>)
2224 2284
2225 <p> 2285 <p>
2264 </p> 2324 </p>
2265 <dl> 2325 <dl>
2266 <dt>Return:</dt> 2326 <dt>Return:</dt>
2267 <dd> 2327 <dd>
2268 flag indicating that one string starts with the other 2328 flag indicating that one string starts with the other
2269 (boolean) 2329 </dd>
2330 </dl>
2331 <dl>
2332 <dt>Return Type:</dt>
2333 <dd>
2334 bool
2270 </dd> 2335 </dd>
2271 </dl> 2336 </dl>
2272 <a NAME="CodeStyleFixer.saveFile" ID="CodeStyleFixer.saveFile"></a> 2337 <a NAME="CodeStyleFixer.saveFile" ID="CodeStyleFixer.saveFile"></a>
2273 <h4>CodeStyleFixer.saveFile</h4> 2338 <h4>CodeStyleFixer.saveFile</h4>
2274 <b>saveFile</b>(<i>encoding</i>) 2339 <b>saveFile</b>(<i>encoding</i>)
2276 <p> 2341 <p>
2277 Public method to save the modified file. 2342 Public method to save the modified file.
2278 </p> 2343 </p>
2279 <dl> 2344 <dl>
2280 2345
2281 <dt><i>encoding</i></dt> 2346 <dt><i>encoding</i> (str)</dt>
2282 <dd> 2347 <dd>
2283 encoding of the source file (string) 2348 encoding of the source file
2284 </dd> 2349 </dd>
2285 </dl> 2350 </dl>
2286 <dl> 2351 <dl>
2287 <dt>Return:</dt> 2352 <dt>Return:</dt>
2288 <dd> 2353 <dd>
2289 error message on failure (tuple of str) 2354 error message on failure
2355 </dd>
2356 </dl>
2357 <dl>
2358 <dt>Return Type:</dt>
2359 <dd>
2360 tuple of (str, [str])
2290 </dd> 2361 </dd>
2291 </dl> 2362 </dl>
2292 <div align="right"><a href="#top">Up</a></div> 2363 <div align="right"><a href="#top">Up</a></div>
2293 <hr /> 2364 <hr />
2294 <hr /> 2365 <hr />
2343 <p> 2414 <p>
2344 Constructor 2415 Constructor
2345 </p> 2416 </p>
2346 <dl> 2417 <dl>
2347 2418
2348 <dt><i>physical_lines</i></dt> 2419 <dt><i>physical_lines</i> (list of str)</dt>
2349 <dd> 2420 <dd>
2350 list of physical lines to operate on 2421 list of physical lines to operate on
2351 (list of strings)
2352 </dd> 2422 </dd>
2353 </dl> 2423 </dl>
2354 <a NAME="IndentationWrapper.__buildTokensLogical" ID="IndentationWrapper.__buildTokensLogical"></a> 2424 <a NAME="IndentationWrapper.__buildTokensLogical" ID="IndentationWrapper.__buildTokensLogical"></a>
2355 <h4>IndentationWrapper.__buildTokensLogical</h4> 2425 <h4>IndentationWrapper.__buildTokensLogical</h4>
2356 <b>__buildTokensLogical</b>(<i>tokens</i>) 2426 <b>__buildTokensLogical</b>(<i>tokens</i>)
2358 <p> 2428 <p>
2359 Private method to build a logical line from a list of tokens. 2429 Private method to build a logical line from a list of tokens.
2360 </p> 2430 </p>
2361 <dl> 2431 <dl>
2362 2432
2363 <dt><i>tokens</i></dt> 2433 <dt><i>tokens</i> (list of Token)</dt>
2364 <dd> 2434 <dd>
2365 list of tokens as generated by tokenize.generate_tokens 2435 list of tokens as generated by tokenize.generate_tokens
2366 </dd> 2436 </dd>
2367 </dl> 2437 </dl>
2368 <dl> 2438 <dl>
2369 <dt>Return:</dt> 2439 <dt>Return:</dt>
2370 <dd> 2440 <dd>
2371 logical line (string) 2441 logical line
2442 </dd>
2443 </dl>
2444 <dl>
2445 <dt>Return Type:</dt>
2446 <dd>
2447 str
2372 </dd> 2448 </dd>
2373 </dl> 2449 </dl>
2374 <a NAME="IndentationWrapper.pep8Expected" ID="IndentationWrapper.pep8Expected"></a> 2450 <a NAME="IndentationWrapper.pep8Expected" ID="IndentationWrapper.pep8Expected"></a>
2375 <h4>IndentationWrapper.pep8Expected</h4> 2451 <h4>IndentationWrapper.pep8Expected</h4>
2376 <b>pep8Expected</b>(<i></i>) 2452 <b>pep8Expected</b>(<i></i>)
2381 </p> 2457 </p>
2382 <dl> 2458 <dl>
2383 <dt>Return:</dt> 2459 <dt>Return:</dt>
2384 <dd> 2460 <dd>
2385 list of lists, where each list represents valid indent levels 2461 list of lists, where each list represents valid indent levels
2386 for the line in question, relative from the initial indent. However, 2462 for the line in question, relative from the initial indent. However,
2387 the first entry is the indent level which was expected. 2463 the first entry is the indent level which was expected.
2464 </dd>
2465 </dl>
2466 <dl>
2467 <dt>Return Type:</dt>
2468 <dd>
2469 list of list
2388 </dd> 2470 </dd>
2389 </dl> 2471 </dl>
2390 <div align="right"><a href="#top">Up</a></div> 2472 <div align="right"><a href="#top">Up</a></div>
2391 <hr /> 2473 <hr />
2392 <hr /> 2474 <hr />
2470 <p> 2552 <p>
2471 Constructor 2553 Constructor
2472 </p> 2554 </p>
2473 <dl> 2555 <dl>
2474 2556
2475 <dt><i>curLine</i></dt> 2557 <dt><i>curLine</i> (str)</dt>
2476 <dd> 2558 <dd>
2477 text to work on (string) 2559 text to work on
2478 </dd> 2560 </dd>
2479 <dt><i>prevLine</i></dt> 2561 <dt><i>prevLine</i> (str)</dt>
2480 <dd> 2562 <dd>
2481 line before the text to work on (string) 2563 line before the text to work on
2482 </dd> 2564 </dd>
2483 <dt><i>nextLine</i></dt> 2565 <dt><i>nextLine</i> (str)</dt>
2484 <dd> 2566 <dd>
2485 line after the text to work on (string) 2567 line after the text to work on
2486 </dd> 2568 </dd>
2487 <dt><i>maxLength</i></dt> 2569 <dt><i>maxLength</i> (int)</dt>
2488 <dd> 2570 <dd>
2489 maximum allowed line length (integer) 2571 maximum allowed line length
2490 </dd> 2572 </dd>
2491 <dt><i>eol</i></dt> 2573 <dt><i>eol</i> (str)</dt>
2492 <dd> 2574 <dd>
2493 eond-of-line marker (string) 2575 eond-of-line marker
2494 </dd> 2576 </dd>
2495 <dt><i>indentWord</i></dt> 2577 <dt><i>indentWord</i> (str)</dt>
2496 <dd> 2578 <dd>
2497 string used for indentation (string) 2579 string used for indentation
2498 </dd> 2580 </dd>
2499 <dt><i>isDocString</i></dt> 2581 <dt><i>isDocString</i> (bool)</dt>
2500 <dd> 2582 <dd>
2501 flag indicating that the line belongs to 2583 flag indicating that the line belongs to
2502 a documentation string (boolean) 2584 a documentation string
2503 </dd> 2585 </dd>
2504 </dl> 2586 </dl>
2505 <a NAME="LineShortener.__breakMultiline" ID="LineShortener.__breakMultiline"></a> 2587 <a NAME="LineShortener.__breakMultiline" ID="LineShortener.__breakMultiline"></a>
2506 <h4>LineShortener.__breakMultiline</h4> 2588 <h4>LineShortener.__breakMultiline</h4>
2507 <b>__breakMultiline</b>(<i></i>) 2589 <b>__breakMultiline</b>(<i></i>)
2511 </p> 2593 </p>
2512 <dl> 2594 <dl>
2513 <dt>Return:</dt> 2595 <dt>Return:</dt>
2514 <dd> 2596 <dd>
2515 tuple of the shortened line and the changed next line 2597 tuple of the shortened line and the changed next line
2516 (string, string) 2598 </dd>
2599 </dl>
2600 <dl>
2601 <dt>Return Type:</dt>
2602 <dd>
2603 tuple of (str, str)
2517 </dd> 2604 </dd>
2518 </dl> 2605 </dl>
2519 <a NAME="LineShortener.__checkSyntax" ID="LineShortener.__checkSyntax"></a> 2606 <a NAME="LineShortener.__checkSyntax" ID="LineShortener.__checkSyntax"></a>
2520 <h4>LineShortener.__checkSyntax</h4> 2607 <h4>LineShortener.__checkSyntax</h4>
2521 <b>__checkSyntax</b>(<i>code</i>) 2608 <b>__checkSyntax</b>(<i>code</i>)
2523 <p> 2610 <p>
2524 Private method to check the syntax of the given code fragment. 2611 Private method to check the syntax of the given code fragment.
2525 </p> 2612 </p>
2526 <dl> 2613 <dl>
2527 2614
2528 <dt><i>code</i></dt> 2615 <dt><i>code</i> (str)</dt>
2529 <dd> 2616 <dd>
2530 code fragment to check (string) 2617 code fragment to check
2531 </dd> 2618 </dd>
2532 </dl> 2619 </dl>
2533 <dl> 2620 <dl>
2534 <dt>Return:</dt> 2621 <dt>Return:</dt>
2535 <dd> 2622 <dd>
2536 flag indicating syntax is ok (boolean) 2623 flag indicating syntax is ok
2624 </dd>
2625 </dl>
2626 <dl>
2627 <dt>Return Type:</dt>
2628 <dd>
2629 bool
2537 </dd> 2630 </dd>
2538 </dl> 2631 </dl>
2539 <a NAME="LineShortener.__countUnbalancedBrackets" ID="LineShortener.__countUnbalancedBrackets"></a> 2632 <a NAME="LineShortener.__countUnbalancedBrackets" ID="LineShortener.__countUnbalancedBrackets"></a>
2540 <h4>LineShortener.__countUnbalancedBrackets</h4> 2633 <h4>LineShortener.__countUnbalancedBrackets</h4>
2541 <b>__countUnbalancedBrackets</b>(<i>line</i>) 2634 <b>__countUnbalancedBrackets</b>(<i>line</i>)
2544 Private method to determine the number of unmatched open/close 2637 Private method to determine the number of unmatched open/close
2545 brackets. 2638 brackets.
2546 </p> 2639 </p>
2547 <dl> 2640 <dl>
2548 2641
2549 <dt><i>line</i></dt> 2642 <dt><i>line</i> (str)</dt>
2550 <dd> 2643 <dd>
2551 line to work at (string) 2644 line to work at
2552 </dd> 2645 </dd>
2553 </dl> 2646 </dl>
2554 <dl> 2647 <dl>
2555 <dt>Return:</dt> 2648 <dt>Return:</dt>
2556 <dd> 2649 <dd>
2557 number of unmatched open/close brackets (integer) 2650 number of unmatched open/close brackets
2651 </dd>
2652 </dl>
2653 <dl>
2654 <dt>Return Type:</dt>
2655 <dd>
2656 int
2558 </dd> 2657 </dd>
2559 </dl> 2658 </dl>
2560 <a NAME="LineShortener.__getIndent" ID="LineShortener.__getIndent"></a> 2659 <a NAME="LineShortener.__getIndent" ID="LineShortener.__getIndent"></a>
2561 <h4>LineShortener.__getIndent</h4> 2660 <h4>LineShortener.__getIndent</h4>
2562 <b>__getIndent</b>(<i>line</i>) 2661 <b>__getIndent</b>(<i>line</i>)
2564 <p> 2663 <p>
2565 Private method to get the indentation string. 2664 Private method to get the indentation string.
2566 </p> 2665 </p>
2567 <dl> 2666 <dl>
2568 2667
2569 <dt><i>line</i></dt> 2668 <dt><i>line</i> (str)</dt>
2570 <dd> 2669 <dd>
2571 line to determine the indentation string from (string) 2670 line to determine the indentation string from
2572 </dd> 2671 </dd>
2573 </dl> 2672 </dl>
2574 <dl> 2673 <dl>
2575 <dt>Return:</dt> 2674 <dt>Return:</dt>
2576 <dd> 2675 <dd>
2577 indentation string (string) 2676 indentation string
2677 </dd>
2678 </dl>
2679 <dl>
2680 <dt>Return Type:</dt>
2681 <dd>
2682 str
2578 </dd> 2683 </dd>
2579 </dl> 2684 </dl>
2580 <a NAME="LineShortener.__isProbablyInsideStringOrComment" ID="LineShortener.__isProbablyInsideStringOrComment"></a> 2685 <a NAME="LineShortener.__isProbablyInsideStringOrComment" ID="LineShortener.__isProbablyInsideStringOrComment"></a>
2581 <h4>LineShortener.__isProbablyInsideStringOrComment</h4> 2686 <h4>LineShortener.__isProbablyInsideStringOrComment</h4>
2582 <b>__isProbablyInsideStringOrComment</b>(<i>line, index</i>) 2687 <b>__isProbablyInsideStringOrComment</b>(<i>line, index</i>)
2585 Private method to check, if the given string might be inside a string 2690 Private method to check, if the given string might be inside a string
2586 or comment. 2691 or comment.
2587 </p> 2692 </p>
2588 <dl> 2693 <dl>
2589 2694
2590 <dt><i>line</i></dt> 2695 <dt><i>line</i> (str)</dt>
2591 <dd> 2696 <dd>
2592 line to check (string) 2697 line to check
2593 </dd> 2698 </dd>
2594 <dt><i>index</i></dt> 2699 <dt><i>index</i> (int)</dt>
2595 <dd> 2700 <dd>
2596 position inside line to check (integer) 2701 position inside line to check
2597 </dd> 2702 </dd>
2598 </dl> 2703 </dl>
2599 <dl> 2704 <dl>
2600 <dt>Return:</dt> 2705 <dt>Return:</dt>
2601 <dd> 2706 <dd>
2602 flag indicating the possibility of being inside a string 2707 flag indicating the possibility of being inside a string
2603 or comment 2708 or comment
2709 </dd>
2710 </dl>
2711 <dl>
2712 <dt>Return Type:</dt>
2713 <dd>
2714 bool
2604 </dd> 2715 </dd>
2605 </dl> 2716 </dl>
2606 <a NAME="LineShortener.__lineShorteningRank" ID="LineShortener.__lineShorteningRank"></a> 2717 <a NAME="LineShortener.__lineShorteningRank" ID="LineShortener.__lineShorteningRank"></a>
2607 <h4>LineShortener.__lineShorteningRank</h4> 2718 <h4>LineShortener.__lineShorteningRank</h4>
2608 <b>__lineShorteningRank</b>(<i>candidate</i>) 2719 <b>__lineShorteningRank</b>(<i>candidate</i>)
2610 <p> 2721 <p>
2611 Private method to rank a candidate. 2722 Private method to rank a candidate.
2612 </p> 2723 </p>
2613 <dl> 2724 <dl>
2614 2725
2615 <dt><i>candidate</i></dt> 2726 <dt><i>candidate</i> (str)</dt>
2616 <dd> 2727 <dd>
2617 candidate line to rank (string) 2728 candidate line to rank
2618 </dd> 2729 </dd>
2619 </dl> 2730 </dl>
2620 <dl> 2731 <dl>
2621 <dt>Return:</dt> 2732 <dt>Return:</dt>
2622 <dd> 2733 <dd>
2623 rank of the candidate (integer) 2734 rank of the candidate
2735 </dd>
2736 </dl>
2737 <dl>
2738 <dt>Return Type:</dt>
2739 <dd>
2740 int
2624 </dd> 2741 </dd>
2625 </dl> 2742 </dl>
2626 <a NAME="LineShortener.__normalizeMultiline" ID="LineShortener.__normalizeMultiline"></a> 2743 <a NAME="LineShortener.__normalizeMultiline" ID="LineShortener.__normalizeMultiline"></a>
2627 <h4>LineShortener.__normalizeMultiline</h4> 2744 <h4>LineShortener.__normalizeMultiline</h4>
2628 <b>__normalizeMultiline</b>(<i>text</i>) 2745 <b>__normalizeMultiline</b>(<i>text</i>)
2631 Private method to remove multiline-related code that will cause syntax 2748 Private method to remove multiline-related code that will cause syntax
2632 error. 2749 error.
2633 </p> 2750 </p>
2634 <dl> 2751 <dl>
2635 2752
2636 <dt><i>text</i></dt> 2753 <dt><i>text</i> (str)</dt>
2637 <dd> 2754 <dd>
2638 code line to work on (string) 2755 code line to work on
2639 </dd> 2756 </dd>
2640 </dl> 2757 </dl>
2641 <dl> 2758 <dl>
2642 <dt>Return:</dt> 2759 <dt>Return:</dt>
2643 <dd> 2760 <dd>
2644 normalized code line (string) 2761 normalized code line
2762 </dd>
2763 </dl>
2764 <dl>
2765 <dt>Return Type:</dt>
2766 <dd>
2767 str
2645 </dd> 2768 </dd>
2646 </dl> 2769 </dl>
2647 <a NAME="LineShortener.__shortenComment" ID="LineShortener.__shortenComment"></a> 2770 <a NAME="LineShortener.__shortenComment" ID="LineShortener.__shortenComment"></a>
2648 <h4>LineShortener.__shortenComment</h4> 2771 <h4>LineShortener.__shortenComment</h4>
2649 <b>__shortenComment</b>(<i>isLast</i>) 2772 <b>__shortenComment</b>(<i>isLast</i>)
2651 <p> 2774 <p>
2652 Private method to shorten a comment line. 2775 Private method to shorten a comment line.
2653 </p> 2776 </p>
2654 <dl> 2777 <dl>
2655 2778
2656 <dt><i>isLast</i></dt> 2779 <dt><i>isLast</i> (bool)</dt>
2657 <dd> 2780 <dd>
2658 flag indicating, that the line is the last comment line 2781 flag indicating, that the line is the last comment line
2659 (boolean) 2782 </dd>
2660 </dd> 2783 </dl>
2661 </dl> 2784 <dl>
2662 <dl> 2785 <dt>Return:</dt>
2663 <dt>Return:</dt> 2786 <dd>
2664 <dd> 2787 shortened comment line
2665 shortened comment line (string) 2788 </dd>
2789 </dl>
2790 <dl>
2791 <dt>Return Type:</dt>
2792 <dd>
2793 str
2666 </dd> 2794 </dd>
2667 </dl> 2795 </dl>
2668 <a NAME="LineShortener.__shortenLine" ID="LineShortener.__shortenLine"></a> 2796 <a NAME="LineShortener.__shortenLine" ID="LineShortener.__shortenLine"></a>
2669 <h4>LineShortener.__shortenLine</h4> 2797 <h4>LineShortener.__shortenLine</h4>
2670 <b>__shortenLine</b>(<i>tokens, source, indent</i>) 2798 <b>__shortenLine</b>(<i>tokens, source, indent</i>)
2672 <p> 2800 <p>
2673 Private method to shorten a line of code at an operator. 2801 Private method to shorten a line of code at an operator.
2674 </p> 2802 </p>
2675 <dl> 2803 <dl>
2676 2804
2677 <dt><i>tokens</i></dt> 2805 <dt><i>tokens</i> (list of Token)</dt>
2678 <dd> 2806 <dd>
2679 tokens of the line as generated by tokenize 2807 tokens of the line as generated by tokenize
2680 (list of token) 2808 </dd>
2681 </dd> 2809 <dt><i>source</i> (str)</dt>
2682 <dt><i>source</i></dt> 2810 <dd>
2683 <dd> 2811 code string to work at
2684 code string to work at (string) 2812 </dd>
2685 </dd> 2813 <dt><i>indent</i> (str)</dt>
2686 <dt><i>indent</i></dt> 2814 <dd>
2687 <dd> 2815 indentation string of the code line
2688 indentation string of the code line (string) 2816 </dd>
2689 </dd> 2817 </dl>
2690 </dl> 2818 <dl>
2691 <dl> 2819 <dt>Return:</dt>
2692 <dt>Return:</dt> 2820 <dd>
2693 <dd> 2821 list of candidates
2694 list of candidates (list of string) 2822 </dd>
2823 </dl>
2824 <dl>
2825 <dt>Return Type:</dt>
2826 <dd>
2827 list of str
2695 </dd> 2828 </dd>
2696 </dl> 2829 </dl>
2697 <a NAME="LineShortener.shorten" ID="LineShortener.shorten"></a> 2830 <a NAME="LineShortener.shorten" ID="LineShortener.shorten"></a>
2698 <h4>LineShortener.shorten</h4> 2831 <h4>LineShortener.shorten</h4>
2699 <b>shorten</b>(<i></i>) 2832 <b>shorten</b>(<i></i>)
2703 </p> 2836 </p>
2704 <dl> 2837 <dl>
2705 <dt>Return:</dt> 2838 <dt>Return:</dt>
2706 <dd> 2839 <dd>
2707 tuple of a flag indicating successful shortening, the 2840 tuple of a flag indicating successful shortening, the
2708 shortened line and the changed next line (boolean, string, string) 2841 shortened line and the changed next line
2842 </dd>
2843 </dl>
2844 <dl>
2845 <dt>Return Type:</dt>
2846 <dd>
2847 tuple of (bool, str, str)
2709 </dd> 2848 </dd>
2710 </dl> 2849 </dl>
2711 <div align="right"><a href="#top">Up</a></div> 2850 <div align="right"><a href="#top">Up</a></div>
2712 <hr /> 2851 <hr />
2713 <hr /> 2852 <hr />
2775 <p> 2914 <p>
2776 Constructor 2915 Constructor
2777 </p> 2916 </p>
2778 <dl> 2917 <dl>
2779 2918
2780 <dt><i>sourceLines</i></dt> 2919 <dt><i>sourceLines</i> (list of str)</dt>
2781 <dd> 2920 <dd>
2782 list of source lines including eol marker 2921 list of source lines including eol marker
2783 (list of string)
2784 </dd> 2922 </dd>
2785 </dl> 2923 </dl>
2786 <a NAME="Reindenter.__genStats" ID="Reindenter.__genStats"></a> 2924 <a NAME="Reindenter.__genStats" ID="Reindenter.__genStats"></a>
2787 <h4>Reindenter.__genStats</h4> 2925 <h4>Reindenter.__genStats</h4>
2788 <b>__genStats</b>(<i>tokens</i>) 2926 <b>__genStats</b>(<i>tokens</i>)
2790 <p> 2928 <p>
2791 Private method to generate the re-indent statistics. 2929 Private method to generate the re-indent statistics.
2792 </p> 2930 </p>
2793 <dl> 2931 <dl>
2794 2932
2795 <dt><i>tokens</i></dt> 2933 <dt><i>tokens</i> (function)</dt>
2796 <dd> 2934 <dd>
2797 tokens generator (tokenize._tokenize) 2935 tokens generator (tokenize._tokenize)
2798 </dd> 2936 </dd>
2799 </dl> 2937 </dl>
2800 <dl> 2938 <dl>
2801 <dt>Return:</dt> 2939 <dt>Return:</dt>
2802 <dd> 2940 <dd>
2803 reference to the generated statistics 2941 reference to the generated statistics
2942 </dd>
2943 </dl>
2944 <dl>
2945 <dt>Return Type:</dt>
2946 <dd>
2947 dict
2804 </dd> 2948 </dd>
2805 </dl> 2949 </dl>
2806 <a NAME="Reindenter.__getlspace" ID="Reindenter.__getlspace"></a> 2950 <a NAME="Reindenter.__getlspace" ID="Reindenter.__getlspace"></a>
2807 <h4>Reindenter.__getlspace</h4> 2951 <h4>Reindenter.__getlspace</h4>
2808 <b>__getlspace</b>(<i>line</i>) 2952 <b>__getlspace</b>(<i>line</i>)
2810 <p> 2954 <p>
2811 Private method to count number of leading blanks. 2955 Private method to count number of leading blanks.
2812 </p> 2956 </p>
2813 <dl> 2957 <dl>
2814 2958
2815 <dt><i>line</i></dt> 2959 <dt><i>line</i> (str)</dt>
2816 <dd> 2960 <dd>
2817 line to check (string) 2961 line to check
2818 </dd> 2962 </dd>
2819 </dl> 2963 </dl>
2820 <dl> 2964 <dl>
2821 <dt>Return:</dt> 2965 <dt>Return:</dt>
2822 <dd> 2966 <dd>
2823 number of leading blanks (integer) 2967 number of leading blanks
2968 </dd>
2969 </dl>
2970 <dl>
2971 <dt>Return Type:</dt>
2972 <dd>
2973 int
2824 </dd> 2974 </dd>
2825 </dl> 2975 </dl>
2826 <a NAME="Reindenter.fixedLine" ID="Reindenter.fixedLine"></a> 2976 <a NAME="Reindenter.fixedLine" ID="Reindenter.fixedLine"></a>
2827 <h4>Reindenter.fixedLine</h4> 2977 <h4>Reindenter.fixedLine</h4>
2828 <b>fixedLine</b>(<i>line</i>) 2978 <b>fixedLine</b>(<i>line</i>)
2830 <p> 2980 <p>
2831 Public method to get a fixed line. 2981 Public method to get a fixed line.
2832 </p> 2982 </p>
2833 <dl> 2983 <dl>
2834 2984
2835 <dt><i>line</i></dt> 2985 <dt><i>line</i> (int)</dt>
2836 <dd> 2986 <dd>
2837 number of the line to retrieve (integer) 2987 number of the line to retrieve
2838 </dd> 2988 </dd>
2839 </dl> 2989 </dl>
2840 <dl> 2990 <dl>
2841 <dt>Return:</dt> 2991 <dt>Return:</dt>
2842 <dd> 2992 <dd>
2843 fixed line (string) 2993 fixed line
2994 </dd>
2995 </dl>
2996 <dl>
2997 <dt>Return Type:</dt>
2998 <dd>
2999 str
2844 </dd> 3000 </dd>
2845 </dl> 3001 </dl>
2846 <a NAME="Reindenter.getline" ID="Reindenter.getline"></a> 3002 <a NAME="Reindenter.getline" ID="Reindenter.getline"></a>
2847 <h4>Reindenter.getline</h4> 3003 <h4>Reindenter.getline</h4>
2848 <b>getline</b>(<i></i>) 3004 <b>getline</b>(<i></i>)
2851 Public method to get a line of text for tokenize. 3007 Public method to get a line of text for tokenize.
2852 </p> 3008 </p>
2853 <dl> 3009 <dl>
2854 <dt>Return:</dt> 3010 <dt>Return:</dt>
2855 <dd> 3011 <dd>
2856 line of text (string) 3012 line of text
3013 </dd>
3014 </dl>
3015 <dl>
3016 <dt>Return Type:</dt>
3017 <dd>
3018 str
2857 </dd> 3019 </dd>
2858 </dl> 3020 </dl>
2859 <a NAME="Reindenter.run" ID="Reindenter.run"></a> 3021 <a NAME="Reindenter.run" ID="Reindenter.run"></a>
2860 <h4>Reindenter.run</h4> 3022 <h4>Reindenter.run</h4>
2861 <b>run</b>(<i></i>) 3023 <b>run</b>(<i></i>)
2864 Public method to run the re-indenter. 3026 Public method to run the re-indenter.
2865 </p> 3027 </p>
2866 <dl> 3028 <dl>
2867 <dt>Return:</dt> 3029 <dt>Return:</dt>
2868 <dd> 3030 <dd>
2869 flag indicating that a change was done (boolean) 3031 flag indicating that a change was done
3032 </dd>
3033 </dl>
3034 <dl>
3035 <dt>Return Type:</dt>
3036 <dd>
3037 bool
2870 </dd> 3038 </dd>
2871 </dl> 3039 </dl>
2872 <div align="right"><a href="#top">Up</a></div> 3040 <div align="right"><a href="#top">Up</a></div>
2873 <hr /> 3041 <hr />
2874 </body></html> 3042 </body></html>

eric ide

mercurial