Skip to content

Instantly share code, notes, and snippets.

Created February 14, 2020 01:37
What would you like to do?
online-judge-tools でテストケースDL済のディレクトリから問題ページを開く
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""oj d したディレクトリから起動すると対応する問題ページを開く。"""
import sys
from typing import *
import webbrowser
from onlinejudge._implementation.download_history import DownloadHistory
def WARN(msg: str) -> None:
print(msg, file=sys.stderr)
def ERROR(msg: str) -> NoReturn:
def main() -> None:
dh = DownloadHistory()
urls = dh.get()
if not urls: ERROR("no URL found")
if len(urls) >= 2: WARN(f"multiple URLs found: {urls}")
if __name__ == "__main__": main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment