Fix flake8 errors

This commit is contained in:
Ben Jackson 2019-04-27 14:21:20 +01:00
commit 4f31c95aa4
9 changed files with 36 additions and 36 deletions

View file

@ -17,12 +17,9 @@ import logging
import vim import vim
import json import json
import os import os
import functools
import subprocess import subprocess
import shlex import shlex
from collections import defaultdict
from vimspector import ( breakpoints, from vimspector import ( breakpoints,
code, code,
debug_adapter_connection, debug_adapter_connection,
@ -110,7 +107,7 @@ class DebugSession( object ):
# set from an api call like SetLaunchParam( 'var', 'value' ), perhaps also a # set from an api call like SetLaunchParam( 'var', 'value' ), perhaps also a
# way to load .vimspector.local.json which just sets variables # way to load .vimspector.local.json which just sets variables
self._variables = { self._variables = {
'dollar': '$', # HACK 'dollar': '$', # HACK. Hote '$$' also works.
'workspaceRoot': self._workspace_root, 'workspaceRoot': self._workspace_root,
'gadgetDir': install.GetGadgetDir( VIMSPECTOR_HOME, install.GetOS() ) 'gadgetDir': install.GetGadgetDir( VIMSPECTOR_HOME, install.GetOS() )
} }
@ -174,7 +171,7 @@ class DebugSession( object ):
# beeps and doesn't display the config selector. One option is to just not # beeps and doesn't display the config selector. One option is to just not
# display the selector and restart with the same opitons. # display the selector and restart with the same opitons.
if not self._configuration or not self._adapter: if not self._configuration or not self._adapter:
return Start() return self.Start()
self._StartWithConfiguration( self._configuration, self._adapter ) self._StartWithConfiguration( self._configuration, self._adapter )

View file

@ -16,6 +16,7 @@
import platform import platform
import os import os
def GetOS(): def GetOS():
if platform.system() == 'Darwin': if platform.system() == 'Darwin':
return 'macos' return 'macos'
@ -24,9 +25,11 @@ def GetOS():
else: else:
return 'linux' return 'linux'
def GetGadgetDir( vimspector_base, OS ): def GetGadgetDir( vimspector_base, OS ):
return os.path.join( os.path.abspath( vimspector_base ), 'gadgets', OS ) return os.path.join( os.path.abspath( vimspector_base ), 'gadgets', OS )
def GetGadgetConfigFile( vimspector_base ): def GetGadgetConfigFile( vimspector_base ):
return os.path.join( GetGadgetDir( vimspector_base, GetOS() ), return os.path.join( GetGadgetDir( vimspector_base, GetOS() ),
'.gadgets.json' ) '.gadgets.json' )

View file

@ -60,7 +60,7 @@ def SetUpCommandBuffer( cmd, name ):
if bufs is None: if bufs is None:
raise RuntimeError( "Unable to start job {}: {}".format( cmd, name ) ) raise RuntimeError( "Unable to start job {}: {}".format( cmd, name ) )
elif not all( [ b > 0 for b in bufs ] ): elif not all( b > 0 for b in bufs ):
raise RuntimeError( "Unable to get all streams for job {}: {}".format( raise RuntimeError( "Unable to get all streams for job {}: {}".format(
name, name,
cmd ) ) cmd ) )
@ -261,7 +261,7 @@ def AppendToBuffer( buf, line_or_lines, modified=False ):
else: else:
line = 1 line = 1
buf[ : ] = line_or_lines buf[ : ] = line_or_lines
except: except Exception:
# There seem to be a lot of Vim bugs that lead to E315, whose help says that # There seem to be a lot of Vim bugs that lead to E315, whose help says that
# this is an internal error. Ignore the error, but write a trace to the log. # this is an internal error. Ignore the error, but write a trace to the log.
logging.getLogger( __name__ ).exception( logging.getLogger( __name__ ).exception(