Subject: [pgAdmin4][Patch]: PEP-8 fixes in the foreign data wrapper module

From: Khushboo Vashi <[email-masked]>
Date: Thu, 1 Mar 2018 18:38:30 +0530

Hi,

Please find the attached patch to fix the PEP-8 issues in the foreign data
wrapper module.

Thanks,
Khushboo
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
index d5a4cc2..401034a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
@@ -33,19 +33,21 @@ class ForeignDataWrapperModule(CollectionNodeModule):
     """
     class ForeignDataWrapperModule(CollectionNodeModule)
 
-        A module class for foreign data wrapper node derived from CollectionNodeModule.
+        A module class for foreign data wrapper node derived
+        from CollectionNodeModule.
 
     Methods:
     -------
     * __init__(*args, **kwargs)
-      - Method is used to initialize the Foreign data wrapper module and it's base module.
+      - Method is used to initialize the Foreign data wrapper
+        module and it's base module.
 
     * get_nodes(gid, sid, did)
       - Method is used to generate the browser collection node.
 
     * script_load()
-      - Load the module script for foreign data wrapper, when any of the database node is
-        initialized.
+      - Load the module script for foreign data wrapper,
+        when any of the database node is initialized.
     """
 
     NODE_TYPE = 'foreign_data_wrapper'
@@ -53,7 +55,8 @@ class ForeignDataWrapperModule(CollectionNodeModule):
 
     def __init__(self, *args, **kwargs):
         """
-        Method is used to initialize the Foreign data wrapper module and it's base module.
+        Method is used to initialize the Foreign data wrapper module
+        and it's base module.
 
         Args:
             *args:
@@ -80,7 +83,8 @@ class ForeignDataWrapperModule(CollectionNodeModule):
     @property
     def script_load(self):
         """
-        Load the module script for foreign data wrapper, when any of the database node is initialized.
+        Load the module script for foreign data wrapper,
+        when any of the database node is initialized.
 
         Returns: node type of the databse module.
         """
@@ -89,8 +93,8 @@ class ForeignDataWrapperModule(CollectionNodeModule):
     @property
     def module_use_template_javascript(self):
         """
-        Returns whether Jinja2 template is used for generating the javascript
-        module.
+        Returns whether Jinja2 template is used for
+        generating the javascript module.
         """
         return False
 
@@ -102,14 +106,16 @@ class ForeignDataWrapperView(PGChildNodeView):
     """
     class ForeignDataWrapperView(PGChildNodeView)
 
-        A view class for foreign data wrapper node derived from PGChildNodeView. This class is
-        responsible for all the stuff related to view like updating foreign data wrapper
+        A view class for foreign data wrapper node derived
+        from PGChildNodeView. This class is responsible for all the
+        stuff related to view like updating foreign data wrapper
         node, showing properties, showing sql in sql pane.
 
     Methods:
     -------
     * __init__(**kwargs)
-      - Method is used to initialize the ForeignDataWrapperView and it's base view.
+      - Method is used to initialize the ForeignDataWrapperView
+        and it's base view.
 
     * check_precondition()
       - This function will behave as a decorator which will checks
@@ -117,14 +123,16 @@ class ForeignDataWrapperView(PGChildNodeView):
         manager,conn & template_path properties to self
 
     * list(gid, sid, did)
-      - This function is used to list all the foreign data wrapper nodes within that collection.
+      - This function is used to list all the foreign data wrapper nodes
+        within that collection.
 
     * nodes(gid, sid, did)
-      - This function will used to create all the child node within that collection.
-        Here it will create all the foreign data wrapper node.
+      - This function will used to create all the child node within that
+        collection. Here it will create all the foreign data wrapper node.
 
     * properties(gid, sid, did, fid)
-      - This function will show the properties of the selected foreign data wrapper node
+      - This function will show the properties of the selected
+        foreign data wrapper node
 
     * create(gid, sid, did)
       - This function will create the new foreign data wrapper node
@@ -133,28 +141,35 @@ class ForeignDataWrapperView(PGChildNodeView):
       - This function will delete the selected foreign data wrapper node
 
     * update(gid, sid, did, fid)
-      - This function will update the data for the selected foreign data wrapper node
+      - This function will update the data for the selected
+        foreign data wrapper node
 
     * msql(gid, sid, did, fid)
-      - This function is used to return modified SQL for the selected foreign data wrapper node
+      - This function is used to return modified SQL for the selected
+        foreign data wrapper node
 
     * get_sql(data, fid)
       - This function will generate sql from model data
 
     * get_validators(gid, sid, did)
-      - This function returns the validators for the selected foreign data wrapper node
+      - This function returns the validators for the selected
+        foreign data wrapper node
 
     * get_handlers(gid, sid, did)
-      - This function returns the handlers for the selected foreign data wrapper node
+      - This function returns the handlers for the selected
+        foreign data wrapper node
 
     * sql(gid, sid, did, fid):
-      - This function will generate sql to show it in sql pane for the selected foreign data wrapper node.
+      - This function will generate sql to show it in sql pane for
+        the selected foreign data wrapper node.
 
     * dependents(gid, sid, did, fid):
-      - This function get the dependents and return ajax response for the foreign data wrapper node.
+      - This function get the dependents and return ajax response for the
+        foreign data wrapper node.
 
     * dependencies(self, gid, sid, did, fid):
-      - This function get the dependencies and return ajax response for the foreign data wrapper node.
+      - This function get the dependencies and return ajax response for the
+        foreign data wrapper node.
     """
 
     node_type = blueprint.node_type
@@ -244,8 +259,8 @@ class ForeignDataWrapperView(PGChildNodeView):
     @check_precondition
     def nodes(self, gid, sid, did):
         """
-        This function will used to create all the child node within that collection.
-        Here it will create all the foreign data wrapper node.
+        This function will used to create all the child node within that
+        collection. Here it will create all the foreign data wrapper node.
 
         Args:
             gid: Server Group ID
@@ -302,12 +317,14 @@ class ForeignDataWrapperView(PGChildNodeView):
                 status=200
             )
 
-        return gone(gettext("Could not find the specified foreign data wrapper."))
+        return gone(gettext("Could not find the specified"
+                            " foreign data wrapper."))
 
     @check_precondition
     def properties(self, gid, sid, did, fid):
         """
-        This function will show the properties of the selected foreign data wrapper node.
+        This function will show the properties of the
+        selected foreign data wrapper node.
 
         Args:
             gid: Server Group ID
@@ -315,7 +332,8 @@ class ForeignDataWrapperView(PGChildNodeView):
             did: Database ID
             fid: foreign data wrapper ID
         """
-        sql = render_template("/".join([self.template_path, 'properties.sql']),
+        sql = render_template("/".join([self.template_path,
+                                        'properties.sql']),
                               fid=fid, conn=self.conn
                               )
         status, res = self.conn.execute_dict(sql)
@@ -325,7 +343,8 @@ class ForeignDataWrapperView(PGChildNodeView):
 
         if len(res['rows']) == 0:
             return gone(
-                gettext("Could not find the foreign data wrapper information.")
+                gettext("Could not find the foreign data"
+                        " wrapper information.")
             )
 
         if res['rows'][0]['fdwoptions'] is not None:
@@ -334,7 +353,9 @@ class ForeignDataWrapperView(PGChildNodeView):
                 'fdwoption', 'fdwvalue'
             )
 
-        sql = render_template("/".join([self.template_path, 'acl.sql']), fid=fid)
+        sql = render_template("/".join([self.template_path, 'acl.sql']),
+                              fid=fid
+                              )
         status, fdw_acl_res = self.conn.execute_dict(sql)
         if not status:
             return internal_server_error(errormsg=fdw_acl_res)
@@ -389,15 +410,18 @@ class ForeignDataWrapperView(PGChildNodeView):
                 )
 
             sql = render_template("/".join([self.template_path, 'create.sql']),
-                                  data=data, conn=self.conn,
+                                  data=data,
+                                  conn=self.conn,
                                   is_valid_options=is_valid_options
                                   )
             status, res = self.conn.execute_dict(sql)
             if not status:
                 return internal_server_error(errormsg=res)
 
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
-                                  fname=data['name'], conn=self.conn
+            sql = render_template("/".join([self.template_path,
+                                            'properties.sql']),
+                                  fname=data['name'],
+                                  conn=self.conn
                                   )
 
             status, r_set = self.conn.execute_dict(sql)
@@ -420,7 +444,8 @@ class ForeignDataWrapperView(PGChildNodeView):
     @check_precondition
     def update(self, gid, sid, did, fid):
         """
-        This function will update the data for the selected foreign data wrapper node.
+        This function will update the data for the selected
+        foreign data wrapper node.
 
         Args:
             gid: Server Group ID
@@ -486,12 +511,15 @@ class ForeignDataWrapperView(PGChildNodeView):
                         'Error: Object not found.'
                     ),
                     info=gettext(
-                        'The specified foreign data wrapper could not be found.\n'
+                        'The specified foreign data'
+                        ' wrapper could not be found.\n'
                     )
                 )
             # drop foreign data wrapper node
-            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,
                                   conn=self.conn)
             status, res = self.conn.execute_scalar(sql)
             if not status:
@@ -514,7 +542,8 @@ class ForeignDataWrapperView(PGChildNodeView):
     @check_precondition
     def msql(self, gid, sid, did, fid=None):
         """
-        This function is used to return modified SQL for the selected foreign data wrapper node.
+        This function is used to return modified SQL for the
+        selected foreign data wrapper node.
 
         Args:
             gid: Server Group ID
@@ -551,7 +580,8 @@ class ForeignDataWrapperView(PGChildNodeView):
             gid: Server Group ID
             sid: Server ID
             did: Database ID
-            data: Contains the data of the selected foreign data wrapper node
+            data: Contains the data of the selected
+                  foreign data wrapper node
             fid: foreign data wrapper ID
         """
         required_args = [
@@ -559,8 +589,10 @@ class ForeignDataWrapperView(PGChildNodeView):
         ]
 
         if fid is not None:
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
-                                  fid=fid, conn=self.conn
+            sql = render_template("/".join([self.template_path,
+                                            'properties.sql']),
+                                  fid=fid,
+                                  conn=self.conn
                                   )
             status, res = self.conn.execute_dict(sql)
             if not status:
@@ -568,7 +600,8 @@ class ForeignDataWrapperView(PGChildNodeView):
 
             if len(res['rows']) == 0:
                 return gone(
-                    gettext("Could not find the foreign data wrapper information.")
+                    gettext("Could not find the foreign"
+                            " data wrapper information.")
                 )
 
             if res['rows'][0]['fdwoptions'] is not None:
@@ -580,33 +613,50 @@ class ForeignDataWrapperView(PGChildNodeView):
             for key in ['fdwacl']:
                 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]
 
-            # Allow user to set the blank value in fdwvalue field in option model
+            # Allow user to set the blank value in fdwvalue
+            # field in option model
             is_valid_added_options = is_valid_changed_options = False
             if 'fdwoptions' in data and 'added' in data['fdwoptions']:
-                is_valid_added_options, data['fdwoptions']['added'] = validate_options(
-                    data['fdwoptions']['added'], 'fdwoption', 'fdwvalue'
-                )
+                is_valid_added_options, data['fdwoptions']['added'] = \
+                    validate_options(
+                        data['fdwoptions']['added'],
+                        'fdwoption', 'fdwvalue'
+                    )
             if 'fdwoptions' in data and 'changed' in data['fdwoptions']:
-                is_valid_changed_options, data['fdwoptions']['changed'] = validate_options(
-                    data['fdwoptions']['changed'], 'fdwoption', 'fdwvalue'
-                )
+                is_valid_changed_options, data['fdwoptions']['changed'] = \
+                    validate_options(
+                        data['fdwoptions']['changed'],
+                        'fdwoption',
+                        'fdwvalue'
+                    )
 
-            sql = render_template("/".join([self.template_path, 'update.sql']),
-                                  data=data, o_data=old_data,
-                                  is_valid_added_options=is_valid_added_options,
-                                  is_valid_changed_options=is_valid_changed_options,
-                                  conn=self.conn
+            sql = render_template(
+                "/".join([self.template_path, 'update.sql']),
+                data=data,
+                o_data=old_data,
+                is_valid_added_options=is_valid_added_options,
+                is_valid_changed_options=is_valid_changed_options,
+                conn=self.conn
             )
             return sql, data['name'] if 'name' in data else old_data['name']
         else:
@@ -614,25 +664,27 @@ class ForeignDataWrapperView(PGChildNodeView):
                 if key in data and data[key] is not None:
                     data[key] = parse_priv_to_db(data[key], ['U'])
 
-            # Allow user to set the blank value in fdwvalue field in option model
+            # Allow user to set the blank value in
+            # fdwvalue field in option model
             is_valid_options = False
             if 'fdwoptions' in data:
                 is_valid_options, data['fdwoptions'] = validate_options(
                     data['fdwoptions'], 'fdwoption', 'fdwvalue'
                 )
 
-            sql = render_template("/".join([self.template_path, 'create.sql']),
+            sql = render_template("/".join([self.template_path,
+                                            'create.sql']),
                                   data=data, conn=self.conn,
                                   is_valid_options=is_valid_options
                                   )
 
         return sql, data['name']
 
-
     @check_precondition
     def sql(self, gid, sid, did, fid):
         """
-        This function will generate sql to show it in sql pane for the selected foreign data wrapper node.
+        This function will generate sql to show it in sql pane
+        for the selected foreign data wrapper node.
 
         Args:
             gid: Server Group ID
@@ -660,7 +712,8 @@ class ForeignDataWrapperView(PGChildNodeView):
             if len(res['rows'][0]['fdwoptions']) > 0:
                 is_valid_options = True
 
-        sql = render_template("/".join([self.template_path, 'acl.sql']), fid=fid)
+        sql = render_template("/".join([self.template_path, 'acl.sql']),
+                              fid=fid)
         status, fdw_acl_res = self.conn.execute_dict(sql)
         if not status:
             return internal_server_error(errormsg=fdw_acl_res)
@@ -674,7 +727,10 @@ class ForeignDataWrapperView(PGChildNodeView):
 
         # To format privileges
         if 'fdwacl' in res['rows'][0]:
-            res['rows'][0]['fdwacl'] = parse_priv_to_db(res['rows'][0]['fdwacl'], ['U'])
+            res['rows'][0]['fdwacl'] = parse_priv_to_db(
+                res['rows'][0]['fdwacl'],
+                ['U']
+            )
 
         sql = ''
         sql = render_template("/".join([self.template_path, 'create.sql']),
@@ -696,7 +752,8 @@ class ForeignDataWrapperView(PGChildNodeView):
     @check_precondition
     def get_validators(self, gid, sid, did):
         """
-        This function returns the validators for the selected foreign data wrapper node.
+        This function returns the validators for the selected
+        foreign data wrapper node.
 
         Args:
             gid: Server Group ID
@@ -705,7 +762,8 @@ class ForeignDataWrapperView(PGChildNodeView):
         """
         res = [{'label': '', 'value': ''}]
         try:
-            sql = render_template("/".join([self.template_path, 'validators.sql']),
+            sql = render_template("/".join([self.template_path,
+                                            'validators.sql']),
                                   conn=self.conn)
             status, r_set = self.conn.execute_2darray(sql)
 
@@ -724,7 +782,8 @@ class ForeignDataWrapperView(PGChildNodeView):
     @check_precondition
     def get_handlers(self, gid, sid, did):
         """
-        This function returns the handlers for the selected foreign data wrapper node.
+        This function returns the handlers for the selected
+        foreign data wrapper node.
 
         Args:
             gid: Server Group ID
@@ -733,7 +792,8 @@ class ForeignDataWrapperView(PGChildNodeView):
         """
         res = [{'label': '', 'value': ''}]
         try:
-            sql = render_template("/".join([self.template_path, 'handlers.sql']),
+            sql = render_template("/".join([self.template_path,
+                                            'handlers.sql']),
                                   conn=self.conn)
             status, r_set = self.conn.execute_2darray(sql)
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
index fdc94a9..779796b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
@@ -33,19 +33,21 @@ class ForeignServerModule(CollectionNodeModule):
     """
     class ForeignServerModule(CollectionNodeModule)
 
-        A module class for foreign server node derived from CollectionNodeModule.
+        A module class for foreign server node derived from
+        CollectionNodeModule.
 
     Methods:
     -------
     * __init__(*args, **kwargs)
-      - Method is used to initialize the Foreign server module and it's base module.
+      - Method is used to initialize the Foreign server module and
+        it's base module.
 
     * get_nodes(gid, sid, did)
       - Method is used to generate the browser collection node.
 
     * script_load(self)
-      - Load the module script for foreign server, when any of the database node is
-        initialized.
+      - Load the module script for foreign server, when any of
+        the database node is initialized.
     """
 
     NODE_TYPE = 'foreign_server'
@@ -53,7 +55,8 @@ class ForeignServerModule(CollectionNodeModule):
 
     def __init__(self, *args, **kwargs):
         """
-        Method is used to initialize the Foreign server module and it's base module.
+        Method is used to initialize the Foreign server module and
+        it's base module.
 
         Args:
             *args:
@@ -80,7 +83,8 @@ class ForeignServerModule(CollectionNodeModule):
     @property
     def script_load(self):
         """
-        Load the module script for foreign server, when any of the foreign data wrapper node is initialized.
+        Load the module script for foreign server, when any of the
+        foreign data wrapper node is initialized.
 
         Returns: node type of the server module.
         """
@@ -102,9 +106,10 @@ class ForeignServerView(PGChildNodeView):
     """
     class ForeignServerView(PGChildNodeView)
 
-        A view class for foreign server node derived from PGChildNodeView. This class is
-        responsible for all the stuff related to view like updating foreign server
-        node, showing properties, showing sql in sql pane.
+        A view class for foreign server node derived from PGChildNodeView.
+        This class is responsible for all the stuff related to view like
+        updating foreign server node, showing properties,
+        showing sql in sql pane.
 
     Methods:
     -------
@@ -121,17 +126,21 @@ class ForeignServerView(PGChildNodeView):
         manager,conn & template_path properties to self
 
     * list(gid, sid, did, fid)
-      - This function is used to list all the foreign server nodes within that collection.
+      - This function is used to list all the foreign server nodes within
+        that collection.
 
     * nodes(gid, sid, did, fid)
-      - This function will used to create all the child node within that collection.
+      - This function will used to create all the child node within
+        that collection.
         Here it will create all the foreign server node.
 
     * properties(gid, sid, did, fid, fsid)
-      - This function will show the properties of the selected foreign server node
+      - This function will show the properties of the selected
+        foreign server node
 
     * update(gid, sid, did, fid, fsid)
-      - This function will update the data for the selected foreign server node
+      - This function will update the data for the selected
+        foreign server node
 
     * create(gid, sid, did, fid)
       - This function will create the new foreign server node
@@ -140,19 +149,23 @@ class ForeignServerView(PGChildNodeView):
       - This function will delete the selected foreign server node
 
     * msql(gid, sid, did, fid, fsid)
-      - This function is used to return modified SQL for the selected foreign server node
+      - This function is used to return modified SQL for the selected
+        foreign server node
 
     * get_sql(data, fid, fsid)
       - This function will generate sql from model data
 
     * sql(gid, sid, did, fid, fsid):
-      - This function will generate sql to show it in sql pane for the selected foreign server node.
+      - This function will generate sql to show it in sql pane for the
+        selected foreign server node.
 
     * dependents(gid, sid, did, fid, fsid):
-      - This function get the dependents and return ajax response for the foreign server node.
+      - This function get the dependents and return ajax response for the
+        foreign server node.
 
     * dependencies(self, gid, sid, did, fid, fsid):
-      - This function get the dependencies and return ajax response for the foreign server node.
+      - This function get the dependencies and return ajax response for the
+        foreign server node.
     """
 
     node_type = blueprint.node_type
@@ -226,7 +239,8 @@ class ForeignServerView(PGChildNodeView):
     @check_precondition
     def list(self, gid, sid, did, fid):
         """
-        This function is used to list all the foreign server nodes within that collection.
+        This function is used to list all the foreign server nodes
+        within that collection.
 
         Args:
             gid: Server Group ID
@@ -250,7 +264,8 @@ class ForeignServerView(PGChildNodeView):
     @check_precondition
     def nodes(self, gid, sid, did, fid):
         """
-        This function will used to create all the child node within that collection.
+        This function will used to create all the child node
+        within that collection.
         Here it will create all the foreign server node.
 
         Args:
@@ -320,7 +335,8 @@ class ForeignServerView(PGChildNodeView):
     @check_precondition
     def properties(self, gid, sid, did, fid, fsid):
         """
-        This function will show the properties of the selected foreign server node.
+        This function will show the properties of the selected
+        foreign server node.
 
         Args:
             gid: Server Group ID
@@ -347,7 +363,9 @@ class ForeignServerView(PGChildNodeView):
                 res['rows'][0]['fsrvoptions'], 'fsrvoption', 'fsrvvalue'
             )
 
-        sql = render_template("/".join([self.template_path, 'acl.sql']), fsid=fsid)
+        sql = render_template("/".join([self.template_path, 'acl.sql']),
+                              fsid=fsid
+                              )
         status, fs_rv_acl_res = self.conn.execute_dict(sql)
 
         if not status:
@@ -397,7 +415,8 @@ class ForeignServerView(PGChildNodeView):
             if 'fsrvacl' in data:
                 data['fsrvacl'] = parse_priv_to_db(data['fsrvacl'], ['U'])
 
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
+            sql = render_template("/".join([self.template_path,
+                                            'properties.sql']),
                                   fdwid=fid, conn=self.conn)
             status, res1 = self.conn.execute_dict(sql)
             if not status:
@@ -419,7 +438,8 @@ class ForeignServerView(PGChildNodeView):
             if not status:
                 return internal_server_error(errormsg=res)
 
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
+            sql = render_template("/".join([self.template_path,
+                                            'properties.sql']),
                                   data=data, fdwdata=fdw_data,
                                   conn=self.conn)
             status, r_set = self.conn.execute_dict(sql)
@@ -440,7 +460,8 @@ class ForeignServerView(PGChildNodeView):
     @check_precondition
     def update(self, gid, sid, did, fid, fsid):
         """
-        This function will update the data for the selected foreign server node.
+        This function will update the data for the selected
+        foreign server node.
 
         Args:
             gid: Server Group ID
@@ -541,7 +562,8 @@ class ForeignServerView(PGChildNodeView):
     @check_precondition
     def msql(self, gid, sid, did, fid, fsid=None):
         """
-        This function is used to return modified SQL for the selected foreign server node.
+        This function is used to return modified SQL for the selected foreign
+        server node.
 
         Args:
             gid: Server Group ID
@@ -591,7 +613,8 @@ class ForeignServerView(PGChildNodeView):
         ]
 
         if fsid is not None:
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
+            sql = render_template("/".join([self.template_path,
+                                            'properties.sql']),
                                   fsid=fsid, conn=self.conn)
             status, res = self.conn.execute_dict(sql)
             if not status:
@@ -609,11 +632,20 @@ class ForeignServerView(PGChildNodeView):
             for key in ['fsrvacl']:
                 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:
@@ -622,22 +654,32 @@ class ForeignServerView(PGChildNodeView):
 
             is_valid_added_options = is_valid_changed_options = False
             if 'fsrvoptions' in data and 'added' in data['fsrvoptions']:
-                is_valid_added_options, data['fsrvoptions']['added'] = validate_options(
-                    data['fsrvoptions']['added'], 'fsrvoption', 'fsrvvalue'
-                )
+                is_valid_added_options, data['fsrvoptions']['added'] =\
+                    validate_options(
+                        data['fsrvoptions']['added'],
+                        'fsrvoption',
+                        'fsrvvalue'
+                    )
             if 'fsrvoptions' in data and 'changed' in data['fsrvoptions']:
-                is_valid_changed_options, data['fsrvoptions']['changed'] = validate_options(
-                    data['fsrvoptions']['changed'], 'fsrvoption', 'fsrvvalue'
-                )
+                is_valid_changed_options, data['fsrvoptions']['changed'] =\
+                    validate_options(
+                        data['fsrvoptions']['changed'],
+                        'fsrvoption',
+                        'fsrvvalue'
+                    )
 
-            sql = render_template("/".join([self.template_path, 'update.sql']),
-                                  data=data, o_data=old_data,
-                                  is_valid_added_options=is_valid_added_options,
-                                  is_valid_changed_options=is_valid_changed_options,
-                                  conn=self.conn)
+            sql = render_template(
+                "/".join([self.template_path, 'update.sql']),
+                data=data,
+                o_data=old_data,
+                is_valid_added_options=is_valid_added_options,
+                is_valid_changed_options=is_valid_changed_options,
+                conn=self.conn
+            )
             return sql, data['name'] if 'name' in data else old_data['name']
         else:
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
+            sql = render_template("/".join([self.template_path,
+                                            'properties.sql']),
                                   fdwid=fid, conn=self.conn)
             status, res = self.conn.execute_dict(sql)
             if not status:
@@ -649,7 +691,6 @@ class ForeignServerView(PGChildNodeView):
                 if key in data and data[key] is not None:
                     data[key] = parse_priv_to_db(data[key], ['U'])
 
-
             is_valid_options = False
             if 'fsrvoptions' in data:
                 is_valid_options, data['fsrvoptions'] = validate_options(
@@ -663,11 +704,11 @@ class ForeignServerView(PGChildNodeView):
             sql += "\n"
         return sql, data['name']
 
-
     @check_precondition
     def sql(self, gid, sid, did, fid, fsid):
         """
-        This function will generate sql to show it in sql pane for the selected foreign server node.
+        This function will generate sql to show it in sql pane for the
+        selected foreign server node.
 
         Args:
             gid: Server Group ID
@@ -696,7 +737,8 @@ class ForeignServerView(PGChildNodeView):
             if len(res['rows'][0]['fsrvoptions']) > 0:
                 is_valid_options = True
 
-        sql = render_template("/".join([self.template_path, 'acl.sql']), fsid=fsid)
+        sql = render_template("/".join([self.template_path, 'acl.sql']),
+                              fsid=fsid)
         status, fs_rv_acl_res = self.conn.execute_dict(sql)
         if not status:
             return internal_server_error(errormsg=fs_rv_acl_res)
@@ -710,7 +752,10 @@ class ForeignServerView(PGChildNodeView):
 
         # To format privileges
         if 'fsrvacl' in res['rows'][0]:
-            res['rows'][0]['fsrvacl'] = parse_priv_to_db(res['rows'][0]['fsrvacl'], ['U'])
+            res['rows'][0]['fsrvacl'] = parse_priv_to_db(
+                res['rows'][0]['fsrvacl'],
+                ['U']
+            )
 
         sql = render_template("/".join([self.template_path, 'properties.sql']),
                               fdwid=fid, conn=self.conn)
@@ -753,7 +798,8 @@ class ForeignServerView(PGChildNodeView):
         dependents_result = self.get_dependents(self.conn, fsid)
 
         # Fetching dependents of foreign servers
-        query = render_template("/".join([self.template_path, 'dependents.sql']),
+        query = render_template("/".join([self.template_path,
+                                          'dependents.sql']),
                                 fsid=fsid)
         status, result = self.conn.execute_dict(query)
         if not status:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_add.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_add.py
index 9cbcc2a..89d3349 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_add.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_add.py
@@ -14,8 +14,8 @@ import uuid
 
 from pgadmin.browser.server_groups.servers.databases.extensions.tests import \
     utils as extension_utils
-from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.tests \
-    import utils as fdw_utils
+from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.\
+    tests import utils as fdw_utils
 from pgadmin.browser.server_groups.servers.databases.tests import \
     utils as database_utils
 from pgadmin.utils.route import BaseTestGenerator
@@ -94,8 +94,9 @@ class ForeignServerAddTestCase(BaseTestGenerator):
         }
         response = self.tester.post(
             self.url + str(utils.SERVER_GROUP) + '/' +
-            str(self.server_id) + '/' + str(self.db_id) + '/'
-            + str(self.fdw_id) + '/', data=json.dumps(data),
+            str(self.server_id) + '/' + str(self.db_id) +
+            '/' + str(self.fdw_id) + '/',
+            data=json.dumps(data),
             content_type='html/json')
         self.assertEquals(response.status_code, 200)
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_delete.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_delete.py
index 91434e8..7d68150 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_delete.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_delete.py
@@ -13,8 +13,8 @@ import uuid
 
 from pgadmin.browser.server_groups.servers.databases.extensions.tests import \
     utils as extension_utils
-from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.tests \
-    import utils as fdw_utils
+from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.\
+    tests import utils as fdw_utils
 from pgadmin.browser.server_groups.servers.databases.tests import \
     utils as database_utils
 from pgadmin.utils.route import BaseTestGenerator
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_get.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_get.py
index cfaa96c..baae85d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_get.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_get.py
@@ -13,8 +13,8 @@ import uuid
 
 from pgadmin.browser.server_groups.servers.databases.extensions.tests import \
     utils as extension_utils
-from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.tests\
-    import utils as fdw_utils
+from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.\
+    tests import utils as fdw_utils
 from pgadmin.browser.server_groups.servers.databases.tests import \
     utils as database_utils
 from pgadmin.utils.route import BaseTestGenerator
@@ -62,8 +62,8 @@ class ForeignServerGetTestCase(BaseTestGenerator):
             raise Exception("Could not find FDW.")
         fsrv_response = self.tester.get(
             self.url + str(utils.SERVER_GROUP) + '/' +
-            str(self.server_id) + '/' + str(self.db_id) + '/'
-            + str(self.fdw_id) + '/' + str(self.fsrv_id),
+            str(self.server_id) + '/' + str(self.db_id) +
+            '/' + str(self.fdw_id) + '/' + str(self.fsrv_id),
             content_type='html/json')
         self.assertEquals(fsrv_response.status_code, 200)
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_put.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_put.py
index 847b4ad..78e2f94 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_put.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_put.py
@@ -14,8 +14,8 @@ import uuid
 
 from pgadmin.browser.server_groups.servers.databases.extensions.tests import \
     utils as extension_utils
-from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.tests\
-    import utils as fdw_utils
+from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.\
+    tests import utils as fdw_utils
 from pgadmin.browser.server_groups.servers.databases.tests import \
     utils as database_utils
 from pgadmin.utils.route import BaseTestGenerator
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/utils.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/utils.py
index 74823d8..4f68147 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/utils.py
@@ -60,16 +60,16 @@ def create_fsrv(server, db_name, fsrv_name, fdw_name):
         print(exception, file=sys.stderr)

-def verify_fsrv(server, db_name , fsrv_name):
+def verify_fsrv(server, db_name, fsrv_name):
     """ This function will verify current foreign server."""
 
     try:
         connection = get_db_connection(db_name,
-                                             server['username'],
-                                             server['db_password'],
-                                             server['host'],
-                                             server['port'],
-                                             server['sslmode'])
+                                       server['username'],
+                                       server['db_password'],
+                                       server['host'],
+                                       server['port'],
+                                       server['sslmode'])
         pg_cursor = connection.cursor()
 
         pg_cursor.execute(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py
index b967a46..38adf61 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py
@@ -33,22 +33,25 @@ class UserMappingModule(CollectionNodeModule):
     """
     class UserMappingModule(CollectionNodeModule)
 
-        A module class for user mapping node derived from CollectionNodeModule.
+        A module class for user mapping node derived
+        from CollectionNodeModule.
 
     Methods:
     -------
     * __init__(*args, **kwargs)
-      - Method is used to initialize the user mapping module and it's base module.
+      - Method is used to initialize the user mapping module and
+        it's base module.
 
     * get_nodes(gid, sid, did, fid, fsid)
       - Method is used to generate the browser collection node.
 
     * node_inode()
-      - Method is overridden from its base class to make the node as leaf node.
+      - Method is overridden from its base class to make the node
+        as leaf node.
 
     * script_load(self)
-      - Load the module script for user mapping, when any of the foreign server node is
-        initialized.
+      - Load the module script for user mapping, when any of the
+        foreign server node is initialized.
     """
 
     NODE_TYPE = 'user_mapping'
@@ -56,7 +59,8 @@ class UserMappingModule(CollectionNodeModule):
 
     def __init__(self, *args, **kwargs):
         """
-        Method is used to initialize the User mapping module and it's base module.
+        Method is used to initialize the User mapping module and
+        it's base module.
 
         Args:
             *args:
@@ -94,7 +98,8 @@ class UserMappingModule(CollectionNodeModule):
     @property
     def script_load(self):
         """
-        Load the module script for user mapping, when any of the foreign server node is initialized.
+        Load the module script for user mapping, when any of the
+        foreign server node is initialized.
 
         Returns: node type of the server module.
         """
@@ -117,9 +122,10 @@ class UserMappingView(PGChildNodeView):
     """
     class UserMappingView(PGChildNodeView)
 
-        A view class for user mapping node derived from PGChildNodeView. This class is
-        responsible for all the stuff related to view like updating user mapping
-        node, showing properties, showing sql in sql pane.
+        A view class for user mapping node derived from PGChildNodeView.
+        This class is responsible for all the stuff related to view like
+        updating user mapping node, showing properties,
+        showing sql in sql pane.
 
     Methods:
     -------
@@ -136,17 +142,21 @@ class UserMappingView(PGChildNodeView):
         manager,conn & template_path properties to self
 
     * list(gid, sid, did, fid, fsid)
-      - This function is used to list all the user mapping nodes within that collection.
+      - This function is used to list all the user mapping nodes
+        within that collection.
 
     * nodes(gid, sid, did, fid, fsid)
-      - This function will used to create all the child node within that collection.
+      - This function will used to create all the child node
+        within that collection.
         Here it will create all the user mapping node.
 
     * properties(gid, sid, did, fid, fsid, umid)
-      - This function will show the properties of the selected user mapping node
+      - This function will show the properties of the selected
+        user mapping node
 
     * update(gid, sid, did, fid, fsid, umid)
-      - This function will update the data for the selected user mapping node
+      - This function will update the data for the selected
+        user mapping node
 
     * create(gid, sid, did, fid, fsid)
       - This function will create the new user mapping node
@@ -155,19 +165,23 @@ class UserMappingView(PGChildNodeView):
       - This function will delete the selected user mapping node
 
     * msql(gid, sid, did, fid, fsid, umid)
-      - This function is used to return modified SQL for the selected user mapping node
+      - This function is used to return modified SQL for the
+        selected user mapping node
 
     * get_sql(data, fid, fsid, umid)
       - This function will generate sql from model data
 
     * sql(gid, sid, did, fid, fsid, umid):
-      - This function will generate sql to show it in sql pane for the selected user mapping node.
+      - This function will generate sql to show it in sql pane for the
+        selected user mapping node.
 
     * dependents(gid, sid, did, fid, fsid, umid):
-      - This function get the dependents and return ajax response for the user mapping node.
+      - This function get the dependents and return ajax response for the
+        user mapping node.
 
     * dependencies(self, gid, sid, did, fid, fsid, umid):
-      - This function get the dependencies and return ajax response for the user mapping node.
+      - This function get the dependencies and return ajax response for the
+        user mapping node.
     """
 
     node_type = blueprint.node_type
@@ -242,7 +256,8 @@ class UserMappingView(PGChildNodeView):
     @check_precondition
     def list(self, gid, sid, did, fid, fsid):
         """
-        This function is used to list all the user mapping nodes within that collection.
+        This function is used to list all the user mapping nodes
+        within that collection.
 
         Args:
             gid: Server Group ID
@@ -252,7 +267,8 @@ class UserMappingView(PGChildNodeView):
             fsid: Foreign server ID
         """
 
-        sql = render_template("/".join([self.template_path, 'properties.sql']),
+        sql = render_template("/".join([self.template_path,
+                                        'properties.sql']),
                               fsid=fsid, conn=self.conn)
         status, res = self.conn.execute_dict(sql)
 
@@ -267,7 +283,8 @@ class UserMappingView(PGChildNodeView):
     @check_precondition
     def nodes(self, gid, sid, did, fid, fsid):
         """
-        This function will used to create all the child node within that collection.
+        This function will used to create all the child
+        node within that collection.
         Here it will create all the user mapping node.
 
         Args:
@@ -279,7 +296,8 @@ class UserMappingView(PGChildNodeView):
         """
 
         res = []
-        sql = render_template("/".join([self.template_path, 'properties.sql']),
+        sql = render_template("/".join([self.template_path,
+                                        'properties.sql']),
                               fsid=fsid, conn=self.conn)
         status, r_set = self.conn.execute_2darray(sql)
 
@@ -313,7 +331,8 @@ class UserMappingView(PGChildNodeView):
             fsid: Foreign server ID
             umid: User mapping ID
         """
-        sql = render_template("/".join([self.template_path, 'properties.sql']),
+        sql = render_template("/".join([self.template_path,
+                                        'properties.sql']),
                               conn=self.conn, umid=umid)
         status, r_set = self.conn.execute_2darray(sql)
 
@@ -336,7 +355,8 @@ class UserMappingView(PGChildNodeView):
     @check_precondition
     def properties(self, gid, sid, did, fid, fsid, umid):
         """
-        This function will show the properties of the selected user mapping node.
+        This function will show the properties of the
+        selected user mapping node.
 
         Args:
             gid: Server Group ID
@@ -347,7 +367,8 @@ class UserMappingView(PGChildNodeView):
             umid: User mapping ID
         """
 
-        sql = render_template("/".join([self.template_path, 'properties.sql']),
+        sql = render_template("/".join([self.template_path,
+                                        'properties.sql']),
                               umid=umid, conn=self.conn)
         status, res = self.conn.execute_dict(sql)
 
@@ -400,7 +421,8 @@ class UserMappingView(PGChildNodeView):
                 )
 
         try:
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
+            sql = render_template("/".join([self.template_path,
+                                            'properties.sql']),
                                   fserid=fsid, conn=self.conn)
             status, res1 = self.conn.execute_dict(sql)
 
@@ -423,7 +445,8 @@ class UserMappingView(PGChildNodeView):
             if not status:
                 return internal_server_error(errormsg=res)
 
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
+            sql = render_template("/".join([self.template_path,
+                                            'properties.sql']),
                                   fsid=fsid, data=data,
                                   conn=self.conn)
             status, r_set = self.conn.execute_dict(sql)
@@ -522,7 +545,8 @@ class UserMappingView(PGChildNodeView):
                     )
                 )
 
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
+            sql = render_template("/".join([self.template_path,
+                                            'properties.sql']),
                                   umid=umid, conn=self.conn)
             status, res = self.conn.execute_dict(sql)
             if not status:
@@ -566,7 +590,8 @@ class UserMappingView(PGChildNodeView):
     @check_precondition
     def msql(self, gid, sid, did, fid, fsid, umid=None):
         """
-        This function is used to return modified SQL for the selected user mapping node.
+        This function is used to return modified SQL for the
+        selected user mapping node.
 
         Args:
             gid: Server Group ID
@@ -617,7 +642,8 @@ class UserMappingView(PGChildNodeView):
         ]
 
         if umid is not None:
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
+            sql = render_template("/".join([self.template_path,
+                                            'properties.sql']),
                                   umid=umid, conn=self.conn)
             status, res = self.conn.execute_dict(sql)
             if not status:
@@ -634,7 +660,8 @@ class UserMappingView(PGChildNodeView):
                 )
             old_data = res['rows'][0]
 
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
+            sql = render_template("/".join([self.template_path,
+                                            'properties.sql']),
                                   fserid=fsid, conn=self.conn)
             status, res1 = self.conn.execute_dict(sql)
             if not status:
@@ -646,25 +673,37 @@ class UserMappingView(PGChildNodeView):
                 if arg not in data:
                     data[arg] = old_data[arg]
 
-            # Allow user to set the blank value in fdwvalue field in option model
+            # Allow user to set the blank value in fdwvalue
+            # field in option model
             is_valid_added_options = is_valid_changed_options = False
             if 'umoptions' in data and 'added' in data['umoptions']:
-                is_valid_added_options, data['umoptions']['added'] = validate_options(
-                    data['umoptions']['added'], 'umoption', 'umvalue'
-                )
+                is_valid_added_options, data['umoptions']['added'] =\
+                    validate_options(
+                        data['umoptions']['added'],
+                        'umoption',
+                        'umvalue'
+                    )
             if 'umoptions' in data and 'changed' in data['umoptions']:
-                is_valid_changed_options, data['umoptions']['changed'] = validate_options(
-                    data['umoptions']['changed'], 'umoption', 'umvalue'
-                )
+                is_valid_changed_options, data['umoptions']['changed'] =\
+                    validate_options(
+                        data['umoptions']['changed'],
+                        'umoption',
+                        'umvalue'
+                    )
 
-            sql = render_template("/".join([self.template_path, 'update.sql']),
-                                  data=data, o_data=old_data,
-                                  is_valid_added_options=is_valid_added_options,
-                                  is_valid_changed_options=is_valid_changed_options,
-                                  fdwdata=fdw_data, conn=self.conn)
+            sql = render_template(
+                "/".join([self.template_path, 'update.sql']),
+                data=data,
+                o_data=old_data,
+                is_valid_added_options=is_valid_added_options,
+                is_valid_changed_options=is_valid_changed_options,
+                fdwdata=fdw_data,
+                conn=self.conn
+            )
             return sql, data['name'] if 'name' in data else old_data['name']
         else:
-            sql = render_template("/".join([self.template_path, 'properties.sql']),
+            sql = render_template("/".join([self.template_path,
+                                            'properties.sql']),
                                   fserid=fsid, conn=self.conn)
             status, res = self.conn.execute_dict(sql)
             if not status:
@@ -687,7 +726,8 @@ class UserMappingView(PGChildNodeView):
     @check_precondition
     def sql(self, gid, sid, did, fid, fsid, umid):
         """
-        This function will generate sql to show it in sql pane for the selected user mapping node.
+        This function will generate sql to show it in sql pane for
+        the selected user mapping node.
 
         Args:
             gid: Server Group ID
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py
index c8d306c..05bb4d6 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py
@@ -16,8 +16,8 @@ from pgadmin.browser.server_groups.servers.databases.extensions.tests import \
     utils as extension_utils
 from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.\
     foreign_servers.tests import utils as fsrv_utils
-from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.tests\
-    import utils as fdw_utils
+from pgadmin.browser.server_groups.servers.databases.\
+    foreign_data_wrappers.tests import utils as fdw_utils
 from pgadmin.browser.server_groups.servers.databases.tests import \
     utils as database_utils
 from pgadmin.utils.route import BaseTestGenerator
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_delete.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_delete.py
index cd845ff..5e65790 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_delete.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_delete.py
@@ -15,8 +15,8 @@ from pgadmin.browser.server_groups.servers.databases.extensions.tests import \
     utils as extension_utils
 from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers. \
     foreign_servers.tests import utils as fsrv_utils
-from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.tests \
-    import utils as fdw_utils
+from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.\
+    tests import utils as fdw_utils
 from pgadmin.browser.server_groups.servers.databases.tests import \
     utils as database_utils
 from pgadmin.utils.route import BaseTestGenerator
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_get.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_get.py
index 5008987..d2ed511 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_get.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_get.py
@@ -15,8 +15,8 @@ from pgadmin.browser.server_groups.servers.databases.extensions.tests import \
     utils as extension_utils
 from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers. \
     foreign_servers.tests import utils as fsrv_utils
-from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.tests \
-    import utils as fdw_utils
+from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.\
+    tests import utils as fdw_utils
 from pgadmin.browser.server_groups.servers.databases.tests import \
     utils as database_utils
 from pgadmin.utils.route import BaseTestGenerator
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_put.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_put.py
index eb05215..e2afa49 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_put.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_put.py
@@ -16,8 +16,8 @@ from pgadmin.browser.server_groups.servers.databases.extensions.tests import \
     utils as extension_utils
 from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers. \
     foreign_servers.tests import utils as fsrv_utils
-from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.tests \
-    import utils as fdw_utils
+from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.\
+    tests import utils as fdw_utils
 from pgadmin.browser.server_groups.servers.databases.tests import \
     utils as database_utils
 from pgadmin.utils.route import BaseTestGenerator
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/utils.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/utils.py
index ef39366..f0d8294 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/utils.py
@@ -39,7 +39,11 @@ def create_user_mapping(server, db_name, fsrv_name):
         connection.set_isolation_level(0)
         pg_cursor = connection.cursor()
         query = "CREATE USER MAPPING FOR %s SERVER %s OPTIONS" \
-                " (user '%s', password '%s')" % (server['username'], fsrv_name, server['username'], server['db_password'])
+                " (user '%s', password '%s')" % (server['username'],
+                                                 fsrv_name,
+                                                 server['username'],
+                                                 server['db_password']
+                                                 )
         pg_cursor.execute(query)
         connection.set_isolation_level(old_isolation_level)
         connection.commit()

---

From: Joao De Almeida Pereira <[email-masked]>
Date: Thu, 01 Mar 2018 14:43:32 +0000

Hello Khushboo,
I applied this patch and here is the result:

 2018-03-01 09:41:00 ⌚ |ruby-2.4.1| pgadmin-dev in ~/workspace/pgadmin4/web
± |pep-8-fdw {2} U:13 ✗| → git st
On branch pep-8-fdw
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

modified:
 pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
modified:
 pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
modified:
 pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_add.py
modified:
 pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_delete.py
modified:
 pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_get.py
modified:
 pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_put.py
modified:
 pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/utils.py
modified:
 pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py
modified:
 pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py
modified:
 pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_delete.py
modified:
 pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_get.py
modified:
 pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_put.py
modified:
 pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/utils.py

no changes added to commit (use "git add" and/or "git commit -a")

 2018-03-01 09:41:03 ⌚ |ruby-2.4.1| pgadmin-dev in ~/workspace/pgadmin4/web
± |pep-8-fdw {2} U:13 ✗| → pycodestyle --config=.pycodestyle
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py:644:
[E123] closing bracket does not match indentation of opening bracket's line
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py:651:
[E123] closing bracket does not match indentation of opening bracket's line
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py:593:
[E123] closing bracket does not match indentation of opening bracket's line
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py:662:
[E123] closing bracket does not match indentation of opening bracket's line
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py:669:
[E123] closing bracket does not match indentation of opening bracket's line
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py:622:
[E123] closing bracket does not match indentation of opening bracket's line
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py:685:
[E123] closing bracket does not match indentation of opening bracket's line
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py:692:
[E123] closing bracket does not match indentation of opening bracket's line
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py:72:
[E126] continuation line over-indented for hanging indent
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py:84:
[E121] continuation line under-indented for hanging indent
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_get.py:74:
[E126] continuation line over-indented for hanging indent
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_put.py:69:
[E126] continuation line over-indented for hanging indent
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_put.py:71:
[E121] continuation line under-indented for hanging indent
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/tests/test_fdw_delete.py:25:
[E126] continuation line over-indented for hanging indent
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/tests/test_fdw_delete.py:28:
[E121] continuation line under-indented for hanging indent
pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/tests/test_fdw_delete.py:55:
[E126] continuation line over-indented for hanging indent
3       E121 continuation line under-indented for hanging indent
8       E123 closing bracket does not match indentation of opening
bracket's line
5       E126 continuation line over-indented for hanging indent
16

Did I execute the command correctly?
If so there are some things that need to be solved still

Thanks
Joao

---

From: Khushboo Vashi <[email-masked]>
Date: Fri, 2 Mar 2018 10:26:28 +0530

Hi Joao,

On Thu, Mar 1, 2018 at 8:13 PM, Joao De Almeida Pereira <
[email-masked]> wrote:

> modified:   pgadmin/browser/server_groups/servers/databases/
> foreign_data_wrappers/__init__.py
> modified:   pgadmin/browser/server_groups/servers/databases/
> foreign_data_wrappers/foreign_servers/__init__.py
> modified:   pgadmin/browser/server_groups/servers/databases/
> foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_add.py
> modified:   pgadmin/browser/server_groups/servers/databases/
> foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_delete.py
> modified:   pgadmin/browser/server_groups/servers/databases/
> foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_get.py
> modified:   pgadmin/browser/server_groups/servers/databases/
> foreign_data_wrappers/foreign_servers/tests/test_foreign_servers_put.py
> modified:   pgadmin/browser/server_groups/servers/databases/
> foreign_data_wrappers/foreign_servers/tests/utils.py
> modified:   pgadmin/browser/server_groups/servers/databases/
> foreign_data_wrappers/foreign_servers/user_mapping/__init__.py
> modified:   pgadmin/browser/server_groups/servers/databases/
> foreign_data_wrappers/foreign_servers/user_mapping/tests/
> test_user_mapping_add.py
> modified:   pgadmin/browser/server_groups/servers/databases/
> foreign_data_wrappers/foreign_servers/user_mapping/tests/
> test_user_mapping_delete.py
> modified:   pgadmin/browser/server_groups/servers/databases/
> foreign_data_wrappers/foreign_servers/user_mapping/tests/
> test_user_mapping_get.py
> modified:   pgadmin/browser/server_groups/servers/databases/
> foreign_data_wrappers/foreign_servers/user_mapping/tests/
> test_user_mapping_put.py
> modified:   pgadmin/browser/server_groups/servers/databases/
> foreign_data_wrappers/foreign_servers/user_mapping/tests/utils.py
>
> pgadmin/browser/server_groups/servers/databases/foreign_
> data_wrappers/foreign_servers/__init__.py:593: [E123] closing bracket
> does not match indentation of opening bracket's line
> pgadmin/browser/server_groups/servers/databases/foreign_
> data_wrappers/foreign_servers/__init__.py:662: [E123] closing bracket
> does not match indentation of opening bracket's line
> pgadmin/browser/server_groups/servers/databases/foreign_
> data_wrappers/foreign_servers/__init__.py:669: [E123] closing bracket
> does not match indentation of opening bracket's line
> pgadmin/browser/server_groups/servers/databases/foreign_
> data_wrappers/foreign_servers/user_mapping/__init__.py:622: [E123]
> closing bracket does not match indentation of opening bracket's line
> pgadmin/browser/server_groups/servers/databases/foreign_
> data_wrappers/foreign_servers/user_mapping/__init__.py:685: [E123]
> closing bracket does not match indentation of opening bracket's line
> pgadmin/browser/server_groups/servers/databases/foreign_
> data_wrappers/foreign_servers/user_mapping/__init__.py:692: [E123]
> closing bracket does not match indentation of opening bracket's line
> pgadmin/browser/server_groups/servers/databases/foreign_
> data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py:72:
> pgadmin/browser/server_groups/servers/databases/foreign_
> data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py:84:
> pgadmin/browser/server_groups/servers/databases/foreign_
> data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_get.py:74:
> pgadmin/browser/server_groups/servers/databases/foreign_
> data_wrappers/foreign_servers/tests/test_foreign_servers_put.py:69:
> pgadmin/browser/server_groups/servers/databases/foreign_
> data_wrappers/foreign_servers/tests/test_foreign_servers_put.py:71:
> pgadmin/browser/server_groups/servers/databases/foreign_
> data_wrappers/tests/test_fdw_delete.py:25: [E126] continuation line
> over-indented for hanging indent
> pgadmin/browser/server_groups/servers/databases/foreign_
> data_wrappers/tests/test_fdw_delete.py:28: [E121] continuation line
> under-indented for hanging indent
> pgadmin/browser/server_groups/servers/databases/foreign_
> data_wrappers/tests/test_fdw_delete.py:55: [E126] continuation line
> over-indented for hanging indent
> Fixed. Patch updated.

>> Please find the attached patch to fix the PEP-8 issues in the foreign
>> data wrapper module.
>>
>> Thanks,
>> Khushboo
>>
>
index d5a4cc2..c93a2fb 100644

     Methods:
     -------

     * script_load()

 
         Args:
             *args:

 
 
     Methods:
     -------
     * __init__(**kwargs)
 
     * check_precondition()
 
     * list(gid, sid, did)
 
     * nodes(gid, sid, did)

     * create(gid, sid, did)

 
     * get_sql(data, fid)

 

 
 
         Args:
             gid: Server Group ID

     @check_precondition
 
         Args:
             gid: Server Group ID

 

 
 
         Args:
             gid: Server Group ID
 
         Args:
             gid: Server Group ID
 
         if fid is not None:

@@ -580,33 +613,49 @@ class ForeignDataWrapperView(PGChildNodeView):

+                        'fdwvalue')
+                        'fdwvalue')
+
@@ -614,25 +663,27 @@ class ForeignDataWrapperView(PGChildNodeView):

 
         return sql, data['name']
 
-
     @check_precondition
 
         Args:
             gid: Server Group ID
@@ -660,7 +711,8 @@ class ForeignDataWrapperView(PGChildNodeView):
             if len(res['rows'][0]['fdwoptions']) > 0:
                 is_valid_options = True
 
@@ -674,7 +726,10 @@ class ForeignDataWrapperView(PGChildNodeView):
 
         # To format privileges
 
         sql = ''
@@ -696,7 +751,8 @@ class ForeignDataWrapperView(PGChildNodeView):
 
         Args:
             gid: Server Group ID
@@ -705,7 +761,8 @@ class ForeignDataWrapperView(PGChildNodeView):
         """
 
@@ -724,7 +781,8 @@ class ForeignDataWrapperView(PGChildNodeView):
     @check_precondition
 
         Args:
             gid: Server Group ID
@@ -733,7 +791,8 @@ class ForeignDataWrapperView(PGChildNodeView):
         """
 
index fdc94a9..ee1325a 100644

     Methods:
     -------

     * script_load(self)

 
         Args:
             *args:

 
     Methods:
     -------

 

 

 

 
         Args:
             gid: Server Group ID
 
         Args:
 
         Args:
             gid: Server Group ID

         if not status:

 
         Args:
             gid: Server Group ID
 
         Args:
             gid: Server Group ID
@@ -567,8 +589,7 @@ class ForeignServerView(PGChildNodeView):
 
             return make_json_response(
                 data=sql.strip('\n'),
-                status=200
-                )
+                status=200)
 
         except Exception as e:
             return internal_server_error(errormsg=str(e))
@@ -591,7 +612,8 @@ class ForeignServerView(PGChildNodeView):
         ]
 
         if fsid is not None:
@@ -609,11 +631,20 @@ class ForeignServerView(PGChildNodeView):
 
             old_data = res['rows'][0]
             for arg in required_args:
@@ -622,22 +653,31 @@ class ForeignServerView(PGChildNodeView):
 
-            if 'fsrvoptions' in data and 'changed' in data['fsrvoptions']:
+                        'fsrvvalue')
 
+            if 'fsrvoptions' in data and 'changed' in data['fsrvoptions']:
+                        'fsrvvalue')
+
@@ -649,7 +689,6 @@ class ForeignServerView(PGChildNodeView):
 
-
             is_valid_options = False
             if 'fsrvoptions' in data:
                 is_valid_options, data['fsrvoptions'] = validate_options(
@@ -663,11 +702,11 @@ class ForeignServerView(PGChildNodeView):
             sql += "\n"
         return sql, data['name']
 
-
     @check_precondition
 
         Args:
             gid: Server Group ID
@@ -696,7 +735,8 @@ class ForeignServerView(PGChildNodeView):
             if len(res['rows'][0]['fsrvoptions']) > 0:
                 is_valid_options = True
 
@@ -710,7 +750,10 @@ class ForeignServerView(PGChildNodeView):
 
         # To format privileges
 
         sql = render_template("/".join([self.template_path, 'properties.sql']),
                               fdwid=fid, conn=self.conn)
@@ -753,7 +796,8 @@ class ForeignServerView(PGChildNodeView):
         dependents_result = self.get_dependents(self.conn, fsid)

 

 
index 847b4ad..2ca73a4 100644
 
 from pgadmin.browser.server_groups.servers.databases.extensions.tests import \
     utils as extension_utils
-from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.tests\
-    import utils as fdw_utils
+from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.\
+    tests import utils as fdw_utils
 from pgadmin.browser.server_groups.servers.databases.tests import \
     utils as database_utils
 from pgadmin.utils.route import BaseTestGenerator
@@ -65,10 +65,8 @@ class ForeignServerPutTestCase(BaseTestGenerator):
                                                self.fsrv_name)
         if not fsrv_response:
             raise Exception("Could not find FSRV.")
-        data = {
-                "description": "This is foreign server update comment",
-                "id": self.fsrv_id
-            }
+        data = {"description": "This is foreign server update comment",
+                "id": self.fsrv_id}
         put_response = self.tester.put(
             self.url + str(utils.SERVER_GROUP) + '/' +
             str(self.server_id) + '/' + str(self.db_id) +
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/utils.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/utils.py
index 74823d8..4f68147 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/tests/utils.py
@@ -60,16 +60,16 @@ def create_fsrv(server, db_name, fsrv_name, fdw_name):
         print(exception, file=sys.stderr)

     try:
 
         pg_cursor.execute(
index b967a46..398351d 100644

     Methods:
     -------

     * node_inode()
 
     * script_load(self)

 
         Args:
             *args:

 
     Methods:
     -------

 

 

 

 
         Args:
             gid: Server Group ID

 
         Args:
 
         res = []

 
         Args:
             gid: Server Group ID

 
         try:

 
 
         Args:
             gid: Server Group ID
@@ -593,8 +618,7 @@ class UserMappingView(PGChildNodeView):
 
             return make_json_response(
                 data=sql,
-                status=200
-                )
+                status=200)
         except Exception as e:
             return internal_server_error(errormsg=str(e))
 
@@ -617,7 +641,8 @@ class UserMappingView(PGChildNodeView):
         ]
 
         if umid is not None:
@@ -634,7 +659,8 @@ class UserMappingView(PGChildNodeView):
 
@@ -646,25 +672,35 @@ class UserMappingView(PGChildNodeView):
 
+                        'umvalue')
+                        'umvalue')
+
@@ -687,7 +723,8 @@ class UserMappingView(PGChildNodeView):
 
         Args:
             gid: Server Group ID
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py
index c8d306c..1d86e2e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py
@@ -16,8 +16,8 @@ from pgadmin.browser.server_groups.servers.databases.extensions.tests import \
     utils as extension_utils
 from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.\
     foreign_servers.tests import utils as fsrv_utils
-from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.tests\
-    import utils as fdw_utils
+from pgadmin.browser.server_groups.servers.databases.\
+    foreign_data_wrappers.tests import utils as fdw_utils
 from pgadmin.browser.server_groups.servers.databases.tests import \
     utils as database_utils
 from pgadmin.utils.route import BaseTestGenerator
@@ -68,8 +68,7 @@ class UserMappingAddTestCase(BaseTestGenerator):
         if not fsrv_response:
             raise Exception("Could not find FSRV.")
         db_user = self.server["username"]
-        data = {
-                "name": db_user,
+        data = {"name": db_user,
                 "um_options": [],
                 "umoptions": [
                     {
@@ -80,8 +79,7 @@ class UserMappingAddTestCase(BaseTestGenerator):
                         "umoption": "password",
                         "umvalue": self.server["db_password"]
                     }
-                ]
-            }
+                ]}
         response = self.tester.post(
             self.url + str(utils.SERVER_GROUP) + '/' +
             str(self.server_id) + '/' + str(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_delete.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_delete.py
index cd845ff..5e65790 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_delete.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_delete.py
@@ -15,8 +15,8 @@ from pgadmin.browser.server_groups.servers.databases.extensions.tests import \
     utils as extension_utils
 from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers. \
     foreign_servers.tests import utils as fsrv_utils
-from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.tests \
-    import utils as fdw_utils
+from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.\
+    tests import utils as fdw_utils
 from pgadmin.browser.server_groups.servers.databases.tests import \
     utils as database_utils
 from pgadmin.utils.route import BaseTestGenerator
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_get.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_get.py
index 5008987..aa5e9c6 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_get.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_get.py
@@ -15,8 +15,8 @@ from pgadmin.browser.server_groups.servers.databases.extensions.tests import \
     utils as extension_utils
 from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers. \
     foreign_servers.tests import utils as fsrv_utils
-from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.tests \
-    import utils as fdw_utils
+from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.\
+    tests import utils as fdw_utils
 from pgadmin.browser.server_groups.servers.databases.tests import \
     utils as database_utils
 from pgadmin.utils.route import BaseTestGenerator
@@ -70,8 +70,7 @@ class UserMappingGetTestCase(BaseTestGenerator):
             raise Exception("Could not find FSRV.")
         response = self.tester.get(self.url + str(utils.SERVER_GROUP) + '/' +
                                    str(self.server_id) + '/' + str(
-            self.db_id) +
-                                   '/' + str(self.fdw_id) + '/' + str(
+            self.db_id) + '/' + str(self.fdw_id) + '/' + str(
             self.fsrv_id) + '/' + str(
             self.um_id), content_type='html/json')
         self.assertEquals(response.status_code, 200)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_put.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_put.py
index eb05215..bbba727 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_put.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_put.py
@@ -16,8 +16,8 @@ from pgadmin.browser.server_groups.servers.databases.extensions.tests import \
     utils as extension_utils
 from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers. \
     foreign_servers.tests import utils as fsrv_utils
-from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.tests \
-    import utils as fdw_utils
+from pgadmin.browser.server_groups.servers.databases.foreign_data_wrappers.\
+    tests import utils as fdw_utils
 from pgadmin.browser.server_groups.servers.databases.tests import \
     utils as database_utils
 from pgadmin.utils.route import BaseTestGenerator
@@ -65,7 +65,8 @@ class UserMappingPutTestCase(BaseTestGenerator):
                                             self.fdw_name)
         if not fdw_response:
             raise Exception("Could not find FDW.")
-        fsrv_response = fsrv_utils.verify_fsrv(self.server, self.db_name,
+        fsrv_response = fsrv_utils.verify_fsrv(self.server,
+                                               self.db_name,
                                                self.fsrv_name)
         if not fsrv_response:
             raise Exception("Could not find FSRV.")
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/utils.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/utils.py
index ef39366..f0d8294 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/tests/utils.py
@@ -39,7 +39,11 @@ def create_user_mapping(server, db_name, fsrv_name):
         connection.set_isolation_level(0)
         pg_cursor = connection.cursor()
         query = "CREATE USER MAPPING FOR %s SERVER %s OPTIONS" \
-                " (user '%s', password '%s')" % (server['username'], fsrv_name, server['username'], server['db_password'])
+                " (user '%s', password '%s')" % (server['username'],
+                                                 fsrv_name,
+                                                 server['username'],
+                                                 server['db_password']
+                                                 )
         pg_cursor.execute(query)
         connection.set_isolation_level(old_isolation_level)
         connection.commit()
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/tests/test_fdw_delete.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/tests/test_fdw_delete.py
index 4f2d277..8fe7df0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/tests/test_fdw_delete.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/tests/test_fdw_delete.py
@@ -21,11 +21,9 @@ from . import utils as fdw_utils
 
 class FDWDDeleteTestCase(BaseTestGenerator):
     """This class will delete foreign data wrappers under test database."""
-    scenarios = [
-            # Fetching default URL for foreign_data_wrapper node.
-            ('Check FDW Node',
-             dict(url='/browser/foreign_data_wrapper/obj/'))
-        ]
+    scenarios = [  # Fetching default URL for foreign_data_wrapper node.
+        ('Check FDW Node',
+         dict(url='/browser/foreign_data_wrapper/obj/'))]
 
     def setUp(self):
         """ This function will create extension and foreign data wrapper."""
@@ -51,11 +49,12 @@ class FDWDDeleteTestCase(BaseTestGenerator):
                                             self.fdw_name)
         if not fdw_response:
             raise Exception("Could not find FDW.")
-        delete_response = self.tester.delete(
-                            self.url + str(utils.SERVER_GROUP) + '/' +
-                            str(self.server_id) + '/' +
-                            str(self.db_id) + '/' + str(self.fdw_id),
-                            follow_redirects=True)
+        delete_response = self.tester.delete(self.url +
+                                             str(utils.SERVER_GROUP) +
+                                             '/' + str(self.server_id) + '/' +
+                                             str(self.db_id) +
+                                             '/' + str(self.fdw_id),
+                                             follow_redirects=True)
         self.assertEquals(delete_response.status_code, 200)
 
     def tearDown(self):

---

From: Dave Page <[email-masked]>
Date: Fri, 2 Mar 2018 14:46:28 +0000

Thanks, applied.

On Fri, Mar 2, 2018 at 4:56 AM, Khushboo Vashi <
[email-masked]> wrote:

>> modified:   pgadmin/browser/server_groups/servers/databases/foreign_
>> data_wrappers/__init__.py
>> modified:   pgadmin/browser/server_groups/servers/databases/foreign_
>> data_wrappers/foreign_servers/__init__.py
>> modified:   pgadmin/browser/server_groups/servers/databases/foreign_
>> data_wrappers/foreign_servers/tests/test_foreign_servers_add.py
>> modified:   pgadmin/browser/server_groups/servers/databases/foreign_
>> data_wrappers/foreign_servers/tests/test_foreign_servers_delete.py
>> modified:   pgadmin/browser/server_groups/servers/databases/foreign_
>> data_wrappers/foreign_servers/tests/test_foreign_servers_get.py
>> modified:   pgadmin/browser/server_groups/servers/databases/foreign_
>> data_wrappers/foreign_servers/tests/test_foreign_servers_put.py
>> modified:   pgadmin/browser/server_groups/servers/databases/foreign_
>> data_wrappers/foreign_servers/tests/utils.py
>> modified:   pgadmin/browser/server_groups/servers/databases/foreign_
>> data_wrappers/foreign_servers/user_mapping/__init__.py
>> modified:   pgadmin/browser/server_groups/servers/databases/foreign_
>> data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py
>> modified:   pgadmin/browser/server_groups/servers/databases/foreign_
>> data_wrappers/foreign_servers/user_mapping/tests/test_user_
>> mapping_delete.py
>> modified:   pgadmin/browser/server_groups/servers/databases/foreign_
>> data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_get.py
>> modified:   pgadmin/browser/server_groups/servers/databases/foreign_
>> data_wrappers/foreign_servers/user_mapping/tests/test_user_mapping_put.py
>> modified:   pgadmin/browser/server_groups/servers/databases/foreign_
>> data_wrappers/foreign_servers/user_mapping/tests/utils.py
>>
>> pgadmin/browser/server_groups/servers/databases/foreign_data
>> _wrappers/foreign_servers/__init__.py:593: [E123] closing bracket does
>> not match indentation of opening bracket's line
>> pgadmin/browser/server_groups/servers/databases/foreign_data
>> _wrappers/foreign_servers/__init__.py:662: [E123] closing bracket does
>> not match indentation of opening bracket's line
>> pgadmin/browser/server_groups/servers/databases/foreign_data
>> _wrappers/foreign_servers/__init__.py:669: [E123] closing bracket does
>> not match indentation of opening bracket's line
>> pgadmin/browser/server_groups/servers/databases/foreign_data
>> _wrappers/foreign_servers/user_mapping/__init__.py:622: [E123] closing
>> bracket does not match indentation of opening bracket's line
>> pgadmin/browser/server_groups/servers/databases/foreign_data
>> _wrappers/foreign_servers/user_mapping/__init__.py:685: [E123] closing
>> bracket does not match indentation of opening bracket's line
>> pgadmin/browser/server_groups/servers/databases/foreign_data
>> _wrappers/foreign_servers/user_mapping/__init__.py:692: [E123] closing
>> bracket does not match indentation of opening bracket's line
>> pgadmin/browser/server_groups/servers/databases/foreign_data
>> _wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py:72:
>> pgadmin/browser/server_groups/servers/databases/foreign_data
>> _wrappers/foreign_servers/user_mapping/tests/test_user_mapping_add.py:84:
>> pgadmin/browser/server_groups/servers/databases/foreign_data
>> _wrappers/foreign_servers/user_mapping/tests/test_user_mapping_get.py:74:
>> pgadmin/browser/server_groups/servers/databases/foreign_data
>> _wrappers/foreign_servers/tests/test_foreign_servers_put.py:69: [E126]
>> continuation line over-indented for hanging indent
>> pgadmin/browser/server_groups/servers/databases/foreign_data
>> _wrappers/foreign_servers/tests/test_foreign_servers_put.py:71: [E121]
>> continuation line under-indented for hanging indent
>> pgadmin/browser/server_groups/servers/databases/foreign_data
>> _wrappers/tests/test_fdw_delete.py:25: [E126] continuation line
>> pgadmin/browser/server_groups/servers/databases/foreign_data
>> _wrappers/tests/test_fdw_delete.py:28: [E121] continuation line
>> pgadmin/browser/server_groups/servers/databases/foreign_data
>> _wrappers/tests/test_fdw_delete.py:55: [E126] continuation line

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

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