GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Set return type to `None` for functions without returns (#581) · deepnote/python-lsp-server@cabac8e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • pylsp
    • __main__.py
    • config
      • config.py
      • source.py
    • hookspecs.py
    • plugins
      • _resolvers.py
      • _rope_task_handle.py
      • preload_imports.py
      • pycodestyle_lint.py
      • pydocstyle_lint.py
      • pyflakes_lint.py
      • rope_autoimport.py
    • python_lsp.py
    • workspace.py
  • scripts
    • jsonschema2md.py
  • test
    • fixtures.py
    • plugins
      • test_autoimport.py
      • test_autopep8_format.py
      • test_completion.py
      • test_definitions.py
      • test_flake8_lint.py
      • test_folding.py
      • test_highlight.py
      • test_hover.py
      • test_jedi_rename.py
      • test_mccabe_lint.py
      • test_pycodestyle_lint.py
      • test_pydocstyle_lint.py
      • test_pyflakes_lint.py
      • test_pylint_lint.py
      • test_references.py
      • test_signature.py
      • test_symbols.py
      • test_yapf_format.py
    • test_configuration.py
    • test_document.py
    • test_language_server.py
    • test_notebook_document.py
    • test_text_edit.py
    • test_uris.py
    • test_utils.py
    • test_workspace.py

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎pylsp/__main__.py‎

Copy file name to clipboardExpand all lines: pylsp/__main__.py
+3-3Lines 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:
Collapse file

‎pylsp/config/config.py‎

Copy file name to clipboardExpand all lines: pylsp/config/config.py
+3-3Lines 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
Collapse file

‎pylsp/config/source.py‎

Copy file name to clipboardExpand all lines: pylsp/config/source.py
+3-3Lines changed: 3 additions & 3 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

Collapse file

‎pylsp/hookspecs.py‎

Copy file name to clipboardExpand all lines: pylsp/hookspecs.py
+26-24Lines 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
Collapse file

‎pylsp/plugins/_resolvers.py‎

Copy file name to clipboardExpand all lines: pylsp/plugins/_resolvers.py
+2-2Lines 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:
Collapse file

‎pylsp/plugins/_rope_task_handle.py‎

Copy file name to clipboardExpand all lines: pylsp/plugins/_rope_task_handle.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PylspJobSet(BaseJobSet):
1919
_report_iter: ContextManager
2020
job_name: str = ""
2121

22-
def __init__(self, count: Optional[int], report_iter: ContextManager):
22+
def __init__(self, count: Optional[int], report_iter: ContextManager) -> None:
2323
if count is not None:
2424
self.count = count
2525
self._reporter = report_iter.__enter__()
@@ -57,7 +57,7 @@ def increment(self) -> None:
5757
self._report()
5858

5959
@throttle(0.5)
60-
def _report(self):
60+
def _report(self) -> None:
6161
percent = int(self.get_percent_done())
6262
message = f"{self.job_name} {self.done}/{self.count}"
6363
log.debug(f"Reporting {message} {percent}%")
@@ -72,7 +72,7 @@ class PylspTaskHandle(BaseTaskHandle):
7272
workspace: Workspace
7373
_report: Callable[[str, str], None]
7474

75-
def __init__(self, workspace: Workspace):
75+
def __init__(self, workspace: Workspace) -> None:
7676
self.workspace = workspace
7777
self.job_sets = []
7878
self.observers = []
Collapse file

‎pylsp/plugins/preload_imports.py‎

Copy file name to clipboardExpand all lines: pylsp/plugins/preload_imports.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def pylsp_settings():
6767

6868

6969
@hookimpl
70-
def pylsp_initialize(config):
70+
def pylsp_initialize(config) -> None:
7171
for mod_name in config.plugin_settings("preload").get("modules", []):
7272
try:
7373
__import__(mod_name)
Collapse file

‎pylsp/plugins/pycodestyle_lint.py‎

Copy file name to clipboardExpand all lines: pylsp/plugins/pycodestyle_lint.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def pylsp_lint(workspace, document):
6565

6666

6767
class PyCodeStyleDiagnosticReport(pycodestyle.BaseReport):
68-
def __init__(self, options):
68+
def __init__(self, options) -> None:
6969
self.diagnostics = []
7070
super().__init__(options=options)
7171

Collapse file

‎pylsp/plugins/pydocstyle_lint.py‎

Copy file name to clipboardExpand all lines: pylsp/plugins/pydocstyle_lint.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def _parse_diagnostic(document, error):
115115

116116

117117
@contextlib.contextmanager
118-
def _patch_sys_argv(arguments):
118+
def _patch_sys_argv(arguments) -> None:
119119
old_args = sys.argv
120120

121121
# Preserve argv[0] since it's the executable
Collapse file

‎pylsp/plugins/pyflakes_lint.py‎

Copy file name to clipboardExpand all lines: pylsp/plugins/pyflakes_lint.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ def pylsp_lint(workspace, document):
3232

3333

3434
class PyflakesDiagnosticReport:
35-
def __init__(self, lines):
35+
def __init__(self, lines) -> None:
3636
self.lines = lines
3737
self.diagnostics = []
3838

39-
def unexpectedError(self, _filename, msg): # pragma: no cover
39+
def unexpectedError(self, _filename, msg) -> None: # pragma: no cover
4040
err_range = {
4141
"start": {"line": 0, "character": 0},
4242
"end": {"line": 0, "character": 0},
@@ -50,7 +50,7 @@ def unexpectedError(self, _filename, msg): # pragma: no cover
5050
}
5151
)
5252

53-
def syntaxError(self, _filename, msg, lineno, offset, text):
53+
def syntaxError(self, _filename, msg, lineno, offset, text) -> None:
5454
# We've seen that lineno and offset can sometimes be None
5555
lineno = lineno or 1
5656
offset = offset or 0
@@ -71,7 +71,7 @@ def syntaxError(self, _filename, msg, lineno, offset, text):
7171
}
7272
)
7373

74-
def flake(self, message):
74+
def flake(self, message) -> None:
7575
"""Get message like <filename>:<lineno>: <msg>"""
7676
err_range = {
7777
"start": {"line": message.lineno - 1, "character": message.col},

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.