pylint: accept specific 2 character names by default (#9460)

* lint: accept 2 letter names by default

* Address review comments

* Remove e and d from good-names
This commit is contained in:
Ville Brofeldt
2020-04-08 20:32:26 +03:00
committed by GitHub
parent 4485800e21
commit 980dd2fd41
72 changed files with 421 additions and 431 deletions

View File

@@ -270,9 +270,9 @@ class DatabaseRestApi(DatabaseMixin, BaseSupersetModelRestApi):
self.incr_stats("init", self.table_metadata.__name__)
try:
table_info: Dict = get_table_metadata(database, table_name, schema_name)
except SQLAlchemyError as e:
except SQLAlchemyError as ex:
self.incr_stats("error", self.table_metadata.__name__)
return self.response_422(error_msg_from_exception(e))
return self.response_422(error_msg_from_exception(ex))
self.incr_stats("success", self.table_metadata.__name__)
return self.response(200, **table_info)

View File

@@ -32,9 +32,7 @@ def check_datasource_access(f):
A Decorator that checks if a user has datasource access
"""
def wraps(
self, pk: int, table_name: str, schema_name: Optional[str] = None
): # pylint: disable=invalid-name
def wraps(self, pk: int, table_name: str, schema_name: Optional[str] = None):
schema_name_parsed = parse_js_uri_path_item(schema_name, eval_undefined=True)
table_name_parsed = parse_js_uri_path_item(table_name)
if not table_name_parsed:

View File

@@ -234,9 +234,9 @@ class DatabaseMixin:
# this will check whether json.loads(extra) can succeed
try:
extra = database.get_extra()
except Exception as e:
except Exception as ex:
raise Exception(
_("Extra field cannot be decoded by JSON. %{msg}s", msg=str(e))
_("Extra field cannot be decoded by JSON. %{msg}s", msg=str(ex))
)
# this will check whether 'metadata_params' is configured correctly
@@ -256,7 +256,7 @@ class DatabaseMixin:
# this will check whether json.loads(secure_extra) can succeed
try:
database.get_encrypted_extra()
except Exception as e:
except Exception as ex:
raise Exception(
_("Extra field cannot be decoded by JSON. %{msg}s", msg=str(e))
_("Extra field cannot be decoded by JSON. %{msg}s", msg=str(ex))
)

View File

@@ -158,7 +158,7 @@ class CsvToDatabaseView(SimpleFormView):
table.fetch_metadata()
db.session.add(table)
db.session.commit()
except Exception as e: # pylint: disable=broad-except
except Exception as ex: # pylint: disable=broad-except
db.session.rollback()
try:
os.remove(path)
@@ -171,7 +171,7 @@ class CsvToDatabaseView(SimpleFormView):
filename=csv_filename,
table_name=form.name.data,
db_name=database.database_name,
error_msg=str(e),
error_msg=str(ex),
)
flash(message, "danger")