GeezerVison is showing github.com — Update pylama · python-mode/python-mode@e5f1486
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: Changelog.rst +11-9Lines changed: 11 additions & 9 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | Changelog | 2 | 2 | ========= | 3 | 3 |
| | 4 | +* Pylama updated to version 5.0.5 | | 5 | + | 4 | 6 | ## 2014-06-11 0.8.1 | 5 | 7 | ------------------- | 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' | 15 | 17 |
| 16 | 18 |
| 17 | 19 | ## 2013-12-04 0.7.8b | |
Collapse file Copy file name to clipboardExpand all lines: pymode/libs/pylama/__init__.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 5 | 5 |
| 6 | 6 | """ | 7 | 7 |
| 8 | | -__version__ = "5.0.1" | | 8 | +__version__ = "5.0.5" | 9 | 9 | __project__ = "pylama" | 10 | 10 | | 11 | 11 | __license__ = "GNU LGPL" |
Collapse file Copy file name to clipboardExpand all lines: pymode/libs/pylama/config.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -136,7 +136,7 @@ def parse_options(args=None, config=True, **overrides): # noqa | 136 | 136 | # Parse args from command string | 137 | 137 | options = PARSER.parse_args(args) | 138 | 138 | options.file_params = dict() | 139 | | - options.linter_params = dict() | | 139 | + options.linters_params = dict() | 140 | 140 |
| 141 | 141 | # Override options | 142 | 142 | for k, v in overrides.items(): | @@ -165,7 +165,7 @@ def parse_options(args=None, config=True, **overrides): # noqa | 165 | 165 | name = name[7:] | 166 | 166 |
| 167 | 167 | if name in LINTERS: | 168 | | - options.linter_params[name] = dict(opts) | | 168 | + options.linters_params[name] = dict(opts) | 169 | 169 | continue | 170 | 170 |
| 171 | 171 | mask = re(fnmatch.translate(name)) | |
Collapse file Copy file name to clipboardExpand all lines: pymode/libs/pylama/core.py +10-6Lines changed: 10 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -32,11 +32,11 @@ def run(path='', code=None, options=None): | 32 | 32 | fileconfig = dict() | 33 | 33 | params = dict() | 34 | 34 | linters = LINTERS | 35 | | - linter_params = dict() | | 35 | + linters_params = dict() | 36 | 36 |
| 37 | 37 | if options: | 38 | 38 | linters = options.linters | 39 | | - linter_params = options.linter_params | | 39 | + linters_params = options.linters_params | 40 | 40 | for mask in options.file_params: | 41 | 41 | if mask.match(path): | 42 | 42 | fileconfig.update(options.file_params[mask]) | @@ -45,6 +45,7 @@ def run(path='', code=None, options=None): | 45 | 45 | with CodeContext(code, path) as ctx: | 46 | 46 | code = ctx.code | 47 | 47 | params = prepare_params(parse_modeline(code), fileconfig, options) | | 48 | + LOGGER.debug('Checking params: %s', params) | 48 | 49 |
| 49 | 50 | if params.get('skip'): | 50 | 51 | return errors | @@ -59,10 +60,13 @@ def run(path='', code=None, options=None): | 59 | 60 | if not linter: | 60 | 61 | continue | 61 | 62 |
| 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)) | 66 | 70 |
| 67 | 71 | except IOError as e: | 68 | 72 | LOGGER.debug("IOError %s", e) | |
Collapse file Copy file name to clipboardExpand all lines: pymode/libs/pylama/errors.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -67,4 +67,4 @@ def get(self, name, default=None): | 67 | 67 | def __repr__(self): | 68 | 68 | return "<Error: %s %s>" % (self.number, self.linter) | 69 | 69 |
| 70 | | -# pylama:ignore=W0622,D | | 70 | +# pylama:ignore=W0622,D,R0924 |
Collapse file Copy file name to clipboardExpand all lines: pymode/libs/pylama/libs/inirama.py +9-8Lines changed: 9 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 16 | 16 | """ | 17 | 17 | from __future__ import unicode_literals, print_function | 18 | 18 |
| | 19 | + | | 20 | +__version__ = "0.8.0" | | 21 | +__project__ = "Inirama" | | 22 | + | | 23 | +__license__ = "BSD" | | 24 | + | | 25 | + | 19 | 26 | import io | 20 | 27 | import re | 21 | 28 | import logging | @@ -66,12 +73,6 @@ def keys(self): | 66 | 73 | iteritems = DictMixin.iteritems | 67 | 74 |
| 68 | 75 |
| 69 | | -__version__ = "0.7.0" | 70 | | -__project__ = "Inirama" | 71 | | - | 72 | | -__license__ = "BSD" | 73 | | - | 74 | | - | 75 | 76 | NS_LOGGER = logging.getLogger('inirama') | 76 | 77 |
| 77 | 78 |
| @@ -169,7 +170,7 @@ class INIScanner(Scanner): | 169 | 170 | ('SECTION', re.compile(r'\[[^]]+\]')), | 170 | 171 | ('IGNORE', re.compile(r'[ \r\t\n]+')), | 171 | 172 | ('COMMENT', re.compile(r'[;#].*')), | 172 | | - ('KEY', re.compile(r'[\w_]+\s*[:=].*')), | | 173 | + ('KEY_VALUE', re.compile(r'[^=\s]+\s*[:=].*')), | 173 | 174 | ('CONTINUATION', re.compile(r'.*')) | 174 | 175 | ] | 175 | 176 |
| @@ -346,7 +347,7 @@ def parse(self, source, update=True, **params): | 346 | 347 | name = None | 347 | 348 |
| 348 | 349 | for token in scanner.tokens: | 349 | | - if token[0] == 'KEY': | | 350 | + if token[0] == 'KEY_VALUE': | 350 | 351 | name, value = re.split('[=:]', token[1], 1) | 351 | 352 | name, value = name.strip(), value.strip() | 352 | 353 | if not update and name in self[section]: | |
Collapse file Copy file name to clipboardExpand all lines: pymode/libs/pylama/lint/extensions.py +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 25 | 25 | from pkg_resources import iter_entry_points | 26 | 26 |
| 27 | 27 | 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()() | 29 | 30 | except ImportError: | 30 | 31 | pass |
Collapse file Copy file name to clipboardExpand all lines: pymode/libs/pylama/lint/pylama_mccabe/__init__.py +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -8,12 +8,13 @@ class Linter(BaseLinter): | 8 | 8 | """ Mccabe code complexity. """ | 9 | 9 |
| 10 | 10 | @staticmethod | 11 | | - def run(path, code=None, complexity=10, **meta): | | 11 | + def run(path, code=None, params=None, **meta): | 12 | 12 | """ MCCabe code checking. | 13 | 13 |
| 14 | 14 | :return list: List of errors. | 15 | 15 |
| 16 | 16 | """ | 17 | 17 | from .mccabe import get_code_complexity | 18 | 18 |
| | 19 | + complexity = params.get('complexity', 10) | 19 | 20 | return get_code_complexity(code, complexity, filename=path) or [] |
Collapse file Copy file name to clipboardExpand all lines: pymode/libs/pylama/lint/pylama_pep8/__init__.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,13 +13,13 @@ class Linter(BaseLinter): | 13 | 13 | """ PEP8 code check. """ | 14 | 14 |
| 15 | 15 | @staticmethod | 16 | | - def run(path, code=None, **options): | | 16 | + def run(path, code=None, params=None, **meta): | 17 | 17 | """ PEP8 code checking. | 18 | 18 |
| 19 | 19 | :return list: List of errors. | 20 | 20 |
| 21 | 21 | """ | 22 | | - P8Style = StyleGuide(reporter=_PEP8Report, **options) | | 22 | + P8Style = StyleGuide(reporter=_PEP8Report, **params) | 23 | 23 | buf = StringIO(code) | 24 | 24 | return P8Style.input_file(path, lines=buf.readlines()) | 25 | 25 |
| |
Collapse file Copy file name to clipboardExpand all lines: pymode/libs/pylama/lint/pylama_pyflakes/__init__.py +6-4Lines changed: 6 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -21,20 +21,22 @@ def __init__(self): | 21 | 21 | monkey_patch_messages(checker.messages) | 22 | 22 |
| 23 | 23 | @staticmethod | 24 | | - def run(path, code=None, builtins="", **meta): | | 24 | + def run(path, code=None, params=None, **meta): | 25 | 25 | """ Pyflake code checking. | 26 | 26 |
| 27 | 27 | :return list: List of errors. | 28 | 28 |
| 29 | 29 | """ | 30 | 30 | import _ast | 31 | | - import os | 32 | 31 |
| 33 | | - os.environ.setdefault('PYFLAKES_BUILTINS', builtins) | | 32 | + builtins = params.get("builtins", "") | | 33 | + | | 34 | + if builtins: | | 35 | + builtins = builtins.split(",") | 34 | 36 |
| 35 | 37 | errors = [] | 36 | 38 | tree = compile(code, path, "exec", _ast.PyCF_ONLY_AST) | 37 | | - w = checker.Checker(tree, path) | | 39 | + w = checker.Checker(tree, path, builtins=builtins) | 38 | 40 | w.messages = sorted(w.messages, key=lambda m: m.lineno) | 39 | 41 | for w in w.messages: | 40 | 42 | errors.append(dict( | |
|