Fix flake8 blank lines problems
authorKarl O. Pinc <kop@meme.com>
Sun, 21 Oct 2018 22:42:21 +0000 (17:42 -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 9910cd255fc63f4523e4a13417d5d3083589b776..58cd3e1957c2e4704068f096931a4768bd1f9c6b 100644 (file)
@@ -69,23 +69,28 @@ class UserInitialPost():
     user = ''
     password = ''
 
+
 class AuthInitialPost():
     db = ''
     user = ''
     password = ''
 
+
 class UploadFileInitialPost(AuthInitialPost):
     upload_fmt = CSV
     datafile = ''
     trim_upload = True
 
+
 class UploadNullFileInitialPost(UploadFileInitialPost):
     upload_null = True
     null_rep = ''
 
+
 class UploadTableInitialPost(UploadNullFileInitialPost):
     table = ''
 
+
 # The wtforms that suck data out of the html.
 
 class UserWTForm(Form):
@@ -239,7 +244,6 @@ class CredsLoadedForm(LoadedForm):
         '''
         self.uh.session[key] = value
 
-
     def read(self):
         '''
         Read form data from the client
@@ -278,7 +282,6 @@ class CredsLoadedForm(LoadedForm):
         else:
             self['action'] = ''
 
-
     def write(self, result, errors):
         '''
         Produces the dict pyramid will use to render the form.
@@ -325,7 +328,6 @@ class AuthLoadedForm(CredsLoadedForm):
         # Keep form variables handy
         self['db'] = self._form.db.data
 
-
     def write(self, result, errors):
         '''
         Produces the dict pyramid will use to render the form.
@@ -372,7 +374,6 @@ class UploadFileForm(AuthLoadedForm):
                 if hasattr(post['datafile'], 'file'):
                     self['localfh'] = post['datafile'].file
 
-
     def write(self, result, errors):
         '''
         Produces the dict pyramid will use to render the form.
@@ -462,7 +463,6 @@ class UploadNullFileForm(UploadFileForm):
         self['upload_null'] = self._form.upload_null.data
         self['null_rep'] = self._form.null_rep.data
 
-
     def write(self, result, errors):
         '''
         Produces the dict pyramid will use to render the form.
@@ -503,7 +503,6 @@ class UploadTableForm(UploadNullFileForm):
         # Read our own data
         self['table'] = self._form.table.data
 
-
     def write(self, result, errors):
         '''
         Produces the dict pyramid will use to render the form.
@@ -558,16 +557,19 @@ def textualize(st):
     '''
     return 'NULL' if st == None else st
 
+
 def is_checked(val):
     '''Is the value something a html input entity recognizes as checked?'''
     return val == CHECKED
 
+
 # Some functions for logging
 
 def escape_eol(string):
     '''Change all the newlines to \n.'''
     return string.replace('\n', r'\n')
 
+
 def format_exception(ex):
     '''Return an exception formatted as suffix text for a log message.'''
     if isinstance(ex, psycopg2.DatabaseError):
@@ -589,6 +591,7 @@ def format_exception(ex):
         msg = ': Error is ({0})'.format(msg)
     return msg
 
+
 # Error handling
 
 class UploadError(Exception):
@@ -631,6 +634,7 @@ class UploadError(Exception):
             out = '{0}: data ({1})'.format(out, self.data)
         return out
 
+
 class Error(UploadError):
     '''
     Module exceptions rasied while setting up to read data lines
@@ -643,55 +647,66 @@ class Error(UploadError):
     def __init__(self, e, descr='', detail=''):
         super(Error, self).__init__(e=e, descr=descr, detail=detail)
 
+
 class NoFileError(Error):
     '''No file uploaded'''
     def __init__(self, e, descr='', detail=''):
         super(NoFileError, self).__init__(e, descr, detail)
 
+
 class NoDBError(Error):
     '''No database name given'''
     def __init__(self, e, descr='', detail=''):
         super(NoDBError, self).__init__(e, descr, detail)
 
+
 class NoUserError(Error):
     '''No user name supplied'''
     def __init__(self, e, descr='', detail=''):
         super(NoUserError, self).__init__(e, descr, detail)
 
+
 class AuthFailError(Error):
     '''Unable to connect to the db'''
     def __init__(self, e, descr='', detail=''):
         super(AuthFailError, self).__init__(e, descr, detail)
 
+
 class DryRunError(Error):
     '''Rollback due to dry_run config option'''
     def __init__(self, e, descr='', detail=''):
         super(DryRunError, self).__init__(e, descr, detail)
 
+
 class CSRFError(Error):
     '''Invalid CSRF token'''
     def __init__(self, e, descr='', detail=''):
         super(CSRFError, self).__init__(e, descr, detail)
 
+
 class NoHeadersError(Error):
     '''No column headings found'''
     def __init__(self, e, descr='', detail=''):
         super(NoHeadersError, self).__init__(e, descr, detail)
 
+
 class NoDataError(Error):
     '''No data uploaded'''
     def __init__(self, e, descr='', detail=''):
         super(NoDataError, self).__init__(e, descr, detail)
 
+
 class DuplicateUploadError(Error):
     '''The same filename updated twice into the same db'''
     def __init__(self, e, descr='', detail=''):
         super(DuplicateUploadError, self).__init__(e, descr, detail)
 
+
 class DataInconsistencyError(Error):
     def __init__(self, e, descr='', detail=''):
         super(DataInconsistencyError, self).__init__(e, descr, detail)
 
+
 class DBError(Error):
     '''psycopg2 raised an error'''
     def __init__(self, pgexc, e='process your request'):
@@ -727,10 +742,12 @@ class DBError(Error):
             detail,
             hint)
 
+
 class DBCommitError(DBError):
     def __init__(self, pgexc):
         super(DBCommitError, self).__init__(pgexc)
 
+
 class DBDataLineError(DBError):
     '''Database generated an error while the processor was running.'''
 
@@ -758,6 +775,7 @@ class DataLineError(UploadError):
     def __init__(self, lineno, e, descr='', detail='', data=''):
         super(DataLineError, self).__init__(e, lineno, descr, detail, data)
 
+
 class TooManyColsError(DataLineError):
     def __init__(self, lineno, e, descr='', detail='', data=''):
         super(TooManyColsError, self).__init__(lineno, e, descr, detail, data)
@@ -786,7 +804,6 @@ class SQLCommand(object):
         self.args = args
         self.ec = ec
 
-
     def execute(self, cur):
         '''
         Execute the sql statement.
@@ -866,6 +883,7 @@ class UploadLine(object):
         self.raw = line
         self.tuples = [mapper(st) for st in stol(line)]
 
+
 def doublequote(st):
     '''
     Put string in double quotes escaping according to sql's
@@ -881,6 +899,7 @@ def doublequote(st):
             out += ch
     return out + '"'
 
+
 class UploadHeaders(UploadLine):
     '''Uploaded heading line
 
@@ -1081,7 +1100,6 @@ class UploadData(DBData):
         return seq + ['' for i in range(len(seq) + 1, self.cols)]
 
 
-
 class DataLineProcessor(object):
     '''
     A processor supplied uploaded lines (UploadDataLine instances)
@@ -1126,7 +1144,6 @@ class NoOpProcessor(DataLineProcessor):
         '''
         super(NoOpProcessor, self).__init__(ue, uh)
 
-
     def eat(self, udl):
         '''
         Executes an sql command in the db.
@@ -1145,7 +1162,6 @@ class ExecuteSQL(DataLineProcessor):
         '''
         super(ExecuteSQL, self).__init__(ue, uh)
 
-
     def eat(self, sqlc):
         '''
         Executes an sql command in the db.
@@ -1480,7 +1496,6 @@ class DBConnector(object):
 
         raise NotImplementedError
 
-
     def no_connection_response(self):
         '''
         The result dict to use when call_with_connection is not called.