Skip to content

change: enable attribute-defined-outside-init Pylint check #933

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
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 @@ -84,7 +84,6 @@ disable=
line-too-long, # We let Flake8 take care of this # TODO: Fix these and stop relying on flake8
len-as-condition, # TODO: Enable this check once pylint 2.4.0 is released and consumed due to the fix in https://github.com/PyCQA/pylint/issues/2684
import-error, # Since we run Pylint before any of our builds in tox, this will always fail
attribute-defined-outside-init, # TODO: Fix scope
protected-access, # TODO: Fix access
abstract-method, # TODO: Fix abstract methods
wrong-import-order, # TODO: Fix import order
Expand Down
2 changes: 1 addition & 1 deletion src/sagemaker/amazon/amazon_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(
data_location = data_location or "s3://{}/sagemaker-record-sets/".format(
self.sagemaker_session.default_bucket()
)
self.data_location = data_location
self._data_location = data_location
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relatively confident this was a typo


def train_image(self):
return get_image_uri(
Expand Down
8 changes: 8 additions & 0 deletions src/sagemaker/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class AnalyticsMetricsBase(with_metaclass(ABCMeta, object)):
Understands common functionality like persistence and caching.
"""

def __init__(self):
self._dataframe = None

def export_csv(self, filename):
"""Persists the analytics dataframe to a file.

Expand Down Expand Up @@ -88,6 +91,9 @@ def __init__(self, hyperparameter_tuning_job_name, sagemaker_session=None):
sagemaker_session = sagemaker_session or Session()
self._sage_client = sagemaker_session.sagemaker_client
self._tuning_job_name = hyperparameter_tuning_job_name
self._tuning_job_describe_result = None
self._training_job_summaries = None
super(HyperparameterTuningJobAnalytics, self).__init__()
self.clear_cache()

@property
Expand Down Expand Up @@ -240,6 +246,8 @@ def __init__(
self._metric_names = metric_names
else:
self._metric_names = self._metric_names_for_training_job()

super(TrainingJobAnalytics, self).__init__()
self.clear_cache()

@property
Expand Down
3 changes: 3 additions & 0 deletions src/sagemaker/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def __init__(
self.output_path = output_path
self.output_kms_key = output_kms_key
self.latest_training_job = None
self.deploy_instance_type = None

self._compiled_models = {}

Expand Down Expand Up @@ -1086,6 +1087,8 @@ def __init__(
self.image_name = image_name
self._enable_network_isolation = enable_network_isolation

self.uploaded_code = None

self._hyperparameters = hyperparameters or {}

def enable_network_isolation(self):
Expand Down
5 changes: 4 additions & 1 deletion src/sagemaker/local/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def start(self, input_data_config, output_data_config, hyperparameters, job_name
self.model_artifacts = self.container.train(
input_data_config, output_data_config, hyperparameters, job_name
)
self.end = datetime.datetime.now()
self.end_time = datetime.datetime.now()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relatively confident this was a typo

self.state = self._COMPLETED

def describe(self):
Expand Down Expand Up @@ -110,6 +110,9 @@ def __init__(self, transform_job_name, model_name, local_session=None):
self.start_time = None
self.end_time = None
self.batch_strategy = None
self.transform_resources = None
self.input_data = None
self.output_data = None
self.environment = {}
self.state = _LocalTransformJob._CREATING

Expand Down
1 change: 1 addition & 0 deletions src/sagemaker/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def __init__(
self.vpc_config = vpc_config
self.sagemaker_session = sagemaker_session
self._model_name = None
self.endpoint_name = None
self._is_compiled_model = False
self._enable_network_isolation = enable_network_isolation

Expand Down
1 change: 1 addition & 0 deletions src/sagemaker/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def __init__(
self.vpc_config = vpc_config
self.sagemaker_session = sagemaker_session
self._model_name = None
self.endpoint_name = None

def pipeline_container_def(self, instance_type):
"""Return a dict created by ``sagemaker.pipeline_container_def()`` for deploying this model to a specified
Expand Down
1 change: 1 addition & 0 deletions src/sagemaker/tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ def __init__(
self.latest_tuning_job = None
self.warm_start_config = warm_start_config
self.early_stopping_type = early_stopping_type
self.static_hyperparameters = None

def _prepare_for_training(self, job_name=None, include_cls_metadata=False):
if job_name is not None:
Expand Down