Skip to content

Commit

Permalink
Update pre-commit hooks, update dependancies, and improve annotation …
Browse files Browse the repository at this point in the history
…module

Handle case when lambda at end of arguments list over-reads close definition parenthesis
Fix case when annotations contain module names that have spaces in them
Ignore annotation prefixes when they are for the module we are adding annotations to
  • Loading branch information
CoolCat467 committed Jan 1, 2024
1 parent d9b23ee commit 6b1531a
Show file tree
Hide file tree
Showing 6 changed files with 280 additions and 54 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ repos:
types: [file]
types_or: [python, pyi]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.0
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.8
rev: v0.1.9
hooks:
- id: ruff
types: [file]
types_or: [python, pyi, toml]
- repo: https://github.com/CoolCat467/badgie
rev: v0.9.4
rev: v0.9.5
hooks:
- id: badgie
- repo: https://github.com/codespell-project/codespell
Expand Down
25 changes: 24 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ classifiers = [
]
keywords = ["mypy", "dmypy", "idle", "extension", "development", "daemon"]
dependencies = [
"mypy~=1.7.0",
"mypy~=1.8.0",
"trio~=0.23.2",
]

Expand Down Expand Up @@ -147,6 +147,29 @@ branch = true
source = ["src"]
omit = []

[tool.coverage.report]
precision = 1
skip_covered = true
exclude_also = [
"pragma: no cover",
"abc.abstractmethod",
"if TYPE_CHECKING.*:",
"if _t.TYPE_CHECKING:",
"if t.TYPE_CHECKING:",
"@overload",
'class .*\bProtocol\b.*\):',
"raise NotImplementedError",
]
partial_branches = [
"pragma: no branch",
"if not TYPE_CHECKING:",
"if not _t.TYPE_CHECKING:",
"if not t.TYPE_CHECKING:",
"if .* or not TYPE_CHECKING:",
"if .* or not _t.TYPE_CHECKING:",
"if .* or not t.TYPE_CHECKING:",
]

[tool.tox]
legacy_tox_ini = """
[tox]
Expand Down
18 changes: 14 additions & 4 deletions src/idlemypyextension/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
__author__ = "CoolCat467"
__license__ = "GPLv3"
__version__ = "0.2.6"
__ver_major__ = 0
__ver_minor__ = 2
__ver_patch__ = 6

import json
import math
Expand Down Expand Up @@ -903,13 +900,24 @@ async def suggest(self, file: str, line: int) -> None:
)
else:
function = f"{file}:{line}"

command = " ".join(
[
"dmypy",
f'--status-file="{self.status_file}"',
"suggest",
f'"{function}"',
],
)
debug(f"{command = }")

response = await client.suggest(
self.status_file,
function=function,
do_json=True,
timeout=self.action_timeout,
)
# debug(f'suggest {response = }')
debug(f"suggest {response = }")

errors = ""
if response.get("error"):
Expand All @@ -922,6 +930,8 @@ async def suggest(self, file: str, line: int) -> None:
if errors:
errors += "\n\n"
errors += f'stderr:\n{response["stderr"]}'
if "out" not in response and not errors:
errors += "No response from dmypy daemon."

# Display errors
if errors:
Expand Down
Loading

0 comments on commit 6b1531a

Please sign in to comment.