Skip to content

Commit

Permalink
Merge pull request #26 from cclauss/patch-1
Browse files Browse the repository at this point in the history
Travis CI: Lint Python code for syntax errors and warnings
  • Loading branch information
connorferster committed Sep 2, 2020
2 parents 396aaaa + 97e9f4f commit 8d5253a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
21 changes: 9 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
os: linux
dist: focal
language: python
python:
- 3.7
script: pytest --cov-report term --cov
- 3.7
before_install:
- "pip install -U pip"
- "python setup.py install"
- "pip install pytest-cov"
- "pip install coverage[toml]"
- "pip install coveralls"
- "pip install nbconvert"
- "pip install IPython"

after_success:
- "coveralls"
- pip install --upgrade pip
- python setup.py install
- pip install coverage[toml] coveralls flake8 IPython nbconvert pytest-cov
before_script: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
script: pytest --cov-report term --cov
after_success: coveralls
10 changes: 5 additions & 5 deletions handcalcs/handcalcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1574,15 +1574,15 @@ def swap_frac_divs(code: deque) -> deque:
close_bracket_token = False
for index, item in enumerate(code):
next_idx = min(index + 1, length - 1)
if code[next_idx] is "/" and isinstance(item, deque):
if code[next_idx] == "/" and isinstance(item, deque):
new_item = f"{ops}{a}"
swapped_deque.append(new_item)
swapped_deque.append(swap_frac_divs(item)) # recursion!
elif code[next_idx] is "/" and not isinstance(item, deque):
elif code[next_idx] == "/" and not isinstance(item, deque):
new_item = f"{ops}{a}"
swapped_deque.append(new_item)
swapped_deque.append(item)
elif item is "/":
elif item == "/":
swapped_deque.append(f"{b}{a}")
close_bracket_token = True
elif close_bracket_token:
Expand Down Expand Up @@ -1670,9 +1670,9 @@ def swap_py_operators(pycode_as_deque: deque) -> deque:
new_item = swap_py_operators(item) # recursion!
swapped_deque.append(new_item)
else:
if item is "*":
if item == "*":
swapped_deque.append("\\cdot")
elif item is "%":
elif item == "%":
swapped_deque.append("\\bmod")
else:
swapped_deque.append(item)
Expand Down
2 changes: 1 addition & 1 deletion handcalcs/install_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import shutil
import nbconvert

__all__ = ["install_latex_template", "install_html_template"]
__all__ = ["install_latex", "install_html"]

def install_latex(swap_in: str = "", swap_out: str = "article.tplx", restore: bool = False) -> None:
"""
Expand Down

0 comments on commit 8d5253a

Please sign in to comment.