public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][Patch]: PEP-8 issue fixes
4+ messages / 2 participants
[nested] [flat]

* [pgAdmin4][Patch]: PEP-8 issue fixes
@ 2018-02-26 12:04  Khushboo Vashi <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Khushboo Vashi @ 2018-02-26 12:04 UTC (permalink / raw)
  To: pgadmin-hackers

Hi,

Please find the attached patch to fix PEP-8 issues in the below modules:

1. about
2. feature_tests
3. misc
4. utils

Thanks,
Khushboo


Attachments:

  [text/x-patch] PEP8_fixes.patch (8.1K, 3-PEP8_fixes.patch)
  download | inline diff:
diff --git a/web/pgadmin/about/__init__.py b/web/pgadmin/about/__init__.py
index 98a4dd6..6d1e0b2 100644
--- a/web/pgadmin/about/__init__.py
+++ b/web/pgadmin/about/__init__.py
@@ -8,7 +8,6 @@
 ##########################################################################
 
 """A blueprint module implementing the about box."""
-MODULE_NAME = 'about'
 
 import sys
 from flask import Response, render_template, __version__, url_for
@@ -18,6 +17,8 @@ from pgadmin.utils import PgAdminModule
 from pgadmin.utils.menu import MenuItem
 import config
 
+MODULE_NAME = 'about'
+
 
 class AboutModule(PgAdminModule):
     def get_own_menuitems(self):
diff --git a/web/pgadmin/feature_tests/keyboard_shortcut_test.py b/web/pgadmin/feature_tests/keyboard_shortcut_test.py
index b83457c..443eff6 100644
--- a/web/pgadmin/feature_tests/keyboard_shortcut_test.py
+++ b/web/pgadmin/feature_tests/keyboard_shortcut_test.py
@@ -65,7 +65,8 @@ class KeyboardShortcutFeatureTest(BaseFeatureTest):
                 Keys.ALT
             ).perform()
 
-            print("Executing shortcut: " + self.new_shortcuts[s]['locator'] + "...", file=sys.stderr, end="")
+            print("Executing shortcut: " + self.new_shortcuts[s]['locator'] +
+                  "...", file=sys.stderr, end="")
 
             self.wait.until(
                 EC.presence_of_element_located(
diff --git a/web/pgadmin/feature_tests/view_data_dml_queries.py b/web/pgadmin/feature_tests/view_data_dml_queries.py
index aa75b6e..12e4295 100644
--- a/web/pgadmin/feature_tests/view_data_dml_queries.py
+++ b/web/pgadmin/feature_tests/view_data_dml_queries.py
@@ -100,7 +100,7 @@ CREATE TABLE public.defaults_{0}
         test_utils.create_database(self.server, "acceptance_test_db")
 
         # Create pre-requisite table
-        for k, v in { 1: 'id', 2:'"ID"' }.items():
+        for k, v in {1: 'id', 2: '"ID"'}.items():
             test_utils.create_table_with_query(
                 self.server,
                 "acceptance_test_db",
@@ -114,7 +114,7 @@ CREATE TABLE public.defaults_{0}
         self.page.add_server(self.server)
         self._tables_node_expandable()
         # iterate on both tables
-        for cnt in (1,2):
+        for cnt in (1, 2):
             self.page.select_tree_item('defaults_{0}'.format(str(cnt)))
             # Open Object -> View/Edit data
             self._view_data_grid()
diff --git a/web/pgadmin/misc/bgprocess/processes.py b/web/pgadmin/misc/bgprocess/processes.py
index 0c4112a..02b953d 100644
--- a/web/pgadmin/misc/bgprocess/processes.py
+++ b/web/pgadmin/misc/bgprocess/processes.py
@@ -21,10 +21,6 @@ from subprocess import Popen
 
 from pgadmin.utils import IS_PY2, u, file_quote, fs_encoding
 
-if IS_PY2:
-    from StringIO import StringIO
-else:
-    from io import StringIO
 import pytz
 from dateutil import parser
 from flask import current_app
@@ -33,6 +29,10 @@ from flask_security import current_user
 
 import config
 from pgadmin.model import Process, db
+if IS_PY2:
+    from StringIO import StringIO
+else:
+    from io import StringIO
 
 
 def get_current_time(format='%Y-%m-%d %H:%M:%S.%f %z'):
diff --git a/web/pgadmin/utils/__init__.py b/web/pgadmin/utils/__init__.py
index 198553e..5f81e09 100644
--- a/web/pgadmin/utils/__init__.py
+++ b/web/pgadmin/utils/__init__.py
@@ -7,6 +7,8 @@
 #
 ##########################################################################
 
+import os
+import sys
 from collections import defaultdict
 from operator import attrgetter
 
@@ -152,9 +154,6 @@ class PgAdminModule(Blueprint):
         return res
 
 
-import os
-import sys
-
 IS_PY2 = (sys.version_info[0] == 2)
 IS_WIN = (os.name == 'nt')
 
diff --git a/web/pgadmin/utils/compile_template_name.py b/web/pgadmin/utils/compile_template_name.py
index 28b5bf8..49c7b6a 100644
--- a/web/pgadmin/utils/compile_template_name.py
+++ b/web/pgadmin/utils/compile_template_name.py
@@ -9,8 +9,14 @@
 import os
 
 
-def compile_template_name(template_prefix, template_file_name, server_type, version):
-    return os.path.join(compile_template_path(template_prefix, server_type, version), template_file_name)
+def compile_template_name(
+    template_prefix,
+    template_file_name,
+    server_type, version
+):
+    return os.path.join(
+        compile_template_path(template_prefix, server_type, version),
+        template_file_name)
 
 
 def compile_template_path(template_prefix, server_type, version):
diff --git a/web/pgadmin/utils/javascript/tests/test_javascript_bundler.py b/web/pgadmin/utils/javascript/tests/test_javascript_bundler.py
index f946cb8..7030703 100644
--- a/web/pgadmin/utils/javascript/tests/test_javascript_bundler.py
+++ b/web/pgadmin/utils/javascript/tests/test_javascript_bundler.py
@@ -9,16 +9,15 @@
 
 
 import sys
+from pgadmin.utils.route import BaseTestGenerator
+from pgadmin.utils.javascript.javascript_bundler import JavascriptBundler
+from pgadmin.utils.javascript.javascript_bundler import JsState
 
 if sys.version_info < (3, 3):
     from mock import patch
 else:
     from unittest.mock import patch
 
-from pgadmin.utils.route import BaseTestGenerator
-from pgadmin.utils.javascript.javascript_bundler import JavascriptBundler
-from pgadmin.utils.javascript.javascript_bundler import JsState
-
 
 class JavascriptBundlerTestCase(BaseTestGenerator):
     """This tests that the javascript bundler tool causes the application to
diff --git a/web/pgadmin/utils/route.py b/web/pgadmin/utils/route.py
index 4103e87..379ef75 100644
--- a/web/pgadmin/utils/route.py
+++ b/web/pgadmin/utils/route.py
@@ -9,16 +9,16 @@
 
 import traceback
 import sys
-if sys.version_info < (2, 7):
-    import unittest2 as unittest
-else:
-    import unittest
-
 from abc import ABCMeta, abstractmethod
 from importlib import import_module
 from werkzeug.utils import find_modules
-
 import config
+import six
+
+if sys.version_info < (2, 7):
+    import unittest2 as unittest
+else:
+    import unittest
 
 
 class TestsGeneratorRegistry(ABCMeta):
@@ -76,9 +76,6 @@ class TestsGeneratorRegistry(ABCMeta):
                 traceback.print_exc(file=sys.stderr)
 
 
-import six
-
-
 @six.add_metaclass(TestsGeneratorRegistry)
 class BaseTestGenerator(unittest.TestCase):
     # Defining abstract method which will override by individual testcase.
diff --git a/web/pgadmin/utils/tests/test_compile_template_name.py b/web/pgadmin/utils/tests/test_compile_template_name.py
index 97f1b05..3f4ceb2 100644
--- a/web/pgadmin/utils/tests/test_compile_template_name.py
+++ b/web/pgadmin/utils/tests/test_compile_template_name.py
@@ -12,23 +12,27 @@ from pgadmin.utils.route import BaseTestGenerator
 
 class StartRunningQueryTest(BaseTestGenerator):
     """
-    Check that the apply_explain_plan_weapper_if_needed method works as intended
+    Check that the apply_explain_plan_weapper_if_needed method
+    works as intended
     """
     scenarios = [
-        ('When server is Postgres and version is 10, it returns the path to the postgres template', dict(
-            server_type='pg',
-            version=100000,
-
-            expected_return_value='some/prefix/#100000#/some_file.sql'
-        )),
-        ('When server is GreenPlum and version is 5, it returns the path to the GreenPlum template', dict(
-            server_type='gpdb',
-            version=80323,
-
-            expected_return_value='some/prefix/#gpdb#80323#/some_file.sql'
-        )),
+        ('When server is Postgres and version is 10, it returns the path'
+         ' to the postgres template',
+         dict(
+             server_type='pg',
+             version=100000,
+             expected_return_value='some/prefix/#100000#/some_file.sql'
+         )),
+        ('When server is GreenPlum and version is 5, it returns the path'
+         ' to the GreenPlum template',
+         dict(
+             server_type='gpdb',
+             version=80323,
+             expected_return_value='some/prefix/#gpdb#80323#/some_file.sql'
+         )),
     ]
 
     def runTest(self):
-        result = compile_template_name('some/prefix', 'some_file.sql', self.server_type, self.version)
+        result = compile_template_name(
+            'some/prefix', 'some_file.sql', self.server_type, self.version)
         self.assertEquals(result, self.expected_return_value)


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [pgAdmin4][Patch]: PEP-8 issue fixes
@ 2018-02-26 15:49  Dave Page <[email protected]>
  parent: Khushboo Vashi <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Dave Page @ 2018-02-26 15:49 UTC (permalink / raw)
  To: Khushboo Vashi <[email protected]>; +Cc: pgadmin-hackers

Can you rebase this please? It doesn't apply against master.

On Mon, Feb 26, 2018 at 12:04 PM, Khushboo Vashi <
[email protected]> wrote:

> Hi,
>
> Please find the attached patch to fix PEP-8 issues in the below modules:
>
> 1. about
> 2. feature_tests
> 3. misc
> 4. utils
>
> Thanks,
> Khushboo
>



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [pgAdmin4][Patch]: PEP-8 issue fixes
@ 2018-02-28 04:19  Khushboo Vashi <[email protected]>
  parent: Dave Page <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Khushboo Vashi @ 2018-02-28 04:19 UTC (permalink / raw)
  To: Dave Page <[email protected]>; +Cc: pgadmin-hackers

On Mon, Feb 26, 2018 at 9:19 PM, Dave Page <[email protected]> wrote:

> Can you rebase this please? It doesn't apply against master.
>
> Please find the updated patch excluding utils module as it is already
done.

> On Mon, Feb 26, 2018 at 12:04 PM, Khushboo Vashi <
> [email protected]> wrote:
>
>> Hi,
>>
>> Please find the attached patch to fix PEP-8 issues in the below modules:
>>
>> 1. about
>> 2. feature_tests
>> 3. misc
>> 4. utils
>>
>> Thanks,
>> Khushboo
>>
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


Attachments:

  [text/x-patch] PEP8_fixes.patch (5.5K, 3-PEP8_fixes.patch)
  download | inline diff:
diff --git a/web/pgadmin/about/__init__.py b/web/pgadmin/about/__init__.py
index 98a4dd6..6d1e0b2 100644
--- a/web/pgadmin/about/__init__.py
+++ b/web/pgadmin/about/__init__.py
@@ -8,7 +8,6 @@
 ##########################################################################
 
 """A blueprint module implementing the about box."""
-MODULE_NAME = 'about'
 
 import sys
 from flask import Response, render_template, __version__, url_for
@@ -18,6 +17,8 @@ from pgadmin.utils import PgAdminModule
 from pgadmin.utils.menu import MenuItem
 import config
 
+MODULE_NAME = 'about'
+
 
 class AboutModule(PgAdminModule):
     def get_own_menuitems(self):
diff --git a/web/pgadmin/feature_tests/keyboard_shortcut_test.py b/web/pgadmin/feature_tests/keyboard_shortcut_test.py
index b83457c..443eff6 100644
--- a/web/pgadmin/feature_tests/keyboard_shortcut_test.py
+++ b/web/pgadmin/feature_tests/keyboard_shortcut_test.py
@@ -65,7 +65,8 @@ class KeyboardShortcutFeatureTest(BaseFeatureTest):
                 Keys.ALT
             ).perform()
 
-            print("Executing shortcut: " + self.new_shortcuts[s]['locator'] + "...", file=sys.stderr, end="")
+            print("Executing shortcut: " + self.new_shortcuts[s]['locator'] +
+                  "...", file=sys.stderr, end="")
 
             self.wait.until(
                 EC.presence_of_element_located(
diff --git a/web/pgadmin/feature_tests/view_data_dml_queries.py b/web/pgadmin/feature_tests/view_data_dml_queries.py
index aa75b6e..12e4295 100644
--- a/web/pgadmin/feature_tests/view_data_dml_queries.py
+++ b/web/pgadmin/feature_tests/view_data_dml_queries.py
@@ -100,7 +100,7 @@ CREATE TABLE public.defaults_{0}
         test_utils.create_database(self.server, "acceptance_test_db")
 
         # Create pre-requisite table
-        for k, v in { 1: 'id', 2:'"ID"' }.items():
+        for k, v in {1: 'id', 2: '"ID"'}.items():
             test_utils.create_table_with_query(
                 self.server,
                 "acceptance_test_db",
@@ -114,7 +114,7 @@ CREATE TABLE public.defaults_{0}
         self.page.add_server(self.server)
         self._tables_node_expandable()
         # iterate on both tables
-        for cnt in (1,2):
+        for cnt in (1, 2):
             self.page.select_tree_item('defaults_{0}'.format(str(cnt)))
             # Open Object -> View/Edit data
             self._view_data_grid()
diff --git a/web/pgadmin/misc/bgprocess/processes.py b/web/pgadmin/misc/bgprocess/processes.py
index 0c4112a..02b953d 100644
--- a/web/pgadmin/misc/bgprocess/processes.py
+++ b/web/pgadmin/misc/bgprocess/processes.py
@@ -21,10 +21,6 @@ from subprocess import Popen
 
 from pgadmin.utils import IS_PY2, u, file_quote, fs_encoding
 
-if IS_PY2:
-    from StringIO import StringIO
-else:
-    from io import StringIO
 import pytz
 from dateutil import parser
 from flask import current_app
@@ -33,6 +29,10 @@ from flask_security import current_user
 
 import config
 from pgadmin.model import Process, db
+if IS_PY2:
+    from StringIO import StringIO
+else:
+    from io import StringIO
 
 
 def get_current_time(format='%Y-%m-%d %H:%M:%S.%f %z'):
diff --git a/web/pgadmin/utils/__init__.py b/web/pgadmin/utils/__init__.py
index 631e981..c87a045 100644
--- a/web/pgadmin/utils/__init__.py
+++ b/web/pgadmin/utils/__init__.py
@@ -7,6 +7,8 @@
 #
 ##########################################################################
 
+import os
+import sys
 from collections import defaultdict
 from operator import attrgetter
 
@@ -153,9 +155,6 @@ class PgAdminModule(Blueprint):
         return res
 
 
-import os
-import sys
-
 IS_PY2 = (sys.version_info[0] == 2)
 IS_WIN = (os.name == 'nt')
 
@@ -316,4 +315,3 @@ SHORTCUT_FIELDS = [
         'label': gettext('Alt/Option')
     }
 ]
-
diff --git a/web/pgadmin/utils/javascript/tests/test_javascript_bundler.py b/web/pgadmin/utils/javascript/tests/test_javascript_bundler.py
index f946cb8..7030703 100644
--- a/web/pgadmin/utils/javascript/tests/test_javascript_bundler.py
+++ b/web/pgadmin/utils/javascript/tests/test_javascript_bundler.py
@@ -9,16 +9,15 @@
 
 
 import sys
+from pgadmin.utils.route import BaseTestGenerator
+from pgadmin.utils.javascript.javascript_bundler import JavascriptBundler
+from pgadmin.utils.javascript.javascript_bundler import JsState
 
 if sys.version_info < (3, 3):
     from mock import patch
 else:
     from unittest.mock import patch
 
-from pgadmin.utils.route import BaseTestGenerator
-from pgadmin.utils.javascript.javascript_bundler import JavascriptBundler
-from pgadmin.utils.javascript.javascript_bundler import JsState
-
 
 class JavascriptBundlerTestCase(BaseTestGenerator):
     """This tests that the javascript bundler tool causes the application to
diff --git a/web/pgadmin/utils/route.py b/web/pgadmin/utils/route.py
index 4103e87..379ef75 100644
--- a/web/pgadmin/utils/route.py
+++ b/web/pgadmin/utils/route.py
@@ -9,16 +9,16 @@
 
 import traceback
 import sys
-if sys.version_info < (2, 7):
-    import unittest2 as unittest
-else:
-    import unittest
-
 from abc import ABCMeta, abstractmethod
 from importlib import import_module
 from werkzeug.utils import find_modules
-
 import config
+import six
+
+if sys.version_info < (2, 7):
+    import unittest2 as unittest
+else:
+    import unittest
 
 
 class TestsGeneratorRegistry(ABCMeta):
@@ -76,9 +76,6 @@ class TestsGeneratorRegistry(ABCMeta):
                 traceback.print_exc(file=sys.stderr)
 
 
-import six
-
-
 @six.add_metaclass(TestsGeneratorRegistry)
 class BaseTestGenerator(unittest.TestCase):
     # Defining abstract method which will override by individual testcase.


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [pgAdmin4][Patch]: PEP-8 issue fixes
@ 2018-03-02 09:37  Dave Page <[email protected]>
  parent: Khushboo Vashi <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: Dave Page @ 2018-03-02 09:37 UTC (permalink / raw)
  To: Khushboo Vashi <[email protected]>; +Cc: pgadmin-hackers

Thanks, applied.

On Wed, Feb 28, 2018 at 4:19 AM, Khushboo Vashi <
[email protected]> wrote:

>
>
> On Mon, Feb 26, 2018 at 9:19 PM, Dave Page <[email protected]> wrote:
>
>> Can you rebase this please? It doesn't apply against master.
>>
>> Please find the updated patch excluding utils module as it is already
> done.
>
>> On Mon, Feb 26, 2018 at 12:04 PM, Khushboo Vashi <
>> [email protected]> wrote:
>>
>>> Hi,
>>>
>>> Please find the attached patch to fix PEP-8 issues in the below modules:
>>>
>>> 1. about
>>> 2. feature_tests
>>> 3. misc
>>> 4. utils
>>>
>>> Thanks,
>>> Khushboo
>>>
>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2018-03-02 09:37 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-02-26 12:04 [pgAdmin4][Patch]: PEP-8 issue fixes Khushboo Vashi <[email protected]>
2018-02-26 15:49 ` Dave Page <[email protected]>
2018-02-28 04:19   ` Khushboo Vashi <[email protected]>
2018-03-02 09:37     ` Dave Page <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox