Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions .github/workflows/isort-and-black-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python 3.14
uses: actions/setup-python@v6
- uses: actions/checkout@v7
- name: Set up Python 3.15
uses: actions/setup-python@v7
with:
python-version: 3.14
python-version: 3.15
- name: Install click, black, and isort
run: pip install 'click==8.2.1' 'black==25.11.0'
run: pip install 'click==8.2.1' 'black==25.11.0' 'isort==8.0.1'
- name: Run black --check .
run: black --check --diff .
- name: If needed, commit black changes to the pull request
if: failure()
run: |
black .
git config --global user.name 'autoblack'
git config --global user.email 'rocky@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git checkout $GITHUB_HEAD_REF
git commit -am "fixup: Format Python code with Black"
git push
- name: Run isort --check .
run: isort --check .
# - name: If needed, commit black changes to the pull request
# if: failure()
# run: |
# black .
# git config --global user.name 'autoblack'
# git config --global user.email 'rocky@users.noreply.github.com'
# git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
# git checkout $GITHUB_HEAD_REF
# git commit -am "fixup: Format Python code with Black"
# git push
6 changes: 3 additions & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
strategy:
matrix:
os: [macOS]
python-version: ['3.14', '3.12', '3.13']
python-version: ['3.15', '3.14', '3.13', '3.12']
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/mathics3-doctest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.14']
python-version: ['3.15']
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install OS dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11', '3.12', '3.13', '3.14']
python-version: ['3.11', '3.12', '3.13', '3.14', '3.15']
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install Mathics3 scanner without JSON files
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
strategy:
matrix:
os: [windows]
python-version: ['3.11', '3.14']
python-version: ['3.12', '3.14', '3.15']
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
10 changes: 10 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[settings]
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
line_length = 88
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
default_section = THIRDPARTY
combine_as_imports = 1
profile = black
13 changes: 7 additions & 6 deletions mathics_scanner/generate/rl_inputrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
"""
import sys

from mathics_scanner.characters import ALIASED_CHARACTERS
from mathics_scanner.characters import replace_wl_with_plain_text as r
from mathics_scanner.characters import (
ALIASED_CHARACTERS,
replace_wl_with_plain_text as r,
)


def _escape(s: str) -> str:
Expand Down Expand Up @@ -38,11 +40,11 @@ def generate_inputrc(fd=sys.stdout, use_unicode=True) -> None:
try:
fd.write(_format(alias, use_unicode))
except UnicodeEncodeError:
sys.stderr.write("Error trying to convert alias %s; skipping\n" % alias)
sys.stderr.write(f"Error trying to convert alias {alias}; skipping\n")


def usage():
sys.stderr.write("usage: %s {inputrc-unicode | inputrc-no-unicode}\n" % sys.argv[0])
sys.stderr.write(f"usage: {sys.argv[0]} {{inputrc-unicode | inputrc-no-unicode}}\n")
sys.exit(1)


Expand All @@ -54,8 +56,7 @@ def usage():
default_encoding = sys.getdefaultencoding()
if default_encoding != "utf-8":
sys.stderr.write(
"sys.defaultencoding() is %s so we can't generate unicode output\n"
% (default_encoding)
f"sys.defaultencoding() is {default_encoding} so we can't generate unicode output\n"
)
sys.exit(2)
generate_inputrc(use_unicode=True)
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ classifiers = [
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Scientific/Engineering",
Expand Down
10 changes: 5 additions & 5 deletions test/test_character_table_consistency.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-

from test.helper import json_data, yaml_data

from mathics_scanner.characters import replace_unicode_with_wl as unicode_to_wl
from mathics_scanner.characters import replace_wl_with_plain_text as wl_to_unicode
from mathics_scanner.characters import (
replace_unicode_with_wl as unicode_to_wl,
replace_wl_with_plain_text as wl_to_unicode,
)


def test_ascii_fields_in_json():
Expand All @@ -20,7 +20,7 @@ def test_ascii_fields_in_json():
"operator-to-ascii",
"operator-to-unicode",
):
for name in json_data[ascii_key_dict].keys():
for name in json_data[ascii_key_dict]:
assert (
name.isascii()
), f"Key name of table {ascii_key_dict} should be ASCII; is: {name}"
Expand Down
Loading