diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml new file mode 100644 index 0000000..cf4eccf --- /dev/null +++ b/.github/workflows/code-quality.yml @@ -0,0 +1,25 @@ +name: "Check code quality" + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + code-quality: + runs-on: ubuntu-latest + name: "Check code quality" + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.x + - name: Install all dependencies + run: pip install .[dev] + - name: Run mypy + run: mypy --pretty . + - name: Run isort + run: isort --check-only --diff . + - name: Run black + run: black --check --diff . \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index e13dfe8..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: "Lint" - -on: - push: - branches: [ "master" ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "master" ] - -jobs: - mypy: - runs-on: ubuntu-latest - steps: - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.11 - architecture: x64 - - name: Checkout - uses: actions/checkout@v1 - - name: Install mypy - run: pip install mypy - - name: Run mypy - uses: sasanquaneuf/mypy-github-action@releases/v1 - with: - checkName: 'mypy' # NOTE: this needs to be the same as the job name - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.isort.cfg b/.isort.cfg new file mode 100644 index 0000000..dc74bfb --- /dev/null +++ b/.isort.cfg @@ -0,0 +1,7 @@ +[settings] +multi_line_output = 3 +include_trailing_comma = True +force_grid_wrap = 0 +use_parentheses = True +ensure_newline_before_comments = True +line_length = 88 diff --git a/format.sh b/format.sh new file mode 100755 index 0000000..b6c2761 --- /dev/null +++ b/format.sh @@ -0,0 +1,3 @@ +set -eux +find src examples -name '*.py' | xargs black +find src examples -name '*.py' | xargs isort diff --git a/lint.sh b/lint.sh index 6532c9b..66ee7cc 100755 --- a/lint.sh +++ b/lint.sh @@ -1,4 +1,2 @@ -find src examples -name '*.py' | xargs black -find src examples -name '*.py' | xargs isort find src examples -name '*.py' | xargs pylint find src examples -name '*.py' | xargs mypy diff --git a/src/edge_tts/communicate.py b/src/edge_tts/communicate.py index 29bbb9a..9128816 100644 --- a/src/edge_tts/communicate.py +++ b/src/edge_tts/communicate.py @@ -12,8 +12,7 @@ from xml.sax.saxutils import escape import aiohttp -from edge_tts.exceptions import (NoAudioReceived, UnexpectedResponse, - UnknownResponse) +from edge_tts.exceptions import NoAudioReceived, UnexpectedResponse, UnknownResponse from .constants import WSS_URL