You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/06/19 15:10:19 UTC

[GitHub] [incubator-superset] mistercrunch commented on a change in pull request #10106: refactor: Re-enable pylint on 5 files

mistercrunch commented on a change in pull request #10106:
URL: https://github.com/apache/incubator-superset/pull/10106#discussion_r442895851



##########
File path: superset/connectors/sqla/models.py
##########
@@ -1169,24 +1189,30 @@ def fetch_metadata(self, commit: bool = True) -> None:
         dbcols = (
             db.session.query(TableColumn)
             .filter(TableColumn.table == self)
-            .filter(or_(TableColumn.column_name == col.name for col in table.columns))
+            .filter(
+                or_(TableColumn.column_name == col.name for col in my_table.columns)
+            )
         )
         dbcols = {dbcol.column_name: dbcol for dbcol in dbcols}
 
-        for col in table.columns:
+        for col in my_table.columns:
             try:
                 datatype = db_engine_spec.column_datatype_to_string(
                     col.type, db_dialect
                 )
-            except Exception as ex:
+            except Exception as ex:  # pylint: disable=broad-except
                 datatype = "UNKNOWN"
-                logger.error("Unrecognized data type in {}.{}".format(table, col.name))
+                logger.error("Unrecognized data type in %s.%s", my_table, col.name)
                 logger.exception(ex)
             dbcol = dbcols.get(col.name, None)
             if not dbcol:
                 dbcol = TableColumn(column_name=col.name, type=datatype, table=self)
-                dbcol.sum = dbcol.is_numeric
-                dbcol.avg = dbcol.is_numeric
+                dbcol.sum = (
+                    dbcol.is_numeric
+                )  # pylint: disable=attribute-defined-outside-init
+                dbcol.avg = (
+                    dbcol.is_numeric
+                )  # pylint: disable=attribute-defined-outside-init

Review comment:
       I think that the comment applies to the block, meaning you can:
   ```python
   # pylint: disable=attribute-defined-outside-init
   dbcol.sum = dbcol.is_numeric
   dbcol.avg = dbcol.is_numeric
   ```
   https://docs.pylint.org/en/1.6.0/faq.html#is-it-possible-to-locally-disable-a-particular-message
   
   It'd be nice to have more scoping options in `pylint`, but block is a good place to start.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org