Skip to content

Commit

Permalink
Update pre-commit to ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
blackary committed Nov 3, 2023
1 parent 09be6a7 commit 87fb57d
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 40 deletions.
23 changes: 8 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
repos:
- repo: https://github.com/PyCQA/flake8
rev: "6.1.0"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- repo: https://github.com/psf/black
rev: "23.10.1"
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: "5.12.0"
hooks:
- id: isort
- id: ruff
args:
- --fix
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.6.1"
rev: v1.6.1
hooks:
- id: mypy
args:
Expand All @@ -25,4 +18,4 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 # Use the ref you want to point at
hooks:
- id: trailing-whitespace
- id: trailing-whitespace
1 change: 0 additions & 1 deletion example_app/streamlit_app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import cv2
import numpy as np
import streamlit as st

from camera_input_live import camera_input_live

"# Streamlit camera input live Demo"
Expand Down
61 changes: 40 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,43 @@
[tool.isort]
profile = "black"
line_length = 88
skip = ["./.venv", "./direnv", ".env"]

[tool.black]
exclude = '''
(
/(
\.vscode
| \.git
| \.pytest_cache
| \.mypy_cache
| \.venv
| \.env
| \.direnv
)/
)
'''
include = '\.pyi?$'
[tool.ruff]
exclude = [
".git",
".vscode",
".pytest_cache",
".bamboo",
".tecton",
".mypy_cache",
".env",
]
ignore = [
"B008",
"ISC001",
"E501",
"W191"
]
line-length = 88
select = [
"B", # https://pypi.org/project/flake8-bugbear/
"E", # https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
"F", # https://flake8.pycqa.org/en/latest/user/error-codes.html
"W", # https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
"I", # https://pycqa.github.io/isort/
"N", # https://github.com/PyCQA/pep8-naming
"C4", # https://github.com/adamchainz/flake8-comprehensions
"EXE", # https://pypi.org/project/flake8-executable/
"ISC", # https://github.com/flake8-implicit-str-concat/flake8-implicit-str-concat
"ICN", # https://pypi.org/project/flake8-import-conventions/
"PIE", # https://pypi.org/project/flake8-pie/
"PT", # https://github.com/m-burst/flake8-pytest-style
"RET", # https://pypi.org/project/flake8-return/
"SIM", # https://pypi.org/project/flake8-simplify/
"ERA", # https://pypi.org/project/flake8-eradicate/
"PLC", # https://beta.ruff.rs/docs/rules/#convention-plc
"RUF", # https://beta.ruff.rs/docs/rules/#ruff-specific-rules-ruf
"ARG", # https://beta.ruff.rs/docs/rules/#flake8-unused-arguments-arg
]

[tool.ruff.per-file-ignores]
"__init__.py" = ["F401"]

[tool.mypy]
files = [
Expand All @@ -27,4 +46,4 @@ files = [
follow_imports = "silent"
ignore_missing_imports = true
scripts_are_modules = true
python_version = 3.9
python_version = 3.9
4 changes: 1 addition & 3 deletions src/camera_input_live/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ def camera_input_live(

raw_data = b64_data.split(",")[1] # Strip the data: type prefix

component_value = BytesIO(base64.b64decode(raw_data))

return component_value
return BytesIO(base64.b64decode(raw_data))


def main():
Expand Down

0 comments on commit 87fb57d

Please sign in to comment.