Skip to content

Commit

Permalink
linters in action...
Browse files Browse the repository at this point in the history
  • Loading branch information
abingham committed Sep 11, 2024
1 parent 658eb03 commit aa3cb9e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
- name: Install dependencies
run: uv sync -i https://pypi.org/simple # Ignore download URLs in uv.lock.
- name: Check syntax
run: uv run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
run: uv run flake8 src/cosmic_ray --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Check style
run: uv run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
run: uv run flake8 src/cosmic_ray --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: uv run pytest tests --run-slow

Expand Down
1 change: 1 addition & 0 deletions src/cosmic_ray/ast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def get_ast_from_path(module_path: Path):
source = read_python_source(module_path)
return get_ast(source)


def get_ast(source: str):
"""Parse the AST for a code string.
Expand Down
4 changes: 2 additions & 2 deletions src/cosmic_ray/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def read_python_source(module_filepath):
"""Load the code in a Python source file.
Use this whenever reading source code from a Python source file!
Use this whenever reading source code from a Python source file!
This takes care of handling the encoding of the file.
Args:
Expand All @@ -33,4 +33,4 @@ def restore_contents(filepath: Path):
try:
yield contents
finally:
filepath.write_bytes(contents)
filepath.write_bytes(contents)
3 changes: 2 additions & 1 deletion src/cosmic_ray/work_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ def pending_work_items(self):
"Iterable of all pending work items. In random order."
with self._session_maker.begin() as session:
completed_job_ids = session.query(WorkResultStorage.job_id)
pending = session.query(WorkItemStorage).where(~WorkItemStorage.job_id.in_(completed_job_ids)).order_by(func.random())
pending = session.query(WorkItemStorage).where(
~WorkItemStorage.job_id.in_(completed_job_ids)).order_by(func.random())
return tuple(_work_item_from_storage(work_item) for work_item in pending)

@property
Expand Down

0 comments on commit aa3cb9e

Please sign in to comment.