chore: fix isort pre-commit

Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>
This commit is contained in:
Yurii Serhiichuk 2025-05-31 15:55:19 +02:00
parent 8b9fd969be
commit 98a7a81ca8
34 changed files with 37 additions and 61 deletions

View File

@ -16,12 +16,13 @@ import enum
import json import json
import typing import typing
from cloudevents import exceptions as cloud_exceptions
from cloudevents.abstract import AnyCloudEvent from cloudevents.abstract import AnyCloudEvent
from cloudevents.sdk import converters, marshaller, types from cloudevents.sdk import converters, marshaller, types
from cloudevents.sdk.converters import is_binary from cloudevents.sdk.converters import is_binary
from cloudevents.sdk.event import v1, v03 from cloudevents.sdk.event import v1, v03
from cloudevents import exceptions as cloud_exceptions
def _best_effort_serialize_to_json( # type: ignore[no-untyped-def] def _best_effort_serialize_to_json( # type: ignore[no-untyped-def]
value: typing.Any, *args, **kwargs value: typing.Any, *args, **kwargs

View File

@ -17,9 +17,10 @@ import typing
import uuid import uuid
import cloudevents.exceptions as cloud_exceptions import cloudevents.exceptions as cloud_exceptions
from cloudevents import abstract
from cloudevents.sdk.event import v1, v03 from cloudevents.sdk.event import v1, v03
from cloudevents import abstract
_required_by_version = { _required_by_version = {
"1.0": v1.Event._ce_required_fields, "1.0": v1.Event._ce_required_fields,
"0.3": v03.Event._ce_required_fields, "0.3": v03.Event._ce_required_fields,

View File

@ -13,10 +13,9 @@
# under the License. # under the License.
import typing import typing
from deprecation import deprecated
from cloudevents.sdk.converters import is_binary as _moved_is_binary from cloudevents.sdk.converters import is_binary as _moved_is_binary
from cloudevents.sdk.converters import is_structured as _moved_is_structured from cloudevents.sdk.converters import is_structured as _moved_is_structured
from deprecation import deprecated
# THIS MODULE IS DEPRECATED, YOU SHOULD NOT ADD NEW FUNCTIONALLY HERE # THIS MODULE IS DEPRECATED, YOU SHOULD NOT ADD NEW FUNCTIONALLY HERE

View File

@ -14,14 +14,13 @@
import typing import typing
from deprecation import deprecated
from cloudevents.abstract import AnyCloudEvent from cloudevents.abstract import AnyCloudEvent
from cloudevents.conversion import to_binary as _moved_to_binary from cloudevents.conversion import to_binary as _moved_to_binary
from cloudevents.conversion import to_structured as _moved_to_structured from cloudevents.conversion import to_structured as _moved_to_structured
from cloudevents.http.conversion import from_http as _moved_from_http from cloudevents.http.conversion import from_http as _moved_from_http
from cloudevents.http.event import CloudEvent from cloudevents.http.event import CloudEvent
from cloudevents.sdk import types from cloudevents.sdk import types
from deprecation import deprecated
# THIS MODULE IS DEPRECATED, YOU SHOULD NOT ADD NEW FUNCTIONALLY HERE # THIS MODULE IS DEPRECATED, YOU SHOULD NOT ADD NEW FUNCTIONALLY HERE

View File

@ -14,13 +14,12 @@
import typing import typing
from deprecation import deprecated
from cloudevents.abstract import AnyCloudEvent from cloudevents.abstract import AnyCloudEvent
from cloudevents.conversion import to_json as _moved_to_json from cloudevents.conversion import to_json as _moved_to_json
from cloudevents.http import CloudEvent from cloudevents.http import CloudEvent
from cloudevents.http.conversion import from_json as _moved_from_json from cloudevents.http.conversion import from_json as _moved_from_json
from cloudevents.sdk import types from cloudevents.sdk import types
from deprecation import deprecated
# THIS MODULE IS DEPRECATED, YOU SHOULD NOT ADD NEW FUNCTIONALLY HERE # THIS MODULE IS DEPRECATED, YOU SHOULD NOT ADD NEW FUNCTIONALLY HERE

View File

@ -13,11 +13,10 @@
# under the License. # under the License.
import typing import typing
from deprecation import deprecated
from cloudevents.conversion import ( from cloudevents.conversion import (
_best_effort_serialize_to_json as _moved_default_marshaller, _best_effort_serialize_to_json as _moved_default_marshaller,
) )
from deprecation import deprecated
# THIS MODULE IS DEPRECATED, YOU SHOULD NOT ADD NEW FUNCTIONALLY HERE # THIS MODULE IS DEPRECATED, YOU SHOULD NOT ADD NEW FUNCTIONALLY HERE

View File

@ -15,12 +15,13 @@ import base64
import json import json
import typing import typing
from cloudevents import exceptions as cloud_exceptions
from cloudevents import http
from cloudevents.abstract import AnyCloudEvent from cloudevents.abstract import AnyCloudEvent
from cloudevents.kafka.exceptions import KeyMapperError from cloudevents.kafka.exceptions import KeyMapperError
from cloudevents.sdk import types from cloudevents.sdk import types
from cloudevents import exceptions as cloud_exceptions
from cloudevents import http
JSON_MARSHALLER: types.MarshallerType = json.dumps JSON_MARSHALLER: types.MarshallerType = json.dumps
JSON_UNMARSHALLER: types.UnmarshallerType = json.loads JSON_UNMARSHALLER: types.UnmarshallerType = json.loads
IDENTITY_MARSHALLER = IDENTITY_UNMARSHALLER = lambda x: x IDENTITY_MARSHALLER = IDENTITY_UNMARSHALLER = lambda x: x

View File

@ -32,10 +32,11 @@ except ImportError: # pragma: no cover # hard to test
"Install it using pip install cloudevents[pydantic]" "Install it using pip install cloudevents[pydantic]"
) )
from cloudevents import abstract, conversion, http
from cloudevents.exceptions import IncompatibleArgumentsError from cloudevents.exceptions import IncompatibleArgumentsError
from cloudevents.sdk.event import attribute from cloudevents.sdk.event import attribute
from cloudevents import abstract, conversion, http
def _ce_json_dumps( # type: ignore[no-untyped-def] def _ce_json_dumps( # type: ignore[no-untyped-def]
obj: typing.Dict[str, typing.Any], obj: typing.Dict[str, typing.Any],

View File

@ -17,10 +17,9 @@ import json
import typing import typing
from typing import Any from typing import Any
from pydantic.deprecated import parse as _deprecated_parse
from cloudevents.exceptions import PydanticFeatureNotInstalled from cloudevents.exceptions import PydanticFeatureNotInstalled
from cloudevents.pydantic.fields_docs import FIELD_DESCRIPTIONS from cloudevents.pydantic.fields_docs import FIELD_DESCRIPTIONS
from pydantic.deprecated import parse as _deprecated_parse
try: try:
from pydantic import BaseModel, ConfigDict, Field, model_serializer from pydantic import BaseModel, ConfigDict, Field, model_serializer
@ -30,10 +29,11 @@ except ImportError: # pragma: no cover # hard to test
"Install it using pip install cloudevents[pydantic]" "Install it using pip install cloudevents[pydantic]"
) )
from cloudevents import abstract, conversion
from cloudevents.exceptions import IncompatibleArgumentsError from cloudevents.exceptions import IncompatibleArgumentsError
from cloudevents.sdk.event import attribute from cloudevents.sdk.event import attribute
from cloudevents import abstract, conversion
class CloudEvent(abstract.CloudEvent, BaseModel): # type: ignore class CloudEvent(abstract.CloudEvent, BaseModel): # type: ignore
""" """

View File

@ -12,7 +12,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import pytest import pytest
from cloudevents.conversion import _best_effort_serialize_to_json from cloudevents.conversion import _best_effort_serialize_to_json
from cloudevents.http import CloudEvent from cloudevents.http import CloudEvent

View File

@ -12,9 +12,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import pytest
import cloudevents.exceptions as cloud_exceptions import cloudevents.exceptions as cloud_exceptions
import pytest
from cloudevents.sdk.event import v1, v03 from cloudevents.sdk.event import v1, v03

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
import pytest import pytest
from cloudevents.sdk import exceptions from cloudevents.sdk import exceptions
from cloudevents.sdk.converters import base, binary from cloudevents.sdk.converters import base, binary

View File

@ -16,7 +16,6 @@ import json
from uuid import uuid4 from uuid import uuid4
import pytest import pytest
from cloudevents.sdk import converters, marshaller from cloudevents.sdk import converters, marshaller
from cloudevents.sdk.event import v1, v03 from cloudevents.sdk.event import v1, v03
from cloudevents.tests import data from cloudevents.tests import data

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
import pytest import pytest
from cloudevents.http import ( from cloudevents.http import (
CloudEvent, CloudEvent,
to_binary, to_binary,

View File

@ -15,7 +15,6 @@
import json import json
import pytest import pytest
from cloudevents.http import CloudEvent, from_http, to_binary, to_structured from cloudevents.http import CloudEvent, from_http, to_binary, to_structured
test_data = json.dumps({"data-key": "val"}) test_data = json.dumps({"data-key": "val"})

View File

@ -15,7 +15,6 @@
import json import json
import pytest import pytest
from cloudevents.sdk import marshaller from cloudevents.sdk import marshaller
from cloudevents.sdk.converters import binary, structured from cloudevents.sdk.converters import binary, structured
from cloudevents.sdk.event import v1, v03 from cloudevents.sdk.event import v1, v03

View File

@ -15,7 +15,6 @@
import json import json
import pytest import pytest
from cloudevents.sdk import converters, marshaller from cloudevents.sdk import converters, marshaller
from cloudevents.sdk.converters import structured from cloudevents.sdk.converters import structured
from cloudevents.sdk.event import v1, v03 from cloudevents.sdk.event import v1, v03

View File

@ -15,7 +15,6 @@
import json import json
import pytest import pytest
from cloudevents.sdk import converters, marshaller from cloudevents.sdk import converters, marshaller
from cloudevents.sdk.event import v1, v03 from cloudevents.sdk.event import v1, v03
from cloudevents.tests import data from cloudevents.tests import data

View File

@ -12,9 +12,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import pytest
import cloudevents.exceptions as cloud_exceptions import cloudevents.exceptions as cloud_exceptions
import pytest
from cloudevents.conversion import _json_or_string from cloudevents.conversion import _json_or_string
from cloudevents.http import CloudEvent from cloudevents.http import CloudEvent

View File

@ -17,7 +17,6 @@ import datetime
import json import json
import pytest import pytest
from cloudevents.conversion import to_dict, to_json from cloudevents.conversion import to_dict, to_json
from cloudevents.http import CloudEvent, from_dict, from_json from cloudevents.http import CloudEvent, from_dict, from_json
from cloudevents.sdk.event.attribute import SpecVersion from cloudevents.sdk.event.attribute import SpecVersion

View File

@ -18,16 +18,15 @@ import io
import json import json
import typing import typing
import pytest
from sanic import Sanic, response
import cloudevents.exceptions as cloud_exceptions import cloudevents.exceptions as cloud_exceptions
import pytest
from cloudevents.http import CloudEvent, from_http, to_binary, to_structured from cloudevents.http import CloudEvent, from_http, to_binary, to_structured
from cloudevents.http.event_type import is_binary as deprecated_is_binary from cloudevents.http.event_type import is_binary as deprecated_is_binary
from cloudevents.http.event_type import is_structured as deprecated_is_structured from cloudevents.http.event_type import is_structured as deprecated_is_structured
from cloudevents.sdk import converters from cloudevents.sdk import converters
from cloudevents.sdk.converters.binary import is_binary from cloudevents.sdk.converters.binary import is_binary
from cloudevents.sdk.converters.structured import is_structured from cloudevents.sdk.converters.structured import is_structured
from sanic import Sanic, response
invalid_test_headers = [ invalid_test_headers = [
{ {

View File

@ -17,8 +17,6 @@ import datetime
import json import json
import pytest import pytest
from cloudevents import exceptions as cloud_exceptions
from cloudevents.abstract.event import AnyCloudEvent from cloudevents.abstract.event import AnyCloudEvent
from cloudevents.http import CloudEvent from cloudevents.http import CloudEvent
from cloudevents.kafka.conversion import ( from cloudevents.kafka.conversion import (
@ -31,6 +29,8 @@ from cloudevents.kafka.conversion import (
from cloudevents.kafka.exceptions import KeyMapperError from cloudevents.kafka.exceptions import KeyMapperError
from cloudevents.sdk import types from cloudevents.sdk import types
from cloudevents import exceptions as cloud_exceptions
def simple_serialize(data: dict) -> bytes: def simple_serialize(data: dict) -> bytes:
return bytes(json.dumps(data).encode("utf-8")) return bytes(json.dumps(data).encode("utf-8"))

View File

@ -14,9 +14,8 @@
import json import json
import pytest
import cloudevents.exceptions as cloud_exceptions import cloudevents.exceptions as cloud_exceptions
import pytest
from cloudevents.http import CloudEvent, from_http, to_binary, to_structured from cloudevents.http import CloudEvent, from_http, to_binary, to_structured
from cloudevents.sdk import exceptions, marshaller from cloudevents.sdk import exceptions, marshaller
from cloudevents.sdk.converters import binary, structured from cloudevents.sdk.converters import binary, structured

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
import pytest import pytest
from cloudevents.sdk.event.opt import Option from cloudevents.sdk.event.opt import Option

View File

@ -15,14 +15,13 @@ import datetime
from json import loads from json import loads
import pytest import pytest
from pydantic import ValidationError as PydanticV2ValidationError
from pydantic.v1 import ValidationError as PydanticV1ValidationError
from cloudevents.conversion import _json_or_string from cloudevents.conversion import _json_or_string
from cloudevents.exceptions import IncompatibleArgumentsError from cloudevents.exceptions import IncompatibleArgumentsError
from cloudevents.pydantic.v1.event import CloudEvent as PydanticV1CloudEvent from cloudevents.pydantic.v1.event import CloudEvent as PydanticV1CloudEvent
from cloudevents.pydantic.v2.event import CloudEvent as PydanticV2CloudEvent from cloudevents.pydantic.v2.event import CloudEvent as PydanticV2CloudEvent
from cloudevents.sdk.event.attribute import SpecVersion from cloudevents.sdk.event.attribute import SpecVersion
from pydantic import ValidationError as PydanticV2ValidationError
from pydantic.v1 import ValidationError as PydanticV1ValidationError
_DUMMY_SOURCE = "dummy:source" _DUMMY_SOURCE = "dummy:source"
_DUMMY_TYPE = "tests.cloudevents.override" _DUMMY_TYPE = "tests.cloudevents.override"

View File

@ -17,9 +17,6 @@ import datetime
import json import json
import pytest import pytest
from pydantic import ValidationError as PydanticV2ValidationError
from pydantic.v1 import ValidationError as PydanticV1ValidationError
from cloudevents.conversion import to_json from cloudevents.conversion import to_json
from cloudevents.pydantic.v1.conversion import from_dict as pydantic_v1_from_dict from cloudevents.pydantic.v1.conversion import from_dict as pydantic_v1_from_dict
from cloudevents.pydantic.v1.conversion import from_json as pydantic_v1_from_json from cloudevents.pydantic.v1.conversion import from_json as pydantic_v1_from_json
@ -28,6 +25,8 @@ from cloudevents.pydantic.v2.conversion import from_dict as pydantic_v2_from_dic
from cloudevents.pydantic.v2.conversion import from_json as pydantic_v2_from_json from cloudevents.pydantic.v2.conversion import from_json as pydantic_v2_from_json
from cloudevents.pydantic.v2.event import CloudEvent as PydanticV2CloudEvent from cloudevents.pydantic.v2.event import CloudEvent as PydanticV2CloudEvent
from cloudevents.sdk.event.attribute import SpecVersion from cloudevents.sdk.event.attribute import SpecVersion
from pydantic import ValidationError as PydanticV2ValidationError
from pydantic.v1 import ValidationError as PydanticV1ValidationError
test_data = json.dumps({"data-key": "val"}) test_data = json.dumps({"data-key": "val"})
test_attributes = { test_attributes = {

View File

@ -18,12 +18,8 @@ import io
import json import json
import typing import typing
import pytest
from pydantic import ValidationError as PydanticV2ValidationError
from pydantic.v1 import ValidationError as PydanticV1ValidationError
from sanic import Sanic, response
import cloudevents.exceptions as cloud_exceptions import cloudevents.exceptions as cloud_exceptions
import pytest
from cloudevents.conversion import to_binary, to_structured from cloudevents.conversion import to_binary, to_structured
from cloudevents.pydantic.v1.conversion import from_http as pydantic_v1_from_http from cloudevents.pydantic.v1.conversion import from_http as pydantic_v1_from_http
from cloudevents.pydantic.v1.event import CloudEvent as PydanticV1CloudEvent from cloudevents.pydantic.v1.event import CloudEvent as PydanticV1CloudEvent
@ -32,6 +28,9 @@ from cloudevents.pydantic.v2.event import CloudEvent as PydanticV2CloudEvent
from cloudevents.sdk import converters, types from cloudevents.sdk import converters, types
from cloudevents.sdk.converters.binary import is_binary from cloudevents.sdk.converters.binary import is_binary
from cloudevents.sdk.converters.structured import is_structured from cloudevents.sdk.converters.structured import is_structured
from pydantic import ValidationError as PydanticV2ValidationError
from pydantic.v1 import ValidationError as PydanticV1ValidationError
from sanic import Sanic, response
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:
from typing_extensions import TypeAlias from typing_extensions import TypeAlias

View File

@ -12,11 +12,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from sanic import Sanic, response
from cloudevents.sdk import converters, marshaller from cloudevents.sdk import converters, marshaller
from cloudevents.sdk.event import v1 from cloudevents.sdk.event import v1
from cloudevents.tests import data as test_data from cloudevents.tests import data as test_data
from sanic import Sanic, response
m = marshaller.NewDefaultHTTPMarshaller() m = marshaller.NewDefaultHTTPMarshaller()
app = Sanic("test_with_sanic") app = Sanic("test_with_sanic")

View File

@ -15,7 +15,6 @@
import sys import sys
import requests import requests
from cloudevents.conversion import to_binary, to_structured from cloudevents.conversion import to_binary, to_structured
from cloudevents.http import CloudEvent from cloudevents.http import CloudEvent

View File

@ -14,11 +14,10 @@
import io import io
from cloudevents.http import from_http
from flask import Flask, request from flask import Flask, request
from PIL import Image from PIL import Image
from cloudevents.http import from_http
app = Flask(__name__) app = Flask(__name__)

View File

@ -18,11 +18,10 @@ import json
import pytest import pytest
from client import image_bytes from client import image_bytes
from image_sample_server import app
from PIL import Image
from cloudevents.conversion import to_binary, to_structured from cloudevents.conversion import to_binary, to_structured
from cloudevents.http import CloudEvent, from_http from cloudevents.http import CloudEvent, from_http
from image_sample_server import app
from PIL import Image
image_fileobj = io.BytesIO(image_bytes) image_fileobj = io.BytesIO(image_bytes)
image_expected_shape = (1880, 363) image_expected_shape = (1880, 363)

View File

@ -15,7 +15,6 @@
import sys import sys
import requests import requests
from cloudevents.conversion import to_binary, to_structured from cloudevents.conversion import to_binary, to_structured
from cloudevents.http import CloudEvent from cloudevents.http import CloudEvent

View File

@ -12,9 +12,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from flask import Flask, request
from cloudevents.http import from_http from cloudevents.http import from_http
from flask import Flask, request
app = Flask(__name__) app = Flask(__name__)

View File

@ -13,10 +13,9 @@
# under the License. # under the License.
import pytest import pytest
from json_sample_server import app
from cloudevents.conversion import to_binary, to_structured from cloudevents.conversion import to_binary, to_structured
from cloudevents.http import CloudEvent from cloudevents.http import CloudEvent
from json_sample_server import app
@pytest.fixture @pytest.fixture