Skip to content

Commit 0fd3ad5

Browse files
yileitensorflow-copybara
authored andcommitted
Update code for Python 3.11 compatibility.
PiperOrigin-RevId: 566973675
1 parent aaa9d3e commit 0fd3ad5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

neural_structured_learning/tools/build_graph_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def _create_graph_file(self):
8787
return self.create_tempfile('graph.tsv').full_path
8888

8989
def _num_file_lines(self, graph_path):
90-
with open(graph_path, 'rU') as f:
90+
with open(graph_path, 'r') as f:
9191
return sum(1 for _ in f)
9292

9393
def testBuildGraphInvalidLshBitsValue(self):

neural_structured_learning/tools/graph_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def read_tsv_graph(filename):
124124
logging.info('Reading graph file: %s...', filename)
125125
graph = {}
126126
edge_cnt = 0
127-
with open(filename, 'rU') as f:
127+
with open(filename, 'r') as f:
128128
for tsv_line in f:
129129
edge = tsv_line.rstrip('\n').split('\t')
130130
if add_edge(graph, edge): edge_cnt += 1

0 commit comments

Comments
 (0)