Skip to content
This repository was archived by the owner on Mar 12, 2020. It is now read-only.

Commit f3ce4bd

Browse files
committed
slight code formatting
1 parent acc77c8 commit f3ce4bd

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

SQLTools.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@
2929

3030

3131
def startPlugin():
32-
global USER_FOLDER, DEFAULT_FOLDER, SETTINGS_FILENAME, SETTINGS_FILENAME_DEFAULT, CONNECTIONS_FILENAME, CONNECTIONS_FILENAME_DEFAULT, QUERIES_FILENAME, QUERIES_FILENAME_DEFAULT, settings, queries, connections, history
32+
global USER_FOLDER, DEFAULT_FOLDER
33+
global SETTINGS_FILENAME, SETTINGS_FILENAME_DEFAULT
34+
global CONNECTIONS_FILENAME, CONNECTIONS_FILENAME_DEFAULT
35+
global QUERIES_FILENAME, QUERIES_FILENAME_DEFAULT
36+
global settings, queries, connections, history
3337

3438
USER_FOLDER = os.path.join(sublime.packages_path(), 'User')
3539
DEFAULT_FOLDER = os.path.dirname(__file__)
@@ -77,17 +81,19 @@ def getConnections():
7781

7882
return connectionsObj
7983

84+
8085
def createConnection(name, config, settings):
8186
newConnection = None
8287
# if DB cli binary could not be found in path a FileNotFoundError is thrown
8388
try:
8489
newConnection = Connection(name, config, settings=settings)
8590
except FileNotFoundError as e:
8691
# use only first line of the Exception in status message
87-
Window().status_message( __package__ + ": " + str(e).splitlines()[0] )
92+
Window().status_message(__package__ + ": " + str(e).splitlines()[0])
8893
raise e
8994
return newConnection
9095

96+
9197
def loadDefaultConnection():
9298
default = settings.get('default', False)
9399
if not default:

SQLToolsAPI/Command.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ def __init__(self, args, callback, query=None, encoding='utf-8', options=None):
1717
self.encoding = encoding
1818
self.callback = callback
1919
self.options = options
20-
# Don't allow empty dicts or lists as defaults in method signature, cfr http://nedbatchelder.com/blog/200806/pylint.html
20+
# Don't allow empty dicts or lists as defaults in method signature,
21+
# cfr http://nedbatchelder.com/blog/200806/pylint.html
2122
if self.options is None:
2223
self.options = {}
2324
Thread.__init__(self)
@@ -58,17 +59,17 @@ def run(self):
5859
if 'show_query' in self.options and self.options['show_query']:
5960
resultInfo = "/*\n-- Executed querie(s) at {0} took {1}ms --".format(
6061
str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(queryTimerStart))),
61-
str(queryTimerEnd-queryTimerStart)
62-
)
63-
resultLine = "-"*(len(resultInfo)-3)
64-
resultString = "{0}\n{1}\n{2}\n{3}\n*/\n{4}".format(resultInfo,
65-
resultLine,self.query,resultLine,resultString)
62+
str(queryTimerEnd - queryTimerStart))
63+
resultLine = "-" * (len(resultInfo) - 3)
64+
resultString = "{0}\n{1}\n{2}\n{3}\n*/\n{4}".format(
65+
resultInfo, resultLine, self.query, resultLine, resultString)
6666

6767
self.callback(resultString)
6868

6969
@staticmethod
7070
def createAndRun(args, query, callback, options=None):
71-
# Don't allow empty dicts or lists as defaults in method signature, cfr http://nedbatchelder.com/blog/200806/pylint.html
71+
# Don't allow empty dicts or lists as defaults in method signature,
72+
# cfr http://nedbatchelder.com/blog/200806/pylint.html
7273
if options is None:
7374
options = {}
7475
command = Command(args, callback, query, options=options)
@@ -85,7 +86,8 @@ def __init__(self, args, callback, query=None, encoding='utf-8',
8586
self.callback = callback
8687
self.options = options
8788
self.timeout = timeout
88-
# Don't allow empty dicts or lists as defaults in method signature, cfr http://nedbatchelder.com/blog/200806/pylint.html
89+
# Don't allow empty dicts or lists as defaults in method signature,
90+
# cfr http://nedbatchelder.com/blog/200806/pylint.html
8991
if self.options is None:
9092
self.options = {}
9193
Thread.__init__(self)
@@ -107,7 +109,8 @@ def stop(self):
107109

108110
@staticmethod
109111
def createAndRun(args, query, callback, options=None, timeout=Command.timeout):
110-
# Don't allow empty dicts or lists as defaults in method signature, cfr http://nedbatchelder.com/blog/200806/pylint.html
112+
# Don't allow empty dicts or lists as defaults in method signature,
113+
# cfr http://nedbatchelder.com/blog/200806/pylint.html
111114
if options is None:
112115
options = {}
113116
command = ThreadCommand(args, callback, query, options=options, timeout=timeout)

SQLToolsAPI/Connection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from . import Utils as U
77
from . import Command as C
88

9+
910
class Connection:
1011
DB_CLI_NOT_FOUND_MESSAGE = """'{0}' could not be found.
1112
Please set the path to '{0}' binary in your SQLTools settings before continuing.
@@ -116,7 +117,7 @@ def explainPlan(self, queries, callback):
116117
try:
117118
queryFormat = self.getOptionsForSgdbCli()['queries']['explain plan']['query']
118119
except KeyError:
119-
return # do nothing, if DBMS has no support for explain plan
120+
return # do nothing, if DBMS has no support for explain plan
120121

121122
stripped_queries = [
122123
queryFormat.format(query.strip().strip(";"))

SQLToolsAPI/Storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def __init__(self, filename, default=None):
1111
self.defaultFile = default
1212
self.items = {}
1313

14-
#copy entire file, to keep comments
14+
# copy entire file, to keep comments
1515
if not os.path.isfile(filename) and default and os.path.isfile(default):
1616
shutil.copyfile(default, filename)
1717

0 commit comments

Comments
 (0)