Skip to content

Conversation

@wchargin
Copy link
Owner

Test PR for tensorflow#2967.

wchargin and others added 30 commits November 22, 2019 16:13
Summary:
Black doesn’t have many configuration options. The default line length
is 88, but we’ll use 80 for consistency with Google style. By default,
Black attempts to automatically detect the Python version on a per-file
basis; we explicitly specify that we require Python 2.7 compatibility to
avoid any surprises.

Test Plan:
Running `black --check .` successfully runs Black (with lots of
failures, of course).

wchargin-branch: pyproject-toml
tensorboard-gardener and others added 5 commits November 22, 2019 16:13
Summary:
The Black binary only runs Python 3.6 and up, so we only lint in the
Python 3 CI build, but that’s perfectly fine. I’ve moved that build to
be first so that we can fail fast.

The preceding large sequence of change commits was generated with:

```
#!/bin/sh
set -eu
black .
docformatter -i -r .
black .  # should be a no-op
export GIT_AUTHOR_NAME="TensorBoard Gardener"
export GIT_AUTHOR_EMAIL="tensorboard-gardener@google.com"
# Commit each directory in order of longest-named directory to
# shortest-named, to force a topological ordering. Collapse some select
# subtrees to reduce the number of commits.
git diff --numstat \
    | awk '{ print $3 }' \
    | rev \
    | cut -d / -f 2- \
    | rev \
    | sed -e 's#/\(test\|demo\)$##' \
    | sed -e 's#^\(tensorboard/compat\)/.*#\1#' \
    | sed -e 's#^\(tensorboard/plugins/interactive_inference\)/.*#\1#' \
    | sed -e 's#^\(tensorboard/summary\)/.*#\1#' \
    | sort -u \
    | awk '{ print length($0), $0 }' \
    | sort -nrs \
    | awk '{ print $2 }' \
    | while read -r dir
do
    git add "${dir}"
    if git commit -m "black: reformat directory ${dir}" >/dev/null 2>&1; then
        printf 'reformat %s: ' "${dir}"
        git show --oneline --shortstat | tail -n 1
    else
        printf 'skip %s (covered by subtrees)\n' "${dir}"
    fi
done
```

Test Plan:
Running `black --check .` currently passes, as all files have been fixed
up. It takes about 0.3 seconds on my machine.

wchargin-branch: ci-black
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants