Skip to content

Commit 457c5c0

Browse files
authored
Fix linting issues reported by the latest version of Ruff (#585)
1 parent dd31328 commit 457c5c0

File tree

8 files changed

+18
-19
lines changed

8 files changed

+18
-19
lines changed

pylsp/config/source.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ def _get_opt(cls, config, key, option, opt_type):
5353
if not config.has_option(key, opt_key):
5454
continue
5555

56-
if opt_type == bool:
56+
if opt_type is bool:
5757
return config.getboolean(key, opt_key)
5858

59-
if opt_type == int:
59+
if opt_type is int:
6060
return config.getint(key, opt_key)
6161

62-
if opt_type == str:
62+
if opt_type is str:
6363
return config.get(key, opt_key)
6464

65-
if opt_type == list:
65+
if opt_type is list:
6666
return cls._parse_list_opt(config.get(key, opt_key))
6767

6868
raise ValueError("Unknown option type: %s" % opt_type)

test/fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import os
55
from io import StringIO
6-
from test.test_utils import CALL_TIMEOUT_IN_SECONDS, ClientServerPair
76
from unittest.mock import MagicMock
87

98
import pytest
@@ -15,6 +14,7 @@
1514
from pylsp.config.config import Config
1615
from pylsp.python_lsp import PythonLSPServer
1716
from pylsp.workspace import Document, Workspace
17+
from test.test_utils import CALL_TIMEOUT_IN_SECONDS, ClientServerPair
1818

1919
DOC_URI = uris.from_fs_path(__file__)
2020
DOC = """import sys

test/plugins/test_autoimport.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Copyright 2022- Python Language Server Contributors.
22

3-
from test.test_notebook_document import wait_for_condition
4-
from test.test_utils import send_initialize_request, send_notebook_did_open
53
from typing import Any, Dict, List
64
from unittest.mock import Mock, patch
75

@@ -22,6 +20,8 @@
2220
pylsp_completions as pylsp_autoimport_completions,
2321
)
2422
from pylsp.workspace import Workspace
23+
from test.test_notebook_document import wait_for_condition
24+
from test.test_utils import send_initialize_request, send_notebook_did_open
2525

2626
DOC_URI = uris.from_fs_path(__file__)
2727

test/test_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Copyright 2021- Python Language Server Contributors.
22

3-
from test.test_notebook_document import wait_for_condition
4-
from test.test_utils import send_initialize_request
53
from unittest.mock import patch
64

75
import pytest
86

97
from pylsp import IS_WIN
8+
from test.test_notebook_document import wait_for_condition
9+
from test.test_utils import send_initialize_request
1010

1111
INITIALIZATION_OPTIONS = {
1212
"pylsp": {

test/test_document.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Copyright 2017-2020 Palantir Technologies, Inc.
22
# Copyright 2021- Python Language Server Contributors.
33

4-
from test.fixtures import DOC, DOC_URI
5-
64
from pylsp.workspace import Document
5+
from test.fixtures import DOC, DOC_URI
76

87

98
def test_document_props(doc):

test/test_language_server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
import os
55
import sys
66
import time
7-
from test.test_utils import ClientServerPair, send_initialize_request
87

98
import pytest
109
from flaky import flaky
1110
from pylsp_jsonrpc.exceptions import JsonRpcMethodNotFound
1211

12+
from test.test_utils import ClientServerPair, send_initialize_request
13+
1314
RUNNING_IN_CI = bool(os.environ.get("CI"))
1415

1516
CALL_TIMEOUT_IN_SECONDS = 10

test/test_notebook_document.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Copyright 2021- Python Language Server Contributors.
22

33
import time
4-
from test.test_utils import (
5-
CALL_TIMEOUT_IN_SECONDS,
6-
send_initialize_request,
7-
send_notebook_did_open,
8-
)
94
from unittest.mock import call, patch
105

116
import pytest
127

138
from pylsp import IS_WIN
149
from pylsp.lsp import NotebookCellKind
1510
from pylsp.workspace import Notebook
11+
from test.test_utils import (
12+
CALL_TIMEOUT_IN_SECONDS,
13+
send_initialize_request,
14+
send_notebook_did_open,
15+
)
1616

1717

1818
def wait_for_condition(condition, timeout=CALL_TIMEOUT_IN_SECONDS):

test/test_uris.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Copyright 2017-2020 Palantir Technologies, Inc.
22
# Copyright 2021- Python Language Server Contributors.
33

4-
from test import unix_only, windows_only
5-
64
import pytest
75

86
from pylsp import uris
7+
from test import unix_only, windows_only
98

109

1110
@unix_only

0 commit comments

Comments
 (0)