Skip to content

Commit da1929f

Browse files
committed
\nRe-sync comments\n
PiperOrigin-RevId: 319467552
1 parent 2df3e59 commit da1929f

File tree

17 files changed

+52
-61
lines changed

17 files changed

+52
-61
lines changed

setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,3 @@ def generate_proto(source):
149149
[console_scripts]
150150
tfx=tfx.tools.cli.cli_main:cli_group
151151
""")
152-

tfx/components/base/base_driver_test.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ def setUp(self):
106106
pipeline_info=self._pipeline_info)
107107

108108
@mock.patch(
109-
'tfx.components.base.base_driver.BaseDriver.verify_input_artifacts'
110-
)
109+
'tfx.components.base.base_driver.BaseDriver.verify_input_artifacts')
111110
@mock.patch.object(types.ValueArtifact, 'read', fake_read)
112111
def testPreExecutionNewExecution(self, mock_verify_input_artifacts_fn):
113112
self._mock_metadata.search_artifacts.return_value = list(
@@ -142,8 +141,7 @@ def testPreExecutionNewExecution(self, mock_verify_input_artifacts_fn):
142141
_STRING_VALUE)
143142

144143
@mock.patch(
145-
'tfx.components.base.base_driver.BaseDriver.verify_input_artifacts'
146-
)
144+
'tfx.components.base.base_driver.BaseDriver.verify_input_artifacts')
147145
@mock.patch.object(types.ValueArtifact, 'read', fake_read)
148146
def testPreExecutionCached(self, mock_verify_input_artifacts_fn):
149147
self._mock_metadata.search_artifacts.return_value = list(

tfx/components/transform/executor_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def testCounters(self):
183183

184184
# The test data has 10036 instances in the train dataset, and 4964 instances
185185
# in the eval dataset (obtained by running:
186-
# gqui third_party/tfx/components/testdata/csv_example_gen/train/data* \
186+
# gqui third_party/py/tfx/components/testdata/csv_example_gen/train/data* \
187187
# 'select count(*)'
188188
# )
189189
# Since the analysis dataset (train) is read twice (once for analysis and

tfx/components/tuner/executor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
from absl import logging
2525
from kerastuner.engine import base_tuner
2626

27-
from google.protobuf import json_format
2827
from tfx import types
2928
from tfx.components.base import base_executor
3029
from tfx.components.trainer import fn_args_utils
3130
from tfx.components.util import udf_utils
3231
from tfx.proto import tuner_pb2
3332
from tfx.types import artifact_utils
3433
from tfx.utils import io_utils
34+
from google.protobuf import json_format
3535

3636
# Key for best hyperparameters in executor output_dict.
3737
_BEST_HYPERPARAMETERS_KEY = 'best_hyperparameters'

tfx/dsl/compiler/testdata/iris_pipeline_ir.pbtxt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# proto-message: Pipeline
33
#
44
# This file contains the IR of an adapted Iris example pipeline
5-
# third_party/tfx/examples/iris/iris_pipeline_beam.py
5+
# tfx/examples/iris/iris_pipeline_beam.py
66

77
pipeline_info {
88
id: "iris"

tfx/examples/custom_components/presto_example_gen/proto/presto_config.proto

+28-12
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,42 @@ package tfx.examples.custom_components.presto_example_gen;
1818
message PrestoConnConfig {
1919
// Based off official prestodb-python-client library
2020
// https://github.com/prestodb/presto-python-client
21-
string host = 1; // required
22-
oneof opt_port { uint32 port = 2; }
23-
oneof opt_user { string user = 3; }
24-
oneof opt_source { string source = 4; }
25-
oneof opt_catalog { string catalog = 5; }
26-
oneof opt_schema { string schema = 6; }
21+
string host = 1; // required
22+
oneof opt_port {
23+
uint32 port = 2;
24+
}
25+
oneof opt_user {
26+
string user = 3;
27+
}
28+
oneof opt_source {
29+
string source = 4;
30+
}
31+
oneof opt_catalog {
32+
string catalog = 5;
33+
}
34+
oneof opt_schema {
35+
string schema = 6;
36+
}
2737
// TODO session_properties = 7
2838
// TODO http_headers = 8
29-
oneof opt_http_scheme { string http_scheme = 9; }
39+
oneof opt_http_scheme {
40+
string http_scheme = 9;
41+
}
3042
oneof opt_auth {
31-
BasicAuthConfig basic_auth = 10; // prestodb.auth.BasicAuthentication class
43+
BasicAuthConfig basic_auth = 10; // prestodb.auth.BasicAuthentication class
3244
// TODO KerberosAuthConfig kerberos_auth = 11
3345
}
3446
// TODO redirect_handler = 12
35-
oneof opt_max_attempts { uint32 max_attempts = 13; }
36-
oneof opt_request_timeout { uint32 request_timeout = 14; }
47+
oneof opt_max_attempts {
48+
uint32 max_attempts = 13;
49+
}
50+
oneof opt_request_timeout {
51+
uint32 request_timeout = 14;
52+
}
3753
// TODO isolation_level = 15
3854

3955
message BasicAuthConfig {
40-
string username = 1; // required
41-
string password = 2; // required
56+
string username = 1; // required
57+
string password = 2; // required
4258
}
4359
}

tfx/experimental/templates/taxi/e2e_tests/kubeflow_e2e_test.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@
2323
from absl import logging
2424
import kfp
2525
import tensorflow as tf
26-
import yaml
27-
28-
from google.cloud import storage
2926
from tfx.experimental.templates.taxi.e2e_tests import test_utils
3027
from tfx.orchestration import test_utils as orchestration_test_utils
3128
from tfx.orchestration.kubeflow import test_utils as kubeflow_test_utils
3229
from tfx.utils import telemetry_utils
30+
import yaml
31+
from google.cloud import storage
3332

3433

3534
class TaxiTemplateKubeflowE2ETest(test_utils.BaseEndToEndTest):

tfx/extensions/google_cloud_ai_platform/runner_test.py

+6-18
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ def _serialize_custom_config_under_test(self) -> Dict[Text, Any]:
7979
result['custom_config'] = json_utils.dumps(result['custom_config'])
8080
return result
8181

82-
@mock.patch(
83-
'tfx.extensions.google_cloud_ai_platform.runner.discovery'
84-
)
82+
@mock.patch('tfx.extensions.google_cloud_ai_platform.runner.discovery')
8583
def testStartAIPTraining(self, mock_discovery):
8684
mock_discovery.build.return_value = self._mock_api_client
8785
self._setUpTrainingMocks()
@@ -114,9 +112,7 @@ def testStartAIPTraining(self, mock_discovery):
114112
self.assertStartsWith(body['jobId'], 'tfx_')
115113
self._mock_get.execute.assert_called_with()
116114

117-
@mock.patch(
118-
'tfx.extensions.google_cloud_ai_platform.runner.discovery'
119-
)
115+
@mock.patch('tfx.extensions.google_cloud_ai_platform.runner.discovery')
120116
def testStartAIPTrainingWithUserContainer(self, mock_discovery):
121117
mock_discovery.build.return_value = self._mock_api_client
122118
self._setUpTrainingMocks()
@@ -238,9 +234,7 @@ def _assertDeployModelMockCalls(self,
238234
self._project_id, self._model_name, self._model_version))
239235
self._mock_set_default_execute.assert_called_with()
240236

241-
@mock.patch(
242-
'tfx.extensions.google_cloud_ai_platform.runner.discovery'
243-
)
237+
@mock.patch('tfx.extensions.google_cloud_ai_platform.runner.discovery')
244238
def testDeployModelForAIPPrediction(self, mock_discovery):
245239
mock_discovery.build.return_value = self._mock_api_client
246240
self._setUpPredictionMocks()
@@ -257,9 +251,7 @@ def testDeployModelForAIPPrediction(self, mock_discovery):
257251
self._assertDeployModelMockCalls(
258252
expected_models_create_body=expected_models_create_body)
259253

260-
@mock.patch(
261-
'tfx.extensions.google_cloud_ai_platform.runner.discovery'
262-
)
254+
@mock.patch('tfx.extensions.google_cloud_ai_platform.runner.discovery')
263255
def testDeployModelForAIPPredictionError(self, mock_discovery):
264256
mock_discovery.build.return_value = self._mock_api_client
265257
self._setUpPredictionMocks()
@@ -286,9 +278,7 @@ def testDeployModelForAIPPredictionError(self, mock_discovery):
286278
expected_models_create_body=expected_models_create_body,
287279
expect_set_default=False)
288280

289-
@mock.patch(
290-
'tfx.extensions.google_cloud_ai_platform.runner.discovery'
291-
)
281+
@mock.patch('tfx.extensions.google_cloud_ai_platform.runner.discovery')
292282
def testDeployModelForAIPPredictionWithCustomRegion(self, mock_discovery):
293283
mock_discovery.build.return_value = self._mock_api_client
294284
self._setUpPredictionMocks()
@@ -306,9 +296,7 @@ def testDeployModelForAIPPredictionWithCustomRegion(self, mock_discovery):
306296
self._assertDeployModelMockCalls(
307297
expected_models_create_body=expected_models_create_body)
308298

309-
@mock.patch(
310-
'tfx.extensions.google_cloud_ai_platform.runner.discovery'
311-
)
299+
@mock.patch('tfx.extensions.google_cloud_ai_platform.runner.discovery')
312300
def testDeployModelForAIPPredictionWithCustomRuntime(self, mock_discovery):
313301
mock_discovery.build.return_value = self._mock_api_client
314302
self._setUpPredictionMocks()

tfx/extensions/google_cloud_ai_platform/tuner/executor_test.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
# TODO(b/160252429): Clearn up lint warining.
2323
import tensorflow as tf
2424

25-
from google.protobuf import json_format
2625
from tfx.extensions.google_cloud_ai_platform.trainer import executor as ai_platform_trainer_executor
2726
from tfx.extensions.google_cloud_ai_platform.tuner import executor as ai_platform_tuner_executor
2827
from tfx.proto import tuner_pb2
2928
from tfx.utils import json_utils
29+
from google.protobuf import json_format
3030

3131

3232
class ExecutorTest(tf.test.TestCase):
@@ -57,8 +57,8 @@ def setUp(self):
5757

5858
self.addCleanup(mock.patch.stopall)
5959
self.mock_runner = mock.patch(
60-
'tfx.extensions.google_cloud_ai_platform.tuner.executor.runner'
61-
).start()
60+
'tfx.extensions.google_cloud_ai_platform.tuner.executor.runner').start(
61+
)
6262

6363
def _serialize_custom_config_under_test(self) -> Dict[Text, Any]:
6464
"""Converts self._exec_properties['custom_config'] to string."""

tfx/orchestration/airflow/airflow_dag_runner_test.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ def __init__(self, spec: types.ComponentSpec):
106106

107107
class AirflowDagRunnerTest(tf.test.TestCase):
108108

109-
@mock.patch(
110-
'tfx.orchestration.airflow.airflow_component.AirflowComponent'
111-
)
109+
@mock.patch('tfx.orchestration.airflow.airflow_component.AirflowComponent')
112110
@mock.patch('airflow.models.DAG')
113111
def testAirflowDagRunner(self, mock_airflow_dag_class,
114112
mock_airflow_component_class):

tfx/orchestration/experimental/interactive/interactive_context_test.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,8 @@ def testExportToPipelineRaisesErrorInvalidRunnerType(self):
203203
export_filepath=export_filepath,
204204
runner_type='foobar')
205205

206-
@mock.patch(
207-
'tfx.orchestration.experimental.interactive.'
208-
'standard_visualizations.ExampleAnomaliesVisualization.display')
206+
@mock.patch('tfx.orchestration.experimental.interactive.'
207+
'standard_visualizations.ExampleAnomaliesVisualization.display')
209208
def testShow(self, *unused_mocks):
210209
context = interactive_context.InteractiveContext()
211210
mock_object = mock.MagicMock()

tfx/orchestration/experimental/interactive/visualizations_test.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ def tearDown(self):
3737
del builtins.__dict__['__IPYTHON__']
3838
super(VisualizationsTest, self).tearDown()
3939

40-
@mock.patch(
41-
'tfx.orchestration.experimental.interactive.'
42-
'visualizations.get_registry')
40+
@mock.patch('tfx.orchestration.experimental.interactive.'
41+
'visualizations.get_registry')
4342
def testVisualizationRegistrationAndUsage(self, *unused_mocks):
4443
registry = visualizations.ArtifactVisualizationRegistry()
4544
visualizations.get_registry = mock.MagicMock(return_value=registry)

tfx/proto/orchestration/pipeline.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ message PropertyPredicate {
139139
// The left-hand side element to the logical operator.
140140
PropertyPredicate lhs = 2;
141141
// The right-hand side element to the logical operator.
142-
PropertyPredicate rhs= 3;
142+
PropertyPredicate rhs = 3;
143143
}
144144
oneof operator {
145145
ValueComparator value_comparator = 1;

tfx/proto/pusher.proto

-1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,3 @@ enum Versioning {
5252
// model is the same.
5353
UNIX_TIMESTAMP = 1;
5454
}
55-

tfx/proto/trainer.proto

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package tfx.components.trainer;
1717

1818
// Args specific to training.
1919
message TrainArgs {
20-
2120
// The number of steps to train on.
2221
int32 num_steps = 2;
2322

@@ -26,7 +25,6 @@ message TrainArgs {
2625

2726
// Args specific to eval.
2827
message EvalArgs {
29-
3028
// The number of evaluation steps to take.
3129
int32 num_steps = 2;
3230

tfx/tools/build_docs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
from tensorflow_docs.api_generator import generate_lib
4949

5050

51-
# Standard Imports.third_party.tfx as tfx
51+
import tfx as tfx
5252
# pylint: disable=unused-import
5353
from tfx import components
5454
from tfx import orchestration

tfx/tools/cli/handler/template_handler.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,7 @@ def copy_template(flags_dict: Dict[Text, Any]) -> None:
164164
_IMPORT_FROM_PACKAGE: _IMPORT_FROM_LOCAL_DIR,
165165
_PLACEHOLDER_PIPELINE_NAME: pipeline_name,
166166
}
167-
_copy_and_replace_placeholder_dir(template_dir,
168-
destination_dir,
169-
ignore_paths,
167+
_copy_and_replace_placeholder_dir(template_dir, destination_dir, ignore_paths,
170168
replace_dict)
171169
for additional_file in _ADDITIONAL_FILE_PATHS.get(model, []):
172170
src_path = os.path.join(_tfx_src_dir(), additional_file.src)

0 commit comments

Comments
 (0)