Skip to content

Commit

Permalink
Better name and flake fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf committed Dec 4, 2023
1 parent 051a438 commit d129ac8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
4 changes: 2 additions & 2 deletions book_list/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Executable for book-list package."""

import book_list.book_list as bl
import book_list.alphabetize as al

if __name__ == "__main__":
bl.main()
al.main()
19 changes: 5 additions & 14 deletions book_list/book_list.py → book_list/alphabetize.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""Alphabetize a list of books
"""Alphabetize a list of books.
A simple script to parse lists of books and alphabetize based on the
author last name.
"""

import argparse
import os
import time
from datetime import timedelta
Expand All @@ -14,18 +13,14 @@


def main():
"""Alphabetize a list of books"""
"""Alphabetize a list of books."""
start = time.time()

# Parse arguments
parser = argparse.ArgumentParser(description="Alphabetize the list of books")
args = parser.parse_args()

# Setup
tmpfile = "tmp.md"
basedir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
ifile = basedir + "/data/read_books.md"
ofile = basedir + "/data/read_books_alpha.md"
ifile = f"{basedir}/data/read_books.md"
ofile = f"{basedir}/data/read_books_alpha.md"

# Parse the list of books
df = pd.read_csv(
Expand Down Expand Up @@ -75,11 +70,7 @@ def main():

# output timer
end = time.time() - start
print(
"Elapsed time "
+ str(timedelta(seconds=end))
+ " (or {0:f} seconds)".format(end)
)
print(f"Elapsed time {timedelta(seconds=end)} (or {end:f} seconds)")


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
alphabetize = "book_list.book_list:main"
alphabetize = "book_list.alphabetize:main"

[tool.black]
line-length = 88
Expand Down

0 comments on commit d129ac8

Please sign in to comment.