Skip to content

Commit 3114dee

Browse files
committed
Check for black-formatted file. Black files.
We use 21.6b0
1 parent d76f35d commit 3114dee

4 files changed

Lines changed: 33 additions & 3 deletions

File tree

.github/workflows/autoblack.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# GitHub Action that uses Black to reformat the Python code in an incoming pull request.
2+
# If all Python code in the pull request is compliant with Black then this Action does nothing.
3+
# Othewrwise, Black is run and its changes are committed back to the incoming pull request.
4+
# https://github.com/cclauss/autoblack
5+
6+
name: autoblack
7+
on: [pull_request]
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: Set up Python 3.9
14+
uses: actions/setup-python@v1
15+
with:
16+
python-version: 3.9
17+
- name: Install Black
18+
run: pip install 'black==21.6b0'
19+
- name: Run black --check .
20+
run: black --check .
21+
- name: If needed, commit black changes to the pull request
22+
if: failure()
23+
run: |
24+
black .
25+
git config --global user.name 'autoblack'
26+
git config --global user.email 'rocky@users.noreply.github.com'
27+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
28+
git checkout $GITHUB_HEAD_REF
29+
git commit -am "fixup: Format Python code with Black"
30+
git push

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repos:
55
- id: debug-statements
66
- id: end-of-file-fixer
77
- repo: https://github.com/psf/black
8-
rev: 20.8b1
8+
rev: 21.6b0
99
hooks:
1010
- id: black
1111
language_version: python3

mathics/builtin/datentime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def parse_date_automatic(self, epochtime, etime, evaluation):
312312
return date
313313

314314
def to_datelist(self, epochtime, evaluation):
315-
""" Converts date-time 'epochtime' to datelist """
315+
"""Converts date-time 'epochtime' to datelist"""
316316
etime = epochtime.to_python()
317317

318318
form_name = self.get_name()

mathics/builtin/lists.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def join_lists(lists):
452452

453453

454454
def get_part(varlist, indices):
455-
" Simple part extraction. indices must be a list of python integers. "
455+
"Simple part extraction. indices must be a list of python integers."
456456

457457
def rec(cur, rest):
458458
if rest:

0 commit comments

Comments
 (0)