Skip to content

change: enable unidiomatic-typecheck pylint check #921

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

Merged
merged 2 commits into from
Jul 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ disable=
attribute-defined-outside-init, # TODO: Fix scope
protected-access, # TODO: Fix access
abstract-method, # TODO: Fix abstract methods
unidiomatic-typecheck, # TODO: Fix typechecks
wrong-import-order, # TODO: Fix import order
no-else-return, # TODO: Remove unnecessary elses
useless-object-inheritance, # TODO: Remove unnecessary imports
Expand Down
2 changes: 1 addition & 1 deletion src/sagemaker/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def _compilation_job_config(
input_model_config = {
"S3Uri": self.model_data,
"DataInputConfig": input_shape
if type(input_shape) != dict
if not isinstance(input_shape, dict)
else json.dumps(input_shape),
"Framework": framework,
}
Expand Down
6 changes: 3 additions & 3 deletions src/sagemaker/vpc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,23 @@ def sanitize(vpc_config):
"""
if vpc_config is None:
return vpc_config
elif type(vpc_config) is not dict:
elif not isinstance(vpc_config, dict):
raise ValueError("vpc_config is not a dict: {}".format(vpc_config))
elif not vpc_config:
raise ValueError("vpc_config is empty")

subnets = vpc_config.get(SUBNETS_KEY)
if subnets is None:
raise ValueError("vpc_config is missing key: {}".format(SUBNETS_KEY))
if type(subnets) is not list:
if not isinstance(subnets, list):
raise ValueError("vpc_config value for {} is not a list: {}".format(SUBNETS_KEY, subnets))
elif not subnets:
raise ValueError("vpc_config value for {} is empty".format(SUBNETS_KEY))

security_group_ids = vpc_config.get(SECURITY_GROUP_IDS_KEY)
if security_group_ids is None:
raise ValueError("vpc_config is missing key: {}".format(SECURITY_GROUP_IDS_KEY))
if type(security_group_ids) is not list:
if not isinstance(security_group_ids, list):
raise ValueError(
"vpc_config value for {} is not a list: {}".format(
SECURITY_GROUP_IDS_KEY, security_group_ids
Expand Down