Skip to content

Commit 684ffad

Browse files
arjungtensorflow-copybara
authored andcommitted
Rename graph building library files for consistency with the 'input_maker' module.
- graph_builder.py -> graph_builder_lib.py - graph_builder_test.py -> graph_builder_lib_test.py PiperOrigin-RevId: 272901940
1 parent f34ea03 commit 684ffad

File tree

5 files changed

+20
-19
lines changed

5 files changed

+20
-19
lines changed

neural_structured_learning/tools/BUILD

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ py_library(
2929
srcs = ["__init__.py"],
3030
srcs_version = "PY2AND3",
3131
deps = [
32-
":graph_builder",
32+
":graph_builder_lib",
3333
":graph_utils",
3434
":input_maker_lib",
3535
],
@@ -56,8 +56,8 @@ py_test(
5656
)
5757

5858
py_library(
59-
name = "graph_builder",
60-
srcs = ["graph_builder.py"],
59+
name = "graph_builder_lib",
60+
srcs = ["graph_builder_lib.py"],
6161
srcs_version = "PY2AND3",
6262
deps = [
6363
":graph_utils",
@@ -69,11 +69,11 @@ py_library(
6969
)
7070

7171
py_test(
72-
name = "graph_builder_test",
73-
srcs = ["graph_builder_test.py"],
72+
name = "graph_builder_lib_test",
73+
srcs = ["graph_builder_lib_test.py"],
7474
srcs_version = "PY2AND3",
7575
deps = [
76-
":graph_builder",
76+
":graph_builder_lib",
7777
":graph_utils",
7878
# package protobuf,
7979
# package absl/testing:absltest
@@ -86,7 +86,7 @@ py_binary(
8686
srcs = ["graph_builder_main.py"],
8787
python_version = "PY3",
8888
deps = [
89-
":graph_builder",
89+
":graph_builder_lib",
9090
# package absl:app
9191
# package absl/flags
9292
# package tensorflow

neural_structured_learning/tools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Tools and APIs for preparing data for Neural Structured Learning."""
22

3-
from neural_structured_learning.tools.graph_builder import build_graph
3+
from neural_structured_learning.tools.graph_builder_lib import build_graph
44
from neural_structured_learning.tools.graph_utils import add_edge
55
from neural_structured_learning.tools.graph_utils import add_undirected_edges
66
from neural_structured_learning.tools.graph_utils import read_tsv_graph

neural_structured_learning/tools/graph_builder_test.py renamed to neural_structured_learning/tools/graph_builder_lib_test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
"""Tests for neural_structured_learning.tools.graph_builder."""
14+
"""Tests for neural_structured_learning.tools.graph_builder_lib."""
1515

1616
from __future__ import absolute_import
1717
from __future__ import division
1818
from __future__ import print_function
1919

2020
from absl.testing import absltest
21-
from neural_structured_learning.tools import graph_builder
21+
from neural_structured_learning.tools import graph_builder_lib
2222
from neural_structured_learning.tools import graph_utils
2323
import tensorflow as tf
2424

@@ -82,9 +82,9 @@ def testGraphBuildingNoThresholding(self):
8282
embedding_path = self._create_embedding_file()
8383
self._write_embeddings(embedding_path)
8484
graph_path = self._create_graph_file()
85-
graph_builder.build_graph([embedding_path],
86-
graph_path,
87-
similarity_threshold=0)
85+
graph_builder_lib.build_graph([embedding_path],
86+
graph_path,
87+
similarity_threshold=0)
8888
g_actual = graph_utils.read_tsv_graph(graph_path)
8989
self.assertDictEqual(
9090
g_actual, {
@@ -107,9 +107,9 @@ def testGraphBuildingWithThresholding(self):
107107
embedding_path = self._create_embedding_file()
108108
self._write_embeddings(embedding_path)
109109
graph_path = self._create_graph_file()
110-
graph_builder.build_graph([embedding_path],
111-
graph_path,
112-
similarity_threshold=0.51)
110+
graph_builder_lib.build_graph([embedding_path],
111+
graph_path,
112+
similarity_threshold=0.51)
113113
g_actual = graph_utils.read_tsv_graph(graph_path)
114114
self.assertDictEqual(g_actual, {})
115115

neural_structured_learning/tools/graph_builder_main.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
from absl import app
3333
from absl import flags
34-
from neural_structured_learning.tools import graph_builder
34+
from neural_structured_learning.tools import graph_builder_lib
3535
import tensorflow as tf
3636

3737

@@ -44,8 +44,9 @@ def _main(argv):
4444
'Invalid number of arguments; expected 2 or more, got %d' %
4545
(len(argv) - 1))
4646

47-
graph_builder.build_graph(argv[1:-1], argv[-1], flag.similarity_threshold,
48-
flag.id_feature_name, flag.embedding_feature_name)
47+
graph_builder_lib.build_graph(argv[1:-1], argv[-1], flag.similarity_threshold,
48+
flag.id_feature_name,
49+
flag.embedding_feature_name)
4950

5051

5152
if __name__ == '__main__':

0 commit comments

Comments
 (0)