Skip to content

Commit 18c3c65

Browse files
committed
fix deprecations
1 parent c0b8d32 commit 18c3c65

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

‎install-poetry.py‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import sys
2828

29-
3029
# Eager version check so we fail nicely before possible syntax errors
3130
if sys.version_info < (3, 6): # noqa: UP036
3231
sys.stdout.write("Poetry installer requires Python 3.6 or newer to run!\n")
@@ -47,11 +46,9 @@
4746
from functools import cmp_to_key
4847
from io import UnsupportedOperation
4948
from pathlib import Path
50-
from typing import Optional
5149
from urllib.request import Request
5250
from urllib.request import urlopen
5351

54-
5552
SHELL = os.getenv("SHELL", "")
5653
WINDOWS = sys.platform.startswith("win") or (sys.platform == "cli" and os.name == "nt")
5754
MINGW = sysconfig.get_platform().startswith("mingw")
@@ -288,7 +285,7 @@ def _get_win_folder_with_ctypes(csidl_name):
288285

289286

290287
class PoetryInstallationError(RuntimeError):
291-
def __init__(self, return_code: int = 0, log: Optional[str] = None):
288+
def __init__(self, return_code: int = 0, log: str | None = None):
292289
super().__init__()
293290
self.return_code = return_code
294291
self.log = log
@@ -492,12 +489,12 @@ class Installer:
492489

493490
def __init__(
494491
self,
495-
version: Optional[str] = None,
492+
version: str | None = None,
496493
preview: bool = False,
497494
force: bool = False,
498495
accept_all: bool = False,
499-
git: Optional[str] = None,
500-
path: Optional[str] = None,
496+
git: str | None = None,
497+
path: str | None = None,
501498
) -> None:
502499
self._version = version
503500
self._preview = preview
@@ -536,7 +533,7 @@ def run(self) -> int:
536533
version = self._path
537534
else:
538535
try:
539-
version, current_version = self.get_version()
536+
version, _current_version = self.get_version()
540537
except ValueError:
541538
return 1
542539

@@ -735,7 +732,7 @@ def display_post_message_windows(self, version: str) -> None:
735732
)
736733
)
737734

738-
def get_windows_path_var(self) -> Optional[str]:
735+
def get_windows_path_var(self) -> str | None:
739736
import winreg
740737

741738
with winreg.ConnectRegistry(

‎pyproject.toml‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
[tool.ruff]
22
fix = true
3+
line-length = 88
4+
target-version = "py310"
5+
6+
[tool.ruff.lint]
37
unfixable = [
48
"ERA", # do not autoremove commented out code
59
]
6-
target-version = "py37"
7-
line-length = 88
810
extend-select = [
911
"B", # flake8-bugbear
1012
"C4", # flake8-comprehensions
@@ -20,10 +22,9 @@ extend-select = [
2022
"UP", # pyupgrade
2123
]
2224

23-
[tool.ruff.flake8-tidy-imports]
25+
[tool.ruff.lint.flake8-tidy-imports]
2426
ban-relative-imports = "all"
2527

26-
[tool.ruff.isort]
28+
[tool.ruff.lint.isort]
2729
force-single-line = true
2830
lines-between-types = 1
29-
lines-after-imports = 2

0 commit comments

Comments
 (0)