Skip to content

Commit

Permalink
[MISC] Add py.typed, add to format_list
Browse files Browse the repository at this point in the history
  • Loading branch information
nikoskoukis-slamcore committed Nov 14, 2023
1 parent aa1d36f commit d71e7b0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ readme = "README.md"

homepage = "https://github.com/slamcore/slamcore_utils"
repository = "https://github.com/slamcore/slamcore_utils"
include = ["slamcore_utils/py.typed"]
classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Expand Down
Empty file added slamcore_utils/py.typed
Empty file.
15 changes: 9 additions & 6 deletions slamcore_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,23 @@ def format_list( # pylint: disable=R0913
header_sep="=",
prefix: str = "",
suffix: str = "",
list_start_sep="\n\n",
list_end_sep="\n\n",
) -> str:
"""
Format and return a string with the corresponding header and all the items each occupying a
single line and with the specified indentation.
"""
indentation = " " * indent
header_indentation = indentation[:-2]
s = f"{header}: "
if not items:
s += " None."
return s

s += "\n" + len(s) * header_sep
s += "\n\n"
s += "\n".join(f'{" " * indent}{bullet_char} {item}' for item in items)
s += "\n\n"
else:
s += f"\n{header_indentation}{len(s) * header_sep}"
s += list_start_sep
s += "\n".join(f"{indentation}{bullet_char} {item}" for item in items)
s += list_end_sep
return f"{prefix}{s}{suffix}"


Expand Down

0 comments on commit d71e7b0

Please sign in to comment.