Skip to content

Commit ee1bace

Browse files
authored
Fix pre-commit config (#55)
* Fix pre-commit config The pre-commit config was inherited from xbox and needed to be brought up to date * comment out mypy since it currently fails
1 parent 040cdef commit ee1bace

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+569
-582
lines changed

.pre-commit-config.yaml

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,43 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
exclude: "CHANGELOG.md|.copier-answers.yml|.all-contributorsrc"
4+
default_stages: [pre-commit]
5+
6+
ci:
7+
autofix_commit_msg: "chore(pre-commit.ci): auto fixes"
8+
autoupdate_commit_msg: "chore(pre-commit.ci): pre-commit autoupdate"
9+
110
repos:
11+
- repo: https://github.com/pre-commit/pre-commit-hooks
12+
rev: v5.0.0
13+
hooks:
14+
- id: debug-statements
15+
- id: check-builtin-literals
16+
- id: check-case-conflict
17+
- id: check-docstring-first
18+
- id: check-toml
19+
- id: check-xml
20+
- id: detect-private-key
21+
- id: end-of-file-fixer
22+
- id: trailing-whitespace
23+
- repo: https://github.com/pre-commit/mirrors-prettier
24+
rev: v4.0.0-alpha.8
25+
hooks:
26+
- id: prettier
27+
args: ["--tab-width", "2"]
28+
- repo: https://github.com/astral-sh/ruff-pre-commit
29+
rev: v0.8.0
30+
hooks:
31+
- id: ruff
32+
args: [--fix, --exit-non-zero-on-fix]
33+
- id: ruff-format
234
- repo: https://github.com/asottile/pyupgrade
335
rev: v2.7.2
436
hooks:
537
- id: pyupgrade
638
args: [--py36-plus]
7-
- repo: https://github.com/psf/black
8-
rev: 20.8b1
9-
hooks:
10-
- id: black
11-
args:
12-
- --safe
13-
- --quiet
14-
files: ^((xbox|tests)/.+)?[^/]+\.py$
15-
- repo: https://gitlab.com/pycqa/flake8
16-
rev: 3.8.3
17-
hooks:
18-
- id: flake8
19-
additional_dependencies:
20-
# - flake8-docstrings==1.5.0
21-
- pydocstyle==5.1.1
22-
files: ^(xbox)/.+\.py$
23-
- repo: https://github.com/PyCQA/bandit
24-
rev: 1.6.2
25-
hooks:
26-
- id: bandit
27-
args:
28-
- --quiet
29-
- --format=custom
30-
- --configfile=bandit.yaml
31-
files: ^(xbox|tests)/.+\.py$
32-
- repo: https://github.com/PyCQA/isort
33-
rev: 5.5.3
34-
hooks:
35-
- id: isort
36-
- repo: https://github.com/pre-commit/pre-commit-hooks
37-
rev: v3.2.0
38-
hooks:
39-
- id: check-executables-have-shebangs
40-
stages: [manual]
41-
- id: check-json
42-
- repo: https://github.com/prettier/prettier
43-
rev: 2.0.4
44-
hooks:
45-
- id: prettier
46-
stages: [manual]
47-
39+
# - repo: https://github.com/pre-commit/mirrors-mypy
40+
# rev: v1.11.2
41+
# hooks:
42+
# - id: mypy
43+
# additional_dependencies: []

LICENSE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22-

examples/events.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
"""Example to fetch pullpoint events."""
2+
23
import asyncio
34
import datetime as dt
45
import logging
56

6-
from pytz import UTC
7-
from zeep import xsd
87

98
from onvif import ONVIFCamera
109

examples/rotate_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
async def rotate_image_180():
7-
""" Rotate the image """
7+
"""Rotate the image"""
88

99
# Create the media service
1010
mycam = ONVIFCamera("192.168.0.112", 80, "admin", "12345")
@@ -14,7 +14,7 @@ async def rotate_image_180():
1414
profiles = await media_service.GetProfiles()
1515

1616
# Use the first profile and Profiles have at least one
17-
token = profiles[0].token
17+
token = profiles[0].token # noqa: F841
1818

1919
# Get all video source configurations
2020
configurations_list = await media_service.GetVideoSourceConfigurations()

onvif/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Initialize onvif."""
2+
23
import zeep
34

45
from onvif.client import SERVICES, ONVIFCamera, ONVIFService

onvif/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""ONVIF Client."""
2+
23
from __future__ import annotations
34

45
import asyncio

onvif/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Core exceptions raised by the ONVIF Client """
1+
"""Core exceptions raised by the ONVIF Client"""
22

33
# Error codes setting
44
# Error unknown, e.g, HTTP errors

onvif/managers.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""ONVIF Managers."""
2+
23
from __future__ import annotations
34

45
from abc import abstractmethod
@@ -227,9 +228,9 @@ async def _start(self) -> float:
227228
}
228229
)
229230
# pylint: disable=protected-access
230-
device.xaddrs[
231-
"http://www.onvif.org/ver10/events/wsdl/NotificationConsumer"
232-
] = normalize_url(result.SubscriptionReference.Address._value_1)
231+
device.xaddrs["http://www.onvif.org/ver10/events/wsdl/NotificationConsumer"] = (
232+
normalize_url(result.SubscriptionReference.Address._value_1)
233+
)
233234
# Create subscription manager
234235
# 5.2.3 BASIC NOTIFICATION INTERFACE - NOTIFY
235236
# Call SetSynchronizationPoint to generate a notification message

onvif/transport.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""ONVIF transport."""
2+
23
from __future__ import annotations
34

45
import os.path

onvif/types.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""ONVIF types."""
22

3-
43
import ciso8601
54
from zeep.xsd.types.builtins import DateTime, treat_whitespace
65

0 commit comments

Comments
 (0)