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

Commit 931fcb0

Browse files
committed
pep8 conventions
1 parent 6460753 commit 931fcb0

7 files changed

Lines changed: 332 additions & 175 deletions

File tree

vrcpy/aobjects.py

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,21 @@
88
Thanks ~ Lazy me
99
'''
1010

11-
## Avatar
11+
# Avatar
12+
1213

1314
class Avatar(o.Avatar):
1415
async def author(self):
1516
resp = await self.client.api.call("/users/"+self.authorId)
1617
return User(self.client, resp["data"])
1718

1819
async def favorite(self):
19-
resp = await self.client.api.call("/favorites", "POST", json={"type": types.FavoriteType.Avatar,\
20-
"favoriteId": self.id, "tags": ["avatars1"]})
20+
resp = await self.client.api.call("/favorites", "POST", json={"type": types.FavoriteType.Avatar,
21+
"favoriteId": self.id, "tags": ["avatars1"]})
2122

2223
f = Favorite(self.client, resp["data"])
23-
if self.client.caching: await f.cacheTask
24+
if self.client.caching:
25+
await f.cacheTask
2426

2527
return f
2628

@@ -31,7 +33,8 @@ async def select(self):
3133

3234
await self.client.api.call("/avatars/{}/select".format(self.id), "PUT")
3335

34-
## User
36+
# User
37+
3538

3639
class LimitedUser(o.LimitedUser):
3740
async def fetch_full(self):
@@ -40,7 +43,7 @@ async def fetch_full(self):
4043

4144
async def public_avatars(self):
4245
resp = await self.client.api.call("/avatars",
43-
params={"userId": self.id})
46+
params={"userId": self.id})
4447

4548
avatars = []
4649
for avatar in resp["data"]:
@@ -56,10 +59,11 @@ async def friend(self):
5659
return o.Notification(self.client, resp["data"])
5760

5861
async def favorite(self):
59-
resp = await self.client.api.call("/favorites", "POST", params={"type": types.FavoriteType.Friend,\
60-
"favoriteId": self.id})
62+
resp = await self.client.api.call("/favorites", "POST", params={"type": types.FavoriteType.Friend,
63+
"favoriteId": self.id})
6164
return Favorite(resp["data"])
6265

66+
6367
class User(o.User, LimitedUser):
6468
async def fetch_full(self):
6569
user = await LimitedUser.fetch_full(self)
@@ -80,6 +84,7 @@ async def favorite(self):
8084
resp = await LimitedUser.favorite(self)
8185
return resp
8286

87+
8388
class CurrentUser(o.CurrentUser, User):
8489
obj = "CurrentUser"
8590

@@ -97,14 +102,15 @@ async def unfriend(self):
97102
async def friend(self):
98103
raise AttributeError("'CurrentUser' object has no attribute 'friend'")
99104

100-
async def update_info(self, email=None, status=None,\
101-
statusDescription=None, bio=None, bioLinks=None):
105+
async def update_info(self, email=None, status=None,
106+
statusDescription=None, bio=None, bioLinks=None):
102107

103-
params = {"email": email, "status": status, "statusDescription": statusDescription,\
104-
"bio": bio, "bioLinks": bioLinks}
108+
params = {"email": email, "status": status, "statusDescription": statusDescription,
109+
"bio": bio, "bioLinks": bioLinks}
105110

106111
for p in params:
107-
if params[p] == None: params[p] = getattr(self, p)
112+
if params[p] == None:
113+
params[p] = getattr(self, p)
108114

109115
resp = await self.client.api.call("/users/"+self.id, "PUT", params=params)
110116

@@ -113,7 +119,7 @@ async def update_info(self, email=None, status=None,\
113119

114120
async def avatars(self, releaseStatus=types.ReleaseStatus.All):
115121
resp = await self.client.api.call("/avatars",
116-
params={"releaseStatus": releaseStatus, "user": "me"})
122+
params={"releaseStatus": releaseStatus, "user": "me"})
117123

118124
avatars = []
119125
for avatar in resp["data"]:
@@ -130,7 +136,8 @@ async def fetch_favorites(self, t):
130136
f.append(Favorite(self.client, favorite))
131137

132138
if self.client.caching:
133-
for fav in f: await fav.cacheTask
139+
for fav in f:
140+
await fav.cacheTask
134141

135142
return f
136143

@@ -163,32 +170,39 @@ async def __cinit__(self):
163170
self.activeFriends = naf
164171

165172
if hasattr(self, "homeLocation"):
166-
if self.homeLocation == "": self.homeLocation = None
167-
else: self.homeLocation = await self.client.fetch_world(self.homeLocation)
168-
else: self.homeLocation = None
173+
if self.homeLocation == "":
174+
self.homeLocation = None
175+
else:
176+
self.homeLocation = await self.client.fetch_world(self.homeLocation)
177+
else:
178+
self.homeLocation = None
169179

170180
# Wait for all cacheTasks
171181
if not self.homeLocation == None and self.client.caching:
172182
await self.homeLocation.cacheTask
173183

184+
174185
class Feature(o.Feature):
175186
pass
176187

188+
177189
class PastDisplayName(o.PastDisplayName):
178190
pass
179191

180-
## World
192+
# World
193+
181194

182195
class LimitedWorld(o.LimitedWorld):
183196
async def author(self):
184197
resp = await self.client.api.call("/users/"+self.authorId)
185198
return User(self.client, resp["data"])
186199

187200
async def favorite(self):
188-
resp = await self.client.api.call("/favorites", "POST", params={"type": types.FavoriteType.World,\
189-
"favoriteId": self.id})
201+
resp = await self.client.api.call("/favorites", "POST", params={"type": types.FavoriteType.World,
202+
"favoriteId": self.id})
190203
return Favorite(resp["data"])
191204

205+
192206
class World(o.World, LimitedWorld):
193207
async def author(self):
194208
resp = await super(LimitedWorld, self).author()
@@ -209,9 +223,11 @@ async def __cinit__(self):
209223

210224
self.instances = instances
211225

226+
212227
class Location(o.Location):
213228
pass
214229

230+
215231
class Instance(o.Instance):
216232
async def world(self):
217233
resp = await self.client.api.call("/worlds/"+self.worldId)
@@ -220,21 +236,25 @@ async def world(self):
220236
async def join(self):
221237
await self.client.api.call("/joins", "PUT", json={"worldId": self.location})
222238

223-
## unityPackage objects
239+
# unityPackage objects
240+
224241

225242
class UnityPackage(o.UnityPackage):
226243
pass
227244

228-
## Notification objects
245+
# Notification objects
246+
229247

230248
class Notification(o.Notification):
231249
pass
232250

251+
233252
class NotificationDetails(o.NotificationDetails):
234253
pass
235254

236255
# Misc
237256

257+
238258
class Favorite(o.Favorite):
239259
async def __cinit__(self):
240260
if self.type == types.FavoriteType.World:

0 commit comments

Comments
 (0)