sbp commented on code in PR #1032:
URL:
https://github.com/apache/tooling-trusted-releases/pull/1032#discussion_r3029951592
##########
atr/attestable.py:
##########
@@ -90,25 +92,26 @@ def compute_file_state_rows(
rows: list[sql.ReleaseFileState] = []
- for path_key in sorted(path_to_hash):
+ for path_key in sorted(path_to_hash, key=str):
+ path_str = str(path_key)
content_hash = path_to_hash[path_key]
classification = classifications[path_key]
# If all prior metadata properties are the same, we skip recording an
event
- if (prev_hashes.get(path_key) == content_hash) and
(prev_classifications.get(path_key) == classification):
+ if (prev_hashes.get(path_str) == content_hash) and
(prev_classifications.get(path_str) == classification):
continue
rows.append(
sql.ReleaseFileState(
release_key=release_key,
- path=path_key,
+ path=path_str,
since_revision_seq=since_revision_seq,
present=True,
content_hash=content_hash,
classification=classification,
)
)
-
+ str_keys = [str(k) for k in path_to_hash]
Review Comment:
This was a check in a dict before, and is now a check in a list. Would
probably be a good idea to make it a set.
##########
atr/models/safe.py:
##########
@@ -57,6 +57,9 @@ def __init__(self, value: str) -> None:
def __bool__(self) -> bool:
return True
+ def __fspath__(self) -> str:
Review Comment:
This makes every safe type a valid path, which seems wrong. It should
probably only be set on types that we know are _always_ paths. Otherwise I
think we should have an explicit coercion method, at most.
##########
atr/post/draft.py:
##########
@@ -296,8 +293,8 @@ async def modify(path: pathlib.Path, old_rev: sql.Revision
| None) -> None:
project_key,
version_key,
old_rev.safe_number,
- str(path_in_new_revision),
- str(sbom_path_in_new_revision),
+ path_in_new_revision,
Review Comment:
`convert_cyclonedx` doesn't like the new types.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]