Skip to content

Commit a8545b1

Browse files
authored
Merge branch 'develop' into codegen/epic/2206/task/88357/solve/24775
2 parents 4ca0fd2 + cabac8e commit a8545b1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+351
-303
lines changed

.github/workflows/static.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ jobs:
2222
OS: 'linux'
2323
timeout-minutes: 2
2424
steps:
25-
- uses: actions/cache@v1
25+
- uses: actions/cache@v4
2626
with:
2727
path: ~/.cache/pip
2828
key: static-pip-${{ hashFiles('pyproject.toml') }}
2929
restore-keys: static-pip-
30-
- uses: actions/checkout@v2
31-
- uses: actions/setup-python@v2
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-python@v5
3232
with:
3333
# TODO: check with Python 3, but need to fix the
3434
# errors first

.github/workflows/test-linux.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ jobs:
2727
PYTHON_VERSION: ['3.10', '3.9', '3.8']
2828
timeout-minutes: 10
2929
steps:
30-
- uses: actions/cache@v1
30+
- uses: actions/cache@v4
3131
with:
3232
path: ~/.cache/pip
3333
key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('pyproject.toml') }}
3434
restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
35-
- uses: actions/checkout@v2
36-
- uses: actions/setup-python@v2
35+
- uses: actions/checkout@v4
36+
- uses: actions/setup-python@v5
3737
with:
3838
python-version: ${{ matrix.PYTHON_VERSION }}
3939
architecture: 'x64'

.github/workflows/test-mac.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ jobs:
2727
PYTHON_VERSION: ['3.10', '3.9', '3.8']
2828
timeout-minutes: 10
2929
steps:
30-
- uses: actions/cache@v1
30+
- uses: actions/cache@v4
3131
with:
3232
path: ~/Library/Caches/pip
3333
key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('pyproject.toml') }}
3434
restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
35-
- uses: actions/checkout@v2
36-
- uses: actions/setup-python@v2
35+
- uses: actions/checkout@v4
36+
- uses: actions/setup-python@v5
3737
with:
3838
python-version: ${{ matrix.PYTHON_VERSION }}
3939
architecture: 'x64'

.github/workflows/test-win.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ jobs:
2727
PYTHON_VERSION: ['3.10', '3.9', '3.8']
2828
timeout-minutes: 10
2929
steps:
30-
- uses: actions/cache@v1
30+
- uses: actions/cache@v4
3131
with:
3232
path: ~\AppData\Local\pip\Cache
3333
key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('pyproject.toml') }}
3434
restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
35-
- uses: actions/checkout@v2
36-
- uses: actions/setup-python@v2
35+
- uses: actions/checkout@v4
36+
- uses: actions/setup-python@v5
3737
with:
3838
python-version: ${{ matrix.PYTHON_VERSION }}
3939
architecture: 'x64'

CONFIGURATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This server can be configured using the `workspace/didChangeConfiguration` metho
99
| `pylsp.plugins.flake8.enabled` | `boolean` | Enable or disable the plugin. | `false` |
1010
| `pylsp.plugins.flake8.exclude` | `array` of `string` items | List of files or directories to exclude. | `[]` |
1111
| `pylsp.plugins.flake8.extendIgnore` | `array` of `string` items | List of errors and warnings to append to ignore list. | `[]` |
12+
| `pylsp.plugins.flake8.extendSelect` | `array` of `string` items | List of errors and warnings to append to select list. | `[]` |
1213
| `pylsp.plugins.flake8.executable` | `string` | Path to the flake8 executable. | `"flake8"` |
1314
| `pylsp.plugins.flake8.filename` | `string` | Only check for filenames matching the patterns in this list. | `null` |
1415
| `pylsp.plugins.flake8.hangClosing` | `boolean` | Hang closing bracket instead of matching indentation of opening bracket's line. | `null` |

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ sudo apt-get install python3-pylsp
6262
or Fedora Linux
6363

6464
```
65-
sudo dnf install python-lsp-server
65+
sudo dnf install python3-lsp-server
6666
```
6767

6868
or Arch Linux

pylsp/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
)
2626

2727

28-
def add_arguments(parser):
28+
def add_arguments(parser) -> None:
2929
parser.description = "Python Language Server"
3030

3131
parser.add_argument(
@@ -67,7 +67,7 @@ def add_arguments(parser):
6767
)
6868

6969

70-
def main():
70+
def main() -> None:
7171
parser = argparse.ArgumentParser()
7272
add_arguments(parser)
7373
args = parser.parse_args()
@@ -94,7 +94,7 @@ def _binary_stdio():
9494
return stdin, stdout
9595

9696

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

100100
if log_config:

pylsp/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def find_parents(root, path, names):
8888
return []
8989

9090
if not os.path.commonprefix((root, path)):
91-
log.warning("Path %s not in %s", path, root)
91+
log.warning("Path %r not in %r", path, root)
9292
return []
9393

9494
# Split the relative by directory, generate all the parent directories, then check each of them.

pylsp/config/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _hookexec(
4343

4444

4545
class Config:
46-
def __init__(self, root_uri, init_opts, process_id, capabilities):
46+
def __init__(self, root_uri, init_opts, process_id, capabilities) -> None:
4747
self._root_path = uris.to_fs_path(root_uri)
4848
self._root_uri = root_uri
4949
self._init_opts = init_opts
@@ -185,14 +185,14 @@ def plugin_settings(self, plugin, document_path=None):
185185
.get(plugin, {})
186186
)
187187

188-
def update(self, settings):
188+
def update(self, settings) -> None:
189189
"""Recursively merge the given settings into the current settings."""
190190
self.settings.cache_clear()
191191
self._settings = settings
192192
log.info("Updated settings to %s", self._settings)
193193
self._update_disabled_plugins()
194194

195-
def _update_disabled_plugins(self):
195+
def _update_disabled_plugins(self) -> None:
196196
# All plugins default to enabled
197197
self._disabled_plugins = [
198198
plugin

pylsp/config/flake8_conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# flake8
2828
("exclude", "plugins.flake8.exclude", list),
2929
("extend-ignore", "plugins.flake8.extendIgnore", list),
30+
("extend-select", "plugins.flake8.extendSelect", list),
3031
("filename", "plugins.flake8.filename", list),
3132
("hang-closing", "plugins.flake8.hangClosing", bool),
3233
("ignore", "plugins.flake8.ignore", list),

pylsp/config/schema.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@
5353
},
5454
"description": "List of errors and warnings to append to ignore list."
5555
},
56+
"pylsp.plugins.flake8.extendSelect": {
57+
"type": "array",
58+
"default": [],
59+
"items": {
60+
"type": "string"
61+
},
62+
"description": "List of errors and warnings to append to select list."
63+
},
5664
"pylsp.plugins.flake8.executable": {
5765
"type": "string",
5866
"default": "flake8",
@@ -500,4 +508,4 @@
500508
"description": "The name of the folder in which rope stores project configurations and data. Pass `null` for not using such a folder at all."
501509
}
502510
}
503-
}
511+
}

pylsp/config/source.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
class ConfigSource:
1313
"""Base class for implementing a config source."""
1414

15-
def __init__(self, root_path):
15+
def __init__(self, root_path) -> None:
1616
self.root_path = root_path
1717
self.is_windows = sys.platform == "win32"
1818
self.xdg_home = os.environ.get(
1919
"XDG_CONFIG_HOME", os.path.expanduser("~/.config")
2020
)
2121

22-
def user_config(self):
22+
def user_config(self) -> None:
2323
"""Return user-level (i.e. home directory) configuration."""
2424
raise NotImplementedError()
2525

26-
def project_config(self, document_path):
26+
def project_config(self, document_path) -> None:
2727
"""Return project-level (i.e. workspace directory) configuration."""
2828
raise NotImplementedError()
2929

@@ -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)

pylsp/hookspecs.py

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ def pylsp_code_actions(config, workspace, document, range, context):
1010

1111

1212
@hookspec
13-
def pylsp_code_lens(config, workspace, document):
13+
def pylsp_code_lens(config, workspace, document) -> None:
1414
pass
1515

1616

1717
@hookspec
18-
def pylsp_commands(config, workspace):
18+
def pylsp_commands(config, workspace) -> None:
1919
"""The list of command strings supported by the server.
2020
2121
Returns:
@@ -24,110 +24,112 @@ def pylsp_commands(config, workspace):
2424

2525

2626
@hookspec
27-
def pylsp_completions(config, workspace, document, position, ignored_names):
27+
def pylsp_completions(config, workspace, document, position, ignored_names) -> None:
2828
pass
2929

3030

3131
@hookspec(firstresult=True)
32-
def pylsp_completion_item_resolve(config, workspace, document, completion_item):
32+
def pylsp_completion_item_resolve(config, workspace, document, completion_item) -> None:
3333
pass
3434

3535

3636
@hookspec
37-
def pylsp_definitions(config, workspace, document, position):
37+
def pylsp_definitions(config, workspace, document, position) -> None:
3838
pass
3939

4040

4141
@hookspec
42-
def pylsp_dispatchers(config, workspace):
42+
def pylsp_dispatchers(config, workspace) -> None:
4343
pass
4444

4545

4646
@hookspec
47-
def pylsp_document_did_open(config, workspace, document):
47+
def pylsp_document_did_open(config, workspace, document) -> None:
4848
pass
4949

5050

5151
@hookspec
52-
def pylsp_document_did_save(config, workspace, document):
52+
def pylsp_document_did_save(config, workspace, document) -> None:
5353
pass
5454

5555

5656
@hookspec
57-
def pylsp_document_highlight(config, workspace, document, position):
57+
def pylsp_document_highlight(config, workspace, document, position) -> None:
5858
pass
5959

6060

6161
@hookspec
62-
def pylsp_document_symbols(config, workspace, document):
62+
def pylsp_document_symbols(config, workspace, document) -> None:
6363
pass
6464

6565

6666
@hookspec(firstresult=True)
67-
def pylsp_execute_command(config, workspace, command, arguments):
67+
def pylsp_execute_command(config, workspace, command, arguments) -> None:
6868
pass
6969

7070

7171
@hookspec
72-
def pylsp_experimental_capabilities(config, workspace):
72+
def pylsp_experimental_capabilities(config, workspace) -> None:
7373
pass
7474

7575

7676
@hookspec
77-
def pylsp_folding_range(config, workspace, document):
77+
def pylsp_folding_range(config, workspace, document) -> None:
7878
pass
7979

8080

8181
@hookspec(firstresult=True)
82-
def pylsp_format_document(config, workspace, document, options):
82+
def pylsp_format_document(config, workspace, document, options) -> None:
8383
pass
8484

8585

8686
@hookspec(firstresult=True)
87-
def pylsp_format_range(config, workspace, document, range, options):
87+
def pylsp_format_range(config, workspace, document, range, options) -> None:
8888
pass
8989

9090

9191
@hookspec(firstresult=True)
92-
def pylsp_hover(config, workspace, document, position):
92+
def pylsp_hover(config, workspace, document, position) -> None:
9393
pass
9494

9595

9696
@hookspec
97-
def pylsp_initialize(config, workspace):
97+
def pylsp_initialize(config, workspace) -> None:
9898
pass
9999

100100

101101
@hookspec
102-
def pylsp_initialized():
102+
def pylsp_initialized() -> None:
103103
pass
104104

105105

106106
@hookspec
107-
def pylsp_lint(config, workspace, document, is_saved):
107+
def pylsp_lint(config, workspace, document, is_saved) -> None:
108108
pass
109109

110110

111111
@hookspec
112-
def pylsp_references(config, workspace, document, position, exclude_declaration):
112+
def pylsp_references(
113+
config, workspace, document, position, exclude_declaration
114+
) -> None:
113115
pass
114116

115117

116118
@hookspec(firstresult=True)
117-
def pylsp_rename(config, workspace, document, position, new_name):
119+
def pylsp_rename(config, workspace, document, position, new_name) -> None:
118120
pass
119121

120122

121123
@hookspec
122-
def pylsp_settings(config):
124+
def pylsp_settings(config) -> None:
123125
pass
124126

125127

126128
@hookspec(firstresult=True)
127-
def pylsp_signature_help(config, workspace, document, position):
129+
def pylsp_signature_help(config, workspace, document, position) -> None:
128130
pass
129131

130132

131133
@hookspec
132-
def pylsp_workspace_configuration_changed(config, workspace):
134+
def pylsp_workspace_configuration_changed(config, workspace) -> None:
133135
pass

pylsp/plugins/_resolvers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# ---- Base class
1616
# -----------------------------------------------------------------------------
1717
class Resolver:
18-
def __init__(self, callback, resolve_on_error, time_to_live=60 * 30):
18+
def __init__(self, callback, resolve_on_error, time_to_live=60 * 30) -> None:
1919
self.callback = callback
2020
self.resolve_on_error = resolve_on_error
2121
self._cache = {}
@@ -33,7 +33,7 @@ def cached_modules(self):
3333
def cached_modules(self, new_value):
3434
self._cached_modules = set(new_value)
3535

36-
def clear_outdated(self):
36+
def clear_outdated(self) -> None:
3737
now = self.time_key()
3838
to_clear = [timestamp for timestamp in self._cache_ttl if timestamp < now]
3939
for time_key in to_clear:

0 commit comments

Comments
 (0)