From 8753d98e7c729a0066275ca9ba3081de6505896b Mon Sep 17 00:00:00 2001 From: MZuenni Date: Tue, 1 Oct 2024 18:37:45 +0200 Subject: [PATCH] removed deprecated typing --- bin/fuzz.py | 2 +- bin/generate.py | 3 ++- bin/latex.py | 4 ++-- bin/parallel.py | 3 ++- bin/problem.py | 3 ++- bin/stats.py | 2 +- bin/util.py | 3 ++- 7 files changed, 12 insertions(+), 8 deletions(-) diff --git a/bin/fuzz.py b/bin/fuzz.py index bebf6f458..50d39417f 100644 --- a/bin/fuzz.py +++ b/bin/fuzz.py @@ -6,7 +6,7 @@ import time import threading from colorama import Fore, Style -from typing import Callable +from collections.abc import Callable import parallel from util import * diff --git a/bin/generate.py b/bin/generate.py index b37649733..cc2c8b2b1 100644 --- a/bin/generate.py +++ b/bin/generate.py @@ -8,8 +8,9 @@ import shutil import secrets +from collections.abc import Callable from pathlib import Path, PurePosixPath, PurePath -from typing import Callable, Literal, overload +from typing import Literal, overload import config import inspect diff --git a/bin/latex.py b/bin/latex.py index da9144ac0..a04fa9213 100644 --- a/bin/latex.py +++ b/bin/latex.py @@ -5,7 +5,7 @@ import shutil import sys from pathlib import Path -from typing import Dict, Optional +from typing import Optional from colorama import Fore, Style @@ -179,7 +179,7 @@ def get_tl(problem: "problem.Problem"): return tl if print_tl else '' -def make_environment() -> Dict[str, str]: +def make_environment() -> dict[str, str]: env = os.environ.copy() # Search the contest directory and the latex directory. latex_paths = [ diff --git a/bin/parallel.py b/bin/parallel.py index f06f50fc4..2d699e72c 100644 --- a/bin/parallel.py +++ b/bin/parallel.py @@ -3,7 +3,8 @@ import os import signal import threading -from typing import Any, Callable, Generic, Literal, Optional, TypeVar +from collections.abc import Callable +from typing import Any, Generic, Literal, Optional, TypeVar import config import util diff --git a/bin/problem.py b/bin/problem.py index a39cfd691..1e0c157f4 100644 --- a/bin/problem.py +++ b/bin/problem.py @@ -4,8 +4,9 @@ import sys import threading +from collections.abc import Callable from pathlib import Path -from typing import Callable, Literal, Optional, Type, TYPE_CHECKING +from typing import Literal, Optional, Type, TYPE_CHECKING if TYPE_CHECKING: # Prevent circular import: https://stackoverflow.com/a/39757388 from program import Program diff --git a/bin/stats.py b/bin/stats.py index a92e17772..2a09cbc1e 100644 --- a/bin/stats.py +++ b/bin/stats.py @@ -1,6 +1,6 @@ import sys +from collections.abc import Callable from pathlib import Path -from typing import Callable from colorama import Fore, Style diff --git a/bin/util.py b/bin/util.py index aaf3b217a..6d5235e41 100644 --- a/bin/util.py +++ b/bin/util.py @@ -14,8 +14,9 @@ import threading import time from enum import Enum +from collections.abc import Sequence from pathlib import Path -from typing import Any, NoReturn, Optional, Sequence +from typing import Any, NoReturn, Optional import yaml as yamllib from colorama import Fore, Style