Skip to content

Fix pre-commit config #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 37 additions & 41 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,43 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: "CHANGELOG.md|.copier-answers.yml|.all-contributorsrc"
default_stages: [pre-commit]

ci:
autofix_commit_msg: "chore(pre-commit.ci): auto fixes"
autoupdate_commit_msg: "chore(pre-commit.ci): pre-commit autoupdate"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: debug-statements
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-toml
- id: check-xml
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
args: ["--tab-width", "2"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.2
hooks:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
args:
- --safe
- --quiet
files: ^((xbox|tests)/.+)?[^/]+\.py$
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
additional_dependencies:
# - flake8-docstrings==1.5.0
- pydocstyle==5.1.1
files: ^(xbox)/.+\.py$
- repo: https://github.com/PyCQA/bandit
rev: 1.6.2
hooks:
- id: bandit
args:
- --quiet
- --format=custom
- --configfile=bandit.yaml
files: ^(xbox|tests)/.+\.py$
- repo: https://github.com/PyCQA/isort
rev: 5.5.3
hooks:
- id: isort
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-executables-have-shebangs
stages: [manual]
- id: check-json
- repo: https://github.com/prettier/prettier
rev: 2.0.4
hooks:
- id: prettier
stages: [manual]

# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.11.2
# hooks:
# - id: mypy
# additional_dependencies: []
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

3 changes: 1 addition & 2 deletions examples/events.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""Example to fetch pullpoint events."""

import asyncio
import datetime as dt
import logging

from pytz import UTC
from zeep import xsd

from onvif import ONVIFCamera

Expand Down
4 changes: 2 additions & 2 deletions examples/rotate_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


async def rotate_image_180():
""" Rotate the image """
"""Rotate the image"""

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

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

# Get all video source configurations
configurations_list = await media_service.GetVideoSourceConfigurations()
Expand Down
1 change: 1 addition & 0 deletions onvif/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Initialize onvif."""

import zeep

from onvif.client import SERVICES, ONVIFCamera, ONVIFService
Expand Down
1 change: 1 addition & 0 deletions onvif/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ONVIF Client."""

from __future__ import annotations

import asyncio
Expand Down
2 changes: 1 addition & 1 deletion onvif/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Core exceptions raised by the ONVIF Client """
"""Core exceptions raised by the ONVIF Client"""

# Error codes setting
# Error unknown, e.g, HTTP errors
Expand Down
7 changes: 4 additions & 3 deletions onvif/managers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ONVIF Managers."""

from __future__ import annotations

from abc import abstractmethod
Expand Down Expand Up @@ -227,9 +228,9 @@ async def _start(self) -> float:
}
)
# pylint: disable=protected-access
device.xaddrs[
"http://www.onvif.org/ver10/events/wsdl/NotificationConsumer"
] = normalize_url(result.SubscriptionReference.Address._value_1)
device.xaddrs["http://www.onvif.org/ver10/events/wsdl/NotificationConsumer"] = (
normalize_url(result.SubscriptionReference.Address._value_1)
)
# Create subscription manager
# 5.2.3 BASIC NOTIFICATION INTERFACE - NOTIFY
# Call SetSynchronizationPoint to generate a notification message
Expand Down
1 change: 1 addition & 0 deletions onvif/transport.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ONVIF transport."""

from __future__ import annotations

import os.path
Expand Down
1 change: 0 additions & 1 deletion onvif/types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""ONVIF types."""


import ciso8601
from zeep.xsd.types.builtins import DateTime, treat_whitespace

Expand Down
1 change: 1 addition & 0 deletions onvif/util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ONVIF util."""

from __future__ import annotations

import contextlib
Expand Down
3 changes: 2 additions & 1 deletion onvif/wrappers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ONVIF Client wrappers."""

from __future__ import annotations

import asyncio
Expand All @@ -21,7 +22,7 @@ def retry_connection_error(
"""Define a wrapper to retry on connection error."""

def _decorator_retry_connection_error(
func: Callable[P, Awaitable[T]]
func: Callable[P, Awaitable[T]],
) -> Callable[P, Awaitable[T]]:
"""Define a wrapper to retry on connection error.

Expand Down
38 changes: 19 additions & 19 deletions onvif/wsdl/accesscontrol.wsdl
Original file line number Diff line number Diff line change
Expand Up @@ -627,27 +627,27 @@ AccessPoint instance shall implement this method.
<wsdl:binding name="PACSBinding" type="tac:PACSPort">
<wsdl:documentation>
Copyright (c) 2010-2013 by ONVIF: Open Network Video Interface Forum. All rights reserved.<br/>
This is the initial minimized version of the Access Control service
This is the initial minimized version of the Access Control service
aimed at the first PACS Profile C. <br/>
The AccessControl service implements the Authentication and
Authorization functionality and controls the actions to get







The AccessControl service implements the Authentication and
Authorization functionality and controls the actions to get
access to various Access Points controlling access to Doors and Areas. <br/>
The basic data structures used by the service are:
* CredentialInfo holding basic information of a credential.<br/>
* AccessPointInfo holding basic information on how access is controlled in
one direction for a door (from which area to which area) defined in the DoorControl service.<br/>


The basic data structures used by the service are:

* CredentialInfo holding basic information of a credential.<br/>
* AccessPointInfo holding basic information on how access is controlled in
one direction for a door (from which area to which area) defined in the DoorControl service.<br/>



</wsdl:documentation>
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
Expand Down
4 changes: 2 additions & 2 deletions onvif/wsdl/actionengine.wsdl
Original file line number Diff line number Diff line change
Expand Up @@ -1117,8 +1117,8 @@ IN NO EVENT WILL THE CORPORATION OR ITS MEMBERS OR THEIR AFFILIATES BE LIABLE FO
</wsdl:message>
<wsdl:portType name="ActionEnginePort">
<wsdl:operation name="GetSupportedActions">
<wsdl:documentation> The service provider returns the supported action types.
<br/>The response returns a list of Action Descriptions according to the Action Description Language.
<wsdl:documentation> The service provider returns the supported action types.
<br/>The response returns a list of Action Descriptions according to the Action Description Language.
<br/>The response also contains a list of URLs that provide the location of the schema files. These schema files describe the types and elements used in the Action Descriptions. If action descriptions reference types or elements of the ONVIF schema file, the ONVIF schema file shall be explicitly listed.</wsdl:documentation>
<wsdl:input message="tae:GetSupportedActionsRequest"/>
<wsdl:output message="tae:GetSupportedActionsResponse"/>
Expand Down
34 changes: 17 additions & 17 deletions onvif/wsdl/addressing
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
<?xml version="1.0"?>
<!--
Copyright © 2002-2004 BEA Systems Inc., International Business Machines Corporation,
Microsoft Corporation, Inc, SAP AG, and Sun Microsystems, Inc.. All rights reserved.
<!--
Copyright © 2002-2004 BEA Systems Inc., International Business Machines Corporation,
Microsoft Corporation, Inc, SAP AG, and Sun Microsystems, Inc.. All rights reserved.

Permission to copy, display, perform, modify and distribute the WS-Addressing Specification,
Permission to copy, display, perform, modify and distribute the WS-Addressing Specification,
and to authorize others to do the foregoing, in any medium without fee or royalty is hereby
granted for the purpose of developing and evaluating the WS-Addressing Specification.

BEA, IBM, Microsoft, SAP AG, and Sun Microsystems (collectively, the "Authors") each agree
to grant a license to third parties, under royalty-free and otherwise reasonable,
BEA, IBM, Microsoft, SAP AG, and Sun Microsystems (collectively, the "Authors") each agree
to grant a license to third parties, under royalty-free and otherwise reasonable,
non-discriminatory terms and conditions, to their respective essential patent claims that
they deem necessary to implement the WS-Addressing Specification.

DISCLAIMERS:

THE WS-Addressing Specification IS PROVIDED "AS IS", AND THE AUTHORS MAKE NO REPRESENTATIONS
OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE
CONTENTS OF THE WS-Addressing Specification IS SUITABLE FOR ANY PURPOSE; NOR THAT THE
IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE
CONTENTS OF THE WS-Addressing Specification IS SUITABLE FOR ANY PURPOSE; NOR THAT THE
IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
TRADEMARKS OR OTHER RIGHTS.

THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
DAMAGES ARISING OUT OF ANY USE OF THE WS-Addressing Specification OR THE PERFORMANCE OR
THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
DAMAGES ARISING OUT OF ANY USE OF THE WS-Addressing Specification OR THE PERFORMANCE OR
IMPLEMENTATION OF THE CONTENTS THEREOF.

You may remove these disclaimers from your modified versions of the WS-Addressing
Specification provided that you effectively disclaim all warranties and liabilities on behalf
You may remove these disclaimers from your modified versions of the WS-Addressing
Specification provided that you effectively disclaim all warranties and liabilities on behalf
of all copyright holders in the copies of any such modified versions you distribute.

The name and trademarks of the Authors may NOT be used in any manner, including advertising
or publicity pertaining to the WS-Addressing Specification or its contents without specific,
written prior permission. Title to copyright in the WS-Addressing Specification will at all
The name and trademarks of the Authors may NOT be used in any manner, including advertising
or publicity pertaining to the WS-Addressing Specification or its contents without specific,
written prior permission. Title to copyright in the WS-Addressing Specification will at all
times remain with the Authors.

No other rights are granted by implication, estoppel or otherwise.
Expand Down
Loading