Ran black on sources
This commit is contained in:
parent
5e5f3efc24
commit
db17ece61b
4 changed files with 73 additions and 45 deletions
|
|
@ -484,7 +484,7 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager):
|
|||
if max_dbref is not None:
|
||||
retval = retval.filter(id__lte=self.dbref(max_dbref, reqhash=False))
|
||||
return retval
|
||||
|
||||
|
||||
def get_typeclass_totals(self, *args, **kwargs) -> object:
|
||||
"""
|
||||
Returns a queryset of typeclass composition statistics.
|
||||
|
|
@ -495,18 +495,24 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager):
|
|||
the percentage of objects associated with the typeclass.
|
||||
|
||||
"""
|
||||
return self.values('db_typeclass_path').distinct().annotate(
|
||||
# Get count of how many objects for each typeclass exist
|
||||
count=Count('db_typeclass_path')
|
||||
).annotate(
|
||||
# Rename db_typeclass_path field to something more human
|
||||
typeclass=F('db_typeclass_path'),
|
||||
# Calculate this class' percentage of total composition
|
||||
percent=ExpressionWrapper(
|
||||
((F('count') / float(self.count())) * 100.0), output_field=FloatField()
|
||||
),
|
||||
).values('typeclass', 'count', 'percent')
|
||||
|
||||
return (
|
||||
self.values("db_typeclass_path")
|
||||
.distinct()
|
||||
.annotate(
|
||||
# Get count of how many objects for each typeclass exist
|
||||
count=Count("db_typeclass_path")
|
||||
)
|
||||
.annotate(
|
||||
# Rename db_typeclass_path field to something more human
|
||||
typeclass=F("db_typeclass_path"),
|
||||
# Calculate this class' percentage of total composition
|
||||
percent=ExpressionWrapper(
|
||||
((F("count") / float(self.count())) * 100.0), output_field=FloatField()
|
||||
),
|
||||
)
|
||||
.values("typeclass", "count", "percent")
|
||||
)
|
||||
|
||||
def object_totals(self):
|
||||
"""
|
||||
Get info about database statistics.
|
||||
|
|
@ -518,8 +524,8 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager):
|
|||
object having that typeclass set on themselves).
|
||||
|
||||
"""
|
||||
stats = self.get_typeclass_totals().order_by('typeclass')
|
||||
return {x.get('typeclass'):x.get('count') for x in stats}
|
||||
stats = self.get_typeclass_totals().order_by("typeclass")
|
||||
return {x.get("typeclass"): x.get("count") for x in stats}
|
||||
|
||||
def typeclass_search(self, typeclass, include_children=False, include_parents=False):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue