From df12587590e286d0e9db7b504d504a14d5004040 Mon Sep 17 00:00:00 2001 From: laerus Date: Sat, 29 Oct 2016 18:51:00 +0300 Subject: [PATCH] heal completers pip --- xonsh/completers/pip.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/xonsh/completers/pip.py b/xonsh/completers/pip.py index e6727d714..4d4bf483c 100644 --- a/xonsh/completers/pip.py +++ b/xonsh/completers/pip.py @@ -1,12 +1,20 @@ +"""Completers for pip.""" +# pylint: disable=invalid-name, missing-docstring, unsupported-membership-test +# pylint: disable=unused-argument, not-an-iterable import re import subprocess import xonsh.lazyasd as xl -PIP_RE = xl.LazyObject(lambda: re.compile("pip(?:\d|\.)*"), - globals(), 'PIP_RE') -PIP_LIST_RE = xl.LazyObject(lambda: re.compile("pip(?:\d|\.)* (?:uninstall|show)"), - globals(), 'PIP_LIST_RE') + +@xl.lazyobject +def PIP_RE(): + return re.compile(r"pip(?:\d|\.)*") + + +@xl.lazyobject +def PIP_LIST_RE(): + return re.compile(r"pip(?:\d|\.)* (?:uninstall|show)") @xl.lazyobject @@ -16,7 +24,7 @@ def ALL_COMMANDS(): stderr=subprocess.DEVNULL)) except FileNotFoundError: return [] - commands = re.findall(" (\w+) ", help_text) + commands = re.findall(r" (\w+) ", help_text) return [c for c in commands if c not in ['completion', 'help']]