Skip to content

Commit e5f1486

Browse files
committed
Update pylama
1 parent e0dd007 commit e5f1486

File tree

16 files changed

+150
-51
lines changed

16 files changed

+150
-51
lines changed

Changelog.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
Changelog
22
=========
33

4+
* Pylama updated to version 5.0.5
5+
46
## 2014-06-11 0.8.1
57
-------------------
6-
* Pylama updated to version 3.3.2
7-
* Get fold's expression symbol from &fillchars;
8-
* Fixed error when setting g:pymode_breakpoint_cmd (expobrain);
9-
* Fixed code running;
10-
* Ability to override rope project root and .ropeproject folder
11-
* Added path argument to `PymodeRopeNewProject` which skips prompt
12-
* Disable `pymode_rope_lookup_project` by default
13-
* Options added:
14-
'pymode_rope_project_root', 'pymode_rope_ropefolder'
8+
* Pylama updated to version 3.3.2
9+
* Get fold's expression symbol from &fillchars;
10+
* Fixed error when setting g:pymode_breakpoint_cmd (expobrain);
11+
* Fixed code running;
12+
* Ability to override rope project root and .ropeproject folder
13+
* Added path argument to `PymodeRopeNewProject` which skips prompt
14+
* Disable `pymode_rope_lookup_project` by default
15+
* Options added:
16+
'pymode_rope_project_root', 'pymode_rope_ropefolder'
1517

1618

1719
## 2013-12-04 0.7.8b

pymode/libs/pylama/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
"""
77

8-
__version__ = "5.0.1"
8+
__version__ = "5.0.5"
99
__project__ = "pylama"
1010
__author__ = "Kirill Klenov <horneds@gmail.com>"
1111
__license__ = "GNU LGPL"

pymode/libs/pylama/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def parse_options(args=None, config=True, **overrides): # noqa
136136
# Parse args from command string
137137
options = PARSER.parse_args(args)
138138
options.file_params = dict()
139-
options.linter_params = dict()
139+
options.linters_params = dict()
140140

141141
# Override options
142142
for k, v in overrides.items():
@@ -165,7 +165,7 @@ def parse_options(args=None, config=True, **overrides): # noqa
165165
name = name[7:]
166166

167167
if name in LINTERS:
168-
options.linter_params[name] = dict(opts)
168+
options.linters_params[name] = dict(opts)
169169
continue
170170

171171
mask = re(fnmatch.translate(name))

pymode/libs/pylama/core.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ def run(path='', code=None, options=None):
3232
fileconfig = dict()
3333
params = dict()
3434
linters = LINTERS
35-
linter_params = dict()
35+
linters_params = dict()
3636

3737
if options:
3838
linters = options.linters
39-
linter_params = options.linter_params
39+
linters_params = options.linters_params
4040
for mask in options.file_params:
4141
if mask.match(path):
4242
fileconfig.update(options.file_params[mask])
@@ -45,6 +45,7 @@ def run(path='', code=None, options=None):
4545
with CodeContext(code, path) as ctx:
4646
code = ctx.code
4747
params = prepare_params(parse_modeline(code), fileconfig, options)
48+
LOGGER.debug('Checking params: %s', params)
4849

4950
if params.get('skip'):
5051
return errors
@@ -59,10 +60,13 @@ def run(path='', code=None, options=None):
5960
if not linter:
6061
continue
6162

62-
LOGGER.info("Run %s", lname)
63-
meta = linter_params.get(lname, dict())
64-
errors += [Error(filename=path, linter=lname, **e)
65-
for e in linter.run(path, code=code, **meta)]
63+
lparams = linters_params.get(lname, dict())
64+
LOGGER.info("Run %s %s", lname, lparams)
65+
66+
for er in linter.run(
67+
path, code=code, ignore=params.get("ignore", set()),
68+
select=params.get("select", set()), params=lparams):
69+
errors.append(Error(filename=path, linter=lname, **er))
6670

6771
except IOError as e:
6872
LOGGER.debug("IOError %s", e)

pymode/libs/pylama/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ def get(self, name, default=None):
6767
def __repr__(self):
6868
return "<Error: %s %s>" % (self.number, self.linter)
6969

70-
# pylama:ignore=W0622,D
70+
# pylama:ignore=W0622,D,R0924

pymode/libs/pylama/libs/inirama.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
"""
1717
from __future__ import unicode_literals, print_function
1818

19+
20+
__version__ = "0.8.0"
21+
__project__ = "Inirama"
22+
__author__ = "Kirill Klenov <horneds@gmail.com>"
23+
__license__ = "BSD"
24+
25+
1926
import io
2027
import re
2128
import logging
@@ -66,12 +73,6 @@ def keys(self):
6673
iteritems = DictMixin.iteritems
6774

6875

69-
__version__ = "0.7.0"
70-
__project__ = "Inirama"
71-
__author__ = "Kirill Klenov <horneds@gmail.com>"
72-
__license__ = "BSD"
73-
74-
7576
NS_LOGGER = logging.getLogger('inirama')
7677

7778

@@ -169,7 +170,7 @@ class INIScanner(Scanner):
169170
('SECTION', re.compile(r'\[[^]]+\]')),
170171
('IGNORE', re.compile(r'[ \r\t\n]+')),
171172
('COMMENT', re.compile(r'[;#].*')),
172-
('KEY', re.compile(r'[\w_]+\s*[:=].*')),
173+
('KEY_VALUE', re.compile(r'[^=\s]+\s*[:=].*')),
173174
('CONTINUATION', re.compile(r'.*'))
174175
]
175176

@@ -346,7 +347,7 @@ def parse(self, source, update=True, **params):
346347
name = None
347348

348349
for token in scanner.tokens:
349-
if token[0] == 'KEY':
350+
if token[0] == 'KEY_VALUE':
350351
name, value = re.split('[=:]', token[1], 1)
351352
name, value = name.strip(), value.strip()
352353
if not update and name in self[section]:

pymode/libs/pylama/lint/extensions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from pkg_resources import iter_entry_points
2626

2727
for entry in iter_entry_points('pylama.linter'):
28-
LINTERS[entry.name] = entry.load()()
28+
if entry.name not in LINTERS:
29+
LINTERS[entry.name] = entry.load()()
2930
except ImportError:
3031
pass

pymode/libs/pylama/lint/pylama_mccabe/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ class Linter(BaseLinter):
88
""" Mccabe code complexity. """
99

1010
@staticmethod
11-
def run(path, code=None, complexity=10, **meta):
11+
def run(path, code=None, params=None, **meta):
1212
""" MCCabe code checking.
1313
1414
:return list: List of errors.
1515
1616
"""
1717
from .mccabe import get_code_complexity
1818

19+
complexity = params.get('complexity', 10)
1920
return get_code_complexity(code, complexity, filename=path) or []

pymode/libs/pylama/lint/pylama_pep8/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ class Linter(BaseLinter):
1313
""" PEP8 code check. """
1414

1515
@staticmethod
16-
def run(path, code=None, **options):
16+
def run(path, code=None, params=None, **meta):
1717
""" PEP8 code checking.
1818
1919
:return list: List of errors.
2020
2121
"""
22-
P8Style = StyleGuide(reporter=_PEP8Report, **options)
22+
P8Style = StyleGuide(reporter=_PEP8Report, **params)
2323
buf = StringIO(code)
2424
return P8Style.input_file(path, lines=buf.readlines())
2525

pymode/libs/pylama/lint/pylama_pyflakes/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,22 @@ def __init__(self):
2121
monkey_patch_messages(checker.messages)
2222

2323
@staticmethod
24-
def run(path, code=None, builtins="", **meta):
24+
def run(path, code=None, params=None, **meta):
2525
""" Pyflake code checking.
2626
2727
:return list: List of errors.
2828
2929
"""
3030
import _ast
31-
import os
3231

33-
os.environ.setdefault('PYFLAKES_BUILTINS', builtins)
32+
builtins = params.get("builtins", "")
33+
34+
if builtins:
35+
builtins = builtins.split(",")
3436

3537
errors = []
3638
tree = compile(code, path, "exec", _ast.PyCF_ONLY_AST)
37-
w = checker.Checker(tree, path)
39+
w = checker.Checker(tree, path, builtins=builtins)
3840
w.messages = sorted(w.messages, key=lambda m: m.lineno)
3941
for w in w.messages:
4042
errors.append(dict(

0 commit comments

Comments
 (0)