|
1 | 1 | # Formatter |
2 | 2 |
|
| 3 | +[Licensecheck Index](../README.md#licensecheck-index) / |
| 4 | +[Licensecheck](./index.md#licensecheck) / |
| 5 | +Formatter |
| 6 | + |
3 | 7 | > Auto-generated documentation for [licensecheck.formatter](../../../licensecheck/formatter.py) module. |
4 | 8 |
|
5 | | -Take our package compat dictionary and give things a pretty format. |
6 | | - |
7 | | -- [Licensecheck](../README.md#licensecheck-index) / [Modules](../MODULES.md#licensecheck-modules) / [Licensecheck](index.md#licensecheck) / Formatter |
8 | | - - [ansi](#ansi) |
9 | | - - [csv](#csv) |
10 | | - - [json](#json) |
11 | | - - [markdown](#markdown) |
12 | | - - [simple](#simple) |
13 | | - |
14 | | -```json |
15 | | -{ |
16 | | - name: str |
17 | | - version: str |
18 | | - namever: str |
19 | | - size: int |
20 | | - home_page: str |
21 | | - author: str |
22 | | - license: str |
23 | | - license_compat: bool |
24 | | -} |
25 | | -``` |
| 9 | +- [Formatter](#formatter) |
| 10 | + - [ansi](#ansi) |
| 11 | + - [markdown](#markdown) |
| 12 | + - [plainText](#plaintext) |
| 13 | + - [raw](#raw) |
| 14 | + - [rawCsv](#rawcsv) |
| 15 | + - [stripAnsi](#stripansi) |
26 | 16 |
|
27 | | -Formats |
| 17 | +## ansi |
28 | 18 |
|
29 | | -- markdown |
30 | | -- json |
31 | | -- csv |
32 | | -- ansi |
| 19 | +[Show source in formatter.py:50](../../../licensecheck/formatter.py#L50) |
33 | 20 |
|
34 | | -## ansi |
| 21 | +Format to ansi |
35 | 22 |
|
36 | | -[[find in source code]](../../../licensecheck/formatter.py#L133) |
| 23 | +#### Arguments |
| 24 | + |
| 25 | +- `packages` *list[PackageCompat]* - list of PackageCompats to format. |
| 26 | + |
| 27 | +#### Returns |
| 28 | + |
| 29 | +- `str` - string to send to specified output in ansi format |
| 30 | + |
| 31 | +#### Signature |
37 | 32 |
|
38 | 33 | ```python |
39 | | -def ansi(packages: list[PackageCompat], heading: str | None = None) -> str: |
| 34 | +def ansi(packages: list[PackageCompat]) -> str: |
| 35 | + ... |
40 | 36 | ``` |
41 | 37 |
|
42 | | -Format to ansi. |
| 38 | +#### See also |
| 39 | + |
| 40 | +- [PackageCompat](./types.md#packagecompat) |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +## markdown |
| 45 | + |
| 46 | +[Show source in formatter.py:91](../../../licensecheck/formatter.py#L91) |
| 47 | + |
| 48 | +Format to markdown |
43 | 49 |
|
44 | 50 | #### Arguments |
45 | 51 |
|
46 | | -- `packages` *list[PackageCompat]* - PackageCompats to format |
47 | | -- `heading` *str, optional* - Optional heading to include. Defaults to None. |
| 52 | +- `packages` *list[PackageCompat]* - list of PackageCompats to format. |
48 | 53 |
|
49 | 54 | #### Returns |
50 | 55 |
|
51 | | -- `str` - String to write to a file of stdout |
| 56 | +- `str` - string to send to specified output in markdown format |
| 57 | + |
| 58 | +#### Signature |
| 59 | + |
| 60 | +```python |
| 61 | +def markdown(packages: list[PackageCompat]) -> str: |
| 62 | + ... |
| 63 | +``` |
52 | 64 |
|
53 | 65 | #### See also |
54 | 66 |
|
55 | | -- [PackageCompat](types.md#packagecompat) |
| 67 | +- [PackageCompat](./types.md#packagecompat) |
56 | 68 |
|
57 | | -## csv |
58 | 69 |
|
59 | | -[[find in source code]](../../../licensecheck/formatter.py#L91) |
60 | 70 |
|
61 | | -```python |
62 | | -def csv(packages: list[PackageCompat], heading: str | None = None) -> str: |
63 | | -``` |
| 71 | +## plainText |
| 72 | + |
| 73 | +[Show source in formatter.py:79](../../../licensecheck/formatter.py#L79) |
64 | 74 |
|
65 | | -Format to CSV. |
| 75 | +Format to plain text |
66 | 76 |
|
67 | 77 | #### Arguments |
68 | 78 |
|
69 | | -- `packages` *list[PackageCompat]* - PackageCompats to format |
70 | | -- `heading` *str, optional* - Optional heading to include. Defaults to None. |
| 79 | +- `packages` *list[PackageCompat]* - list of PackageCompats to format. |
71 | 80 |
|
72 | 81 | #### Returns |
73 | 82 |
|
74 | | -- `str` - String to write to a file of stdout |
| 83 | +- `str` - string to send to specified output in plain text format |
| 84 | + |
| 85 | +#### Signature |
| 86 | + |
| 87 | +```python |
| 88 | +def plainText(packages: list[PackageCompat]) -> str: |
| 89 | + ... |
| 90 | +``` |
75 | 91 |
|
76 | 92 | #### See also |
77 | 93 |
|
78 | | -- [PackageCompat](types.md#packagecompat) |
| 94 | +- [PackageCompat](./types.md#packagecompat) |
79 | 95 |
|
80 | | -## json |
81 | 96 |
|
82 | | -[[find in source code]](../../../licensecheck/formatter.py#L71) |
83 | 97 |
|
84 | | -```python |
85 | | -def json(packages: list[PackageCompat], heading: str | None = None) -> str: |
86 | | -``` |
| 98 | +## raw |
| 99 | + |
| 100 | +[Show source in formatter.py:127](../../../licensecheck/formatter.py#L127) |
87 | 101 |
|
88 | | -Format to Json. |
| 102 | +Format to raw json |
89 | 103 |
|
90 | 104 | #### Arguments |
91 | 105 |
|
92 | | -- `packages` *list[PackageCompat]* - PackageCompats to format |
93 | | -- `heading` *str, optional* - Optional heading to include. Defaults to None. |
| 106 | +- `packages` *list[PackageCompat]* - list of PackageCompats to format. |
94 | 107 |
|
95 | 108 | #### Returns |
96 | 109 |
|
97 | | -- `str` - String to write to a file of stdout |
| 110 | +- `str` - string to send to specified output in raw json format |
| 111 | + |
| 112 | +#### Signature |
| 113 | + |
| 114 | +```python |
| 115 | +def raw(packages: list[PackageCompat]) -> str: |
| 116 | + ... |
| 117 | +``` |
98 | 118 |
|
99 | 119 | #### See also |
100 | 120 |
|
101 | | -- [PackageCompat](types.md#packagecompat) |
| 121 | +- [PackageCompat](./types.md#packagecompat) |
102 | 122 |
|
103 | | -## markdown |
104 | 123 |
|
105 | | -[[find in source code]](../../../licensecheck/formatter.py#L32) |
106 | 124 |
|
107 | | -```python |
108 | | -def markdown( |
109 | | - packages: list[PackageCompat], |
110 | | - heading: str | None = None, |
111 | | -) -> str: |
112 | | -``` |
| 125 | +## rawCsv |
113 | 126 |
|
114 | | -Format to Markdown. |
| 127 | +[Show source in formatter.py:139](../../../licensecheck/formatter.py#L139) |
| 128 | + |
| 129 | +Format to raw csv |
115 | 130 |
|
116 | 131 | #### Arguments |
117 | 132 |
|
118 | | -- `packages` *list[PackageCompat]* - PackageCompats to format |
119 | | -- `heading` *str, optional* - Optional heading to include. Defaults to None. |
| 133 | +- `packages` *list[PackageCompat]* - list of PackageCompats to format. |
120 | 134 |
|
121 | 135 | #### Returns |
122 | 136 |
|
123 | | -- `str` - String to write to a file of stdout |
| 137 | +- `str` - string to send to specified output in raw csv format |
| 138 | + |
| 139 | +#### Signature |
| 140 | + |
| 141 | +```python |
| 142 | +def rawCsv(packages: list[PackageCompat]) -> str: |
| 143 | + ... |
| 144 | +``` |
124 | 145 |
|
125 | 146 | #### See also |
126 | 147 |
|
127 | | -- [PackageCompat](types.md#packagecompat) |
| 148 | +- [PackageCompat](./types.md#packagecompat) |
128 | 149 |
|
129 | | -## simple |
130 | 150 |
|
131 | | -[[find in source code]](../../../licensecheck/formatter.py#L186) |
132 | 151 |
|
133 | | -```python |
134 | | -def simple(packages: list[PackageCompat]) -> str: |
135 | | -``` |
| 152 | +## stripAnsi |
136 | 153 |
|
137 | | -Format to plain text. |
| 154 | +[Show source in formatter.py:38](../../../licensecheck/formatter.py#L38) |
| 155 | + |
| 156 | +Strip ansi codes from a given string |
138 | 157 |
|
139 | 158 | #### Arguments |
140 | 159 |
|
141 | | -- `packages` *list[PackageCompat]* - PackageCompats to format |
| 160 | +- `string` *str* - string to strip codes from |
142 | 161 |
|
143 | 162 | #### Returns |
144 | 163 |
|
145 | | -- `str` - String to write to a file of stdout |
| 164 | +- `str` - plaintext, utf-8 string (safe for writing to files) |
| 165 | + |
| 166 | +#### Signature |
| 167 | + |
| 168 | +```python |
| 169 | +def stripAnsi(string: str) -> str: |
| 170 | + ... |
| 171 | +``` |
146 | 172 |
|
147 | | -#### See also |
148 | 173 |
|
149 | | -- [PackageCompat](types.md#packagecompat) |
|
0 commit comments