1
0
forked from VimPlug/jedi

Some minor flake8 fixes

This commit is contained in:
Daniel Hahler
2018-07-15 23:34:52 +02:00
committed by Dave Halter
parent 08b0b668a6
commit 10b61c41f4
4 changed files with 19 additions and 12 deletions

View File

@@ -207,6 +207,7 @@ def _iter_modules(paths, prefix=''):
yield importer, prefix + modname, ispkg yield importer, prefix + modname, ispkg
# END COPY # END COPY
iter_modules = _iter_modules if py_version >= 34 else pkgutil.iter_modules iter_modules = _iter_modules if py_version >= 34 else pkgutil.iter_modules
@@ -252,6 +253,7 @@ Usage::
""" """
class Python3Method(object): class Python3Method(object):
def __init__(self, func): def __init__(self, func):
self.func = func self.func = func
@@ -312,10 +314,10 @@ def force_unicode(obj):
try: try:
import builtins # module name in python 3 import builtins # module name in python 3
except ImportError: except ImportError:
import __builtin__ as builtins import __builtin__ as builtins # noqa: F401
import ast import ast # noqa: F401
def literal_eval(string): def literal_eval(string):
@@ -325,7 +327,7 @@ def literal_eval(string):
try: try:
from itertools import zip_longest from itertools import zip_longest
except ImportError: except ImportError:
from itertools import izip_longest as zip_longest # Python 2 from itertools import izip_longest as zip_longest # Python 2 # noqa: F401
try: try:
FileNotFoundError = FileNotFoundError FileNotFoundError = FileNotFoundError
@@ -378,7 +380,7 @@ def utf8_repr(func):
if is_py3: if is_py3:
import queue import queue
else: else:
import Queue as queue import Queue as queue # noqa: F401
try: try:
# Attempt to load the C implementation of pickle on Python 2 as it is way # Attempt to load the C implementation of pickle on Python 2 as it is way
@@ -544,7 +546,7 @@ def which(cmd, mode=os.F_OK | os.X_OK, path=None):
if sys.platform == "win32": if sys.platform == "win32":
# The current directory takes precedence on Windows. # The current directory takes precedence on Windows.
if not os.curdir in path: if os.curdir not in path:
path.insert(0, os.curdir) path.insert(0, os.curdir)
# PATHEXT is necessary to check on Windows. # PATHEXT is necessary to check on Windows.
@@ -565,7 +567,7 @@ def which(cmd, mode=os.F_OK | os.X_OK, path=None):
seen = set() seen = set()
for dir in path: for dir in path:
normdir = os.path.normcase(dir) normdir = os.path.normcase(dir)
if not normdir in seen: if normdir not in seen:
seen.add(normdir) seen.add(normdir)
for thefile in files: for thefile in files:
name = os.path.join(dir, thefile) name = os.path.join(dir, thefile)

View File

@@ -2,16 +2,17 @@ from jedi._compatibility import encoding, is_py3, u
import os import os
import time import time
_inited = False
def _lazy_colorama_init(): def _lazy_colorama_init():
""" """
Lazily init colorama if necessary, not to screw up stdout is debug not Lazily init colorama if necessary, not to screw up stdout if debugging is
enabled. not enabled.
This version of the function does nothing. This version of the function does nothing.
""" """
pass
_inited=False
try: try:
if os.name == 'nt': if os.name == 'nt':
@@ -21,7 +22,8 @@ try:
# Use colorama for nicer console output. # Use colorama for nicer console output.
from colorama import Fore, init from colorama import Fore, init
from colorama import initialise from colorama import initialise
def _lazy_colorama_init():
def _lazy_colorama_init(): # noqa: F811
""" """
Lazily init colorama if necessary, not to screw up stdout is Lazily init colorama if necessary, not to screw up stdout is
debug not enabled. debug not enabled.

View File

@@ -113,7 +113,7 @@ def setup_readline(namespace_module=__main__):
# this code. This didn't use to be an issue until 3.3. Starting with # this code. This didn't use to be an issue until 3.3. Starting with
# 3.4 this is different, it always overwrites the completer if it's not # 3.4 this is different, it always overwrites the completer if it's not
# already imported here. # already imported here.
import rlcompleter import rlcompleter # noqa: F401
import readline import readline
except ImportError: except ImportError:
print("Jedi: Module readline not available.") print("Jedi: Module readline not available.")

View File

@@ -3,3 +3,6 @@ universal=1
[flake8] [flake8]
max-line-length = 100 max-line-length = 100
ignore =
# do not use bare 'except'
E722,