mirror of
https://github.com/evennia/evennia.git
synced 2026-03-27 18:26:32 +01:00
minor PEP 8 whitespace, docstring, comment edits
This commit is contained in:
parent
0af6f2498e
commit
dd8468aab6
1 changed files with 13 additions and 16 deletions
|
|
@ -32,8 +32,9 @@ from django.utils.translation import ugettext as _
|
|||
|
||||
# Handlers for Session.db/ndb operation
|
||||
|
||||
|
||||
class NDbHolder(object):
|
||||
"Holder for allowing property access of attributes"
|
||||
"""Holder for allowing property access of attributes"""
|
||||
def __init__(self, obj, name, manager_name='attributes'):
|
||||
_SA(self, name, _GA(obj, manager_name))
|
||||
_SA(self, 'name', name)
|
||||
|
|
@ -145,9 +146,9 @@ class NAttributeHandler(object):
|
|||
return [key for key in self._store if not key.startswith("_")]
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
# -------------------------------------------------------------
|
||||
# Server Session
|
||||
#------------------------------------------------------------
|
||||
# -------------------------------------------------------------
|
||||
|
||||
class ServerSession(Session):
|
||||
"""
|
||||
|
|
@ -160,7 +161,7 @@ class ServerSession(Session):
|
|||
|
||||
"""
|
||||
def __init__(self):
|
||||
"Initiate to avoid AttributeErrors down the line"
|
||||
"""Initiate to avoid AttributeErrors down the line"""
|
||||
self.puppet = None
|
||||
self.player = None
|
||||
self.cmdset_storage_string = ""
|
||||
|
|
@ -203,7 +204,7 @@ class ServerSession(Session):
|
|||
obj.player = self.player
|
||||
self.puid = obj.id
|
||||
self.puppet = obj
|
||||
#obj.scripts.validate()
|
||||
# obj.scripts.validate()
|
||||
obj.locks.cache_lock_bypass(obj)
|
||||
|
||||
def at_login(self, player):
|
||||
|
|
@ -264,7 +265,6 @@ class ServerSession(Session):
|
|||
MONITOR_HANDLER.remove(player, "_saved_webclient_options",
|
||||
self.sessid)
|
||||
|
||||
|
||||
def get_player(self):
|
||||
"""
|
||||
Get the player associated with this session
|
||||
|
|
@ -364,7 +364,6 @@ class ServerSession(Session):
|
|||
self.protocol_flags.update(kwargs)
|
||||
self.sessionhandler.session_portal_sync(self)
|
||||
|
||||
|
||||
def data_out(self, **kwargs):
|
||||
"""
|
||||
Sending data from Evennia->Client
|
||||
|
|
@ -437,7 +436,7 @@ class ServerSession(Session):
|
|||
self.sessionhandler.data_in(self, **kwargs)
|
||||
|
||||
def __eq__(self, other):
|
||||
"Handle session comparisons"
|
||||
"""Handle session comparisons"""
|
||||
try:
|
||||
return self.address == other.address
|
||||
except AttributeError:
|
||||
|
|
@ -462,11 +461,9 @@ class ServerSession(Session):
|
|||
return "%s%s@%s" % (self.uname, symbol, address)
|
||||
|
||||
def __unicode__(self):
|
||||
"Unicode representation"
|
||||
"""Unicode representation"""
|
||||
return u"%s" % str(self)
|
||||
|
||||
|
||||
|
||||
# Dummy API hooks for use during non-loggedin operation
|
||||
|
||||
def at_cmdset_get(self, **kwargs):
|
||||
|
|
@ -488,7 +485,7 @@ class ServerSession(Session):
|
|||
def attributes(self):
|
||||
return self.nattributes
|
||||
|
||||
#@property
|
||||
# @property
|
||||
def ndb_get(self):
|
||||
"""
|
||||
A non-persistent store (ndb: NonDataBase). Everything stored
|
||||
|
|
@ -503,7 +500,7 @@ class ServerSession(Session):
|
|||
self._ndb_holder = NDbHolder(self, "nattrhandler", manager_name="nattributes")
|
||||
return self._ndb_holder
|
||||
|
||||
#@ndb.setter
|
||||
# @ndb.setter
|
||||
def ndb_set(self, value):
|
||||
"""
|
||||
Stop accidentally replacing the db object
|
||||
|
|
@ -516,9 +513,9 @@ class ServerSession(Session):
|
|||
string += "Use ndb.attr=value instead."
|
||||
raise Exception(string)
|
||||
|
||||
#@ndb.deleter
|
||||
# @ndb.deleter
|
||||
def ndb_del(self):
|
||||
"Stop accidental deletion."
|
||||
"""Stop accidental deletion."""
|
||||
raise Exception("Cannot delete the ndb object!")
|
||||
ndb = property(ndb_get, ndb_set, ndb_del)
|
||||
db = property(ndb_get, ndb_set, ndb_del)
|
||||
|
|
@ -526,5 +523,5 @@ class ServerSession(Session):
|
|||
# Mock access method for the session (there is no lock info
|
||||
# at this stage, so we just present a uniform API)
|
||||
def access(self, *args, **kwargs):
|
||||
"Dummy method to mimic the logged-in API."
|
||||
"""Dummy method to mimic the logged-in API."""
|
||||
return True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue