Merge remote-tracking branch 'origin/drop-python3.8' into drop-python3.8
This commit is contained in:
commit
4cd705d086
|
@ -16,13 +16,12 @@ import enum
|
|||
import json
|
||||
import typing
|
||||
|
||||
from cloudevents import exceptions as cloud_exceptions
|
||||
from cloudevents.abstract import AnyCloudEvent
|
||||
from cloudevents.sdk import converters, marshaller, types
|
||||
from cloudevents.sdk.converters import is_binary
|
||||
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]
|
||||
value: typing.Any, *args, **kwargs
|
||||
|
|
|
@ -17,9 +17,8 @@ import typing
|
|||
import uuid
|
||||
|
||||
import cloudevents.exceptions as cloud_exceptions
|
||||
from cloudevents.sdk.event import v1, v03
|
||||
|
||||
from cloudevents import abstract
|
||||
from cloudevents.sdk.event import v1, v03
|
||||
|
||||
_required_by_version = {
|
||||
"1.0": v1.Event._ce_required_fields,
|
||||
|
|
|
@ -13,9 +13,10 @@
|
|||
# under the License.
|
||||
import typing
|
||||
|
||||
from deprecation import deprecated
|
||||
|
||||
from cloudevents.sdk.converters import is_binary as _moved_is_binary
|
||||
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
|
||||
|
||||
|
|
|
@ -14,13 +14,14 @@
|
|||
|
||||
import typing
|
||||
|
||||
from deprecation import deprecated
|
||||
|
||||
from cloudevents.abstract import AnyCloudEvent
|
||||
from cloudevents.conversion import to_binary as _moved_to_binary
|
||||
from cloudevents.conversion import to_structured as _moved_to_structured
|
||||
from cloudevents.http.conversion import from_http as _moved_from_http
|
||||
from cloudevents.http.event import CloudEvent
|
||||
from cloudevents.sdk import types
|
||||
from deprecation import deprecated
|
||||
|
||||
# THIS MODULE IS DEPRECATED, YOU SHOULD NOT ADD NEW FUNCTIONALLY HERE
|
||||
|
||||
|
|
|
@ -14,12 +14,13 @@
|
|||
|
||||
import typing
|
||||
|
||||
from deprecation import deprecated
|
||||
|
||||
from cloudevents.abstract import AnyCloudEvent
|
||||
from cloudevents.conversion import to_json as _moved_to_json
|
||||
from cloudevents.http import CloudEvent
|
||||
from cloudevents.http.conversion import from_json as _moved_from_json
|
||||
from cloudevents.sdk import types
|
||||
from deprecation import deprecated
|
||||
|
||||
# THIS MODULE IS DEPRECATED, YOU SHOULD NOT ADD NEW FUNCTIONALLY HERE
|
||||
|
||||
|
|
|
@ -13,10 +13,11 @@
|
|||
# under the License.
|
||||
import typing
|
||||
|
||||
from deprecation import deprecated
|
||||
|
||||
from cloudevents.conversion import (
|
||||
_best_effort_serialize_to_json as _moved_default_marshaller,
|
||||
)
|
||||
from deprecation import deprecated
|
||||
|
||||
# THIS MODULE IS DEPRECATED, YOU SHOULD NOT ADD NEW FUNCTIONALLY HERE
|
||||
|
||||
|
|
|
@ -15,13 +15,12 @@ import base64
|
|||
import json
|
||||
import typing
|
||||
|
||||
from cloudevents import exceptions as cloud_exceptions
|
||||
from cloudevents import http
|
||||
from cloudevents.abstract import AnyCloudEvent
|
||||
from cloudevents.kafka.exceptions import KeyMapperError
|
||||
from cloudevents.sdk import types
|
||||
|
||||
from cloudevents import exceptions as cloud_exceptions
|
||||
from cloudevents import http
|
||||
|
||||
JSON_MARSHALLER: types.MarshallerType = json.dumps
|
||||
JSON_UNMARSHALLER: types.UnmarshallerType = json.loads
|
||||
IDENTITY_MARSHALLER = IDENTITY_UNMARSHALLER = lambda x: x
|
||||
|
|
|
@ -32,11 +32,10 @@ except ImportError: # pragma: no cover # hard to test
|
|||
"Install it using pip install cloudevents[pydantic]"
|
||||
)
|
||||
|
||||
from cloudevents import abstract, conversion, http
|
||||
from cloudevents.exceptions import IncompatibleArgumentsError
|
||||
from cloudevents.sdk.event import attribute
|
||||
|
||||
from cloudevents import abstract, conversion, http
|
||||
|
||||
|
||||
def _ce_json_dumps( # type: ignore[no-untyped-def]
|
||||
obj: typing.Dict[str, typing.Any],
|
||||
|
|
|
@ -17,9 +17,10 @@ import json
|
|||
import typing
|
||||
from typing import Any
|
||||
|
||||
from pydantic.deprecated import parse as _deprecated_parse
|
||||
|
||||
from cloudevents.exceptions import PydanticFeatureNotInstalled
|
||||
from cloudevents.pydantic.fields_docs import FIELD_DESCRIPTIONS
|
||||
from pydantic.deprecated import parse as _deprecated_parse
|
||||
|
||||
try:
|
||||
from pydantic import BaseModel, ConfigDict, Field, model_serializer
|
||||
|
@ -29,11 +30,10 @@ except ImportError: # pragma: no cover # hard to test
|
|||
"Install it using pip install cloudevents[pydantic]"
|
||||
)
|
||||
|
||||
from cloudevents import abstract, conversion
|
||||
from cloudevents.exceptions import IncompatibleArgumentsError
|
||||
from cloudevents.sdk.event import attribute
|
||||
|
||||
from cloudevents import abstract, conversion
|
||||
|
||||
|
||||
class CloudEvent(abstract.CloudEvent, BaseModel): # type: ignore
|
||||
"""
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import pytest
|
||||
|
||||
from cloudevents.conversion import _best_effort_serialize_to_json
|
||||
from cloudevents.http import CloudEvent
|
||||
|
||||
|
|
|
@ -12,8 +12,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import cloudevents.exceptions as cloud_exceptions
|
||||
import pytest
|
||||
|
||||
import cloudevents.exceptions as cloud_exceptions
|
||||
from cloudevents.sdk.event import v1, v03
|
||||
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
# under the License.
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudevents.sdk import exceptions
|
||||
from cloudevents.sdk.converters import base, binary
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import json
|
|||
from uuid import uuid4
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudevents.sdk import converters, marshaller
|
||||
from cloudevents.sdk.event import v1, v03
|
||||
from cloudevents.tests import data
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
# under the License.
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudevents.http import (
|
||||
CloudEvent,
|
||||
to_binary,
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudevents.http import CloudEvent, from_http, to_binary, to_structured
|
||||
|
||||
test_data = json.dumps({"data-key": "val"})
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudevents.sdk import marshaller
|
||||
from cloudevents.sdk.converters import binary, structured
|
||||
from cloudevents.sdk.event import v1, v03
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudevents.sdk import converters, marshaller
|
||||
from cloudevents.sdk.converters import structured
|
||||
from cloudevents.sdk.event import v1, v03
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudevents.sdk import converters, marshaller
|
||||
from cloudevents.sdk.event import v1, v03
|
||||
from cloudevents.tests import data
|
||||
|
|
|
@ -12,8 +12,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import cloudevents.exceptions as cloud_exceptions
|
||||
import pytest
|
||||
|
||||
import cloudevents.exceptions as cloud_exceptions
|
||||
from cloudevents.conversion import _json_or_string
|
||||
from cloudevents.http import CloudEvent
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import datetime
|
|||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudevents.conversion import to_dict, to_json
|
||||
from cloudevents.http import CloudEvent, from_dict, from_json
|
||||
from cloudevents.sdk.event.attribute import SpecVersion
|
||||
|
|
|
@ -18,15 +18,16 @@ import io
|
|||
import json
|
||||
import typing
|
||||
|
||||
import cloudevents.exceptions as cloud_exceptions
|
||||
import pytest
|
||||
from sanic import Sanic, response
|
||||
|
||||
import cloudevents.exceptions as cloud_exceptions
|
||||
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_structured as deprecated_is_structured
|
||||
from cloudevents.sdk import converters
|
||||
from cloudevents.sdk.converters.binary import is_binary
|
||||
from cloudevents.sdk.converters.structured import is_structured
|
||||
from sanic import Sanic, response
|
||||
|
||||
invalid_test_headers = [
|
||||
{
|
||||
|
|
|
@ -17,6 +17,8 @@ import datetime
|
|||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudevents import exceptions as cloud_exceptions
|
||||
from cloudevents.abstract.event import AnyCloudEvent
|
||||
from cloudevents.http import CloudEvent
|
||||
from cloudevents.kafka.conversion import (
|
||||
|
@ -29,8 +31,6 @@ from cloudevents.kafka.conversion import (
|
|||
from cloudevents.kafka.exceptions import KeyMapperError
|
||||
from cloudevents.sdk import types
|
||||
|
||||
from cloudevents import exceptions as cloud_exceptions
|
||||
|
||||
|
||||
def simple_serialize(data: dict) -> bytes:
|
||||
return bytes(json.dumps(data).encode("utf-8"))
|
||||
|
|
|
@ -14,8 +14,9 @@
|
|||
|
||||
import json
|
||||
|
||||
import cloudevents.exceptions as cloud_exceptions
|
||||
import pytest
|
||||
|
||||
import cloudevents.exceptions as cloud_exceptions
|
||||
from cloudevents.http import CloudEvent, from_http, to_binary, to_structured
|
||||
from cloudevents.sdk import exceptions, marshaller
|
||||
from cloudevents.sdk.converters import binary, structured
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
# under the License.
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudevents.sdk.event.opt import Option
|
||||
|
||||
|
||||
|
|
|
@ -15,13 +15,14 @@ import datetime
|
|||
from json import loads
|
||||
|
||||
import pytest
|
||||
from pydantic import ValidationError as PydanticV2ValidationError
|
||||
from pydantic.v1 import ValidationError as PydanticV1ValidationError
|
||||
|
||||
from cloudevents.conversion import _json_or_string
|
||||
from cloudevents.exceptions import IncompatibleArgumentsError
|
||||
from cloudevents.pydantic.v1.event import CloudEvent as PydanticV1CloudEvent
|
||||
from cloudevents.pydantic.v2.event import CloudEvent as PydanticV2CloudEvent
|
||||
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_TYPE = "tests.cloudevents.override"
|
||||
|
|
|
@ -17,6 +17,9 @@ import datetime
|
|||
import json
|
||||
|
||||
import pytest
|
||||
from pydantic import ValidationError as PydanticV2ValidationError
|
||||
from pydantic.v1 import ValidationError as PydanticV1ValidationError
|
||||
|
||||
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_json as pydantic_v1_from_json
|
||||
|
@ -25,8 +28,6 @@ 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.event import CloudEvent as PydanticV2CloudEvent
|
||||
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_attributes = {
|
||||
|
|
|
@ -18,8 +18,12 @@ import io
|
|||
import json
|
||||
import typing
|
||||
|
||||
import cloudevents.exceptions as cloud_exceptions
|
||||
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
|
||||
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.event import CloudEvent as PydanticV1CloudEvent
|
||||
|
@ -28,9 +32,6 @@ from cloudevents.pydantic.v2.event import CloudEvent as PydanticV2CloudEvent
|
|||
from cloudevents.sdk import converters, types
|
||||
from cloudevents.sdk.converters.binary import is_binary
|
||||
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:
|
||||
from typing_extensions import TypeAlias
|
||||
|
|
|
@ -12,10 +12,11 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from sanic import Sanic, response
|
||||
|
||||
from cloudevents.sdk import converters, marshaller
|
||||
from cloudevents.sdk.event import v1
|
||||
from cloudevents.tests import data as test_data
|
||||
from sanic import Sanic, response
|
||||
|
||||
m = marshaller.NewDefaultHTTPMarshaller()
|
||||
app = Sanic("test_with_sanic")
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
import sys
|
||||
|
||||
import requests
|
||||
|
||||
from cloudevents.conversion import to_binary, to_structured
|
||||
from cloudevents.http import CloudEvent
|
||||
|
||||
|
|
|
@ -14,10 +14,11 @@
|
|||
|
||||
import io
|
||||
|
||||
from cloudevents.http import from_http
|
||||
from flask import Flask, request
|
||||
from PIL import Image
|
||||
|
||||
from cloudevents.http import from_http
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -18,11 +18,12 @@ import json
|
|||
|
||||
import pytest
|
||||
from client import image_bytes
|
||||
from cloudevents.conversion import to_binary, to_structured
|
||||
from cloudevents.http import CloudEvent, from_http
|
||||
from image_sample_server import app
|
||||
from PIL import Image
|
||||
|
||||
from cloudevents.conversion import to_binary, to_structured
|
||||
from cloudevents.http import CloudEvent, from_http
|
||||
|
||||
image_fileobj = io.BytesIO(image_bytes)
|
||||
image_expected_shape = (1880, 363)
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
import sys
|
||||
|
||||
import requests
|
||||
|
||||
from cloudevents.conversion import to_binary, to_structured
|
||||
from cloudevents.http import CloudEvent
|
||||
|
||||
|
|
|
@ -12,9 +12,10 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from cloudevents.http import from_http
|
||||
from flask import Flask, request
|
||||
|
||||
from cloudevents.http import from_http
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -13,9 +13,10 @@
|
|||
# under the License.
|
||||
|
||||
import pytest
|
||||
from json_sample_server import app
|
||||
|
||||
from cloudevents.conversion import to_binary, to_structured
|
||||
from cloudevents.http import CloudEvent
|
||||
from json_sample_server import app
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
Loading…
Reference in New Issue