Skip to content

Commit

Permalink
enhancement #42: add isort and update black, mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien Danieau committed Jun 26, 2024
1 parent c298b30 commit 6a74619
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 22 deletions.
35 changes: 26 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,39 @@ on: [push]
jobs:

black:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
options: "--check --verbose"
version: "23.3.0"
version: "23.10.1"

isort:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
sudo apt install -y libgirepository1.0-dev
python -m pip install --upgrade pip
pip install .[dev]
- name : Check import order
run : isort . -c

flake8:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.10"
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
Expand All @@ -32,12 +49,12 @@ jobs:
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# option --exit-zero can be added to this line to set these errors as warnings
flake8 . --count --max-complexity=10 --max-line-length=128 --statistics
flake8 . --count --statistics --config setup.cfg
mypy:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
Expand Down
15 changes: 7 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@ include_package_data = True
package_dir=
=src
install_requires =
numpy
numpy>=1.24.0,<=1.26.4
pyee==11.0.1
websockets==11.0.3
PyGObject==3.42.2
websockets<12.0.0
PyGObject>=3.42.2, <=3.46.0

[options.packages.find]
where=src

[options.extras_require]
dev = black==23.3.0
flake8==6.0.0
pytest==7.3.1
coverage==7.2.5
mypy==1.0.0
dev = black==23.10.1
flake8==6.1.0
mypy==1.6.1
isort==5.12.0
pygobject-stubs==2.10.0

[options.entry_points]
Expand Down
6 changes: 4 additions & 2 deletions src/example/gstreamer_consumer/gstreamer_consumer.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import argparse
import logging
import os
import time
import logging
from gst_signalling import utils

import gi

from gst_signalling import utils

gi.require_version("Gst", "1.0")
from gi.repository import Gst # noqa: E402

Expand Down
2 changes: 1 addition & 1 deletion src/gst_signalling/gst_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def on_answer_created(
assert promise.wait() == Gst.PromiseResult.REPLIED
reply = promise.get_reply()
# answer = reply["answer"]
answer = reply.get_value("answer") # type: ignore[union-attr]
answer = reply.get_value("answer")
promise = Gst.Promise.new()
webrtc.emit("set-local-description", answer, promise)
promise.interrupt() # we don't care about the result, discard it
Expand Down
2 changes: 1 addition & 1 deletion src/gst_signalling/gst_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def on_offer_created(
self.logger.debug(f"on offer created {promise} {webrtc} {session_id}")
assert promise.wait() == Gst.PromiseResult.REPLIED
reply = promise.get_reply()
offer = reply.get_value("offer") # type: ignore[union-attr]
offer = reply.get_value("offer")

promise = Gst.Promise.new()
self.logger.info("Offer created, setting local description")
Expand Down
2 changes: 1 addition & 1 deletion src/gst_signalling/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import argparse
import asyncio
from typing import Dict
import argparse

from .gst_signalling import GstSignalling

Expand Down

0 comments on commit 6a74619

Please sign in to comment.