Skip to content
This repository was archived by the owner on Dec 20, 2021. It is now read-only.

Commit 74fa78f

Browse files
committed
Manual do_init() func for objects when caching is off
1 parent cef7ac2 commit 74fa78f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

vrcpy/objects.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,26 @@ def _assign(self, obj):
3838
self.cacheTask = asyncio.get_event_loop().create_task(self.__cinit__())
3939
else:
4040
self.__cinit__()
41+
elif hasattr(self, "__cinit__"):
42+
if str(type(self.client)) == "<class 'vrcpy.client.AClient'>":
43+
async def di1(self):
44+
async def di2(self):
45+
raise AttributeError(self.objType + " object has no attribute 'do_init'")
46+
47+
if asyncio.iscoroutinefunction(self.__cinit__):
48+
await self.__cinit__()
49+
else:
50+
self.__cinit__()
51+
52+
self.do_init = di2
53+
else:
54+
def di1(self):
55+
def di2(self):
56+
raise AttributeError(self.objType + " object has no attribute 'do_init'")
57+
58+
self.__cinit__()
59+
self.do_init = di2
60+
self.do_init = di1
4161

4262
self._dict = obj
4363

0 commit comments

Comments
 (0)