Skip to content

Commit d34dc2d

Browse files
committed
Add more print debugging
1 parent 8c35501 commit d34dc2d

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

pystac/link.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ def get_href(self, transform_href: bool = True) -> str | None:
172172
href = self._target_object.get_self_href()
173173
else:
174174
href = self._target_href
175+
print("starting href:", href)
175176

176177
if (
177178
transform_href
@@ -191,7 +192,7 @@ def get_href(self, transform_href: bool = True) -> str | None:
191192
owner_href = self.owner.get_self_href()
192193
if owner_href is not None:
193194
href = make_relative_href(href, owner_href)
194-
195+
print("new href:", href)
195196
return href
196197

197198
@property

pystac/stac_io.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,6 @@ def read_text_from_href(self, href: str) -> str:
304304
raise Exception(f"Could not read uri {href}") from e
305305
else:
306306
href = safe_urlparse(href).path
307-
if href.startswith("/D:/"):
308-
href = href[1:]
309307
with open(href, encoding="utf-8") as f:
310308
href_contents = f.read()
311309
return href_contents

pystac/utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def safe_urlparse(href: str) -> URLParseResult:
6060
and not href.lower().startswith(f"{parsed.scheme}://")
6161
)
6262
):
63-
return URLParseResult(
63+
output = URLParseResult(
6464
scheme="",
6565
netloc="",
6666
path="{}:{}".format(
@@ -73,15 +73,19 @@ def safe_urlparse(href: str) -> URLParseResult:
7373
query=parsed.query,
7474
fragment=parsed.fragment,
7575
)
76+
print("non-file scheme gives:", output.path)
77+
return output
7678
if parsed.scheme == "file" and parsed.netloc:
77-
return URLParseResult(
79+
output = URLParseResult(
7880
scheme=parsed.scheme,
7981
netloc="",
8082
path=f"{parsed.netloc}{parsed.path}",
8183
params=parsed.params,
8284
query=parsed.query,
8385
fragment=parsed.fragment,
8486
)
87+
print("file scheme gives:", output.path)
88+
return output
8589
else:
8690
return parsed
8791

@@ -215,10 +219,7 @@ def _make_relative_href_path(
215219
# posixpath doesn't play well with windows drive letters, so we have to use
216220
# the os-specific path library for the relpath function. This means we can
217221
# only handle windows paths on windows machines.
218-
print("start_dir: ", start_dir)
219-
print("source_path:", source_path)
220222
relpath = make_posix_style(os.path.relpath(source_path, start_dir))
221-
print("relpath:", relpath)
222223

223224
# Ensure we retain a trailing slash from the original source path
224225
if parsed_source.path.endswith("/"):

0 commit comments

Comments
 (0)