Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d00f1dd

Browse filesBrowse files
committed
mypy: debug.py
1 parent 78444f4 commit d00f1dd
Copy full SHA for d00f1dd

File tree

Expand file treeCollapse file tree

2 files changed

+16
-12
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-12
lines changed

‎coverage/debug.py

Copy file name to clipboardExpand all lines: coverage/debug.py
+15-11Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def __init__(self, options: Iterable[str]) -> None:
9696

9797
def get_output(self) -> str:
9898
"""Get the output text from the `DebugControl`."""
99-
return cast(str, self.raw_output.getvalue())
99+
return cast(str, self.raw_output.getvalue()) # type: ignore
100100

101101

102102
class NoDebugging:
@@ -188,9 +188,9 @@ def dump_stack_frames(
188188
skip: int = 0
189189
) -> None:
190190
"""Print a summary of the stack to stdout, or someplace else."""
191-
out = out or sys.stdout
192-
out.write(short_stack(limit=limit, skip=skip+1))
193-
out.write("\n")
191+
fout = out or sys.stdout
192+
fout.write(short_stack(limit=limit, skip=skip+1))
193+
fout.write("\n")
194194

195195

196196
def clipped_repr(text: str, numchars: int = 50) -> str:
@@ -371,17 +371,21 @@ def flush(self) -> None:
371371
self.outfile.flush()
372372

373373

374-
def log(msg: str, stack: bool = False) -> None: # pragma: debugging
374+
def log(msg: str, stack: bool = False) -> None: # pragma: debugging
375375
"""Write a log message as forcefully as possible."""
376376
out = DebugOutputFile.get_one(interim=True)
377377
out.write(msg+"\n")
378378
if stack:
379379
dump_stack_frames(out=out, skip=1)
380380

381381

382-
def decorate_methods(decorator, butnot=(), private=False): # pragma: debugging
382+
def decorate_methods(
383+
decorator: Callable[..., Any],
384+
butnot: Iterable[str] = (),
385+
private: bool = False,
386+
) -> Callable[..., Any]: # pragma: debugging
383387
"""A class decorator to apply a decorator to methods."""
384-
def _decorator(cls):
388+
def _decorator(cls): # type: ignore
385389
for name, meth in inspect.getmembers(cls, inspect.isroutine):
386390
if name not in cls.__dict__:
387391
continue
@@ -395,10 +399,10 @@ def _decorator(cls):
395399
return _decorator
396400

397401

398-
def break_in_pudb(func): # pragma: debugging
402+
def break_in_pudb(func: Callable[..., Any]) -> Callable[..., Any]: # pragma: debugging
399403
"""A function decorator to stop in the debugger for each call."""
400404
@functools.wraps(func)
401-
def _wrapper(*args, **kwargs):
405+
def _wrapper(*args: Any, **kwargs: Any) -> Any:
402406
import pudb
403407
sys.stdout = sys.__stdout__
404408
pudb.set_trace()
@@ -416,9 +420,9 @@ def show_calls(
416420
show_return: bool = False,
417421
) -> Callable[..., Any]: # pragma: debugging
418422
"""A method decorator to debug-log each call to the function."""
419-
def _decorator(func):
423+
def _decorator(func: Callable[..., Any]) -> Callable[..., Any]:
420424
@functools.wraps(func)
421-
def _wrapper(self, *args, **kwargs):
425+
def _wrapper(self: Any, *args: Any, **kwargs: Any) -> Any:
422426
oid = getattr(self, OBJ_ID_ATTR, None)
423427
if oid is None:
424428
oid = f"{os.getpid():08d} {next(OBJ_IDS):04d}"

‎tox.ini

Copy file name to clipboardExpand all lines: tox.ini
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ setenv =
9797
{[testenv]setenv}
9898
C1=coverage/__init__.py coverage/__main__.py coverage/annotate.py coverage/bytecode.py
9999
C2=coverage/cmdline.py coverage/collector.py coverage/config.py coverage/context.py coverage/control.py
100-
C3=coverage/data.py coverage/disposition.py coverage/env.py coverage/exceptions.py
100+
C3=coverage/data.py coverage/debug.py coverage/disposition.py coverage/env.py coverage/exceptions.py
101101
C4=coverage/files.py coverage/inorout.py coverage/jsonreport.py coverage/lcovreport.py coverage/misc.py coverage/multiproc.py coverage/numbits.py
102102
C5=coverage/parser.py coverage/phystokens.py coverage/plugin.py coverage/plugin_support.py coverage/python.py
103103
C6=coverage/report.py coverage/results.py coverage/sqldata.py coverage/summary.py coverage/tomlconfig.py coverage/types.py coverage/version.py coverage/xmlreport.py

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.