Skip to content

Commit 11b4700

Browse files
Merge branch '29-lint-fixes' into 29-lint-workflow
2 parents 09197ab + b737804 commit 11b4700

File tree

107 files changed

+15822
-14535
lines changed

Some content is hidden

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

107 files changed

+15822
-14535
lines changed

setup.py

Lines changed: 58 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -25,68 +25,67 @@
2525
# built by setuptools, it will be incorrectly treated as a purelib. The
2626
# following works around that bug.
2727
class _InstallPlatlib(install):
28-
29-
def finalize_options(self):
30-
install.finalize_options(self)
31-
self.install_lib = self.install_platlib
28+
def finalize_options(self):
29+
install.finalize_options(self)
30+
self.install_lib = self.install_platlib
3231

3332

3433
class BinaryDistribution(Distribution):
35-
"""This class is needed in order to create OS specific wheels."""
34+
"""This class is needed in order to create OS specific wheels."""
3635

37-
def is_pure(self):
38-
return False
36+
def is_pure(self):
37+
return False
3938

40-
def has_ext_modules(self):
41-
return True
39+
def has_ext_modules(self):
40+
return True
4241

4342

4443
def select_constraint(default, nightly=None, git_master=None):
45-
"""Select dependency constraint based on TFX_DEPENDENCY_SELECTOR env var."""
46-
selector = os.environ.get('TFX_DEPENDENCY_SELECTOR')
47-
if selector == 'UNCONSTRAINED':
48-
return ''
49-
if selector == 'NIGHTLY' and nightly is not None:
50-
return nightly
51-
if selector == 'GIT_MASTER' and git_master is not None:
52-
return git_master
53-
return default
44+
"""Select dependency constraint based on TFX_DEPENDENCY_SELECTOR env var."""
45+
selector = os.environ.get("TFX_DEPENDENCY_SELECTOR")
46+
if selector == "UNCONSTRAINED":
47+
return ""
48+
if selector == "NIGHTLY" and nightly is not None:
49+
return nightly
50+
if selector == "GIT_MASTER" and git_master is not None:
51+
return git_master
52+
return default
5453

5554

5655
# Get the long description from the README file.
57-
with open('README.md') as fp:
58-
_LONG_DESCRIPTION = fp.read()
56+
with open("README.md") as fp:
57+
_LONG_DESCRIPTION = fp.read()
5958

60-
with open('struct2tensor/version.py') as fp:
61-
globals_dict = {}
62-
exec(fp.read(), globals_dict) # pylint: disable=exec-used
63-
__version__ = globals_dict['__version__']
59+
with open("struct2tensor/version.py") as fp:
60+
globals_dict = {}
61+
exec(fp.read(), globals_dict) # pylint: disable=exec-used
62+
__version__ = globals_dict["__version__"]
6463

6564
setup(
66-
name='struct2tensor',
65+
name="struct2tensor",
6766
version=__version__,
6867
description=(
69-
'Struct2Tensor is a package for parsing and manipulating'
70-
' structured data for TensorFlow'
68+
"Struct2Tensor is a package for parsing and manipulating"
69+
" structured data for TensorFlow"
7170
),
72-
author='Google LLC',
73-
author_email='[email protected]',
71+
author="Google LLC",
72+
author_email="[email protected]",
7473
# Contained modules and scripts.
7574
packages=find_packages(),
7675
install_requires=[
7776
# TODO(b/263060885): Remove the explicit numpy dependency once TF works
7877
# with numpy>=1.24.
79-
'numpy>=1.22',
78+
"numpy>=1.22",
8079
'protobuf>=4.25.2,<6.0.0;python_version>="3.11"',
8180
'protobuf>=4.21.6,<6.0.0;python_version<"3.11"',
82-
'tensorflow>=2.17,<2.18',
83-
'tensorflow-metadata'
81+
"tensorflow>=2.17,<2.18",
82+
"tensorflow-metadata"
8483
+ select_constraint(
85-
default='>=1.17.0,<1.18.0',
86-
nightly='>=1.18.0.dev',
87-
git_master='@git+https://github.com/tensorflow/metadata@master',
84+
default=">=1.17.0,<1.18.0",
85+
nightly=">=1.18.0.dev",
86+
git_master="@git+https://github.com/tensorflow/metadata@master",
8887
),
89-
'pyarrow>=10,<11',
88+
"pyarrow>=10,<11",
9089
],
9190
extras_require={
9291
'lint': [
@@ -95,33 +94,33 @@ def select_constraint(default, nightly=None, git_master=None):
9594
},
9695
# Add in any packaged data.
9796
include_package_data=True,
98-
package_data={'': ['*.lib', '*.so']},
97+
package_data={"": ["*.lib", "*.so"]},
9998
zip_safe=False,
10099
distclass=BinaryDistribution,
101100
# PyPI package information.
102101
classifiers=[
103-
'Development Status :: 4 - Beta',
104-
'Intended Audience :: Developers',
105-
'Intended Audience :: Education',
106-
'Intended Audience :: Science/Research',
107-
'License :: OSI Approved :: Apache Software License',
108-
'Operating System :: MacOS :: MacOS X',
109-
'Operating System :: POSIX :: Linux',
110-
'Programming Language :: Python',
111-
'Programming Language :: Python :: 3.9',
112-
'Programming Language :: Python :: 3.10',
113-
'Programming Language :: Python :: 3.11',
114-
'Programming Language :: Python :: 3 :: Only',
115-
'Topic :: Scientific/Engineering',
116-
'Topic :: Scientific/Engineering :: Artificial Intelligence',
117-
'Topic :: Scientific/Engineering :: Mathematics',
118-
'Topic :: Software Development',
119-
'Topic :: Software Development :: Libraries',
120-
'Topic :: Software Development :: Libraries :: Python Modules',
102+
"Development Status :: 4 - Beta",
103+
"Intended Audience :: Developers",
104+
"Intended Audience :: Education",
105+
"Intended Audience :: Science/Research",
106+
"License :: OSI Approved :: Apache Software License",
107+
"Operating System :: MacOS :: MacOS X",
108+
"Operating System :: POSIX :: Linux",
109+
"Programming Language :: Python",
110+
"Programming Language :: Python :: 3.9",
111+
"Programming Language :: Python :: 3.10",
112+
"Programming Language :: Python :: 3.11",
113+
"Programming Language :: Python :: 3 :: Only",
114+
"Topic :: Scientific/Engineering",
115+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
116+
"Topic :: Scientific/Engineering :: Mathematics",
117+
"Topic :: Software Development",
118+
"Topic :: Software Development :: Libraries",
119+
"Topic :: Software Development :: Libraries :: Python Modules",
121120
],
122-
license='Apache 2.0',
123-
keywords='tensorflow protobuf machine learning',
121+
license="Apache 2.0",
122+
keywords="tensorflow protobuf machine learning",
124123
long_description=_LONG_DESCRIPTION,
125-
long_description_content_type='text/markdown',
126-
cmdclass={'install': _InstallPlatlib},
124+
long_description_content_type="text/markdown",
125+
cmdclass={"install": _InstallPlatlib},
127126
)
-1.9 KB
Binary file not shown.
-26.8 KB
Binary file not shown.
-2.9 KB
Binary file not shown.
Binary file not shown.
-32.5 KB
Binary file not shown.
-10.4 KB
Binary file not shown.
-19.5 KB
Binary file not shown.
-44 KB
Binary file not shown.

struct2tensor/benchmarks/ops_benchmark.py

Lines changed: 57 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -38,64 +38,66 @@
3838

3939

4040
class EquiJoinIndicesBenchmarks(struct2tensor_benchmark_util.OpsBenchmarks):
41-
"""Benchmarks for EquiJoinIndices."""
42-
43-
@parameterized.named_parameters(*[
44-
dict(
45-
testcase_name="equi_join_indices_monotonic_increasing",
46-
fn_name="equi_join_indices_monotonic_increasing",
47-
fn_args=[],
48-
data_key="monotonic_increasing",
49-
),
50-
dict(
51-
testcase_name="equi_join_indices_random",
52-
fn_name="equi_join_indices_random",
53-
fn_args=[],
54-
data_key="random",
55-
),
56-
])
57-
def test_equi_join_indices(self, fn_name, fn_args, data_key):
58-
59-
def benchmark_fn(session):
60-
a = tf.compat.v1.placeholder(dtype=tf.int64, shape=(None,))
61-
b = tf.compat.v1.placeholder(dtype=tf.int64, shape=(None,))
62-
result = struct2tensor_ops.equi_join_indices(a, b)
63-
with tf.control_dependencies(result):
64-
x = tf.constant(1)
65-
return session.make_callable(x, feed_list=[a, b])
66-
67-
self.run_benchmarks(fn_name, benchmark_fn, fn_args, data_key)
41+
"""Benchmarks for EquiJoinIndices."""
42+
43+
@parameterized.named_parameters(
44+
*[
45+
dict(
46+
testcase_name="equi_join_indices_monotonic_increasing",
47+
fn_name="equi_join_indices_monotonic_increasing",
48+
fn_args=[],
49+
data_key="monotonic_increasing",
50+
),
51+
dict(
52+
testcase_name="equi_join_indices_random",
53+
fn_name="equi_join_indices_random",
54+
fn_args=[],
55+
data_key="random",
56+
),
57+
]
58+
)
59+
def test_equi_join_indices(self, fn_name, fn_args, data_key):
60+
def benchmark_fn(session):
61+
a = tf.compat.v1.placeholder(dtype=tf.int64, shape=(None,))
62+
b = tf.compat.v1.placeholder(dtype=tf.int64, shape=(None,))
63+
result = struct2tensor_ops.equi_join_indices(a, b)
64+
with tf.control_dependencies(result):
65+
x = tf.constant(1)
66+
return session.make_callable(x, feed_list=[a, b])
67+
68+
self.run_benchmarks(fn_name, benchmark_fn, fn_args, data_key)
6869

6970

7071
class EquiJoinAnyIndicesBenchmarks(struct2tensor_benchmark_util.OpsBenchmarks):
71-
"""Benchmarks for EquiJoinAnyIndices."""
72-
73-
@parameterized.named_parameters(*[
74-
dict(
75-
testcase_name="equi_join_any_indices_monotonic_increasing",
76-
fn_name="equi_join_any_indices_monotonic_increasing",
77-
fn_args=[],
78-
data_key="monotonic_increasing",
79-
),
80-
dict(
81-
testcase_name="equi_join_any_indices_random",
82-
fn_name="equi_join_any_indices_random",
83-
fn_args=[],
84-
data_key="random",
85-
),
86-
])
87-
def test_equi_join_indices(self, fn_name, fn_args, data_key):
88-
89-
def benchmark_fn(session):
90-
a = tf.compat.v1.placeholder(dtype=tf.int64, shape=(None,))
91-
b = tf.compat.v1.placeholder(dtype=tf.int64, shape=(None,))
92-
result = struct2tensor_ops.equi_join_any_indices(a, b)
93-
with tf.control_dependencies(result):
94-
x = tf.constant(1)
95-
return session.make_callable(x, feed_list=[a, b])
96-
97-
self.run_benchmarks(fn_name, benchmark_fn, fn_args, data_key)
72+
"""Benchmarks for EquiJoinAnyIndices."""
73+
74+
@parameterized.named_parameters(
75+
*[
76+
dict(
77+
testcase_name="equi_join_any_indices_monotonic_increasing",
78+
fn_name="equi_join_any_indices_monotonic_increasing",
79+
fn_args=[],
80+
data_key="monotonic_increasing",
81+
),
82+
dict(
83+
testcase_name="equi_join_any_indices_random",
84+
fn_name="equi_join_any_indices_random",
85+
fn_args=[],
86+
data_key="random",
87+
),
88+
]
89+
)
90+
def test_equi_join_indices(self, fn_name, fn_args, data_key):
91+
def benchmark_fn(session):
92+
a = tf.compat.v1.placeholder(dtype=tf.int64, shape=(None,))
93+
b = tf.compat.v1.placeholder(dtype=tf.int64, shape=(None,))
94+
result = struct2tensor_ops.equi_join_any_indices(a, b)
95+
with tf.control_dependencies(result):
96+
x = tf.constant(1)
97+
return session.make_callable(x, feed_list=[a, b])
98+
99+
self.run_benchmarks(fn_name, benchmark_fn, fn_args, data_key)
98100

99101

100102
if __name__ == "__main__":
101-
tf.test.main()
103+
tf.test.main()

0 commit comments

Comments
 (0)