Fixed some lint errors in TensorFlow Privacy.

* Fixed `g-importing-member`
* Fixed `g-bad-import-order`

PiperOrigin-RevId: 424926847
This commit is contained in:
Michael Reneer 2022-01-28 12:09:38 -08:00 committed by A. Unique TensorFlower
parent 943ef91ee9
commit e6536597c5
3 changed files with 12 additions and 7 deletions

View file

@ -12,14 +12,17 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
"""BoltOn Method for privacy.""" """BoltOn Method for privacy."""
from distutils import version
import sys import sys
from distutils.version import LooseVersion
import tensorflow.compat.v1 as tf import tensorflow.compat.v1 as tf
if LooseVersion(tf.__version__) < LooseVersion("2.0.0"): if version.LooseVersion(tf.__version__) < version.LooseVersion("2.0.0"):
raise ImportError("Please upgrade your version " raise ImportError("Please upgrade your version "
"of tensorflow from: {0} to at least 2.0.0 to " "of tensorflow from: {0} to at least 2.0.0 to "
"use privacy/bolt_on".format(LooseVersion(tf.__version__))) "use privacy/bolt_on".format(
version.LooseVersion(tf.__version__)))
if hasattr(sys, "skip_tf_privacy_import"): # Useful for standalone scripts. if hasattr(sys, "skip_tf_privacy_import"): # Useful for standalone scripts.
pass pass
else: else:

View file

@ -28,8 +28,9 @@ Includes two types of datasets:
- MNIST 10-class classification dataset. - MNIST 10-class classification dataset.
""" """
from typing import Tuple
import dataclasses import dataclasses
from typing import Tuple
import numpy as np import numpy as np
from sklearn import preprocessing from sklearn import preprocessing
import tensorflow as tf import tensorflow as tf

View file

@ -13,10 +13,11 @@
# limitations under the License. # limitations under the License.
"""Generate random sequences.""" """Generate random sequences."""
import dataclasses
import itertools import itertools
import string import string
from typing import Dict, List from typing import Dict, List
from dataclasses import dataclass
import numpy as np import numpy as np
@ -66,7 +67,7 @@ def generate_random_sequences(vocab: List[str],
return list(seq) return list(seq)
@dataclass @dataclasses.dataclass
class SecretConfig: class SecretConfig:
"""Configuration of secret for secrets sharer. """Configuration of secret for secrets sharer.
@ -85,7 +86,7 @@ class SecretConfig:
num_references: int num_references: int
@dataclass @dataclasses.dataclass
class Secrets: class Secrets:
"""Secrets for secrets sharer. """Secrets for secrets sharer.