Skip to content

Commit 602379d

Browse files
committed
experimenting with ty
1 parent 32e0c89 commit 602379d

5 files changed

Lines changed: 39 additions & 6 deletions

File tree

.vscode/extensions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"ms-python.pylint",
66
"ms-python.debugpy",
77
"charliermarsh.ruff",
8+
"astral-sh.ty",
89
"shd101wyy.markdown-preview-enhanced",
910
"mhutchie.git-graph",
1011
"tamasfe.even-better-toml",

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,6 @@
7373
},
7474
"basedpyright.analysis.inlayHints.genericTypes": true,
7575
"chat.commandCenter.enabled": false,
76-
"dprint.path": ".venv/Scripts/dprint.exe" // https://github.com/dprint/dprint/issues/859#issuecomment-2868290521
76+
"dprint.path": ".venv/Scripts/dprint.exe",
77+
"ty.experimental.completions.enable": true // https://github.com/dprint/dprint/issues/859#issuecomment-2868290521
7778
}

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ dev-dependencies = [
5959
"pdoc>=14.1.0",
6060
"robotcode[analyze]>=0.97.0",
6161
"dprint-py>=0.49.1.2",
62+
"ty>=0.0.0a8",
6263
]
6364

6465
[build-system]
@@ -194,6 +195,9 @@ reportUnusedVariable = false # covered by ruff (has quickfix)
194195
# even though we enable this rule we still keep reportUnannotatedClassAttribute enabled since this is a library
195196
reportIncompatibleUnannotatedOverride = 'error'
196197

198+
[tool.ty.rules]
199+
invalid-type-form = "ignore" # https://github.com/astral-sh/ty/issues/157
200+
197201
[tool.ruff]
198202
unsafe-fixes = true
199203
target-version = "py39"

pytest_robotframework/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ def truncate(arg: object) -> str:
269269
result=(
270270
result.Keyword(
271271
# pyright is only run when robot 7 is installed
272-
kwname=keyword_name, # pyright:ignore[reportCallIssue]
273-
libname=self._module, # pyright:ignore[reportCallIssue]
272+
kwname=keyword_name, # pyright:ignore[reportCallIssue] # ty:ignore[unknown-argument]
273+
libname=self._module, # pyright:ignore[reportCallIssue] # ty:ignore[unknown-argument]
274274
doc=doc,
275275
args=log_args,
276276
tags=self._tags,
@@ -299,7 +299,7 @@ def truncate(arg: object) -> str:
299299
)
300300
)
301301
if context
302-
else nullcontext()
302+
else nullcontext() # ty:ignore[no-matching-overload] https://github.com/astral-sh/ty/issues/258
303303
)
304304
return self.inner(fn, context_manager, *args, **kwargs)
305305

@@ -411,7 +411,7 @@ def __exit__(
411411
f"keyword decorator expected a context manager but instead got {fn_result!r}"
412412
)
413413
# 🚀 independently verified for safety by the overloads
414-
return WrappedContextManager( # pyright:ignore[reportReturnType]
414+
return WrappedContextManager( # pyright:ignore[reportReturnType] # ty:ignore[invalid-return-type]
415415
fn_result, status_reporter
416416
)
417417

@@ -499,7 +499,7 @@ def keyword( # pylint:disable=missing-param-doc
499499
if wrap_context_manager:
500500
return _WrappedContextManagerKeywordDecorator(name=name, tags=tags, module=module)
501501
return _NonWrappedContextManagerKeywordDecorator(name=name, tags=tags, module=module)
502-
return keyword( # pyright:ignore[reportReturnType]
502+
return keyword( # pyright:ignore[reportReturnType] # ty:ignore[no-matching-overload]
503503
name=name, tags=tags, module=module, wrap_context_manager=wrap_context_manager
504504
)(fn) # pyright:ignore[reportArgumentType]
505505

uv.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)