Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and Shayna Kapadia committed Dec 16, 2024
1 parent 1b42b60 commit 2eae730
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/cli_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ Our SBOM after the `cli add` command:
```
## surfactant cli save
The **cli save** command saves the edited sbom to the output file specified.
The **cli save** command saves the edited sbom to the output file specified.
### Example:
```bash
surfactant cli save new_sbom.json
```
```
4 changes: 2 additions & 2 deletions surfactant/cmd/cli_commands/cli_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ def serialize(sbom: SBOM) -> str:
Returns:
str: A string representation of the serialized SBOM.
"""
# NOTE: python pickle cannot pickle MappingProxyType, which is inherently included in the Field type.
# NOTE: python pickle cannot pickle MappingProxyType, which is inherently included in the Field type.
# Pickling is much faster than converting to json or msgpack (see MR for timings: https://github.com/LLNL/Surfactant/pull/261
# To workaround the issue we replace the metadata attribute of the Field type (which is default mappingproxytype) with an empty dict
# Upon deserialization, we recreate the class with dataclasses.replace() to ensure the unpickled class instance is intact. Without this,
# Upon deserialization, we recreate the class with dataclasses.replace() to ensure the unpickled class instance is intact. Without this,
# the class function to_json() and to_dict() does not work as the Field type is no longer recongized.
if isinstance(sbom, SBOM):
for _, v in sbom.__dataclass_fields__.items():
Expand Down

0 comments on commit 2eae730

Please sign in to comment.