Porównaj commity

...

5 Commity

Autor SHA1 Wiadomość Data
Ivan Habunek 07ad41960f
Capitalize visibility 2024-04-08 08:34:56 +02:00
Sandra Snan 07beba8c68
Fix --clear text issue
It's a click flag.
2024-04-08 08:32:05 +02:00
Sandra Snan 7244b2718f
Print visibility in CLI
I went with two spaces before and after but feel free to change that
to whatever! Having the visibility printed this way is pretty useful
for us who mostly read posts through the CLI.
2024-04-08 08:31:19 +02:00
Ivan Habunek 968a516f76
Remove unused helpers 2024-04-06 15:06:59 +02:00
Ivan Habunek 38eca67905
Fix bug in run_with_retries, better types 2024-04-06 15:05:47 +02:00
3 zmienionych plików z 9 dodań i 21 usunięć

Wyświetl plik

@ -3,28 +3,13 @@ Helpers for testing.
"""
import time
from typing import Any, Callable
from typing import Callable, TypeVar
class MockResponse:
def __init__(self, response_data={}, ok=True, is_redirect=False):
self.response_data = response_data
self.content = response_data
self.ok = ok
self.is_redirect = is_redirect
def raise_for_status(self):
pass
def json(self):
return self.response_data
T = TypeVar("T")
def retval(val):
return lambda *args, **kwargs: val
def run_with_retries(fn: Callable[..., Any]):
def run_with_retries(fn: Callable[..., T]) -> T:
"""
Run the the given function repeatedly until it finishes without raising an
AssertionError. Sleep a bit between attempts. If the function doesn't
@ -41,4 +26,4 @@ def run_with_retries(fn: Callable[..., Any]):
except AssertionError:
time.sleep(delay)
fn()
return fn()

Wyświetl plik

@ -111,7 +111,10 @@ def bookmarks(
@cli.command()
@click.option("--clear", help="Dismiss all notifications and exit")
@click.option(
"--clear", is_flag=True,
help="Dismiss all notifications and exit"
)
@click.option(
"--reverse", "-r", is_flag=True,
help="Reverse the order of the shown notifications (newest on top)"

Wyświetl plik

@ -219,7 +219,7 @@ def status_lines(status: Status) -> t.Generator[str, None, None]:
reply = f"↲ In reply to {yellow(in_reply_to_id)} " if in_reply_to_id else ""
boost = f"{blue(reblogged_by_acct)} boosted " if reblogged_by else ""
yield f"ID {yellow(status_id)} {reply} {boost}"
yield f"ID {yellow(status_id)} Visibility: {status.visibility} {reply} {boost}"
def html_lines(html: str, width: int) -> t.Generator[str, None, None]: