Skip to content

Commit

Permalink
upgrade attrs to 20.3.0 and update converter kwarg
Browse files Browse the repository at this point in the history
  • Loading branch information
mahenzon committed Feb 24, 2021
1 parent cc15868 commit f4f51df
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions aioalice/types/alice_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
class AliceRequest(AliceObject):
"""AliceRequest is a request from Alice API"""
original_request = attrib(type=WebRequest)
meta = attrib(convert=ensure_cls(Meta))
request = attrib(convert=ensure_cls(Request))
session = attrib(convert=ensure_cls(Session))
meta = attrib(converter=ensure_cls(Meta))
request = attrib(converter=ensure_cls(Request))
session = attrib(converter=ensure_cls(Session))
version = attrib(type=str)

def _response(self, response):
Expand Down
4 changes: 2 additions & 2 deletions aioalice/types/alice_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
class AliceResponse(AliceObject):
"""AliceResponse is a response to Alice API"""

response = attrib(convert=ensure_cls(Response))
session = attrib(convert=ensure_cls(BaseSession))
response = attrib(converter=ensure_cls(Response))
session = attrib(converter=ensure_cls(BaseSession))
version = attrib(type=str)
8 changes: 4 additions & 4 deletions aioalice/types/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ class Card(AliceObject):
image_id = attrib(default=None, type=str)
title = attrib(default=None, type=str)
description = attrib(default=None, type=str)
button = attrib(default=None, convert=ensure_cls(MediaButton))
button = attrib(default=None, converter=ensure_cls(MediaButton))

# for ItemsList
header = attrib(default=None, convert=ensure_cls(CardHeader))
items = attrib(default=None, convert=ensure_cls(Image)) # List of Image objects
header = attrib(default=None, converter=ensure_cls(CardHeader))
items = attrib(default=None, converter=ensure_cls(Image)) # List of Image objects

footer = attrib(default=None, convert=ensure_cls(CardFooter))
footer = attrib(default=None, converter=ensure_cls(CardFooter))

@type.validator
def check(self, attribute, value):
Expand Down
2 changes: 1 addition & 1 deletion aioalice/types/card_footer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
class CardFooter(AliceObject):
"""This object represents a card's footer"""
text = attrib(type=str)
button = attrib(default=None, convert=ensure_cls(MediaButton))
button = attrib(default=None, converter=ensure_cls(MediaButton))
2 changes: 1 addition & 1 deletion aioalice/types/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class Entity(AliceObject):
"""Entity object"""
type = attrib(type=str)
tokens = attrib(convert=ensure_cls(EntityTokens))
tokens = attrib(converter=ensure_cls(EntityTokens))
value = attrib(factory=dict)

@type.validator
Expand Down
2 changes: 1 addition & 1 deletion aioalice/types/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ class Image(AliceObject):
image_id = attrib(type=str)
title = attrib(type=str)
description = attrib(type=str)
button = attrib(default=None, convert=ensure_cls(MediaButton))
button = attrib(default=None, converter=ensure_cls(MediaButton))
2 changes: 1 addition & 1 deletion aioalice/types/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ class Meta(AliceObject):
locale = attrib(type=str)
timezone = attrib(type=str)
client_id = attrib(type=str)
interfaces = attrib(default=None, convert=ensure_cls(Interfaces))
interfaces = attrib(default=None, converter=ensure_cls(Interfaces))
flags = attrib(factory=list)
2 changes: 1 addition & 1 deletion aioalice/types/natural_language_understanding.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
class NaturalLanguageUnderstanding(AliceObject):
"""Natural Language Understanding object"""
tokens = attrib(factory=list)
entities = attrib(factory=list, convert=ensure_cls(Entity))
entities = attrib(factory=list, converter=ensure_cls(Entity))
2 changes: 1 addition & 1 deletion aioalice/types/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Request(AliceObject):
original_utterance = attrib(default='', type=str) # Can be none if payload passed
markup = attrib(default=None)
payload = attrib(default=None)
nlu = attrib(default=None, convert=ensure_cls(NaturalLanguageUnderstanding))
nlu = attrib(default=None, converter=ensure_cls(NaturalLanguageUnderstanding))

@type.validator
def check(self, attribute, value):
Expand Down
4 changes: 2 additions & 2 deletions aioalice/types/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ class Response(AliceObject):

text = attrib(type=str)
tts = attrib(default=None, type=str)
card = attrib(default=None, convert=ensure_cls(Card))
buttons = attrib(default=None, convert=ensure_cls(Button))
card = attrib(default=None, converter=ensure_cls(Card))
buttons = attrib(default=None, converter=ensure_cls(Button))
end_session = attrib(default=False, type=bool)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
aiohttp>=3.3.2
attrs==18.1.0
attrs==20.3.0

0 comments on commit f4f51df

Please sign in to comment.