Skip to content

Commit 28a6b3b

Browse files
committed
run linter
1 parent ef80244 commit 28a6b3b

File tree

121 files changed

+34922
-30183
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+34922
-30183
lines changed

.bazelrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ build --protocopt=--experimental_allow_proto3_optional
88
# parameter 'user_link_flags' is deprecated and will be removed soon.
99
# It may be temporarily re-enabled by setting --incompatible_require_linker_input_cc_api=false
1010
build --incompatible_require_linker_input_cc_api=false
11-

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.5.0
1+
6.5.0

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@ dmypy.json
126126
.pyre/
127127

128128
# pb2.py files
129-
*_pb2.py
129+
*_pb2.py

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,4 +238,3 @@ tag.
238238
* [TensorFlow Data Validation PyPI](https://pypi.org/project/tensorflow-data-validation/)
239239
* [TensorFlow Data Validation Paper](https://mlsys.org/Conferences/2019/doc/2019/167.pdf)
240240
* [TensorFlow Data Validation Slides](https://conf.slac.stanford.edu/xldb2018/sites/xldb2018.conf.slac.stanford.edu/files/Tues_09.45_NeoklisPolyzotis_Data%20Analysis%20and%20Validation%20(1).pdf)
241-

g3doc/custom_data_validation.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,3 @@ See the
4343
[documentation](https://github.com/tensorflow/data-validation/blob/master/tensorflow_data_validation/anomalies/proto/custom_validation_config.proto)
4444
in the `CustomValidationConfig` proto for example
4545
configurations.
46-
47-

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,3 @@ ignore = [
146146

147147
[tool.ruff.lint.per-file-ignores]
148148
"__init__.py" = ["F401"]
149-

setup.py

Lines changed: 142 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -12,222 +12,225 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
"""Package Setup script for TensorFlow Data Validation."""
15+
1516
import os
1617
import platform
1718
import shutil
1819
import subprocess
1920
import sys
2021

21-
import setuptools
22-
from setuptools import find_packages
23-
from setuptools import setup
24-
from setuptools.command.install import install
25-
from setuptools.dist import Distribution
2622
# pylint:disable=g-bad-import-order
2723
# setuptools must be imported prior to distutils.
2824
from distutils.command import build
25+
26+
import setuptools
27+
from setuptools import find_packages, setup
28+
from setuptools.command.install import install
29+
from setuptools.dist import Distribution
30+
2931
# pylint:enable=g-bad-import-order
3032

3133

3234
class _BuildCommand(build.build):
33-
"""Build everything that is needed to install.
35+
"""Build everything that is needed to install.
3436
35-
This overrides the original distutils "build" command to to run bazel_build
36-
command before any sub_commands.
37+
This overrides the original distutils "build" command to to run bazel_build
38+
command before any sub_commands.
3739
38-
build command is also invoked from bdist_wheel and install command, therefore
39-
this implementation covers the following commands:
40-
- pip install . (which invokes bdist_wheel)
41-
- python setup.py install (which invokes install command)
42-
- python setup.py bdist_wheel (which invokes bdist_wheel command)
43-
"""
40+
build command is also invoked from bdist_wheel and install command, therefore
41+
this implementation covers the following commands:
42+
- pip install . (which invokes bdist_wheel)
43+
- python setup.py install (which invokes install command)
44+
- python setup.py bdist_wheel (which invokes bdist_wheel command)
45+
"""
4446

45-
def _build_cc_extensions(self):
46-
return True
47+
def _build_cc_extensions(self):
48+
return True
4749

48-
# Add "bazel_build" command as the first sub_command of "build". Each
49-
# sub_command of "build" (e.g. "build_py", "build_ext", etc.) is executed
50-
# sequentially when running a "build" command, if the second item in the tuple
51-
# (predicate method) is evaluated to true.
52-
sub_commands = [
53-
('bazel_build', _build_cc_extensions),
54-
] + build.build.sub_commands
50+
# Add "bazel_build" command as the first sub_command of "build". Each
51+
# sub_command of "build" (e.g. "build_py", "build_ext", etc.) is executed
52+
# sequentially when running a "build" command, if the second item in the tuple
53+
# (predicate method) is evaluated to true.
54+
sub_commands = [
55+
("bazel_build", _build_cc_extensions),
56+
] + build.build.sub_commands
5557

5658

5759
class _BazelBuildCommand(setuptools.Command):
58-
"""Build TFDV C++ extensions and public protos with Bazel.
59-
60-
Running this command will populate foo_pb2.py file next to your foo.proto
61-
file.
62-
"""
63-
64-
def initialize_options(self):
65-
pass
66-
67-
def finalize_options(self):
68-
self._bazel_cmd = shutil.which('bazel')
69-
if not self._bazel_cmd:
70-
raise RuntimeError(
71-
'Could not find "bazel" binary. Please visit '
72-
'https://docs.bazel.build/versions/master/install.html for '
73-
'installation instruction.')
74-
self._additional_build_options = []
75-
if platform.system() == 'Darwin':
76-
self._additional_build_options = ['--macos_minimum_os=10.14']
77-
78-
def run(self):
79-
subprocess.check_call(
80-
[self._bazel_cmd, 'run', '-c', 'opt'] + self._additional_build_options +
81-
['//tensorflow_data_validation:move_generated_files'],
82-
# Bazel should be invoked in a directory containing bazel WORKSPACE
83-
# file, which is the root directory.
84-
cwd=os.path.dirname(os.path.realpath(__file__)),
85-
env=dict(os.environ, PYTHON_BIN_PATH=sys.executable))
60+
"""Build TFDV C++ extensions and public protos with Bazel.
61+
62+
Running this command will populate foo_pb2.py file next to your foo.proto
63+
file.
64+
"""
65+
66+
def initialize_options(self):
67+
pass
68+
69+
def finalize_options(self):
70+
self._bazel_cmd = shutil.which("bazel")
71+
if not self._bazel_cmd:
72+
raise RuntimeError(
73+
'Could not find "bazel" binary. Please visit '
74+
"https://docs.bazel.build/versions/master/install.html for "
75+
"installation instruction."
76+
)
77+
self._additional_build_options = []
78+
if platform.system() == "Darwin":
79+
self._additional_build_options = ["--macos_minimum_os=10.14"]
80+
81+
def run(self):
82+
subprocess.check_call(
83+
[self._bazel_cmd, "run", "-c", "opt"]
84+
+ self._additional_build_options
85+
+ ["//tensorflow_data_validation:move_generated_files"],
86+
# Bazel should be invoked in a directory containing bazel WORKSPACE
87+
# file, which is the root directory.
88+
cwd=os.path.dirname(os.path.realpath(__file__)),
89+
env=dict(os.environ, PYTHON_BIN_PATH=sys.executable),
90+
)
8691

8792

8893
# TFDV is not a purelib. However because of the extension module is not built
8994
# by setuptools, it will be incorrectly treated as a purelib. The following
9095
# works around that bug.
9196
class _InstallPlatlibCommand(install):
92-
93-
def finalize_options(self):
94-
install.finalize_options(self)
95-
self.install_lib = self.install_platlib
97+
def finalize_options(self):
98+
install.finalize_options(self)
99+
self.install_lib = self.install_platlib
96100

97101

98102
class _BinaryDistribution(Distribution):
99-
"""This class is needed in order to create OS specific wheels."""
103+
"""This class is needed in order to create OS specific wheels."""
100104

101-
def is_pure(self):
102-
return False
105+
def is_pure(self):
106+
return False
103107

104-
def has_ext_modules(self):
105-
return True
108+
def has_ext_modules(self):
109+
return True
106110

107111

108112
def _make_mutual_information_requirements():
109-
return ['scikit-learn>=1.0,<2', 'scipy>=1.5,<2']
113+
return ["scikit-learn>=1.0,<2", "scipy>=1.5,<2"]
110114

111115

112116
def _make_visualization_requirements():
113-
return [
114-
'ipython>=7,<8',
115-
]
117+
return [
118+
"ipython>=7,<8",
119+
]
116120

117121

118122
def _make_all_extra_requirements():
119-
return (_make_mutual_information_requirements() +
120-
_make_visualization_requirements())
123+
return _make_mutual_information_requirements() + _make_visualization_requirements()
121124

122125

123126
def select_constraint(default, nightly=None, git_master=None):
124-
"""Select dependency constraint based on TFX_DEPENDENCY_SELECTOR env var."""
125-
selector = os.environ.get('TFX_DEPENDENCY_SELECTOR')
126-
if selector == 'UNCONSTRAINED':
127-
return ''
128-
elif selector == 'NIGHTLY' and nightly is not None:
129-
return nightly
130-
elif selector == 'GIT_MASTER' and git_master is not None:
131-
return git_master
132-
else:
133-
return default
127+
"""Select dependency constraint based on TFX_DEPENDENCY_SELECTOR env var."""
128+
selector = os.environ.get("TFX_DEPENDENCY_SELECTOR")
129+
if selector == "UNCONSTRAINED":
130+
return ""
131+
elif selector == "NIGHTLY" and nightly is not None:
132+
return nightly
133+
elif selector == "GIT_MASTER" and git_master is not None:
134+
return git_master
135+
else:
136+
return default
134137

135138

136139
# Get version from version module.
137-
with open('tensorflow_data_validation/version.py') as fp:
138-
globals_dict = {}
139-
exec(fp.read(), globals_dict) # pylint: disable=exec-used
140-
__version__ = globals_dict['__version__']
140+
with open("tensorflow_data_validation/version.py") as fp:
141+
globals_dict = {}
142+
exec(fp.read(), globals_dict) # pylint: disable=exec-used
143+
__version__ = globals_dict["__version__"]
141144

142145
# Get the long description from the README file.
143-
with open('README.md') as fp:
144-
_LONG_DESCRIPTION = fp.read()
146+
with open("README.md") as fp:
147+
_LONG_DESCRIPTION = fp.read()
145148

146149
setup(
147-
name='tensorflow-data-validation',
150+
name="tensorflow-data-validation",
148151
version=__version__,
149-
author='Google LLC',
150-
author_email='[email protected]',
151-
license='Apache 2.0',
152+
author="Google LLC",
153+
author_email="[email protected]",
154+
license="Apache 2.0",
152155
classifiers=[
153-
'Development Status :: 5 - Production/Stable',
154-
'Intended Audience :: Developers',
155-
'Intended Audience :: Education',
156-
'Intended Audience :: Science/Research',
157-
'License :: OSI Approved :: Apache Software License',
158-
'Operating System :: MacOS :: MacOS X',
159-
'Operating System :: POSIX :: Linux',
160-
'Programming Language :: Python',
161-
'Programming Language :: Python :: 3',
162-
'Programming Language :: Python :: 3.9',
163-
'Programming Language :: Python :: 3.10',
164-
'Programming Language :: Python :: 3.11',
165-
'Programming Language :: Python :: 3 :: Only',
166-
'Topic :: Scientific/Engineering',
167-
'Topic :: Scientific/Engineering :: Artificial Intelligence',
168-
'Topic :: Scientific/Engineering :: Mathematics',
169-
'Topic :: Software Development',
170-
'Topic :: Software Development :: Libraries',
171-
'Topic :: Software Development :: Libraries :: Python Modules',
156+
"Development Status :: 5 - Production/Stable",
157+
"Intended Audience :: Developers",
158+
"Intended Audience :: Education",
159+
"Intended Audience :: Science/Research",
160+
"License :: OSI Approved :: Apache Software License",
161+
"Operating System :: MacOS :: MacOS X",
162+
"Operating System :: POSIX :: Linux",
163+
"Programming Language :: Python",
164+
"Programming Language :: Python :: 3",
165+
"Programming Language :: Python :: 3.9",
166+
"Programming Language :: Python :: 3.10",
167+
"Programming Language :: Python :: 3.11",
168+
"Programming Language :: Python :: 3 :: Only",
169+
"Topic :: Scientific/Engineering",
170+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
171+
"Topic :: Scientific/Engineering :: Mathematics",
172+
"Topic :: Software Development",
173+
"Topic :: Software Development :: Libraries",
174+
"Topic :: Software Development :: Libraries :: Python Modules",
172175
],
173176
namespace_packages=[],
174177
# Make sure to sync the versions of common dependencies (absl-py, numpy,
175178
# six, and protobuf) with TF.
176179
install_requires=[
177-
'absl-py>=0.9,<2.0.0',
180+
"absl-py>=0.9,<2.0.0",
178181
'apache-beam[gcp]>=2.53,<3;python_version>="3.11"',
179182
'apache-beam[gcp]>=2.50,<2.51;python_version<"3.11"',
180183
# TODO(b/139941423): Consider using multi-processing provided by
181184
# Beam's DirectRunner.
182-
'joblib>=1.2.0', # Dependency for multi-processing.
183-
'numpy>=1.22.0',
184-
'pandas>=1.0,<2',
185+
"joblib>=1.2.0", # Dependency for multi-processing.
186+
"numpy>=1.22.0",
187+
"pandas>=1.0,<2",
185188
'protobuf>=4.25.2,<6.0.0;python_version>="3.11"',
186189
'protobuf>=4.21.6,<6.0.0;python_version<"3.11"',
187-
'pyarrow>=10,<11',
188-
'pyfarmhash>=0.2.2,<0.4',
189-
'six>=1.12,<2',
190-
'tensorflow>=2.17,<2.18',
191-
'tensorflow-metadata'
190+
"pyarrow>=10,<11",
191+
"pyfarmhash>=0.2.2,<0.4",
192+
"six>=1.12,<2",
193+
"tensorflow>=2.17,<2.18",
194+
"tensorflow-metadata"
192195
+ select_constraint(
193-
default='>=1.17.1,<1.18',
194-
nightly='>=1.18.0.dev',
195-
git_master='@git+https://github.com/tensorflow/metadata@master',
196+
default=">=1.17.1,<1.18",
197+
nightly=">=1.18.0.dev",
198+
git_master="@git+https://github.com/tensorflow/metadata@master",
196199
),
197-
'tfx-bsl'
200+
"tfx-bsl"
198201
+ select_constraint(
199-
default='>=1.17.1,<1.18',
200-
nightly='>=1.18.0.dev',
201-
git_master='@git+https://github.com/tensorflow/tfx-bsl@master',
202+
default=">=1.17.1,<1.18",
203+
nightly=">=1.18.0.dev",
204+
git_master="@git+https://github.com/tensorflow/tfx-bsl@master",
202205
),
203206
],
204207
extras_require={
205-
'mutual-information': _make_mutual_information_requirements(),
206-
'visualization': _make_visualization_requirements(),
207-
'dev': ["precommit"],
208-
'test': [
209-
"pytest",
210-
"scikit-learn",
211-
"scipy",
208+
"mutual-information": _make_mutual_information_requirements(),
209+
"visualization": _make_visualization_requirements(),
210+
"dev": ["precommit"],
211+
"test": [
212+
"pytest",
213+
"scikit-learn",
214+
"scipy",
212215
],
213-
'all': _make_all_extra_requirements(),
216+
"all": _make_all_extra_requirements(),
214217
},
215-
python_requires='>=3.9,<4',
218+
python_requires=">=3.9,<4",
216219
packages=find_packages(),
217220
include_package_data=True,
218-
package_data={'': ['*.lib', '*.pyd', '*.so']},
221+
package_data={"": ["*.lib", "*.pyd", "*.so"]},
219222
zip_safe=False,
220223
distclass=_BinaryDistribution,
221-
description='A library for exploring and validating machine learning data.',
224+
description="A library for exploring and validating machine learning data.",
222225
long_description=_LONG_DESCRIPTION,
223-
long_description_content_type='text/markdown',
224-
keywords='tensorflow data validation tfx',
225-
url='https://www.tensorflow.org/tfx/data_validation/get_started',
226-
download_url='https://github.com/tensorflow/data-validation/tags',
226+
long_description_content_type="text/markdown",
227+
keywords="tensorflow data validation tfx",
228+
url="https://www.tensorflow.org/tfx/data_validation/get_started",
229+
download_url="https://github.com/tensorflow/data-validation/tags",
227230
requires=[],
228231
cmdclass={
229-
'install': _InstallPlatlibCommand,
230-
'build': _BuildCommand,
231-
'bazel_build': _BazelBuildCommand,
232+
"install": _InstallPlatlibCommand,
233+
"build": _BuildCommand,
234+
"bazel_build": _BazelBuildCommand,
232235
},
233236
)

0 commit comments

Comments
 (0)