Skip to content

Commit

Permalink
add indent and remove typing
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded committed Jul 3, 2024
1 parent 1f0fe85 commit 42f9868
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions extensions/commands/sbom/cmd_cyclonedx.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
def format_cyclonedx(formatter_module: str, formatter_class: str, bom: 'Bom') -> None:
module = import_module(formatter_module)
klass = getattr(module, formatter_class)
serialized = klass(bom).output_as_string()
serialized = klass(bom).output_as_string(indent=2)
cli_out_write(serialized)


Expand Down Expand Up @@ -66,8 +66,6 @@ def cyclonedx(conan_api: ConanAPI, parser, *args) -> 'Bom':
sep='\n', file=sys.stderr)
sys.exit(1)

if TYPE_CHECKING:
from conans.client.graph.graph import Node

def package_type_to_component_type(pt: str) -> ComponentType:
return ComponentType.APPLICATION if pt == "application" else ComponentType.LIBRARY
Expand All @@ -82,7 +80,7 @@ def licenses(ls: Optional[Union[Tuple[str, ...], Set[str], List[str], str]]) ->
ls = [ls]
return [LicenseFactory().make_from_string(i) for i in ls]

def package_url(node: 'Node') -> Optional[PackageURL]:
def package_url(node) -> Optional[PackageURL]:
"""
Creates a PURL following https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst#conan
"""
Expand All @@ -99,7 +97,7 @@ def package_url(node: 'Node') -> Optional[PackageURL]:
}
) if node.name else None

def create_component(node: 'Node') -> Component:
def create_component(node) -> Component:
purl = package_url(node)
component = Component(
type=package_type_to_component_type(node.conanfile.package_type),
Expand Down

0 comments on commit 42f9868

Please sign in to comment.