Skip to content

Commit c93a9af

Browse files
committed
Merge branch 'develop' into docstring-hook
2 parents eb3f843 + e9776fd commit c93a9af

23 files changed

+75
-73
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
PYTHON_VERSION: ['3.8']
20+
PYTHON_VERSION: ['3.9']
2121
timeout-minutes: 10
2222
steps:
2323
- uses: actions/cache@v1

.github/workflows/static.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ jobs:
3030
- uses: actions/checkout@v4
3131
- uses: actions/setup-python@v5
3232
with:
33-
# TODO: check with Python 3, but need to fix the
34-
# errors first
35-
python-version: '3.8'
33+
python-version: '3.9'
3634
architecture: 'x64'
3735
- run: python -m pip install --upgrade pip setuptools jsonschema
3836
# If we don't install pycodestyle, pylint will throw an unused-argument error in pylsp/plugins/pycodestyle_lint.py:72

.github/workflows/test-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
PYTHON_VERSION: ['3.10', '3.9', '3.8']
27+
PYTHON_VERSION: ['3.11', '3.10', '3.9']
2828
timeout-minutes: 10
2929
steps:
3030
- uses: actions/cache@v4

.github/workflows/test-mac.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
PYTHON_VERSION: ['3.10', '3.9', '3.8']
27+
PYTHON_VERSION: ['3.11', '3.10', '3.9']
2828
timeout-minutes: 10
2929
steps:
3030
- uses: actions/cache@v4

.github/workflows/test-win.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
PYTHON_VERSION: ['3.10', '3.9', '3.8']
27+
PYTHON_VERSION: ['3.11', '3.10', '3.9']
2828
timeout-minutes: 10
2929
steps:
3030
- uses: actions/cache@v4

pylsp/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
start_ws_lang_server,
2121
)
2222

23-
LOG_FORMAT = "%(asctime)s {0} - %(levelname)s - %(name)s - %(message)s".format(
23+
LOG_FORMAT = "%(asctime)s {} - %(levelname)s - %(name)s - %(message)s".format(
2424
time.localtime().tm_zone
2525
)
2626

@@ -98,7 +98,7 @@ def _configure_logger(verbose=0, log_config=None, log_file=None) -> None:
9898
root_logger = logging.root
9999

100100
if log_config:
101-
with open(log_config, "r", encoding="utf-8") as f:
101+
with open(log_config, encoding="utf-8") as f:
102102
logging.config.dictConfig(json.load(f))
103103
else:
104104
formatter = logging.Formatter(LOG_FORMAT)

pylsp/_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import sys
1212
import threading
1313
import time
14-
from typing import List, Optional
14+
from typing import Optional
1515

1616
import docstring_to_markdown
1717
import jedi
@@ -80,7 +80,7 @@ def find_parents(root, path, names):
8080
8181
Args:
8282
path (str): The file path to start searching up from.
83-
names (List[str]): The file/directory names to look for.
83+
names (list[str]): The file/directory names to look for.
8484
root (str): The directory at which to stop recursing upwards.
8585
8686
Note:
@@ -200,7 +200,7 @@ def wrap_signature(signature):
200200
SERVER_SUPPORTED_MARKUP_KINDS = {"markdown", "plaintext"}
201201

202202

203-
def choose_markup_kind(client_supported_markup_kinds: List[str]):
203+
def choose_markup_kind(client_supported_markup_kinds: list[str]):
204204
"""Choose a markup kind supported by both client and the server.
205205
206206
This gives priority to the markup kinds provided earlier on the client preference list.
@@ -316,7 +316,7 @@ def convert_signatures_to_markdown(signatures: List[str], config: dict) -> str:
316316
def format_docstring(
317317
contents: str,
318318
markup_kind: str,
319-
signatures: Optional[List[str]] = None,
319+
signatures: Optional[list[str]] = None,
320320
signature_config: Optional[dict] = None,
321321
):
322322
"""Transform the provided docstring into a MarkupContent object.

pylsp/config/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
import logging
55
import sys
6+
from collections.abc import Mapping, Sequence
67
from functools import lru_cache
7-
from typing import List, Mapping, Sequence, Union
8+
from typing import Union
89

910
import pluggy
1011
from pluggy._hooks import HookImpl
@@ -32,7 +33,7 @@ def _hookexec(
3233
methods: Sequence[HookImpl],
3334
kwargs: Mapping[str, object],
3435
firstresult: bool,
35-
) -> Union[object, List[object]]:
36+
) -> Union[object, list[object]]:
3637
# called from all hookcaller instances.
3738
# enable_tracing will set its own wrapping function at self._inner_hookexec
3839
try:

pylsp/plugins/_resolvers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def resolve(self, completion):
8888
def format_label(completion, sig):
8989
if sig and completion.type in ("function", "method"):
9090
params = ", ".join(param.name for param in sig[0].params)
91-
label = "{}({})".format(completion.name, params)
91+
label = f"{completion.name}({params})"
9292
return label
9393
return completion.name
9494

@@ -115,7 +115,7 @@ def format_snippet(completion, sig):
115115
snippet_completion["insertTextFormat"] = lsp.InsertTextFormat.Snippet
116116
snippet = completion.name + "("
117117
for i, param in enumerate(positional_args):
118-
snippet += "${%s:%s}" % (i + 1, param.name)
118+
snippet += "${{{}:{}}}".format(i + 1, param.name)
119119
if i < len(positional_args) - 1:
120120
snippet += ", "
121121
snippet += ")$0"

pylsp/plugins/_rope_task_handle.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from __future__ import annotations
22

33
import logging
4-
from typing import Callable, ContextManager, List, Optional, Sequence
4+
from collections.abc import Sequence
5+
from typing import Callable, ContextManager
56

67
from rope.base.taskhandle import BaseJobSet, BaseTaskHandle
78

@@ -19,13 +20,13 @@ class PylspJobSet(BaseJobSet):
1920
_report_iter: ContextManager
2021
job_name: str = ""
2122

22-
def __init__(self, count: Optional[int], report_iter: ContextManager) -> None:
23+
def __init__(self, count: int | None, report_iter: ContextManager) -> None:
2324
if count is not None:
2425
self.count = count
2526
self._reporter = report_iter.__enter__()
2627
self._report_iter = report_iter
2728

28-
def started_job(self, name: Optional[str]) -> None:
29+
def started_job(self, name: str | None) -> None:
2930
if name:
3031
self.job_name = name
3132

@@ -42,7 +43,7 @@ def finished_job(self) -> None:
4243
def check_status(self) -> None:
4344
pass
4445

45-
def get_percent_done(self) -> Optional[float]:
46+
def get_percent_done(self) -> float | None:
4647
if self.count == 0:
4748
return 0
4849
return (self.done / self.count) * 100
@@ -66,8 +67,8 @@ def _report(self) -> None:
6667

6768
class PylspTaskHandle(BaseTaskHandle):
6869
name: str
69-
observers: List
70-
job_sets: List[PylspJobSet]
70+
observers: list
71+
job_sets: list[PylspJobSet]
7172
stopped: bool
7273
workspace: Workspace
7374
_report: Callable[[str, str], None]
@@ -77,7 +78,7 @@ def __init__(self, workspace: Workspace) -> None:
7778
self.job_sets = []
7879
self.observers = []
7980

80-
def create_jobset(self, name="JobSet", count: Optional[int] = None):
81+
def create_jobset(self, name="JobSet", count: int | None = None):
8182
report_iter = self.workspace.report_progress(
8283
name, None, None, skip_token_initialization=True
8384
)
@@ -89,7 +90,7 @@ def create_jobset(self, name="JobSet", count: Optional[int] = None):
8990
def stop(self) -> None:
9091
pass
9192

92-
def current_jobset(self) -> Optional[BaseJobSet]:
93+
def current_jobset(self) -> BaseJobSet | None:
9394
pass
9495

9596
def add_observer(self) -> None:

0 commit comments

Comments
 (0)