Fix flake8 import * problems
authorKarl O. Pinc <kop@meme.com>
Sun, 21 Oct 2018 23:00:07 +0000 (18:00 -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 42380071a8fac19f572c2c8c54a84b045d0a0383..96a24132fff4ffc8d6cf9961dac9342665dd9052 100644 (file)
@@ -59,13 +59,13 @@ from wtforms import (
 
 import psycopg2
 
-from pgwui_core.form_constants import *
+from pgwui_core import form_constants
 
 
 # Setup default values for forms.
 
 class UserInitialPost():
-    db = LIVE_DB
+    db = form_constants.LIVE_DB
     user = ''
     password = ''
 
@@ -77,7 +77,7 @@ class AuthInitialPost():
 
 
 class UploadFileInitialPost(AuthInitialPost):
-    upload_fmt = CSV
+    upload_fmt = form_constants.CSV
     datafile = ''
     trim_upload = True
 
@@ -120,8 +120,9 @@ class UploadFileWTForm(AuthWTForm):
     # look (and render) like html, but I'll define them anyway
     # just to keep my hand in.
     upload_fmt = RadioField('Upload Format:',
-                            choices=[('Upload CSV Data:', CSV),
-                                     ('Upload tab delimited Data:', TAB)])
+                            choices=[('Upload CSV Data:', form_constants.CSV),
+                                     ('Upload tab delimited Data:',
+                                      form_constants.TAB)])
     datafile = FileField('File with CSV or Tab delimited Data:')
     trim_upload = BooleanField('Trim Leading/Trailing Spaces:')
 
@@ -378,23 +379,23 @@ class UploadFileForm(AuthLoadedForm):
         '''
         Produces the dict pyramid will use to render the form.
         '''
-        if self['upload_fmt'] == CSV:
-            csv_checked = CHECKED
-            tab_checked = UNCHECKED
+        if self['upload_fmt'] == form_constants.CSV:
+            csv_checked = form_constants.CHECKED
+            tab_checked = form_constants.UNCHECKED
         else:
-            tab_checked = CHECKED
-            csv_checked = UNCHECKED
+            tab_checked = form_constants.CHECKED
+            csv_checked = form_constants.UNCHECKED
 
         if self['trim_upload']:
-            trim_upload_checked = CHECKED
+            trim_upload_checked = form_constants.CHECKED
         else:
-            trim_upload_checked = UNCHECKED
+            trim_upload_checked = form_constants.UNCHECKED
 
         response = super(UploadFileForm, self).write(result, errors)
         response['filename'] = self['filename']
         response['trim_upload'] = trim_upload_checked
-        response['csv_value'] = CSV_VALUE
-        response['tab_value'] = TAB_VALUE
+        response['csv_value'] = form_constants.CSV_VALUE
+        response['tab_value'] = form_constants.TAB_VALUE
         response['csv_checked'] = csv_checked
         response['tab_checked'] = tab_checked
         return response
@@ -468,9 +469,9 @@ class UploadNullFileForm(UploadFileForm):
         Produces the dict pyramid will use to render the form.
         '''
         if self['upload_null']:
-            upload_null_checked = CHECKED
+            upload_null_checked = form_constants.CHECKED
         else:
-            upload_null_checked = UNCHECKED
+            upload_null_checked = form_constants.UNCHECKED
 
         response = super(UploadNullFileForm, self).write(result, errors)
         response['upload_null'] = upload_null_checked
@@ -560,7 +561,7 @@ def textualize(st):
 
 def is_checked(val):
     '''Is the value something a html input entity recognizes as checked?'''
-    return val == CHECKED
+    return val == form_constants.CHECKED
 
 
 # Some functions for logging
@@ -1029,7 +1030,7 @@ class UploadData(DBData):
                     # Give up
                     eol = ''
 
-                if file_fmt == CSV:
+                if file_fmt == form_constants.CSV:
                     def func(st):
                         return next(csv_reader((st,)))
                 else:
@@ -1056,7 +1057,7 @@ class UploadData(DBData):
         self.cols = len(self.headers.tuples)
 
         # Create parser to read raw lines into a list
-        if file_fmt == CSV:
+        if file_fmt == form_constants.CSV:
             self._parser = lambda st: self._extend(st,
                                                    next(csv_reader((st,))))
         else:    # Tab delimited format