Drop support for Python 3.8

This commit is contained in:
rlaphoenix
2023-02-22 03:43:22 +00:00
parent f21aa5aac5
commit c1f716cb6c
20 changed files with 6 additions and 44 deletions

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
import logging
import re
from pathlib import Path

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
import logging
from pathlib import Path
from typing import Optional

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
from typing import Optional
import click

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
import asyncio
import subprocess
from pathlib import Path

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
import subprocess
from pathlib import Path
from typing import Optional, Union

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
import random
import re
import subprocess

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
import json
import re
from typing import Optional

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
import base64
import logging
from abc import ABCMeta, abstractmethod

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
from pathlib import Path
import click

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
import re
import shutil
import subprocess

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
import ast
import contextlib
import importlib.util
@@ -22,12 +20,6 @@ from devine.core.config import config
from devine.core.constants import LANGUAGE_MAX_DISTANCE
def is_relative_to_backport(base: Path, path_: Union[Path, str]) -> bool:
"""Same as Path.is_relative_to, but back-ported to 3.8.x."""
path_ = Path(path_)
return path_ == base or path_ in base.parents
def import_module_by_path(path: Path) -> ModuleType:
"""Import a Python file by Path as a Module."""
if not path:
@@ -38,7 +30,7 @@ def import_module_by_path(path: Path) -> ModuleType:
raise ValueError("Path does not exist")
# compute package hierarchy for relative import support
if is_relative_to_backport(path, config.directories.core_dir):
if path.is_relative_to(config.directories.core_dir):
name = []
_path = path.parent
while _path.stem != config.directories.core_dir.stem:

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
import re
from typing import Optional, Union

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
from abc import ABCMeta, abstractmethod
from typing import Iterator, Optional, Union
from uuid import UUID

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
from typing import Any, Iterator, Optional, Union
from uuid import UUID

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
import threading
from typing import Iterator, Optional, Union
from uuid import UUID

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
import sqlite3
import threading
from pathlib import Path