Skip to content

Commit

Permalink
Restore Python 3.7 compatibility (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh authored Dec 2, 2022
1 parent dd69c3a commit 9eba524
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 11 deletions.
10 changes: 6 additions & 4 deletions bundled/tool/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import pathlib
import sys
import sysconfig
from typing import Sequence, TypedDict, cast
from typing import Sequence, cast
from typing_extensions import TypedDict


# **********************************************************
Expand Down Expand Up @@ -255,7 +256,8 @@ def code_action(params: CodeActionParams) -> list[CodeAction] | None:
and len(params.context.only) == 1
and CodeActionKind.SourceOrganizeImports in params.context.only
):
if results := _formatting_helper(text_document, select="I001"):
results = _formatting_helper(text_document, select="I001")
if results is not None:
return [
CodeAction(
title="Ruff: Organize Imports",
Expand Down Expand Up @@ -330,7 +332,7 @@ def code_action(params: CodeActionParams) -> list[CodeAction] | None:
):
for diagnostic in params.context.diagnostics:
if diagnostic.source == "Ruff":
if fix := diagnostic.data:
if diagnostic.data is not None:
actions.append(
CodeAction(
title=(
Expand All @@ -341,7 +343,7 @@ def code_action(params: CodeActionParams) -> list[CodeAction] | None:
kind=CodeActionKind.QuickFix,
data=params.text_document.uri,
edit=_create_workspace_edit(
text_document, cast(Fix, fix)
text_document, cast(Fix, diagnostic.data)
),
diagnostics=[diagnostic],
),
Expand Down
5 changes: 1 addition & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ def _setup_template_environment(session: nox.Session) -> None:
"pip-compile", "--generate-hashes", "--upgrade", "./requirements.in"
)
session.run(
"pip-compile",
"--generate-hashes",
"--upgrade",
"./src/test/python_tests/requirements.in",
"pip-compile", "--generate-hashes", "--upgrade", "./requirements-dev.in"
)
_install_bundle(session)

Expand Down
46 changes: 44 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.7
# by the following command:
#
# pip-compile --generate-hashes --resolver=backtracking ./requirements-dev.in
Expand Down Expand Up @@ -39,6 +39,13 @@ exceptiongroup==1.0.4 \
--hash=sha256:542adf9dea4055530d6e1279602fa5cb11dab2395fa650b8674eaec35fc4a828 \
--hash=sha256:bd14967b79cd9bdb54d97323216f8fdf533e278df937aa2a90089e7d6e06e5ec
# via pytest
importlib-metadata==5.1.0 \
--hash=sha256:d5059f9f1e8e41f80e9c56c2ee58811450c31984dfa625329ffd7c0dad88a73b \
--hash=sha256:d84d17e21670ec07990e1044a99efe8d615d860fd176fc29ef5c306068fda313
# via
# click
# pluggy
# pytest
iniconfig==1.1.1 \
--hash=sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3 \
--hash=sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32
Expand Down Expand Up @@ -116,10 +123,41 @@ tomli==2.0.1 \
# black
# mypy
# pytest
typed-ast==1.5.4 \
--hash=sha256:0261195c2062caf107831e92a76764c81227dae162c4f75192c0d489faf751a2 \
--hash=sha256:0fdbcf2fef0ca421a3f5912555804296f0b0960f0418c440f5d6d3abb549f3e1 \
--hash=sha256:183afdf0ec5b1b211724dfef3d2cad2d767cbefac291f24d69b00546c1837fb6 \
--hash=sha256:211260621ab1cd7324e0798d6be953d00b74e0428382991adfddb352252f1d62 \
--hash=sha256:267e3f78697a6c00c689c03db4876dd1efdfea2f251a5ad6555e82a26847b4ac \
--hash=sha256:2efae9db7a8c05ad5547d522e7dbe62c83d838d3906a3716d1478b6c1d61388d \
--hash=sha256:370788a63915e82fd6f212865a596a0fefcbb7d408bbbb13dea723d971ed8bdc \
--hash=sha256:39e21ceb7388e4bb37f4c679d72707ed46c2fbf2a5609b8b8ebc4b067d977df2 \
--hash=sha256:3e123d878ba170397916557d31c8f589951e353cc95fb7f24f6bb69adc1a8a97 \
--hash=sha256:4879da6c9b73443f97e731b617184a596ac1235fe91f98d279a7af36c796da35 \
--hash=sha256:4e964b4ff86550a7a7d56345c7864b18f403f5bd7380edf44a3c1fb4ee7ac6c6 \
--hash=sha256:639c5f0b21776605dd6c9dbe592d5228f021404dafd377e2b7ac046b0349b1a1 \
--hash=sha256:669dd0c4167f6f2cd9f57041e03c3c2ebf9063d0757dc89f79ba1daa2bfca9d4 \
--hash=sha256:6778e1b2f81dfc7bc58e4b259363b83d2e509a65198e85d5700dfae4c6c8ff1c \
--hash=sha256:683407d92dc953c8a7347119596f0b0e6c55eb98ebebd9b23437501b28dcbb8e \
--hash=sha256:79b1e0869db7c830ba6a981d58711c88b6677506e648496b1f64ac7d15633aec \
--hash=sha256:7d5d014b7daa8b0bf2eaef684295acae12b036d79f54178b92a2b6a56f92278f \
--hash=sha256:98f80dee3c03455e92796b58b98ff6ca0b2a6f652120c263efdba4d6c5e58f72 \
--hash=sha256:a94d55d142c9265f4ea46fab70977a1944ecae359ae867397757d836ea5a3f47 \
--hash=sha256:a9916d2bb8865f973824fb47436fa45e1ebf2efd920f2b9f99342cb7fab93f72 \
--hash=sha256:c542eeda69212fa10a7ada75e668876fdec5f856cd3d06829e6aa64ad17c8dfe \
--hash=sha256:cf4afcfac006ece570e32d6fa90ab74a17245b83dfd6655a6f68568098345ff6 \
--hash=sha256:ebd9d7f80ccf7a82ac5f88c521115cc55d84e35bf8b446fcd7836eb6b98929a3 \
--hash=sha256:ed855bbe3eb3715fca349c80174cfcfd699c2f9de574d40527b8429acae23a66
# via
# black
# mypy
typing-extensions==4.4.0 \
--hash=sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa \
--hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e
# via mypy
# via
# black
# importlib-metadata
# mypy
ujson==5.6.0 \
--hash=sha256:0f0f21157d1a84ad5fb54388f31767cde9c1a48fb29de7ef91d8887fdc2ca92b \
--hash=sha256:1217326ba80eab1ff3f644f9eee065bd4fcc4e0c068a2f86f851cafd05737169 \
Expand Down Expand Up @@ -187,3 +225,7 @@ ujson==5.6.0 \
--hash=sha256:fb1632b27e12c0b0df62f924c362206daf246a42c0080e959dd465810dc3482e \
--hash=sha256:fecf83b2ef3cbce4f5cc573df6f6ded565e5e27c1af84038bae5ade306686d82
# via python-jsonrpc-server
zipp==3.11.0 \
--hash=sha256:83a28fcb75844b5c0cdaf5aa4003c2d728c77e05f5aeabe8e95e56727005fbaa \
--hash=sha256:a7a22e05929290a67401440b39690ae6563279bced5f314609d9d03798f56766
# via importlib-metadata
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
pygls>=1.0.0a3
packaging
ruff==0.0.150
typing_extensions
8 changes: 7 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.7
# by the following command:
#
# pip-compile --generate-hashes --resolver=backtracking ./requirements.in
Expand Down Expand Up @@ -56,3 +56,9 @@ typeguard==2.13.3 \
--hash=sha256:00edaa8da3a133674796cf5ea87d9f4b4c367d77476e185e80251cc13dfbb8c4 \
--hash=sha256:5e3e3be01e887e7eafae5af63d1f36c849aaa94e3a0112097312aabfa16284f1
# via pygls
typing-extensions==4.4.0 \
--hash=sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa \
--hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e
# via
# -r ./requirements.in
# cattrs

0 comments on commit 9eba524

Please sign in to comment.