Skip to content

Commit

Permalink
run black
Browse files Browse the repository at this point in the history
  • Loading branch information
RonnyPfannschmidt committed May 23, 2018
1 parent 3e1590b commit 703e4b1
Show file tree
Hide file tree
Showing 133 changed files with 13,851 additions and 9,400 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
rev: 18.4a4
hooks:
- id: black
args: [--safe, --quiet, --check]
args: [--safe, --quiet]
python_version: python3.6
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
Expand Down
4 changes: 2 additions & 2 deletions _pytest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
__all__ = ['__version__']
__all__ = ["__version__"]

try:
from ._version import version as __version__
except ImportError:
# broken installation, we don't even try
# unknown only works because we do poor mans version compare
__version__ = 'unknown'
__version__ = "unknown"
16 changes: 10 additions & 6 deletions _pytest/_argcomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@


class FastFilesCompleter(object):
'Fast file completer class'
"Fast file completer class"

def __init__(self, directories=True):
self.directories = directories
Expand All @@ -74,21 +74,21 @@ def __call__(self, prefix, **kwargs):
prefix_dir = 0
completion = []
globbed = []
if '*' not in prefix and '?' not in prefix:
if "*" not in prefix and "?" not in prefix:
# we are on unix, otherwise no bash
if not prefix or prefix[-1] == os.path.sep:
globbed.extend(glob(prefix + '.*'))
prefix += '*'
globbed.extend(glob(prefix + ".*"))
prefix += "*"
globbed.extend(glob(prefix))
for x in sorted(globbed):
if os.path.isdir(x):
x += '/'
x += "/"
# append stripping the prefix (like bash, not like compgen)
completion.append(x[prefix_dir:])
return completion


if os.environ.get('_ARGCOMPLETE'):
if os.environ.get("_ARGCOMPLETE"):
try:
import argcomplete.completers
except ImportError:
Expand All @@ -97,7 +97,11 @@ def __call__(self, prefix, **kwargs):

def try_argcomplete(parser):
argcomplete.autocomplete(parser, always_complete_options=False)


else:

def try_argcomplete(parser):
pass

filescompleter = None
21 changes: 12 additions & 9 deletions _pytest/_code/_py2traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ def format_exception_only(etype, value):
#
# Clear these out first because issubtype(string1, SyntaxError)
# would throw another exception and mask the original problem.
if (isinstance(etype, BaseException) or
isinstance(etype, types.InstanceType) or
etype is None or type(etype) is str):
if (
isinstance(etype, BaseException)
or isinstance(etype, types.InstanceType)
or etype is None
or type(etype) is str
):
return [_format_final_exc_line(etype, value)]

stype = etype.__name__
Expand All @@ -50,14 +53,14 @@ def format_exception_only(etype, value):
lines.append(' File "%s", line %d\n' % (filename, lineno))
if badline is not None:
if isinstance(badline, bytes): # python 2 only
badline = badline.decode('utf-8', 'replace')
lines.append(u' %s\n' % badline.strip())
badline = badline.decode("utf-8", "replace")
lines.append(u" %s\n" % badline.strip())
if offset is not None:
caretspace = badline.rstrip('\n')[:offset].lstrip()
caretspace = badline.rstrip("\n")[:offset].lstrip()
# non-space whitespace (likes tabs) must be kept for alignment
caretspace = ((c.isspace() and c or ' ') for c in caretspace)
caretspace = ((c.isspace() and c or " ") for c in caretspace)
# only three spaces to account for offset1 == pos 0
lines.append(' %s^\n' % ''.join(caretspace))
lines.append(" %s^\n" % "".join(caretspace))
value = msg

lines.append(_format_final_exc_line(stype, value))
Expand All @@ -82,4 +85,4 @@ def _some_str(value):
return str(value)
except Exception:
pass
return '<unprintable %s object>' % type(value).__name__
return "<unprintable %s object>" % type(value).__name__
Loading

0 comments on commit 703e4b1

Please sign in to comment.