Things look slightly more legit...

This commit is contained in:
Jeppe Klitgaard 2015-04-06 15:27:42 +02:00
parent eef23e2023
commit fde8286e7e
3 changed files with 9 additions and 6 deletions

View File

@ -18,7 +18,7 @@ class Profile(object):
See: `<http://wiki.vg/Authentication>`_
"""
def __init__(self, id_=None, name=None):
self.id = id_
self.id_ = id_
self.name = name
def to_dict(self):
@ -26,13 +26,13 @@ class Profile(object):
Returns ``self`` in dictionary-form, which can be serialized by json.
"""
if self:
return {"id": self.id,
return {"id": self.id_,
"name": self.name}
else:
raise AttributeError("Profile is not yet populated.")
def __bool__(self):
bool_state = self.id is not None and self.name is not None
bool_state = self.id_ is not None and self.name is not None
return bool_state
# Python 2 support
@ -121,7 +121,7 @@ class AuthenticationToken(object):
self.username = username
self.access_token = json_resp["accessToken"]
self.client_token = json_resp["clientToken"]
self.profile.id = json_resp["selectedProfile"]["id"]
self.profile.id_ = json_resp["selectedProfile"]["id"]
self.profile.name = json_resp["selectedProfile"]["name"]
return True

View File

@ -11,9 +11,9 @@ both Python2 and Python3 while using the same codebase.
# Hi, I'm pylint, and sometimes I act silly, at which point my programmer
# overlords need to correct me.
# pylint: disable=undefined-variable
# pylint: disable=undefined-variable,redefined-builtin,invalid-name
try:
input = raw_input
except NameError:
pass
# pylint: enable=undefined-variable
# pylint: enable=undefined-variable,redefined-builtin,invalid-name

View File

@ -0,0 +1,3 @@
"""
Contains the networking code for `pyminecraft`.
"""