Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions config/qutebrowser/config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
## qutebrowser config.py

from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING, Any, cast

from qutebrowser.api import interceptor

if TYPE_CHECKING:
c: Any = object
config: Any = object
# c and config are injected as globals by qutebrowser at runtime
c = cast(Any, None)
config = cast(Any, None)

config.load_autoconfig()

Expand Down
2 changes: 1 addition & 1 deletion dot/jupyter/jupyter_notebook_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration file for notebook.

c = get_config() # noqa
c = get_config() # type: ignore # noqa

# ------------------------------------------------------------------------------
# Application(SingletonConfigurable) configuration
Expand Down
2 changes: 1 addition & 1 deletion py-scripts/aur-auto-vote-with-chaotic.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def login(session, username, password):
return bool(
navbar.find(
"form",
action=lambda h: h and h.rstrip("/").endswith("/logout"), # type: ignore
action=lambda h: h and h.rstrip("/").endswith("/logout"),
)
)

Expand Down
11 changes: 6 additions & 5 deletions py-scripts/wah.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import argparse
import datetime
from pathlib import Path
from typing import Dict, List
from typing import Any, Dict, List

import yaml
from colorama import Back, Fore, Style, init
Expand Down Expand Up @@ -134,6 +134,7 @@ def save(path, data):

# read wah data
needs_save = False
data: Dict[str, Any]
if save_path.exists():
data = yaml.load(save_path.read_text(), Loader=yaml.SafeLoader)
else:
Expand All @@ -160,10 +161,10 @@ def save(path, data):
if needs_save is True:
save(save_path, data)

min_hours: float = _ if (_ := data["min_hours"]) is not None else 0.75
max_hours: float = _ if (_ := data["max_hours"]) is not None else 4.0
min_lpm: float = _ if (_ := data["min_lpm"]) is not None else 0.1
max_lpm: float = _ if (_ := data["max_lpm"]) is not None else 1
min_hours: float = data["min_hours"] if data["min_hours"] is not None else 0.75
max_hours: float = data["max_hours"] if data["max_hours"] is not None else 4.0
min_lpm: float = data["min_lpm"] if data["min_lpm"] is not None else 0.1
max_lpm: float = data["max_lpm"] if data["max_lpm"] is not None else 1

decision: Dict[str, bool] = data.get("decision", {}) # hexsha -> true or false
time = datetime.timedelta(hours=0)
Expand Down
2 changes: 2 additions & 0 deletions ty.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[rules]
unresolved-import = "ignore"
10 changes: 5 additions & 5 deletions venueQ/otis.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import subprocess
import time
import webbrowser
from datetime import UTC, datetime
from datetime import datetime, timezone
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from importlib.util import find_spec
Expand Down Expand Up @@ -511,9 +511,9 @@ def on_buffer_close(self, data: Data):
if data["accept_all"]:
if query_otis_server(payload={"action": "accept_inquiries"}):
body = "This is an automated message to notify you that your recent unit petition\n"
body += f"was processed on {datetime.now(UTC).strftime('%-d %B %Y, %H:%M')} UTC."
body += f"was processed on {datetime.now(timezone.utc).strftime('%-d %B %Y, %H:%M')} UTC."
body += "\n\n"
body += f"Have a nice {datetime.now(UTC).strftime('%A')}."
body += f"Have a nice {datetime.now(timezone.utc).strftime('%A')}."
recipients = [
inquiry["student__user__email"]
for inquiry in data["inquiries"]
Expand Down Expand Up @@ -545,7 +545,7 @@ def on_buffer_close(self, data: Data):
"You are receiving this message because you checked the box "
"asking to be notified once your decision form was processed.\n\n"
"We're happy to confirm that your decision form\n"
f"was processed on {datetime.now(UTC).strftime('%-d %B %Y, %H:%M')} UTC "
f"was processed on {datetime.now(timezone.utc).strftime('%-d %B %Y, %H:%M')} UTC "
"and your account is now fully activated!"
"You should be able to log in and pick your units now,\n"
"and use the /register slash command in the Discord."
Expand Down Expand Up @@ -790,7 +790,7 @@ def callback():
"You are receiving this message because you checked the box "
"asking to be notified by email when your application was reviewed.\n\n"
"We're letting you know that your OTIS application was reviewed at "
f"{datetime.now(UTC).strftime('%-d %B %Y, %H:%M')} UTC. "
f"{datetime.now(timezone.utc).strftime('%-d %B %Y, %H:%M')} UTC. "
"You can see the decision (and comments if any) on the "
f"website {linkify('https://apply.evanchen.cc')} "
"by logging in to the account you used when you submitted."
Expand Down
16 changes: 13 additions & 3 deletions venueQ/venueQ.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@ def repr_str(dumper: yaml.SafeDumper, data: str) -> yaml.ScalarNode:
yaml.add_representer(str, repr_str, Dumper=yaml.SafeDumper)

if TYPE_CHECKING:
vim: Any = None

class _Vim:
"""Stub for the vim C extension module."""

class error(Exception): ...

buffers: Any

def command(self, s: str) -> None: ...

vim = _Vim()
VIM_ENABLED = True
else:
try:
Expand Down Expand Up @@ -276,7 +286,7 @@ def queue_wipe(self, p: Path):
self.wipe_queue.append(b.number)
break
else:
logger.warn(
logger.warning(
f"Tried to wipe {p} but found no buffer for it among "
+ ", ".join(b.name for b in vim.buffers)
)
Expand All @@ -288,7 +298,7 @@ def wipe(self):
try:
vim.command(f"bdelete! {bn}")
except vim.error:
logging.warn(
logging.warning(
f"Could not delete buffer {bn}, maybe it was deleted already."
)
self.wipe_queue = []
Loading