Skip to content

Commit

Permalink
Merge pull request #40 from tiagocoutinho/isort
Browse files Browse the repository at this point in the history
Apply isort through ruff
  • Loading branch information
tiagocoutinho committed Apr 19, 2023
2 parents 7a4ba64 + 798e992 commit 8af46bd
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 23 deletions.
3 changes: 2 additions & 1 deletion examples/qt/label.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import cv2
from qtpy import QtWidgets, QtGui, QtCore
from qtpy import QtCore, QtGui, QtWidgets

from v4l2py import Device, VideoCapture


Expand Down
5 changes: 3 additions & 2 deletions examples/qt/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
# run with: QT_API=pyqt6 python widget.py

import cv2
from qtpy import QtWidgets, QtGui, QtCore
from v4l2py import Device, VideoCapture, PixelFormat
from qtpy import QtCore, QtGui, QtWidgets

from v4l2py import Device, PixelFormat, VideoCapture


class QVideo(QtWidgets.QWidget):
Expand Down
1 change: 0 additions & 1 deletion examples/tk.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from v4l2py import Device, VideoCapture


fmt = "%(threadName)-10s %(asctime)-15s %(levelname)-5s %(name)s: %(message)s"
logging.basicConfig(level="INFO", format=fmt)

Expand Down
4 changes: 1 addition & 3 deletions examples/web/async.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@
import logging
from typing import Annotated

from common import BOUNDARY, BaseCamera, frame_to_image
from fastapi import FastAPI, Form, Request
from fastapi.responses import HTMLResponse, StreamingResponse
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates

from v4l2py.device import ControlType, Device, iter_video_capture_devices

from common import BaseCamera, frame_to_image, BOUNDARY


logging.basicConfig(
level="INFO",
format="%(threadName)-10s %(asctime)-15s %(levelname)-5s %(name)s: %(message)s",
Expand Down
1 change: 0 additions & 1 deletion examples/web/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from v4l2py.device import Device, PixelFormat, VideoCapture


BOUNDARY = "frame"
HEADER = (
"--{boundary}\r\nContent-Type: image/{type}\r\nContent-Length: {length}\r\n\r\n"
Expand Down
4 changes: 1 addition & 3 deletions examples/web/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@
import gevent.monkey
import gevent.queue
import gevent.time
from common import BOUNDARY, BaseCamera, frame_to_image

from v4l2py.device import ControlType, Device, iter_video_capture_devices
from v4l2py.io import GeventIO

from common import BaseCamera, frame_to_image, BOUNDARY


gevent.monkey.patch_all()

app = flask.Flask("basic-web-cam")
Expand Down
1 change: 0 additions & 1 deletion examples/web_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

from v4l2py import Device, VideoCapture


PREFIX = b"--frame\r\nContent-Type: image/jpeg\r\n\r\n"
SUFFIX = b"\r\n"
INDEX = """\
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ report = {skip_empty = true}
branch = true

[tool.ruff]
select = ["E", "F", "W", "C", "B", "B9"]
select = ["E", "F", "W", "C", "B", "B9", "I001"]
ignore = ["B904", "B028", "C901", ]
line-length = 120
target-version = "py37"
Expand Down
8 changes: 4 additions & 4 deletions tests/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
from contextlib import ExitStack
from errno import EINVAL
from inspect import isgenerator
from math import isclose
from pathlib import Path
from random import randint
from unittest import mock
from math import isclose

from ward import each, fixture, test, raises
from ward import each, fixture, raises, test

try:
import numpy
Expand All @@ -21,10 +21,10 @@

from v4l2py import raw
from v4l2py.device import (
BufferType,
Device,
VideoCapture,
PixelFormat,
BufferType,
VideoCapture,
device_number,
iter_devices,
iter_video_files,
Expand Down
6 changes: 3 additions & 3 deletions v4l2py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
from .device import (
Device,
Frame,
VideoCapture,
MemoryMap,
PixelFormat,
iter_video_files,
iter_video_capture_files,
VideoCapture,
iter_devices,
iter_video_capture_devices,
iter_video_capture_files,
iter_video_files,
)
from .io import IO, GeventIO

Expand Down
2 changes: 0 additions & 2 deletions v4l2py/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
import os
import pathlib
import typing

from io import IOBase

from . import raw
from .io import IO, fopen


log = logging.getLogger(__name__)
log_ioctl = log.getChild("ioctl")
log_mmap = log.getChild("mmap")
Expand Down
2 changes: 1 addition & 1 deletion v4l2py/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# Copyright (c) 2021 Tiago Coutinho
# Distributed under the GPLv3 license. See LICENSE for more info.

import os
import functools
import os
import select


Expand Down

0 comments on commit 8af46bd

Please sign in to comment.