Skip to content

Commit

Permalink
Merge branch 'release/0.6.18'
Browse files Browse the repository at this point in the history
  • Loading branch information
klen committed May 15, 2013
2 parents 9c88704 + cb5d970 commit 1b4b8f1
Show file tree
Hide file tree
Showing 14 changed files with 413 additions and 214 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -28,3 +28,4 @@ Contributors:
* Fredrik Henrysson (fhenrysson);
* Lowe Thiderman (thiderman);
* Naoya Inada (naoina);
* Anler Hp (ikame);
6 changes: 6 additions & 0 deletions Changelog.rst
@@ -1,6 +1,12 @@
Changelog
=========

## 2013-05-15 0.6.18
--------------------
* Fixed autopep8 (`PyLintAuto`) command;
* Fix error on non-ascii characters in docstrings;
* Update python syntax;

## 2013-05-03 0.6.17
--------------------
* Update `Pylint` to version 0.28.0;
Expand Down
9 changes: 9 additions & 0 deletions README.rst
Expand Up @@ -329,6 +329,15 @@ Default values: ::
" Highlight exceptions
let g:pymode_syntax_highlight_exceptions = g:pymode_syntax_all

" Highlight equal operator
let g:pymode_syntax_highlight_equal_operator = g:pymode_syntax_all

" Highlight stars operator
let g:pymode_syntax_highlight_stars_operator = g:pymode_syntax_all

" Highlight `self`
let g:pymode_syntax_highlight_self = g:pymode_syntax_all

" For fast machines
let g:pymode_syntax_slow_sync = 0

Expand Down
1 change: 1 addition & 0 deletions autoload/pymode/lint.vim
Expand Up @@ -15,6 +15,7 @@ fun! pymode#lint#Check() "{{{
let g:pymode_lint_buffer = bufnr('%')

py from pymode import lint
py queue.stop_queue(False)
py lint.check_file()

endfunction " }}}
Expand Down
137 changes: 136 additions & 1 deletion doc/pymode.txt
Expand Up @@ -6,7 +6,7 @@
(__) (__) (__) (_) (_)(_____)(_)\_) (_/\/\_)(_____)(____/(____) ~


Version: 0.6.17
Version: 0.6.18

==============================================================================
CONTENTS *Python-mode-contents*
Expand Down Expand Up @@ -100,6 +100,36 @@ PythonMode. These options should be set in your vimrc.

|'pymode_syntax'| Turns off the custom syntax highlighting

|'pymode_syntax_all'| Enable all hightlight groups

|'pymode_syntax_print_as_function'| Hightlight `print` as function

|'pymode_syntax_highlight_equal_operator'| Hightlight `=`

|'pymode_syntax_highlight_stars_operator'| Hightlight `*`

|'pymode_syntax_highlight_self'| Hightlight `self`

|'pymode_syntax_indent_errors'| Hightlight indentation errors

|'pymode_syntax_space_errors'| Hightlight trailing spaces as errors

|'pymode_syntax_string_formating'| Hightlight string formating

|'pymode_syntax_string_format'| Hightlight Str.format syntax

|'pymode_syntax_string_templates'| Hightlight string templates

|'pymode_syntax_doc_tests'| Hightlight doctests

|'pymode_syntax_builtin_objs'| Hightlight builtin objects

|'pymode_syntax_builtin_types'| Hightlight builtin types

|'pymode_syntax_builtin_functions'| Hightlight builtin functions

|'pymode_syntax_highlight_exceptions'| Hightlight builtin exceptions

|'pymode_indent'| Enable/Disable pymode PEP8 indentation

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

------------------------------------------------------------------------------
*'pymode_syntax_all'*
Values: 0 or 1.
Default: 1.

Enabling all hightlight groups.

------------------------------------------------------------------------------
*'pymode_syntax_print_as_function'*
Values: 0 or 1.
Default: 0.

Hightlight `print` as function

------------------------------------------------------------------------------
*'pymode_syntax_highlight_equal_operator'*
Values: 0 or 1.
Default: |'pymode_syntax_all'|.

Hightlight `=`

------------------------------------------------------------------------------
*'pymode_syntax_highlight_stars_operator'*
Values: 0 or 1.
Default: |'pymode_syntax_all'|.

Hightlight `*`

------------------------------------------------------------------------------
*'pymode_syntax_highlight_self'*
Values: 0 or 1.
Default: |'pymode_syntax_all'|.

Hightlight `self`

------------------------------------------------------------------------------
*'pymode_syntax_indent_errors'*
Values: 0 or 1.
Default: |'pymode_syntax_all'|.

Hightlight indentation errors

------------------------------------------------------------------------------
*'pymode_syntax_space_errors'*
Values: 0 or 1.
Default: |'pymode_syntax_all'|.

Hightlight trailing spaces as errors

------------------------------------------------------------------------------
*'pymode_syntax_string_formating'*
Values: 0 or 1.
Default: |'pymode_syntax_all'|.

Hightlight string formating

------------------------------------------------------------------------------
*'pymode_syntax_string_format'*
Values: 0 or 1.
Default: |'pymode_syntax_all'|.

Hightlight Str.format syntax

------------------------------------------------------------------------------
*'pymode_syntax_string_templates'*
Values: 0 or 1.
Default: |'pymode_syntax_all'|.

Hightlight string templates

------------------------------------------------------------------------------
*'pymode_syntax_string_doctests'*
Values: 0 or 1.
Default: |'pymode_syntax_all'|.

Hightlight doctests

------------------------------------------------------------------------------
*'pymode_syntax_builtin_objs'*
Values: 0 or 1.
Default: |'pymode_syntax_all'|.

Hightlight builtin objects

------------------------------------------------------------------------------
*'pymode_syntax_builtin_types'*
Values: 0 or 1.
Default: |'pymode_syntax_all'|.

Hightlight builtin types

------------------------------------------------------------------------------
*'pymode_syntax_builtin_functions'*
Values: 0 or 1.
Default: |'pymode_syntax_all'|.

Hightlight builtin functions

------------------------------------------------------------------------------
*'pymode_syntax_highlight_exceptions'*
Values: 0 or 1.
Default: |'pymode_syntax_all'|.

Hightlight builtin exceptions

------------------------------------------------------------------------------
*'pymode_indent'*
Values: 0 or 1.
Expand Down
5 changes: 2 additions & 3 deletions ftplugin/python/init-pymode.vim
@@ -1,9 +1,8 @@
if exists('did_init_pymode_vim')
if pymode#Default('g:pymode_init', 1)
finish
endif
let did_init_pymode_vim = 1

let g:pymode_version = "0.6.17"
let g:pymode_version = "0.6.18"

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

Expand Down
33 changes: 18 additions & 15 deletions pylibs/autopep8.py
Expand Up @@ -54,7 +54,7 @@
import difflib
import tempfile

import pep8
from pylama import pep8


try:
Expand All @@ -63,7 +63,7 @@
unicode = str


__version__ = '0.8.7'
__version__ = '0.9'


CR = '\r'
Expand All @@ -83,8 +83,7 @@
])


DEFAULT_IGNORE = ','.join([pep8.DEFAULT_IGNORE,
'W6'])
DEFAULT_IGNORE = 'E24,W6'


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

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

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

fixed_source = original_source

if options.in_place:
if options.in_place or output:
encoding = detect_encoding(filename)

if output:
output = codecs.getwriter(encoding)(output.buffer
if hasattr(output, 'buffer')
else output)

output = LineEndingWrapper(output)

fixed_source = fix_lines(fixed_source, options, filename=filename)

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

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

Expand Down Expand Up @@ -2289,13 +2298,7 @@ def main():
else:
filenames = args[:1]

output = codecs.getwriter('utf-8')(sys.stdout.buffer
if sys.version_info[0] >= 3
else sys.stdout)

output = LineEndingWrapper(output)

fix_multiple_files(filenames, options, output)
fix_multiple_files(filenames, options, sys.stdout)
except KeyboardInterrupt:
return 1 # pragma: no cover

Expand Down
2 changes: 1 addition & 1 deletion pylibs/pylama/__init__.py
@@ -1,6 +1,6 @@
" pylama -- Python code audit. "

version_info = (0, 3, 1)
version_info = (0, 3, 2)

__version__ = version = '.'.join(map(str, version_info))
__project__ = __name__
Expand Down
19 changes: 11 additions & 8 deletions pylibs/pylama/pep8.py
Expand Up @@ -842,19 +842,21 @@ def compound_statements(logical_line):
line = logical_line
last_char = len(line) - 1
found = line.find(':')
if -1 < found < last_char:
while -1 < found < last_char:
before = line[:found]
if (before.count('{') <= before.count('}') and # {'a': 1} (dict)
before.count('[') <= before.count(']') and # [1:2] (slice)
before.count('(') <= before.count(')') and # (Python 3 annotation)
not LAMBDA_REGEX.search(before)): # lambda x: x
yield found, "E701 multiple statements on one line (colon)"
found = line.find(':', found + 1)
found = line.find(';')
if -1 < found:
while -1 < found:
if found < last_char:
yield found, "E702 multiple statements on one line (semicolon)"
else:
yield found, "E703 statement ends with a semicolon"
found = line.find(';', found + 1)


def explicit_line_join(logical_line, tokens):
Expand Down Expand Up @@ -1016,8 +1018,6 @@ def readlines(filename):
return f.readlines()
finally:
f.close()

BOM_UTF8 = '\xef\xbb\xbf'
isidentifier = re.compile(r'[a-zA-Z_]\w*').match
stdin_get_value = sys.stdin.read
else:
Expand All @@ -1035,8 +1035,6 @@ def readlines(filename):
return f.readlines()
finally:
f.close()

BOM_UTF8 = '\ufeff'
isidentifier = str.isidentifier

def stdin_get_value():
Expand Down Expand Up @@ -1202,8 +1200,13 @@ def __init__(self, filename=None, lines=None,
self.lines = []
else:
self.lines = lines
if self.lines and self.lines[0].startswith(BOM_UTF8):
self.lines[0] = self.lines[0][len(BOM_UTF8):]
if self.lines:
ord0 = ord(self.lines[0][0])
if ord0 in (0xef, 0xfeff): # Strip the UTF-8 BOM
if ord0 == 0xfeff:
self.lines[0] = self.lines[0][1:]
elif self.lines[0][:3] == '\xef\xbb\xbf':
self.lines[0] = self.lines[0][3:]
self.report = report or options.report
self.report_error = self.report.error

Expand Down
2 changes: 1 addition & 1 deletion pylibs/pymode/interface.py
Expand Up @@ -18,7 +18,7 @@ def get_current_buffer():


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


def command(cmd):
Expand Down

0 comments on commit 1b4b8f1

Please sign in to comment.