Skip to content

Commit

Permalink
Replace black with ruff formatter (#93)
Browse files Browse the repository at this point in the history
* Replace black with ruff formatter

* Replace black with ruff formatter

* Remove pyugrade
  • Loading branch information
kaypee90 authored May 2, 2024
1 parent 0c7208f commit a91255f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 22 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,17 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install ruff pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run Ruff
run: ruff check --output-format=github .
- name: Test with unittest
run: |
pytest tests
15 changes: 6 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ repos:
hooks:
- id: add-trailing-comma
args: [--py36-plus]
- repo: https://github.com/asottile/pyupgrade
rev: v2.12.0
hooks:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/ambv/black
rev: 22.6.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.2
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
4 changes: 3 additions & 1 deletion examples/client.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# ruff-disable-check
"""
Example file showing how a registered task
can be called and executed on a zebrok worker
"""
import examples
from tasks import long_running_task_one, long_running_task_two
from tasks import long_running_task_one
from tasks import long_running_task_two

long_running_task_one.run(firstname="Kay", lastname="Pee")
long_running_task_two.run(email="[email protected]")
1 change: 1 addition & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend-exclude = ["tests", "examples"]
14 changes: 11 additions & 3 deletions zebrok/connection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import enum
import socket
from typing import Any, Tuple
from typing import Any

import zmq

Expand Down Expand Up @@ -70,7 +70,11 @@ class ZmqBindConnection(BaseSocketConnection):
"""

def __init__(
self, socket_type: Any, host: str, port: str, context: Any = None
self,
socket_type: Any,
host: str,
port: str,
context: Any = None,
) -> None:
"""
Initializes Zmq Bind connection
Expand All @@ -97,7 +101,11 @@ class ZmqConnectTypeConnection(BaseSocketConnection):
"""

def __init__(
self, socket_type: Any, host: str, port: str, context: Any = None
self,
socket_type: Any,
host: str,
port: str,
context: Any = None,
) -> None:
"""
Initializes Zmq Connect Type connection
Expand Down

0 comments on commit a91255f

Please sign in to comment.