lkj 0.1.45__tar.gz → 0.1.46__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.
- {lkj-0.1.45 → lkj-0.1.46}/PKG-INFO +1 -1
- {lkj-0.1.45 → lkj-0.1.46}/lkj/strings.py +6 -8
- {lkj-0.1.45 → lkj-0.1.46}/lkj.egg-info/PKG-INFO +1 -1
- {lkj-0.1.45 → lkj-0.1.46}/setup.cfg +1 -1
- {lkj-0.1.45 → lkj-0.1.46}/LICENSE +0 -0
- {lkj-0.1.45 → lkj-0.1.46}/README.md +0 -0
- {lkj-0.1.45 → lkj-0.1.46}/lkj/__init__.py +0 -0
- {lkj-0.1.45 → lkj-0.1.46}/lkj/chunking.py +0 -0
- {lkj-0.1.45 → lkj-0.1.46}/lkj/dicts.py +0 -0
- {lkj-0.1.45 → lkj-0.1.46}/lkj/filesys.py +0 -0
- {lkj-0.1.45 → lkj-0.1.46}/lkj/funcs.py +0 -0
- {lkj-0.1.45 → lkj-0.1.46}/lkj/importing.py +0 -0
- {lkj-0.1.45 → lkj-0.1.46}/lkj/iterables.py +0 -0
- {lkj-0.1.45 → lkj-0.1.46}/lkj/loggers.py +0 -0
- {lkj-0.1.45 → lkj-0.1.46}/lkj/misc.py +0 -0
- {lkj-0.1.45 → lkj-0.1.46}/lkj.egg-info/SOURCES.txt +0 -0
- {lkj-0.1.45 → lkj-0.1.46}/lkj.egg-info/dependency_links.txt +0 -0
- {lkj-0.1.45 → lkj-0.1.46}/lkj.egg-info/not-zip-safe +0 -0
- {lkj-0.1.45 → lkj-0.1.46}/lkj.egg-info/top_level.txt +0 -0
- {lkj-0.1.45 → lkj-0.1.46}/setup.py +0 -0
|
@@ -741,7 +741,7 @@ def print_list(
|
|
|
741
741
|
sep: str = ", ",
|
|
742
742
|
line_prefix: str = "",
|
|
743
743
|
items_per_line=None,
|
|
744
|
-
show_count=
|
|
744
|
+
show_count: Union[bool, Callable[[int], str]] = False,
|
|
745
745
|
title=None,
|
|
746
746
|
print_func=print,
|
|
747
747
|
):
|
|
@@ -755,7 +755,7 @@ def print_list(
|
|
|
755
755
|
sep: Separator for items
|
|
756
756
|
line_prefix: Prefix for each line
|
|
757
757
|
items_per_line: For columns style, how many items per line
|
|
758
|
-
show_count: Whether to
|
|
758
|
+
show_count: Whether to prefix with the count of items
|
|
759
759
|
title: Optional title to display before the list
|
|
760
760
|
print_func: Function to use for printing. Defaults to print.
|
|
761
761
|
If None, returns the string instead of printing.
|
|
@@ -765,19 +765,16 @@ def print_list(
|
|
|
765
765
|
|
|
766
766
|
# Wrapped style (default)
|
|
767
767
|
>>> print_list(items, max_width=30)
|
|
768
|
-
List (6 items):
|
|
769
768
|
apple, banana, cherry, date,
|
|
770
769
|
elderberry, fig
|
|
771
770
|
|
|
772
771
|
# Columns style
|
|
773
772
|
>>> print_list(items, style="columns", items_per_line=3)
|
|
774
|
-
List (6 items):
|
|
775
773
|
apple banana cherry
|
|
776
774
|
date elderberry fig
|
|
777
775
|
|
|
778
776
|
# Numbered style
|
|
779
777
|
>>> print_list(items, style="numbered")
|
|
780
|
-
List (6 items):
|
|
781
778
|
1. apple
|
|
782
779
|
2. banana
|
|
783
780
|
3. cherry
|
|
@@ -787,7 +784,6 @@ def print_list(
|
|
|
787
784
|
|
|
788
785
|
# Bullet style
|
|
789
786
|
>>> print_list(items, style="bullet")
|
|
790
|
-
List (6 items):
|
|
791
787
|
• apple
|
|
792
788
|
• banana
|
|
793
789
|
• cherry
|
|
@@ -796,7 +792,7 @@ def print_list(
|
|
|
796
792
|
• fig
|
|
797
793
|
|
|
798
794
|
# Return string instead of printing
|
|
799
|
-
>>> result = print_list(items, style="numbered", print_func=None)
|
|
795
|
+
>>> result = print_list(items, style="numbered", print_func=None, show_count=True)
|
|
800
796
|
>>> print(result)
|
|
801
797
|
List (6 items):
|
|
802
798
|
1. apple
|
|
@@ -847,6 +843,8 @@ def print_list(
|
|
|
847
843
|
print_func=print_func,
|
|
848
844
|
)
|
|
849
845
|
items = list(items) # Convert to list if it's an iterable
|
|
846
|
+
if show_count is True:
|
|
847
|
+
show_count = lambda n_items: f"List ({n_items} items):"
|
|
850
848
|
|
|
851
849
|
# Handle print_func=None by using StringAppender
|
|
852
850
|
if print_func is None:
|
|
@@ -860,7 +858,7 @@ def print_list(
|
|
|
860
858
|
if title:
|
|
861
859
|
print_func(title)
|
|
862
860
|
elif show_count:
|
|
863
|
-
print_func(
|
|
861
|
+
print_func(show_count(len(items)))
|
|
864
862
|
|
|
865
863
|
if not items:
|
|
866
864
|
print_func(f"{line_prefix}(empty list)")
|
|
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
|
|
File without changes
|