From c67f7b6b21aefdd7efaa626b413880cb0eeea6b5 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 4 Aug 2015 10:36:35 +0200 Subject: [PATCH 1/3] Simplify utils.qualname. --- qutebrowser/utils/utils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py index 526a2a5e0..d33c00894 100644 --- a/qutebrowser/utils/utils.py +++ b/qutebrowser/utils/utils.py @@ -555,10 +555,8 @@ def qualname(obj): else: name = repr(obj) - if inspect.isclass(obj) or inspect.isfunction(obj): - module = obj.__module__ - return "{}.{}".format(module, name) - elif inspect.ismethod(obj): + if (inspect.isclass(obj) or inspect.isfunction(obj) or + inspect.ismethod(obj)): return "{}.{}".format(obj.__module__, name) else: return name From 7e7fe9b4ce0c76fcd11d179e34b69536605e101b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 4 Aug 2015 10:39:34 +0200 Subject: [PATCH 2/3] Simplify utils.qualname, take two. --- qutebrowser/utils/utils.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py index d33c00894..373e38cbd 100644 --- a/qutebrowser/utils/utils.py +++ b/qutebrowser/utils/utils.py @@ -22,7 +22,6 @@ import io import sys import enum -import inspect import os.path import collections import functools @@ -548,18 +547,18 @@ def qualname(obj): """ if isinstance(obj, functools.partial): obj = obj.func - if hasattr(obj, '__qualname__'): - name = obj.__qualname__ - elif hasattr(obj, '__name__'): - name = obj.__name__ - else: - name = repr(obj) - if (inspect.isclass(obj) or inspect.isfunction(obj) or - inspect.ismethod(obj)): - return "{}.{}".format(obj.__module__, name) + if hasattr(obj, '__module__'): + prefix = '{}.'.format(obj.__module__) else: - return name + prefix = '' + + if hasattr(obj, '__qualname__'): + return '{}{}'.format(prefix, obj.__qualname__) + elif hasattr(obj, '__name__'): + return '{}{}'.format(prefix, obj.__name__) + else: + return repr(obj) def raises(exc, func, *args): From 8ac48699f2156cb963e8e588737817f016a99caa Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 4 Aug 2015 12:00:23 +0200 Subject: [PATCH 3/3] tox: Update hypothesis/hypothesis-pytest. --- tox.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index a05f0859e..81ff6f724 100644 --- a/tox.ini +++ b/tox.ini @@ -27,8 +27,8 @@ deps = pytest-qt==1.5.1 pytest-mock==0.7.0 pytest-html==1.3.2 - hypothesis==1.10.0 - hypothesis-pytest==0.15.0 + hypothesis==1.10.1 + hypothesis-pytest==0.15.1 commands = {envpython} scripts/link_pyqt.py --tox {envdir} {envpython} -m py.test --strict -rfEsw {posargs:tests} @@ -82,7 +82,7 @@ deps = astroid==1.3.8 beautifulsoup4==4.4.0 pylint==1.4.4 - hypothesis==1.10.0 + hypothesis==1.10.1 logilab-common==1.0.2 six==1.9.0 commands =