Skip to content

Commit

Permalink
Older types
Browse files Browse the repository at this point in the history
  • Loading branch information
eliotwrobson committed Feb 21, 2024
1 parent 6f900bf commit 0ef3f32
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/ecfr/ecfr.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Executer(object):
def __init__(
self,
*,
compile_command: str | None,
compile_command: t.Optional[str],
execute_command: str,
problem_id: str,
source_file_dir: str,
Expand Down Expand Up @@ -60,7 +60,7 @@ def compile(self) -> subprocess.CompletedProcess:
shell=True,
)

def execute(self, input_str: str) -> tuple[str, str, int, float, bool]:
def execute(self, input_str: str) -> t.Tuple[str, str, int, float, bool]:
"""Execute the subprocess. Returns None in case of a timeout"""
execute_command = self.execute_command.format(
output_file=self.output_file, source_file=self.source_file
Expand Down Expand Up @@ -104,10 +104,10 @@ def execute(self, input_str: str) -> tuple[str, str, int, float, bool]:


def get_parser_for_page(
contest_id: int, problem_id: str | None = None
) -> tuple[bs4.BeautifulSoup, str]:
contest_id: int, problem_id: t.Optional[str] = None
) -> t.Tuple[bs4.BeautifulSoup, str]:
if problem_id is None:
url_tuple: tuple[str, ...] = (CODEFORCES_URL, "contest", str(contest_id))
url_tuple: t.Tuple[str, ...] = (CODEFORCES_URL, "contest", str(contest_id))
else:
url_tuple = (
CODEFORCES_URL,
Expand All @@ -124,7 +124,7 @@ def get_parser_for_page(
return parser, contest_url


def get_problem_ids(contest_id: int) -> list[str]:
def get_problem_ids(contest_id: int) -> t.List[str]:
parser, _ = get_parser_for_page(contest_id)
table = parser.find("table", {"class": "problems"})

Expand Down Expand Up @@ -199,7 +199,7 @@ def cli(context: click.Context, config_file_name: str) -> None:
)
@click.pass_context
def download_contest(
context: click.Context, contest_id: int, problem_id: ProblemType | None
context: click.Context, contest_id: int, problem_id: t.Optional[ProblemType]
) -> None:
"""
Download contest or individual problems.
Expand Down Expand Up @@ -363,7 +363,7 @@ def run(context: click.Context, problem_id: ProblemType) -> None:


def print_center_separated(
target_str: str, width: int = 100, color_addons: list[str] = [], delim: str = "="
target_str: str, width: int = 100, color_addons: t.List[str] = [], delim: str = "="
) -> None:
rem_width = (width - len(target_str)) // 2
side_thing = delim * (rem_width - 1)
Expand Down

0 comments on commit 0ef3f32

Please sign in to comment.