Make PEP8 cleanup of line spaces and character distances as well as indents

This commit is contained in:
Griatch 2017-08-19 23:16:36 +02:00
parent 7ff783fea1
commit b278337172
189 changed files with 2039 additions and 1583 deletions

View file

@ -528,7 +528,7 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)):
"""
result = super(DefaultAccount, self).access(accessing_obj, access_type=access_type,
default=default, no_superuser_bypass=no_superuser_bypass)
default=default, no_superuser_bypass=no_superuser_bypass)
self.at_access(result, accessing_obj, access_type, **kwargs)
return result
@ -879,10 +879,10 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)):
result.append(nsess == 1 and "\n\n|wConnected session:|n" or "\n\n|wConnected sessions (%i):|n" % nsess)
for isess, sess in enumerate(sessions):
csessid = sess.sessid
addr = "%s (%s)" % (sess.protocol_key, isinstance(sess.address, tuple)
and str(sess.address[0]) or str(sess.address))
result.append("\n %s %s" % (session.sessid == csessid and "|w* %s|n" % (isess + 1)
or " %s" % (isess + 1), addr))
addr = "%s (%s)" % (sess.protocol_key, isinstance(sess.address, tuple) and
str(sess.address[0]) or str(sess.address))
result.append("\n %s %s" % (session.sessid == csessid and "|w* %s|n" % (isess + 1) or
" %s" % (isess + 1), addr))
result.append("\n\n |whelp|n - more commands")
result.append("\n |wooc <Text>|n - talk on public channel")
@ -928,6 +928,7 @@ class DefaultGuest(DefaultAccount):
This class is used for guest logins. Unlike Accounts, Guests and
their characters are deleted after disconnection.
"""
def at_post_login(self, session=None, **kwargs):
"""
In theory, guests only have one character regardless of which

View file

@ -155,7 +155,7 @@ class AccountInline(admin.StackedInline):
fieldsets = (
("In-game Permissions and Locks",
{'fields': ('db_lock_storage',),
#{'fields': ('db_permissions', 'db_lock_storage'),
#{'fields': ('db_permissions', 'db_lock_storage'),
'description': "<i>These are permissions/locks for in-game use. "
"They are unrelated to website access rights.</i>"}),
("In-game Account data",
@ -215,11 +215,11 @@ class AccountDBAdmin(BaseUserAdmin):
'db_lock_storage'),
'description': '<i>These are attributes that are more relevant '
'to gameplay.</i>'}))
# ('Game Options', {'fields': (
# 'db_typeclass_path', 'db_cmdset_storage',
# 'db_permissions', 'db_lock_storage'),
# 'description': '<i>These are attributes that are '
# 'more relevant to gameplay.</i>'}))
# ('Game Options', {'fields': (
# 'db_typeclass_path', 'db_cmdset_storage',
# 'db_permissions', 'db_lock_storage'),
# 'description': '<i>These are attributes that are '
# 'more relevant to gameplay.</i>'}))
add_fieldsets = (
(None,
@ -240,7 +240,7 @@ class AccountDBAdmin(BaseUserAdmin):
"""
obj.save()
if not change:
#calling hooks for new account
# calling hooks for new account
obj.set_class_from_typeclass(typeclass_path=settings.BASE_ACCOUNT_TYPECLASS)
obj.basetype_setup()
obj.at_account_creation()
@ -252,4 +252,5 @@ class AccountDBAdmin(BaseUserAdmin):
return HttpResponseRedirect(reverse("admin:accounts_accountdb_change", args=[obj.id]))
return HttpResponseRedirect(reverse("admin:accounts_accountdb_change", args=[obj.id]))
admin.site.register(AccountDB, AccountDBAdmin)

View file

@ -28,6 +28,7 @@ class BotStarter(DefaultScript):
into gear when it is initialized.
"""
def at_script_creation(self):
"""
Called once, when script is created.
@ -148,6 +149,7 @@ class IRCBot(Bot):
Bot for handling IRC connections.
"""
def start(self, ev_channel=None, irc_botname=None, irc_channel=None, irc_network=None, irc_port=None, irc_ssl=None):
"""
Start by telling the portal to start a new session.
@ -359,6 +361,7 @@ class RSSBot(Bot):
its feed at regular intervals.
"""
def start(self, ev_channel=None, rss_url=None, rss_rate=None):
"""
Start by telling the portal to start a new RSS session

View file

@ -38,6 +38,7 @@ class AccountDBManager(TypedObjectManager, UserManager):
#swap_character
"""
def num_total_accounts(self):
"""
Get total number of accounts.
@ -91,7 +92,7 @@ class AccountDBManager(TypedObjectManager, UserManager):
tdelta = datetime.timedelta(days)
start_date = end_date - tdelta
return self.filter(last_login__range=(
start_date, end_date)).order_by('-last_login')
start_date, end_date)).order_by('-last_login')
def get_account_from_email(self, uemail):
"""

View file

@ -3,12 +3,14 @@ from __future__ import unicode_literals
from django.db import models, migrations
def convert_defaults(apps, schema_editor):
AccountDB = apps.get_model("accounts", "AccountDB")
for account in AccountDB.objects.filter(db_typeclass_path="src.accounts.account.Account"):
account.db_typeclass_path = "typeclasses.accounts.Account"
account.save()
class Migration(migrations.Migration):
dependencies = [
@ -16,5 +18,5 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(convert_defaults),
migrations.RunPython(convert_defaults),
]

View file

@ -89,7 +89,7 @@ class AccountDB(TypedObject, AbstractUser):
help_text="If player is connected to game or not")
# database storage of persistant cmdsets.
db_cmdset_storage = models.CharField('cmdset', max_length=255, null=True,
help_text="optional python path to a cmdset class. If creating a Character, this will default to settings.CMDSET_CHARACTER.")
help_text="optional python path to a cmdset class. If creating a Character, this will default to settings.CMDSET_CHARACTER.")
# marks if this is a "virtual" bot account object
db_is_bot = models.BooleanField(default=False, verbose_name="is_bot", help_text="Used to identify irc/rss bots")