lkj 0.1.44__tar.gz → 0.1.45__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lkj
3
- Version: 0.1.44
3
+ Version: 0.1.45
4
4
  Summary: A dump of homeless useful utils
5
5
  Home-page: https://github.com/thorwhalen/lkj
6
6
  Author: Thor Whalen
@@ -167,3 +167,103 @@ import_object(dot_path: str)
167
167
  >>> f is join
168
168
  True
169
169
  ```
170
+
171
+ ## Pretty Printing Lists
172
+
173
+ The `print_list` function provides flexible, human-friendly ways to display lists and collections. It supports multiple display styles and can be used in several ways.
174
+
175
+ ### Basic Usage
176
+
177
+ ```python
178
+ from lkj.strings import print_list
179
+
180
+ items = ['apple', 'banana', 'cherry', 'date', 'elderberry', 'fig']
181
+
182
+ # Different display styles
183
+ print_list(items, style='wrapped') # Automatic line wrapping
184
+ print_list(items, style='columns') # Column format
185
+ print_list(items, style='numbered') # Numbered list
186
+ print_list(items, style='bullet') # Bullet points
187
+ print_list(items, style='compact') # All on one line
188
+ print_list(items, style='table') # Table format
189
+ ```
190
+
191
+ ### Direct Usage with Customization
192
+
193
+ ```python
194
+ # Customize width, separators, and formatting
195
+ print_list(items, style='wrapped', max_width=40, sep=' | ')
196
+ print_list(items, style='columns', items_per_line=3)
197
+ print_list(items, style='numbered', line_prefix=' ')
198
+ print_list(items, style='bullet', show_count=False)
199
+
200
+ # Return string instead of printing
201
+ result = print_list(items, style='numbered', print_func=None)
202
+ print(result)
203
+ ```
204
+
205
+ ### Partial Function Factory
206
+
207
+ When you don't specify the `items` parameter, `print_list` returns a partial function that you can reuse:
208
+
209
+ ```python
210
+ # Create specialized printers
211
+ numbered_printer = print_list(style='numbered', show_count=False)
212
+ bullet_printer = print_list(style='bullet', print_func=None)
213
+ compact_printer = print_list(style='compact', max_width=60)
214
+
215
+ # Reuse with different data
216
+ numbered_printer(['a', 'b', 'c']) # Prints: 1. a\n2. b\n3. c
217
+ result = bullet_printer(['x', 'y', 'z']) # Returns: '• x\n• y\n• z'
218
+ compact_printer(['item1', 'item2']) # Prints: item1, item2
219
+ ```
220
+
221
+ ### Convenience Methods
222
+
223
+ The `print_list` object provides convenient pre-configured methods:
224
+
225
+ ```python
226
+ # Quick access to common styles
227
+ print_list.compact(items) # Compact format, no count
228
+ print_list.wrapped(items) # Wrapped format, no count
229
+ print_list.columns(items) # Column format, no count
230
+ print_list.numbered(items) # Numbered format, no count
231
+ print_list.bullets(items) # Bullet format, no count
232
+
233
+ # Specialized methods
234
+ print_list.as_table(data) # Table with headers
235
+ print_list.summary(items) # Summary for long lists
236
+ ```
237
+
238
+ ### Advanced Examples
239
+
240
+ ```python
241
+ # Table with custom data
242
+ data = [['Name', 'Age', 'City'], ['Alice', 25, 'NYC'], ['Bob', 30, 'LA']]
243
+ print_list.as_table(data)
244
+
245
+ # Summary for long lists
246
+ long_list = list(range(100))
247
+ print_list.summary(long_list, max_items=6) # Shows: [0, 1, 2, ..., 97, 98, 99]
248
+
249
+ # Custom print function (e.g., for logging)
250
+ def my_logger(msg):
251
+ print(f"[LOG] {msg}")
252
+
253
+ print_list(items, style='bullet', print_func=my_logger)
254
+
255
+ # Combine partial with custom parameters
256
+ custom_compact = print_list(style='compact', sep=' | ')
257
+ custom_compact(items) # Prints: apple | banana | cherry | date | elderberry | fig
258
+ ```
259
+
260
+ ### Key Features
261
+
262
+ - **Multiple Styles**: `wrapped`, `columns`, `numbered`, `bullet`, `compact`, `table`
263
+ - **Flexible Output**: Print directly or return strings with `print_func=None`
264
+ - **Partial Functions**: Create reusable printers with pre-configured settings
265
+ - **Customizable**: Control width, separators, line prefixes, and more
266
+ - **Type Safe**: Uses `Literal` types for style validation
267
+ - **Self-Contained**: No external dependencies beyond Python standard library
268
+
269
+ The `print_list` function is perfect for debugging, logging, user interfaces, and any situation where you need to display lists in a readable format.
@@ -156,3 +156,103 @@ import_object(dot_path: str)
156
156
  >>> f is join
157
157
  True
158
158
  ```
159
+
160
+ ## Pretty Printing Lists
161
+
162
+ The `print_list` function provides flexible, human-friendly ways to display lists and collections. It supports multiple display styles and can be used in several ways.
163
+
164
+ ### Basic Usage
165
+
166
+ ```python
167
+ from lkj.strings import print_list
168
+
169
+ items = ['apple', 'banana', 'cherry', 'date', 'elderberry', 'fig']
170
+
171
+ # Different display styles
172
+ print_list(items, style='wrapped') # Automatic line wrapping
173
+ print_list(items, style='columns') # Column format
174
+ print_list(items, style='numbered') # Numbered list
175
+ print_list(items, style='bullet') # Bullet points
176
+ print_list(items, style='compact') # All on one line
177
+ print_list(items, style='table') # Table format
178
+ ```
179
+
180
+ ### Direct Usage with Customization
181
+
182
+ ```python
183
+ # Customize width, separators, and formatting
184
+ print_list(items, style='wrapped', max_width=40, sep=' | ')
185
+ print_list(items, style='columns', items_per_line=3)
186
+ print_list(items, style='numbered', line_prefix=' ')
187
+ print_list(items, style='bullet', show_count=False)
188
+
189
+ # Return string instead of printing
190
+ result = print_list(items, style='numbered', print_func=None)
191
+ print(result)
192
+ ```
193
+
194
+ ### Partial Function Factory
195
+
196
+ When you don't specify the `items` parameter, `print_list` returns a partial function that you can reuse:
197
+
198
+ ```python
199
+ # Create specialized printers
200
+ numbered_printer = print_list(style='numbered', show_count=False)
201
+ bullet_printer = print_list(style='bullet', print_func=None)
202
+ compact_printer = print_list(style='compact', max_width=60)
203
+
204
+ # Reuse with different data
205
+ numbered_printer(['a', 'b', 'c']) # Prints: 1. a\n2. b\n3. c
206
+ result = bullet_printer(['x', 'y', 'z']) # Returns: '• x\n• y\n• z'
207
+ compact_printer(['item1', 'item2']) # Prints: item1, item2
208
+ ```
209
+
210
+ ### Convenience Methods
211
+
212
+ The `print_list` object provides convenient pre-configured methods:
213
+
214
+ ```python
215
+ # Quick access to common styles
216
+ print_list.compact(items) # Compact format, no count
217
+ print_list.wrapped(items) # Wrapped format, no count
218
+ print_list.columns(items) # Column format, no count
219
+ print_list.numbered(items) # Numbered format, no count
220
+ print_list.bullets(items) # Bullet format, no count
221
+
222
+ # Specialized methods
223
+ print_list.as_table(data) # Table with headers
224
+ print_list.summary(items) # Summary for long lists
225
+ ```
226
+
227
+ ### Advanced Examples
228
+
229
+ ```python
230
+ # Table with custom data
231
+ data = [['Name', 'Age', 'City'], ['Alice', 25, 'NYC'], ['Bob', 30, 'LA']]
232
+ print_list.as_table(data)
233
+
234
+ # Summary for long lists
235
+ long_list = list(range(100))
236
+ print_list.summary(long_list, max_items=6) # Shows: [0, 1, 2, ..., 97, 98, 99]
237
+
238
+ # Custom print function (e.g., for logging)
239
+ def my_logger(msg):
240
+ print(f"[LOG] {msg}")
241
+
242
+ print_list(items, style='bullet', print_func=my_logger)
243
+
244
+ # Combine partial with custom parameters
245
+ custom_compact = print_list(style='compact', sep=' | ')
246
+ custom_compact(items) # Prints: apple | banana | cherry | date | elderberry | fig
247
+ ```
248
+
249
+ ### Key Features
250
+
251
+ - **Multiple Styles**: `wrapped`, `columns`, `numbered`, `bullet`, `compact`, `table`
252
+ - **Flexible Output**: Print directly or return strings with `print_func=None`
253
+ - **Partial Functions**: Create reusable printers with pre-configured settings
254
+ - **Customizable**: Control width, separators, line prefixes, and more
255
+ - **Type Safe**: Uses `Literal` types for style validation
256
+ - **Self-Contained**: No external dependencies beyond Python standard library
257
+
258
+ The `print_list` function is perfect for debugging, logging, user interfaces, and any situation where you need to display lists in a readable format.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lkj
3
- Version: 0.1.44
3
+ Version: 0.1.45
4
4
  Summary: A dump of homeless useful utils
5
5
  Home-page: https://github.com/thorwhalen/lkj
6
6
  Author: Thor Whalen
@@ -167,3 +167,103 @@ import_object(dot_path: str)
167
167
  >>> f is join
168
168
  True
169
169
  ```
170
+
171
+ ## Pretty Printing Lists
172
+
173
+ The `print_list` function provides flexible, human-friendly ways to display lists and collections. It supports multiple display styles and can be used in several ways.
174
+
175
+ ### Basic Usage
176
+
177
+ ```python
178
+ from lkj.strings import print_list
179
+
180
+ items = ['apple', 'banana', 'cherry', 'date', 'elderberry', 'fig']
181
+
182
+ # Different display styles
183
+ print_list(items, style='wrapped') # Automatic line wrapping
184
+ print_list(items, style='columns') # Column format
185
+ print_list(items, style='numbered') # Numbered list
186
+ print_list(items, style='bullet') # Bullet points
187
+ print_list(items, style='compact') # All on one line
188
+ print_list(items, style='table') # Table format
189
+ ```
190
+
191
+ ### Direct Usage with Customization
192
+
193
+ ```python
194
+ # Customize width, separators, and formatting
195
+ print_list(items, style='wrapped', max_width=40, sep=' | ')
196
+ print_list(items, style='columns', items_per_line=3)
197
+ print_list(items, style='numbered', line_prefix=' ')
198
+ print_list(items, style='bullet', show_count=False)
199
+
200
+ # Return string instead of printing
201
+ result = print_list(items, style='numbered', print_func=None)
202
+ print(result)
203
+ ```
204
+
205
+ ### Partial Function Factory
206
+
207
+ When you don't specify the `items` parameter, `print_list` returns a partial function that you can reuse:
208
+
209
+ ```python
210
+ # Create specialized printers
211
+ numbered_printer = print_list(style='numbered', show_count=False)
212
+ bullet_printer = print_list(style='bullet', print_func=None)
213
+ compact_printer = print_list(style='compact', max_width=60)
214
+
215
+ # Reuse with different data
216
+ numbered_printer(['a', 'b', 'c']) # Prints: 1. a\n2. b\n3. c
217
+ result = bullet_printer(['x', 'y', 'z']) # Returns: '• x\n• y\n• z'
218
+ compact_printer(['item1', 'item2']) # Prints: item1, item2
219
+ ```
220
+
221
+ ### Convenience Methods
222
+
223
+ The `print_list` object provides convenient pre-configured methods:
224
+
225
+ ```python
226
+ # Quick access to common styles
227
+ print_list.compact(items) # Compact format, no count
228
+ print_list.wrapped(items) # Wrapped format, no count
229
+ print_list.columns(items) # Column format, no count
230
+ print_list.numbered(items) # Numbered format, no count
231
+ print_list.bullets(items) # Bullet format, no count
232
+
233
+ # Specialized methods
234
+ print_list.as_table(data) # Table with headers
235
+ print_list.summary(items) # Summary for long lists
236
+ ```
237
+
238
+ ### Advanced Examples
239
+
240
+ ```python
241
+ # Table with custom data
242
+ data = [['Name', 'Age', 'City'], ['Alice', 25, 'NYC'], ['Bob', 30, 'LA']]
243
+ print_list.as_table(data)
244
+
245
+ # Summary for long lists
246
+ long_list = list(range(100))
247
+ print_list.summary(long_list, max_items=6) # Shows: [0, 1, 2, ..., 97, 98, 99]
248
+
249
+ # Custom print function (e.g., for logging)
250
+ def my_logger(msg):
251
+ print(f"[LOG] {msg}")
252
+
253
+ print_list(items, style='bullet', print_func=my_logger)
254
+
255
+ # Combine partial with custom parameters
256
+ custom_compact = print_list(style='compact', sep=' | ')
257
+ custom_compact(items) # Prints: apple | banana | cherry | date | elderberry | fig
258
+ ```
259
+
260
+ ### Key Features
261
+
262
+ - **Multiple Styles**: `wrapped`, `columns`, `numbered`, `bullet`, `compact`, `table`
263
+ - **Flexible Output**: Print directly or return strings with `print_func=None`
264
+ - **Partial Functions**: Create reusable printers with pre-configured settings
265
+ - **Customizable**: Control width, separators, line prefixes, and more
266
+ - **Type Safe**: Uses `Literal` types for style validation
267
+ - **Self-Contained**: No external dependencies beyond Python standard library
268
+
269
+ The `print_list` function is perfect for debugging, logging, user interfaces, and any situation where you need to display lists in a readable format.
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = lkj
3
- version = 0.1.44
3
+ version = 0.1.45
4
4
  url = https://github.com/thorwhalen/lkj
5
5
  platforms = any
6
6
  description_file = README.md
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes