From 28dbbbb9e59ae9d36e2e009f942058873c17007e Mon Sep 17 00:00:00 2001 From: Michael Reneer Date: Wed, 26 Jan 2022 11:45:47 -0800 Subject: [PATCH] Remove TensorFlow Privacy Python `lint as` directive. This is now the default behavior. PiperOrigin-RevId: 424403961 --- g3doc/build_docs.py | 5 +---- .../privacy/membership_inference_attack/data_structures.py | 2 -- .../privacy/membership_inference_attack/dataset_slicing.py | 2 -- .../privacy/membership_inference_attack/keras_evaluation.py | 2 -- .../membership_inference_attack.py | 2 -- .../privacy/membership_inference_attack/models.py | 2 -- .../privacy/membership_inference_attack/plotting.py | 2 -- .../privacy/membership_inference_attack/privacy_report.py | 2 -- .../privacy/membership_inference_attack/seq2seq_mia.py | 2 -- .../membership_inference_attack/tf_estimator_evaluation.py | 2 -- .../membership_inference_attack/codelabs/example.py | 4 ++-- .../membership_inference_attack/data_structures.py | 3 +-- .../membership_inference_attack/data_structures_test.py | 4 ++-- .../membership_inference_attack/dataset_slicing.py | 3 +-- .../membership_inference_attack/dataset_slicing_test.py | 3 --- .../membership_inference_attack/keras_evaluation.py | 4 +--- .../membership_inference_attack/keras_evaluation_example.py | 3 +-- .../membership_inference_attack/keras_evaluation_test.py | 3 --- .../membership_inference_attack.py | 3 +-- .../membership_inference_attack_test.py | 2 -- .../privacy_tests/membership_inference_attack/models.py | 2 -- .../privacy_tests/membership_inference_attack/models_test.py | 2 -- .../privacy_tests/membership_inference_attack/plotting.py | 2 -- .../membership_inference_attack/privacy_report.py | 3 +-- .../membership_inference_attack/privacy_report_test.py | 3 --- .../privacy_tests/membership_inference_attack/seq2seq_mia.py | 3 +-- .../membership_inference_attack/seq2seq_mia_test.py | 2 -- .../membership_inference_attack/tf_estimator_evaluation.py | 3 ++- .../tf_estimator_evaluation_example.py | 3 +-- .../tf_estimator_evaluation_test.py | 3 --- .../privacy_tests/membership_inference_attack/utils.py | 1 - .../membership_inference_attack/utils_tensorboard.py | 3 +-- .../privacy_tests/membership_inference_attack/utils_test.py | 3 --- .../privacy/privacy_tests/secret_sharer/exposures_test.py | 4 ---- 34 files changed, 16 insertions(+), 76 deletions(-) diff --git a/g3doc/build_docs.py b/g3doc/build_docs.py index 9e2ebda..d038ad9 100644 --- a/g3doc/build_docs.py +++ b/g3doc/build_docs.py @@ -1,4 +1,3 @@ -# Lint as: python3 # Copyright 2021 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,15 +17,13 @@ import os from absl import app from absl import flags - import tensorflow as tf - from tensorflow_docs.api_generator import doc_controls from tensorflow_docs.api_generator import generate_lib from tensorflow_docs.api_generator import public_api - import tensorflow_privacy as tf_privacy + flags.DEFINE_string('output_dir', '/tmp/tf_privacy', 'Where to output the docs.') flags.DEFINE_string( diff --git a/tensorflow_privacy/privacy/membership_inference_attack/data_structures.py b/tensorflow_privacy/privacy/membership_inference_attack/data_structures.py index bf52465..83e6d9b 100644 --- a/tensorflow_privacy/privacy/membership_inference_attack/data_structures.py +++ b/tensorflow_privacy/privacy/membership_inference_attack/data_structures.py @@ -11,8 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Moved to privacy_attack/membership_inference_attack.""" from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import * # pylint: disable=wildcard-import diff --git a/tensorflow_privacy/privacy/membership_inference_attack/dataset_slicing.py b/tensorflow_privacy/privacy/membership_inference_attack/dataset_slicing.py index c5268ac..a03a31a 100644 --- a/tensorflow_privacy/privacy/membership_inference_attack/dataset_slicing.py +++ b/tensorflow_privacy/privacy/membership_inference_attack/dataset_slicing.py @@ -11,8 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Moved to privacy_attack/membership_inference_attack.""" from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.dataset_slicing import * # pylint: disable=wildcard-import diff --git a/tensorflow_privacy/privacy/membership_inference_attack/keras_evaluation.py b/tensorflow_privacy/privacy/membership_inference_attack/keras_evaluation.py index 7cdafe8..1bbaacf 100644 --- a/tensorflow_privacy/privacy/membership_inference_attack/keras_evaluation.py +++ b/tensorflow_privacy/privacy/membership_inference_attack/keras_evaluation.py @@ -11,8 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Moved to privacy_attack/membership_inference_attack.""" from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.keras_evaluation import * # pylint: disable=wildcard-import diff --git a/tensorflow_privacy/privacy/membership_inference_attack/membership_inference_attack.py b/tensorflow_privacy/privacy/membership_inference_attack/membership_inference_attack.py index 90aa00e..46076ed 100644 --- a/tensorflow_privacy/privacy/membership_inference_attack/membership_inference_attack.py +++ b/tensorflow_privacy/privacy/membership_inference_attack/membership_inference_attack.py @@ -11,8 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Moved to privacy_attack/membership_inference_attack.""" from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.membership_inference_attack import * # pylint: disable=wildcard-import diff --git a/tensorflow_privacy/privacy/membership_inference_attack/models.py b/tensorflow_privacy/privacy/membership_inference_attack/models.py index 008b776..b494c62 100644 --- a/tensorflow_privacy/privacy/membership_inference_attack/models.py +++ b/tensorflow_privacy/privacy/membership_inference_attack/models.py @@ -11,8 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Moved to privacy_attack/membership_inference_attack.""" from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.models import * # pylint: disable=wildcard-import diff --git a/tensorflow_privacy/privacy/membership_inference_attack/plotting.py b/tensorflow_privacy/privacy/membership_inference_attack/plotting.py index 93f6d0a..89d1ea6 100644 --- a/tensorflow_privacy/privacy/membership_inference_attack/plotting.py +++ b/tensorflow_privacy/privacy/membership_inference_attack/plotting.py @@ -11,8 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Moved to privacy_attack/membership_inference_attack.""" from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.plotting import * # pylint: disable=wildcard-import diff --git a/tensorflow_privacy/privacy/membership_inference_attack/privacy_report.py b/tensorflow_privacy/privacy/membership_inference_attack/privacy_report.py index 93f6d0a..89d1ea6 100644 --- a/tensorflow_privacy/privacy/membership_inference_attack/privacy_report.py +++ b/tensorflow_privacy/privacy/membership_inference_attack/privacy_report.py @@ -11,8 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Moved to privacy_attack/membership_inference_attack.""" from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.plotting import * # pylint: disable=wildcard-import diff --git a/tensorflow_privacy/privacy/membership_inference_attack/seq2seq_mia.py b/tensorflow_privacy/privacy/membership_inference_attack/seq2seq_mia.py index e034424..0fb1326 100644 --- a/tensorflow_privacy/privacy/membership_inference_attack/seq2seq_mia.py +++ b/tensorflow_privacy/privacy/membership_inference_attack/seq2seq_mia.py @@ -11,8 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Moved to privacy_attack/membership_inference_attack.""" from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.seq2seq_mia import * # pylint: disable=wildcard-import diff --git a/tensorflow_privacy/privacy/membership_inference_attack/tf_estimator_evaluation.py b/tensorflow_privacy/privacy/membership_inference_attack/tf_estimator_evaluation.py index 6c402df..e641f78 100644 --- a/tensorflow_privacy/privacy/membership_inference_attack/tf_estimator_evaluation.py +++ b/tensorflow_privacy/privacy/membership_inference_attack/tf_estimator_evaluation.py @@ -11,8 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Moved to privacy_attack/membership_inference_attack.""" from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.tf_estimator_evaluation import * # pylint: disable=wildcard-import diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/codelabs/example.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/codelabs/example.py index 47454f7..bd2c885 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/codelabs/example.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/codelabs/example.py @@ -11,12 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """An example for the membership inference attacks. This is using a toy model based on classifying four spacial clusters of data. """ + import os import tempfile @@ -28,6 +27,7 @@ from sklearn import metrics from tensorflow import keras from tensorflow.keras import layers from tensorflow.keras.utils import to_categorical + from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import membership_inference_attack as mia from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackInputData diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/data_structures.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/data_structures.py index da21ebd..180a890 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/data_structures.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/data_structures.py @@ -11,9 +11,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Data structures representing attack inputs, configuration, outputs.""" + import collections import dataclasses import enum diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/data_structures_test.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/data_structures_test.py index eb9a669..4cb11a8 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/data_structures_test.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/data_structures_test.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Lint as: python3 -"""Tests for tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures.""" import os import tempfile + from absl.testing import absltest from absl.testing import parameterized import numpy as np import pandas as pd + from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import _log_value from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackInputData from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackResults diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/dataset_slicing.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/dataset_slicing.py index db68cd0..b9eb40a 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/dataset_slicing.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/dataset_slicing.py @@ -11,8 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Specifying and creating AttackInputData slices.""" import collections @@ -20,6 +18,7 @@ import copy from typing import List import numpy as np + from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackInputData from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SingleSliceSpec from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SlicingFeature diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/dataset_slicing_test.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/dataset_slicing_test.py index 9777e4a..2ce8438 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/dataset_slicing_test.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/dataset_slicing_test.py @@ -12,9 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Lint as: python3 -"""Tests for tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.dataset_slicing.""" - from absl.testing import absltest import numpy as np diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/keras_evaluation.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/keras_evaluation.py index 6091a59..5205baf 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/keras_evaluation.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/keras_evaluation.py @@ -11,14 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """A callback and a function in keras for membership inference attack.""" import os from typing import Iterable -from absl import logging +from absl import logging import tensorflow as tf from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import membership_inference_attack as mia diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/keras_evaluation_example.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/keras_evaluation_example.py index 2bb7278..15e56f3 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/keras_evaluation_example.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/keras_evaluation_example.py @@ -12,14 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Lint as: python3 """An example for using keras_evaluation.""" from absl import app from absl import flags - import numpy as np import tensorflow as tf + from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackType from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import get_flattened_attack_metrics from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SlicingSpec diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/keras_evaluation_test.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/keras_evaluation_test.py index f6d2747..53a3098 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/keras_evaluation_test.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/keras_evaluation_test.py @@ -12,9 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Lint as: python3 -"""Tests for tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.keras_evaluation.""" - from absl.testing import absltest import numpy as np diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/membership_inference_attack.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/membership_inference_attack.py index 4ee7e73..80c951f 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/membership_inference_attack.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/membership_inference_attack.py @@ -11,8 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Code that runs membership inference attacks based on the model outputs. This file belongs to the new API for membership inference attacks. This file @@ -20,6 +18,7 @@ will be renamed to membership_inference_attack.py after the old API is removed. """ from typing import Iterable + import numpy as np from sklearn import metrics diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/membership_inference_attack_test.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/membership_inference_attack_test.py index f7d9401..a934e30 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/membership_inference_attack_test.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/membership_inference_attack_test.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Lint as: python3 -"""Tests for tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.utils.""" from absl.testing import absltest import numpy as np diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/models.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/models.py index 9e78a98..ab15d12 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/models.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/models.py @@ -11,8 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Trained models for membership inference attacks.""" import dataclasses diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/models_test.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/models_test.py index 09452e5..bad3d87 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/models_test.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/models_test.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Lint as: python3 -"""Tests for tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures.""" from absl.testing import absltest import numpy as np diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/plotting.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/plotting.py index ed801ca..5f6bb95 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/plotting.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/plotting.py @@ -11,8 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Plotting functionality for membership inference attack analysis. Functions to plot ROC curves and histograms as well as functionality to store diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/privacy_report.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/privacy_report.py index 6fd09db..f014fb5 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/privacy_report.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/privacy_report.py @@ -11,9 +11,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Plotting code for ML Privacy Reports.""" + from typing import Iterable import matplotlib.pyplot as plt import pandas as pd diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/privacy_report_test.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/privacy_report_test.py index ac5d904..f26dc25 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/privacy_report_test.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/privacy_report_test.py @@ -12,13 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Lint as: python3 -"""Tests for tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.privacy_report.""" from absl.testing import absltest import numpy as np from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import privacy_report - from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackResults from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackResultsCollection from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackType diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/seq2seq_mia.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/seq2seq_mia.py index 7a7d4df..e4c97dd 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/seq2seq_mia.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/seq2seq_mia.py @@ -11,14 +11,13 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Code for membership inference attacks on seq2seq models. Contains seq2seq specific logic for attack data structures, attack data generation, and the logistic regression membership inference attack. """ + import dataclasses from typing import Iterator, List diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/seq2seq_mia_test.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/seq2seq_mia_test.py index b21f8c4..03c1fb2 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/seq2seq_mia_test.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/seq2seq_mia_test.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Lint as: python3 -"""Tests for tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.seq2seq_mia.""" from absl.testing import absltest import numpy as np diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation.py index ff76c4b..afb80f0 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation.py @@ -12,14 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Lint as: python3 """A hook and a function in tf estimator for membership inference attack.""" import os + from typing import Iterable from absl import logging import numpy as np import tensorflow.compat.v1 as tf + from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import membership_inference_attack as mia from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackInputData from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackType diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation_example.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation_example.py index f1bc185..943f3c1 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation_example.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation_example.py @@ -12,15 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Lint as: python3 """An example for using tf_estimator_evaluation.""" from absl import app from absl import flags from absl import logging - import numpy as np import tensorflow.compat.v1 as tf + from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackType from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import get_flattened_attack_metrics from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SlicingSpec diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation_test.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation_test.py index 7ae11e5..4d40f87 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation_test.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation_test.py @@ -12,9 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Lint as: python3 -"""Tests for tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.tf_estimator_evaluation.""" - from absl.testing import absltest import numpy as np diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/utils.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/utils.py index 0231bb2..a29081e 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/utils.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/utils.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Lint as: python3 """Utility functions for membership inference attacks.""" import numpy as np diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/utils_tensorboard.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/utils_tensorboard.py index a9b6cce..401b890 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/utils_tensorboard.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/utils_tensorboard.py @@ -11,9 +11,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# Lint as: python3 """Utility functions for writing attack results to tensorboard.""" + from typing import List from typing import Union diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/utils_test.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/utils_test.py index 994b44f..bd9d80e 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/utils_test.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/utils_test.py @@ -12,10 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Lint as: python3 -"""Tests for tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.utils.""" from absl.testing import absltest - import numpy as np from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import utils diff --git a/tensorflow_privacy/privacy/privacy_tests/secret_sharer/exposures_test.py b/tensorflow_privacy/privacy/privacy_tests/secret_sharer/exposures_test.py index cb1e686..689be7f 100644 --- a/tensorflow_privacy/privacy/privacy_tests/secret_sharer/exposures_test.py +++ b/tensorflow_privacy/privacy/privacy_tests/secret_sharer/exposures_test.py @@ -12,11 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Lint as: python3 -"""Tests for tensorflow_privacy.privacy.secret_sharer.exposures.""" - from absl.testing import absltest - import numpy as np from scipy.stats import skewnorm