Fix flake8 whitespace problems
authorKarl O. Pinc <kop@meme.com>
Sun, 21 Oct 2018 22:07:24 +0000 (17:07 -0500)
committerKarl O. Pinc <kop@meme.com>
Sun, 21 Oct 2018 23:58:53 +0000 (18:58 -0500)
src/pgwui_core/pgwui_core.py

index 083621123d0b16a6088573ec3dcdbc8f61cb4acc..fd131dce0d8d0d3f93d9fef7dbc2423b892b7b82 100644 (file)
@@ -70,7 +70,7 @@ class UserInitialPost():
     password    = ''
 
 class AuthInitialPost():
-    db          = '' 
+    db          = ''
     user        = ''
     password    = ''
 
@@ -97,7 +97,7 @@ class UserWTForm(Form):
     password     = PasswordField('Password:')
 
     ivals        = UserInitialPost
-        
+
 
 class AuthWTForm(UserWTForm):
     '''The wtform used to connect to any db and authenticate.'''
@@ -107,7 +107,7 @@ class AuthWTForm(UserWTForm):
     db           = StringField('Database:')
 
     ivals        = AuthInitialPost
-        
+
 
 class UploadFileWTForm(AuthWTForm):
     '''The wtform used for uploading files.'''
@@ -219,7 +219,7 @@ class CredsLoadedForm(LoadedForm):
         Input:
           key    The key
           value  The value
-          
+
         Returns:
 
         Side effects:
@@ -229,7 +229,7 @@ class CredsLoadedForm(LoadedForm):
         of the session.
         '''
         self.uh.session[key] = value
-        
+
 
     def read(self):
         '''
@@ -621,7 +621,7 @@ class UploadError(Exception):
         if self.data != '':
             out = '{0}: data ({1})'.format(out, self.data)
         return out
-    
+
 class Error(UploadError):
     '''
     Module exceptions rasied while setting up to read data lines
@@ -724,7 +724,7 @@ class DBCommitError(DBError):
 
 class DBDataLineError(DBError):
     '''Database generated an error while the processor was running.'''
-        
+
     def __init__(self, udl, pgexc):
         '''
         udl    An UploadDataLine instance
@@ -781,7 +781,7 @@ class SQLCommand(object):
     def execute(self, cur):
         '''
         Execute the sql statement.
-        
+
         Input:
           cur  A psycopg2 cursor
 
@@ -816,7 +816,7 @@ class LogSQLCommand(SQLCommand):
     def execute(self, cur):
         '''
         Execute the sql statement.
-        
+
         Input:
           cur  A psycopg2 cursor
 
@@ -861,7 +861,7 @@ def doublequote(st):
     '''
     Put string in double quotes escaping according to sql's
     requirements for an identifier.
-    
+
     Note that this does not work for unicode identifiers.
     '''
     out = '"'
@@ -909,7 +909,7 @@ class UploadDataLine(UploadLine):
 
 class DBData(object):
     '''Data that is to modify the db.
-  
+
     It is iterable, consisting of thunks which make an UploadedLine instance.
 
     lineno     Number of lines processed (including header line)
@@ -947,7 +947,7 @@ class SQLData(DBData):
         '''
         stmts  List of SQLCommand instances
         '''
-        super(SQLData,self).__init__()
+        super(SQLData, self).__init__()
         self.stmts = stmts
 
         def gen(stmts):
@@ -963,7 +963,7 @@ class SQLData(DBData):
 
 class UploadData(DBData):
     '''Uploaded data file
-  
+
     It is iterable, consisting of thunks which make an UploadedLine instance.
 
     headers    UploadedHeaders instance
@@ -1058,10 +1058,10 @@ class UploadData(DBData):
 
     def _extend(self, line, seq):
         '''Give the list as many elements as there are in the header.
-        
+
         line  line as string
         seq   line as sequence
-        
+
         If there's too many elements, raise an error.
         '''
         if len(seq) > self.cols:
@@ -1069,7 +1069,7 @@ class UploadData(DBData):
                                    'Line has too many columns',
                                    'More columns than column headings',
                                    data=line)
-        return seq + [ '' for i in range(len(seq)+1, self.cols)]
+        return seq + ['' for i in range(len(seq) + 1, self.cols)]
 
 
 
@@ -1313,7 +1313,7 @@ class UploadHandler(SessionDBHandler):
 
         if uf['filename'] == '':
             errors.append(NoFileError('No file supplied'))
-        
+
         return errors
 
     def double_validator(self, errors):
@@ -1423,7 +1423,7 @@ class TabularFileUploadHandler(UploadHandler):
 class DBConnector(object):
     '''Abstract class supporting db connection and execution of a
     processor function that alters the db content.
-    
+
     Responsible for connecting to the db, transaction management,
     and running the DataLineProcessor instances produced by the
     DBConnector's (the UploadHandler's) factory.
@@ -1482,7 +1482,7 @@ class DBConnector(object):
           Reserved keys:
             havecreds   Boolean. Supplied credentials can connect to db.
         '''
-        return {'havecreds' : False}
+        return {'havecreds': False}
 
     def nodberror_factory(self):
         return NoDBError('No database name supplied')
@@ -1600,7 +1600,7 @@ class DBConnector(object):
                 havecreds = True
                 errors = self.call_alter_db(func, conn)
 
-        response.update({'havecreds' : havecreds
+        response.update({'havecreds': havecreds
                  })
         return (errors, response)
 
@@ -1666,9 +1666,9 @@ class DBConnector(object):
 
 class NoTransactionEngine(DBConnector):
     '''An engine that does not run things in a transaction.
-    
+
     It also does not do CSRF checking.
-    
+
     Attributes:
         uh        An UploadHandler instance.
         data      An UploadData instance of the uploaded data
@@ -1739,7 +1739,7 @@ class NoTransactionEngine(DBConnector):
 class UnsafeUploadEngine(DBConnector):
     '''Abstract class supporting repeatedly running a processer to put
        uploaded data into db.
-    
+
     Attributes:
         uh        An UploadHandler instance.
         data      An UploadData instance of the uploaded data
@@ -1850,7 +1850,7 @@ class UploadEngine(UnsafeUploadEngine):
     '''Abstract class supporting repeatedly running a processor
     to alter db content.  Adds cross-site request forgery checking
     to the UnsafeUploadEngine class.
-    
+
     Attributes:
         uh        An UploadHandler instance.
         cur       A psycopg2 cursor instance
@@ -1877,7 +1877,7 @@ class UploadEngine(UnsafeUploadEngine):
             'Your request failed and you are now logged out',
             ('This is a security measure. '
              'Some possible causes are:'),
-            ('<ul>' 
+            ('<ul>'
              '<li>Cookies are off in the browser</li> '
              '<li>Reload of an expired page</li> '
              '  <ul>'
@@ -1931,8 +1931,8 @@ class UploadEngine(UnsafeUploadEngine):
             session.invalidate()
             response = self.no_connection_response()
             response['session_expired'] = True
-            return([self.csrferror_factory()]
-                   response)
+            return([self.csrferror_factory()],
+                   response)
         else:
             (errors, response) = (super(UploadEngine, self)
                                   .call_with_connection(func))