Skip to content

Commit 02090c2

Browse files
tobiasraabepre-commit-ci[bot]mum
authored
Fix type-checking error for console.render call (#127)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/pre-commit-hooks: v5.0.0 → v6.0.0](pre-commit/pre-commit-hooks@v5.0.0...v6.0.0) - [github.com/astral-sh/ruff-pre-commit: v0.12.4 → v0.14.10](astral-sh/ruff-pre-commit@v0.12.4...v0.14.10) - [github.com/kynan/nbstripout: 0.8.1 → 0.8.2](kynan/nbstripout@0.8.1...0.8.2) - [github.com/executablebooks/mdformat: 0.7.22 → 1.0.0](hukkin/mdformat@0.7.22...1.0.0) - [github.com/executablebooks/mdformat: 0.7.22 → 1.0.0](hukkin/mdformat@0.7.22...1.0.0) * Fix type-checking error for console.render call Add type ignore comment for console.render(traceback) call. The Traceback object is correctly renderable by rich's console, but the type checker doesn't recognize this properly. * Fix remaining type-checking errors - Add type ignore for Path() call with potentially None __file__ - Add type ignore for functools.wraps with CoiledFunction * Move type ignore comment to correct line --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: mum <mum@slack.bot>
1 parent c71613d commit 02090c2

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v5.0.0
3+
rev: v6.0.0
44
hooks:
55
- id: check-added-large-files
66
args: ['--maxkb=25']
@@ -23,16 +23,16 @@ repos:
2323
- id: python-use-type-annotations
2424
- id: text-unicode-replacement-char
2525
- repo: https://github.com/astral-sh/ruff-pre-commit
26-
rev: v0.12.4
26+
rev: v0.14.10
2727
hooks:
2828
- id: ruff
2929
- id: ruff-format
3030
- repo: https://github.com/kynan/nbstripout
31-
rev: 0.8.1
31+
rev: 0.8.2
3232
hooks:
3333
- id: nbstripout
3434
- repo: https://github.com/executablebooks/mdformat
35-
rev: 0.7.22
35+
rev: 1.0.0
3636
hooks:
3737
- id: mdformat
3838
additional_dependencies: [
@@ -43,7 +43,7 @@ repos:
4343
args: [--wrap, "88"]
4444
files: (docs/.)
4545
- repo: https://github.com/executablebooks/mdformat
46-
rev: 0.7.22
46+
rev: 1.0.0
4747
hooks:
4848
- id: mdformat
4949
additional_dependencies: [

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def linkcode_resolve(domain: str, info: dict[str, str]) -> str | None: # noqa:
144144

145145
linespec = f"#L{lineno}-L{lineno + len(source) - 1}" if lineno else ""
146146

147-
fn = os.path.relpath(fn, start=Path(pytask_parallel.__file__).parent)
147+
fn = os.path.relpath(fn, start=Path(pytask_parallel.__file__).parent) # ty: ignore[invalid-argument-type]
148148

149149
if "+" in pytask_parallel.__version__:
150150
return f"https://github.com/pytask-dev/pytask-parallel/blob/main/src/pytask_parallel/{fn}{linespec}"

src/pytask_parallel/wrappers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ def wrap_task_in_process( # noqa: PLR0913
168168

169169

170170
def rewrap_task_with_coiled_function(task: PTask) -> CoiledFunction:
171-
return functools.wraps(wrap_task_in_process)(
172-
CoiledFunction(wrap_task_in_process, **task.attributes["coiled_kwargs"])
171+
return functools.wraps(wrap_task_in_process)( # ty: ignore[invalid-return-type]
172+
CoiledFunction(wrap_task_in_process, **task.attributes["coiled_kwargs"]) # ty: ignore[invalid-argument-type]
173173
)
174174

175175

@@ -203,7 +203,7 @@ def _render_traceback_to_string(
203203
) -> tuple[type[BaseException], BaseException, str]:
204204
"""Process the exception and convert the traceback to a string."""
205205
traceback = Traceback(exc_info, show_locals=show_locals)
206-
segments = console.render(traceback, options=console_options)
206+
segments = console.render(traceback, options=console_options) # ty: ignore[invalid-argument-type]
207207
text = "".join(segment.text for segment in segments)
208208
return (*exc_info[:2], text) # ty: ignore[invalid-return-type]
209209

0 commit comments

Comments
 (0)