diff --git a/data.py b/data.py index 05785e5..4e95dd9 100644 --- a/data.py +++ b/data.py @@ -255,7 +255,10 @@ class LinkData: new_replies = [i for i in replies if i[2] >= config.USER.lastlogin] if replies: last_modified_timestamp = str( - max(float(timestamp), max([float(i[2]) for i in replies if i[2]])) + max( + float(timestamp), + max([float(i[2]) for i in replies if i[2]]), + ) ) else: last_modified_timestamp = timestamp diff --git a/linkulator.py b/linkulator.py index c4d2ff2..a7b81d2 100755 --- a/linkulator.py +++ b/linkulator.py @@ -75,10 +75,18 @@ def print_category_details(view_cat): link_count += 1 thread_index[link_count] = link["postid"] desc = textwrap.shorten(link["description"], width=desclen, placeholder="...") - newmarker = "*" if link["last_modified_timestamp"] >= config.USER.lastlogin else "" + newmarker = ( + "*" if link["last_modified_timestamp"] >= config.USER.lastlogin else "" + ) _dt = datetime.fromtimestamp(float(link["link_timestamp"])).strftime("%Y-%m-%d") out += " {:3d} {:>10s} {:<{namelen}s} [{:3d}] {:s}{}\n".format( - link_count, _dt, link["link_author"], link["reply_count"], desc, newmarker, namelen=namelen + link_count, + _dt, + link["link_author"], + link["reply_count"], + desc, + newmarker, + namelen=namelen, ) if len(out) > 0: @@ -268,15 +276,17 @@ def is_valid_input(entry: str) -> bool: return False return True + def is_correct_category(entry: str) -> bool: """Make sure the user purposefully created a new category and not by accident (mistyped, tried to use category number instead of name)""" - if entry not in [ record["name"] for record in categories ]: + if entry not in [record["name"] for record in categories]: question = "Do you want to create a new category '{}'? Y/[N]".format(entry) answer = input(question).lower().strip() return answer != "" and answer[0] == "y" return True + def get_input(item: str) -> str: """Get user input with the specified prompt, validate and return it, or break if invalid""" @@ -398,7 +408,9 @@ def menu_view_category_details(cat_index): menu_view_thread_details(post_id) except (KeyError, ValueError): # Catch a Post ID that is not in the thread list or is not a number - print("{}\n\n".format(style_text("Invalid category ID/entry", False, "bold"))) + print( + "{}\n\n".format(style_text("Invalid category ID/entry", False, "bold")) + ) def menu_view_thread_details(post_id): @@ -450,7 +462,7 @@ def style_text(text: str, is_input: bool, *args) -> str: # (ctrl+shift+esc+E to enable evil mode.) "inverse": "\033[7m", # Make fg and bg color swap "rl_left_fix": "\001" if is_input else "", - "rl_right_fix": "\002" if is_input else "" + "rl_right_fix": "\002" if is_input else "", } out = "" for arg in args: diff --git a/setup.py b/setup.py index 1fbb5b2..ce038f1 100644 --- a/setup.py +++ b/setup.py @@ -18,5 +18,5 @@ setup( "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: POSIX", ], - python_requires='>=3.6', + python_requires=">=3.6", )