From e4da58d4abc99b66b6a7675cce9fa6ce9f2198bd Mon Sep 17 00:00:00 2001 From: autopep8 Date: Sat, 16 Oct 2021 20:36:14 +0000 Subject: [PATCH 1/3] Automated autopep8 fixes --- cad_to_h5m/core.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cad_to_h5m/core.py b/cad_to_h5m/core.py index 51152e4..f40584f 100644 --- a/cad_to_h5m/core.py +++ b/cad_to_h5m/core.py @@ -143,10 +143,10 @@ def cad_to_h5m( cubit, verbose, ) - - #resets cubit workspace + + # resets cubit workspace cubit.cmd('reset') - + return h5m_filename From 86ae9894575c38c25863eea08fbcb93cb9c41b2c Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 18 Oct 2021 22:40:24 +0100 Subject: [PATCH 2/3] using f strings for rm commands --- tests/test_python_api.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/test_python_api.py b/tests/test_python_api.py index 75edb74..2b51e17 100644 --- a/tests/test_python_api.py +++ b/tests/test_python_api.py @@ -30,9 +30,8 @@ def test_h5m_file_creation(self): """Checks that a h5m file is created from stp files when make_watertight is set to false""" - os.system("rm test_dagmc.h5m") - test_h5m_filename = "test_dagmc.h5m" + os.system(f"rm {test_h5m_filename}") returned_filename = cad_to_h5m( files_with_tags=[ @@ -59,9 +58,8 @@ def test_h5m_file_creation_in_subfolder(self): """Checks that a h5m file is created from stp files when make_watertight is set to false""" - os.system("rm test_dagmc.h5m") - test_h5m_filename = "subfolder/test_dagmc.h5m" + os.system(f"rm {test_h5m_filename}") returned_filename = cad_to_h5m( files_with_tags=[ @@ -239,9 +237,8 @@ def test_h5m_file_creation_with_scaling(self): """Checks that a h5m file is created from stp files when volumes are scaled """ - os.system("rm test_dagmc.h5m") - test_h5m_filename = "test_dagmc.h5m" + os.system(f"rm {test_h5m_filename}") returned_filename = cad_to_h5m( files_with_tags=[ @@ -261,9 +258,8 @@ def test_implicit_complement_assignment(self): """Checks h5m file creation and that the resulting h5m file contains the material tag assigned to the implicit complement""" - os.system("rm test_dagmc.h5m") - test_h5m_filename = "test_dagmc.h5m" + os.system(f"rm {test_h5m_filename}") implicit_complement_material = "air" From 2e10fc0c92d7970949d136fd0b77b2df7850dcef Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Sun, 31 Oct 2021 06:12:54 +0000 Subject: [PATCH 3/3] replaced autopep8 --- .github/workflows/autopep8.yml | 24 ------------------------ .github/workflows/black.yml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 24 deletions(-) delete mode 100755 .github/workflows/autopep8.yml create mode 100644 .github/workflows/black.yml diff --git a/.github/workflows/autopep8.yml b/.github/workflows/autopep8.yml deleted file mode 100755 index 6641dc6..0000000 --- a/.github/workflows/autopep8.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: autopep8 -on: pull_request -jobs: - autopep8: - # Check if the PR is not from a fork - if: github.event.pull_request.head.repo.full_name == github.repository - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - ref: ${{ github.head_ref }} - - name: autopep8 - id: autopep8 - uses: peter-evans/autopep8@v1 - with: - args: --exclude=make_faceteted_neutronics_model.py --exit-code --recursive --in-place --aggressive --aggressive . - - name: Commit autopep8 changes - if: steps.autopep8.outputs.exit-code == 2 - run: | - git config --global user.name 'autopep8' - git config --global user.email 'autopep8@users.noreply.github.com' - git commit -am "Automated autopep8 fixes" - git push \ No newline at end of file diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml new file mode 100644 index 0000000..4eee07f --- /dev/null +++ b/.github/workflows/black.yml @@ -0,0 +1,32 @@ +name: black + +on: + push: + paths: + - '**.py' + +defaults: + run: + shell: bash + +jobs: + black: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.x + - name: Install black + run: | + python -m pip install --upgrade pip + pip install black + - name: Run black + run: | + black . + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "[skip ci] Apply formatting changes"