Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add indent and remove typing #139

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading