Skip to content

Commit 77a82cb

Browse files
refactor: cleaner code
Co-authored-by: Christian Clauss <[email protected]>
1 parent ce38298 commit 77a82cb

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

sc2reader/objects.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,8 @@ def __init__(self, uid, init_data):
291291
#: 2. The user has a None value for their 'scaled_rating' key, or
292292
#: 3. The user has a negative rating, often -36400.
293293
#: For ease of use, this property will return None in both cases.
294-
if (
295-
"scaled_rating" in init_data
296-
and init_data["scaled_rating"] is not None
297-
and init_data["scaled_rating"] > 0
298-
):
299-
self.mmr = init_data["scaled_rating"]
300-
else:
301-
self.mmr = None
294+
mmr = int(init_data.get("scaled_rating") or 0)
295+
self.mmr = mmr if mmr > 0 else None
302296

303297
@property
304298
def url(self):

0 commit comments

Comments
 (0)