- async_property version: 0.2.2
- Python version: 3.11.9
- Operating System: Windows 11
Description
I created an async property. It needed a setter, so I made a synchronous setter for it. It raised an error saying async_property has no attribute 'setter'.
I am aware of the other async setter issue. It was, however, closed with the explanation that setters can’t be asynchronous. That is not my issue, I want a synchronous setter for an async property.
What I Did
The code
@async_property
async def channel(self) -> hikari.GuildChannel:
"""La steltabula kanalo"""
if not self.__channel:
self.__channel = await plugin.app.rest.fetch_channel(self.__channel_id)
return self.__channel
@channel.setter
def channel(self, new_value: hikari.GuildChannel | int):
if isinstance(new_value, hikari.GuildChannel):
self.__channel = new_value
self.__channel_id = new_value.id
else:
self.__channel_id = new_value
self.__channel = None
self.__update_in_database("steltabula-kanalo", self.__channel_id)
The traceback
File "c:\Esperanto\Espiralo\steltabulo.py", line 76, in StarboardSettings
@channel.setter
^^^^^^^^^^^^^^
AttributeError: 'AsyncPropertyDescriptor' object has no attribute 'setter'
Description
I created an async property. It needed a setter, so I made a synchronous setter for it. It raised an error saying async_property has no attribute 'setter'.
I am aware of the other async setter issue. It was, however, closed with the explanation that setters can’t be asynchronous. That is not my issue, I want a synchronous setter for an async property.
What I Did
The code
The traceback