Skip to content

Commit 1b4b8f1

Browse files
committed
Merge branch 'release/0.6.18'
2 parents 9c88704 + cb5d970 commit 1b4b8f1

File tree

14 files changed

+413
-214
lines changed

14 files changed

+413
-214
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ Contributors:
2828
* Fredrik Henrysson (fhenrysson);
2929
* Lowe Thiderman (thiderman);
3030
* Naoya Inada (naoina);
31+
* Anler Hp (ikame);

Changelog.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=========
33

4+
## 2013-05-15 0.6.18
5+
--------------------
6+
* Fixed autopep8 (`PyLintAuto`) command;
7+
* Fix error on non-ascii characters in docstrings;
8+
* Update python syntax;
9+
410
## 2013-05-03 0.6.17
511
--------------------
612
* Update `Pylint` to version 0.28.0;

README.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,15 @@ Default values: ::
329329
" Highlight exceptions
330330
let g:pymode_syntax_highlight_exceptions = g:pymode_syntax_all
331331

332+
" Highlight equal operator
333+
let g:pymode_syntax_highlight_equal_operator = g:pymode_syntax_all
334+
335+
" Highlight stars operator
336+
let g:pymode_syntax_highlight_stars_operator = g:pymode_syntax_all
337+
338+
" Highlight `self`
339+
let g:pymode_syntax_highlight_self = g:pymode_syntax_all
340+
332341
" For fast machines
333342
let g:pymode_syntax_slow_sync = 0
334343

autoload/pymode/lint.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ fun! pymode#lint#Check() "{{{
1515
let g:pymode_lint_buffer = bufnr('%')
1616

1717
py from pymode import lint
18+
py queue.stop_queue(False)
1819
py lint.check_file()
1920

2021
endfunction " }}}

doc/pymode.txt

Lines changed: 136 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
(__) (__) (__) (_) (_)(_____)(_)\_) (_/\/\_)(_____)(____/(____) ~
77

88

9-
Version: 0.6.17
9+
Version: 0.6.18
1010

1111
==============================================================================
1212
CONTENTS *Python-mode-contents*
@@ -100,6 +100,36 @@ PythonMode. These options should be set in your vimrc.
100100

101101
|'pymode_syntax'| Turns off the custom syntax highlighting
102102

103+
|'pymode_syntax_all'| Enable all hightlight groups
104+
105+
|'pymode_syntax_print_as_function'| Hightlight `print` as function
106+
107+
|'pymode_syntax_highlight_equal_operator'| Hightlight `=`
108+
109+
|'pymode_syntax_highlight_stars_operator'| Hightlight `*`
110+
111+
|'pymode_syntax_highlight_self'| Hightlight `self`
112+
113+
|'pymode_syntax_indent_errors'| Hightlight indentation errors
114+
115+
|'pymode_syntax_space_errors'| Hightlight trailing spaces as errors
116+
117+
|'pymode_syntax_string_formating'| Hightlight string formating
118+
119+
|'pymode_syntax_string_format'| Hightlight Str.format syntax
120+
121+
|'pymode_syntax_string_templates'| Hightlight string templates
122+
123+
|'pymode_syntax_doc_tests'| Hightlight doctests
124+
125+
|'pymode_syntax_builtin_objs'| Hightlight builtin objects
126+
127+
|'pymode_syntax_builtin_types'| Hightlight builtin types
128+
129+
|'pymode_syntax_builtin_functions'| Hightlight builtin functions
130+
131+
|'pymode_syntax_highlight_exceptions'| Hightlight builtin exceptions
132+
103133
|'pymode_indent'| Enable/Disable pymode PEP8 indentation
104134

105135
|'pymode_options'| Set default pymode options for
@@ -344,6 +374,111 @@ Default: 1.
344374
If this option is set to 0 then the custom syntax highlighting will
345375
not be used.
346376

377+
------------------------------------------------------------------------------
378+
*'pymode_syntax_all'*
379+
Values: 0 or 1.
380+
Default: 1.
381+
382+
Enabling all hightlight groups.
383+
384+
------------------------------------------------------------------------------
385+
*'pymode_syntax_print_as_function'*
386+
Values: 0 or 1.
387+
Default: 0.
388+
389+
Hightlight `print` as function
390+
391+
------------------------------------------------------------------------------
392+
*'pymode_syntax_highlight_equal_operator'*
393+
Values: 0 or 1.
394+
Default: |'pymode_syntax_all'|.
395+
396+
Hightlight `=`
397+
398+
------------------------------------------------------------------------------
399+
*'pymode_syntax_highlight_stars_operator'*
400+
Values: 0 or 1.
401+
Default: |'pymode_syntax_all'|.
402+
403+
Hightlight `*`
404+
405+
------------------------------------------------------------------------------
406+
*'pymode_syntax_highlight_self'*
407+
Values: 0 or 1.
408+
Default: |'pymode_syntax_all'|.
409+
410+
Hightlight `self`
411+
412+
------------------------------------------------------------------------------
413+
*'pymode_syntax_indent_errors'*
414+
Values: 0 or 1.
415+
Default: |'pymode_syntax_all'|.
416+
417+
Hightlight indentation errors
418+
419+
------------------------------------------------------------------------------
420+
*'pymode_syntax_space_errors'*
421+
Values: 0 or 1.
422+
Default: |'pymode_syntax_all'|.
423+
424+
Hightlight trailing spaces as errors
425+
426+
------------------------------------------------------------------------------
427+
*'pymode_syntax_string_formating'*
428+
Values: 0 or 1.
429+
Default: |'pymode_syntax_all'|.
430+
431+
Hightlight string formating
432+
433+
------------------------------------------------------------------------------
434+
*'pymode_syntax_string_format'*
435+
Values: 0 or 1.
436+
Default: |'pymode_syntax_all'|.
437+
438+
Hightlight Str.format syntax
439+
440+
------------------------------------------------------------------------------
441+
*'pymode_syntax_string_templates'*
442+
Values: 0 or 1.
443+
Default: |'pymode_syntax_all'|.
444+
445+
Hightlight string templates
446+
447+
------------------------------------------------------------------------------
448+
*'pymode_syntax_string_doctests'*
449+
Values: 0 or 1.
450+
Default: |'pymode_syntax_all'|.
451+
452+
Hightlight doctests
453+
454+
------------------------------------------------------------------------------
455+
*'pymode_syntax_builtin_objs'*
456+
Values: 0 or 1.
457+
Default: |'pymode_syntax_all'|.
458+
459+
Hightlight builtin objects
460+
461+
------------------------------------------------------------------------------
462+
*'pymode_syntax_builtin_types'*
463+
Values: 0 or 1.
464+
Default: |'pymode_syntax_all'|.
465+
466+
Hightlight builtin types
467+
468+
------------------------------------------------------------------------------
469+
*'pymode_syntax_builtin_functions'*
470+
Values: 0 or 1.
471+
Default: |'pymode_syntax_all'|.
472+
473+
Hightlight builtin functions
474+
475+
------------------------------------------------------------------------------
476+
*'pymode_syntax_highlight_exceptions'*
477+
Values: 0 or 1.
478+
Default: |'pymode_syntax_all'|.
479+
480+
Hightlight builtin exceptions
481+
347482
------------------------------------------------------------------------------
348483
*'pymode_indent'*
349484
Values: 0 or 1.

ftplugin/python/init-pymode.vim

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
if exists('did_init_pymode_vim')
1+
if pymode#Default('g:pymode_init', 1)
22
finish
33
endif
4-
let did_init_pymode_vim = 1
54

6-
let g:pymode_version = "0.6.17"
5+
let g:pymode_version = "0.6.18"
76

87
com! PymodeVersion echomsg "Current python-mode version: " . g:pymode_version
98

pylibs/autopep8.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
import difflib
5555
import tempfile
5656

57-
import pep8
57+
from pylama import pep8
5858

5959

6060
try:
@@ -63,7 +63,7 @@
6363
unicode = str
6464

6565

66-
__version__ = '0.8.7'
66+
__version__ = '0.9'
6767

6868

6969
CR = '\r'
@@ -83,8 +83,7 @@
8383
])
8484

8585

86-
DEFAULT_IGNORE = ','.join([pep8.DEFAULT_IGNORE,
87-
'W6'])
86+
DEFAULT_IGNORE = 'E24,W6'
8887

8988

9089
def open_with_encoding(filename, encoding=None, mode='r'):
@@ -716,7 +715,10 @@ def fix_e501(self, result):
716715

717716
if self.options.verbose >= 4:
718717
print(('-' * 79 + '\n').join([''] + candidates + ['']),
719-
file=sys.stderr)
718+
file=codecs.getwriter('utf-8')(sys.stderr.buffer
719+
if hasattr(sys.stderr,
720+
'buffer')
721+
else sys.stderr))
720722

721723
for _candidate in candidates:
722724
assert _candidate is not None
@@ -1877,9 +1879,16 @@ def fix_file(filename, options=None, output=None):
18771879

18781880
fixed_source = original_source
18791881

1880-
if options.in_place:
1882+
if options.in_place or output:
18811883
encoding = detect_encoding(filename)
18821884

1885+
if output:
1886+
output = codecs.getwriter(encoding)(output.buffer
1887+
if hasattr(output, 'buffer')
1888+
else output)
1889+
1890+
output = LineEndingWrapper(output)
1891+
18831892
fixed_source = fix_lines(fixed_source, options, filename=filename)
18841893

18851894
if options.diff:
@@ -1978,7 +1987,7 @@ def parse_args(args):
19781987
help='maximum number of additional pep8 passes '
19791988
'(default: infinite)')
19801989
parser.add_option('-a', '--aggressive', action='count', default=0,
1981-
help='enable possibly unsafe changes (E711, E712); '
1990+
help='enable non-whitespace changes; '
19821991
'multiple -a result in more aggressive changes')
19831992
parser.add_option('--exclude', metavar='globs',
19841993
help='exclude files/directories that match these '
@@ -2066,7 +2075,7 @@ def supported_fixes():
20662075
re.sub(r'\s+', ' ',
20672076
getattr(instance, attribute).__doc__))
20682077

2069-
for (code, function) in global_fixes():
2078+
for (code, function) in sorted(global_fixes()):
20702079
yield (code.upper() + (4 - len(code)) * ' ',
20712080
re.sub(r'\s+', ' ', function.__doc__))
20722081

@@ -2289,13 +2298,7 @@ def main():
22892298
else:
22902299
filenames = args[:1]
22912300

2292-
output = codecs.getwriter('utf-8')(sys.stdout.buffer
2293-
if sys.version_info[0] >= 3
2294-
else sys.stdout)
2295-
2296-
output = LineEndingWrapper(output)
2297-
2298-
fix_multiple_files(filenames, options, output)
2301+
fix_multiple_files(filenames, options, sys.stdout)
22992302
except KeyboardInterrupt:
23002303
return 1 # pragma: no cover
23012304

pylibs/pylama/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" pylama -- Python code audit. "
22

3-
version_info = (0, 3, 1)
3+
version_info = (0, 3, 2)
44

55
__version__ = version = '.'.join(map(str, version_info))
66
__project__ = __name__

pylibs/pylama/pep8.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -842,19 +842,21 @@ def compound_statements(logical_line):
842842
line = logical_line
843843
last_char = len(line) - 1
844844
found = line.find(':')
845-
if -1 < found < last_char:
845+
while -1 < found < last_char:
846846
before = line[:found]
847847
if (before.count('{') <= before.count('}') and # {'a': 1} (dict)
848848
before.count('[') <= before.count(']') and # [1:2] (slice)
849849
before.count('(') <= before.count(')') and # (Python 3 annotation)
850850
not LAMBDA_REGEX.search(before)): # lambda x: x
851851
yield found, "E701 multiple statements on one line (colon)"
852+
found = line.find(':', found + 1)
852853
found = line.find(';')
853-
if -1 < found:
854+
while -1 < found:
854855
if found < last_char:
855856
yield found, "E702 multiple statements on one line (semicolon)"
856857
else:
857858
yield found, "E703 statement ends with a semicolon"
859+
found = line.find(';', found + 1)
858860

859861

860862
def explicit_line_join(logical_line, tokens):
@@ -1016,8 +1018,6 @@ def readlines(filename):
10161018
return f.readlines()
10171019
finally:
10181020
f.close()
1019-
1020-
BOM_UTF8 = '\xef\xbb\xbf'
10211021
isidentifier = re.compile(r'[a-zA-Z_]\w*').match
10221022
stdin_get_value = sys.stdin.read
10231023
else:
@@ -1035,8 +1035,6 @@ def readlines(filename):
10351035
return f.readlines()
10361036
finally:
10371037
f.close()
1038-
1039-
BOM_UTF8 = '\ufeff'
10401038
isidentifier = str.isidentifier
10411039

10421040
def stdin_get_value():
@@ -1202,8 +1200,13 @@ def __init__(self, filename=None, lines=None,
12021200
self.lines = []
12031201
else:
12041202
self.lines = lines
1205-
if self.lines and self.lines[0].startswith(BOM_UTF8):
1206-
self.lines[0] = self.lines[0][len(BOM_UTF8):]
1203+
if self.lines:
1204+
ord0 = ord(self.lines[0][0])
1205+
if ord0 in (0xef, 0xfeff): # Strip the UTF-8 BOM
1206+
if ord0 == 0xfeff:
1207+
self.lines[0] = self.lines[0][1:]
1208+
elif self.lines[0][:3] == '\xef\xbb\xbf':
1209+
self.lines[0] = self.lines[0][3:]
12071210
self.report = report or options.report
12081211
self.report_error = self.report.error
12091212

pylibs/pymode/interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def get_current_buffer():
1818

1919

2020
def show_message(message):
21-
vim.command("call pymode#WideMessage('%s')" % message)
21+
vim.command("call pymode#WideMessage('{0}')".format(message))
2222

2323

2424
def command(cmd):

0 commit comments

Comments
 (0)