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

@ -97,18 +97,18 @@ class ObjectDBAdmin(admin.ModelAdmin):
form = ObjectEditForm
fieldsets = (
(None, {
'fields': (('db_key', 'db_typeclass_path'), ('db_lock_storage', ),
('db_location', 'db_home'), 'db_destination', 'db_cmdset_storage'
)}),
)
'fields': (('db_key', 'db_typeclass_path'), ('db_lock_storage', ),
('db_location', 'db_home'), 'db_destination', 'db_cmdset_storage'
)}),
)
add_form = ObjectCreateForm
add_fieldsets = (
(None, {
'fields': (('db_key', 'db_typeclass_path'),
('db_location', 'db_home'), 'db_destination', 'db_cmdset_storage'
)}),
)
'fields': (('db_key', 'db_typeclass_path'),
('db_location', 'db_home'), 'db_destination', 'db_cmdset_storage'
)}),
)
def get_fieldsets(self, request, obj=None):
"""

View file

@ -261,7 +261,7 @@ class ObjectDBManager(TypedObjectManager):
if exact:
# exact match - do direct search
return self.filter(cand_restriction & type_restriction & (Q(db_key__iexact=ostring) |
Q(db_tags__db_key__iexact=ostring) & Q(db_tags__db_tagtype__iexact="alias"))).distinct()
Q(db_tags__db_key__iexact=ostring) & Q(db_tags__db_tagtype__iexact="alias"))).distinct()
elif candidates:
# fuzzy with candidates
search_candidates = self.filter(cand_restriction & type_restriction)

View file

@ -3,12 +3,14 @@ from __future__ import unicode_literals
from django.db import models, migrations
def convert_defaults(apps, schema_editor):
ObjectDB = apps.get_model("objects", "ObjectDB")
for obj in ObjectDB.objects.filter(db_typeclass_path="src.objects.objects.Object"):
obj.db_typeclass_path = "typeclasses.objects.Object"
obj.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

@ -21,6 +21,7 @@ def forwards(apps, schema_editor):
object.db_account = account
object.save(update_fields=['db_account'])
class Migration(migrations.Migration):
dependencies = [

View file

@ -33,6 +33,7 @@ class ContentsHandler(object):
for object-cmdsets). It is stored on the 'contents_cache' property
of the ObjectDB.
"""
def __init__(self, obj):
"""
Sets up the contents handler.
@ -171,12 +172,12 @@ class ObjectDB(TypedObject):
# If this is a character object, the account is connected here.
db_account = models.ForeignKey("accounts.AccountDB", null=True, verbose_name='account', on_delete=models.SET_NULL,
help_text='an Account connected to this object, if any.')
help_text='an Account connected to this object, if any.')
# the session id associated with this account, if any
db_sessid = models.CharField(null=True, max_length=32, validators=[validate_comma_separated_integer_list],
verbose_name="session id",
help_text="csv list of session ids of connected Account, if any.")
verbose_name="session id",
help_text="csv list of session ids of connected Account, if any.")
# The location in the game world. Since this one is likely
# to change often, we set this with the 'location' property
# to transparently handle Typeclassing.

View file

@ -39,6 +39,7 @@ class ObjectSessionHandler(object):
Handles the get/setting of the sessid
comma-separated integer field
"""
def __init__(self, obj):
"""
Initializes the handler.
@ -1211,10 +1212,10 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
mapping = {}
mapping.update({
"object": self,
"exit": exits[0] if exits else "somwhere",
"origin": location or "nowhere",
"destination": destination or "nowhere",
"object": self,
"exit": exits[0] if exits else "somwhere",
"origin": location or "nowhere",
"destination": destination or "nowhere",
})
location.msg_contents(string, exclude=(self, ), mapping=mapping)
@ -1267,10 +1268,10 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
mapping = {}
mapping.update({
"object": self,
"exit": exits[0] if exits else "somewhere",
"origin": origin or "nowhere",
"destination": destination or "nowhere",
"object": self,
"exit": exits[0] if exits else "somewhere",
"origin": origin or "nowhere",
"destination": destination or "nowhere",
})
destination.msg_contents(string, exclude=(self, ), mapping=mapping)
@ -1630,20 +1631,20 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
mapping = mapping or {}
mapping.update({
"object": self,
"location": self.location,
"speech": message,
"receiver": receiver
})
"object": self,
"location": self.location,
"speech": message,
"receiver": receiver
})
if msg_self:
self_mapping = {k: v.get_display_name(self) if hasattr(
v, "get_display_name") else str(v) for k, v in mapping.items()}
v, "get_display_name") else str(v) for k, v in mapping.items()}
self.msg(msg_self.format(**self_mapping))
if receiver and msg_receiver:
receiver_mapping = {k: v.get_display_name(receiver) if hasattr(
v, "get_display_name") else str(v) for k, v in mapping.items()}
v, "get_display_name") else str(v) for k, v in mapping.items()}
receiver.msg(msg_receiver.format(**receiver_mapping))
if self.location and msg_location:
@ -1778,6 +1779,7 @@ class DefaultRoom(DefaultObject):
This is the base room object. It's just like any Object except its
location is always `None`.
"""
def basetype_setup(self):
"""
Simple room setup setting locks to make sure the room