public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][RM#3161] Fix PEP-8 issues
8+ messages / 3 participants
[nested] [flat]

* [pgAdmin4][RM#3161] Fix PEP-8 issues
@ 2018-02-28 18:04 Murtuza Zabuawala <[email protected]>
  2018-02-28 21:40 ` Re: [pgAdmin4][RM#3161] Fix PEP-8 issues Joao De Almeida Pereira <[email protected]>
  0 siblings, 1 reply; 8+ messages in thread

From: Murtuza Zabuawala @ 2018-02-28 18:04 UTC (permalink / raw)
  To: pgadmin-hackers

Hi,

PFA patch to fix the PEP8 issues in Casts, Event triggers, Extensions and
Languages module.

pycodestyle --config=.pycodestyle
pgadmin/browser/server_groups/servers/databases/languages/
pycodestyle --config=.pycodestyle
pgadmin/browser/server_groups/servers/databases/extensions/
pycodestyle --config=.pycodestyle
pgadmin/browser/server_groups/servers/databases/event_triggers/
pycodestyle --config=.pycodestyle
pgadmin/browser/server_groups/servers/databases/casts/

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

diff --git a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
index e9ef8ac..2ea178e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
@@ -26,6 +26,7 @@ from pgadmin.utils import IS_PY2
 if not IS_PY2:
     unicode = str
 
+
 class CastModule(CollectionNodeModule):
     """
      class CastModule(CollectionNodeModule)
@@ -96,8 +97,9 @@ class CastView(PGChildNodeView):
     class CastView(PGChildNodeView)
 
         A view class for cast node derived from PGChildNodeView. This class is
-        responsible for all the stuff related to view like create/update/delete cast,
-        showing properties of cast node, showing sql in sql pane.
+        responsible for all the stuff related to view like
+        create/update/delete cast, showing properties of cast node,
+        showing sql in sql pane.
 
     Methods:
     -------
@@ -110,11 +112,12 @@ class CastView(PGChildNodeView):
         manager,conn & template_path properties to self
 
     * list()
-      - This function is used to list all the cast nodes within that collection.
+      - This function is used to list all the cast nodes within that
+      collection.
 
     * nodes()
-      - This function will used to create all the child node within that collection.
-        Here it will create all the cast nodes.
+      - This function will used to create all the child node within that
+      collection. Here it will create all the cast nodes.
 
     * properties(gid, sid, did, rg_id)
       - This function will show the properties of the selected cast node
@@ -135,14 +138,16 @@ class CastView(PGChildNodeView):
       - This function will generate sql from model data
 
     * sql(gid, sid, did, rg_id):
-      - This function will generate sql to show in sql pane for the selected cast node.
+      - This function will generate sql to show in sql pane for the selected
+      cast node.
 
     * get_type():
-      - This function will fetch all the types for source and target types select control.
+      - This function will fetch all the types for source and target types
+      select control.
 
     * get_functions():
-      - This function will fetch associated functions list depending on selected source
-        and target types while creating a new cast node.
+      - This function will fetch associated functions list depending on
+      selected source and target types while creating a new cast node.
     """
 
     node_type = blueprint.node_type
@@ -171,8 +176,14 @@ class CastView(PGChildNodeView):
         'stats': [{'get': 'statistics'}],
         'dependency': [{'get': 'dependencies'}],
         'dependent': [{'get': 'dependents'}],
-        'get_type': [{'get': 'get_src_and_trg_type'}, {'get': 'get_src_and_trg_type'}],
-        'get_functions': [{'post': 'get_functions'}, {'post': 'get_functions'}]
+        'get_type': [
+            {'get': 'get_src_and_trg_type'},
+            {'get': 'get_src_and_trg_type'}
+        ],
+        'get_functions': [
+            {'post': 'get_functions'},
+            {'post': 'get_functions'}
+        ]
     })
 
     def _init_(self, **kwargs):
@@ -192,7 +203,9 @@ class CastView(PGChildNodeView):
         def wrap(*args, **kwargs):
             # Here args[0] will hold self & kwargs will hold gid,sid,did
             self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
+            self.manager = get_driver(
+                PG_DEFAULT_DRIVER
+            ).connection_manager(kwargs['sid'])
             self.conn = self.manager.connection(did=kwargs['did'])
             # Set template path for the SQL scripts
             self.template_path = 'cast/sql/#{0}#'.format(self.manager.version)
@@ -225,7 +238,8 @@ class CastView(PGChildNodeView):
             return internal_server_error(errormsg=res)
 
         for row in res['rows']:
-            row['castcontext'] = True if row['castcontext'] == 'IMPLICIT' else False
+            row['castcontext'] = True if row['castcontext'] == 'IMPLICIT' \
+                else False
 
         return ajax_response(
             response=res['rows'],
@@ -235,8 +249,8 @@ class CastView(PGChildNodeView):
     @check_precondition
     def nodes(self, gid, sid, did):
         """
-        This function will used to create all the child nodes within the collection.
-        Here it will create all the cast nodes.
+        This function will used to create all the child nodes within the
+        collection. Here it will create all the cast nodes.
         :param gid: group id
         :param sid: server id
         :param did: database id
@@ -366,17 +380,19 @@ class CastView(PGChildNodeView):
             if not status:
                 return internal_server_error(errormsg=res)
 
-            # we need oid to to add object in tree at browser, below sql will gives the same
+            # we need oid to to add object in tree at browser, below sql will
+            # gives the same
             last_system_oid = 0 if self.blueprint.show_system_objects else \
                 (self.manager.db_info[did])['datlastsysoid'] \
                 if self.manager.db_info is not None and \
                 did in self.manager.db_info else 0
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
-                                  srctyp=data['srctyp'],
-                                  trgtyp=data['trgtyp'],
-                                  datlastsysoid=last_system_oid,
-                                  showsysobj=self.blueprint.show_system_objects
-                                  )
+            sql = render_template(
+                "/".join([self.template_path, 'properties.sql']),
+                srctyp=data['srctyp'],
+                trgtyp=data['trgtyp'],
+                datlastsysoid=last_system_oid,
+                showsysobj=self.blueprint.show_system_objects
+            )
             status, cid = self.conn.execute_scalar(sql)
             if not status:
                 return internal_server_error(errormsg=cid)
@@ -527,10 +543,12 @@ class CastView(PGChildNodeView):
                 (self.manager.db_info[did])['datlastsysoid'] \
                 if self.manager.db_info is not None and \
                 did in self.manager.db_info else 0
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
-                                  cid=cid,
-                                  datlastsysoid=last_system_oid,
-                                  showsysobj=self.blueprint.show_system_objects)
+            sql = render_template(
+                "/".join([self.template_path, 'properties.sql']),
+                cid=cid,
+                datlastsysoid=last_system_oid,
+                showsysobj=self.blueprint.show_system_objects
+            )
             status, res = self.conn.execute_dict(sql)
 
             if not status:
@@ -549,7 +567,10 @@ class CastView(PGChildNodeView):
             return sql, data['name'] if 'name' in data else old_data['name']
         else:
             if 'srctyp' in data and 'trgtyp' in data:
-                sql = render_template("/".join([self.template_path, 'create.sql']), data=data, conn=self.conn)
+                sql = render_template(
+                    "/".join([self.template_path, 'create.sql']),
+                    data=data, conn=self.conn
+                )
             else:
                 return u"-- definition incomplete", None
             return sql, data['srctyp'] + "->" + data["trgtyp"]
@@ -638,14 +659,14 @@ class CastView(PGChildNodeView):
             status, res = self.conn.execute_scalar(sql)
             if not status:
                 return internal_server_error(
-                    _("Could not generate reversed engineered SQL for the cast.\n\n{0}").format(
-                        res
-                    )
+                    _("Could not generate reversed engineered SQL for the "
+                      "cast.\n\n{0}").format(res)
                 )
 
             if res is None:
                 return gone(
-                    _("Could not generate reversed engineered SQL for the cast node.\n")
+                    _("Could not generate reversed engineered SQL for the "
+                      "cast node.\n")
                 )
 
             return ajax_response(response=res)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/casts/tests/utils.py b/web/pgadmin/browser/server_groups/servers/databases/casts/tests/utils.py
index 0b6a9ef..84b2b8d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/casts/tests/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/casts/tests/utils.py
@@ -56,7 +56,8 @@ def create_cast(server, source_type, target_type):
         # Get 'oid' from newly created cast
         pg_cursor.execute(
             "SELECT ca.oid FROM pg_cast ca WHERE ca.castsource = "
-            "(SELECT t.oid FROM pg_type t WHERE format_type(t.oid, NULL)='%s') "
+            "(SELECT t.oid FROM pg_type t "
+            "WHERE format_type(t.oid, NULL)='%s') "
             "AND ca.casttarget = (SELECT t.oid FROM pg_type t WHERE "
             "format_type(t.oid, NULL) = '%s')" % (source_type, target_type))
         oid = pg_cursor.fetchone()
@@ -75,7 +76,8 @@ def verify_cast(connection, source_type, target_type):
         pg_cursor = connection.cursor()
         pg_cursor.execute(
             "SELECT * FROM pg_cast ca WHERE ca.castsource = "
-            "(SELECT t.oid FROM pg_type t WHERE format_type(t.oid, NULL)='%s') "
+            "(SELECT t.oid FROM pg_type t "
+            "WHERE format_type(t.oid, NULL)='%s') "
             "AND ca.casttarget = (SELECT t.oid FROM pg_type t WHERE "
             "format_type(t.oid, NULL) = '%s')" % (source_type, target_type))
         casts = pg_cursor.fetchall()
@@ -92,7 +94,8 @@ def drop_cast(connection, source_type, target_type):
         pg_cursor = connection.cursor()
         pg_cursor.execute(
             "SELECT * FROM pg_cast ca WHERE ca.castsource = "
-            "(SELECT t.oid FROM pg_type t WHERE format_type(t.oid, NULL)='%s') "
+            "(SELECT t.oid FROM pg_type t "
+            "WHERE format_type(t.oid, NULL)='%s') "
             "AND ca.casttarget = (SELECT t.oid FROM pg_type t WHERE "
             "format_type(t.oid, NULL) = '%s')" % (source_type, target_type))
         if pg_cursor.fetchall():
diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
index 33ef894..1fa8b26 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
@@ -30,7 +30,8 @@ class EventTriggerModule(CollectionNodeModule):
     """
     class EventTriggerModule(CollectionNodeModule)
 
-        A module class for Event trigger node derived from CollectionNodeModule.
+        A module class for Event trigger node derived from
+        CollectionNodeModule.
 
     Methods:
     -------
@@ -51,7 +52,8 @@ class EventTriggerModule(CollectionNodeModule):
 
     def __init__(self, *args, **kwargs):
         """
-        Method is used to initialize the EventTriggerModule and it's base module.
+        Method is used to initialize the EventTriggerModule and it's base
+        module.
 
         Args:
             *args:
@@ -184,9 +186,12 @@ class EventTriggerView(PGChildNodeView):
         @wraps(f)
         def wrap(*args, **kwargs):
 
-            # Here - args[0] will always hold self & kwargs will hold gid, sid, did
+            # Here - args[0] will always hold self & kwargs will hold gid,
+            # sid, did
             self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
+            self.manager = get_driver(
+                PG_DEFAULT_DRIVER
+            ).connection_manager(kwargs['sid'])
             self.conn = self.manager.connection(did=kwargs['did'])
             self.template_path = 'event_triggers/sql/9.3_plus'
 
@@ -222,8 +227,8 @@ class EventTriggerView(PGChildNodeView):
     @check_precondition
     def nodes(self, gid, sid, did):
         """
-        This function is used to create all the child nodes within the collection.
-        Here it will create all the event trigger nodes.
+        This function is used to create all the child nodes within the
+        collection. Here it will create all the event trigger nodes.
 
         Args:
           gid: Server Group ID
@@ -318,7 +323,10 @@ class EventTriggerView(PGChildNodeView):
         Returns:
 
         """
-        sql = render_template("/".join([self.template_path, 'properties.sql']), etid=etid, conn=self.conn)
+        sql = render_template(
+            "/".join([self.template_path, 'properties.sql']),
+            etid=etid, conn=self.conn
+        )
         status, res = self.conn.execute_dict(sql)
         if not status:
             return internal_server_error(errormsg=res)
@@ -374,18 +382,27 @@ class EventTriggerView(PGChildNodeView):
                 )
             )
         try:
-            sql = render_template("/".join([self.template_path, 'create.sql']), data=data, conn=self.conn)
+            sql = render_template(
+                "/".join([self.template_path, 'create.sql']),
+                data=data, conn=self.conn
+            )
             status, res = self.conn.execute_scalar(sql)
             if not status:
                 return internal_server_error(errormsg=res)
-            sql = render_template("/".join([self.template_path, 'grant.sql']), data=data, conn=self.conn)
+            sql = render_template(
+                "/".join([self.template_path, 'grant.sql']),
+                data=data, conn=self.conn
+            )
             sql = sql.strip('\n').strip(' ')
 
             status, res = self.conn.execute_scalar(sql)
             if not status:
                 return internal_server_error(errormsg=res)
 
-            sql = render_template("/".join([self.template_path, 'get_oid.sql']), data=data)
+            sql = render_template(
+                "/".join([self.template_path, 'get_oid.sql']),
+                data=data
+            )
             status, etid = self.conn.execute_scalar(sql)
             if not status:
                 return internal_server_error(errormsg=etid)
@@ -431,7 +448,10 @@ class EventTriggerView(PGChildNodeView):
                 if not status:
                     return internal_server_error(errormsg=res)
 
-                sql = render_template("/".join([self.template_path, 'get_oid.sql']), data=data)
+                sql = render_template(
+                    "/".join([self.template_path, 'get_oid.sql']),
+                    data=data
+                )
                 status, etid = self.conn.execute_scalar(sql)
 
                 return jsonify(
@@ -478,7 +498,10 @@ class EventTriggerView(PGChildNodeView):
         else:
             cascade = False
         try:
-            sql = render_template("/".join([self.template_path, 'delete.sql']), etid=etid)
+            sql = render_template(
+                "/".join([self.template_path, 'delete.sql']),
+                etid=etid
+            )
             status, name = self.conn.execute_scalar(sql)
             if not status:
                 return internal_server_error(errormsg=name)
@@ -495,7 +518,10 @@ class EventTriggerView(PGChildNodeView):
                     )
                 )
 
-            sql = render_template("/".join([self.template_path, 'delete.sql']), name=name, cascade=cascade)
+            sql = render_template(
+                "/".join([self.template_path, 'delete.sql']),
+                name=name, cascade=cascade
+            )
             status, res = self.conn.execute_scalar(sql)
             if not status:
                 return internal_server_error(errormsg=res)
@@ -568,7 +594,10 @@ class EventTriggerView(PGChildNodeView):
         ]
 
         if etid is not None:
-            sql = render_template("/".join([self.template_path, 'properties.sql']), etid=etid)
+            sql = render_template(
+                "/".join([self.template_path, 'properties.sql']),
+                etid=etid
+            )
             status, res = self.conn.execute_dict(sql)
             if not status:
                 return internal_server_error(errormsg=res)
@@ -584,7 +613,10 @@ class EventTriggerView(PGChildNodeView):
             for arg in required_args:
                 if arg not in data:
                     data[arg] = old_data[arg]
-            sql = render_template("/".join([self.template_path, 'update.sql']), data=data, o_data=old_data)
+            sql = render_template(
+                "/".join([self.template_path, 'update.sql']),
+                data=data, o_data=old_data
+            )
         else:
             required_args = {
                 'name': 'Name',
@@ -605,16 +637,22 @@ class EventTriggerView(PGChildNodeView):
                         "Could not find the required parameter %s." % err
                     )
                 )
-            sql = render_template("/".join([self.template_path, 'create.sql']), data=data)
+            sql = render_template(
+                "/".join([self.template_path, 'create.sql']),
+                data=data
+            )
             sql += "\n"
-            sql += render_template("/".join([self.template_path, 'grant.sql']), data=data)
+            sql += render_template(
+                "/".join([self.template_path, 'grant.sql']),
+                data=data
+            )
         return sql
 
     @check_precondition
     def sql(self, gid, sid, did, etid):
         """
-        This function will generate sql to show in the sql pane for the selected
-        event trigger node.
+        This function will generate sql to show in the sql pane for the
+        selected event trigger node.
 
         Args:
           gid: Server Group ID
@@ -625,7 +663,10 @@ class EventTriggerView(PGChildNodeView):
         Returns:
 
         """
-        sql = render_template("/".join([self.template_path, 'properties.sql']), etid=etid)
+        sql = render_template(
+            "/".join([self.template_path, 'properties.sql']),
+            etid=etid
+        )
         status, res = self.conn.execute_dict(sql)
         if not status:
             return internal_server_error(errormsg=res)
@@ -638,16 +679,27 @@ class EventTriggerView(PGChildNodeView):
         result = res['rows'][0]
         result = self._formatter(result)
 
-        sql = render_template("/".join([self.template_path, 'create.sql']), data=result, conn=self.conn)
+        sql = render_template(
+            "/".join([self.template_path, 'create.sql']),
+            data=result, conn=self.conn
+        )
         sql += "\n\n"
-        sql += render_template("/".join([self.template_path, 'grant.sql']), data=result, conn=self.conn)
+        sql += render_template(
+            "/".join([self.template_path, 'grant.sql']),
+            data=result, conn=self.conn
+        )
 
-        db_sql = render_template("/".join([self.template_path, 'get_db.sql']), did=did)
+        db_sql = render_template(
+            "/".join([self.template_path, 'get_db.sql']),
+            did=did
+        )
         status, db_name = self.conn.execute_scalar(db_sql)
         if not status:
             return internal_server_error(errormsg=db_name)
 
-        sql_header = u"-- Event Trigger: {0} on database {1}\n\n-- ".format(result['name'], db_name)
+        sql_header = u"-- Event Trigger: {0} on database {1}\n\n-- ".format(
+            result['name'], db_name
+        )
 
         sql_header += render_template(
             "/".join([self.template_path, 'delete.sql']),
@@ -675,7 +727,9 @@ class EventTriggerView(PGChildNodeView):
 
         """
         res = [{'label': '', 'value': ''}]
-        sql = render_template("/".join([self.template_path, 'eventfunctions.sql']))
+        sql = render_template(
+            "/".join([self.template_path, 'eventfunctions.sql'])
+        )
         status, rest = self.conn.execute_2darray(sql)
         if not status:
             return internal_server_error(errormsg=rest)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/tests/test_event_trigger_get.py b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/tests/test_event_trigger_get.py
index 647e6b1..b07e7d5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/tests/test_event_trigger_get.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/tests/test_event_trigger_get.py
@@ -77,10 +77,11 @@ class EventTriggerGetTestCase(BaseTestGenerator):
         if not func_response:
             raise Exception("Could not find the trigger function.")
         response = self.tester.get(
-            self.url + str(utils.SERVER_GROUP) + '/'
-            + str(self.server_id) + '/' + str(self.db_id) + '/' +
-            str(self.event_trigger_id),
-            content_type='html/json')
+            self.url +
+            str(utils.SERVER_GROUP) + '/' + str(self.server_id) + '/' +
+            str(self.db_id) + '/' + str(self.event_trigger_id),
+            content_type='html/json'
+        )
         self.assertEquals(response.status_code, 200)
 
     def tearDown(self):
diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
index abb9631..abef0d2 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
@@ -78,8 +78,8 @@ class ExtensionModule(CollectionNodeModule):
     @property
     def script_load(self):
         """
-        Load the module script for extension, when any of the database nodes are
-        initialized.
+        Load the module script for extension, when any of the database nodes
+        are initialized.
         """
         return databases.DatabaseModule.NODE_TYPE
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
index a516d1e..90acae3 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
@@ -90,7 +90,8 @@ class LanguageModule(CollectionNodeModule):
     @property
     def script_load(self):
         """
-        Load the module script for language, when any of the database nodes are initialized.
+        Load the module script for language, when any of the database nodes
+        are initialized.
 
         Returns: node type of the server module.
         """
@@ -112,9 +113,9 @@ class LanguageView(PGChildNodeView):
     """
     class LanguageView(PGChildNodeView)
 
-        A view class for Language node derived from PGChildNodeView. This class is
-        responsible for all the stuff related to view like updating language
-        node, showing properties, showing sql in sql pane.
+        A view class for Language node derived from PGChildNodeView.
+        This class is responsible for all the stuff related to view like
+        updating language node, showing properties, showing sql in sql pane.
 
     Methods:
     -------
@@ -127,11 +128,12 @@ class LanguageView(PGChildNodeView):
         manager,conn & template_path properties to self
 
     * list()
-      - This function is used to list all the language nodes within that collection.
+      - This function is used to list all the language nodes within that
+      collection.
 
     * nodes()
-      - This function will used to create all the child node within that collection.
-        Here it will create all the language node.
+      - This function will used to create all the child node within that
+      collection. Here it will create all the language node.
 
     * properties(gid, sid, did, lid)
       - This function will show the properties of the selected language node
@@ -146,25 +148,30 @@ class LanguageView(PGChildNodeView):
       - This function will delete the selected language node
 
     * msql(gid, sid, did, lid)
-      - This function is used to return modified SQL for the selected language node
+      - This function is used to return modified SQL for the selected
+      language node
 
     * get_sql(data, lid)
       - This function will generate sql from model data
 
     * get_functions(gid, sid, did)
-      - This function returns the handler and inline functions for the selected language node
+      - This function returns the handler and inline functions for the
+      selected language node
 
     * get_templates(gid, sid, did)
       - This function returns language templates.
 
     * sql(gid, sid, did, lid):
-      - This function will generate sql to show it in sql pane for the selected language node.
+      - This function will generate sql to show it in sql pane for the
+      selected language node.
 
     * dependents(gid, sid, did, lid):
-      - This function get the dependents and return ajax response for the language node.
+      - This function get the dependents and return ajax response for the
+      language node.
 
     * dependencies(self, gid, sid, did, lid):
-      - This function get the dependencies and return ajax response for the language node.
+      - This function get the dependencies and return ajax response for the
+      language node.
     """
 
     node_type = blueprint.node_type
@@ -197,7 +204,8 @@ class LanguageView(PGChildNodeView):
     def _init_(self, **kwargs):
         """
         Method is used to initialize the LanguageView and its base view.
-        Initialize all the variables create/used dynamically like conn, template_path.
+        Initialize all the variables create/used dynamically like conn,
+        template_path.
 
         Args:
             **kwargs:
@@ -223,9 +231,11 @@ class LanguageView(PGChildNodeView):
             self.manager = self.driver.connection_manager(kwargs['sid'])
             self.conn = self.manager.connection(did=kwargs['did'])
             # Set the template path for the SQL scripts
-            self.template_path = ("languages/sql/#gpdb#{0}#".format(self.manager.version)
-                                if self.manager.server_type == 'gpdb'
-                                else "languages/sql/#{0}#".format(self.manager.version))
+            self.template_path = (
+                "languages/sql/#gpdb#{0}#".format(self.manager.version) if
+                self.manager.server_type == 'gpdb' else
+                "languages/sql/#{0}#".format(self.manager.version)
+            )
 
             return f(*args, **kwargs)
 
@@ -234,7 +244,8 @@ class LanguageView(PGChildNodeView):
     @check_precondition
     def list(self, gid, sid, did):
         """
-        This function is used to list all the language nodes within that collection.
+        This function is used to list all the language nodes within that
+        collection.
 
         Args:
             gid: Server Group ID
@@ -254,8 +265,8 @@ class LanguageView(PGChildNodeView):
     @check_precondition
     def nodes(self, gid, sid, did):
         """
-        This function is used to create all the child nodes within the collection.
-        Here it will create all the language nodes.
+        This function is used to create all the child nodes within the
+        collection. Here it will create all the language nodes.
 
         Args:
             gid: Server Group ID
@@ -323,7 +334,10 @@ class LanguageView(PGChildNodeView):
             did: Database ID
             lid: Language ID
         """
-        sql = render_template("/".join([self.template_path, 'properties.sql']), lid=lid)
+        sql = render_template(
+            "/".join([self.template_path, 'properties.sql']),
+            lid=lid
+        )
         status, res = self.conn.execute_dict(sql)
 
         if not status:
@@ -334,7 +348,10 @@ class LanguageView(PGChildNodeView):
                 gettext("Could not find the language information.")
             )
 
-        sql = render_template("/".join([self.template_path, 'acl.sql']), lid=lid)
+        sql = render_template(
+            "/".join([self.template_path, 'acl.sql']),
+            lid=lid
+        )
         status, result = self.conn.execute_dict(sql)
         if not status:
             return internal_server_error(errormsg=result)
@@ -344,7 +361,13 @@ class LanguageView(PGChildNodeView):
             res['rows'][0]['lanacl'] = dict()
             res['rows'][0]['lanacl']['grantee'] = 'PUBLIC'
             res['rows'][0]['lanacl']['grantor'] = res['rows'][0]['lanowner']
-            res['rows'][0]['lanacl']['privileges'] = [{'privilege_type': 'U', 'privilege': True, 'with_grant': False}]
+            res['rows'][0]['lanacl']['privileges'] = [
+                {
+                    'privilege_type': 'U',
+                    'privilege': True,
+                    'with_grant': False
+                }
+            ]
         else:
             for row in result['rows']:
                 priv = parse_priv_from_db(row)
@@ -354,7 +377,8 @@ class LanguageView(PGChildNodeView):
                     res['rows'][0][row['deftype']] = [priv]
 
         seclabels = []
-        if 'seclabels' in res['rows'][0] and res['rows'][0]['seclabels'] is not None:
+        if 'seclabels' in res['rows'][0] and \
+                res['rows'][0]['seclabels'] is not None:
             import re
             for sec in res['rows'][0]['seclabels']:
                 sec = re.search(r'([^=]+)=(.*$)', sec)
@@ -443,8 +467,10 @@ class LanguageView(PGChildNodeView):
             if not status:
                 return internal_server_error(errormsg=res)
 
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
-                                  lanname=data['name'], conn=self.conn)
+            sql = render_template(
+                "/".join([self.template_path, 'properties.sql']),
+                lanname=data['name'], conn=self.conn
+            )
 
             status, r_set = self.conn.execute_dict(sql)
             if not status:
@@ -482,15 +508,20 @@ class LanguageView(PGChildNodeView):
 
         try:
             # Get name for language from lid
-            sql = render_template("/".join([self.template_path, 'delete.sql']), lid=lid, conn=self.conn)
+            sql = render_template(
+                "/".join([self.template_path, 'delete.sql']),
+                lid=lid, conn=self.conn
+            )
             status, lname = self.conn.execute_scalar(sql)
 
             if not status:
                 return internal_server_error(errormsg=lname)
 
             # drop language
-            sql = render_template("/".join([self.template_path, 'delete.sql']), lname=lname,
-                                  cascade=cascade, conn=self.conn)
+            sql = render_template(
+                "/".join([self.template_path, 'delete.sql']),
+                lname=lname, cascade=cascade, conn=self.conn
+            )
             status, res = self.conn.execute_scalar(sql)
 
             if not status:
@@ -513,7 +544,8 @@ class LanguageView(PGChildNodeView):
     @check_precondition
     def msql(self, gid, sid, did, lid=None):
         """
-        This function is used to return modified SQL for the selected language node.
+        This function is used to return modified SQL for the selected
+        language node.
 
         Args:
             gid: Server Group ID
@@ -538,7 +570,7 @@ class LanguageView(PGChildNodeView):
             return make_json_response(
                 data=sql,
                 status=200
-                )
+            )
         except Exception as e:
             return internal_server_error(errormsg=str(e))
 
@@ -555,7 +587,9 @@ class LanguageView(PGChildNodeView):
         ]
 
         if lid is not None:
-            sql = render_template("/".join([self.template_path, 'properties.sql']), lid=lid)
+            sql = render_template(
+                "/".join([self.template_path, 'properties.sql']), lid=lid
+            )
             status, res = self.conn.execute_dict(sql)
             if not status:
                 return internal_server_error(errormsg=res)
@@ -568,19 +602,28 @@ class LanguageView(PGChildNodeView):
             for key in ['lanacl']:
                 if key in data and data[key] is not None:
                     if 'added' in data[key]:
-                        data[key]['added'] = parse_priv_to_db(data[key]['added'], ["U"])
+                        data[key]['added'] = parse_priv_to_db(
+                            data[key]['added'], ["U"]
+                        )
                     if 'changed' in data[key]:
-                        data[key]['changed'] = parse_priv_to_db(data[key]['changed'], ["U"])
+                        data[key]['changed'] = parse_priv_to_db(
+                            data[key]['changed'], ["U"]
+                        )
                     if 'deleted' in data[key]:
-                        data[key]['deleted'] = parse_priv_to_db(data[key]['deleted'], ["U"])
+                        data[key]['deleted'] = parse_priv_to_db(
+                            data[key]['deleted'], ["U"]
+                        )
 
             old_data = res['rows'][0]
             for arg in required_args:
                 if arg not in data:
                     data[arg] = old_data[arg]
-            sql = render_template("/".join([self.template_path, 'update.sql']), data=data,
-                                  o_data=old_data, conn=self.conn)
-            return sql.strip('\n'), data['name'] if 'name' in data else old_data['name']
+            sql = render_template(
+                "/".join([self.template_path, 'update.sql']),
+                data=data, o_data=old_data, conn=self.conn
+            )
+            return sql.strip('\n'), data['name'] if 'name' in data \
+                else old_data['name']
         else:
 
             if 'lanacl' in data:
@@ -590,11 +633,11 @@ class LanguageView(PGChildNodeView):
                                   data=data, conn=self.conn)
             return sql.strip('\n'), data['name']
 
-
     @check_precondition
     def get_functions(self, gid, sid, did):
         """
-        This function returns the handler and inline functions for the selected language node.
+        This function returns the handler and inline functions for the
+        selected language node.
 
         Args:
             gid: Server Group ID
@@ -632,7 +675,8 @@ class LanguageView(PGChildNodeView):
     @check_precondition
     def sql(self, gid, sid, did, lid):
         """
-        This function will generate sql to show in the sql pane for the selected language node.
+        This function will generate sql to show in the sql pane for the
+        selected language node.
 
         Args:
             gid: Server Group ID
@@ -640,7 +684,10 @@ class LanguageView(PGChildNodeView):
             did: Database ID
             lid: Language ID
         """
-        sql = render_template("/".join([self.template_path, 'properties.sql']), lid=lid)
+        sql = render_template(
+            "/".join([self.template_path, 'properties.sql']),
+            lid=lid
+        )
         status, res = self.conn.execute_dict(sql)
         if not status:
             return internal_server_error(errormsg=res)
@@ -653,7 +700,10 @@ class LanguageView(PGChildNodeView):
         # Making copy of output for future use
         old_data = dict(res['rows'][0])
 
-        sql = render_template("/".join([self.template_path, 'acl.sql']), lid=lid)
+        sql = render_template(
+            "/".join([self.template_path, 'acl.sql']),
+            lid=lid
+        )
         status, result = self.conn.execute_dict(sql)
         if not status:
             return internal_server_error(errormsg=result)
@@ -676,7 +726,10 @@ class LanguageView(PGChildNodeView):
                 })
 
         old_data['seclabels'] = seclabels
-        sql = render_template("/".join([self.template_path, 'sqlpane.sql']), data=old_data, conn=self.conn)
+        sql = render_template(
+            "/".join([self.template_path, 'sqlpane.sql']),
+            data=old_data, conn=self.conn
+        )
 
         return ajax_response(response=sql.strip('\n'))
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/test_language_add.py b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/test_language_add.py
index 0f76cc6..4c6f9c0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/test_language_add.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/test_language_add.py
@@ -50,23 +50,21 @@ class LanguagesAddTestCase(BaseTestGenerator):
             "lanval": "fmgr_c_validator",
             "name": "language_%s" % str(uuid.uuid4())[1:8],
             "seclabels": [],
-            "template_list":
-                [
-                    "plperl",
-                    "plperlu",
-                    "plpython2u",
-                    "plpython3u",
-                    "plpythonu",
-                    "pltcl",
-                    "pltclu"
-                ],
+            "template_list": [
+                "plperl",
+                "plperlu",
+                "plpython2u",
+                "plpython3u",
+                "plpythonu",
+                "pltcl",
+                "pltclu"
+            ],
             "trusted": "true"
-                }
+        }
 
         response = self.tester.post(
             self.url + str(utils.SERVER_GROUP) + '/' +
-            str(self.server_id) + '/' + str(
-                self.db_id) + '/',
+            str(self.server_id) + '/' + str(self.db_id) + '/',
             data=json.dumps(self.data),
             content_type='html/json')
 
@@ -76,7 +74,7 @@ class LanguagesAddTestCase(BaseTestGenerator):
         """This function delete added language and
         disconnect the test database."""
 
-        language_utils.delete_language(self.server, self.db_name,
-                                       self.data['name'])
+        language_utils.delete_language(
+            self.server, self.db_name, self.data['name']
+        )
         database_utils.disconnect_database(self, self.server_id, self.db_id)
-


Attachments:

  [text/plain] RM_3161.diff (37.9K, 3-RM_3161.diff)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
index e9ef8ac..2ea178e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
@@ -26,6 +26,7 @@ from pgadmin.utils import IS_PY2
 if not IS_PY2:
     unicode = str
 
+
 class CastModule(CollectionNodeModule):
     """
      class CastModule(CollectionNodeModule)
@@ -96,8 +97,9 @@ class CastView(PGChildNodeView):
     class CastView(PGChildNodeView)
 
         A view class for cast node derived from PGChildNodeView. This class is
-        responsible for all the stuff related to view like create/update/delete cast,
-        showing properties of cast node, showing sql in sql pane.
+        responsible for all the stuff related to view like
+        create/update/delete cast, showing properties of cast node,
+        showing sql in sql pane.
 
     Methods:
     -------
@@ -110,11 +112,12 @@ class CastView(PGChildNodeView):
         manager,conn & template_path properties to self
 
     * list()
-      - This function is used to list all the cast nodes within that collection.
+      - This function is used to list all the cast nodes within that
+      collection.
 
     * nodes()
-      - This function will used to create all the child node within that collection.
-        Here it will create all the cast nodes.
+      - This function will used to create all the child node within that
+      collection. Here it will create all the cast nodes.
 
     * properties(gid, sid, did, rg_id)
       - This function will show the properties of the selected cast node
@@ -135,14 +138,16 @@ class CastView(PGChildNodeView):
       - This function will generate sql from model data
 
     * sql(gid, sid, did, rg_id):
-      - This function will generate sql to show in sql pane for the selected cast node.
+      - This function will generate sql to show in sql pane for the selected
+      cast node.
 
     * get_type():
-      - This function will fetch all the types for source and target types select control.
+      - This function will fetch all the types for source and target types
+      select control.
 
     * get_functions():
-      - This function will fetch associated functions list depending on selected source
-        and target types while creating a new cast node.
+      - This function will fetch associated functions list depending on
+      selected source and target types while creating a new cast node.
     """
 
     node_type = blueprint.node_type
@@ -171,8 +176,14 @@ class CastView(PGChildNodeView):
         'stats': [{'get': 'statistics'}],
         'dependency': [{'get': 'dependencies'}],
         'dependent': [{'get': 'dependents'}],
-        'get_type': [{'get': 'get_src_and_trg_type'}, {'get': 'get_src_and_trg_type'}],
-        'get_functions': [{'post': 'get_functions'}, {'post': 'get_functions'}]
+        'get_type': [
+            {'get': 'get_src_and_trg_type'},
+            {'get': 'get_src_and_trg_type'}
+        ],
+        'get_functions': [
+            {'post': 'get_functions'},
+            {'post': 'get_functions'}
+        ]
     })
 
     def _init_(self, **kwargs):
@@ -192,7 +203,9 @@ class CastView(PGChildNodeView):
         def wrap(*args, **kwargs):
             # Here args[0] will hold self & kwargs will hold gid,sid,did
             self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
+            self.manager = get_driver(
+                PG_DEFAULT_DRIVER
+            ).connection_manager(kwargs['sid'])
             self.conn = self.manager.connection(did=kwargs['did'])
             # Set template path for the SQL scripts
             self.template_path = 'cast/sql/#{0}#'.format(self.manager.version)
@@ -225,7 +238,8 @@ class CastView(PGChildNodeView):
             return internal_server_error(errormsg=res)
 
         for row in res['rows']:
-            row['castcontext'] = True if row['castcontext'] == 'IMPLICIT' else False
+            row['castcontext'] = True if row['castcontext'] == 'IMPLICIT' \
+                else False
 
         return ajax_response(
             response=res['rows'],
@@ -235,8 +249,8 @@ class CastView(PGChildNodeView):
     @check_precondition
     def nodes(self, gid, sid, did):
         """
-        This function will used to create all the child nodes within the collection.
-        Here it will create all the cast nodes.
+        This function will used to create all the child nodes within the
+        collection. Here it will create all the cast nodes.
         :param gid: group id
         :param sid: server id
         :param did: database id
@@ -366,17 +380,19 @@ class CastView(PGChildNodeView):
             if not status:
                 return internal_server_error(errormsg=res)
 
-            # we need oid to to add object in tree at browser, below sql will gives the same
+            # we need oid to to add object in tree at browser, below sql will
+            # gives the same
             last_system_oid = 0 if self.blueprint.show_system_objects else \
                 (self.manager.db_info[did])['datlastsysoid'] \
                 if self.manager.db_info is not None and \
                 did in self.manager.db_info else 0
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
-                                  srctyp=data['srctyp'],
-                                  trgtyp=data['trgtyp'],
-                                  datlastsysoid=last_system_oid,
-                                  showsysobj=self.blueprint.show_system_objects
-                                  )
+            sql = render_template(
+                "/".join([self.template_path, 'properties.sql']),
+                srctyp=data['srctyp'],
+                trgtyp=data['trgtyp'],
+                datlastsysoid=last_system_oid,
+                showsysobj=self.blueprint.show_system_objects
+            )
             status, cid = self.conn.execute_scalar(sql)
             if not status:
                 return internal_server_error(errormsg=cid)
@@ -527,10 +543,12 @@ class CastView(PGChildNodeView):
                 (self.manager.db_info[did])['datlastsysoid'] \
                 if self.manager.db_info is not None and \
                 did in self.manager.db_info else 0
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
-                                  cid=cid,
-                                  datlastsysoid=last_system_oid,
-                                  showsysobj=self.blueprint.show_system_objects)
+            sql = render_template(
+                "/".join([self.template_path, 'properties.sql']),
+                cid=cid,
+                datlastsysoid=last_system_oid,
+                showsysobj=self.blueprint.show_system_objects
+            )
             status, res = self.conn.execute_dict(sql)
 
             if not status:
@@ -549,7 +567,10 @@ class CastView(PGChildNodeView):
             return sql, data['name'] if 'name' in data else old_data['name']
         else:
             if 'srctyp' in data and 'trgtyp' in data:
-                sql = render_template("/".join([self.template_path, 'create.sql']), data=data, conn=self.conn)
+                sql = render_template(
+                    "/".join([self.template_path, 'create.sql']),
+                    data=data, conn=self.conn
+                )
             else:
                 return u"-- definition incomplete", None
             return sql, data['srctyp'] + "->" + data["trgtyp"]
@@ -638,14 +659,14 @@ class CastView(PGChildNodeView):
             status, res = self.conn.execute_scalar(sql)
             if not status:
                 return internal_server_error(
-                    _("Could not generate reversed engineered SQL for the cast.\n\n{0}").format(
-                        res
-                    )
+                    _("Could not generate reversed engineered SQL for the "
+                      "cast.\n\n{0}").format(res)
                 )
 
             if res is None:
                 return gone(
-                    _("Could not generate reversed engineered SQL for the cast node.\n")
+                    _("Could not generate reversed engineered SQL for the "
+                      "cast node.\n")
                 )
 
             return ajax_response(response=res)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/casts/tests/utils.py b/web/pgadmin/browser/server_groups/servers/databases/casts/tests/utils.py
index 0b6a9ef..84b2b8d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/casts/tests/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/casts/tests/utils.py
@@ -56,7 +56,8 @@ def create_cast(server, source_type, target_type):
         # Get 'oid' from newly created cast
         pg_cursor.execute(
             "SELECT ca.oid FROM pg_cast ca WHERE ca.castsource = "
-            "(SELECT t.oid FROM pg_type t WHERE format_type(t.oid, NULL)='%s') "
+            "(SELECT t.oid FROM pg_type t "
+            "WHERE format_type(t.oid, NULL)='%s') "
             "AND ca.casttarget = (SELECT t.oid FROM pg_type t WHERE "
             "format_type(t.oid, NULL) = '%s')" % (source_type, target_type))
         oid = pg_cursor.fetchone()
@@ -75,7 +76,8 @@ def verify_cast(connection, source_type, target_type):
         pg_cursor = connection.cursor()
         pg_cursor.execute(
             "SELECT * FROM pg_cast ca WHERE ca.castsource = "
-            "(SELECT t.oid FROM pg_type t WHERE format_type(t.oid, NULL)='%s') "
+            "(SELECT t.oid FROM pg_type t "
+            "WHERE format_type(t.oid, NULL)='%s') "
             "AND ca.casttarget = (SELECT t.oid FROM pg_type t WHERE "
             "format_type(t.oid, NULL) = '%s')" % (source_type, target_type))
         casts = pg_cursor.fetchall()
@@ -92,7 +94,8 @@ def drop_cast(connection, source_type, target_type):
         pg_cursor = connection.cursor()
         pg_cursor.execute(
             "SELECT * FROM pg_cast ca WHERE ca.castsource = "
-            "(SELECT t.oid FROM pg_type t WHERE format_type(t.oid, NULL)='%s') "
+            "(SELECT t.oid FROM pg_type t "
+            "WHERE format_type(t.oid, NULL)='%s') "
             "AND ca.casttarget = (SELECT t.oid FROM pg_type t WHERE "
             "format_type(t.oid, NULL) = '%s')" % (source_type, target_type))
         if pg_cursor.fetchall():
diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
index 33ef894..1fa8b26 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
@@ -30,7 +30,8 @@ class EventTriggerModule(CollectionNodeModule):
     """
     class EventTriggerModule(CollectionNodeModule)
 
-        A module class for Event trigger node derived from CollectionNodeModule.
+        A module class for Event trigger node derived from
+        CollectionNodeModule.
 
     Methods:
     -------
@@ -51,7 +52,8 @@ class EventTriggerModule(CollectionNodeModule):
 
     def __init__(self, *args, **kwargs):
         """
-        Method is used to initialize the EventTriggerModule and it's base module.
+        Method is used to initialize the EventTriggerModule and it's base
+        module.
 
         Args:
             *args:
@@ -184,9 +186,12 @@ class EventTriggerView(PGChildNodeView):
         @wraps(f)
         def wrap(*args, **kwargs):
 
-            # Here - args[0] will always hold self & kwargs will hold gid, sid, did
+            # Here - args[0] will always hold self & kwargs will hold gid,
+            # sid, did
             self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
+            self.manager = get_driver(
+                PG_DEFAULT_DRIVER
+            ).connection_manager(kwargs['sid'])
             self.conn = self.manager.connection(did=kwargs['did'])
             self.template_path = 'event_triggers/sql/9.3_plus'
 
@@ -222,8 +227,8 @@ class EventTriggerView(PGChildNodeView):
     @check_precondition
     def nodes(self, gid, sid, did):
         """
-        This function is used to create all the child nodes within the collection.
-        Here it will create all the event trigger nodes.
+        This function is used to create all the child nodes within the
+        collection. Here it will create all the event trigger nodes.
 
         Args:
           gid: Server Group ID
@@ -318,7 +323,10 @@ class EventTriggerView(PGChildNodeView):
         Returns:
 
         """
-        sql = render_template("/".join([self.template_path, 'properties.sql']), etid=etid, conn=self.conn)
+        sql = render_template(
+            "/".join([self.template_path, 'properties.sql']),
+            etid=etid, conn=self.conn
+        )
         status, res = self.conn.execute_dict(sql)
         if not status:
             return internal_server_error(errormsg=res)
@@ -374,18 +382,27 @@ class EventTriggerView(PGChildNodeView):
                 )
             )
         try:
-            sql = render_template("/".join([self.template_path, 'create.sql']), data=data, conn=self.conn)
+            sql = render_template(
+                "/".join([self.template_path, 'create.sql']),
+                data=data, conn=self.conn
+            )
             status, res = self.conn.execute_scalar(sql)
             if not status:
                 return internal_server_error(errormsg=res)
-            sql = render_template("/".join([self.template_path, 'grant.sql']), data=data, conn=self.conn)
+            sql = render_template(
+                "/".join([self.template_path, 'grant.sql']),
+                data=data, conn=self.conn
+            )
             sql = sql.strip('\n').strip(' ')
 
             status, res = self.conn.execute_scalar(sql)
             if not status:
                 return internal_server_error(errormsg=res)
 
-            sql = render_template("/".join([self.template_path, 'get_oid.sql']), data=data)
+            sql = render_template(
+                "/".join([self.template_path, 'get_oid.sql']),
+                data=data
+            )
             status, etid = self.conn.execute_scalar(sql)
             if not status:
                 return internal_server_error(errormsg=etid)
@@ -431,7 +448,10 @@ class EventTriggerView(PGChildNodeView):
                 if not status:
                     return internal_server_error(errormsg=res)
 
-                sql = render_template("/".join([self.template_path, 'get_oid.sql']), data=data)
+                sql = render_template(
+                    "/".join([self.template_path, 'get_oid.sql']),
+                    data=data
+                )
                 status, etid = self.conn.execute_scalar(sql)
 
                 return jsonify(
@@ -478,7 +498,10 @@ class EventTriggerView(PGChildNodeView):
         else:
             cascade = False
         try:
-            sql = render_template("/".join([self.template_path, 'delete.sql']), etid=etid)
+            sql = render_template(
+                "/".join([self.template_path, 'delete.sql']),
+                etid=etid
+            )
             status, name = self.conn.execute_scalar(sql)
             if not status:
                 return internal_server_error(errormsg=name)
@@ -495,7 +518,10 @@ class EventTriggerView(PGChildNodeView):
                     )
                 )
 
-            sql = render_template("/".join([self.template_path, 'delete.sql']), name=name, cascade=cascade)
+            sql = render_template(
+                "/".join([self.template_path, 'delete.sql']),
+                name=name, cascade=cascade
+            )
             status, res = self.conn.execute_scalar(sql)
             if not status:
                 return internal_server_error(errormsg=res)
@@ -568,7 +594,10 @@ class EventTriggerView(PGChildNodeView):
         ]
 
         if etid is not None:
-            sql = render_template("/".join([self.template_path, 'properties.sql']), etid=etid)
+            sql = render_template(
+                "/".join([self.template_path, 'properties.sql']),
+                etid=etid
+            )
             status, res = self.conn.execute_dict(sql)
             if not status:
                 return internal_server_error(errormsg=res)
@@ -584,7 +613,10 @@ class EventTriggerView(PGChildNodeView):
             for arg in required_args:
                 if arg not in data:
                     data[arg] = old_data[arg]
-            sql = render_template("/".join([self.template_path, 'update.sql']), data=data, o_data=old_data)
+            sql = render_template(
+                "/".join([self.template_path, 'update.sql']),
+                data=data, o_data=old_data
+            )
         else:
             required_args = {
                 'name': 'Name',
@@ -605,16 +637,22 @@ class EventTriggerView(PGChildNodeView):
                         "Could not find the required parameter %s." % err
                     )
                 )
-            sql = render_template("/".join([self.template_path, 'create.sql']), data=data)
+            sql = render_template(
+                "/".join([self.template_path, 'create.sql']),
+                data=data
+            )
             sql += "\n"
-            sql += render_template("/".join([self.template_path, 'grant.sql']), data=data)
+            sql += render_template(
+                "/".join([self.template_path, 'grant.sql']),
+                data=data
+            )
         return sql
 
     @check_precondition
     def sql(self, gid, sid, did, etid):
         """
-        This function will generate sql to show in the sql pane for the selected
-        event trigger node.
+        This function will generate sql to show in the sql pane for the
+        selected event trigger node.
 
         Args:
           gid: Server Group ID
@@ -625,7 +663,10 @@ class EventTriggerView(PGChildNodeView):
         Returns:
 
         """
-        sql = render_template("/".join([self.template_path, 'properties.sql']), etid=etid)
+        sql = render_template(
+            "/".join([self.template_path, 'properties.sql']),
+            etid=etid
+        )
         status, res = self.conn.execute_dict(sql)
         if not status:
             return internal_server_error(errormsg=res)
@@ -638,16 +679,27 @@ class EventTriggerView(PGChildNodeView):
         result = res['rows'][0]
         result = self._formatter(result)
 
-        sql = render_template("/".join([self.template_path, 'create.sql']), data=result, conn=self.conn)
+        sql = render_template(
+            "/".join([self.template_path, 'create.sql']),
+            data=result, conn=self.conn
+        )
         sql += "\n\n"
-        sql += render_template("/".join([self.template_path, 'grant.sql']), data=result, conn=self.conn)
+        sql += render_template(
+            "/".join([self.template_path, 'grant.sql']),
+            data=result, conn=self.conn
+        )
 
-        db_sql = render_template("/".join([self.template_path, 'get_db.sql']), did=did)
+        db_sql = render_template(
+            "/".join([self.template_path, 'get_db.sql']),
+            did=did
+        )
         status, db_name = self.conn.execute_scalar(db_sql)
         if not status:
             return internal_server_error(errormsg=db_name)
 
-        sql_header = u"-- Event Trigger: {0} on database {1}\n\n-- ".format(result['name'], db_name)
+        sql_header = u"-- Event Trigger: {0} on database {1}\n\n-- ".format(
+            result['name'], db_name
+        )
 
         sql_header += render_template(
             "/".join([self.template_path, 'delete.sql']),
@@ -675,7 +727,9 @@ class EventTriggerView(PGChildNodeView):
 
         """
         res = [{'label': '', 'value': ''}]
-        sql = render_template("/".join([self.template_path, 'eventfunctions.sql']))
+        sql = render_template(
+            "/".join([self.template_path, 'eventfunctions.sql'])
+        )
         status, rest = self.conn.execute_2darray(sql)
         if not status:
             return internal_server_error(errormsg=rest)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/tests/test_event_trigger_get.py b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/tests/test_event_trigger_get.py
index 647e6b1..b07e7d5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/tests/test_event_trigger_get.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/tests/test_event_trigger_get.py
@@ -77,10 +77,11 @@ class EventTriggerGetTestCase(BaseTestGenerator):
         if not func_response:
             raise Exception("Could not find the trigger function.")
         response = self.tester.get(
-            self.url + str(utils.SERVER_GROUP) + '/'
-            + str(self.server_id) + '/' + str(self.db_id) + '/' +
-            str(self.event_trigger_id),
-            content_type='html/json')
+            self.url +
+            str(utils.SERVER_GROUP) + '/' + str(self.server_id) + '/' +
+            str(self.db_id) + '/' + str(self.event_trigger_id),
+            content_type='html/json'
+        )
         self.assertEquals(response.status_code, 200)
 
     def tearDown(self):
diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
index abb9631..abef0d2 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
@@ -78,8 +78,8 @@ class ExtensionModule(CollectionNodeModule):
     @property
     def script_load(self):
         """
-        Load the module script for extension, when any of the database nodes are
-        initialized.
+        Load the module script for extension, when any of the database nodes
+        are initialized.
         """
         return databases.DatabaseModule.NODE_TYPE
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
index a516d1e..90acae3 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
@@ -90,7 +90,8 @@ class LanguageModule(CollectionNodeModule):
     @property
     def script_load(self):
         """
-        Load the module script for language, when any of the database nodes are initialized.
+        Load the module script for language, when any of the database nodes
+        are initialized.
 
         Returns: node type of the server module.
         """
@@ -112,9 +113,9 @@ class LanguageView(PGChildNodeView):
     """
     class LanguageView(PGChildNodeView)
 
-        A view class for Language node derived from PGChildNodeView. This class is
-        responsible for all the stuff related to view like updating language
-        node, showing properties, showing sql in sql pane.
+        A view class for Language node derived from PGChildNodeView.
+        This class is responsible for all the stuff related to view like
+        updating language node, showing properties, showing sql in sql pane.
 
     Methods:
     -------
@@ -127,11 +128,12 @@ class LanguageView(PGChildNodeView):
         manager,conn & template_path properties to self
 
     * list()
-      - This function is used to list all the language nodes within that collection.
+      - This function is used to list all the language nodes within that
+      collection.
 
     * nodes()
-      - This function will used to create all the child node within that collection.
-        Here it will create all the language node.
+      - This function will used to create all the child node within that
+      collection. Here it will create all the language node.
 
     * properties(gid, sid, did, lid)
       - This function will show the properties of the selected language node
@@ -146,25 +148,30 @@ class LanguageView(PGChildNodeView):
       - This function will delete the selected language node
 
     * msql(gid, sid, did, lid)
-      - This function is used to return modified SQL for the selected language node
+      - This function is used to return modified SQL for the selected
+      language node
 
     * get_sql(data, lid)
       - This function will generate sql from model data
 
     * get_functions(gid, sid, did)
-      - This function returns the handler and inline functions for the selected language node
+      - This function returns the handler and inline functions for the
+      selected language node
 
     * get_templates(gid, sid, did)
       - This function returns language templates.
 
     * sql(gid, sid, did, lid):
-      - This function will generate sql to show it in sql pane for the selected language node.
+      - This function will generate sql to show it in sql pane for the
+      selected language node.
 
     * dependents(gid, sid, did, lid):
-      - This function get the dependents and return ajax response for the language node.
+      - This function get the dependents and return ajax response for the
+      language node.
 
     * dependencies(self, gid, sid, did, lid):
-      - This function get the dependencies and return ajax response for the language node.
+      - This function get the dependencies and return ajax response for the
+      language node.
     """
 
     node_type = blueprint.node_type
@@ -197,7 +204,8 @@ class LanguageView(PGChildNodeView):
     def _init_(self, **kwargs):
         """
         Method is used to initialize the LanguageView and its base view.
-        Initialize all the variables create/used dynamically like conn, template_path.
+        Initialize all the variables create/used dynamically like conn,
+        template_path.
 
         Args:
             **kwargs:
@@ -223,9 +231,11 @@ class LanguageView(PGChildNodeView):
             self.manager = self.driver.connection_manager(kwargs['sid'])
             self.conn = self.manager.connection(did=kwargs['did'])
             # Set the template path for the SQL scripts
-            self.template_path = ("languages/sql/#gpdb#{0}#".format(self.manager.version)
-                                if self.manager.server_type == 'gpdb'
-                                else "languages/sql/#{0}#".format(self.manager.version))
+            self.template_path = (
+                "languages/sql/#gpdb#{0}#".format(self.manager.version) if
+                self.manager.server_type == 'gpdb' else
+                "languages/sql/#{0}#".format(self.manager.version)
+            )
 
             return f(*args, **kwargs)
 
@@ -234,7 +244,8 @@ class LanguageView(PGChildNodeView):
     @check_precondition
     def list(self, gid, sid, did):
         """
-        This function is used to list all the language nodes within that collection.
+        This function is used to list all the language nodes within that
+        collection.
 
         Args:
             gid: Server Group ID
@@ -254,8 +265,8 @@ class LanguageView(PGChildNodeView):
     @check_precondition
     def nodes(self, gid, sid, did):
         """
-        This function is used to create all the child nodes within the collection.
-        Here it will create all the language nodes.
+        This function is used to create all the child nodes within the
+        collection. Here it will create all the language nodes.
 
         Args:
             gid: Server Group ID
@@ -323,7 +334,10 @@ class LanguageView(PGChildNodeView):
             did: Database ID
             lid: Language ID
         """
-        sql = render_template("/".join([self.template_path, 'properties.sql']), lid=lid)
+        sql = render_template(
+            "/".join([self.template_path, 'properties.sql']),
+            lid=lid
+        )
         status, res = self.conn.execute_dict(sql)
 
         if not status:
@@ -334,7 +348,10 @@ class LanguageView(PGChildNodeView):
                 gettext("Could not find the language information.")
             )
 
-        sql = render_template("/".join([self.template_path, 'acl.sql']), lid=lid)
+        sql = render_template(
+            "/".join([self.template_path, 'acl.sql']),
+            lid=lid
+        )
         status, result = self.conn.execute_dict(sql)
         if not status:
             return internal_server_error(errormsg=result)
@@ -344,7 +361,13 @@ class LanguageView(PGChildNodeView):
             res['rows'][0]['lanacl'] = dict()
             res['rows'][0]['lanacl']['grantee'] = 'PUBLIC'
             res['rows'][0]['lanacl']['grantor'] = res['rows'][0]['lanowner']
-            res['rows'][0]['lanacl']['privileges'] = [{'privilege_type': 'U', 'privilege': True, 'with_grant': False}]
+            res['rows'][0]['lanacl']['privileges'] = [
+                {
+                    'privilege_type': 'U',
+                    'privilege': True,
+                    'with_grant': False
+                }
+            ]
         else:
             for row in result['rows']:
                 priv = parse_priv_from_db(row)
@@ -354,7 +377,8 @@ class LanguageView(PGChildNodeView):
                     res['rows'][0][row['deftype']] = [priv]
 
         seclabels = []
-        if 'seclabels' in res['rows'][0] and res['rows'][0]['seclabels'] is not None:
+        if 'seclabels' in res['rows'][0] and \
+                res['rows'][0]['seclabels'] is not None:
             import re
             for sec in res['rows'][0]['seclabels']:
                 sec = re.search(r'([^=]+)=(.*$)', sec)
@@ -443,8 +467,10 @@ class LanguageView(PGChildNodeView):
             if not status:
                 return internal_server_error(errormsg=res)
 
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
-                                  lanname=data['name'], conn=self.conn)
+            sql = render_template(
+                "/".join([self.template_path, 'properties.sql']),
+                lanname=data['name'], conn=self.conn
+            )
 
             status, r_set = self.conn.execute_dict(sql)
             if not status:
@@ -482,15 +508,20 @@ class LanguageView(PGChildNodeView):
 
         try:
             # Get name for language from lid
-            sql = render_template("/".join([self.template_path, 'delete.sql']), lid=lid, conn=self.conn)
+            sql = render_template(
+                "/".join([self.template_path, 'delete.sql']),
+                lid=lid, conn=self.conn
+            )
             status, lname = self.conn.execute_scalar(sql)
 
             if not status:
                 return internal_server_error(errormsg=lname)
 
             # drop language
-            sql = render_template("/".join([self.template_path, 'delete.sql']), lname=lname,
-                                  cascade=cascade, conn=self.conn)
+            sql = render_template(
+                "/".join([self.template_path, 'delete.sql']),
+                lname=lname, cascade=cascade, conn=self.conn
+            )
             status, res = self.conn.execute_scalar(sql)
 
             if not status:
@@ -513,7 +544,8 @@ class LanguageView(PGChildNodeView):
     @check_precondition
     def msql(self, gid, sid, did, lid=None):
         """
-        This function is used to return modified SQL for the selected language node.
+        This function is used to return modified SQL for the selected
+        language node.
 
         Args:
             gid: Server Group ID
@@ -538,7 +570,7 @@ class LanguageView(PGChildNodeView):
             return make_json_response(
                 data=sql,
                 status=200
-                )
+            )
         except Exception as e:
             return internal_server_error(errormsg=str(e))
 
@@ -555,7 +587,9 @@ class LanguageView(PGChildNodeView):
         ]
 
         if lid is not None:
-            sql = render_template("/".join([self.template_path, 'properties.sql']), lid=lid)
+            sql = render_template(
+                "/".join([self.template_path, 'properties.sql']), lid=lid
+            )
             status, res = self.conn.execute_dict(sql)
             if not status:
                 return internal_server_error(errormsg=res)
@@ -568,19 +602,28 @@ class LanguageView(PGChildNodeView):
             for key in ['lanacl']:
                 if key in data and data[key] is not None:
                     if 'added' in data[key]:
-                        data[key]['added'] = parse_priv_to_db(data[key]['added'], ["U"])
+                        data[key]['added'] = parse_priv_to_db(
+                            data[key]['added'], ["U"]
+                        )
                     if 'changed' in data[key]:
-                        data[key]['changed'] = parse_priv_to_db(data[key]['changed'], ["U"])
+                        data[key]['changed'] = parse_priv_to_db(
+                            data[key]['changed'], ["U"]
+                        )
                     if 'deleted' in data[key]:
-                        data[key]['deleted'] = parse_priv_to_db(data[key]['deleted'], ["U"])
+                        data[key]['deleted'] = parse_priv_to_db(
+                            data[key]['deleted'], ["U"]
+                        )
 
             old_data = res['rows'][0]
             for arg in required_args:
                 if arg not in data:
                     data[arg] = old_data[arg]
-            sql = render_template("/".join([self.template_path, 'update.sql']), data=data,
-                                  o_data=old_data, conn=self.conn)
-            return sql.strip('\n'), data['name'] if 'name' in data else old_data['name']
+            sql = render_template(
+                "/".join([self.template_path, 'update.sql']),
+                data=data, o_data=old_data, conn=self.conn
+            )
+            return sql.strip('\n'), data['name'] if 'name' in data \
+                else old_data['name']
         else:
 
             if 'lanacl' in data:
@@ -590,11 +633,11 @@ class LanguageView(PGChildNodeView):
                                   data=data, conn=self.conn)
             return sql.strip('\n'), data['name']
 
-
     @check_precondition
     def get_functions(self, gid, sid, did):
         """
-        This function returns the handler and inline functions for the selected language node.
+        This function returns the handler and inline functions for the
+        selected language node.
 
         Args:
             gid: Server Group ID
@@ -632,7 +675,8 @@ class LanguageView(PGChildNodeView):
     @check_precondition
     def sql(self, gid, sid, did, lid):
         """
-        This function will generate sql to show in the sql pane for the selected language node.
+        This function will generate sql to show in the sql pane for the
+        selected language node.
 
         Args:
             gid: Server Group ID
@@ -640,7 +684,10 @@ class LanguageView(PGChildNodeView):
             did: Database ID
             lid: Language ID
         """
-        sql = render_template("/".join([self.template_path, 'properties.sql']), lid=lid)
+        sql = render_template(
+            "/".join([self.template_path, 'properties.sql']),
+            lid=lid
+        )
         status, res = self.conn.execute_dict(sql)
         if not status:
             return internal_server_error(errormsg=res)
@@ -653,7 +700,10 @@ class LanguageView(PGChildNodeView):
         # Making copy of output for future use
         old_data = dict(res['rows'][0])
 
-        sql = render_template("/".join([self.template_path, 'acl.sql']), lid=lid)
+        sql = render_template(
+            "/".join([self.template_path, 'acl.sql']),
+            lid=lid
+        )
         status, result = self.conn.execute_dict(sql)
         if not status:
             return internal_server_error(errormsg=result)
@@ -676,7 +726,10 @@ class LanguageView(PGChildNodeView):
                 })
 
         old_data['seclabels'] = seclabels
-        sql = render_template("/".join([self.template_path, 'sqlpane.sql']), data=old_data, conn=self.conn)
+        sql = render_template(
+            "/".join([self.template_path, 'sqlpane.sql']),
+            data=old_data, conn=self.conn
+        )
 
         return ajax_response(response=sql.strip('\n'))
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/test_language_add.py b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/test_language_add.py
index 0f76cc6..4c6f9c0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/test_language_add.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/test_language_add.py
@@ -50,23 +50,21 @@ class LanguagesAddTestCase(BaseTestGenerator):
             "lanval": "fmgr_c_validator",
             "name": "language_%s" % str(uuid.uuid4())[1:8],
             "seclabels": [],
-            "template_list":
-                [
-                    "plperl",
-                    "plperlu",
-                    "plpython2u",
-                    "plpython3u",
-                    "plpythonu",
-                    "pltcl",
-                    "pltclu"
-                ],
+            "template_list": [
+                "plperl",
+                "plperlu",
+                "plpython2u",
+                "plpython3u",
+                "plpythonu",
+                "pltcl",
+                "pltclu"
+            ],
             "trusted": "true"
-                }
+        }
 
         response = self.tester.post(
             self.url + str(utils.SERVER_GROUP) + '/' +
-            str(self.server_id) + '/' + str(
-                self.db_id) + '/',
+            str(self.server_id) + '/' + str(self.db_id) + '/',
             data=json.dumps(self.data),
             content_type='html/json')
 
@@ -76,7 +74,7 @@ class LanguagesAddTestCase(BaseTestGenerator):
         """This function delete added language and
         disconnect the test database."""
 
-        language_utils.delete_language(self.server, self.db_name,
-                                       self.data['name'])
+        language_utils.delete_language(
+            self.server, self.db_name, self.data['name']
+        )
         database_utils.disconnect_database(self, self.server_id, self.db_id)
-


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

* Re: [pgAdmin4][RM#3161] Fix PEP-8 issues
  2018-02-28 18:04 [pgAdmin4][RM#3161] Fix PEP-8 issues Murtuza Zabuawala <[email protected]>
@ 2018-02-28 21:40 ` Joao De Almeida Pereira <[email protected]>
  2018-03-01 05:13   ` Re: [pgAdmin4][RM#3161] Fix PEP-8 issues Murtuza Zabuawala <[email protected]>
  0 siblings, 1 reply; 8+ messages in thread

From: Joao De Almeida Pereira @ 2018-02-28 21:40 UTC (permalink / raw)
  To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers

Hello Murtuza,

I passed the patch through our CI and all test are green. Also run the
codestyle in all those folders and everything is clean.

575 issues to go

Thanks
Joao

On Wed, Feb 28, 2018 at 1:05 PM Murtuza Zabuawala <
[email protected]> wrote:

> Hi,
>
> PFA patch to fix the PEP8 issues in Casts, Event triggers, Extensions and
> Languages module.
>
> pycodestyle --config=.pycodestyle
> pgadmin/browser/server_groups/servers/databases/languages/
> pycodestyle --config=.pycodestyle
> pgadmin/browser/server_groups/servers/databases/extensions/
> pycodestyle --config=.pycodestyle
> pgadmin/browser/server_groups/servers/databases/event_triggers/
> pycodestyle --config=.pycodestyle
> pgadmin/browser/server_groups/servers/databases/casts/
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>


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

* Re: [pgAdmin4][RM#3161] Fix PEP-8 issues
  2018-02-28 18:04 [pgAdmin4][RM#3161] Fix PEP-8 issues Murtuza Zabuawala <[email protected]>
  2018-02-28 21:40 ` Re: [pgAdmin4][RM#3161] Fix PEP-8 issues Joao De Almeida Pereira <[email protected]>
@ 2018-03-01 05:13   ` Murtuza Zabuawala <[email protected]>
  2018-03-02 11:59     ` Re: [pgAdmin4][RM#3161] Fix PEP-8 issues Dave Page <[email protected]>
  0 siblings, 1 reply; 8+ messages in thread

From: Murtuza Zabuawala @ 2018-03-01 05:13 UTC (permalink / raw)
  To: Joao De Almeida Pereira <[email protected]>; +Cc: pgadmin-hackers

Thank you Joao for reviewing.

On Thu, Mar 1, 2018 at 3:10 AM, Joao De Almeida Pereira <
[email protected]> wrote:

> Hello Murtuza,
>
> I passed the patch through our CI and all test are green. Also run the
> codestyle in all those folders and everything is clean.
>
> 575 issues to go
>
> Thanks
> Joao
>
> On Wed, Feb 28, 2018 at 1:05 PM Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> Hi,
>>
>> PFA patch to fix the PEP8 issues in Casts, Event triggers, Extensions and
>> Languages module.
>>
>> pycodestyle --config=.pycodestyle pgadmin/browser/server_groups/
>> servers/databases/languages/
>> pycodestyle --config=.pycodestyle pgadmin/browser/server_groups/
>> servers/databases/extensions/
>> pycodestyle --config=.pycodestyle pgadmin/browser/server_groups/
>> servers/databases/event_triggers/
>> pycodestyle --config=.pycodestyle pgadmin/browser/server_groups/
>> servers/databases/casts/
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>>


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

* Re: [pgAdmin4][RM#3161] Fix PEP-8 issues
  2018-02-28 18:04 [pgAdmin4][RM#3161] Fix PEP-8 issues Murtuza Zabuawala <[email protected]>
  2018-02-28 21:40 ` Re: [pgAdmin4][RM#3161] Fix PEP-8 issues Joao De Almeida Pereira <[email protected]>
  2018-03-01 05:13   ` Re: [pgAdmin4][RM#3161] Fix PEP-8 issues Murtuza Zabuawala <[email protected]>
@ 2018-03-02 11:59     ` Dave Page <[email protected]>
  0 siblings, 0 replies; 8+ messages in thread

From: Dave Page @ 2018-03-02 11:59 UTC (permalink / raw)
  To: Murtuza Zabuawala <[email protected]>; +Cc: Joao De Almeida Pereira <[email protected]>; pgadmin-hackers

Thanks, applied.

On Thu, Mar 1, 2018 at 5:13 AM, Murtuza Zabuawala <
[email protected]> wrote:

> Thank you Joao for reviewing.
>
> On Thu, Mar 1, 2018 at 3:10 AM, Joao De Almeida Pereira <
> [email protected]> wrote:
>
>> Hello Murtuza,
>>
>> I passed the patch through our CI and all test are green. Also run the
>> codestyle in all those folders and everything is clean.
>>
>> 575 issues to go
>>
>> Thanks
>> Joao
>>
>> On Wed, Feb 28, 2018 at 1:05 PM Murtuza Zabuawala <
>> [email protected]> wrote:
>>
>>> Hi,
>>>
>>> PFA patch to fix the PEP8 issues in Casts, Event triggers, Extensions
>>> and Languages module.
>>>
>>> pycodestyle --config=.pycodestyle pgadmin/browser/server_groups/
>>> servers/databases/languages/
>>> pycodestyle --config=.pycodestyle pgadmin/browser/server_groups/
>>> servers/databases/extensions/
>>> pycodestyle --config=.pycodestyle pgadmin/browser/server_groups/
>>> servers/databases/event_triggers/
>>> pycodestyle --config=.pycodestyle pgadmin/browser/server_groups/
>>> servers/databases/casts/
>>>
>>> --
>>> Regards,
>>> Murtuza Zabuawala
>>> EnterpriseDB: 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] 8+ messages in thread

* [pgAdmin4][RM#3175] Fix PEP-8 issues
@ 2018-03-05 12:08 Murtuza Zabuawala <[email protected]>
  2018-03-05 15:28 ` Re: [pgAdmin4][RM#3175] Fix PEP-8 issues Joao De Almeida Pereira <[email protected]>
  0 siblings, 1 reply; 8+ messages in thread

From: Murtuza Zabuawala @ 2018-03-05 12:08 UTC (permalink / raw)
  To: pgadmin-hackers

Hi,

PFA patch to fix PEP8 issues in Browser & Database modules,
pycodestyle --config=.pycodestyle pgadmin/browser/__init__.py
pycodestyle --config=.pycodestyle pgadmin/browser/tests/
pycodestyle --config=.pycodestyle
pgadmin/browser/server_groups/servers/databases/__init__.py
pycodestyle --config=.pycodestyle
pgadmin/browser/server_groups/servers/databases/tests/



--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Attachments:

  [application/octet-stream] RM_3175.diff (25.5K, 3-RM_3175.diff)
  download | inline diff:
diff --git a/web/pgadmin/browser/__init__.py b/web/pgadmin/browser/__init__.py
index ca1edd0..1589677 100644
--- a/web/pgadmin/browser/__init__.py
+++ b/web/pgadmin/browser/__init__.py
@@ -995,10 +995,13 @@ if hasattr(config, 'SECURITY_CHANGEABLE') and config.SECURITY_CHANGEABLE:
             except Exception as e:
                 # Handle other exceptions.
                 logging.exception(str(e), exc_info=True)
-                flash(gettext(u'Error: {}\n'
-                              u'Your password has not been changed.'
-                              ).format(e),
-                      'danger')
+                flash(
+                    gettext(
+                        u'Error: {}\n'
+                        u'Your password has not been changed.'
+                    ).format(e),
+                    'danger'
+                )
                 has_error = True
 
             if request.json is None and not has_error:
@@ -1098,10 +1101,13 @@ if hasattr(config, 'SECURITY_RECOVERABLE') and config.SECURITY_RECOVERABLE:
     # url_for('browser.forgot_password')
     # So hard code the url '/browser/reset_password' while passing as
     # parameter to slash_url_suffix function.
-    @blueprint.route('/reset_password' + slash_url_suffix(
-        '/browser/reset_password', '<token>'),
-                     methods=['GET', 'POST'],
-                     endpoint='reset_password')
+    @blueprint.route(
+        '/reset_password' + slash_url_suffix(
+            '/browser/reset_password', '<token>'
+        ),
+        methods=['GET', 'POST'],
+        endpoint='reset_password'
+    )
     @anonymous_user_required
     def reset_password(token):
         """View function that handles a reset password request."""
diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
index ec29425..3438d45 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
@@ -86,6 +86,7 @@ class DatabaseModule(CollectionNodeModule):
         """
         return False
 
+
 blueprint = DatabaseModule(__name__)
 
 
@@ -105,20 +106,52 @@ class DatabaseView(PGChildNodeView):
             {'get': 'properties', 'delete': 'delete', 'put': 'update'},
             {'get': 'list', 'post': 'create'}
         ],
-        'nodes': [{'get': 'node'}, {'get': 'nodes'}],
-        'get_databases': [{'get': 'get_databases'}, {'get': 'get_databases'}],
-        'sql': [{'get': 'sql'}],
-        'msql': [{'get': 'msql'}, {'get': 'msql'}],
-        'stats': [{'get': 'statistics'}, {'get': 'statistics'}],
-        'dependency': [{'get': 'dependencies'}],
-        'dependent': [{'get': 'dependents'}],
-        'children': [{'get': 'children'}],
-        'connect': [{
-            'get': 'connect_status', 'post': 'connect', 'delete': 'disconnect'
-        }],
-        'get_encodings': [{'get': 'get_encodings'}, {'get': 'get_encodings'}],
-        'get_ctypes': [{'get': 'get_ctypes'}, {'get': 'get_ctypes'}],
-        'vopts': [{}, {'get': 'variable_options'}]
+        'nodes': [
+            {'get': 'node'},
+            {'get': 'nodes'}
+        ],
+        'get_databases': [
+            {'get': 'get_databases'},
+            {'get': 'get_databases'}
+        ],
+        'sql': [
+            {'get': 'sql'}
+        ],
+        'msql': [
+            {'get': 'msql'},
+            {'get': 'msql'}
+        ],
+        'stats': [
+            {'get': 'statistics'},
+            {'get': 'statistics'}
+        ],
+        'dependency': [
+            {'get': 'dependencies'}
+        ],
+        'dependent': [
+            {'get': 'dependents'}
+        ],
+        'children': [
+            {'get': 'children'}
+        ],
+        'connect': [
+            {
+                'get': 'connect_status',
+                'post': 'connect',
+                'delete': 'disconnect'
+            }
+        ],
+        'get_encodings': [
+            {'get': 'get_encodings'},
+            {'get': 'get_encodings'}
+        ],
+        'get_ctypes': [
+            {'get': 'get_ctypes'},
+            {'get': 'get_ctypes'}
+        ],
+        'vopts': [
+            {}, {'get': 'variable_options'}
+        ]
     })
 
     def check_precondition(action=None):
@@ -132,7 +165,11 @@ class DatabaseView(PGChildNodeView):
             @wraps(f)
             def wrapped(self, *args, **kwargs):
 
-                self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
+                self.manager = get_driver(
+                    PG_DEFAULT_DRIVER
+                ).connection_manager(
+                    kwargs['sid']
+                )
                 if self.manager is None:
                     return gone(errormsg="Could not find the server.")
 
@@ -152,7 +189,9 @@ class DatabaseView(PGChildNodeView):
                     self.conn = self.manager.connection()
 
                 # set template path for sql scripts
-                self.template_path = 'databases/sql/#{0}#'.format(self.manager.version)
+                self.template_path = 'databases/sql/#{0}#'.format(
+                    self.manager.version
+                )
 
                 return f(self, *args, **kwargs)
 
@@ -170,12 +209,16 @@ class DatabaseView(PGChildNodeView):
         db_disp_res = None
         params = None
         if self.manager and self.manager.db_res:
-            db_disp_res = ", ".join(['%s'] * len(self.manager.db_res.split(',')))
+            db_disp_res = ", ".join(
+                ['%s'] * len(self.manager.db_res.split(','))
+            )
             params = tuple(self.manager.db_res.split(','))
 
         SQL = render_template(
             "/".join([self.template_path, 'properties.sql']),
-            conn=self.conn, last_system_oid=last_system_oid, db_restrictions=db_disp_res
+            conn=self.conn,
+            last_system_oid=last_system_oid,
+            db_restrictions=db_disp_res
         )
         status, res = self.conn.execute_dict(SQL, params)
 
@@ -191,8 +234,8 @@ class DatabaseView(PGChildNodeView):
         res = []
         last_system_oid = 0 if self.blueprint.show_system_objects or \
             show_system_templates else (
-                (self.manager.db_info[self.manager.did])['datlastsysoid'] \
-                if self.manager.db_info is not None and \
+                (self.manager.db_info[self.manager.did])['datlastsysoid']
+                if self.manager.db_info is not None and
                 self.manager.did in self.manager.db_info else 0
             )
         server_node_res = self.manager
@@ -200,7 +243,9 @@ class DatabaseView(PGChildNodeView):
         db_disp_res = None
         params = None
         if server_node_res and server_node_res.db_res:
-            db_disp_res = ", ".join(['%s']*len(server_node_res.db_res.split(',')))
+            db_disp_res = ", ".join(
+                ['%s'] * len(server_node_res.db_res.split(','))
+            )
             params = tuple(server_node_res.db_res.split(','))
         SQL = render_template(
             "/".join([self.template_path, 'nodes.sql']),
@@ -218,7 +263,7 @@ class DatabaseView(PGChildNodeView):
                 connected = True
                 canDrop = canDisConn = False
             else:
-                conn = self.manager.connection(dbname,did=row['did'])
+                conn = self.manager.connection(dbname, did=row['did'])
                 connected = conn.connected()
                 canDrop = canDisConn = True
 
@@ -281,8 +326,8 @@ class DatabaseView(PGChildNodeView):
                     row['did'],
                     sid,
                     row['name'],
-                    icon="icon-database-not-connected" if not connected \
-                        else "pg-icon-database",
+                    icon="icon-database-not-connected" if not connected
+                    else "pg-icon-database",
                     connected=connected,
                     spcname=row['spcname'],
                     allowConn=row['datallowconn'],
@@ -495,7 +540,8 @@ class DatabaseView(PGChildNodeView):
         if 'datacl' in data:
             data['datacl'] = parse_priv_to_db(data['datacl'], 'DATABASE')
 
-        # The below SQL will execute rest DMLs because we cannot execute CREATE with any other
+        # The below SQL will execute rest DMLs because we cannot execute
+        # CREATE with any other
         SQL = render_template(
             "/".join([self.template_path, 'grant.sql']),
             data=data, conn=self.conn
@@ -547,9 +593,8 @@ class DatabaseView(PGChildNodeView):
         status, errmsg = conn.connect()
         if not status:
             current_app.logger.error(
-                "Could not create database connection for offline updates\nErr: {0}".format(
-                    errmsg
-                )
+                "Could not create database connection for offline updates\n"
+                "Err: {0}".format(errmsg)
             )
             return internal_server_error(errmsg)
 
@@ -594,9 +639,8 @@ class DatabaseView(PGChildNodeView):
 
             if not status:
                 current_app.logger.error(
-                    "Could not connected to database(#{0}).\nError: {1}".format(
-                        did, errmsg
-                    )
+                    "Could not connected to database(#{0}).\n"
+                    "Error: {1}".format(did, errmsg)
                 )
                 return internal_server_error(errmsg)
 
@@ -783,9 +827,10 @@ class DatabaseView(PGChildNodeView):
                 )
 
         SQL_acl = render_template(
-                    "/".join([self.template_path, 'grant.sql']),
-                    data=data, conn=self.conn
-                )
+            "/".join([self.template_path, 'grant.sql']),
+            data=data,
+            conn=self.conn
+        )
 
         SQL = render_template(
             "/".join([self.template_path, 'create.sql']),
@@ -867,14 +912,21 @@ class DatabaseView(PGChildNodeView):
         db_disp_res = None
         params = None
         if self.manager and self.manager.db_res:
-            db_disp_res = ", ".join(['%s'] * len(self.manager.db_res.split(',')))
+            db_disp_res = ", ".join(
+                ['%s'] * len(self.manager.db_res.split(','))
+            )
             params = tuple(self.manager.db_res.split(','))
 
         conn = self.manager.connection()
-        status, res = conn.execute_dict(render_template(
-            "/".join([self.template_path, 'stats.sql']),
-            did=did, conn=conn, last_system_oid=last_system_oid, db_restrictions=db_disp_res
-            ),params
+        status, res = conn.execute_dict(
+            render_template(
+                "/".join([self.template_path, 'stats.sql']),
+                did=did,
+                conn=conn,
+                last_system_oid=last_system_oid,
+                db_restrictions=db_disp_res
+            ),
+            params
         )
 
         if not status:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/tests/test_db_add.py b/web/pgadmin/browser/server_groups/servers/databases/tests/test_db_add.py
index 144a456..20462fd 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/tests/test_db_add.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/tests/test_db_add.py
@@ -60,4 +60,3 @@ class DatabaseAddTestCase(BaseTestGenerator):
                                              self.server['host'],
                                              self.server['port'])
         utils.drop_database(connection, self.db_name)
-
diff --git a/web/pgadmin/browser/server_groups/servers/databases/tests/utils.py b/web/pgadmin/browser/server_groups/servers/databases/tests/utils.py
index 795d0a2..4024336 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/tests/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/tests/utils.py
@@ -17,81 +17,60 @@ DATABASE_CONNECT_URL = '/browser/database/connect/'
 
 
 def get_db_data(db_owner):
-    """
-    This function returns the database details in dict format
-    """
+    """This function returns the database details in dict format"""
     data = {
         "datconnlimit": -1,
         "datowner": db_owner,
-        "deffuncacl": [
-      {
-        "grantee": db_owner,
-        "grantor": db_owner,
-        "privileges": [
-          {
-            "privilege_type": "X",
-            "privilege": True,
-            "with_grant": False
-          }
-        ]
-      }
-    ],
-        "defseqacl": [
-      {
-        "grantee": db_owner,
-        "grantor": db_owner,
-        "privileges": [
-          {
-            "privilege_type": "r",
-            "privilege": True,
-            "with_grant": False
-          },
-          {
-            "privilege_type": "w",
-            "privilege": True,
-            "with_grant": False
-          },
-          {
-            "privilege_type": "U",
-            "privilege": True,
-            "with_grant": False
-          }
-        ]
-      }
-    ],
-        "deftblacl": [
-      {
-        "grantee": db_owner,
-        "grantor": db_owner,
-        "privileges": [
-          {
-            "privilege_type": "a",
-            "privilege": True,
-            "with_grant": True
-          },
-          {
-            "privilege_type": "r",
-            "privilege": True,
-            "with_grant": False
-          }
-        ]
-      }
-    ],
-        "deftypeacl": [
-      {
-        "grantee": db_owner,
-        "grantor": db_owner,
-        "privileges": [
-          {
-            "privilege_type": "U",
-            "privilege": True,
-            "with_grant": False
-          }
-        ]
-      }
-    ],
+        "deffuncacl": [{
+            "grantee": db_owner,
+            "grantor": db_owner,
+            "privileges": [{
+                "privilege_type": "X",
+                "privilege": True,
+                "with_grant": False
+            }]
+        }],
+        "defseqacl": [{
+            "grantee": db_owner,
+            "grantor": db_owner,
+            "privileges": [{
+                "privilege_type": "r",
+                "privilege": True,
+                "with_grant": False
+            }, {
+                "privilege_type": "w",
+                "privilege": True,
+                "with_grant": False
+            }, {
+                "privilege_type": "U",
+                "privilege": True,
+                "with_grant": False
+            }]
+        }],
+        "deftblacl": [{
+            "grantee": db_owner,
+            "grantor": db_owner,
+            "privileges": [{
+                "privilege_type": "a",
+                "privilege": True,
+                "with_grant": True
+            }, {
+                "privilege_type": "r",
+                "privilege": True,
+                "with_grant": False
+            }]
+        }],
+        "deftypeacl": [{
+            "grantee": db_owner,
+            "grantor": db_owner,
+            "privileges": [{
+                "privilege_type": "U",
+                "privilege": True,
+                "with_grant": False
+            }]
+        }],
         "encoding": "UTF8",
-        "name": "db_add_%s" % str(uuid.uuid4())[1:8],
+        "name": "db_add_%s" % str(uuid.uuid4())[1: 8],
         "privileges": [],
         "securities": [],
         "variables": []
@@ -105,7 +84,9 @@ def create_database(connection, db_name):
         old_isolation_level = connection.isolation_level
         connection.set_isolation_level(0)
         pg_cursor = connection.cursor()
-        pg_cursor.execute('''CREATE DATABASE "%s" TEMPLATE template0''' % db_name)
+        pg_cursor.execute(
+            '''CREATE DATABASE "%s" TEMPLATE template0''' % db_name
+        )
         connection.set_isolation_level(old_isolation_level)
         connection.commit()
         return pg_cursor
@@ -134,9 +115,15 @@ def connect_database(self, server_group, server_id, db_id):
     server_utils.connect_server(self, server_id)
 
     # Connect to database
-    db_con = self.tester.post('{0}{1}/{2}/{3}'.format(
-        DATABASE_CONNECT_URL, server_group, server_id, db_id),
-        follow_redirects=True)
+    db_con = self.tester.post(
+        '{0}{1}/{2}/{3}'.format(
+            DATABASE_CONNECT_URL,
+            server_group,
+            server_id,
+            db_id
+        ),
+        follow_redirects=True
+    )
     assert db_con.status_code == 200
     db_con = json.loads(db_con.data.decode('utf-8'))
     return db_con
@@ -144,7 +131,13 @@ def connect_database(self, server_group, server_id, db_id):
 
 def disconnect_database(self, server_id, db_id):
     """This function disconnect the db"""
-    db_con = self.tester.delete('{0}{1}/{2}/{3}'.format(
-        'browser/database/connect/', utils.SERVER_GROUP, server_id, db_id),
-        follow_redirects=True)
+    db_con = self.tester.delete(
+        '{0}{1}/{2}/{3}'.format(
+            'browser/database/connect/',
+            utils.SERVER_GROUP,
+            server_id,
+            db_id
+        ),
+        follow_redirects=True
+    )
     assert db_con.status_code == 200
diff --git a/web/pgadmin/browser/server_groups/servers/databases/utils.py b/web/pgadmin/browser/server_groups/servers/databases/utils.py
index e28c161..27d4d9a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/utils.py
@@ -76,7 +76,10 @@ def parse_variables_from_db(db_variables):
                     if var_value == 'false' or var_value == 'off':
                         var_value = False
 
-                    var_dict = {'name': var_name, 'value': var_value}
+                    var_dict = {
+                        'name': var_name,
+                        'value': var_value
+                    }
                     if 'user_name' in row:
                         var_dict['role'] = row['user_name']
                     if 'db_name' in row:
diff --git a/web/pgadmin/browser/tests/test_change_password.py b/web/pgadmin/browser/tests/test_change_password.py
index 6ea2573..e34e1c0 100644
--- a/web/pgadmin/browser/tests/test_change_password.py
+++ b/web/pgadmin/browser/tests/test_change_password.py
@@ -84,16 +84,28 @@ class ChangePasswordTestCase(BaseTestGenerator):
         # Check for 'valid_password' exists in self to test 'valid password'
         # test case
         if 'valid_password' in dir(self):
-            response = self.tester.post('/user_management/user/', data=dict(
-                email=self.username, newPassword=self.password,
-                confirmPassword=self.password, active=1, role="2"),
-                                        follow_redirects=True)
+            response = self.tester.post(
+                '/user_management/user/',
+                data=dict(
+                    email=self.username,
+                    newPassword=self.password,
+                    confirmPassword=self.password,
+                    active=1,
+                    role="2"
+                ),
+                follow_redirects=True
+            )
             user_id = json.loads(response.data.decode('utf-8'))['id']
             # Logout the Administrator before login normal user
             test_utils.logout_tester_account(self.tester)
-            response = self.tester.post('/login', data=dict(
-                email=self.username, password=self.password),
-                                        follow_redirects=True)
+            response = self.tester.post(
+                '/login',
+                data=dict(
+                    email=self.username,
+                    password=self.password
+                ),
+                follow_redirects=True
+            )
             self.assertEquals(response.status_code, 200)
             # test the 'change password' test case
             utils.change_password(self)
@@ -103,7 +115,8 @@ class ChangePasswordTestCase(BaseTestGenerator):
             test_utils.login_tester_account(self.tester)
             response = self.tester.delete(
                 '/user_management/user/' + str(user_id),
-                follow_redirects=True)
+                follow_redirects=True
+            )
             self.assertEquals(response.status_code, 200)
         else:
             utils.change_password(self)
diff --git a/web/pgadmin/browser/tests/test_login.py b/web/pgadmin/browser/tests/test_login.py
index 9cdb172..3331b68 100644
--- a/web/pgadmin/browser/tests/test_login.py
+++ b/web/pgadmin/browser/tests/test_login.py
@@ -82,10 +82,14 @@ class LoginTestCase(BaseTestGenerator):
 
     def runTest(self):
         """This function checks login functionality."""
-
-        response = self.tester.post('/login', data=dict(
-            email=self.email, password=self.password),
-                                    follow_redirects=True)
+        response = self.tester.post(
+            '/login',
+            data=dict(
+                email=self.email,
+                password=self.password
+            ),
+            follow_redirects=True
+        )
         self.assertTrue(self.respdata in response.data.decode('utf8'))
 
     @classmethod
diff --git a/web/pgadmin/browser/tests/test_version_in_range.py b/web/pgadmin/browser/tests/test_version_in_range.py
index a2c76f0..548b2a0 100644
--- a/web/pgadmin/browser/tests/test_version_in_range.py
+++ b/web/pgadmin/browser/tests/test_version_in_range.py
@@ -7,12 +7,7 @@
 #
 ##########################################################################
 
-import json
-import uuid
-
 from pgadmin.utils.route import BaseTestGenerator
-from regression.python_test_utils import test_utils
-from regression.test_setup import config_data
 from pgadmin.browser.utils import is_version_in_range
 
 
@@ -24,30 +19,45 @@ class VersionInRangeTestCase(BaseTestGenerator):
     """
 
     scenarios = [
-        ('TestCase for Validating pgversion 8.23 and min_version is 91000, should not show', dict(
-            sversion=82300,
-            min_version=90100,
-            max_version=1000000000,
-            scenario=2
-        )),
-        ('TestCase for Validating pgversion 9.2 and should show by default', dict(
-            sversion=90200,
-            min_version=0,
-            max_version=1000000000,
-            scenario=1
-        )),
-        ('TestCase for Validating pgversion 9.2 and min/max are None, should show by default', dict(
-            sversion=90200,
-            min_version=None,
-            max_version=None,
-            scenario=1
-        )),
-        ('TestCase for Validating pgversion 9.6 and max is lower, should not show', dict(
-            sversion=90600,
-            min_version=None,
-            max_version=90400,
-            scenario=2
-        ))
+        (
+            'TestCase for Validating pgversion 8.23 and min_version is 91000, '
+            'should not show',
+            dict(
+                sversion=82300,
+                min_version=90100,
+                max_version=1000000000,
+                scenario=2
+            )
+        ),
+        (
+            'TestCase for Validating pgversion 9.2 and should show by default',
+            dict(
+                sversion=90200,
+                min_version=0,
+                max_version=1000000000,
+                scenario=1
+            )
+        ),
+        (
+            'TestCase for Validating pgversion 9.2 and min/max are None, '
+            'should show by default',
+            dict(
+                sversion=90200,
+                min_version=None,
+                max_version=None,
+                scenario=1
+            )
+        ),
+        (
+            'TestCase for Validating pgversion 9.6 and max is lower, should '
+            'not show',
+            dict(
+                sversion=90600,
+                min_version=None,
+                max_version=90400,
+                scenario=2
+            )
+        )
     ]
 
     @classmethod
@@ -62,7 +72,15 @@ class VersionInRangeTestCase(BaseTestGenerator):
             self.test_result_is_false()
 
     def test_result_is_true(self):
-        self.assertTrue(is_version_in_range(self.sversion, self.min_version, self.max_version))
+        self.assertTrue(
+            is_version_in_range(
+                self.sversion, self.min_version, self.max_version
+            )
+        )
 
     def test_result_is_false(self):
-        self.assertFalse(is_version_in_range(self.sversion, self.min_version, self.max_version))
+        self.assertFalse(
+            is_version_in_range(
+                self.sversion, self.min_version, self.max_version
+            )
+        )
diff --git a/web/pgadmin/browser/tests/utils.py b/web/pgadmin/browser/tests/utils.py
index 5f31b52..aa4bb78 100644
--- a/web/pgadmin/browser/tests/utils.py
+++ b/web/pgadmin/browser/tests/utils.py
@@ -7,14 +7,22 @@
 #
 ##########################################################################
 
+
 def change_password(self):
-    response = self.tester.get('/browser/change_password', follow_redirects=True)
-    self.assertTrue('pgAdmin 4 Password Change' in response.data.decode(
-        'utf-8'))
+    response = self.tester.get(
+        '/browser/change_password', follow_redirects=True
+    )
+    self.assertTrue(
+        'pgAdmin 4 Password Change' in response.data.decode('utf-8')
+    )
 
-    response = self.tester.post('/browser/change_password', data=dict(
-        password=self.password,
-        new_password=self.new_password,
-        new_password_confirm=self.new_password_confirm),
-                                follow_redirects=True)
+    response = self.tester.post(
+        '/browser/change_password',
+        data=dict(
+            password=self.password,
+            new_password=self.new_password,
+            new_password_confirm=self.new_password_confirm
+        ),
+        follow_redirects=True
+    )
     self.assertTrue(self.respdata in response.data.decode('utf-8'))


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

* Re: [pgAdmin4][RM#3175] Fix PEP-8 issues
  2018-03-05 12:08 [pgAdmin4][RM#3175] Fix PEP-8 issues Murtuza Zabuawala <[email protected]>
@ 2018-03-05 15:28 ` Joao De Almeida Pereira <[email protected]>
  2018-03-05 16:23   ` Re: [pgAdmin4][RM#3175] Fix PEP-8 issues Murtuza Zabuawala <[email protected]>
  0 siblings, 1 reply; 8+ messages in thread

From: Joao De Almeida Pereira @ 2018-03-05 15:28 UTC (permalink / raw)
  To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers

Hi Murtuza,

Looks good, and all tests are green. I run the commands provided and
nothing pops up.

Only missing 374 :D

Thanks
Joao

On Mon, Mar 5, 2018 at 7:09 AM Murtuza Zabuawala <
[email protected]> wrote:

> Hi,
>
> PFA patch to fix PEP8 issues in Browser & Database modules,
> pycodestyle --config=.pycodestyle pgadmin/browser/__init__.py
> pycodestyle --config=.pycodestyle pgadmin/browser/tests/
> pycodestyle --config=.pycodestyle
> pgadmin/browser/server_groups/servers/databases/__init__.py
> pycodestyle --config=.pycodestyle
> pgadmin/browser/server_groups/servers/databases/tests/
>
>
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>


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

* Re: [pgAdmin4][RM#3175] Fix PEP-8 issues
  2018-03-05 12:08 [pgAdmin4][RM#3175] Fix PEP-8 issues Murtuza Zabuawala <[email protected]>
  2018-03-05 15:28 ` Re: [pgAdmin4][RM#3175] Fix PEP-8 issues Joao De Almeida Pereira <[email protected]>
@ 2018-03-05 16:23   ` Murtuza Zabuawala <[email protected]>
  2018-03-07 11:48     ` Re: [pgAdmin4][RM#3175] Fix PEP-8 issues Dave Page <[email protected]>
  0 siblings, 1 reply; 8+ messages in thread

From: Murtuza Zabuawala @ 2018-03-05 16:23 UTC (permalink / raw)
  To: Joao De Almeida Pereira <[email protected]>; +Cc: pgadmin-hackers

Thanks Joao for reviewing.


On Mon, Mar 5, 2018 at 8:58 PM, Joao De Almeida Pereira <
[email protected]> wrote:

> Hi Murtuza,
>
> Looks good, and all tests are green. I run the commands provided and
> nothing pops up.
>
> Only missing 374 :D
>
​:-) ​


>
> Thanks
> Joao
>
> On Mon, Mar 5, 2018 at 7:09 AM Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> Hi,
>>
>> PFA patch to fix PEP8 issues in Browser & Database modules,
>> pycodestyle --config=.pycodestyle pgadmin/browser/__init__.py
>> pycodestyle --config=.pycodestyle pgadmin/browser/tests/
>> pycodestyle --config=.pycodestyle pgadmin/browser/server_groups/
>> servers/databases/__init__.py
>> pycodestyle --config=.pycodestyle pgadmin/browser/server_groups/
>> servers/databases/tests/
>>
>>
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>>


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

* Re: [pgAdmin4][RM#3175] Fix PEP-8 issues
  2018-03-05 12:08 [pgAdmin4][RM#3175] Fix PEP-8 issues Murtuza Zabuawala <[email protected]>
  2018-03-05 15:28 ` Re: [pgAdmin4][RM#3175] Fix PEP-8 issues Joao De Almeida Pereira <[email protected]>
  2018-03-05 16:23   ` Re: [pgAdmin4][RM#3175] Fix PEP-8 issues Murtuza Zabuawala <[email protected]>
@ 2018-03-07 11:48     ` Dave Page <[email protected]>
  0 siblings, 0 replies; 8+ messages in thread

From: Dave Page @ 2018-03-07 11:48 UTC (permalink / raw)
  To: Murtuza Zabuawala <[email protected]>; +Cc: Joao De Almeida Pereira <[email protected]>; pgadmin-hackers

Thanks, applied!

On Mon, Mar 5, 2018 at 4:23 PM, Murtuza Zabuawala <
[email protected]> wrote:

> Thanks Joao for reviewing.
>
>
> On Mon, Mar 5, 2018 at 8:58 PM, Joao De Almeida Pereira <
> [email protected]> wrote:
>
>> Hi Murtuza,
>>
>> Looks good, and all tests are green. I run the commands provided and
>> nothing pops up.
>>
>> Only missing 374 :D
>>
> ​:-) ​
>
>
>>
>> Thanks
>> Joao
>>
>> On Mon, Mar 5, 2018 at 7:09 AM Murtuza Zabuawala <
>> [email protected]> wrote:
>>
>>> Hi,
>>>
>>> PFA patch to fix PEP8 issues in Browser & Database modules,
>>> pycodestyle --config=.pycodestyle pgadmin/browser/__init__.py
>>> pycodestyle --config=.pycodestyle pgadmin/browser/tests/
>>> pycodestyle --config=.pycodestyle pgadmin/browser/server_groups/
>>> servers/databases/__init__.py
>>> pycodestyle --config=.pycodestyle pgadmin/browser/server_groups/
>>> servers/databases/tests/
>>>
>>>
>>>
>>> --
>>> Regards,
>>> Murtuza Zabuawala
>>> EnterpriseDB: 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] 8+ messages in thread


end of thread, other threads:[~2018-03-07 11:48 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-02-28 18:04 [pgAdmin4][RM#3161] Fix PEP-8 issues Murtuza Zabuawala <[email protected]>
2018-02-28 21:40 ` Joao De Almeida Pereira <[email protected]>
2018-03-01 05:13   ` Murtuza Zabuawala <[email protected]>
2018-03-02 11:59     ` Dave Page <[email protected]>
2018-03-05 12:08 [pgAdmin4][RM#3175] Fix PEP-8 issues Murtuza Zabuawala <[email protected]>
2018-03-05 15:28 ` Joao De Almeida Pereira <[email protected]>
2018-03-05 16:23   ` Murtuza Zabuawala <[email protected]>
2018-03-07 11:48     ` 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