Skip to content

Commit 0054aff

Browse files
lambertacopybara-github
authored andcommitted
Fix Python 3.14 pathlib compatibility in nblint
PiperOrigin-RevId: 914344701
1 parent 7c36502 commit 0054aff

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

tools/tensorflow_docs/tools/nblint/style/gemini_cookbook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def split_path_on_dir(fp, dirname, offset=1):
161161
parts = fp.parts
162162
idx = parts.index(dirname)
163163
docs_dir = pathlib.Path(*parts[idx : idx + offset])
164-
rel_path = fp.relative_to(*parts[: idx + offset])
164+
rel_path = fp.relative_to(pathlib.Path(*parts[: idx + offset]))
165165
return docs_dir, rel_path
166166

167167
if "site" in fp_full.parts:

tools/tensorflow_docs/tools/nblint/style/tensorflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def split_path_on_dir(fp, dirname, offset=1):
137137
parts = fp.parts
138138
idx = parts.index(dirname)
139139
docs_dir = pathlib.Path(*parts[idx:idx + offset])
140-
rel_path = fp.relative_to(*parts[:idx + offset])
140+
rel_path = fp.relative_to(pathlib.Path(*parts[: idx + offset]))
141141
return docs_dir, rel_path
142142

143143
if "site" in fp_full.parts:

0 commit comments

Comments
 (0)