Replace pprintpp usage by devtools.debug

This commit is contained in:
miruka 2021-01-16 08:37:21 -04:00
parent 0dadf7de97
commit 626a43b7b0
3 changed files with 6 additions and 12 deletions

View File

@ -1,6 +1,6 @@
remote_pdb >= 2.0.0, < 3
pdbpp >= 0.10.2, < 0.11
pprintpp >= 0.4.0, < 0.5
devtools >= 0.4.0, < 0.5
mypy >= 0.790, < 0.800
flake8 >= 3.8.4, < 4

View File

@ -55,13 +55,8 @@ class Model(MutableMapping):
def __repr__(self) -> str:
"""Provide a full representation of the model and its content."""
try:
from pprintpp import pformat
except ImportError:
from pprint import pformat # type: ignore
return "%s(sync_id=%s, %s)" % (
type(self).__name__, self.sync_id, pformat(self._data),
type(self).__name__, self.sync_id, self._data,
)

View File

@ -134,7 +134,7 @@ class QMLBridge:
def pdb(self, extra_data: Sequence = (), remote: bool = False) -> None:
"""Call the RemotePdb debugger; define some conveniance variables."""
"""Call the python debugger, defining some conveniance variables."""
ad = extra_data # noqa
ba = self.backend # noqa
@ -144,12 +144,11 @@ class QMLBridge:
rc = lambda c: asyncio.run_coroutine_threadsafe(c, self._loop) # noqa
p = print # pdb's `p` doesn't print a class's __str__ # noqa
try:
log.warning("\nThe pprintpp python package is not installed.")
from pprintpp import pprint as pp # noqa
from devtools import debug # noqa
d = debug # noqa
except ModuleNotFoundError:
pass
log.warning("Module python-devtools not found, can't use debug()")
if remote:
# Run `socat readline tcp:127.0.0.1:4444` in a terminal to connect