Skip to content

Commit 195bf60

Browse files
committedMay 3, 2024·
fix type errors
1 parent 6996c56 commit 195bf60

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed
 

‎addon_service/addon_operation/models.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
get_imp_name,
88
)
99
from addon_service.common.static_dataclass_model import StaticDataclassModel
10-
from addon_toolkit import AddonOperationImp
10+
from addon_toolkit import (
11+
AddonCapabilities,
12+
AddonOperationImp,
13+
)
1114
from addon_toolkit.json_arguments import jsonschema_for_signature_params
1215
from addon_toolkit.operation import AddonOperationType
1316

@@ -42,7 +45,7 @@ def implementation_docstring(self) -> str:
4245
return self.operation_imp.imp_function.__doc__ or ""
4346

4447
@cached_property
45-
def capability(self) -> str:
48+
def capability(self) -> AddonCapabilities:
4649
return self.operation_imp.declaration.capability
4750

4851
@cached_property

‎addon_service/addon_operation/serializers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from rest_framework_json_api import serializers
22
from rest_framework_json_api.utils import get_resource_type_from_model
33

4-
from addon_service.addon_imp.models import AddonImp
54
from addon_service.common import view_names
65
from addon_service.common.enums.serializers import EnumNameChoiceField
76
from addon_service.common.serializer_fields import DataclassRelatedDataField
87
from addon_toolkit import AddonCapabilities
8+
from addon_toolkit.imp import AddonImp
99

1010
from .models import AddonOperationModel
1111

‎addon_toolkit/operation.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Iterator,
88
)
99

10+
from .capabilities import AddonCapabilities
1011
from .declarator import Declarator
1112

1213

@@ -35,7 +36,7 @@ class AddonOperationDeclaration:
3536
"""
3637

3738
operation_type: AddonOperationType
38-
capability: enum.Enum
39+
capability: AddonCapabilities
3940
operation_fn: Callable # the decorated function
4041
return_type: type = dataclasses.field(
4142
default=type(None), # if not provided, inferred by __post_init__

‎addon_toolkit/tests/test_addon_protocol.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TestAddonProtocol(unittest.TestCase):
2121
# the basics of an addon protocol
2222

2323
###
24-
# shared test env (on `self`)
24+
# shared test env (initialized by setUpClass)
2525
_MyProtocol: type # typing.Protocol subclass decorated with `@addon_protocol`
2626
_MyImplementation: type # subclass of _MyProtocol
2727
_my_imp: AddonImp

0 commit comments

Comments
 (0)