From a0c71526b6ae02218853cd46852888eabef2efb9 Mon Sep 17 00:00:00 2001 From: ArtemIsmagilov Date: Thu, 13 Jun 2024 22:18:12 +0400 Subject: [PATCH] incorrect args `["--application-directories", "src"]`, nothing doing --- .pre-commit-config.yaml | 1 - caldav/davclient.py | 14 +++++++------- caldav/elements/base.py | 5 +++-- caldav/elements/cdav.py | 3 +-- caldav/elements/dav.py | 3 +-- caldav/elements/ical.py | 3 +-- caldav/lib/vcal.py | 1 + caldav/objects.py | 6 +++--- examples/scheduling_examples.py | 5 +++-- tests/test_caldav.py | 32 ++++++++++++++++---------------- tests/test_caldav_unit.py | 3 ++- tests/test_cdav.py | 1 + tests/test_vcal.py | 1 + 13 files changed, 40 insertions(+), 38 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 247a0594..0154e83a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,6 @@ repos: rev: v3.12.0 hooks: - id: reorder-python-imports - args: ["--application-directories", "src"] - repo: https://github.com/psf/black rev: 23.12.0 hooks: diff --git a/caldav/davclient.py b/caldav/davclient.py index ce9183a0..8f816669 100644 --- a/caldav/davclient.py +++ b/caldav/davclient.py @@ -13,6 +13,13 @@ from urllib.parse import unquote import requests +from lxml import etree +from lxml.etree import _Element +from requests.auth import AuthBase +from requests.models import Response +from requests.structures import CaseInsensitiveDict + +from .elements.base import BaseElement from caldav.elements import dav from caldav.lib import error from caldav.lib.python_utilities import to_normal_str @@ -22,13 +29,6 @@ from caldav.objects import log from caldav.objects import Principal from caldav.requests import HTTPBearerAuth -from lxml import etree -from lxml.etree import _Element -from requests.auth import AuthBase -from requests.models import Response -from requests.structures import CaseInsensitiveDict - -from .elements.base import BaseElement if TYPE_CHECKING: pass diff --git a/caldav/elements/base.py b/caldav/elements/base.py index 1667a60e..c2e63a96 100644 --- a/caldav/elements/base.py +++ b/caldav/elements/base.py @@ -5,11 +5,12 @@ from typing import Optional from typing import Union -from caldav.lib.namespace import nsmap -from caldav.lib.python_utilities import to_unicode from lxml import etree from lxml.etree import _Element +from caldav.lib.namespace import nsmap +from caldav.lib.python_utilities import to_unicode + if sys.version_info < (3, 9): from typing import Iterable else: diff --git a/caldav/elements/cdav.py b/caldav/elements/cdav.py index 01c100dd..6df49263 100644 --- a/caldav/elements/cdav.py +++ b/caldav/elements/cdav.py @@ -5,11 +5,10 @@ from typing import ClassVar from typing import Optional -from caldav.lib.namespace import ns - from .base import BaseElement from .base import NamedBaseElement from .base import ValuedBaseElement +from caldav.lib.namespace import ns utc_tz = timezone.utc diff --git a/caldav/elements/dav.py b/caldav/elements/dav.py index fb7d4369..feb092c4 100644 --- a/caldav/elements/dav.py +++ b/caldav/elements/dav.py @@ -1,10 +1,9 @@ #!/usr/bin/env python from typing import ClassVar -from caldav.lib.namespace import ns - from .base import BaseElement from .base import ValuedBaseElement +from caldav.lib.namespace import ns # Operations diff --git a/caldav/elements/ical.py b/caldav/elements/ical.py index 1578eafc..ffae7e14 100644 --- a/caldav/elements/ical.py +++ b/caldav/elements/ical.py @@ -1,9 +1,8 @@ #!/usr/bin/env python from typing import ClassVar -from caldav.lib.namespace import ns - from .base import ValuedBaseElement +from caldav.lib.namespace import ns # Properties diff --git a/caldav/lib/vcal.py b/caldav/lib/vcal.py index 868bcdd3..e196f4c2 100644 --- a/caldav/lib/vcal.py +++ b/caldav/lib/vcal.py @@ -5,6 +5,7 @@ import uuid import icalendar + from caldav.lib.python_utilities import to_normal_str ## Global counter. We don't want to be too verbose on the users, ref https://github.com/home-assistant/core/issues/86938 diff --git a/caldav/objects.py b/caldav/objects.py index ce09c4b3..40ab0407 100644 --- a/caldav/objects.py +++ b/caldav/objects.py @@ -30,9 +30,6 @@ class hierarchy into a separate file) import icalendar import vobject -from caldav.lib.python_utilities import to_normal_str -from caldav.lib.python_utilities import to_unicode -from caldav.lib.python_utilities import to_wire from dateutil.rrule import rrulestr from lxml import etree from lxml.etree import _Element @@ -41,6 +38,9 @@ class hierarchy into a separate file) from .elements.base import BaseElement from .elements.cdav import CalendarData from .elements.cdav import CompFilter +from caldav.lib.python_utilities import to_normal_str +from caldav.lib.python_utilities import to_unicode +from caldav.lib.python_utilities import to_wire try: from typing import ClassVar, Optional, Union diff --git a/examples/scheduling_examples.py b/examples/scheduling_examples.py index 09ca27dd..4b591ad5 100644 --- a/examples/scheduling_examples.py +++ b/examples/scheduling_examples.py @@ -4,11 +4,12 @@ from datetime import timedelta from datetime import timezone -from caldav import DAVClient -from caldav import error from icalendar import Calendar from icalendar import Event +from caldav import DAVClient +from caldav import error + ############### ### SETUP START diff --git a/tests/test_caldav.py b/tests/test_caldav.py index d77d7613..2c003df4 100644 --- a/tests/test_caldav.py +++ b/tests/test_caldav.py @@ -24,6 +24,22 @@ import pytest import requests import vobject +from requests.packages import urllib3 + +from . import compatibility_issues +from .conf import caldav_servers +from .conf import client +from .conf import proxy +from .conf import proxy_noport +from .conf import radicale_host +from .conf import radicale_port +from .conf import rfc6638_users +from .conf import test_radicale +from .conf import test_xandikos +from .conf import xandikos_host +from .conf import xandikos_port +from .proxy import NonThreadingHTTPServer +from .proxy import ProxyHandler from caldav.davclient import DAVClient from caldav.davclient import DAVResponse from caldav.elements import cdav @@ -41,22 +57,6 @@ from caldav.objects import FreeBusy from caldav.objects import Principal from caldav.objects import Todo -from requests.packages import urllib3 - -from . import compatibility_issues -from .conf import caldav_servers -from .conf import client -from .conf import proxy -from .conf import proxy_noport -from .conf import radicale_host -from .conf import radicale_port -from .conf import rfc6638_users -from .conf import test_radicale -from .conf import test_xandikos -from .conf import xandikos_host -from .conf import xandikos_port -from .proxy import NonThreadingHTTPServer -from .proxy import ProxyHandler if test_xandikos: from xandikos.web import XandikosBackend, XandikosApp diff --git a/tests/test_caldav_unit.py b/tests/test_caldav_unit.py index 93212945..7e1cbffb 100644 --- a/tests/test_caldav_unit.py +++ b/tests/test_caldav_unit.py @@ -13,11 +13,12 @@ from unittest import mock from urllib.parse import urlparse -import caldav import icalendar import lxml.etree import pytest import vobject + +import caldav from caldav import Calendar from caldav import CalendarObjectResource from caldav import CalendarSet diff --git a/tests/test_cdav.py b/tests/test_cdav.py index a6b3ee88..e9ba39ab 100644 --- a/tests/test_cdav.py +++ b/tests/test_cdav.py @@ -1,6 +1,7 @@ import datetime import tzlocal + from caldav.elements.cdav import _to_utc_date_string from caldav.elements.cdav import CalendarQuery diff --git a/tests/test_vcal.py b/tests/test_vcal.py index 3496c6c9..597d1eb7 100644 --- a/tests/test_vcal.py +++ b/tests/test_vcal.py @@ -9,6 +9,7 @@ import icalendar import pytest import vobject + from caldav.lib import vcal from caldav.lib.python_utilities import to_normal_str from caldav.lib.python_utilities import to_wire