Skip to content

Commit 73dbab7

Browse files
authored
Create python-app.yml (#16)
* Create python-app.yml * Fix flake8 error "undefined n" * Comment out flake8 checks in workflow There many issues found by flake8. THey are to be fixed in a separate branch. * Add manually requirements to the workflow description. Proper way is to convert current setup.py to pyproject.toml. * Fix pytest working dir in workflow.
1 parent 8cce00c commit 73dbab7

File tree

2 files changed

+45
-3
lines changed

2 files changed

+45
-3
lines changed

.github/workflows/python-app.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python application
5+
6+
on:
7+
push:
8+
branches: [ "master" ]
9+
pull_request:
10+
branches: [ "master" ]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Set up Python 3.10
23+
uses: actions/setup-python@v3
24+
with:
25+
python-version: "3.10"
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install pytest six chardet
30+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31+
# - name: Lint with flake8
32+
# run: |
33+
# # stop the build if there are Python syntax errors or undefined names
34+
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35+
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36+
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37+
- name: Test with pytest
38+
run: |
39+
cd tests
40+
pytest

numjuggler/ri_notation.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Print out a list using "i" identifiers for inserting and repeating, as in MCNP.
33
44
This is for a list of cells, where repititions and multiplication by a constant
5-
are not possible or saldom.
5+
are not possible or seldom.
66
77
"""
88

@@ -59,11 +59,13 @@ def expand(list_):
5959
they are expanded.
6060
"""
6161
es = None
62+
# this value not actually used. Set only to avoid checker warning about undefined n
63+
n = -1
6264
for e in list_:
6365
if es is not None:
6466
e = float(e)
65-
d = (e - es) / (n+1)
66-
for i in range(1, n+2):
67+
d = (e - es) / (n + 1)
68+
for i in range(1, n + 2):
6769
yield es + d*i
6870
es = None
6971
ep = e

0 commit comments

Comments
 (0)