Typo, whitespace, comments to PEP 8 comply
This commit is contained in:
parent
8b0232d610
commit
8700659097
1 changed files with 33 additions and 30 deletions
|
|
@ -134,6 +134,7 @@ def _get_prototype(dic, prot, protparents):
|
||||||
prot.pop("prototype", None) # we don't need this anymore
|
prot.pop("prototype", None) # we don't need this anymore
|
||||||
return prot
|
return prot
|
||||||
|
|
||||||
|
|
||||||
def _batch_create_object(*objparams):
|
def _batch_create_object(*objparams):
|
||||||
"""
|
"""
|
||||||
This is a cut-down version of the create_object() function,
|
This is a cut-down version of the create_object() function,
|
||||||
|
|
@ -141,7 +142,7 @@ def _batch_create_object(*objparams):
|
||||||
so make sure the spawned Typeclass works before using this!
|
so make sure the spawned Typeclass works before using this!
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
objsparams (any): Aach argument should be a tuple of arguments
|
objsparams (any): Each argument should be a tuple of arguments
|
||||||
for the respective creation/add handlers in the following
|
for the respective creation/add handlers in the following
|
||||||
order: (create, permissions, locks, aliases, nattributes,
|
order: (create, permissions, locks, aliases, nattributes,
|
||||||
attributes)
|
attributes)
|
||||||
|
|
@ -153,7 +154,7 @@ def _batch_create_object(*objparams):
|
||||||
# bulk create all objects in one go
|
# bulk create all objects in one go
|
||||||
|
|
||||||
# unfortunately this doesn't work since bulk_create doesn't creates pks;
|
# unfortunately this doesn't work since bulk_create doesn't creates pks;
|
||||||
# the result are double objects at the next stage
|
# the result are database objects at the next stage
|
||||||
# dbobjs = _ObjectDB.objects.bulk_create(dbobjs)
|
# dbobjs = _ObjectDB.objects.bulk_create(dbobjs)
|
||||||
|
|
||||||
dbobjs = [ObjectDB(**objparam[0]) for objparam in objparams]
|
dbobjs = [ObjectDB(**objparam[0]) for objparam in objparams]
|
||||||
|
|
@ -201,8 +202,8 @@ def spawn(*prototypes, **kwargs):
|
||||||
if not protmodules and hasattr(settings, "PROTOTYPE_MODULES"):
|
if not protmodules and hasattr(settings, "PROTOTYPE_MODULES"):
|
||||||
protmodules = make_iter(settings.PROTOTYPE_MODULES)
|
protmodules = make_iter(settings.PROTOTYPE_MODULES)
|
||||||
for prototype_module in protmodules:
|
for prototype_module in protmodules:
|
||||||
protparents.update(dict((key, val)
|
protparents.update(dict((key, val) for key, val in
|
||||||
for key, val in all_from_module(prototype_module).items() if isinstance(val, dict)))
|
all_from_module(prototype_module).items() if isinstance(val, dict)))
|
||||||
# overload module's protparents with specifically given protparents
|
# overload module's protparents with specifically given protparents
|
||||||
protparents.update(kwargs.get("prototype_parents", {}))
|
protparents.update(kwargs.get("prototype_parents", {}))
|
||||||
for key, prototype in protparents.items():
|
for key, prototype in protparents.items():
|
||||||
|
|
@ -300,4 +301,6 @@ if __name__ == "__main__":
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# test
|
# test
|
||||||
print([o.key for o in spawn(protparents["GOBLIN"], protparents["GOBLIN_ARCHWIZARD"], prototype_parents=protparents)])
|
print([o.key for o in spawn(protparents["GOBLIN"],
|
||||||
|
protparents["GOBLIN_ARCHWIZARD"],
|
||||||
|
prototype_parents=protparents)])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue