-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(pylint): Bump Pylint to 2.9.6 #16146
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,7 @@ disable= | |
super-with-arguments, | ||
too-few-public-methods, | ||
too-many-locals, | ||
duplicate-code, | ||
|
||
[REPORTS] | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -506,7 +506,7 @@ def get_all_view_names_in_database( | |
return self.db_engine_spec.get_all_datasource_names(self, "view") | ||
|
||
@cache_util.memoized_func( | ||
key=lambda self, schema, *args, **kwargs: f"db:{self.id}:schema:{schema}:table_list", # type: ignore | ||
key=lambda self, schema, *args, **kwargs: f"db:{self.id}:schema:{schema}:table_list", | ||
cache=cache_manager.data_cache, | ||
) | ||
def get_all_table_names_in_schema( | ||
|
@@ -536,9 +536,10 @@ def get_all_table_names_in_schema( | |
] | ||
except Exception as ex: # pylint: disable=broad-except | ||
logger.warning(ex) | ||
return [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kind of surprised Mypy didn't find this. |
||
|
||
@cache_util.memoized_func( | ||
key=lambda self, schema, *args, **kwargs: f"db:{self.id}:schema:{schema}:view_list", # type: ignore | ||
key=lambda self, schema, *args, **kwargs: f"db:{self.id}:schema:{schema}:view_list", | ||
cache=cache_manager.data_cache, | ||
) | ||
def get_all_view_names_in_schema( | ||
|
@@ -566,6 +567,7 @@ def get_all_view_names_in_schema( | |
return [utils.DatasourceName(table=view, schema=schema) for view in views] | ||
except Exception as ex: # pylint: disable=broad-except | ||
logger.warning(ex) | ||
return [] | ||
|
||
@cache_util.memoized_func( | ||
key=lambda self, *args, **kwargs: f"db:{self.id}:schema_list", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,17 +31,20 @@ | |
|
||
|
||
class ScheduleType(str, enum.Enum): | ||
# pylint: disable=invalid-name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I opted not the change these enums (and others) to uppercase as the string representation of the lowercase name is used in the database and I wanted to minimize the size of the PR. |
||
slice = "slice" | ||
dashboard = "dashboard" | ||
alert = "alert" | ||
|
||
|
||
class EmailDeliveryType(str, enum.Enum): | ||
# pylint: disable=invalid-name | ||
attachment = "Attachment" | ||
inline = "Inline" | ||
|
||
|
||
class SliceEmailReportFormat(str, enum.Enum): | ||
# pylint: disable=invalid-name | ||
visualization = "Visualization" | ||
data = "Raw data" | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ class TagTypes(enum.Enum): | |
can find all their objects by querying for the tag `owner:alice`. | ||
""" | ||
|
||
# pylint: disable=invalid-name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I opted not the change these enums to uppercase as the string representation of the lowercase name is used throughout and I wanted to minimize the size of the PR. |
||
# explicit tags, added manually by the owner | ||
custom = 1 | ||
|
||
|
@@ -59,6 +60,7 @@ class ObjectTypes(enum.Enum): | |
|
||
"""Object types.""" | ||
|
||
# pylint: disable=invalid-name | ||
query = 1 | ||
chart = 2 | ||
dashboard = 3 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1321,8 +1321,8 @@ def get_first_metric_name(metrics: Sequence[Metric]) -> Optional[str]: | |
def ensure_path_exists(path: str) -> None: | ||
try: | ||
os.makedirs(path) | ||
except OSError as exc: | ||
if not (os.path.isdir(path) and exc.errno == errno.EEXIST): | ||
except OSError as ex: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fixes a potential bug as |
||
if not (os.path.isdir(path) and ex.errno == errno.EEXIST): | ||
raise | ||
|
||
|
||
|
@@ -1440,9 +1440,8 @@ def create_ssl_cert_file(certificate: str) -> str: | |
if not os.path.exists(path): | ||
# Validate certificate prior to persisting to temporary directory | ||
parse_ssl_cert(certificate) | ||
cert_file = open(path, "w") | ||
cert_file.write(certificate) | ||
cert_file.close() | ||
with open(path, "w") as cert_file: | ||
cert_file.write(certificate) | ||
return path | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -593,7 +593,7 @@ def geohash_encode( | |
) | ||
return _append_columns(df, encode_df, {"geohash": geohash}) | ||
except ValueError: | ||
QueryObjectValidationError(_("Invalid longitude/latitude")) | ||
raise QueryObjectValidationError(_("Invalid longitude/latitude")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixes a potential bug as the exception was never raised. |
||
|
||
|
||
def geodetic_parse( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
pylint
caught this this is a nice improvement 👍There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know many people find Pylint somewhat verbose and cumbersome, but the linting rules and checks are far superior than other linters in my opinion.