refactor: rename abstract to generic
Signed-off-by: Alexander Tkachev <sasha64sasha@gmail.com>
This commit is contained in:
parent
a22efbde37
commit
89d30eb23d
|
@ -12,4 +12,4 @@
|
||||||
# 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 cloudevents.abstract.event import CloudEvent, AnyCloudEvent # noqa
|
from cloudevents.generic.event import CloudEvent, AnyCloudEvent # noqa
|
|
@ -17,7 +17,7 @@ import typing
|
||||||
|
|
||||||
|
|
||||||
import cloudevents.exceptions as cloud_exceptions
|
import cloudevents.exceptions as cloud_exceptions
|
||||||
from cloudevents.abstract.event import AnyCloudEvent
|
from cloudevents.generic.event import AnyCloudEvent
|
||||||
from cloudevents.http.event_type import is_binary
|
from cloudevents.http.event_type import is_binary
|
||||||
from cloudevents.http.mappings import _marshaller_by_format, _obj_by_version
|
from cloudevents.http.mappings import _marshaller_by_format, _obj_by_version
|
||||||
from cloudevents.http.util import _json_or_string
|
from cloudevents.http.util import _json_or_string
|
|
@ -14,9 +14,9 @@
|
||||||
|
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from cloudevents.abstract import AnyCloudEvent
|
from cloudevents.generic import AnyCloudEvent
|
||||||
from cloudevents.sdk import types
|
from cloudevents.sdk import types
|
||||||
from cloudevents.abstract.http_methods import to_structured, from_http
|
from cloudevents.generic.http_methods import to_structured, from_http
|
||||||
|
|
||||||
|
|
||||||
def to_json(
|
def to_json(
|
|
@ -18,10 +18,10 @@ import uuid
|
||||||
|
|
||||||
import cloudevents.exceptions as cloud_exceptions
|
import cloudevents.exceptions as cloud_exceptions
|
||||||
from cloudevents.http.mappings import _required_by_version
|
from cloudevents.http.mappings import _required_by_version
|
||||||
from cloudevents import abstract
|
from cloudevents import generic
|
||||||
|
|
||||||
|
|
||||||
class CloudEvent(abstract.CloudEvent):
|
class CloudEvent(generic.CloudEvent):
|
||||||
"""
|
"""
|
||||||
Python-friendly cloudevent class supporting v1 events
|
Python-friendly cloudevent class supporting v1 events
|
||||||
Supports both binary and structured mode CloudEvents
|
Supports both binary and structured mode CloudEvents
|
||||||
|
|
|
@ -21,10 +21,10 @@ from cloudevents.http.event import CloudEvent
|
||||||
from cloudevents.sdk import types
|
from cloudevents.sdk import types
|
||||||
|
|
||||||
# backwards compatability imports
|
# backwards compatability imports
|
||||||
from cloudevents.abstract.http_methods import to_binary, to_structured # noqa
|
from cloudevents.generic.http_methods import to_binary, to_structured # noqa
|
||||||
|
|
||||||
|
|
||||||
from cloudevents.abstract.http_methods import from_http as _abstract_from_http
|
from cloudevents.generic.http_methods import from_http as _generic_from_http
|
||||||
|
|
||||||
|
|
||||||
def from_http(
|
def from_http(
|
||||||
|
@ -43,7 +43,7 @@ def from_http(
|
||||||
e.g. lambda x: x or lambda x: json.loads(x)
|
e.g. lambda x: x or lambda x: json.loads(x)
|
||||||
:type data_unmarshaller: types.UnmarshallerType
|
:type data_unmarshaller: types.UnmarshallerType
|
||||||
"""
|
"""
|
||||||
return _abstract_from_http(CloudEvent, headers, data, data_unmarshaller)
|
return _generic_from_http(CloudEvent, headers, data, data_unmarshaller)
|
||||||
|
|
||||||
|
|
||||||
@deprecated(deprecated_in="1.0.2", details="Use to_binary function instead")
|
@deprecated(deprecated_in="1.0.2", details="Use to_binary function instead")
|
||||||
|
|
|
@ -18,8 +18,8 @@ from cloudevents.http.event import CloudEvent
|
||||||
from cloudevents.sdk import types
|
from cloudevents.sdk import types
|
||||||
|
|
||||||
# backwards compatibility
|
# backwards compatibility
|
||||||
from cloudevents.abstract.json_methods import to_json # noqa
|
from cloudevents.generic.json_methods import to_json # noqa
|
||||||
from cloudevents.abstract.json_methods import from_json as _abstract_from_json
|
from cloudevents.generic.json_methods import from_json as _generic_from_json
|
||||||
|
|
||||||
|
|
||||||
def from_json(
|
def from_json(
|
||||||
|
@ -34,4 +34,4 @@ def from_json(
|
||||||
:type data_unmarshaller: typing.Callable
|
:type data_unmarshaller: typing.Callable
|
||||||
:returns: CloudEvent representing given cloudevent json object
|
:returns: CloudEvent representing given cloudevent json object
|
||||||
"""
|
"""
|
||||||
return _abstract_from_json(CloudEvent, data, data_unmarshaller)
|
return _generic_from_json(CloudEvent, data, data_unmarshaller)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from cloudevents.abstract import CloudEvent
|
from cloudevents.generic import CloudEvent
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue