More style changes.
This commit is contained in:
parent
18125c7d1f
commit
84fdba129a
|
@ -23,6 +23,8 @@ isclass = inspect.isclass
|
||||||
callable = py.builtin.callable
|
callable = py.builtin.callable
|
||||||
# used to work around a python2 exception info leak
|
# used to work around a python2 exception info leak
|
||||||
exc_clear = getattr(sys, 'exc_clear', lambda: None)
|
exc_clear = getattr(sys, 'exc_clear', lambda: None)
|
||||||
|
# The type of re.compile objects is not exposed in Python.
|
||||||
|
REGEX_TYPE = type(re.compile(''))
|
||||||
|
|
||||||
def filter_traceback(entry):
|
def filter_traceback(entry):
|
||||||
return entry.path != cutdir1 and not entry.path.relto(cutdir2)
|
return entry.path != cutdir1 and not entry.path.relto(cutdir2)
|
||||||
|
@ -983,16 +985,14 @@ def _idval(val, argname, idx, idfn):
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# Only available in Python 3.4+
|
# Only available in Python 3.4+
|
||||||
enum = None
|
enum = None
|
||||||
# The type of re.compile objects is not exposed in Python.
|
|
||||||
RegexType = type(re.compile(''))
|
|
||||||
|
|
||||||
if isinstance(val, (float, int, str, bool, NoneType)):
|
if isinstance(val, (float, int, str, bool, NoneType)):
|
||||||
return str(val)
|
return str(val)
|
||||||
elif isinstance(val, RegexType):
|
elif isinstance(val, REGEX_TYPE):
|
||||||
return val.pattern
|
return val.pattern
|
||||||
elif enum is not None and isinstance(val, enum.Enum):
|
elif enum is not None and isinstance(val, enum.Enum):
|
||||||
return str(val)
|
return str(val)
|
||||||
elif inspect.isclass(val) and hasattr(val, '__name__'):
|
elif isclass(val) and hasattr(val, '__name__'):
|
||||||
return val.__name__
|
return val.__name__
|
||||||
return str(argname)+str(idx)
|
return str(argname)+str(idx)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue