Skip to content

Commit

Permalink
Update code for Python 3.11 compatibility.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 566973675
  • Loading branch information
yilei authored and tensorflow-copybara committed Sep 20, 2023
1 parent aaa9d3e commit 0fd3ad5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion neural_structured_learning/tools/build_graph_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _create_graph_file(self):
return self.create_tempfile('graph.tsv').full_path

def _num_file_lines(self, graph_path):
with open(graph_path, 'rU') as f:
with open(graph_path, 'r') as f:
return sum(1 for _ in f)

def testBuildGraphInvalidLshBitsValue(self):
Expand Down
2 changes: 1 addition & 1 deletion neural_structured_learning/tools/graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def read_tsv_graph(filename):
logging.info('Reading graph file: %s...', filename)
graph = {}
edge_cnt = 0
with open(filename, 'rU') as f:
with open(filename, 'r') as f:
for tsv_line in f:
edge = tsv_line.rstrip('\n').split('\t')
if add_edge(graph, edge): edge_cnt += 1
Expand Down

0 comments on commit 0fd3ad5

Please sign in to comment.