Skip to content

Commit 094256e

Browse files
authored
style: make long-text indents smaller (#924)
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent c15db5b commit 094256e

File tree

5 files changed

+70
-66
lines changed

5 files changed

+70
-66
lines changed

cyclonedx_py/_internal/environment.py

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -58,60 +58,61 @@ class EnvironmentBB(BomBuilder):
5858

5959
@staticmethod
6060
def make_argument_parser(**kwargs: Any) -> 'ArgumentParser':
61-
p = ArgumentParser(description='Build an SBOM from Python (virtual) environment',
62-
**kwargs)
61+
p = ArgumentParser(
62+
description='Build an SBOM from Python (virtual) environment',
63+
**kwargs)
6364
if os_name == 'nt':
6465
p.epilog = dedent("""\
6566
Example Usage:
6667
• Build an SBOM from python environment:
67-
> %(prog)s
68+
> %(prog)s
6869
• Build an SBOM from a Python (virtual) environment:
69-
> %(prog)s "...\\some\\path\\bin\\python.exe"
70-
> %(prog)s "...\\some\\path\\.venv"
71-
> %(prog)s "$env:VIRTUAL_ENV"
72-
> %(prog)s %%VIRTUAL_ENV%%
70+
> %(prog)s "...\\some\\path\\bin\\python.exe"
71+
> %(prog)s "...\\some\\path\\.venv"
72+
> %(prog)s "$env:VIRTUAL_ENV"
73+
> %(prog)s %%VIRTUAL_ENV%%
7374
• Build an SBOM from specific Python environment:
74-
> where.exe python3.9.exe
75-
> %(prog)s "%%path-to-specific-python%%"
75+
> where.exe python3.9.exe
76+
> %(prog)s "%%path-to-specific-python%%"
7677
• Build an SBOM from conda Python environment:
77-
> conda.exe run where.exe python
78-
> %(prog)s "%%path-to-conda-python%%"
78+
> conda.exe run where.exe python
79+
> %(prog)s "%%path-to-conda-python%%"
7980
• Build an SBOM from Pipenv environment:
80-
> pipenv.exe --py
81-
> pipenv.exe --venv
82-
> %(prog)s "%%path-to-pipenv-python%%"
81+
> pipenv.exe --py
82+
> pipenv.exe --venv
83+
> %(prog)s "%%path-to-pipenv-python%%"
8384
• Build an SBOM from Poetry environment:
84-
> poetry.exe env info --executable
85-
> %(prog)s "%%path-to-poetry-python%%"
85+
> poetry.exe env info --executable
86+
> %(prog)s "%%path-to-poetry-python%%"
8687
• Build an SBOM from PDM environment:
87-
> pdm.exe info --python
88-
> %(prog)s "%%path-to-pdm-python%%"
88+
> pdm.exe info --python
89+
> %(prog)s "%%path-to-pdm-python%%"
8990
• Build an SBOM from uv environment:
90-
> uv.exe python find
91-
> %(prog)s "%%path-to-uv-python%%"
91+
> uv.exe python find
92+
> %(prog)s "%%path-to-uv-python%%"
9293
""")
9394
else: # if os_name == 'posix':
9495
p.epilog = dedent("""\
9596
Example Usage:
9697
• Build an SBOM from python environment:
97-
$ %(prog)s
98+
$ %(prog)s
9899
• Build an SBOM from a Python (virtual) environment:
99-
$ %(prog)s '.../some/path/bin/python'
100-
$ %(prog)s '.../some/path/.venv'
101-
$ %(prog)s "$VIRTUAL_ENV"
100+
$ %(prog)s '.../some/path/bin/python'
101+
$ %(prog)s '.../some/path/.venv'
102+
$ %(prog)s "$VIRTUAL_ENV"
102103
• Build an SBOM from specific Python environment:
103-
$ %(prog)s "$(which python3.9)"
104+
$ %(prog)s "$(which python3.9)"
104105
• Build an SBOM from conda Python environment:
105-
$ %(prog)s "$(conda run which python)"
106+
$ %(prog)s "$(conda run which python)"
106107
• Build an SBOM from Pipenv environment:
107-
$ %(prog)s "$(pipenv --py)"
108-
$ %(prog)s "$(pipenv --venv)"
108+
$ %(prog)s "$(pipenv --py)"
109+
$ %(prog)s "$(pipenv --venv)"
109110
• Build an SBOM from Poetry environment:
110-
$ %(prog)s "$(poetry env info --executable)"
111+
$ %(prog)s "$(poetry env info --executable)"
111112
• Build an SBOM from PDM environment:
112-
$ %(prog)s "$(pdm info --python)"
113+
$ %(prog)s "$(pdm info --python)"
113114
• Build an SBOM from uv environment:
114-
$ %(prog)s "$(uv python find)"
115+
$ %(prog)s "$(uv python find)"
115116
""")
116117
p.add_argument('--PEP-639',
117118
action='store_true',

cyclonedx_py/_internal/pipenv.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ class PipenvBB(BomBuilder):
5050

5151
@staticmethod
5252
def make_argument_parser(**kwargs: Any) -> 'ArgumentParser':
53-
p = ArgumentParser(description=dedent("""\
54-
Build an SBOM from Pipenv manifest.
53+
p = ArgumentParser(
54+
description=dedent("""\
55+
Build an SBOM from Pipenv manifest.
5556
56-
The options and switches mimic the respective ones from Pipenv CLI.
57-
"""),
58-
**kwargs)
57+
The options and switches mimic the respective ones from Pipenv CLI.
58+
"""),
59+
**kwargs)
5960
# the options and switches SHALL mimic the ones from Pipenv
6061
# see also: https://pipenv.pypa.io/en/latest/configuration.html
6162
p.add_argument('--categories',

cyclonedx_py/_internal/poetry.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,13 @@ class PoetryBB(BomBuilder):
9898

9999
@staticmethod
100100
def make_argument_parser(**kwargs: Any) -> 'ArgumentParser':
101-
p = ArgumentParser(description=dedent("""\
102-
Build an SBOM from Poetry project.
101+
p = ArgumentParser(
102+
description=dedent("""\
103+
Build an SBOM from Poetry project.
103104
104-
The options and switches mimic the respective ones from Poetry CLI.
105-
"""),
106-
**kwargs)
105+
The options and switches mimic the respective ones from Poetry CLI.
106+
"""),
107+
**kwargs)
107108
# the options and switches SHALL mimic the ones from Poetry, which uses comma-separated lists and multi-use
108109
p.add_argument('--without',
109110
metavar='<groups>',

cyclonedx_py/_internal/requirements.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,30 @@ class RequirementsBB(BomBuilder):
4949

5050
@staticmethod
5151
def make_argument_parser(**kwargs: Any) -> 'ArgumentParser':
52-
p = ArgumentParser(description=dedent("""\
53-
Build an SBOM from Pip requirements.
54-
55-
The options and switches mimic the respective ones from Pip CLI.
56-
"""),
57-
epilog=dedent("""\
58-
Example Usage:
59-
• Build an SBOM from a requirements file:
60-
$ %(prog)s requirements-prod.txt
61-
• Merge multiple files and build an SBOM from it:
62-
$ cat requirements/*.txt | %(prog)s -
63-
• Build an inventory for all installed packages:
64-
$ python -m pip freeze --all | %(prog)s -
65-
• Build an inventory for all installed packages in a conda environment:
66-
$ conda run python -m pip freeze --all | %(prog)s -
67-
• Build an inventory for installed packages in a Python (virtual) environment:
68-
$ .../.venv/bin/python -m pip freeze --all --local --require-virtualenv |\\
69-
%(prog)s -
70-
• Build an inventory from an unfrozen manifest:
71-
$ python -m pip install -r dependencies.txt &&\\
72-
python -m pip freeze | %(prog)s -
73-
"""),
74-
**kwargs)
52+
p = ArgumentParser(
53+
description=dedent("""\
54+
Build an SBOM from Pip requirements.
55+
56+
The options and switches mimic the respective ones from Pip CLI.
57+
"""),
58+
epilog=dedent("""\
59+
Example Usage:
60+
• Build an SBOM from a requirements file:
61+
$ %(prog)s requirements-prod.txt
62+
• Merge multiple files and build an SBOM from it:
63+
$ cat requirements/*.txt | %(prog)s -
64+
• Build an inventory for all installed packages:
65+
$ python -m pip freeze --all | %(prog)s -
66+
• Build an inventory for all installed packages in a conda environment:
67+
$ conda run python -m pip freeze --all | %(prog)s -
68+
• Build an inventory for installed packages in a Python (virtual) environment:
69+
$ .../.venv/bin/python -m pip freeze --all --local --require-virtualenv | \\
70+
%(prog)s -
71+
• Build an inventory from an unfrozen manifest:
72+
$ python -m pip install -r dependencies.txt && \\
73+
python -m pip freeze | %(prog)s -
74+
"""),
75+
**kwargs)
7576
# the options and switches SHALL mimic the ones from Pip
7677
p.add_argument('-i', '--index-url',
7778
metavar='<url>',

docs/usage.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,13 +460,13 @@ Example Usage
460460
.. code-block:: shell-session
461461
:caption: Build an inventory for installed packages in a Python (virtual) environment
462462
463-
$ .../.venv/bin/python -m pip freeze --all --local --require-virtualenv |\
463+
$ .../.venv/bin/python -m pip freeze --all --local --require-virtualenv | \
464464
cyclonedx-py requirements -
465465
466466
.. code-block:: shell-session
467467
:caption: Build an inventory from an unfrozen manifest
468468
469-
$ python -m pip install -r dependencies.txt &&\
469+
$ python -m pip install -r dependencies.txt && \
470470
python -m pip freeze | cyclonedx-py requirements -
471471
472472

0 commit comments

Comments
 (0)